cc-devflow 4.5.14 → 4.5.16

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 (63) hide show
  1. package/.claude/skills/cc-act/CHANGELOG.md +5 -0
  2. package/.claude/skills/cc-act/SKILL.md +2 -2
  3. package/.claude/skills/cc-act/assets/PR_BRIEF_TEMPLATE.md +3 -0
  4. package/.claude/skills/cc-act/scripts/render-pr-brief.sh +113 -33
  5. package/.claude/skills/cc-check/SKILL.md +0 -1
  6. package/.claude/skills/cc-dev/CHANGELOG.md +5 -0
  7. package/.claude/skills/cc-dev/PLAYBOOK.md +6 -3
  8. package/.claude/skills/cc-dev/SKILL.md +11 -8
  9. package/.claude/skills/cc-dev/scripts/ensure-work-branch.sh +117 -0
  10. package/.claude/skills/cc-dev/scripts/prepare-change-worktree.sh +135 -0
  11. package/.claude/skills/cc-dev/scripts/resolve-cc-devflow.sh +8 -26
  12. package/.claude/skills/cc-do/SKILL.md +1 -2
  13. package/.claude/skills/cc-investigate/CHANGELOG.md +15 -0
  14. package/.claude/skills/cc-investigate/SKILL.md +86 -9
  15. package/.claude/skills/cc-investigate/assets/TASKS_TEMPLATE.md +57 -1
  16. package/.claude/skills/cc-investigate/references/investigation-contract.md +1 -0
  17. package/.claude/skills/cc-plan/CHANGELOG.md +23 -0
  18. package/.claude/skills/cc-plan/PLAYBOOK.md +8 -5
  19. package/.claude/skills/cc-plan/SKILL.md +91 -20
  20. package/.claude/skills/cc-plan/assets/TASKS_TEMPLATE.md +59 -8
  21. package/.claude/skills/cc-plan/references/planning-contract.md +15 -9
  22. package/.claude/skills/cc-pr-review/CHANGELOG.md +9 -0
  23. package/.claude/skills/cc-pr-review/PLAYBOOK.md +3 -0
  24. package/.claude/skills/cc-pr-review/SKILL.md +30 -1
  25. package/.claude/skills/cc-review/CHANGELOG.md +10 -0
  26. package/.claude/skills/cc-review/SKILL.md +53 -9
  27. package/.claude/skills/cc-review/references/implementation-review-branch.md +1 -0
  28. package/.claude/skills/cc-review/references/plan-review-branch.md +1 -0
  29. package/.claude/skills/cc-review/references/review-methods.md +30 -0
  30. package/.claude/skills/cc-roadmap/CHANGELOG.md +6 -0
  31. package/.claude/skills/cc-roadmap/SKILL.md +1 -1
  32. package/.claude/skills/cc-roadmap/scripts/lib/roadmap-tracking/markdown.js +274 -69
  33. package/.claude/skills/cc-roadmap/scripts/lib/roadmap-tracking/schema.js +69 -15
  34. package/CHANGELOG.md +18 -0
  35. package/README.md +3 -4
  36. package/README.zh-CN.md +3 -4
  37. package/bin/cc-devflow-cli.js +8 -94
  38. package/docs/examples/example-bindings.json +8 -8
  39. package/docs/examples/full-design-blocked/BACKLOG.md +12 -1
  40. package/docs/examples/full-design-blocked/README.md +1 -1
  41. package/docs/examples/full-design-blocked/ROADMAP.md +2 -2
  42. package/docs/examples/full-design-blocked/changes/REQ-002-bulk-invite-import/task.md +39 -5
  43. package/docs/examples/full-design-blocked/roadmap.json +7 -2
  44. package/docs/examples/local-handoff/BACKLOG.md +12 -1
  45. package/docs/examples/local-handoff/README.md +1 -1
  46. package/docs/examples/local-handoff/ROADMAP.md +2 -2
  47. package/docs/examples/local-handoff/changes/REQ-003-audit-log-export/task.md +39 -5
  48. package/docs/examples/local-handoff/roadmap.json +7 -2
  49. package/docs/examples/pdca-loop/BACKLOG.md +12 -1
  50. package/docs/examples/pdca-loop/README.md +1 -1
  51. package/docs/examples/pdca-loop/ROADMAP.md +2 -2
  52. package/docs/examples/pdca-loop/changes/REQ-001-copy-invite-link/task.md +39 -5
  53. package/docs/examples/pdca-loop/roadmap.json +7 -2
  54. package/lib/skill-runtime/CLAUDE.md +1 -1
  55. package/lib/skill-runtime/__tests__/cli-bootstrap.integration.test.js +2 -1
  56. package/lib/skill-runtime/__tests__/config.test.js +7 -2
  57. package/lib/skill-runtime/config.js +38 -6
  58. package/lib/skill-runtime/index.js +1 -9
  59. package/package.json +1 -1
  60. package/lib/skill-runtime/errors.js +0 -39
  61. package/lib/skill-runtime/query-registry.js +0 -101
  62. package/lib/skill-runtime/query.js +0 -126
  63. package/lib/skill-runtime/trace.js +0 -22
