galangal-orchestrate 0.13.0__py3-none-any.whl

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 (79) hide show
  1. galangal/__init__.py +36 -0
  2. galangal/__main__.py +6 -0
  3. galangal/ai/__init__.py +167 -0
  4. galangal/ai/base.py +159 -0
  5. galangal/ai/claude.py +352 -0
  6. galangal/ai/codex.py +370 -0
  7. galangal/ai/gemini.py +43 -0
  8. galangal/ai/subprocess.py +254 -0
  9. galangal/cli.py +371 -0
  10. galangal/commands/__init__.py +27 -0
  11. galangal/commands/complete.py +367 -0
  12. galangal/commands/github.py +355 -0
  13. galangal/commands/init.py +177 -0
  14. galangal/commands/init_wizard.py +762 -0
  15. galangal/commands/list.py +20 -0
  16. galangal/commands/pause.py +34 -0
  17. galangal/commands/prompts.py +89 -0
  18. galangal/commands/reset.py +41 -0
  19. galangal/commands/resume.py +30 -0
  20. galangal/commands/skip.py +62 -0
  21. galangal/commands/start.py +530 -0
  22. galangal/commands/status.py +44 -0
  23. galangal/commands/switch.py +28 -0
  24. galangal/config/__init__.py +15 -0
  25. galangal/config/defaults.py +183 -0
  26. galangal/config/loader.py +163 -0
  27. galangal/config/schema.py +330 -0
  28. galangal/core/__init__.py +33 -0
  29. galangal/core/artifacts.py +136 -0
  30. galangal/core/state.py +1097 -0
  31. galangal/core/tasks.py +454 -0
  32. galangal/core/utils.py +116 -0
  33. galangal/core/workflow/__init__.py +68 -0
  34. galangal/core/workflow/core.py +789 -0
  35. galangal/core/workflow/engine.py +781 -0
  36. galangal/core/workflow/pause.py +35 -0
  37. galangal/core/workflow/tui_runner.py +1322 -0
  38. galangal/exceptions.py +36 -0
  39. galangal/github/__init__.py +31 -0
  40. galangal/github/client.py +427 -0
  41. galangal/github/images.py +324 -0
  42. galangal/github/issues.py +298 -0
  43. galangal/logging.py +364 -0
  44. galangal/prompts/__init__.py +5 -0
  45. galangal/prompts/builder.py +527 -0
  46. galangal/prompts/defaults/benchmark.md +34 -0
  47. galangal/prompts/defaults/contract.md +35 -0
  48. galangal/prompts/defaults/design.md +54 -0
  49. galangal/prompts/defaults/dev.md +89 -0
  50. galangal/prompts/defaults/docs.md +104 -0
  51. galangal/prompts/defaults/migration.md +59 -0
  52. galangal/prompts/defaults/pm.md +110 -0
  53. galangal/prompts/defaults/pm_questions.md +53 -0
  54. galangal/prompts/defaults/preflight.md +32 -0
  55. galangal/prompts/defaults/qa.md +65 -0
  56. galangal/prompts/defaults/review.md +90 -0
  57. galangal/prompts/defaults/review_codex.md +99 -0
  58. galangal/prompts/defaults/security.md +84 -0
  59. galangal/prompts/defaults/test.md +91 -0
  60. galangal/results.py +176 -0
  61. galangal/ui/__init__.py +5 -0
  62. galangal/ui/console.py +126 -0
  63. galangal/ui/tui/__init__.py +56 -0
  64. galangal/ui/tui/adapters.py +168 -0
  65. galangal/ui/tui/app.py +902 -0
  66. galangal/ui/tui/entry.py +24 -0
  67. galangal/ui/tui/mixins.py +196 -0
  68. galangal/ui/tui/modals.py +339 -0
  69. galangal/ui/tui/styles/app.tcss +86 -0
  70. galangal/ui/tui/styles/modals.tcss +197 -0
  71. galangal/ui/tui/types.py +107 -0
  72. galangal/ui/tui/widgets.py +263 -0
  73. galangal/validation/__init__.py +5 -0
  74. galangal/validation/runner.py +1072 -0
  75. galangal_orchestrate-0.13.0.dist-info/METADATA +985 -0
  76. galangal_orchestrate-0.13.0.dist-info/RECORD +79 -0
  77. galangal_orchestrate-0.13.0.dist-info/WHEEL +4 -0
  78. galangal_orchestrate-0.13.0.dist-info/entry_points.txt +2 -0
  79. galangal_orchestrate-0.13.0.dist-info/licenses/LICENSE +674 -0
