codexspec 0.7.18__tar.gz → 0.7.20__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 (103) hide show
  1. {codexspec-0.7.18 → codexspec-0.7.20}/PKG-INFO +8 -7
  2. {codexspec-0.7.18 → codexspec-0.7.20}/README.md +7 -6
  3. {codexspec-0.7.18 → codexspec-0.7.20}/pyproject.toml +1 -1
  4. {codexspec-0.7.18 → codexspec-0.7.20}/scripts/powershell/check-prerequisites.ps1 +1 -1
  5. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/__init__.py +175 -8
  6. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/commands/installer.py +41 -3
  7. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/integrations/codex.py +20 -2
  8. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/worktrees.py +153 -31
  9. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/auto-dev.md +1 -1
  10. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/config.md +24 -0
  11. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/debug.md +4 -1
  12. codexspec-0.7.18/templates/commands/spec-to-plan.md → codexspec-0.7.20/templates/commands/design-to-plan.md +1 -1
  13. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/implement-tasks.md +98 -20
  14. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/quick.md +1 -1
  15. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/review-code.md +78 -10
  16. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/spec-to-design.md +2 -2
  17. {codexspec-0.7.18 → codexspec-0.7.20}/templates/translations/de.json +2 -2
  18. {codexspec-0.7.18 → codexspec-0.7.20}/templates/translations/en.json +2 -2
  19. {codexspec-0.7.18 → codexspec-0.7.20}/templates/translations/es.json +2 -2
  20. {codexspec-0.7.18 → codexspec-0.7.20}/templates/translations/fr.json +2 -2
  21. {codexspec-0.7.18 → codexspec-0.7.20}/templates/translations/ja.json +2 -2
  22. {codexspec-0.7.18 → codexspec-0.7.20}/templates/translations/ko.json +2 -2
  23. {codexspec-0.7.18 → codexspec-0.7.20}/templates/translations/pt-BR.json +2 -2
  24. {codexspec-0.7.18 → codexspec-0.7.20}/templates/translations/zh-CN.json +2 -2
  25. {codexspec-0.7.18 → codexspec-0.7.20}/.gitignore +0 -0
  26. {codexspec-0.7.18 → codexspec-0.7.20}/LICENSE +0 -0
  27. {codexspec-0.7.18 → codexspec-0.7.20}/codexspec-icon.svg +0 -0
  28. {codexspec-0.7.18 → codexspec-0.7.20}/codexspec-logo-dark.svg +0 -0
  29. {codexspec-0.7.18 → codexspec-0.7.20}/codexspec-logo-light.svg +0 -0
  30. {codexspec-0.7.18 → codexspec-0.7.20}/scripts/bash/check-i18n-completeness.sh +0 -0
  31. {codexspec-0.7.18 → codexspec-0.7.20}/scripts/bash/check-i18n-structure.sh +0 -0
  32. {codexspec-0.7.18 → codexspec-0.7.20}/scripts/bash/check-prerequisites.sh +0 -0
  33. {codexspec-0.7.18 → codexspec-0.7.20}/scripts/bash/common.sh +0 -0
  34. {codexspec-0.7.18 → codexspec-0.7.20}/scripts/bash/create-new-feature.sh +0 -0
  35. {codexspec-0.7.18 → codexspec-0.7.20}/scripts/bash/review-context.sh +0 -0
  36. {codexspec-0.7.18 → codexspec-0.7.20}/scripts/powershell/common.ps1 +0 -0
  37. {codexspec-0.7.18 → codexspec-0.7.20}/scripts/powershell/create-new-feature.ps1 +0 -0
  38. {codexspec-0.7.18 → codexspec-0.7.20}/scripts/powershell/review-context.ps1 +0 -0
  39. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/automation.py +0 -0
  40. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/blueprint.py +0 -0
  41. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/commands/__init__.py +0 -0
  42. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/__init__.py +0 -0
  43. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/app.js +0 -0
  44. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/i18n/ar.json +0 -0
  45. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/i18n/de.json +0 -0
  46. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/i18n/en.json +0 -0
  47. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/i18n/es.json +0 -0
  48. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/i18n/fr.json +0 -0
  49. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/i18n/hi.json +0 -0
  50. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/i18n/it.json +0 -0
  51. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/i18n/ja.json +0 -0
  52. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/i18n/ko.json +0 -0
  53. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/i18n/pt.json +0 -0
  54. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/i18n/ru.json +0 -0
  55. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/i18n/zh-CN.json +0 -0
  56. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/i18n/zh-TW.json +0 -0
  57. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/index.html +0 -0
  58. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/assets/styles.css +0 -0
  59. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/domain.py +0 -0
  60. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/lease.py +0 -0
  61. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/models.py +0 -0
  62. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/records.py +0 -0
  63. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/server.py +0 -0
  64. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/session.py +0 -0
  65. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/terminal.py +0 -0
  66. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/distill_review/transaction.py +0 -0
  67. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/i18n.py +0 -0
  68. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/idea.md +0 -0
  69. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/integrations/__init__.py +0 -0
  70. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/integrations/base.py +0 -0
  71. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/integrations/claude.py +0 -0
  72. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/profile.py +0 -0
  73. {codexspec-0.7.18 → codexspec-0.7.20}/src/codexspec/translator.py +0 -0
  74. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/analyze.md +0 -0
  75. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/blueprint.md +0 -0
  76. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/checklist.md +0 -0
  77. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/clarify.md +0 -0
  78. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/commit-staged.md +0 -0
  79. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/constitution.md +0 -0
  80. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/distill.md +0 -0
  81. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/evolve.md +0 -0
  82. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/generate-spec.md +0 -0
  83. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/onboard.md +0 -0
  84. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/plan-to-tasks.md +0 -0
  85. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/pr.md +0 -0
  86. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/release-notes.md +0 -0
  87. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/reverse-spec.md +0 -0
  88. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/review-design.md +0 -0
  89. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/review-plan.md +0 -0
  90. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/review-spec.md +0 -0
  91. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/review-tasks.md +0 -0
  92. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/specify.md +0 -0
  93. {codexspec-0.7.18 → codexspec-0.7.20}/templates/commands/tasks-to-issues.md +0 -0
  94. {codexspec-0.7.18 → codexspec-0.7.20}/templates/docs/checklist-template.md +0 -0
  95. {codexspec-0.7.18 → codexspec-0.7.20}/templates/docs/constitution-template.md +0 -0
  96. {codexspec-0.7.18 → codexspec-0.7.20}/templates/docs/design-template.md +0 -0
  97. {codexspec-0.7.18 → codexspec-0.7.20}/templates/docs/plan-template-detailed.md +0 -0
  98. {codexspec-0.7.18 → codexspec-0.7.20}/templates/docs/plan-template-simple.md +0 -0
  99. {codexspec-0.7.18 → codexspec-0.7.20}/templates/docs/requirements-template.md +0 -0
  100. {codexspec-0.7.18 → codexspec-0.7.20}/templates/docs/spec-template-detailed.md +0 -0
  101. {codexspec-0.7.18 → codexspec-0.7.20}/templates/docs/spec-template-simple.md +0 -0
  102. {codexspec-0.7.18 → codexspec-0.7.20}/templates/docs/tasks-template-detailed.md +0 -0
  103. {codexspec-0.7.18 → codexspec-0.7.20}/templates/docs/tasks-template-simple.md +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: codexspec
