@mindfoldhq/trellis 0.6.10 → 0.7.0-beta.1

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 (55) hide show
  1. package/dist/cli/index.d.ts.map +1 -1
  2. package/dist/cli/index.js +20 -2
  3. package/dist/cli/index.js.map +1 -1
  4. package/dist/commands/update.d.ts.map +1 -1
  5. package/dist/commands/update.js +0 -8
  6. package/dist/commands/update.js.map +1 -1
  7. package/dist/commands/workflow.d.ts +17 -0
  8. package/dist/commands/workflow.d.ts.map +1 -1
  9. package/dist/commands/workflow.js +222 -0
  10. package/dist/commands/workflow.js.map +1 -1
  11. package/dist/configurators/opencode.d.ts.map +1 -1
  12. package/dist/configurators/opencode.js +4 -0
  13. package/dist/configurators/opencode.js.map +1 -1
  14. package/dist/configurators/workflow.d.ts +0 -14
  15. package/dist/configurators/workflow.d.ts.map +1 -1
  16. package/dist/configurators/workflow.js +1 -37
  17. package/dist/configurators/workflow.js.map +1 -1
  18. package/dist/migrations/manifests/0.7.0-beta.0.json +9 -0
  19. package/dist/migrations/manifests/0.7.0-beta.1.json +9 -0
  20. package/dist/templates/claude/settings.json +22 -0
  21. package/dist/templates/codex/agents/trellis-check.toml +2 -2
  22. package/dist/templates/codex/agents/trellis-implement.toml +2 -2
  23. package/dist/templates/codex/agents/trellis-research.toml +2 -2
  24. package/dist/templates/codex/hooks/session-start.py +20 -1
  25. package/dist/templates/codex/hooks.json +25 -0
  26. package/dist/templates/common/bundled-skills/trellis-meta/references/platform-files/hooks-and-settings.md +2 -1
  27. package/dist/templates/copilot/hooks/session-start.py +20 -1
  28. package/dist/templates/opencode/plugins/inject-spec-context.js +121 -0
  29. package/dist/templates/opencode/plugins/inject-workflow-state.js +111 -10
  30. package/dist/templates/pi/extensions/trellis/index.ts.txt +61 -4
  31. package/dist/templates/shared-hooks/index.d.ts +8 -2
  32. package/dist/templates/shared-hooks/index.d.ts.map +1 -1
  33. package/dist/templates/shared-hooks/index.js +13 -1
  34. package/dist/templates/shared-hooks/index.js.map +1 -1
  35. package/dist/templates/shared-hooks/inject-spec-context.py +844 -0
  36. package/dist/templates/shared-hooks/inject-subagent-context.py +4 -3
  37. package/dist/templates/shared-hooks/inject-workflow-state.py +35 -9
  38. package/dist/templates/shared-hooks/session-start.py +22 -1
  39. package/dist/templates/trellis/config.yaml +47 -0
  40. package/dist/templates/trellis/index.d.ts +4 -3
  41. package/dist/templates/trellis/index.d.ts.map +1 -1
  42. package/dist/templates/trellis/index.js +7 -3
  43. package/dist/templates/trellis/index.js.map +1 -1
  44. package/dist/templates/trellis/scripts/add_session.py +0 -45
  45. package/dist/templates/trellis/scripts/common/config.py +18 -0
  46. package/dist/templates/trellis/scripts/common/git_context.py +34 -2
  47. package/dist/templates/trellis/scripts/common/paths.py +28 -0
  48. package/dist/templates/trellis/scripts/common/spec_inject.py +439 -0
  49. package/dist/templates/trellis/scripts/common/spec_match.py +395 -0
  50. package/dist/templates/trellis/scripts/common/task_store.py +30 -0
  51. package/dist/templates/trellis/scripts/common/workflow_phase.py +3 -2
  52. package/dist/templates/trellis/scripts/common/workflow_selection.py +177 -0
  53. package/dist/templates/trellis/scripts/task.py +82 -0
  54. package/package.json +2 -2
  55. package/dist/templates/trellis/gitattributes.txt +0 -9
