@mind-fold/open-flow 0.1.5 → 0.1.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/commands/init.js +347 -26
- package/dist/commands/init.js.map +1 -1
- package/dist/configurators/templates.js +202 -126
- package/dist/configurators/templates.js.map +1 -1
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +828 -65
- package/dist/configurators/workflow.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,15 +1,14 @@
|
|
|
1
|
-
import fs from
|
|
2
|
-
import path from
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import path from "node:path";
|
|
3
3
|
export async function createWorkflowStructure(cwd) {
|
|
4
|
-
const workflowDir = path.join(cwd, 'workflow');
|
|
5
4
|
// Create directories
|
|
6
5
|
const dirs = [
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
6
|
+
"workflow",
|
|
7
|
+
"workflow/scripts",
|
|
8
|
+
"workflow/agent-progress",
|
|
9
|
+
"workflow/structure",
|
|
10
|
+
"workflow/structure/frontend",
|
|
11
|
+
"workflow/structure/backend",
|
|
13
12
|
];
|
|
14
13
|
for (const dir of dirs) {
|
|
15
14
|
fs.mkdirSync(path.join(cwd, dir), { recursive: true });
|
|
@@ -24,6 +23,8 @@ export async function createWorkflowStructure(cwd) {
|
|
|
24
23
|
await createFeatureJson(cwd);
|
|
25
24
|
// Create flow.md
|
|
26
25
|
await createFlowMd(cwd);
|
|
26
|
+
// Create onboarding-guide.md
|
|
27
|
+
await createOnboardingGuide(cwd);
|
|
27
28
|
// Create .gitignore for workflow
|
|
28
29
|
await createWorkflowGitignore(cwd);
|
|
29
30
|
}
|
|
@@ -146,11 +147,274 @@ fi
|
|
|
146
147
|
|
|
147
148
|
cat "$DEVELOPER_FILE" | grep "name:" | cut -d' ' -f2
|
|
148
149
|
`;
|
|
149
|
-
fs.writeFileSync(path.join(cwd,
|
|
150
|
-
fs.writeFileSync(path.join(cwd,
|
|
150
|
+
fs.writeFileSync(path.join(cwd, "workflow/scripts/init-developer.sh"), initDeveloperScript);
|
|
151
|
+
fs.writeFileSync(path.join(cwd, "workflow/scripts/get-developer.sh"), getDeveloperScript);
|
|
151
152
|
// Make scripts executable
|
|
152
|
-
fs.chmodSync(path.join(cwd,
|
|
153
|
-
fs.chmodSync(path.join(cwd,
|
|
153
|
+
fs.chmodSync(path.join(cwd, "workflow/scripts/init-developer.sh"), "755");
|
|
154
|
+
fs.chmodSync(path.join(cwd, "workflow/scripts/get-developer.sh"), "755");
|
|
155
|
+
// Create extract-md-headings.sh script
|
|
156
|
+
const extractMdHeadingsScript = `#!/bin/zsh
|
|
157
|
+
|
|
158
|
+
# ============================================
|
|
159
|
+
# Markdown Heading Line Number Extraction Tool
|
|
160
|
+
# ============================================
|
|
161
|
+
#
|
|
162
|
+
# Purpose: Auto-extract headings and line numbers from markdown files
|
|
163
|
+
# Used to quickly update line number references in index.md
|
|
164
|
+
#
|
|
165
|
+
# Usage:
|
|
166
|
+
# ./extract-md-headings.sh <markdown-file> [options]
|
|
167
|
+
#
|
|
168
|
+
# Options:
|
|
169
|
+
# -l, --level <1-6> Only extract specific heading levels (default: 1,2)
|
|
170
|
+
# -f, --format <type> Output format: table(default), list, csv, json
|
|
171
|
+
# -r, --range Show line number ranges (current heading to next)
|
|
172
|
+
# -h, --help Show help
|
|
173
|
+
#
|
|
174
|
+
# Examples:
|
|
175
|
+
# # Extract all # and ## level headings
|
|
176
|
+
# ./extract-md-headings.sh doc.md
|
|
177
|
+
#
|
|
178
|
+
# # Only extract ## level headings
|
|
179
|
+
# ./extract-md-headings.sh doc.md -l 2
|
|
180
|
+
#
|
|
181
|
+
# # Output as CSV format
|
|
182
|
+
# ./extract-md-headings.sh doc.md -f csv
|
|
183
|
+
#
|
|
184
|
+
# # Show line number ranges
|
|
185
|
+
# ./extract-md-headings.sh doc.md -r
|
|
186
|
+
#
|
|
187
|
+
# ============================================
|
|
188
|
+
|
|
189
|
+
# Color definitions
|
|
190
|
+
RED='\\033[0;31m'
|
|
191
|
+
GREEN='\\033[0;32m'
|
|
192
|
+
YELLOW='\\033[1;33m'
|
|
193
|
+
BLUE='\\033[0;34m'
|
|
194
|
+
CYAN='\\033[0;36m'
|
|
195
|
+
NC='\\033[0m' # No Color
|
|
196
|
+
|
|
197
|
+
# Default parameters
|
|
198
|
+
LEVELS="1,2"
|
|
199
|
+
FORMAT="table"
|
|
200
|
+
SHOW_RANGE=false
|
|
201
|
+
|
|
202
|
+
# Show help
|
|
203
|
+
show_help() {
|
|
204
|
+
echo "📚 Markdown Heading Line Number Extraction Tool"
|
|
205
|
+
echo ""
|
|
206
|
+
echo "Purpose: Auto-extract headings and line numbers from markdown files"
|
|
207
|
+
echo ""
|
|
208
|
+
echo "Usage:"
|
|
209
|
+
echo " $0 <markdown-file> [options]"
|
|
210
|
+
echo ""
|
|
211
|
+
echo "Options:"
|
|
212
|
+
echo " -l, --level <1-6> Only extract specific heading levels (default: 1,2)"
|
|
213
|
+
echo " Can be single number or comma-separated list: 1,2,3"
|
|
214
|
+
echo " -f, --format <type> Output format:"
|
|
215
|
+
echo " - table Table format (default)"
|
|
216
|
+
echo " - list List format"
|
|
217
|
+
echo " - csv CSV format"
|
|
218
|
+
echo " - json JSON format"
|
|
219
|
+
echo " -r, --range Show line number ranges (current to next same/higher level)"
|
|
220
|
+
echo " -h, --help Show this help"
|
|
221
|
+
echo ""
|
|
222
|
+
echo "Examples:"
|
|
223
|
+
echo " # Extract all # and ## level headings"
|
|
224
|
+
echo " $0 doc.md"
|
|
225
|
+
echo ""
|
|
226
|
+
echo " # Only extract ## level headings"
|
|
227
|
+
echo " $0 doc.md -l 2"
|
|
228
|
+
echo ""
|
|
229
|
+
echo " # Extract # ## ### three levels"
|
|
230
|
+
echo " $0 doc.md -l 1,2,3"
|
|
231
|
+
echo ""
|
|
232
|
+
echo " # Output as CSV format"
|
|
233
|
+
echo " $0 doc.md -f csv"
|
|
234
|
+
echo ""
|
|
235
|
+
echo " # Show line number ranges (for Read tool)"
|
|
236
|
+
echo " $0 doc.md -r"
|
|
237
|
+
echo ""
|
|
238
|
+
exit 0
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
# Parse command line arguments
|
|
242
|
+
POSITIONAL_ARGS=()
|
|
243
|
+
while [[ $# -gt 0 ]]; do
|
|
244
|
+
case $1 in
|
|
245
|
+
-l|--level)
|
|
246
|
+
LEVELS="$2"
|
|
247
|
+
shift 2
|
|
248
|
+
;;
|
|
249
|
+
-f|--format)
|
|
250
|
+
FORMAT="$2"
|
|
251
|
+
shift 2
|
|
252
|
+
;;
|
|
253
|
+
-r|--range)
|
|
254
|
+
SHOW_RANGE=true
|
|
255
|
+
shift
|
|
256
|
+
;;
|
|
257
|
+
-h|--help)
|
|
258
|
+
show_help
|
|
259
|
+
;;
|
|
260
|
+
*)
|
|
261
|
+
POSITIONAL_ARGS+=("$1")
|
|
262
|
+
shift
|
|
263
|
+
;;
|
|
264
|
+
esac
|
|
265
|
+
done
|
|
266
|
+
|
|
267
|
+
# Restore positional args
|
|
268
|
+
set -- "\${POSITIONAL_ARGS[@]}"
|
|
269
|
+
|
|
270
|
+
# Check file argument
|
|
271
|
+
if [[ $# -eq 0 ]]; then
|
|
272
|
+
echo -e "\${RED}Error: Please provide markdown file path\${NC}"
|
|
273
|
+
echo "Use -h or --help to see help"
|
|
274
|
+
exit 1
|
|
275
|
+
fi
|
|
276
|
+
|
|
277
|
+
MD_FILE="$1"
|
|
278
|
+
|
|
279
|
+
# Check if file exists
|
|
280
|
+
if [[ ! -f "$MD_FILE" ]]; then
|
|
281
|
+
echo -e "\${RED}Error: File not found: $MD_FILE\${NC}"
|
|
282
|
+
exit 1
|
|
283
|
+
fi
|
|
284
|
+
|
|
285
|
+
# Check if file is markdown
|
|
286
|
+
if [[ ! "$MD_FILE" =~ \\.(md|markdown)$ ]]; then
|
|
287
|
+
echo -e "\${YELLOW}Warning: File may not be markdown format: $MD_FILE\${NC}"
|
|
288
|
+
fi
|
|
289
|
+
|
|
290
|
+
# Build awk script to extract headings
|
|
291
|
+
AWK_SCRIPT='
|
|
292
|
+
BEGIN {
|
|
293
|
+
split(levels, level_array, ",")
|
|
294
|
+
for (i in level_array) {
|
|
295
|
+
allowed_levels[level_array[i]] = 1
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/^#{1,6} / {
|
|
299
|
+
# Calculate heading level
|
|
300
|
+
match($0, /^#+/)
|
|
301
|
+
level = RLENGTH
|
|
302
|
+
|
|
303
|
+
# Check if this is a level we want
|
|
304
|
+
if (level in allowed_levels) {
|
|
305
|
+
# Extract heading text (remove leading # and space)
|
|
306
|
+
title = substr($0, level + 2)
|
|
307
|
+
# Remove trailing # symbols (some markdown styles)
|
|
308
|
+
gsub(/ #+$/, "", title)
|
|
309
|
+
|
|
310
|
+
# Save heading info (use @@@ as delimiter)
|
|
311
|
+
headings[++count] = level "@@@" NR "@@@" title
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
END {
|
|
315
|
+
for (i = 1; i <= count; i++) {
|
|
316
|
+
split(headings[i], parts, "@@@")
|
|
317
|
+
level = parts[1]
|
|
318
|
+
line = parts[2]
|
|
319
|
+
title = parts[3]
|
|
320
|
+
|
|
321
|
+
# Calculate end line (previous line of next same/higher level heading)
|
|
322
|
+
end_line = total_lines
|
|
323
|
+
for (j = i + 1; j <= count; j++) {
|
|
324
|
+
split(headings[j], next_parts, "@@@")
|
|
325
|
+
next_level = next_parts[1]
|
|
326
|
+
next_line = next_parts[2]
|
|
327
|
+
if (next_level <= level) {
|
|
328
|
+
end_line = next_line - 1
|
|
329
|
+
break
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
printf "%d|%d|%d|%s\\n", level, line, end_line, title
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
'
|
|
337
|
+
|
|
338
|
+
# Get total lines
|
|
339
|
+
TOTAL_LINES=$(wc -l < "$MD_FILE" | tr -d ' ')
|
|
340
|
+
|
|
341
|
+
# Extract headings
|
|
342
|
+
HEADINGS=$(awk -v levels="$LEVELS" -v total_lines="$TOTAL_LINES" "$AWK_SCRIPT" "$MD_FILE")
|
|
343
|
+
|
|
344
|
+
# Check if headings found
|
|
345
|
+
if [[ -z "$HEADINGS" ]]; then
|
|
346
|
+
echo -e "\${YELLOW}No matching headings found\${NC}"
|
|
347
|
+
exit 0
|
|
348
|
+
fi
|
|
349
|
+
|
|
350
|
+
# Output based on format
|
|
351
|
+
case $FORMAT in
|
|
352
|
+
table)
|
|
353
|
+
echo -e "\${GREEN}📋 Heading List\${NC}"
|
|
354
|
+
echo -e "\${CYAN}File: $MD_FILE\${NC}"
|
|
355
|
+
echo ""
|
|
356
|
+
printf "%-8s %-12s %-12s %s\\n" "Level" "Line" "Range" "Title"
|
|
357
|
+
printf "%-8s %-12s %-12s %s\\n" "----" "----" "----" "----"
|
|
358
|
+
echo "$HEADINGS" | while IFS='|' read -r level line end_line title; do
|
|
359
|
+
indent=$(printf '%*s' $((level * 2)) '')
|
|
360
|
+
if [[ "$SHOW_RANGE" == true ]]; then
|
|
361
|
+
range="L\${line}-\${end_line}"
|
|
362
|
+
else
|
|
363
|
+
range="L\${line}"
|
|
364
|
+
fi
|
|
365
|
+
printf "%-8s %-12s %-12s %s%s\\n" "$level" "$line" "$range" "$indent" "$title"
|
|
366
|
+
done
|
|
367
|
+
;;
|
|
368
|
+
|
|
369
|
+
list)
|
|
370
|
+
echo -e "\${GREEN}📋 Heading List\${NC}"
|
|
371
|
+
echo -e "\${CYAN}File: $MD_FILE\${NC}"
|
|
372
|
+
echo ""
|
|
373
|
+
echo "$HEADINGS" | while IFS='|' read -r level line end_line title; do
|
|
374
|
+
indent=$(printf '%*s' $((level * 2)) '')
|
|
375
|
+
if [[ "$SHOW_RANGE" == true ]]; then
|
|
376
|
+
echo "L\${line}-\${end_line}: \${indent}$title"
|
|
377
|
+
else
|
|
378
|
+
echo "L\${line}: \${indent}$title"
|
|
379
|
+
fi
|
|
380
|
+
done
|
|
381
|
+
;;
|
|
382
|
+
|
|
383
|
+
csv)
|
|
384
|
+
echo "Level,LineStart,LineEnd,Title"
|
|
385
|
+
echo "$HEADINGS" | while IFS='|' read -r level line end_line title; do
|
|
386
|
+
# CSV needs to escape commas and quotes in title
|
|
387
|
+
escaped_title=$(echo "$title" | sed 's/"/""/g')
|
|
388
|
+
echo "$level,$line,$end_line,\\"$escaped_title\\""
|
|
389
|
+
done
|
|
390
|
+
;;
|
|
391
|
+
|
|
392
|
+
json)
|
|
393
|
+
echo "["
|
|
394
|
+
first=true
|
|
395
|
+
echo "$HEADINGS" | while IFS='|' read -r level line end_line title; do
|
|
396
|
+
if [[ "$first" != true ]]; then
|
|
397
|
+
echo ","
|
|
398
|
+
fi
|
|
399
|
+
first=false
|
|
400
|
+
# JSON needs to escape quotes and backslashes
|
|
401
|
+
escaped_title=$(echo "$title" | sed 's/\\\\/\\\\\\\\/g' | sed 's/"/\\\\"/g')
|
|
402
|
+
printf ' {"level": %d, "lineStart": %d, "lineEnd": %d, "title": "%s"}' \\
|
|
403
|
+
"$level" "$line" "$end_line" "$escaped_title"
|
|
404
|
+
done
|
|
405
|
+
echo ""
|
|
406
|
+
echo "]"
|
|
407
|
+
;;
|
|
408
|
+
|
|
409
|
+
*)
|
|
410
|
+
echo -e "\${RED}Error: Unknown output format: $FORMAT\${NC}"
|
|
411
|
+
echo "Supported formats: table, list, csv, json"
|
|
412
|
+
exit 1
|
|
413
|
+
;;
|
|
414
|
+
esac
|
|
415
|
+
`;
|
|
416
|
+
fs.writeFileSync(path.join(cwd, "workflow/scripts/extract-md-headings.sh"), extractMdHeadingsScript);
|
|
417
|
+
fs.chmodSync(path.join(cwd, "workflow/scripts/extract-md-headings.sh"), "755");
|
|
154
418
|
}
|
|
155
419
|
async function createAgentProgressIndex(cwd) {
|
|
156
420
|
const content = `# Agent Progress
|
|
@@ -215,7 +479,7 @@ One-line description of what was done
|
|
|
215
479
|
3. **Update personal index** - After each session
|
|
216
480
|
4. **Sequential numbering** - progress-1.md, progress-2.md, etc.
|
|
217
481
|
`;
|
|
218
|
-
fs.writeFileSync(path.join(cwd,
|
|
482
|
+
fs.writeFileSync(path.join(cwd, "workflow/agent-progress/index.md"), content);
|
|
219
483
|
}
|
|
220
484
|
async function createStructureTemplates(cwd) {
|
|
221
485
|
// Frontend index.md
|
|
@@ -561,26 +825,26 @@ console.log('User created: ' + user.id);
|
|
|
561
825
|
|
|
562
826
|
**Note**: Update line numbers in index.md when you modify this document.
|
|
563
827
|
`;
|
|
564
|
-
fs.writeFileSync(path.join(cwd,
|
|
565
|
-
fs.writeFileSync(path.join(cwd,
|
|
566
|
-
fs.writeFileSync(path.join(cwd,
|
|
567
|
-
fs.writeFileSync(path.join(cwd,
|
|
828
|
+
fs.writeFileSync(path.join(cwd, "workflow/structure/frontend/index.md"), frontendIndex);
|
|
829
|
+
fs.writeFileSync(path.join(cwd, "workflow/structure/frontend/doc.md"), frontendDoc);
|
|
830
|
+
fs.writeFileSync(path.join(cwd, "workflow/structure/backend/index.md"), backendIndex);
|
|
831
|
+
fs.writeFileSync(path.join(cwd, "workflow/structure/backend/doc.md"), backendDoc);
|
|
568
832
|
}
|
|
569
833
|
async function createFeatureJson(cwd) {
|
|
570
834
|
const content = {
|
|
571
|
-
project:
|
|
572
|
-
lastUpdated: new Date().toISOString().split(
|
|
573
|
-
version:
|
|
835
|
+
project: "My Project",
|
|
836
|
+
lastUpdated: new Date().toISOString().split("T")[0],
|
|
837
|
+
version: "1.0.0",
|
|
574
838
|
categories: {
|
|
575
839
|
example: {
|
|
576
|
-
name:
|
|
840
|
+
name: "Example Category",
|
|
577
841
|
features: [
|
|
578
842
|
{
|
|
579
|
-
id:
|
|
580
|
-
name:
|
|
581
|
-
description:
|
|
582
|
-
status:
|
|
583
|
-
priority:
|
|
843
|
+
id: "example-001",
|
|
844
|
+
name: "Example Feature",
|
|
845
|
+
description: "An example feature to demonstrate the structure",
|
|
846
|
+
status: "planned",
|
|
847
|
+
priority: "medium",
|
|
584
848
|
},
|
|
585
849
|
],
|
|
586
850
|
},
|
|
@@ -591,18 +855,18 @@ async function createFeatureJson(cwd) {
|
|
|
591
855
|
inProgress: 0,
|
|
592
856
|
planned: 1,
|
|
593
857
|
blocked: 0,
|
|
594
|
-
completionRate:
|
|
858
|
+
completionRate: "0%",
|
|
595
859
|
},
|
|
596
860
|
notes: [
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
861
|
+
"Feature ID format: category-XXX (e.g., auth-001, ui-002)",
|
|
862
|
+
"Status: completed | in-progress | planned | blocked",
|
|
863
|
+
"Priority: high | medium | low",
|
|
864
|
+
"When completed, add completedAt (YYYY-MM-DD) and commit (hash)",
|
|
865
|
+
"When blocked, add blockedReason field",
|
|
866
|
+
"Update statistics after changing feature status",
|
|
603
867
|
],
|
|
604
868
|
};
|
|
605
|
-
fs.writeFileSync(path.join(cwd,
|
|
869
|
+
fs.writeFileSync(path.join(cwd, "workflow/feature.json"), JSON.stringify(content, null, 2));
|
|
606
870
|
}
|
|
607
871
|
async function createFlowMd(cwd) {
|
|
608
872
|
const content = `# Development Workflow
|
|
@@ -611,13 +875,50 @@ async function createFlowMd(cwd) {
|
|
|
611
875
|
|
|
612
876
|
---
|
|
613
877
|
|
|
614
|
-
##
|
|
878
|
+
## Table of Contents
|
|
879
|
+
|
|
880
|
+
1. [Workflow Overview](#workflow-overview)
|
|
881
|
+
2. [Session Start Process](#session-start-process)
|
|
882
|
+
3. [Development Process](#development-process)
|
|
883
|
+
4. [Session End](#session-end)
|
|
884
|
+
5. [File Descriptions](#file-descriptions)
|
|
885
|
+
6. [Best Practices](#best-practices)
|
|
886
|
+
|
|
887
|
+
---
|
|
888
|
+
|
|
889
|
+
## Workflow Overview
|
|
890
|
+
|
|
891
|
+
### Core Principles
|
|
615
892
|
|
|
616
893
|
1. **Read Before Write** - Understand context before starting
|
|
617
|
-
2. **Follow Standards** -
|
|
894
|
+
2. **Follow Standards** - ⚠️ **MUST read \`workflow/structure/\` guidelines (index → doc) before coding**
|
|
618
895
|
3. **Incremental Development** - Complete one feature at a time
|
|
619
|
-
4. **Record Promptly** - Update tracking files after completion
|
|
620
|
-
5. **Document Limits** - Max 2000 lines per agent-progress document
|
|
896
|
+
4. **Record Promptly** - Update tracking files immediately after completion
|
|
897
|
+
5. **Document Limits** - ⚠️ **Max 2000 lines per agent-progress document**
|
|
898
|
+
|
|
899
|
+
### File System
|
|
900
|
+
|
|
901
|
+
\`\`\`
|
|
902
|
+
workflow/
|
|
903
|
+
├── .developer # Developer identity (gitignored)
|
|
904
|
+
├── scripts/
|
|
905
|
+
│ ├── init-developer.sh # Initialize developer identity
|
|
906
|
+
│ └── get-developer.sh # Get current developer name
|
|
907
|
+
├── agent-progress/ # AI Agent work progress records
|
|
908
|
+
│ ├── index.md # Progress index + Session template
|
|
909
|
+
│ └── {developer}/ # Per-developer directories
|
|
910
|
+
│ ├── index.md # Personal index
|
|
911
|
+
│ └── progress-N.md # Progress files (sequential numbering)
|
|
912
|
+
├── structure/ # ⚠️ MUST READ before coding
|
|
913
|
+
│ ├── frontend/
|
|
914
|
+
│ │ ├── index.md # Frontend guidelines index (read first)
|
|
915
|
+
│ │ └── doc.md # Frontend guidelines detailed doc (read specific sections)
|
|
916
|
+
│ └── backend/
|
|
917
|
+
│ ├── index.md # Backend guidelines index (read first)
|
|
918
|
+
│ └── doc.md # Backend guidelines detailed doc (read specific sections)
|
|
919
|
+
├── feature.json # Feature tracking list (single file, no limit)
|
|
920
|
+
└── flow.md # This document
|
|
921
|
+
\`\`\`
|
|
621
922
|
|
|
622
923
|
---
|
|
623
924
|
|
|
@@ -625,6 +926,8 @@ async function createFlowMd(cwd) {
|
|
|
625
926
|
|
|
626
927
|
### Step 1: Read Work Context
|
|
627
928
|
|
|
929
|
+
Read the following files in order to quickly establish context:
|
|
930
|
+
|
|
628
931
|
\`\`\`bash
|
|
629
932
|
# 0. Check your developer identity
|
|
630
933
|
./workflow/scripts/get-developer.sh
|
|
@@ -636,24 +939,58 @@ cat workflow/agent-progress/$DEVELOPER/index.md
|
|
|
636
939
|
# 2. Check feature status
|
|
637
940
|
cat workflow/feature.json
|
|
638
941
|
|
|
639
|
-
# 3. Check Git history
|
|
942
|
+
# 3. Check Git history (use git command directly)
|
|
640
943
|
git status
|
|
641
944
|
git log --oneline -20
|
|
642
945
|
\`\`\`
|
|
643
946
|
|
|
644
|
-
### Step 2: Read Development Guidelines
|
|
947
|
+
### Step 2: Read Development Guidelines Index ⚠️ REQUIRED
|
|
948
|
+
|
|
949
|
+
**⚠️ CRITICAL: MUST read guidelines before writing any code**
|
|
645
950
|
|
|
646
|
-
Based on
|
|
951
|
+
Based on what you'll develop (frontend/backend), read the corresponding guidelines **index document**:
|
|
647
952
|
|
|
953
|
+
**Frontend Development**:
|
|
648
954
|
\`\`\`bash
|
|
649
|
-
# Frontend
|
|
650
955
|
cat workflow/structure/frontend/index.md
|
|
956
|
+
\`\`\`
|
|
957
|
+
- Find corresponding chapters based on task type (e.g., "New Query Hook", "Write Component")
|
|
958
|
+
- Note down chapter names and line number ranges
|
|
959
|
+
- This is **mandatory**, not optional
|
|
651
960
|
|
|
652
|
-
|
|
961
|
+
**Backend Development**:
|
|
962
|
+
\`\`\`bash
|
|
653
963
|
cat workflow/structure/backend/index.md
|
|
654
964
|
\`\`\`
|
|
965
|
+
- Find corresponding chapters based on scenario (e.g., "New API Module", "Write Batch Tasks")
|
|
966
|
+
- Note down chapter names and line number ranges
|
|
967
|
+
- This is **mandatory**, not optional
|
|
968
|
+
|
|
969
|
+
### Step 3: Read Specific Guidelines ⚠️ REQUIRED
|
|
970
|
+
|
|
971
|
+
**⚠️ CRITICAL: Read detailed guidelines for your specific task**
|
|
972
|
+
|
|
973
|
+
Based on line numbers found in index, read detailed guideline documents:
|
|
974
|
+
|
|
975
|
+
**Frontend**:
|
|
976
|
+
\`\`\`bash
|
|
977
|
+
# Use Read tool to read specific line ranges
|
|
978
|
+
# Example: L179-264 (Query Hook guidelines)
|
|
979
|
+
Read workflow/structure/frontend/doc.md --offset 179 --limit 85
|
|
980
|
+
\`\`\`
|
|
981
|
+
- **MUST read** the sections relevant to your task
|
|
982
|
+
- Do NOT skip this step
|
|
983
|
+
|
|
984
|
+
**Backend**:
|
|
985
|
+
\`\`\`bash
|
|
986
|
+
# Use Read tool to read specific line ranges
|
|
987
|
+
# Example: L5-28 (Directory structure guidelines)
|
|
988
|
+
Read workflow/structure/backend/doc.md --offset 5 --limit 23
|
|
989
|
+
\`\`\`
|
|
990
|
+
- **MUST read** the sections relevant to your task
|
|
991
|
+
- Do NOT skip this step
|
|
655
992
|
|
|
656
|
-
### Step
|
|
993
|
+
### Step 4: Select Feature to Develop
|
|
657
994
|
|
|
658
995
|
Based on \`workflow/feature.json\`:
|
|
659
996
|
- Prioritize \`in-progress\` status features
|
|
@@ -664,76 +1001,502 @@ Based on \`workflow/feature.json\`:
|
|
|
664
1001
|
|
|
665
1002
|
## Development Process
|
|
666
1003
|
|
|
1004
|
+
### Feature Development Flow
|
|
1005
|
+
|
|
667
1006
|
\`\`\`
|
|
668
1007
|
1. Update feature.json
|
|
669
1008
|
└─> Change selected feature status to "in-progress"
|
|
670
1009
|
|
|
671
1010
|
2. Write code according to guidelines
|
|
672
|
-
└─>
|
|
1011
|
+
└─> Strictly follow workflow/structure/ development guidelines
|
|
1012
|
+
└─> Frontend: Type safety, Hook standards, Component standards, Performance
|
|
1013
|
+
└─> Backend: Directory structure, Type safety, Database operations, Logging
|
|
673
1014
|
|
|
674
1015
|
3. Self-test
|
|
675
1016
|
└─> pnpm lint (must pass)
|
|
676
1017
|
└─> pnpm type-check (must pass)
|
|
677
1018
|
└─> Manual feature testing
|
|
678
1019
|
|
|
679
|
-
4. Commit code
|
|
1020
|
+
4. Commit code
|
|
680
1021
|
└─> git add <files>
|
|
681
1022
|
└─> git commit -m "type(scope): description"
|
|
1023
|
+
Format: feat/fix/docs/refactor/test/chore
|
|
682
1024
|
|
|
683
1025
|
5. Update tracking files
|
|
684
|
-
└─> agent-progress: Record session work
|
|
685
|
-
└─> feature.json: Update feature status
|
|
1026
|
+
└─> agent-progress: Record this session's work (include commit hashes)
|
|
1027
|
+
└─> feature.json: Update feature status to "completed"
|
|
686
1028
|
\`\`\`
|
|
687
1029
|
|
|
1030
|
+
### Code Quality Checklist
|
|
1031
|
+
|
|
1032
|
+
**Must pass before commit**:
|
|
1033
|
+
- ✅ \`pnpm lint\` - 0 errors
|
|
1034
|
+
- ✅ \`pnpm type-check\` - No type errors
|
|
1035
|
+
- ✅ Manual feature testing passes
|
|
1036
|
+
|
|
1037
|
+
**Frontend-specific checks**:
|
|
1038
|
+
- ✅ Use semantic HTML (\`<button>\` not \`<div role="button">\`)
|
|
1039
|
+
- ✅ Use Next.js \`<Image>\` instead of \`<img>\`
|
|
1040
|
+
- ✅ Import types from backend, don't redefine
|
|
1041
|
+
- ✅ Avoid non-null assertions \`!\`
|
|
1042
|
+
|
|
1043
|
+
**Backend-specific checks**:
|
|
1044
|
+
- ✅ Strictly avoid non-null assertion \`!\`, use local variable extraction
|
|
1045
|
+
- ✅ All API inputs/outputs have Zod Schema
|
|
1046
|
+
- ✅ Use structured logging (\`logger\`), forbidden \`console.log\`
|
|
1047
|
+
- ✅ Database operations avoid \`await\` in loops
|
|
1048
|
+
- ✅ Update corresponding API documentation
|
|
1049
|
+
|
|
688
1050
|
---
|
|
689
1051
|
|
|
690
1052
|
## Session End
|
|
691
1053
|
|
|
692
|
-
### Checklist
|
|
1054
|
+
### Pre-end Checklist
|
|
693
1055
|
|
|
694
|
-
1. ✅ All code committed
|
|
1056
|
+
1. ✅ All code committed, commit message follows convention
|
|
695
1057
|
2. ✅ \`workflow/agent-progress/{developer}/progress-N.md\` updated
|
|
696
1058
|
3. ✅ \`workflow/feature.json\` status updated
|
|
697
1059
|
4. ✅ No lint/type-check errors
|
|
1060
|
+
5. ✅ Working directory clean (or WIP noted)
|
|
1061
|
+
|
|
1062
|
+
### Update Tracking Files
|
|
1063
|
+
|
|
1064
|
+
**agent-progress update**:
|
|
1065
|
+
- Write to your own directory: \`workflow/agent-progress/{developer}/\`
|
|
1066
|
+
- Include commit hashes in your session record
|
|
1067
|
+
- See template in \`workflow/agent-progress/index.md\`
|
|
1068
|
+
|
|
1069
|
+
**feature.json update**:
|
|
1070
|
+
\`\`\`json
|
|
1071
|
+
{
|
|
1072
|
+
"id": "feature-xxx",
|
|
1073
|
+
"status": "completed",
|
|
1074
|
+
"completedAt": "2025-11-28",
|
|
1075
|
+
"commit": "abc1234"
|
|
1076
|
+
}
|
|
1077
|
+
\`\`\`
|
|
1078
|
+
|
|
1079
|
+
Also update \`statistics\` field completion rate.
|
|
1080
|
+
|
|
1081
|
+
---
|
|
1082
|
+
|
|
1083
|
+
## File Descriptions
|
|
1084
|
+
|
|
1085
|
+
### 1. agent-progress/ - Agent Work Progress
|
|
1086
|
+
|
|
1087
|
+
**Purpose**: Record each AI Agent session's work content
|
|
1088
|
+
|
|
1089
|
+
**Structure** (Multi-developer support):
|
|
1090
|
+
\`\`\`
|
|
1091
|
+
agent-progress/
|
|
1092
|
+
├── index.md # Main index (Active Developers table)
|
|
1093
|
+
└── {developer}/ # Per-developer directory
|
|
1094
|
+
├── index.md # Personal index
|
|
1095
|
+
└── progress-N.md # Progress files (sequential: 1, 2, 3...)
|
|
1096
|
+
\`\`\`
|
|
1097
|
+
|
|
1098
|
+
**When to update**:
|
|
1099
|
+
- ✅ End of each session
|
|
1100
|
+
- ✅ Complete important feature
|
|
1101
|
+
- ✅ Fix important bug
|
|
1102
|
+
|
|
1103
|
+
**How to update**:
|
|
1104
|
+
1. Get your developer name: \`./workflow/scripts/get-developer.sh\`
|
|
1105
|
+
2. Open your personal index: \`workflow/agent-progress/{developer}/index.md\`
|
|
1106
|
+
3. Add new session record to your active progress file
|
|
1107
|
+
4. ⚠️ **IMPORTANT: If file exceeds 2000 lines:**
|
|
1108
|
+
- Create new file \`progress-{N+1}.md\`
|
|
1109
|
+
- Update your personal index.md
|
|
1110
|
+
- **Do NOT continue adding to a file over 2000 lines**
|
|
1111
|
+
|
|
1112
|
+
**Record content**:
|
|
1113
|
+
- Summary: One-line description
|
|
1114
|
+
- Main changes: Files and change descriptions
|
|
1115
|
+
- Git commits: Commit hash and message (use \`git log\` to get)
|
|
1116
|
+
- Related features: ID in feature.json
|
|
1117
|
+
- Next steps: What to do next
|
|
1118
|
+
|
|
1119
|
+
### 2. feature.json - Feature Tracking
|
|
1120
|
+
|
|
1121
|
+
**Purpose**: Structured record of all feature completion status
|
|
1122
|
+
|
|
1123
|
+
**When to update**:
|
|
1124
|
+
- ✅ Start developing new feature (planned → in-progress)
|
|
1125
|
+
- ✅ Complete feature (in-progress → completed)
|
|
1126
|
+
- ✅ Feature blocked (any status → blocked)
|
|
1127
|
+
- ✅ Add new planned feature (add planned)
|
|
1128
|
+
|
|
1129
|
+
**How to update**:
|
|
1130
|
+
1. Modify corresponding feature's \`status\` field
|
|
1131
|
+
2. If completed, add \`completedAt\` and \`commit\` fields
|
|
1132
|
+
3. If blocked, add \`blockedReason\` field
|
|
1133
|
+
4. Recalculate \`statistics\` section values
|
|
1134
|
+
5. Update \`lastUpdated\` field to current date
|
|
1135
|
+
|
|
1136
|
+
**Status flow**:
|
|
1137
|
+
\`\`\`
|
|
1138
|
+
planned → in-progress → completed
|
|
1139
|
+
↓ ↓ ↓
|
|
1140
|
+
blocked ← blocked ← blocked
|
|
1141
|
+
\`\`\`
|
|
698
1142
|
|
|
699
1143
|
---
|
|
700
1144
|
|
|
701
1145
|
## Best Practices
|
|
702
1146
|
|
|
703
|
-
### DO
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
-
|
|
707
|
-
-
|
|
1147
|
+
### ✅ DO - Should Do
|
|
1148
|
+
|
|
1149
|
+
1. **Before session start**:
|
|
1150
|
+
- Check your identity: \`./workflow/scripts/get-developer.sh\`
|
|
1151
|
+
- Read your agent-progress and feature.json
|
|
1152
|
+
- Check recent git log: \`git log --oneline -20\`
|
|
1153
|
+
- ⚠️ **MUST read** \`workflow/structure/[frontend|backend]/index.md\`
|
|
1154
|
+
- ⚠️ **MUST read** specific sections in doc.md based on task
|
|
1155
|
+
|
|
1156
|
+
2. **During development**:
|
|
1157
|
+
- ⚠️ **Strictly follow** \`workflow/structure/\` frontend/backend guidelines
|
|
1158
|
+
- Develop only one feature at a time
|
|
1159
|
+
- Run lint and type-check before finishing
|
|
1160
|
+
|
|
1161
|
+
3. **After development complete** (⚠️ AI should not commit, human is responsible):
|
|
1162
|
+
- AI reminds human to test
|
|
1163
|
+
- Human commits after testing passes
|
|
1164
|
+
- After human commits, use \`/record-agent-flow\` to record progress
|
|
1165
|
+
- Update feature.json status
|
|
1166
|
+
|
|
1167
|
+
### ❌ DON'T - Should Not Do
|
|
1168
|
+
|
|
1169
|
+
1. ⚠️ **Don't** skip reading \`workflow/structure/\` guidelines (CRITICAL VIOLATION)
|
|
1170
|
+
2. ⚠️ **Don't** let agent-progress single file exceed 2000 lines
|
|
1171
|
+
3. **Don't** skip reading context files
|
|
1172
|
+
4. **Don't** develop multiple unrelated features simultaneously
|
|
1173
|
+
5. **Don't** commit code with lint/type-check errors
|
|
1174
|
+
6. **Don't** forget to update tracking files
|
|
1175
|
+
7. ⚠️ **Don't** execute \`git commit\` - AI should not commit code
|
|
1176
|
+
- Only allowed: \`git log\`, \`git status\`, \`git diff\`
|
|
1177
|
+
- Human is responsible for testing and committing
|
|
1178
|
+
|
|
1179
|
+
---
|
|
1180
|
+
|
|
1181
|
+
## Error Recovery
|
|
1182
|
+
|
|
1183
|
+
### Lint/Type Errors
|
|
1184
|
+
|
|
1185
|
+
\`\`\`bash
|
|
1186
|
+
# Auto-fix formatting issues
|
|
1187
|
+
pnpm format
|
|
1188
|
+
|
|
1189
|
+
# Auto-fix safe lint issues
|
|
1190
|
+
pnpm biome check --write --unsafe .
|
|
1191
|
+
|
|
1192
|
+
# Check remaining issues
|
|
1193
|
+
pnpm lint
|
|
1194
|
+
\`\`\`
|
|
1195
|
+
|
|
1196
|
+
### Git Issues
|
|
708
1197
|
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
1198
|
+
\`\`\`bash
|
|
1199
|
+
# Undo last commit (keep changes)
|
|
1200
|
+
git reset --soft HEAD~1
|
|
1201
|
+
|
|
1202
|
+
# Discard uncommitted changes
|
|
1203
|
+
git checkout -- <file>
|
|
1204
|
+
|
|
1205
|
+
# View changes
|
|
1206
|
+
git diff
|
|
1207
|
+
git status
|
|
1208
|
+
\`\`\`
|
|
714
1209
|
|
|
715
1210
|
---
|
|
716
1211
|
|
|
717
|
-
##
|
|
1212
|
+
## Quick Reference
|
|
1213
|
+
|
|
1214
|
+
### Must-read Before Development
|
|
1215
|
+
|
|
1216
|
+
| Task Type | Must-read Document | Line Numbers |
|
|
1217
|
+
|---------|---------|------|
|
|
1218
|
+
| New Frontend Query Hook | \`frontend/doc.md\` | (see index.md) |
|
|
1219
|
+
| New Frontend Mutation Hook | \`frontend/doc.md\` | (see index.md) |
|
|
1220
|
+
| New Frontend Component | \`frontend/doc.md\` | (see index.md) |
|
|
1221
|
+
| New Backend API | \`backend/doc.md\` | (see index.md) |
|
|
1222
|
+
| Database Batch Operations | \`backend/doc.md\` | (see index.md) |
|
|
1223
|
+
|
|
1224
|
+
### Commit Convention
|
|
1225
|
+
|
|
1226
|
+
\`\`\`bash
|
|
1227
|
+
git commit -m "type(scope): description"
|
|
1228
|
+
\`\`\`
|
|
1229
|
+
|
|
1230
|
+
**Type**: feat, fix, docs, refactor, test, chore
|
|
1231
|
+
**Scope**: Module name (e.g., mail, auth, api)
|
|
1232
|
+
**Description**: Brief description
|
|
1233
|
+
|
|
1234
|
+
### Common Commands
|
|
718
1235
|
|
|
719
1236
|
\`\`\`bash
|
|
720
1237
|
# Development
|
|
721
1238
|
pnpm dev # Start dev server
|
|
722
1239
|
pnpm build # Production build
|
|
723
1240
|
pnpm lint # Lint check
|
|
1241
|
+
pnpm format # Format code
|
|
724
1242
|
pnpm type-check # Type check
|
|
725
1243
|
|
|
726
1244
|
# Git
|
|
727
|
-
git log --oneline -20 # Recent commits
|
|
1245
|
+
git log --oneline -20 # Recent 20 commits
|
|
1246
|
+
git diff main...HEAD # Diff with main
|
|
728
1247
|
git status # Working directory status
|
|
729
1248
|
\`\`\`
|
|
1249
|
+
|
|
1250
|
+
---
|
|
1251
|
+
|
|
1252
|
+
## Summary
|
|
1253
|
+
|
|
1254
|
+
Following this workflow ensures:
|
|
1255
|
+
- ✅ Continuity across multiple sessions
|
|
1256
|
+
- ✅ Consistent code quality
|
|
1257
|
+
- ✅ Trackable progress
|
|
1258
|
+
- ✅ Easy recovery and rollback
|
|
1259
|
+
- ✅ Transparent team collaboration
|
|
1260
|
+
|
|
1261
|
+
**Core Philosophy**: Read before write, follow standards, record promptly, develop incrementally
|
|
1262
|
+
`;
|
|
1263
|
+
fs.writeFileSync(path.join(cwd, "workflow/flow.md"), content);
|
|
1264
|
+
}
|
|
1265
|
+
async function createOnboardingGuide(cwd) {
|
|
1266
|
+
const content = `# AI Onboarding Guide for New Developers
|
|
1267
|
+
|
|
1268
|
+
> **Purpose**: Help AI understand the workflow system, then guide first-time developers
|
|
1269
|
+
|
|
1270
|
+
---
|
|
1271
|
+
|
|
1272
|
+
## Part 1: AI Self-Learning (Read This First)
|
|
1273
|
+
|
|
1274
|
+
### 1.1 What is This Workflow?
|
|
1275
|
+
|
|
1276
|
+
This is a **multi-developer collaboration workflow system** based on [Anthropic Best Practices](https://www.anthropic.com/engineering/effective-harnesses-for-long-running-agents).
|
|
1277
|
+
|
|
1278
|
+
**Core Problem**: AI Agents have no persistent memory, each session is independent. Without handling:
|
|
1279
|
+
- New sessions don't know what was done before
|
|
1280
|
+
- May re-develop completed features
|
|
1281
|
+
- Code style may be inconsistent
|
|
1282
|
+
|
|
1283
|
+
**Solution**: Use file system to simulate "persistent memory"
|
|
1284
|
+
|
|
1285
|
+
\`\`\`
|
|
1286
|
+
workflow/
|
|
1287
|
+
├── agent-progress/ # Progress records (simulated memory)
|
|
1288
|
+
│ └── {developer}/ # Each developer has own directory
|
|
1289
|
+
│ ├── index.md # Session history table
|
|
1290
|
+
│ └── progress-N.md # Detailed records
|
|
1291
|
+
├── structure/ # Development guidelines
|
|
1292
|
+
│ ├── frontend/ # Frontend guidelines
|
|
1293
|
+
│ └── backend/ # Backend guidelines
|
|
1294
|
+
├── feature.json # Feature tracking
|
|
1295
|
+
├── flow.md # Workflow specification
|
|
1296
|
+
└── .developer # Local identity file (gitignore)
|
|
1297
|
+
\`\`\`
|
|
1298
|
+
|
|
1299
|
+
### 1.2 Key Design Principles
|
|
1300
|
+
|
|
1301
|
+
| Principle | Description |
|
|
1302
|
+
|-----------|-------------|
|
|
1303
|
+
| **Multi-developer Isolation** | Each developer/Agent has own directory, avoid conflicts |
|
|
1304
|
+
| **AI Doesn't Commit Code** | AI only develops, human tests and commits |
|
|
1305
|
+
| **Sequential Numbering** | Progress files use \`progress-1.md\`, \`progress-2.md\` (not dates) |
|
|
1306
|
+
| **2000 Line Limit** | Create new file when single file exceeds 2000 lines |
|
|
1307
|
+
|
|
1308
|
+
### 1.3 Daily Workflow
|
|
1309
|
+
|
|
1310
|
+
\`\`\`
|
|
1311
|
+
┌─────────────────────────────────────────────────────────┐
|
|
1312
|
+
│ │
|
|
1313
|
+
│ /init-agent → AI reads context │
|
|
1314
|
+
│ ↓ │
|
|
1315
|
+
│ AI develops code → Follow workflow/structure/ │
|
|
1316
|
+
│ ↓ │
|
|
1317
|
+
│ /check-frontend → Check frontend standards (opt) │
|
|
1318
|
+
│ /check-backend → Check backend standards (opt) │
|
|
1319
|
+
│ ↓ │
|
|
1320
|
+
│ pnpm lint → Check code quality │
|
|
1321
|
+
│ ↓ │
|
|
1322
|
+
│ 👤 Human tests → AI doesn't commit itself │
|
|
1323
|
+
│ ↓ │
|
|
1324
|
+
│ 👤 Human git commit → Commit after test passes │
|
|
1325
|
+
│ ↓ │
|
|
1326
|
+
│ /record-agent-flow → Record progress (with hash) │
|
|
1327
|
+
│ │
|
|
1328
|
+
└─────────────────────────────────────────────────────────┘
|
|
1329
|
+
\`\`\`
|
|
1330
|
+
|
|
1331
|
+
### 1.4 Available Slash Commands
|
|
1332
|
+
|
|
1333
|
+
| Command | Purpose | When to Use |
|
|
1334
|
+
|---------|---------|-------------|
|
|
1335
|
+
| \`/init-agent\` | Initialize AI session, read project context | Every time starting work |
|
|
1336
|
+
| \`/onboard-developer\` | Guide new developer through initialization | First-time users |
|
|
1337
|
+
| \`/check-frontend\` | Check if frontend code follows standards | After frontend code is done |
|
|
1338
|
+
| \`/check-backend\` | Check if backend code follows standards | After backend code is done |
|
|
1339
|
+
| \`/record-agent-flow\` | Record progress to agent-progress | After human commits code |
|
|
1340
|
+
| \`/generate-frontend-structure\` | Auto-generate frontend guidelines | Setting up project standards |
|
|
1341
|
+
| \`/generate-backend-structure\` | Auto-generate backend guidelines | Setting up project standards |
|
|
1342
|
+
|
|
1343
|
+
### 1.5 AI Permission Boundaries
|
|
1344
|
+
|
|
1345
|
+
| Can Do ✅ | Cannot Do ❌ |
|
|
1346
|
+
|----------|-------------|
|
|
1347
|
+
| \`git log\` view history | \`git commit\` commit code |
|
|
1348
|
+
| \`git status\` view status | \`git push\` push code |
|
|
1349
|
+
| \`git diff\` view changes | \`git add\` stage files |
|
|
1350
|
+
| Write code | Commit without human testing |
|
|
1351
|
+
|
|
1352
|
+
### 1.6 Related Document Locations
|
|
1353
|
+
|
|
1354
|
+
| Document | Purpose | When to Read |
|
|
1355
|
+
|----------|---------|--------------|
|
|
1356
|
+
| \`init-agent.md\` | Complete initialization guide | Start of each session |
|
|
1357
|
+
| \`workflow/flow.md\` | Workflow specification | Need to understand process details |
|
|
1358
|
+
| \`workflow/structure/\` | Coding standards | Before writing code |
|
|
1359
|
+
|
|
1360
|
+
---
|
|
1361
|
+
|
|
1362
|
+
## Part 2: Identifying New Developers
|
|
1363
|
+
|
|
1364
|
+
When the following occurs, developer may be first-time user:
|
|
1365
|
+
|
|
1366
|
+
### 2.1 Auto Detection
|
|
1367
|
+
|
|
1368
|
+
\`\`\`bash
|
|
1369
|
+
# Run this command, if error returned, it's a new developer
|
|
1370
|
+
./workflow/scripts/get-developer.sh
|
|
1371
|
+
|
|
1372
|
+
# Error output:
|
|
1373
|
+
# ERROR: Developer not initialized. Run: ./workflow/scripts/init-developer.sh
|
|
1374
|
+
\`\`\`
|
|
1375
|
+
|
|
1376
|
+
### 2.2 Proactive Inquiry
|
|
1377
|
+
|
|
1378
|
+
Developer may say:
|
|
1379
|
+
- "How do I use this workflow?"
|
|
1380
|
+
- "I'm new, how do I start?"
|
|
1381
|
+
- "First time using, what do I need to do?"
|
|
1382
|
+
- "Do I need to initialize something?"
|
|
1383
|
+
|
|
1384
|
+
---
|
|
1385
|
+
|
|
1386
|
+
## Part 3: Guiding New Developers
|
|
1387
|
+
|
|
1388
|
+
> When you confirm developer needs guidance, follow these steps
|
|
1389
|
+
|
|
1390
|
+
### Step 1: Explain Concept (30 seconds)
|
|
1391
|
+
|
|
1392
|
+
**AI should say**:
|
|
1393
|
+
|
|
1394
|
+
> This project uses a multi-developer workflow system. Simply put:
|
|
1395
|
+
>
|
|
1396
|
+
> - Each developer has their own progress directory
|
|
1397
|
+
> - AI helps write code, but **you test and commit**
|
|
1398
|
+
> - This ensures code quality, prevents AI from committing problematic code
|
|
1399
|
+
>
|
|
1400
|
+
> Now let me help you initialize your developer identity.
|
|
1401
|
+
|
|
1402
|
+
### Step 2: Choose Name
|
|
1403
|
+
|
|
1404
|
+
**AI should ask**:
|
|
1405
|
+
|
|
1406
|
+
> Please tell me your developer name:
|
|
1407
|
+
> - Use your name, like \`john-doe\`
|
|
1408
|
+
> - Only letters, numbers, hyphens, underscores allowed
|
|
1409
|
+
|
|
1410
|
+
### Step 3: Run Initialization
|
|
1411
|
+
|
|
1412
|
+
\`\`\`bash
|
|
1413
|
+
./workflow/scripts/init-developer.sh <developer-name>
|
|
1414
|
+
\`\`\`
|
|
1415
|
+
|
|
1416
|
+
**AI should explain**:
|
|
1417
|
+
|
|
1418
|
+
> The script created:
|
|
1419
|
+
> 1. Your identity file (stored locally, not committed to git)
|
|
1420
|
+
> 2. Your progress directory
|
|
1421
|
+
|
|
1422
|
+
### Step 4: Verify Success
|
|
1423
|
+
|
|
1424
|
+
\`\`\`bash
|
|
1425
|
+
./workflow/scripts/get-developer.sh
|
|
1426
|
+
# Should output developer's name
|
|
1427
|
+
\`\`\`
|
|
1428
|
+
|
|
1429
|
+
### Step 5: Explain Daily Process and Common Commands
|
|
1430
|
+
|
|
1431
|
+
**AI should say**:
|
|
1432
|
+
|
|
1433
|
+
> Initialization complete! Future workflow:
|
|
1434
|
+
>
|
|
1435
|
+
> 1. Every time starting work, run \`/init-agent\`
|
|
1436
|
+
> 2. AI helps write code
|
|
1437
|
+
> 3. After code is done, use \`/check-frontend\` or \`/check-backend\` to check standards
|
|
1438
|
+
> 4. You test the code
|
|
1439
|
+
> 5. After test passes, **you do git commit**
|
|
1440
|
+
> 6. After commit, run \`/record-agent-flow\` to record progress
|
|
1441
|
+
>
|
|
1442
|
+
> **Remember**: AI won't execute git commit, that's your responsibility.
|
|
1443
|
+
|
|
1444
|
+
---
|
|
1445
|
+
|
|
1446
|
+
## Part 4: Quick Guide Template
|
|
1447
|
+
|
|
1448
|
+
If developer is in a hurry, use this simplified version:
|
|
1449
|
+
|
|
1450
|
+
**AI says**:
|
|
1451
|
+
|
|
1452
|
+
> Quick start:
|
|
1453
|
+
>
|
|
1454
|
+
> \`\`\`bash
|
|
1455
|
+
> # Initialize (only once)
|
|
1456
|
+
> ./workflow/scripts/init-developer.sh your-name
|
|
1457
|
+
> \`\`\`
|
|
1458
|
+
>
|
|
1459
|
+
> Then develop normally:
|
|
1460
|
+
> - AI won't commit, you commit
|
|
1461
|
+
> - After commit use \`/record-agent-flow\` to record
|
|
1462
|
+
>
|
|
1463
|
+
> Detailed docs: \`workflow/flow.md\`
|
|
1464
|
+
|
|
1465
|
+
---
|
|
1466
|
+
|
|
1467
|
+
## Part 5: FAQ
|
|
1468
|
+
|
|
1469
|
+
### Q: Why can't AI commit code itself?
|
|
1470
|
+
|
|
1471
|
+
> To ensure code quality. Humans can review and test before commit, preventing problematic code from entering codebase.
|
|
1472
|
+
|
|
1473
|
+
### Q: Do I need to initialize every time?
|
|
1474
|
+
|
|
1475
|
+
> No, only once. Identity info is stored locally, not committed to git.
|
|
1476
|
+
|
|
1477
|
+
### Q: Will multi-person collaboration conflict?
|
|
1478
|
+
|
|
1479
|
+
> No. Each developer has their own directory, only updates their own files.
|
|
1480
|
+
|
|
1481
|
+
---
|
|
1482
|
+
|
|
1483
|
+
## Part 6: Onboarding Completion Checklist
|
|
1484
|
+
|
|
1485
|
+
Confirm all completed:
|
|
1486
|
+
|
|
1487
|
+
- [ ] AI understands workflow (Part 1)
|
|
1488
|
+
- [ ] Identified developer needs guidance
|
|
1489
|
+
- [ ] Developer chose name
|
|
1490
|
+
- [ ] \`init-developer.sh\` ran successfully
|
|
1491
|
+
- [ ] \`get-developer.sh\` returns correct name
|
|
1492
|
+
- [ ] Developer understands AI won't commit
|
|
730
1493
|
`;
|
|
731
|
-
fs.writeFileSync(path.join(cwd,
|
|
1494
|
+
fs.writeFileSync(path.join(cwd, "workflow/onboarding-guide.md"), content);
|
|
732
1495
|
}
|
|
733
1496
|
async function createWorkflowGitignore(cwd) {
|
|
734
1497
|
const content = `# Developer identity (local only)
|
|
735
1498
|
.developer
|
|
736
1499
|
`;
|
|
737
|
-
fs.writeFileSync(path.join(cwd,
|
|
1500
|
+
fs.writeFileSync(path.join(cwd, "workflow/.gitignore"), content);
|
|
738
1501
|
}
|
|
739
1502
|
//# sourceMappingURL=workflow.js.map
|