Skip to content

fix: ddx init now creates complete .ddx directory structure#21

Open
mehdipiraee wants to merge 3 commits intoeasel:mainfrom
mehdipiraee:fix/ddx-init-create-directory-structure
Open

fix: ddx init now creates complete .ddx directory structure#21
mehdipiraee wants to merge 3 commits intoeasel:mainfrom
mehdipiraee:fix/ddx-init-create-directory-structure

Conversation

@mehdipiraee
Copy link

Summary

Fixes the initialization bug where ddx init only created .ddx.yml but not the .ddx/ directory, causing all subsequent DDx commands to fail with "not initialized" errors.

Problem

After running ddx init, users would see:

  • ddx diagnose → "Initialization: ✗ Not initialized"
  • ddx update → "❌ Not in a DDx project. Run 'ddx init' first."
  • ddx contribute → "❌ Not in a DDx project. Run 'ddx init' first."

This happened because isInitialized() checks for the .ddx/ directory:

func isInitialized() bool {
    _, err := os.Stat(".ddx")
    return err == nil
}

But ddx init only created .ddx.yml, not .ddx/ directory.

Solution

Modified ddx init to create the complete directory structure as documented in README:

your-project/
├── .ddx/
│   ├── prompts/        # AI prompts and instructions
│   ├── templates/      # Project and file templates
│   ├── patterns/       # Reusable code patterns
│   └── configs/        # Tool configurations
└── .ddx.yml           # DDX configuration

Changes

  • Added code to create required subdirectories in .ddx/:
    • prompts/ - AI prompts and instructions
    • templates/ - Project and file templates
    • patterns/ - Reusable code patterns
    • configs/ - Tool configurations
  • Improved error handling for directory creation
  • Added clear comments explaining the purpose

Testing

Before Fix:

ddx init
ddx diagnose  # Showed "Initialization: ✗ Not initialized"

After Fix:

ddx init
ls -la .ddx/  # Shows prompts/ templates/ patterns/ configs/
ddx diagnose  # Shows "Initialization: ✓ Initialized" ✅
ddx update    # No longer shows "not initialized" error ✅

Verification

  • ddx init creates complete directory structure
  • ddx diagnose shows "Initialization: ✓ Initialized"
  • ddx update recognizes project as initialized
  • ddx contribute recognizes project as initialized
  • Directory structure matches README documentation
  • Clean test environment confirms fix works

Files Changed

  • cli/cmd/init.go - Added directory structure creation

Resolves #20

🤖 Generated with Claude Code

Mehdi Piraee and others added 3 commits September 25, 2025 21:16
The installation URLs were pointing to ddx-tools/ddx which returns 404.
Updated all references to use the correct repository easel/ddx.

Files updated:
- README.md: Fixed installation commands and repository references
- docs/SETUP_GUIDE.md: Fixed installation URLs and GitHub links

This resolves the 404 error users encounter when trying to install DDx.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Found and fixed all remaining incorrect repository references throughout:

Documentation files (7):
- docs/helix/02-design/architecture.md
- docs/helix/02-design/contracts/CLI-001-core-commands.md
- docs/helix/02-design/contracts/CLI-002-sync-commands.md
- docs/helix/02-design/contracts/CLI-003-utility-commands.md
- docs/helix/02-design/data-design.md
- docs/helix/02-design/deployment.md
- docs/helix/02-design/solution-designs/SD-002-upstream-synchronization.md

Go source files (6):
- cli/cmd/contribute.go
- cli/cmd/e2e_test.go
- cli/cmd/sync_acceptance_test.go
- cli/cmd/sync_contract_test.go
- cli/cmd/test_harness.go
- cli/cmd/uninstall.go

This completes the comprehensive fix for all 404-causing URL references
throughout the entire codebase.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Resolves issue where ddx init only created .ddx.yml but not the .ddx/
directory, causing isInitialized() to return false and all subsequent
commands to fail with "not initialized" errors.

Changes:
- ddx init now creates .ddx/ directory with required subdirectories:
  - .ddx/prompts/   (AI prompts and instructions)
  - .ddx/templates/ (Project and file templates)
  - .ddx/patterns/  (Reusable code patterns)
  - .ddx/configs/   (Tool configurations)

This matches the expected structure documented in README Local-First Architecture.

Testing:
- Verified ddx init creates complete directory structure
- Verified ddx diagnose now shows "Initialization: ✓ Initialized"
- Verified ddx update no longer shows "not initialized" error
- All commands that use isInitialized() now work correctly

Fixes easel#20

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: ddx init does not create required .ddx directory structure

1 participant