codexspec 0.3.4__tar.gz → 0.3.6__tar.gz

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 (37) hide show
  1. {codexspec-0.3.4 → codexspec-0.3.6}/PKG-INFO +54 -1
  2. {codexspec-0.3.4 → codexspec-0.3.6}/README.md +50 -0
  3. {codexspec-0.3.4 → codexspec-0.3.6}/pyproject.toml +4 -1
  4. {codexspec-0.3.4 → codexspec-0.3.6}/src/codexspec/__init__.py +25 -5
  5. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/checklist.md +11 -0
  6. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/clarify.md +1 -0
  7. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/commit-staged.md +22 -2
  8. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/commit.md +27 -6
  9. codexspec-0.3.6/templates/commands/pr.md +366 -0
  10. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/tasks-to-issues.md +11 -0
  11. {codexspec-0.3.4 → codexspec-0.3.6}/.gitignore +0 -0
  12. {codexspec-0.3.4 → codexspec-0.3.6}/LICENSE +0 -0
  13. {codexspec-0.3.4 → codexspec-0.3.6}/scripts/bash/check-prerequisites.sh +0 -0
  14. {codexspec-0.3.4 → codexspec-0.3.6}/scripts/bash/common.sh +0 -0
  15. {codexspec-0.3.4 → codexspec-0.3.6}/scripts/bash/create-new-feature.sh +0 -0
  16. {codexspec-0.3.4 → codexspec-0.3.6}/scripts/powershell/check-prerequisites.ps1 +0 -0
  17. {codexspec-0.3.4 → codexspec-0.3.6}/scripts/powershell/common.ps1 +0 -0
  18. {codexspec-0.3.4 → codexspec-0.3.6}/scripts/powershell/create-new-feature.ps1 +0 -0
  19. {codexspec-0.3.4 → codexspec-0.3.6}/src/codexspec/i18n.py +0 -0
  20. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/analyze.md +0 -0
  21. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/constitution.md +0 -0
  22. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/generate-spec.md +0 -0
  23. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/implement-tasks.md +0 -0
  24. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/plan-to-tasks.md +0 -0
  25. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/review-plan.md +0 -0
  26. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/review-spec.md +0 -0
  27. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/review-tasks.md +0 -0
  28. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/spec-to-plan.md +0 -0
  29. {codexspec-0.3.4 → codexspec-0.3.6}/templates/commands/specify.md +0 -0
  30. {codexspec-0.3.4 → codexspec-0.3.6}/templates/docs/checklist-template.md +0 -0
  31. {codexspec-0.3.4 → codexspec-0.3.6}/templates/docs/constitution-template.md +0 -0
  32. {codexspec-0.3.4 → codexspec-0.3.6}/templates/docs/plan-template-detailed.md +0 -0
  33. {codexspec-0.3.4 → codexspec-0.3.6}/templates/docs/plan-template-simple.md +0 -0
  34. {codexspec-0.3.4 → codexspec-0.3.6}/templates/docs/spec-template-detailed.md +0 -0
  35. {codexspec-0.3.4 → codexspec-0.3.6}/templates/docs/spec-template-simple.md +0 -0
  36. {codexspec-0.3.4 → codexspec-0.3.6}/templates/docs/tasks-template-detailed.md +0 -0
  37. {codexspec-0.3.4 → codexspec-0.3.6}/templates/docs/tasks-template-simple.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: codexspec
3
- Version: 0.3.4
3
+ Version: 0.3.6
4
4
  Summary: CodexSpec - A Spec-Driven Development (SDD) toolkit for Claude Code
5
5
  Project-URL: Homepage, https://github.com/Zts0hg/codexspec
6
6
  Project-URL: Repository, https://github.com/Zts0hg/codexspec
@@ -13,6 +13,9 @@ Classifier: Development Status :: 3 - Alpha
13
13
  Classifier: Environment :: Console
14
14
  Classifier: Intended Audience :: Developers
15
15
  Classifier: License :: OSI Approved :: MIT License
16
+ Classifier: Operating System :: MacOS
17
+ Classifier: Operating System :: Microsoft :: Windows
18
+ Classifier: Operating System :: POSIX :: Linux
16
19
  Classifier: Programming Language :: Python :: 3
17
20
  Classifier: Programming Language :: Python :: 3.11
18
21
  Classifier: Programming Language :: Python :: 3.12
@@ -161,6 +164,55 @@ uv tool install git+https://github.com/Zts0hg/codexspec.git@main
161
164
  uv tool install git+https://github.com/Zts0hg/codexspec.git@v0.2.0
