codexspec 0.7.20__tar.gz → 0.7.22__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.
- {codexspec-0.7.20 → codexspec-0.7.22}/PKG-INFO +16 -2
- {codexspec-0.7.20 → codexspec-0.7.22}/README.md +15 -1
- {codexspec-0.7.20 → codexspec-0.7.22}/pyproject.toml +1 -1
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/__init__.py +136 -40
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/automation.py +243 -148
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/commands/installer.py +7 -0
- codexspec-0.7.22/src/codexspec/commit_guidance.py +76 -0
- codexspec-0.7.22/src/codexspec/commit_runtime.py +496 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/integrations/codex.py +2 -0
- codexspec-0.7.22/src/codexspec/merge_commits.py +48 -0
- codexspec-0.7.22/src/codexspec/staged_commits.py +226 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/worktrees.py +8 -23
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/analyze.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/auto-dev.md +83 -17
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/blueprint.md +46 -9
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/checklist.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/clarify.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/commit-staged.md +122 -102
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/config.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/constitution.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/debug.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/design-to-plan.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/distill.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/evolve.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/generate-spec.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/implement-tasks.md +29 -10
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/onboard.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/plan-to-tasks.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/pr.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/quick.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/release-notes.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/reverse-spec.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/review-code.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/review-design.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/review-plan.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/review-spec.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/review-tasks.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/spec-to-design.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/specify.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/commands/tasks-to-issues.md +23 -8
- {codexspec-0.7.20 → codexspec-0.7.22}/.gitignore +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/LICENSE +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/codexspec-icon.svg +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/codexspec-logo-dark.svg +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/codexspec-logo-light.svg +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/scripts/bash/check-i18n-completeness.sh +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/scripts/bash/check-i18n-structure.sh +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/scripts/bash/check-prerequisites.sh +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/scripts/bash/common.sh +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/scripts/bash/create-new-feature.sh +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/scripts/bash/review-context.sh +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/scripts/powershell/check-prerequisites.ps1 +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/scripts/powershell/common.ps1 +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/scripts/powershell/create-new-feature.ps1 +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/scripts/powershell/review-context.ps1 +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/blueprint.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/commands/__init__.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/__init__.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/app.js +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/i18n/ar.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/i18n/de.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/i18n/en.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/i18n/es.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/i18n/fr.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/i18n/hi.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/i18n/it.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/i18n/ja.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/i18n/ko.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/i18n/pt.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/i18n/ru.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/i18n/zh-CN.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/i18n/zh-TW.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/index.html +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/assets/styles.css +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/domain.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/lease.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/models.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/records.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/server.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/session.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/terminal.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/distill_review/transaction.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/i18n.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/idea.md +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/integrations/__init__.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/integrations/base.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/integrations/claude.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/profile.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/src/codexspec/translator.py +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/docs/checklist-template.md +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/docs/constitution-template.md +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/docs/design-template.md +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/docs/plan-template-detailed.md +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/docs/plan-template-simple.md +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/docs/requirements-template.md +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/docs/spec-template-detailed.md +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/docs/spec-template-simple.md +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/docs/tasks-template-detailed.md +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/docs/tasks-template-simple.md +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/translations/de.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/translations/en.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/translations/es.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/translations/fr.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/translations/ja.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/translations/ko.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/translations/pt-BR.json +0 -0
- {codexspec-0.7.20 → codexspec-0.7.22}/templates/translations/zh-CN.json +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: codexspec
|
|
3
|
-
Version: 0.7.
|
|
3
|
+
Version: 0.7.22
|
|
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
|
|
@@ -349,7 +349,7 @@ The config command will guide you through:
|
|
|
349
349
|
| Method | Best For | Features |
|
|
350
350
|
|--------|----------|----------|
|
|
351
351
|
| **CLI Installation** (`uv tool install`) | Full development workflow | CLI commands (`init`, `check`, `config`) + slash commands |
|
|
352
|
-
| **Plugin Marketplace** | Quick start, existing projects | Slash commands
|
|
352
|
+
| **Plugin Marketplace** | Quick start, existing projects | Slash commands + automatic commit guidance (use `/codexspec:config` for language setup) |
|
|
353
353
|
|
|
354
354
|
**Note**: The plugin uses `strict: false` mode and reuses the existing multi-language support via LLM dynamic translation.
|
|
355
355
|
|
|
@@ -617,6 +617,11 @@ Implementation follows **conditional TDD workflow**:
|
|
|
617
617
|
|
|
618
618
|
#### Git Workflow Commands
|
|
619
619
|
|
|
620
|
+
Agents invoke `commit-staged` before authorized commits, including auto-dev and
|
|
621
|
+
blueprint commits. The caller prepares staging; the command generates a subject
|
|
622
|
+
and any needed body from the staged diff only. Helper workflows use preview
|
|
623
|
+
analysis and verify that the finalized commit matches the analyzed content.
|
|
624
|
+
|
|
620
625
|
| Command | Description |
|
|
621
626
|
| -------------------------- | ------------------------------------------------- |
|
|
622
627
|
| `/codexspec:commit-staged` | Generate commit message from staged changes |
|
|
@@ -835,6 +840,8 @@ Contributions are welcome! Please read the contributing guidelines before submit
|
|
|
835
840
|
|
|
836
841
|
MIT License - see [LICENSE](LICENSE) for details.
|
|
837
842
|
|
|
843
|
+
The commit-staged runtime is bundled with Claude plugins and copied by init to `.codexspec/scripts/commit-staged-helper.py`, including one-time uvx initialization. Direct preview and authorized in-place commits require Python 3.11+ and Git, but no persistent CodexSpec CLI. The current agent generates the message; the shared helper validates and executes it. Worktree routing, blueprint and auto-dev keep their existing CLI prerequisites.
|
|
844
|
+
|
|
838
845
|
## Acknowledgements
|
|
839
846
|
|
|
840
847
|
- Inspired by [GitHub spec-kit](https://github.com/github/spec-kit)
|
|
@@ -846,3 +853,10 @@ Blueprint and auto-dev retain their fixed shared worktree. Standalone project ed
|
|
|
846
853
|
use a maintenance worktree; settings take effect per checkout and reach other checkouts
|
|
847
854
|
through Git integration. See [worktree development](docs/en/user-guide/workflow.md#worktree-development)
|
|
848
855
|
and [configuration](docs/en/reference/configuration.md#workflowworktrees).
|
|
856
|
+
|
|
857
|
+
The enabled Claude plugin loads the same commit guidance at session start,
|
|
858
|
+
including resumed sessions, through its bundled `hooks/hooks.json`. This requires
|
|
859
|
+
Git on PATH and a Claude Code version supporting command-hook `args` (exec form).
|
|
860
|
+
It does not initialize the project or modify its Git state. Initialized projects
|
|
861
|
+
receive the rule in CLAUDE.md or AGENTS.md. The guidance tells the agent to invoke
|
|
862
|
+
commit-staged; it is not a Git-wide interceptor for manual terminal commands.
|
|
@@ -304,7 +304,7 @@ The config command will guide you through:
|
|
|
304
304
|
| Method | Best For | Features |
|
|
305
305
|
|--------|----------|----------|
|
|
306
306
|
| **CLI Installation** (`uv tool install`) | Full development workflow | CLI commands (`init`, `check`, `config`) + slash commands |
|
|
307
|
-
| **Plugin Marketplace** | Quick start, existing projects | Slash commands
|
|
307
|
+
| **Plugin Marketplace** | Quick start, existing projects | Slash commands + automatic commit guidance (use `/codexspec:config` for language setup) |
|
|
308
308
|
|
|
309
309
|
**Note**: The plugin uses `strict: false` mode and reuses the existing multi-language support via LLM dynamic translation.
|
|
310
310
|
|
|
@@ -572,6 +572,11 @@ Implementation follows **conditional TDD workflow**:
|
|
|
572
572
|
|
|
573
573
|
#### Git Workflow Commands
|
|
574
574
|
|
|
575
|
+
Agents invoke `commit-staged` before authorized commits, including auto-dev and
|
|
576
|
+
blueprint commits. The caller prepares staging; the command generates a subject
|
|
577
|
+
and any needed body from the staged diff only. Helper workflows use preview
|
|
578
|
+
analysis and verify that the finalized commit matches the analyzed content.
|
|
579
|
+
|
|
575
580
|
| Command | Description |
|
|
576
581
|
| -------------------------- | ------------------------------------------------- |
|
|
577
582
|
| `/codexspec:commit-staged` | Generate commit message from staged changes |
|
|
@@ -790,6 +795,8 @@ Contributions are welcome! Please read the contributing guidelines before submit
|
|
|
790
795
|
|
|
791
796
|
MIT License - see [LICENSE](LICENSE) for details.
|
|
792
797
|
|
|
798
|
+
The commit-staged runtime is bundled with Claude plugins and copied by init to `.codexspec/scripts/commit-staged-helper.py`, including one-time uvx initialization. Direct preview and authorized in-place commits require Python 3.11+ and Git, but no persistent CodexSpec CLI. The current agent generates the message; the shared helper validates and executes it. Worktree routing, blueprint and auto-dev keep their existing CLI prerequisites.
|
|
799
|
+
|
|
793
800
|
## Acknowledgements
|
|
794
801
|
|
|
795
802
|
- Inspired by [GitHub spec-kit](https://github.com/github/spec-kit)
|
|
@@ -801,3 +808,10 @@ Blueprint and auto-dev retain their fixed shared worktree. Standalone project ed
|
|
|
801
808
|
use a maintenance worktree; settings take effect per checkout and reach other checkouts
|
|
802
809
|
through Git integration. See [worktree development](docs/en/user-guide/workflow.md#worktree-development)
|
|
803
810
|
and [configuration](docs/en/reference/configuration.md#workflowworktrees).
|
|
811
|
+
|
|
812
|
+
The enabled Claude plugin loads the same commit guidance at session start,
|
|
813
|
+
including resumed sessions, through its bundled `hooks/hooks.json`. This requires
|
|
814
|
+
Git on PATH and a Claude Code version supporting command-hook `args` (exec form).
|
|
815
|
+
It does not initialize the project or modify its Git state. Initialized projects
|
|
816
|
+
receive the rule in CLAUDE.md or AGENTS.md. The guidance tells the agent to invoke
|
|
817
|
+
commit-staged; it is not a Git-wide interceptor for manual terminal commands.
|
|
@@ -30,7 +30,6 @@ from .automation import (
|
|
|
30
30
|
AutomationError,
|
|
31
31
|
BlueprintStore,
|
|
32
32
|
OwnershipError,
|
|
33
|
-
WorkspaceContext,
|
|
34
33
|
ensure_dedicated_workspace,
|
|
35
34
|
locate_dedicated_workspace,
|
|
36
35
|
locate_repository,
|
|
@@ -46,6 +45,7 @@ from .commands.installer import (
|
|
|
46
45
|
should_update_commands,
|
|
47
46
|
update_installed_command_frontmatter,
|
|
48
47
|
)
|
|
48
|
+
from .commit_guidance import inject_commit_guidance
|
|
49
49
|
from .distill_review.domain import ReviewError, ReviewService
|
|
50
50
|
from .distill_review.lease import ActiveSessionError, ReviewLease
|
|
51
51
|
from .distill_review.server import create_server
|
|
@@ -77,7 +77,7 @@ from .worktrees import (
|
|
|
77
77
|
)
|
|
78
78
|
|
|
79
79
|
# Version info
|
|
80
|
-
__version__ = "0.7.
|
|
80
|
+
__version__ = "0.7.22"
|
|
81
81
|
__author__ = "CodexSpec Team"
|
|
82
82
|
|
|
83
83
|
# Constitution file path constants
|
|
@@ -109,6 +109,12 @@ def worktree_helper(
|
|
|
109
109
|
root = checkout_root(Path.cwd())
|
|
110
110
|
if action == "setting":
|
|
111
111
|
result = {"enabled": read_worktrees(root / ".codexspec/config.yml")}
|
|
112
|
+
elif action == "finish-initial" and verification:
|
|
113
|
+
from .automation import finish_initial_workspace
|
|
114
|
+
|
|
115
|
+
result = finish_initial_workspace(
|
|
116
|
+
locate_repository(root), json.loads(verification.read_text(encoding="utf-8"))
|
|
117
|
+
)
|
|
112
118
|
elif action == "route":
|
|
113
119
|
result = {"status": "ready", "workspace": str(write_destination(root))}
|
|
114
120
|
elif action == "create" and not read_worktrees(root / ".codexspec/config.yml"):
|
|
@@ -388,10 +394,30 @@ def _stdin_json() -> dict:
|
|
|
388
394
|
|
|
389
395
|
|
|
390
396
|
def _automation_failure(exc: Exception) -> None:
|
|
397
|
+
if isinstance(exc, AutomationError) and exc.code == "initial_merge_requires_verification":
|
|
398
|
+
_machine_json(json.loads(str(exc).split(": ", 1)[1]))
|
|
399
|
+
raise typer.Exit(3)
|
|
391
400
|
typer.echo(str(exc), err=True)
|
|
392
401
|
raise typer.Exit(1)
|
|
393
402
|
|
|
394
403
|
|
|
404
|
+
def _analysis_request(body: dict[str, Any], *, token: bool = False) -> None:
|
|
405
|
+
keys = {"preparation_id", "analyzed_tree", "message"} | ({"token"} if token else set())
|
|
406
|
+
if set(body) != keys or not all(isinstance(body[key], str) for key in keys):
|
|
407
|
+
raise AutomationError("analysis_required", "prepare staging and use commit-staged -p before finalizing")
|
|
408
|
+
|
|
409
|
+
|
|
410
|
+
@app.command("_commit-staged-helper", hidden=True)
|
|
411
|
+
def commit_staged_helper(action: str = typer.Argument(...)) -> None:
|
|
412
|
+
"""Snapshot or commit the original index without staging files."""
|
|
413
|
+
from .commit_runtime import dispatch
|
|
414
|
+
|
|
415
|
+
try:
|
|
416
|
+
_machine_json(dispatch(action, _stdin_json() if action == "commit" else None))
|
|
417
|
+
except (AutomationError, OSError, ValueError) as exc:
|
|
418
|
+
_automation_failure(exc)
|
|
419
|
+
|
|
420
|
+
|
|
395
421
|
@app.command("_blueprint-helper", hidden=True)
|
|
396
422
|
def blueprint_helper(
|
|
397
423
|
action: str = typer.Argument(..., help="Internal helper action"),
|
|
@@ -418,35 +444,99 @@ def blueprint_helper(
|
|
|
418
444
|
}
|
|
419
445
|
)
|
|
420
446
|
return
|
|
447
|
+
if action == "prepare":
|
|
448
|
+
_machine_json(store.prepare(sys.stdin.buffer.read(), owner_token=auto_dev_token))
|
|
449
|
+
return
|
|
421
450
|
if action == "apply":
|
|
422
|
-
|
|
423
|
-
|
|
451
|
+
body = _stdin_json()
|
|
452
|
+
_analysis_request(body)
|
|
453
|
+
_machine_json(
|
|
454
|
+
store.apply_and_commit(
|
|
455
|
+
body["preparation_id"],
|
|
456
|
+
body["analyzed_tree"],
|
|
457
|
+
body["message"],
|
|
458
|
+
owner_token=auto_dev_token,
|
|
459
|
+
)
|
|
460
|
+
)
|
|
461
|
+
return
|
|
462
|
+
if action == "discard":
|
|
463
|
+
from .staged_commits import PreparedCommits
|
|
464
|
+
|
|
465
|
+
body = _stdin_json()
|
|
466
|
+
if set(body) != {"preparation_id"} or not isinstance(body["preparation_id"], str):
|
|
467
|
+
raise AutomationError("invalid_preparation")
|
|
468
|
+
if auto_dev_token is not None:
|
|
469
|
+
AutoDevOwnership(context).assert_owner(auto_dev_token)
|
|
470
|
+
PreparedCommits(workspace).discard(body["preparation_id"], kind="blueprint", token=auto_dev_token)
|
|
471
|
+
_machine_json({"state": "discarded"})
|
|
424
472
|
return
|
|
425
473
|
raise AutomationError("unsupported_blueprint_helper_action", action)
|
|
426
474
|
except (AutomationError, OwnershipError, OSError, UnicodeError, ValueError) as exc:
|
|
427
475
|
_automation_failure(exc)
|
|
428
476
|
|
|
429
477
|
|
|
478
|
+
def _validate_auto_dev_request(action: str, body: dict[str, Any]) -> None:
|
|
479
|
+
"""Reject malformed requests before ownership or workspace mutations."""
|
|
480
|
+
if action == "acquire":
|
|
481
|
+
if body:
|
|
482
|
+
raise AutomationError("unexpected_fields")
|
|
483
|
+
return
|
|
484
|
+
token_only = {"renew", "assert-owner", "release", "sync-default", "abort-sync"}
|
|
485
|
+
if action not in token_only | {
|
|
486
|
+
"prepare-sync-verification",
|
|
487
|
+
"continue-sync",
|
|
488
|
+
"prepare-feature",
|
|
489
|
+
"commit-feature",
|
|
490
|
+
"discard-feature",
|
|
491
|
+
}:
|
|
492
|
+
raise AutomationError("unsupported_auto_dev_helper_action", action)
|
|
493
|
+
if not isinstance(body.get("token"), str):
|
|
494
|
+
raise AutomationError("missing_token")
|
|
495
|
+
if action in token_only:
|
|
496
|
+
if set(body) != {"token"}:
|
|
497
|
+
raise AutomationError("unexpected_fields")
|
|
498
|
+
elif action == "prepare-sync-verification":
|
|
499
|
+
if (
|
|
500
|
+
set(body) != {"token", "resolved_paths"}
|
|
501
|
+
or not isinstance(body["resolved_paths"], list)
|
|
502
|
+
or not body["resolved_paths"]
|
|
503
|
+
or not all(isinstance(path, str) for path in body["resolved_paths"])
|
|
504
|
+
):
|
|
505
|
+
raise AutomationError("invalid_prepare_sync_request")
|
|
506
|
+
elif action == "continue-sync":
|
|
507
|
+
if set(body) not in (
|
|
508
|
+
{"token", "checks_passed"},
|
|
509
|
+
{"token", "checks_passed", "analysis", "message"},
|
|
510
|
+
) or not isinstance(body.get("checks_passed"), bool):
|
|
511
|
+
raise AutomationError("invalid_continue_sync_request")
|
|
512
|
+
elif action == "prepare-feature":
|
|
513
|
+
if (
|
|
514
|
+
set(body) != {"token", "feature_id", "paths"}
|
|
515
|
+
or not isinstance(body["feature_id"], str)
|
|
516
|
+
or not isinstance(body["paths"], list)
|
|
517
|
+
or not all(isinstance(path, str) for path in body["paths"])
|
|
518
|
+
):
|
|
519
|
+
raise AutomationError("invalid_prepare_feature_request")
|
|
520
|
+
elif action == "commit-feature":
|
|
521
|
+
_analysis_request(body, token=True)
|
|
522
|
+
elif action == "discard-feature":
|
|
523
|
+
if set(body) != {"token", "preparation_id"} or not isinstance(body["preparation_id"], str):
|
|
524
|
+
raise AutomationError("invalid_preparation")
|
|
525
|
+
|
|
526
|
+
|
|
430
527
|
@app.command("_auto-dev-helper", hidden=True)
|
|
431
528
|
def auto_dev_helper(action: str = typer.Argument(..., help="Internal helper action")) -> None:
|
|
432
529
|
"""Internal machine interface for auto-dev ownership and Git writes."""
|
|
433
530
|
try:
|
|
434
531
|
body = _stdin_json()
|
|
532
|
+
_validate_auto_dev_request(action, body)
|
|
435
533
|
context = locate_repository(Path.cwd())
|
|
436
534
|
ownership = AutoDevOwnership(context)
|
|
437
|
-
workspace: WorkspaceContext | None = None
|
|
438
|
-
service: AutoDevGit | None = None
|
|
439
|
-
if action != "acquire":
|
|
440
|
-
# Every non-acquire action legitimately waits behind the active run.
|
|
441
|
-
workspace = ensure_dedicated_workspace(context)
|
|
442
|
-
service = AutoDevGit(workspace, ownership)
|
|
443
535
|
if action == "acquire":
|
|
444
|
-
if body:
|
|
445
|
-
raise AutomationError("unexpected_fields")
|
|
446
536
|
token = ownership.acquire()
|
|
447
|
-
workspace = ensure_dedicated_workspace(context)
|
|
448
|
-
service = AutoDevGit(workspace, ownership)
|
|
449
537
|
try:
|
|
538
|
+
workspace = ensure_dedicated_workspace(context)
|
|
539
|
+
service = AutoDevGit(workspace, ownership)
|
|
450
540
|
merge_recovery = service.recover_merge_ownership(token)
|
|
451
541
|
if merge_recovery["state"] == "none":
|
|
452
542
|
BlueprintStore(workspace).recover_pending_transaction(owner_token=token)
|
|
@@ -465,44 +555,45 @@ def auto_dev_helper(action: str = typer.Argument(..., help="Internal helper acti
|
|
|
465
555
|
}
|
|
466
556
|
)
|
|
467
557
|
return
|
|
468
|
-
if set(body) < {"token"} or not isinstance(body.get("token"), str):
|
|
469
|
-
raise AutomationError("missing_token")
|
|
470
558
|
token = body["token"]
|
|
471
|
-
|
|
472
|
-
raise AutomationError("unexpected_fields")
|
|
559
|
+
# Ownership operations must remain usable even if the worktree is missing.
|
|
473
560
|
if action == "renew":
|
|
474
561
|
ownership.renew(token)
|
|
475
|
-
|
|
476
|
-
|
|
562
|
+
_machine_json({"state": "renewed"})
|
|
563
|
+
return
|
|
564
|
+
if action == "assert-owner":
|
|
477
565
|
ownership.assert_owner(token)
|
|
478
|
-
|
|
479
|
-
|
|
566
|
+
_machine_json({"state": "owner"})
|
|
567
|
+
return
|
|
568
|
+
if action == "release":
|
|
480
569
|
ownership.release(token)
|
|
481
|
-
|
|
482
|
-
|
|
570
|
+
_machine_json({"state": "released"})
|
|
571
|
+
return
|
|
572
|
+
|
|
573
|
+
# Only acquire may initialize a workspace; follow-up actions must not repair
|
|
574
|
+
# missing state or fetch/merge history before their operation is validated.
|
|
575
|
+
workspace = locate_dedicated_workspace(context)
|
|
576
|
+
service = AutoDevGit(workspace, ownership)
|
|
577
|
+
if action == "sync-default":
|
|
483
578
|
result = service.sync_default(token)
|
|
484
579
|
elif action == "prepare-sync-verification":
|
|
485
|
-
if set(body) != {"token", "resolved_paths"} or not isinstance(body["resolved_paths"], list):
|
|
486
|
-
raise AutomationError("invalid_prepare_sync_request")
|
|
487
|
-
if not body["resolved_paths"] or not all(isinstance(path, str) for path in body["resolved_paths"]):
|
|
488
|
-
raise AutomationError("invalid_prepare_sync_request")
|
|
489
580
|
result = service.prepare_sync_verification(token, body["resolved_paths"])
|
|
490
581
|
elif action == "abort-sync":
|
|
491
582
|
result = service.abort_sync(token)
|
|
492
583
|
elif action == "continue-sync":
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
result = service.continue_sync(token, checks_passed=body["checks_passed"])
|
|
496
|
-
elif action == "commit-feature":
|
|
497
|
-
if set(body) != {"token", "feature_id", "commit_type", "description", "paths"}:
|
|
498
|
-
raise AutomationError("invalid_commit_feature_request")
|
|
499
|
-
if not all(isinstance(body[key], str) for key in ("feature_id", "commit_type", "description")):
|
|
500
|
-
raise AutomationError("invalid_commit_feature_request")
|
|
501
|
-
if not isinstance(body["paths"], list) or not all(isinstance(item, str) for item in body["paths"]):
|
|
502
|
-
raise AutomationError("invalid_commit_feature_request")
|
|
503
|
-
result = service.commit_feature(
|
|
504
|
-
token, body["feature_id"], body["commit_type"], body["description"], body["paths"]
|
|
584
|
+
result = service.continue_sync(
|
|
585
|
+
token, checks_passed=body["checks_passed"], analysis=body.get("analysis"), message=body.get("message")
|
|
505
586
|
)
|
|
587
|
+
elif action == "prepare-feature":
|
|
588
|
+
result = service.prepare_feature(token, body["feature_id"], body["paths"])
|
|
589
|
+
elif action == "commit-feature":
|
|
590
|
+
result = service.commit_feature(token, body["preparation_id"], body["analyzed_tree"], body["message"])
|
|
591
|
+
elif action == "discard-feature":
|
|
592
|
+
from .staged_commits import PreparedCommits
|
|
593
|
+
|
|
594
|
+
ownership.assert_owner(token)
|
|
595
|
+
PreparedCommits(workspace).discard(body["preparation_id"], kind="feature", token=token)
|
|
596
|
+
result = {"state": "discarded"}
|
|
506
597
|
else:
|
|
507
598
|
raise AutomationError("unsupported_auto_dev_helper_action", action)
|
|
508
599
|
_machine_json(result)
|
|
@@ -1186,6 +1277,10 @@ def init(
|
|
|
1186
1277
|
ensure_profile_scaffold(target_dir)
|
|
1187
1278
|
ensure_runtime_ignored(target_dir, install_managed_file=True)
|
|
1188
1279
|
|
|
1280
|
+
from .commit_runtime import install_helper
|
|
1281
|
+
|
|
1282
|
+
install_helper(codexspec_dir / "scripts")
|
|
1283
|
+
|
|
1189
1284
|
# Copy helper scripts based on platform
|
|
1190
1285
|
scripts_source_dir = get_scripts_dir()
|
|
1191
1286
|
if scripts_source_dir.exists():
|
|
@@ -1367,6 +1462,7 @@ def init(
|
|
|
1367
1462
|
# Inject the profile block AFTER creation/compliance so it never clobbers
|
|
1368
1463
|
# the compliance @import or the user's body (bounded, idempotent).
|
|
1369
1464
|
inject_profile_block(claude_md)
|
|
1465
|
+
inject_commit_guidance(claude_md, "/codexspec:commit-staged")
|
|
1370
1466
|
|
|
1371
1467
|
# Initialize git if requested
|
|
1372
1468
|
if not no_git and not (target_dir / ".git").exists():
|