3
- Version: 0.7.18
3
+ Version: 0.7.20
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
@@ -169,7 +169,7 @@ CodexSpec structures development into **reviewable checkpoints**:
169
169
  Idea → /specify → requirements.md
170
170
  → /generate-spec → spec.md → review-spec
171
171
  → /spec-to-design → design.md → review-design
172
- → /spec-to-plan → plan.md → review-plan
172
+ → /design-to-plan → plan.md → review-plan
173
173
  → /plan-to-tasks → tasks.md → review-tasks
174
174
  → /implement-tasks → code
175
175
  ```
@@ -212,7 +212,7 @@ claude
212
212
  > /codexspec:specify I want to build a todo application
213
213
  > /codexspec:generate-spec
214
214
  > /codexspec:spec-to-design
215
- > /codexspec:spec-to-plan
215
+ > /codexspec:design-to-plan
216
216
  > /codexspec:plan-to-tasks
217
217
  > /codexspec:implement-tasks
218
218
  ```
@@ -363,7 +363,7 @@ CodexSpec breaks development into **reviewable checkpoints**:
363
363
  Idea → /specify → requirements.md
364
364
  → /generate-spec → spec.md → review-spec
365
365
  → /spec-to-design → design.md → review-design
366
- → /spec-to-plan → plan.md → review-plan
366
+ → /design-to-plan → plan.md → review-plan
367
367
  → /plan-to-tasks → tasks.md → review-tasks
368
368
  → /implement-tasks → code
