codexspec 0.7.7__tar.gz → 0.7.9__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 (72) hide show
  1. {codexspec-0.7.7 → codexspec-0.7.9}/PKG-INFO +25 -13
  2. {codexspec-0.7.7 → codexspec-0.7.9}/README.md +23 -11
  3. {codexspec-0.7.7 → codexspec-0.7.9}/pyproject.toml +1 -1
  4. {codexspec-0.7.7 → codexspec-0.7.9}/src/codexspec/__init__.py +11 -1
  5. {codexspec-0.7.7 → codexspec-0.7.9}/src/codexspec/commands/installer.py +26 -5
  6. {codexspec-0.7.7 → codexspec-0.7.9}/src/codexspec/integrations/codex.py +6 -0
  7. codexspec-0.7.9/src/codexspec/profile.py +112 -0
  8. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/analyze.md +9 -4
  9. codexspec-0.7.9/templates/commands/debug.md +80 -0
  10. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/distill.md +14 -13
  11. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/generate-spec.md +2 -2
  12. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/implement-tasks.md +29 -3
  13. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/plan-to-tasks.md +3 -0
  14. codexspec-0.7.9/templates/commands/review-design.md +132 -0
  15. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/review-plan.md +8 -6
  16. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/review-tasks.md +6 -5
  17. codexspec-0.7.9/templates/commands/spec-to-design.md +114 -0
  18. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/spec-to-plan.md +24 -21
  19. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/specify.md +9 -0
  20. codexspec-0.7.9/templates/docs/design-template.md +95 -0
  21. codexspec-0.7.9/templates/docs/plan-template-detailed.md +101 -0
  22. codexspec-0.7.9/templates/docs/plan-template-simple.md +53 -0
  23. {codexspec-0.7.7 → codexspec-0.7.9}/templates/translations/de.json +2 -2
  24. {codexspec-0.7.7 → codexspec-0.7.9}/templates/translations/en.json +2 -2
  25. {codexspec-0.7.7 → codexspec-0.7.9}/templates/translations/es.json +2 -2
  26. {codexspec-0.7.7 → codexspec-0.7.9}/templates/translations/fr.json +2 -2
  27. {codexspec-0.7.7 → codexspec-0.7.9}/templates/translations/ja.json +2 -2
  28. {codexspec-0.7.7 → codexspec-0.7.9}/templates/translations/ko.json +2 -2
  29. {codexspec-0.7.7 → codexspec-0.7.9}/templates/translations/pt-BR.json +2 -2
  30. {codexspec-0.7.7 → codexspec-0.7.9}/templates/translations/zh-CN.json +2 -2
  31. codexspec-0.7.7/templates/docs/plan-template-detailed.md +0 -218
  32. codexspec-0.7.7/templates/docs/plan-template-simple.md +0 -57
  33. {codexspec-0.7.7 → codexspec-0.7.9}/.gitignore +0 -0
  34. {codexspec-0.7.7 → codexspec-0.7.9}/LICENSE +0 -0
  35. {codexspec-0.7.7 → codexspec-0.7.9}/codexspec-icon.svg +0 -0
  36. {codexspec-0.7.7 → codexspec-0.7.9}/codexspec-logo-dark.svg +0 -0
  37. {codexspec-0.7.7 → codexspec-0.7.9}/codexspec-logo-light.svg +0 -0
  38. {codexspec-0.7.7 → codexspec-0.7.9}/scripts/bash/check-i18n-completeness.sh +0 -0
  39. {codexspec-0.7.7 → codexspec-0.7.9}/scripts/bash/check-i18n-structure.sh +0 -0
  40. {codexspec-0.7.7 → codexspec-0.7.9}/scripts/bash/check-prerequisites.sh +0 -0
  41. {codexspec-0.7.7 → codexspec-0.7.9}/scripts/bash/common.sh +0 -0
  42. {codexspec-0.7.7 → codexspec-0.7.9}/scripts/bash/create-new-feature.sh +0 -0
  43. {codexspec-0.7.7 → codexspec-0.7.9}/scripts/bash/review-context.sh +0 -0
  44. {codexspec-0.7.7 → codexspec-0.7.9}/scripts/powershell/check-prerequisites.ps1 +0 -0
  45. {codexspec-0.7.7 → codexspec-0.7.9}/scripts/powershell/common.ps1 +0 -0
  46. {codexspec-0.7.7 → codexspec-0.7.9}/scripts/powershell/create-new-feature.ps1 +0 -0
  47. {codexspec-0.7.7 → codexspec-0.7.9}/scripts/powershell/review-context.ps1 +0 -0
  48. {codexspec-0.7.7 → codexspec-0.7.9}/src/codexspec/commands/__init__.py +0 -0
  49. {codexspec-0.7.7 → codexspec-0.7.9}/src/codexspec/i18n.py +0 -0
  50. {codexspec-0.7.7 → codexspec-0.7.9}/src/codexspec/idea.md +0 -0
  51. {codexspec-0.7.7 → codexspec-0.7.9}/src/codexspec/integrations/__init__.py +0 -0
  52. {codexspec-0.7.7 → codexspec-0.7.9}/src/codexspec/integrations/base.py +0 -0
  53. {codexspec-0.7.7 → codexspec-0.7.9}/src/codexspec/integrations/claude.py +0 -0
  54. {codexspec-0.7.7 → codexspec-0.7.9}/src/codexspec/translator.py +0 -0
  55. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/checklist.md +0 -0
  56. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/clarify.md +0 -0
  57. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/commit-staged.md +0 -0
  58. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/config.md +0 -0
  59. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/constitution.md +0 -0
  60. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/evolve.md +0 -0
  61. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/pr.md +0 -0
  62. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/quick.md +0 -0
  63. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/review-code.md +0 -0
  64. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/review-spec.md +0 -0
  65. {codexspec-0.7.7 → codexspec-0.7.9}/templates/commands/tasks-to-issues.md +0 -0
  66. {codexspec-0.7.7 → codexspec-0.7.9}/templates/docs/checklist-template.md +0 -0
  67. {codexspec-0.7.7 → codexspec-0.7.9}/templates/docs/constitution-template.md +0 -0
  68. {codexspec-0.7.7 → codexspec-0.7.9}/templates/docs/requirements-template.md +0 -0
  69. {codexspec-0.7.7 → codexspec-0.7.9}/templates/docs/spec-template-detailed.md +0 -0
  70. {codexspec-0.7.7 → codexspec-0.7.9}/templates/docs/spec-template-simple.md +0 -0
  71. {codexspec-0.7.7 → codexspec-0.7.9}/templates/docs/tasks-template-detailed.md +0 -0
  72. {codexspec-0.7.7 → codexspec-0.7.9}/templates/docs/tasks-template-simple.md +0 -0
