@mindfoldhq/trellis 0.1.0 → 0.1.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/README.md +58 -11
- package/dist/cli/index.js +1 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +28 -3
- package/dist/commands/init.js.map +1 -1
- package/dist/configurators/opencode.d.ts +24 -0
- package/dist/configurators/opencode.d.ts.map +1 -0
- package/dist/configurators/opencode.js +73 -0
- package/dist/configurators/opencode.js.map +1 -0
- package/dist/configurators/workflow.d.ts +2 -0
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +30 -1
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/templates/agents/bodies/check.md +91 -0
- package/dist/templates/agents/bodies/debug.md +102 -0
- package/dist/templates/agents/{dispatch.txt → bodies/dispatch.md} +17 -12
- package/dist/templates/agents/bodies/implement.md +94 -0
- package/dist/templates/agents/bodies/research.md +113 -0
- package/dist/templates/agents/index.d.ts +22 -15
- package/dist/templates/agents/index.d.ts.map +1 -1
- package/dist/templates/agents/index.js +125 -48
- package/dist/templates/agents/index.js.map +1 -1
- package/dist/templates/agents/metadata.d.ts +48 -0
- package/dist/templates/agents/metadata.d.ts.map +1 -0
- package/dist/templates/agents/metadata.js +101 -0
- package/dist/templates/agents/metadata.js.map +1 -0
- package/dist/templates/commands/claude/parallel.md.txt +199 -0
- package/dist/templates/commands/claude/start.md.txt +120 -55
- package/dist/templates/commands/common/onboard-developer.txt +2 -2
- package/dist/templates/commands/common/record-agent-flow.txt +1 -1
- package/dist/templates/commands/cursor/start.md.txt +92 -29
- package/dist/templates/commands/index.d.ts +2 -0
- package/dist/templates/commands/index.d.ts.map +1 -1
- package/dist/templates/commands/index.js +16 -0
- package/dist/templates/commands/index.js.map +1 -1
- package/dist/templates/commands/opencode/start.md.txt +127 -0
- package/dist/templates/markdown/agent-traces-index.md.txt +8 -9
- package/dist/templates/markdown/agents.md.txt +1 -1
- package/dist/templates/markdown/init-agent.md.txt +8 -8
- package/dist/templates/markdown/workflow.md.txt +6 -6
- package/dist/templates/scripts/add-session.sh.txt +14 -14
- package/dist/templates/scripts/common/developer.sh.txt +13 -13
- package/dist/templates/scripts/common/git-context.sh.txt +8 -8
- package/dist/templates/scripts/common/paths.sh.txt +4 -4
- package/dist/templates/scripts/common/worktree.sh.txt +138 -0
- package/dist/templates/scripts/feature.sh.txt +292 -0
- package/dist/templates/scripts/index.d.ts +12 -1
- package/dist/templates/scripts/index.d.ts.map +1 -1
- package/dist/templates/scripts/index.js +14 -1
- package/dist/templates/scripts/index.js.map +1 -1
- package/dist/templates/scripts/multi-agent/cleanup.sh.txt +327 -0
- package/dist/templates/scripts/multi-agent/start.sh.txt +323 -0
- package/dist/templates/scripts/multi-agent/status.sh.txt +423 -0
- package/dist/templates/scripts/worktree.yaml.txt +49 -0
- package/dist/types/ai-tools.d.ts +2 -2
- package/dist/types/ai-tools.d.ts.map +1 -1
- package/dist/types/ai-tools.js +4 -0
- package/dist/types/ai-tools.js.map +1 -1
- package/package.json +1 -1
- package/dist/templates/agents/check.txt +0 -120
- package/dist/templates/agents/debug.txt +0 -121
- package/dist/templates/agents/implement.txt +0 -114
- package/dist/templates/agents/research.txt +0 -258
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# Worktree utilities for Multi-Agent Pipeline
|
|
3
|
+
#
|
|
4
|
+
# Usage: source this file in multi-agent scripts
|
|
5
|
+
# source "$(dirname "$0")/../common/worktree.sh"
|
|
6
|
+
#
|
|
7
|
+
# Provides:
|
|
8
|
+
# get_worktree_config - Get worktree.yaml path
|
|
9
|
+
# get_worktree_base_dir - Get worktree storage directory
|
|
10
|
+
# get_worktree_copy_files - Get files to copy list
|
|
11
|
+
# get_worktree_post_create_hooks - Get post-create hooks
|
|
12
|
+
# get_worktree_pre_merge_hooks - Get pre-merge hooks
|
|
13
|
+
# get_agents_dir - Get agents registry directory
|
|
14
|
+
#
|
|
15
|
+
# Requires: paths.sh (for get_repo_root)
|
|
16
|
+
|
|
17
|
+
# Ensure paths.sh is loaded
|
|
18
|
+
if ! type get_repo_root &>/dev/null; then
|
|
19
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
20
|
+
source "$SCRIPT_DIR/paths.sh"
|
|
21
|
+
fi
|
|
22
|
+
|
|
23
|
+
# =============================================================================
|
|
24
|
+
# Worktree Configuration
|
|
25
|
+
# =============================================================================
|
|
26
|
+
|
|
27
|
+
# Worktree config file relative path (relative to repo root)
|
|
28
|
+
WORKTREE_CONFIG_PATH="$DIR_WORKFLOW/worktree.yaml"
|
|
29
|
+
|
|
30
|
+
# Get worktree.yaml config file path
|
|
31
|
+
# Args: $1 - repo_root (optional)
|
|
32
|
+
# Returns: absolute path to config file
|
|
33
|
+
get_worktree_config() {
|
|
34
|
+
local repo_root="${1:-$(get_repo_root)}"
|
|
35
|
+
echo "$repo_root/$WORKTREE_CONFIG_PATH"
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
# Read simple value from worktree.yaml
|
|
39
|
+
# Args: $1 - key, $2 - config_file (optional)
|
|
40
|
+
# Returns: value
|
|
41
|
+
_yaml_get_value() {
|
|
42
|
+
local key="$1"
|
|
43
|
+
local config="${2:-$(get_worktree_config)}"
|
|
44
|
+
grep "^${key}:" "$config" 2>/dev/null | sed "s/^${key}:[[:space:]]*//" | tr -d '"' | tr -d "'"
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
# Read list from worktree.yaml
|
|
48
|
+
# Args: $1 - section, $2 - config_file (optional)
|
|
49
|
+
# Returns: list items (one per line)
|
|
50
|
+
_yaml_get_list() {
|
|
51
|
+
local section="$1"
|
|
52
|
+
local config="${2:-$(get_worktree_config)}"
|
|
53
|
+
local in_section=0
|
|
54
|
+
|
|
55
|
+
while IFS= read -r line; do
|
|
56
|
+
if [[ "$line" =~ ^${section}: ]]; then
|
|
57
|
+
in_section=1
|
|
58
|
+
continue
|
|
59
|
+
fi
|
|
60
|
+
|
|
61
|
+
if [ $in_section -eq 1 ]; then
|
|
62
|
+
# Exit when encountering new top-level key
|
|
63
|
+
if [[ "$line" =~ ^[a-z_]+: ]] && [[ ! "$line" =~ ^[[:space:]] ]]; then
|
|
64
|
+
break
|
|
65
|
+
fi
|
|
66
|
+
# Read list item
|
|
67
|
+
if [[ "$line" =~ ^[[:space:]]*-[[:space:]](.+)$ ]]; then
|
|
68
|
+
echo "${BASH_REMATCH[1]}" | tr -d '"' | tr -d "'"
|
|
69
|
+
fi
|
|
70
|
+
fi
|
|
71
|
+
done < "$config"
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
# Get worktree base directory
|
|
75
|
+
# Args: $1 - repo_root (optional)
|
|
76
|
+
# Returns: absolute path to worktree base directory
|
|
77
|
+
get_worktree_base_dir() {
|
|
78
|
+
local repo_root="${1:-$(get_repo_root)}"
|
|
79
|
+
local config=$(get_worktree_config "$repo_root")
|
|
80
|
+
local worktree_dir=$(_yaml_get_value "worktree_dir" "$config")
|
|
81
|
+
|
|
82
|
+
# Default value
|
|
83
|
+
if [ -z "$worktree_dir" ]; then
|
|
84
|
+
worktree_dir="../worktrees"
|
|
85
|
+
fi
|
|
86
|
+
|
|
87
|
+
# Handle relative path
|
|
88
|
+
if [[ "$worktree_dir" == ../* ]] || [[ "$worktree_dir" == ./* ]]; then
|
|
89
|
+
# Relative to repo_root
|
|
90
|
+
echo "$repo_root/$worktree_dir"
|
|
91
|
+
else
|
|
92
|
+
# Absolute path
|
|
93
|
+
echo "$worktree_dir"
|
|
94
|
+
fi
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
# Get files to copy list
|
|
98
|
+
# Args: $1 - repo_root (optional)
|
|
99
|
+
# Returns: file list (one per line)
|
|
100
|
+
get_worktree_copy_files() {
|
|
101
|
+
local repo_root="${1:-$(get_repo_root)}"
|
|
102
|
+
local config=$(get_worktree_config "$repo_root")
|
|
103
|
+
_yaml_get_list "copy" "$config"
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
# Get post_create hooks
|
|
107
|
+
# Args: $1 - repo_root (optional)
|
|
108
|
+
# Returns: command list (one per line)
|
|
109
|
+
get_worktree_post_create_hooks() {
|
|
110
|
+
local repo_root="${1:-$(get_repo_root)}"
|
|
111
|
+
local config=$(get_worktree_config "$repo_root")
|
|
112
|
+
_yaml_get_list "post_create" "$config"
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
# Get pre_merge hooks
|
|
116
|
+
# Args: $1 - repo_root (optional)
|
|
117
|
+
# Returns: command list (one per line)
|
|
118
|
+
get_worktree_pre_merge_hooks() {
|
|
119
|
+
local repo_root="${1:-$(get_repo_root)}"
|
|
120
|
+
local config=$(get_worktree_config "$repo_root")
|
|
121
|
+
_yaml_get_list "pre_merge" "$config"
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
# =============================================================================
|
|
125
|
+
# Agents Registry
|
|
126
|
+
# =============================================================================
|
|
127
|
+
|
|
128
|
+
# Get agents directory for current developer
|
|
129
|
+
# Args: $1 - repo_root (optional)
|
|
130
|
+
# Returns: absolute path to agents directory
|
|
131
|
+
get_agents_dir() {
|
|
132
|
+
local repo_root="${1:-$(get_repo_root)}"
|
|
133
|
+
local progress_dir=$(get_progress_dir "$repo_root")
|
|
134
|
+
|
|
135
|
+
if [[ -n "$progress_dir" ]]; then
|
|
136
|
+
echo "$progress_dir/.agents"
|
|
137
|
+
fi
|
|
138
|
+
}
|
|
@@ -9,6 +9,9 @@
|
|
|
9
9
|
# ./.trellis/scripts/feature.sh list-context <dir> # List jsonl entries
|
|
10
10
|
# ./.trellis/scripts/feature.sh start <dir> # Set as current feature
|
|
11
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
|
|
12
15
|
# ./.trellis/scripts/feature.sh archive <feature-name> # Archive completed feature
|
|
13
16
|
# ./.trellis/scripts/feature.sh list # List active features
|
|
14
17
|
# ./.trellis/scripts/feature.sh list-archive [month] # List archived features
|
|
@@ -155,11 +158,23 @@ cmd_create() {
|
|
|
155
158
|
"description": "",
|
|
156
159
|
"status": "planning",
|
|
157
160
|
"dev_type": null,
|
|
161
|
+
"scope": null,
|
|
158
162
|
"priority": "medium",
|
|
159
163
|
"developer": "$developer",
|
|
160
164
|
"createdAt": "$today",
|
|
161
165
|
"completedAt": null,
|
|
166
|
+
"branch": null,
|
|
167
|
+
"base_branch": null,
|
|
168
|
+
"worktree_path": null,
|
|
169
|
+
"current_phase": 0,
|
|
170
|
+
"next_action": [
|
|
171
|
+
{"phase": 1, "action": "implement"},
|
|
172
|
+
{"phase": 2, "action": "check"},
|
|
173
|
+
{"phase": 3, "action": "finish"},
|
|
174
|
+
{"phase": 4, "action": "create-pr"}
|
|
175
|
+
],
|
|
162
176
|
"commit": null,
|
|
177
|
+
"pr_url": null,
|
|
163
178
|
"subtasks": [],
|
|
164
179
|
"relatedFiles": [],
|
|
165
180
|
"notes": ""
|
|
@@ -172,6 +187,8 @@ EOF
|
|
|
172
187
|
echo -e " 1. Create prd.md with requirements" >&2
|
|
173
188
|
echo -e " 2. Run: $0 init-context <dir> <dev_type>" >&2
|
|
174
189
|
echo -e " 3. Run: $0 start <dir>" >&2
|
|
190
|
+
echo -e " 4. (Optional) Set branch for multi-agent:" >&2
|
|
191
|
+
echo -e " jq '.branch = \"feature/$feature_name\"' <dir>/feature.json > tmp && mv tmp <dir>/feature.json" >&2
|
|
175
192
|
echo "" >&2
|
|
176
193
|
|
|
177
194
|
# Output relative path for script chaining
|
|
@@ -622,6 +639,265 @@ cmd_list_archive() {
|
|
|
622
639
|
fi
|
|
623
640
|
}
|
|
624
641
|
|
|
642
|
+
# =============================================================================
|
|
643
|
+
# Command: set-branch
|
|
644
|
+
# =============================================================================
|
|
645
|
+
|
|
646
|
+
cmd_set_branch() {
|
|
647
|
+
local target_dir="$1"
|
|
648
|
+
local branch="$2"
|
|
649
|
+
|
|
650
|
+
if [[ -z "$target_dir" ]] || [[ -z "$branch" ]]; then
|
|
651
|
+
echo -e "${RED}Error: Missing arguments${NC}"
|
|
652
|
+
echo "Usage: $0 set-branch <feature-dir> <branch-name>"
|
|
653
|
+
echo "Example: $0 set-branch <dir> feature/my-feature"
|
|
654
|
+
exit 1
|
|
655
|
+
fi
|
|
656
|
+
|
|
657
|
+
# Support relative paths
|
|
658
|
+
if [[ ! "$target_dir" = /* ]]; then
|
|
659
|
+
target_dir="$REPO_ROOT/$target_dir"
|
|
660
|
+
fi
|
|
661
|
+
|
|
662
|
+
local feature_json="$target_dir/feature.json"
|
|
663
|
+
if [[ ! -f "$feature_json" ]]; then
|
|
664
|
+
echo -e "${RED}Error: feature.json not found at $target_dir${NC}"
|
|
665
|
+
exit 1
|
|
666
|
+
fi
|
|
667
|
+
|
|
668
|
+
# Update branch field
|
|
669
|
+
jq --arg branch "$branch" '.branch = $branch' "$feature_json" > "${feature_json}.tmp"
|
|
670
|
+
mv "${feature_json}.tmp" "$feature_json"
|
|
671
|
+
|
|
672
|
+
echo -e "${GREEN}✓ Branch set to: $branch${NC}"
|
|
673
|
+
echo ""
|
|
674
|
+
echo -e "${BLUE}Now you can start the multi-agent pipeline:${NC}"
|
|
675
|
+
echo " ./.trellis/scripts/multi-agent/start.sh $1"
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
# =============================================================================
|
|
679
|
+
# Command: set-scope
|
|
680
|
+
# =============================================================================
|
|
681
|
+
|
|
682
|
+
cmd_set_scope() {
|
|
683
|
+
local target_dir="$1"
|
|
684
|
+
local scope="$2"
|
|
685
|
+
|
|
686
|
+
if [[ -z "$target_dir" ]] || [[ -z "$scope" ]]; then
|
|
687
|
+
echo -e "${RED}Error: Missing arguments${NC}"
|
|
688
|
+
echo "Usage: $0 set-scope <feature-dir> <scope>"
|
|
689
|
+
echo "Example: $0 set-scope <dir> api"
|
|
690
|
+
exit 1
|
|
691
|
+
fi
|
|
692
|
+
|
|
693
|
+
# Support relative paths
|
|
694
|
+
if [[ ! "$target_dir" = /* ]]; then
|
|
695
|
+
target_dir="$REPO_ROOT/$target_dir"
|
|
696
|
+
fi
|
|
697
|
+
|
|
698
|
+
local feature_json="$target_dir/feature.json"
|
|
699
|
+
if [[ ! -f "$feature_json" ]]; then
|
|
700
|
+
echo -e "${RED}Error: feature.json not found at $target_dir${NC}"
|
|
701
|
+
exit 1
|
|
702
|
+
fi
|
|
703
|
+
|
|
704
|
+
# Update scope field
|
|
705
|
+
jq --arg scope "$scope" '.scope = $scope' "$feature_json" > "${feature_json}.tmp"
|
|
706
|
+
mv "${feature_json}.tmp" "$feature_json"
|
|
707
|
+
|
|
708
|
+
echo -e "${GREEN}✓ Scope set to: $scope${NC}"
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
# =============================================================================
|
|
712
|
+
# Command: create-pr
|
|
713
|
+
# =============================================================================
|
|
714
|
+
|
|
715
|
+
cmd_create_pr() {
|
|
716
|
+
local target_dir=""
|
|
717
|
+
local dry_run=false
|
|
718
|
+
|
|
719
|
+
# Parse arguments
|
|
720
|
+
while [[ $# -gt 0 ]]; do
|
|
721
|
+
case "$1" in
|
|
722
|
+
--dry-run)
|
|
723
|
+
dry_run=true
|
|
724
|
+
shift
|
|
725
|
+
;;
|
|
726
|
+
*)
|
|
727
|
+
if [[ -z "$target_dir" ]]; then
|
|
728
|
+
target_dir="$1"
|
|
729
|
+
fi
|
|
730
|
+
shift
|
|
731
|
+
;;
|
|
732
|
+
esac
|
|
733
|
+
done
|
|
734
|
+
|
|
735
|
+
# Get feature directory
|
|
736
|
+
if [[ -z "$target_dir" ]]; then
|
|
737
|
+
target_dir=$(get_current_feature)
|
|
738
|
+
if [[ -z "$target_dir" ]]; then
|
|
739
|
+
echo -e "${RED}Error: No feature directory specified and no current feature set${NC}"
|
|
740
|
+
echo "Usage: $0 create-pr [feature-dir] [--dry-run]"
|
|
741
|
+
exit 1
|
|
742
|
+
fi
|
|
743
|
+
fi
|
|
744
|
+
|
|
745
|
+
# Support relative paths
|
|
746
|
+
if [[ ! "$target_dir" = /* ]]; then
|
|
747
|
+
target_dir="$REPO_ROOT/$target_dir"
|
|
748
|
+
fi
|
|
749
|
+
|
|
750
|
+
local feature_json="$target_dir/feature.json"
|
|
751
|
+
if [[ ! -f "$feature_json" ]]; then
|
|
752
|
+
echo -e "${RED}Error: feature.json not found at $target_dir${NC}"
|
|
753
|
+
exit 1
|
|
754
|
+
fi
|
|
755
|
+
|
|
756
|
+
echo -e "${BLUE}=== Create PR ===${NC}"
|
|
757
|
+
if [[ "$dry_run" == "true" ]]; then
|
|
758
|
+
echo -e "${YELLOW}[DRY-RUN MODE] No actual changes will be made${NC}"
|
|
759
|
+
fi
|
|
760
|
+
echo ""
|
|
761
|
+
|
|
762
|
+
# Read feature config
|
|
763
|
+
local feature_name=$(jq -r '.name' "$feature_json")
|
|
764
|
+
local base_branch=$(jq -r '.base_branch // "main"' "$feature_json")
|
|
765
|
+
local scope=$(jq -r '.scope // "core"' "$feature_json")
|
|
766
|
+
local dev_type=$(jq -r '.dev_type // "feature"' "$feature_json")
|
|
767
|
+
|
|
768
|
+
# Map dev_type to commit prefix
|
|
769
|
+
local commit_prefix
|
|
770
|
+
case "$dev_type" in
|
|
771
|
+
feature|frontend|backend|fullstack) commit_prefix="feat" ;;
|
|
772
|
+
bugfix|fix) commit_prefix="fix" ;;
|
|
773
|
+
refactor) commit_prefix="refactor" ;;
|
|
774
|
+
docs) commit_prefix="docs" ;;
|
|
775
|
+
test) commit_prefix="test" ;;
|
|
776
|
+
*) commit_prefix="feat" ;;
|
|
777
|
+
esac
|
|
778
|
+
|
|
779
|
+
echo -e "Feature: ${feature_name}"
|
|
780
|
+
echo -e "Base branch: ${base_branch}"
|
|
781
|
+
echo -e "Scope: ${scope}"
|
|
782
|
+
echo -e "Commit prefix: ${commit_prefix}"
|
|
783
|
+
echo ""
|
|
784
|
+
|
|
785
|
+
# Get current branch
|
|
786
|
+
local current_branch=$(git branch --show-current)
|
|
787
|
+
echo -e "Current branch: ${current_branch}"
|
|
788
|
+
|
|
789
|
+
# Check for changes
|
|
790
|
+
echo -e "${YELLOW}Checking for changes...${NC}"
|
|
791
|
+
|
|
792
|
+
# Stage changes (even in dry-run to detect what would be committed)
|
|
793
|
+
git add -A
|
|
794
|
+
# Exclude agent traces and temp files
|
|
795
|
+
git reset "$DIR_WORKFLOW/$DIR_PROGRESS/" 2>/dev/null || true
|
|
796
|
+
git reset .agent-log .agent-prompt .agent-runner.sh 2>/dev/null || true
|
|
797
|
+
|
|
798
|
+
# Check if there are staged changes
|
|
799
|
+
if git diff --cached --quiet 2>/dev/null; then
|
|
800
|
+
echo -e "${YELLOW}No staged changes to commit${NC}"
|
|
801
|
+
|
|
802
|
+
# Check for unpushed commits
|
|
803
|
+
local unpushed=$(git log "origin/${current_branch}..HEAD" --oneline 2>/dev/null | wc -l | tr -d ' ' || echo "0")
|
|
804
|
+
if [[ "$unpushed" -eq 0 ]] 2>/dev/null; then
|
|
805
|
+
# In dry-run, also reset the staging
|
|
806
|
+
if [[ "$dry_run" == "true" ]]; then
|
|
807
|
+
git reset HEAD >/dev/null 2>&1 || true
|
|
808
|
+
fi
|
|
809
|
+
echo -e "${RED}No changes to create PR${NC}"
|
|
810
|
+
exit 1
|
|
811
|
+
fi
|
|
812
|
+
echo -e "Found ${unpushed} unpushed commit(s)"
|
|
813
|
+
else
|
|
814
|
+
# Commit changes
|
|
815
|
+
echo -e "${YELLOW}Committing changes...${NC}"
|
|
816
|
+
local commit_msg="${commit_prefix}(${scope}): ${feature_name}"
|
|
817
|
+
|
|
818
|
+
if [[ "$dry_run" == "true" ]]; then
|
|
819
|
+
echo -e "[DRY-RUN] Would commit with message: ${commit_msg}"
|
|
820
|
+
echo -e "[DRY-RUN] Staged files:"
|
|
821
|
+
git diff --cached --name-only | sed 's/^/ - /'
|
|
822
|
+
else
|
|
823
|
+
git commit -m "$commit_msg"
|
|
824
|
+
echo -e "${GREEN}Committed: ${commit_msg}${NC}"
|
|
825
|
+
fi
|
|
826
|
+
fi
|
|
827
|
+
|
|
828
|
+
# Push to remote
|
|
829
|
+
echo -e "${YELLOW}Pushing to remote...${NC}"
|
|
830
|
+
if [[ "$dry_run" == "true" ]]; then
|
|
831
|
+
echo -e "[DRY-RUN] Would push to: origin/${current_branch}"
|
|
832
|
+
else
|
|
833
|
+
git push -u origin "$current_branch"
|
|
834
|
+
echo -e "${GREEN}Pushed to origin/${current_branch}${NC}"
|
|
835
|
+
fi
|
|
836
|
+
|
|
837
|
+
# Create PR
|
|
838
|
+
echo -e "${YELLOW}Creating PR...${NC}"
|
|
839
|
+
local pr_title="${commit_prefix}(${scope}): ${feature_name}"
|
|
840
|
+
local pr_url=""
|
|
841
|
+
|
|
842
|
+
if [[ "$dry_run" == "true" ]]; then
|
|
843
|
+
echo -e "[DRY-RUN] Would create PR:"
|
|
844
|
+
echo -e " Title: ${pr_title}"
|
|
845
|
+
echo -e " Base: ${base_branch}"
|
|
846
|
+
echo -e " Head: ${current_branch}"
|
|
847
|
+
if [[ -f "$target_dir/prd.md" ]]; then
|
|
848
|
+
echo -e " Body: (from prd.md)"
|
|
849
|
+
fi
|
|
850
|
+
pr_url="https://github.com/example/repo/pull/DRY-RUN"
|
|
851
|
+
else
|
|
852
|
+
# Check if PR already exists
|
|
853
|
+
local existing_pr=$(gh pr list --head "$current_branch" --base "$base_branch" --json url --jq '.[0].url' 2>/dev/null || echo "")
|
|
854
|
+
|
|
855
|
+
if [[ -n "$existing_pr" ]]; then
|
|
856
|
+
echo -e "${YELLOW}PR already exists: ${existing_pr}${NC}"
|
|
857
|
+
pr_url="$existing_pr"
|
|
858
|
+
else
|
|
859
|
+
# Read PRD as PR body
|
|
860
|
+
local pr_body=""
|
|
861
|
+
if [[ -f "$target_dir/prd.md" ]]; then
|
|
862
|
+
pr_body=$(cat "$target_dir/prd.md")
|
|
863
|
+
fi
|
|
864
|
+
|
|
865
|
+
# Create PR
|
|
866
|
+
pr_url=$(gh pr create \
|
|
867
|
+
--draft \
|
|
868
|
+
--base "$base_branch" \
|
|
869
|
+
--title "$pr_title" \
|
|
870
|
+
--body "$pr_body" \
|
|
871
|
+
2>&1)
|
|
872
|
+
|
|
873
|
+
echo -e "${GREEN}PR created: ${pr_url}${NC}"
|
|
874
|
+
fi
|
|
875
|
+
fi
|
|
876
|
+
|
|
877
|
+
# Update feature.json
|
|
878
|
+
echo -e "${YELLOW}Updating feature status...${NC}"
|
|
879
|
+
if [[ "$dry_run" == "true" ]]; then
|
|
880
|
+
echo -e "[DRY-RUN] Would update feature.json:"
|
|
881
|
+
echo -e " status: review"
|
|
882
|
+
echo -e " pr_url: ${pr_url}"
|
|
883
|
+
else
|
|
884
|
+
jq --arg url "$pr_url" '.status = "review" | .pr_url = $url' "$feature_json" > "${feature_json}.tmp"
|
|
885
|
+
mv "${feature_json}.tmp" "$feature_json"
|
|
886
|
+
echo -e "${GREEN}Feature status updated to 'review'${NC}"
|
|
887
|
+
fi
|
|
888
|
+
|
|
889
|
+
# In dry-run, reset the staging area
|
|
890
|
+
if [[ "$dry_run" == "true" ]]; then
|
|
891
|
+
git reset HEAD >/dev/null 2>&1 || true
|
|
892
|
+
fi
|
|
893
|
+
|
|
894
|
+
echo ""
|
|
895
|
+
echo -e "${GREEN}=== PR Created Successfully ===${NC}"
|
|
896
|
+
echo -e "PR URL: ${pr_url}"
|
|
897
|
+
echo -e "Target: ${base_branch}"
|
|
898
|
+
echo -e "Source: ${current_branch}"
|
|
899
|
+
}
|
|
900
|
+
|
|
625
901
|
# =============================================================================
|
|
626
902
|
# Help
|
|
627
903
|
# =============================================================================
|
|
@@ -638,6 +914,9 @@ Usage:
|
|
|
638
914
|
$0 list-context <dir> List jsonl entries
|
|
639
915
|
$0 start <dir> Set as current feature
|
|
640
916
|
$0 finish Clear current feature
|
|
917
|
+
$0 set-branch <dir> <branch> Set git branch for multi-agent
|
|
918
|
+
$0 set-scope <dir> <scope> Set scope for PR title
|
|
919
|
+
$0 create-pr [dir] [--dry-run] Create PR from feature
|
|
641
920
|
$0 archive <feature-name> Archive completed feature
|
|
642
921
|
$0 list List active features
|
|
643
922
|
$0 list-archive [YYYY-MM] List archived features
|
|
@@ -649,7 +928,10 @@ Examples:
|
|
|
649
928
|
$0 create add-login-feature
|
|
650
929
|
$0 init-context .trellis/agent-traces/john/features/13-add-login-feature backend
|
|
651
930
|
$0 add-context <dir> implement .trellis/structure/backend/auth.md "Auth guidelines"
|
|
931
|
+
$0 set-branch <dir> feature/add-login-feature
|
|
652
932
|
$0 start .trellis/agent-traces/john/features/13-add-login-feature
|
|
933
|
+
$0 create-pr # Uses current feature
|
|
934
|
+
$0 create-pr <dir> --dry-run # Preview without changes
|
|
653
935
|
$0 finish
|
|
654
936
|
$0 archive add-login-feature
|
|
655
937
|
EOF
|
|
@@ -681,6 +963,16 @@ case "${1:-}" in
|
|
|
681
963
|
finish)
|
|
682
964
|
cmd_finish
|
|
683
965
|
;;
|
|
966
|
+
set-branch)
|
|
967
|
+
cmd_set_branch "$2" "$3"
|
|
968
|
+
;;
|
|
969
|
+
set-scope)
|
|
970
|
+
cmd_set_scope "$2" "$3"
|
|
971
|
+
;;
|
|
972
|
+
create-pr)
|
|
973
|
+
shift
|
|
974
|
+
cmd_create_pr "$@"
|
|
975
|
+
;;
|
|
684
976
|
archive)
|
|
685
977
|
cmd_archive "$2"
|
|
686
978
|
;;
|
|
@@ -6,8 +6,14 @@
|
|
|
6
6
|
* ├── common/ # Shared utilities (to be sourced)
|
|
7
7
|
* │ ├── paths.sh.txt # Path utilities
|
|
8
8
|
* │ ├── developer.sh.txt # Developer management
|
|
9
|
-
* │
|
|
9
|
+
* │ ├── git-context.sh.txt # Git context (main implementation)
|
|
10
|
+
* │ └── worktree.sh.txt # Worktree utilities (for multi-agent)
|
|
11
|
+
* ├── multi-agent/ # Multi-agent pipeline scripts
|
|
12
|
+
* │ ├── start.sh.txt # Start worktree agent
|
|
13
|
+
* │ ├── cleanup.sh.txt # Cleanup worktree
|
|
14
|
+
* │ └── status.sh.txt # Status monitor
|
|
10
15
|
* ├── feature.sh.txt # Feature management
|
|
16
|
+
* ├── worktree.yaml.txt # Worktree configuration template
|
|
11
17
|
* ├── get-context.sh.txt # Wrapper for git-context.sh
|
|
12
18
|
* ├── get-developer.sh.txt # Get developer name
|
|
13
19
|
* ├── init-developer.sh.txt
|
|
@@ -16,6 +22,11 @@
|
|
|
16
22
|
export declare const commonPathsScript: string;
|
|
17
23
|
export declare const commonDeveloperScript: string;
|
|
18
24
|
export declare const commonGitContextScript: string;
|
|
25
|
+
export declare const commonWorktreeScript: string;
|
|
26
|
+
export declare const multiAgentStartScript: string;
|
|
27
|
+
export declare const multiAgentCleanupScript: string;
|
|
28
|
+
export declare const multiAgentStatusScript: string;
|
|
29
|
+
export declare const worktreeYamlTemplate: string;
|
|
19
30
|
export declare const initDeveloperScript: string;
|
|
20
31
|
export declare const getDeveloperScript: string;
|
|
21
32
|
export declare const featureScript: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/scripts/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/scripts/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAKH,eAAO,MAAM,iBAAiB,EAAE,MAA0C,CAAC;AAC3E,eAAO,MAAM,qBAAqB,EAAE,MAEnC,CAAC;AACF,eAAO,MAAM,sBAAsB,EAAE,MAEpC,CAAC;AACF,eAAO,MAAM,oBAAoB,EAAE,MAElC,CAAC;AAGF,eAAO,MAAM,qBAAqB,EAAE,MAEnC,CAAC;AACF,eAAO,MAAM,uBAAuB,EAAE,MAErC,CAAC;AACF,eAAO,MAAM,sBAAsB,EAAE,MAEpC,CAAC;AAGF,eAAO,MAAM,oBAAoB,EAAE,MAAwC,CAAC;AAG5E,eAAO,MAAM,mBAAmB,EAAE,MAA4C,CAAC;AAC/E,eAAO,MAAM,kBAAkB,EAAE,MAA2C,CAAC;AAC7E,eAAO,MAAM,aAAa,EAAE,MAAqC,CAAC;AAClE,eAAO,MAAM,gBAAgB,EAAE,MAAyC,CAAC;AACzE,eAAO,MAAM,gBAAgB,EAAE,MAAyC,CAAC;AACzE,eAAO,MAAM,qBAAqB,EAAE,MAEnC,CAAC"}
|
|
@@ -6,8 +6,14 @@
|
|
|
6
6
|
* ├── common/ # Shared utilities (to be sourced)
|
|
7
7
|
* │ ├── paths.sh.txt # Path utilities
|
|
8
8
|
* │ ├── developer.sh.txt # Developer management
|
|
9
|
-
* │
|
|
9
|
+
* │ ├── git-context.sh.txt # Git context (main implementation)
|
|
10
|
+
* │ └── worktree.sh.txt # Worktree utilities (for multi-agent)
|
|
11
|
+
* ├── multi-agent/ # Multi-agent pipeline scripts
|
|
12
|
+
* │ ├── start.sh.txt # Start worktree agent
|
|
13
|
+
* │ ├── cleanup.sh.txt # Cleanup worktree
|
|
14
|
+
* │ └── status.sh.txt # Status monitor
|
|
10
15
|
* ├── feature.sh.txt # Feature management
|
|
16
|
+
* ├── worktree.yaml.txt # Worktree configuration template
|
|
11
17
|
* ├── get-context.sh.txt # Wrapper for git-context.sh
|
|
12
18
|
* ├── get-developer.sh.txt # Get developer name
|
|
13
19
|
* ├── init-developer.sh.txt
|
|
@@ -18,6 +24,13 @@ import { readScript } from "../extract.js";
|
|
|
18
24
|
export const commonPathsScript = readScript("common/paths.sh.txt");
|
|
19
25
|
export const commonDeveloperScript = readScript("common/developer.sh.txt");
|
|
20
26
|
export const commonGitContextScript = readScript("common/git-context.sh.txt");
|
|
27
|
+
export const commonWorktreeScript = readScript("common/worktree.sh.txt");
|
|
28
|
+
// Multi-agent scripts
|
|
29
|
+
export const multiAgentStartScript = readScript("multi-agent/start.sh.txt");
|
|
30
|
+
export const multiAgentCleanupScript = readScript("multi-agent/cleanup.sh.txt");
|
|
31
|
+
export const multiAgentStatusScript = readScript("multi-agent/status.sh.txt");
|
|
32
|
+
// Configuration templates
|
|
33
|
+
export const worktreeYamlTemplate = readScript("worktree.yaml.txt");
|
|
21
34
|
// Main scripts
|
|
22
35
|
export const initDeveloperScript = readScript("init-developer.sh.txt");
|
|
23
36
|
export const getDeveloperScript = readScript("get-developer.sh.txt");
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/scripts/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/scripts/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,oDAAoD;AACpD,MAAM,CAAC,MAAM,iBAAiB,GAAW,UAAU,CAAC,qBAAqB,CAAC,CAAC;AAC3E,MAAM,CAAC,MAAM,qBAAqB,GAAW,UAAU,CACrD,yBAAyB,CAC1B,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAW,UAAU,CACtD,2BAA2B,CAC5B,CAAC;AACF,MAAM,CAAC,MAAM,oBAAoB,GAAW,UAAU,CACpD,wBAAwB,CACzB,CAAC;AAEF,sBAAsB;AACtB,MAAM,CAAC,MAAM,qBAAqB,GAAW,UAAU,CACrD,0BAA0B,CAC3B,CAAC;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAW,UAAU,CACvD,4BAA4B,CAC7B,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAW,UAAU,CACtD,2BAA2B,CAC5B,CAAC;AAEF,0BAA0B;AAC1B,MAAM,CAAC,MAAM,oBAAoB,GAAW,UAAU,CAAC,mBAAmB,CAAC,CAAC;AAE5E,eAAe;AACf,MAAM,CAAC,MAAM,mBAAmB,GAAW,UAAU,CAAC,uBAAuB,CAAC,CAAC;AAC/E,MAAM,CAAC,MAAM,kBAAkB,GAAW,UAAU,CAAC,sBAAsB,CAAC,CAAC;AAC7E,MAAM,CAAC,MAAM,aAAa,GAAW,UAAU,CAAC,gBAAgB,CAAC,CAAC;AAClE,MAAM,CAAC,MAAM,gBAAgB,GAAW,UAAU,CAAC,oBAAoB,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,gBAAgB,GAAW,UAAU,CAAC,oBAAoB,CAAC,CAAC;AACzE,MAAM,CAAC,MAAM,qBAAqB,GAAW,UAAU,CACrD,yBAAyB,CAC1B,CAAC"}
|