@mindfoldhq/trellis 0.6.0-beta.9 → 0.6.0-rc.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 +49 -49
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +36 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/channel/adapters/claude.d.ts +29 -0
- package/dist/commands/channel/adapters/claude.d.ts.map +1 -0
- package/dist/commands/channel/adapters/claude.js +203 -0
- package/dist/commands/channel/adapters/claude.js.map +1 -0
- package/dist/commands/channel/adapters/codex.d.ts +85 -0
- package/dist/commands/channel/adapters/codex.d.ts.map +1 -0
- package/dist/commands/channel/adapters/codex.js +505 -0
- package/dist/commands/channel/adapters/codex.js.map +1 -0
- package/dist/commands/channel/adapters/index.d.ts +84 -0
- package/dist/commands/channel/adapters/index.d.ts.map +1 -0
- package/dist/commands/channel/adapters/index.js +115 -0
- package/dist/commands/channel/adapters/index.js.map +1 -0
- package/dist/commands/channel/adapters/types.d.ts +33 -0
- package/dist/commands/channel/adapters/types.d.ts.map +1 -0
- package/dist/commands/channel/adapters/types.js +2 -0
- package/dist/commands/channel/adapters/types.js.map +1 -0
- package/dist/commands/channel/agent-loader.d.ts +32 -0
- package/dist/commands/channel/agent-loader.d.ts.map +1 -0
- package/dist/commands/channel/agent-loader.js +154 -0
- package/dist/commands/channel/agent-loader.js.map +1 -0
- package/dist/commands/channel/context-loader.d.ts +26 -0
- package/dist/commands/channel/context-loader.d.ts.map +1 -0
- package/dist/commands/channel/context-loader.js +290 -0
- package/dist/commands/channel/context-loader.js.map +1 -0
- package/dist/commands/channel/context.d.ts +16 -0
- package/dist/commands/channel/context.d.ts.map +1 -0
- package/dist/commands/channel/context.js +83 -0
- package/dist/commands/channel/context.js.map +1 -0
- package/dist/commands/channel/create.d.ts +27 -0
- package/dist/commands/channel/create.d.ts.map +1 -0
- package/dist/commands/channel/create.js +39 -0
- package/dist/commands/channel/create.js.map +1 -0
- package/dist/commands/channel/dev-parse-trace.d.ts +14 -0
- package/dist/commands/channel/dev-parse-trace.d.ts.map +1 -0
- package/dist/commands/channel/dev-parse-trace.js +70 -0
- package/dist/commands/channel/dev-parse-trace.js.map +1 -0
- package/dist/commands/channel/guard.d.ts +150 -0
- package/dist/commands/channel/guard.d.ts.map +1 -0
- package/dist/commands/channel/guard.js +474 -0
- package/dist/commands/channel/guard.js.map +1 -0
- package/dist/commands/channel/index.d.ts +3 -0
- package/dist/commands/channel/index.d.ts.map +1 -0
- package/dist/commands/channel/index.js +531 -0
- package/dist/commands/channel/index.js.map +1 -0
- package/dist/commands/channel/interrupt.d.ts +10 -0
- package/dist/commands/channel/interrupt.d.ts.map +1 -0
- package/dist/commands/channel/interrupt.js +22 -0
- package/dist/commands/channel/interrupt.js.map +1 -0
- package/dist/commands/channel/kill.d.ts +7 -0
- package/dist/commands/channel/kill.d.ts.map +1 -0
- package/dist/commands/channel/kill.js +121 -0
- package/dist/commands/channel/kill.js.map +1 -0
- package/dist/commands/channel/list.d.ts +17 -0
- package/dist/commands/channel/list.d.ts.map +1 -0
- package/dist/commands/channel/list.js +233 -0
- package/dist/commands/channel/list.js.map +1 -0
- package/dist/commands/channel/messages.d.ts +15 -0
- package/dist/commands/channel/messages.d.ts.map +1 -0
- package/dist/commands/channel/messages.js +245 -0
- package/dist/commands/channel/messages.js.map +1 -0
- package/dist/commands/channel/rm.d.ts +27 -0
- package/dist/commands/channel/rm.d.ts.map +1 -0
- package/dist/commands/channel/rm.js +216 -0
- package/dist/commands/channel/rm.js.map +1 -0
- package/dist/commands/channel/run.d.ts +30 -0
- package/dist/commands/channel/run.d.ts.map +1 -0
- package/dist/commands/channel/run.js +130 -0
- package/dist/commands/channel/run.js.map +1 -0
- package/dist/commands/channel/send.d.ts +11 -0
- package/dist/commands/channel/send.d.ts.map +1 -0
- package/dist/commands/channel/send.js +24 -0
- package/dist/commands/channel/send.js.map +1 -0
- package/dist/commands/channel/spawn.d.ts +40 -0
- package/dist/commands/channel/spawn.d.ts.map +1 -0
- package/dist/commands/channel/spawn.js +244 -0
- package/dist/commands/channel/spawn.js.map +1 -0
- package/dist/commands/channel/store/events.d.ts +39 -0
- package/dist/commands/channel/store/events.d.ts.map +1 -0
- package/dist/commands/channel/store/events.js +87 -0
- package/dist/commands/channel/store/events.js.map +1 -0
- package/dist/commands/channel/store/filter.d.ts +3 -0
- package/dist/commands/channel/store/filter.d.ts.map +1 -0
- package/dist/commands/channel/store/filter.js +2 -0
- package/dist/commands/channel/store/filter.js.map +1 -0
- package/dist/commands/channel/store/lock.d.ts +23 -0
- package/dist/commands/channel/store/lock.d.ts.map +1 -0
- package/dist/commands/channel/store/lock.js +99 -0
- package/dist/commands/channel/store/lock.js.map +1 -0
- package/dist/commands/channel/store/paths.d.ts +63 -0
- package/dist/commands/channel/store/paths.d.ts.map +1 -0
- package/dist/commands/channel/store/paths.js +246 -0
- package/dist/commands/channel/store/paths.js.map +1 -0
- package/dist/commands/channel/store/schema.d.ts +27 -0
- package/dist/commands/channel/store/schema.d.ts.map +1 -0
- package/dist/commands/channel/store/schema.js +34 -0
- package/dist/commands/channel/store/schema.js.map +1 -0
- package/dist/commands/channel/store/thread-state.d.ts +5 -0
- package/dist/commands/channel/store/thread-state.d.ts.map +1 -0
- package/dist/commands/channel/store/thread-state.js +16 -0
- package/dist/commands/channel/store/thread-state.js.map +1 -0
- package/dist/commands/channel/store/watch.d.ts +19 -0
- package/dist/commands/channel/store/watch.d.ts.map +1 -0
- package/dist/commands/channel/store/watch.js +146 -0
- package/dist/commands/channel/store/watch.js.map +1 -0
- package/dist/commands/channel/supervisor/idle.d.ts +46 -0
- package/dist/commands/channel/supervisor/idle.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/idle.js +72 -0
- package/dist/commands/channel/supervisor/idle.js.map +1 -0
- package/dist/commands/channel/supervisor/inbox.d.ts +30 -0
- package/dist/commands/channel/supervisor/inbox.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/inbox.js +160 -0
- package/dist/commands/channel/supervisor/inbox.js.map +1 -0
- package/dist/commands/channel/supervisor/shutdown.d.ts +68 -0
- package/dist/commands/channel/supervisor/shutdown.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/shutdown.js +146 -0
- package/dist/commands/channel/supervisor/shutdown.js.map +1 -0
- package/dist/commands/channel/supervisor/stdout.d.ts +51 -0
- package/dist/commands/channel/supervisor/stdout.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/stdout.js +121 -0
- package/dist/commands/channel/supervisor/stdout.js.map +1 -0
- package/dist/commands/channel/supervisor/turns.d.ts +31 -0
- package/dist/commands/channel/supervisor/turns.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/turns.js +45 -0
- package/dist/commands/channel/supervisor/turns.js.map +1 -0
- package/dist/commands/channel/supervisor/warning.d.ts +48 -0
- package/dist/commands/channel/supervisor/warning.d.ts.map +1 -0
- package/dist/commands/channel/supervisor/warning.js +77 -0
- package/dist/commands/channel/supervisor/warning.js.map +1 -0
- package/dist/commands/channel/supervisor.d.ts +59 -0
- package/dist/commands/channel/supervisor.d.ts.map +1 -0
- package/dist/commands/channel/supervisor.js +344 -0
- package/dist/commands/channel/supervisor.js.map +1 -0
- package/dist/commands/channel/text-body.d.ts +13 -0
- package/dist/commands/channel/text-body.d.ts.map +1 -0
- package/dist/commands/channel/text-body.js +47 -0
- package/dist/commands/channel/text-body.js.map +1 -0
- package/dist/commands/channel/threads.d.ts +39 -0
- package/dist/commands/channel/threads.d.ts.map +1 -0
- package/dist/commands/channel/threads.js +106 -0
- package/dist/commands/channel/threads.js.map +1 -0
- package/dist/commands/channel/title.d.ts +12 -0
- package/dist/commands/channel/title.d.ts.map +1 -0
- package/dist/commands/channel/title.js +24 -0
- package/dist/commands/channel/title.js.map +1 -0
- package/dist/commands/channel/wait.d.ts +17 -0
- package/dist/commands/channel/wait.d.ts.map +1 -0
- package/dist/commands/channel/wait.js +75 -0
- package/dist/commands/channel/wait.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +162 -43
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/mem.d.ts +13 -217
- package/dist/commands/mem.d.ts.map +1 -1
- package/dist/commands/mem.js +142 -1587
- package/dist/commands/mem.js.map +1 -1
- package/dist/commands/uninstall.d.ts.map +1 -1
- package/dist/commands/uninstall.js +28 -2
- package/dist/commands/uninstall.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +102 -5
- package/dist/commands/update.js.map +1 -1
- package/dist/commands/workflow.d.ts +35 -0
- package/dist/commands/workflow.d.ts.map +1 -0
- package/dist/commands/workflow.js +232 -0
- package/dist/commands/workflow.js.map +1 -0
- package/dist/configurators/claude.d.ts.map +1 -1
- package/dist/configurators/claude.js +1 -0
- package/dist/configurators/claude.js.map +1 -1
- package/dist/configurators/index.d.ts.map +1 -1
- package/dist/configurators/index.js +5 -0
- package/dist/configurators/index.js.map +1 -1
- package/dist/configurators/reasonix.d.ts +23 -0
- package/dist/configurators/reasonix.d.ts.map +1 -0
- package/dist/configurators/reasonix.js +60 -0
- package/dist/configurators/reasonix.js.map +1 -0
- package/dist/configurators/shared.d.ts.map +1 -1
- package/dist/configurators/shared.js +8 -0
- package/dist/configurators/shared.js.map +1 -1
- package/dist/configurators/workflow.d.ts +8 -0
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +14 -3
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/constants/paths.d.ts +4 -0
- package/dist/constants/paths.d.ts.map +1 -1
- package/dist/constants/paths.js +4 -0
- package/dist/constants/paths.js.map +1 -1
- package/dist/migrations/manifests/0.5.14.json +9 -0
- package/dist/migrations/manifests/0.5.15.json +9 -0
- package/dist/migrations/manifests/0.5.16.json +9 -0
- package/dist/migrations/manifests/0.5.17.json +9 -0
- package/dist/migrations/manifests/0.5.18.json +9 -0
- package/dist/migrations/manifests/0.5.19.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.10.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.11.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.12.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.13.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.14.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.15.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.16.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.17.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.18.json +16 -0
- package/dist/migrations/manifests/0.6.0-beta.19.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.20.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.21.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.22.json +9 -0
- package/dist/migrations/manifests/0.6.0-beta.23.json +88 -0
- package/dist/migrations/manifests/0.6.0-rc.0.json +9 -0
- package/dist/templates/claude/agents/trellis-check.md +12 -6
- package/dist/templates/claude/agents/trellis-implement.md +1 -1
- package/dist/templates/claude/agents/trellis-research.md +1 -1
- package/dist/templates/codebuddy/agents/trellis-check.md +12 -6
- package/dist/templates/codebuddy/agents/trellis-implement.md +1 -1
- package/dist/templates/codebuddy/agents/trellis-research.md +1 -1
- package/dist/templates/codex/agents/trellis-check.toml +0 -25
- package/dist/templates/codex/agents/trellis-implement.toml +0 -25
- package/dist/templates/codex/config.toml +9 -16
- package/dist/templates/codex/hooks/session-start.py +22 -0
- package/dist/templates/codex/hooks.json +1 -1
- package/dist/templates/common/bundled-skills/trellis-meta/references/local-architecture/task-system.md +27 -0
- package/dist/templates/common/bundled-skills/trellis-session-insight/SKILL.md +81 -0
- package/dist/templates/common/bundled-skills/trellis-session-insight/references/cli-quick-reference.md +66 -0
- package/dist/templates/common/bundled-skills/trellis-session-insight/references/triggering-patterns.md +93 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/SKILL.md +41 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/mcp-setup.md +90 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/repository-analysis.md +59 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-task-planning.md +61 -0
- package/dist/templates/common/bundled-skills/trellis-spec-bootstrap/references/spec-writing.md +70 -0
- package/dist/templates/copilot/hooks/session-start.py +24 -0
- package/dist/templates/cursor/agents/trellis-check.md +12 -6
- package/dist/templates/cursor/agents/trellis-implement.md +1 -1
- package/dist/templates/cursor/agents/trellis-research.md +1 -1
- package/dist/templates/cursor/hooks.json +0 -6
- package/dist/templates/droid/droids/trellis-check.md +12 -6
- package/dist/templates/droid/droids/trellis-implement.md +1 -1
- package/dist/templates/droid/droids/trellis-research.md +1 -1
- package/dist/templates/gemini/agents/trellis-check.md +11 -5
- package/dist/templates/kiro/agents/trellis-check.json +1 -1
- package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +127 -9
- package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +130 -0
- package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +38 -0
- package/dist/templates/markdown/spec/guides/index.md.txt +18 -0
- package/dist/templates/opencode/agents/trellis-check.md +11 -5
- package/dist/templates/pi/agents/trellis-check.md +5 -4
- package/dist/templates/pi/agents/trellis-implement.md +5 -4
- package/dist/templates/pi/extensions/trellis/index.ts.txt +1339 -913
- package/dist/templates/pi/settings.json +0 -9
- package/dist/templates/qoder/agents/trellis-check.md +12 -6
- package/dist/templates/qoder/agents/trellis-implement.md +1 -1
- package/dist/templates/qoder/agents/trellis-research.md +1 -1
- package/dist/templates/reasonix/agents/trellis-check.md +36 -0
- package/dist/templates/reasonix/agents/trellis-implement.md +41 -0
- package/dist/templates/reasonix/index.d.ts +13 -0
- package/dist/templates/reasonix/index.d.ts.map +1 -0
- package/dist/templates/reasonix/index.js +16 -0
- package/dist/templates/reasonix/index.js.map +1 -0
- package/dist/templates/shared-hooks/index.d.ts.map +1 -1
- package/dist/templates/shared-hooks/index.js +0 -1
- package/dist/templates/shared-hooks/index.js.map +1 -1
- package/dist/templates/shared-hooks/inject-workflow-state.py +22 -0
- package/dist/templates/shared-hooks/session-start.py +25 -8
- package/dist/templates/trellis/agents/check.md +70 -0
- package/dist/templates/trellis/agents/implement.md +71 -0
- package/dist/templates/trellis/config.yaml +20 -0
- package/dist/templates/trellis/index.d.ts +13 -0
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +22 -0
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/common/safe_commit.py +49 -19
- package/dist/templates/trellis/scripts/common/task_store.py +94 -16
- package/dist/templates/trellis/workflow.md +21 -0
- package/dist/types/ai-tools.d.ts +4 -4
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +16 -0
- package/dist/types/ai-tools.js.map +1 -1
- package/dist/utils/agent-refs.d.ts +31 -0
- package/dist/utils/agent-refs.d.ts.map +1 -0
- package/dist/utils/agent-refs.js +63 -0
- package/dist/utils/agent-refs.js.map +1 -0
- package/dist/utils/cwd-guard.d.ts +38 -0
- package/dist/utils/cwd-guard.d.ts.map +1 -0
- package/dist/utils/cwd-guard.js +62 -0
- package/dist/utils/cwd-guard.js.map +1 -0
- package/dist/utils/file-writer.d.ts +13 -0
- package/dist/utils/file-writer.d.ts.map +1 -1
- package/dist/utils/file-writer.js +59 -1
- package/dist/utils/file-writer.js.map +1 -1
- package/dist/utils/manifest-prune.d.ts +61 -0
- package/dist/utils/manifest-prune.d.ts.map +1 -0
- package/dist/utils/manifest-prune.js +136 -0
- package/dist/utils/manifest-prune.js.map +1 -0
- package/dist/utils/registry-config.d.ts +7 -0
- package/dist/utils/registry-config.d.ts.map +1 -0
- package/dist/utils/registry-config.js +171 -0
- package/dist/utils/registry-config.js.map +1 -0
- package/dist/utils/task-json.d.ts +9 -42
- package/dist/utils/task-json.d.ts.map +1 -1
- package/dist/utils/task-json.js +8 -45
- package/dist/utils/task-json.js.map +1 -1
- package/dist/utils/template-fetcher.d.ts +11 -0
- package/dist/utils/template-fetcher.d.ts.map +1 -1
- package/dist/utils/template-fetcher.js +51 -2
- package/dist/utils/template-fetcher.js.map +1 -1
- package/dist/utils/template-hash.d.ts +32 -6
- package/dist/utils/template-hash.d.ts.map +1 -1
- package/dist/utils/template-hash.js +53 -31
- package/dist/utils/template-hash.js.map +1 -1
- package/dist/utils/workflow-resolver.d.ts +86 -0
- package/dist/utils/workflow-resolver.d.ts.map +1 -0
- package/dist/utils/workflow-resolver.js +265 -0
- package/dist/utils/workflow-resolver.js.map +1 -0
- package/package.json +9 -8
|
@@ -111,31 +111,61 @@ def safe_trellis_paths_to_add(repo_root: Path) -> list[str]:
|
|
|
111
111
|
return paths
|
|
112
112
|
|
|
113
113
|
|
|
114
|
-
def safe_archive_paths_to_add(
|
|
114
|
+
def safe_archive_paths_to_add(
|
|
115
|
+
repo_root: Path,
|
|
116
|
+
task_name: str | None = None,
|
|
117
|
+
modified_children: list[str] | None = None,
|
|
118
|
+
) -> list[str]:
|
|
115
119
|
"""Return paths to stage after `task.py archive`.
|
|
116
120
|
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
121
|
+
Scoped to ONLY the paths the archive operation actually touched:
|
|
122
|
+
|
|
123
|
+
- the archive subtree (where the freshly-moved task lives)
|
|
124
|
+
- the source task directory (for source-side deletes; caller pairs
|
|
125
|
+
this with `git rm --cached` since `git add` won't stage deletes
|
|
126
|
+
for a path that no longer exists in the working tree)
|
|
127
|
+
- any child task directories whose `task.json` was edited to drop
|
|
128
|
+
the archived parent (parent-children relationship update)
|
|
129
|
+
|
|
130
|
+
This narrow scope avoids "scope creep" — dirty changes in OTHER
|
|
131
|
+
active task dirs (parallel-window edits) are NOT bundled into the
|
|
132
|
+
archive commit. Callers handle each kind of change in its own
|
|
133
|
+
commit boundary.
|
|
134
|
+
|
|
135
|
+
Backwards-compat: with no arguments, the function walks the whole
|
|
136
|
+
`.trellis/tasks/` subtree the old way (active tasks + archive). New
|
|
137
|
+
callers should always pass `task_name`.
|
|
122
138
|
"""
|
|
123
139
|
paths: list[str] = []
|
|
124
140
|
tasks_dir = repo_root / DIR_WORKFLOW / DIR_TASKS
|
|
125
|
-
if tasks_dir.is_dir():
|
|
126
|
-
|
|
127
|
-
|
|
141
|
+
if not tasks_dir.is_dir():
|
|
142
|
+
return paths
|
|
143
|
+
|
|
144
|
+
archive_dir = tasks_dir / DIR_ARCHIVE
|
|
145
|
+
|
|
146
|
+
if task_name is not None:
|
|
147
|
+
# Narrow scope — only paths that still exist on disk (so
|
|
148
|
+
# `git add` doesn't choke on the moved-away source). The caller
|
|
149
|
+
# handles the source-side deletes via `git rm --cached`
|
|
150
|
+
# explicitly.
|
|
128
151
|
if archive_dir.is_dir():
|
|
129
|
-
paths.append(
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
152
|
+
paths.append(
|
|
153
|
+
f"{DIR_WORKFLOW}/{DIR_TASKS}/{DIR_ARCHIVE}"
|
|
154
|
+
)
|
|
155
|
+
for child_name in modified_children or []:
|
|
156
|
+
paths.append(f"{DIR_WORKFLOW}/{DIR_TASKS}/{child_name}")
|
|
157
|
+
return paths
|
|
158
|
+
|
|
159
|
+
# Legacy wide scope (no task_name): preserve old behavior so callers
|
|
160
|
+
# that have not been updated keep working.
|
|
161
|
+
if archive_dir.is_dir():
|
|
162
|
+
paths.append(f"{DIR_WORKFLOW}/{DIR_TASKS}/{DIR_ARCHIVE}")
|
|
163
|
+
for child in sorted(tasks_dir.iterdir()):
|
|
164
|
+
if not child.is_dir():
|
|
165
|
+
continue
|
|
166
|
+
if child.name == DIR_ARCHIVE:
|
|
167
|
+
continue
|
|
168
|
+
paths.append(f"{DIR_WORKFLOW}/{DIR_TASKS}/{child.name}")
|
|
139
169
|
return paths
|
|
140
170
|
|
|
141
171
|
|
|
@@ -83,6 +83,30 @@ def ensure_tasks_dir(repo_root: Path) -> Path:
|
|
|
83
83
|
return tasks_dir
|
|
84
84
|
|
|
85
85
|
|
|
86
|
+
def _find_archived_task_by_dir_name(tasks_dir: Path, dir_name: str) -> Path | None:
|
|
87
|
+
"""Find an archived task directory with the exact active-task dir name."""
|
|
88
|
+
archive_dir = tasks_dir / DIR_ARCHIVE
|
|
89
|
+
if not archive_dir.is_dir():
|
|
90
|
+
return None
|
|
91
|
+
|
|
92
|
+
for month_dir in sorted(archive_dir.iterdir()):
|
|
93
|
+
if not month_dir.is_dir():
|
|
94
|
+
continue
|
|
95
|
+
candidate = month_dir / dir_name
|
|
96
|
+
if candidate.is_dir():
|
|
97
|
+
return candidate
|
|
98
|
+
|
|
99
|
+
return None
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def _repo_relative_path(path: Path, repo_root: Path) -> str:
|
|
103
|
+
"""Format a path relative to the repo root when possible."""
|
|
104
|
+
try:
|
|
105
|
+
return path.relative_to(repo_root).as_posix()
|
|
106
|
+
except ValueError:
|
|
107
|
+
return str(path)
|
|
108
|
+
|
|
109
|
+
|
|
86
110
|
# =============================================================================
|
|
87
111
|
# Sub-agent platform detection + JSONL seeding
|
|
88
112
|
# =============================================================================
|
|
@@ -219,6 +243,13 @@ def cmd_create(args: argparse.Namespace) -> int:
|
|
|
219
243
|
task_dir = tasks_dir / dir_name
|
|
220
244
|
task_json_path = task_dir / FILE_TASK_JSON
|
|
221
245
|
|
|
246
|
+
archived_task_dir = _find_archived_task_by_dir_name(tasks_dir, dir_name)
|
|
247
|
+
if archived_task_dir:
|
|
248
|
+
print(colored(f"Error: Task already archived: {dir_name}", Colors.RED), file=sys.stderr)
|
|
249
|
+
print(f"Archived at: {_repo_relative_path(archived_task_dir, repo_root)}", file=sys.stderr)
|
|
250
|
+
print("Use a new slug if you intend to create a new task.", file=sys.stderr)
|
|
251
|
+
return 1
|
|
252
|
+
|
|
222
253
|
if task_dir.exists():
|
|
223
254
|
print(colored(f"Warning: Task directory already exists: {dir_name}", Colors.YELLOW), file=sys.stderr)
|
|
224
255
|
else:
|
|
@@ -369,6 +400,9 @@ def cmd_archive(args: argparse.Namespace) -> int:
|
|
|
369
400
|
|
|
370
401
|
# Update status before archiving
|
|
371
402
|
today = datetime.now().strftime("%Y-%m-%d")
|
|
403
|
+
# Names of child task dirs whose task.json gets modified below; passed
|
|
404
|
+
# into safe_archive_paths_to_add so they're staged in this commit.
|
|
405
|
+
modified_children: list[str] = []
|
|
372
406
|
if task_json_path.is_file():
|
|
373
407
|
data = read_json(task_json_path)
|
|
374
408
|
if data:
|
|
@@ -393,6 +427,7 @@ def cmd_archive(args: argparse.Namespace) -> int:
|
|
|
393
427
|
if child_data:
|
|
394
428
|
child_data["parent"] = None
|
|
395
429
|
write_json(child_json, child_data)
|
|
430
|
+
modified_children.append(child_dir_path.name)
|
|
396
431
|
|
|
397
432
|
# Clear any session that still points at this task before the path moves.
|
|
398
433
|
from .active_task import clear_task_from_sessions
|
|
@@ -407,7 +442,16 @@ def cmd_archive(args: argparse.Namespace) -> int:
|
|
|
407
442
|
|
|
408
443
|
# Auto-commit unless --no-commit
|
|
409
444
|
if not getattr(args, "no_commit", False):
|
|
410
|
-
_auto_commit_archive(dir_name, repo_root)
|
|
445
|
+
if not _auto_commit_archive(dir_name, repo_root, modified_children):
|
|
446
|
+
print(
|
|
447
|
+
colored(
|
|
448
|
+
"Archive moved on disk, but git auto-commit did not complete. "
|
|
449
|
+
"Resolve `git status` before continuing.",
|
|
450
|
+
Colors.RED,
|
|
451
|
+
),
|
|
452
|
+
file=sys.stderr,
|
|
453
|
+
)
|
|
454
|
+
return 1
|
|
411
455
|
|
|
412
456
|
# Return the archive path
|
|
413
457
|
print(f"{DIR_WORKFLOW}/{DIR_TASKS}/{DIR_ARCHIVE}/{year_month}/{dir_name}")
|
|
@@ -420,30 +464,47 @@ def cmd_archive(args: argparse.Namespace) -> int:
|
|
|
420
464
|
return 1
|
|
421
465
|
|
|
422
466
|
|
|
423
|
-
def _auto_commit_archive(
|
|
467
|
+
def _auto_commit_archive(
|
|
468
|
+
task_name: str,
|
|
469
|
+
repo_root: Path,
|
|
470
|
+
modified_children: list[str] | None = None,
|
|
471
|
+
) -> bool:
|
|
424
472
|
"""Stage Trellis-owned task paths and commit after archive.
|
|
425
473
|
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
caches/backups) and points users at ``session_auto_commit: false``.
|
|
474
|
+
Scoped narrowly to the archived task's source + destination paths
|
|
475
|
+
plus any child task dirs whose ``task.json`` was edited (parent →
|
|
476
|
+
children relationship update). Dirty changes in OTHER active task
|
|
477
|
+
dirs are NOT bundled into the archive commit.
|
|
431
478
|
|
|
432
|
-
|
|
433
|
-
``
|
|
434
|
-
|
|
479
|
+
If ``.gitignore`` blocks the paths, we warn + skip — we do NOT
|
|
480
|
+
retry with ``git add -f``. The warning explicitly forbids
|
|
481
|
+
``git add -f .trellis/`` (which would fan out to caches/backups)
|
|
482
|
+
and points users at ``session_auto_commit: false``.
|
|
483
|
+
|
|
484
|
+
Honors ``session_auto_commit`` in ``.trellis/config.yaml``: when
|
|
485
|
+
set to ``false``, this function returns immediately without
|
|
486
|
+
touching git (the archive directory move on disk is unaffected).
|
|
435
487
|
"""
|
|
436
488
|
if not get_session_auto_commit(repo_root):
|
|
437
489
|
print(
|
|
438
490
|
"[OK] session_auto_commit: false — skipping git stage/commit.",
|
|
439
491
|
file=sys.stderr,
|
|
440
492
|
)
|
|
441
|
-
return
|
|
493
|
+
return True
|
|
442
494
|
|
|
443
|
-
|
|
495
|
+
source_rel = f"{DIR_WORKFLOW}/{DIR_TASKS}/{task_name}"
|
|
496
|
+
rc, tracked_out, _ = run_git(
|
|
497
|
+
["ls-files", "--", source_rel],
|
|
498
|
+
cwd=repo_root,
|
|
499
|
+
)
|
|
500
|
+
source_was_tracked = rc == 0 and bool(tracked_out.strip())
|
|
501
|
+
|
|
502
|
+
paths = safe_archive_paths_to_add(
|
|
503
|
+
repo_root, task_name=task_name, modified_children=modified_children
|
|
504
|
+
)
|
|
444
505
|
if not paths:
|
|
445
506
|
print("[OK] No task changes to commit.", file=sys.stderr)
|
|
446
|
-
return
|
|
507
|
+
return True
|
|
447
508
|
|
|
448
509
|
success, _, err = safe_git_add(paths, repo_root)
|
|
449
510
|
if not success:
|
|
@@ -454,21 +515,38 @@ def _auto_commit_archive(task_name: str, repo_root: Path) -> None:
|
|
|
454
515
|
f"[WARN] git add failed: {err.strip() if err else 'unknown error'}",
|
|
455
516
|
file=sys.stderr,
|
|
456
517
|
)
|
|
457
|
-
return
|
|
518
|
+
return not source_was_tracked
|
|
519
|
+
|
|
520
|
+
# Belt-and-suspenders for the phantom-delete bug: `safe_git_add` uses
|
|
521
|
+
# `git add` (no -A) which only stages additions/modifications. The
|
|
522
|
+
# source task directory was moved away by `shutil.move`, so its files
|
|
523
|
+
# need an explicit `git rm --cached` to stage the deletions in this
|
|
524
|
+
# same commit — otherwise they sit as uncommitted "phantom deletes"
|
|
525
|
+
# against HEAD until something later picks them up.
|
|
526
|
+
#
|
|
527
|
+
# `--ignore-unmatch` makes this a no-op when the task was never tracked
|
|
528
|
+
# (e.g. archiving a task that lived only in working tree).
|
|
529
|
+
run_git(
|
|
530
|
+
["rm", "-r", "--cached", "--ignore-unmatch", "--", source_rel],
|
|
531
|
+
cwd=repo_root,
|
|
532
|
+
)
|
|
458
533
|
|
|
459
534
|
rc, _, _ = run_git(
|
|
460
|
-
["diff", "--cached", "--quiet", "--", *paths],
|
|
535
|
+
["diff", "--cached", "--quiet", "--", *paths, source_rel],
|
|
536
|
+
cwd=repo_root,
|
|
461
537
|
)
|
|
462
538
|
if rc == 0:
|
|
463
539
|
print("[OK] No task changes to commit.", file=sys.stderr)
|
|
464
|
-
return
|
|
540
|
+
return True
|
|
465
541
|
|
|
466
542
|
commit_msg = f"chore(task): archive {task_name}"
|
|
467
543
|
rc, _, err = run_git(["commit", "-m", commit_msg], cwd=repo_root)
|
|
468
544
|
if rc == 0:
|
|
469
545
|
print(f"[OK] Auto-committed: {commit_msg}", file=sys.stderr)
|
|
546
|
+
return True
|
|
470
547
|
else:
|
|
471
548
|
print(f"[WARN] Auto-commit failed: {err.strip()}", file=sys.stderr)
|
|
549
|
+
return not source_was_tracked
|
|
472
550
|
|
|
473
551
|
|
|
474
552
|
# =============================================================================
|
|
@@ -163,6 +163,14 @@ Phase 3: Finish → verify, update spec, commit, and wrap up
|
|
|
163
163
|
- `implement.jsonl` / `check.jsonl` — spec and research manifests for sub-agent context. They do not replace `implement.md`.
|
|
164
164
|
- Lightweight tasks may be PRD-only. Complex tasks must have `prd.md`, `design.md`, and `implement.md` before `task.py start`.
|
|
165
165
|
|
|
166
|
+
### Parent / Child Task Trees
|
|
167
|
+
|
|
168
|
+
Use a parent task when one user request contains several independently verifiable deliverables. The parent task owns the source requirement set, the task map, cross-child acceptance criteria, and final integration review; it normally should not be the implementation target unless it also has direct work.
|
|
169
|
+
|
|
170
|
+
Use child tasks for deliverables that can be planned, implemented, checked, and archived independently. Parent/child structure is not a dependency system: if one child must wait for another, write that ordering in the child `prd.md` / `implement.md` and keep each child's acceptance criteria testable.
|
|
171
|
+
|
|
172
|
+
Create new children with `task.py create "<title>" --slug <name> --parent <parent-dir>`. Link existing tasks with `task.py add-subtask <parent> <child>`, and unlink mistakes with `task.py remove-subtask <parent> <child>`.
|
|
173
|
+
|
|
166
174
|
<!-- Per-turn breadcrumb: shown when there is no active task (before Phase 1) -->
|
|
167
175
|
|
|
168
176
|
[workflow-state:no_task]
|
|
@@ -184,6 +192,7 @@ Complex task: ask the user if you can create a Trellis task and enter the planni
|
|
|
184
192
|
[workflow-state:planning]
|
|
185
193
|
Load `trellis-brainstorm`; stay in planning.
|
|
186
194
|
Lightweight: `prd.md` can be enough. Complex: finish `prd.md`, `design.md`, and `implement.md`; ask for review before `task.py start`.
|
|
195
|
+
Multi-deliverable scope: consider a parent task plus independently verifiable child tasks; dependencies must be written in child artifacts, not implied by tree position.
|
|
187
196
|
Sub-agent mode: curate `implement.jsonl` and `check.jsonl` as spec/research manifests before start.
|
|
188
197
|
[/workflow-state:planning]
|
|
189
198
|
|
|
@@ -196,6 +205,7 @@ Sub-agent mode: curate `implement.jsonl` and `check.jsonl` as spec/research mani
|
|
|
196
205
|
[workflow-state:planning-inline]
|
|
197
206
|
Load `trellis-brainstorm`; stay in planning.
|
|
198
207
|
Lightweight: `prd.md` can be enough. Complex: finish `prd.md`, `design.md`, and `implement.md`; ask for review before `task.py start`.
|
|
208
|
+
Multi-deliverable scope: consider a parent task plus independently verifiable child tasks; dependencies must be written in child artifacts, not implied by tree position.
|
|
199
209
|
Inline mode: skip jsonl curation; Phase 2 reads artifacts/specs via `trellis-before-dev`.
|
|
200
210
|
[/workflow-state:planning-inline]
|
|
201
211
|
|
|
@@ -213,6 +223,7 @@ Inline mode: skip jsonl curation; Phase 2 reads artifacts/specs via `trellis-bef
|
|
|
213
223
|
Sub-agent dispatch protocol applies to all platforms and all sub-agents, including class-2 Codex/Copilot/Gemini/Qoder and `trellis-research`: every dispatch prompt starts with `Active task: <task path from task.py current>` before role-specific instructions.
|
|
214
224
|
|
|
215
225
|
[workflow-state:in_progress]
|
|
226
|
+
Tools: `trellis-implement` / `trellis-research` are sub-agent types only (Task/Agent tool, NOT Skill; there is no skill by these names). `trellis-update-spec` is a skill. `trellis-check` exists as both; prefer the Agent form when verifying after code changes.
|
|
216
227
|
Flow: `trellis-implement` -> `trellis-check` -> `trellis-update-spec` -> commit (Phase 3.4) -> `/trellis:finish-work`.
|
|
217
228
|
Main-session default: dispatch implement/check sub-agents. Sub-agent self-exemption: if already running as `trellis-implement`, do NOT spawn another `trellis-implement` or `trellis-check`; if already running as `trellis-check`, do NOT spawn another `trellis-check` or `trellis-implement`. Dispatch is main session only.
|
|
218
229
|
Dispatch prompt starts with `Active task: <task path from task.py current>`. Read context: jsonl entries -> `prd.md` -> `design.md if present` -> `implement.md if present`.
|
|
@@ -307,6 +318,8 @@ python3 ./.trellis/scripts/task.py create "<task title>" --slug <name>
|
|
|
307
318
|
|
|
308
319
|
`--slug` is the human-readable name only. Do **not** include the `MM-DD-` date prefix; `task.py create` adds that prefix automatically.
|
|
309
320
|
|
|
321
|
+
For task trees, create the parent task first and then create each child with `--parent <parent-dir>`. Do not start the parent just because children exist; start the child that owns the next independently verifiable deliverable.
|
|
322
|
+
|
|
310
323
|
After this command succeeds, the per-turn breadcrumb auto-switches to `[workflow-state:planning]`, telling the AI to stay in planning.
|
|
311
324
|
|
|
312
325
|
Run only `create` here — do not also run `start`. `start` flips status to `in_progress`, which switches the breadcrumb to the implementation phase before planning artifacts are reviewed. Save `start` for step 1.4.
|
|
@@ -322,9 +335,17 @@ The brainstorm skill will guide you to:
|
|
|
322
335
|
- Prefer researching over asking the user
|
|
323
336
|
- Prefer offering options over open-ended questions
|
|
324
337
|
- Update `prd.md` immediately after each user answer
|
|
338
|
+
- Split large scopes into a parent task plus child tasks when the deliverables can be verified independently
|
|
325
339
|
- Keep `prd.md` focused on requirements and acceptance criteria
|
|
326
340
|
- For complex tasks, produce `design.md` and `implement.md` before implementation starts
|
|
327
341
|
|
|
342
|
+
When considering a parent/child split:
|
|
343
|
+
- Use a parent task when one request contains several independently verifiable deliverables.
|
|
344
|
+
- Parent tasks own source requirements, child-task mapping, cross-child acceptance criteria, and final integration review.
|
|
345
|
+
- Child tasks own actual deliverables that can be planned, implemented, checked, and archived independently.
|
|
346
|
+
- Parent/child structure is not a dependency system. If child B depends on child A, write that ordering in child B's `prd.md` / `implement.md`.
|
|
347
|
+
- Start the child task that owns the next deliverable. Do not start the parent unless the parent itself has direct implementation work.
|
|
348
|
+
|
|
328
349
|
Return to this step whenever requirements change and revise the relevant artifact.
|
|
329
350
|
|
|
330
351
|
#### 1.2 Research `[optional · repeatable]`
|
package/dist/types/ai-tools.d.ts
CHANGED
|
@@ -6,23 +6,23 @@
|
|
|
6
6
|
/**
|
|
7
7
|
* Supported AI coding tools
|
|
8
8
|
*/
|
|
9
|
-
export type AITool = "claude-code" | "cursor" | "opencode" | "codex" | "kilo" | "kiro" | "gemini" | "antigravity" | "windsurf" | "qoder" | "codebuddy" | "copilot" | "droid" | "pi";
|
|
9
|
+
export type AITool = "claude-code" | "cursor" | "opencode" | "codex" | "kilo" | "kiro" | "gemini" | "antigravity" | "windsurf" | "qoder" | "codebuddy" | "copilot" | "droid" | "pi" | "reasonix";
|
|
10
10
|
/**
|
|
11
11
|
* Template directory categories
|
|
12
12
|
*/
|
|
13
|
-
export type TemplateDir = "common" | "claude" | "cursor" | "opencode" | "codex" | "kilo" | "kiro" | "gemini" | "antigravity" | "windsurf" | "qoder" | "codebuddy" | "copilot" | "droid" | "pi";
|
|
13
|
+
export type TemplateDir = "common" | "claude" | "cursor" | "opencode" | "codex" | "kilo" | "kiro" | "gemini" | "antigravity" | "windsurf" | "qoder" | "codebuddy" | "copilot" | "droid" | "pi" | "reasonix";
|
|
14
14
|
/**
|
|
15
15
|
* CLI flag names for platform selection (e.g., --claude, --cursor, --kilo, --kiro, --gemini, --antigravity)
|
|
16
16
|
* Must match keys in InitOptions (src/commands/init.ts)
|
|
17
17
|
*/
|
|
18
|
-
export type CliFlag = "claude" | "cursor" | "opencode" | "codex" | "kilo" | "kiro" | "gemini" | "antigravity" | "windsurf" | "qoder" | "codebuddy" | "copilot" | "droid" | "pi";
|
|
18
|
+
export type CliFlag = "claude" | "cursor" | "opencode" | "codex" | "kilo" | "kiro" | "gemini" | "antigravity" | "windsurf" | "qoder" | "codebuddy" | "copilot" | "droid" | "pi" | "reasonix";
|
|
19
19
|
/**
|
|
20
20
|
* Template context for placeholder resolution.
|
|
21
21
|
* Controls how common templates are rendered per platform.
|
|
22
22
|
*/
|
|
23
23
|
export interface TemplateContext {
|
|
24
24
|
/** Prefix for cross-referencing other commands/skills */
|
|
25
|
-
cmdRefPrefix: "/trellis:" | "/trellis-" | "$" | "/";
|
|
25
|
+
cmdRefPrefix: "/trellis:" | "/trellis-" | "$" | "/" | "/skill trellis-";
|
|
26
26
|
/** Description of AI executor actions shown in role tables */
|
|
27
27
|
executorAI: "Bash scripts or Task calls" | "Bash scripts or tool calls" | "Bash scripts or file reads";
|
|
28
28
|
/** Label for user-invocable actions */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-tools.d.ts","sourceRoot":"","sources":["../../src/types/ai-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,MAAM,GACd,aAAa,GACb,QAAQ,GACR,UAAU,GACV,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,GACR,aAAa,GACb,UAAU,GACV,OAAO,GACP,WAAW,GACX,SAAS,GACT,OAAO,GACP,IAAI,CAAC;
|
|
1
|
+
{"version":3,"file":"ai-tools.d.ts","sourceRoot":"","sources":["../../src/types/ai-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,MAAM,GACd,aAAa,GACb,QAAQ,GACR,UAAU,GACV,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,GACR,aAAa,GACb,UAAU,GACV,OAAO,GACP,WAAW,GACX,SAAS,GACT,OAAO,GACP,IAAI,GACJ,UAAU,CAAC;AAEf;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,QAAQ,GACR,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,GACR,aAAa,GACb,UAAU,GACV,OAAO,GACP,WAAW,GACX,SAAS,GACT,OAAO,GACP,IAAI,GACJ,UAAU,CAAC;AAEf;;;GAGG;AACH,MAAM,MAAM,OAAO,GACf,QAAQ,GACR,QAAQ,GACR,UAAU,GACV,OAAO,GACP,MAAM,GACN,MAAM,GACN,QAAQ,GACR,aAAa,GACb,UAAU,GACV,OAAO,GACP,WAAW,GACX,SAAS,GACT,OAAO,GACP,I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AI,EAAE,MAAM,GAAG,WAAW,EAAE,CAE3D"}
|
package/dist/types/ai-tools.js
CHANGED
|
@@ -250,6 +250,22 @@ export const AI_TOOLS = {
|
|
|
250
250
|
cliFlag: "pi",
|
|
251
251
|
},
|
|
252
252
|
},
|
|
253
|
+
reasonix: {
|
|
254
|
+
name: "Reasonix",
|
|
255
|
+
templateDirs: ["common", "reasonix"],
|
|
256
|
+
configDir: ".reasonix",
|
|
257
|
+
cliFlag: "reasonix",
|
|
258
|
+
defaultChecked: false,
|
|
259
|
+
hasPythonHooks: false,
|
|
260
|
+
templateContext: {
|
|
261
|
+
cmdRefPrefix: "/skill trellis-",
|
|
262
|
+
executorAI: "Bash scripts or tool calls",
|
|
263
|
+
userActionLabel: "Skills",
|
|
264
|
+
agentCapable: true,
|
|
265
|
+
hasHooks: false,
|
|
266
|
+
cliFlag: "reasonix",
|
|
267
|
+
},
|
|
268
|
+
},
|
|
253
269
|
};
|
|
254
270
|
/**
|
|
255
271
|
* Get the configuration for a specific AI tool
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ai-tools.js","sourceRoot":"","sources":["../../src/types/ai-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"ai-tools.js","sourceRoot":"","sources":["../../src/types/ai-tools.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAyHH;;;;;;;;;;GAUG;AACH,MAAM,CAAC,MAAM,QAAQ,GAAiC;IACpD,aAAa,EAAE;QACb,IAAI,EAAE,aAAa;QACnB,YAAY,EAAE,CAAC,QAAQ,EAAE,QAAQ,CAAC;QAClC,SAAS,EAAE,SAAS;QACpB,OAAO,EAAE,QAAQ;QACjB,cAAc,EAAE,IAAI;QACpB,cAAc,EAAE,IAAI;QACpB,eAAe,EAAE;YACf,YAAY,EAAE,WAAW;YACzB,UAAU,EAAE,4BAA4B;YACxC,eAAe,EAAE,gBAAgB;YACjC,YAAY,EAAE,IAAI;YAClB,QAAQ,EA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
|
|
4
|
+
* Channel-driven workflows tell the main session to run
|
|
5
|
+
* `trellis channel spawn --agent <name>`, which loads `.trellis/agents/<name>.md`
|
|
6
|
+
* via `packages/cli/src/commands/channel/agent-loader.ts`. If a workflow
|
|
7
|
+
* references an agent name that is not on disk, the spawn call fails at
|
|
8
|
+
* runtime. We surface that mismatch eagerly (at `trellis init --workflow` /
|
|
9
|
+
* `trellis workflow --template` time) so users can run `trellis update` before
|
|
10
|
+
* the first spawn.
|
|
11
|
+
*
|
|
12
|
+
* Detection is intentionally lexical — we accept false positives over
|
|
13
|
+
* shipping a markdown parser. We pick names from two surface forms:
|
|
14
|
+
*
|
|
15
|
+
* 1. `--agent <name>` flag on a `trellis channel spawn ...` command
|
|
16
|
+
* 2. `.trellis/agents/<name>.md` literal path reference
|
|
17
|
+
*
|
|
18
|
+
* Both forms gate on the same `SAFE_AGENT_NAME` charset that `agent-loader.ts`
|
|
19
|
+
* enforces, so the discovered set is always loader-compatible.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Extract the set of `.trellis/agents/<name>.md` agent names that the given
|
|
23
|
+
* workflow body references. Result is sorted and deduplicated.
|
|
24
|
+
*/
|
|
25
|
+
export declare function collectReferencedAgents(workflowContent: string): string[];
|
|
26
|
+
/**
|
|
27
|
+
* Of the agent names referenced by the workflow, return those that do not
|
|
28
|
+
* exist under `<cwd>/.trellis/agents/`.
|
|
29
|
+
*/
|
|
30
|
+
export declare function collectMissingAgents(cwd: string, workflowContent: string): string[];
|
|
31
|
+
//# sourceMappingURL=agent-refs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-refs.d.ts","sourceRoot":"","sources":["../../src/utils/agent-refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAsBH;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,EAAE,CAWzE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,GAAG,EAAE,MAAM,EACX,eAAe,EAAE,MAAM,GACtB,MAAM,EAAE,CASV"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discover channel runtime agent names referenced by a workflow.md body.
|
|
3
|
+
*
|
|
4
|
+
* Channel-driven workflows tell the main session to run
|
|
5
|
+
* `trellis channel spawn --agent <name>`, which loads `.trellis/agents/<name>.md`
|
|
6
|
+
* via `packages/cli/src/commands/channel/agent-loader.ts`. If a workflow
|
|
7
|
+
* references an agent name that is not on disk, the spawn call fails at
|
|
8
|
+
* runtime. We surface that mismatch eagerly (at `trellis init --workflow` /
|
|
9
|
+
* `trellis workflow --template` time) so users can run `trellis update` before
|
|
10
|
+
* the first spawn.
|
|
11
|
+
*
|
|
12
|
+
* Detection is intentionally lexical — we accept false positives over
|
|
13
|
+
* shipping a markdown parser. We pick names from two surface forms:
|
|
14
|
+
*
|
|
15
|
+
* 1. `--agent <name>` flag on a `trellis channel spawn ...` command
|
|
16
|
+
* 2. `.trellis/agents/<name>.md` literal path reference
|
|
17
|
+
*
|
|
18
|
+
* Both forms gate on the same `SAFE_AGENT_NAME` charset that `agent-loader.ts`
|
|
19
|
+
* enforces, so the discovered set is always loader-compatible.
|
|
20
|
+
*/
|
|
21
|
+
import fs from "node:fs";
|
|
22
|
+
import path from "node:path";
|
|
23
|
+
import { PATHS } from "../constants/paths.js";
|
|
24
|
+
/**
|
|
25
|
+
* Mirror of `SAFE_AGENT_NAME` in `commands/channel/agent-loader.ts`.
|
|
26
|
+
* Names outside this charset cannot be loaded, so we silently ignore them.
|
|
27
|
+
*/
|
|
28
|
+
const SAFE_AGENT_NAME_CHARS = "A-Za-z0-9._-";
|
|
29
|
+
const AGENT_FLAG_RE = new RegExp(`--agent[\\s=]+([${SAFE_AGENT_NAME_CHARS}]+)`, "g");
|
|
30
|
+
const AGENT_PATH_RE = new RegExp(`\\.trellis/agents/([${SAFE_AGENT_NAME_CHARS}]+)\\.md`, "g");
|
|
31
|
+
/**
|
|
32
|
+
* Extract the set of `.trellis/agents/<name>.md` agent names that the given
|
|
33
|
+
* workflow body references. Result is sorted and deduplicated.
|
|
34
|
+
*/
|
|
35
|
+
export function collectReferencedAgents(workflowContent) {
|
|
36
|
+
const found = new Set();
|
|
37
|
+
for (const re of [AGENT_FLAG_RE, AGENT_PATH_RE]) {
|
|
38
|
+
re.lastIndex = 0;
|
|
39
|
+
let m;
|
|
40
|
+
while ((m = re.exec(workflowContent)) !== null) {
|
|
41
|
+
const name = m[1];
|
|
42
|
+
if (name)
|
|
43
|
+
found.add(name);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
return [...found].sort();
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Of the agent names referenced by the workflow, return those that do not
|
|
50
|
+
* exist under `<cwd>/.trellis/agents/`.
|
|
51
|
+
*/
|
|
52
|
+
export function collectMissingAgents(cwd, workflowContent) {
|
|
53
|
+
const referenced = collectReferencedAgents(workflowContent);
|
|
54
|
+
if (referenced.length === 0)
|
|
55
|
+
return [];
|
|
56
|
+
const agentsRoot = path.join(cwd, PATHS.AGENTS);
|
|
57
|
+
return referenced.filter((name) => {
|
|
58
|
+
const file = path.join(agentsRoot, `${name}.md`);
|
|
59
|
+
const nested = path.join(agentsRoot, name, "AGENT.md");
|
|
60
|
+
return !fs.existsSync(file) && !fs.existsSync(nested);
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=agent-refs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agent-refs.js","sourceRoot":"","sources":["../../src/utils/agent-refs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,KAAK,EAAE,MAAM,uBAAuB,CAAC;AAE9C;;;GAGG;AACH,MAAM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IAAI,CAAC,UAAU,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC;QACvD,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;IACxD,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Homedir guard for destructive commands (init, uninstall).
|
|
3
|
+
*
|
|
4
|
+
* Running `trellis init` / `trellis uninstall` in `$HOME` is catastrophic:
|
|
5
|
+
* platforms like Claude Code, Codex, OpenCode all store global runtime data
|
|
6
|
+
* (`.claude/projects/<sanitized-cwd>/*.jsonl` chat history, `.codex/sessions/`,
|
|
7
|
+
* `.opencode/` caches, etc.) directly in the user's home directory. If
|
|
8
|
+
* trellis manages the same `.{platform}/` config dirs and the hash manifest
|
|
9
|
+
* picks up runtime data, uninstall would later unlink it.
|
|
10
|
+
*
|
|
11
|
+
* Subdirectories of home (`~/Documents/projects/foo/`) are NOT blocked — only
|
|
12
|
+
* exact-home match.
|
|
13
|
+
*
|
|
14
|
+
* Bypass: `TRELLIS_ALLOW_HOMEDIR=1`.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* Returns true if `process.cwd()` is exactly the user's home directory.
|
|
18
|
+
*
|
|
19
|
+
* Uses `realpathSync.native()` on both sides so symlinks, `..` segments, and
|
|
20
|
+
* case differences (Windows) don't confuse the comparison. On Windows the
|
|
21
|
+
* comparison is also case-insensitive — `C:\Users\Alice` matches
|
|
22
|
+
* `c:\users\alice`.
|
|
23
|
+
*
|
|
24
|
+
* Permissive on lookup failure: if realpath fails for any reason (broken
|
|
25
|
+
* symlink, EACCES, etc.) we return false so a safety check doesn't crash
|
|
26
|
+
* the command.
|
|
27
|
+
*/
|
|
28
|
+
export declare function isCwdHomedir(): boolean;
|
|
29
|
+
/**
|
|
30
|
+
* Error message printed by both `trellis init` and `trellis uninstall` when
|
|
31
|
+
* the homedir guard trips.
|
|
32
|
+
*/
|
|
33
|
+
export declare function homedirGuardMessage(commandName: "init" | "uninstall"): string;
|
|
34
|
+
/**
|
|
35
|
+
* Returns true when the bypass env var is set.
|
|
36
|
+
*/
|
|
37
|
+
export declare function homedirBypassEnabled(): boolean;
|
|
38
|
+
//# sourceMappingURL=cwd-guard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cwd-guard.d.ts","sourceRoot":"","sources":["../../src/utils/cwd-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAKH;;;;;;;;;;;GAWG;AACH,wBAAgB,YAAY,IAAI,OAAO,CAYtC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,WAAW,EAAE,MAAM,GAAG,WAAW,GAAG,MAAM,CAS7E;AAED;;GAEG;AACH,wBAAgB,oBAAoB,IAAI,OAAO,CAE9C"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Homedir guard for destructive commands (init, uninstall).
|
|
3
|
+
*
|
|
4
|
+
* Running `trellis init` / `trellis uninstall` in `$HOME` is catastrophic:
|
|
5
|
+
* platforms like Claude Code, Codex, OpenCode all store global runtime data
|
|
6
|
+
* (`.claude/projects/<sanitized-cwd>/*.jsonl` chat history, `.codex/sessions/`,
|
|
7
|
+
* `.opencode/` caches, etc.) directly in the user's home directory. If
|
|
8
|
+
* trellis manages the same `.{platform}/` config dirs and the hash manifest
|
|
9
|
+
* picks up runtime data, uninstall would later unlink it.
|
|
10
|
+
*
|
|
11
|
+
* Subdirectories of home (`~/Documents/projects/foo/`) are NOT blocked — only
|
|
12
|
+
* exact-home match.
|
|
13
|
+
*
|
|
14
|
+
* Bypass: `TRELLIS_ALLOW_HOMEDIR=1`.
|
|
15
|
+
*/
|
|
16
|
+
import { realpathSync } from "node:fs";
|
|
17
|
+
import * as os from "node:os";
|
|
18
|
+
/**
|
|
19
|
+
* Returns true if `process.cwd()` is exactly the user's home directory.
|
|
20
|
+
*
|
|
21
|
+
* Uses `realpathSync.native()` on both sides so symlinks, `..` segments, and
|
|
22
|
+
* case differences (Windows) don't confuse the comparison. On Windows the
|
|
23
|
+
* comparison is also case-insensitive — `C:\Users\Alice` matches
|
|
24
|
+
* `c:\users\alice`.
|
|
25
|
+
*
|
|
26
|
+
* Permissive on lookup failure: if realpath fails for any reason (broken
|
|
27
|
+
* symlink, EACCES, etc.) we return false so a safety check doesn't crash
|
|
28
|
+
* the command.
|
|
29
|
+
*/
|
|
30
|
+
export function isCwdHomedir() {
|
|
31
|
+
try {
|
|
32
|
+
let cwd = realpathSync.native(process.cwd());
|
|
33
|
+
let home = realpathSync.native(os.homedir());
|
|
34
|
+
if (process.platform === "win32") {
|
|
35
|
+
cwd = cwd.toLowerCase();
|
|
36
|
+
home = home.toLowerCase();
|
|
37
|
+
}
|
|
38
|
+
return cwd === home;
|
|
39
|
+
}
|
|
40
|
+
catch {
|
|
41
|
+
return false;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Error message printed by both `trellis init` and `trellis uninstall` when
|
|
46
|
+
* the homedir guard trips.
|
|
47
|
+
*/
|
|
48
|
+
export function homedirGuardMessage(commandName) {
|
|
49
|
+
return (`✗ Refusing to run \`trellis ${commandName}\` in your home directory.\n\n` +
|
|
50
|
+
`Trellis manages platform config dirs like .claude/, .codex/, .opencode/, which\n` +
|
|
51
|
+
`in your home directory also contain runtime data from those CLIs (chat history,\n` +
|
|
52
|
+
`session JSONLs, caches). Running here can wipe that data.\n\n` +
|
|
53
|
+
`Run trellis from your project directory instead. If you really want to run in\n` +
|
|
54
|
+
`$HOME, set TRELLIS_ALLOW_HOMEDIR=1.`);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Returns true when the bypass env var is set.
|
|
58
|
+
*/
|
|
59
|
+
export function homedirBypassEnabled() {
|
|
60
|
+
return process.env.TRELLIS_ALLOW_HOMEDIR === "1";
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=cwd-guard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cwd-guard.js","sourceRoot":"","sources":["../../src/utils/cwd-guard.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAE9B;;;;;;;;;;;GAWG;AACH,MAAM,UAAU,YAAY;IAC1B,IAAI,CAAC;QACH,IAAI,GAAG,GAAG,YAAY,CAAC,MAAM,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;QAC7C,IAAI,IAAI,GAAG,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,CAAC;QAC7C,IAAI,OAAO,CAAC,QAAQ,KAAK,OAAO,EAAE,CAAC;YACjC,GAAG,GAAG,GAAG,CAAC,WAAW,EAAE,CAAC;YACxB,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;QAC5B,CAAC;QACD,OAAO,GAAG,KAAK,IAAI,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,mBAAmB,CAAC,WAAiC;IACnE,OAAO,CACL,+BAA+B,WAAW,gCAAgC;QAC1E,kFAAkF;QAClF,mFAAmF;QACnF,+DAA+D;QAC/D,iFAAiF;QACjF,qCAAqC,CACtC,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,oBAAoB;IAClC,OAAO,OAAO,CAAC,GAAG,CAAC,qBAAqB,KAAK,GAAG,CAAC;AACnD,CAAC"}
|