@@ -3,7 +3,7 @@
3
3
  ## Roadmap Meta
4
4
 
5
5
  - Roadmap version: `roadmap.v3`
6
- - Skill version: `5.3.0`
6
+ - Skill version: `5.3.1`
7
7
  - Status: `active`
8
8
  - Last updated: `2026-04-16`
9
9
  - Owner / decider: `product-owner`
@@ -52,6 +52,7 @@
52
52
 
53
53
  ## Implementation Tracking
54
54
  - Roadmap state source: `roadmap.json`
55
+ - Output language: en
55
56
 
56
57
  <!-- roadmap-tracking:start -->
57
58
  | RM-ID | Item | Stage | Priority | Primary Capability | Secondary Capabilities | Expected Spec Delta | Depends On | Status | REQ | Progress |
@@ -59,7 +60,6 @@
59
60
  | RM-020 | Add an audit-log export summary download | Stage 2 | P1 | cap-audit-log-export | - | codify local export summary truth | - | Local handoff | REQ-003 | 100% |
60
61
  <!-- roadmap-tracking:end -->
61
62
 
62
-
63
63
  ## Technical Architecture
64
64
 
65
65
  ```mermaid
@@ -4,8 +4,9 @@
4
4
 
5
5
  - Requirement version: `REQ-003.v1`
6
6
  - Design version: `design.v1`
7
- - CC-Plan skill version: `3.10.2`
7
+ - CC-Plan skill version: `3.10.7`
8
8
  - Work branch: `REQ/003-audit-log-export`
9
+ - Output language: en
9
10
  - Source roadmap item: `RM-020`
10
11
  - Source roadmap version: `roadmap.v3`
11
12
 
@@ -24,6 +25,39 @@
24
25
  - Testing decisions: test through admin panel action and visible row data
25
26
  - Out of scope: JSON export, scheduled reporting, shared reporting backend
26
27
  - AI Leverage Decision Lens: boil-lake; complete visible-row CSV export while keeping reporting-platform work outside the lake
28
+ - Product / Creative Discovery:
29
+ - Worth doing: admins already copy audit summaries into weekly reports by hand.
30
+ - Desired product shape: download the same visible rows they are reviewing, without a reporting setup flow.
31
+ - Narrowest wedge: CSV export for currently visible summary rows.
32
+ - 10x / better version: scheduled reporting and shared report history, deferred outside this requirement.
33
+ - Do-nothing consequence: weekly reporting stays manual and easy to miscopy.
34
+ - Second-Move Review:
35
+ - First good move: add a download action to the audit summary panel.
36
+ - Simpler move: export only visible rows in CSV and avoid backend report storage.
37
+ - Better architecture: later introduce a reporting backend for scheduled exports.
38
+ - Selected move: visible-row CSV download from the existing panel.
39
+ - Rejected tradeoff: no JSON export, scheduling, or shared reporting backend here.
40
+ - ASCII Branch Chain Analysis:
41
+ Language rule: connector tokens stay ASCII; node text follows `Output language: en`.
42
+
43
+ ```text
44
+ Requirement Impact Chain
45
+ REQ: CSV export for visible audit summary rows
46
+ |-- Upstream source: RM-020 + weekly admin reporting workflow
47
+ |-- Current code path: src/admin/AuditSummaryPanel.tsx
48
+ | |-- caller: admin audit summary panel action
49
+ | |-- data or state: visible summary rows
50
+ | `-- deepest affected layer: browser download/blob boundary for CSV output
51
+ |-- Required change: export visible rows without adding reporting storage
52
+ `-- Verification seam: src/admin/AuditSummaryPanel.test.tsx
53
+
54
+ Business Impact Chain
55
+ OUTCOME: admins stop manually copying weekly audit summaries
56
+ |-- Direct behavior impact: visible rows become a downloadable CSV
57
+ |-- Downstream impact: local handoff documents proof for CSV-only export
58
+ |-- Risk branch: exported rows diverge from visible panel state
59
+ `-- Non-goal branch: JSON export, scheduled reporting, and backend history stay out
60
+ ```
27
61
  - Read first:
