@devflow-core/dsh-devflow 0.6.2 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -33,7 +33,7 @@ npx @deepseek-ai/dsh plugin --profile web add @devflow-core/dsh-devflow
33
33
 
34
34
  - **devflow-\* 权威覆盖**:目标文件与包内源文件字节相同 → 跳过;不同 → 覆盖。
35
35
  - 源不再包含的 devflow-\* 残留(升级后旧文件)→ 删除(prune)。
36
- - **非 devflow 资产永不触碰**:用户自装的 skill(如 `atlassian`、`rtk`)、
36
+ - **非 devflow 资产永不触碰**:用户自装的 skill(如 `atlassian`)、
37
37
  自定义命令/脚本一律保留,不删除不覆盖。
38
38
  - **preset 目录完全由插件管理**:`~/.dsh/.agent-presets/devflow-2/` 整目录归
39
39
  插件所有,目录内非包内文件(含手动备份如 `agent.cordis.yml.bak-*`)会在
package/RELEASE.md CHANGED
@@ -101,7 +101,7 @@ npx @deepseek-ai/dsh plugin --profile web update @devflow-core/dsh-devflow
101
101
  - 字节相同的文件跳过(不覆盖用户 mtime)
102
102
  - 不同的文件覆盖(devflow-* 权威)
103
103
  - 源不再包含的 devflow-* 残留 prune
104
- - 非 devflow 资产(atlassian、rtk 等)永不触碰
104
+ - 非 devflow 资产(atlassian 等)永不触碰
105
105
  - `~/.dsh/.agent-presets/devflow-2/` 整目录归插件管理,目录内非包内文件会被清理
106
106
 
107
107
  ## 常见错误对照表
@@ -369,20 +369,24 @@ function splitTasksV2(body) {
369
369
  }
370
370
 
371
371
  /** Validate one v2 task: files, change intent, acceptance, proof, and exclusion. */