@@ -1,6 +1,6 @@
1
- Metadata-Version: 2.4
1
+ Metadata-Version: 2.5
2
2
  Name: codexspec
3
- Version: 0.7.7
3
+ Version: 0.7.9
4
4
  Summary: CodexSpec - A Requirements-First 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
@@ -166,9 +166,12 @@ CodexSpec is built on the belief that **effective AI-assisted development requir
166
166
  CodexSpec structures development into **reviewable checkpoints**:
167
167
 
168
168
  ```
169
- Idea → /specify → requirements.md → /generate-spec → spec.md → /spec-to-plan → plan.md → /plan-to-tasks → tasks.md → /implement
170
- │ │ │
171
- Review spec Review plan Review tasks
169
+ Idea → /specify → requirements.md
170
+ → /generate-spec → spec.md → review-spec
171
+ → /spec-to-design → design.md → review-design
172
+ → /spec-to-plan → plan.md → review-plan
173
+ → /plan-to-tasks → tasks.md → review-tasks
174
+ → /implement-tasks → code
172
175
  ```
173
176
 
174
177
  Confirmed requirements are the highest-priority feature authority. Derived artifacts carry explicit source links so conflicts can be traced back instead of silently propagated.
@@ -176,6 +179,7 @@ Confirmed requirements are the highest-priority feature authority. Derived artif
176
179
  **Every generated artifact has a corresponding review command:**
177
180
 
178
181
  - `spec.md` → `/codexspec:review-spec`
182
+ - `design.md` → `/codexspec:review-design`
179
183
  - `plan.md` → `/codexspec:review-plan`
180
184
  - `tasks.md` → `/codexspec:review-tasks`
181
185
  - All artifacts → `/codexspec:analyze`
@@ -207,6 +211,7 @@ claude
207
211
  > /codexspec:constitution Create principles focused on code quality and testing
208
212
  > /codexspec:specify I want to build a todo application
209
213
  > /codexspec:generate-spec
214
+ > /codexspec:spec-to-design
210
215
  > /codexspec:spec-to-plan
211
216
  > /codexspec:plan-to-tasks
212
217
  > /codexspec:implement-tasks
@@ -355,9 +360,12 @@ The config command will guide you through:
355
360
  CodexSpec breaks development into **reviewable checkpoints**:
356
361
 
357
362
  ```
358
- Idea → /specify → requirements.md → /generate-spec → spec.md → /spec-to-plan → plan.md → /plan-to-tasks → tasks.md → /implement
359
- │ │ │
360
- Review spec Review plan Review tasks
363
+ Idea → /specify → requirements.md
364
+ → /generate-spec → spec.md → review-spec
365
+ → /spec-to-design → design.md → review-design
366
+ → /spec-to-plan → plan.md → review-plan
367
+ → /plan-to-tasks → tasks.md → review-tasks
368
+ → /implement-tasks → code
361
369
  ```
362
370
 
363
371
  ### Workflow Steps
@@ -367,10 +375,11 @@ Idea → /specify → requirements.md → /generate-spec → spec.md → /spec-t
367
375
  | 1. Project Principles | `/codexspec:constitution` | `constitution.md` | ✅ |
368
376
  | 2. Requirement Clarification | `/codexspec:specify` | `requirements.md` | ✅ |
369
377
  | 3. Generate Spec | `/codexspec:generate-spec` | `spec.md` + auto-review | ✅ |
370
- | 4. Technical Planning | `/codexspec:spec-to-plan` | `plan.md` + auto-review | ✅ |
371
- | 5. Task Breakdown | `/codexspec:plan-to-tasks` | `tasks.md` + auto-review | ✅ |
372
- | 6. Cross-Artifact Analysis | `/codexspec:analyze` | Analysis report | ✅ |
373
- | 7. Implementation | `/codexspec:implement-tasks` | Code | - |
378
+ | 4. System Design | `/codexspec:spec-to-design` | `design.md` + auto-review | ✅ |
379
+ | 5. Technical Planning | `/codexspec:spec-to-plan` | `plan.md` + auto-review | ✅ |
380
+ | 6. Task Breakdown | `/codexspec:plan-to-tasks` | `tasks.md` + auto-review | ✅ |
381
+ | 7. Cross-Artifact Analysis | `/codexspec:analyze` | Analysis report | ✅ |
382
+ | 8. Implementation | `/codexspec:implement-tasks` | Code | - |
374
383
 
375
384
  ### specify vs clarify: When to Use Which?
376
385
 
@@ -568,7 +577,8 @@ Implementation follows **conditional TDD workflow**:
568
577
  | `/codexspec:constitution` | Create/update project constitution with cross-artifact validation |
569
578
  | `/codexspec:specify` | Clarify, confirm, and persist requirements in `requirements.md` |
