cowork-flow 0.0.37 → 0.0.39

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 (111) hide show
  1. package/README.md +27 -14
  2. package/package.json +1 -1
  3. package/src/commands/init.js +39 -28
  4. package/src/commands/sync.js +2 -2
  5. package/src/lib/asset-plan.js +127 -0
  6. package/src/lib/copy-template.js +101 -141
  7. package/src/lib/host-assets.js +231 -0
  8. package/src/lib/plan-applier.js +329 -0
  9. package/src/lib/platforms.js +15 -76
  10. package/src/lib/skill-registry.js +503 -0
  11. package/template/.claude/agents/cowork-check.md +10 -1
  12. package/template/.claude/agents/cowork-implement.md +11 -2
  13. package/template/.claude/hooks/inject-workflow-state.py +51 -254
  14. package/template/.codex/agents/cowork-check.toml +12 -3
  15. package/template/.codex/agents/cowork-implement.toml +11 -2
  16. package/template/.codex/agents/default.toml +3 -2
  17. package/template/.codex/agents/explorer.toml +3 -2
  18. package/template/.codex/agents/worker.toml +2 -1
  19. package/template/.codex/hooks/inject-workflow-state.py +46 -265
  20. package/template/.cowork-flow/.version +1 -1
  21. package/template/.cowork-flow/scripts/application/__init__.py +1 -0
  22. package/template/.cowork-flow/scripts/application/batch_execution.py +743 -0
  23. package/template/.cowork-flow/scripts/application/runtime_context_service.py +365 -0
  24. package/template/.cowork-flow/scripts/application/task_archive.py +220 -0
  25. package/template/.cowork-flow/scripts/application/task_context.py +765 -0
  26. package/template/.cowork-flow/scripts/application/task_creation.py +201 -0
  27. package/template/.cowork-flow/scripts/application/task_lifecycle.py +532 -0
  28. package/template/.cowork-flow/scripts/application/task_tree.py +179 -0
  29. package/template/.cowork-flow/scripts/commands/doctor.py +78 -57
  30. package/template/.cowork-flow/scripts/commands/party_mode_v2.py +671 -425
  31. package/template/.cowork-flow/scripts/commands/subagent.py +38 -26
  32. package/template/.cowork-flow/scripts/commands/task.py +535 -1953
  33. package/template/.cowork-flow/scripts/commands/task_archive_commands.py +195 -0
  34. package/template/.cowork-flow/scripts/commands/task_context_commands.py +240 -0
  35. package/template/.cowork-flow/scripts/commands/task_create_command.py +164 -0
  36. package/template/.cowork-flow/scripts/commands/task_navigation.py +407 -0
  37. package/template/.cowork-flow/scripts/commands/task_parser.py +364 -0
  38. package/template/.cowork-flow/scripts/commands/task_support.py +76 -0
  39. package/template/.cowork-flow/scripts/commands/task_tree_commands.py +160 -0
  40. package/template/.cowork-flow/scripts/common/core/execution_context.py +161 -85
  41. package/template/.cowork-flow/scripts/common/core/host_manifest.py +393 -0
  42. package/template/.cowork-flow/scripts/common/core/skill_registry.py +568 -0
  43. package/template/.cowork-flow/scripts/common/gates/coding_standards.py +58 -7
  44. package/template/.cowork-flow/scripts/common/gates/gates.py +323 -46
  45. package/template/.cowork-flow/scripts/common/gates/models.py +196 -0
  46. package/template/.cowork-flow/scripts/common/gates/registry.py +79 -0
  47. package/template/.cowork-flow/scripts/common/gates/tdd_evidence.py +13 -13
  48. package/template/.cowork-flow/scripts/common/gates/validate_coding_standards.py +104 -62
  49. package/template/.cowork-flow/scripts/common/gates/validate_implementation.py +39 -22
  50. package/template/.cowork-flow/scripts/common/gates/validate_rules.py +223 -40
  51. package/template/.cowork-flow/scripts/common/git/git_context.py +216 -182
  52. package/template/.cowork-flow/scripts/common/host/__init__.py +1 -0
  53. package/template/.cowork-flow/scripts/common/host/workflow_state_hook.py +303 -0
  54. package/template/.cowork-flow/scripts/common/storage/__init__.py +1 -0
  55. package/template/.cowork-flow/scripts/common/storage/operation_log.py +72 -0
  56. package/template/.cowork-flow/scripts/common/storage/state_store.py +279 -0
  57. package/template/.cowork-flow/scripts/common/storage/unit_of_work.py +214 -0
  58. package/template/.cowork-flow/scripts/common/task/active_task.py +93 -135
  59. package/template/.cowork-flow/scripts/common/task/batch_mode.py +33 -120
  60. package/template/.cowork-flow/scripts/common/task/decision_review.py +85 -0
  61. package/template/.cowork-flow/scripts/common/task/readiness.py +9 -15
  62. package/template/.cowork-flow/scripts/common/task/task_repository.py +156 -0
  63. package/template/.cowork-flow/scripts/run.py +24 -0
  64. package/template/.cowork-flow/spec/contracts/decision-anchor.md +8 -2
  65. package/template/.cowork-flow/spec/contracts/subagent-dispatch.md +2 -4
  66. package/template/.cowork-flow/spec/contracts/workflow-state-templates.md +1 -1
  67. package/template/.cowork-flow/spec/protocols/decision-review.md +28 -0
  68. package/template/.cowork-flow/spec/protocols/review.md +34 -0
  69. package/template/.cowork-flow/spec/protocols/spec-maintenance.md +16 -0
  70. package/template/.cowork-flow/spec/protocols/tdd.md +30 -0
  71. package/template/.cowork-flow/spec/references/definition-of-done.md +4 -4
  72. package/template/.cowork-flow/spec/references/orchestration-patterns.md +1 -1
  73. package/template/.cowork-flow/spec/runtime/contract-registry.json +25 -0
  74. package/template/.cowork-flow/spec/runtime/host-assets.json +214 -0
  75. package/template/.cowork-flow/spec/runtime/index.md +8 -0
  76. package/template/.cowork-flow/spec/runtime/rules.json +61 -10
  77. package/template/.cowork-flow/spec/runtime/skill-registry.json +397 -0
  78. package/template/.cowork-flow/spec/schemas/host-assets.schema.json +173 -0
  79. package/template/.cowork-flow/spec/schemas/rules.schema.json +10 -1
  80. package/template/.cowork-flow/spec/schemas/skill-registry.schema.json +202 -0
  81. package/template/.cowork-flow/workflow.md +18 -13
  82. package/template/.opencode/agents/cowork-check.md +11 -0
  83. package/template/.opencode/agents/cowork-implement.md +16 -1
  84. package/template/.zcode/.zcode-plugin/plugin.json +1 -1
  85. package/template/.zcode/hooks/inject-context.js +3 -85
  86. package/template/.zcode/hooks/inject-context.selfcheck.mjs +6 -6
  87. package/template/.zcode/scaffold/.cowork-flow/spec/contracts/decision-anchor.md +8 -2
  88. package/template/.zcode/scaffold/.cowork-flow/spec/contracts/subagent-dispatch.md +2 -4
  89. package/template/.zcode/scaffold/.cowork-flow/spec/runtime/rules.json +61 -10
  90. package/template/.zcode/scaffold/.cowork-flow/spec/schemas/rules.schema.json +10 -1
  91. package/template/.zcode/scaffold/.cowork-flow/workflow.md +18 -13
  92. package/template/.zcode/scaffold/AGENTS.md +18 -8
  93. package/template/AGENTS.md +1 -1
  94. package/template/skills/batch-mode/SKILL.md +140 -76
  95. package/template/skills/brainstorming/SKILL.md +2 -2
  96. package/template/skills/cowork-flow/SKILL.md +42 -0
  97. package/template/skills/party-mode/SHARED-BOUNDARIES.md +1 -1
  98. package/template/skills/party-mode/SKILL.md +48 -119
  99. package/template/.cowork-flow/scripts/common/gates/spec_validator.py +0 -53
  100. package/template/.cowork-flow/scripts/common/gates/validate_jsonl.py +0 -32
  101. package/template/skills/before-dev/SKILL.md +0 -41
  102. package/template/skills/check/SKILL.md +0 -53
  103. package/template/skills/check/simplification-guide.md +0 -47
  104. package/template/skills/continue/SKILL.md +0 -29
  105. package/template/skills/doubt-review/SKILL.md +0 -118
  106. package/template/skills/finish-work/SKILL.md +0 -32
  107. package/template/skills/party-mode-v2/SKILL.md +0 -75
  108. package/template/skills/start/SKILL.md +0 -78
  109. package/template/skills/tdd/SKILL.md +0 -74
  110. package/template/skills/update-spec/SKILL.md +0 -39
  111. package/template/skills/using-cowork-flow/SKILL.md +0 -80
