@mindfoldhq/trellis 0.1.8 → 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.
Files changed (104) hide show
  1. package/dist/cli/index.js +2 -0
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/commands/init.d.ts.map +1 -1
  4. package/dist/commands/init.js +12 -6
  5. package/dist/commands/init.js.map +1 -1
  6. package/dist/commands/update.d.ts +1 -0
  7. package/dist/commands/update.d.ts.map +1 -1
  8. package/dist/commands/update.js +669 -38
  9. package/dist/commands/update.js.map +1 -1
  10. package/dist/configurators/opencode.js +1 -1
  11. package/dist/configurators/opencode.js.map +1 -1
  12. package/dist/configurators/workflow.d.ts +4 -3
  13. package/dist/configurators/workflow.d.ts.map +1 -1
  14. package/dist/configurators/workflow.js +23 -20
  15. package/dist/configurators/workflow.js.map +1 -1
  16. package/dist/constants/paths.d.ts +29 -30
  17. package/dist/constants/paths.d.ts.map +1 -1
  18. package/dist/constants/paths.js +32 -35
  19. package/dist/constants/paths.js.map +1 -1
  20. package/dist/migrations/index.d.ts +35 -0
  21. package/dist/migrations/index.d.ts.map +1 -0
  22. package/dist/migrations/index.js +124 -0
  23. package/dist/migrations/index.js.map +1 -0
  24. package/dist/migrations/manifests/0.1.9.json +30 -0
  25. package/dist/migrations/manifests/0.2.0.json +43 -0
  26. package/dist/templates/claude/agents/check.md +3 -3
  27. package/dist/templates/claude/agents/debug.md +1 -1
  28. package/dist/templates/claude/agents/dispatch.md +12 -12
  29. package/dist/templates/claude/agents/implement.md +6 -6
  30. package/dist/templates/claude/agents/plan.md +37 -37
  31. package/dist/templates/claude/agents/research.md +1 -1
  32. package/dist/templates/claude/commands/before-backend-dev.md +5 -5
  33. package/dist/templates/claude/commands/before-frontend-dev.md +5 -5
  34. package/dist/templates/claude/commands/break-loop.md +2 -2
  35. package/dist/templates/claude/commands/check-backend.md +6 -6
  36. package/dist/templates/claude/commands/check-cross-layer.md +5 -5
  37. package/dist/templates/claude/commands/check-frontend.md +6 -6
  38. package/dist/templates/claude/commands/create-command.md +3 -3
  39. package/dist/templates/claude/commands/finish-work.md +6 -6
  40. package/dist/templates/claude/commands/integrate-skill.md +11 -11
  41. package/dist/templates/claude/commands/{onboard-developer.md → onboard.md} +31 -28
  42. package/dist/templates/claude/commands/parallel.md +17 -17
  43. package/dist/templates/{cursor/commands/record-agent-flow.md → claude/commands/record-session.md} +7 -7
  44. package/dist/templates/claude/commands/start.md +184 -96
  45. package/dist/templates/claude/hooks/inject-subagent-context.py +77 -76
  46. package/dist/templates/claude/hooks/ralph-loop.py +18 -18
  47. package/dist/templates/claude/hooks/session-start.py +124 -0
  48. package/dist/templates/claude/settings.json +14 -1
  49. package/dist/templates/cursor/commands/before-backend-dev.md +5 -5
  50. package/dist/templates/cursor/commands/before-frontend-dev.md +5 -5
  51. package/dist/templates/cursor/commands/break-loop.md +2 -2
  52. package/dist/templates/cursor/commands/check-backend.md +6 -6
  53. package/dist/templates/cursor/commands/check-cross-layer.md +5 -5
  54. package/dist/templates/cursor/commands/check-frontend.md +6 -6
  55. package/dist/templates/cursor/commands/create-command.md +3 -3
  56. package/dist/templates/cursor/commands/finish-work.md +6 -6
  57. package/dist/templates/cursor/commands/integrate-skill.md +11 -11
  58. package/dist/templates/cursor/commands/{onboard-developer.md → onboard.md} +31 -28
  59. package/dist/templates/{claude/commands/record-agent-flow.md → cursor/commands/record-session.md} +7 -7
  60. package/dist/templates/cursor/commands/start.md +25 -25
  61. package/dist/templates/extract.d.ts +2 -2
  62. package/dist/templates/extract.js +2 -2
  63. package/dist/templates/markdown/agents.md +2 -2
  64. package/dist/templates/markdown/gitignore.txt +2 -2
  65. package/dist/templates/markdown/index.d.ts +1 -0
  66. package/dist/templates/markdown/index.d.ts.map +1 -1
  67. package/dist/templates/markdown/index.js +4 -2
  68. package/dist/templates/markdown/index.js.map +1 -1
  69. package/dist/templates/markdown/{agent-traces-index.md → workspace-index.md} +14 -14
  70. package/dist/templates/trellis/index.d.ts +7 -1
  71. package/dist/templates/trellis/index.d.ts.map +1 -1
  72. package/dist/templates/trellis/index.js +14 -2
  73. package/dist/templates/trellis/index.js.map +1 -1
  74. package/dist/templates/trellis/scripts/add-session.sh +26 -26
  75. package/dist/templates/trellis/scripts/common/developer.sh +20 -21
  76. package/dist/templates/trellis/scripts/common/git-context.sh +90 -115
  77. package/dist/templates/trellis/scripts/common/paths.sh +53 -63
  78. package/dist/templates/trellis/scripts/common/phase.sh +40 -40
  79. package/dist/templates/trellis/scripts/common/registry.sh +13 -13
  80. package/dist/templates/trellis/scripts/common/task-queue.sh +142 -0
  81. package/dist/templates/trellis/scripts/common/task-utils.sh +151 -0
  82. package/dist/templates/trellis/scripts/common/worktree.sh +3 -3
  83. package/dist/templates/trellis/scripts/create-bootstrap.sh +43 -42
  84. package/dist/templates/trellis/scripts/init-developer.sh +1 -1
  85. package/dist/templates/trellis/scripts/multi-agent/cleanup.sh +33 -33
  86. package/dist/templates/trellis/scripts/multi-agent/create-pr.sh +31 -31
  87. package/dist/templates/trellis/scripts/multi-agent/plan.sh +30 -56
  88. package/dist/templates/trellis/scripts/multi-agent/start.sh +59 -70
  89. package/dist/templates/trellis/scripts/multi-agent/status.sh +59 -59
  90. package/dist/templates/trellis/scripts/{feature.sh → task.sh} +236 -186
  91. package/dist/templates/trellis/workflow.md +71 -74
  92. package/dist/types/migration.d.ts +74 -0
  93. package/dist/types/migration.d.ts.map +1 -0
  94. package/dist/types/migration.js +8 -0
  95. package/dist/types/migration.js.map +1 -0
  96. package/dist/utils/template-hash.d.ts +78 -0
  97. package/dist/utils/template-hash.d.ts.map +1 -0
  98. package/dist/utils/template-hash.js +234 -0
  99. package/dist/utils/template-hash.js.map +1 -0
  100. package/package.json +1 -1
  101. package/README.md +0 -818
  102. package/dist/templates/trellis/scripts/common/backlog.sh +0 -220
  103. package/dist/templates/trellis/scripts/common/feature-utils.sh +0 -194
  104. /package/dist/templates/trellis/{backlog → tasks}/.gitkeep +0 -0
