cowork-flow 2.4.1 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/CHANGELOG.md +30 -1
  2. package/README.en.md +2 -1
  3. package/README.md +2 -1
  4. package/docs/architecture.en.md +2 -0
  5. package/docs/architecture.md +2 -0
  6. package/docs/hosts.en.md +15 -0
  7. package/docs/hosts.md +15 -0
  8. package/package.json +2 -2
  9. package/presets/claude-code/.claude-plugin/plugin.json +1 -1
  10. package/presets/codex/.codex-plugin/plugin.json +1 -1
  11. package/presets/kimi-code/.kimi-plugin/plugin.json +1 -1
  12. package/presets/qoder/.qoder-plugin/plugin.json +1 -1
  13. package/presets/zcode/.zcode-plugin/plugin.json +1 -1
  14. package/src/commands/host-inspect.js +86 -0
  15. package/src/commands/host.js +42 -18
  16. package/src/commands/init.js +100 -3
  17. package/src/commands/install-claude-code-plugin.js +53 -2
  18. package/src/commands/install-codex-plugin.js +114 -4
  19. package/src/commands/install-dsh-hook.js +51 -0
  20. package/src/commands/install-dsh-preset.js +46 -4
  21. package/src/commands/install-kimi-code-plugin.js +61 -2
  22. package/src/commands/install-kimi-hook.js +84 -2
  23. package/src/commands/install-opencode-plugin.js +58 -2
  24. package/src/commands/install-qoder-plugin.js +67 -3
  25. package/src/commands/install-zcode-plugin.js +77 -2
  26. package/src/commands/registry.js +20 -5
  27. package/src/lib/dsh-home.js +2 -2
  28. package/template/.cowork-flow/.version +1 -1
  29. package/template/.cowork-flow/scripts/adapters/cli/plan.py +218 -0
  30. package/template/.cowork-flow/scripts/adapters/host/host_manifest.py +4 -0
  31. package/template/.cowork-flow/scripts/adapters/host/workflow_state_hook.py +1 -3
  32. package/template/.cowork-flow/scripts/infra/files.py +0 -13
  33. package/template/.cowork-flow/scripts/run.py +3 -1
  34. package/template/.cowork-flow/scripts/services/ac_evidence.py +1 -1
  35. package/template/.cowork-flow/scripts/services/decision_anchor_schema.py +65 -0
  36. package/template/.cowork-flow/scripts/services/fact_view.py +2 -75
  37. package/template/.cowork-flow/scripts/services/lifecycle_checks.py +1 -1
  38. package/template/.cowork-flow/scripts/services/plan_readiness.py +655 -0
  39. package/template/.cowork-flow/scripts/services/plan_scaffold.py +133 -0
  40. package/template/.cowork-flow/scripts/services/plan_schema.py +40 -0
  41. package/template/.cowork-flow/scripts/services/task_context.py +12 -0
  42. package/template/.cowork-flow/scripts/services/task_creation.py +23 -24
  43. package/template/.cowork-flow/spec/contracts/host-install-inspection.md +174 -0
  44. package/template/.cowork-flow/spec/contracts/index.md +1 -0
  45. package/template/.cowork-flow/spec/contracts/plan-binding.md +62 -4
  46. package/template/.cowork-flow/spec/runtime/contract-registry.json +17 -1
  47. package/template/skills/runtime-health/scripts/doctor.py +538 -489
  48. package/template/skills/task-planning/SKILL.md +24 -0
  49. package/template/skills/task-review/scripts/review_check.py +33 -6
