@mindfoldhq/trellis 0.1.9 → 0.2.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.map +1 -1
- package/dist/commands/init.js +12 -6
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/update.d.ts +1 -0
- package/dist/commands/update.d.ts.map +1 -1
- package/dist/commands/update.js +669 -38
- package/dist/commands/update.js.map +1 -1
- package/dist/configurators/opencode.js +1 -1
- package/dist/configurators/opencode.js.map +1 -1
- package/dist/configurators/workflow.d.ts +4 -3
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +23 -20
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/constants/paths.d.ts +29 -30
- package/dist/constants/paths.d.ts.map +1 -1
- package/dist/constants/paths.js +32 -35
- package/dist/constants/paths.js.map +1 -1
- package/dist/migrations/index.d.ts +35 -0
- package/dist/migrations/index.d.ts.map +1 -0
- package/dist/migrations/index.js +124 -0
- package/dist/migrations/index.js.map +1 -0
- package/dist/migrations/manifests/0.1.9.json +30 -0
- package/dist/migrations/manifests/0.2.0.json +43 -0
- package/dist/templates/claude/agents/check.md +3 -3
- package/dist/templates/claude/agents/debug.md +1 -1
- package/dist/templates/claude/agents/dispatch.md +12 -12
- package/dist/templates/claude/agents/implement.md +6 -6
- package/dist/templates/claude/agents/plan.md +37 -37
- package/dist/templates/claude/agents/research.md +1 -1
- package/dist/templates/claude/commands/before-backend-dev.md +5 -5
- package/dist/templates/claude/commands/before-frontend-dev.md +5 -5
- package/dist/templates/claude/commands/break-loop.md +2 -2
- package/dist/templates/claude/commands/check-backend.md +6 -6
- package/dist/templates/claude/commands/check-cross-layer.md +5 -5
- package/dist/templates/claude/commands/check-frontend.md +6 -6
- package/dist/templates/claude/commands/create-command.md +3 -3
- package/dist/templates/claude/commands/finish-work.md +6 -6
- package/dist/templates/claude/commands/integrate-skill.md +11 -11
- package/dist/templates/claude/commands/{onboard-developer.md → onboard.md} +31 -28
- package/dist/templates/claude/commands/parallel.md +17 -17
- package/dist/templates/claude/commands/{record-agent-flow.md → record-session.md} +7 -7
- package/dist/templates/claude/commands/start.md +36 -36
- package/dist/templates/claude/hooks/inject-subagent-context.py +77 -76
- package/dist/templates/claude/hooks/ralph-loop.py +18 -18
- package/dist/templates/claude/hooks/session-start.py +4 -4
- package/dist/templates/cursor/commands/before-backend-dev.md +5 -5
- package/dist/templates/cursor/commands/before-frontend-dev.md +5 -5
- package/dist/templates/cursor/commands/break-loop.md +2 -2
- package/dist/templates/cursor/commands/check-backend.md +6 -6
- package/dist/templates/cursor/commands/check-cross-layer.md +5 -5
- package/dist/templates/cursor/commands/check-frontend.md +6 -6
- package/dist/templates/cursor/commands/create-command.md +3 -3
- package/dist/templates/cursor/commands/finish-work.md +6 -6
- package/dist/templates/cursor/commands/integrate-skill.md +11 -11
- package/dist/templates/cursor/commands/{onboard-developer.md → onboard.md} +31 -28
- package/dist/templates/cursor/commands/{record-agent-flow.md → record-session.md} +7 -7
- package/dist/templates/cursor/commands/start.md +25 -25
- package/dist/templates/extract.d.ts +2 -2
- package/dist/templates/extract.js +2 -2
- package/dist/templates/markdown/agents.md +2 -2
- package/dist/templates/markdown/gitignore.txt +2 -2
- package/dist/templates/markdown/index.d.ts +1 -0
- package/dist/templates/markdown/index.d.ts.map +1 -1
- package/dist/templates/markdown/index.js +4 -2
- package/dist/templates/markdown/index.js.map +1 -1
- package/dist/templates/markdown/{agent-traces-index.md → workspace-index.md} +14 -14
- package/dist/templates/trellis/index.d.ts +7 -1
- package/dist/templates/trellis/index.d.ts.map +1 -1
- package/dist/templates/trellis/index.js +14 -2
- package/dist/templates/trellis/index.js.map +1 -1
- package/dist/templates/trellis/scripts/add-session.sh +26 -26
- package/dist/templates/trellis/scripts/common/developer.sh +20 -21
- package/dist/templates/trellis/scripts/common/git-context.sh +90 -115
- package/dist/templates/trellis/scripts/common/paths.sh +53 -63
- package/dist/templates/trellis/scripts/common/phase.sh +40 -40
- package/dist/templates/trellis/scripts/common/registry.sh +13 -13
- package/dist/templates/trellis/scripts/common/task-queue.sh +142 -0
- package/dist/templates/trellis/scripts/common/task-utils.sh +151 -0
- package/dist/templates/trellis/scripts/common/worktree.sh +3 -3
- package/dist/templates/trellis/scripts/create-bootstrap.sh +43 -42
- package/dist/templates/trellis/scripts/init-developer.sh +1 -1
- package/dist/templates/trellis/scripts/multi-agent/cleanup.sh +33 -33
- package/dist/templates/trellis/scripts/multi-agent/create-pr.sh +30 -30
- package/dist/templates/trellis/scripts/multi-agent/plan.sh +28 -28
- package/dist/templates/trellis/scripts/multi-agent/start.sh +56 -56
- package/dist/templates/trellis/scripts/multi-agent/status.sh +59 -59
- package/dist/templates/trellis/scripts/{feature.sh → task.sh} +235 -185
- package/dist/templates/trellis/workflow.md +71 -74
- package/dist/types/migration.d.ts +74 -0
- package/dist/types/migration.d.ts.map +1 -0
- package/dist/types/migration.js +8 -0
- package/dist/types/migration.js.map +1 -0
- package/dist/utils/template-hash.d.ts +78 -0
- package/dist/utils/template-hash.d.ts.map +1 -0
- package/dist/utils/template-hash.js +234 -0
- package/dist/utils/template-hash.js.map +1 -0
- package/package.json +1 -1
- package/dist/templates/trellis/scripts/common/backlog.sh +0 -220
- package/dist/templates/trellis/scripts/common/feature-utils.sh +0 -194
- /package/dist/templates/trellis/{backlog → tasks}/.gitkeep +0 -0
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
# =============================================================================
|
|
3
3
|
# Multi-Agent Pipeline: Start Worktree Agent
|
|
4
4
|
# =============================================================================
|
|
5
|
-
# Usage: ./start.sh <
|
|
6
|
-
# Example: ./start.sh .trellis/
|
|
5
|
+
# Usage: ./start.sh <task-dir>
|
|
6
|
+
# Example: ./start.sh .trellis/tasks/01-21-my-task
|
|
7
7
|
#
|
|
8
8
|
# This script:
|
|
9
9
|
# 1. Creates worktree (if not exists) with dependency install
|
|
10
10
|
# 2. Copies environment files (from worktree.yaml config)
|
|
11
|
-
# 3. Sets .current-
|
|
11
|
+
# 3. Sets .current-task in worktree
|
|
12
12
|
# 4. Starts claude agent in background
|
|
13
13
|
# 5. Registers agent to registry.json
|
|
14
14
|
#
|
|
15
15
|
# Prerequisites:
|
|
16
|
-
# -
|
|
16
|
+
# - task.json must exist with 'branch' field
|
|
17
17
|
# - .claude/agents/dispatch.md must exist
|
|
18
18
|
#
|
|
19
19
|
# Configuration: .trellis/worktree.yaml
|
|
@@ -48,30 +48,30 @@ DISPATCH_MD_PATH=".claude/agents/dispatch.md"
|
|
|
48
48
|
# =============================================================================
|
|
49
49
|
# Parse Arguments
|
|
50
50
|
# =============================================================================
|
|
51
|
-
|
|
52
|
-
if [ -z "$
|
|
53
|
-
log_error "
|
|
54
|
-
echo "Usage: $0 <
|
|
55
|
-
echo "Example: $0 .trellis/
|
|
51
|
+
TASK_DIR=$1
|
|
52
|
+
if [ -z "$TASK_DIR" ]; then
|
|
53
|
+
log_error "Task directory required"
|
|
54
|
+
echo "Usage: $0 <task-dir>"
|
|
55
|
+
echo "Example: $0 .trellis/tasks/01-21-my-task"
|
|
56
56
|
exit 1
|
|
57
57
|
fi
|
|
58
58
|
|
|
59
59
|
# Normalize paths
|
|
60
|
-
if [[ "$
|
|
61
|
-
|
|
62
|
-
|
|
60
|
+
if [[ "$TASK_DIR" = /* ]]; then
|
|
61
|
+
TASK_DIR_RELATIVE="${TASK_DIR#$PROJECT_ROOT/}"
|
|
62
|
+
TASK_DIR_ABS="$TASK_DIR"
|
|
63
63
|
else
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
TASK_DIR_RELATIVE="$TASK_DIR"
|
|
65
|
+
TASK_DIR_ABS="${PROJECT_ROOT}/${TASK_DIR}"
|
|
66
66
|
fi
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
TASK_JSON="${TASK_DIR_ABS}/$FILE_TASK_JSON"
|
|
69
69
|
|
|
70
70
|
# =============================================================================
|
|
71
71
|
# Validation
|
|
72
72
|
# =============================================================================
|
|
73
|
-
if [ ! -f "$
|
|
74
|
-
log_error "
|
|
73
|
+
if [ ! -f "$TASK_JSON" ]; then
|
|
74
|
+
log_error "task.json not found at ${TASK_JSON}"
|
|
75
75
|
exit 1
|
|
76
76
|
fi
|
|
77
77
|
|
|
@@ -88,24 +88,24 @@ if [ ! -f "$CONFIG_FILE" ]; then
|
|
|
88
88
|
fi
|
|
89
89
|
|
|
90
90
|
# =============================================================================
|
|
91
|
-
# Read
|
|
91
|
+
# Read Task Config
|
|
92
92
|
# =============================================================================
|
|
93
93
|
echo ""
|
|
94
94
|
echo -e "${BLUE}=== Multi-Agent Pipeline: Start ===${NC}"
|
|
95
|
-
log_info "
|
|
95
|
+
log_info "Task: ${TASK_DIR_ABS}"
|
|
96
96
|
|
|
97
|
-
BRANCH=$(jq -r '.branch' "$
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
WORKTREE_PATH=$(jq -r '.worktree_path // empty' "$
|
|
97
|
+
BRANCH=$(jq -r '.branch' "$TASK_JSON")
|
|
98
|
+
TASK_NAME=$(jq -r '.name' "$TASK_JSON")
|
|
99
|
+
TASK_STATUS=$(jq -r '.status' "$TASK_JSON")
|
|
100
|
+
WORKTREE_PATH=$(jq -r '.worktree_path // empty' "$TASK_JSON")
|
|
101
101
|
|
|
102
|
-
# Check if
|
|
103
|
-
if [ "$
|
|
104
|
-
log_error "
|
|
105
|
-
if [ -f "${
|
|
102
|
+
# Check if task was rejected
|
|
103
|
+
if [ "$TASK_STATUS" = "rejected" ]; then
|
|
104
|
+
log_error "Task was rejected by Plan Agent"
|
|
105
|
+
if [ -f "${TASK_DIR_ABS}/REJECTED.md" ]; then
|
|
106
106
|
echo ""
|
|
107
107
|
echo -e "${YELLOW}Rejection reason:${NC}"
|
|
108
|
-
cat "${
|
|
108
|
+
cat "${TASK_DIR_ABS}/REJECTED.md"
|
|
109
109
|
fi
|
|
110
110
|
echo ""
|
|
111
111
|
log_info "To retry, delete this directory and run plan.sh again with revised requirements"
|
|
@@ -113,21 +113,21 @@ if [ "$FEATURE_STATUS" = "rejected" ]; then
|
|
|
113
113
|
fi
|
|
114
114
|
|
|
115
115
|
# Check if prd.md exists (plan completed successfully)
|
|
116
|
-
if [ ! -f "${
|
|
116
|
+
if [ ! -f "${TASK_DIR_ABS}/prd.md" ]; then
|
|
117
117
|
log_error "prd.md not found - Plan Agent may not have completed"
|
|
118
|
-
log_info "Check plan log: ${
|
|
118
|
+
log_info "Check plan log: ${TASK_DIR_ABS}/.plan-log"
|
|
119
119
|
exit 1
|
|
120
120
|
fi
|
|
121
121
|
|
|
122
122
|
if [ -z "$BRANCH" ] || [ "$BRANCH" = "null" ]; then
|
|
123
|
-
log_error "branch field not set in
|
|
123
|
+
log_error "branch field not set in task.json"
|
|
124
124
|
log_info "Please set branch field first, e.g.:"
|
|
125
|
-
log_info " jq '.branch = \"
|
|
125
|
+
log_info " jq '.branch = \"task/my-task\"' task.json > tmp && mv tmp task.json"
|
|
126
126
|
exit 1
|
|
127
127
|
fi
|
|
128
128
|
|
|
129
129
|
log_info "Branch: ${BRANCH}"
|
|
130
|
-
log_info "Name: ${
|
|
130
|
+
log_info "Name: ${TASK_NAME}"
|
|
131
131
|
|
|
132
132
|
# =============================================================================
|
|
133
133
|
# Step 1: Create Worktree (if not exists)
|
|
@@ -160,10 +160,10 @@ if [ -z "$WORKTREE_PATH" ] || [ ! -d "$WORKTREE_PATH" ]; then
|
|
|
160
160
|
|
|
161
161
|
log_success "Worktree created: ${WORKTREE_PATH}"
|
|
162
162
|
|
|
163
|
-
# Update
|
|
163
|
+
# Update task.json with worktree_path and base_branch
|
|
164
164
|
jq --arg path "$WORKTREE_PATH" --arg base "$BASE_BRANCH" \
|
|
165
|
-
'.worktree_path = $path | .base_branch = $base' "$
|
|
166
|
-
mv "${
|
|
165
|
+
'.worktree_path = $path | .base_branch = $base' "$TASK_JSON" > "${TASK_JSON}.tmp"
|
|
166
|
+
mv "${TASK_JSON}.tmp" "$TASK_JSON"
|
|
167
167
|
|
|
168
168
|
# ----- Copy environment files -----
|
|
169
169
|
log_info "Copying environment files..."
|
|
@@ -189,12 +189,12 @@ if [ -z "$WORKTREE_PATH" ] || [ ! -d "$WORKTREE_PATH" ]; then
|
|
|
189
189
|
log_success "Copied $COPY_COUNT file(s)"
|
|
190
190
|
fi
|
|
191
191
|
|
|
192
|
-
# ----- Copy
|
|
193
|
-
log_info "Copying
|
|
194
|
-
|
|
195
|
-
mkdir -p "$(dirname "$
|
|
196
|
-
cp -r "$
|
|
197
|
-
log_success "
|
|
192
|
+
# ----- Copy task directory (may not be committed yet) -----
|
|
193
|
+
log_info "Copying task directory..."
|
|
194
|
+
TASK_TARGET_DIR="${WORKTREE_PATH}/${TASK_DIR_RELATIVE}"
|
|
195
|
+
mkdir -p "$(dirname "$TASK_TARGET_DIR")"
|
|
196
|
+
cp -r "$TASK_DIR_ABS" "$(dirname "$TASK_TARGET_DIR")/"
|
|
197
|
+
log_success "Task directory copied to worktree"
|
|
198
198
|
|
|
199
199
|
# ----- Run post_create hooks -----
|
|
200
200
|
log_info "Running post_create hooks..."
|
|
@@ -223,22 +223,22 @@ else
|
|
|
223
223
|
fi
|
|
224
224
|
|
|
225
225
|
# =============================================================================
|
|
226
|
-
# Step 2: Set .current-
|
|
226
|
+
# Step 2: Set .current-task in Worktree
|
|
227
227
|
# =============================================================================
|
|
228
|
-
log_info "Step 2: Setting current
|
|
228
|
+
log_info "Step 2: Setting current task in worktree..."
|
|
229
229
|
|
|
230
230
|
mkdir -p "${WORKTREE_PATH}/$DIR_WORKFLOW"
|
|
231
|
-
echo "$
|
|
232
|
-
log_success "Current
|
|
231
|
+
echo "$TASK_DIR_RELATIVE" > "${WORKTREE_PATH}/$DIR_WORKFLOW/$FILE_CURRENT_TASK"
|
|
232
|
+
log_success "Current task set: ${TASK_DIR_RELATIVE}"
|
|
233
233
|
|
|
234
234
|
# =============================================================================
|
|
235
235
|
# Step 3: Prepare and Start Claude Agent
|
|
236
236
|
# =============================================================================
|
|
237
237
|
log_info "Step 3: Starting Claude agent..."
|
|
238
238
|
|
|
239
|
-
# Update
|
|
240
|
-
jq '.status = "in_progress"' "$
|
|
241
|
-
mv "${
|
|
239
|
+
# Update task status
|
|
240
|
+
jq '.status = "in_progress"' "$TASK_JSON" > "${TASK_JSON}.tmp"
|
|
241
|
+
mv "${TASK_JSON}.tmp" "$TASK_JSON"
|
|
242
242
|
|
|
243
243
|
cd "$WORKTREE_PATH"
|
|
244
244
|
|
|
@@ -275,15 +275,15 @@ log_success "Agent started with PID: ${AGENT_PID}"
|
|
|
275
275
|
log_info "Step 4: Registering agent to registry..."
|
|
276
276
|
|
|
277
277
|
# Generate agent ID
|
|
278
|
-
|
|
279
|
-
if [ -z "$
|
|
280
|
-
|
|
278
|
+
TASK_ID=$(jq -r '.id // empty' "$TASK_JSON")
|
|
279
|
+
if [ -z "$TASK_ID" ]; then
|
|
280
|
+
TASK_ID=$(echo "$BRANCH" | sed 's/\//-/g')
|
|
281
281
|
fi
|
|
282
282
|
|
|
283
283
|
# Use common registry function
|
|
284
|
-
registry_add_agent "$
|
|
284
|
+
registry_add_agent "$TASK_ID" "$WORKTREE_PATH" "$AGENT_PID" "$TASK_DIR_RELATIVE" "$PROJECT_ROOT"
|
|
285
285
|
|
|
286
|
-
log_success "Agent registered: ${
|
|
286
|
+
log_success "Agent registered: ${TASK_ID}"
|
|
287
287
|
|
|
288
288
|
# =============================================================================
|
|
289
289
|
# Summary
|
|
@@ -291,10 +291,10 @@ log_success "Agent registered: ${FEATURE_ID}"
|
|
|
291
291
|
echo ""
|
|
292
292
|
echo -e "${GREEN}=== Agent Started ===${NC}"
|
|
293
293
|
echo ""
|
|
294
|
-
echo " ID: $
|
|
294
|
+
echo " ID: $TASK_ID"
|
|
295
295
|
echo " PID: $AGENT_PID"
|
|
296
296
|
echo " Worktree: $WORKTREE_PATH"
|
|
297
|
-
echo "
|
|
297
|
+
echo " Task: $TASK_DIR_RELATIVE"
|
|
298
298
|
echo " Log: $LOG_FILE"
|
|
299
299
|
echo " Registry: $(registry_get_file "$PROJECT_ROOT")"
|
|
300
300
|
echo ""
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
# Multi-Agent Pipeline: Status Monitor
|
|
4
4
|
# =============================================================================
|
|
5
5
|
# Usage:
|
|
6
|
-
# ./status.sh Show summary of all
|
|
6
|
+
# ./status.sh Show summary of all tasks (default)
|
|
7
7
|
# ./status.sh --list List all worktrees and agents
|
|
8
|
-
# ./status.sh --detail <
|
|
9
|
-
# ./status.sh --watch <
|
|
10
|
-
# ./status.sh --log <
|
|
8
|
+
# ./status.sh --detail <task> Detailed task status
|
|
9
|
+
# ./status.sh --watch <task> Watch agent log in real-time
|
|
10
|
+
# ./status.sh --log <task> Show recent log entries
|
|
11
11
|
# ./status.sh --registry Show agent registry
|
|
12
12
|
# =============================================================================
|
|
13
13
|
|
|
@@ -18,7 +18,7 @@ source "$SCRIPT_DIR/../common/paths.sh"
|
|
|
18
18
|
source "$SCRIPT_DIR/../common/worktree.sh"
|
|
19
19
|
source "$SCRIPT_DIR/../common/developer.sh"
|
|
20
20
|
source "$SCRIPT_DIR/../common/phase.sh"
|
|
21
|
-
source "$SCRIPT_DIR/../common/
|
|
21
|
+
source "$SCRIPT_DIR/../common/task-queue.sh"
|
|
22
22
|
|
|
23
23
|
# Colors
|
|
24
24
|
RED='\033[0;31m'
|
|
@@ -99,7 +99,7 @@ status_color() {
|
|
|
99
99
|
esac
|
|
100
100
|
}
|
|
101
101
|
|
|
102
|
-
# Find agent by
|
|
102
|
+
# Find agent by task name or ID
|
|
103
103
|
find_agent() {
|
|
104
104
|
local search="$1"
|
|
105
105
|
AGENTS_DIR=$(get_agents_dir)
|
|
@@ -112,9 +112,9 @@ find_agent() {
|
|
|
112
112
|
# Try exact ID match first (use -c for compact single-line JSON output)
|
|
113
113
|
local agent=$(jq -c --arg id "$search" '.agents[] | select(.id == $id)' "$REGISTRY_FILE" 2>/dev/null)
|
|
114
114
|
|
|
115
|
-
# Try partial match on
|
|
115
|
+
# Try partial match on task_dir (use -c for compact single-line JSON output)
|
|
116
116
|
if [ -z "$agent" ] || [ "$agent" = "null" ]; then
|
|
117
|
-
agent=$(jq -c --arg search "$search" '[.agents[] | select(.
|
|
117
|
+
agent=$(jq -c --arg search "$search" '[.agents[] | select(.task_dir | contains($search))] | first' "$REGISTRY_FILE" 2>/dev/null)
|
|
118
118
|
fi
|
|
119
119
|
|
|
120
120
|
echo "$agent"
|
|
@@ -185,18 +185,18 @@ cmd_help() {
|
|
|
185
185
|
Multi-Agent Pipeline: Status Monitor
|
|
186
186
|
|
|
187
187
|
Usage:
|
|
188
|
-
$0 Show summary of all
|
|
188
|
+
$0 Show summary of all tasks
|
|
189
189
|
$0 --list List all worktrees and agents
|
|
190
|
-
$0 --detail <
|
|
191
|
-
$0 --progress <
|
|
192
|
-
$0 --watch <
|
|
193
|
-
$0 --log <
|
|
190
|
+
$0 --detail <task> Detailed task status
|
|
191
|
+
$0 --progress <task> Quick progress view with recent activity
|
|
192
|
+
$0 --watch <task> Watch agent log in real-time
|
|
193
|
+
$0 --log <task> Show recent log entries
|
|
194
194
|
$0 --registry Show agent registry
|
|
195
195
|
|
|
196
196
|
Examples:
|
|
197
|
-
$0 --detail my-
|
|
198
|
-
$0 --progress my-
|
|
199
|
-
$0 --watch 16-worktree-support
|
|
197
|
+
$0 --detail my-task
|
|
198
|
+
$0 --progress my-task
|
|
199
|
+
$0 --watch 01-16-worktree-support
|
|
200
200
|
$0 --log worktree-support
|
|
201
201
|
EOF
|
|
202
202
|
}
|
|
@@ -288,9 +288,9 @@ count_modified_files() {
|
|
|
288
288
|
cmd_summary() {
|
|
289
289
|
ensure_developer
|
|
290
290
|
|
|
291
|
-
local
|
|
292
|
-
if [ ! -d "$
|
|
293
|
-
echo "No
|
|
291
|
+
local tasks_dir=$(get_tasks_dir)
|
|
292
|
+
if [ ! -d "$tasks_dir" ]; then
|
|
293
|
+
echo "No tasks directory found"
|
|
294
294
|
exit 0
|
|
295
295
|
fi
|
|
296
296
|
|
|
@@ -307,27 +307,27 @@ cmd_summary() {
|
|
|
307
307
|
done < <(jq -r '.agents[].pid' "$REGISTRY_FILE" 2>/dev/null)
|
|
308
308
|
fi
|
|
309
309
|
|
|
310
|
-
#
|
|
311
|
-
local
|
|
310
|
+
# Task queue stats
|
|
311
|
+
local task_stats=$(get_task_queue_stats "$PROJECT_ROOT")
|
|
312
312
|
|
|
313
313
|
echo -e "${BLUE}=== Multi-Agent Status ===${NC}"
|
|
314
314
|
echo -e " Agents: ${GREEN}${running_count}${NC} running / ${total_agents} registered"
|
|
315
|
-
echo -e "
|
|
315
|
+
echo -e " Tasks: ${task_stats}"
|
|
316
316
|
echo ""
|
|
317
317
|
|
|
318
318
|
# Check if any agents are running and show detailed view
|
|
319
319
|
local has_running_agent=false
|
|
320
320
|
|
|
321
|
-
for d in "$
|
|
321
|
+
for d in "$tasks_dir"/*/; do
|
|
322
322
|
[ ! -d "$d" ] && continue
|
|
323
323
|
[[ "$(basename "$d")" == "archive" ]] && continue
|
|
324
324
|
|
|
325
325
|
local name=$(basename "$d")
|
|
326
|
-
local
|
|
326
|
+
local task_json="$d/task.json"
|
|
327
327
|
local status="unknown"
|
|
328
328
|
|
|
329
|
-
if [ -f "$
|
|
330
|
-
status=$(jq -r '.status // "unknown"' "$
|
|
329
|
+
if [ -f "$task_json" ]; then
|
|
330
|
+
status=$(jq -r '.status // "unknown"' "$task_json")
|
|
331
331
|
fi
|
|
332
332
|
|
|
333
333
|
# Check agent status
|
|
@@ -338,7 +338,7 @@ cmd_summary() {
|
|
|
338
338
|
local is_agent_running=false
|
|
339
339
|
|
|
340
340
|
if [ -f "$REGISTRY_FILE" ]; then
|
|
341
|
-
agent_info=$(jq -c --arg name "$name" '[.agents[] | select(.
|
|
341
|
+
agent_info=$(jq -c --arg name "$name" '[.agents[] | select(.task_dir | contains($name))] | first' "$REGISTRY_FILE" 2>/dev/null)
|
|
342
342
|
if [ -n "$agent_info" ] && [ "$agent_info" != "null" ]; then
|
|
343
343
|
pid=$(echo "$agent_info" | jq -r '.pid')
|
|
344
344
|
worktree=$(echo "$agent_info" | jq -r '.worktree_path')
|
|
@@ -354,11 +354,11 @@ cmd_summary() {
|
|
|
354
354
|
|
|
355
355
|
if [ "$is_agent_running" = true ]; then
|
|
356
356
|
# Detailed view for running agents
|
|
357
|
-
# Read
|
|
358
|
-
local
|
|
359
|
-
local
|
|
360
|
-
local phase_source="$
|
|
361
|
-
[ -f "$
|
|
357
|
+
# Read task.json from worktree (has live phase info)
|
|
358
|
+
local task_dir_rel=$(echo "$agent_info" | jq -r '.task_dir')
|
|
359
|
+
local worktree_task_json="$worktree/$task_dir_rel/task.json"
|
|
360
|
+
local phase_source="$task_json"
|
|
361
|
+
[ -f "$worktree_task_json" ] && phase_source="$worktree_task_json"
|
|
362
362
|
|
|
363
363
|
local phase_info=$(get_phase_info "$phase_source")
|
|
364
364
|
local elapsed=$(calc_elapsed "$started")
|
|
@@ -396,8 +396,8 @@ cmd_summary() {
|
|
|
396
396
|
echo ""
|
|
397
397
|
else
|
|
398
398
|
# No agent, just show status with developer and priority
|
|
399
|
-
local developer=$(jq -r '.developer // "?"' "$
|
|
400
|
-
local priority=$(jq -r '.priority // "?"' "$
|
|
399
|
+
local developer=$(jq -r '.developer // "?"' "$task_json" 2>/dev/null)
|
|
400
|
+
local priority=$(jq -r '.priority // "?"' "$task_json" 2>/dev/null)
|
|
401
401
|
|
|
402
402
|
# Color priority
|
|
403
403
|
local priority_color="${NC}"
|
|
@@ -421,7 +421,7 @@ cmd_summary() {
|
|
|
421
421
|
|
|
422
422
|
cmd_progress() {
|
|
423
423
|
if [ -z "$TARGET" ]; then
|
|
424
|
-
echo "Usage: $0 --progress <
|
|
424
|
+
echo "Usage: $0 --progress <task>"
|
|
425
425
|
exit 1
|
|
426
426
|
fi
|
|
427
427
|
|
|
@@ -434,7 +434,7 @@ cmd_progress() {
|
|
|
434
434
|
local id=$(echo "$agent" | jq -r '.id')
|
|
435
435
|
local pid=$(echo "$agent" | jq -r '.pid')
|
|
436
436
|
local worktree=$(echo "$agent" | jq -r '.worktree_path')
|
|
437
|
-
local
|
|
437
|
+
local task_dir=$(echo "$agent" | jq -r '.task_dir')
|
|
438
438
|
local started=$(echo "$agent" | jq -r '.started_at')
|
|
439
439
|
local log_file="$worktree/.agent-log"
|
|
440
440
|
|
|
@@ -443,13 +443,13 @@ cmd_progress() {
|
|
|
443
443
|
exit 1
|
|
444
444
|
fi
|
|
445
445
|
|
|
446
|
-
# Get phase info from worktree's
|
|
447
|
-
local
|
|
446
|
+
# Get phase info from worktree's task.json
|
|
447
|
+
local worktree_task_json="$worktree/$task_dir/task.json"
|
|
448
448
|
local phase_info="N/A"
|
|
449
449
|
local current_phase=0
|
|
450
|
-
if [ -f "$
|
|
451
|
-
phase_info=$(get_phase_info "$
|
|
452
|
-
current_phase=$(jq -r '.current_phase // 0' "$
|
|
450
|
+
if [ -f "$worktree_task_json" ]; then
|
|
451
|
+
phase_info=$(get_phase_info "$worktree_task_json")
|
|
452
|
+
current_phase=$(jq -r '.current_phase // 0' "$worktree_task_json")
|
|
453
453
|
fi
|
|
454
454
|
|
|
455
455
|
local elapsed=$(calc_elapsed "$started")
|
|
@@ -519,7 +519,7 @@ cmd_progress() {
|
|
|
519
519
|
|
|
520
520
|
cmd_detail() {
|
|
521
521
|
if [ -z "$TARGET" ]; then
|
|
522
|
-
echo "Usage: $0 --detail <
|
|
522
|
+
echo "Usage: $0 --detail <task>"
|
|
523
523
|
exit 1
|
|
524
524
|
fi
|
|
525
525
|
|
|
@@ -532,34 +532,34 @@ cmd_detail() {
|
|
|
532
532
|
local id=$(echo "$agent" | jq -r '.id')
|
|
533
533
|
local pid=$(echo "$agent" | jq -r '.pid')
|
|
534
534
|
local worktree=$(echo "$agent" | jq -r '.worktree_path')
|
|
535
|
-
local
|
|
535
|
+
local task_dir=$(echo "$agent" | jq -r '.task_dir')
|
|
536
536
|
local started=$(echo "$agent" | jq -r '.started_at')
|
|
537
537
|
|
|
538
538
|
echo -e "${BLUE}=== Agent Detail: $id ===${NC}"
|
|
539
539
|
echo ""
|
|
540
|
-
echo " ID:
|
|
541
|
-
echo " PID:
|
|
542
|
-
echo " Worktree:
|
|
543
|
-
echo "
|
|
544
|
-
echo " Started:
|
|
540
|
+
echo " ID: $id"
|
|
541
|
+
echo " PID: $pid"
|
|
542
|
+
echo " Worktree: $worktree"
|
|
543
|
+
echo " Task Dir: $task_dir"
|
|
544
|
+
echo " Started: $started"
|
|
545
545
|
echo ""
|
|
546
546
|
|
|
547
547
|
# Status
|
|
548
548
|
if is_running "$pid"; then
|
|
549
|
-
echo -e " Status:
|
|
549
|
+
echo -e " Status: ${GREEN}Running${NC}"
|
|
550
550
|
else
|
|
551
|
-
echo -e " Status:
|
|
551
|
+
echo -e " Status: ${RED}Stopped${NC}"
|
|
552
552
|
fi
|
|
553
553
|
|
|
554
|
-
#
|
|
555
|
-
local
|
|
556
|
-
if [ -f "$
|
|
554
|
+
# Task info
|
|
555
|
+
local task_json="$PROJECT_ROOT/$task_dir/task.json"
|
|
556
|
+
if [ -f "$task_json" ]; then
|
|
557
557
|
echo ""
|
|
558
|
-
echo -e "${BLUE}===
|
|
558
|
+
echo -e "${BLUE}=== Task Info ===${NC}"
|
|
559
559
|
echo ""
|
|
560
|
-
local status=$(jq -r '.status // "unknown"' "$
|
|
561
|
-
local branch=$(jq -r '.branch // "N/A"' "$
|
|
562
|
-
local base=$(jq -r '.base_branch // "N/A"' "$
|
|
560
|
+
local status=$(jq -r '.status // "unknown"' "$task_json")
|
|
561
|
+
local branch=$(jq -r '.branch // "N/A"' "$task_json")
|
|
562
|
+
local base=$(jq -r '.base_branch // "N/A"' "$task_json")
|
|
563
563
|
echo " Status: $status"
|
|
564
564
|
echo " Branch: $branch"
|
|
565
565
|
echo " Base Branch: $base"
|
|
@@ -588,7 +588,7 @@ cmd_detail() {
|
|
|
588
588
|
|
|
589
589
|
cmd_watch() {
|
|
590
590
|
if [ -z "$TARGET" ]; then
|
|
591
|
-
echo "Usage: $0 --watch <
|
|
591
|
+
echo "Usage: $0 --watch <task>"
|
|
592
592
|
exit 1
|
|
593
593
|
fi
|
|
594
594
|
|
|
@@ -615,7 +615,7 @@ cmd_watch() {
|
|
|
615
615
|
|
|
616
616
|
cmd_log() {
|
|
617
617
|
if [ -z "$TARGET" ]; then
|
|
618
|
-
echo "Usage: $0 --log <
|
|
618
|
+
echo "Usage: $0 --log <task>"
|
|
619
619
|
exit 1
|
|
620
620
|
fi
|
|
621
621
|
|