@mind-fold/open-flow 0.1.9 → 0.1.11
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 +1 -0
- package/dist/configurators/templates.d.ts.map +1 -1
- package/dist/configurators/templates.js +14 -837
- package/dist/configurators/templates.js.map +1 -1
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +24 -1547
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/templates/commands/before-backend-dev.txt +10 -0
- package/dist/templates/commands/before-frontend-dev.txt +10 -0
- package/dist/templates/commands/check-backend.txt +9 -0
- package/dist/templates/commands/check-frontend.txt +9 -0
- package/dist/templates/commands/create-command.txt +155 -0
- package/dist/templates/commands/generate-backend-structure.txt +341 -0
- package/dist/templates/commands/generate-frontend-structure.txt +297 -0
- package/dist/templates/commands/index.d.ts +18 -0
- package/dist/templates/commands/index.d.ts.map +1 -0
- package/dist/templates/commands/index.js +19 -0
- package/dist/templates/commands/index.js.map +1 -0
- package/dist/templates/commands/init-agent.txt +11 -0
- package/dist/templates/commands/onboard-developer.txt +34 -0
- package/dist/templates/commands/record-agent-flow.txt +64 -0
- package/dist/templates/commands/record-question.txt +38 -0
- package/dist/templates/commands/update-backend-structure.txt +16 -0
- package/dist/templates/commands/update-frontend-structure.txt +16 -0
- package/dist/templates/extract.d.ts +20 -0
- package/dist/templates/extract.d.ts.map +1 -0
- package/dist/templates/extract.js +34 -0
- package/dist/templates/extract.js.map +1 -0
- package/dist/templates/markdown/agent-progress-index.d.ts +2 -0
- package/dist/templates/markdown/agent-progress-index.d.ts.map +1 -0
- package/dist/templates/markdown/agent-progress-index.js +5 -0
- package/dist/templates/markdown/agent-progress-index.js.map +1 -0
- package/dist/templates/markdown/agent-progress-index.md.txt +124 -0
- package/dist/templates/markdown/backend-doc.d.ts +2 -0
- package/dist/templates/markdown/backend-doc.d.ts.map +1 -0
- package/dist/templates/markdown/backend-doc.js +5 -0
- package/dist/templates/markdown/backend-doc.js.map +1 -0
- package/dist/templates/markdown/backend-doc.md.txt +154 -0
- package/dist/templates/markdown/backend-index.d.ts +2 -0
- package/dist/templates/markdown/backend-index.d.ts.map +1 -0
- package/dist/templates/markdown/backend-index.js +5 -0
- package/dist/templates/markdown/backend-index.js.map +1 -0
- package/dist/templates/markdown/backend-index.md.txt +45 -0
- package/dist/templates/markdown/flow.d.ts +2 -0
- package/dist/templates/markdown/flow.d.ts.map +1 -0
- package/dist/templates/markdown/flow.js +5 -0
- package/dist/templates/markdown/flow.js.map +1 -0
- package/dist/templates/markdown/flow.md.txt +342 -0
- package/dist/templates/markdown/frontend-doc.d.ts +2 -0
- package/dist/templates/markdown/frontend-doc.d.ts.map +1 -0
- package/dist/templates/markdown/frontend-doc.js +5 -0
- package/dist/templates/markdown/frontend-doc.js.map +1 -0
- package/dist/templates/markdown/frontend-doc.md.txt +175 -0
- package/dist/templates/markdown/frontend-index.d.ts +2 -0
- package/dist/templates/markdown/frontend-index.d.ts.map +1 -0
- package/dist/templates/markdown/frontend-index.js +5 -0
- package/dist/templates/markdown/frontend-index.js.map +1 -0
- package/dist/templates/markdown/frontend-index.md.txt +46 -0
- package/dist/templates/markdown/gitignore.d.ts +2 -0
- package/dist/templates/markdown/gitignore.d.ts.map +1 -0
- package/dist/templates/markdown/gitignore.js +5 -0
- package/dist/templates/markdown/gitignore.js.map +1 -0
- package/dist/templates/markdown/gitignore.txt +3 -0
- package/dist/templates/markdown/index.d.ts +12 -0
- package/dist/templates/markdown/index.d.ts.map +1 -0
- package/dist/templates/markdown/index.js +13 -0
- package/dist/templates/markdown/index.js.map +1 -0
- package/dist/templates/scripts/add-session.d.ts +2 -0
- package/dist/templates/scripts/add-session.d.ts.map +1 -0
- package/dist/templates/scripts/add-session.js +5 -0
- package/dist/templates/scripts/add-session.js.map +1 -0
- package/dist/templates/scripts/add-session.sh.txt +257 -0
- package/dist/templates/scripts/extract-md-headings.d.ts +2 -0
- package/dist/templates/scripts/extract-md-headings.d.ts.map +1 -0
- package/dist/templates/scripts/extract-md-headings.js +5 -0
- package/dist/templates/scripts/extract-md-headings.js.map +1 -0
- package/dist/templates/scripts/extract-md-headings.sh.txt +260 -0
- package/dist/templates/scripts/feature.d.ts +2 -0
- package/dist/templates/scripts/feature.d.ts.map +1 -0
- package/dist/templates/scripts/feature.js +5 -0
- package/dist/templates/scripts/feature.js.map +1 -0
- package/dist/templates/scripts/feature.sh.txt +243 -0
- package/dist/templates/scripts/get-context.d.ts +2 -0
- package/dist/templates/scripts/get-context.d.ts.map +1 -0
- package/dist/templates/scripts/get-context.js +5 -0
- package/dist/templates/scripts/get-context.js.map +1 -0
- package/dist/templates/scripts/get-context.sh.txt +243 -0
- package/dist/templates/scripts/get-developer.d.ts +2 -0
- package/dist/templates/scripts/get-developer.d.ts.map +1 -0
- package/dist/templates/scripts/get-developer.js +5 -0
- package/dist/templates/scripts/get-developer.js.map +1 -0
- package/dist/templates/scripts/get-developer.sh.txt +16 -0
- package/dist/templates/scripts/index.d.ts +12 -0
- package/dist/templates/scripts/index.d.ts.map +1 -0
- package/dist/templates/scripts/index.js +13 -0
- package/dist/templates/scripts/index.js.map +1 -0
- package/dist/templates/scripts/init-developer.d.ts +2 -0
- package/dist/templates/scripts/init-developer.d.ts.map +1 -0
- package/dist/templates/scripts/init-developer.js +5 -0
- package/dist/templates/scripts/init-developer.js.map +1 -0
- package/dist/templates/scripts/init-developer.sh.txt +114 -0
- package/dist/templates/scripts/update-index.d.ts +2 -0
- package/dist/templates/scripts/update-index.d.ts.map +1 -0
- package/dist/templates/scripts/update-index.js +5 -0
- package/dist/templates/scripts/update-index.js.map +1 -0
- package/dist/templates/scripts/update-index.sh.txt +244 -0
- package/package.json +3 -2
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Feature Management Script
|
|
4
|
+
# Usage:
|
|
5
|
+
# ./workflow/scripts/feature.sh create <feature-name> # Create new feature
|
|
6
|
+
# ./workflow/scripts/feature.sh archive <feature-name> # Archive completed feature
|
|
7
|
+
# ./workflow/scripts/feature.sh list # List active features
|
|
8
|
+
# ./workflow/scripts/feature.sh list-archive [month] # List archived features
|
|
9
|
+
|
|
10
|
+
set -e
|
|
11
|
+
|
|
12
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
13
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
14
|
+
WORKFLOW_DIR="$PROJECT_ROOT/workflow"
|
|
15
|
+
|
|
16
|
+
RED='\033[0;31m'
|
|
17
|
+
GREEN='\033[0;32m'
|
|
18
|
+
YELLOW='\033[1;33m'
|
|
19
|
+
BLUE='\033[0;34m'
|
|
20
|
+
NC='\033[0m'
|
|
21
|
+
|
|
22
|
+
get_developer() {
|
|
23
|
+
local developer_file="$WORKFLOW_DIR/.developer"
|
|
24
|
+
if [[ -f "$developer_file" ]]; then
|
|
25
|
+
grep "^name=" "$developer_file" | cut -d= -f2
|
|
26
|
+
else
|
|
27
|
+
echo ""
|
|
28
|
+
fi
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
get_features_dir() {
|
|
32
|
+
local developer=$(get_developer)
|
|
33
|
+
if [[ -z "$developer" ]]; then
|
|
34
|
+
echo -e "${RED}Error: Developer not initialized. Run ./workflow/scripts/init-developer.sh first${NC}" >&2
|
|
35
|
+
exit 1
|
|
36
|
+
fi
|
|
37
|
+
echo "$WORKFLOW_DIR/agent-progress/$developer/features"
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
ensure_features_dir() {
|
|
41
|
+
local features_dir=$(get_features_dir)
|
|
42
|
+
local archive_dir="$features_dir/archive"
|
|
43
|
+
|
|
44
|
+
if [[ ! -d "$features_dir" ]]; then
|
|
45
|
+
mkdir -p "$features_dir"
|
|
46
|
+
echo -e "${GREEN}Created features directory: $features_dir${NC}" >&2
|
|
47
|
+
fi
|
|
48
|
+
|
|
49
|
+
if [[ ! -d "$archive_dir" ]]; then
|
|
50
|
+
mkdir -p "$archive_dir"
|
|
51
|
+
fi
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
create_feature() {
|
|
55
|
+
local feature_name="$1"
|
|
56
|
+
|
|
57
|
+
if [[ -z "$feature_name" ]]; then
|
|
58
|
+
echo -e "${RED}Error: Feature name is required${NC}" >&2
|
|
59
|
+
echo "Usage: $0 create <feature-name>" >&2
|
|
60
|
+
exit 1
|
|
61
|
+
fi
|
|
62
|
+
|
|
63
|
+
ensure_features_dir
|
|
64
|
+
|
|
65
|
+
local features_dir=$(get_features_dir)
|
|
66
|
+
local day=$(date +%d)
|
|
67
|
+
local filename="${day}-${feature_name}.json"
|
|
68
|
+
local filepath="$features_dir/$filename"
|
|
69
|
+
|
|
70
|
+
if [[ -f "$filepath" ]]; then
|
|
71
|
+
echo -e "${YELLOW}Warning: Feature already exists: $filepath${NC}" >&2
|
|
72
|
+
echo "workflow/agent-progress/$(get_developer)/features/$filename"
|
|
73
|
+
exit 0
|
|
74
|
+
fi
|
|
75
|
+
|
|
76
|
+
local today=$(date +%Y-%m-%d)
|
|
77
|
+
local developer=$(get_developer)
|
|
78
|
+
|
|
79
|
+
cat > "$filepath" << EOF
|
|
80
|
+
{
|
|
81
|
+
"id": "$feature_name",
|
|
82
|
+
"name": "$feature_name",
|
|
83
|
+
"description": "",
|
|
84
|
+
"status": "in-progress",
|
|
85
|
+
"priority": "medium",
|
|
86
|
+
"developer": "$developer",
|
|
87
|
+
"createdAt": "$today",
|
|
88
|
+
"completedAt": null,
|
|
89
|
+
"commit": null,
|
|
90
|
+
"subtasks": [],
|
|
91
|
+
"relatedFiles": [],
|
|
92
|
+
"notes": ""
|
|
93
|
+
}
|
|
94
|
+
EOF
|
|
95
|
+
|
|
96
|
+
echo -e "${GREEN}Created feature: $filename${NC}" >&2
|
|
97
|
+
echo "workflow/agent-progress/$developer/features/$filename"
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
archive_feature() {
|
|
101
|
+
local feature_name="$1"
|
|
102
|
+
|
|
103
|
+
if [[ -z "$feature_name" ]]; then
|
|
104
|
+
echo -e "${RED}Error: Feature name is required${NC}" >&2
|
|
105
|
+
echo "Usage: $0 archive <feature-name>" >&2
|
|
106
|
+
exit 1
|
|
107
|
+
fi
|
|
108
|
+
|
|
109
|
+
local features_dir=$(get_features_dir)
|
|
110
|
+
local archive_dir="$features_dir/archive"
|
|
111
|
+
local year_month=$(date +%Y-%m)
|
|
112
|
+
local month_dir="$archive_dir/$year_month"
|
|
113
|
+
|
|
114
|
+
local feature_file=$(find "$features_dir" -maxdepth 1 -name "*-${feature_name}.json" -type f 2>/dev/null | head -1)
|
|
115
|
+
|
|
116
|
+
if [[ -z "$feature_file" ]] || [[ ! -f "$feature_file" ]]; then
|
|
117
|
+
echo -e "${RED}Error: Feature not found: $feature_name${NC}" >&2
|
|
118
|
+
echo "Active features:" >&2
|
|
119
|
+
list_features >&2
|
|
120
|
+
exit 1
|
|
121
|
+
fi
|
|
122
|
+
|
|
123
|
+
if [[ ! -d "$month_dir" ]]; then
|
|
124
|
+
mkdir -p "$month_dir"
|
|
125
|
+
fi
|
|
126
|
+
|
|
127
|
+
local filename=$(basename "$feature_file")
|
|
128
|
+
local target_path="$month_dir/$filename"
|
|
129
|
+
|
|
130
|
+
local today=$(date +%Y-%m-%d)
|
|
131
|
+
if command -v jq &> /dev/null; then
|
|
132
|
+
local temp_file=$(mktemp)
|
|
133
|
+
jq --arg date "$today" '.status = "completed" | .completedAt = $date' "$feature_file" > "$temp_file"
|
|
134
|
+
mv "$temp_file" "$feature_file"
|
|
135
|
+
else
|
|
136
|
+
sed -i.bak 's/"status": "in-progress"/"status": "completed"/' "$feature_file"
|
|
137
|
+
sed -i.bak "s/\"completedAt\": null/\"completedAt\": \"$today\"/" "$feature_file"
|
|
138
|
+
rm -f "${feature_file}.bak"
|
|
139
|
+
fi
|
|
140
|
+
|
|
141
|
+
mv "$feature_file" "$target_path"
|
|
142
|
+
|
|
143
|
+
echo -e "${GREEN}Archived: $filename -> archive/$year_month/${NC}" >&2
|
|
144
|
+
echo "workflow/agent-progress/$(get_developer)/features/archive/$year_month/$filename"
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
list_features() {
|
|
148
|
+
local features_dir=$(get_features_dir)
|
|
149
|
+
|
|
150
|
+
echo -e "${BLUE}Active features for $(get_developer):${NC}"
|
|
151
|
+
echo ""
|
|
152
|
+
|
|
153
|
+
local count=0
|
|
154
|
+
for f in "$features_dir"/*.json; do
|
|
155
|
+
if [[ -f "$f" ]]; then
|
|
156
|
+
local filename=$(basename "$f")
|
|
157
|
+
local name=$(echo "$filename" | sed 's/^[0-9]*-//' | sed 's/\.json$//')
|
|
158
|
+
local status=""
|
|
159
|
+
if command -v jq &> /dev/null; then
|
|
160
|
+
status=$(jq -r '.status // "unknown"' "$f")
|
|
161
|
+
fi
|
|
162
|
+
echo " - $filename ($status)"
|
|
163
|
+
((count++))
|
|
164
|
+
fi
|
|
165
|
+
done
|
|
166
|
+
|
|
167
|
+
if [[ $count -eq 0 ]]; then
|
|
168
|
+
echo " (no active features)"
|
|
169
|
+
fi
|
|
170
|
+
|
|
171
|
+
echo ""
|
|
172
|
+
echo "Total: $count active feature(s)"
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
list_archive() {
|
|
176
|
+
local month="$1"
|
|
177
|
+
local features_dir=$(get_features_dir)
|
|
178
|
+
local archive_dir="$features_dir/archive"
|
|
179
|
+
|
|
180
|
+
echo -e "${BLUE}Archived features for $(get_developer):${NC}"
|
|
181
|
+
echo ""
|
|
182
|
+
|
|
183
|
+
if [[ -n "$month" ]]; then
|
|
184
|
+
local month_dir="$archive_dir/$month"
|
|
185
|
+
if [[ -d "$month_dir" ]]; then
|
|
186
|
+
echo "[$month]"
|
|
187
|
+
for f in "$month_dir"/*.json; do
|
|
188
|
+
if [[ -f "$f" ]]; then
|
|
189
|
+
echo " - $(basename "$f")"
|
|
190
|
+
fi
|
|
191
|
+
done
|
|
192
|
+
else
|
|
193
|
+
echo " No archives for $month"
|
|
194
|
+
fi
|
|
195
|
+
else
|
|
196
|
+
for month_dir in "$archive_dir"/*/; do
|
|
197
|
+
if [[ -d "$month_dir" ]]; then
|
|
198
|
+
local month_name=$(basename "$month_dir")
|
|
199
|
+
local count=$(find "$month_dir" -name "*.json" -type f | wc -l | tr -d ' ')
|
|
200
|
+
echo "[$month_name] - $count feature(s)"
|
|
201
|
+
fi
|
|
202
|
+
done
|
|
203
|
+
fi
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
show_usage() {
|
|
207
|
+
echo "Feature Management Script"
|
|
208
|
+
echo ""
|
|
209
|
+
echo "Usage:"
|
|
210
|
+
echo " $0 create <feature-name> Create new feature, output relative path"
|
|
211
|
+
echo " $0 archive <feature-name> Archive completed feature"
|
|
212
|
+
echo " $0 list List active features"
|
|
213
|
+
echo " $0 list-archive [YYYY-MM] List archived features"
|
|
214
|
+
echo ""
|
|
215
|
+
echo "Examples:"
|
|
216
|
+
echo " $0 create add-login-feature"
|
|
217
|
+
echo " $0 archive filter-implementation"
|
|
218
|
+
echo " $0 list"
|
|
219
|
+
echo " $0 list-archive 2025-12"
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
case "${1:-}" in
|
|
223
|
+
create)
|
|
224
|
+
create_feature "$2"
|
|
225
|
+
;;
|
|
226
|
+
archive)
|
|
227
|
+
archive_feature "$2"
|
|
228
|
+
;;
|
|
229
|
+
list)
|
|
230
|
+
list_features
|
|
231
|
+
;;
|
|
232
|
+
list-archive)
|
|
233
|
+
list_archive "$2"
|
|
234
|
+
;;
|
|
235
|
+
-h|--help|help)
|
|
236
|
+
show_usage
|
|
237
|
+
;;
|
|
238
|
+
*)
|
|
239
|
+
show_usage
|
|
240
|
+
exit 1
|
|
241
|
+
;;
|
|
242
|
+
esac
|
|
243
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-context.d.ts","sourceRoot":"","sources":["../../../src/templates/scripts/get-context.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gBAAgB,QAAyC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-context.js","sourceRoot":"","sources":["../../../src/templates/scripts/get-context.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;AAChE,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Get Session Context for AI Agent
|
|
4
|
+
# Usage:
|
|
5
|
+
# ./workflow/scripts/get-context.sh # Full context output
|
|
6
|
+
# ./workflow/scripts/get-context.sh --json # JSON format
|
|
7
|
+
|
|
8
|
+
set -e
|
|
9
|
+
|
|
10
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
11
|
+
PROJECT_ROOT="$(cd "$SCRIPT_DIR/../.." && pwd)"
|
|
12
|
+
WORKFLOW_DIR="$PROJECT_ROOT/workflow"
|
|
13
|
+
|
|
14
|
+
cd "$PROJECT_ROOT"
|
|
15
|
+
|
|
16
|
+
get_developer() {
|
|
17
|
+
local developer_file="$WORKFLOW_DIR/.developer"
|
|
18
|
+
if [[ -f "$developer_file" ]]; then
|
|
19
|
+
grep "^name=" "$developer_file" | cut -d= -f2
|
|
20
|
+
else
|
|
21
|
+
echo ""
|
|
22
|
+
fi
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get_features_dir() {
|
|
26
|
+
local developer=$(get_developer)
|
|
27
|
+
if [[ -n "$developer" ]]; then
|
|
28
|
+
echo "$WORKFLOW_DIR/agent-progress/$developer/features"
|
|
29
|
+
fi
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get_progress_dir() {
|
|
33
|
+
local developer=$(get_developer)
|
|
34
|
+
if [[ -n "$developer" ]]; then
|
|
35
|
+
echo "$WORKFLOW_DIR/agent-progress/$developer"
|
|
36
|
+
fi
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
count_lines() {
|
|
40
|
+
local file="$1"
|
|
41
|
+
if [[ -f "$file" ]]; then
|
|
42
|
+
wc -l < "$file" | tr -d ' '
|
|
43
|
+
else
|
|
44
|
+
echo "0"
|
|
45
|
+
fi
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
get_active_progress_file() {
|
|
49
|
+
local progress_dir=$(get_progress_dir)
|
|
50
|
+
if [[ -z "$progress_dir" ]] || [[ ! -d "$progress_dir" ]]; then
|
|
51
|
+
echo ""
|
|
52
|
+
return
|
|
53
|
+
fi
|
|
54
|
+
|
|
55
|
+
local latest=""
|
|
56
|
+
local highest=0
|
|
57
|
+
for f in "$progress_dir"/progress-*.md; do
|
|
58
|
+
if [[ -f "$f" ]]; then
|
|
59
|
+
local num=$(basename "$f" | sed 's/progress-//' | sed 's/\.md//')
|
|
60
|
+
if [[ "$num" =~ ^[0-9]+$ ]] && [[ "$num" -gt "$highest" ]]; then
|
|
61
|
+
highest=$num
|
|
62
|
+
latest="$f"
|
|
63
|
+
fi
|
|
64
|
+
fi
|
|
65
|
+
done
|
|
66
|
+
|
|
67
|
+
if [[ -n "$latest" ]]; then
|
|
68
|
+
echo "$latest"
|
|
69
|
+
fi
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
output_json() {
|
|
73
|
+
local developer=$(get_developer)
|
|
74
|
+
local features_dir=$(get_features_dir)
|
|
75
|
+
local progress_file=$(get_active_progress_file)
|
|
76
|
+
local progress_lines=0
|
|
77
|
+
local progress_relative=""
|
|
78
|
+
|
|
79
|
+
if [[ -n "$progress_file" ]]; then
|
|
80
|
+
progress_lines=$(count_lines "$progress_file")
|
|
81
|
+
progress_relative="workflow/agent-progress/$developer/$(basename "$progress_file")"
|
|
82
|
+
fi
|
|
83
|
+
|
|
84
|
+
local branch=$(git branch --show-current 2>/dev/null || echo "unknown")
|
|
85
|
+
local git_status=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
|
|
86
|
+
local is_clean="true"
|
|
87
|
+
[[ "$git_status" != "0" ]] && is_clean="false"
|
|
88
|
+
|
|
89
|
+
local commits_json="["
|
|
90
|
+
local first=true
|
|
91
|
+
while IFS= read -r line; do
|
|
92
|
+
local hash=$(echo "$line" | cut -d' ' -f1)
|
|
93
|
+
local msg=$(echo "$line" | cut -d' ' -f2-)
|
|
94
|
+
msg=$(echo "$msg" | sed 's/"/\\"/g')
|
|
95
|
+
if [[ "$first" == "true" ]]; then
|
|
96
|
+
first=false
|
|
97
|
+
else
|
|
98
|
+
commits_json+=","
|
|
99
|
+
fi
|
|
100
|
+
commits_json+="{\"hash\":\"$hash\",\"message\":\"$msg\"}"
|
|
101
|
+
done < <(git log --oneline -5 2>/dev/null || echo "")
|
|
102
|
+
commits_json+="]"
|
|
103
|
+
|
|
104
|
+
local features_json="["
|
|
105
|
+
first=true
|
|
106
|
+
if [[ -d "$features_dir" ]]; then
|
|
107
|
+
for f in "$features_dir"/*.json; do
|
|
108
|
+
if [[ -f "$f" ]]; then
|
|
109
|
+
local filename=$(basename "$f")
|
|
110
|
+
local name=$(echo "$filename" | sed 's/^[0-9]*-//' | sed 's/\.json$//')
|
|
111
|
+
local status="unknown"
|
|
112
|
+
if command -v jq &> /dev/null; then
|
|
113
|
+
status=$(jq -r '.status // "unknown"' "$f")
|
|
114
|
+
fi
|
|
115
|
+
if [[ "$first" == "true" ]]; then
|
|
116
|
+
first=false
|
|
117
|
+
else
|
|
118
|
+
features_json+=","
|
|
119
|
+
fi
|
|
120
|
+
features_json+="{\"file\":\"$filename\",\"name\":\"$name\",\"status\":\"$status\"}"
|
|
121
|
+
fi
|
|
122
|
+
done
|
|
123
|
+
fi
|
|
124
|
+
features_json+="]"
|
|
125
|
+
|
|
126
|
+
cat << EOF
|
|
127
|
+
{
|
|
128
|
+
"developer": "$developer",
|
|
129
|
+
"git": {
|
|
130
|
+
"branch": "$branch",
|
|
131
|
+
"isClean": $is_clean,
|
|
132
|
+
"uncommittedChanges": $git_status,
|
|
133
|
+
"recentCommits": $commits_json
|
|
134
|
+
},
|
|
135
|
+
"features": {
|
|
136
|
+
"active": $features_json,
|
|
137
|
+
"directory": "workflow/agent-progress/$developer/features"
|
|
138
|
+
},
|
|
139
|
+
"progress": {
|
|
140
|
+
"file": "$progress_relative",
|
|
141
|
+
"lines": $progress_lines,
|
|
142
|
+
"nearLimit": $([ "$progress_lines" -gt 1800 ] && echo "true" || echo "false")
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
EOF
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
output_text() {
|
|
149
|
+
local developer=$(get_developer)
|
|
150
|
+
|
|
151
|
+
echo "========================================"
|
|
152
|
+
echo "SESSION CONTEXT"
|
|
153
|
+
echo "========================================"
|
|
154
|
+
echo ""
|
|
155
|
+
|
|
156
|
+
echo "## DEVELOPER"
|
|
157
|
+
if [[ -z "$developer" ]]; then
|
|
158
|
+
echo "ERROR: Not initialized. Run: ./workflow/scripts/init-developer.sh"
|
|
159
|
+
exit 1
|
|
160
|
+
fi
|
|
161
|
+
echo "Name: $developer"
|
|
162
|
+
echo ""
|
|
163
|
+
|
|
164
|
+
echo "## GIT STATUS"
|
|
165
|
+
echo "Branch: $(git branch --show-current 2>/dev/null || echo 'unknown')"
|
|
166
|
+
local status_count=$(git status --porcelain 2>/dev/null | wc -l | tr -d ' ')
|
|
167
|
+
if [[ "$status_count" == "0" ]]; then
|
|
168
|
+
echo "Working directory: Clean"
|
|
169
|
+
else
|
|
170
|
+
echo "Working directory: $status_count uncommitted change(s)"
|
|
171
|
+
echo ""
|
|
172
|
+
echo "Changes:"
|
|
173
|
+
git status --short 2>/dev/null | head -10
|
|
174
|
+
fi
|
|
175
|
+
echo ""
|
|
176
|
+
|
|
177
|
+
echo "## RECENT COMMITS"
|
|
178
|
+
git log --oneline -5 2>/dev/null || echo "(no commits)"
|
|
179
|
+
echo ""
|
|
180
|
+
|
|
181
|
+
echo "## ACTIVE FEATURES"
|
|
182
|
+
local features_dir=$(get_features_dir)
|
|
183
|
+
local feature_count=0
|
|
184
|
+
if [[ -d "$features_dir" ]]; then
|
|
185
|
+
for f in "$features_dir"/*.json; do
|
|
186
|
+
if [[ -f "$f" ]]; then
|
|
187
|
+
local filename=$(basename "$f")
|
|
188
|
+
local name=$(echo "$filename" | sed 's/^[0-9]*-//' | sed 's/\.json$//')
|
|
189
|
+
local status="unknown"
|
|
190
|
+
if command -v jq &> /dev/null; then
|
|
191
|
+
status=$(jq -r '.status // "unknown"' "$f")
|
|
192
|
+
fi
|
|
193
|
+
echo "- $name ($status) -> $filename"
|
|
194
|
+
((feature_count++))
|
|
195
|
+
fi
|
|
196
|
+
done
|
|
197
|
+
fi
|
|
198
|
+
if [[ $feature_count -eq 0 ]]; then
|
|
199
|
+
echo "(no active features)"
|
|
200
|
+
fi
|
|
201
|
+
echo "Total: $feature_count active feature(s)"
|
|
202
|
+
echo ""
|
|
203
|
+
|
|
204
|
+
echo "## PROGRESS FILE"
|
|
205
|
+
local progress_file=$(get_active_progress_file)
|
|
206
|
+
if [[ -n "$progress_file" ]]; then
|
|
207
|
+
local lines=$(count_lines "$progress_file")
|
|
208
|
+
local relative="workflow/agent-progress/$developer/$(basename "$progress_file")"
|
|
209
|
+
echo "Active file: $relative"
|
|
210
|
+
echo "Line count: $lines / 2000"
|
|
211
|
+
if [[ "$lines" -gt 1800 ]]; then
|
|
212
|
+
echo "⚠️ WARNING: Approaching 2000 line limit!"
|
|
213
|
+
fi
|
|
214
|
+
else
|
|
215
|
+
echo "No progress file found"
|
|
216
|
+
fi
|
|
217
|
+
echo ""
|
|
218
|
+
|
|
219
|
+
echo "## PATHS"
|
|
220
|
+
echo "Progress dir: workflow/agent-progress/$developer/"
|
|
221
|
+
echo "Features dir: workflow/agent-progress/$developer/features/"
|
|
222
|
+
echo "Index file: workflow/agent-progress/$developer/index.md"
|
|
223
|
+
echo ""
|
|
224
|
+
|
|
225
|
+
echo "========================================"
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
case "${1:-}" in
|
|
229
|
+
--json|-j)
|
|
230
|
+
output_json
|
|
231
|
+
;;
|
|
232
|
+
--help|-h)
|
|
233
|
+
echo "Get Session Context for AI Agent"
|
|
234
|
+
echo ""
|
|
235
|
+
echo "Usage:"
|
|
236
|
+
echo " $0 Output context in text format"
|
|
237
|
+
echo " $0 --json Output context in JSON format"
|
|
238
|
+
;;
|
|
239
|
+
*)
|
|
240
|
+
output_text
|
|
241
|
+
;;
|
|
242
|
+
esac
|
|
243
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-developer.d.ts","sourceRoot":"","sources":["../../../src/templates/scripts/get-developer.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,kBAAkB,QAAyC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-developer.js","sourceRoot":"","sources":["../../../src/templates/scripts/get-developer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,sBAAsB,CAAC,CAAC;AAClE,MAAM,CAAC,MAAM,kBAAkB,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
|
|
3
|
+
# Get current developer identity
|
|
4
|
+
# Usage: ./workflow/scripts/get-developer.sh
|
|
5
|
+
|
|
6
|
+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
7
|
+
WORKFLOW_DIR="$(dirname "$SCRIPT_DIR")"
|
|
8
|
+
DEVELOPER_FILE="$WORKFLOW_DIR/.developer"
|
|
9
|
+
|
|
10
|
+
if [ ! -f "$DEVELOPER_FILE" ]; then
|
|
11
|
+
echo "Not initialized. Run: ./workflow/scripts/init-developer.sh <your-name>" >&2
|
|
12
|
+
exit 1
|
|
13
|
+
fi
|
|
14
|
+
|
|
15
|
+
grep "^name=" "$DEVELOPER_FILE" | cut -d= -f2
|
|
16
|
+
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Script templates for open-flow workflow
|
|
3
|
+
* Each script is stored as a .sh.txt file
|
|
4
|
+
*/
|
|
5
|
+
export declare const initDeveloperScript: string;
|
|
6
|
+
export declare const getDeveloperScript: string;
|
|
7
|
+
export declare const extractMdHeadingsScript: string;
|
|
8
|
+
export declare const featureScript: string;
|
|
9
|
+
export declare const getContextScript: string;
|
|
10
|
+
export declare const updateIndexScript: string;
|
|
11
|
+
export declare const addSessionScript: string;
|
|
12
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/scripts/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,eAAO,MAAM,mBAAmB,QAAsC,CAAC;AACvE,eAAO,MAAM,kBAAkB,QAAqC,CAAC;AACrE,eAAO,MAAM,uBAAuB,QAA2C,CAAC;AAChF,eAAO,MAAM,aAAa,QAA+B,CAAC;AAC1D,eAAO,MAAM,gBAAgB,QAAmC,CAAC;AACjE,eAAO,MAAM,iBAAiB,QAAoC,CAAC;AACnE,eAAO,MAAM,gBAAgB,QAAmC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Script templates for open-flow workflow
|
|
3
|
+
* Each script is stored as a .sh.txt file
|
|
4
|
+
*/
|
|
5
|
+
import { readScript } from "../extract.js";
|
|
6
|
+
export const initDeveloperScript = readScript("init-developer.sh.txt");
|
|
7
|
+
export const getDeveloperScript = readScript("get-developer.sh.txt");
|
|
8
|
+
export const extractMdHeadingsScript = readScript("extract-md-headings.sh.txt");
|
|
9
|
+
export const featureScript = readScript("feature.sh.txt");
|
|
10
|
+
export const getContextScript = readScript("get-context.sh.txt");
|
|
11
|
+
export const updateIndexScript = readScript("update-index.sh.txt");
|
|
12
|
+
export const addSessionScript = readScript("add-session.sh.txt");
|
|
13
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/scripts/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAE3C,MAAM,CAAC,MAAM,mBAAmB,GAAG,UAAU,CAAC,uBAAuB,CAAC,CAAC;AACvE,MAAM,CAAC,MAAM,kBAAkB,GAAG,UAAU,CAAC,sBAAsB,CAAC,CAAC;AACrE,MAAM,CAAC,MAAM,uBAAuB,GAAG,UAAU,CAAC,4BAA4B,CAAC,CAAC;AAChF,MAAM,CAAC,MAAM,aAAa,GAAG,UAAU,CAAC,gBAAgB,CAAC,CAAC;AAC1D,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC;AACjE,MAAM,CAAC,MAAM,iBAAiB,GAAG,UAAU,CAAC,qBAAqB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,gBAAgB,GAAG,UAAU,CAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-developer.d.ts","sourceRoot":"","sources":["../../../src/templates/scripts/init-developer.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,mBAAmB,QAAyC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"init-developer.js","sourceRoot":"","sources":["../../../src/templates/scripts/init-developer.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,MAAM,YAAY,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,uBAAuB,CAAC,CAAC;AACnE,MAAM,CAAC,MAAM,mBAAmB,GAAG,EAAE,CAAC,YAAY,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC"}
|