28
62
  - `design.md`
29
63
  - `src/admin/AuditSummaryPanel.tsx`
@@ -42,8 +76,8 @@
42
76
  ClaudeCode / Codex 执行本计划时,必须把本文件当成任务模板合同,而不是普通 TODO 列表。
43
77
 
44
78
  - Template source: `assets/TASKS_TEMPLATE.md`
45
- - CLI resolver: all workflow commands must run through `.claude/skills/cc-dev/scripts/resolve-cc-devflow.sh` or `.codex/skills/cc-dev/scripts/resolve-cc-devflow.sh`; if it cannot prove `query workflow-context` and `next-change-key`, stop blocked.
46
- - Context first: run resolved CLI `query workflow-context --change <changeId> --change-key <changeKey> --cwd <repo-root> --data-only --no-trace --compact` before opening deep sections.
79
+ - CLI resolver: all workflow commands must run through `.claude/skills/cc-dev/scripts/resolve-cc-devflow.sh` or `.codex/skills/cc-dev/scripts/resolve-cc-devflow.sh`; if it cannot prove `next-change-key`, stop blocked.
80
+ - Context first: read this `task.md`, current Git status/history, and PR or handoff truth when present before opening deep sections.
47
81
  - Task selection: use `scripts/select-ready-tasks.sh --tasks devflow/changes/<change-key>/task.md`.
48
82
  - Task block rule: read the full task block before coding; title-only execution is invalid.
49
83
  - Completion rule: after verification and review gates pass, run `scripts/mark-task-complete.sh --tasks devflow/changes/<change-key>/task.md --task <task-id>`.
@@ -54,8 +88,8 @@ DEVFLOW=".claude/skills/cc-dev/scripts/resolve-cc-devflow.sh"
54
88
  if [[ ! -f "$DEVFLOW" && -f ".codex/skills/cc-dev/scripts/resolve-cc-devflow.sh" ]]; then
55
89
  DEVFLOW=".codex/skills/cc-dev/scripts/resolve-cc-devflow.sh"
56
90
  fi
57
- bash "$DEVFLOW" require query workflow-context next-change-key
58
- bash "$DEVFLOW" query workflow-context --change <changeId> --change-key <changeKey> --cwd <repo-root> --data-only --no-trace --compactSCRIPT_ROOT=".claude/skills/cc-do/scripts"
91
+ bash "$DEVFLOW" require next-change-key
92
+ SCRIPT_ROOT=".claude/skills/cc-do/scripts"
59
93
  if [[ ! -d "$SCRIPT_ROOT" && -d ".codex/skills/cc-do/scripts" ]]; then
60
94
  SCRIPT_ROOT=".codex/skills/cc-do/scripts"
61
95
  fi
@@ -5,12 +5,17 @@
5
5
  },
6
6
  "meta": {
7
7
  "roadmapVersion": "roadmap.v2",
8
- "skillVersion": "5.3.0",
8
+ "skillVersion": "5.3.1",
9
9
  "status": "active",
10
10
  "lastUpdated": "2026-04-19",
11
11
  "currentFocusStage": "Stage 2"
12
12
  },
13
13
  "context": {
14
+ "projectDirectionMode": "",
15
+ "projectDirectionRationale": "",
16
+ "directionQuestionsSelected": [],
17
+ "directionQuestionsSkipped": [],
18
+ "directionGuardrailsApplied": [],
14
19
  "planningPosture": "",
15
20
  "evidenceMaturity": "",
16
21
  "canonicalTerms": [],
@@ -123,7 +128,7 @@
123
128
  },
124
129
  "backlogMeta": {
125
130
  "roadmapVersion": "roadmap.v2",
126
- "skillVersion": "4.4.1",
131
+ "skillVersion": "5.3.1",
127
132
  "currentFocusStage": "Stage 2"
128
133
  },