@@ -1,25 +1,25 @@
1
1
  #!/bin/bash
2
- # Feature Management Script for Multi-Agent Pipeline
2
+ # Task Management Script for Multi-Agent Pipeline
3
3
  #
4
4
  # Usage:
5
- # ./.trellis/scripts/feature.sh create "<title>" [--slug <name>] [--assignee <dev>] [--priority P0|P1|P2|P3]
6
- # ./.trellis/scripts/feature.sh init-context <dir> <type> # Initialize jsonl files
7
- # ./.trellis/scripts/feature.sh add-context <dir> <file> <path> [reason] # Add jsonl entry
8
- # ./.trellis/scripts/feature.sh validate <dir> # Validate jsonl files
9
- # ./.trellis/scripts/feature.sh list-context <dir> # List jsonl entries
10
- # ./.trellis/scripts/feature.sh start <dir> # Set as current feature
11
- # ./.trellis/scripts/feature.sh finish # Clear current feature
12
- # ./.trellis/scripts/feature.sh set-branch <dir> <branch> # Set git branch
13
- # ./.trellis/scripts/feature.sh set-scope <dir> <scope> # Set scope for PR title
14
- # ./.trellis/scripts/feature.sh create-pr [dir] [--dry-run] # Create PR from feature
15
- # ./.trellis/scripts/feature.sh archive <feature-name> # Archive completed feature
16
- # ./.trellis/scripts/feature.sh list # List active features
17
- # ./.trellis/scripts/feature.sh list-archive [month] # List archived features
5
+ # ./.trellis/scripts/task.sh create "<title>" [--slug <name>] [--assignee <dev>] [--priority P0|P1|P2|P3]
6
+ # ./.trellis/scripts/task.sh init-context <dir> <type> # Initialize jsonl files
7
+ # ./.trellis/scripts/task.sh add-context <dir> <file> <path> [reason] # Add jsonl entry
8
+ # ./.trellis/scripts/task.sh validate <dir> # Validate jsonl files
9
+ # ./.trellis/scripts/task.sh list-context <dir> # List jsonl entries
10
+ # ./.trellis/scripts/task.sh start <dir> # Set as current task
11
+ # ./.trellis/scripts/task.sh finish # Clear current task
12
+ # ./.trellis/scripts/task.sh set-branch <dir> <branch> # Set git branch
13
+ # ./.trellis/scripts/task.sh set-scope <dir> <scope> # Set scope for PR title
14
+ # ./.trellis/scripts/task.sh create-pr [dir] [--dry-run] # Create PR from task
15
+ # ./.trellis/scripts/task.sh archive <task-name> # Archive completed task
16
+ # ./.trellis/scripts/task.sh list # List active tasks
17
+ # ./.trellis/scripts/task.sh list-archive [month] # List archived tasks
18
18
  #
19
- # Feature Directory Structure:
20
- # features/
21
- # ├── 13-my-feature/
22
- # │ ├── feature.json # Metadata
19
+ # Task Directory Structure:
20
+ # tasks/
21
+ # ├── 01-21-my-task/
22
+ # │ ├── task.json # Metadata
23
23
  # │ ├── prd.md # Requirements
24
24
  # │ ├── info.md # Technical design (optional)
25
25
  # │ ├── implement.jsonl # Implement agent context
@@ -27,15 +27,15 @@
27
27
  # │ └── debug.jsonl # Debug agent context
28
28
  # └── archive/
29
29
  # └── 2026-01/
30
- # └── 13-old-feature/
30
+ # └── 01-21-old-task/
31
31
 
32
32
  set -e
33
33
 
34
34
  SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
35
35
  source "$SCRIPT_DIR/common/paths.sh"
36
36
  source "$SCRIPT_DIR/common/developer.sh"
37
- source "$SCRIPT_DIR/common/backlog.sh"
38
- source "$SCRIPT_DIR/common/feature-utils.sh"
37
+ source "$SCRIPT_DIR/common/task-queue.sh"
38
+ source "$SCRIPT_DIR/common/task-utils.sh"
39
39
 
40
40
  # Colors
41
41
  RED='\033[0;31m'
@@ -47,6 +47,16 @@ NC='\033[0m'
47
47
 
48
48
  REPO_ROOT=$(get_repo_root)
49
49
 
50
+ # =============================================================================
51
+ # Helper Functions
52
+ # =============================================================================
53
+
54
+ # Convert title to slug (only works with ASCII)
55
+ _slugify() {
56
+ local result=$(echo "$1" | tr '[:upper:]' '[:lower:]' | sed 's/[^a-z0-9]/-/g' | sed 's/--*/-/g' | sed 's/^-//' | sed 's/-$//')
57
+ echo "$result"
58
+ }
59
+
50
60
  # =============================================================================
51
61
  # jsonl Default Content Generators