369
369
  ```
@@ -376,7 +376,7 @@ Idea → /specify → requirements.md
376
376
  | 2. Requirement Clarification | `/codexspec:specify` | `requirements.md` | ✅ |
377
377
  | 3. Generate Spec | `/codexspec:generate-spec` | `spec.md` + auto-review | ✅ |
378
378
  | 4. System Design | `/codexspec:spec-to-design` | `design.md` + auto-review | ✅ |
379
- | 5. Technical Planning | `/codexspec:spec-to-plan` | `plan.md` + auto-review | ✅ |
379
+ | 5. Technical Planning | `/codexspec:design-to-plan` | `plan.md` + auto-review | ✅ |
380
380
  | 6. Task Breakdown | `/codexspec:plan-to-tasks` | `tasks.md` + auto-review | ✅ |
381
381
  | 7. Cross-Artifact Analysis | `/codexspec:analyze` | Analysis report | ✅ |
382
382
  | 8. Implementation | `/codexspec:implement-tasks` | Code | - |
@@ -478,7 +478,8 @@ This command:
478
478
  ### 5. Create Technical Plan
479
479
 
480
480
  ```
481
- /codexspec:spec-to-plan Use Python FastAPI for backend, PostgreSQL for database, React for frontend
481
+ /codexspec:spec-to-design Use Python FastAPI for backend, PostgreSQL for database, React for frontend
482
+ /codexspec:design-to-plan
482
483
  ```
483
484
 
484
485
  Uses only relevant planning sections, records `Covers` links to specification requirements, and verifies applicable project principles.
@@ -580,7 +581,7 @@ Implementation follows **conditional TDD workflow**:
580
581
  | `/codexspec:blueprint` | Discuss and maintain confirmed requirements in the shared blueprint |
581
582
  | `/codexspec:generate-spec` | Generate `spec.md` document ★ Auto-review |
582
583
  | `/codexspec:spec-to-design` | Produce `design.md` (architecture/components/decisions) ★ Auto-review |
583
- | `/codexspec:spec-to-plan` | Convert design to implementation plan ★ Auto-review |
584
+ | `/codexspec:design-to-plan` | Convert design to implementation plan ★ Auto-review |
584
585
  | `/codexspec:plan-to-tasks` | Break down plan into traceable, verifiable tasks ★ Auto-review |
585
586
  | `/codexspec:implement-tasks` | Execute tasks (conditional TDD) |
586
587
  | `/codexspec:auto-dev` | Autonomously develop all pending blueprint requirements in order |
@@ -124,7 +124,7 @@ CodexSpec structures development into **reviewable checkpoints**:
124
124
  Idea → /specify → requirements.md
125
125
  → /generate-spec → spec.md → review-spec
126
126
  → /spec-to-design → design.md → review-design
127
- → /spec-to-plan → plan.md → review-plan
127
+ → /design-to-plan → plan.md → review-plan
128
128
  → /plan-to-tasks → tasks.md → review-tasks
129
129
  → /implement-tasks → code
130
130
  ```
@@ -167,7 +167,7 @@ claude
167
167
  > /codexspec:specify I want to build a todo application
168
168
  > /codexspec:generate-spec
169
169
  > /codexspec:spec-to-design
170
- > /codexspec:spec-to-plan
170
+ > /codexspec:design-to-plan
171
171
  > /codexspec:plan-to-tasks
172
172
  > /codexspec:implement-tasks
173
173
  ```
@@ -318,7 +318,7 @@ CodexSpec breaks development into **reviewable checkpoints**:
318
318
  Idea → /specify → requirements.md
319
319
  → /generate-spec → spec.md → review-spec
320
320
  → /spec-to-design → design.md → review-design
321
- → /spec-to-plan → plan.md → review-plan
321
+ → /design-to-plan → plan.md → review-plan
322
322
  → /plan-to-tasks → tasks.md → review-tasks
323
323
  → /implement-tasks → code
324
324
  ```
@@ -331,7 +331,7 @@ Idea → /specify → requirements.md
331
331
  | 2. Requirement Clarification | `/codexspec:specify` | `requirements.md` | ✅ |
332
332
  | 3. Generate Spec | `/codexspec:generate-spec` | `spec.md` + auto-review | ✅ |
333
333
  | 4. System Design | `/codexspec:spec-to-design` | `design.md` + auto-review | ✅ |
334
- | 5. Technical Planning | `/codexspec:spec-to-plan` | `plan.md` + auto-review | ✅ |
334
+ | 5. Technical Planning | `/codexspec:design-to-plan` | `plan.md` + auto-review | ✅ |
335
335
  | 6. Task Breakdown | `/codexspec:plan-to-tasks` | `tasks.md` + auto-review | ✅ |