129
134
  "dependencyHandoff": {
@@ -5,10 +5,11 @@
5
5
  ## Backlog Meta
6
6
 
7
7
  - Roadmap version: `roadmap.v1`
8
- - Skill version: `5.3.0`
8
+ - Skill version: `5.3.1`
9
9
  - Last synced: `2026-04-19`
10
10
  - Current focus stage: `Stage 1`
11
11
  - Roadmap state source: `roadmap.json`
12
+ - Output language: en
12
13
 
13
14
  ## Queue
14
15
 
@@ -23,6 +24,16 @@
23
24
  - Parallel-ready next wave: none until RM-001 proves the copy action shape
24
25
  - Notes on blockers: RM-002 should reuse the final interaction contract from RM-001, not race it
25
26
 
27
+ ## Project Direction Handoff
28
+
29
+ - Project direction mode: -
30
+ - Direction mode rationale: -
31
+ - Direction-specific questions selected: -
32
+ - Direction-specific questions skipped: -
33
+ - Direction guardrails applied: -
34
+ - Planning posture: -
35
+ - Evidence maturity: -
36
+
26
37
  ## Ready For Req-Plan
27
38
 
28
39
  - RM-001:
@@ -4,7 +4,7 @@
4
4
 
5
5
  - Example version: `1.0.0`
6
6
  - Last reviewed: `2026-04-17`
7
- - Bound skills: `cc-roadmap@5.3.0`, `cc-plan@3.10.2`, `cc-do@1.7.2`, `cc-check@1.12.2`, `cc-act@1.9.1`
7
+ - Bound skills: `cc-roadmap@5.3.1`, `cc-plan@3.10.7`, `cc-do@1.7.2`, `cc-check@1.12.2`, `cc-act@1.9.2`
8
8
 
9
9
  This folder shows one minimal but complete `cc-roadmap -> cc-plan -> cc-do -> cc-check -> cc-act` loop.
10
10
 
@@ -3,7 +3,7 @@
3
3
  ## Roadmap Meta
4
4
 
5
5
  - Roadmap version: `roadmap.v1`
6
- - Skill version: `5.3.0`
6
+ - Skill version: `5.3.1`
7
7
  - Status: `active`
8
8
  - Last updated: `2026-04-15`
9
9
  - Owner / decider: `product-owner`
@@ -138,6 +138,7 @@
138
138
 
139
139
  ## Implementation Tracking
140
140
  - Roadmap state source: `roadmap.json`
141
+ - Output language: en
141
142
 
142
143
  <!-- roadmap-tracking:start -->
143
144
  | RM-ID | Item | Stage | Priority | Primary Capability | Secondary Capabilities | Expected Spec Delta | Depends On | Status | REQ | Progress |
@@ -147,7 +148,6 @@
147
148
  | RM-004 | Collaboration analytics follow-up | - | - | - | - | - | - | - | - | - |
148
149
  <!-- roadmap-tracking:end -->
149
150
 
150
-
151
151
  ## Technical Architecture
152
152
 
153
153
  ```mermaid
@@ -4,8 +4,9 @@
4
4
 
5
5
  - Requirement version: `REQ-001.v1`
6
6
  - Design version: `design.v1`
7
- - CC-Plan skill version: `3.10.2`
7
+ - CC-Plan skill version: `3.10.7`
8
8
  - Work branch: `REQ/001-copy-invite-link`
9
+ - Output language: en
9
10
  - Source roadmap item: `RM-001`
10
11
  - Source roadmap version: `roadmap.v1`
11
12
 
@@ -25,6 +26,39 @@
25
26
  - Testing decisions: test through share dialog behavior
26
27
  - Out of scope: invite generation, role controls, analytics, clipboard fallback redesign
27
28
  - AI Leverage Decision Lens: boil-lake; complete the bounded same-dialog copy lake instead of stopping at a happy-path button
29
+ - Product / Creative Discovery:
30
+ - Worth doing: users already have an invite URL but must manually select and copy it.
31
+ - Desired product shape: one click in the existing dialog, then visible copied confirmation.
32
+ - Narrowest wedge: copy the currently visible invite URL only.
33
+ - 10x / better version: richer share workflow with fallback feedback and analytics, deferred outside this requirement.
34
+ - Do-nothing consequence: users keep making copy mistakes in the most common sharing path.
35
+ - Second-Move Review:
36
+ - First good move: add a copy button beside the invite URL.
37
+ - Simpler move: expose only a browser copy action and keep all share-service contracts unchanged.
38
+ - Better architecture: centralize all share actions behind a richer share command model later.
39
+ - Selected move: same-dialog copy action with minimal copied-state confirmation.
40
+ - Rejected tradeoff: no broader share-service redesign in this bounded requirement.
41
+ - ASCII Branch Chain Analysis:
42
+ Language rule: connector tokens stay ASCII; node text follows `Output language: en`.
43
+
44
+ ```text
45
+ Requirement Impact Chain
46
+ REQ: one-click copy for the visible invite URL
47
+ |-- Upstream source: RM-001 + share dialog user story
48
+ |-- Current code path: src/features/share/ShareDialog.tsx
49
+ | |-- caller: share dialog render flow
50
+ | |-- data or state: existing invite URL prop + copied confirmation state
51
+ | `-- deepest affected layer: clipboard boundary in the dialog behavior
52
+ |-- Required change: add copy action without changing share-service contracts
53
+ `-- Verification seam: src/features/share/ShareDialog.test.tsx
54
+
55
+ Business Impact Chain
56
+ OUTCOME: users can share invites without manual text selection
57
+ |-- Direct behavior impact: visible invite URL copies from the dialog
58
+ |-- Downstream impact: tests and PR brief document the bounded copy behavior
59
+ |-- Risk branch: clipboard boundary failure or stale copied-state feedback
60
+ `-- Non-goal branch: invite generation, analytics, and fallback redesign stay out
61
+ ```
28
62
  - Read first:
29
63
  - `design.md`
30
64
  - `src/features/share/ShareDialog.tsx`
@@ -45,8 +79,8 @@
45
79
  ClaudeCode / Codex 执行本计划时,必须把本文件当成任务模板合同,而不是普通 TODO 列表。
46
80
 
47
81
  - Template source: `assets/TASKS_TEMPLATE.md`
48
- - CLI resolver: all workflow commands must run through `.claude/skills/cc-dev/scripts/resolve-cc-devflow.sh` or `.codex/skills/cc-dev/scripts/resolve-cc-devflow.sh`; if it cannot prove `query workflow-context` and `next-change-key`, stop blocked.
49
- - Context first: run resolved CLI `query workflow-context --change <changeId> --change-key <changeKey> --cwd <repo-root> --data-only --no-trace --compact` before opening deep sections.
82
+ - CLI resolver: all workflow commands must run through `.claude/skills/cc-dev/scripts/resolve-cc-devflow.sh` or `.codex/skills/cc-dev/scripts/resolve-cc-devflow.sh`; if it cannot prove `next-change-key`, stop blocked.
83
+ - Context first: read this `task.md`, current Git status/history, and PR or handoff truth when present before opening deep sections.
50
84
  - Task selection: use `scripts/select-ready-tasks.sh --tasks devflow/changes/<change-key>/task.md`.
51
85
  - Task block rule: read the full task block before coding; title-only execution is invalid.
52
86
  - Completion rule: after verification and review gates pass, run `scripts/mark-task-complete.sh --tasks devflow/changes/<change-key>/task.md --task <task-id>`.
@@ -57,8 +91,8 @@ DEVFLOW=".claude/skills/cc-dev/scripts/resolve-cc-devflow.sh"
57
91
  if [[ ! -f "$DEVFLOW" && -f ".codex/skills/cc-dev/scripts/resolve-cc-devflow.sh" ]]; then
58
92
  DEVFLOW=".codex/skills/cc-dev/scripts/resolve-cc-devflow.sh"
59
93
  fi
60
- bash "$DEVFLOW" require query workflow-context next-change-key
61
- bash "$DEVFLOW" query workflow-context --change <changeId> --change-key <changeKey> --cwd <repo-root> --data-only --no-trace --compactSCRIPT_ROOT=".claude/skills/cc-do/scripts"
94
+ bash "$DEVFLOW" require next-change-key
95
+ SCRIPT_ROOT=".claude/skills/cc-do/scripts"
62
96
  if [[ ! -d "$SCRIPT_ROOT" && -d ".codex/skills/cc-do/scripts" ]]; then
63
97
  SCRIPT_ROOT=".codex/skills/cc-do/scripts"
64
98
  fi
@@ -5,12 +5,17 @@
5
5
  },
