@mindfoldhq/trellis 0.3.10-beta.0 → 0.3.10
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 +0 -2
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts +0 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +31 -203
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +6 -154
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/workflow.d.ts +2 -6
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +58 -88
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/migrations/index.d.ts +0 -1
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +0 -2
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/manifests/0.3.10.json +9 -0
- package/dist/templates/claude/agents/dispatch.md +2 -1
- package/dist/templates/claude/agents/implement.md +3 -2
- package/dist/templates/claude/commands/trellis/before-backend-dev.md +13 -0
- package/dist/templates/claude/commands/trellis/before-frontend-dev.md +13 -0
- package/dist/templates/claude/commands/trellis/check-backend.md +13 -0
- package/dist/templates/claude/commands/trellis/check-frontend.md +13 -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 +2 -1
- package/dist/templates/claude/commands/trellis/record-session.md +2 -2
- package/dist/templates/claude/commands/trellis/start.md +4 -8
- package/dist/templates/claude/hooks/inject-subagent-context.py +13 -21
- package/dist/templates/claude/hooks/session-start.py +2 -170
- package/dist/templates/codex/skills/before-backend-dev/SKILL.md +18 -0
- package/dist/templates/codex/skills/before-frontend-dev/SKILL.md +18 -0
- package/dist/templates/codex/skills/check-backend/SKILL.md +18 -0
- package/dist/templates/codex/skills/check-frontend/SKILL.md +18 -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 +2 -2
- package/dist/templates/codex/skills/start/SKILL.md +3 -8
- package/dist/templates/cursor/commands/trellis-before-backend-dev.md +13 -0
- package/dist/templates/cursor/commands/trellis-before-frontend-dev.md +13 -0
- package/dist/templates/cursor/commands/trellis-check-backend.md +13 -0
- package/dist/templates/cursor/commands/trellis-check-frontend.md +13 -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 +2 -2
- package/dist/templates/cursor/commands/trellis-start.md +16 -7
- package/dist/templates/gemini/commands/trellis/before-backend-dev.toml +17 -0
- package/dist/templates/gemini/commands/trellis/before-frontend-dev.toml +17 -0
- package/dist/templates/gemini/commands/trellis/check-backend.toml +17 -0
- package/dist/templates/gemini/commands/trellis/check-frontend.toml +17 -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 +2 -2
- package/dist/templates/gemini/commands/trellis/start.toml +4 -9
- package/dist/templates/iflow/agents/dispatch.md +2 -1
- package/dist/templates/iflow/agents/implement.md +3 -2
- package/dist/templates/iflow/commands/trellis/before-backend-dev.md +13 -0
- package/dist/templates/iflow/commands/trellis/before-frontend-dev.md +13 -0
- package/dist/templates/iflow/commands/trellis/check-backend.md +13 -0
- package/dist/templates/iflow/commands/trellis/check-frontend.md +13 -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 +2 -1
- package/dist/templates/iflow/commands/trellis/record-session.md +2 -2
- package/dist/templates/iflow/commands/trellis/start.md +4 -8
- package/dist/templates/iflow/hooks/inject-subagent-context.py +13 -21
- package/dist/templates/iflow/hooks/session-start.py +1 -156
- package/dist/templates/kilo/workflows/before-backend-dev.md +13 -0
- package/dist/templates/kilo/workflows/before-frontend-dev.md +13 -0
- package/dist/templates/kilo/workflows/check-backend.md +13 -0
- package/dist/templates/kilo/workflows/check-frontend.md +13 -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 +2 -1
- package/dist/templates/kilo/workflows/record-session.md +2 -2
- package/dist/templates/kilo/workflows/start.md +3 -8
- package/dist/templates/kiro/skills/before-backend-dev/SKILL.md +18 -0
- package/dist/templates/kiro/skills/before-frontend-dev/SKILL.md +18 -0
- package/dist/templates/kiro/skills/check-backend/SKILL.md +18 -0
- package/dist/templates/kiro/skills/check-frontend/SKILL.md +18 -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 +2 -2
- package/dist/templates/kiro/skills/start/SKILL.md +3 -8
- package/dist/templates/markdown/spec/backend/script-conventions.md +0 -93
- package/dist/templates/opencode/agents/dispatch.md +2 -1
- package/dist/templates/opencode/agents/implement.md +2 -2
- package/dist/templates/opencode/agents/research.md +2 -1
- package/dist/templates/opencode/commands/trellis/before-backend-dev.md +13 -0
- package/dist/templates/opencode/commands/trellis/before-frontend-dev.md +13 -0
- package/dist/templates/opencode/commands/trellis/check-backend.md +13 -0
- package/dist/templates/opencode/commands/trellis/check-frontend.md +13 -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 +2 -1
- package/dist/templates/opencode/commands/trellis/record-session.md +2 -2
- package/dist/templates/opencode/commands/trellis/start.md +3 -8
- package/dist/templates/opencode/plugin/inject-subagent-context.js +18 -45
- package/dist/templates/opencode/plugin/session-start.js +1 -149
- package/dist/templates/qoder/skills/before-backend-dev/SKILL.md +18 -0
- package/dist/templates/qoder/skills/before-frontend-dev/SKILL.md +18 -0
- package/dist/templates/qoder/skills/check-backend/SKILL.md +18 -0
- package/dist/templates/qoder/skills/check-frontend/SKILL.md +18 -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 +2 -2
- package/dist/templates/qoder/skills/start/SKILL.md +3 -8
- package/dist/templates/trellis/config.yaml +0 -20
- package/dist/templates/trellis/index.d.ts +0 -11
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +0 -22
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/add_session.py +7 -52
- package/dist/templates/trellis/scripts/common/cli_adapter.py +45 -33
- package/dist/templates/trellis/scripts/common/config.py +0 -152
- package/dist/templates/trellis/scripts/common/git_context.py +586 -23
- package/dist/templates/trellis/scripts/common/paths.py +0 -46
- package/dist/templates/trellis/scripts/common/phase.py +49 -50
- package/dist/templates/trellis/scripts/common/registry.py +72 -41
- package/dist/templates/trellis/scripts/common/task_queue.py +98 -27
- package/dist/templates/trellis/scripts/common/task_utils.py +6 -96
- package/dist/templates/trellis/scripts/create_bootstrap.py +26 -31
- package/dist/templates/trellis/scripts/multi_agent/cleanup.py +48 -43
- package/dist/templates/trellis/scripts/multi_agent/create_pr.py +45 -336
- package/dist/templates/trellis/scripts/multi_agent/plan.py +26 -2
- package/dist/templates/trellis/scripts/multi_agent/start.py +57 -126
- package/dist/templates/trellis/scripts/multi_agent/status.py +753 -12
- package/dist/templates/trellis/scripts/task.py +975 -50
- package/dist/templates/trellis/workflow.md +34 -21
- package/dist/types/migration.d.ts +1 -3
- package/dist/types/migration.d.ts.map +1 -1
- package/dist/utils/project-detector.d.ts +0 -23
- package/dist/utils/project-detector.d.ts.map +1 -1
- package/dist/utils/project-detector.js +0 -364
- package/dist/utils/project-detector.js.map +1 -1
- package/dist/utils/template-fetcher.d.ts +10 -2
- package/dist/utils/template-fetcher.d.ts.map +1 -1
- package/dist/utils/template-fetcher.js +43 -12
- package/dist/utils/template-fetcher.js.map +1 -1
- package/package.json +1 -1
- package/dist/migrations/manifests/0.4.0-beta.1.json +0 -228
- package/dist/templates/claude/commands/trellis/before-dev.md +0 -29
- package/dist/templates/claude/commands/trellis/check.md +0 -25
- package/dist/templates/codex/skills/before-dev/SKILL.md +0 -34
- package/dist/templates/codex/skills/check/SKILL.md +0 -30
- package/dist/templates/cursor/commands/trellis-before-dev.md +0 -29
- package/dist/templates/cursor/commands/trellis-check.md +0 -25
- package/dist/templates/gemini/commands/trellis/before-dev.toml +0 -33
- package/dist/templates/gemini/commands/trellis/check.toml +0 -29
- package/dist/templates/iflow/commands/trellis/before-dev.md +0 -29
- package/dist/templates/iflow/commands/trellis/check.md +0 -25
- package/dist/templates/kilo/workflows/before-dev.md +0 -29
- package/dist/templates/kilo/workflows/check.md +0 -25
- package/dist/templates/kiro/skills/before-dev/SKILL.md +0 -34
- package/dist/templates/kiro/skills/check/SKILL.md +0 -30
- package/dist/templates/opencode/commands/trellis/before-dev.md +0 -29
- package/dist/templates/opencode/commands/trellis/check.md +0 -25
- package/dist/templates/qoder/skills/before-dev/SKILL.md +0 -34
- package/dist/templates/qoder/skills/check/SKILL.md +0 -30
- package/dist/templates/trellis/scripts/common/git.py +0 -31
- package/dist/templates/trellis/scripts/common/io.py +0 -37
- package/dist/templates/trellis/scripts/common/log.py +0 -45
- package/dist/templates/trellis/scripts/common/packages_context.py +0 -233
- package/dist/templates/trellis/scripts/common/session_context.py +0 -466
- package/dist/templates/trellis/scripts/common/task_context.py +0 -384
- package/dist/templates/trellis/scripts/common/task_store.py +0 -534
- package/dist/templates/trellis/scripts/common/tasks.py +0 -109
- package/dist/templates/trellis/scripts/common/types.py +0 -112
- package/dist/templates/trellis/scripts/hooks/linear_sync.py +0 -243
- package/dist/templates/trellis/scripts/multi_agent/_bootstrap.py +0 -17
- package/dist/templates/trellis/scripts/multi_agent/status_display.py +0 -542
- package/dist/templates/trellis/scripts/multi_agent/status_monitor.py +0 -225
|
@@ -36,7 +36,6 @@ from common.paths import (
|
|
|
36
36
|
get_tasks_dir,
|
|
37
37
|
set_current_task,
|
|
38
38
|
)
|
|
39
|
-
from common.config import get_spec_base, resolve_package
|
|
40
39
|
|
|
41
40
|
|
|
42
41
|
# =============================================================================
|
|
@@ -71,36 +70,36 @@ Fill in the guideline files based on your **existing codebase**.
|
|
|
71
70
|
"""
|
|
72
71
|
|
|
73
72
|
|
|
74
|
-
def write_prd_backend_section(
|
|
73
|
+
def write_prd_backend_section() -> str:
|
|
75
74
|
"""Write PRD backend section."""
|
|
76
|
-
return
|
|
75
|
+
return """
|
|
77
76
|
|
|
78
77
|
### Backend Guidelines
|
|
79
78
|
|
|
80
79
|
| File | What to Document |
|
|
81
80
|
|------|------------------|
|
|
82
|
-
| `.trellis/
|
|
83
|
-
| `.trellis/
|
|
84
|
-
| `.trellis/
|
|
85
|
-
| `.trellis/
|
|
86
|
-
| `.trellis/
|
|
81
|
+
| `.trellis/spec/backend/directory-structure.md` | Where different file types go (routes, services, utils) |
|
|
82
|
+
| `.trellis/spec/backend/database-guidelines.md` | ORM, migrations, query patterns, naming conventions |
|
|
83
|
+
| `.trellis/spec/backend/error-handling.md` | How errors are caught, logged, and returned |
|
|
84
|
+
| `.trellis/spec/backend/logging-guidelines.md` | Log levels, format, what to log |
|
|
85
|
+
| `.trellis/spec/backend/quality-guidelines.md` | Code review standards, testing requirements |
|
|
87
86
|
"""
|
|
88
87
|
|
|
89
88
|
|
|
90
|
-
def write_prd_frontend_section(
|
|
89
|
+
def write_prd_frontend_section() -> str:
|
|
91
90
|
"""Write PRD frontend section."""
|
|
92
|
-
return
|
|
91
|
+
return """
|
|
93
92
|
|
|
94
93
|
### Frontend Guidelines
|
|
95
94
|
|
|
96
95
|
| File | What to Document |
|
|
97
96
|
|------|------------------|
|
|
98
|
-
| `.trellis/
|
|
99
|
-
| `.trellis/
|
|
100
|
-
| `.trellis/
|
|
101
|
-
| `.trellis/
|
|
102
|
-
| `.trellis/
|
|
103
|
-
| `.trellis/
|
|
97
|
+
| `.trellis/spec/frontend/directory-structure.md` | Component/page/hook organization |
|
|
98
|
+
| `.trellis/spec/frontend/component-guidelines.md` | Component patterns, props conventions |
|
|
99
|
+
| `.trellis/spec/frontend/hook-guidelines.md` | Custom hook naming, patterns |
|
|
100
|
+
| `.trellis/spec/frontend/state-management.md` | State library, patterns, what goes where |
|
|
101
|
+
| `.trellis/spec/frontend/type-safety.md` | TypeScript conventions, type organization |
|
|
102
|
+
| `.trellis/spec/frontend/quality-guidelines.md` | Linting, testing, accessibility |
|
|
104
103
|
"""
|
|
105
104
|
|
|
106
105
|
|
|
@@ -169,17 +168,17 @@ After completing this task:
|
|
|
169
168
|
"""
|
|
170
169
|
|
|
171
170
|
|
|
172
|
-
def write_prd(task_dir: Path, project_type: str
|
|
171
|
+
def write_prd(task_dir: Path, project_type: str) -> None:
|
|
173
172
|
"""Write prd.md file."""
|
|
174
173
|
content = write_prd_header()
|
|
175
174
|
|
|
176
175
|
if project_type == "frontend":
|
|
177
|
-
content += write_prd_frontend_section(
|
|
176
|
+
content += write_prd_frontend_section()
|
|
178
177
|
elif project_type == "backend":
|
|
179
|
-
content += write_prd_backend_section(
|
|
178
|
+
content += write_prd_backend_section()
|
|
180
179
|
else: # fullstack
|
|
181
|
-
content += write_prd_backend_section(
|
|
182
|
-
content += write_prd_frontend_section(
|
|
180
|
+
content += write_prd_backend_section()
|
|
181
|
+
content += write_prd_frontend_section()
|
|
183
182
|
|
|
184
183
|
content += write_prd_footer()
|
|
185
184
|
|
|
@@ -191,7 +190,7 @@ def write_prd(task_dir: Path, project_type: str, spec_base: str) -> None:
|
|
|
191
190
|
# Task JSON
|
|
192
191
|
# =============================================================================
|
|
193
192
|
|
|
194
|
-
def write_task_json(task_dir: Path, developer: str, project_type: str
|
|
193
|
+
def write_task_json(task_dir: Path, developer: str, project_type: str) -> None:
|
|
195
194
|
"""Write task.json file."""
|
|
196
195
|
today = datetime.now().strftime("%Y-%m-%d")
|
|
197
196
|
|
|
@@ -201,20 +200,20 @@ def write_task_json(task_dir: Path, developer: str, project_type: str, spec_base
|
|
|
201
200
|
{"name": "Fill frontend guidelines", "status": "pending"},
|
|
202
201
|
{"name": "Add code examples", "status": "pending"},
|
|
203
202
|
]
|
|
204
|
-
related_files = [
|
|
203
|
+
related_files = [".trellis/spec/frontend/"]
|
|
205
204
|
elif project_type == "backend":
|
|
206
205
|
subtasks = [
|
|
207
206
|
{"name": "Fill backend guidelines", "status": "pending"},
|
|
208
207
|
{"name": "Add code examples", "status": "pending"},
|
|
209
208
|
]
|
|
210
|
-
related_files = [
|
|
209
|
+
related_files = [".trellis/spec/backend/"]
|
|
211
210
|
else: # fullstack
|
|
212
211
|
subtasks = [
|
|
213
212
|
{"name": "Fill backend guidelines", "status": "pending"},
|
|
214
213
|
{"name": "Fill frontend guidelines", "status": "pending"},
|
|
215
214
|
{"name": "Add code examples", "status": "pending"},
|
|
216
215
|
]
|
|
217
|
-
related_files = [
|
|
216
|
+
related_files = [".trellis/spec/backend/", ".trellis/spec/frontend/"]
|
|
218
217
|
|
|
219
218
|
task_data = {
|
|
220
219
|
"id": TASK_NAME,
|
|
@@ -265,10 +264,6 @@ def main() -> int:
|
|
|
265
264
|
print(f"Run: python3 ./{DIR_WORKFLOW}/{DIR_SCRIPTS}/init_developer.py <your-name>")
|
|
266
265
|
return 1
|
|
267
266
|
|
|
268
|
-
# Resolve spec base path (monorepo: spec/<package>, single-repo: spec)
|
|
269
|
-
package = resolve_package(repo_root=repo_root)
|
|
270
|
-
spec_base = get_spec_base(package, repo_root)
|
|
271
|
-
|
|
272
267
|
tasks_dir = get_tasks_dir(repo_root)
|
|
273
268
|
task_dir = tasks_dir / TASK_NAME
|
|
274
269
|
relative_path = f"{DIR_WORKFLOW}/{DIR_TASKS}/{TASK_NAME}"
|
|
@@ -282,8 +277,8 @@ def main() -> int:
|
|
|
282
277
|
task_dir.mkdir(parents=True, exist_ok=True)
|
|
283
278
|
|
|
284
279
|
# Write files
|
|
285
|
-
write_task_json(task_dir, developer, project_type
|
|
286
|
-
write_prd(task_dir, project_type
|
|
280
|
+
write_task_json(task_dir, developer, project_type)
|
|
281
|
+
write_prd(task_dir, project_type)
|
|
287
282
|
|
|
288
283
|
# Set as current task
|
|
289
284
|
set_current_task(relative_path, repo_root)
|
|
@@ -22,17 +22,16 @@ This script:
|
|
|
22
22
|
from __future__ import annotations
|
|
23
23
|
|
|
24
24
|
import argparse
|
|
25
|
-
import json
|
|
26
25
|
import shutil
|
|
27
26
|
import subprocess
|
|
28
27
|
import sys
|
|
29
28
|
from pathlib import Path
|
|
30
29
|
|
|
31
|
-
|
|
30
|
+
# Add parent directory to path for imports
|
|
31
|
+
sys.path.insert(0, str(Path(__file__).parent.parent))
|
|
32
32
|
|
|
33
|
-
from common.
|
|
34
|
-
from common.
|
|
35
|
-
from common.paths import FILE_TASK_JSON, get_repo_root
|
|
33
|
+
from common.git_context import _run_git_command
|
|
34
|
+
from common.paths import get_repo_root
|
|
36
35
|
from common.registry import (
|
|
37
36
|
registry_get_file,
|
|
38
37
|
registry_get_task_dir,
|
|
@@ -45,8 +44,38 @@ from common.task_utils import (
|
|
|
45
44
|
is_safe_task_path,
|
|
46
45
|
)
|
|
47
46
|
|
|
48
|
-
#
|
|
49
|
-
#
|
|
47
|
+
# =============================================================================
|
|
48
|
+
# Colors
|
|
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
|
+
# =============================================================================
|
|
50
79
|
|
|
51
80
|
|
|
52
81
|
def confirm(prompt: str, skip_confirm: bool) -> bool:
|
|
@@ -62,26 +91,6 @@ def confirm(prompt: str, skip_confirm: bool) -> bool:
|
|
|
62
91
|
return response.lower() in ("y", "yes")
|
|
63
92
|
|
|
64
93
|
|
|
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
|
-
|
|
85
94
|
# =============================================================================
|
|
86
95
|
# Commands
|
|
87
96
|
# =============================================================================
|
|
@@ -101,6 +110,8 @@ def cmd_list(repo_root: Path) -> int:
|
|
|
101
110
|
print(f"{Colors.BLUE}=== Registered Agents ==={Colors.NC}")
|
|
102
111
|
print()
|
|
103
112
|
|
|
113
|
+
import json
|
|
114
|
+
|
|
104
115
|
data = json.loads(registry_file.read_text(encoding="utf-8"))
|
|
105
116
|
agents = data.get("agents", [])
|
|
106
117
|
|
|
@@ -154,11 +165,10 @@ def cleanup_registry_only(search: str, repo_root: Path, skip_confirm: bool) -> i
|
|
|
154
165
|
log_info("Aborted")
|
|
155
166
|
return 0
|
|
156
167
|
|
|
157
|
-
#
|
|
168
|
+
# Archive task directory if exists
|
|
158
169
|
if task_dir and is_safe_task_path(task_dir, repo_root):
|
|
159
170
|
task_dir_abs = repo_root / task_dir
|
|
160
171
|
if task_dir_abs.is_dir():
|
|
161
|
-
_warn_submodule_prs(task_dir_abs)
|
|
162
172
|
result = archive_task_complete(task_dir_abs, repo_root)
|
|
163
173
|
if "archived_to" in result:
|
|
164
174
|
dest = Path(result["archived_to"])
|
|
@@ -181,7 +191,7 @@ def cleanup_worktree(
|
|
|
181
191
|
) -> int:
|
|
182
192
|
"""Cleanup single worktree."""
|
|
183
193
|
# Find worktree path for branch
|
|
184
|
-
_, worktree_list, _ =
|
|
194
|
+
_, worktree_list, _ = _run_git_command(
|
|
185
195
|
["worktree", "list", "--porcelain"], cwd=repo_root
|
|
186
196
|
)
|
|
187
197
|
|
|
@@ -213,12 +223,7 @@ def cleanup_worktree(
|
|
|
213
223
|
log_info("Aborted")
|
|
214
224
|
return 0
|
|
215
225
|
|
|
216
|
-
# 1. Archive task
|
|
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)
|
|
226
|
+
# 1. Archive task
|
|
222
227
|
archive_task(worktree_path, repo_root)
|
|
223
228
|
|
|
224
229
|
# 2. Remove from registry
|
|
@@ -227,7 +232,7 @@ def cleanup_worktree(
|
|
|
227
232
|
|
|
228
233
|
# 3. Remove worktree
|
|
229
234
|
log_info("Removing worktree...")
|
|
230
|
-
ret, _, _ =
|
|
235
|
+
ret, _, _ = _run_git_command(
|
|
231
236
|
["worktree", "remove", worktree_path, "--force"], cwd=repo_root
|
|
232
237
|
)
|
|
233
238
|
if ret != 0:
|
|
@@ -242,7 +247,7 @@ def cleanup_worktree(
|
|
|
242
247
|
# 4. Delete branch (optional)
|
|
243
248
|
if not keep_branch:
|
|
244
249
|
log_info("Deleting branch...")
|
|
245
|
-
ret, _, _ =
|
|
250
|
+
ret, _, _ = _run_git_command(["branch", "-D", branch], cwd=repo_root)
|
|
246
251
|
if ret != 0:
|
|
247
252
|
log_warn("Could not delete branch (may be checked out elsewhere)")
|
|
248
253
|
|
|
@@ -253,7 +258,7 @@ def cleanup_worktree(
|
|
|
253
258
|
def cmd_merged(repo_root: Path, skip_confirm: bool, keep_branch: bool) -> int:
|
|
254
259
|
"""Cleanup merged worktrees."""
|
|
255
260
|
# Get main branch
|
|
256
|
-
_, head_out, _ =
|
|
261
|
+
_, head_out, _ = _run_git_command(
|
|
257
262
|
["symbolic-ref", "refs/remotes/origin/HEAD"], cwd=repo_root
|
|
258
263
|
)
|
|
259
264
|
main_branch = head_out.strip().replace("refs/remotes/origin/", "") or "main"
|
|
@@ -262,7 +267,7 @@ def cmd_merged(repo_root: Path, skip_confirm: bool, keep_branch: bool) -> int:
|
|
|
262
267
|
print()
|
|
263
268
|
|
|
264
269
|
# Get merged branches
|
|
265
|
-
_, merged_out, _ =
|
|
270
|
+
_, merged_out, _ = _run_git_command(
|
|
266
271
|
["branch", "--merged", main_branch], cwd=repo_root
|
|
267
272
|
)
|
|
268
273
|
merged_branches = []
|
|
@@ -276,7 +281,7 @@ def cmd_merged(repo_root: Path, skip_confirm: bool, keep_branch: bool) -> int:
|
|
|
276
281
|
return 0
|
|
277
282
|
|
|
278
283
|
# Get worktree list
|
|
279
|
-
_, worktree_list, _ =
|
|
284
|
+
_, worktree_list, _ = _run_git_command(["worktree", "list"], cwd=repo_root)
|
|
280
285
|
|
|
281
286
|
worktree_branches = []
|
|
282
287
|
for branch in merged_branches:
|
|
@@ -305,7 +310,7 @@ def cmd_all(repo_root: Path, skip_confirm: bool, keep_branch: bool) -> int:
|
|
|
305
310
|
print()
|
|
306
311
|
|
|
307
312
|
# Get worktree list
|
|
308
|
-
_, worktree_list, _ =
|
|
313
|
+
_, worktree_list, _ = _run_git_command(
|
|
309
314
|
["worktree", "list", "--porcelain"], cwd=repo_root
|
|
310
315
|
)
|
|
311
316
|
|
|
@@ -335,7 +340,7 @@ def cmd_all(repo_root: Path, skip_confirm: bool, keep_branch: bool) -> int:
|
|
|
335
340
|
# Get branch for each worktree
|
|
336
341
|
for wt in worktrees:
|
|
337
342
|
# Find branch name from worktree list
|
|
338
|
-
_, wt_list, _ =
|
|
343
|
+
_, wt_list, _ = _run_git_command(["worktree", "list"], cwd=repo_root)
|
|
339
344
|
for line in wt_list.splitlines():
|
|
340
345
|
if wt in line:
|
|
341
346
|
# Extract branch from [branch] format
|