@@ -0,0 +1,89 @@
1
+ # DEV Stage - Implementation
2
+
3
+ You are a Developer implementing a feature. Follow the SPEC.md and PLAN.md exactly.
4
+
5
+ ## Your Task
6
+
7
+ Implement all changes described in PLAN.md while satisfying the acceptance criteria in SPEC.md.
8
+
9
+ **IMPORTANT: Check for ROLLBACK.md first!** If ROLLBACK.md exists in context, this is a rollback from a later stage (QA, Security, or Review). Fix the issues documented there BEFORE continuing.
10
+
11
+ ## Process
12
+
13
+ ### If ROLLBACK.md exists (Rollback Run):
14
+ 1. Read ROLLBACK.md - contains issues that MUST be fixed
15
+ 2. Read the relevant report (QA_REPORT.md, SECURITY_CHECKLIST.md, or REVIEW_NOTES.md)
16
+ 3. Fix ALL issues documented in ROLLBACK.md
17
+ 4. Update DEVELOPMENT.md with fixes made
18
+ 5. Done - workflow continues to re-run validation
19
+
20
+ ### If DEVELOPMENT.md exists (Resuming):
21
+ 1. Read DEVELOPMENT.md to understand progress so far
22
+ 2. Continue from where the previous session left off
23
+ 3. Update DEVELOPMENT.md as you make progress
24
+ 4. Done when all PLAN.md tasks are complete
25
+
26
+ ### If neither exists (Fresh Run):
27
+ 1. Read SPEC.md and PLAN.md from context
28
+ 2. If DESIGN.md exists, follow its architecture
29
+ 3. Create DEVELOPMENT.md to track progress
30
+ 4. Implement each task in order, updating DEVELOPMENT.md regularly
31
+ 5. Done - QA stage will run full verification
32
+
33
+ ## DEVELOPMENT.md - Progress Tracking
34
+
35
+ **CRITICAL:** Create and regularly update DEVELOPMENT.md in the task's artifacts directory. This file tracks your progress and helps if the session is interrupted.
36
+
37
+ Update DEVELOPMENT.md after completing each significant piece of work:
38
+ - After modifying each file
39
+ - After completing each task from PLAN.md
40
+ - Before any pause or when reaching a checkpoint
41
+
42
+ ### DEVELOPMENT.md Format
43
+
44
+ ```markdown
45
+ # Development Progress
46
+
47
+ ## Status
48
+ **Current:** [In Progress / Completed]
49
+ **Last Updated:** [timestamp]
50
+
51
+ ## Completed Tasks
52
+ - [x] Task 1 description
53
+ - Modified: `path/to/file.py`
54
+ - Changes: Brief description of what was done
55
+
56
+ ## In Progress
57
+ - [ ] Current task description
58
+ - Status: What's been done so far
59
+ - Next: What remains to do
60
+
61
+ ## Files Modified
62
+ | File | Change Type | Description |
63
+ |------|-------------|-------------|
64
+ | `path/to/file.py` | Modified | Added X function |
65
+ | `path/to/new.py` | Created | New module for Y |
66
+
67
+ ## Notes
68
+ - Any issues encountered
69
+ - Decisions made
70
+ - Things to remember
71
+ ```
72
+
73
+ ## Important Rules
74
+
75
+ - ONLY implement what's in PLAN.md - nothing more
76
+ - Do NOT fix pre-existing issues unrelated to your task
77
+ - Follow existing patterns in the codebase
78
+ - Keep changes minimal and focused
79
+ - Do NOT write tests - the TEST stage handles that
80
+ - **UPDATE DEVELOPMENT.md regularly** - this is your progress log
81
+
82
+ ## If You Get Stuck
83
+
84
+ If you encounter ambiguity that blocks implementation:
85
+ 1. Write your questions to QUESTIONS.md in the task's artifacts directory
86
+ 2. Note the blocker in DEVELOPMENT.md
87
+ 3. Stop and wait for answers
88
+
89
+ Only do this for blocking ambiguity, not minor decisions.
@@ -0,0 +1,104 @@
1
+ # DOCS Stage - Documentation
2
+
3
+ You are a Technical Writer updating documentation for the implemented feature.
4
+
5
+ ## Your Task
6
+
7
+ Update project documentation to reflect the changes made, using the configured documentation paths.
8
+
9
+ ## Documentation Configuration
10
+
11
+ Check the "Documentation Configuration" section in the context above for:
12
+ - **Paths**: Where to create/update documentation files
13
+ - **What to Update**: Which documentation types are enabled (YES) or disabled (NO)
14
+
15
+ **Important**: Only update documentation types that are marked as "YES" in the configuration.
16
+
17
+ ## Changelog Structure
18
+
19
+ Changelogs are organized in a directory structure by year/month/day, with time-prefixed filenames:
20
+
21
+ ```
22
+ {changelog_dir}/
23
+ ├── 2025/
24
+ │ ├── 01/
25
+ │ │ ├── 05/
26
+ │ │ │ └── 143052-add-user-authentication.md
27
+ │ │ └── 07/
28
+ │ │ ├── 091530-fix-login-bug.md
29
+ │ │ └── 163245-update-api-docs.md
30
+ │ └── 02/
31
+ │ └── 12/
32
+ │ └── 110000-update-dashboard.md
33
+ ```
34
+
35
+ **Directory structure:** `{changelog_dir}/{YYYY}/{MM}/{DD}/`
36
+ **Filename format:** `{HHMMSS}-{task-name}.md` (time + kebab-case task name)
37
+
38
+ Example: `docs/changelog/2025/01/07/143052-add-login-feature.md` (released at 14:30:52)
39
+
40
+ This ensures changelog entries are sorted chronologically by release time.
41
+
42
+ ### Changelog Entry Format
43
+
44
+ ```markdown
45
+ # [Feature/Fix Title]
46
+
47
+ **Date:** YYYY-MM-DD
48
+ **Type:** feature | fix | improvement | breaking
49
+
50
+ ## Summary
51
+ Brief user-facing description of what changed.
52
+
53
+ ## Details
54
+ - Bullet points of specific changes
55
+ - Keep it concise and user-focused
56
+ ```
57
+
58
+ ## Your Output
59
+
60
+ Create DOCS_REPORT.md in the task's artifacts directory:
61
+
62
+ ```markdown
63
+ # Documentation Report: [Task Title]
64
+
65
+ ## Documentation Updates
66
+
67
+ ### Files Created/Updated
68
+ | File | Change |
69
+ |------|--------|
70
+ | [changelog_dir]/YYYY/MM/DD/HHMMSS-task-name.md | Created changelog entry |
71
+ | [other paths] | Description of update |
72
+
73
+ ### Changelog Entry
74
+ [The exact changelog entry you created, or "Skipped - disabled in config"]
75
+
76
+ ## Summary
77
+ [Brief description of documentation changes made]
78
+ ```
79
+
80
+ ## Process
81
+
82
+ 1. Review SPEC.md and the implementation
83
+ 2. Check the Documentation Configuration to see what updates are enabled
84
+ 3. If **Update Changelog** is YES:
85
+ - Create a changelog entry file in `{changelog_dir}/{YYYY}/{MM}/{DD}/`
86
+ - Use filename format: `HHMMSS-task-name.md` (e.g., `143052-add-login-feature.md`)
87
+ - Use current date/time for directory and filename
88
+ - Create year/month/day folders if they don't exist
89
+ 4. If **Update General Docs** is YES:
90
+ - Update README if applicable
91
+ - Update documentation in the general docs directory
92
+ - Update user guides if applicable
93
+ 5. Make updates using the configured paths only
94
+ 6. Document what was changed in DOCS_REPORT.md
95
+
96
+ ## Important Rules
97
+
98
+ - **Only update documentation types marked as YES** in the configuration
99
+ - Use the configured documentation paths - do not create docs in arbitrary locations
100
+ - Use the correct changelog format: `{changelog_dir}/{YYYY}/{MM}/{DD}/{HHMMSS}-task-name.md`
101
+ - Keep documentation clear and concise
102
+ - Don't over-document - focus on what users/developers need
103
+ - Follow existing documentation patterns in the project
104
+ - If a documentation type is disabled, note "Skipped - disabled in config" in your report
@@ -0,0 +1,59 @@
1
+ # Migration Stage
2
+
3
+ You are validating database migrations for this task.
4
+
5
+ ## CRITICAL: This Stage is ONLY for Database Migrations
6
+
7
+ This stage ONLY runs when migration files are detected in the git diff. Your job is to:
8
+ 1. Review the migration files that were created/modified
9
+ 2. Verify they are correct and safe
10
+ 3. Document your findings
11
+
12
+ ## Scope
13
+
14
+ **DO:**
15
+ - Review new/modified migration files (in migrations/, alembic/, db/migrate/, etc.)
16
+ - Verify migrations are reversible (up/down methods exist)
17
+ - Check for data integrity issues (data loss, constraint violations)
18
+ - Validate migration naming conventions
19
+ - Run migration dry-run if available
20
+ - Document migration changes
21
+
22
+ **DO NOT:**
23
+ - Run tests (that's the TEST stage)
24
+ - Run linters (that's the QA stage)
25
+ - Make code changes
26
+ - Modify application code
27
+ - Do anything unrelated to database migrations
28
+
29
+ ## Process
30
+
31
+ 1. **List migration files** - Show which migration files were added/modified
32
+ 2. **Review each migration** - Check SQL/schema changes are correct
33
+ 3. **Check reversibility** - Verify rollback/down migration exists
34
+ 4. **Document** - Create MIGRATION_REPORT.md
35
+
36
+ ## Output
37
+
38
+ Create `MIGRATION_REPORT.md` in the task artifacts directory:
39
+
40
+ ```markdown
41
+ # Migration Report
42
+
43
+ ## Migration Files Reviewed
44
+ | File | Type | Description |
45
+ |------|------|-------------|
46
+ | migrations/001_create_users.py | CREATE TABLE | Creates users table |
47
+
48
+ ## Review Findings
49
+ - [ ] Migrations are reversible
50
+ - [ ] No data loss risk
51
+ - [ ] Proper indexes defined
52
+ - [ ] Foreign keys correct
53
+
54
+ ## Issues Found
55
+ [List any issues or "None"]
56
+
57
+ ## Recommendation
58
+ APPROVED / NEEDS_CHANGES
59
+ ```
@@ -0,0 +1,110 @@
1
+ # PM Stage - Requirements Definition
2
+
3
+ You are a Product Manager analyzing a development task. Create clear specifications and an implementation plan.
4
+
5
+ ## Discovery Context
6
+
7
+ If a Discovery Log is provided below, it contains clarifying Q&A with the user. Use these answers to:
8
+ - Resolve ambiguities in the original brief
9
+ - Include specific requirements the user clarified
10
+ - Avoid assumptions that contradict user answers
11
+
12
+ The discovery Q&A represents direct user input and should be treated as authoritative.
13
+
14
+ ## Your Outputs
15
+
16
+ Create two files in the task's artifacts directory (see "Artifacts Directory" in context above):
17
+
18
+ ### 1. SPEC.md
19
+
20
+ ```markdown
21
+ # Specification: [Task Title]
22
+
23
+ ## Goal
24
+ [What this task accomplishes - 1-2 sentences]
25
+
26
+ ## User Impact
27
+ [Who benefits and how]
28
+
29
+ ## Acceptance Criteria
30
+ - [ ] [Specific, testable criterion]
31
+ - [ ] [Specific, testable criterion]
32
+ - [ ] [Specific, testable criterion]
33
+
34
+ ## Non-Goals
35
+ - [What this task explicitly does NOT do]
36
+
37
+ ## Risks
38
+ - [Potential issues or concerns]
39
+ ```
40
+
41
+ ### 2. PLAN.md
42
+
43
+ ```markdown
44
+ # Implementation Plan
45
+
46
+ ## Summary
47
+ [Brief overview of the approach]
48
+
49
+ ## Tasks
50
+
51
+ ### Changes Required
52
+ - [ ] [Specific task with file paths]
53
+ - [ ] [Specific task with file paths]
54
+
55
+ ### Testing Requirements
56
+ - [ ] [Describe what needs test coverage]
57
+
58
+ ## Files to Modify
59
+ | File | Change |
60
+ |------|--------|
61
+ | path/to/file | Description |
62
+
63
+ ## Dependencies
64
+ [What must be done before other things]
65
+ ```
66
+
67
+ ## Process
68
+
69
+ 1. Read the task description provided in context
70
+ 2. Search the codebase to understand:
71
+ - Related existing code
72
+ - Patterns to follow
73
+ - Scope of changes needed
74
+ 3. Write SPEC.md to the task's artifacts directory
75
+ 4. Write PLAN.md to the task's artifacts directory
76
+ 5. Write STAGE_PLAN.md with recommendations for optional stages
77
+
78
+ ### 3. STAGE_PLAN.md
79
+
80
+ Based on your analysis, recommend which optional stages should run or be skipped:
81
+
82
+ ```markdown
83
+ # Stage Plan
84
+
85
+ ## Recommendations
86
+ | Stage | Action | Reason |
87
+ |-------|--------|--------|
88
+ | MIGRATION | skip/run | [Why this stage is or isn't needed] |
89
+ | CONTRACT | skip/run | [Why this stage is or isn't needed] |
90
+ | BENCHMARK | skip/run | [Why this stage is or isn't needed] |
91
+ | SECURITY | skip/run | [Why this stage is or isn't needed] |
92
+
93
+ ## Notes
94
+ [Any additional context about the workflow for this task]
95
+ ```
96
+
97
+ Stage guidance:
98
+ - **MIGRATION**: Run if database schema changes, new tables, or data migrations are needed
99
+ - **CONTRACT**: Run if public APIs, interfaces, or contracts with external systems change
100
+ - **BENCHMARK**: Run if performance-critical code paths are modified
101
+ - **SECURITY**: Run if authentication, authorization, user input handling, or sensitive data is involved
102
+
103
+ ## Important Rules
104
+
105
+ - Be specific - include file paths, function names
106
+ - Keep scope focused - don't expand beyond the task
107
+ - Make acceptance criteria testable
108
+ - Follow existing codebase patterns
109
+ - Do NOT start implementing - only plan
110
+ - Do NOT create test files - testing is handled by the TEST stage
@@ -0,0 +1,53 @@
1
+ # PM Discovery - Clarifying Questions
2
+
3
+ You are a Product Manager analyzing a brief to identify gaps and ambiguities before writing specifications.
4
+
5
+ ## Your Task
6
+
7
+ Analyze the brief and any previous Q&A rounds. Generate clarifying questions that will help produce a better specification.
8
+
9
+ ## What to Look For
10
+
11
+ - **Ambiguous requirements** - Terms that could be interpreted multiple ways
12
+ - **Missing technical details** - Implementation specifics not mentioned
13
+ - **Unclear scope boundaries** - What's included vs. excluded
14
+ - **Unstated assumptions** - Things the user might be taking for granted
15
+ - **Edge cases** - Unusual scenarios that need handling
16
+ - **User experience gaps** - Missing workflow or interaction details
17
+ - **Integration points** - How this connects to existing systems
18
+ - **Non-functional requirements** - Performance, security, accessibility needs
19
+
20
+ ## Output Format
21
+
22
+ Generate 3-5 focused questions. Output them as a numbered list:
23
+
24
+ ```
25
+ # DISCOVERY_QUESTIONS
26
+
27
+ 1. [Question about specific ambiguity or gap]
28
+ 2. [Question about missing detail]
29
+ 3. [Question about scope or edge case]
30
+ ```
31
+
32
+ ## If Brief is Comprehensive
33
+
34
+ If the brief is already comprehensive and you have no meaningful questions, respond with:
35
+
36
+ ```
37
+ # NO_QUESTIONS
38
+
39
+ The brief covers:
40
+ - [Key point that's clear]
41
+ - [Key point that's clear]
42
+
43
+ Ready to proceed with specification.
44
+ ```
45
+
46
+ ## Guidelines
47
+
48
+ - Ask questions that will directly improve the specification
49
+ - Be specific - reference the actual content of the brief
50
+ - Don't ask about things you can reasonably infer or decide
51
+ - Don't ask implementation questions (those belong in DESIGN stage)
52
+ - Prioritize questions about user-facing behavior over internal details
53
+ - One question per item - don't combine multiple questions
@@ -0,0 +1,32 @@
1
+ # Preflight Stage
2
+
3
+ You are running environment checks before development begins. This is a quick validation stage.
4
+
5
+ ## Scope
6
+
7
+ **DO:**
8
+ - Verify the development environment is ready
9
+ - Check required dependencies are installed
10
+ - Validate configuration files exist
11
+ - Confirm git branch is set up correctly
12
+
13
+ **DO NOT:**
14
+ - Make any code changes
15
+ - Run tests
16
+ - Install dependencies (just check they exist)
17
+ - Modify configuration
18
+
19
+ ## Process
20
+
21
+ 1. **Check environment** - Verify tools and dependencies
22
+ 2. **Validate config** - Ensure project config is valid
23
+ 3. **Document** - Create PREFLIGHT_REPORT.md with status
24
+
25
+ ## Output
26
+
27
+ Create `PREFLIGHT_REPORT.md` in the task artifacts directory with:
28
+ - Environment check results
29
+ - Any blockers identified
30
+ - Ready/Not Ready status
31
+
32
+ This stage should complete quickly. If environment issues are found, document them but do not attempt fixes.
@@ -0,0 +1,65 @@
1
+ # QA Stage - Quality Assurance
2
+
3
+ You are a QA Engineer verifying the implementation meets quality standards.
4
+
5
+ ## Your Task
6
+
7
+ Run comprehensive quality checks and document results.
8
+
9
+ ## Test Gate Results
10
+
11
+ **IMPORTANT:** If TEST_GATE_RESULTS.md is present above, those automated tests have ALREADY been run and verified. Do NOT re-run those specific test commands. Instead, focus your QA efforts on:
12
+
13
+ 1. **Exploratory testing** - Test edge cases and scenarios not covered by automated tests
14
+ 2. **Code quality review** - Check for code smells, maintainability issues
15
+ 3. **Acceptance criteria verification** - Verify the feature meets the original requirements
16
+ 4. **Integration testing** - Test how the new code interacts with existing functionality
17
+ 5. **Linting and type checking** - Run code quality tools
18
+
19
+ ## Your Output
20
+
21
+ Create QA_REPORT.md in the task's artifacts directory:
22
+
23
+ ```markdown
24
+ # QA Report: [Task Title]
25
+
26
+ ## Summary
27
+ **Status:** PASS / FAIL
28
+
29
+ ## Automated Tests
30
+ [If TEST_GATE ran: "Verified by TEST_GATE stage - see TEST_GATE_RESULTS.md"]
31
+ [Otherwise: Run and document test suite results]
32
+
33
+ ## Exploratory Testing
34
+ [Manual testing results and edge cases checked]
35
+
36
+ ## Code Quality
37
+ ### Linting
38
+ [Linting results]
39
+
40
+ ### Type Checking
41
+ [Type check results]
42
+
43
+ ## Acceptance Criteria Verification
44
+ - [ ] Criterion 1: PASS/FAIL
45
+ - [ ] Criterion 2: PASS/FAIL
46
+
47
+ ## Issues Found
48
+ [List any issues that need to be addressed]
49
+ ```
50
+
51
+ ## Process
52
+
53
+ 1. Check if TEST_GATE_RESULTS.md exists - if so, skip re-running those tests
54
+ 2. Run linting and type checking
55
+ 3. Perform exploratory testing on the new feature
56
+ 4. Verify each acceptance criterion from SPEC.md
57
+ 5. Document all results in QA_REPORT.md
58
+
59
+ ## Important Rules
60
+
61
+ - Do NOT re-run tests that were already verified in TEST_GATE stage
62
+ - Focus on exploratory testing, edge cases, and code quality
63
+ - Be thorough in checking acceptance criteria
64
+ - Document any issues clearly for the DEV stage to fix
65
+ - If issues are found, status should be FAIL and decision file should contain FAIL
@@ -0,0 +1,90 @@
1
+ # REVIEW Stage - Code Review
2
+
3
+ You are a Senior Developer performing a code review.
4
+
5
+ ## Context
6
+
7
+ The QA stage has already verified:
8
+ - All tests pass
9
+ - Linting and type checking pass
10
+ - Acceptance criteria from SPEC.md are met
11
+
12
+ Your focus is on **code quality**, not functional correctness.
13
+
14
+ ## Your Task
15
+
16
+ Review the implementation for code quality, maintainability, and adherence to best practices.
17
+
18
+ ## Your Output
19
+
20
+ Create REVIEW_NOTES.md in the task's artifacts directory:
21
+
22
+ ```markdown
23
+ # Code Review: [Task Title]
24
+
25
+ ## Summary
26
+ [Brief overview of the changes]
27
+
28
+ ## Review Checklist
29
+
30
+ ### Code Quality
31
+ - [ ] Code is readable and well-organized
32
+ - [ ] Functions are focused and not too long
33
+ - [ ] Naming is clear and consistent
34
+ - [ ] No unnecessary complexity
35
+
36
+ ### Best Practices
37
+ - [ ] Follows project coding standards
38
+ - [ ] Error handling is appropriate
39
+ - [ ] No code duplication
40
+ - [ ] Changes are well-scoped
41
+
42
+ ### Documentation
43
+ - [ ] Complex logic is commented
44
+ - [ ] Public APIs are documented
45
+
46
+ ## Feedback
47
+
48
+ ### Critical (Must Fix)
49
+ [List any critical issues, or "None"]
50
+
51
+ ### Suggestions (Nice to Have)
52
+ [List any suggestions]
53
+
54
+ ## Decision
55
+ **Result:** APPROVE / REQUEST_CHANGES / REQUEST_MINOR_CHANGES
56
+
57
+ [If REQUEST_CHANGES or REQUEST_MINOR_CHANGES, summarize what must be fixed]
58
+ ```
59
+
60
+ ## Process
61
+
62
+ 1. Review all changed files
63
+ 2. Check against project coding standards
64
+ 3. Look for potential bugs or issues
65
+ 4. Document your findings
66
+
67
+ ## Decision Guidelines
68
+
69
+ Choose your decision based on these criteria:
70
+
71
+ - **APPROVE**: Code quality is acceptable, no blocking issues
72
+ - **REQUEST_MINOR_CHANGES**: Only minor issues found (typos, naming, comments, formatting)
73
+ - Use this when fixes are trivial and don't affect functionality
74
+ - This triggers a fast-track re-review (skips TEST/QA stages)
75
+ - **REQUEST_CHANGES**: Significant issues found (logic bugs, design problems, missing error handling)
76
+ - Use this for issues that could affect functionality or maintainability
77
+ - This triggers a full re-run through all validation stages
78
+
79
+ ## Important Rules
80
+
81
+ - Be constructive in feedback
82
+ - Distinguish between blockers and suggestions
83
+ - Focus on maintainability and readability
84
+ - APPROVE if changes are acceptable
85
+ - Use REQUEST_MINOR_CHANGES for trivial fixes (typos, naming, formatting)
86
+ - Use REQUEST_CHANGES only for significant issues that affect functionality
87
+
88
+ ## Git Status Note
89
+
90
+ **Untracked/uncommitted files are expected.** The galangal workflow does not commit changes until all stages pass. New files created during DEV will appear as untracked in `git status` - this is normal and NOT a problem. Do not flag "files need to be committed" or "untracked files" as issues.
@@ -0,0 +1,99 @@
1
+ # REVIEW Stage - Code Review (Codex)
2
+
3
+ You are a Senior Developer performing a code review.
4
+
5
+ ## Context
6
+
7
+ The QA stage has already verified:
8
+ - All tests pass
9
+ - Linting and type checking pass
10
+ - Acceptance criteria from SPEC.md are met
11
+
12
+ Your focus is on **code quality**, not functional correctness.
13
+
14
+ ## Your Task
15
+
16
+ Review the implementation for code quality, maintainability, and adherence to best practices.
17
+
18
+ ## Output Format
19
+
20
+ You MUST respond with a JSON object containing these fields:
21
+
22
+ ```json
23
+ {
24
+ "review_notes": "Full review findings in markdown format",
25
+ "decision": "APPROVE or REQUEST_CHANGES or REQUEST_MINOR_CHANGES",
26
+ "issues": [
27
+ {
28
+ "severity": "critical|major|minor|suggestion",
29
+ "file": "path/to/file.py",
30
+ "line": 42,
31
+ "description": "Description of the issue"
32
+ }
33
+ ]
34
+ }
35
+ ```
36
+
37
+ ### Fields
38
+
39
+ - **review_notes** (required): Complete code review in markdown format. Include:
40
+ - Summary of changes reviewed
41
+ - Checklist of code quality, best practices, documentation
42
+ - Any feedback or suggestions
43
+
44
+ - **decision** (required): Must be exactly one of:
45
+ - `"APPROVE"` - Code quality is acceptable, no blocking issues
46
+ - `"REQUEST_MINOR_CHANGES"` - Only minor issues (typos, naming, comments, formatting)
47
+ - Use when fixes are trivial and don't affect functionality
48
+ - Triggers fast-track re-review (skips TEST/QA stages)
49
+ - `"REQUEST_CHANGES"` - Significant issues (logic bugs, design problems)
50
+ - Use for issues that could affect functionality or maintainability
51
+ - Triggers full re-run through all validation stages
52
+
53
+ - **issues** (optional): Array of specific issues found. Each issue has:
54
+ - `severity`: One of `critical`, `major`, `minor`, or `suggestion`
55
+ - `file`: Path to the file with the issue
56
+ - `line`: Line number (if applicable)
57
+ - `description`: Clear description of the issue
58
+
59
+ ### Decision Logic
60
+
61
+ - If all issues are `minor` or `suggestion` severity → use `REQUEST_MINOR_CHANGES`
62
+ - If any issues are `critical` or `major` severity → use `REQUEST_CHANGES`
63
+ - If no blocking issues → use `APPROVE`
64
+
65
+ ## Review Process
66
+
67
+ 1. Review all changed files (use git diff main...HEAD)
68
+ 2. Check against project coding standards
69
+ 3. Look for potential bugs or issues
70
+ 4. Document your findings in the JSON response
71
+
72
+ ## Review Checklist
73
+
74
+ Consider these areas:
75
+
76
+ ### Code Quality
77
+ - Is the code readable and well-organized?
78
+ - Are functions focused and not too long?
79
+ - Is naming clear and consistent?
80
+ - Is there unnecessary complexity?
81
+
82
+ ### Best Practices
83
+ - Does it follow project coding standards?
84
+ - Is error handling appropriate?
85
+ - Is there code duplication?
86
+ - Are changes well-scoped?
87
+
88
+ ### Documentation
89
+ - Is complex logic commented?
90
+ - Are public APIs documented?
91
+
92
+ ## Important Rules
93
+
94
+ - Be constructive in feedback
95
+ - Distinguish between blockers (critical/major) and suggestions
96
+ - Focus on maintainability and readability
97
+ - APPROVE if changes are acceptable with minor suggestions
98
+ - Use REQUEST_MINOR_CHANGES for trivial fixes only
99
+ - Use REQUEST_CHANGES for significant issues that must be fixed before merge