52
62
  # =============================================================================
@@ -54,22 +64,22 @@ REPO_ROOT=$(get_repo_root)
54
64
  get_implement_base() {
55
65
  cat << EOF
56
66
  {"file": "$DIR_WORKFLOW/workflow.md", "reason": "Project workflow and conventions"}
57
- {"file": "$DIR_WORKFLOW/$DIR_STRUCTURE/shared/index.md", "reason": "Shared coding standards"}
67
+ {"file": "$DIR_WORKFLOW/$DIR_SPEC/shared/index.md", "reason": "Shared coding standards"}
58
68
  EOF
59
69
  }
60
70
 
61
71
  get_implement_backend() {
62
72
  cat << EOF
63
- {"file": "$DIR_WORKFLOW/$DIR_STRUCTURE/backend/index.md", "reason": "Backend development guide"}
64
- {"file": "$DIR_WORKFLOW/$DIR_STRUCTURE/backend/api-module.md", "reason": "API module conventions"}
65
- {"file": "$DIR_WORKFLOW/$DIR_STRUCTURE/backend/quality.md", "reason": "Code quality requirements"}
73
+ {"file": "$DIR_WORKFLOW/$DIR_SPEC/backend/index.md", "reason": "Backend development guide"}
74
+ {"file": "$DIR_WORKFLOW/$DIR_SPEC/backend/api-module.md", "reason": "API module conventions"}
75
+ {"file": "$DIR_WORKFLOW/$DIR_SPEC/backend/quality.md", "reason": "Code quality requirements"}
66
76
  EOF
67
77
  }
68
78
 
69
79
  get_implement_frontend() {
70
80
  cat << EOF
71
- {"file": "$DIR_WORKFLOW/$DIR_STRUCTURE/frontend/index.md", "reason": "Frontend development guide"}
72
- {"file": "$DIR_WORKFLOW/$DIR_STRUCTURE/frontend/components.md", "reason": "Component conventions"}
81
+ {"file": "$DIR_WORKFLOW/$DIR_SPEC/frontend/index.md", "reason": "Frontend development guide"}
82
+ {"file": "$DIR_WORKFLOW/$DIR_SPEC/frontend/components.md", "reason": "Component conventions"}
73
83
  EOF
74
84
  }
75
85
 