570
579
  | `/codexspec:generate-spec` | Generate `spec.md` document ★ Auto-review |
571
- | `/codexspec:spec-to-plan` | Convert spec to technical plan ★ Auto-review |
580
+ | `/codexspec:spec-to-design` | Produce `design.md` (architecture/components/decisions) ★ Auto-review |
581
+ | `/codexspec:spec-to-plan` | Convert design to implementation plan ★ Auto-review |
572
582
  | `/codexspec:plan-to-tasks` | Break down plan into traceable, verifiable tasks ★ Auto-review |
573
583
  | `/codexspec:implement-tasks` | Execute tasks (conditional TDD) |
574
584
 
@@ -577,6 +587,7 @@ Implementation follows **conditional TDD workflow**:
577
587
  | Command | Description |
578
588
  | ------------------------- | -------------------------------------- |
579
589
  | `/codexspec:review-spec` | Review specification (auto or manual) |
590
+ | `/codexspec:review-design` | Review design (auto or manual) |
580
591
  | `/codexspec:review-plan` | Review technical plan (auto or manual) |
581
592
  | `/codexspec:review-tasks` | Review task breakdown (auto or manual) |
582
593
 
@@ -589,6 +600,7 @@ Implementation follows **conditional TDD workflow**:
589
600
  | `/codexspec:analyze` | Cross-artifact consistency analysis (auto-remediating, severity-based) |
590
601
  | `/codexspec:checklist` | Generate requirements quality checklist |
591
602
  | `/codexspec:tasks-to-issues` | Convert tasks to GitHub Issues |
603
+ | `/codexspec:debug` | Systematic root-cause debugging (4 phases; standalone or escalated from implement-tasks) |
592
604
 
593
605
  #### Self-Evolution Commands
594
606
 
@@ -121,9 +121,12 @@ CodexSpec is built on the belief that **effective AI-assisted development requir
121
121
  CodexSpec structures development into **reviewable checkpoints**:
122
122
 
123
123
  ```
124
- Idea → /specify → requirements.md → /generate-spec → spec.md → /spec-to-plan → plan.md → /plan-to-tasks → tasks.md → /implement
125
- │ │ │
126
- Review spec Review plan Review tasks
124
+ Idea → /specify → requirements.md
125
+ → /generate-spec → spec.md → review-spec
126
+ → /spec-to-design → design.md → review-design
127
+ → /spec-to-plan → plan.md → review-plan
128
+ → /plan-to-tasks → tasks.md → review-tasks
129
+ → /implement-tasks → code
127
130
  ```
128
131
 
129
132
  Confirmed requirements are the highest-priority feature authority. Derived artifacts carry explicit source links so conflicts can be traced back instead of silently propagated.
@@ -131,6 +134,7 @@ Confirmed requirements are the highest-priority feature authority. Derived artif
131
134
  **Every generated artifact has a corresponding review command:**
132
135
 
133
136
  - `spec.md` → `/codexspec:review-spec`
137
+ - `design.md` → `/codexspec:review-design`
134
138
  - `plan.md` → `/codexspec:review-plan`
135
139
  - `tasks.md` → `/codexspec:review-tasks`
136
140
  - All artifacts → `/codexspec:analyze`
@@ -162,6 +166,7 @@ claude
162
166
  > /codexspec:constitution Create principles focused on code quality and testing
163
167
  > /codexspec:specify I want to build a todo application
164
168
  > /codexspec:generate-spec
169
+ > /codexspec:spec-to-design
165
170
  > /codexspec:spec-to-plan
166
171
  > /codexspec:plan-to-tasks
167
172
  > /codexspec:implement-tasks
@@ -310,9 +315,12 @@ The config command will guide you through:
310
315
  CodexSpec breaks development into **reviewable checkpoints**:
311
316
 
312
317
  ```
313
- Idea → /specify → requirements.md → /generate-spec → spec.md → /spec-to-plan → plan.md → /plan-to-tasks → tasks.md → /implement
314
- │ │ │
315
- Review spec Review plan Review tasks
318
+ Idea → /specify → requirements.md
319
+ → /generate-spec → spec.md → review-spec
320
+ → /spec-to-design → design.md → review-design
321
+ → /spec-to-plan → plan.md → review-plan
322
+ → /plan-to-tasks → tasks.md → review-tasks
323
+ → /implement-tasks → code
316
324
  ```
317
325
 
318
326
  ### Workflow Steps
@@ -322,10 +330,11 @@ Idea → /specify → requirements.md → /generate-spec → spec.md → /spec-t
322
330
  | 1. Project Principles | `/codexspec:constitution` | `constitution.md` | ✅ |
323
331
  | 2. Requirement Clarification | `/codexspec:specify` | `requirements.md` | ✅ |
324
332
  | 3. Generate Spec | `/codexspec:generate-spec` | `spec.md` + auto-review | ✅ |
325
- | 4. Technical Planning | `/codexspec:spec-to-plan` | `plan.md` + auto-review | ✅ |
326
- | 5. Task Breakdown | `/codexspec:plan-to-tasks` | `tasks.md` + auto-review | ✅ |
327
- | 6. Cross-Artifact Analysis | `/codexspec:analyze` | Analysis report | ✅ |
328
- | 7. Implementation | `/codexspec:implement-tasks` | Code | - |
333
+ | 4. System Design | `/codexspec:spec-to-design` | `design.md` + auto-review | ✅ |
334
+ | 5. Technical Planning | `/codexspec:spec-to-plan` | `plan.md` + auto-review | ✅ |
335
+ | 6. Task Breakdown | `/codexspec:plan-to-tasks` | `tasks.md` + auto-review | ✅ |
336
+ | 7. Cross-Artifact Analysis | `/codexspec:analyze` | Analysis report | ✅ |
337
+ | 8. Implementation | `/codexspec:implement-tasks` | Code | - |
329
338
 