@@ -30,6 +30,28 @@ If the installed template is missing, stop and report it (run `cwf project sync
30
30
 
31
31
  The template is distributed at install time for the project language configured in `.cowork-flow/config.yaml` (`zh-CN` by default, or `en-US`). Write the plan in that language. Keep the template's machine-readable goal line and `AC-NNN` identifiers unchanged so task creation and workflow gates can parse them. Do not translate paths, commands, code identifiers, or spec file names.
32
32
 
33
+ ### Skeleton Generation
34
+
35
+ Generate the first version from the installed template instead of retyping its structure:
36
+
37
+ ```bash
38
+ ./.cowork-flow/run plan new --title "<plan title>" --slug <ascii-slug>
39
+ ```
40
+
41
+ `plan new` replaces the title placeholder, writes `.cowork-flow/plans/YYYY-MM-DD-<slug>.md`, and refuses to overwrite an existing plan unless `--force` is explicit. Fill the generated skeleton; do not invent a second plan shape. If the installed template is missing, the command stops with a `cwf project sync .` hint.
42
+
43
+ ### Plan Readiness Gate
44
+
45
+ After filling the plan and anchor, finalize them before human review:
46
+
47
+ ```bash
48
+ ./.cowork-flow/run plan finalize <task-dir>
49
+ ```
50
+
51
+ `plan finalize` checks the plan and anchor for template shape, concrete section content, AC rows, complete task briefs, verification commands, matching goal/AC text, the spec-check result, and a non-empty `implement.jsonl`. On success it writes `task.json.meta.planReady` with plan/anchor digests.
52
+
53
+ New strict non-Tiny tasks require this snapshot at start. Present the finalized plan and anchor for human review; start only verifies that the reviewed files have not changed. If either file changes after finalize, run `plan finalize` again and re-review before starting. Tiny and legacy tasks keep their existing exemptions.
54
+
33
55
  ### Plan Style: Task Briefs, Not Design Docs
34
56
 
35
57
  Plans exist to prevent implementation drift. They must guide implementation by pinning task order, file boundaries, key symbols, the core patch shape, test proof, completion conditions, and prohibited drift. They are not architecture essays and must not explain every possible option.
@@ -82,6 +104,7 @@ A plan can be marked approved only when all conditions hold:
82
104
  - Every task has implementation steps and verification commands.
83
105
  - Task dependencies are explicit, including whether work is serial or parallelizable.
84
106
  - The plan uses the installed `.cowork-flow/templates/plan-template.md` shape and the configured output language. For strict non-Tiny tasks, the runtime blocks start when the plan or anchor lacks the configured-language verification section or a filled spec-check result.
107
+ - For new strict non-Tiny tasks, the plan and anchor have passed `plan finalize` and the human has reviewed that snapshot. Any later edit requires another finalize and review.
85
108
 
86
109
  `implement.jsonl` is the current task's context index — the files in scope and
87
110
  the spec pointers it needs — not the task list. The plan owns the task list.
@@ -120,3 +143,4 @@ Before handoff:
120
143
  5. Confirm the plan says to stop and report back when code facts conflict with the plan, a plan-external file becomes necessary, or a test fails for an unplanned reason.
121
144
  6. Confirm Final Verification carries the applicable `.cowork-flow/spec/<dev_type>/` clause check with an actual `pass` / `not_applicable` result, or states why no spec file applies. For strict non-Tiny tasks the runtime blocks start when this line is missing or still the template placeholder.
122
145
  7. Confirm the plan is written in the configured language and keeps the machine-readable goal line and `AC-NNN` identifiers unchanged.
146
+ 8. Run `plan finalize <task-dir>` and fix every reported blocker before handing the plan to the user for review.
@@ -30,6 +30,7 @@ from infra.git_snapshot import collect_changed_paths
30
30
  from infra.quality_sources import quality_source_entries
31
31
  from services.lifecycle_checks import LifecycleCheckRunner
32
32
  from services.task_context import TaskContextService
33
+ from services.task_repository import TaskRepository
33
34
  from runtime.session_state import is_main_session
34
35
 
35
36
 
@@ -78,10 +79,12 @@ def _repo_root() -> Path:
78
79
 
79
80
 
80
81
  def _task_dir(repo_root: Path, raw: str) -> Path:
81
- path = Path(raw)
82
- if not path.is_absolute():
83
- path = repo_root / path
84
- return path.resolve()
82
+ """Resolve a task name, workflow-relative path, or absolute path.
83
+
84
+ `task next` accepts all three forms; an advisory report that only
85
+ understood paths silently produced facts about a non-existent directory.
86
+ """
87
+ return TaskRepository(repo_root).resolve(raw)
85
88
 
86
89
 
87
90
  def _relative(repo_root: Path, path: Path) -> str:
@@ -596,7 +599,10 @@ def main(argv: list[str] | None = None) -> int:
596
599
  parser = argparse.ArgumentParser(
597
600
  description="Print advisory review facts for task-review.",
598
601
  )
599
- parser.add_argument("task_dir", help="Task directory to inspect.")
602
+ parser.add_argument(
603
+ "task_dir",
604
+ help="Task directory, repository-relative path, or task name to inspect.",
605
+ )
600
606
  parser.add_argument(
601
607
  "--json",
602
608
  action="store_true",
@@ -605,7 +611,28 @@ def main(argv: list[str] | None = None) -> int:
605
611
  args = parser.parse_args(argv)
606
612
 
607
613
  repo_root = _repo_root()
608
- report = build_report(repo_root, _task_dir(repo_root, args.task_dir))
614
+ task_dir = _task_dir(repo_root, args.task_dir)
615
+ if not (task_dir / "task.json").is_file():
616
+ print(
617
+ json.dumps(
618
+ {
619
+ "error": {
620
+ "code": "TASK-NOT-FOUND",
621
+ "task": args.task_dir,
622
+ "path": _relative(repo_root, task_dir),
623
+ "message": (
624
+ f"No task.json found for {args.task_dir!r}; "
625
+ "pass a task name, a repository-relative path, "
626
+ "or an absolute task directory."
627
+ ),
628
+ }
629
+ },
630
+ ensure_ascii=False,
631
+ indent=2,
632
+ )
633
+ )
634
+ return 2
635
+ report = build_report(repo_root, task_dir)
609
636
  print(json.dumps(report, ensure_ascii=False, indent=2, sort_keys=False))
610
637
  return 0
611
638