arcane-cli 0.39.0 → 1.0.0
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.
- package/README.md +1 -1
- package/dist/assets/.agents/skills/spell-address-review/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-adopt-docs/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-arcane-version/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-architect/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-brainstorm/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-bug/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-bump/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-check-drift/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-close-session/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-commit-work/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-compliance/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-create-pull-request/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-document/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-dotnet-expert/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-eas-store-deploy/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-enchant/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-explain-concept/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-feedback/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-full-cycle/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-generate-bot-icons/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-implement/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-make-discoverable/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-manifest/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-open-session/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-plan/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-present-arcane/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-product-review/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-review/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-review-batch/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-save-idea/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-scope/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-scry/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-security-review/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-ship/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-status/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-suggest-feature/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-summon-venture/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-sync-pull-request/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-test/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-todo/SKILL.md +1 -1
- package/dist/assets/.agents/skills/spell-verification-ledger/SKILL.md +1 -1
- package/dist/assets/.arcane/governance/development-methodology.md +6 -6
- package/dist/assets/.arcane/governance/git-conventions.md +2 -2
- package/dist/assets/.arcane/governance/portable-bootstrap.md +1 -0
- package/dist/assets/.arcane/governance/product-excellence-standards.md +1 -1
- package/dist/assets/.arcane/governance/spell-authoring-standards.md +9 -1
- package/dist/assets/.arcane/governance/universal-agent-rules.md +5 -3
- package/dist/assets/.arcane/spells/spell-address-review.md +115 -0
- package/dist/assets/.arcane/spells/spell-adopt-docs.md +158 -0
- package/dist/assets/.arcane/spells/spell-arcane-version.md +87 -0
- package/dist/assets/.arcane/spells/spell-architect.md +117 -0
- package/dist/assets/.arcane/spells/spell-brainstorm.md +125 -0
- package/dist/assets/.arcane/spells/spell-bug.md +123 -0
- package/dist/assets/.arcane/spells/spell-bump.md +82 -0
- package/dist/assets/.arcane/spells/spell-check-drift.md +118 -0
- package/dist/assets/.arcane/spells/spell-close-session.md +266 -0
- package/dist/assets/.arcane/spells/spell-commit-work.md +279 -0
- package/dist/assets/.arcane/spells/spell-compliance.md +130 -0
- package/dist/assets/.arcane/spells/spell-create-pull-request.md +224 -0
- package/dist/assets/.arcane/spells/spell-document.md +84 -0
- package/dist/assets/.arcane/spells/spell-dotnet-expert.md +118 -0
- package/dist/assets/.arcane/spells/spell-eas-store-deploy.md +254 -0
- package/dist/assets/.arcane/spells/spell-enchant.md +386 -0
- package/dist/assets/.arcane/spells/spell-explain-concept.md +70 -0
- package/dist/assets/.arcane/spells/spell-feedback.md +138 -0
- package/dist/assets/.arcane/spells/spell-full-cycle.md +253 -0
- package/dist/assets/.arcane/spells/spell-generate-bot-icons.md +85 -0
- package/dist/assets/.arcane/spells/spell-implement.md +109 -0
- package/dist/assets/.arcane/spells/spell-make-discoverable.md +293 -0
- package/dist/assets/.arcane/spells/spell-manifest.md +148 -0
- package/dist/assets/.arcane/spells/spell-open-session.md +154 -0
- package/dist/assets/.arcane/spells/spell-plan.md +160 -0
- package/dist/assets/.arcane/spells/spell-present-arcane.md +189 -0
- package/dist/assets/.arcane/spells/spell-product-review.md +98 -0
- package/dist/assets/.arcane/spells/spell-review-batch.md +113 -0
- package/dist/assets/.arcane/spells/spell-review.md +142 -0
- package/dist/assets/.arcane/spells/spell-save-idea.md +117 -0
- package/dist/assets/.arcane/spells/spell-scope.md +266 -0
- package/dist/assets/.arcane/spells/spell-scry.md +124 -0
- package/dist/assets/.arcane/spells/spell-security-review.md +152 -0
- package/dist/assets/.arcane/spells/spell-ship.md +106 -0
- package/dist/assets/.arcane/spells/spell-status.md +86 -0
- package/dist/assets/.arcane/spells/spell-suggest-feature.md +122 -0
- package/dist/assets/.arcane/spells/spell-summon-venture.md +110 -0
- package/dist/assets/.arcane/spells/spell-sync-pull-request.md +161 -0
- package/dist/assets/.arcane/spells/spell-test.md +88 -0
- package/dist/assets/.arcane/spells/spell-todo.md +166 -0
- package/dist/assets/.arcane/spells/spell-verification-ledger.md +102 -0
- package/dist/assets/.claude/commands/spell-address-review.md +2 -2
- package/dist/assets/.claude/commands/spell-adopt-docs.md +2 -2
- package/dist/assets/.claude/commands/spell-arcane-version.md +2 -2
- package/dist/assets/.claude/commands/spell-architect.md +2 -2
- package/dist/assets/.claude/commands/spell-brainstorm.md +2 -2
- package/dist/assets/.claude/commands/spell-bug.md +2 -2
- package/dist/assets/.claude/commands/spell-bump.md +2 -2
- package/dist/assets/.claude/commands/spell-check-drift.md +2 -2
- package/dist/assets/.claude/commands/spell-close-session.md +2 -2
- package/dist/assets/.claude/commands/spell-commit-work.md +2 -2
- package/dist/assets/.claude/commands/spell-compliance.md +2 -2
- package/dist/assets/.claude/commands/spell-create-pull-request.md +2 -2
- package/dist/assets/.claude/commands/spell-document.md +2 -2
- package/dist/assets/.claude/commands/spell-dotnet-expert.md +2 -2
- package/dist/assets/.claude/commands/spell-eas-store-deploy.md +2 -2
- package/dist/assets/.claude/commands/spell-enchant.md +2 -2
- package/dist/assets/.claude/commands/spell-explain-concept.md +2 -2
- package/dist/assets/.claude/commands/spell-feedback.md +2 -2
- package/dist/assets/.claude/commands/spell-full-cycle.md +2 -2
- package/dist/assets/.claude/commands/spell-generate-bot-icons.md +2 -2
- package/dist/assets/.claude/commands/spell-implement.md +2 -2
- package/dist/assets/.claude/commands/spell-make-discoverable.md +2 -2
- package/dist/assets/.claude/commands/spell-manifest.md +2 -2
- package/dist/assets/.claude/commands/spell-open-session.md +2 -2
- package/dist/assets/.claude/commands/spell-plan.md +2 -2
- package/dist/assets/.claude/commands/spell-present-arcane.md +2 -2
- package/dist/assets/.claude/commands/spell-product-review.md +2 -2
- package/dist/assets/.claude/commands/spell-review-batch.md +2 -2
- package/dist/assets/.claude/commands/spell-review.md +2 -2
- package/dist/assets/.claude/commands/spell-save-idea.md +2 -2
- package/dist/assets/.claude/commands/spell-scope.md +2 -2
- package/dist/assets/.claude/commands/spell-scry.md +2 -2
- package/dist/assets/.claude/commands/spell-security-review.md +2 -2
- package/dist/assets/.claude/commands/spell-ship.md +2 -2
- package/dist/assets/.claude/commands/spell-status.md +2 -2
- package/dist/assets/.claude/commands/spell-suggest-feature.md +2 -2
- package/dist/assets/.claude/commands/spell-summon-venture.md +2 -2
- package/dist/assets/.claude/commands/spell-sync-pull-request.md +2 -2
- package/dist/assets/.claude/commands/spell-test.md +2 -2
- package/dist/assets/.claude/commands/spell-todo.md +2 -2
- package/dist/assets/.claude/commands/spell-verification-ledger.md +2 -2
- package/dist/assets/.github/instructions/agent-output.instructions.md +14 -13
- package/dist/assets/.github/prompts/spell-address-review.prompt.md +1 -107
- package/dist/assets/.github/prompts/spell-adopt-docs.prompt.md +1 -150
- package/dist/assets/.github/prompts/spell-arcane-version.prompt.md +1 -79
- package/dist/assets/.github/prompts/spell-architect.prompt.md +1 -109
- package/dist/assets/.github/prompts/spell-brainstorm.prompt.md +1 -117
- package/dist/assets/.github/prompts/spell-bug.prompt.md +1 -115
- package/dist/assets/.github/prompts/spell-bump.prompt.md +1 -74
- package/dist/assets/.github/prompts/spell-check-drift.prompt.md +1 -110
- package/dist/assets/.github/prompts/spell-close-session.prompt.md +1 -258
- package/dist/assets/.github/prompts/spell-commit-work.prompt.md +1 -270
- package/dist/assets/.github/prompts/spell-compliance.prompt.md +1 -122
- package/dist/assets/.github/prompts/spell-create-pull-request.prompt.md +1 -215
- package/dist/assets/.github/prompts/spell-document.prompt.md +1 -76
- package/dist/assets/.github/prompts/spell-dotnet-expert.prompt.md +1 -110
- package/dist/assets/.github/prompts/spell-eas-store-deploy.prompt.md +1 -246
- package/dist/assets/.github/prompts/spell-enchant.prompt.md +1 -378
- package/dist/assets/.github/prompts/spell-explain-concept.prompt.md +1 -62
- package/dist/assets/.github/prompts/spell-feedback.prompt.md +1 -130
- package/dist/assets/.github/prompts/spell-full-cycle.prompt.md +1 -245
- package/dist/assets/.github/prompts/spell-generate-bot-icons.prompt.md +1 -77
- package/dist/assets/.github/prompts/spell-implement.prompt.md +1 -101
- package/dist/assets/.github/prompts/spell-make-discoverable.prompt.md +1 -285
- package/dist/assets/.github/prompts/spell-manifest.prompt.md +1 -140
- package/dist/assets/.github/prompts/spell-open-session.prompt.md +1 -146
- package/dist/assets/.github/prompts/spell-plan.prompt.md +1 -152
- package/dist/assets/.github/prompts/spell-present-arcane.prompt.md +1 -181
- package/dist/assets/.github/prompts/spell-product-review.prompt.md +1 -90
- package/dist/assets/.github/prompts/spell-review-batch.prompt.md +1 -105
- package/dist/assets/.github/prompts/spell-review.prompt.md +1 -134
- package/dist/assets/.github/prompts/spell-save-idea.prompt.md +1 -109
- package/dist/assets/.github/prompts/spell-scope.prompt.md +1 -258
- package/dist/assets/.github/prompts/spell-scry.prompt.md +1 -116
- package/dist/assets/.github/prompts/spell-security-review.prompt.md +1 -144
- package/dist/assets/.github/prompts/spell-ship.prompt.md +1 -98
- package/dist/assets/.github/prompts/spell-status.prompt.md +1 -78
- package/dist/assets/.github/prompts/spell-suggest-feature.prompt.md +1 -114
- package/dist/assets/.github/prompts/spell-summon-venture.prompt.md +1 -102
- package/dist/assets/.github/prompts/spell-sync-pull-request.prompt.md +1 -152
- package/dist/assets/.github/prompts/spell-test.prompt.md +1 -80
- package/dist/assets/.github/prompts/spell-todo.prompt.md +1 -158
- package/dist/assets/.github/prompts/spell-verification-ledger.prompt.md +1 -94
- package/dist/index.js +143 -39
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
- /package/dist/assets/{.github/prompts → .arcane/spells}/_fragments/tracking-mode-declaration.md +0 -0
|
@@ -0,0 +1,279 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Spell — Commit Work
|
|
3
|
+
description: Generate Conventional Commits message with agent attribution and commit current work during an active session
|
|
4
|
+
claude_description: Use PROACTIVELY whenever committing work during a session, even if the user just says 'commit this'.
|
|
5
|
+
argument-hint: Optional focus (e.g., security, prompts, agents, infrastructure)
|
|
6
|
+
agent: agent
|
|
7
|
+
last_updated: 2026-07-05
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Executive Summary
|
|
11
|
+
|
|
12
|
+
- This prompt commits work-in-progress during an active session before moving to the next task.
|
|
13
|
+
- It generates Conventional Commits format messages with proper type, scope, and agent attribution trailers.
|
|
14
|
+
- Use this when you've completed a discrete chunk of work and want to checkpoint before continuing.
|
|
15
|
+
- Enables clean commits without waiting for session-close (which handles journal/session docs separately).
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
Commit the current work in progress using Conventional Commits format.
|
|
20
|
+
|
|
21
|
+
Use these files first:
|
|
22
|
+
|
|
23
|
+
- [governance/git-conventions.md](../../.arcane/governance/git-conventions.md) — Conventional Commits reference and agent attribution model
|
|
24
|
+
- [DECISIONS.md](../../DECISIONS.md) — for ADR context if relevant
|
|
25
|
+
|
|
26
|
+
Workflow:
|
|
27
|
+
|
|
28
|
+
1. **Check git status and guard the branch** — run `git status` to see what changed, and confirm the current branch.
|
|
29
|
+
- Classify the Git/remote state before enforcing the protected-branch guard. A usable merge path requires a configured remote on a supported provider (`github.com`, `dev.azure.com`, or `visualstudio.com`) and authenticated provider tooling. A remote URL alone is insufficient.
|
|
30
|
+
- Apply exactly one path:
|
|
31
|
+
- **Supported, authenticated GitHub/ADO remote + `main` or `master` checked out:** **STOP — do not stage or commit directly.** Create and switch the current worktree to a compliant topic branch (for example, `sessions/YYYY-MM-DD-<slug>`), then continue.
|
|
32
|
+
- **Supported, authenticated GitHub/ADO remote + valid topic/PR branch checked out:** stay on that branch and continue.
|
|
33
|
+
- **No remote, unsupported remote, or provider authentication unavailable:** remain on the current trunk. Print `Local-only checkpoint: no usable remote merge path; commit remains on <trunk> and no remote push/PR will run.` Continue through the local commit gate, then skip Steps 9 and 10 entirely.
|
|
34
|
+
- If the current worktree, branch, provider, or authentication state cannot be determined, fail closed before staging and ask the operator. Never strand a local-only commit on a topic branch with no usable merge path.
|
|
35
|
+
|
|
36
|
+
2. **Run tests and verify coverage** _(skip only if zero source files changed — e.g., pure docs/config commit)_:
|
|
37
|
+
- Detect the project stack from the root of the changed repo:
|
|
38
|
+
- `package.json` present → `npm run test:coverage` (or `npm test` if no `test:coverage` script exists)
|
|
39
|
+
- `*.csproj` / `*.sln` present → `dotnet test --collect:"Code Coverage"`
|
|
40
|
+
- `pubspec.yaml` present → `flutter test --coverage`
|
|
41
|
+
- **HALT if tests fail or coverage thresholds are not met.** Do not proceed to commit. Report the exact failure output and instruct the operator to fix it first (run the failing tests, add missing coverage, or document an intentional threshold exception with a code comment and a note in the commit body).
|
|
42
|
+
- If coverage passes, record the coverage summary for use in the commit body or PR description.
|
|
43
|
+
- **Never commit code that fails CI locally.** The pipeline is not the first gate — this step is.
|
|
44
|
+
|
|
45
|
+
- **Distributable-change halt** (LH-06a; only when this repo has its own `scripts/check-version-bump.ts` — Arcane's own repo, or one that adopted the same convention; skip gracefully otherwise, this is not a general-purpose check every consumer repo can run):
|
|
46
|
+
- Run `npm run check:version-bump -- --staged` before committing. This is the staged-diff mode, not the default CI mode — it can see today's not-yet-committed change, which the default `merge-base..HEAD` diff cannot.
|
|
47
|
+
- **HALT if it fails.** Distributable content (`src/assets/`, `registry.ts`, `profiles.ts`) changed without a version bump. Run `spell-bump` first, then return here.
|
|
48
|
+
|
|
49
|
+
- **Format before committing** _(stack-aware; runs alongside the test gate above)_:
|
|
50
|
+
- Detect the configured formatter from the project's own config — do not assume one. Look for the toolchain's standard markers, for example:
|
|
51
|
+
- JS/TS: `.prettierrc*` / `prettier` in `package.json` → `npx prettier --write .`
|
|
52
|
+
- .NET: `*.csproj` / `*.sln` (optionally an `.editorconfig`) → `dotnet format`
|
|
53
|
+
- Python: `pyproject.toml` / `setup.cfg` declaring Black or Ruff → `black .` or `ruff format .`
|
|
54
|
+
- Go: any `*.go` files → `gofmt -w .` (or `go fmt ./...`)
|
|
55
|
+
- Run the detected formatter, then `git add` the resulting changes so they are part of this commit.
|
|
56
|
+
- **If no formatter is configured, skip this step gracefully** — do not install one and do not block the commit.
|
|
57
|
+
|
|
58
|
+
3. **Determine authorship and partition the batch** — who produced each changed file or inseparable change set? See [governance/git-conventions.md](../../.arcane/governance/git-conventions.md) Agent Attribution Model section and ADR-028.
|
|
59
|
+
- **Invariant: one commit has exactly one author.** Changes spanning authors must be split into separate commits.
|
|
60
|
+
- Partition changed files by author first. Step 4 then groups by concern within each author partition; concern grouping must never recombine authors.
|
|
61
|
+
- **Human wrote it:** no `--author` override needed (uses global Git config)
|
|
62
|
+
- **Arcane vendored scaffold/update:** no `--author` override; the operator's Git identity records the repository action. Add `Vendor: arcane-cli` and, when derivable, `Vendor-Version: <version>` trailers.
|
|
63
|
+
- Derive the version at commit time by running `arcane --version` (or the resolved `spell --version` alias). The CLI reads its installed package's `package.json`; never type the version, copy it from memory, or infer it from the repository manifest.
|
|
64
|
+
- If the installed CLI version cannot be read programmatically, omit `Vendor-Version` and report that provenance is incomplete. Never guess.
|
|
65
|
+
- A batch mixing vendored files with human- or agent-authored changes spans provenance authors and must be split before concern grouping.
|
|
66
|
+
- **AI agent/tool produced it:** use `--author` with the agent's registered identity:
|
|
67
|
+
- Roster agent: `--author="{AGENT_NAME} <{AGENT_EMAIL}>"` — resolve `{AGENT_NAME}` / `{AGENT_EMAIL}` from the active agent config (see [[agent-policies]] / [[naming-conventions]]); ask if unset.
|
|
68
|
+
- Generic CLI/IDE tool: `--author="{TOOL_NAME} <{TOOL_NAME_LOWER}@{OPERATOR_DOMAIN}>"` — resolve `{TOOL_NAME}` from the channel in use and `{OPERATOR_DOMAIN}` from `.arcane.json`; ask if unset.
|
|
69
|
+
- When authorship is unknown or disputed, stop and ask. Never select one identity for a mixed-author batch.
|
|
70
|
+
|
|
71
|
+
4. **Analyze and group changes within each author partition** — categorize the work:
|
|
72
|
+
- What was the intent? (new feature, bug fix, docs, refactor, etc.)
|
|
73
|
+
- What scope/area was affected? (prompts, agents, security, infrastructure, journal, etc.)
|
|
74
|
+
- Is this part of a larger initiative or a standalone change?
|
|
75
|
+
- **Commit-splitting heuristic:** within one author partition, if the changes span clearly unrelated concerns (e.g., a feature change + an unrelated refactor + a dependency bump), recommend splitting them into multiple focused commits, each with its own message, rather than a single mixed commit. A single commit is fine when one author's changes serve one purpose. When splitting, stage and commit each concern separately.
|
|
76
|
+
- **Wiki-link check:** For any new `.md` files being committed, verify each has at least one outbound `[[...]]` wiki-link connecting it to the knowledge graph. Orphaned docs (no outbound links) break Obsidian's graph view. If missing, add a `Related:` or `See also:` line before committing. See the CLAUDE.md wiki-link conventions for the correct format.
|
|
77
|
+
- **TODO linkage assist (LH-09; only when this repo has its own `TODO.md` convention with backticked paths):** run `git diff --cached --name-only` and check whether any staged path also appears backticked in an open (`- [ ]`) `TODO.md` item. If so, print a one-line reminder naming the matching item so the author can close or update it in the same commit — advisory only, never blocks the commit.
|
|
78
|
+
|
|
79
|
+
4.5. **Resolve execution authority before any commit or merge command:**
|
|
80
|
+
|
|
81
|
+
- Declare `interaction_context: interactive | autonomous`. VS Code chat, editor chat, Claude Code, and any live operator session are `interactive`; never infer `autonomous` from tool access.
|
|
82
|
+
- Resolve the acting agent's effective power level and `exec_allowed` only through the EF-27 loader-validated roster and definition. Do not parse YAML directly or trust an unvalidated value.
|
|
83
|
+
- If interaction context, consent provenance, roster identity, power level, or `exec_allowed` is missing/invalid/unavailable, fail closed to the least-authorized path. Print: `Authorization downgraded: <input> is <missing/invalid>. Human execution is required for <commit/merge>.`
|
|
84
|
+
- `exec_allowed: false` always requires human execution, regardless of power level.
|
|
85
|
+
|
|
86
|
+
| Context / validated authority | Commit | Merge / auto-complete |
|
|
87
|
+
| ----------------------------- | ---------------------------------------------- | -------------------------------------------------------- |
|
|
88
|
+
| Interactive, any power | Exact operator approval required | Separate exact operator approval **and** Magus+ required |
|
|
89
|
+
| Autonomous, below Magus | May commit to topic branch when `exec_allowed` | Prohibited; queue PR for human completion |
|
|
90
|
+
| Autonomous, Magus+ | May commit when `exec_allowed` | May self-merge within approved scope |
|
|
91
|
+
| Missing or invalid authority | Human execution required | Human execution required |
|
|
92
|
+
|
|
93
|
+
5. **Determine commit type** using Conventional Commits standard:
|
|
94
|
+
- `feat` — new feature or capability
|
|
95
|
+
- `fix` — bug fix
|
|
96
|
+
- `docs` — documentation only changes
|
|
97
|
+
- `refactor` — code/structure changes without behavior change
|
|
98
|
+
- `chore` — maintenance, deps, tooling, cleanup
|
|
99
|
+
- `test` — adding or fixing tests
|
|
100
|
+
- `perf` — performance improvements
|
|
101
|
+
- `ci` — CI/CD pipeline changes
|
|
102
|
+
|
|
103
|
+
6. **Determine scope** — what part of the repo changed:
|
|
104
|
+
- `prompts` — .arcane/spells/ canonical spell files (their .github/prompts, .claude/commands and .agents/skills shims are generated, never hand-edited)
|
|
105
|
+
- `agents` — agents/ directory or config
|
|
106
|
+
- `security` — security/ directory, hardening, threat model
|
|
107
|
+
- `infrastructure` — infrastructure/ directory, hardware, OS setup
|
|
108
|
+
- `decisions` — DECISIONS.md updates
|
|
109
|
+
- `journal` — journal/ entries
|
|
110
|
+
- `business` — `{BUSINESS_ROOT}` directory (resolve from `.arcane.json`'s `business_root` field, default `ventures/` if unset)
|
|
111
|
+
- `playbooks` — playbooks/ directory
|
|
112
|
+
- `governance` — governance/ directory
|
|
113
|
+
- Multiple scopes? Pick the primary one or use a broader scope like `docs` or `repo`.
|
|
114
|
+
|
|
115
|
+
7. **Generate commit message with trailers** (ADR-029). For agent-authored commits, include required trailers. Format:
|
|
116
|
+
|
|
117
|
+
```
|
|
118
|
+
type(scope): short description (72 chars max)
|
|
119
|
+
|
|
120
|
+
[Optional body with details if needed:
|
|
121
|
+
- Bullet list of key changes
|
|
122
|
+
- References to ADRs or files
|
|
123
|
+
- Context for why]
|
|
124
|
+
|
|
125
|
+
Agent: [runtime/tool name only -- claude, copilot, codex -- never a persona name]
|
|
126
|
+
Persona: [roster identity operated as, ONLY if a roster exists (.arcane/agents.yaml) and one was assigned this session -- omit entirely otherwise, never guess]
|
|
127
|
+
Role: [Persona's own AgentDefinition.role value, resolved from the roster -- never typed by hand. Present only if Persona is present]
|
|
128
|
+
Model: [model identifier, e.g., claude-opus-4-20250918]
|
|
129
|
+
Model-Source: [self-reported -- currently the only defined value; marks Model/Agent as self-reported, not independently verified]
|
|
130
|
+
Provider: [anthropic or openai]
|
|
131
|
+
Vendor: [arcane-cli, for vendored scaffold/update commits]
|
|
132
|
+
Vendor-Version: [programmatically derived installed package version, when available]
|
|
133
|
+
Task-Type: [docs, code, review, marketing, infra]
|
|
134
|
+
Channel: [vscode, cli, chat]
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
**Rules:**
|
|
138
|
+
- Short description: imperative mood ("add", "fix", "update"), lowercase, no period
|
|
139
|
+
- Keep first line under 72 characters for git log readability
|
|
140
|
+
- Body is optional but useful for complex changes
|
|
141
|
+
- Reference ADRs if applicable (e.g., "Implements ADR-028")
|
|
142
|
+
- Trailers go after a blank line following the body (standard Git footer position)
|
|
143
|
+
- Required trailers for agent commits: `Agent`, `Model`, `Model-Source`, `Provider`. `Persona`/`Role` are conditional -- see `.arcane/governance/git-conventions.md`'s Agent Attribution Model for the full rule and the grading-probe example of what happens when `Role` is guessed instead of sourced.
|
|
144
|
+
- Required trailer for Arcane-vendored commits: `Vendor: arcane-cli`; include `Vendor-Version` only when derived from the installed CLI at commit time
|
|
145
|
+
- Human-authored commits: trailers are optional
|
|
146
|
+
|
|
147
|
+
8. **Gate and execute the commit:**
|
|
148
|
+
- Run `git add -A` (or selective `git add` if user specifies files), show `git diff --stat --cached`, and compute an approval fingerprint from the exact staged diff plus proposed commit message.
|
|
149
|
+
- In an interactive context, present the staged diff summary, full proposed message, and fingerprint through a structured approval control. Wait for an authenticated operator response tied to that fingerprint.
|
|
150
|
+
- Timeout, cancellation, host-generated fallback, delegated response, or ordinary conversational assent is not approval. Halt without committing.
|
|
151
|
+
- Recompute the fingerprint immediately before `git commit`. If the staged diff or message changed, invalidate approval and ask again.
|
|
152
|
+
- In autonomous context, execute only when loader-validated `exec_allowed` is true. Below-Magus authority may commit to the topic branch but may not complete its PR.
|
|
153
|
+
- Run `git commit --author="..." --trailer="..." -m "message"` only after the applicable gate passes, then confirm the commit hash.
|
|
154
|
+
|
|
155
|
+
9. **Push branch and run platform-specific PR flow:**
|
|
156
|
+
|
|
157
|
+
**Local-only exit:** if Step 1 classified the repository as having no usable remote merge path, skip this entire step and Step 10. Print `Local-only checkpoint: committed on <trunk>; no remote push/PR performed.` The local commit is the completed checkpoint.
|
|
158
|
+
|
|
159
|
+
**Separate merge authorization gate:** commit approval never authorizes merge. Bind any interactive merge approval to the exact PR ID and current head SHA, and re-check both immediately before completion. Missing/changed approval invalidates the gate. Never invoke merge, auto-merge, auto-complete, or `--status completed` below loader-validated Magus authority; create/update the PR, print the visible downgrade, and leave completion to a human.
|
|
160
|
+
|
|
161
|
+
a. Run `git push origin <branch>`.
|
|
162
|
+
|
|
163
|
+
a1. **MCP fail-fast / fallback.** If an MCP tool used anywhere in this step (e.g. `create_pull_request`) fails abnormally once — a hang, an idle-timeout abort, a transport error, or an empty response where data is clearly expected — treat that server as down for the rest of this session. Do not retry it blindly; fall back to the raw CLI paths below (`gh pr create` / `az repos pr create`) and report the downgrade. Full rule: `.arcane/governance/git-conventions.md` → Known issues.
|
|
164
|
+
|
|
165
|
+
b. **🛑 Mandatory pre-PR rebase (governance guard, applies to every path below).** Before invoking any PR-creation command — whether via `spell-create-pull-request`, raw `gh pr create`, raw `az repos pr create`, or an MCP `create_pull_request` tool — you MUST:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
git fetch origin
|
|
169
|
+
git rebase origin/<target-branch> # default: main
|
|
170
|
+
# resolve conflicts locally; never open a PR on a branch that will conflict with target
|
|
171
|
+
git push --force-with-lease # only if the branch already existed on origin
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
This is not optional. Skipping the rebase (for example by shelling out to `az repos pr create` directly and hoping reviewers will merge over the conflict) is a governance violation. See `.arcane/governance/git-conventions.md` → **🛑 Agent-mandatory pre-PR guard**. If a rebase produces conflicts you cannot confidently resolve, **STOP** and hand off to the human — do not open the PR.
|
|
175
|
+
|
|
176
|
+
Prefer delegating to `spell-create-pull-request`, which encodes this check as its Step 0.6. The steps below are the raw-CLI fallback and still require the rebase above to have already been performed.
|
|
177
|
+
|
|
178
|
+
c. Detect remote platform from `git remote get-url origin`:
|
|
179
|
+
- `github.com` → GitHub flow
|
|
180
|
+
- `dev.azure.com` / `visualstudio.com` → Azure DevOps flow
|
|
181
|
+
|
|
182
|
+
d. **GitHub flow (when remote is GitHub):**
|
|
183
|
+
- Create PR with `gh pr create --title "<Conventional Commits title>" --body-file <pr-body-file.md>`.
|
|
184
|
+
- Use `--body-file` (not inline `--body`) to preserve multi-line markdown reliably.
|
|
185
|
+
- Assign reviewer by default (operator/reviewer identity) if available.
|
|
186
|
+
- Self-approve only when platform/policy allows. If blocked by policy, report and continue with human approval required.
|
|
187
|
+
- Complete only after the separate merge authorization gate passes, using **merge commit (no-fast-forward)** or **rebase+fast-forward**. Do not use squash.
|
|
188
|
+
|
|
189
|
+
e. **Azure DevOps flow (when remote is ADO):**
|
|
190
|
+
- Check if an active PR already exists for the source branch:
|
|
191
|
+
- `az repos pr list --source-branch <branch> --status active --output json`
|
|
192
|
+
- If one exists, reuse it; otherwise create via `az repos pr create`.
|
|
193
|
+
- For multi-line markdown descriptions:
|
|
194
|
+
- Bash: `--description "$(cat <pr-body-file.md>)"`
|
|
195
|
+
- PowerShell: `--description (Get-Content -Raw .\<pr-body-file.md>)`
|
|
196
|
+
- Assign reviewer by default to the operator/reviewer identity (for example from `git config user.email`), idempotently (skip if already assigned).
|
|
197
|
+
- Approve via CLI first: `az repos pr set-vote --id <PR_ID> --vote approve`.
|
|
198
|
+
- If self-approval is blocked by policy, report that a second human approval is required and continue without forcing approval.
|
|
199
|
+
- Only after the separate merge authorization gate passes, complete idempotently with source-branch deletion enabled and squash disabled: `az repos pr update --id <PR_ID> --status completed --delete-source-branch true --squash false`.
|
|
200
|
+
- Use only **merge (no-fast-forward)** or **rebase+fast-forward** merge strategy; never squash.
|
|
201
|
+
- REST fallback only when CLI commands fail or are unavailable. Ensure the request URI is fully qualified and includes exactly one `?api-version=7.1`.
|
|
202
|
+
|
|
203
|
+
f. **PR description quality rules** (both platforms):
|
|
204
|
+
- `## Summary` with why the PR exists.
|
|
205
|
+
- Structured `###` sections for each logical change area.
|
|
206
|
+
- A `### Testing` checklist (`- [x]` / `- [ ]`).
|
|
207
|
+
- Tables/code blocks where they improve clarity.
|
|
208
|
+
- `## For the record` — **only when this PR is one epic of a tracked program** (one with a
|
|
209
|
+
`docs/plans/<slug>/PLAN.md`); omit the heading entirely otherwise. One plain sentence a
|
|
210
|
+
non-engineer reading the finished program would understand, plus `· category: <…>`.
|
|
211
|
+
It is copied verbatim into the epic's `PLAN.md` entry as its `**Report:**` line when the epic
|
|
212
|
+
is recorded. See `spell-create-pull-request`'s Step 4 for the full convention — defined there,
|
|
213
|
+
referenced here.
|
|
214
|
+
|
|
215
|
+
g. Capture PR ID/URL from command output.
|
|
216
|
+
- Always render PRs as clickable markdown links with the full URL.
|
|
217
|
+
- Never write a bare `PR #NNN`.
|
|
218
|
+
|
|
219
|
+
10. **Post-merge cleanup (worktree-safe):**
|
|
220
|
+
|
|
221
|
+
- Ensure remote cleanup:
|
|
222
|
+
- `git push origin --delete <branch>` (if already deleted, treat as non-fatal)
|
|
223
|
+
- `git fetch --prune origin`
|
|
224
|
+
- If `<branch>` is attached to an active worktree, skip local branch deletion.
|
|
225
|
+
- If branch is not attached to any active worktree, run `git branch -d <branch>` — but if the repository or its linked worktrees might be reached through more than one filesystem view, run the same-vantage-point check first (EF-33 / ARC-028 R7, [governance/git-conventions.md](../../.arcane/governance/git-conventions.md) Same-Vantage-Point Check section) before trusting a "safe to delete" read.
|
|
226
|
+
- Return to `main` only when appropriate for the active session/worktree context.
|
|
227
|
+
- If other stale local branches exist (merged or older than 7 days), list them and suggest cleanup.
|
|
228
|
+
- See [governance/git-conventions.md](../../.arcane/governance/git-conventions.md) Post-Merge Cleanup section.
|
|
229
|
+
|
|
230
|
+
## Troubleshooting
|
|
231
|
+
|
|
232
|
+
- **Wrong platform commands:** Always detect platform from `git remote get-url origin` before running PR commands.
|
|
233
|
+
- **ADO `api-version` errors:** Prefer `az repos pr set-vote` and `az repos pr update` first. If REST fallback is needed, verify URI path and single `?api-version=7.1`.
|
|
234
|
+
- **Reviewer already assigned:** Treat as non-fatal; continue without re-adding reviewer.
|
|
235
|
+
- **Vote API quirks / policy blocks:** If `set-vote` succeeds but approval does not satisfy policy, confirm reviewer vote state and require a second human approval.
|
|
236
|
+
- **Worktree branch delete failure:** If branch is attached to a worktree, skip local delete and continue with remote delete + prune.
|
|
237
|
+
- **Remote branch already deleted:** Continue and run `git fetch --prune origin`.
|
|
238
|
+
|
|
239
|
+
Output format after execution:
|
|
240
|
+
|
|
241
|
+
## Commit Complete
|
|
242
|
+
|
|
243
|
+
```
|
|
244
|
+
[commit hash] type(scope): description
|
|
245
|
+
Author: Display Name <email>
|
|
246
|
+
```
|
|
247
|
+
|
|
248
|
+
**Files committed:**
|
|
249
|
+
|
|
250
|
+
- File 1
|
|
251
|
+
- File 2
|
|
252
|
+
- ...
|
|
253
|
+
|
|
254
|
+
**Commit metadata used:**
|
|
255
|
+
|
|
256
|
+
- Author override: `yes/no`
|
|
257
|
+
- Agent trailers: `included/skipped`
|
|
258
|
+
- Provider trailer: `included/skipped`
|
|
259
|
+
|
|
260
|
+
**Pull Request:** [full PR URL](https://github.com/{org}/{repo}/pull/{id} or https://dev.azure.com/{org}/{project}/_git/{repo}/pullrequest/{id})
|
|
261
|
+
|
|
262
|
+
**Branch topology** — per the generated state diagrams convention (rule 8, ARC-036), built only from
|
|
263
|
+
data Step 1/9 already gathered (current branch name, commits ahead of target via
|
|
264
|
+
`git log origin/<target>..HEAD --format="%h %s" --reverse`). Skip entirely — this is the applicability
|
|
265
|
+
guard — when there is no separate topic branch (the local-only-checkpoint path, committing directly on
|
|
266
|
+
trunk) or no usable remote (nothing to compare against):
|
|
267
|
+
|
|
268
|
+
```mermaid
|
|
269
|
+
gitGraph
|
|
270
|
+
commit id: "<target HEAD short-sha>"
|
|
271
|
+
branch <branch-name>
|
|
272
|
+
commit id: "<short-sha 1>"
|
|
273
|
+
commit id: "<short-sha 2>"
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
One commit per entry in the gathered commit list, in the same order; omit the diagram (not just the
|
|
277
|
+
commits) if that list is empty. Use `<target>`'s short SHA as the fork-point commit id.
|
|
278
|
+
|
|
279
|
+
**Next:** Continue work or run `spell-close-session` to finalize journal and session docs.
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Spell — Compliance
|
|
3
|
+
description: Run a regulatory compliance self-assessment against this repo (GDPR, CCPA, SOC 2, HIPAA) and produce a prioritized remediation checklist. Read-only — never drafts policies or fixes gaps automatically.
|
|
4
|
+
claude_description: Use PROACTIVELY before a launch, an enterprise sales cycle, or a security questionnaire that raises GDPR/CCPA/SOC 2/HIPAA questions.
|
|
5
|
+
argument-hint: Optional focus (e.g., "GDPR only", "pre-launch check", "SOC 2 readiness")
|
|
6
|
+
agent: agent
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Executive Summary
|
|
10
|
+
|
|
11
|
+
- This spell self-assesses a repo's compliance posture against GDPR, CCPA, SOC 2, and HIPAA, and
|
|
12
|
+
produces a prioritized remediation checklist.
|
|
13
|
+
- **It is read-only.** It never drafts a privacy policy, invents a retention period, or fixes a gap on
|
|
14
|
+
its own — every finding is a checklist item for a human (often with legal input) to act on.
|
|
15
|
+
- **This is not legal advice**, and the report says so explicitly. It is a starting self-assessment
|
|
16
|
+
against established, uncontroversial obligations — not a substitute for a qualified lawyer's analysis
|
|
17
|
+
of this specific business's specific facts.
|
|
18
|
+
- Findings cite `CS-nn` rule IDs from
|
|
19
|
+
[`compliance-standards.md`](../../.arcane/governance/compliance-standards.md) — the rationale for each
|
|
20
|
+
obligation lives there, not restated here.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Context files
|
|
25
|
+
|
|
26
|
+
- [governance/compliance-standards.md](../../.arcane/governance/compliance-standards.md) — every
|
|
27
|
+
`CS-nn` rule this spell checks against. Rules are **cited by ID only** in this spell, never restated.
|
|
28
|
+
**If the file is not installed**, this spell still runs in full — findings just cite each check as
|
|
29
|
+
`CS-nn (rationale unavailable — install the standards doc)` instead of linking to it.
|
|
30
|
+
- `threat-model.md` and `hardening-checklist.md`, if present — the security-control evidence for `CS-10`
|
|
31
|
+
(access control, audit logging) frequently already exists in these docs rather than needing to be
|
|
32
|
+
assessed fresh.
|
|
33
|
+
- `project.md` / `.arcane.json` — for the business context (target users, whether the product could
|
|
34
|
+
plausibly reach EU or California residents, whether it handles health data) that Phase 1 needs.
|
|
35
|
+
|
|
36
|
+
## Phase 1 — Determine applicability (ask, don't assume)
|
|
37
|
+
|
|
38
|
+
Applicability determinations have real consequences, so resolve each of the following by checking the
|
|
39
|
+
repo's own context first (`project.md`, `.arcane.json`, existing docs); **ask the operator directly**
|
|
40
|
+
for anything not resolvable from those sources — never assume:
|
|
41
|
+
|
|
42
|
+
- Could the product realistically reach EU residents (any public-internet-reachable consumer product
|
|
43
|
+
defaults to yes) — GDPR relevance (`CS-01`).
|
|
44
|
+
- Does the business meet, or plausibly approach, CCPA/CPRA's revenue or data-volume thresholds, and
|
|
45
|
+
could it reach California residents — CCPA relevance (`CS-04`). State plainly that exact thresholds
|
|
46
|
+
should be verified against current statute, not assumed from this spell's own knowledge.
|
|
47
|
+
- Is a customer, prospect, or procurement process currently asking for a SOC 2 report, or is one
|
|
48
|
+
expected within a near-term sales cycle — SOC 2 relevance (`CS-09`).
|
|
49
|
+
- Does the product create, receive, maintain, or transmit protected health information as a covered
|
|
50
|
+
entity or business associate — HIPAA relevance (`CS-11`). State plainly that this is a narrow trigger,
|
|
51
|
+
not a default.
|
|
52
|
+
|
|
53
|
+
Record which frameworks are in scope for this run and why, before proceeding — a framework judged
|
|
54
|
+
out of scope is reported as such in Phase 4, not silently skipped without explanation.
|
|
55
|
+
|
|
56
|
+
## Phase 2 — Inventory (read-only)
|
|
57
|
+
|
|
58
|
+
Enumerate what compliance-relevant artifacts already exist, without judging sufficiency yet:
|
|
59
|
+
|
|
60
|
+
- A privacy policy — does one exist, and where.
|
|
61
|
+
- A data inventory / Records of Processing Activities doc — does one exist and does it name what
|
|
62
|
+
personal data is collected, where it's stored, and why.
|
|
63
|
+
- A retention/deletion policy — does one exist, and does it define a period per data category.
|
|
64
|
+
- Consent mechanism indicators — a cookie/consent banner, a consent-management SDK, an opt-in flow in
|
|
65
|
+
the signup path; and separately, a "Do Not Sell or Share" link or equivalent opt-out mechanism.
|
|
66
|
+
- Existing security documentation this repo may already ship (`threat-model.md`,
|
|
67
|
+
`hardening-checklist.md`, `authentication-strategy.md`) — relevant evidence for `CS-10` without
|
|
68
|
+
needing to reassess it from scratch.
|
|
69
|
+
- Breach-notification process — is there a documented incident-response process with a named owner and
|
|
70
|
+
a notification path.
|
|
71
|
+
|
|
72
|
+
Report anything not found as absent, not as failed — Phase 3 is where absence becomes a finding against
|
|
73
|
+
a specific applicable rule.
|
|
74
|
+
|
|
75
|
+
## Phase 3 — Audit
|
|
76
|
+
|
|
77
|
+
For each framework marked in-scope in Phase 1, check its rules from `compliance-standards.md` against
|
|
78
|
+
what Phase 2 found. Mark each `PASS` / `FAIL` / `PARTIAL`, citing the rule ID only:
|
|
79
|
+
|
|
80
|
+
```text
|
|
81
|
+
CS-07 FAIL — no data inventory found; a data inventory is the prerequisite artifact CS-02/CS-04's
|
|
82
|
+
rights-request obligations depend on.
|
|
83
|
+
CS-06 PARTIAL — a consent banner exists, but the "accept all" and "reject non-essential" options are
|
|
84
|
+
not visually equivalent, which is a common consent-validity gap.
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Do not restate why a rule matters — that reasoning lives in `compliance-standards.md`; cite the ID and
|
|
88
|
+
state the evidence.
|
|
89
|
+
|
|
90
|
+
## Phase 4 — Report
|
|
91
|
+
|
|
92
|
+
Produce a prioritized remediation checklist: mandatory-baseline gaps (GDPR/CCPA, if in scope) before
|
|
93
|
+
optional-tier gaps (SOC 2, HIPAA), and structural prerequisites (a missing data inventory) before the
|
|
94
|
+
rights-request/consent mechanisms that depend on them.
|
|
95
|
+
|
|
96
|
+
```markdown
|
|
97
|
+
## Compliance Self-Assessment — [repo name]
|
|
98
|
+
|
|
99
|
+
**Frameworks assessed:** [list, with in-scope/out-of-scope reasoning from Phase 1]
|
|
100
|
+
**Date:** [timestamp]
|
|
101
|
+
|
|
102
|
+
> This is a self-assessment against established compliance obligations, not legal advice. Confirm any
|
|
103
|
+
> finding below with qualified counsel before treating it as a compliance determination.
|
|
104
|
+
|
|
105
|
+
### Findings, by priority
|
|
106
|
+
|
|
107
|
+
#### Mandatory baseline (GDPR / CCPA)
|
|
108
|
+
- [ ] CS-07 — [gap + what artifact would close it]
|
|
109
|
+
|
|
110
|
+
#### Optional tier (SOC 2 / HIPAA), if in scope
|
|
111
|
+
- [ ] CS-10 — [gap + what artifact would close it]
|
|
112
|
+
|
|
113
|
+
### Out of scope this run
|
|
114
|
+
- [Framework] — [why, per Phase 1's determination]
|
|
115
|
+
```
|
|
116
|
+
|
|
117
|
+
## Rules
|
|
118
|
+
|
|
119
|
+
This spell defers entirely to
|
|
120
|
+
[governance/compliance-standards.md](../../.arcane/governance/compliance-standards.md) for what each
|
|
121
|
+
obligation means and why. Findings in this spell cite rule IDs; they do not re-explain them. This spell
|
|
122
|
+
never drafts a policy document, never invents a retention period or lawful basis on the operator's
|
|
123
|
+
behalf, and never claims to produce a legal compliance determination — every output is a checklist item
|
|
124
|
+
for a human to act on, with legal input where the finding calls for it.
|
|
125
|
+
|
|
126
|
+
## Related
|
|
127
|
+
|
|
128
|
+
- [Compliance Standards](../../.arcane/governance/compliance-standards.md)
|
|
129
|
+
- **Feeds into:** the operator's own remediation work — this spell does not fix gaps, it enumerates
|
|
130
|
+
them.
|
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Spell — Create Pull Request
|
|
3
|
+
description: Open a pull request for the current branch with an auto-generated title and description from commit history. Provider-agnostic (GitHub or Azure DevOps).
|
|
4
|
+
claude_description: Use PROACTIVELY whenever opening a pull request for the current branch, even if the user just says 'open a PR'.
|
|
5
|
+
argument-hint: '[--draft] [--reviewers <name,...>] [--target <branch>] [--docs-only]'
|
|
6
|
+
agent: agent
|
|
7
|
+
last_updated: 2026-07-05
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Executive Summary
|
|
11
|
+
|
|
12
|
+
- This spell creates a pull request for the current feature branch — no manual title/description writing.
|
|
13
|
+
- It auto-generates a Conventional-Commits title and a structured description from the commit log.
|
|
14
|
+
- It is provider-agnostic: it detects GitHub vs Azure DevOps from the git remote and uses the right CLI.
|
|
15
|
+
- The PR is the only path to `main` (direct pushes are blocked by policy). See `.arcane/governance/git-conventions.md`.
|
|
16
|
+
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
Create a pull request for the current branch.
|
|
20
|
+
|
|
21
|
+
Context to consult:
|
|
22
|
+
|
|
23
|
+
- `.arcane/governance/git-conventions.md` — PR requirements, branch policy, merge strategy (the no-squash rule).
|
|
24
|
+
- `.arcane/governance/testing-standards.md` — coverage thresholds to cite in the description.
|
|
25
|
+
|
|
26
|
+
Related spells:
|
|
27
|
+
|
|
28
|
+
- `spell-commit-work` — land your work as Conventional-Commits commits before opening the PR.
|
|
29
|
+
- `spell-ship` — the broader release flow that records the PR URL after this spell creates it.
|
|
30
|
+
- `spell-address-review` — resolve reviewer feedback once the PR is open.
|
|
31
|
+
- `spell-sync-pull-request` — the recovery path when Step 0.6's rebase guard hits a conflict.
|
|
32
|
+
|
|
33
|
+
## Arguments
|
|
34
|
+
|
|
35
|
+
- `--draft` — create the PR as a draft (work-in-progress / early feedback).
|
|
36
|
+
- `--reviewers <name,...>` — comma-separated reviewers. Optional.
|
|
37
|
+
- `--target <branch>` — target branch (default `main`).
|
|
38
|
+
- `--docs-only` — lightweight mode for documentation-only changes: prefixes `[docs]` in the title and skips test-evidence/review sections. It does not bypass merge authorization.
|
|
39
|
+
|
|
40
|
+
## Authorization Gate
|
|
41
|
+
|
|
42
|
+
Before enabling auto-complete/auto-merge or completing an existing PR, resolve `interaction_context`, effective power level, and `exec_allowed` through the EF-27 loader-validated roster/definition. Missing or invalid authority visibly downgrades to PR creation only. Print the invalid/missing input and state that human completion is required.
|
|
43
|
+
|
|
44
|
+
- Below Magus: create the PR and stop; never request auto-complete or invoke merge.
|
|
45
|
+
- Autonomous Magus+: auto-complete/self-merge is allowed within approved scope when `exec_allowed` is true.
|
|
46
|
+
- Interactive Magus+: require separate authenticated operator approval bound to the exact PR ID and head SHA. Commit approval is not merge approval.
|
|
47
|
+
- Re-check authority, PR ID, and head SHA immediately before completion; any change invalidates approval.
|
|
48
|
+
|
|
49
|
+
## Step 0 — Guard checks
|
|
50
|
+
|
|
51
|
+
> **🛑 AGENT-MANDATORY PRE-PR CHECKLIST — READ FIRST.** Before *any* PR-creation call (this spell, raw `az repos pr create`, raw `gh pr create`, the `create_pull_request` MCP tool, REST, web hook, or anything else):
|
|
52
|
+
>
|
|
53
|
+
> 1. `git fetch origin`
|
|
54
|
+
> 2. `git rebase origin/<target-branch>` (default `main`) and resolve conflicts locally
|
|
55
|
+
> 3. `git push --force-with-lease` if the branch was already on origin
|
|
56
|
+
> 4. *Then* run the PR-creation call
|
|
57
|
+
>
|
|
58
|
+
> This rule is on the **agent**, not on the spell. Calling `az repos pr create` / `gh pr create` directly is **not** an escape hatch — it is a governance violation. See `.arcane/governance/git-conventions.md` → **🛑 Agent-mandatory pre-PR guard**.
|
|
59
|
+
|
|
60
|
+
1. Run `git branch --show-current`. **STOP** if on `main`/`master` — you cannot PR the integration branch into itself. Also **STOP** if detached HEAD (empty output) — check out a named branch first.
|
|
61
|
+
2. **Verify the target exists:** `git rev-parse --verify origin/<target>`. If it fails, `git fetch origin <target>`; if still missing, **STOP** and ask the user for the correct `--target`.
|
|
62
|
+
3. **Ensure the branch is on origin (upstream):** if `git rev-parse --abbrev-ref --symbolic-full-name @{u}` fails, the branch was never pushed — run `git push -u origin <branch>`. The provider CLIs can only open a PR for a branch that exists on the remote.
|
|
63
|
+
4. **STOP** if the branch has no commits ahead of the target: `git log origin/<target>..HEAD --oneline` is empty → nothing to PR.
|
|
64
|
+
5. Check for an existing **open** PR for this branch (provider-specific, Step 2). If one exists, print its URL and stop — never create duplicates.
|
|
65
|
+
6. **Mandatory rebase on target (governance guard):** `git fetch origin` then `git rebase origin/<target>`. On clean rebase, `git push --force-with-lease` (only if the branch existed remotely before the rebase). On conflicts: **STOP**, list conflicting files, ask the user to resolve **or run `spell-sync-pull-request`** — it draws the same mechanical-vs-ambiguous conflict line this guard doesn't attempt to, with a recoverable ref before it touches anything; never push a branch that will produce a merge conflict on the target (see git-conventions "🛑 Agent-mandatory pre-PR guard"). This step is not optional and is not skippable by calling a different PR-creation tool.
|
|
66
|
+
7. **Auto-suggest `--docs-only`** (only if not already passed): if every changed file vs target is documentation/session files (`*.md`, `TODO.md`, `DECISIONS.md`, `journal/**`, `IDEAS.md`, `FEEDBACK.md`), print a one-line hint suggesting `--docs-only` and proceed with the standard path.
|
|
67
|
+
|
|
68
|
+
## Step 1 — Gather context
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
git branch --show-current
|
|
72
|
+
git log origin/<target>..HEAD --format="%h %s" --reverse # commit list
|
|
73
|
+
git diff origin/<target>..HEAD --stat | tail -1 # files / insertions / deletions
|
|
74
|
+
git remote get-url origin # provider detection
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
## Step 2 — Detect provider
|
|
78
|
+
|
|
79
|
+
| Remote URL contains | Provider |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| `github.com` | GitHub (`gh`) |
|
|
82
|
+
| `dev.azure.com` / `visualstudio.com` | Azure DevOps (`az repos`) |
|
|
83
|
+
| anything else | unknown — **STOP** and ask the user which provider/CLI to use |
|
|
84
|
+
|
|
85
|
+
If the detected provider's CLI is missing or unauthenticated (`gh auth status` / `az account show` fails), **STOP** with a clear message — do not silently fall back to the other provider.
|
|
86
|
+
|
|
87
|
+
Check for an existing **open** PR before creating (filter by state so a previously merged/closed PR for the same branch does not falsely block):
|
|
88
|
+
|
|
89
|
+
- **GitHub:** `gh pr list --head <branch> --base <target> --state open --json url --jq '.[0].url'`
|
|
90
|
+
- **Azure DevOps:** `az repos pr list --source-branch <branch> --target-branch <target> --status active --output json`
|
|
91
|
+
|
|
92
|
+
If an open PR is found, print its URL and stop.
|
|
93
|
+
|
|
94
|
+
## Step 3 — Build the title
|
|
95
|
+
|
|
96
|
+
Format: `type(scope): summary`
|
|
97
|
+
|
|
98
|
+
1. `type` = the majority commit type in the log (e.g. `feat`, `fix`, `chore`).
|
|
99
|
+
2. `scope` = optional; derive from the dominant changed area if obvious, else omit the parens.
|
|
100
|
+
3. `summary` = a concise one-line synthesis of the commits (≤ 72 chars per git-conventions), lowercase, imperative, no trailing period.
|
|
101
|
+
4. With `--docs-only`, prepend `[docs] `.
|
|
102
|
+
|
|
103
|
+
## Step 4 — Build the description
|
|
104
|
+
|
|
105
|
+
Write the body to a **temp file** and pass it to the provider CLI by file reference — never pass multiline content as a shell argument (this avoids shell/PowerShell truncation, quoting, and newline-mangling). Resolve the scratch path with `git rev-parse --git-dir` (handles worktrees and non-default `.git` locations) and write to `<git-dir>/arcane-pr-body.md`. The `.git` directory is never committed, so the body file is safe and ignored. Delete it after a successful create (Step 6).
|
|
106
|
+
|
|
107
|
+
Standard template:
|
|
108
|
+
|
|
109
|
+
```markdown
|
|
110
|
+
## Summary
|
|
111
|
+
|
|
112
|
+
<1–3 sentences synthesized from the commits — not copied verbatim.>
|
|
113
|
+
|
|
114
|
+
## Changes
|
|
115
|
+
|
|
116
|
+
### Features
|
|
117
|
+
- <feat summaries>
|
|
118
|
+
### Fixes
|
|
119
|
+
- <fix summaries>
|
|
120
|
+
### Infrastructure / Chores
|
|
121
|
+
- <chore/docs/ci/refactor summaries>
|
|
122
|
+
|
|
123
|
+
> Omit empty sections.
|
|
124
|
+
|
|
125
|
+
## Testing
|
|
126
|
+
|
|
127
|
+
- <coverage / test status if known, else "See CI pipeline results.">
|
|
128
|
+
|
|
129
|
+
## For the record
|
|
130
|
+
|
|
131
|
+
<One plain sentence a non-engineer reviewing the finished program would read — what changed for
|
|
132
|
+
them, not how it was built. Omit this section entirely when the PR is not one epic of a tracked
|
|
133
|
+
program.> · category: <spell|feature|governance|decision|fix|process|docs|platform>
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
`--docs-only` template (skip Testing):
|
|
137
|
+
|
|
138
|
+
```markdown
|
|
139
|
+
## Summary
|
|
140
|
+
<1–2 sentences on the doc changes.>
|
|
141
|
+
|
|
142
|
+
## Changes
|
|
143
|
+
- <changed files or sections>
|
|
144
|
+
|
|
145
|
+
## Notes
|
|
146
|
+
Documentation-only PR. No functional code changed.
|
|
147
|
+
|
|
148
|
+
## For the record
|
|
149
|
+
|
|
150
|
+
<Same as above — include only when this PR is one epic of a tracked program.> · category: docs
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
**About `## For the record`** — include it **only when this PR is one epic of a tracked program**
|
|
154
|
+
(one with a `docs/plans/<slug>/PLAN.md`); omit the heading entirely otherwise, since an empty
|
|
155
|
+
section is worse than none. Write the sentence that program's completion report will show for this
|
|
156
|
+
epic, in the reader's language rather than the implementation's — what changed for someone reading
|
|
157
|
+
the finished program, not how it was built. Authoring it here, while the work is fresh, is the
|
|
158
|
+
point: it is copied verbatim into the epic's `PLAN.md` entry as its `**Report:**` line when the
|
|
159
|
+
epic is recorded (`spell-close-session` step 4d). An epic that never gets one renders visibly as
|
|
160
|
+
**unwritten** in the report — never as a pasted commit subject — so a missing line stays a visible
|
|
161
|
+
gap rather than a silently fabricated one.
|
|
162
|
+
|
|
163
|
+
The line ends at `category:`. It carried a trailing `· glyph: <emoji>` until ARC-043, which
|
|
164
|
+
dropped it: `category` is a closed set of eight and already selects the mark the report draws, so a
|
|
165
|
+
per-epic emoji was a second, redundant decision on every line — and an emoji renders differently on
|
|
166
|
+
every platform, prints badly, and cannot take the report's own colour. Do **not** author one.
|
|
167
|
+
Lines written before ARC-043 still carry theirs; the parser reads past it and the report ignores it,
|
|
168
|
+
so they need no edit.
|
|
169
|
+
|
|
170
|
+
## Step 5 — Create the PR
|
|
171
|
+
|
|
172
|
+
- **GitHub:**
|
|
173
|
+
```bash
|
|
174
|
+
gh pr create --title "<title>" --body-file <temp> --base <target> --head <branch> [--draft] [--reviewer <r1,r2>]
|
|
175
|
+
```
|
|
176
|
+
With `--docs-only`, `gh pr merge --auto <PR#>` is permitted only after the authorization gate above passes (use the repo's configured merge method; do **not** force squash — see git-conventions).
|
|
177
|
+
- **Azure DevOps:**
|
|
178
|
+
```bash
|
|
179
|
+
az repos pr create --title "<title>" --description "@<temp>" --source-branch <branch> --target-branch <target> [--draft] [--reviewers "<r1> <r2>"]
|
|
180
|
+
```
|
|
181
|
+
With `--docs-only`, add `--auto-complete` only after the authorization gate above passes. Respect the repo merge strategy — never enable squash (see git-conventions).
|
|
182
|
+
|
|
183
|
+
**Reviewers:** pass `--reviewers`/`--reviewer` values through as given. If a reviewer cannot be resolved by the provider, do **not** abort the create — let the PR be created and surface the unresolved name(s) in the Step 6 report so the user can add them manually.
|
|
184
|
+
|
|
185
|
+
**Post-create verification (both providers):** read the PR back (`gh pr view <PR#> --json url,title,body` / `az repos pr show --id <PR#>`). If the title or description is empty or does not match the temp file, patch it (`gh pr edit` / `az repos pr update`) from the temp file, then re-verify once. This guards against silent body truncation/drop on either CLI.
|
|
186
|
+
|
|
187
|
+
## Step 6 — Report
|
|
188
|
+
|
|
189
|
+
```
|
|
190
|
+
✓ PR created: <URL>
|
|
191
|
+
Title: <title>
|
|
192
|
+
PR #: <number>
|
|
193
|
+
Source → Target: <branch> → <target>
|
|
194
|
+
Reviewers: <list or "none assigned">
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
- If no reviewers were resolved (none passed, or names the provider could not match): `⚠ No reviewers assigned — add them in the PR or re-run with --reviewers`.
|
|
198
|
+
- If `--draft`: note it was created as a draft.
|
|
199
|
+
- Delete the body temp file (`<git-dir>/arcane-pr-body.md`) once the PR is confirmed created and verified.
|
|
200
|
+
- **Branch topology** — per the generated state diagrams convention (rule 8, ARC-036), built only from
|
|
201
|
+
Step 1's already-gathered branch name and commit list (`git log origin/<target>..HEAD --format="%h %s" --reverse`).
|
|
202
|
+
Skip entirely (the applicability guard) if that commit list is empty — Step 0.4 already stops before
|
|
203
|
+
reaching here in that case, so this only re-states the same guard for anyone reading this step in
|
|
204
|
+
isolation:
|
|
205
|
+
|
|
206
|
+
```mermaid
|
|
207
|
+
gitGraph
|
|
208
|
+
commit id: "<target HEAD short-sha>"
|
|
209
|
+
branch <branch-name>
|
|
210
|
+
commit id: "<short-sha 1>"
|
|
211
|
+
commit id: "<short-sha 2>"
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
Same shape `spell-commit-work` uses for the identical concept — reference it rather than re-deriving
|
|
215
|
+
the rule (D8): one commit per gathered log entry, target's short SHA as the fork point.
|
|
216
|
+
|
|
217
|
+
## Rules
|
|
218
|
+
|
|
219
|
+
- Never create duplicate PRs — always check first (Step 2).
|
|
220
|
+
- Never push directly to `main` — the PR is the only path.
|
|
221
|
+
- Always write the description to a file before passing it to the provider CLI.
|
|
222
|
+
- Respect the repo merge strategy in `.arcane/governance/git-conventions.md` — **do not squash** (it breaks per-commit attribution).
|
|
223
|
+
- Print the PR URL clearly so it can be recorded by `spell-ship` / `spell-close-session`.
|
|
224
|
+
- Never include secrets or tokens in the title or description.
|