6
6
  "meta": {
7
7
  "roadmapVersion": "roadmap.v1",
8
- "skillVersion": "5.3.0",
8
+ "skillVersion": "5.3.1",
9
9
  "status": "active",
10
10
  "lastUpdated": "2026-04-19",
11
11
  "currentFocusStage": "Stage 1"
12
12
  },
13
13
  "context": {
14
+ "projectDirectionMode": "",
15
+ "projectDirectionRationale": "",
16
+ "directionQuestionsSelected": [],
17
+ "directionQuestionsSkipped": [],
18
+ "directionGuardrailsApplied": [],
14
19
  "planningPosture": "",
15
20
  "evidenceMaturity": "",
16
21
  "canonicalTerms": [],
@@ -193,7 +198,7 @@
193
198
  },
194
199
  "backlogMeta": {
195
200
  "roadmapVersion": "roadmap.v1",
196
- "skillVersion": "4.4.1",
201
+ "skillVersion": "5.3.1",
197
202
  "currentFocusStage": "Stage 1"
198
203
  },
199
204
  "dependencyHandoff": {
@@ -4,7 +4,7 @@
4
4
  职责分组
5
5
  入口层: `cli.js` 负责命令分发,`index.js` 提供给测试和内部脚本的稳定聚合入口。
6
6
  基础层: `schemas.js`、`store.js`、`paths.js` 管住契约、持久化与路径规则,避免执行层重复造轮子。
7
- 状态层: `artifacts.js`、`lifecycle.js`、`query.js`、`workflow-context.js`、`review.js`、`team-state.js` 维护运行时真相源与只读查询。
7
+ 状态层: `artifacts.js`、`lifecycle.js`、`review.js`、`team-state.js` 维护运行时真相源。
8
8
  规划与交接: `planner.js`、`intent.js`、`delegation.js` 把任务解析、handoff 生成和 team/workspace 委派收口成统一语义。
9
9
  阶段操作: `operations/` 是唯一 stage 入口目录;具体阶段边界见 `operations/CLAUDE.md`。
10
10
  测试布局: `__tests__/` 紧贴模块放置单元、回归与集成测试;顶层 `test/` 不再承载 `skill-runtime` 私有测试。
@@ -133,8 +133,9 @@ describe('cc-devflow cli distribution bootstrap', () => {
133
133
  const doctorResult = runCli(['config', 'doctor', '--cwd', repoRoot], repoRoot);
134
134
 
135
135
  expect(resolveResult.status).toBe(0);
136
- expect(resolveResult.stdout).toContain('CC-DevFlow Output Policy');
136
+ expect(resolveResult.stdout).toContain('CC-DevFlow 输出策略');
137
137
  expect(resolveResult.stdout).toContain('Output language: zh-CN');
138
+ expect(resolveResult.stdout).toContain('标题、正文、占位符、证据说明和 PR/body 草稿必须使用简体中文');
138
139
  expect(resolveResult.stdout).toContain('Trace:');
139
140
  expect(resolveResult.stdout).toContain('project');
140
141
  expect(getResult.status).toBe(0);
@@ -100,8 +100,13 @@ describe('skill-runtime user config', () => {
100
100
  'cli:output.document_language:zh-CN'
101
101
  ]);
102
102
  expect(result.policy).toContain('Output language: zh-CN');
103
- expect(result.policy).toContain('Machine-enforced fields: output.document_language');
104
- expect(result.policy).toContain('Agent advisory preferences');
103
+ expect(result.policy).toContain('## CC-DevFlow 输出策略');
104
+ expect(result.policy).toContain('机器强制字段:output.document_language');
105
+ expect(result.policy).toContain('标题、正文、占位符、证据说明和 PR/body 草稿必须使用简体中文');
106
+ expect(result.policy).toContain('必须在元数据或首屏包含 `Output language: zh-CN`');
107
+ expect(result.policy).toContain('Agent 建议偏好:');
108
+ expect(result.policy).not.toContain('Machine-enforced fields');
109
+ expect(result.policy).not.toContain('Durable Markdown artifacts must include');
105
110
  });
106
111
 
107
112
  test('rejects unsupported language and unknown top-level fields', () => {
@@ -24,6 +24,35 @@ const DEFAULT_CONFIG = {
24
24
  agent_preferences: {}
25
25
  };
26
26
 
27
+ const OUTPUT_POLICY_TEXT = {
28
+ en: {
29
+ title: '## CC-DevFlow Output Policy',
30
+ enforced: 'Machine-enforced fields: output.document_language',
31
+ language: (language) => `- Output language: ${language}`,
32
+ markdown: (language) =>
33
+ `- Durable planning, review, and handoff Markdown must write headings, prose, placeholders, evidence summaries, and PR/body drafts in ${language}.`,
34
+ literals:
35
+ '- Keep code, commands, paths, schema keys, API names, dependency names, and Conventional Commit type/scope literals unchanged.',
36
+ metadata: (language) =>
37
+ `- Durable Markdown artifacts must include \`Output language: ${language}\` in their metadata or first screen.`,
38
+ preferences: 'Agent advisory preferences:',
39
+ none: '- none'
40
+ },
41
+ 'zh-CN': {
42
+ title: '## CC-DevFlow 输出策略',
43
+ enforced: '机器强制字段:output.document_language',
44
+ language: (language) => `- Output language: ${language}`,
45
+ markdown:
46
+ '- 所有 durable planning、review、handoff Markdown 的标题、正文、占位符、证据说明和 PR/body 草稿必须使用简体中文。',
47
+ literals:
48
+ '- 代码、命令、路径、schema key、API 名、依赖名、Conventional Commit 的 type/scope 等机器字面量保持原文。',
49
+ metadata: (language) =>
50
+ `- Durable Markdown artifact 必须在元数据或首屏包含 \`Output language: ${language}\`。`,
51
+ preferences: 'Agent 建议偏好:',
52
+ none: '- 无'
53
+ }
54
+ };
55
+
27
56
  function isPlainObject(value) {
28
57
  return Boolean(value) && typeof value === 'object' && !Array.isArray(value);
29
58
  }
@@ -221,21 +250,24 @@ function formatPreferenceLines(value, prefix = '') {
221
250
 
222
251
  function renderOutputPolicy(config = DEFAULT_CONFIG) {
223
252
  const documentLanguage = config.output?.document_language || DEFAULT_CONFIG.output.document_language;
253
+ const text = OUTPUT_POLICY_TEXT[documentLanguage] || OUTPUT_POLICY_TEXT.en;
224
254
  const lines = [
225
- '## CC-DevFlow Output Policy',
255
+ text.title,
226
256
  '',
227
- 'Machine-enforced fields: output.document_language',
228
- `- Output language: ${documentLanguage}`,
229
- `- Durable Markdown artifacts must include \`Output language: ${documentLanguage}\` in their metadata or first screen.`,
257
+ text.enforced,
258
+ text.language(documentLanguage),
259
+ typeof text.markdown === 'function' ? text.markdown(documentLanguage) : text.markdown,
260
+ text.literals,
261
+ text.metadata(documentLanguage),
230
262
  '',
231
- 'Agent advisory preferences:'
263
+ text.preferences
232
264
  ];
233
265
 
234
266
  const preferences = config.agent_preferences || {};
235
267
  const preferenceLines = formatPreferenceLines(preferences);
236
268
 
237
269
  if (preferenceLines.length === 0) {
238
- lines.push('- none');
270
+ lines.push(text.none);
239
271
  } else {
240
272
  lines.push(...preferenceLines);
241
273
  }
@@ -1,25 +1,17 @@
1
1
  /**
2
2
  * [INPUT]: 依赖 skill runtime 基础模块。
3
- * [OUTPUT]: 统一导出 config/path/store/query helpers。
3
+ * [OUTPUT]: 统一导出 config/path/store helpers。
4
4
  * [POS]: skill runtime 模块聚合出口,只保留 CLI 仍需的轻量能力。
5
5
  * [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
6
6
  */
7
7
 
8
8
  const store = require('./store');
9
- const query = require('./query');
10
- const queryRegistry = require('./query-registry');
11
- const errors = require('./errors');
12
- const trace = require('./trace');
13
9
  const paths = require('./paths');
14
10
  const config = require('./config');
15
11
  const archiveChange = require('./archive-change');
16
12
 
17
13
  module.exports = {
18
14
  ...store,
19
- ...query,
20
- ...queryRegistry,
21
- ...errors,
22
- ...trace,
23
15
  ...paths,
24
16
  ...config,
25
17
  ...archiveChange
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cc-devflow",
3
- "version": "4.5.14",
3
+ "version": "4.5.16",
4
4
  "description": "Multi-platform CLI and skill pack for agent coding",
5
5
  "main": "bin/cc-devflow.js",
6
6
  "bin": {
@@ -1,39 +0,0 @@
1
- /**
2
- * [INPUT]: 接收 runtime/query/compiler 边界抛出的错误或失败字段。
3
- * [OUTPUT]: 生成可序列化 named error,保留 refs 与 rescue action。
4
- * [POS]: skill runtime 的失败语义层,避免用 null/false/string 表达可恢复失败。
5
- * [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
6
- */
7
-
8
- class SkillRuntimeError extends Error {
9
- constructor(name, message, options = {}) {
10
- super(message);
11
- this.name = name;
12
- this.artifactRefs = options.artifactRefs || [];
13
- this.rescueAction = options.rescueAction || 'inspect-task-md-and-git-history';
14
- this.details = options.details || {};
15
- }
16
- }
17
-
18
- function namedError(name, message, options = {}) {
19
- return new SkillRuntimeError(name, message, options);
20
- }
21
-
22
- function serializeError(error, fallbackName = 'SkillRuntimeError') {
23
- const name = error?.name || fallbackName;
24
- const message = error?.message || String(error || 'Unknown runtime error');
25
-
26
- return {
27
- name,
28
- message,
29
- artifactRefs: error?.artifactRefs || [],
30
- rescueAction: error?.rescueAction || 'inspect-task-md-and-git-history',
31
- details: error?.details || {}
32
- };
33
- }
34
-
35
- module.exports = {
36
- SkillRuntimeError,
37
- namedError,
38
- serializeError
39
- };
@@ -1,101 +0,0 @@
1
- /**
2
- * [INPUT]: 接收 query id、repoRoot/changeId 与只读 handler registry。
3
- * [OUTPUT]: 返回 typed query result:ok/data 或 named error,并附 trace。
4
- * [POS]: skill runtime 的查询分发表,只读派生 task.md 与 Git 语义。
5
- * [PROTOCOL]: 变更时更新此头部,然后检查 CLAUDE.md
6
- */
7
-
8
- const fs = require('fs');
9
-
10
- const { namedError, serializeError } = require('./errors');
11
- const { createTrace } = require('./trace');
12
-
13
- function resolveArtifactRefs(entry, context, key) {
14
- const refs = entry[key];
15
- return typeof refs === 'function' ? refs(context) : refs || [];
16
- }
17
-
18
- function createQueryRegistry(entries) {
19
- const registry = new Map(entries.map((entry) => [entry.id, entry]));
20
-
21
- function listQueryIds() {
22
- return [...registry.keys()].sort();
23
- }
24
-
25
- async function runQuery(queryId, context = {}) {
26
- const entry = registry.get(queryId);
27
-
28
- if (!entry) {
29
- const supported = listQueryIds();
30
- const error = namedError(
31
- 'UnknownQueryError',
32
- `Unknown query id: ${queryId}`,
33
- {
34
- rescueAction: `use one of: ${supported.join(', ')}`,
35
- details: { supported }
36
- }
37
- );
38
-
39
- return {
40
- ok: false,
41
- queryId,
42
- error: serializeError(error),
43
- trace: createTrace({
44
- event: 'query.unknown',
45
- changeId: context.changeId,
46
- nextAction: 'choose-supported-query'
47
- })
48
- };
49
- }
50
-
51
- let artifactRefs = [];
52
- try {
53
- artifactRefs = resolveArtifactRefs(entry, context, 'artifactRefs');
54
- const requiredArtifactRefs = resolveArtifactRefs(entry, context, 'requiredArtifactRefs');
55
- const missingRefs = requiredArtifactRefs.filter((ref) => !fs.existsSync(ref));
56
- if (missingRefs.length > 0) {
57
- throw namedError(
58
- 'MissingQueryArtifactError',
59
- `Missing required query artifact: ${missingRefs.join(', ')}`,
60
- {
61
- artifactRefs: missingRefs,
62
- rescueAction: 'create task.md before running this query'
63
- }
64
- );
65
- }
66
-
67
- return {
68
- ok: true,
69
- queryId,
70
- data: await entry.handler(context),
71
- trace: createTrace({
72
- event: `query.${queryId}`,
73
- changeId: context.changeId,
74
- artifactRefs,
75
- nextAction: entry.nextAction || 'read-query-result'
76
- })
77
- };
78
- } catch (error) {
79
- return {
80
- ok: false,
81
- queryId,
82
- error: serializeError(error),
83
- trace: createTrace({
84
- event: `query.${queryId}.failed`,
85
- changeId: context.changeId,
86
- artifactRefs,
87
- nextAction: error.rescueAction || 'inspect-task-md-and-git-history'
88
- })
89
- };
90
- }
91
- }
92
-
93
- return {
94
- listQueryIds,
95
- runQuery
96
- };
97
- }
98
-
99
- module.exports = {
100
- createQueryRegistry
101
- };