@@ -17,15 +17,14 @@ if __package__:
17
17
  else:
18
18
  import _bootstrap # noqa: F401
19
19
  from common.task.active_task import (
20
- bind_runtime_context,
21
- close_runtime_context,
22
- read_runtime_context,
23
20
  resolve_context_key,
24
21
  runtime_context_path,
25
22
  sessions_dir,
26
23
  subagent_contexts_dir,
27
- write_runtime_context,
28
- write_subagent_logical_session,
24
+ )
25
+ from application.runtime_context_service import (
26
+ RuntimeContextError,
27
+ RuntimeContextService,
29
28
  )
30
29
  from common.core.execution_context import build_internal_execution_context_parser
31
30
  from common.core.paths import get_repo_root
@@ -170,13 +169,15 @@ def cmd_init(args: argparse.Namespace) -> int:
170
169
  "bound_context_key": None,
171
170
  "closed_at": None,
172
171
  }
173
- write_runtime_context(repo_root, runtime_context_id, context)
174
- logical_context_key = write_subagent_logical_session(
175
- repo_root,
176
- runtime_context_id,
177
- task_dir,
178
- host,
179
- )
172
+ try:
173
+ initialized = RuntimeContextService(repo_root).initialize(
174
+ runtime_context_id,
175
+ context,
176
+ )
177
+ except RuntimeContextError as error:
178
+ print(f"Error: {error.detail}", file=sys.stderr)
179
+ return 1
180
+ logical_context_key = initialized.logical_context_key
180
181
  host_context_key = _suggest_host_context_key(host, runtime_context_id)
