worktrees 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. checksums.yaml +7 -0
  2. data/.claude/commands/plan.md +42 -0
  3. data/.claude/commands/specify.md +12 -0
  4. data/.claude/commands/tasks.md +60 -0
  5. data/.cursor/commands/plan.md +42 -0
  6. data/.cursor/commands/specify.md +12 -0
  7. data/.cursor/commands/tasks.md +60 -0
  8. data/.cursor/rules +81 -0
  9. data/.specify/memory/constitution-v1.0.1-formal.md +90 -0
  10. data/.specify/memory/constitution.md +153 -0
  11. data/.specify/memory/constitution_update_checklist.md +88 -0
  12. data/.specify/scripts/bash/check-task-prerequisites.sh +15 -0
  13. data/.specify/scripts/bash/common.sh +37 -0
  14. data/.specify/scripts/bash/create-new-feature.sh +58 -0
  15. data/.specify/scripts/bash/get-feature-paths.sh +7 -0
  16. data/.specify/scripts/bash/setup-plan.sh +17 -0
  17. data/.specify/scripts/bash/update-agent-context.sh +57 -0
  18. data/.specify/templates/agent-file-template.md +23 -0
  19. data/.specify/templates/plan-template.md +254 -0
  20. data/.specify/templates/spec-template.md +116 -0
  21. data/.specify/templates/tasks-template.md +152 -0
  22. data/CLAUDE.md +145 -0
  23. data/Gemfile +15 -0
  24. data/Gemfile.lock +150 -0
  25. data/README.md +163 -0
  26. data/Rakefile +52 -0
  27. data/exe/worktrees +52 -0
  28. data/lib/worktrees/cli.rb +36 -0
  29. data/lib/worktrees/commands/create.rb +74 -0
  30. data/lib/worktrees/commands/list.rb +87 -0
  31. data/lib/worktrees/commands/remove.rb +62 -0
  32. data/lib/worktrees/commands/status.rb +95 -0
  33. data/lib/worktrees/commands/switch.rb +57 -0
  34. data/lib/worktrees/git_operations.rb +106 -0
  35. data/lib/worktrees/models/feature_worktree.rb +92 -0
  36. data/lib/worktrees/models/repository.rb +75 -0
  37. data/lib/worktrees/models/worktree_config.rb +74 -0
  38. data/lib/worktrees/version.rb +5 -0
  39. data/lib/worktrees/worktree_manager.rb +238 -0
  40. data/lib/worktrees.rb +27 -0
  41. data/specs/001-build-a-tool/GEMINI.md +20 -0
  42. data/specs/001-build-a-tool/contracts/cli-contracts.md +43 -0
  43. data/specs/001-build-a-tool/contracts/openapi.yaml +135 -0
  44. data/specs/001-build-a-tool/data-model.md +51 -0
  45. data/specs/001-build-a-tool/plan.md +241 -0
  46. data/specs/001-build-a-tool/quickstart.md +67 -0
  47. data/specs/001-build-a-tool/research.md +76 -0
  48. data/specs/001-build-a-tool/spec.md +153 -0
  49. data/specs/001-build-a-tool/tasks.md +209 -0
  50. metadata +138 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7c0973aeb2135810ab165544d4bdb82a16b234fba3a3c17504d9650ac964a069