162
165
  ```
163
166
 
167
+ ## Windows Users
168
+
169
+ ### Recommended: Use PowerShell
170
+
171
+ **Windows users should use PowerShell for installation and running CodexSpec**:
172
+
173
+ ```powershell
174
+ # 1. Install uv (if not already installed)
175
+ powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
176
+
177
+ # 2. Restart PowerShell, then install codexspec
178
+ uv tool install codexspec
179
+
180
+ # 3. Verify installation
181
+ codexspec --version
182
+ ```
183
+
184
+ ### Troubleshooting for CMD Users
185
+
186
+ If you encounter "Access denied" or "spawn codexspec access denied (OSError 5)" errors in CMD:
187
+
188
+ **Solution 1: Refresh environment variables**
189
+ ```cmd
190
+ # Close all CMD windows and open a new one
191
+ # Or manually refresh PATH
192
+ set PATH=%PATH%;%USERPROFILE%\.local\bin
193
+ codexspec --version
194
+ ```
195
+
196
+ **Solution 2: Use full path**
197
+ ```cmd
198
+ %USERPROFILE%\.local\bin\codexspec.exe --version
199
+ ```
200
+
201
+ **Solution 3: Use pipx instead of uv tool**
202
+ ```cmd
203
+ pip install pipx
204
+ pipx ensurepath
205
+ # Restart CMD
206
+ pipx install codexspec
207
+ ```
208
+
209
+ ### FAQ
210
+
211
+ **Q: Why does PowerShell work but CMD doesn't?**
212
+ A: PowerShell and CMD handle user environment variables differently. When uv adds paths to user PATH, PowerShell typically recognizes them immediately, while CMD may require a restart or manual refresh.
213
+
214
+ For more details, see [Windows Troubleshooting Guide](docs/WINDOWS-TROUBLESHOOTING.md).
215
+
164
216
  ## Quick Start
165
217
 
166
218
  After installation, you can use the CLI:
@@ -405,6 +457,7 @@ After initialization, these slash commands are available in Claude Code:
405
457
  |---------|-------------|
406
458
  | `/codexspec.commit` | Generate Conventional Commits messages based on git status and session context |
407
459
  | `/codexspec.commit-staged` | Generate commit message from staged changes only |
460
+ | `/codexspec.pr` | Generate structured PR (GitHub) or MR (GitLab) descriptions with platform auto-detection |
408
461
 
409
462
  ## Workflow Overview
410
463
 
@@ -123,6 +123,55 @@ uv tool install git+https://github.com/Zts0hg/codexspec.git@main
123
123
  uv tool install git+https://github.com/Zts0hg/codexspec.git@v0.2.0
124
124
  ```
125
125
 
126
+ ## Windows Users
127
+
128
+ ### Recommended: Use PowerShell
129
+
130
+ **Windows users should use PowerShell for installation and running CodexSpec**:
131
+
132
+ ```powershell
133
+ # 1. Install uv (if not already installed)
134
+ powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
135
+
136
+ # 2. Restart PowerShell, then install codexspec
137
+ uv tool install codexspec
138
+
139
+ # 3. Verify installation
140
+ codexspec --version
141
+ ```
142
+
143
+ ### Troubleshooting for CMD Users
144
+
145
+ If you encounter "Access denied" or "spawn codexspec access denied (OSError 5)" errors in CMD:
146
+
147
+ **Solution 1: Refresh environment variables**
148
+ ```cmd
149
+ # Close all CMD windows and open a new one
150
+ # Or manually refresh PATH
151
+ set PATH=%PATH%;%USERPROFILE%\.local\bin
152
+ codexspec --version
153
+ ```
154
+
155
+ **Solution 2: Use full path**
156
+ ```cmd
157
+ %USERPROFILE%\.local\bin\codexspec.exe --version
158
+ ```
159
+
160
+ **Solution 3: Use pipx instead of uv tool**
161
+ ```cmd
162
+ pip install pipx
163
+ pipx ensurepath
164
+ # Restart CMD
165
+ pipx install codexspec
166
+ ```
167
+
168
+ ### FAQ
169
+
170
+ **Q: Why does PowerShell work but CMD doesn't?**
171
+ A: PowerShell and CMD handle user environment variables differently. When uv adds paths to user PATH, PowerShell typically recognizes them immediately, while CMD may require a restart or manual refresh.
172
+
173
+ For more details, see [Windows Troubleshooting Guide](docs/WINDOWS-TROUBLESHOOTING.md).
174
+
126
175
  ## Quick Start
127
176
 
128
177
  After installation, you can use the CLI:
@@ -367,6 +416,7 @@ After initialization, these slash commands are available in Claude Code:
367
416
  |---------|-------------|
