@fantasticit/sumi 0.14.7 → 0.14.9

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 (162) hide show
  1. package/dist/adapters.d.ts +0 -9
  2. package/dist/adapters.js +52 -75
  3. package/dist/adapters.js.map +1 -1
  4. package/dist/agents.js +1 -3
  5. package/dist/agents.js.map +1 -1
  6. package/dist/bin.js +0 -0
  7. package/dist/declared-hooks.d.ts +1 -3
  8. package/dist/declared-hooks.js +0 -11
  9. package/dist/declared-hooks.js.map +1 -1
  10. package/dist/hub/board.d.ts +5 -2
  11. package/dist/hub/board.js +65 -36
  12. package/dist/hub/board.js.map +1 -1
  13. package/dist/hub/commands.js +1 -1
  14. package/dist/hub/commands.js.map +1 -1
  15. package/dist/hub/pages.js +4 -2
  16. package/dist/hub/pages.js.map +1 -1
  17. package/dist/hub/server.js +1 -0
  18. package/dist/hub/server.js.map +1 -1
  19. package/dist/hub/snapshot.d.ts +2 -2
  20. package/dist/hub/snapshot.js +153 -71
  21. package/dist/hub/snapshot.js.map +1 -1
  22. package/dist/instructions.js +1 -1
  23. package/dist/launcher.cjs +2 -0
  24. package/dist/visualize-sessions.d.ts +2 -0
  25. package/dist/visualize-sessions.js +8 -0
  26. package/dist/visualize-sessions.js.map +1 -1
  27. package/node_modules/@sumi/create/dist/index.d.ts +1 -0
  28. package/node_modules/@sumi/create/dist/index.js +1 -0
  29. package/node_modules/@sumi/create/dist/index.js.map +1 -1
  30. package/node_modules/@sumi/create/dist/scaffold.js +5 -0
  31. package/node_modules/@sumi/create/dist/scaffold.js.map +1 -1
  32. package/node_modules/@sumi/create/dist/testing-rules.d.ts +6 -0
  33. package/node_modules/@sumi/create/dist/testing-rules.js +20 -0
  34. package/node_modules/@sumi/create/dist/testing-rules.js.map +1 -0
  35. package/node_modules/@sumi/create/package.json +2 -2
  36. package/node_modules/@sumi/create/template/control/rules/boundaries.md +1 -1
  37. package/node_modules/@sumi/create/template/control/rules/core-modules.json +0 -1
  38. package/node_modules/@sumi/create/template/control/rules/development.md +1 -1
  39. package/node_modules/@sumi/kernel/dist/brief.d.ts +3 -1
  40. package/node_modules/@sumi/kernel/dist/brief.js +14 -1
  41. package/node_modules/@sumi/kernel/dist/brief.js.map +1 -1
  42. package/node_modules/@sumi/kernel/dist/engine.js +28 -1
  43. package/node_modules/@sumi/kernel/dist/engine.js.map +1 -1
  44. package/node_modules/@sumi/kernel/dist/finding-disposition.d.ts +10 -0
  45. package/node_modules/@sumi/kernel/dist/finding-disposition.js +73 -0
  46. package/node_modules/@sumi/kernel/dist/finding-disposition.js.map +1 -0
  47. package/node_modules/@sumi/kernel/dist/record.d.ts +7 -2
  48. package/node_modules/@sumi/kernel/dist/record.js +29 -13
  49. package/node_modules/@sumi/kernel/dist/record.js.map +1 -1
  50. package/node_modules/@sumi/kernel/dist/runner.js +1 -1
  51. package/node_modules/@sumi/kernel/dist/runner.js.map +1 -1
  52. package/node_modules/@sumi/kernel/dist/step.d.ts +2 -0
  53. package/node_modules/@sumi/kernel/dist/step.js +20 -0
  54. package/node_modules/@sumi/kernel/dist/step.js.map +1 -1
  55. package/node_modules/@sumi/kernel/package.json +2 -2
  56. package/node_modules/@sumi/plugin-sdk/dist/env.d.ts +1 -5
  57. package/node_modules/@sumi/plugin-sdk/dist/env.js +2 -5
  58. package/node_modules/@sumi/plugin-sdk/dist/env.js.map +1 -1
  59. package/node_modules/@sumi/plugin-sdk/dist/html-page.d.ts +2 -10
  60. package/node_modules/@sumi/plugin-sdk/dist/html-page.js +5 -14
  61. package/node_modules/@sumi/plugin-sdk/dist/html-page.js.map +1 -1
  62. package/node_modules/@sumi/plugin-sdk/dist/hub.d.ts +8 -2
  63. package/node_modules/@sumi/plugin-sdk/dist/hub.js +3 -0
  64. package/node_modules/@sumi/plugin-sdk/dist/hub.js.map +1 -1
  65. package/node_modules/@sumi/plugin-sdk/dist/project.d.ts +6 -1
  66. package/node_modules/@sumi/plugin-sdk/dist/project.js +6 -1
  67. package/node_modules/@sumi/plugin-sdk/dist/project.js.map +1 -1
  68. package/node_modules/@sumi/plugin-sdk/dist/protocol.d.ts +19 -10
  69. package/node_modules/@sumi/plugin-sdk/dist/protocol.js.map +1 -1
  70. package/node_modules/@sumi/plugin-sdk/dist/session-env.d.ts +5 -0
  71. package/node_modules/@sumi/plugin-sdk/dist/session-env.js +5 -0
  72. package/node_modules/@sumi/plugin-sdk/dist/session-env.js.map +1 -1
  73. package/node_modules/@sumi/plugin-sdk/dist/validate.d.ts +1 -0
  74. package/node_modules/@sumi/plugin-sdk/dist/validate.js +1 -16
  75. package/node_modules/@sumi/plugin-sdk/dist/validate.js.map +1 -1
  76. package/node_modules/@sumi/plugin-sdk/package.json +1 -1
  77. package/node_modules/@sumi/plugins-core/dist/context-provider.js +8 -3
  78. package/node_modules/@sumi/plugins-core/dist/context-provider.js.map +1 -1
  79. package/node_modules/@sumi/plugins-core/dist/dependency-impact.d.ts +14 -1
  80. package/node_modules/@sumi/plugins-core/dist/dependency-impact.js +28 -8
  81. package/node_modules/@sumi/plugins-core/dist/dependency-impact.js.map +1 -1
  82. package/node_modules/@sumi/plugins-core/dist/lock-fixture.d.ts +1 -0
  83. package/node_modules/@sumi/plugins-core/dist/lock-fixture.js +90 -0
  84. package/node_modules/@sumi/plugins-core/dist/lock-fixture.js.map +1 -0
  85. package/node_modules/@sumi/plugins-core/dist/plugins/test-affected.js +30 -12
  86. package/node_modules/@sumi/plugins-core/dist/plugins/test-affected.js.map +1 -1
  87. package/node_modules/@sumi/plugins-core/dist/test-scope.js +9 -2
  88. package/node_modules/@sumi/plugins-core/dist/test-scope.js.map +1 -1
  89. package/node_modules/@sumi/plugins-core/dist/testing-rules-upgrade.d.ts +0 -5
  90. package/node_modules/@sumi/plugins-core/dist/testing-rules-upgrade.js +1 -17
  91. package/node_modules/@sumi/plugins-core/dist/testing-rules-upgrade.js.map +1 -1
  92. package/node_modules/@sumi/plugins-core/dist/workspace-dependency.d.ts +44 -0
  93. package/node_modules/@sumi/plugins-core/dist/workspace-dependency.js +180 -0
  94. package/node_modules/@sumi/plugins-core/dist/workspace-dependency.js.map +1 -0
  95. package/node_modules/@sumi/plugins-core/instructions/bugfix.md +1 -1
  96. package/node_modules/@sumi/plugins-core/instructions/feature.md +1 -1
  97. package/node_modules/@sumi/plugins-core/package.json +3 -3
  98. package/node_modules/@sumi/plugins-governance/dist/base-failures.d.ts +7 -0
  99. package/node_modules/@sumi/plugins-governance/dist/base-failures.js +197 -0
  100. package/node_modules/@sumi/plugins-governance/dist/base-failures.js.map +1 -0
  101. package/node_modules/@sumi/plugins-governance/dist/boundary-hooks.d.ts +1 -1
  102. package/node_modules/@sumi/plugins-governance/dist/boundary-hooks.js +1 -1
  103. package/node_modules/@sumi/plugins-governance/dist/boundary-hooks.js.map +1 -1
  104. package/node_modules/@sumi/plugins-governance/dist/boundary.d.ts +0 -23
  105. package/node_modules/@sumi/plugins-governance/dist/boundary.js +68 -158
  106. package/node_modules/@sumi/plugins-governance/dist/boundary.js.map +1 -1
  107. package/node_modules/@sumi/plugins-governance/dist/checkout.d.ts +12 -1
  108. package/node_modules/@sumi/plugins-governance/dist/checkout.js +28 -17
  109. package/node_modules/@sumi/plugins-governance/dist/checkout.js.map +1 -1
  110. package/node_modules/@sumi/plugins-governance/dist/commands/base-finding-disposition.d.ts +1 -0
  111. package/node_modules/@sumi/plugins-governance/dist/commands/base-finding-disposition.js +5 -0
  112. package/node_modules/@sumi/plugins-governance/dist/commands/base-finding-disposition.js.map +1 -0
  113. package/node_modules/@sumi/plugins-governance/dist/commands/boundary.js +34 -80
  114. package/node_modules/@sumi/plugins-governance/dist/commands/boundary.js.map +1 -1
  115. package/node_modules/@sumi/plugins-governance/dist/commands/record-base.d.ts +1 -0
  116. package/node_modules/@sumi/plugins-governance/dist/commands/record-base.js +26 -0
  117. package/node_modules/@sumi/plugins-governance/dist/commands/record-base.js.map +1 -0
  118. package/node_modules/@sumi/plugins-governance/dist/commands/view.js +4 -16
  119. package/node_modules/@sumi/plugins-governance/dist/commands/view.js.map +1 -1
  120. package/node_modules/@sumi/plugins-governance/dist/hub-snapshot.d.ts +2 -0
  121. package/node_modules/@sumi/plugins-governance/dist/hub-snapshot.js +12 -3
  122. package/node_modules/@sumi/plugins-governance/dist/hub-snapshot.js.map +1 -1
  123. package/node_modules/@sumi/plugins-governance/dist/pr-report-sections.d.ts +3 -0
  124. package/node_modules/@sumi/plugins-governance/dist/pr-report-sections.js +23 -12
  125. package/node_modules/@sumi/plugins-governance/dist/pr-report-sections.js.map +1 -1
  126. package/node_modules/@sumi/plugins-governance/dist/view-page.d.ts +0 -3
  127. package/node_modules/@sumi/plugins-governance/dist/view-page.js +0 -29
  128. package/node_modules/@sumi/plugins-governance/dist/view-page.js.map +1 -1
  129. package/node_modules/@sumi/plugins-governance/instructions/boundary.md +18 -22
  130. package/node_modules/@sumi/plugins-governance/package.json +4 -4
  131. package/node_modules/@sumi/plugins-governance/sumi-plugins.yaml +9 -4
  132. package/node_modules/@sumi/plugins-openspec/dist/hub-snapshot.js +6 -3
  133. package/node_modules/@sumi/plugins-openspec/dist/hub-snapshot.js.map +1 -1
  134. package/node_modules/@sumi/plugins-openspec/package.json +6 -6
  135. package/node_modules/@sumi/plugins-precedent/package.json +3 -3
  136. package/node_modules/@sumi/plugins-review/dist/commands/hub-snapshot.d.ts +1 -0
  137. package/node_modules/@sumi/plugins-review/dist/commands/hub-snapshot.js +4 -0
  138. package/node_modules/@sumi/plugins-review/dist/commands/hub-snapshot.js.map +1 -0
  139. package/node_modules/@sumi/plugins-review/dist/hub-snapshot.d.ts +2 -0
  140. package/node_modules/@sumi/plugins-review/dist/hub-snapshot.js +10 -0
  141. package/node_modules/@sumi/plugins-review/dist/hub-snapshot.js.map +1 -0
  142. package/node_modules/@sumi/plugins-review/dist/review.d.ts +4 -2
  143. package/node_modules/@sumi/plugins-review/dist/review.js +14 -6
  144. package/node_modules/@sumi/plugins-review/dist/review.js.map +1 -1
  145. package/node_modules/@sumi/plugins-review/package.json +6 -6
  146. package/node_modules/@sumi/plugins-review/sumi-plugins.yaml +6 -0
  147. package/package.json +10 -10
  148. package/dist/mcp-hosts.d.ts +0 -25
  149. package/dist/mcp-hosts.js +0 -64
  150. package/dist/mcp-hosts.js.map +0 -1
  151. package/node_modules/@sumi/plugins-governance/dist/boundary-answer-page.d.ts +0 -3
  152. package/node_modules/@sumi/plugins-governance/dist/boundary-answer-page.js +0 -76
  153. package/node_modules/@sumi/plugins-governance/dist/boundary-answer-page.js.map +0 -1
  154. package/node_modules/@sumi/plugins-governance/dist/boundary-browser.d.ts +0 -6
  155. package/node_modules/@sumi/plugins-governance/dist/boundary-browser.js +0 -128
  156. package/node_modules/@sumi/plugins-governance/dist/boundary-browser.js.map +0 -1
  157. package/node_modules/@sumi/plugins-governance/dist/boundary-form.d.ts +0 -18
  158. package/node_modules/@sumi/plugins-governance/dist/boundary-form.js +0 -97
  159. package/node_modules/@sumi/plugins-governance/dist/boundary-form.js.map +0 -1
  160. package/node_modules/@sumi/plugins-governance/dist/boundary-mcp.d.ts +0 -1
  161. package/node_modules/@sumi/plugins-governance/dist/boundary-mcp.js +0 -231
  162. package/node_modules/@sumi/plugins-governance/dist/boundary-mcp.js.map +0 -1