4
+ data.tar.gz: e98633f2e3c2eb6952fe1bbe811398cc5a34d33edb0b8f6dd9ddb7dfa51ad2b6
5
+ SHA512:
6
+ metadata.gz: 692b7d2cbb11df4e8707c8bd6dfd397908d5e5f41b161ab44e90aa521e07afbf80a3eab9dd6b25bc711a4db4b18f4c46fac906fab01722a2e510ea55b178da3c
7
+ data.tar.gz: a8b6939c381effd8dd72ad59caa41ff0d59d2022bbf1aa2dd40080b3365ea83650e7e4708e6e24b613ac92dceb25311e98b9c6a3d4b550cbcf1cbac57a5adefe
@@ -0,0 +1,42 @@
1
+ ---
2
+ description: Execute the implementation planning workflow using the plan template to generate design artifacts.
3
+ ---
4
+
5
+ Given the implementation details provided as an argument, do this:
6
+
7
+ 1. Run `.specify/scripts/bash/setup-plan.sh --json` from the repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. All future file paths must be absolute.
8
+ 2. Read and analyze the feature specification to understand:
9
+ - The feature requirements and user stories
10
+ - Functional and non-functional requirements
11
+ - Success criteria and acceptance criteria
12
+ - Any technical constraints or dependencies mentioned
13
+
14
+ 3. Read my personal principles at `.specify/memory/constitution.md` to understand my approach:
15
+ - Ruby First: Choose Ruby because it makes me productive and happy
16
+ - Simple Over Clever: Code I can understand in six months
17
+ - Test-Driven Development is Fundamental: Write tests first, always
18
+
19
+ 4. Execute the implementation plan template:
20
+ - Load `.specify/templates/plan-template.md` (already copied to IMPL_PLAN path)
21
+ - Set Input path to FEATURE_SPEC
22
+ - Run the Execution Flow (main) function steps 1-10
23
+ - The template is self-contained and executable
24
+ - Follow error handling and gate checks as specified
25
+ - Let the template guide artifact generation in $SPECS_DIR:
26
+ * Phase 0 generates research.md
27
+ * Phase 1 generates data-model.md, contracts/, quickstart.md
28
+ * Phase 2 generates tasks.md
29
+ - Incorporate user-provided details from arguments into Technical Context: $ARGUMENTS
30
+ - **IMPORTANT**: Validate against personal principles in Development Principles Check
31
+ - For CLIs: Start with Ruby + dry-cli unless there's a specific reason not to
32
+ - Remember: "Life's too short for verbose languages when building personal tools"
33
+ - Update Progress Tracking as you complete each phase
34
+
35
+ 5. Verify execution completed:
36
+ - Check Progress Tracking shows all phases complete
37
+ - Ensure all required artifacts were generated
38
+ - Confirm no ERROR states in execution
39
+
40
+ 6. Report results with branch name, file paths, and generated artifacts.
41
+
42
+ Use absolute paths with the repository root for all file operations to avoid path issues.
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: Create or update the feature specification from a natural language feature description.
3
+ ---
4
+
5
+ Given the feature description provided as an argument, do this:
6
+
7
+ 1. Run the script `.specify/scripts/bash/create-new-feature.sh --json "$ARGUMENTS"` from repo root and parse its JSON output for BRANCH_NAME and SPEC_FILE. All file paths must be absolute.
8
+ 2. Load `.specify/templates/spec-template.md` to understand required sections.
9
+ 3. Write the specification to SPEC_FILE using the template structure, replacing placeholders with concrete details derived from the feature description (arguments) while preserving section order and headings.
10
+ 4. Report completion with branch name, spec file path, and readiness for the next phase.
11
+
12
+ Note: The script creates and checks out the new branch and initializes the spec file before writing.
@@ -0,0 +1,60 @@
1
+ ---
2
+ description: Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.
3
+ ---
4
+
5
+ Given the context provided as an argument, do this:
6
+
7
+ 1. Run `.specify/scripts/bash/check-task-prerequisites.sh --json` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute.
8
+ 2. Load and analyze available design documents:
9
+ - Always read plan.md for tech stack and libraries
10
+ - IF EXISTS: Read data-model.md for entities
11
+ - IF EXISTS: Read contracts/ for API endpoints
12
+ - IF EXISTS: Read research.md for technical decisions
13
+ - IF EXISTS: Read quickstart.md for test scenarios
14
+
15
+ Note: Not all projects have all documents. For example:
16
+ - CLI tools might not have contracts/
17
+ - Simple libraries might not need data-model.md
18
+ - Generate tasks based on what's available
19
+
20
+ 3. Generate tasks following the template:
21
+ - Use `.specify/templates/tasks-template.md` as the base
22
+ - Replace example tasks with actual tasks based on:
23
+ * **Setup tasks**: Project init, dependencies, linting
24
+ * **Ruby CLI Setup**: Gemfile, RSpec config, dry-cli setup (if Ruby detected)
25
+ * **Test tasks [P]**: Aruba feature tests, RSpec unit tests (Ruby), contract tests
26
+ * **Core tasks**: CLI commands, business logic modules (Simple Over Clever approach)
27
+ * **Integration tasks**: Real git operations, error handling, logging
28
+ * **Polish tasks [P]**: Unit tests, performance, docs
29
+
30
+ 4. Task generation rules:
31
+ - Each contract file → contract test task marked [P]
32
+ - Each entity in data-model → model creation task marked [P]
33
+ - Each CLI command → dry-cli command class task marked [P] (Ruby)
34
+ - Each user story → Aruba integration test marked [P] (Ruby)
35
+ - Different files = can be parallel [P]
36
+ - Same file = sequential (no [P])
37
+ - **IMPORTANT**: Tests MUST be created before implementation (Test-Driven Development is Fundamental)
38
+
39
+ 5. Order tasks by dependencies:
40
+ - Setup before everything
41
+ - Tests before implementation (TDD)
42
+ - Models before services
43
+ - Services before endpoints
44
+ - Core before integration
45
+ - Everything before polish
46
+
47
+ 6. Include parallel execution examples:
48
+ - Group [P] tasks that can run together
49
+ - Show actual Task agent commands
50
+
51
+ 7. Create FEATURE_DIR/tasks.md with:
52
+ - Correct feature name from implementation plan
53
+ - Numbered tasks (T001, T002, etc.)
54
+ - Clear file paths for each task
55
+ - Dependency notes
56
+ - Parallel execution guidance
57
+
58
+ Context for task generation: $ARGUMENTS
59
+
60
+ The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context.
@@ -0,0 +1,42 @@
1
+ ---
2
+ description: Execute the implementation planning workflow using the plan template to generate design artifacts.
3
+ ---
4
+
5
+ Given the implementation details provided as an argument, do this:
6
+
7
+ 1. Run `.specify/scripts/bash/setup-plan.sh --json` from the repo root and parse JSON for FEATURE_SPEC, IMPL_PLAN, SPECS_DIR, BRANCH. All future file paths must be absolute.
8
+ 2. Read and analyze the feature specification to understand:
9
+ - The feature requirements and user stories
10
+ - Functional and non-functional requirements
11
+ - Success criteria and acceptance criteria
12
+ - Any technical constraints or dependencies mentioned
13
+
14
+ 3. Read my personal principles at `.specify/memory/constitution.md` to understand my approach:
15
+ - Ruby First: Choose Ruby because it makes me productive and happy
16
+ - Simple Over Clever: Code I can understand in six months
17
+ - Test-Driven Development is Fundamental: Write tests first, always
18
+
19
+ 4. Execute the implementation plan template:
20
+ - Load `.specify/templates/plan-template.md` (already copied to IMPL_PLAN path)
21
+ - Set Input path to FEATURE_SPEC
22
+ - Run the Execution Flow (main) function steps 1-10
23
+ - The template is self-contained and executable
24
+ - Follow error handling and gate checks as specified
25
+ - Let the template guide artifact generation in $SPECS_DIR:
26
+ * Phase 0 generates research.md
27
+ * Phase 1 generates data-model.md, contracts/, quickstart.md
28
+ * Phase 2 generates tasks.md
29
+ - Incorporate user-provided details from arguments into Technical Context: $ARGUMENTS
30
+ - **IMPORTANT**: Validate against personal principles in Development Principles Check
31
+ - For CLIs: Start with Ruby + dry-cli unless there's a specific reason not to
32
+ - Remember: "Life's too short for verbose languages when building personal tools"
33
+ - Update Progress Tracking as you complete each phase
34
+
35
+ 5. Verify execution completed:
36
+ - Check Progress Tracking shows all phases complete
37
+ - Ensure all required artifacts were generated
38
+ - Confirm no ERROR states in execution
39
+
40
+ 6. Report results with branch name, file paths, and generated artifacts.
41
+
42
+ Use absolute paths with the repository root for all file operations to avoid path issues.
@@ -0,0 +1,12 @@
1
+ ---
2
+ description: Create or update the feature specification from a natural language feature description.
3
+ ---
4
+
5
+ Given the feature description provided as an argument, do this:
6
+
7
+ 1. Run the script `.specify/scripts/bash/create-new-feature.sh --json "$ARGUMENTS"` from repo root and parse its JSON output for BRANCH_NAME and SPEC_FILE. All file paths must be absolute.
8
+ 2. Load `.specify/templates/spec-template.md` to understand required sections.
9
+ 3. Write the specification to SPEC_FILE using the template structure, replacing placeholders with concrete details derived from the feature description (arguments) while preserving section order and headings.
10
+ 4. Report completion with branch name, spec file path, and readiness for the next phase.
11
+
12
+ Note: The script creates and checks out the new branch and initializes the spec file before writing.
@@ -0,0 +1,60 @@
1
+ ---
2
+ description: Generate an actionable, dependency-ordered tasks.md for the feature based on available design artifacts.
3
+ ---
4
+
5
+ Given the context provided as an argument, do this:
6
+
7
+ 1. Run `.specify/scripts/bash/check-task-prerequisites.sh --json` from repo root and parse FEATURE_DIR and AVAILABLE_DOCS list. All paths must be absolute.
8
+ 2. Load and analyze available design documents:
9
+ - Always read plan.md for tech stack and libraries
10
+ - IF EXISTS: Read data-model.md for entities
11
+ - IF EXISTS: Read contracts/ for API endpoints
12
+ - IF EXISTS: Read research.md for technical decisions
13
+ - IF EXISTS: Read quickstart.md for test scenarios
14
+
15
+ Note: Not all projects have all documents. For example:
16
+ - CLI tools might not have contracts/
17
+ - Simple libraries might not need data-model.md
18
+ - Generate tasks based on what's available
19
+
20
+ 3. Generate tasks following the template:
21
+ - Use `.specify/templates/tasks-template.md` as the base
22
+ - Replace example tasks with actual tasks based on:
23
+ * **Setup tasks**: Project init, dependencies, linting
24
+ * **Ruby CLI Setup**: Gemfile, RSpec config, dry-cli setup (if Ruby detected)
25
+ * **Test tasks [P]**: Aruba feature tests, RSpec unit tests (Ruby), contract tests
26
+ * **Core tasks**: CLI commands, business logic modules (Simple Over Clever approach)
27
+ * **Integration tasks**: Real git operations, error handling, logging
28
+ * **Polish tasks [P]**: Unit tests, performance, docs
29
+
30
+ 4. Task generation rules:
31
+ - Each contract file → contract test task marked [P]
32
+ - Each entity in data-model → model creation task marked [P]
33
+ - Each CLI command → dry-cli command class task marked [P] (Ruby)
34
+ - Each user story → Aruba integration test marked [P] (Ruby)
35
+ - Different files = can be parallel [P]
36
+ - Same file = sequential (no [P])
37
+ - **IMPORTANT**: Tests MUST be created before implementation (Test-Driven Development is Fundamental)
38
+
39
+ 5. Order tasks by dependencies:
40
+ - Setup before everything
41
+ - Tests before implementation (TDD)
42
+ - Models before services
43
+ - Services before endpoints
44
+ - Core before integration
45
+ - Everything before polish
46
+
47
+ 6. Include parallel execution examples:
48
+ - Group [P] tasks that can run together
49
+ - Show actual Task agent commands
50
+
51
+ 7. Create FEATURE_DIR/tasks.md with:
52
+ - Correct feature name from implementation plan
53
+ - Numbered tasks (T001, T002, etc.)
54
+ - Clear file paths for each task
55
+ - Dependency notes
56
+ - Parallel execution guidance
57
+
58
+ Context for task generation: $ARGUMENTS
59
+
60
+ The tasks.md should be immediately executable - each task must be specific enough that an LLM can complete it without additional context.
data/.cursor/rules ADDED
@@ -0,0 +1,81 @@
1
+ # Cursor IDE Development Guidelines - Worktrees Project
2
+
3
+ This project follows my personal development principles defined in `.specify/memory/constitution.md` for Ruby CLI development.
4
+
5
+ ## My Technology Choices
6
+ - Ruby 3.2+ with dry-cli framework (Ruby First principle)
7
+ - RSpec + Aruba for testing (no mocks - use real git repositories)
8
+ - lib/ + exe/ structure (Simple Over Clever)
9
+ - Focus on clear, maintainable code I can understand in six months
10
+
11
+ ## File Structure
12
+ ```
13
+ lib/worktrees/ # Business logic modules
14
+ ├── cli.rb # Main CLI application
15
+ ├── commands/ # Command classes (dry-cli)
16
+ └── git_operations.rb # Core business logic
17
+
18
+ exe/worktrees # CLI entry point
19
+ spec/ # Tests
20
+ ├── lib/ # Unit tests (RSpec)
21
+ └── features/ # Integration tests (Aruba)
22
+ ```
23
+
24
+ ## My Development Approach
25
+
26
+ ### Test-Driven Development is Fundamental
27
+ - Write failing test FIRST (Red-Green-Refactor cycle)
28
+ - Make it pass with minimal code (Simple Over Clever)
29
+ - Refactor only when tests are green (Write It Like I'll Maintain It)
30
+ - Use real git repositories, never mocks (test real behavior)
31
+ - Aruba for CLI integration tests, RSpec for unit tests
32
+
33
+ ### What I've Learned to Avoid
34
+ - Service layers in CLI tools (unnecessary complexity)
35
+ - Auto-initialization on require (causes side effects)
36
+ - Global state mutations (pass data explicitly)
37
+ - Clever abstractions I won't understand later
38
+
39
+ ### User Experience That Actually Helps
40
+ - Clear error messages with actionable guidance
41
+ - Consistent exit codes: 0=success, 1=error, 2=validation, 3=precondition
42
+ - Support --help, --version, --format json/text on all commands
43
+ - Show progress for long operations, handle Ctrl+C gracefully
44
+
45
+ ## What I Learned from the Bash Attempt
46
+ This project started in bash but I discovered service layers don't belong in CLI tools. Ruby gives me:
47
+ - Natural module system (no source conflicts)
48
+ - Explicit initialization (no auto-magic side effects)
49
+ - Clear testing boundaries with RSpec and Aruba
50
+ - Code I can actually maintain
51
+
52
+ The bash attempt taught me to Start Simple and choose tools that make me productive rather than fighting the language.
53
+
54
+ ## Current Implementation Status ✅
55
+
56
+ ### Planning Complete (2025-09-15)
57
+ 1. ✅ **Implementation plan** - Ruby CLI architecture designed
58
+ 2. ✅ **Task breakdown** - 35 TDD tasks ready (T001-T035 in specs/001-build-a-tool/tasks.md)
59
+ 3. **Ready for execution** - Start with T001 (project structure setup)
60
+
61
+ ### Recent Technology Decisions
62
+ - **Git Integration**: Shell out to git commands (canonical interface, no library abstractions)
63
+ - **Worktree Storage**: Global `~/.worktrees/` directory (separate from main repositories)
64
+ - **Error Handling**: Structured exit codes (0=success, 1=general, 2=validation, 3=precondition)
65
+ - **Configuration**: Command args override environment vars override config files
66
+ - **Naming Convention**: Enforce NNN-kebab-feature format with validation
67
+ - **Safety**: Conservative dirty-state policies (allow switch with warning, block unsafe removal)
68
+
69
+ ### Architecture Overview
70
+ **Core Models**: FeatureWorktree, Repository, WorktreeManager, GitOperations
71
+ **CLI Commands**: create, list, switch, remove, status (5 commands total)
72
+ **Testing Strategy**: Aruba integration tests + RSpec unit tests (real git repos, no mocks)
73
+
74
+ ### Next Steps
75
+ Execute tasks T001-T035 following Red-Green-Refactor methodology:
76
+ - T001-T007: Project setup (Ruby structure, Gemfile, RSpec+Aruba config)
77
+ - T008-T023: Test-first development (write failing tests)
78
+ - T024-T035: Implementation (make tests pass)
79
+
80
+ ---
81
+ *Based on Personal Principles v2.0.0*
@@ -0,0 +1,90 @@
1
+ # Worktrees Constitution
2
+
3
+ ## Core Principles
4
+
5
+ ### I. Technology Appropriateness
6
+ Choose implementation language based on tool complexity and maintenance needs:
7
+ - Simple scripts (<100 lines): Bash with minimal structure
8
+ - Multi-command CLIs: Ruby (dry-cli), Python (Click), or Go (Cobra)
9
+ - Service layers only when multiple consumers exist (API + CLI + Web)
10
+ - Study similar successful tools (git, docker, rbenv) for patterns
11
+
12
+ ### II. Library-First Architecture
13
+ Every feature must be implemented as a standalone library first:
14
+ - Libraries must be self-contained and independently testable
15
+ - CLI layer only handles argument parsing and output formatting
16
+ - Business logic lives in libraries, not CLI layer
17
+ - Clear separation between presentation and logic
18
+
19
+ ### III. Test-First Development (NON-NEGOTIABLE)
20
+ Strict TDD Red-Green-Refactor cycle:
21
+ - Tests written first and must fail before implementation
22
+ - Ruby: RSpec for unit tests, Aruba for CLI integration tests
23
+ - Use real dependencies (actual git repos, not mocks)
24
+ - Test order: Contract → Integration → Unit
25
+ - No implementation without failing test first
26
+
27
+ ### IV. Simplicity and Maintainability
28
+ Start with simplest architecture that could possibly work:
29
+ - Maximum 2 architectural layers for CLI tools (commands + libraries)
30
+ - No design patterns without demonstrated need
31
+ - Avoid premature abstraction
32
+ - YAGNI (You Aren't Gonna Need It) principle applies
33
+ - Refactor only when tests are green
34
+
35
+ ### V. Observability and Debugging
36
+ All tools must be observable and debuggable:
37
+ - Structured logging to stderr
38
+ - Verbose mode (-v, --verbose) for debugging
39
+ - Clear error messages with actionable next steps
40
+ - JSON output for programmatic consumption
41
+
42
+ ### VI. Consistent User Experience
43
+ All CLI tools in our ecosystem follow same patterns:
44
+ - --help and --version flags on all commands
45
+ - --format json/text for output control
46
+ - Consistent exit codes (0=success, 1=general, 2=validation, 3=precondition)
47
+ - Predictable command structure: noun-verb or verb-noun
48
+
49
+ ## Implementation Standards
50
+
51
+ ### For Ruby CLI Tools
52
+ - Framework: dry-cli (consistent, well-tested, minimal magic)
53
+ - Testing: RSpec + Aruba (standard in Ruby ecosystem)
54
+ - Structure: lib/ for logic, exe/ for CLI entry point
55
+ - Dependencies: Bundler for management, minimal external gems
56
+
57
+ ### Anti-Patterns to Avoid
58
+ - Service layers in CLI tools (unnecessary abstraction)
59
+ - Auto-initialization on require/source (causes side effects)
60
+ - Mock-heavy tests (use real dependencies instead)
61
+ - Deep inheritance hierarchies (composition over inheritance)
62
+ - Global state mutations (pass data explicitly)
63
+
64
+ ## Development Workflow
65
+
66
+ ### Planning Process
67
+ - Constitution defines technology choices and architectural principles
68
+ - /plan command reads constitution to generate appropriate architecture
69
+ - /tasks command reads plan to generate implementation tasks
70
+ - Implementation follows tasks in TDD order
71
+
72
+ ### Quality Gates
73
+ - All tests must pass before merging
74
+ - Code review must verify constitutional compliance
75
+ - No implementation without failing test first
76
+ - Complexity must be justified in plan documentation
77
+
78
+ ## Governance
79
+ - Constitution supersedes all design decisions
80
+ - Amendments require documentation of rationale
81
+ - Each project must reference this constitution in its README
82
+ - Plan and task generation must comply with these principles
83
+
84
+ **Version**: 1.0.1 | **Ratified**: 2025-01-15 | **Last Amended**: 2025-01-15
85
+
86
+ ## Amendment History
87
+ - v1.0.1 (2025-01-15): Added template synchronization for Ruby CLI implementation
88
+ - Updated all templates to enforce constitutional principles
89
+ - Added Ruby-specific guidance and anti-patterns
90
+ - Synchronized command files across AI assistants
@@ -0,0 +1,153 @@
1
+ # Personal CLI Tools Development Principles
2
+
3
+ ## My Philosophy
4
+
5
+ These are my core principles for building CLI tools that I actually want to use and maintain. They help me create tools that solve real problems without becoming problems themselves.
6
+
7
+ ---
8
+
9
+ ## Core Values
10
+
11
+ ### Ruby First
12
+ **I choose Ruby because it makes me productive and happy.** Life's too short for verbose languages when I'm building personal tools. Ruby lets me focus on solving problems instead of fighting syntax.
13
+
14
+ ### Simple Over Clever
15
+ **I prefer code I can understand in six months.** Clever one-liners are fun, but clear, readable code is a gift to my future self. When I need to debug at 2 AM, I'll thank myself for writing obvious code.
16
+
17
+ ### Libraries Over NIH Syndrome
18
+ **I use proven libraries instead of reinventing wheels.** The Ruby ecosystem has solved most problems better than I could in an evening. My time is better spent on the unique parts of my problem.
19
+
20
+ ---
21
+
22
+ ## Building Principles
23
+
24
+ ### Start Simple, Grow Thoughtfully
25
+ **Every tool starts as a simple script.** I only add complexity when I actually need it, not when I think I might. Features that aren't used are just maintenance burden.
26
+
27
+ ### Test-Driven Development is Fundamental
28
+ **I write tests first, always.** TDD isn't academic ceremony - it's the fastest way to build CLI tools that actually work. Starting with tests forces me to think about the interface before getting lost in implementation details.
29
+
30
+ **I test real behavior over mocked abstractions.** CLI tools live at integration boundaries - file systems, networks, databases. Testing against real dependencies catches the problems that actually break tools in production use.
31
+
32
+ **I prioritize integration testing for CLI tools.** Unit tests verify logic; integration tests verify that my tool works in the real world with real files, real services, and real edge cases.
33
+
34
+ ### Fail Gracefully
35
+ **Things go wrong, so I plan for it.** Good error messages help me debug faster. Reasonable defaults mean my tools work without fiddling. Validation catches problems early.
36
+
37
+ ---
38
+
39
+ ## Security Basics
40
+
41
+ ### Trust Nothing External
42
+ **I validate all inputs and avoid shell injection.** Using `system('ls', user_input)` instead of `system("ls #{user_input}")` prevents nasty surprises. It's a simple habit that prevents major headaches.
43
+
44
+ ### Keep Secrets Secret
45
+ **No passwords or API keys in code.** Environment variables or config files that stay out of git. My future self will thank me when I don't accidentally leak credentials.
46
+
47
+ ### Stay Updated
48
+ **I keep dependencies current and use tools like `bundle audit`.** Security vulnerabilities are real, and staying patched is easier than dealing with breaches.
49
+
50
+ ---
51
+
52
+ ## User Experience (Even When the User Is Me)
53
+
54
+ ### Help That Actually Helps
55
+ **My tools explain themselves clearly.** Good help text, clear error messages, and examples for common usage. If I can't remember how to use my own tool, it needs better help.
56
+
57
+ ### Consistent and Predictable
58
+ **I follow CLI conventions people expect.** Standard flags, consistent output formats, and behavior that matches other tools. Fighting muscle memory is annoying.
59
+
60
+ ### Show Progress, Handle Interruption
61
+ **Long operations show progress and handle Ctrl+C gracefully.** Nothing worse than wondering if a tool hung or is just slow.
62
+
63
+ ---
64
+
65
+ ## Quality Habits
66
+
67
+ ### Red-Green-Refactor is My Default Workflow
68
+ **I start every feature with a failing test.** Write the test, watch it fail (red), make it pass with minimal code (green), then clean up (refactor). This cycle keeps me focused and prevents over-engineering.
69
+
70
+ **I test the CLI interface, not just the internals.** Aruba tests how users actually interact with my tool. Unit tests for complex logic, Aruba scenarios for user workflows, test-containers for integration points.
71
+
72
+ ### Write It Like I'll Maintain It
73
+ **Because I will.** Clear naming, reasonable comments, and structure that makes sense. Code is communication with my future self.
74
+
75
+ ### Measure What Matters
76
+ **I know how my tools perform on real data.** If it's slow, I measure before optimizing. Premature optimization is the root of all evil, but so is ignoring real performance problems.
77
+
78
+ ### Document the Why
79
+ **I capture decisions and trade-offs.** A simple README with examples and any non-obvious choices. Six months later, I'll have forgotten why I did things a certain way.
80
+
81
+ ### Test Coverage That Actually Matters
82
+ **I focus on testing behavior that users care about.** High line coverage of trivial code is meaningless. Testing that my tool correctly handles malformed input and provides helpful errors is essential.
83
+
84
+ **Integration tests catch the bugs that matter most.** CLI tools fail at boundaries - file handling, external APIs, system integration. I test these integration points with real dependencies, not simulation.
85
+
86
+ ---
87
+
88
+ ## Practical Guidelines
89
+
90
+ ### Testing Philosophy Guides Tool Choice
91
+ **I choose testing tools that validate real CLI behavior.** Tools that test actual command execution and real dependencies reveal problems that matter. Mocking frameworks have their place, but CLI testing demands reality-based validation.
92
+
93
+ **I test happy paths AND edge cases.** What happens when files don't exist? When network calls fail? When users pass malformed input? Edge case testing prevents 2 AM debugging sessions.
94
+
95
+ ### Configuration That Works
96
+ **Command-line args override environment variables override config files.** This gives me flexibility without confusion. Reasonable defaults mean most tools work out of the box.
97
+
98
+ ### One Thing Well
99
+ **Each tool has a clear, focused purpose.** If I'm tempted to add unrelated features, maybe I need a separate tool. Unix philosophy scales down to personal tools too.
100
+
101
+ ### Build for Change
102
+ **I assume requirements will evolve.** Modular design and clear interfaces make adaptation easier. Today's quick script might become tomorrow's essential tool.
103
+
104
+ ---
105
+
106
+ ## Personal Development Rules
107
+
108
+ ### Learn by Building
109
+ **I try new patterns and libraries in personal tools.** It's a safe place to experiment before using techniques in important projects. Mistakes here are learning opportunities.
110
+
111
+ ### Share What Works
112
+ **If I build something useful, I consider sharing it.** Open source gives back to the community that provides the libraries I depend on. Plus, external users find bugs I miss.
113
+
114
+ ### Evolve Standards
115
+ **These principles change as I learn.** What works for me now might not work forever. I update my approach based on what I learn from successes and failures.
116
+
117
+ ---
118
+
119
+ ## Implementation Freedom
120
+
121
+ **These are principles, not rules.** They guide decisions but don't replace thinking. Sometimes the right choice breaks a principle - that's fine if I understand why.
122
+
123
+ **Context matters.** A quick one-off script has different needs than a tool I'll use daily. I scale my effort to match the tool's importance and lifespan.
124
+
125
+ **Done is better than perfect.** These principles help me build better tools, not perfect ones. The goal is solving problems, not following rules.
126
+
127
+ ---
128
+
129
+ ## Why This Matters
130
+
131
+ Building personal tools with TDD and sound principles means:
132
+ - **Faster development** - tests catch mistakes immediately instead of during late-night debugging sessions
133
+ - **Fearless refactoring** - comprehensive tests enable confident code improvement
134
+ - **Real confidence** - tools tested against actual behavior work reliably in real conditions
135
+ - **Better learning** - TDD develops design skills that transfer to every project
136
+ - **Genuine productivity** - tools that work correctly under real conditions
137
+
138
+ **TDD for personal tools isn't overkill - it's self-respect.** My time is valuable, and spending it debugging preventable issues is wasteful. Testing first means tools work correctly from day one.
139
+
140
+ **Testing real behavior prevents surprises.** CLI tools live at integration boundaries. Testing with real files, real services, and real edge cases catches the problems that actually matter.
141
+
142
+ Good habits in small projects build the muscle memory for larger ones. Plus, life's more enjoyable when my tools work reliably and I can trust them completely.
143
+
144
+ ---
145
+
146
+ **Version**: 2.0.0 | **Adopted**: 2025-01-15
147
+
148
+ ## Version History
149
+ - v2.0.0 (2025-01-15): Replaced formal constitution with personal principles
150
+ - Shifted from enterprise patterns to personal development philosophy
151
+ - Simplified language and removed unnecessary formality
152
+ - Focused on Ruby-first, TDD, and practical simplicity
153
+ - v1.0.1 (2025-01-15): [Archived] Formal constitution with enterprise patterns
@@ -0,0 +1,88 @@
1
+ # Constitution Update Checklist
2
+
3
+ When amending the constitution (`/memory/constitution.md`), ensure all dependent documents are updated to maintain consistency.
4
+
5
+ ## Templates to Update
6
+
7
+ ### When adding/modifying ANY article:
8
+ - [ ] `/templates/plan-template.md` - Update Constitution Check section
9
+ - [ ] `/templates/spec-template.md` - Update if requirements/scope affected
10
+ - [ ] `/templates/tasks-template.md` - Update if new task types needed
11
+ - [ ] `/.claude/commands/plan.md` - Update if planning process changes
12
+ - [ ] `/.claude/commands/tasks.md` - Update if task generation affected
13
+ - [ ] `/CLAUDE.md` - Update runtime development guidelines
14
+ - [ ] `/.cursor/commands/plan.md` - Update if planning process changes
15
+ - [ ] `/.cursor/commands/tasks.md` - Update if task generation affected
16
+ - [ ] `/.cursor/rules` - Update runtime development guidelines
17
+
18
+ ### Article-specific updates:
19
+
20
+ #### Article I (Library-First):
21
+ - [ ] Ensure templates emphasize library creation
22
+ - [ ] Update CLI command examples
23
+ - [ ] Add llms.txt documentation requirements
24
+
25
+ #### Article II (CLI Interface):
26
+ - [ ] Update CLI flag requirements in templates
27
+ - [ ] Add text I/O protocol reminders
28
+
29
+ #### Article III (Test-First):
30
+ - [ ] Update test order in all templates
31
+ - [ ] Emphasize TDD requirements
32
+ - [ ] Add test approval gates
33
+
34
+ #### Article IV (Integration Testing):
35
+ - [ ] List integration test triggers
36
+ - [ ] Update test type priorities
37
+ - [ ] Add real dependency requirements
38
+
39
+ #### Article V (Observability):
40
+ - [ ] Add logging requirements to templates
41
+ - [ ] Include multi-tier log streaming
42
+ - [ ] Update performance monitoring sections
43
+
44
+ #### Article VI (Versioning):
45
+ - [ ] Add version increment reminders
46
+ - [ ] Include breaking change procedures
47
+ - [ ] Update migration requirements
48
+
49
+ #### Article VII (Simplicity):
50
+ - [ ] Update project count limits
51
+ - [ ] Add pattern prohibition examples
52
+ - [ ] Include YAGNI reminders
53
+
54
+ ## Validation Steps
55
+
56
+ 1. **Before committing constitution changes:**
57
+ - [ ] All templates reference new requirements
58
+ - [ ] Examples updated to match new rules
59
+ - [ ] No contradictions between documents
60
+
61
+ 2. **After updating templates:**
62
+ - [ ] Run through a sample implementation plan
63
+ - [ ] Verify all constitution requirements addressed
64
+ - [ ] Check that templates are self-contained (readable without constitution)
65
+
66
+ 3. **Version tracking:**
67
+ - [ ] Update constitution version number
68
+ - [ ] Note version in template footers
69
+ - [ ] Add amendment to constitution history
70
+
71
+ ## Common Misses
72
+
73
+ Watch for these often-forgotten updates:
74
+ - Command documentation (`/commands/*.md`)
75
+ - Checklist items in templates
76
+ - Example code/commands
77
+ - Domain-specific variations (web vs mobile vs CLI)
78
+ - Cross-references between documents
79
+
80
+ ## Template Sync Status
81
+
82
+ Last sync check: 2025-07-16
83
+ - Constitution version: 2.1.1
84
+ - Templates aligned: ❌ (missing versioning, observability details)
85
+
86
+ ---
87
+
88
+ *This checklist ensures the constitution's principles are consistently applied across all project documentation.*