330
339
  ### specify vs clarify: When to Use Which?
331
340
 
@@ -523,7 +532,8 @@ Implementation follows **conditional TDD workflow**:
523
532
  | `/codexspec:constitution` | Create/update project constitution with cross-artifact validation |
524
533
  | `/codexspec:specify` | Clarify, confirm, and persist requirements in `requirements.md` |
525
534
  | `/codexspec:generate-spec` | Generate `spec.md` document ★ Auto-review |
526
- | `/codexspec:spec-to-plan` | Convert spec to technical plan ★ Auto-review |
535
+ | `/codexspec:spec-to-design` | Produce `design.md` (architecture/components/decisions) ★ Auto-review |
536
+ | `/codexspec:spec-to-plan` | Convert design to implementation plan ★ Auto-review |
527
537
  | `/codexspec:plan-to-tasks` | Break down plan into traceable, verifiable tasks ★ Auto-review |
528
538
  | `/codexspec:implement-tasks` | Execute tasks (conditional TDD) |
529
539
 
@@ -532,6 +542,7 @@ Implementation follows **conditional TDD workflow**:
532
542
  | Command | Description |
533
543
  | ------------------------- | -------------------------------------- |
534
544
  | `/codexspec:review-spec` | Review specification (auto or manual) |
545
+ | `/codexspec:review-design` | Review design (auto or manual) |
535
546
  | `/codexspec:review-plan` | Review technical plan (auto or manual) |
536
547
  | `/codexspec:review-tasks` | Review task breakdown (auto or manual) |
537
548
 
@@ -544,6 +555,7 @@ Implementation follows **conditional TDD workflow**:
544
555
  | `/codexspec:analyze` | Cross-artifact consistency analysis (auto-remediating, severity-based) |
545
556
  | `/codexspec:checklist` | Generate requirements quality checklist |
546
557
  | `/codexspec:tasks-to-issues` | Convert tasks to GitHub Issues |
558
+ | `/codexspec:debug` | Systematic root-cause debugging (4 phases; standalone or escalated from implement-tasks) |
547
559
 
548
560
  #### Self-Evolution Commands
549
561
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codexspec"
3
- version = "0.7.7"
3
+ version = "0.7.9"
4
4
  description = "CodexSpec - A Requirements-First SDD toolkit for Claude Code"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -40,10 +40,11 @@ from .i18n import (
40
40
  update_language_field,
41
41
  )
42
42
  from .integrations import get_integrations
43
+ from .profile import ensure_profile_scaffold, inject_profile_block
43
44
  from .translator import SUPPORTED_LANGUAGES, translate
44
45
 
45
46
  # Version info
46
- __version__ = "0.7.7"
47
+ __version__ = "0.7.9"
47
48
  __author__ = "CodexSpec Team"
48
49
 
49
50
  # Constitution file path constants