368
417
  | `/codexspec.commit` | Generate Conventional Commits messages based on git status and session context |
369
418
  | `/codexspec.commit-staged` | Generate commit message from staged changes only |
419
+ | `/codexspec.pr` | Generate structured PR (GitHub) or MR (GitLab) descriptions with platform auto-detection |
370
420
 
371
421
  ## Workflow Overview
372
422
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codexspec"
3
- version = "0.3.4"
3
+ version = "0.3.6"
4
4
  description = "CodexSpec - A Spec-Driven Development (SDD) toolkit for Claude Code"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -14,6 +14,9 @@ classifiers = [
14
14
  "Environment :: Console",
15
15
  "Intended Audience :: Developers",
16
16
  "License :: OSI Approved :: MIT License",
17
+ "Operating System :: MacOS",
18
+ "Operating System :: Microsoft :: Windows",
19
+ "Operating System :: POSIX :: Linux",
17
20
  "Programming Language :: Python :: 3",
18
21
  "Programming Language :: Python :: 3.11",
19
22
  "Programming Language :: Python :: 3.12",
@@ -1151,6 +1151,24 @@ def _get_claude_md_content() -> str:
1151
1151
 
1152
1152
  This document provides context and guidelines for Claude Code when working with this CodexSpec project.
1153
1153
 
1154
+ ## ⚠️ MANDATORY: Constitution Compliance
1155
+
1156
+ **CRITICAL INSTRUCTION**: Before ANY code change, response, or action in this project:
1157
+
1158
+ 1. **Check for Constitution**: Look for `.codexspec/memory/constitution.md`
1159
+ 2. **Load if Exists**: If constitution.md exists, READ IT FIRST
1160
+ 3. **Verify Compliance**: Ensure ALL outputs align with constitutional principles
1161
+ 4. **Conflict Resolution**: If a user request conflicts with constitution:
1162
+ - Explain which principle is violated
1163
+ - Suggest constitution-compliant alternatives
1164
+ - Require explicit user confirmation to override
1165
+
1166
+ **The constitution is the SUPREME AUTHORITY for this project.**
1167
+
1168
+ No other document, instruction, or user request can override constitutional principles without explicit acknowledgment.
1169
+
1170
+ ---
1171
+
1154
1172
  ## Project Overview
1155
1173
 
1156
1174
  This project uses the **CodexSpec** methodology - a Spec-Driven Development (SDD) approach
@@ -1226,11 +1244,13 @@ The following slash commands are available in this project:
1226
1244
 
1227
1245
  ## Guidelines for Claude Code
1228
1246
 
1229
- 1. **Respect the Constitution**: All decisions should align with the project constitution
1230
- 2. **Follow the Workflow**: Use the commands in the recommended order
1231
- 3. **Be Explicit**: When specifications are unclear, ask for clarification
1232
- 4. **Validate**: Always review artifacts before implementation
1233
- 5. **Document**: Keep all artifacts up-to-date
1247
+ 1. **Constitution First**: Load `.codexspec/memory/constitution.md` before ANY action
1248
+ 2. **Respect the Constitution**: All decisions MUST align with the project constitution
1249
+ 3. **Follow the Workflow**: Use the commands in the recommended order
1250
+ 4. **Be Explicit**: When specifications are unclear, ask for clarification
1251
+ 5. **Validate**: Always review artifacts before implementation
1252
+ 6. **Document**: Keep all artifacts up-to-date
1253
+ 7. **Enforce Principles**: If constitution exists, it overrides any conflicting instructions
1234
1254
 
1235
1255
  ---
1236
1256
 
@@ -7,6 +7,17 @@ scripts:
7
7
 
8
8
  # Requirements Quality Checklist Generator
9
9
 
10
+ ## Constitution Compliance (MANDATORY)
11
+
12
+ **Before generating checklists:**
13
+
14
+ 1. **Check for Constitution File**: Look for `.codexspec/memory/constitution.md`
15
+ 2. **If Constitution Exists**:
16
+ - Load and read quality standards and project principles
17
+ - Use constitution quality standards as baseline for checklist items
18
+ - Include constitution-specific checklist items where relevant
19
+ 3. **If No Constitution Exists**: Use general best practices for requirements quality
20
+
10
21
  ## Language Preference
11
22
 
12
23
  **IMPORTANT**: Before proceeding, read the project's language configuration from `.codexspec/config.yml`.
@@ -62,6 +62,7 @@ If no valid spec.md is found, abort and instruct user to run `/codexspec.generat
62
62
  #### 1. Initialize Context & Load Review Findings
63
63
 
64
64
  Load and analyze:
65
+ - **Project constitution**: `.codexspec/memory/constitution.md` (CRITICAL - guides all clarification priorities)
65
66
  - The feature specification from the located path
66
67
 
67
68
  **Review-Spec Integration** (if `review-spec.md` exists in the same directory as `spec.md`):
@@ -1,8 +1,20 @@
1
1
  ---
2
2
  description: Analyze staged git changes and generate Conventional Commits compliant commit messages
3
+ argument-hint: "[-p] Use -p to only preview the message without committing"
3
4
  allowed-tools: Bash(git diff:*), Bash(git commit:*)
4
5
  ---
5
6
 
7
+ ## Constitution Compliance (MANDATORY)
8
+
9
+ **Before generating commit messages:**
10
+
11
+ 1. **Check for Constitution File**: Look for `.codexspec/memory/constitution.md`
12
+ 2. **If Constitution Exists**:
13
+ - Load and read relevant principles (especially coding standards, commit conventions)
14
+ - Ensure commit message style aligns with constitutional guidelines
15
+ - Verify that the changes being committed don't violate any principles
16
+ 3. **If No Constitution Exists**: Proceed with default Conventional Commits format
17
+
6
18
  ## Language Preference
7
19
 
8
20
  **IMPORTANT**: Before generating commit messages, read the project's language configuration from `.codexspec/config.yml`.
@@ -17,6 +29,12 @@ allowed-tools: Bash(git diff:*), Bash(git commit:*)
17
29
  - Only the description part should use the configured language
18
30
  - Technical terms (e.g., API, JWT, OAuth) may remain in English when appropriate
19
31
 
32
+ ## Parameter Check
33
+
34
+ Check if `$ARGUMENTS` contains `-p`:
35
+ - **If `-p` is present**: Preview mode - only output the commit message, do not execute `git commit`
36
+ - **If `-p` is NOT present**: Execute mode - generate the message and execute `git commit` directly
37
+
20
38
  ## Instructions
21
39
 
22
40
  1. Execute `git diff --staged` to retrieve staged changes.
@@ -29,12 +47,14 @@ allowed-tools: Bash(git diff:*), Bash(git commit:*)
29
47
  - Do not add `Co-Authored-By` lines or any references to AI tools/agents
30
48
  - The commit message should focus solely on describing the changes
31
49
 
32
- 3. Present the generated commit message to the user and ask for confirmation.
50
+ 3. **If preview mode (`-p`)**: Display the generated commit message and stop.
33
51
 
34
- 4. If confirmed, execute `git commit -m "..."` with the generated message.
52
+ 4. **If execute mode (default)**: Execute `git commit -m "..."` directly with the generated message.
35
53
 
36
54
  ## Important Notes
37
55
 
56
+ - In execute mode (default), execute `git commit` directly after generating the message
57
+ - In preview mode (`-p`), only display the commit message without executing
38
58
  - If no staged changes exist, inform the user and suggest using `git add` first
39
59
  - For breaking changes, include `BREAKING CHANGE:` in the commit body
40
60
  - Keep the description concise and in imperative mood (e.g., "add feature" not "added feature")
@@ -1,8 +1,20 @@
1
1
  ---
2
- description: Generate Conventional Commits compliant commit messages based on git status and session context
2
+ description: Generate and execute Conventional Commits compliant commit messages based on git status and session context
3
+ argument-hint: "[-p] Use -p to only preview the message without committing"
3
4
  allowed-tools: Bash(git status:*), Bash(git diff:*), Bash(git branch:*), Bash(git add:*), Bash(git commit:*)
4
5
  ---
5
6
 
7
+ ## Constitution Compliance (MANDATORY)
8
+
9
+ **Before generating commit messages:**
10
+
11
+ 1. **Check for Constitution File**: Look for `.codexspec/memory/constitution.md`
12
+ 2. **If Constitution Exists**:
13
+ - Load and read relevant principles (especially coding standards, commit conventions)
14
+ - Ensure commit message style aligns with constitutional guidelines
15
+ - Verify that the changes being committed don't violate any principles
16
+ 3. **If No Constitution Exists**: Proceed with default Conventional Commits format
17
+
6
18
  ## Language Preference
7
19
 
8
20
  **IMPORTANT**: Before generating commit messages, read the project's language configuration from `.codexspec/config.yml`.
@@ -31,6 +43,12 @@ Execute the following commands to gather git context:
31
43
  3. **Staged Changes**: `git diff --staged`
32
44
  4. **Unstaged Changes**: `git diff`
33
45
 
46
+ ## Parameter Check
47
+
48
+ Check if `$ARGUMENTS` contains `-p`:
49
+ - **If `-p` is present**: Preview mode - only output the commit message, do not execute `git commit`
50
+ - **If `-p` is NOT present**: Execute mode - generate the message and execute `git commit` directly
51
+
34
52
  ## Decision Logic
35
53
 
36
54
  Based on the git context, follow this priority order:
@@ -40,8 +58,8 @@ Based on the git context, follow this priority order:
40
58
  1. Ignore unstaged changes
41
59
  2. Generate a commit message based on staged changes only
42
60
  3. Consider the current session conversation history to understand the intent and context
43
- 4. Present the commit message to user for confirmation
44
- 5. If confirmed, execute `git commit -m "..."`
61
+ 4. **If preview mode (`-p`)**: Display the commit message and stop
62
+ 5. **If execute mode (default)**: Execute `git commit -m "..."` directly
45
63
 
46
64
  ### Case B: No Staged Changes, But Unstaged Changes Exist
47
65
 
@@ -49,7 +67,9 @@ Based on the git context, follow this priority order:
49
67
  2. Analyze the unstaged changes
50
68
  3. Generate a **suggested** commit message
51
69
  4. **REMINDER**: After displaying the commit message, repeat the reminder: "Remember: You must stage changes with `git add` before committing."
52
- 5. Ask user if they want to stage all changes and commit
70
+ 5. **STOP here** - Do NOT execute any git commands. The user must manually stage the appropriate changes first.
71
+
72
+ **Rationale**: When staging area is empty, we cannot safely assume which changes should be committed. The user may only want to commit a subset of the changes, or may need to split changes into multiple commits. Always require explicit user action to stage changes.
53
73
 
54
74
  ### Case C: No Changes At All
55
75
 
@@ -79,6 +99,7 @@ This context helps generate more meaningful commit messages that reflect the "wh
79
99
 
80
100
  ## Important Notes
81
101
 
82
- - Always confirm with user before executing `git commit`
83
- - For Case B, display a prominent reminder at the **beginning** before showing the suggested commit message, AND repeat the reminder at the **end** after displaying the message. This ensures the user is aware that the commit message is generated based on unstaged changes (not staged changes), so they can take appropriate action: proceed if intentional, or re-stage specific files and run the command again if they forgot to stage.
102
+ - In execute mode (default), execute `git commit` directly after generating the message (only for Case A with staged changes)
103
+ - In preview mode (`-p`), only display the commit message without executing
104
+ - For Case B (no staged changes), always display the suggested message and stop - never auto-stage or auto-commit
84
105
  - Do not make assumptions about change intent without context
@@ -0,0 +1,366 @@
1
+ ---
2
+ description: Generate structured Pull Request (GitHub) or Merge Request (GitLab) descriptions based on git diff and optional spec.md integration
3
+ allowed-tools: Bash(git branch:*), Bash(git diff:*), Bash(git log:*), Bash(git remote:*), Bash(git rev-parse:*), Bash(ls:*), Bash(cat:*)
4
+ ---
5
+
6
+ ## Constitution Compliance (MANDATORY)
7
+
8
+ **Before generating PR description:**
9
+
10
+ 1. **Check for Constitution File**: Look for `.codexspec/memory/constitution.md`
11
+ 2. **If Constitution Exists**:
12
+ - Load and read relevant principles (especially documentation standards, code review guidelines)
13
+ - Ensure PR description reflects constitutional principles
14
+ - Verify that the changes align with project quality standards
15
+ 3. **If No Constitution Exists**: Proceed with standard PR generation
16
+
17
+ ## Language Preference
18
+
19
+ **IMPORTANT**: Before generating PR descriptions, read the project's language configuration from `.codexspec/config.yml`.
20
+
21
+ **PR description language priority**:
22
+ 1. If `language.commit` is set, use that language for the PR description
23
+ 2. Otherwise, use `language.output` as fallback
24
+ 3. If neither is configured, default to English
25
+
26
+ **Note**:
27
+ - Technical terms (e.g., API, JWT, OAuth, PR, MR) may remain in English when appropriate
28
+ - The PR title and section headers should follow the configured language
29
+
30
+ **Examples**:
31
+ - `output: "zh-CN"` + `commit: "en"` → Chinese interactions, English PR descriptions
32
+ - `output: "zh-CN"` + `commit: "zh-CN"` → Chinese for both
33
+ - `output: "zh-CN"` + no `commit` setting → Chinese for both (fallback)
34
+
35
+ ## User Input
36
+
37
+ ```
38
+ $ARGUMENTS
39
+ ```
40
+
41
+ ## Parameters
42
+
43
+ Parse `$ARGUMENTS` for the following optional parameters:
44
+
45
+ | Parameter | Default | Description |
46
+ |-----------|---------|-------------|
47
+ | `--target-branch <branch>` | `origin/main` | Branch to compare against |
48
+ | `--output <file>` | (none) | Save output to file instead of terminal |
49
+ | `--sections <list>` | `all` | Comma-separated sections to include |
50
+ | `--spec <path>` | (none) | Enable spec.md integration (opt-in) |
51
+
52
+ ### `--sections` Values
53
+ - `context` - Background and problem statement
54
+ - `implementation` - Technical approach
55
+ - `testing` - Test coverage information
56
+ - `verify` - Verification steps
57
+ - `all` - Include all sections (default)
58
+
59
+ Example: `--sections context,implementation,verify`
60
+
61
+ ### `--spec` Usage (Opt-in)
62
+
63
+ By default, spec.md is **NOT** used. Use `--spec` to enable SDD workflow integration:
64
+
65
+ | Value | Behavior |
66
+ |-------|----------|
67
+ | (not specified) | No spec integration, generate from git only |
68
+ | `001-auth` | Use `.codexspec/specs/001-auth/spec.md` |
69
+ | `path/to/spec.md` | Use specified spec.md file path |
70
+
71
+ **When to use**:
72
+ - Following SDD workflow with existing spec.md
73
+ - Want Context section with user stories and requirements
74
+ - Large feature changes with documented specifications
75
+
76
+ **When NOT to use**:
77
+ - Small bug fixes or minor changes
78
+ - Quick iterations without formal specification
79
+ - Changes unrelated to existing specs
80
+
81
+ ## Git Context Collection
82
+
83
+ Execute the following commands to gather git context:
84
+
85
+ 1. **Current Branch**: `git branch --show-current`
86
+ 2. **Current Branch (full ref)**: `git rev-parse --abbrev-ref HEAD`
87
+ 3. **Remote URL**: `git remote get-url origin` (or error if no remote)
88
+ 4. **Commits Ahead**: `git log --oneline --no-merges <target-branch>..HEAD`
89
+ 5. **File Changes**: `git diff --name-status <target-branch>...HEAD`
90
+ 6. **Full Diff**: `git diff <target-branch>...HEAD`
91
+ 7. **Commit Messages**: `git log --pretty=format:"%s" --no-merges <target-branch>..HEAD`
92
+
93
+ ## Platform Detection
94
+
95
+ Detect the Git platform from the remote URL:
96
+
97
+ ### Detection Rules
98
+
99
+ 1. **GitHub**: URL contains `github.com`
100
+ - Use "Pull Request" terminology
101
+ - Title format: `## Pull Request: [Title]`
102
+
103
+ 2. **GitLab**: URL contains `gitlab.com`
104
+ - Use "Merge Request" terminology
105
+ - Title format: `## Merge Request: [Title]`
106
+
107
+ 3. **Other/No Remote**: Default to GitHub terminology
108
+ - Display warning if no remote configured
109
+
110
+ ## Spec.md Integration (Opt-in)
111
+
112
+ Only when `--spec` is provided, read spec.md for Context section.
113
+
114
+ ### Spec Resolution
115
+
116
+ 1. If `--spec` is a number like `001`, resolve to `.codexspec/specs/001-*/spec.md`
117
+ 2. If `--spec` is a directory name like `001-auth`, resolve to `.codexspec/specs/001-auth/spec.md`
118
+ 3. If `--spec` is a path, use directly
119
+
120
+ ### Content Extraction (Best-Effort)
121
+
122
+ Extract content from spec.md with priority order:
123
+ 1. **User Stories** - Primary source for Context
124
+ 2. **Goals** - Fallback if no User Stories
125
+ 3. **Overview** - Fallback if no Goals
126
+ 4. **Requirements** - Last resort
127
+
128
+ **Graceful Degradation**:
129
+ - If spec structure is incomplete, use available sections
130
+ - Do not error or warn on incomplete specs
131
+ - Skip Context section if no spec or extraction fails
132
+
133
+ ### Invalid Spec Path Handling
134
+
135
+ If `--spec` path doesn't exist:
136
+ 1. List available specs: `ls .codexspec/specs/`
137
+ 2. Display error: "Spec '[path]' not found. Available specs: [list]"
138
+ 3. Continue without Context section
139
+
140
+ ## PR Title Generation
141
+
142
+ Generate the PR title following **Conventional Commits** specification:
143
+
144
+ - Format: `type(scope): description`
145
+ - Types: `feat`, `fix`, `docs`, `style`, `refactor`, `perf`, `test`, `build`, `ci`, `chore`, `revert`
146
+ - If the project has a `CLAUDE.md` with custom commit conventions, follow those instead
147
+
148
+ ### Generation Process
149
+
150
+ 1. **Primary Source**: Analyze git diff content
151
+ - Identify main components/modules changed
152
+ - Understand the nature of changes (feature, fix, refactor, etc.)
153
+ - Determine the appropriate **type** prefix
154
+
155
+ 2. **Supporting Sources**:
156
+ - Branch name (extract feature/fix hints)
157
+ - Commit messages (understand intent, look for existing type prefixes)
158
+
159
+ 3. **Synthesis**:
160
+ - Combine insights into a single descriptive title
161
+ - Keep it concise but informative
162
+ - Use imperative mood (e.g., "Add" not "Added")
163
+
164
+ ### Type Determination Rules
165
+
166
+ | Type | When to Use |
167
+ |------|-------------|
168
+ | `feat` | New feature or functionality |
169
+ | `fix` | Bug fix |
170
+ | `docs` | Documentation changes only |
171
+ | `style` | Code style changes (formatting, semicolons, etc.) |
172
+ | `refactor` | Code refactoring without changing behavior |
173
+ | `perf` | Performance improvements |
174
+ | `test` | Adding or modifying tests |
175
+ | `build` | Build system or dependency changes |
176
+ | `ci` | CI/CD configuration changes |
177
+ | `chore` | Other changes that don't modify src or test files |
178
+ | `revert` | Reverting a previous commit |
179
+
180
+ ### Scope (Optional)
181
+
182
+ Add scope when changes are focused on a specific module/component:
183
+ - `feat(auth): add OAuth2 support`
184
+ - `fix(api): handle timeout errors`
185
+ - `refactor(core): improve caching mechanism`
186
+
187
+ **Example**:
188
+ - Branch: `feature/auth-cleanup`
189
+ - First commit: "Add password validation"
190
+ - Actual changes: Full authentication refactor
191
+ - **Generated title**: `refactor(auth): improve authentication system with JWT and session management`
192
+
193
+ ## Test File Discovery
194
+
195
+ Identify test files using language-agnostic patterns:
196
+
197
+ ### Directory Patterns
198
+ - `tests/`
199
+ - `test/`
200
+ - `__tests__/`
201
+ - `spec/`
202
+
203
+ ### File Name Patterns
204
+ - `*_test.py`, `test_*.py`
205
+ - `*.test.js`, `*.spec.ts`
206
+ - `*_test.go`
207
+ - `*Test.java`, `*Tests.java`
208
+
209
+ ### Combined Approach
210
+ Match files that are:
211
+ - In test directories, OR
212
+ - Match file name patterns
213
+
214
+ ## Project Command Detection
215
+
216
+ Detect project-specific test commands for "How to Verify" section:
217
+
218
+ | Detection | Command | Example |
219
+ |-----------|---------|---------|
220
+ | `pyproject.toml` + (`pytest.ini` OR `tests/`) | `pytest` | `uv run pytest` or `pytest` |
221
+ | `package.json` + `jest.config.js` | `npm test` | `npm test` |
222
+ | `package.json` + `vitest.config.ts` | `npm run test` | `npm run test` |
223
+ | `Cargo.toml` | `cargo test` | `cargo test` |
224
+ | `go.mod` | `go test` | `go test ./...` |
225
+ | `Makefile` with `test` target | `make test` | `make test` |
226
+
227
+ **Fallback**: If no project files detected, use generic steps:
228
+ 1. Install dependencies
229
+ 2. Run tests
230
+
231
+ ## Section Generation
232
+
233
+ Generate PR sections based on gathered information:
234
+
235
+ ### Context Section
236
+ - **Include**: Only if `--spec` is provided and spec.md found
237
+ - **Content**: Extract from spec.md (User Stories, Goals, Overview)
238
+ - **Skip**: If no spec or extraction fails
239
+
240
+ ### Implementation Section
241
+ - **Source**: Git diff analysis
242
+ - **Content**:
243
+ - Summary of technical changes
244
+ - Key files changed with brief descriptions
245
+ - Architectural decisions if apparent
246
+
247
+ ### Testing Section
248
+ - **Source**: Test file discovery + commit messages
249
+ - **Content**:
250
+ - Test files discovered
251
+ - Test coverage information (if available in commits)
252
+ - Test commands to run
253
+
254
+ ### How to Verify Section
255
+ - **Source**: Project command detection
256
+ - **Content**:
257
+ - Step-by-step verification instructions
258
+ - Project-specific test commands
259
+ - Manual verification steps if applicable
260
+
261
+ ## Section Selection
262
+
263
+ If `--sections` is specified, only include listed sections:
264
+ - `context` → Include Context section
265
+ - `implementation` → Include Implementation section
266
+ - `testing` → Include Testing section
267
+ - `verify` → Include How to Verify section
268
+ - `all` → Include all sections (default)
269
+
270
+ ## Output Format
271
+
272
+ ### GitHub PR Format
273
+
274
+ ```markdown
275
+ ## Pull Request: type(scope): description
276
+
277
+ ### Context
278
+ [Background from spec.md if --spec used]
279
+
280
+ ### Implementation
281
+ [Technical changes summary]
282
+
283
+ **Key Files Changed:**
284
+ - `path/to/file.py` - [Brief description]
285
+ - `path/to/another.py` - [Brief description]
286
+
287
+ ### Testing
288
+ [Test coverage and methodology]
289
+
290
+ **Test Commands:**
291
+ ```bash
292
+ [project-specific test commands]
293
+ ```
294
+
295
+ ### How to Verify
296
+ 1. [Step 1]
297
+ 2. [Step 2]
298
+ 3. [Step 3]
299
+ ...
300
+ ```
301
+
302
+ **Title Examples**:
303
+ - `feat(auth): add OAuth2 login support`
304
+ - `fix(api): resolve timeout issue in user endpoint`
305
+ - `refactor(core): improve caching mechanism`
306
+ - `docs: update API documentation`
307
+
308
+ ### GitLab MR Format
309
+
310
+ ```markdown
311
+ ## Merge Request: type(scope): description
312
+
313
+ ### Context
314
+ ...
315
+
316
+ ### Implementation
317
+ ...
318
+
319
+ ### Testing
320
+ ...
321
+
322
+ ### How to Verify
323
+ ...
324
+ ```
325
+
326
+ ## Edge Cases
327
+
328
+ ### EC-001: Branch Up to Date with Target
329
+ **Scenario**: No commits ahead of target branch
330
+ **Response**: "No changes detected between current branch and [target]. Nothing to generate."
331
+
332
+ ### EC-002: Invalid Target Branch
333
+ **Scenario**: Target branch doesn't exist
334
+ **Response**: "Target branch '[branch]' not found. Please verify the branch name."
335
+
336
+ ### EC-003: Not a Git Repository
337
+ **Scenario**: Command run outside git repo
338
+ **Response**: "Not a git repository. Please run this command from within a git repository."
339
+
340
+ ### EC-004b: Invalid Spec Path
341
+ **Scenario**: `--spec` path doesn't exist
342
+ **Response**: "Spec '[path]' not found. Available specs: [list specs in .codexspec/specs/]"
343
+
344
+ ### EC-005: Detached HEAD State
345
+ **Scenario**: Repository in detached HEAD
346
+ **Response**: "Cannot determine current branch. Please checkout a branch before generating PR description."
347
+
348
+ ### EC-006: No Remote Configured
349
+ **Scenario**: No git remote configured
350
+ **Handling**: Use GitHub terminology with warning: "No remote configured. Defaulting to GitHub terminology."
351
+
352
+ ## Output Modes
353
+
354
+ ### Terminal Output (Default)
355
+ Print the generated PR description to stdout for copy-paste.
356
+
357
+ ### File Output (`--output`)
358
+ Save the PR description to the specified file path.
359
+
360
+ ## Important Notes
361
+
362
+ - Always verify the current branch has commits ahead of target before generating
363
+ - The PR description should be self-contained and understandable without external context
364
+ - Include enough detail for reviewers to understand the changes
365
+ - Do not include any AI attribution in the PR description
366
+ - Focus on clarity and usefulness for code reviewers
@@ -7,6 +7,17 @@ scripts:
7
7
 
8
8
  # Tasks to GitHub Issues Converter
9
9
 
10
+ ## Constitution Compliance (MANDATORY)
11
+
12
+ **Before converting tasks to issues:**
13
+
14
+ 1. **Check for Constitution File**: Look for `.codexspec/memory/constitution.md`
15
+ 2. **If Constitution Exists**:
16
+ - Load and read project principles
17
+ - Ensure issue descriptions align with project principles
18
+ - Include relevant constitutional context in issues if applicable
19
+ 3. **If No Constitution Exists**: Proceed with standard issue generation
20
+
10
21
  ## Language Preference
11
22
 
12
23
  **IMPORTANT**: Before proceeding, read the project's language configuration from `.codexspec/config.yml`.
File without changes
File without changes