@@ -78,7 +88,7 @@ get_check_context() {
78
88
 
79
89
  cat << EOF
80
90
  {"file": ".claude/commands/finish-work.md", "reason": "Finish work checklist"}
81
- {"file": "$DIR_WORKFLOW/$DIR_STRUCTURE/shared/index.md", "reason": "Shared coding standards"}
91
+ {"file": "$DIR_WORKFLOW/$DIR_SPEC/shared/index.md", "reason": "Shared coding standards"}
82
92
  EOF
83
93
 
84
94
  if [[ "$dev_type" == "backend" ]] || [[ "$dev_type" == "fullstack" ]]; then
@@ -92,7 +102,7 @@ EOF
92
102
  get_debug_context() {
93
103
  local dev_type="$1"
94
104
 
95
- echo "{\"file\": \"$DIR_WORKFLOW/$DIR_STRUCTURE/shared/index.md\", \"reason\": \"Shared coding standards\"}"
105
+ echo "{\"file\": \"$DIR_WORKFLOW/$DIR_SPEC/shared/index.md\", \"reason\": \"Shared coding standards\"}"
96
106
 
97
107
  if [[ "$dev_type" == "backend" ]] || [[ "$dev_type" == "fullstack" ]]; then
98
108
  echo '{"file": ".claude/commands/check-backend.md", "reason": "Backend check spec"}'
@@ -103,16 +113,16 @@ get_debug_context() {
103
113
  }
104
114
 
105
115
  # =============================================================================
106
- # Feature Operations
116
+ # Task Operations
107
117
  # =============================================================================
108
118
 
109
- ensure_features_dir() {
110
- local features_dir=$(get_features_dir)
111
- local archive_dir="$features_dir/archive"
119
+ ensure_tasks_dir() {
120
+ local tasks_dir=$(get_tasks_dir)
121
+ local archive_dir="$tasks_dir/archive"
112
122
 
113
- if [[ ! -d "$features_dir" ]]; then
114
- mkdir -p "$features_dir"
115
- echo -e "${GREEN}Created features directory: $features_dir${NC}" >&2
123
+ if [[ ! -d "$tasks_dir" ]]; then
124
+ mkdir -p "$tasks_dir"
125
+ echo -e "${GREEN}Created tasks directory: $tasks_dir${NC}" >&2
116
126
  fi
117
127
 
118
128
  if [[ ! -d "$archive_dir" ]]; then
@@ -179,7 +189,7 @@ cmd_create() {
179
189
  fi
180
190
  fi
181
191
 
182
- ensure_features_dir
192
+ ensure_tasks_dir
183
193
 
184
194
  # Get current developer as creator
185
195
  local creator=$(get_developer "$REPO_ROOT")
@@ -187,48 +197,44 @@ cmd_create() {
187
197
  creator="$assignee"
188
198
  fi
189
199
 
190
- # Create backlog issue (returns ID like "260119-my-feature")
191
- local backlog_id=$(create_backlog_issue "$title" "$assignee" "$priority" "$slug" "$description" "$creator" "$REPO_ROOT")
192
- if [[ -z "$backlog_id" ]]; then
193
- echo -e "${RED}Error: Failed to create backlog issue${NC}" >&2
194
- exit 1
200
+ # Generate slug if not provided
201
+ if [[ -z "$slug" ]]; then
202
+ slug=$(_slugify "$title")
195
203
  fi
196
204
 
197
- echo -e "${GREEN}Created backlog issue: ${backlog_id}.json${NC}" >&2
198
-
199
- # Extract slug from backlog_id (remove date prefix)
200
- local feature_slug=$(echo "$backlog_id" | sed 's/^[0-9]*-//')
201
-
202
- # Create feature directory
203
- local features_dir="$REPO_ROOT/$DIR_WORKFLOW/$DIR_PROGRESS/$assignee/$DIR_FEATURES"
204
- if [[ ! -d "$features_dir" ]]; then
205
- mkdir -p "$features_dir"
205
+ # Validate slug
206
+ if [[ -z "$slug" ]]; then
207
+ echo -e "${RED}Error: could not generate slug from title${NC}" >&2
208
+ exit 1
206
209
  fi
207
210
 
208
- local day=$(date +%d)
209
- local dir_name="${day}-${feature_slug}"
210
- local feature_dir="$features_dir/$dir_name"
211
- local feature_json="$feature_dir/feature.json"
211
+ # Create task directory with MM-DD-slug format
212
+ local tasks_dir=$(get_tasks_dir)
213
+ local date_prefix=$(generate_task_date_prefix)
214
+ local dir_name="${date_prefix}-${slug}"
215
+ local task_dir="$tasks_dir/$dir_name"
216
+ local task_json="$task_dir/$FILE_TASK_JSON"
212
217
 
213
- if [[ -d "$feature_dir" ]]; then
214
- echo -e "${YELLOW}Warning: Feature directory already exists: $dir_name${NC}" >&2
218
+ if [[ -d "$task_dir" ]]; then
219
+ echo -e "${YELLOW}Warning: Task directory already exists: $dir_name${NC}" >&2
215
220
  else
216
- mkdir -p "$feature_dir"
221
+ mkdir -p "$task_dir"
217
222
  fi
218
223
 
219
224
  local today=$(date +%Y-%m-%d)
220
- local backlog_ref_json="\"${backlog_id}.json\""
221
225
 
222
- cat > "$feature_json" << EOF
226
+ cat > "$task_json" << EOF
223
227
  {
224
- "id": "$feature_slug",
225
- "name": "$feature_slug",
228
+ "id": "$slug",
229
+ "name": "$slug",
230
+ "title": "$title",
226
231
  "description": "$description",
227
232
  "status": "planning",
228
233
  "dev_type": null,
229
234
  "scope": null,
230
235
  "priority": "$priority",
231
- "developer": "$assignee",
236
+ "creator": "$creator",
237
+ "assignee": "$assignee",
232
238
  "createdAt": "$today",
233
239
  "completedAt": null,
234
240
  "branch": null,
@@ -243,15 +249,13 @@ cmd_create() {
243
249
  ],
244
250
  "commit": null,
245
251
  "pr_url": null,
246
- "backlog_ref": $backlog_ref_json,
247
252
  "subtasks": [],
248
253
  "relatedFiles": [],
249
254
  "notes": ""
250
255
  }
251
256
  EOF
252
257
 
253
- echo -e "${GREEN}Created feature: $dir_name${NC}" >&2
254
- echo -e "${CYAN}Linked to backlog: $backlog_id${NC}" >&2
258
+ echo -e "${GREEN}Created task: $dir_name${NC}" >&2
255
259
  echo -e "" >&2
256
260
  echo -e "${BLUE}Next steps:${NC}" >&2
257
261
  echo -e " 1. Create prd.md with requirements" >&2
@@ -260,7 +264,7 @@ EOF
260
264
  echo "" >&2
261
265
 
262
266
  # Output relative path for script chaining
263
- echo "$DIR_WORKFLOW/$DIR_PROGRESS/$assignee/$DIR_FEATURES/$dir_name"
267
+ echo "$DIR_WORKFLOW/$DIR_TASKS/$dir_name"
264
268
  }
265
269
 
266
270
  # =============================================================================
@@ -273,7 +277,7 @@ cmd_init_context() {
273
277
 
274
278
  if [[ -z "$target_dir" ]] || [[ -z "$dev_type" ]]; then
275
279
  echo -e "${RED}Error: Missing arguments${NC}"
276
- echo "Usage: $0 init-context <feature-dir> <dev_type>"
280
+ echo "Usage: $0 init-context <task-dir> <dev_type>"
277
281
  echo " dev_type: backend | frontend | fullstack | test | docs"
278
282
  exit 1
279
283
  fi
@@ -341,7 +345,7 @@ cmd_add_context() {
341
345
 
342
346
  if [[ -z "$target_dir" ]] || [[ -z "$jsonl_name" ]] || [[ -z "$path" ]]; then
343
347
  echo -e "${RED}Error: Missing arguments${NC}"
344
- echo "Usage: $0 add-context <feature-dir> <jsonl-file> <path> [reason]"
348
+ echo "Usage: $0 add-context <task-dir> <jsonl-file> <path> [reason]"
345
349
  echo " jsonl-file: implement | check | debug (or full filename)"
346
350
  exit 1
347
351
  fi
@@ -445,7 +449,7 @@ cmd_validate() {
445
449
  local target_dir="$1"
446
450
 
447
451
  if [[ -z "$target_dir" ]]; then
448
- echo -e "${RED}Error: feature directory required${NC}"
452
+ echo -e "${RED}Error: task directory required${NC}"
449
453
  exit 1
450
454
  fi
451
455
 
@@ -480,7 +484,7 @@ cmd_list_context() {
480
484
  local target_dir="$1"
481
485
 
482
486
  if [[ -z "$target_dir" ]]; then
483
- echo -e "${RED}Error: feature directory required${NC}"
487
+ echo -e "${RED}Error: task directory required${NC}"
484
488
  exit 1
485
489
  fi
486
490
 
@@ -523,40 +527,40 @@ cmd_list_context() {
523
527
  # =============================================================================
524
528
 
525
529
  cmd_start() {
526
- local feature_dir="$1"
530
+ local task_dir="$1"
527
531
 
528
- if [[ -z "$feature_dir" ]]; then
529
- echo -e "${RED}Error: feature directory required${NC}"
532
+ if [[ -z "$task_dir" ]]; then
533
+ echo -e "${RED}Error: task directory required${NC}"
530
534
  exit 1
531
535
  fi
532
536
 
533
537
  # Convert to relative path
534
- if [[ "$feature_dir" = /* ]]; then
535
- feature_dir="${feature_dir#$REPO_ROOT/}"
538
+ if [[ "$task_dir" = /* ]]; then
539
+ task_dir="${task_dir#$REPO_ROOT/}"
536
540
  fi
537
541
 
538
542
  # Verify directory exists
539
- if [[ ! -d "$REPO_ROOT/$feature_dir" ]]; then
540
- echo -e "${RED}Error: Feature directory not found: $feature_dir${NC}"
543
+ if [[ ! -d "$REPO_ROOT/$task_dir" ]]; then
544
+ echo -e "${RED}Error: Task directory not found: $task_dir${NC}"
541
545
  exit 1
542
546
  fi
543
547
 
544
- set_current_feature "$feature_dir"
545
- echo -e "${GREEN}✓ Current feature set to: $feature_dir${NC}"
548
+ set_current_task "$task_dir"
549
+ echo -e "${GREEN}✓ Current task set to: $task_dir${NC}"
546
550
  echo ""
547
- echo -e "${BLUE}The hook will now inject context from this feature's jsonl files.${NC}"
551
+ echo -e "${BLUE}The hook will now inject context from this task's jsonl files.${NC}"
548
552
  }
549
553
 
550
554
  cmd_finish() {
551
- local current=$(get_current_feature)
555
+ local current=$(get_current_task)
552
556
 
553
557
  if [[ -z "$current" ]]; then
554
- echo -e "${YELLOW}No current feature set${NC}"
558
+ echo -e "${YELLOW}No current task set${NC}"
555
559
  exit 0
556
560
  fi
557
561
 
558
- clear_current_feature
559
- echo -e "${GREEN}✓ Cleared current feature (was: $current)${NC}"
562
+ clear_current_task
563
+ echo -e "${GREEN}✓ Cleared current task (was: $current)${NC}"
560
564
  }
561
565
 
562
566
  # =============================================================================
@@ -564,54 +568,49 @@ cmd_finish() {
564
568
  # =============================================================================
565
569
 
566
570
  cmd_archive() {
567
- local feature_name="$1"
571
+ local task_name="$1"
568
572
 
569
- if [[ -z "$feature_name" ]]; then
570
- echo -e "${RED}Error: Feature name is required${NC}" >&2
571
- echo "Usage: $0 archive <feature-name>" >&2
573
+ if [[ -z "$task_name" ]]; then
574
+ echo -e "${RED}Error: Task name is required${NC}" >&2
575
+ echo "Usage: $0 archive <task-name>" >&2
572
576
  exit 1
573
577
  fi
574
578
 
575
- ensure_developer
576
-
577
- local features_dir=$(get_features_dir)
579
+ local tasks_dir=$(get_tasks_dir)
578
580
 
579
- # Find feature directory using common function
580
- local feature_dir=$(find_feature_by_name "$feature_name" "$features_dir")
581
+ # Find task directory using common function
582
+ local task_dir=$(find_task_by_name "$task_name" "$tasks_dir")
581
583
 
582
- if [[ -z "$feature_dir" ]] || [[ ! -d "$feature_dir" ]]; then
583
- echo -e "${RED}Error: Feature not found: $feature_name${NC}" >&2
584
- echo "Active features:" >&2
584
+ if [[ -z "$task_dir" ]] || [[ ! -d "$task_dir" ]]; then
585
+ echo -e "${RED}Error: Task not found: $task_name${NC}" >&2
586
+ echo "Active tasks:" >&2
585
587
  cmd_list >&2
586
588
  exit 1
587
589
  fi
588
590
 
589
- local dir_name=$(basename "$feature_dir")
590
- local feature_json="$feature_dir/feature.json"
591
+ local dir_name=$(basename "$task_dir")
592
+ local task_json="$task_dir/$FILE_TASK_JSON"
591
593
 
592
594
  # Update status before archiving
593
595
  local today=$(date +%Y-%m-%d)
594
- if [[ -f "$feature_json" ]] && command -v jq &> /dev/null; then
596
+ if [[ -f "$task_json" ]] && command -v jq &> /dev/null; then
595
597
  local temp_file=$(mktemp)
596
- jq --arg date "$today" '.status = "completed" | .completedAt = $date' "$feature_json" > "$temp_file"
597
- mv "$temp_file" "$feature_json"
598
+ jq --arg date "$today" '.status = "completed" | .completedAt = $date' "$task_json" > "$temp_file"
599
+ mv "$temp_file" "$task_json"
598
600
  fi
599
601
 
600
- # Clear if current feature
601
- local current=$(get_current_feature)
602
+ # Clear if current task
603
+ local current=$(get_current_task)
602
604
  if [[ "$current" == *"$dir_name"* ]]; then
603
- clear_current_feature
605
+ clear_current_task
604
606
  fi
605
607
 
606
- # Use common archive function (handles backlog completion + directory move)
607
- local result=$(archive_feature_complete "$feature_dir" "$REPO_ROOT")
608
+ # Use common archive function
609
+ local result=$(archive_task_complete "$task_dir" "$REPO_ROOT")
608
610
  local archive_dest=""
609
611
 
610
612
  echo "$result" | while IFS= read -r line; do
611
613
  case "$line" in
612
- backlog_completed:*)
613
- echo -e "${CYAN}Completed linked backlog: ${line#backlog_completed:}${NC}" >&2
614
- ;;
615
614
  archived_to:*)
616
615
  archive_dest="${line#archived_to:}"
617
616
  local year_month=$(basename "$(dirname "$archive_dest")")
@@ -622,7 +621,7 @@ cmd_archive() {
622
621
 
623
622
  # Return the archive path
624
623
  local year_month=$(date +%Y-%m)
625
- echo "$DIR_WORKFLOW/$DIR_PROGRESS/$(get_developer)/$DIR_FEATURES/$DIR_ARCHIVE/$year_month/$dir_name"
624
+ echo "$DIR_WORKFLOW/$DIR_TASKS/$DIR_ARCHIVE/$year_month/$dir_name"
626
625
  }
627
626
 
628
627
  # =============================================================================
@@ -630,44 +629,90 @@ cmd_archive() {
630
629
  # =============================================================================
631
630
 
632
631
  cmd_list() {
633
- ensure_developer
632
+ local filter_mine=false
633
+ local filter_status=""
634
634
 
635
- local features_dir=$(get_features_dir)
636
- local developer=$(get_developer)
637
- local current_feature=$(get_current_feature)
635
+ # Parse arguments
636
+ while [[ $# -gt 0 ]]; do
637
+ case "$1" in
638
+ --mine|-m)
639
+ filter_mine=true
640
+ shift
641
+ ;;
642
+ --status|-s)
643
+ filter_status="$2"
644
+ shift 2
645
+ ;;
646
+ *)
647
+ shift
648
+ ;;
649
+ esac
650
+ done
638
651
 
639
- echo -e "${BLUE}Active features for $developer:${NC}"
652
+ local tasks_dir=$(get_tasks_dir)
653
+ local current_task=$(get_current_task)
654
+ local developer=$(get_developer "$REPO_ROOT")
655
+
656
+ if [[ "$filter_mine" == "true" ]]; then
657
+ if [[ -z "$developer" ]]; then
658
+ echo -e "${RED}Error: No developer set. Run init-developer.sh first${NC}" >&2
659
+ exit 1
660
+ fi
661
+ echo -e "${BLUE}My tasks (assignee: $developer):${NC}"
662
+ else
663
+ echo -e "${BLUE}All active tasks:${NC}"
664
+ fi
640
665
  echo ""
641
666
 
642
667
  local count=0
643
668
 
644
- for d in "$features_dir"/*/; do
669
+ for d in "$tasks_dir"/*/; do
645
670
  if [[ -d "$d" ]] && [[ "$(basename "$d")" != "archive" ]]; then
646
671
  local dir_name=$(basename "$d")
647
- local feature_json="$d/feature.json"
672
+ local task_json="$d/$FILE_TASK_JSON"
648
673
  local status="unknown"
649
- local relative_path="$DIR_WORKFLOW/$DIR_PROGRESS/$developer/$DIR_FEATURES/$dir_name"
674
+ local assignee="-"
675
+ local relative_path="$DIR_WORKFLOW/$DIR_TASKS/$dir_name"
676
+
677
+ if [[ -f "$task_json" ]] && command -v jq &> /dev/null; then
678
+ status=$(jq -r '.status // "unknown"' "$task_json")
679
+ assignee=$(jq -r '.assignee // "-"' "$task_json")
680
+ fi
650
681
 
651
- if [[ -f "$feature_json" ]] && command -v jq &> /dev/null; then
652
- status=$(jq -r '.status // "unknown"' "$feature_json")
682
+ # Apply --mine filter
683
+ if [[ "$filter_mine" == "true" ]] && [[ "$assignee" != "$developer" ]]; then
684
+ continue
685
+ fi
686
+
687
+ # Apply --status filter
688
+ if [[ -n "$filter_status" ]] && [[ "$status" != "$filter_status" ]]; then
689
+ continue
653
690
  fi
654
691
 
655
692
  local marker=""
656
- if [[ "$relative_path" == "$current_feature" ]]; then
693
+ if [[ "$relative_path" == "$current_task" ]]; then
657
694
  marker=" ${GREEN}<- current${NC}"
658
695
  fi
659
696
 
660
- echo -e " - $dir_name/ ($status)$marker"
697
+ if [[ "$filter_mine" == "true" ]]; then
698
+ echo -e " - $dir_name/ ($status)$marker"
699
+ else
700
+ echo -e " - $dir_name/ ($status) [${CYAN}$assignee${NC}]$marker"
701
+ fi
661
702
  ((count++))
662
703
  fi
663
704
  done
664
705
 
665
706
  if [[ $count -eq 0 ]]; then
666
- echo " (no active features)"
707
+ if [[ "$filter_mine" == "true" ]]; then
708
+ echo " (no tasks assigned to you)"
709
+ else
710
+ echo " (no active tasks)"
711
+ fi
667
712
  fi
668
713
 
669
714
  echo ""
670
- echo "Total: $count active feature(s)"
715
+ echo "Total: $count task(s)"
671
716
  }
672
717
 
673
718
  # =============================================================================
@@ -677,13 +722,10 @@ cmd_list() {
677
722
  cmd_list_archive() {
678
723
  local month="$1"
679
724
 
680
- ensure_developer
681
-
682
- local features_dir=$(get_features_dir)
683
- local archive_dir="$features_dir/archive"
684
- local developer=$(get_developer)
725
+ local tasks_dir=$(get_tasks_dir)
726
+ local archive_dir="$tasks_dir/archive"
685
727
 
686
- echo -e "${BLUE}Archived features for $developer:${NC}"
728
+ echo -e "${BLUE}Archived tasks:${NC}"
687
729
  echo ""
688
730
 
689
731
  if [[ -n "$month" ]]; then
@@ -703,7 +745,7 @@ cmd_list_archive() {
703
745
  if [[ -d "$month_dir" ]]; then
704
746
  local month_name=$(basename "$month_dir")
705
747
  local count=$(find "$month_dir" -maxdepth 1 -type d ! -name "$(basename "$month_dir")" | wc -l | tr -d ' ')
706
- echo "[$month_name] - $count feature(s)"
748
+ echo "[$month_name] - $count task(s)"
707
749
  fi
708
750
  done
709
751
  fi
@@ -719,8 +761,8 @@ cmd_set_branch() {
719
761
 
720
762
  if [[ -z "$target_dir" ]] || [[ -z "$branch" ]]; then
721
763
  echo -e "${RED}Error: Missing arguments${NC}"
722
- echo "Usage: $0 set-branch <feature-dir> <branch-name>"
723
- echo "Example: $0 set-branch <dir> feature/my-feature"
764
+ echo "Usage: $0 set-branch <task-dir> <branch-name>"
765
+ echo "Example: $0 set-branch <dir> feature/my-task"
724
766
  exit 1
725
767
  fi
726
768
 
@@ -729,15 +771,15 @@ cmd_set_branch() {
729
771
  target_dir="$REPO_ROOT/$target_dir"
730
772
  fi
731
773
 
732
- local feature_json="$target_dir/feature.json"
733
- if [[ ! -f "$feature_json" ]]; then
734
- echo -e "${RED}Error: feature.json not found at $target_dir${NC}"
774
+ local task_json="$target_dir/$FILE_TASK_JSON"
775
+ if [[ ! -f "$task_json" ]]; then
776
+ echo -e "${RED}Error: task.json not found at $target_dir${NC}"
735
777
  exit 1
736
778
  fi
737
779
 
738
780
  # Update branch field
739
- jq --arg branch "$branch" '.branch = $branch' "$feature_json" > "${feature_json}.tmp"
740
- mv "${feature_json}.tmp" "$feature_json"
781
+ jq --arg branch "$branch" '.branch = $branch' "$task_json" > "${task_json}.tmp"
782
+ mv "${task_json}.tmp" "$task_json"
741
783
 
742
784
  echo -e "${GREEN}✓ Branch set to: $branch${NC}"
743
785
  echo ""
@@ -755,7 +797,7 @@ cmd_set_scope() {
755
797
 
756
798
  if [[ -z "$target_dir" ]] || [[ -z "$scope" ]]; then
757
799
  echo -e "${RED}Error: Missing arguments${NC}"
758
- echo "Usage: $0 set-scope <feature-dir> <scope>"
800
+ echo "Usage: $0 set-scope <task-dir> <scope>"
759
801
  echo "Example: $0 set-scope <dir> api"
760
802
  exit 1
761
803
  fi
@@ -765,15 +807,15 @@ cmd_set_scope() {
765
807
  target_dir="$REPO_ROOT/$target_dir"
766
808
  fi
767
809
 
768
- local feature_json="$target_dir/feature.json"
769
- if [[ ! -f "$feature_json" ]]; then
770
- echo -e "${RED}Error: feature.json not found at $target_dir${NC}"
810
+ local task_json="$target_dir/$FILE_TASK_JSON"
811
+ if [[ ! -f "$task_json" ]]; then
812
+ echo -e "${RED}Error: task.json not found at $target_dir${NC}"
771
813
  exit 1
772
814
  fi
773
815
 
774
816
  # Update scope field
775
- jq --arg scope "$scope" '.scope = $scope' "$feature_json" > "${feature_json}.tmp"
776
- mv "${feature_json}.tmp" "$feature_json"
817
+ jq --arg scope "$scope" '.scope = $scope' "$task_json" > "${task_json}.tmp"
818
+ mv "${task_json}.tmp" "$task_json"
777
819
 
778
820
  echo -e "${GREEN}✓ Scope set to: $scope${NC}"
779
821
  }
@@ -802,12 +844,12 @@ cmd_create_pr() {
802
844
  esac
803
845
  done
804
846
 
805
- # Get feature directory
847
+ # Get task directory
806
848
  if [[ -z "$target_dir" ]]; then
807
- target_dir=$(get_current_feature)
849
+ target_dir=$(get_current_task)
808
850
  if [[ -z "$target_dir" ]]; then
809
- echo -e "${RED}Error: No feature directory specified and no current feature set${NC}"
810
- echo "Usage: $0 create-pr [feature-dir] [--dry-run]"
851
+ echo -e "${RED}Error: No task directory specified and no current task set${NC}"
852
+ echo "Usage: $0 create-pr [task-dir] [--dry-run]"
811
853
  exit 1
812
854
  fi
813
855
  fi
@@ -817,9 +859,9 @@ cmd_create_pr() {
817
859
  target_dir="$REPO_ROOT/$target_dir"
818
860
  fi
819
861
 
820
- local feature_json="$target_dir/feature.json"
821
- if [[ ! -f "$feature_json" ]]; then
822
- echo -e "${RED}Error: feature.json not found at $target_dir${NC}"
862
+ local task_json="$target_dir/$FILE_TASK_JSON"
863
+ if [[ ! -f "$task_json" ]]; then
864
+ echo -e "${RED}Error: task.json not found at $target_dir${NC}"
823
865
  exit 1
824
866
  fi
825
867
 
@@ -829,11 +871,11 @@ cmd_create_pr() {
829
871
  fi
830
872
  echo ""
831
873
 
832
- # Read feature config
833
- local feature_name=$(jq -r '.name' "$feature_json")
834
- local base_branch=$(jq -r '.base_branch // "main"' "$feature_json")
835
- local scope=$(jq -r '.scope // "core"' "$feature_json")
836
- local dev_type=$(jq -r '.dev_type // "feature"' "$feature_json")
874
+ # Read task config
875
+ local task_name=$(jq -r '.name' "$task_json")
876
+ local base_branch=$(jq -r '.base_branch // "main"' "$task_json")
877
+ local scope=$(jq -r '.scope // "core"' "$task_json")
878
+ local dev_type=$(jq -r '.dev_type // "feature"' "$task_json")
837
879
 
838
880
  # Map dev_type to commit prefix
839
881
  local commit_prefix
@@ -846,7 +888,7 @@ cmd_create_pr() {
846
888
  *) commit_prefix="feat" ;;
847
889
  esac
848
890
 
849
- echo -e "Feature: ${feature_name}"
891
+ echo -e "Task: ${task_name}"
850
892
  echo -e "Base branch: ${base_branch}"
851
893
  echo -e "Scope: ${scope}"
852
894
  echo -e "Commit prefix: ${commit_prefix}"
@@ -861,9 +903,9 @@ cmd_create_pr() {
861
903
 
862
904
  # Stage changes (even in dry-run to detect what would be committed)
863
905
  git add -A
864
- # Exclude agent traces and temp files
865
- git reset "$DIR_WORKFLOW/$DIR_PROGRESS/" 2>/dev/null || true
866
- git reset .agent-log .agent-prompt .agent-runner.sh 2>/dev/null || true
906
+ # Exclude workspace and temp files
907
+ git reset "$DIR_WORKFLOW/$DIR_WORKSPACE/" 2>/dev/null || true
908
+ git reset .agent-log .agent-runner.sh 2>/dev/null || true
867
909
 
868
910
  # Check if there are staged changes
869
911
  if git diff --cached --quiet 2>/dev/null; then
@@ -883,7 +925,7 @@ cmd_create_pr() {
883
925
  else
884
926
  # Commit changes
885
927
  echo -e "${YELLOW}Committing changes...${NC}"
886
- local commit_msg="${commit_prefix}(${scope}): ${feature_name}"
928
+ local commit_msg="${commit_prefix}(${scope}): ${task_name}"
887
929
 
888
930
  if [[ "$dry_run" == "true" ]]; then
889
931
  echo -e "[DRY-RUN] Would commit with message: ${commit_msg}"
@@ -906,7 +948,7 @@ cmd_create_pr() {
906
948
 
907
949
  # Create PR
908
950
  echo -e "${YELLOW}Creating PR...${NC}"
909
- local pr_title="${commit_prefix}(${scope}): ${feature_name}"
951
+ local pr_title="${commit_prefix}(${scope}): ${task_name}"
910
952
  local pr_url=""
911
953
 
912
954
  if [[ "$dry_run" == "true" ]]; then
@@ -944,20 +986,20 @@ cmd_create_pr() {
944
986
  fi
945
987
  fi
946
988
 
947
- # Update feature.json
948
- echo -e "${YELLOW}Updating feature status...${NC}"
989
+ # Update task.json
990
+ echo -e "${YELLOW}Updating task status...${NC}"
949
991
  if [[ "$dry_run" == "true" ]]; then
950
- echo -e "[DRY-RUN] Would update feature.json:"
992
+ echo -e "[DRY-RUN] Would update task.json:"
951
993
  echo -e " status: review"
952
994
  echo -e " pr_url: ${pr_url}"
953
995
  echo -e " current_phase: (set to create-pr phase)"
954
996
  else
955
997
  # Find the phase number for create-pr action
956
- local create_pr_phase=$(jq -r '.next_action[] | select(.action == "create-pr") | .phase // 4' "$feature_json")
998
+ local create_pr_phase=$(jq -r '.next_action[] | select(.action == "create-pr") | .phase // 4' "$task_json")
957
999
  jq --arg url "$pr_url" --argjson phase "$create_pr_phase" \
958
- '.status = "review" | .pr_url = $url | .current_phase = $phase' "$feature_json" > "${feature_json}.tmp"
959
- mv "${feature_json}.tmp" "$feature_json"
960
- echo -e "${GREEN}Feature status updated to 'review', phase ${create_pr_phase}${NC}"
1000
+ '.status = "review" | .pr_url = $url | .current_phase = $phase' "$task_json" > "${task_json}.tmp"
1001
+ mv "${task_json}.tmp" "$task_json"
1002
+ echo -e "${GREEN}Task status updated to 'review', phase ${create_pr_phase}${NC}"
961
1003
  fi
962
1004
 
963
1005
  # In dry-run, reset the staging area
@@ -978,36 +1020,43 @@ cmd_create_pr() {
978
1020
 
979
1021
  show_usage() {
980
1022
  cat << EOF
981
- Feature Management Script for Multi-Agent Pipeline
1023
+ Task Management Script for Multi-Agent Pipeline
982
1024
 
983
1025
  Usage:
984
- $0 create <feature-name> Create new feature directory
1026
+ $0 create <title> Create new task directory
985
1027
  $0 init-context <dir> <dev_type> Initialize jsonl files
986
1028
  $0 add-context <dir> <jsonl> <path> [reason] Add entry to jsonl
987
1029
  $0 validate <dir> Validate jsonl files
988
1030
  $0 list-context <dir> List jsonl entries
989
- $0 start <dir> Set as current feature
990
- $0 finish Clear current feature
1031
+ $0 start <dir> Set as current task
1032
+ $0 finish Clear current task
991
1033
  $0 set-branch <dir> <branch> Set git branch for multi-agent
992
1034
  $0 set-scope <dir> <scope> Set scope for PR title
993
- $0 create-pr [dir] [--dry-run] Create PR from feature
994
- $0 archive <feature-name> Archive completed feature
995
- $0 list List active features
996
- $0 list-archive [YYYY-MM] List archived features
1035
+ $0 create-pr [dir] [--dry-run] Create PR from task
1036
+ $0 archive <task-name> Archive completed task
1037
+ $0 list [--mine] [--status <status>] List tasks
1038
+ $0 list-archive [YYYY-MM] List archived tasks
997
1039
 
998
1040
  Arguments:
999
1041
  dev_type: backend | frontend | fullstack | test | docs
1000
1042
 
1043
+ List options:
1044
+ --mine, -m Show only tasks assigned to current developer
1045
+ --status, -s <s> Filter by status (planning, in_progress, review, completed)
1046
+
1001
1047
  Examples:
1002
- $0 create add-login-feature
1003
- $0 init-context .trellis/agent-traces/john/features/13-add-login-feature backend
1004
- $0 add-context <dir> implement .trellis/structure/backend/auth.md "Auth guidelines"
1005
- $0 set-branch <dir> feature/add-login-feature
1006
- $0 start .trellis/agent-traces/john/features/13-add-login-feature
1007
- $0 create-pr # Uses current feature
1048
+ $0 create "Add login feature" --slug add-login
1049
+ $0 init-context .trellis/tasks/01-21-add-login backend
1050
+ $0 add-context <dir> implement .trellis/spec/backend/auth.md "Auth guidelines"
1051
+ $0 set-branch <dir> feature/add-login
1052
+ $0 start .trellis/tasks/01-21-add-login
1053
+ $0 create-pr # Uses current task
1008
1054
  $0 create-pr <dir> --dry-run # Preview without changes
1009
1055
  $0 finish
1010
- $0 archive add-login-feature
1056
+ $0 archive add-login
1057
+ $0 list # List all active tasks
1058
+ $0 list --mine # List my tasks only
1059
+ $0 list --mine --status in_progress # List my in-progress tasks
1011
1060
  EOF
1012
1061
  }
1013
1062
 
@@ -1053,7 +1102,8 @@ case "${1:-}" in
1053
1102
  cmd_archive "$2"
1054
1103
  ;;
1055
1104
  list)
1056
- cmd_list
1105
+ shift
1106
+ cmd_list "$@"
1057
1107
  ;;
1058
1108
  list-archive)
1059
1109
  cmd_list_archive "$2"