372
- function checkTaskV2(task) {
372
+ function checkTaskV2(task, enforceGranularity = true) {
373
373
  const missing = v2TaskFields.filter((field) => !v2FieldPatterns[field].test(task.body));
374
374
  const files = v2FieldBlock(task.body, "Files");
375
375
  const change = v2FieldBlock(task.body, "Change");
376
+ const acceptance = v2FieldBlock(task.body, "Acceptance");
376
377
  const verify = v2FieldBlock(task.body, "Verify");
377
378
  const notDoing = v2FieldBlock(task.body, "Not doing");
378
379
  const fileEntries = parseFileEntries(files);
379
380
  const invalidFiles = fileEntries.filter(({ match }) => !match).map(({ line }) => line);
380
381
  const unlocatedCodeFiles = findUnlocatedCodeFiles(fileEntries);
381
382
  const unresolved = findMatches(task.body, unresolvedPatterns);
382
- const vague = findMatches([change, v2FieldBlock(task.body, "Acceptance"), verify].join("\n"), vaguePatterns);
383
+ const vague = findMatches([change, acceptance, verify].join("\n"), vaguePatterns);
383
384
  // v2 不强制精确改法;只要求 Change 说出可执行意图,具体实现归 Build。
384
385
  const missingChange = !implementationVerbPattern.test(change) || genericMechanicsPattern.test(change);
385
386
  const incompleteVerification = !hasVerificationExpectation(verify);
387
+ // 单结果保守代理:Acceptance 含分号即视为多交付单元;先剔除反引号代码片段,避免命令里的半角分号误报。语义判据("且"连接独立结果、镜像合并)在技能指南,checker 只强制可静态判定的子集。
388
+ const acceptanceText = acceptance.replace(/`[^`]*`/g, "");
389
+ const multiResult = enforceGranularity && /[;;]/.test(acceptanceText);
386
390
 
387
391
  return {
388
392
  number: task.number,
@@ -393,6 +397,7 @@ function checkTaskV2(task) {
393
397
  unlocatedCodeFiles,
394
398
  missingChange,
395
399
  incompleteVerification,
400
+ multiResult,
396
401
  missingNotDoing: !notDoing,
397
402
  ok:
398
403
  missing.length === 0 &&
@@ -402,6 +407,7 @@ function checkTaskV2(task) {
402
407
  unlocatedCodeFiles.length === 0 &&
403
408
  !missingChange &&
404
409
  !incompleteVerification &&
410
+ !multiResult &&
405
411
  Boolean(notDoing)
406
412
  };
407
413
  }
@@ -409,13 +415,15 @@ function checkTaskV2(task) {
409
415
  /** Validate the v2 plan contract: slim header, task rows, Progress table, and Cut subtraction. */
410
416
  function checkPlanV2(body) {
411
417
  const tasks = splitTasksV2(body);
412
- const taskResults = tasks.map(checkTaskV2);
413
- const missingGlobal = v2GlobalFields.filter((field) => !v2FieldPatterns[field].test(body));
414
- const cutBlock = v2FieldBlock(body, "Cut");
415
- const missingRejected = !/Rejected\s*:\s*\S/im.test(cutBlock);
416
418
  const statusMatch = body.match(statusPattern);
417
419
  const status = statusMatch ? statusMatch[1].trim() : "legacy";
418
420
  const invalidStatus = statusMatch ? !validStatuses.includes(status) : false;
421
+ // 粒度代理只在活跃计划(draft/approved/in-progress)上强制;done 计划是历史记录,不重判,避免既有 v2 计划校验回归。
422
+ const enforceGranularity = status !== "done";
423
+ const taskResults = tasks.map((task) => checkTaskV2(task, enforceGranularity));
424
+ const missingGlobal = v2GlobalFields.filter((field) => !v2FieldPatterns[field].test(body));
425
+ const cutBlock = v2FieldBlock(body, "Cut");
426
+ const missingRejected = !/Rejected\s*:\s*\S/im.test(cutBlock);
419
427
  const progress = [...body.matchAll(progressRowPattern)].map((match) => ({
420
428
  number: Number(match[1]),
421
429
  state: match[3],
@@ -806,6 +814,7 @@ function report(body, filePath, json) {
806
814
  ...task.vague.map((match) => `vague ${match}`),
807
815
  ...task.invalidFiles.map((line) => `unclassified file ${line}`),
808
816
  ...task.unlocatedCodeFiles.map((line) => `missing file symbol/anchor ${line}`),
817
+ ...(task.multiResult ? ["Acceptance lists multiple results; split the task or state one observable result"] : []),
809
818
  ...(task.missingChange ? ["Change needs an executable intent verb"] : []),
810
819
  ...(task.missingNotDoing ? ["missing Not doing exclusion"] : []),
811
820
  ...(task.incompleteVerification ? ["Verify needs command/scenario and expected result"] : [])
@@ -1046,7 +1055,7 @@ function selfTest() {
1046
1055
  "Files:",
1047
1056
  "- Modify: scripts/devflow-plan.js | symbol: `checkPlanV2` | validate the slim contract",
1048
1057
  "Change: add v2 field validation and dispatch",
1049
- "Acceptance: v2 plans pass and legacy plans keep passing",
1058
+ "Acceptance: v2 plans pass the slim contract",
1050
1059
  "Verify: run `node scripts/devflow-plan.js --self-test` expect exit 0",
1051
1060
  "Not doing: changing legacy validation",
1052
1061
  "",
@@ -1058,6 +1067,24 @@ function selfTest() {
1058
1067
  ].join("\n");
1059
1068
  if (!detectV2(validV2Plan)) throw new Error("Self-test expected v2 detection to pass");
1060
1069
  if (!checkPlan(validV2Plan).ok) throw new Error("Self-test expected valid v2 plan to pass");
1070
+ const multiResultV2Plan = validV2Plan.replace(
1071
+ "Acceptance: v2 plans pass the slim contract",
1072
+ "Acceptance: v2 plans pass;legacy plans keep passing"
1073
+ );
1074
+ if (checkPlan(multiResultV2Plan).ok) throw new Error("Self-test expected a semicolon-joined Acceptance to fail");
1075
+ const doneMultiResultV2Plan = multiResultV2Plan
1076
+ .replace("Status: approved", "Status: done")
1077
+ .replace("| 1 | Add v2 validation | todo | - |", "| 1 | Add v2 validation | done | run `node scripts/devflow-plan.js --self-test` |");
1078
+ if (!checkPlan(doneMultiResultV2Plan).ok) {
1079
+ throw new Error("Self-test expected a done plan to keep validating without granularity re-judging");
1080
+ }
1081
+ const codeSpanSemicolonV2Plan = validV2Plan.replace(
1082
+ "Acceptance: v2 plans pass the slim contract",
1083
+ "Acceptance: `node -e \"a;b\"` prints one result"
1084
+ );
1085
+ if (!checkPlan(codeSpanSemicolonV2Plan).ok) {
1086
+ throw new Error("Self-test expected a semicolon inside a code span to stay valid");
1087
+ }
1061
1088
  if (checkPlan(validV2Plan.replace(/Rejected:[^\n]*/, "Rejected:")).ok) throw new Error("Self-test expected missing Rejected to fail");
1062
1089
  if (checkPlan(validV2Plan.replace("| 1 | Add v2 validation | todo | - |", "| 1 | Add v2 validation | done | - |")).ok) {
1063
1090
  throw new Error("Self-test expected a done Progress row without evidence to fail");
@@ -1089,7 +1116,7 @@ function selfTest() {
1089
1116
  if (missingArtifact.length === 0) throw new Error("Self-test expected a missing requirement artifact to fail");
1090
1117
 
1091
1118
  console.log("DevFlow plan self-test passed");
1092
- console.log("Checked v2 and legacy plan contracts, Progress evidence, Cut Rejected, code-level fields, precise file locations, verification expectations, documentation-only exception, external-skill declaration, and plan landing guidance");
1119
+ console.log("Checked v2 and legacy plan contracts, Progress evidence, Cut Rejected, single-result Acceptance granularity, code-level fields, precise file locations, verification expectations, documentation-only exception, external-skill declaration, and plan landing guidance");
1093
1120
  }
1094
1121
 
1095
1122
  const args = process.argv.slice(2);
@@ -46,7 +46,7 @@ When saving a plan file, use `docs/plans/YYYY-MM-DD-<short-kebab-name>.md`, reso
46
46
 
47
47
  For multi-step work, tasks must cite the approved source, be small and verifiable, and follow the six-field contract (`Task` / `Files` / `Change` / `Acceptance` / `Verify` / `Not doing`) in `skills/devflow-plan/SKILL.md`. Legacy plans with `Change mechanics` and `Prewalk` stay executable under their own contract.
48
48
 
49
- No unresolved markers. `Change` states the executable intent and boundary; add exact mechanics only when the change crosses a module contract, is irreversible, or touches security or data boundaries. Otherwise Build chooses the smallest implementation and records it as Progress evidence. The verification step keeps its trigger/input, expected result, and command or manual scenario. A task whose files are all documentation paths is documentation-only. No "add tests" without naming the behavior, no "handle edge cases" without naming the edge case, no "similar to Task N" shortcuts.
49
+ No unresolved markers. `Change` states the executable intent and boundary; add exact mechanics only when the change crosses a module contract, is irreversible, touches security or data boundaries, or the mechanism cannot be inferred from the task's named anchors by a different session or model. Otherwise Build chooses the smallest implementation and records it as Progress evidence. The verification step keeps its trigger/input, expected result, and command or manual scenario. A task whose files are all documentation paths is documentation-only. No "add tests" without naming the behavior, no "handle edge cases" without naming the edge case, no "similar to Task N" shortcuts.
50
50
 
51
51
  Close each task by writing back its `## Progress` row: `doing` when starting, `done` with the command and key result when its `Verify` passes. A `done` row without evidence fails the checker. On a legacy plan without a Progress table, report the same evidence in the completion message. When every task is `done`, advance the requirement row in `docs/requirements.md` to `built`.
52
52
 
@@ -18,7 +18,7 @@ Turn an A/B `CUT_PASS`-bounded approved design or confirmed Spec into one review
18
18
  1. Read only source material, code, tests, and conventions relevant to the approved scope. Load `skills/devflow-spec/references/spec-plan-methods.md` and `skills/devflow-plan/references/plan-methods.md` before applying Plan Pack mechanics.
19
19
  2. Map the intended touch set once: list the files and the responsibility each one carries. Reuse existing modules and name the intended file operation.
20
20
  3. Do the bounded investigation needed to write correct tasks. Keep that evidence in the conversation or in a learning card; it is not a plan field.
21
- 4. Split independent deliverables into small, reviewable tasks. Each task carries `Files`, `Change`, `Acceptance`, `Verify`, and `Not doing` so an executor can act on it without reading another task.
21
+ 4. Split by delivery unit: one task = one independently verifiable deliverable and the smallest unit worth a fresh reviewer's gate — split only where a reviewer could meaningfully reject one task while approving its neighbor, and fold setup, configuration, scaffolding, and documentation into the task whose deliverable needs them. Split whenever `Acceptance` needs `且`/`and` to join two independently verifiable results; keep one task when the same rule mirrors across files — mirrored edits are one delivery unit, not one task per file. Each task carries `Files`, `Change`, `Acceptance`, `Verify`, and `Not doing` so an executor can act on it without reading another task.
22
22
  5. Write the plan using the required header, task contract, and `## Progress` table below.
23
23
  6. Self-review Cut fidelity, touch-set coverage, acceptance proof, scope exclusions, and Progress row count against the task count.
24
24
  7. Run `node scripts/devflow-plan.js <plan-file>` when the project-level checker exists. Otherwise resolve the user-level checker according to `core-methods.md` Script Path Resolution.
@@ -49,7 +49,7 @@ Files:
49
49
  - Create: <path> | new file | <responsibility>
50
50
  - Modify: <path> | <symbol or stable anchor> | <responsibility>
51
51
  - Test: <path> | <symbol or stable anchor> | <behavior proved> # only when applicable
52
- Change: <what changes and its boundary; add the smallest mechanics only when the change crosses a module contract, is irreversible, or touches security or data boundaries>
52
+ Change: <what changes and its boundary; add the smallest mechanics (pseudocode, exact replacement, or key fragment) only when the change crosses a module contract, is irreversible, touches security or data boundaries, or the mechanism cannot be inferred from the task's named anchors by a different session or model>
53
53
  Acceptance: <specific observable condition>
54
54
  Verify: <exact command or manual scenario, trigger/input, and expected result>
55
55
  Not doing: <scope excluded by this task>
@@ -77,15 +77,15 @@ Files:
77
77
  - Create: <path> | new file | <responsibility>
78
78
  - Modify: <path> | <symbol or stable anchor> | <responsibility>
79
79
  - Test: <path> | <symbol or stable anchor> | <behavior proved> # only when applicable
80
- Change: <what changes and its boundary; exact mechanics only when the change crosses a module contract, is irreversible, or touches security or data boundaries>
80
+ Change: <what changes and its boundary; exact mechanics (pseudocode, exact replacement, or key fragment) only when the change crosses a module contract, is irreversible, touches security or data boundaries, or the mechanism cannot be inferred from the task's named anchors by a different session or model>
81
81
  Acceptance: <specific observable condition>
82
82
  Verify: <exact command or manual scenario, trigger/input, and expected result>
83
83
  Not doing: <scope excluded by this task>
84
84
  ```
85
85
 
86
- Use only `Create`, `Modify`, and `Test` file-operation labels. `Create` rows use `new file`; every other row names a symbol or stable anchor. `Change` states the executable intent and its boundary in one or two lines; it does not restate current behavior, target behavior, call impact, or interfaces unless the task changes a cross-module contract. The Plan no longer classifies tasks by `Task type`: a task whose files are all documentation paths is documentation-only, and the checker treats it that way.
86
+ Use only `Create`, `Modify`, and `Test` file-operation labels. `Create` rows use `new file`; every other row names a symbol or stable anchor. `Change` states the executable intent and its boundary in one or two lines; it does not restate current behavior, target behavior, call impact, or interfaces unless the task changes a cross-module contract. When the mechanism cannot be inferred from the task's named anchors — the common case when a different session or model executes the plan — `Change` carries the smallest runnable mechanics (pseudocode, exact replacement, or key fragment) so the executor acts without the author's session context. The Plan no longer classifies tasks by `Task type`: a task whose files are all documentation paths is documentation-only, and the checker treats it that way.
87
87
 
88
- Six fields per task is the whole contract: ordering, the touch set, the intent, the acceptance condition, the proof command, and the exclusion. Investigation traces, handoff facts, per-task worklists, architecture, tech stack, spec coverage, and comment locations are owned by other nodes or stay in the conversation. `Prewalk`, `File Structure`, `Interfaces`, `Current behavior`, `Target behavior`, `Change mechanics`, `Call impact`, and `Comments` are not part of the v2 contract; a plan that still carries them is treated as legacy.
88
+ Six fields per task is the whole contract: ordering, the touch set, the intent, the acceptance condition, the proof command, and the exclusion. `Acceptance` states one observable result; a `;`/`;`-joined multi-result acceptance is a split signal and the checker fails it while the plan is active. Plan length has no fixed total line cap: it grows with the number of delivery units while every task keeps the six-field, one-result shape. Investigation traces, handoff facts, per-task worklists, architecture, tech stack, spec coverage, and comment locations are owned by other nodes or stay in the conversation. `Prewalk`, `File Structure`, `Interfaces`, `Current behavior`, `Target behavior`, `Change mechanics`, `Call impact`, and `Comments` are not part of the v2 contract; a plan that still carries them is treated as legacy.
89
89
 
90
90
  Keep one task understandable on its own. Do not use cross-task shorthand, generic test additions, unnamed edge cases, or cleanup entries. Name a test file only when the stated behavior needs one.
91
91
 
@@ -103,6 +103,8 @@ Plan generation does not repeat Cut, perform Build or Prove, prescribe independe
103
103
  | "The checker proves the architecture." | It proves structure only; the author must review scope and design consistency. |
104
104
  | "The plan is approved, so Cut can be skipped." | Plan generation requires an existing `CUT_PASS`; it cannot replace the earlier reuse and scope decision. |
105
105
  | "The task details can broaden the solution." | If a task exceeds the Cut Decision, return the scope-drift facts to `devflow-core`; do not directly enter Build. |
106
+ | "Two results can share one task when they ship together." | Two independently verifiable results are two delivery units; split the task or reduce `Acceptance` to one observable result. |
107
+ | "A different session or model will figure out the how." | If the mechanism cannot be inferred from the task's named anchors, `Change` must carry the smallest runnable mechanics; otherwise the handoff stalls. |
106
108
 
107
109
  ## Verification
108
110
 
@@ -114,6 +116,8 @@ Before leaving this skill, confirm:
114
116
  - [ ] Approved design or saved spec is cited as optional `Source`.
115
117
  - [ ] Header, tasks, and `## Progress` match the v2 contract; each task has six fields and no legacy field.
116
118
  - [ ] Every task is independently understandable and has no unresolved or vague placeholder.
119
+ - [ ] Each task is exactly one delivery unit: no `;`/`;`-joined `Acceptance`, and a mirrored rule was not split per file.
120
+ - [ ] Every task is executable by a different session or model from its six fields plus named anchors: a non-inferable mechanism carries the smallest runnable mechanics.
117
121
  - [ ] Progress row count equals task count; every `done` row carries evidence.
118
122
  - [ ] The checker passed when available.
119
123
  - [ ] The user reviewed the written plan.
@@ -8,6 +8,17 @@ State the intended touch set once, before tasks: the files and the responsibilit
8
8
 
9
9
  The v2 Plan Pack has no `File Structure` table. The per-task `Files` rows are the touch set; a global table would only restate them.
10
10
 
11
+ ## Delivery Unit
12
+
13
+ Split by delivery unit, not by file or by step: one task = one independently verifiable deliverable.
14
+
15
+ - Splitting test: if `Acceptance` needs `且`/`and` to join two independently verifiable results, they are two delivery units — split them.
16
+ - Mirror test: the same rule edited across several files is one delivery unit; do not split it per file.
17
+ - Right-sizing test: a task is the smallest unit worth a fresh reviewer's gate — split only where a reviewer could meaningfully reject one task while approving its neighbor; fold setup, configuration, scaffolding, and documentation into the task whose deliverable needs them.
18
+ - `Acceptance` states one observable result. The checker fails a v2 task whose `Acceptance` contains a `;`/`;` separator outside backtick code spans as the conservative static proxy for this rule; it applies while the plan is active (draft/approved/in-progress), while done plans stay historical records. The semantic tests above still govern mirrored and independently verifiable cases.
19
+ - Handoff density: when the mechanism cannot be inferred from the task's named anchors — a different session or model executes the plan — `Change` carries the smallest runnable mechanics (pseudocode, exact replacement, or key fragment); otherwise it stays intent plus boundary.
20
+ - No fixed total line cap: plan length grows with the number of delivery units; the six-field shape keeps each task slim.
21
+
11
22
  ## Task Rows
12
23
 
13
24
  Each task carries exactly six fields:
@@ -21,7 +32,7 @@ Verify: <command or manual scenario with trigger, input, and expected result>
21
32
  Not doing: <scope excluded by this task>
22
33
  ```
23
34
 
24
- `Change` states the executable intent. Add exact mechanics only when the change crosses a module contract, is irreversible, or touches security or data boundaries. Otherwise the executor chooses the smallest implementation inside the task boundary. This is the deliberate trade: the plan stops pre-deciding every edit, and Build regains bounded implementation authority. That trade is the fix for the bloated-plan problem, not a relaxation of proof.
35
+ `Change` states the executable intent. Add exact mechanics (pseudocode, exact replacement, or key fragment) only when the change crosses a module contract, is irreversible, touches security or data boundaries, or the mechanism cannot be inferred from the task's named anchors by a different session or model. Otherwise the executor chooses the smallest implementation inside the task boundary. This is the deliberate trade: the plan stops pre-deciding every edit, and Build regains bounded implementation authority. That trade is the fix for the bloated-plan problem, not a relaxation of proof.
25
36
 
26
37
  Investigation evidence does not belong in the plan. Keep it in the conversation, or in a `.copilot/cards/` learning card when it is reusable across tasks.
27
38
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devflow-core/dsh-devflow",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "DevFlow for DeepSeek Harness: devflow-2 agent preset + skills + commands + verification scripts, synced into ~/.dsh on host startup.",
5
5
  "type": "module",
6
6
  "engines": {