@@ -0,0 +1,197 @@
1
+ import { createHash } from 'node:crypto';
2
+ import { mkdirSync, readFileSync } from 'node:fs';
3
+ import { dirname, join } from 'node:path';
4
+ import { createStepContext, execute, fingerprint, listFiles, loadConfig, loadFlow, loadRegistry, readRecords, resolveBase, runsRoot, sourceDigest, stepConfigDigest, stepScope, verifiedRunSource, } from '@sumi/kernel';
5
+ import { gitOutput, gitPaths, writeFileAtomic } from '@sumi/plugin-sdk';
6
+ import { createGateWorktree, prepareGateWorktree, removeGateWorktree } from './checkout.js';
7
+ import { configAt, configBrokenAt, defaultBranch, DEFAULT_GATE_FLOW } from './protected.js';
8
+ import { stateDir } from './state.js';
9
+ const PREPARE_TIMEOUT_MS = 600_000;
10
+ const ISSUE_COMMAND = 'gh issue create --title "修复主干存量失败" --body "请处理检查报告中列出的主干存量失败。"';
11
+ const objectId = /^(?:[a-f0-9]{40}|[a-f0-9]{64})$/;
12
+ const digest = /^[a-f0-9]{64}$/;
13
+ const fingerprintPattern = /^[a-f0-9]{40}$/;
14
+ const stepName = /^[\p{L}\p{N}_.:/-]+$/u;
15
+ function recordingBase(root) {
16
+ const branch = defaultBranch(root);
17
+ const remote = `refs/remotes/origin/${branch}`;
18
+ const local = `refs/heads/${branch}`;
19
+ try {
20
+ const refs = gitOutput(root, ['for-each-ref', '--format=%(refname)', remote, local]).split('\n');
21
+ if (refs.includes(remote))
22
+ return gitOutput(root, ['merge-base', 'HEAD', remote]).trim();
23
+ if (refs.includes(local))
24
+ return gitOutput(root, ['merge-base', 'HEAD', local]).trim();
25
+ }
26
+ catch {
27
+ return null;
28
+ }
29
+ return null;
30
+ }
31
+ function isReview(step) {
32
+ return [step.id, step.use, step.base].some((id) => id?.startsWith('review/'));
33
+ }
34
+ function failureScope(errorFiles) {
35
+ const files = new Set();
36
+ for (const file of errorFiles) {
37
+ if (!file)
38
+ return null;
39
+ files.add(file);
40
+ }
41
+ return [...files].sort();
42
+ }
43
+ function recordPath(root, base, step, files) {
44
+ const project = gitOutput(root, ['rev-parse', '--show-prefix']).trim();
45
+ const key = createHash('sha256')
46
+ .update(JSON.stringify([project, step.id, step.configDigest, files]))
47
+ .digest('hex');
48
+ return join(stateDir(root), 'base-failures', base, `${key}.json`);
49
+ }
50
+ function readFingerprints(path) {
51
+ try {
52
+ const data = JSON.parse(readFileSync(path, 'utf8'));
53
+ return Array.isArray(data) && data.every((item) => typeof item === 'string' && fingerprintPattern.test(item)) ? data : null;
54
+ }
55
+ catch {
56
+ return null;
57
+ }
58
+ }
59
+ export function baseFindingDisposition(root, input) {
60
+ const { flow, step } = input;
61
+ if (isReview(step))
62
+ return { fingerprints: [] };
63
+ const base = recordingBase(root);
64
+ if (!base || !objectId.test(base) || !digest.test(step.configDigest))
65
+ return { fingerprints: [] };
66
+ const stored = readFingerprints(recordPath(root, base, step, failureScope(input.errorFiles)));
67
+ if (!stored) {
68
+ if (!stepName.test(flow) || !stepName.test(step.id))
69
+ return { fingerprints: [] };
70
+ return {
71
+ fingerprints: [],
72
+ next: [
73
+ {
74
+ type: 'run',
75
+ argv: ['sumi', 'record-base', '--base', base, '--flow', flow, '--', step.id],
76
+ effects: ['writes-control'],
77
+ why: '缺少当前失败范围的基准记录。用工作区同范围的检查结果记录后重跑',
78
+ },
79
+ ],
80
+ };
81
+ }
82
+ const known = new Set(stored);
83
+ const fingerprints = input.fingerprints.filter((item) => known.has(item));
84
+ return fingerprints.length
85
+ ? { fingerprints, summary: `${fingerprints.length} 条主干存量失败,未阻断`, followUpCommand: ISSUE_COMMAND }
86
+ : { fingerprints };
87
+ }
88
+ export async function recordBaseFailures(root, options, log) {
89
+ const config = loadConfig(root);
90
+ const registry = loadRegistry(root, config);
91
+ const latest = readRecords(root).findLast((run) => run.mode === 'worktree' && (!options.flow || run.flow === options.flow));
92
+ const latestSteps = new Map(latest?.steps.map((step) => [step.id, step]));
93
+ const flowId = options.flow ?? latest?.flow ?? configAt(root, null)?.gate?.flow ?? DEFAULT_GATE_FLOW;
94
+ const ids = new Set(options.steps.length
95
+ ? options.steps
96
+ : (latest?.steps ?? [])
97
+ .filter((step) => step.required && step.state === 'fail' && !isReview(step) && step.findings.some((finding) => finding.severity === 'error'))
98
+ .map((step) => step.id));
99
+ if (!ids.size)
100
+ return log('最近一次运行没有可记录的失败检查。');
101
+ const base = options.base ? resolveBase(root, config, options.base).oid : recordingBase(root);
102
+ if (!base)
103
+ throw new Error('无法确定与默认分支的合并基础。可用 `--base` 指定要记录的提交。');
104
+ const flow = loadFlow(root, config, registry, flowId);
105
+ const steps = new Map(flow.steps.map((step) => [step.id, step]));
106
+ if (latest?.flow === flowId && [...ids].some((id) => !steps.has(id))) {
107
+ verifiedRunSource(root, latest.runId);
108
+ const plan = JSON.parse(readFileSync(join(runsRoot(root), latest.runId, 'plan.json'), 'utf8'));
109
+ for (const step of plan.steps)
110
+ if (!steps.has(step.id))
111
+ steps.set(step.id, step);
112
+ }
113
+ const missing = [...ids].flatMap((id) => {
114
+ const step = steps.get(id);
115
+ const plugin = step && registry.plugins.get(step.use);
116
+ if (!step || !plugin || plugin.decl.kind !== 'check' || isReview({ ...step, base: plugin.decl.base })) {
117
+ throw new Error(`步骤 ${id} 无法记录主干存量失败。`);
118
+ }
119
+ const previous = latestSteps.get(id);
120
+ const errorFiles = [...(previous?.findings ?? []), ...(previous?.followUps ?? [])]
121
+ .filter((finding) => finding.severity === 'error')
122
+ .map((finding) => finding.file ?? null);
123
+ if (!errorFiles.length)
124
+ throw new Error(`最近一次工作区运行没有步骤 ${id} 的错误明细,请先在工作区运行 ${flowId}。`);
125
+ const files = failureScope(errorFiles);
126
+ const path = recordPath(root, base, { ...step, configDigest: stepConfigDigest(step, plugin.decl, config, registry.pathHints) }, files);
127
+ return readFingerprints(path) ? [] : [{ step, plugin, path, files }];
128
+ });
129
+ if (!missing.length)
130
+ return log(`基准 ${base.slice(0, 12)} 的 ${ids.size} 个步骤已有记录。`);
131
+ const baseConfig = configAt(root, base);
132
+ if (!baseConfig && configBrokenAt(root, base))
133
+ throw new Error(`基准 ${base.slice(0, 12)} 的项目配置无法解析。`);
134
+ const gate = baseConfig?.gate ?? {};
135
+ const wt = createGateWorktree(root, base);
136
+ const recorded = new Map();
137
+ let removed;
138
+ try {
139
+ const { project, problem } = prepareGateWorktree(root, wt, gate, log, PREPARE_TIMEOUT_MS);
140
+ if (problem)
141
+ throw new Error(problem);
142
+ const checkoutRegistry = loadRegistry(project, config);
143
+ const baseFiles = new Set(gitPaths(project, ['ls-files']));
144
+ const allFiles = missing.some(({ files }) => files === null) ? listFiles(project) : [];
145
+ const start = sourceDigest(project);
146
+ for (const { step, plugin, path, files } of missing) {
147
+ const selected = files?.filter((file) => baseFiles.has(file));
148
+ if (selected?.length === 0) {
149
+ recorded.set(path, []);
150
+ continue;
151
+ }
152
+ const checkout = checkoutRegistry.plugins.get(step.use);
153
+ if (!checkout ||
154
+ checkout.decl.kind !== 'check' ||
155
+ checkout.decl.version !== plugin.decl.version ||
156
+ checkout.decl.base !== plugin.decl.base ||
157
+ JSON.stringify(checkout.decl.command) !== JSON.stringify(plugin.decl.command)) {
158
+ throw new Error(`基准检出无法运行同一检查插件:${step.use}`);
159
+ }
160
+ const scope = selected
161
+ ? { files: selected, deleted: [], obligations: [] }
162
+ : stepScope(plugin.decl, { config, files: allFiles, deleted: [], injection: { files: new Set(), obligations: [], forced: false } });
163
+ const ctx = createStepContext({
164
+ root: project,
165
+ config,
166
+ registry,
167
+ base: null,
168
+ mode: 'commit',
169
+ tier: latest?.flow === flowId ? latest.tier : (flow.tier ?? config.tiers[0]),
170
+ all: files === null,
171
+ runDir: join(project, '.sumi', 'base-recording'),
172
+ runId: 'base-recording',
173
+ runPid: process.pid,
174
+ labels: {},
175
+ }, step, scope);
176
+ const exec = await execute({ ...checkout, decl: plugin.decl }, ctx, project);
177
+ if (!exec.result || !['pass', 'fail'].includes(exec.result.status)) {
178
+ throw new Error(`${step.id} 检查无法完成:${exec.reason ?? exec.result?.summary}`);
179
+ }
180
+ if (sourceDigest(project) !== start)
181
+ throw new Error(`${step.id} 改写了基准检出的源码。`);
182
+ const errors = exec.result.findings.filter((finding) => finding.severity === 'error');
183
+ recorded.set(path, [...new Set(errors.map((finding) => fingerprint(step.id, finding)))].sort());
184
+ }
185
+ }
186
+ finally {
187
+ removed = removeGateWorktree(root, wt);
188
+ }
189
+ if (!removed)
190
+ throw new Error(`无法清理基准检出 ${wt}`);
191
+ for (const [path, fingerprints] of recorded) {
192
+ mkdirSync(dirname(path), { recursive: true });
193
+ writeFileAtomic(path, JSON.stringify(fingerprints));
194
+ }
195
+ log(`已记录基准 ${base.slice(0, 12)} 的 ${recorded.size} 个步骤。重新运行检查即可比对。`);
196
+ }
197
+ //# sourceMappingURL=base-failures.js.map
@@ -0,0 +1 @@
1
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AC/E,MAAM,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,QAAQ,KAAK,OAAO,CAAC,CAAC;YACtF,QAAQ,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QAClG,CAAC;IACH,CAAC;YAAS,CAAC;QACT,OAAO,GAAG,kBAAkB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACzC,CAAC;IACD,IAAI,CAAC,OAAO;QAAE,MAAM,IAAI,KAAK,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;IAChD,KAAK,MAAM,CAAC,IAAI,EAAE,YAAY,CAAC,IAAI,QAAQ,EAAE,CAAC;QAC5C,SAAS,CAAC,OAAO,CAAC,IAAI,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QAC9C,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,CAAC;IACtD,CAAC;IACD,GAAG,CAAC,SAAS,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,QAAQ,CAAC,IAAI,kBAAkB,CAAC,CAAC;AACvE,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { type ContextItem, type AfterEditResult } from '@sumi/plugin-sdk';
2
- export declare const BOUNDARY_PROMPT = "\u82E5\u672C\u6B21\u662F\u9700\u6C42\u5F00\u53D1\u6216\u7F3A\u9677\u4FEE\u590D\uFF0C\u5148\u8D77\u8349\u8FB9\u754C\u7EA6\u5B9A\u5E76\u8FD0\u884C `sumi boundary propose`\uFF0C\u5411\u7528\u6237\u786E\u8BA4\u540E\u518D\u6539\u4EE3\u7801";
2
+ export declare const BOUNDARY_PROMPT = "\u82E5\u672C\u6B21\u662F\u9700\u6C42\u5F00\u53D1\u6216\u7F3A\u9677\u4FEE\u590D\uFF0C\u5148\u6309 `sumi instructions boundary` \u5728\u4F1A\u8BDD\u5185\u5411\u7528\u6237\u786E\u8BA4\u5E76\u8BB0\u5F55\u8FB9\u754C\uFF0C\u518D\u6539\u4EE3\u7801\u3002";
3
3
  export declare function boundarySummary(root: string, session: string | undefined, paths?: string[], reserved?: number, items?: ContextItem[]): string;