@@ -706,6 +707,11 @@ def init(
706
707
  (codexspec_dir / "templates" / "docs").mkdir(exist_ok=True)
707
708
  (codexspec_dir / "scripts").mkdir(exist_ok=True)
708
709
 
710
+ # Ensure the profile scaffold unconditionally (independent of integrations),
711
+ # so knowledge distilled later is effective immediately with no re-init and
712
+ # no dangling reference. Non-destructive: existing profile files are kept.
713
+ ensure_profile_scaffold(target_dir)
714
+
709
715
  # Copy helper scripts based on platform
710
716
  scripts_source_dir = get_scripts_dir()
711
717
  if scripts_source_dir.exists():
@@ -884,6 +890,10 @@ def init(
884
890
  prepend_compliance_section(claude_md)
885
891
  console.print(f"[green]{translate('cli.init.compliance_added', normalized_lang)}[/green]")
886
892
 
893
+ # Inject the profile block AFTER creation/compliance so it never clobbers
894
+ # the compliance @import or the user's body (bounded, idempotent).
895
+ inject_profile_block(claude_md)
896
+
887
897
  # Initialize git if requested
888
898
  if not no_git and not (target_dir / ".git").exists():
889
899
  try:
@@ -47,11 +47,11 @@ def get_commands_metadata() -> list[CommandMetadata]:
47
47
 
48
48
  Returns:
49
49
  List of CommandMetadata dictionaries sorted by category priority:
50
- core (9) -> enhanced (6) -> git (2) -> review (1) -> utility (2)
51
- Total: 20 commands
50
+ core (11) -> enhanced (7) -> git (2) -> review (1) -> utility (2)
51
+ Total: 23 commands
52
52
  """
53
53
  return [
54
- # Core Commands (9)
54
+ # Core Commands (11)
55
55
  {
56
56
  "name": "constitution",
57
57
  "display_name": "/codexspec:constitution",
@@ -73,10 +73,17 @@ def get_commands_metadata() -> list[CommandMetadata]:
73
73
  "category": "core",
74
74
  "file_name": "generate-spec.md",
75
75
  },
76
+ {
77
+ "name": "spec-to-design",
78
+ "display_name": "/codexspec:spec-to-design",
79
+ "description": "将已确认的规格转换为可追溯的设计文档(架构/组件/关键设计决策)",
80
+ "category": "core",
81
+ "file_name": "spec-to-design.md",
82
+ },
76
83
  {
77
84
  "name": "spec-to-plan",
78
85
  "display_name": "/codexspec:spec-to-plan",
79
- "description": "将已确认的规格转换为可追溯的技术计划",
86
+ "description": "将已确认的设计转换为可追溯的实现计划",
80
87
  "category": "core",
81
88
  "file_name": "spec-to-plan.md",
82
89
  },
@@ -94,6 +101,13 @@ def get_commands_metadata() -> list[CommandMetadata]:
94
101
  "category": "core",
95
102
  "file_name": "review-spec.md",
96
103
  },
104
+ {
105
+ "name": "review-design",
106
+ "display_name": "/codexspec:review-design",
107
+ "description": "审查设计的忠实度、可行性与规划就绪度",
108
+ "category": "core",
109
+ "file_name": "review-design.md",
110
+ },
97
111
  {
98
112
  "name": "review-plan",
99
113
  "display_name": "/codexspec:review-plan",
@@ -115,7 +129,7 @@ def get_commands_metadata() -> list[CommandMetadata]:
115
129
  "category": "core",
116
130
  "file_name": "implement-tasks.md",
117
131
  },
118
- # Enhanced Commands (4)
132
+ # Enhanced Commands (7)
119
133
  {
120
134
  "name": "clarify",
121
135
  "display_name": "/codexspec:clarify",
@@ -158,6 +172,13 @@ def get_commands_metadata() -> list[CommandMetadata]:
158
172
  "category": "enhanced",
159
173
  "file_name": "evolve.md",
160
174
  },
175
+ {
176
+ "name": "debug",
177
+ "display_name": "/codexspec:debug",
178
+ "description": "系统化根因排查(四阶段:复现→定位根因→单一修复),可独立调用或由 implement-tasks 升级进入",
179
+ "category": "enhanced",
180
+ "file_name": "debug.md",
181
+ },
161
182
  # Git Workflow Commands (2)
162
183
  {
163
184
  "name": "commit-staged",
@@ -10,6 +10,7 @@ from typing import Any
10
10
  import yaml
11
11
 
12
12
  from codexspec.commands.installer import get_commands_metadata
13
+ from codexspec.profile import inject_profile_block
13
14
  from codexspec.translator import load_translation_cache, translate_template_frontmatter
14
15
 
15
16
  CODEXSPEC_CONTEXT_START = "<!-- CODEXSPEC START -->"
@@ -90,6 +91,10 @@ class CodexIntegration:
90
91
 
91
92
  context_path.write_text(updated, encoding="utf-8")
92
93
 
94
+ # Inject the profile block (pointers only, no @import) alongside the
95
+ # skills section, as its own bounded, idempotent managed block.
96
+ inject_profile_block(context_path)
97
+
93
98
  def render_skill(self, command_name: str, content: str, fallback_description: str = "") -> str:
94
99
  """Render one command template into a Codex SKILL.md."""
95
100
  frontmatter, body = _split_frontmatter(content)
@@ -110,6 +115,7 @@ Use these Codex skills when working on CodexSpec workflows:
110
115
  - `$codexspec:constitution` to create or update project principles.
111
116
  - `$codexspec:specify` to capture confirmed requirements.
112
117
  - `$codexspec:generate-spec` to produce `spec.md`.
118
+ - `$codexspec:spec-to-design` to produce `design.md`.
113
119
  - `$codexspec:spec-to-plan` to produce `plan.md`.
114
120
  - `$codexspec:plan-to-tasks` to produce `tasks.md`.
115
121
  - `$codexspec:implement-tasks` to implement approved tasks.
@@ -0,0 +1,112 @@
1
+ """Project-profile consumption.
2
+
3
+ Wires a user project's ``.codexspec/profile/`` into the AI context files so that
4
+ knowledge distilled by ``/codexspec:distill`` is consulted in later work.
5
+
6
+ Store layout: **one record per file** under a per-category directory
7
+ (``constraints/`` ``conventions/`` ``pitfalls/`` ``decisions/``). Because parallel
8
+ feature branches each add differently-named record files, their distilled
9
+ knowledge merges without conflict.
10
+
11
+ Two concerns live here:
12
+
13
+ - ``ensure_profile_scaffold`` — create the four category directories (each kept
14
+ by a ``.gitkeep``) so every injected reference resolves, independent of whether
15
+ any knowledge has been distilled yet.
16
+ - ``render_profile_block`` / ``inject_profile_block`` — render a bounded,
17
+ channel-neutral managed block (pointers only, no ``@import``) and inject it
18
+ idempotently into a context file (CLAUDE.md or AGENTS.md) without disturbing any
19
+ other content.
20
+
21
+ See the feature record under
22
+ ``.codexspec/specs/2026-0812-14054p-profile-consumption/``.
23
+ """
24
+
25
+ import re
26
+ from pathlib import Path
27
+
28
+ # Ordered: constraints first (highest weight, honored first). Each is a directory
29
+ # holding one record per file.
30
+ PROFILE_CATEGORIES = ("constraints", "conventions", "pitfalls", "decisions")
31
+
32
+ PROFILE_BLOCK_START = "<!-- CODEXSPEC PROFILE START -->"
33
+ PROFILE_BLOCK_END = "<!-- CODEXSPEC PROFILE END -->"
34
+
35
+ # Channel-neutral: identical for CLAUDE.md and AGENTS.md. Constraints are a strong
36
+ # mandatory pointer (no @import), so the block depends on no tool-specific import
37
+ # mechanism and the store can be one-file-per-record directories. Assembled from
38
+ # short literals to keep each source line within the line-length limit.
39
+ _PROFILE_BLOCK = "".join(
40
+ [
41
+ f"{PROFILE_BLOCK_START}\n",
42
+ "## CodexSpec Project Profile\n\n",
43
+ "**Project constraints (highest priority — read these FIRST):** before any non-trivial work you MUST ",
44
+ "read every record under `.codexspec/profile/constraints/` — the project's hard prohibitions ",
45
+ "(严禁 / 仅允许). Honor them before anything else.\n\n",
46
+ "**Project profile — consult on demand when relevant to the task** ",
47
+ "(each directory holds one record per file):\n\n",
48
+ "- `.codexspec/profile/conventions/` — cross-feature conventions / steering; ",
49
+ "read before adopting a pattern, structure, or naming choice.\n",
50
+ "- `.codexspec/profile/pitfalls/` — known traps and their workarounds; ",
51
+ "read before implementing or debugging in an area that may have bitten before.\n",
52
+ "- `.codexspec/profile/decisions/` — past cross-feature / architectural decisions; ",
53
+ "read before deciding in the same area, to reuse prior rationale rather than re-litigate it.\n\n",
54
+ "Read the full record — each carries a `status` of `candidate` or `vetted`; ",
55
+ "weight `candidate` items with appropriate caution. A directory may be empty ",
56
+ "until `/codexspec:distill` has captured knowledge.\n",
57
+ f"{PROFILE_BLOCK_END}\n",
58
+ ]
59
+ )
60
+
61
+
62
+ def ensure_profile_scaffold(target_dir: Path) -> Path:
63
+ """Create ``.codexspec/profile/`` and its four category directories if absent.
64
+
65
+ Each category is a directory of one-record-per-file entries; a ``.gitkeep``
66
+ keeps an empty category tracked so every pointer resolves. Idempotent and
67
+ non-destructive: existing records and directories are never overwritten.
68
+ """
69
+ profile_dir = target_dir / ".codexspec" / "profile"
70
+ for category in PROFILE_CATEGORIES:
71
+ category_dir = profile_dir / category
72
+ category_dir.mkdir(parents=True, exist_ok=True)
73
+ keep = category_dir / ".gitkeep"
74
+ if not keep.exists():
75
+ keep.write_text("", encoding="utf-8")
76
+ return profile_dir
77
+
78
+
79
+ def render_profile_block() -> str:
80
+ """Render the bounded managed profile block.
81
+
82
+ Identical for CLAUDE.md and AGENTS.md: constraints and the three on-demand
83
+ categories are all delivered as pointers to their directories — no ``@import``
84
+ anywhere — so the block is channel-neutral and the store can be
85
+ one-file-per-record directories that merge without conflict.
86
+ """
87
+ return _PROFILE_BLOCK
88
+
89
+
90
+ def inject_profile_block(context_path: Path) -> None:
91
+ """Idempotently inject/update the profile block in ``context_path``.
92
+
93
+ Only the bounded ``<!-- CODEXSPEC PROFILE START/END -->`` region is written;
94
+ any other content in the file is preserved verbatim. Creates the file if it
95
+ does not exist.
96
+ """
97
+ block = render_profile_block().rstrip("\n")
98
+ existing = context_path.read_text(encoding="utf-8") if context_path.exists() else ""
99
+
100
+ pattern = re.compile(
101
+ re.escape(PROFILE_BLOCK_START) + r".*?" + re.escape(PROFILE_BLOCK_END),
102
+ re.DOTALL,
103
+ )
104
+ if pattern.search(existing):
105
+ # Function replacement avoids backslash/group interpretation in `block`.
106
+ updated = pattern.sub(lambda _match: block, existing)
107
+ elif existing.strip():
108
+ updated = existing.rstrip() + "\n\n" + block + "\n"
109
+ else:
110
+ updated = block + "\n"
111
+
112
+ context_path.write_text(updated, encoding="utf-8")
@@ -22,7 +22,7 @@ Converse in the interaction language and author artifacts in the document langua
22
22
 
23
23
  This command detects cross-artifact inconsistencies **and auto-remediates them**. It is not read-only.
24
24
 
25
- - `requirements.md` is the single source of truth. analyze **never modifies `requirements.md`**. Every fix conforms the downstream artifacts (`spec.md`, `plan.md`, `tasks.md`) to `requirements.md`; the fix direction is uniquely determined by the authority hierarchy (requirements > spec > plan > tasks) and never requires inventing intent.
25
+ - `requirements.md` is the single source of truth. analyze **never modifies `requirements.md`**. Every fix conforms the downstream artifacts (`spec.md`, `design.md`, `plan.md`, `tasks.md`) to `requirements.md`; the fix direction is uniquely determined by the authority hierarchy (requirements > spec > design > plan > tasks) and never requires inventing intent.
26
26
  - Auto-apply deterministic, authority-directed fixes **by default** — both when invoked manually and when invoked inside the `auto_next` chain — with no confirmation prompt and no human-escalation path.
27
27
 
28
28
  Resolve the feature by explicit path, then current branch. Ask the user if it is ambiguous; never select the latest feature silently.
@@ -33,10 +33,13 @@ Load:
33
33
 
34
34
  - `requirements.md`
35
35
  - `spec.md`
36
+ - `design.md`
36
37
  - `plan.md`
37
38
  - `tasks.md`
38
39
  - Constitution
39
40
 
41
+ A legacy feature may have no `design.md`; when it is absent, analyze the chain without the design link and proceed.
42
+
40
43
  Legacy compatibility: if `requirements.md` is missing, state that the analysis starts at `spec.md` and cannot validate fidelity to the original discussion. In legacy mode there is no source of truth to conform to, so do not auto-modify artifacts; report findings only.
41
44
 
42
45
  ## End-to-End Traceability
@@ -46,7 +49,8 @@ Build the chain:
46
49
  ```text
47
50
  confirmed NEED/CON/DEC/OUT
48
51
  -> REQ/NFR Sources
49
- -> plan Covers
52
+ -> design Covers
53
+ -> plan Covers (Covers: REQ; Design: <component>)
50
54
  -> task Covers + Plan reference
51
55
  ```
52
56
 
@@ -54,7 +58,8 @@ Detect:
54
58
 
55
59
  - Confirmed requirements with no spec coverage
56
60
  - Spec requirements with missing or invalid sources
57
- - Spec requirements with no plan coverage
61
+ - Spec requirements with no design coverage
62
+ - Design components with no plan coverage
58
63
  - Plan deliverables with no task coverage
59
64
  - Tasks with no upstream authority or implementation-support justification
60
65
  - Semantic drift, scope expansion, contradictions, and use of superseded/open entries
@@ -89,7 +94,7 @@ Produce:
89
94
 
90
95
  - Authority mode
91
96
  - End-to-end coverage table
92
- - Applied remediations: the exact downstream edits made to `spec.md`/`plan.md`/`tasks.md` and why, or "none"
97
+ - Applied remediations: the exact downstream edits made to `spec.md`/`design.md`/`plan.md`/`tasks.md` and why, or "none"
93
98
  - Verified defects by severity that were not auto-remediable (for example, a reported-only tie-break conflict)
94
99
  - Unmapped or unauthorized items
95
100
  - Risk Advisories
@@ -0,0 +1,80 @@
1
+ ---
2
+ description: Debug a failure to its root cause before proposing any fix
3
+ argument-hint: "[error text | failing test | file:line | plain-language symptom]"
4
+ allowed-tools: Read, Grep, Glob, Bash, Edit, Write
5
+ ---
6
+
7
+ # Systematic Debugger
8
+
9
+ ## Language Preference
10
+
11
+ Read `.codexspec/config.yml`. Two independent language controls apply (each falls back to `language.output`, then English):
12
+
13
+ - **Interaction language** (`language.interaction`): language for all conversation with the user — questions, explanations, status messages, and `codexspec` CLI terminal output.
14
+ - **Document language** (`language.document`): language for generated artifact files (requirements/spec/plan/tasks).
15
+
16
+ Converse in the interaction language and author artifacts in the document language. Apply the project's translation standard to both: translate by meaning (not word-for-word), keep English for terms with no good native equivalent, and write as if originally in that language.
17
+
18
+ ## User Input
19
+
20
+ `$ARGUMENTS`
21
+
22
+ ## Role and Iron Law
23
+
24
+ You debug a reported symptom to its **root cause** and apply exactly one verified fix.
25
+
26
+ **Iron Law: NO FIX BEFORE ROOT CAUSE.** You MUST NOT propose, apply, or even sketch a fix until Phase 1 has established what is actually wrong and why. Symptom patches — wrapping the error, silencing a failing assertion, retrying blindly — are failures, not fixes.
27
+
28
+ Red flags that mean STOP and return to Phase 1: "let me just try changing X", "add a try/except here", "it's probably the Y" — any edit attempted before the failure is reproduced and understood.
29
+
30
+ You leave **no persistent artifact**: no report file, no debug journal. Your output is the fix plus a concise root-cause explanation in the conversation. (Reusable, cross-feature lessons are captured separately by `/codexspec:distill`, never written here.)
31
+
32
+ ## Symptom Intake
33
+
34
+ Take the symptom from `$ARGUMENTS` when provided — an error or stack trace, a failing-test id, a `file:line`, or a plain-language description — otherwise from error output already visible in this session.
35
+
36
+ When the symptom is too thin to act on, **reproduce-or-ask** before doing anything else:
37
+
38
+ - First attempt to reproduce it yourself: run the failing test, exercise the path, read the log or stack trace.
39
+ - If you still cannot reproduce it reliably, ask the user for exactly what is missing — reproduction steps, the precise input that triggers it, expected-vs-actual behavior, the verbatim error, and when it started.
40
+ - Do NOT propose a fix for an unreproduced symptom.
41
+
42
+ ## Investigation Protocol
43
+
44
+ Work the phases in order. Phase 1 is a hard gate.
45
+
46
+ ### Phase 1 — Root-Cause Investigation (hard gate)
47
+
48
+ - Read the error/failure carefully and completely; do not skim.
49
+ - Reproduce it consistently. A flaky or order-dependent failure must be made reliably reproducible before you continue.
50
+ - Check what changed recently — the diff, recent commits, configuration.
51
+ - Trace the data and control flow **backward** from the symptom to where the wrong state originates. Inspect enough callers, callees, and inputs to locate the true origin; it is often not where the error surfaces.
52
+ - **Exit criterion**: you can state, in one sentence, WHAT is wrong and WHY. Until then, no fix.
53
+
54
+ ### Phase 2 — Pattern Analysis
55
+
56
+ - Find a working reference: a passing sibling test, an analogous code path, or an earlier good state.
57
+ - Compare the failing case against it and enumerate every material difference.
58
+ - Identify which difference actually explains the root cause.
59
+
60
+ ### Phase 3 — Hypothesis & Verification
61
+
62
+ - Write down a single, specific hypothesis about the root cause.
63
+ - Test it minimally — change one variable at a time, and predict the outcome before observing it.
64
+ - Confirm or reject. If rejected, reformulate; do not stack untested guesses.
65
+
66
+ ### Phase 4 — Fix
67
+
68
+ - Write a failing test first that captures the defect (a reproducing regression test) and observe it fail for the right reason. For a symptom with no natural unit test — a documentation or configuration defect, a production-log incident — construct the closest reproducing check instead.
69
+ - Apply a single, minimal fix that targets the root cause — not the symptom, and no "while I'm here" changes.
70
+ - Verify: the new test passes and no previously-passing test breaks.
71
+
72
+ ### Architecture Gate (≥3 failed fixes)
73
+
74
+ If three fixes for the same problem have failed, STOP. Do not attempt a fourth blind fix. Repeated failure is evidence that the model of the problem — or the architecture — is wrong. Surface it: state what was tried, why each attempt failed, and what architectural question must be answered before continuing.
75
+
76
+ ## Completion
77
+
78
+ - Report the root cause (one or two sentences), the fix applied, and the verification that shows it green.
79
+ - **When you were entered from another command** (for example, `implement-tasks` escalated into this discipline), do not end the session: hand control back and **resume that command** exactly where it left off, now with the defect resolved.
80
+ - If you could not reach a root cause, or you hit the Architecture Gate, say so plainly with the evidence. Never paper over it with a speculative fix.
@@ -42,17 +42,18 @@ Apply this boundary test to every candidate: **"Would a single feature's `requir
42
42
 
43
43
  ## The profile store: `.codexspec/profile/`
44
44
 
45
- Four markdown files, each holding **only current-effective** knowledge — dense, with no "retired" section (git history is the ledger). Create the directory and file on first write.
45
+ Four **category directories**, each holding **one record per file** (`<id>.md`) with **only current-effective** knowledge — dense, with no "retired" section (git history is the ledger). One-file-per-record is deliberate: parallel feature branches each add differently-named files, so distilled knowledge merges without conflict. Create the directory and record file on first write.
46
46
 
47
- - `constraints.md` — negative constraints (`严禁 / 仅允许`). These carry the **highest** weight and MUST be honored first.
48
- - `conventions.md` — positive cross-feature conventions / steering.
49
- - `pitfalls.md` — cross-feature traps and their workarounds.
50
- - `decisions.md` — cross-feature / architectural decisions only (ADR-lite). **Never** single-feature requirement rationale.
47
+ - `constraints/` — negative constraints (`严禁 / 仅允许`). These carry the **highest** weight and MUST be honored first.
48
+ - `conventions/` — positive cross-feature conventions / steering.
49
+ - `pitfalls/` — cross-feature traps and their workarounds.
50
+ - `decisions/` — cross-feature / architectural decisions only (ADR-lite). **Never** single-feature requirement rationale.
51
51
 
52
52
  ### Record format — `claim` and `evidence` physically separated
53
53
 
54
54
  Every record MUST separate the distilled claim from the evidence it rests on:
55
55
 
56
+ - `id` — **type letter + full source-feature id + local sequence**, e.g. `P-2026-0812-14054p-1` or `Con-2026-0812-14054p-1`. It is **both** the record's `### <id>: <title>` heading **and its filename** (`pitfalls/P-2026-0812-14054p-1.md`). The **source-feature id** is the distilling feature's full spec-dir id `{YYYY-MMDD-HHMM}{rr}` (e.g. `2026-0812-14054p`); it is globally unique by the timestamp+random scheme spec directories use, so records distilled on parallel feature branches never collide on id **or filename** (they merge with no conflict). Keep the **full** id (not a short tail) so the record is self-describing: the date supports recency/staleness reading, and the feature id ties the record to its originating change for decision context and scope. When distilling with no feature context, generate a fresh `{YYYY-MMDD-HHMM}{rr}` id now (same convention as create-new-feature). **Never** use a bare sequential id such as `P-001` — those collide across parallel branches.
56
57
  - `claim` — one-sentence reusable statement.
57
58
  - `type` — `convention` | `constraint` | `pitfall` | `decision` (`constraint` = highest priority).
58
59
  - `scope/when` — natural-language applicability condition (e.g. "when editing Python code"); omit for global. **No formal syntax.**
@@ -63,10 +64,10 @@ Every record MUST separate the distilled claim from the evidence it rests on:
63
64
 
64
65
  This separation is what makes a later error locatable as **misread** (facts wrong) vs **overreach** (claim over-generalized) vs **stale** (state no longer holds).
65
66
 
66
- Example entry:
67
+ Example entry — file `conventions/Con-2026-0809-2219gg-1.md`:
67
68
 
68
69
  ```markdown
69
- ### C-003: Prefer absolute imports
70
+ ### Con-2026-0809-2219gg-1: Prefer absolute imports
70
71
  - claim: Always use absolute imports in `src/`.
71
72
  - type: convention
72
73
  - scope/when: Python modules under `src/`
@@ -80,7 +81,7 @@ Example entry:
80
81
 
81
82
  Read the interaction segment and extract, per the dimensions above, only **verified** knowledge — prefer facts confirmed by outcomes over speculation; speculation MUST NOT become `vetted`.
82
83
 
83
- Before writing, **read the current profile** and skip anything already covered; update anything changed via `replace`. **This is how deduplication is done — by judgment, not an algorithm.**
84
+ Before writing, **read the current profile** (the record files under each category directory) and skip anything already covered; update anything changed via `replace`. **This is how deduplication is done — by judgment, not an algorithm.**
84
85
 
85
86
  ## Conflict adjudication
86
87
 
@@ -93,13 +94,13 @@ When a new item conflicts with an existing rule, resolve in this order:
93
94
 
94
95
  ## Mutation discipline
95
96
 
96
- Change the profile **only** through three conceptual operations (you edit the markdown directly — these are a discipline, **not** a tool API or matching algorithm):
97
+ Change the profile **only** through three conceptual operations (you edit the files directly — these are a discipline, **not** a tool API or matching algorithm):
97
98
 
98
- - `add` — append a new verified item.
99
- - `replace` — supersede an outdated/wrong item in place (keeps files dense).
100
- - `remove` — delete an item invalidated by a changed environment.
99
+ - `add` — create a new record file `<category>/<id>.md` for a verified item.
100
+ - `replace` — supersede an outdated/wrong item **in its own file** (keeps records dense).
101
+ - `remove` — delete the record's file when a changed environment invalidates it.
101
102
 
102
- git history is the audit ledger. Do **NOT** keep a retired section inside the files.
103
+ git history is the audit ledger. Do **NOT** keep a retired file or a retired section.
103
104
 
104
105
  ## Vetting candidates (manual, interactive)
105
106