181
182
 
182
183
  print(
@@ -206,7 +207,7 @@ def cmd_init(args: argparse.Namespace) -> int:
206
207
 
207
208
 
208
209
  def _find_subagent(repo_root: Path, runtime_context_id: str) -> dict:
209
- context = read_runtime_context(repo_root, runtime_context_id)
210
+ context = RuntimeContextService(repo_root).load(runtime_context_id)
210
211
  if not context:
211
212
  raise FileNotFoundError(runtime_context_id)
212
213
  return context
@@ -233,26 +234,32 @@ def cmd_update(args: argparse.Namespace) -> int:
233
234
  except FileNotFoundError:
234
235
  print(f"Error: subagent not found: {args.subagent_id}", file=sys.stderr)
235
236
  return 1
236
- context["status"] = args.status
237
- context["updated_at"] = _now()
238
- if args.note:
239
- context["note"] = args.note
240
- write_runtime_context(repo_root, args.subagent_id, context)
237
+ try:
238
+ context = RuntimeContextService(repo_root).update(
239
+ args.subagent_id,
240
+ status=args.status,
241
+ note=args.note,
242
+ )
243
+ except RuntimeContextError as error:
244
+ print(f"Error: {error.detail}", file=sys.stderr)
245
+ return 1
246
+ if context is None:
247
+ print(f"Error: subagent not found: {args.subagent_id}", file=sys.stderr)
248
+ return 1
241
249
  print(f"subagent {args.subagent_id} status={args.status}")
242
250
  return 0
243
251
 
244
252
 
245
253
  def cmd_bind(args: argparse.Namespace) -> int:
246
254
  repo_root = get_repo_root()
247
- existing = read_runtime_context(repo_root, args.subagent_id)
248
- existing_key = existing.get("bound_context_key") if existing else None
249
- if isinstance(existing_key, str) and existing_key.strip() and existing_key != args.context_key:
250
- print(
251
- f"Error: runtime context {args.subagent_id} already bound to {existing_key}",
252
- file=sys.stderr,
255
+ try:
256
+ context = RuntimeContextService(repo_root).bind(
257
+ args.subagent_id,
258
+ args.context_key,
253
259
  )
260
+ except RuntimeContextError as error:
261
+ print(f"Error: {error.detail}", file=sys.stderr)
254
262
  return 1
255
- context = bind_runtime_context(repo_root, args.subagent_id, args.context_key)
256
263
  if context is None:
257
264
  print(f"Error: cannot bind runtime context: {args.subagent_id}", file=sys.stderr)
258
265
  return 1
@@ -262,7 +269,12 @@ def cmd_bind(args: argparse.Namespace) -> int:
262
269
 
263
270
  def cmd_close(args: argparse.Namespace) -> int:
264
271
  repo_root = get_repo_root()
265
- if not close_runtime_context(repo_root, args.subagent_id):
272
+ try:
273
+ closed = RuntimeContextService(repo_root).close(args.subagent_id)
274
+ except RuntimeContextError as error:
275
+ print(f"Error: {error.detail}", file=sys.stderr)
276
+ return 1
277
+ if not closed:
266
278
  print(f"Error: subagent not found: {args.subagent_id}", file=sys.stderr)
267
279
  return 1
268
280
  print(f"subagent {args.subagent_id} closed")