claude-code-workflow 6.0.5 → 6.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/.claude/agents/action-planning-agent.md +1 -1
- package/.claude/agents/cli-execution-agent.md +269 -269
- package/.claude/agents/cli-explore-agent.md +182 -182
- package/.claude/agents/context-search-agent.md +582 -582
- package/.claude/agents/memory-bridge.md +93 -93
- package/.claude/commands/cli/cli-init.md +1 -1
- package/.claude/commands/memory/docs-full-cli.md +471 -471
- package/.claude/commands/memory/docs-related-cli.md +386 -386
- package/.claude/commands/memory/docs.md +615 -615
- package/.claude/commands/memory/load.md +1 -1
- package/.claude/commands/memory/update-full.md +332 -332
- package/.claude/commands/memory/update-related.md +5 -5
- package/.claude/commands/workflow/init.md +1 -1
- package/.claude/commands/workflow/lite-fix.md +621 -621
- package/.claude/commands/workflow/lite-plan.md +592 -592
- package/.claude/commands/workflow/tools/context-gather.md +434 -434
- package/.claude/commands/workflow/ui-design/generate.md +504 -504
- package/.claude/commands/workflow/ui-design/import-from-code.md +537 -537
- package/.claude/scripts/classify-folders.sh +4 -0
- package/.claude/scripts/convert_tokens_to_css.sh +4 -0
- package/.claude/scripts/detect_changed_modules.sh +5 -1
- package/.claude/scripts/discover-design-files.sh +87 -83
- package/.claude/scripts/generate_module_docs.sh +717 -713
- package/.claude/scripts/get_modules_by_depth.sh +5 -1
- package/.claude/scripts/ui-generate-preview.sh +4 -0
- package/.claude/scripts/ui-instantiate-prototypes.sh +4 -0
- package/.claude/scripts/update_module_claude.sh +4 -0
- package/.claude/skills/command-guide/index/all-commands.json +1 -12
- package/.claude/skills/command-guide/index/by-category.json +1 -12
- package/.claude/skills/command-guide/index/by-use-case.json +1 -12
- package/.claude/skills/command-guide/index/essential-commands.json +1 -12
- package/.claude/skills/command-guide/reference/agents/action-planning-agent.md +127 -71
- package/.claude/skills/command-guide/reference/agents/cli-execution-agent.md +269 -269
- package/.claude/skills/command-guide/reference/agents/cli-explore-agent.md +182 -182
- package/.claude/skills/command-guide/reference/agents/conceptual-planning-agent.md +18 -38
- package/.claude/skills/command-guide/reference/agents/context-search-agent.md +582 -577
- package/.claude/skills/command-guide/reference/agents/memory-bridge.md +93 -93
- package/.claude/skills/command-guide/reference/commands/cli/cli-init.md +1 -1
- package/.claude/skills/command-guide/reference/commands/memory/docs-full-cli.md +471 -471
- package/.claude/skills/command-guide/reference/commands/memory/docs-related-cli.md +386 -386
- package/.claude/skills/command-guide/reference/commands/memory/docs.md +615 -610
- package/.claude/skills/command-guide/reference/commands/memory/load.md +1 -1
- package/.claude/skills/command-guide/reference/commands/memory/update-full.md +332 -332
- package/.claude/skills/command-guide/reference/commands/memory/update-related.md +5 -5
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/artifacts.md +299 -451
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/auto-parallel.md +14 -37
- package/.claude/skills/command-guide/reference/commands/workflow/brainstorm/synthesis.md +252 -350
- package/.claude/skills/command-guide/reference/commands/workflow/init.md +2 -2
- package/.claude/skills/command-guide/reference/commands/workflow/lite-execute.md +52 -0
- package/.claude/skills/command-guide/reference/commands/workflow/lite-fix.md +621 -602
- package/.claude/skills/command-guide/reference/commands/workflow/lite-plan.md +46 -36
- package/.claude/skills/command-guide/reference/commands/workflow/review-fix.md +18 -58
- package/.claude/skills/command-guide/reference/commands/workflow/review-module-cycle.md +22 -52
- package/.claude/skills/command-guide/reference/commands/workflow/review-session-cycle.md +19 -48
- package/.claude/skills/command-guide/reference/commands/workflow/session/start.md +25 -5
- package/.claude/skills/command-guide/reference/commands/workflow/tdd-plan.md +1 -1
- package/.claude/skills/command-guide/reference/commands/workflow/test-fix-gen.md +7 -7
- package/.claude/skills/command-guide/reference/commands/workflow/tools/context-gather.md +434 -434
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-agent.md +151 -11
- package/.claude/skills/command-guide/reference/commands/workflow/tools/task-generate-tdd.md +4 -4
- package/.claude/skills/command-guide/reference/commands/workflow/tools/test-task-generate.md +1 -1
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/generate.md +504 -504
- package/.claude/skills/command-guide/reference/commands/workflow/ui-design/import-from-code.md +537 -537
- package/.claude/workflows/context-search-strategy.md +77 -77
- package/.claude/workflows/tool-strategy.md +90 -71
- package/.claude/workflows/workflow-architecture.md +1 -1
- package/README.md +285 -285
- package/ccw/src/cli.js +7 -0
- package/ccw/src/commands/tool.js +217 -0
- package/ccw/src/core/dashboard-generator.js +18 -3
- package/ccw/src/core/lite-scanner.js +35 -11
- package/ccw/src/core/server.js +531 -46
- package/ccw/src/templates/dashboard-css/01-base.css +161 -0
- package/ccw/src/templates/dashboard-css/02-session.css +726 -0
- package/ccw/src/templates/dashboard-css/03-tasks.css +512 -0
- package/ccw/src/templates/dashboard-css/04-lite-tasks.css +843 -0
- package/ccw/src/templates/dashboard-css/05-context.css +2206 -0
- package/ccw/src/templates/dashboard-css/06-cards.css +1570 -0
- package/ccw/src/templates/dashboard-css/07-managers.css +936 -0
- package/ccw/src/templates/dashboard-css/08-review.css +1266 -0
- package/ccw/src/templates/dashboard-css/09-explorer.css +1397 -0
- package/ccw/src/templates/dashboard-js/components/global-notifications.js +219 -0
- package/ccw/src/templates/dashboard-js/components/hook-manager.js +10 -0
- package/ccw/src/templates/dashboard-js/components/mcp-manager.js +11 -1
- package/ccw/src/templates/dashboard-js/components/navigation.js +11 -5
- package/ccw/src/templates/dashboard-js/components/tabs-context.js +20 -20
- package/ccw/src/templates/dashboard-js/components/tabs-other.js +11 -11
- package/ccw/src/templates/dashboard-js/components/theme.js +29 -1
- package/ccw/src/templates/dashboard-js/main.js +4 -0
- package/ccw/src/templates/dashboard-js/state.js +5 -0
- package/ccw/src/templates/dashboard-js/views/explorer.js +852 -0
- package/ccw/src/templates/dashboard-js/views/home.js +13 -9
- package/ccw/src/templates/dashboard-js/views/hook-manager.js +8 -5
- package/ccw/src/templates/dashboard-js/views/lite-tasks.js +21 -16
- package/ccw/src/templates/dashboard-js/views/mcp-manager.js +90 -19
- package/ccw/src/templates/dashboard-js/views/project-overview.js +15 -11
- package/ccw/src/templates/dashboard-js/views/review-session.js +3 -3
- package/ccw/src/templates/dashboard-js/views/session-detail.js +38 -28
- package/ccw/src/templates/dashboard.html +129 -28
- package/ccw/src/tools/classify-folders.js +204 -0
- package/ccw/src/tools/convert-tokens-to-css.js +250 -0
- package/ccw/src/tools/detect-changed-modules.js +288 -0
- package/ccw/src/tools/discover-design-files.js +134 -0
- package/ccw/src/tools/edit-file.js +266 -0
- package/ccw/src/tools/generate-module-docs.js +416 -0
- package/ccw/src/tools/get-modules-by-depth.js +308 -0
- package/ccw/src/tools/index.js +176 -0
- package/ccw/src/tools/ui-generate-preview.js +327 -0
- package/ccw/src/tools/ui-instantiate-prototypes.js +301 -0
- package/ccw/src/tools/update-module-claude.js +380 -0
- package/package.json +1 -1
- package/.claude/skills/command-guide/reference/commands/workflow/status.md +0 -352
- package/ccw/src/core/server.js.bak +0 -385
- package/ccw/src/core/server_original.bak +0 -385
- package/ccw/src/templates/dashboard.css +0 -8187
- package/ccw/src/templates/dashboard_tailwind.html +0 -42
- package/ccw/src/templates/dashboard_test.html +0 -37
- package/ccw/src/templates/tailwind-base.css +0 -212
|
@@ -1,713 +1,717 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
#
|
|
3
|
-
#
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
# gemini: gemini
|
|
12
|
-
#
|
|
13
|
-
#
|
|
14
|
-
#
|
|
15
|
-
#
|
|
16
|
-
#
|
|
17
|
-
#
|
|
18
|
-
#
|
|
19
|
-
#
|
|
20
|
-
#
|
|
21
|
-
#
|
|
22
|
-
# -
|
|
23
|
-
# -
|
|
24
|
-
#
|
|
25
|
-
#
|
|
26
|
-
#
|
|
27
|
-
#
|
|
28
|
-
# -
|
|
29
|
-
#
|
|
30
|
-
#
|
|
31
|
-
#
|
|
32
|
-
#
|
|
33
|
-
# -
|
|
34
|
-
# -
|
|
35
|
-
#
|
|
36
|
-
#
|
|
37
|
-
#
|
|
38
|
-
# -
|
|
39
|
-
# -
|
|
40
|
-
#
|
|
41
|
-
#
|
|
42
|
-
#
|
|
43
|
-
#
|
|
44
|
-
#
|
|
45
|
-
#
|
|
46
|
-
#
|
|
47
|
-
#
|
|
48
|
-
#
|
|
49
|
-
#
|
|
50
|
-
#
|
|
51
|
-
#
|
|
52
|
-
#
|
|
53
|
-
#
|
|
54
|
-
#
|
|
55
|
-
# -
|
|
56
|
-
|
|
57
|
-
#
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
local
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
local
|
|
136
|
-
local
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
local
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
local
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
if [ -f "$
|
|
324
|
-
template_content
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
if [ -f "$
|
|
351
|
-
|
|
352
|
-
echo " 📋 Loaded
|
|
353
|
-
fi
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
$
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
Template:
|
|
472
|
-
$
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
$
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
Template:
|
|
524
|
-
$
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
tool_result=$?
|
|
585
|
-
;;
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
tool_result=$?
|
|
589
|
-
;;
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
echo "
|
|
674
|
-
cd - > /dev/null
|
|
675
|
-
return
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
echo "
|
|
692
|
-
echo ""
|
|
693
|
-
echo "
|
|
694
|
-
echo "
|
|
695
|
-
echo "
|
|
696
|
-
echo "
|
|
697
|
-
echo ""
|
|
698
|
-
echo "
|
|
699
|
-
echo "
|
|
700
|
-
echo ""
|
|
701
|
-
echo "
|
|
702
|
-
echo "
|
|
703
|
-
echo "
|
|
704
|
-
echo ""
|
|
705
|
-
echo "
|
|
706
|
-
echo " ./generate_module_docs.sh
|
|
707
|
-
echo " ./generate_module_docs.sh
|
|
708
|
-
echo "
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# ⚠️ DEPRECATED: This script is deprecated.
|
|
3
|
+
# Please use: ccw tool exec generate_module_docs '{"path":".","strategy":"single-layer","tool":"gemini"}'
|
|
4
|
+
# This file will be removed in a future version.
|
|
5
|
+
|
|
6
|
+
# Generate documentation for modules and projects with multiple strategies
|
|
7
|
+
# Usage: generate_module_docs.sh <strategy> <source_path> <project_name> [tool] [model]
|
|
8
|
+
# strategy: full|single|project-readme|project-architecture|http-api
|
|
9
|
+
# source_path: Path to the source module directory (or project root for project-level docs)
|
|
10
|
+
# project_name: Project name for output path (e.g., "myproject")
|
|
11
|
+
# tool: gemini|qwen|codex (default: gemini)
|
|
12
|
+
# model: Model name (optional, uses tool defaults)
|
|
13
|
+
#
|
|
14
|
+
# Default Models:
|
|
15
|
+
# gemini: gemini-2.5-flash
|
|
16
|
+
# qwen: coder-model
|
|
17
|
+
# codex: gpt5-codex
|
|
18
|
+
#
|
|
19
|
+
# Module-Level Strategies:
|
|
20
|
+
# full: Full documentation generation
|
|
21
|
+
# - Read: All files in current and subdirectories (@**/*)
|
|
22
|
+
# - Generate: API.md + README.md for each directory containing code files
|
|
23
|
+
# - Use: Deep directories (Layer 3), comprehensive documentation
|
|
24
|
+
#
|
|
25
|
+
# single: Single-layer documentation
|
|
26
|
+
# - Read: Current directory code + child API.md/README.md files
|
|
27
|
+
# - Generate: API.md + README.md only in current directory
|
|
28
|
+
# - Use: Upper layers (Layer 1-2), incremental updates
|
|
29
|
+
#
|
|
30
|
+
# Project-Level Strategies:
|
|
31
|
+
# project-readme: Project overview documentation
|
|
32
|
+
# - Read: All module API.md and README.md files
|
|
33
|
+
# - Generate: README.md (project root)
|
|
34
|
+
# - Use: After all module docs are generated
|
|
35
|
+
#
|
|
36
|
+
# project-architecture: System design documentation
|
|
37
|
+
# - Read: All module docs + project README
|
|
38
|
+
# - Generate: ARCHITECTURE.md + EXAMPLES.md
|
|
39
|
+
# - Use: After project README is generated
|
|
40
|
+
#
|
|
41
|
+
# http-api: HTTP API documentation
|
|
42
|
+
# - Read: API route files + existing docs
|
|
43
|
+
# - Generate: api/README.md
|
|
44
|
+
# - Use: For projects with HTTP APIs
|
|
45
|
+
#
|
|
46
|
+
# Output Structure:
|
|
47
|
+
# Module docs: .workflow/docs/{project_name}/{source_path}/API.md
|
|
48
|
+
# Module docs: .workflow/docs/{project_name}/{source_path}/README.md
|
|
49
|
+
# Project docs: .workflow/docs/{project_name}/README.md
|
|
50
|
+
# Project docs: .workflow/docs/{project_name}/ARCHITECTURE.md
|
|
51
|
+
# Project docs: .workflow/docs/{project_name}/EXAMPLES.md
|
|
52
|
+
# API docs: .workflow/docs/{project_name}/api/README.md
|
|
53
|
+
#
|
|
54
|
+
# Features:
|
|
55
|
+
# - Path mirroring: source structure → docs structure
|
|
56
|
+
# - Template-driven generation
|
|
57
|
+
# - Respects .gitignore patterns
|
|
58
|
+
# - Detects code vs navigation folders
|
|
59
|
+
# - Tool fallback support
|
|
60
|
+
|
|
61
|
+
# Build exclusion filters from .gitignore
|
|
62
|
+
build_exclusion_filters() {
|
|
63
|
+
local filters=""
|
|
64
|
+
|
|
65
|
+
# Common system/cache directories to exclude
|
|
66
|
+
local system_excludes=(
|
|
67
|
+
".git" "__pycache__" "node_modules" ".venv" "venv" "env"
|
|
68
|
+
"dist" "build" ".cache" ".pytest_cache" ".mypy_cache"
|
|
69
|
+
"coverage" ".nyc_output" "logs" "tmp" "temp" ".workflow"
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
for exclude in "${system_excludes[@]}"; do
|
|
73
|
+
filters+=" -not -path '*/$exclude' -not -path '*/$exclude/*'"
|
|
74
|
+
done
|
|
75
|
+
|
|
76
|
+
# Find and parse .gitignore (current dir first, then git root)
|
|
77
|
+
local gitignore_file=""
|
|
78
|
+
|
|
79
|
+
# Check current directory first
|
|
80
|
+
if [ -f ".gitignore" ]; then
|
|
81
|
+
gitignore_file=".gitignore"
|
|
82
|
+
else
|
|
83
|
+
# Try to find git root and check for .gitignore there
|
|
84
|
+
local git_root=$(git rev-parse --show-toplevel 2>/dev/null)
|
|
85
|
+
if [ -n "$git_root" ] && [ -f "$git_root/.gitignore" ]; then
|
|
86
|
+
gitignore_file="$git_root/.gitignore"
|
|
87
|
+
fi
|
|
88
|
+
fi
|
|
89
|
+
|
|
90
|
+
# Parse .gitignore if found
|
|
91
|
+
if [ -n "$gitignore_file" ]; then
|
|
92
|
+
while IFS= read -r line; do
|
|
93
|
+
# Skip empty lines and comments
|
|
94
|
+
[[ -z "$line" || "$line" =~ ^[[:space:]]*# ]] && continue
|
|
95
|
+
|
|
96
|
+
# Remove trailing slash and whitespace
|
|
97
|
+
line=$(echo "$line" | sed 's|/$||' | xargs)
|
|
98
|
+
|
|
99
|
+
# Skip wildcards patterns (too complex for simple find)
|
|
100
|
+
[[ "$line" =~ \* ]] && continue
|
|
101
|
+
|
|
102
|
+
# Add to filters
|
|
103
|
+
filters+=" -not -path '*/$line' -not -path '*/$line/*'"
|
|
104
|
+
done < "$gitignore_file"
|
|
105
|
+
fi
|
|
106
|
+
|
|
107
|
+
echo "$filters"
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
# Detect folder type (code vs navigation)
|
|
111
|
+
detect_folder_type() {
|
|
112
|
+
local target_path="$1"
|
|
113
|
+
local exclusion_filters="$2"
|
|
114
|
+
|
|
115
|
+
# Count code files (primary indicators)
|
|
116
|
+
local code_count=$(eval "find \"$target_path\" -maxdepth 1 -type f \\( -name '*.ts' -o -name '*.tsx' -o -name '*.js' -o -name '*.jsx' -o -name '*.py' -o -name '*.sh' -o -name '*.go' -o -name '*.rs' \\) $exclusion_filters 2>/dev/null" | wc -l)
|
|
117
|
+
|
|
118
|
+
if [ $code_count -gt 0 ]; then
|
|
119
|
+
echo "code"
|
|
120
|
+
else
|
|
121
|
+
echo "navigation"
|
|
122
|
+
fi
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
# Scan directory structure and generate structured information
|
|
126
|
+
scan_directory_structure() {
|
|
127
|
+
local target_path="$1"
|
|
128
|
+
local strategy="$2"
|
|
129
|
+
|
|
130
|
+
if [ ! -d "$target_path" ]; then
|
|
131
|
+
echo "Directory not found: $target_path"
|
|
132
|
+
return 1
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
local exclusion_filters=$(build_exclusion_filters)
|
|
136
|
+
local structure_info=""
|
|
137
|
+
|
|
138
|
+
# Get basic directory info
|
|
139
|
+
local dir_name=$(basename "$target_path")
|
|
140
|
+
local total_files=$(eval "find \"$target_path\" -type f $exclusion_filters 2>/dev/null" | wc -l)
|
|
141
|
+
local total_dirs=$(eval "find \"$target_path\" -type d $exclusion_filters 2>/dev/null" | wc -l)
|
|
142
|
+
local folder_type=$(detect_folder_type "$target_path" "$exclusion_filters")
|
|
143
|
+
|
|
144
|
+
structure_info+="Directory: $dir_name\n"
|
|
145
|
+
structure_info+="Total files: $total_files\n"
|
|
146
|
+
structure_info+="Total directories: $total_dirs\n"
|
|
147
|
+
structure_info+="Folder type: $folder_type\n\n"
|
|
148
|
+
|
|
149
|
+
if [ "$strategy" = "full" ]; then
|
|
150
|
+
# For full: show all subdirectories with file counts
|
|
151
|
+
structure_info+="Subdirectories with files:\n"
|
|
152
|
+
while IFS= read -r dir; do
|
|
153
|
+
if [ -n "$dir" ] && [ "$dir" != "$target_path" ]; then
|
|
154
|
+
local rel_path=${dir#$target_path/}
|
|
155
|
+
local file_count=$(eval "find \"$dir\" -maxdepth 1 -type f $exclusion_filters 2>/dev/null" | wc -l)
|
|
156
|
+
if [ $file_count -gt 0 ]; then
|
|
157
|
+
local subdir_type=$(detect_folder_type "$dir" "$exclusion_filters")
|
|
158
|
+
structure_info+=" - $rel_path/ ($file_count files, type: $subdir_type)\n"
|
|
159
|
+
fi
|
|
160
|
+
fi
|
|
161
|
+
done < <(eval "find \"$target_path\" -type d $exclusion_filters 2>/dev/null")
|
|
162
|
+
else
|
|
163
|
+
# For single: show direct children only
|
|
164
|
+
structure_info+="Direct subdirectories:\n"
|
|
165
|
+
while IFS= read -r dir; do
|
|
166
|
+
if [ -n "$dir" ]; then
|
|
167
|
+
local dir_name=$(basename "$dir")
|
|
168
|
+
local file_count=$(eval "find \"$dir\" -maxdepth 1 -type f $exclusion_filters 2>/dev/null" | wc -l)
|
|
169
|
+
local has_api=$([ -f "$dir/API.md" ] && echo " [has API.md]" || echo "")
|
|
170
|
+
local has_readme=$([ -f "$dir/README.md" ] && echo " [has README.md]" || echo "")
|
|
171
|
+
structure_info+=" - $dir_name/ ($file_count files)$has_api$has_readme\n"
|
|
172
|
+
fi
|
|
173
|
+
done < <(eval "find \"$target_path\" -maxdepth 1 -type d $exclusion_filters 2>/dev/null" | grep -v "^$target_path$")
|
|
174
|
+
fi
|
|
175
|
+
|
|
176
|
+
# Show main file types in current directory
|
|
177
|
+
structure_info+="\nCurrent directory files:\n"
|
|
178
|
+
local code_files=$(eval "find \"$target_path\" -maxdepth 1 -type f \\( -name '*.ts' -o -name '*.tsx' -o -name '*.js' -o -name '*.jsx' -o -name '*.py' -o -name '*.sh' -o -name '*.go' -o -name '*.rs' \\) $exclusion_filters 2>/dev/null" | wc -l)
|
|
179
|
+
local config_files=$(eval "find \"$target_path\" -maxdepth 1 -type f \\( -name '*.json' -o -name '*.yaml' -o -name '*.yml' -o -name '*.toml' \\) $exclusion_filters 2>/dev/null" | wc -l)
|
|
180
|
+
local doc_files=$(eval "find \"$target_path\" -maxdepth 1 -type f -name '*.md' $exclusion_filters 2>/dev/null" | wc -l)
|
|
181
|
+
|
|
182
|
+
structure_info+=" - Code files: $code_files\n"
|
|
183
|
+
structure_info+=" - Config files: $config_files\n"
|
|
184
|
+
structure_info+=" - Documentation: $doc_files\n"
|
|
185
|
+
|
|
186
|
+
printf "%b" "$structure_info"
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
# Calculate output path based on source path and project name
|
|
190
|
+
calculate_output_path() {
|
|
191
|
+
local source_path="$1"
|
|
192
|
+
local project_name="$2"
|
|
193
|
+
local project_root="$3"
|
|
194
|
+
|
|
195
|
+
# Get absolute path of source (normalize to Unix-style path)
|
|
196
|
+
local abs_source=$(cd "$source_path" && pwd)
|
|
197
|
+
|
|
198
|
+
# Normalize project root to same format
|
|
199
|
+
local norm_project_root=$(cd "$project_root" && pwd)
|
|
200
|
+
|
|
201
|
+
# Calculate relative path from project root
|
|
202
|
+
local rel_path="${abs_source#$norm_project_root}"
|
|
203
|
+
|
|
204
|
+
# Remove leading slash if present
|
|
205
|
+
rel_path="${rel_path#/}"
|
|
206
|
+
|
|
207
|
+
# If source is project root, use project name directly
|
|
208
|
+
if [ "$abs_source" = "$norm_project_root" ] || [ -z "$rel_path" ]; then
|
|
209
|
+
echo "$norm_project_root/.workflow/docs/$project_name"
|
|
210
|
+
else
|
|
211
|
+
echo "$norm_project_root/.workflow/docs/$project_name/$rel_path"
|
|
212
|
+
fi
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
generate_module_docs() {
|
|
216
|
+
local strategy="$1"
|
|
217
|
+
local source_path="$2"
|
|
218
|
+
local project_name="$3"
|
|
219
|
+
local tool="${4:-gemini}"
|
|
220
|
+
local model="$5"
|
|
221
|
+
|
|
222
|
+
# Validate parameters
|
|
223
|
+
if [ -z "$strategy" ] || [ -z "$source_path" ] || [ -z "$project_name" ]; then
|
|
224
|
+
echo "❌ Error: Strategy, source path, and project name are required"
|
|
225
|
+
echo "Usage: generate_module_docs.sh <strategy> <source_path> <project_name> [tool] [model]"
|
|
226
|
+
echo "Module strategies: full, single"
|
|
227
|
+
echo "Project strategies: project-readme, project-architecture, http-api"
|
|
228
|
+
return 1
|
|
229
|
+
fi
|
|
230
|
+
|
|
231
|
+
# Validate strategy
|
|
232
|
+
local valid_strategies=("full" "single" "project-readme" "project-architecture" "http-api")
|
|
233
|
+
local strategy_valid=false
|
|
234
|
+
for valid_strategy in "${valid_strategies[@]}"; do
|
|
235
|
+
if [ "$strategy" = "$valid_strategy" ]; then
|
|
236
|
+
strategy_valid=true
|
|
237
|
+
break
|
|
238
|
+
fi
|
|
239
|
+
done
|
|
240
|
+
|
|
241
|
+
if [ "$strategy_valid" = false ]; then
|
|
242
|
+
echo "❌ Error: Invalid strategy '$strategy'"
|
|
243
|
+
echo "Valid module strategies: full, single"
|
|
244
|
+
echo "Valid project strategies: project-readme, project-architecture, http-api"
|
|
245
|
+
return 1
|
|
246
|
+
fi
|
|
247
|
+
|
|
248
|
+
if [ ! -d "$source_path" ]; then
|
|
249
|
+
echo "❌ Error: Source directory '$source_path' does not exist"
|
|
250
|
+
return 1
|
|
251
|
+
fi
|
|
252
|
+
|
|
253
|
+
# Set default models if not specified
|
|
254
|
+
if [ -z "$model" ]; then
|
|
255
|
+
case "$tool" in
|
|
256
|
+
gemini)
|
|
257
|
+
model="gemini-2.5-flash"
|
|
258
|
+
;;
|
|
259
|
+
qwen)
|
|
260
|
+
model="coder-model"
|
|
261
|
+
;;
|
|
262
|
+
codex)
|
|
263
|
+
model="gpt5-codex"
|
|
264
|
+
;;
|
|
265
|
+
*)
|
|
266
|
+
model=""
|
|
267
|
+
;;
|
|
268
|
+
esac
|
|
269
|
+
fi
|
|
270
|
+
|
|
271
|
+
# Build exclusion filters
|
|
272
|
+
local exclusion_filters=$(build_exclusion_filters)
|
|
273
|
+
|
|
274
|
+
# Get project root
|
|
275
|
+
local project_root=$(git rev-parse --show-toplevel 2>/dev/null || pwd)
|
|
276
|
+
|
|
277
|
+
# Determine if this is a project-level strategy
|
|
278
|
+
local is_project_level=false
|
|
279
|
+
if [[ "$strategy" =~ ^project- ]] || [ "$strategy" = "http-api" ]; then
|
|
280
|
+
is_project_level=true
|
|
281
|
+
fi
|
|
282
|
+
|
|
283
|
+
# Calculate output path
|
|
284
|
+
local output_path
|
|
285
|
+
if [ "$is_project_level" = true ]; then
|
|
286
|
+
# Project-level docs go to project root
|
|
287
|
+
if [ "$strategy" = "http-api" ]; then
|
|
288
|
+
output_path="$project_root/.workflow/docs/$project_name/api"
|
|
289
|
+
else
|
|
290
|
+
output_path="$project_root/.workflow/docs/$project_name"
|
|
291
|
+
fi
|
|
292
|
+
else
|
|
293
|
+
output_path=$(calculate_output_path "$source_path" "$project_name" "$project_root")
|
|
294
|
+
fi
|
|
295
|
+
|
|
296
|
+
# Create output directory
|
|
297
|
+
mkdir -p "$output_path"
|
|
298
|
+
|
|
299
|
+
# Detect folder type (only for module-level strategies)
|
|
300
|
+
local folder_type=""
|
|
301
|
+
if [ "$is_project_level" = false ]; then
|
|
302
|
+
folder_type=$(detect_folder_type "$source_path" "$exclusion_filters")
|
|
303
|
+
fi
|
|
304
|
+
|
|
305
|
+
# Load templates based on strategy
|
|
306
|
+
local api_template=""
|
|
307
|
+
local readme_template=""
|
|
308
|
+
local template_content=""
|
|
309
|
+
|
|
310
|
+
if [ "$is_project_level" = true ]; then
|
|
311
|
+
# Project-level templates
|
|
312
|
+
case "$strategy" in
|
|
313
|
+
project-readme)
|
|
314
|
+
local proj_readme_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/project-readme.txt"
|
|
315
|
+
if [ -f "$proj_readme_path" ]; then
|
|
316
|
+
template_content=$(cat "$proj_readme_path")
|
|
317
|
+
echo " 📋 Loaded Project README template: $(wc -l < "$proj_readme_path") lines"
|
|
318
|
+
fi
|
|
319
|
+
;;
|
|
320
|
+
project-architecture)
|
|
321
|
+
local arch_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/project-architecture.txt"
|
|
322
|
+
local examples_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/project-examples.txt"
|
|
323
|
+
if [ -f "$arch_path" ]; then
|
|
324
|
+
template_content=$(cat "$arch_path")
|
|
325
|
+
echo " 📋 Loaded Architecture template: $(wc -l < "$arch_path") lines"
|
|
326
|
+
fi
|
|
327
|
+
if [ -f "$examples_path" ]; then
|
|
328
|
+
template_content="$template_content
|
|
329
|
+
|
|
330
|
+
EXAMPLES TEMPLATE:
|
|
331
|
+
$(cat "$examples_path")"
|
|
332
|
+
echo " 📋 Loaded Examples template: $(wc -l < "$examples_path") lines"
|
|
333
|
+
fi
|
|
334
|
+
;;
|
|
335
|
+
http-api)
|
|
336
|
+
local api_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/api.txt"
|
|
337
|
+
if [ -f "$api_path" ]; then
|
|
338
|
+
template_content=$(cat "$api_path")
|
|
339
|
+
echo " 📋 Loaded HTTP API template: $(wc -l < "$api_path") lines"
|
|
340
|
+
fi
|
|
341
|
+
;;
|
|
342
|
+
esac
|
|
343
|
+
else
|
|
344
|
+
# Module-level templates
|
|
345
|
+
local api_template_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/api.txt"
|
|
346
|
+
local readme_template_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/module-readme.txt"
|
|
347
|
+
local nav_template_path="$HOME/.claude/workflows/cli-templates/prompts/documentation/folder-navigation.txt"
|
|
348
|
+
|
|
349
|
+
if [ "$folder_type" = "code" ]; then
|
|
350
|
+
if [ -f "$api_template_path" ]; then
|
|
351
|
+
api_template=$(cat "$api_template_path")
|
|
352
|
+
echo " 📋 Loaded API template: $(wc -l < "$api_template_path") lines"
|
|
353
|
+
fi
|
|
354
|
+
if [ -f "$readme_template_path" ]; then
|
|
355
|
+
readme_template=$(cat "$readme_template_path")
|
|
356
|
+
echo " 📋 Loaded README template: $(wc -l < "$readme_template_path") lines"
|
|
357
|
+
fi
|
|
358
|
+
else
|
|
359
|
+
# Navigation folder uses navigation template
|
|
360
|
+
if [ -f "$nav_template_path" ]; then
|
|
361
|
+
readme_template=$(cat "$nav_template_path")
|
|
362
|
+
echo " 📋 Loaded Navigation template: $(wc -l < "$nav_template_path") lines"
|
|
363
|
+
fi
|
|
364
|
+
fi
|
|
365
|
+
fi
|
|
366
|
+
|
|
367
|
+
# Scan directory structure (only for module-level strategies)
|
|
368
|
+
local structure_info=""
|
|
369
|
+
if [ "$is_project_level" = false ]; then
|
|
370
|
+
echo " 🔍 Scanning directory structure..."
|
|
371
|
+
structure_info=$(scan_directory_structure "$source_path" "$strategy")
|
|
372
|
+
fi
|
|
373
|
+
|
|
374
|
+
# Prepare logging info
|
|
375
|
+
local module_name=$(basename "$source_path")
|
|
376
|
+
|
|
377
|
+
echo "⚡ Generating docs: $source_path → $output_path"
|
|
378
|
+
echo " Strategy: $strategy | Tool: $tool | Model: $model | Type: $folder_type"
|
|
379
|
+
echo " Output: $output_path"
|
|
380
|
+
|
|
381
|
+
# Build strategy-specific prompt
|
|
382
|
+
local final_prompt=""
|
|
383
|
+
|
|
384
|
+
# Project-level strategies
|
|
385
|
+
if [ "$strategy" = "project-readme" ]; then
|
|
386
|
+
final_prompt="PURPOSE: Generate comprehensive project overview documentation
|
|
387
|
+
|
|
388
|
+
PROJECT: $project_name
|
|
389
|
+
OUTPUT: Current directory (file will be moved to final location)
|
|
390
|
+
|
|
391
|
+
Read: @.workflow/docs/$project_name/**/*.md
|
|
392
|
+
|
|
393
|
+
Context: All module documentation files from the project
|
|
394
|
+
|
|
395
|
+
Generate ONE documentation file in current directory:
|
|
396
|
+
- README.md - Project root documentation
|
|
397
|
+
|
|
398
|
+
Template:
|
|
399
|
+
$template_content
|
|
400
|
+
|
|
401
|
+
Instructions:
|
|
402
|
+
- Create README.md in CURRENT DIRECTORY
|
|
403
|
+
- Synthesize information from all module docs
|
|
404
|
+
- Include project overview, getting started, and navigation
|
|
405
|
+
- Create clear module navigation with links
|
|
406
|
+
- Follow template structure exactly"
|
|
407
|
+
|
|
408
|
+
elif [ "$strategy" = "project-architecture" ]; then
|
|
409
|
+
final_prompt="PURPOSE: Generate system design and usage examples documentation
|
|
410
|
+
|
|
411
|
+
PROJECT: $project_name
|
|
412
|
+
OUTPUT: Current directory (files will be moved to final location)
|
|
413
|
+
|
|
414
|
+
Read: @.workflow/docs/$project_name/**/*.md
|
|
415
|
+
|
|
416
|
+
Context: All project documentation including module docs and project README
|
|
417
|
+
|
|
418
|
+
Generate TWO documentation files in current directory:
|
|
419
|
+
1. ARCHITECTURE.md - System architecture and design patterns
|
|
420
|
+
2. EXAMPLES.md - End-to-end usage examples
|
|
421
|
+
|
|
422
|
+
Template:
|
|
423
|
+
$template_content
|
|
424
|
+
|
|
425
|
+
Instructions:
|
|
426
|
+
- Create both ARCHITECTURE.md and EXAMPLES.md in CURRENT DIRECTORY
|
|
427
|
+
- Synthesize architectural patterns from module documentation
|
|
428
|
+
- Document system structure, module relationships, and design decisions
|
|
429
|
+
- Provide practical code examples and usage scenarios
|
|
430
|
+
- Follow template structure for both files"
|
|
431
|
+
|
|
432
|
+
elif [ "$strategy" = "http-api" ]; then
|
|
433
|
+
final_prompt="PURPOSE: Generate HTTP API reference documentation
|
|
434
|
+
|
|
435
|
+
PROJECT: $project_name
|
|
436
|
+
OUTPUT: Current directory (file will be moved to final location)
|
|
437
|
+
|
|
438
|
+
Read: @**/*.{ts,js,py,go,rs} @.workflow/docs/$project_name/**/*.md
|
|
439
|
+
|
|
440
|
+
Context: API route files and existing documentation
|
|
441
|
+
|
|
442
|
+
Generate ONE documentation file in current directory:
|
|
443
|
+
- README.md - HTTP API documentation (in api/ subdirectory)
|
|
444
|
+
|
|
445
|
+
Template:
|
|
446
|
+
$template_content
|
|
447
|
+
|
|
448
|
+
Instructions:
|
|
449
|
+
- Create README.md in CURRENT DIRECTORY
|
|
450
|
+
- Document all HTTP endpoints (routes, methods, parameters, responses)
|
|
451
|
+
- Include authentication requirements and error codes
|
|
452
|
+
- Provide request/response examples
|
|
453
|
+
- Follow template structure (Part B: HTTP API documentation)"
|
|
454
|
+
|
|
455
|
+
# Module-level strategies
|
|
456
|
+
elif [ "$strategy" = "full" ]; then
|
|
457
|
+
# Full strategy: read all files, generate for each directory
|
|
458
|
+
if [ "$folder_type" = "code" ]; then
|
|
459
|
+
final_prompt="PURPOSE: Generate comprehensive API and module documentation
|
|
460
|
+
|
|
461
|
+
Directory Structure Analysis:
|
|
462
|
+
$structure_info
|
|
463
|
+
|
|
464
|
+
SOURCE: $source_path
|
|
465
|
+
OUTPUT: Current directory (files will be moved to final location)
|
|
466
|
+
|
|
467
|
+
Read: @**/*
|
|
468
|
+
|
|
469
|
+
Generate TWO documentation files in current directory:
|
|
470
|
+
1. API.md - Code API documentation (functions, classes, interfaces)
|
|
471
|
+
Template:
|
|
472
|
+
$api_template
|
|
473
|
+
|
|
474
|
+
2. README.md - Module overview documentation
|
|
475
|
+
Template:
|
|
476
|
+
$readme_template
|
|
477
|
+
|
|
478
|
+
Instructions:
|
|
479
|
+
- Generate both API.md and README.md in CURRENT DIRECTORY
|
|
480
|
+
- If subdirectories contain code files, generate their docs too (recursive)
|
|
481
|
+
- Work bottom-up: deepest directories first
|
|
482
|
+
- Follow template structure exactly
|
|
483
|
+
- Use structure analysis for context"
|
|
484
|
+
else
|
|
485
|
+
# Navigation folder - README only
|
|
486
|
+
final_prompt="PURPOSE: Generate navigation documentation for folder structure
|
|
487
|
+
|
|
488
|
+
Directory Structure Analysis:
|
|
489
|
+
$structure_info
|
|
490
|
+
|
|
491
|
+
SOURCE: $source_path
|
|
492
|
+
OUTPUT: Current directory (file will be moved to final location)
|
|
493
|
+
|
|
494
|
+
Read: @**/*
|
|
495
|
+
|
|
496
|
+
Generate ONE documentation file in current directory:
|
|
497
|
+
- README.md - Navigation and folder overview
|
|
498
|
+
|
|
499
|
+
Template:
|
|
500
|
+
$readme_template
|
|
501
|
+
|
|
502
|
+
Instructions:
|
|
503
|
+
- Create README.md in CURRENT DIRECTORY
|
|
504
|
+
- Focus on folder structure and navigation
|
|
505
|
+
- Link to subdirectory documentation
|
|
506
|
+
- Use structure analysis for context"
|
|
507
|
+
fi
|
|
508
|
+
else
|
|
509
|
+
# Single strategy: read current + child docs only
|
|
510
|
+
if [ "$folder_type" = "code" ]; then
|
|
511
|
+
final_prompt="PURPOSE: Generate API and module documentation for current directory
|
|
512
|
+
|
|
513
|
+
Directory Structure Analysis:
|
|
514
|
+
$structure_info
|
|
515
|
+
|
|
516
|
+
SOURCE: $source_path
|
|
517
|
+
OUTPUT: Current directory (files will be moved to final location)
|
|
518
|
+
|
|
519
|
+
Read: @*/API.md @*/README.md @*.ts @*.tsx @*.js @*.jsx @*.py @*.sh @*.go @*.rs @*.md @*.json @*.yaml @*.yml
|
|
520
|
+
|
|
521
|
+
Generate TWO documentation files in current directory:
|
|
522
|
+
1. API.md - Code API documentation
|
|
523
|
+
Template:
|
|
524
|
+
$api_template
|
|
525
|
+
|
|
526
|
+
2. README.md - Module overview
|
|
527
|
+
Template:
|
|
528
|
+
$readme_template
|
|
529
|
+
|
|
530
|
+
Instructions:
|
|
531
|
+
- Generate both API.md and README.md in CURRENT DIRECTORY
|
|
532
|
+
- Reference child documentation, do not duplicate
|
|
533
|
+
- Follow template structure
|
|
534
|
+
- Use structure analysis for current directory context"
|
|
535
|
+
else
|
|
536
|
+
# Navigation folder - README only
|
|
537
|
+
final_prompt="PURPOSE: Generate navigation documentation
|
|
538
|
+
|
|
539
|
+
Directory Structure Analysis:
|
|
540
|
+
$structure_info
|
|
541
|
+
|
|
542
|
+
SOURCE: $source_path
|
|
543
|
+
OUTPUT: Current directory (file will be moved to final location)
|
|
544
|
+
|
|
545
|
+
Read: @*/API.md @*/README.md @*.md
|
|
546
|
+
|
|
547
|
+
Generate ONE documentation file in current directory:
|
|
548
|
+
- README.md - Navigation and overview
|
|
549
|
+
|
|
550
|
+
Template:
|
|
551
|
+
$readme_template
|
|
552
|
+
|
|
553
|
+
Instructions:
|
|
554
|
+
- Create README.md in CURRENT DIRECTORY
|
|
555
|
+
- Link to child documentation
|
|
556
|
+
- Use structure analysis for navigation context"
|
|
557
|
+
fi
|
|
558
|
+
fi
|
|
559
|
+
|
|
560
|
+
# Execute documentation generation
|
|
561
|
+
local start_time=$(date +%s)
|
|
562
|
+
echo " 🔄 Starting documentation generation..."
|
|
563
|
+
|
|
564
|
+
if cd "$source_path" 2>/dev/null; then
|
|
565
|
+
local tool_result=0
|
|
566
|
+
|
|
567
|
+
# Store current output path for CLI context
|
|
568
|
+
export DOC_OUTPUT_PATH="$output_path"
|
|
569
|
+
|
|
570
|
+
# Record git HEAD before CLI execution (to detect unwanted auto-commits)
|
|
571
|
+
local git_head_before=""
|
|
572
|
+
if git rev-parse --git-dir >/dev/null 2>&1; then
|
|
573
|
+
git_head_before=$(git rev-parse HEAD 2>/dev/null)
|
|
574
|
+
fi
|
|
575
|
+
|
|
576
|
+
# Execute with selected tool
|
|
577
|
+
case "$tool" in
|
|
578
|
+
qwen)
|
|
579
|
+
if [ "$model" = "coder-model" ]; then
|
|
580
|
+
qwen -p "$final_prompt" --yolo 2>&1
|
|
581
|
+
else
|
|
582
|
+
qwen -p "$final_prompt" -m "$model" --yolo 2>&1
|
|
583
|
+
fi
|
|
584
|
+
tool_result=$?
|
|
585
|
+
;;
|
|
586
|
+
codex)
|
|
587
|
+
codex --full-auto exec "$final_prompt" -m "$model" --skip-git-repo-check -s danger-full-access 2>&1
|
|
588
|
+
tool_result=$?
|
|
589
|
+
;;
|
|
590
|
+
gemini)
|
|
591
|
+
gemini -p "$final_prompt" -m "$model" --yolo 2>&1
|
|
592
|
+
tool_result=$?
|
|
593
|
+
;;
|
|
594
|
+
*)
|
|
595
|
+
echo " ⚠️ Unknown tool: $tool, defaulting to gemini"
|
|
596
|
+
gemini -p "$final_prompt" -m "$model" --yolo 2>&1
|
|
597
|
+
tool_result=$?
|
|
598
|
+
;;
|
|
599
|
+
esac
|
|
600
|
+
|
|
601
|
+
# Move generated files to output directory
|
|
602
|
+
local docs_created=0
|
|
603
|
+
local moved_files=""
|
|
604
|
+
|
|
605
|
+
if [ $tool_result -eq 0 ]; then
|
|
606
|
+
if [ "$is_project_level" = true ]; then
|
|
607
|
+
# Project-level documentation files
|
|
608
|
+
case "$strategy" in
|
|
609
|
+
project-readme)
|
|
610
|
+
if [ -f "README.md" ]; then
|
|
611
|
+
mv "README.md" "$output_path/README.md" 2>/dev/null && {
|
|
612
|
+
docs_created=$((docs_created + 1))
|
|
613
|
+
moved_files+="README.md "
|
|
614
|
+
}
|
|
615
|
+
fi
|
|
616
|
+
;;
|
|
617
|
+
project-architecture)
|
|
618
|
+
if [ -f "ARCHITECTURE.md" ]; then
|
|
619
|
+
mv "ARCHITECTURE.md" "$output_path/ARCHITECTURE.md" 2>/dev/null && {
|
|
620
|
+
docs_created=$((docs_created + 1))
|
|
621
|
+
moved_files+="ARCHITECTURE.md "
|
|
622
|
+
}
|
|
623
|
+
fi
|
|
624
|
+
if [ -f "EXAMPLES.md" ]; then
|
|
625
|
+
mv "EXAMPLES.md" "$output_path/EXAMPLES.md" 2>/dev/null && {
|
|
626
|
+
docs_created=$((docs_created + 1))
|
|
627
|
+
moved_files+="EXAMPLES.md "
|
|
628
|
+
}
|
|
629
|
+
fi
|
|
630
|
+
;;
|
|
631
|
+
http-api)
|
|
632
|
+
if [ -f "README.md" ]; then
|
|
633
|
+
mv "README.md" "$output_path/README.md" 2>/dev/null && {
|
|
634
|
+
docs_created=$((docs_created + 1))
|
|
635
|
+
moved_files+="api/README.md "
|
|
636
|
+
}
|
|
637
|
+
fi
|
|
638
|
+
;;
|
|
639
|
+
esac
|
|
640
|
+
else
|
|
641
|
+
# Module-level documentation files
|
|
642
|
+
# Check and move API.md if it exists
|
|
643
|
+
if [ "$folder_type" = "code" ] && [ -f "API.md" ]; then
|
|
644
|
+
mv "API.md" "$output_path/API.md" 2>/dev/null && {
|
|
645
|
+
docs_created=$((docs_created + 1))
|
|
646
|
+
moved_files+="API.md "
|
|
647
|
+
}
|
|
648
|
+
fi
|
|
649
|
+
|
|
650
|
+
# Check and move README.md if it exists
|
|
651
|
+
if [ -f "README.md" ]; then
|
|
652
|
+
mv "README.md" "$output_path/README.md" 2>/dev/null && {
|
|
653
|
+
docs_created=$((docs_created + 1))
|
|
654
|
+
moved_files+="README.md "
|
|
655
|
+
}
|
|
656
|
+
fi
|
|
657
|
+
fi
|
|
658
|
+
fi
|
|
659
|
+
|
|
660
|
+
# Check if CLI tool auto-committed (and revert if needed)
|
|
661
|
+
if [ -n "$git_head_before" ]; then
|
|
662
|
+
local git_head_after=$(git rev-parse HEAD 2>/dev/null)
|
|
663
|
+
if [ "$git_head_before" != "$git_head_after" ]; then
|
|
664
|
+
echo " ⚠️ Detected unwanted auto-commit by CLI tool, reverting..."
|
|
665
|
+
git reset --soft "$git_head_before" 2>/dev/null
|
|
666
|
+
echo " ✅ Auto-commit reverted (files remain staged)"
|
|
667
|
+
fi
|
|
668
|
+
fi
|
|
669
|
+
|
|
670
|
+
if [ $docs_created -gt 0 ]; then
|
|
671
|
+
local end_time=$(date +%s)
|
|
672
|
+
local duration=$((end_time - start_time))
|
|
673
|
+
echo " ✅ Generated $docs_created doc(s) in ${duration}s: $moved_files"
|
|
674
|
+
cd - > /dev/null
|
|
675
|
+
return 0
|
|
676
|
+
else
|
|
677
|
+
echo " ❌ Documentation generation failed for $source_path"
|
|
678
|
+
cd - > /dev/null
|
|
679
|
+
return 1
|
|
680
|
+
fi
|
|
681
|
+
else
|
|
682
|
+
echo " ❌ Cannot access directory: $source_path"
|
|
683
|
+
return 1
|
|
684
|
+
fi
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
# Execute function if script is run directly
|
|
688
|
+
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
|
|
689
|
+
# Show help if no arguments or help requested
|
|
690
|
+
if [ $# -eq 0 ] || [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
|
691
|
+
echo "Usage: generate_module_docs.sh <strategy> <source_path> <project_name> [tool] [model]"
|
|
692
|
+
echo ""
|
|
693
|
+
echo "Module-Level Strategies:"
|
|
694
|
+
echo " full - Generate docs for all subdirectories with code"
|
|
695
|
+
echo " single - Generate docs only for current directory"
|
|
696
|
+
echo ""
|
|
697
|
+
echo "Project-Level Strategies:"
|
|
698
|
+
echo " project-readme - Generate project root README.md"
|
|
699
|
+
echo " project-architecture - Generate ARCHITECTURE.md + EXAMPLES.md"
|
|
700
|
+
echo " http-api - Generate HTTP API documentation (api/README.md)"
|
|
701
|
+
echo ""
|
|
702
|
+
echo "Tools: gemini (default), qwen, codex"
|
|
703
|
+
echo "Models: Use tool defaults if not specified"
|
|
704
|
+
echo ""
|
|
705
|
+
echo "Module Examples:"
|
|
706
|
+
echo " ./generate_module_docs.sh full ./src/auth myproject"
|
|
707
|
+
echo " ./generate_module_docs.sh single ./components myproject gemini"
|
|
708
|
+
echo ""
|
|
709
|
+
echo "Project Examples:"
|
|
710
|
+
echo " ./generate_module_docs.sh project-readme . myproject"
|
|
711
|
+
echo " ./generate_module_docs.sh project-architecture . myproject qwen"
|
|
712
|
+
echo " ./generate_module_docs.sh http-api . myproject"
|
|
713
|
+
exit 0
|
|
714
|
+
fi
|
|
715
|
+
|
|
716
|
+
generate_module_docs "$@"
|
|
717
|
+
fi
|