336
336
  | 7. Cross-Artifact Analysis | `/codexspec:analyze` | Analysis report | ✅ |
337
337
  | 8. Implementation | `/codexspec:implement-tasks` | Code | - |
@@ -433,7 +433,8 @@ This command:
433
433
  ### 5. Create Technical Plan
434
434
 
435
435
  ```
436
- /codexspec:spec-to-plan Use Python FastAPI for backend, PostgreSQL for database, React for frontend
436
+ /codexspec:spec-to-design Use Python FastAPI for backend, PostgreSQL for database, React for frontend
437
+ /codexspec:design-to-plan
437
438
  ```
438
439
 
439
440
  Uses only relevant planning sections, records `Covers` links to specification requirements, and verifies applicable project principles.
@@ -535,7 +536,7 @@ Implementation follows **conditional TDD workflow**:
535
536
  | `/codexspec:blueprint` | Discuss and maintain confirmed requirements in the shared blueprint |
536
537
  | `/codexspec:generate-spec` | Generate `spec.md` document ★ Auto-review |
537
538
  | `/codexspec:spec-to-design` | Produce `design.md` (architecture/components/decisions) ★ Auto-review |
538
- | `/codexspec:spec-to-plan` | Convert design to implementation plan ★ Auto-review |
539
+ | `/codexspec:design-to-plan` | Convert design to implementation plan ★ Auto-review |
539
540
  | `/codexspec:plan-to-tasks` | Break down plan into traceable, verifiable tasks ★ Auto-review |
540
541
  | `/codexspec:implement-tasks` | Execute tasks (conditional TDD) |
