@mindfoldhq/trellis 0.3.9 → 0.4.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.
- package/dist/cli/index.js +2 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts +1 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +203 -31
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +154 -6
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/workflow.d.ts +6 -2
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +88 -58
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/migrations/index.d.ts +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +2 -0
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/manifests/0.4.0-beta.1.json +228 -0
- package/dist/templates/claude/agents/dispatch.md +1 -2
- package/dist/templates/claude/agents/implement.md +2 -3
- package/dist/templates/claude/commands/trellis/before-dev.md +29 -0
- package/dist/templates/claude/commands/trellis/check.md +25 -0
- package/dist/templates/claude/commands/trellis/create-command.md +2 -2
- package/dist/templates/claude/commands/trellis/onboard.md +13 -13
- package/dist/templates/claude/commands/trellis/parallel.md +1 -2
- package/dist/templates/claude/commands/trellis/record-session.md +1 -1
- package/dist/templates/claude/commands/trellis/start.md +8 -4
- package/dist/templates/claude/hooks/inject-subagent-context.py +21 -13
- package/dist/templates/claude/hooks/session-start.py +170 -2
- package/dist/templates/codex/skills/before-dev/SKILL.md +34 -0
- package/dist/templates/codex/skills/check/SKILL.md +30 -0
- package/dist/templates/codex/skills/create-command/SKILL.md +2 -2
- package/dist/templates/codex/skills/onboard/SKILL.md +11 -11
- package/dist/templates/codex/skills/record-session/SKILL.md +1 -1
- package/dist/templates/codex/skills/start/SKILL.md +8 -3
- package/dist/templates/cursor/commands/trellis-before-dev.md +29 -0
- package/dist/templates/cursor/commands/trellis-check.md +25 -0
- package/dist/templates/cursor/commands/trellis-create-command.md +2 -2
- package/dist/templates/cursor/commands/trellis-onboard.md +13 -13
- package/dist/templates/cursor/commands/trellis-record-session.md +1 -1
- package/dist/templates/cursor/commands/trellis-start.md +7 -16
- package/dist/templates/gemini/commands/trellis/before-dev.toml +33 -0
- package/dist/templates/gemini/commands/trellis/check.toml +29 -0
- package/dist/templates/gemini/commands/trellis/create-command.toml +2 -2
- package/dist/templates/gemini/commands/trellis/onboard.toml +2 -2
- package/dist/templates/gemini/commands/trellis/record-session.toml +1 -1
- package/dist/templates/gemini/commands/trellis/start.toml +9 -4
- package/dist/templates/iflow/agents/dispatch.md +1 -2
- package/dist/templates/iflow/agents/implement.md +2 -3
- package/dist/templates/iflow/commands/trellis/before-dev.md +29 -0
- package/dist/templates/iflow/commands/trellis/check.md +25 -0
- package/dist/templates/iflow/commands/trellis/create-command.md +2 -2
- package/dist/templates/iflow/commands/trellis/onboard.md +13 -13
- package/dist/templates/iflow/commands/trellis/parallel.md +1 -2
- package/dist/templates/iflow/commands/trellis/record-session.md +1 -1
- package/dist/templates/iflow/commands/trellis/start.md +8 -4
- package/dist/templates/iflow/hooks/inject-subagent-context.py +21 -13
- package/dist/templates/iflow/hooks/session-start.py +156 -1
- package/dist/templates/kilo/workflows/before-dev.md +29 -0
- package/dist/templates/kilo/workflows/check.md +25 -0
- package/dist/templates/kilo/workflows/create-command.md +2 -2
- package/dist/templates/kilo/workflows/onboard.md +13 -13
- package/dist/templates/kilo/workflows/parallel.md +1 -2
- package/dist/templates/kilo/workflows/record-session.md +1 -1
- package/dist/templates/kilo/workflows/start.md +8 -3
- package/dist/templates/kiro/skills/before-dev/SKILL.md +34 -0
- package/dist/templates/kiro/skills/check/SKILL.md +30 -0
- package/dist/templates/kiro/skills/create-command/SKILL.md +2 -2
- package/dist/templates/kiro/skills/onboard/SKILL.md +11 -11
- package/dist/templates/kiro/skills/record-session/SKILL.md +1 -1
- package/dist/templates/kiro/skills/start/SKILL.md +8 -3
- package/dist/templates/markdown/spec/backend/script-conventions.md +93 -0
- package/dist/templates/opencode/agents/dispatch.md +1 -2
- package/dist/templates/opencode/agents/implement.md +2 -2
- package/dist/templates/opencode/agents/research.md +1 -2
- package/dist/templates/opencode/commands/trellis/before-dev.md +29 -0
- package/dist/templates/opencode/commands/trellis/check.md +25 -0
- package/dist/templates/opencode/commands/trellis/create-command.md +2 -2
- package/dist/templates/opencode/commands/trellis/onboard.md +13 -13
- package/dist/templates/opencode/commands/trellis/parallel.md +1 -2
- package/dist/templates/opencode/commands/trellis/record-session.md +1 -1
- package/dist/templates/opencode/commands/trellis/start.md +8 -3
- package/dist/templates/opencode/plugin/inject-subagent-context.js +45 -18
- package/dist/templates/opencode/plugin/session-start.js +149 -1
- package/dist/templates/qoder/skills/before-dev/SKILL.md +34 -0
- package/dist/templates/qoder/skills/check/SKILL.md +30 -0
- package/dist/templates/qoder/skills/create-command/SKILL.md +2 -2
- package/dist/templates/qoder/skills/onboard/SKILL.md +13 -13
- package/dist/templates/qoder/skills/record-session/SKILL.md +1 -1
- package/dist/templates/qoder/skills/start/SKILL.md +8 -3
- package/dist/templates/trellis/config.yaml +20 -0
- package/dist/templates/trellis/index.d.ts +11 -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/add_session.py +52 -7
- package/dist/templates/trellis/scripts/common/cli_adapter.py +33 -45
- package/dist/templates/trellis/scripts/common/config.py +152 -0
- package/dist/templates/trellis/scripts/common/git.py +31 -0
- package/dist/templates/trellis/scripts/common/git_context.py +23 -586
- package/dist/templates/trellis/scripts/common/io.py +37 -0
- package/dist/templates/trellis/scripts/common/log.py +45 -0
- package/dist/templates/trellis/scripts/common/packages_context.py +233 -0
- package/dist/templates/trellis/scripts/common/paths.py +46 -0
- package/dist/templates/trellis/scripts/common/phase.py +50 -49
- package/dist/templates/trellis/scripts/common/registry.py +41 -72
- package/dist/templates/trellis/scripts/common/session_context.py +466 -0
- package/dist/templates/trellis/scripts/common/task_context.py +384 -0
- package/dist/templates/trellis/scripts/common/task_queue.py +27 -98
- package/dist/templates/trellis/scripts/common/task_store.py +534 -0
- package/dist/templates/trellis/scripts/common/task_utils.py +96 -6
- package/dist/templates/trellis/scripts/common/tasks.py +109 -0
- package/dist/templates/trellis/scripts/common/types.py +112 -0
- package/dist/templates/trellis/scripts/create_bootstrap.py +31 -26
- package/dist/templates/trellis/scripts/hooks/linear_sync.py +243 -0
- package/dist/templates/trellis/scripts/multi_agent/_bootstrap.py +17 -0
- package/dist/templates/trellis/scripts/multi_agent/cleanup.py +43 -48
- package/dist/templates/trellis/scripts/multi_agent/create_pr.py +336 -45
- package/dist/templates/trellis/scripts/multi_agent/plan.py +2 -26
- package/dist/templates/trellis/scripts/multi_agent/start.py +126 -57
- package/dist/templates/trellis/scripts/multi_agent/status.py +12 -753
- package/dist/templates/trellis/scripts/multi_agent/status_display.py +542 -0
- package/dist/templates/trellis/scripts/multi_agent/status_monitor.py +225 -0
- package/dist/templates/trellis/scripts/task.py +50 -975
- package/dist/templates/trellis/workflow.md +21 -34
- package/dist/types/migration.d.ts +3 -1
- package/dist/types/migration.d.ts.map +1 -1
- package/dist/utils/project-detector.d.ts +23 -0
- package/dist/utils/project-detector.d.ts.map +1 -1
- package/dist/utils/project-detector.js +364 -0
- package/dist/utils/project-detector.js.map +1 -1
- package/dist/utils/template-fetcher.d.ts +2 -2
- package/dist/utils/template-fetcher.d.ts.map +1 -1
- package/dist/utils/template-fetcher.js +5 -5
- package/dist/utils/template-fetcher.js.map +1 -1
- package/package.json +1 -1
- package/dist/templates/claude/commands/trellis/before-backend-dev.md +0 -13
- package/dist/templates/claude/commands/trellis/before-frontend-dev.md +0 -13
- package/dist/templates/claude/commands/trellis/check-backend.md +0 -13
- package/dist/templates/claude/commands/trellis/check-frontend.md +0 -13
- package/dist/templates/codex/skills/before-backend-dev/SKILL.md +0 -18
- package/dist/templates/codex/skills/before-frontend-dev/SKILL.md +0 -18
- package/dist/templates/codex/skills/check-backend/SKILL.md +0 -18
- package/dist/templates/codex/skills/check-frontend/SKILL.md +0 -18
- package/dist/templates/cursor/commands/trellis-before-backend-dev.md +0 -13
- package/dist/templates/cursor/commands/trellis-before-frontend-dev.md +0 -13
- package/dist/templates/cursor/commands/trellis-check-backend.md +0 -13
- package/dist/templates/cursor/commands/trellis-check-frontend.md +0 -13
- package/dist/templates/gemini/commands/trellis/before-backend-dev.toml +0 -17
- package/dist/templates/gemini/commands/trellis/before-frontend-dev.toml +0 -17
- package/dist/templates/gemini/commands/trellis/check-backend.toml +0 -17
- package/dist/templates/gemini/commands/trellis/check-frontend.toml +0 -17
- package/dist/templates/iflow/commands/trellis/before-backend-dev.md +0 -13
- package/dist/templates/iflow/commands/trellis/before-frontend-dev.md +0 -13
- package/dist/templates/iflow/commands/trellis/check-backend.md +0 -13
- package/dist/templates/iflow/commands/trellis/check-frontend.md +0 -13
- package/dist/templates/kilo/workflows/before-backend-dev.md +0 -13
- package/dist/templates/kilo/workflows/before-frontend-dev.md +0 -13
- package/dist/templates/kilo/workflows/check-backend.md +0 -13
- package/dist/templates/kilo/workflows/check-frontend.md +0 -13
- package/dist/templates/kiro/skills/before-backend-dev/SKILL.md +0 -18
- package/dist/templates/kiro/skills/before-frontend-dev/SKILL.md +0 -18
- package/dist/templates/kiro/skills/check-backend/SKILL.md +0 -18
- package/dist/templates/kiro/skills/check-frontend/SKILL.md +0 -18
- package/dist/templates/opencode/commands/trellis/before-backend-dev.md +0 -13
- package/dist/templates/opencode/commands/trellis/before-frontend-dev.md +0 -13
- package/dist/templates/opencode/commands/trellis/check-backend.md +0 -13
- package/dist/templates/opencode/commands/trellis/check-frontend.md +0 -13
- package/dist/templates/qoder/skills/before-backend-dev/SKILL.md +0 -18
- package/dist/templates/qoder/skills/before-frontend-dev/SKILL.md +0 -18
- package/dist/templates/qoder/skills/check-backend/SKILL.md +0 -18
- package/dist/templates/qoder/skills/check-frontend/SKILL.md +0 -18
|
@@ -22,16 +22,17 @@ This script:
|
|
|
22
22
|
from __future__ import annotations
|
|
23
23
|
|
|
24
24
|
import argparse
|
|
25
|
+
import json
|
|
25
26
|
import shutil
|
|
26
27
|
import subprocess
|
|
27
28
|
import sys
|
|
28
29
|
from pathlib import Path
|
|
29
30
|
|
|
30
|
-
#
|
|
31
|
-
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
31
|
+
import _bootstrap # noqa: F401 — adds parent scripts/ dir to sys.path
|
|
32
32
|
|
|
33
|
-
from common.
|
|
34
|
-
from common.
|
|
33
|
+
from common.git import run_git
|
|
34
|
+
from common.log import Colors, log_info, log_success, log_warn, log_error
|
|
35
|
+
from common.paths import FILE_TASK_JSON, get_repo_root
|
|
35
36
|
from common.registry import (
|
|
36
37
|
registry_get_file,
|
|
37
38
|
registry_get_task_dir,
|
|
@@ -44,38 +45,8 @@ from common.task_utils import (
|
|
|
44
45
|
is_safe_task_path,
|
|
45
46
|
)
|
|
46
47
|
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
# =============================================================================
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
class Colors:
|
|
53
|
-
RED = "\033[0;31m"
|
|
54
|
-
GREEN = "\033[0;32m"
|
|
55
|
-
YELLOW = "\033[1;33m"
|
|
56
|
-
BLUE = "\033[0;34m"
|
|
57
|
-
NC = "\033[0m"
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
def log_info(msg: str) -> None:
|
|
61
|
-
print(f"{Colors.BLUE}[INFO]{Colors.NC} {msg}")
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
def log_success(msg: str) -> None:
|
|
65
|
-
print(f"{Colors.GREEN}[SUCCESS]{Colors.NC} {msg}")
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
def log_warn(msg: str) -> None:
|
|
69
|
-
print(f"{Colors.YELLOW}[WARN]{Colors.NC} {msg}")
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
def log_error(msg: str) -> None:
|
|
73
|
-
print(f"{Colors.RED}[ERROR]{Colors.NC} {msg}")
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
# =============================================================================
|
|
77
|
-
# Helper Functions
|
|
78
|
-
# =============================================================================
|
|
48
|
+
# Colors, log_info, log_success, log_warn, log_error
|
|
49
|
+
# are now imported from common.log above.
|
|
79
50
|
|
|
80
51
|
|
|
81
52
|
def confirm(prompt: str, skip_confirm: bool) -> bool:
|
|
@@ -91,6 +62,26 @@ def confirm(prompt: str, skip_confirm: bool) -> bool:
|
|
|
91
62
|
return response.lower() in ("y", "yes")
|
|
92
63
|
|
|
93
64
|
|
|
65
|
+
def _warn_submodule_prs(task_dir_abs: Path) -> None:
|
|
66
|
+
"""Print reminders for any open submodule PRs found in task.json."""
|
|
67
|
+
task_json = task_dir_abs / FILE_TASK_JSON
|
|
68
|
+
if not task_json.is_file():
|
|
69
|
+
return
|
|
70
|
+
|
|
71
|
+
try:
|
|
72
|
+
task_data = json.loads(task_json.read_text(encoding="utf-8"))
|
|
73
|
+
except (json.JSONDecodeError, OSError):
|
|
74
|
+
return
|
|
75
|
+
|
|
76
|
+
submodule_prs = task_data.get("submodule_prs")
|
|
77
|
+
if not isinstance(submodule_prs, dict) or not submodule_prs:
|
|
78
|
+
return
|
|
79
|
+
|
|
80
|
+
for name, url in submodule_prs.items():
|
|
81
|
+
log_warn(f"Submodule PR still open: {name} -> {url}")
|
|
82
|
+
log_info("Remember to close/merge submodule PRs before cleanup")
|
|
83
|
+
|
|
84
|
+
|
|
94
85
|
# =============================================================================
|
|
95
86
|
# Commands
|
|
96
87
|
# =============================================================================
|
|
@@ -110,8 +101,6 @@ def cmd_list(repo_root: Path) -> int:
|
|
|
110
101
|
print(f"{Colors.BLUE}=== Registered Agents ==={Colors.NC}")
|
|
111
102
|
print()
|
|
112
103
|
|
|
113
|
-
import json
|
|
114
|
-
|
|
115
104
|
data = json.loads(registry_file.read_text(encoding="utf-8"))
|
|
116
105
|
agents = data.get("agents", [])
|
|
117
106
|
|
|
@@ -165,10 +154,11 @@ def cleanup_registry_only(search: str, repo_root: Path, skip_confirm: bool) -> i
|
|
|
165
154
|
log_info("Aborted")
|
|
166
155
|
return 0
|
|
167
156
|
|
|
168
|
-
#
|
|
157
|
+
# Check for submodule PRs and archive task directory
|
|
169
158
|
if task_dir and is_safe_task_path(task_dir, repo_root):
|
|
170
159
|
task_dir_abs = repo_root / task_dir
|
|
171
160
|
if task_dir_abs.is_dir():
|
|
161
|
+
_warn_submodule_prs(task_dir_abs)
|
|
172
162
|
result = archive_task_complete(task_dir_abs, repo_root)
|
|
173
163
|
if "archived_to" in result:
|
|
174
164
|
dest = Path(result["archived_to"])
|
|
@@ -191,7 +181,7 @@ def cleanup_worktree(
|
|
|
191
181
|
) -> int:
|
|
192
182
|
"""Cleanup single worktree."""
|
|
193
183
|
# Find worktree path for branch
|
|
194
|
-
_, worktree_list, _ =
|
|
184
|
+
_, worktree_list, _ = run_git(
|
|
195
185
|
["worktree", "list", "--porcelain"], cwd=repo_root
|
|
196
186
|
)
|
|
197
187
|
|
|
@@ -223,7 +213,12 @@ def cleanup_worktree(
|
|
|
223
213
|
log_info("Aborted")
|
|
224
214
|
return 0
|
|
225
215
|
|
|
226
|
-
# 1. Archive task
|
|
216
|
+
# 1. Archive task (and check for submodule PRs)
|
|
217
|
+
task_dir = registry_get_task_dir(worktree_path, repo_root)
|
|
218
|
+
if task_dir and is_safe_task_path(task_dir, repo_root):
|
|
219
|
+
task_dir_abs_for_warn = repo_root / task_dir
|
|
220
|
+
if task_dir_abs_for_warn.is_dir():
|
|
221
|
+
_warn_submodule_prs(task_dir_abs_for_warn)
|
|
227
222
|
archive_task(worktree_path, repo_root)
|
|
228
223
|
|
|
229
224
|
# 2. Remove from registry
|
|
@@ -232,7 +227,7 @@ def cleanup_worktree(
|
|
|
232
227
|
|
|
233
228
|
# 3. Remove worktree
|
|
234
229
|
log_info("Removing worktree...")
|
|
235
|
-
ret, _, _ =
|
|
230
|
+
ret, _, _ = run_git(
|
|
236
231
|
["worktree", "remove", worktree_path, "--force"], cwd=repo_root
|
|
237
232
|
)
|
|
238
233
|
if ret != 0:
|
|
@@ -247,7 +242,7 @@ def cleanup_worktree(
|
|
|
247
242
|
# 4. Delete branch (optional)
|
|
248
243
|
if not keep_branch:
|
|
249
244
|
log_info("Deleting branch...")
|
|
250
|
-
ret, _, _ =
|
|
245
|
+
ret, _, _ = run_git(["branch", "-D", branch], cwd=repo_root)
|
|
251
246
|
if ret != 0:
|
|
252
247
|
log_warn("Could not delete branch (may be checked out elsewhere)")
|
|
253
248
|
|
|
@@ -258,7 +253,7 @@ def cleanup_worktree(
|
|
|
258
253
|
def cmd_merged(repo_root: Path, skip_confirm: bool, keep_branch: bool) -> int:
|
|
259
254
|
"""Cleanup merged worktrees."""
|
|
260
255
|
# Get main branch
|
|
261
|
-
_, head_out, _ =
|
|
256
|
+
_, head_out, _ = run_git(
|
|
262
257
|
["symbolic-ref", "refs/remotes/origin/HEAD"], cwd=repo_root
|
|
263
258
|
)
|
|
264
259
|
main_branch = head_out.strip().replace("refs/remotes/origin/", "") or "main"
|
|
@@ -267,7 +262,7 @@ def cmd_merged(repo_root: Path, skip_confirm: bool, keep_branch: bool) -> int:
|
|
|
267
262
|
print()
|
|
268
263
|
|
|
269
264
|
# Get merged branches
|
|
270
|
-
_, merged_out, _ =
|
|
265
|
+
_, merged_out, _ = run_git(
|
|
271
266
|
["branch", "--merged", main_branch], cwd=repo_root
|
|
272
267
|
)
|
|
273
268
|
merged_branches = []
|
|
@@ -281,7 +276,7 @@ def cmd_merged(repo_root: Path, skip_confirm: bool, keep_branch: bool) -> int:
|
|
|
281
276
|
return 0
|
|
282
277
|
|
|
283
278
|
# Get worktree list
|
|
284
|
-
_, worktree_list, _ =
|
|
279
|
+
_, worktree_list, _ = run_git(["worktree", "list"], cwd=repo_root)
|
|
285
280
|
|
|
286
281
|
worktree_branches = []
|
|
287
282
|
for branch in merged_branches:
|
|
@@ -310,7 +305,7 @@ def cmd_all(repo_root: Path, skip_confirm: bool, keep_branch: bool) -> int:
|
|
|
310
305
|
print()
|
|
311
306
|
|
|
312
307
|
# Get worktree list
|
|
313
|
-
_, worktree_list, _ =
|
|
308
|
+
_, worktree_list, _ = run_git(
|
|
314
309
|
["worktree", "list", "--porcelain"], cwd=repo_root
|
|
315
310
|
)
|
|
316
311
|
|
|
@@ -340,7 +335,7 @@ def cmd_all(repo_root: Path, skip_confirm: bool, keep_branch: bool) -> int:
|
|
|
340
335
|
# Get branch for each worktree
|
|
341
336
|
for wt in worktrees:
|
|
342
337
|
# Find branch name from worktree list
|
|
343
|
-
_, wt_list, _ =
|
|
338
|
+
_, wt_list, _ = run_git(["worktree", "list"], cwd=repo_root)
|
|
344
339
|
for line in wt_list.splitlines():
|
|
345
340
|
if wt in line:
|
|
346
341
|
# Extract branch from [branch] format
|