specrune-claude 0.0.0-stage → 0.9.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.
Files changed (42) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +132 -2
  3. package/agents/specrune-check.md +37 -0
  4. package/agents/specrune-implement.md +42 -0
  5. package/agents/specrune-research.md +45 -0
  6. package/bin/specrune-claude.mjs +14 -0
  7. package/commands/specrune-finish-work.md +70 -0
  8. package/commands/specrune-next.md +37 -0
  9. package/commands/specrune-start.md +56 -0
  10. package/package.json +43 -4
  11. package/settings.json +50 -0
  12. package/skills/specrune-before-dev/SKILL.md +69 -0
  13. package/skills/specrune-board/SKILL.md +65 -0
  14. package/skills/specrune-board/assets/specrune-board.html +2330 -0
  15. package/skills/specrune-board/references/limits.md +21 -0
  16. package/skills/specrune-brainstorm/SKILL.md +132 -0
  17. package/skills/specrune-brainstorm/references/artifacts.md +27 -0
  18. package/skills/specrune-brainstorm/references/codex-dispatch.md +40 -0
  19. package/skills/specrune-brainstorm/references/coverage-checklists.md +43 -0
  20. package/skills/specrune-brainstorm/references/decomposition.md +29 -0
  21. package/skills/specrune-brainstorm/references/dispatch.md +29 -0
  22. package/skills/specrune-break-loop/SKILL.md +55 -0
  23. package/skills/specrune-finish-work/SKILL.md +73 -0
  24. package/skills/specrune-meta/SKILL.md +64 -0
  25. package/skills/specrune-meta/references/architecture.md +56 -0
  26. package/skills/specrune-meta/references/customization.md +31 -0
  27. package/skills/specrune-meta/references/platform-files.md +68 -0
  28. package/skills/specrune-next/SKILL.md +50 -0
  29. package/skills/specrune-review/SKILL.md +106 -0
  30. package/skills/specrune-setup/SKILL.md +78 -0
  31. package/skills/specrune-setup/agents/openai.yaml +2 -0
  32. package/skills/specrune-setup/references/repository-analysis.md +44 -0
  33. package/skills/specrune-setup/references/spec-writing.md +41 -0
  34. package/skills/specrune-spec-health/SKILL.md +49 -0
  35. package/skills/specrune-update-spec/SKILL.md +98 -0
  36. package/skills/specrune-update-spec/references/code-spec-shape.md +78 -0
  37. package/skills/specrune-update-spec/references/go.md +68 -0
  38. package/skills/specrune-update-spec/references/mem-cli.md +37 -0
  39. package/skills/specrune-update-spec/references/recall.md +34 -0
  40. package/skills/specrune-update-spec/references/targets.md +18 -0
  41. package/skills/specrune-update-spec/references/typescript.md +77 -0
  42. package/src/install.mjs +924 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 jsfaint
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,3 +1,133 @@
1
- # Temporary Holding Version
1
+ # specrune-claude
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ SpecRune 的 Claude Code 宿主适配与安装器。
4
+
5
+ ## 安装
6
+
7
+ 包自带 `specrune` CLI:安装器把平台二进制复制到宿主根下,并把 `settings.json`
8
+ 的 hook 命令改写为该绝对路径,不需要另装 CLI。安装器的通用编排在 `specrune`
9
+ 包内的 `specrune/lib/installer-core.mjs`(共享核心);本包只保留 Claude Code 的
10
+ 落点、模板与 hooks/env 键级合并。入口命令不变:`specrune-claude install` 仍是
11
+ 用户入口。共享核心随 `specrune` 发布,旧版 `specrune` 缺少它时安装器会提示升级。
12
+ 默认装到宿主全局目录
13
+ (`~/.claude/`),装一次所有项目共用:
14
+
15
+ ```bash
16
+ npm i -g specrune-claude
17
+ specrune-claude install
18
+ ```
19
+
20
+ `npx specrune-claude install` 只适合一次性试装:包本身住在 npx 的临时缓存里,
21
+ 缓存随时会被清理,后续 `status` / 升级都得重新下载。常驻安装请用
22
+ `npm i -g specrune-claude`。
23
+
24
+ project scope 用于需要随仓库锁版本或全局目录不可写的场景(同样是一等安装模式):
25
+
26
+ ```bash
27
+ specrune-claude install --scope project --dir <项目根>
28
+ ```
29
+
30
+ ### 安装模式与五宿主矩阵
31
+
32
+ 同一宿主在同一台机器上只能选一种模式:两处同时启用会每轮重复注入,技能也会在两处同名出现。`<adapter>` 是宿主适配器标识,不是 OS / 机器名;`specrune-windows-*` 是平台二进制包,不是安装器。下表 global / project 指**插件安装范围**;技能 `--scope` 由 `specrune skills` 单独决定(Codex 的技能可用 global,只有插件必须 project;DSH 技能与插件都只有 global)。
33
+
34
+ | 适配器 | npm 包 | global | project |
35
+ |---|---|---|---|
36
+ | `opencode` | `specrune-opencode` | ✓ | ✓ |
37
+ | `pi` | `specrune-pi` | ✓ | ✓ |
38
+ | `claude` | `specrune-claude` | ✓ | ✓ |
39
+ | `codex` | `specrune-codex` | —(自动纠正为 project) | ✓ |
40
+ | `dsh` | `specrune-dsh-host` | ✓ | —(自动纠正为 global) |
41
+
42
+ 本适配器是 `claude`,两种 scope 都支持:
43
+
44
+ - **global**(默认):项目里只有 `.specrune/`,技能在 `~/.agents/skills/`,并链接到 `~/.claude/skills/`(无权限时回退真实副本)。
45
+ - **project**:`.specrune/`、`.agents/skills/`、`.claude/` 都在项目内。
46
+
47
+ Windows 完整示例(PowerShell):
48
+
49
+ ```powershell
50
+ npm i -g specrune-claude
51
+ cd C:\path\to\project
52
+ specrune init --developer "你的名字"
53
+ specrune-claude install --scope project
54
+ ```
55
+
56
+ 技能由 CLI 统一安装:`specrune skills install --adapter claude --scope global|project`;切换用 `specrune skills migrate --scope global|project`(整机切换,先写目标再删源,用户改过的文件保留)。项目根放 `.specrune-disabled` 可禁用该项目的自动注入;`specrune-setup` 只能由用户显式调用(`disable-model-invocation`)。
57
+
58
+ 安装器写入五类内容:
59
+
60
+ | 内容 | 位置(global) | 说明 |
61
+ |---|---|---|
62
+ | `specrune/bin/specrune[.exe]` | `~/.claude/specrune/bin/` | 依赖里的平台二进制,供 hook 直接调用 |
63
+ | `agents/specrune-*.md` | `~/.claude/agents/` | implement / check / research 子代理 |
64
+ | `commands/specrune-*.md` | `~/.claude/commands/` | `/specrune-start` 等斜杠命令 |
65
+ | `skills/<name>/**` | `~/.claude/skills/` | 由 `specrune skills install --adapter claude` 创建(链接优先,复制回退;Claude 只扫 `.claude/skills/`) |
66
+ | `settings.json` | `~/.claude/settings.json` | 只合并事件 hook 与 env 键 |
67
+
68
+ `hook` 命令写成 `"<宿主根>/specrune/bin/specrune" hook-claude`(路径带引号,
69
+ 宿主根含空格时也能执行)。找不到依赖里的二进制时不写该目录,命令保留裸
70
+ `specrune hook-claude` 并回退 PATH。升级时旧裸命令与旧路径会原地替换,不会
71
+ 重复追加。
72
+
73
+ `settings.json` 是混合所有权文件,安装器只增删本工具的条目:
74
+
75
+ ```json
76
+ {
77
+ "env": {
78
+ "CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR": "1"
79
+ },
80
+ "hooks": {
81
+ "SessionStart": [
82
+ { "matcher": "startup", "hooks": [{ "type": "command", "command": "\"/home/you/.claude/specrune/bin/specrune\" hook-claude", "timeout": 30 }] },
83
+ { "matcher": "clear", "hooks": [{ "type": "command", "command": "\"/home/you/.claude/specrune/bin/specrune\" hook-claude", "timeout": 30 }] },
84
+ { "matcher": "compact", "hooks": [{ "type": "command", "command": "\"/home/you/.claude/specrune/bin/specrune\" hook-claude", "timeout": 30 }] }
85
+ ],
86
+ "UserPromptSubmit": [
87
+ { "hooks": [{ "type": "command", "command": "\"/home/you/.claude/specrune/bin/specrune\" hook-claude", "timeout": 15 }] }
88
+ ]
89
+ }
90
+ }
91
+ ```
92
+
93
+ 用户的其它键、其它 hook 分组与 env 键原样保留;`env` 键只在用户未设时补,
94
+ 用户改过的值不会被覆盖。非法 JSON 不改并告警;卸载只擦本工具的 hook 条目与
95
+ env 键、删除 `<宿主根>/specrune/` 二进制目录,擦完为空才删 settings 文件(与
96
+ Go 的 `mergeClaudeSettings` / `ScrubClaudeSettings` 同语义)。
97
+
98
+ 状态写在 `<宿主根>/specrune-install.json`(项目级为
99
+ `.specrune/.state/plugins/claude.json`),记录 `{ protocol, version, files }`。
100
+ CLI 不读它;它只服务安装器的升级与卸载。`settings.json` 不进 `files`:它走
101
+ 键级擦除,不能按整文件哈希删除。
102
+
103
+ ## 命令
104
+
105
+ ```bash
106
+ specrune-claude install [--scope global|project] [--dir <路径>] [--dry-run] [--force]
107
+ specrune-claude uninstall [--scope global|project] [--dir <路径>] [--dry-run] [--force]
108
+ specrune-claude status [--scope global|project] [--dir <路径>] [--json]
109
+ ```
110
+
111
+ - `--dry-run` 只打印计划,不写盘。
112
+ - `--force` 覆盖(install)或删除(uninstall)已被用户改过的文件。
113
+ - 退出码:`0` 成功,`1` 运行失败,`2` 用法错误。
114
+
115
+ ## 从项目级旧装配迁移
116
+
117
+ 旧版 `specrune init --claude` 会写 `<项目>/.claude/`。Claude Code 同时加载
118
+ 全局与项目级配置,两处都在会重复挂 hook、每轮注入两次。
119
+
120
+ CLI 已不再提供平台旧文件检测(`specrune doctor` 只校验研究与技能)。请在项目里
121
+ 手工删除旧版写入的 `.claude/agents/specrune-*.md`、`.claude/commands/specrune-*.md`
122
+ 与 `.claude/skills/specrune-*`;`.claude/settings.json` 只移除 `specrune hook-claude`
123
+ 条目与 `CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR`,其余用户配置保留。内容已改过的
124
+ 文件先备份再删。
125
+
126
+ ## 开发
127
+
128
+ ```bash
129
+ npm test
130
+ ```
131
+
132
+ 包内 agents、commands、settings 是 Claude Code 适配的权威副本;`skills/` 是旧版
133
+ 安装器的兼容副本,新版技能正文由 CLI 的 `specrune skills install` 链接/复制。
@@ -0,0 +1,37 @@
1
+ ---
2
+ name: specrune-check
3
+ description: |
4
+ Review agent for the SpecRune workflow. Compares the change against the task requirements and the project specs, fixes what it finds. Never commits.
5
+ tools: Read, Write, Edit, Bash, Glob, Grep, Skill
6
+ ---
7
+ # Check Agent
8
+
9
+ You are the review agent inside a SpecRune workflow.
10
+
11
+ ## You are already the sub-agent
12
+
13
+ The main session dispatched you; do the review and fixes yourself. Do not dispatch another review or implementation agent — that instruction in the breadcrumb or `workflow.md` is for the main session. Report work beyond a review's scope instead of spawning help.
14
+
15
+ ## Load your skill first
16
+
17
+ Before touching anything, load the `specrune-review` skill, plus any skills named in your dispatch prompt, with the `Skill` tool. If that tool is unavailable, read `.agents/skills/<name>/SKILL.md` in the project, or `~/.agents/skills/<name>/SKILL.md` globally for each. If any is unavailable, report `<name> skill unavailable` and stop before reviewing.
18
+
19
+ ## Load your task context first
20
+
21
+ On this platform your context is not preloaded at dispatch time. Fetch it before reviewing anything:
22
+
23
+ specrune context compile --role check
24
+
25
+ Its JSON `context` field contains materialized copies of the task's `prd.md`, `design.md` / `implement.md` (when present), plus every spec and research file in `check.jsonl`. Review against that block.
26
+
27
+ Fallback: retry with `--task <ref>` when your dispatch prompt names a task; if both attempts fail, report `could not load task context` and stop — an ungrounded review is worse than no review.
28
+
29
+ Use the task path from the parent's prompt or curated context. Do not infer it from your child session, environment, or another session.
30
+
31
+ ## What to do
32
+
33
+ Fix mechanical and local issues in scope; for design or judgment calls, report the evidence and stop. Re-run the focused lint, typecheck, and tests.
34
+
35
+ ## Report
36
+
37
+ Report what you fixed, which files changed, and what you verified. If nothing is wrong, say so plainly; padding with speculation wastes time.
@@ -0,0 +1,42 @@
1
+ ---
2
+ name: specrune-implement
3
+ description: |
4
+ Implementation agent for the SpecRune workflow. Reads the task's requirements and curated specs, then writes the code. Never commits.
5
+ tools: Read, Write, Edit, Bash, Glob, Grep, Skill
6
+ ---
7
+ # Implement Agent
8
+
9
+ You are the implementation agent inside a SpecRune workflow.
10
+
11
+ ## You are already the sub-agent
12
+
13
+ The main session dispatched you; do the work yourself. Do not dispatch another implementation or review agent — that instruction in the breadcrumb or `workflow.md` is for the main session. Report work beyond one agent instead of spawning help.
14
+
15
+ ## Load your skill first
16
+
17
+ Before touching anything, load the `specrune-before-dev` skill, plus any skills named in your dispatch prompt, with the `Skill` tool. If that tool is unavailable, read `.agents/skills/<name>/SKILL.md` in the project, or `~/.agents/skills/<name>/SKILL.md` globally for each. If any is unavailable, report `<name> skill unavailable` and stop before editing.
18
+
19
+ ## Load your task context first
20
+
21
+ On this platform your context is not preloaded at dispatch time. Fetch it before touching anything:
22
+
23
+ specrune context compile --role implement
24
+
25
+ Its JSON `context` field contains materialized copies of the task's `prd.md`, `design.md` / `implement.md` (when present), plus every spec and research file in `implement.jsonl`. Work from that block.
26
+
27
+ Fallback: retry with `--task <ref>` when your dispatch prompt names a task; if both attempts fail, report `could not load task context` and stop — do not guess the requirements.
28
+
29
+ ## What to do
30
+
31
+ Follow existing patterns; implement the change; run focused lint, typecheck, and tests; report what changed and what you verified.
32
+
33
+ Before editing, state the change boundary: the behavior gap, where it lives, the files you expect to change, what you will not do, and how you will show behavior did not change. If the scope is larger than the dispatch, say so before continuing.
34
+
35
+ ## Never do
36
+
37
+ `git commit`, `git push`, `git merge` — committing belongs to the session owner.
38
+
39
+ ## Working rules
40
+
41
+ - Read adjacent code and tests first; stay inside this task's scope; do not revert work you did not write. Fix the cause, not the symptom; reuse existing helpers before inventing an abstraction.
42
+ - Research files open with an evidence card (`status` / `sources` / `revision`). `INCONCLUSIVE` is not established and `NOT_FOUND` is a positive finding — neither licenses invention; re-verify cited lines when `revision` is stale.
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: specrune-research
3
+ description: |
4
+ Investigation agent for the SpecRune workflow. Finds the relevant code, patterns and docs, and writes each finding to the task's research/ directory.
5
+ tools: Read, Write, Edit, Bash, Glob, Grep
6
+ ---
7
+ # Research Agent
8
+
9
+ You are the investigation agent inside a SpecRune workflow.
10
+
11
+ ## Progressive disclosure
12
+
13
+ The research context is a navigation map, not preloaded bodies. Start from its paths and titles, read relevant contracts, then trace code and tests. Skip specs that are merely listed. `kind: navigation` entries record delivered pointers, not files read; a body intentionally not preloaded is not a dropped candidate. Search `.specrune/spec/` when incomplete. Record the sources the conclusions actually use in the evidence card; the ledger records delivery, not reading.
14
+
15
+ If no navigation was delivered, run `specrune context compile --role research` and read the JSON `context` field. With a confirmed task path, pass `--task <ref>`; never infer the parent task from your child session or change its binding. Compilation failure is not an empty map: report missing context before task-dependent work. Without a task, a self-contained question may still be investigated.
16
+
17
+ ## Task and report
18
+
19
+ Confirm the task from the parent's explicit path or the host-delivered task; `task current` may verify a delivered identity but never replaces the parent's. Report disagreement before task-dependent work.
20
+
21
+ Write findings before reporting — an in-conversation-only finding disappears at the next compaction. For a confirmed task, create `<task-dir>/research/` if needed, one `<task-dir>/research/<slug>.md` per topic headed by its evidence card, then report paths and a summary, and report a failed write rather than claiming a file exists. With no task, return source-backed findings without a report; never guess a task directory or bind the parent session.
22
+
23
+ ## Evidence card
24
+
25
+ Every report file opens with this YAML header:
26
+
27
+ ---
28
+ status: VERIFIED # VERIFIED | INCONCLUSIVE | NOT_FOUND
29
+ sources: # files the conclusion actually rests on
30
+ - path: core/internal/specrune/context.go
31
+ lines: 654-682
32
+ - path: https://github.com/<org>/<repo>/blob/<rev>/<path>
33
+ revision: a1b2c3d # git rev at investigation time
34
+ ---
35
+
36
+ - `VERIFIED` — you read the evidence; `sources` is mandatory.
37
+ - `INCONCLUSIVE` — the evidence does not settle the question.
38
+ - `NOT_FOUND` — the thing genuinely is not there.
39
+ - External repo? `sources[].path` may be an `http(s)://` permalink embedding the rev; `revision` then records that repo's rev (req:sessions-memory#session-record-authoritative; the doctor skips URL checks).
40
+
41
+ Pick exactly one. No `sources` entry means it is not a fact: cite, downgrade, or drop it — never dress a guess up as a conclusion. Cite `file:line` so a stale reference can be re-located from `revision`.
42
+
43
+ ## Stay in your lane
44
+
45
+ Write only a plain `<slug>.md` report under this task's `research/` — no subdirectories, and never copy source into the task directory; cite it by `file:line` plus the `revision` in the card. Do not edit code, specs, platform config, or task files; patching is no longer investigating.
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env node
2
+ // specrune-claude 的可执行入口。
3
+ //
4
+ // 包内只有这一个 bin:安装器负责把 agents / commands / skills 落到 Claude Code
5
+ // 的配置目录,并对 settings.json 做键级合并——pnpm 10 默认拦截依赖的生命周期
6
+ // 脚本,装包时偷偷写用户配置既不可见也不可控。
7
+ // 共享核心缺失(旧版 specrune)等启动错误只打印可操作消息,不甩模块堆栈。
8
+ try {
9
+ const { main } = await import("../src/install.mjs");
10
+ process.exitCode = await main(process.argv.slice(2));
11
+ } catch (err) {
12
+ process.stderr.write(`specrune-claude: ${err?.message ?? err}\n`);
13
+ process.exitCode = 1;
14
+ }
@@ -0,0 +1,70 @@
1
+ ---
2
+ description: Wrap up: verify the tree, archive finished tasks, record the session
3
+ ---
4
+
5
+ # Finish Work
6
+
7
+ Wrap up the session: verify the tree, record the session, archive the finished
8
+ task(s). Code commits are NOT done here — they belong to the workflow's commit
9
+ step and must already be in history. That step is named, not numbered: numbers
10
+ differ per workflow template and a stale one points at the wrong step with no
11
+ error.
12
+
13
+ ## Step 1: Survey current state
14
+
15
+ ```bash
16
+ specrune context --mode record
17
+ git status --porcelain
18
+ ```
19
+
20
+ Record mode lists active tasks, dirty paths, and recent commits (the hashes
21
+ Step 3 needs). If it surfaces other completed tasks, ask once — "These N tasks
22
+ look done — archive them too this round? [y/N]", default no. The bound task is
23
+ archived regardless.
24
+
25
+ ## Step 2: Classify dirty paths
26
+
27
+ Ignore `.specrune/workspace/`, `.specrune/tasks/` and `.specrune/sessions/`:
28
+ this flow writes there. For the rest, decide whether each path is this task's
29
+ work (cited in `prd.md` / the manifests, or in code areas of its scope) or
30
+ another window's. Then:
31
+
32
+ - **This task's work** — stop. Report the paths and send the user back to the
33
+ commit step. Do not `git commit` here and do not ask the user to.
34
+ - **Unrelated** — report once and continue.
35
+ - **Unsure** — ask once, then route by the answer.
36
+
37
+ ## Step 3: Record the session
38
+
39
+ Verify every acceptance criterion in `prd.md` first — the summary claims what
40
+ happened.
41
+
42
+ ```bash
43
+ specrune session record --title "Session title" \
44
+ --commit "hash1,hash2" \
45
+ --summary "Brief summary of what happened" \
46
+ --next-step "What the next session should pick up first"
47
+ ```
48
+
49
+ **Record before archiving.** The record's `task:` field resolves from the
50
+ active-task pointer, and `task archive` clears session pointers aimed at the task
51
+ it moves — archiving first leaves the field empty and still exits 0. Pass the
52
+ work commits from Step 1, not the archive commits.
53
+
54
+ `--next-step` is for a session with no memory of this one: name the concrete
55
+ next action, not a topic. Repeat the flag for several items; the first is what
56
+ gets surfaced. Older records without Next Steps are normal — do not backfill.
57
+
58
+ ## Step 4: Finish and archive
59
+
60
+ ```bash
61
+ specrune task finish
62
+ specrune task archive <task>
63
+ ```
64
+
65
+ At minimum the bound task, plus any extras confirmed in Step 1. Archive moves
66
+ the directory to `.specrune/tasks/archive/<YYYY-MM>/`, clears session pointers,
67
+ and commits. It marks the task `completed` — except `canceled`, which keeps its
68
+ status and empty completion date. Skip when there is no task.
69
+
70
+ Final commit order: work commit → session record → `chore(task): archive ...`.
@@ -0,0 +1,37 @@
1
+ ---
2
+ description: Pick up the current task at the right step of the workflow
3
+ ---
4
+
5
+ # Next Step
6
+
7
+ Pick up the bound task at the right step of `.specrune/workflow.md` instead of
8
+ re-deriving the flow.
9
+
10
+ ## Step 1: Load current context
11
+
12
+ ```bash
13
+ specrune task current
14
+ specrune context --mode phase
15
+ ```
16
+
17
+ `task current` shows the binding, git state, and where the phase index says you
18
+ are. One binding per session; switch with `specrune task start <task>`.
19
+
20
+ ## Step 2: Follow the project workflow
21
+
22
+ `.specrune/workflow.md` is the only routing authority. Read its phase index,
23
+ the current breadcrumb, and the relevant step; do not assume a particular
24
+ status set, phase count, step number, or native/tdd route. The `specrune-next`
25
+ skill only provides generic instructions for loading this project workflow.
26
+
27
+ Step numbers are deliberately absent from these commands because they differ
28
+ per workflow template. Route by role, then get the numbers from the per-turn
29
+ breadcrumb or the step headings in `.specrune/workflow.md`.
30
+
31
+ ## Step 3: Load the specific step
32
+
33
+ ```bash
34
+ specrune context --mode phase --step <X.X>
35
+ ```
36
+
37
+ Follow the loaded instructions, then move to the next step.
@@ -0,0 +1,56 @@
1
+ ---
2
+ description: Start a SpecRune session: load context, pick or resume the active task
3
+ ---
4
+
5
+ # Start Session
6
+
7
+ Load the compact context by hand — at the start of a conversation, or when the
8
+ host platform has no session-start hook.
9
+
10
+ ## Step 1: Current state and recent sessions
11
+
12
+ ```bash
13
+ specrune context
14
+ specrune session log
15
+ ```
16
+
17
+ The log shows what happened recently, which task each session belonged to, and
18
+ where it left off. Hook-driven platforms get the same three entries injected
19
+ automatically; ask the user what they were working on only when both are empty.
20
+ For the reasoning behind an old decision, `specrune mem` — the `specrune-update-spec`
21
+ skill's step 3 holds the two-sources table for choosing between the two.
22
+
23
+ ## Step 2: Workflow and spec indexes
24
+
25
+ ```bash
26
+ specrune context --mode phase
27
+ specrune packages
28
+ specrune specs
29
+ cat .specrune/spec/<package>/<layer>/index.md # each layer you expect to touch
30
+ cat .specrune/spec/guides/index.md
31
+ ```
32
+
33
+ Read indexes only for areas the work will touch; the index points at the
34
+ guidelines, and `.specrune/workflow.md` holds the full flow (read on demand).
35
+
36
+ ## Step 3: Follow the project workflow
37
+
38
+ `.specrune/workflow.md` is the only routing authority. Read its phase index,
39
+ the current breadcrumb, and the relevant step before choosing an action. Do not
40
+ assume a particular status set, phase count, step number, or native/tdd route.
41
+ For a bound task, load `specrune-next`; it explains how to use the project's
42
+ workflow rather than copying a route table into this command.
43
+
44
+ ## Skill routing
45
+
46
+ | User intent | Skill |
47
+ |---|---|
48
+ | New feature / unclear requirements | `specrune-brainstorm` |
49
+ | About to write code | `specrune-before-dev` |
50
+ | Done coding / quality check | `specrune-review` |
51
+ | Stuck / fixed the same bug multiple times | `specrune-break-loop` |
52
+ | Learned something worth capturing | `specrune-update-spec` |
53
+
54
+ Each step's full text lives in `.specrune/workflow.md`; load one with
55
+ `specrune context --mode phase --step N.N`. The per-turn breadcrumb names the
56
+ skill for the phase you are in.
package/package.json CHANGED
@@ -1,6 +1,45 @@
1
1
  {
2
2
  "name": "specrune-claude",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.9.0",
4
+ "description": "SpecRune 的 Claude Code 宿主适配与安装器:全局装配 agents、commands、skills,并合并 settings.json 的事件 hook 与 env",
5
+ "type": "module",
6
+ "bin": {
7
+ "specrune-claude": "bin/specrune-claude.mjs"
8
+ },
9
+ "files": [
10
+ "bin",
11
+ "src",
12
+ "agents",
13
+ "commands",
14
+ "skills",
15
+ "settings.json",
16
+ "README.md"
17
+ ],
18
+ "engines": {
19
+ "node": ">=20"
20
+ },
21
+ "dependencies": {
22
+ "specrune": "^0.9.0"
23
+ },
24
+ "scripts": {
25
+ "test": "node --test"
26
+ },
27
+ "repository": {
28
+ "type": "git",
29
+ "url": "git+https://github.com/jsfaint/SpecRune.git",
30
+ "directory": "plugins/claude"
31
+ },
32
+ "homepage": "https://github.com/jsfaint/SpecRune#readme",
33
+ "bugs": {
34
+ "url": "https://github.com/jsfaint/SpecRune/issues"
35
+ },
36
+ "license": "MIT",
37
+ "keywords": [
38
+ "specrune",
39
+ "claude",
40
+ "claude-code",
41
+ "plugin",
42
+ "spec-driven",
43
+ "workflow"
44
+ ]
45
+ }
package/settings.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "env": {
3
+ "CLAUDE_BASH_MAINTAIN_PROJECT_WORKING_DIR": "1"
4
+ },
5
+ "hooks": {
6
+ "SessionStart": [
7
+ {
8
+ "matcher": "startup",
9
+ "hooks": [
10
+ {
11
+ "type": "command",
12
+ "command": "specrune hook-claude",
13
+ "timeout": 30
14
+ }
15
+ ]
16
+ },
17
+ {
18
+ "matcher": "clear",
19
+ "hooks": [
20
+ {
21
+ "type": "command",
22
+ "command": "specrune hook-claude",
23
+ "timeout": 30
24
+ }
25
+ ]
26
+ },
27
+ {
28
+ "matcher": "compact",
29
+ "hooks": [
30
+ {
31
+ "type": "command",
32
+ "command": "specrune hook-claude",
33
+ "timeout": 30
34
+ }
35
+ ]
36
+ }
37
+ ],
38
+ "UserPromptSubmit": [
39
+ {
40
+ "hooks": [
41
+ {
42
+ "type": "command",
43
+ "command": "specrune hook-claude",
44
+ "timeout": 15
45
+ }
46
+ ]
47
+ }
48
+ ]
49
+ }
50
+ }
@@ -0,0 +1,69 @@
1
+ ---
2
+ name: specrune-before-dev
3
+ description: Load task requirements, specs and conventions before coding. Use in the main session before dispatch, or as the dispatched specrune-implement sub-agent.
4
+ ---
5
+
6
+ # specrune-before-dev
7
+
8
+ > **Project gate**: stop if the repository root lacks `.specrune/` or contains `.specrune-disabled`; do not run any step of this skill.
9
+
10
+ Read the specs before coding so the implementation follows them, not the
11
+ model's habits.
12
+
13
+ ## Who this skill is for
14
+
15
+ - **Main session** — read the task and specs, state the boundary, then dispatch `specrune-implement`.
16
+ - **Dispatched `specrune-implement` sub-agent** — run the steps below on the task path the parent supplied.
17
+
18
+ ## Sub-agent boundaries
19
+
20
+ If you are the dispatched `specrune-implement` sub-agent:
21
+
22
+ - Use the task path from the parent's prompt or curated context. Do not run `task current` to discover the parent task.
23
+ - Do not create, start, finish, or archive tasks; do not commit.
24
+ - Load any additional skills named in your dispatch prompt, not only this role skill.
25
+ - If the curated context is missing or incomplete, report it before editing.
26
+
27
+ ## Dispatch note
28
+
29
+ The main session may have loaded other skills. They are not inherited
30
+ automatically: name the ones the sub-agent needs in the dispatch prompt (or
31
+ pass `skills` to `specrune_subagent`). The sub-agent loads its role skill and
32
+ those named skills.
33
+
34
+ ## Steps
35
+
36
+ 1. **Read the task's planning artifacts** (if a task is bound; a dispatched sub-agent uses the task path from its parent, never `task current`):
37
+
38
+ Main session:
39
+
40
+ ```bash
41
+ specrune task current
42
+ specrune task show <task>
43
+ ```
44
+
45
+ `prd.md` first; `design.md` / `implement.md` when present.
46
+
47
+ 2. **Find the specs that apply**:
48
+
49
+ ```bash
50
+ specrune packages
51
+ specrune specs # path + title only; add --verbose for bytes/density/index refs
52
+ ```
53
+
54
+ Read `.specrune/spec/<package>/<layer>/index.md` for each package you touch
55
+ and follow it into the concrete guideline files. The index is a pointer, not
56
+ the goal. Include `spec/guides/index.md` for cross-cutting checklists.
57
+
58
+ 3. **State the change boundary** before writing code, for a non-trivial change
59
+ (more than one file, crosses a layer, changes a public interface, or edits
60
+ code you did not just write):
61
+
62
+ - the behavior gap between now and target
63
+ - where that behavior actually lives (not where it is easiest to intercept)
64
+ - files you expect to change, and why each is necessary
65
+ - what this task explicitly does not do
66
+ - how you will show a local refactor did not change behavior
67
+
68
+ If the real scope is clearly larger than that, say so before continuing.
69
+ Do not widen the change on your own.