541
542
  | `/codexspec:auto-dev` | Autonomously develop all pending blueprint requirements in order |
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "codexspec"
3
- version = "0.7.18"
3
+ version = "0.7.20"
4
4
  description = "CodexSpec - A Requirements-First SDD toolkit for Claude Code"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -95,7 +95,7 @@ if (-not (Test-Path $paths.FEATURE_DIR -PathType Container)) {
95
95
 
96
96
  if (-not (Test-Path $paths.IMPL_PLAN -PathType Leaf)) {
97
97
  Write-Output "ERROR: plan.md not found in $($paths.FEATURE_DIR)"
98
- Write-Output "Run /codexspec:spec-to-plan first to create the implementation plan."
98
+ Write-Output "Run /codexspec:design-to-plan first to create the implementation plan."
99
99
  exit 1
100
100
  }
101
101
 
@@ -17,6 +17,7 @@ from pathlib import Path
17
17
  from typing import Any, Optional
18
18
 
19
19
  import typer
20
+ import yaml
20
21
  from rich.console import Console
21
22
  from rich.panel import Panel
22
23
  from rich.prompt import Confirm, Prompt
@@ -70,12 +71,13 @@ from .worktrees import (
70
71
  feature_name,
71
72
  read_worktrees,
72
73
  validate_write_path,
74
+ write_config_scalar,
73
75
  write_destination,
74
76
  write_worktrees,
75
77
  )
76
78
 
77
79
  # Version info
78
- __version__ = "0.7.18"
80
+ __version__ = "0.7.20"
79
81
  __author__ = "CodexSpec Team"
80
82
 
81
83
  # Constitution file path constants
@@ -544,6 +546,25 @@ _AUTO_NEXT_ACCEPTED = "on/off, true/false, 1/0, yes/no"
544
546
  # sets for parsing; a distinct sentinel keeps the bare-toggle rewrites separate.
545
547
  _AUTO_DISTILL_SENTINEL = "__toggle_distill__"
546
548
 
549
+ # review.decided_by: who decides about a review-code finding whose trigger lies
550
+ # outside the project's real operating context. ``reviewer`` (default) keeps
551
+ # today's behavior; ``ask`` lets the user decide once.
552
+ _DECIDED_BY_VALUES = ("reviewer", "ask")
553
+ _DECIDED_BY_DEFAULT = "reviewer"
554
+ _DECIDED_BY_ACCEPTED = ", ".join(_DECIDED_BY_VALUES)
555
+
556
+
557
+ class _DecidedByRefusal(str):
558
+ """Why the writer refuses config.yml; typed so it never collides with a stored value."""
559
+
560
+
561
+ # Writer refusal codes, as reported by the display; any other refusal is "unsupported layout".
562
+ _DECIDED_BY_REFUSALS = {
563
+ "invalid_review_config": "unparseable",
564
+ "duplicate_config_key": "duplicate keys",
565
+ "invalid_review_section": "invalid review section",
566
+ }
567
+
547
568
 
548
569
  @app.command()
549
570
  def config(
@@ -594,6 +615,11 @@ def config(
594
615
  worktrees: Optional[str] = typer.Option(
595
616
  None, "--worktrees", help="Toggle checkout-local worktree isolation (default on), or set on/off."
596
617
  ),
618
+ decided_by: Optional[str] = typer.Option(
619
+ None,
620
+ "--decided-by",
621
+ help="Set review.decided_by (reviewer|ask): who decides about out-of-context review findings.",
622
+ ),
597
623
  ) -> None:
598
624
  """
599
625
  View or modify CodexSpec project configuration.
@@ -607,6 +633,7 @@ def config(
607
633
  codexspec config --set-commit-lang en # Set commit messages to English
608
634
  codexspec config --auto-next # Toggle workflow.auto_next
609
635
  codexspec config --auto-distill off # Disable workflow.auto_distill (default on)
636
+ codexspec config --decided-by ask # Ask the user about out-of-context review findings
610
637
  codexspec config --list-langs # List supported languages
611
638
  """
612
639
  # Handle list languages
@@ -641,12 +668,20 @@ def config(
641
668
  except ValueError:
642
669
  console.print(f"[red]Invalid {option} value:[/red] {value!r}")
643
670
  raise typer.Exit(1)
671
+ if decided_by is not None:
672
+ try:
673
+ parse_decided_by_value(decided_by)
674
+ except ValueError:
675
+ console.print(f"[red]Invalid --decided-by value:[/red] {decided_by!r}")
676
+ console.print(f"Accepted values: {_DECIDED_BY_ACCEPTED}.")
677
+ raise typer.Exit(1)
644
678
  modifying = any(
645
679
  value is not None
646
680
  for value in (
647
681
  auto_next,
648
682
  auto_distill,
649
683
  worktrees,
684
+ decided_by,
650
685
  set_lang,
651
686
  set_commit_lang,
652
687
  set_interaction_lang,
@@ -681,6 +716,16 @@ def config(
681
716
  console.print(f"workflow.worktrees = {str(target).lower()}")
682
717
  return
683
718
 
719
+ # Handle review.decided_by set
720
+ if decided_by is not None:
721
+ mode = parse_decided_by_value(decided_by)
722
+ if _write_review_decided_by(config_file, mode):
723
+ console.print(f"[green]review.decided_by = {mode}[/green]")
724
+ else:
725
+ console.print("[red]Failed to update review.decided_by[/red]")
726
+ raise typer.Exit(1)
727
+ return
728
+
684
729
  # Handle auto-next toggle/set
685
730
  if auto_next is not None:
686
731
  if auto_next == _AUTO_NEXT_SENTINEL:
@@ -861,6 +906,21 @@ def config(
861
906
 
862
907
  # Display current configuration
863
908
  console.print(f"Effective workflow.worktrees: {str(read_worktrees(config_file)).lower()}")
909
+ stored_mode = _read_review_decided_by(config_file)
910
+ if stored_mode in _DECIDED_BY_VALUES:
911
+ console.print(f"Effective review.decided_by: {stored_mode}")
912
+ elif isinstance(stored_mode, _DecidedByRefusal):
913
+ console.print(
914
+ f"review.decided_by: config.yml cannot be managed ({stored_mode}); "
915
+ "fix the file by hand before setting it with --decided-by.",
916
+ markup=False,
917
+ )
918
+ else:
919
+ console.print(
920
+ f"review.decided_by: invalid value {stored_mode!r} (accepted: {_DECIDED_BY_ACCEPTED}); "
921
+ "review-code rejects it until it is corrected.",
922
+ markup=False,
923
+ )
864
924
  console.print(
865
925
  Panel(
866
926
  config_file.read_text(encoding="utf-8"),
@@ -1602,6 +1662,111 @@ def _write_auto_distill(config_file: Path, value: bool) -> bool:
1602
1662
  return True
1603
1663
 
1604
1664
 
1665
+ # --- review.decided_by helpers ---------------------------------------------
1666
+
1667
+
1668
+ def parse_decided_by_value(raw: str) -> str:
1669
+ """Parse a ``review.decided_by`` value (``reviewer`` or ``ask``).
1670
+
1671
+ Case-insensitive; surrounding whitespace is ignored. Raises ``ValueError``
1672
+ for any other token so callers can report it instead of guessing a mode.
1673
+ """
1674
+ token = (raw or "").strip().lower()
1675
+ if token in _DECIDED_BY_VALUES:
1676
+ return token
1677
+ raise ValueError(f"invalid review.decided_by value: {raw!r}")
1678
+
1679
+
1680
+ def _yaml_has_duplicate_keys(content: str) -> bool:
1681
+ """Return True when any YAML mapping in ``content`` repeats a key."""
1682
+ try:
1683
+ root = yaml.compose(content)
1684
+ except yaml.YAMLError:
1685
+ return False
1686
+ stack = [root] if root is not None else []
1687
+ seen_nodes: set[int] = set()
1688
+ while stack:
1689
+ node = stack.pop()
1690
+ if id(node) in seen_nodes:
1691
+ continue
1692
+ seen_nodes.add(id(node))
1693
+ if isinstance(node, yaml.MappingNode):
1694
+ keys = [key.value for key, _ in node.value if isinstance(key, yaml.ScalarNode)]
1695
+ if len(keys) != len(set(keys)):
1696
+ return True
1697
+ stack.extend(value for _, value in node.value)
1698
+ elif isinstance(node, yaml.SequenceNode):
1699
+ stack.extend(node.value)
1700
+ return False
1701
+
1702
+
1703
+ def _read_review_decided_by(config_file: Path) -> str:
1704
+ """Return the effective ``review.decided_by`` value, or why the file cannot be managed.
1705
+
1706
+ Validity comes from the writer itself: the file is checked with a dry run of
1707
+ ``write_config_scalar`` (the writer behind ``--decided-by``), so a state shown as
1708
+ valid is always settable and a successful write is never shown as invalid. A file
1709
+ the writer refuses yields a ``_DecidedByRefusal`` (``"unparseable"``,
1710
+ ``"duplicate keys"``, ``"invalid review section"``, or ``"unsupported layout"``),
1711
+ typed so a stored value with the same text is never mistaken for one. Otherwise the value is
1712
+ the one YAML resolves (merge keys included): ``reviewer`` when absent, ``"null"``
1713
+ for null, text for non-strings, so callers report invalid values rather than
1714
+ masking them as the default. An absent or unreadable file yields ``reviewer``.
1715
+ """
1716
+ try:
1717
+ content = config_file.read_bytes().decode("utf-8")
1718
+ except (OSError, UnicodeDecodeError):
1719
+ return _DECIDED_BY_DEFAULT
1720
+ try:
1721
+ write_config_scalar(
1722
+ config_file,
1723
+ "review",
1724
+ "decided_by",
1725
+ _DECIDED_BY_DEFAULT,
1726
+ _DECIDED_BY_DEFAULT,
1727
+ error_prefix="review",
1728
+ invalid_section_code="invalid_review_section",
1729
+ dry_run=True,
1730
+ )
1731
+ data = yaml.safe_load(content)
1732
+ except (AutomationError, yaml.YAMLError) as exc:
1733
+ code = getattr(exc, "code", "invalid_review_config")
1734
+ return _DecidedByRefusal(_DECIDED_BY_REFUSALS.get(code, "unsupported layout"))
1735
+ review = data.get("review") if isinstance(data, dict) else None
1736
+ if not isinstance(review, dict) or "decided_by" not in review:
1737
+ return _DECIDED_BY_DEFAULT
1738
+ value = review["decided_by"]
1739
+ if value is None:
1740
+ return "null"
1741
+ return value if isinstance(value, str) else str(value)
1742
+
1743
+
1744
+ def _write_review_decided_by(config_file: Path, value: str) -> bool:
1745
+ """Set ``review.decided_by`` to ``reviewer`` or ``ask``.
1746
+
1747
+ Delegates to the shared surgical writer used for ``workflow.worktrees``, which
1748
+ preserves comments, line endings, and every other value, handles block and
1749
+ flow mappings, and writes atomically only when the parsed document equals the
1750
+ original with just this key replaced. Returns ``False`` (file untouched) when
1751
+ the edit cannot be made that way or on I/O error; raises ``ValueError`` for an
1752
+ invalid value.
1753
+ """
1754
+ token = parse_decided_by_value(value)
1755
+ try:
1756
+ write_config_scalar(
1757
+ config_file,
1758
+ "review",
1759
+ "decided_by",
1760
+ token,
1761
+ token,
1762
+ error_prefix="review",
1763
+ invalid_section_code="invalid_review_section",
1764
+ )
1765
+ except (AutomationError, OSError):
1766
+ return False
1767
+ return True
1768
+
1769
+
1605
1770
  def _next_step_start(integration_keys: set[str], language: str) -> str:
1606
1771
  """Return a target-aware start instruction."""
1607
1772
  if integration_keys == {"codex"}:
@@ -1904,7 +2069,8 @@ The following slash commands are available in this project:
1904
2069
  | `/codexspec:specify` | Define what you want to build (requirements and user stories) |
1905
2070
  | `/codexspec:blueprint` | Discuss and maintain confirmed requirements in the shared blueprint |
1906
2071
  | `/codexspec:generate-spec` | Generate detailed specification from high-level requirements |
1907
- | `/codexspec:spec-to-plan` | Convert specification to technical implementation plan |
2072
+ | `/codexspec:spec-to-design` | Convert specification to design |
2073
+ | `/codexspec:design-to-plan` | Convert design to implementation plan |
1908
2074
  | `/codexspec:plan-to-tasks` | Break down plan into actionable tasks |
1909
2075
  | `/codexspec:review-spec` | Review specification for completeness and quality |
1910
2076
  | `/codexspec:review-plan` | Review technical plan for feasibility |
@@ -1947,12 +2113,13 @@ The following slash commands are available in this project:
1947
2113
  2. **Create Specification**: Run `/codexspec:specify` with your feature requirements
1948
2114
  3. **Clarify Spec**: Run `/codexspec:clarify` to resolve ambiguities
1949
2115
  4. **Review Spec**: Run `/codexspec:review-spec` to validate the specification
1950
- 5. **Create Plan**: Run `/codexspec:spec-to-plan` with your tech stack choices
1951
- 6. **Review Plan**: Run `/codexspec:review-plan` to validate the plan
1952
- 7. **Generate Tasks**: Run `/codexspec:plan-to-tasks` to create task breakdown
1953
- 8. **Analyze**: Run `/codexspec:analyze` for cross-artifact consistency
1954
- 9. **Review Tasks**: Run `/codexspec:review-tasks` to validate tasks
1955
- 10. **Implement**: Run `/codexspec:implement-tasks` to execute the implementation
2116
+ 5. **Create Design**: Run `/codexspec:spec-to-design` to define the system design
2117
+ 6. **Create Plan**: Run `/codexspec:design-to-plan` to plan implementation of the design
2118
+ 7. **Review Plan**: Run `/codexspec:review-plan` to validate the plan
2119
+ 8. **Generate Tasks**: Run `/codexspec:plan-to-tasks` to create task breakdown
2120
+ 9. **Analyze**: Run `/codexspec:analyze` for cross-artifact consistency
2121
+ 10. **Review Tasks**: Run `/codexspec:review-tasks` to validate tasks
2122
+ 11. **Implement**: Run `/codexspec:implement-tasks` to execute the implementation
1956
2123
 
1957
2124
  > **Shortcut**: For small, self-contained requirements, run `/codexspec:quick` to
1958
2125
  > auto-run spec → plan → tasks → implementation in one shot.
@@ -88,11 +88,11 @@ def get_commands_metadata() -> list[CommandMetadata]:
88
88
  "file_name": "spec-to-design.md",
89
89
  },
90
90
  {
91
- "name": "spec-to-plan",
92
- "display_name": "/codexspec:spec-to-plan",
91
+ "name": "design-to-plan",
92
+ "display_name": "/codexspec:design-to-plan",
93
93
  "description": "将已确认的设计转换为可追溯的实现计划",
94
94
  "category": "core",
95
- "file_name": "spec-to-plan.md",
95
+ "file_name": "design-to-plan.md",
96
96
  },
97
97
  {
98
98
  "name": "plan-to-tasks",
@@ -363,6 +363,31 @@ def migrate_old_commands(
363
363
  return False
364
364
 
365
365
 
366
+ def validate_retired_planning_entry(entry: Path, boundary: Path) -> None:
367
+ """Refuse to retire an entry through a symbolic-link parent directory."""
368
+ entry.relative_to(boundary)
369
+ for parent in entry.parents:
370
+ if parent.is_symlink():
371
+ raise OSError(f"Symbolic-link parent of planning command: {parent}")
372
+ if parent == boundary:
373
+ break
374
+
375
+
376
+ def validate_planning_replacement(entry: Path, boundary: Path) -> None:
377
+ """Reject occupied or linked replacement paths before writing or retirement."""
378
+ validate_retired_planning_entry(entry, boundary)
379
+ if entry.is_symlink() or (entry.exists() and not entry.is_file()):
380
+ raise OSError(f"Planning command replacement must be a regular file: {entry}")
381
+
382
+
383
+ def remove_retired_planning_entry(entry: Path, boundary: Path, *, remove_empty_parent: bool = False) -> None:
384
+ """Remove only the retired entry; retain additional files in a skill directory."""
385
+ validate_retired_planning_entry(entry, boundary)
386
+ entry.unlink(missing_ok=True)
387
+ if remove_empty_parent and entry.parent.is_dir() and not any(entry.parent.iterdir()):
388
+ entry.parent.rmdir()
389
+
390
+
366
391
  def install_commands_to_subdir(
367
392
  target_dir: Path,
368
393
  templates_dir: Path,
@@ -393,6 +418,13 @@ def install_commands_to_subdir(
393
418
  if not templates_dir.exists():
394
419
  return 0
395
420
 
421
+ replacement = templates_dir / "design-to-plan.md"
422
+ retired_entry = target_dir / "spec-to-plan.md"
423
+ replacement_entry = target_dir / replacement.name
424
+ if replacement.is_file():
425
+ validate_retired_planning_entry(retired_entry, target_dir)
426
+ validate_planning_replacement(replacement_entry, target_dir)
427
+
396
428
  # Ensure target directory exists
397
429
  target_dir.mkdir(parents=True, exist_ok=True)
398
430
 
@@ -420,6 +452,12 @@ def install_commands_to_subdir(
420
452
  target_path.write_text(content, encoding="utf-8")
421
453
  installed_count += 1
422
454
 
455
+ if replacement.is_file():
456
+ validate_planning_replacement(replacement_entry, target_dir)
457
+ if not replacement_entry.is_file():
458
+ raise OSError(f"Planning command replacement was not installed: {replacement_entry}")
459
+ remove_retired_planning_entry(retired_entry, target_dir)
460
+
423
461
  return installed_count
424
462
 
425
463
 
@@ -9,7 +9,12 @@ from typing import Any
9
9
 
10
10
  import yaml
11
11
 
12
- from codexspec.commands.installer import get_commands_metadata
12
+ from codexspec.commands.installer import (
13
+ get_commands_metadata,
14
+ remove_retired_planning_entry,
15
+ validate_planning_replacement,
16
+ validate_retired_planning_entry,
17
+ )
13
18
  from codexspec.profile import inject_profile_block
14
19
  from codexspec.translator import load_translation_cache, translate_template_frontmatter
15
20
 
@@ -50,6 +55,13 @@ class CodexIntegration:
50
55
  if not templates_dir.exists():
51
56
  return 0
52
57
 
58
+ replacement = templates_dir / "design-to-plan.md"
59
+ retired_entry = self.skills_dir(target_dir) / "codexspec-spec-to-plan" / "SKILL.md"
60
+ replacement_entry = self.skills_dir(target_dir) / "codexspec-design-to-plan" / "SKILL.md"
61
+ if replacement.is_file():
62
+ validate_retired_planning_entry(retired_entry, self.skills_dir(target_dir))
63
+ validate_planning_replacement(replacement_entry, self.skills_dir(target_dir))
64
+
53
65
  descriptions = {cmd["file_name"]: cmd["description"] for cmd in get_commands_metadata()}
54
66
  translation_cache = None
55
67
  if language != "en":
@@ -70,6 +82,12 @@ class CodexIntegration:
70
82
  skill_file.write_text(skill_content, encoding="utf-8")
71
83
  installed_count += 1
72
84
 
85
+ if replacement.is_file():
86
+ validate_planning_replacement(replacement_entry, self.skills_dir(target_dir))
87
+ if not replacement_entry.is_file():
88
+ raise OSError(f"Planning command replacement was not installed: {replacement_entry}")
89
+ remove_retired_planning_entry(retired_entry, self.skills_dir(target_dir), remove_empty_parent=True)
90
+
73
91
  return installed_count
74
92
 
75
93
  def ensure_context_file(self, target_dir: Path) -> None:
@@ -117,7 +135,7 @@ Use these Codex skills when working on CodexSpec workflows:
117
135
  - `$codexspec:blueprint` to discuss and maintain confirmed requirements in the shared blueprint.
118
136
  - `$codexspec:generate-spec` to produce `spec.md`.
119
137
  - `$codexspec:spec-to-design` to produce `design.md`.
120
- - `$codexspec:spec-to-plan` to produce `plan.md`.
138
+ - `$codexspec:design-to-plan` to produce `plan.md`.
121
139
  - `$codexspec:plan-to-tasks` to produce `tasks.md`.
122
140
  - `$codexspec:implement-tasks` to implement approved tasks.
123
141
  - `$codexspec:auto-dev` to develop pending blueprint requirements autonomously in document order.