@@ -11,6 +11,7 @@ Usage:
11
11
  python3 task.py start <dir> # Set active task
12
12
  python3 task.py current [--source] [--json] # Show active task
13
13
  python3 task.py finish # Clear active task
14
+ python3 task.py workflow <id>|--clear # Set/clear per-task workflow selection
14
15
  python3 task.py set-branch <dir> <branch> # Set git branch
15
16
  python3 task.py set-base-branch <dir> <branch> # Set PR target branch
16
17
  python3 task.py set-scope <dir> <scope> # Set scope for PR title
@@ -47,6 +48,7 @@ from common.active_task import (
47
48
  from common.io import read_json, write_json
48
49
  from common.task_utils import resolve_task_dir, run_task_hooks
49
50
  from common.tasks import iter_active_tasks, children_progress
51
+ from common.workflow_selection import WORKFLOW_ID_RE, workflow_md_for_task
50
52
 
51
53
  # Import command handlers from split modules (also re-exports for plan.py compatibility)
52
54
  from common.task_store import (
@@ -204,6 +206,72 @@ def cmd_current(args: argparse.Namespace) -> int:
204
206
  return 1
205
207
 
206
208
 
209
+ # =============================================================================
210
+ # Command: workflow
211
+ # =============================================================================
212
+
213
+ def cmd_workflow(args: argparse.Namespace) -> int:
214
+ """Set or clear the workflow selection on the current session's active task."""
215
+ repo_root = get_repo_root()
216
+
217
+ if args.clear and args.id:
218
+ print(colored("Error: pass either <id> or --clear, not both", Colors.RED))
219
+ return 1
220
+ if not args.clear and not args.id:
221
+ print(colored("Error: workflow id required (or --clear)", Colors.RED))
222
+ print("Usage: python3 task.py workflow <id> | --clear")
223
+ return 1
224
+
225
+ active = resolve_active_task(repo_root)
226
+ if not active.task_path:
227
+ print(colored("Error: No current task set", Colors.RED))
228
+ print("Hint: run task.py start <dir> first")
229
+ return 1
230
+
231
+ task_dir = repo_root / active.task_path
232
+ task_json_path = task_dir / FILE_TASK_JSON
233
+ if not task_json_path.is_file():
234
+ print(colored(f"Error: task.json not found at {task_dir}", Colors.RED))
235
+ return 1
236
+
237
+ data = read_json(task_json_path)
238
+ if not data:
239
+ print(colored(f"Error: failed to read {task_json_path}", Colors.RED))
240
+ return 1
241
+
242
+ if args.clear:
243
+ if data.pop("workflow", None) is None:
244
+ print(colored("No workflow selection set on this task", Colors.YELLOW))
245
+ else:
246
+ if not write_json(task_json_path, data):
247
+ print(colored("Error: failed to update task.json", Colors.RED))
248
+ return 1
249
+ print(colored("✓ Workflow selection cleared", Colors.GREEN))
250
+ else:
251
+ workflow_id = args.id
252
+ if not WORKFLOW_ID_RE.match(workflow_id):
253
+ print(colored(
254
+ f"Error: invalid workflow id '{workflow_id}' (allowed: letters, digits, '-', '_')",
255
+ Colors.RED,
256
+ ))
257
+ return 1
258
+ data["workflow"] = workflow_id
259
+ if not write_json(task_json_path, data):
260
+ print(colored("Error: failed to update task.json", Colors.RED))
261
+ return 1
262
+ print(colored(f"✓ Workflow set to: {workflow_id}", Colors.GREEN))
263
+
264
+ # workflow_md_for_task warns on stderr itself when the selected variant
265
+ # file is missing (it can be saved later via `trellis workflow --save`).
266
+ effective = workflow_md_for_task(repo_root, task_dir)
267
+ try:
268
+ effective_display = effective.relative_to(repo_root).as_posix()
269
+ except ValueError:
270
+ effective_display = str(effective)
271
+ print(f"Effective workflow: {effective_display}")
272
+ return 0
273
+
274
+
207
275
  # =============================================================================
208
276
  # Command: list
209
277
  # =============================================================================
@@ -382,12 +450,15 @@ Usage:
382
450
  python3 task.py create <title> --package <pkg> Create task for a specific package
383
451
  python3 task.py create <title> --parent <dir> Create task as child of parent
384
452
  python3 task.py create <title> --no-start Create without making it active in this session
453
+ python3 task.py create <title> --workflow <id> Create task pinned to a workflow variant
385
454
  python3 task.py add-context <dir> <jsonl> <path> [reason] Add entry to jsonl
386
455
  python3 task.py validate <dir> Validate jsonl files
387
456
  python3 task.py list-context <dir> List jsonl entries
388
457
  python3 task.py start <dir> Set active task
389
458
  python3 task.py current [--source] Show active task
390
459
  python3 task.py finish Clear active task
460
+ python3 task.py workflow <id> Select workflow variant for active task
461
+ python3 task.py workflow --clear Clear selection (use default resolution)
391
462
  python3 task.py set-branch <dir> <branch> Set git branch
392
463
  python3 task.py set-base-branch <dir> <branch> Set PR target branch
393
464
  python3 task.py set-scope <dir> <scope> Set scope for PR title
@@ -490,6 +561,10 @@ def main() -> int:
490
561
  action="store_true",
491
562
  help="Create the task without making it active in this session",
492
563
  )
564
+ p_create.add_argument(
565
+ "--workflow",
566
+ help="Workflow variant id for this task (.trellis/workflows/<id>.md)",
567
+ )
493
568
 
494
569
  # add-context
495
570
  p_add = subparsers.add_parser("add-context", help="Add context entry")
@@ -520,6 +595,12 @@ def main() -> int:
520
595
  # finish
521
596
  subparsers.add_parser("finish", help="Clear active task")
522
597
 
598
+ # workflow
599
+ p_workflow = subparsers.add_parser("workflow", help="Set/clear per-task workflow selection")
600
+ p_workflow.add_argument("id", nargs="?", help="Workflow id (.trellis/workflows/<id>.md)")
601
+ p_workflow.add_argument("--clear", action="store_true",
602
+ help="Remove the workflow selection (use default resolution)")
603
+
523
604
  # set-branch
524
605
  p_branch = subparsers.add_parser("set-branch", help="Set git branch")
525
606
  p_branch.add_argument("dir", help="Task directory")
@@ -580,6 +661,7 @@ def main() -> int:
580
661
  "start": cmd_start,
581
662
  "current": cmd_current,
582
663
  "finish": cmd_finish,
664
+ "workflow": cmd_workflow,
583
665
  "set-branch": cmd_set_branch,
584
666
  "set-base-branch": cmd_set_base_branch,
585
667
  "set-scope": cmd_set_scope,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mindfoldhq/trellis",
3
- "version": "0.6.10",
3
+ "version": "0.7.0-beta.1",
4
4
  "description": "AI capabilities grow like ivy — Trellis provides the structure to guide them along a disciplined path",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -34,7 +34,7 @@
34
34
  "inquirer": "^9.3.7",
35
35
  "undici": "^6.21.0",
36
36
  "zod": "^4.4.2",
37
- "@mindfoldhq/trellis-core": "0.6.10"
37
+ "@mindfoldhq/trellis-core": "0.7.0-beta.1"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@eslint/js": "^9.18.0",
@@ -1,9 +0,0 @@
1
- # Trellis: append-only developer journals should merge cleanly across
2
- # parallel sessions/worktrees — each session only appends a new block, so
3
- # there is nothing to actually conflict on.
4
- #
5
- # Do NOT add a rule for workspace/*/index.md here — it is fully regenerated
6
- # every session, so a real conflict there is expected and safe to resolve by
7
- # picking either side (task state lives in task.json, not index.md). See
8
- # .trellis/spec/cli/backend/directory-structure.md for details.
9
- .trellis/workspace/*/journal-*.md merge=union