4
4
  export declare function boundaryPrompt(root: string, raw: string): AfterEditResult | null;
5
5
  export declare function boundaryInjection(root: string, raw: string, paths?: string[], prompt?: boolean): AfterEditResult | null;
@@ -4,7 +4,7 @@ import { configFile, contextScopeCovers, contextSession, editedPaths, payloadWri
4
4
  import { parse } from 'yaml';
5
5
  import { boundaryContext, boundaryDecision, boundaryRecord } from './boundary.js';
6
6
  import { stopMessage } from './human-stop.js';
7
- export const BOUNDARY_PROMPT = '若本次是需求开发或缺陷修复,先起草边界约定并运行 `sumi boundary propose`,向用户确认后再改代码';
7
+ export const BOUNDARY_PROMPT = '若本次是需求开发或缺陷修复,先按 `sumi instructions boundary` 在会话内向用户确认并记录边界,再改代码。';
8
8
  export function boundarySummary(root, session, paths = [], reserved = 0, items = boundaryContext(root, paths, session)) {
9
9
  return renderBoundary(root, items, reserved).text;
10
10
  }
@@ -1 +1 @@
1
- {"version":3,"file":"boundary-hooks.js","sourceRoot":"","sources":["../src/boundary-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EACL,UAAU,EACV,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,kBAAkB,EAClB,iBAAiB,EACjB,eAAe,EACf,oBAAoB,EACpB,iBAAiB,GAGlB,MAAM,kBAAk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AE,MAAM,EAAE,CAAC;IAC9B,MAAM,MAAM,GAAG,iBAAiB,CAAC,IAAI,EAAE,GAAG,EAAE,KAAK,CAAC,CAAC;IACnD,OAAO,MAAM,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,iBAAiB,EAAE,YAAY,EAAE,MAAM,CAAC,YAAY,EAAE,eAAe,EAAE,MAAM,CAAC,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;AACzI,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,IAAY,EAAE,GAAW;IACvD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAkE,CAAC;IAC/F,MAAM,OAAO,GAAG,cAAc,CAAC,KAAK,CAAC,aAAa,IAAI,IAAI,CAAC,CAAC;IAC5D,IAAI,OAAO,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,OAAO,GAAG,KAAK,QAAQ,CAAC;QAC5F,kBAAkB,CAChB,IAAI,EACJ,OAAO,EACP,KAAK,CAAC,IAAI,EACV,SAAS,EACT,KAAK,EACL,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC,CAAC,CAAC,CAAC,EAAE,CAC5E,CAAC;AACN,CAAC"}
@@ -1,20 +1,12 @@
1
1
  import { type ContextItem } from '@sumi/plugin-sdk';
2
2
  export declare const BOUNDARY_HEADINGS: readonly ["支持", "不处理", "可接受的异常", "兼容范围", "人工兜底"];
3
- export interface BoundaryRow {
4
- section: string;
5
- text: string;
6
- suggested: string;
7
- decision: boolean;
8
- }
9
3
  export interface BoundaryRecord {
10
4
  status: 'proposed' | 'confirmed' | 'unconfirmed' | 'skipped';
11
5
  markdown: string;
12
6
  change?: string;
13
7
  reason?: string;
14
8
  at: string;
15
- id?: string;
16
9
  project?: string;
17
- submitted?: string;
18
10
  }
19
11
  /** 与评审的既有关联规则共用:显式 change、唯一进行中 change、改动路径。 */
20
12
  export declare function scopeChanges(root: string, files: string[], change?: string): string[];
@@ -23,30 +15,15 @@ export declare function boundarySources(root: string, changes: string[]): {
23
15
  source: string;
24
16
  text: string;
25
17
  }[];
26
- export declare function parseBoundary(markdown: string): BoundaryRow[];
27
18
  /** 只读该会话自己的边界记录,不回退到 change 的记录。 */
28
19
  export declare function readRecord(root: string, session: string): BoundaryRecord | null;
29
20
  export declare function boundaryRecord(root: string, session?: string | undefined, changes?: string[]): BoundaryRecord | null;
30
21
  export declare function boundaryStatus(root: string, session?: string, changes?: string[]): string;
31
- export declare function proposeBoundary(root: string, session: string, markdown: string, options?: {
32
- change?: string;
33
- noOpen?: boolean;
34
- open?: (path: string) => void;
35
- }): {
36
- id: `${string}-${string}-${string}-${string}-${string}`;
37
- path: string;
38
- guidance: string;
39
- };
40
22
  export declare function confirmBoundary(root: string, session: string, options: {
41
23
  markdown?: string;
42
- defaults?: boolean;
43
24
  unconfirmed?: boolean;
44
25
  change?: string;
45
26
  }): BoundaryRecord;
46
- export declare function boundaryReceipt(record: BoundaryRecord): string;
47
- export declare function boundaryAnswer(root: string, session: string, id: string): BoundaryRecord;
48
- export declare function submitBoundaryAnswer(root: string, session: string, id: string, answers: unknown): BoundaryRecord;
49
- export declare function cancelBoundaryAnswer(root: string, session: string, id: string): void;
50
27
  export declare function skipBoundary(root: string, session: string, reason: string, change?: string): void;
51
28
  export declare function boundaryDecision(root: string, session: string | undefined, paths: string[]): string | null;
52
29
  export declare function boundaryContext(root: string, paths: string[], session?: string | undefined, change?: string): ContextItem[];
@@ -1,10 +1,8 @@
1
- import { createHash, randomUUID } from 'node:crypto';
2
1
  import { existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync } from 'node:fs';
3
2
  import { dirname, join } from 'node:path';
4
3
  import { configFile, envSession, readContextSession, saveContextMetadata, withFileLock, writeFileAtomic, } from '@sumi/plugin-sdk';
5
4
  import { parse } from 'yaml';
6
5
  import picomatch from 'picomatch';
7
- import { boundaryPage, openPage, desktopAvailable } from './view-page.js';
8
6
  import { stateDir } from './state.js';
9
7
  export const BOUNDARY_HEADINGS = ['支持', '不处理', '可接受的异常', '兼容范围', '人工兜底'];
10
8
  const KEY = 'gov/boundary';
@@ -42,33 +40,14 @@ export function boundarySources(root, changes) {
42
40
  }
43
41
  return sources;
44
42
  }
45
- const DEFAULT_ANSWER = /(建议默认[::]\s*)([^;;\n]+)/;
46
- export function parseBoundary(markdown) {
47
- const rows = [];
43
+ function validateBoundary(markdown) {
48
44
  for (const section of BOUNDARY_HEADINGS) {
49
45
  const content = new RegExp(`^### ${section}[ \\t]*\\r?\\n([\\s\\S]*?)(?=^#{1,3} |$(?![\\s\\S]))`, 'm').exec(markdown)?.[1];
50
- if (!content?.trim())
51
- throw new Error(`边界草稿缺少小节:### ${section}`);
52
- const entries = content.split(/\r?\n/).filter((line) => /^\s*[-*] /.test(line));
53
- if (!entries.length)
54
- throw new Error(`${section} 至少需要一个列表条目`);
55
- for (const entry of entries) {
56
- const suggested = DEFAULT_ANSWER.exec(entry)?.[2]?.trim();
57
- const decision = /需拍板[::]\s*(是|否)/.exec(entry)?.[1];
58
- if (!suggested || !decision)
59
- throw new Error(`${section} 每条必须包含“建议默认:…”与“需拍板:是/否”`);
60
- rows.push({
61
- section,
62
- text: entry
63
- .replace(/^\s*[-*] /, '')
64
- .split(/建议默认[::]/)[0]
65
- .trim(),
66
- suggested,
67
- decision: decision === '是',
68
- });
69
- }
46
+ if (content === undefined)
47
+ throw new Error(`边界记录缺少小节:### ${section}`);
48
+ if (!/^\s*[-*] \S/m.test(content))
49
+ throw new Error(`${section} 至少需要一条约定`);
70
50
  }
71
- return rows;
72
51
  }
73
52
  /** 只读该会话自己的边界记录,不回退到 change 的记录。 */
74
53
  export function readRecord(root, session) {
@@ -120,62 +99,29 @@ export function boundaryStatus(root, session, changes) {
120
99
  return `边界约定:已跳过(${record.reason})`;
121
100
  return '边界约定未经用户确认';
122
101
  }
123
- export function proposeBoundary(root, session, markdown, options = {}) {
124
- const rows = parseBoundary(markdown);
102
+ export function confirmBoundary(root, session, options) {
125
103
  const associated = readContextSession(root, session)?.metadata?.['gov/change'];
126
104
  const change = options.change ?? (typeof associated === 'string' ? associated : scopeChanges(root, [])[0]);
127
- if (change)
128
- scopeChanges(root, [], change);
129
- const id = randomUUID();
130
- boundaryWrite(root, () => save(root, session, {
131
- id,
132
- project: realpathSync(root),
133
- status: 'proposed',
105
+ const { markdown } = options;
106
+ if (markdown === undefined)
107
+ throw new Error('请提供五节边界记录文件');
108
+ return boundaryWrite(root, () => persistConfirmation(root, session, {
109
+ status: options.unconfirmed ? 'unconfirmed' : 'confirmed',
134
110
  markdown,
135
111
  ...(change ? { change } : {}),
112
+ project: realpathSync(root),
136
113
  at: new Date().toISOString(),
137
114
  }));
138
- const path = boundaryPage(root, change ?? session, markdown, '边界约定未经用户确认');
139
- if (!options.noOpen && (options.open || desktopAvailable())) {
140
- try {
141
- (options.open ?? openPage)(path);
142
- }
143
- catch {
144
- /* 页面已生成,打开失败只保留路径。 */
145
- }
146
- }
147
- const questions = rows
148
- .filter((row) => row.decision)
149
- .map((row) => `- ${row.section}:${row.text} 建议默认:${row.suggested}`)
150
- .join('\n');
151
- return {
152
- id,
153
- path,
154
- guidance: `边界确认页:${path}\n将以下需拍板条目一次性交给宿主提问工具向用户提问(没有工具时直接在对话提问),附页面路径;用户可回复“按建议”或逐条修改,也可在页面上逐条选择后复制答复粘贴回对话:\n${questions || '无额外需拍板条目,说明沿用常设边界。'}\n回答后运行 sumi boundary confirm <答案文件> 或 --defaults(用户粘贴的“边界确认答复”即五节答案原文,存为答案文件);非交互运行使用 --unconfirmed,不等待审批。`,
155
- };
156
- }
157
- export function confirmBoundary(root, session, options) {
158
- return boundaryWrite(root, () => {
159
- const changes = options.change ? scopeChanges(root, [], options.change) : undefined;
160
- const prior = boundaryRecord(root, session, changes);
161
- if (!prior)
162
- throw new Error('先运行 sumi boundary propose <草稿文件>');
163
- if (!options.markdown && !options.defaults && !options.unconfirmed)
164
- throw new Error('提供答案文件或 --defaults / --unconfirmed');
165
- const markdown = options.markdown ?? prior.markdown;
166
- return persistConfirmation(root, session, {
167
- status: options.unconfirmed ? 'unconfirmed' : 'confirmed',
168
- markdown,
169
- change: options.change ?? prior.change,
170
- project: realpathSync(root),
171
- at: new Date().toISOString(),
172
- });
173
- });
174
115
  }
175
116
  const CONFIRMED_HEADER = /^确认:用户[^\n]*$/m;
176
- const entryText = (line) => line.replace(/^\s*[-*] /, '').trim();
117
+ /** 以条目正文为键,兼容旧记录的“建议默认”字段。 */
118
+ function entryKey(line) {
119
+ const entry = /^\s*[-*] (\S.*)/.exec(line)?.[1];
120
+ return entry?.split(/(?:结论|建议默认|来源)[::]/, 1)[0]?.trim() || undefined;
121
+ }
177
122
  /**
178
- * 已确认的支持范围按小节合并:保留原有条目与说明,只追加新答案中原来没有的条目。
123
+ * 已确认的支持范围按小节与条目正文合并:用户确认时,同一条目改判就替换原答案,新条目追加;
124
+ * 未经用户确认的写入只追加新条目,不覆盖已确认的答案。原有说明文字保留。
179
125
  * 原节未经用户确认(或是旧式自由文本)时属于临时内容,整节替换。
180
126
  */
181
127
  function mergedSupport(existing, markdown, confirmation) {
@@ -183,31 +129,57 @@ function mergedSupport(existing, markdown, confirmation) {
183
129
  const header = existing?.match(CONFIRMED_HEADER)?.[0];
184
130
  if (!existing || !header || !/^### /m.test(existing))
185
131
  return fresh;
132
+ const confirmed = confirmation.startsWith('用户,');
186
133
  let merged = existing;
187
- let added = false;
134
+ let changed = false;
135
+ let revised = false;
188
136
  for (const heading of BOUNDARY_HEADINGS) {
189
137
  const block = (text) => new RegExp(`^### ${heading}[ \\t]*\\r?\\n([\\s\\S]*?)(?=^#{1,3} |$(?![\\s\\S]))`, 'm').exec(text);
190
- const entries = (block(markdown)?.[1] ?? '').split(/\r?\n/).filter((line) => /^\s*[-*] /.test(line));
138
+ // 同一答案里重复的条目以最后一次为准
139
+ const answers = new Map();
140
+ for (const line of (block(markdown)?.[1] ?? '').split(/\r?\n/)) {
141
+ const key = entryKey(line);
142
+ if (key !== undefined)
143
+ answers.set(key, line);
144
+ }
191
145
  const current = block(merged);
192
- const known = new Set((current?.[1] ?? '')
193
- .split(/\r?\n/)
194
- .filter((line) => /^\s*[-*] /.test(line))
195
- .map(entryText));
196
- const missing = entries.filter((line) => !known.has(entryText(line)));
197
- if (!missing.length)
146
+ const original = current?.[1] ?? '';
147
+ const newline = original.includes('\r\n') ? '\r\n' : '\n';
148
+ const seen = new Set();
149
+ const lines = [];
150
+ for (const line of original.split(/\r?\n/)) {
151
+ const key = entryKey(line);
152
+ if (key === undefined || !answers.has(key)) {
153
+ lines.push(line);
154
+ continue;
155
+ }
156
+ if (seen.has(key))
157
+ continue;
158
+ seen.add(key);
159
+ const answer = answers.get(key);
160
+ const replace = confirmed && line.trim() !== answer.trim();
161
+ lines.push(replace ? answer : line);
162
+ if (replace)
163
+ revised = true;
164
+ }
165
+ const added = [...answers].filter(([key]) => !seen.has(key)).map(([, line]) => line);
166
+ let body = lines.join(newline);
167
+ if (added.length)
168
+ body = `${body.trimEnd()}${body.trim() ? newline : ''}${added.join(newline)}${newline}${newline}`;
169
+ if (body === original)
198
170
  continue;
199
- added = true;
171
+ changed = true;
200
172
  // 条目是用户文本,替换值用函数形式,避免 `$&` 等被当作替换模式。
201
173
  merged = current
202
- ? merged.replace(current[0], () => `${current[0].trimEnd()}\n${missing.join('\n')}\n\n`)
203
- : `${merged.trimEnd()}\n\n### ${heading}\n\n${missing.join('\n')}`;
174
+ ? merged.replace(current[0], () => `${current[0].slice(0, current[0].length - original.length)}${body}`)
175
+ : `${merged.trimEnd()}\n\n### ${heading}\n\n${body}`;
204
176
  }
205
- const note = confirmation.startsWith('用户,') ? `${confirmation.slice('用户,'.length)} 追加` : `追加条目${confirmation}`;
206
- return (added ? merged.replace(header, () => `${header};${note}`) : merged).trim();
177
+ const note = confirmed ? `${confirmation.slice('用户,'.length)} ${revised ? '更新' : '追加'}` : `追加条目${confirmation}`;
178
+ return (changed ? merged.replace(header, () => `${header};${note}`) : merged).trim();
207
179
  }
208
180
  function persistConfirmation(root, session, record) {
209
181
  const { change, markdown, at, status } = record;
210
- parseBoundary(markdown);
182
+ validateBoundary(markdown);
211
183
  const dir = change ? join(root, 'openspec/changes', scopeChanges(root, [], change)[0]) : undefined;
212
184
  if (dir && !existsSync(dir))
213
185
  throw new Error(`当前工作区没有 OpenSpec change ${change},边界不写入`);
@@ -235,81 +207,19 @@ function persistConfirmation(root, session, record) {
235
207
  }
236
208
  return record;
237
209
  }
238
- export function boundaryReceipt(record) {
239
- return `边界约定:已确认\n确认时间:${record.at}\n${record.markdown}`;
240
- }
241
- export function boundaryAnswer(root, session, id) {
242
- const record = readRecord(root, session);
243
- if (!id || !record || record.id !== id || record.project !== realpathSync(root))
244
- throw new Error('边界提案已替换或不属于当前会话');
245
- return record;
246
- }
247
- export function submitBoundaryAnswer(root, session, id, answers) {
248
- if (!answers || typeof answers !== 'object' || Array.isArray(answers))
249
- throw new Error('答案格式无效');
250
- const entries = Object.entries(answers).sort(([a], [b]) => a.localeCompare(b));
251
- if (entries.length > 200 || entries.some(([, value]) => typeof value !== 'string' || value.length > 2000)) {
252
- throw new Error('答案格式或长度无效');
253
- }
254
- const submitted = createHash('sha256').update(JSON.stringify(entries)).digest('hex');
255
- return boundaryWrite(root, () => {
256
- const prior = boundaryAnswer(root, session, id);
257
- if (prior.status === 'confirmed' && prior.submitted === submitted)
258
- return prior;
259
- if (prior.status !== 'proposed')
260
- throw new Error('边界提案已经结束');
261
- if (Date.now() - Date.parse(prior.at) > 30 * 60_000)
262
- throw new Error('边界提案已过期');
263
- if (prior.change && readRecord(root, changeSession(prior.change))?.id !== id)
264
- throw new Error('关联 change 已有更新的边界提案');
265
- const rows = parseBoundary(prior.markdown);
266
- const edits = new Map();
267
- for (const [key, answer] of entries) {
268
- const index = Number(key);
269
- if (String(index) !== key || !rows[index]?.decision || !answer.trim() || /[\r\n;;]|(?:建议默认|需拍板)[::]/.test(answer))
270
- throw new Error('条目或答案无效');
271
- if (answer.trim() !== rows[index].suggested)
272
- edits.set(index, answer.trim());
273
- }
274
- const markdown = edits.size ? applyBoundaryEdits(prior.markdown, edits) : prior.markdown;
275
- return persistConfirmation(root, session, { ...prior, status: 'confirmed', markdown, submitted, at: new Date().toISOString() });
276
- });
277
- }
278
- export function cancelBoundaryAnswer(root, session, id) {
279
- boundaryWrite(root, () => {
280
- const prior = boundaryAnswer(root, session, id);
281
- if (prior.status !== 'proposed')
282
- throw new Error('边界提案已经结束');
283
- const { id: _id, ...draft } = prior;
284
- if (!saveContextMetadata(root, session, KEY, draft))
285
- throw new Error('无法取消边界提案');
286
- });
287
- }
288
- function applyBoundaryEdits(markdown, edits) {
289
- let section = '';
290
- const counters = new Map();
291
- const rows = parseBoundary(markdown);
292
- return markdown.replace(/^.*$/gm, (line) => {
293
- const heading = /^(#{1,3}) (.+?)\s*$/.exec(line);
294
- if (heading)
295
- section = heading[1] === '###' ? heading[2] : '';
296
- if (!/^\s*[-*] /.test(line))
297
- return line;
298
- const offset = counters.get(section) ?? 0;
299
- const start = rows.findIndex((row) => row.section === section);
300
- if (start < 0)
301
- return line;
302
- counters.set(section, offset + 1);
303
- const answer = edits.get(start + offset);
304
- return answer === undefined ? line : line.replace(DEFAULT_ANSWER, (_match, prefix) => prefix + answer);
305
- });
306
- }
307
210
  export function skipBoundary(root, session, reason, change) {
308
211
  if (!reason.trim())
309
212
  throw new Error('boundary skip 需要 --reason');
310
213
  if (change)
311
214
  scopeChanges(root, [], change);
312
- boundaryWrite(root, () => save(root, session, { status: 'skipped', markdown: '', reason, at: new Date().toISOString(), ...(change ? { change } : {}) }));
215
+ boundaryWrite(root, () => save(root, session, {
216
+ status: 'skipped',
217
+ markdown: '',
218
+ project: realpathSync(root),
219
+ reason,
220
+ at: new Date().toISOString(),
221
+ ...(change ? { change } : {}),
222
+ }));
313
223
  }
314
224
  export function boundaryDecision(root, session, paths) {
315
225
  // 编辑护栏是会话级一次性约束,当前工作区的任何既有记录都足以放行。
@@ -327,7 +237,7 @@ export function boundaryDecision(root, session, paths) {
327
237
  return match(config?.zones?.business, path) && !match(others, path) && !match(config?.exclude, path);
328
238
  });
329
239
  return business
330
- ? '开发前先确认边界:起草边界约定,运行 `sumi boundary propose`,按输出向用户提问;纯格式或文档改动运行 `sumi boundary skip --reason …`'
240
+ ? '开发前先确认边界:按 `sumi instructions boundary` 向用户确认后运行 `sumi boundary confirm <记录文件>`。纯格式或文档改动使用 `sumi boundary skip --reason <原因>`'
331
241
  : null;
332
242
  }
333
243
  export function boundaryContext(root, paths, session = envSession(), change) {