@mthanhlm/autodev 0.2.0 → 0.2.2

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/PUBLISH.md CHANGED
@@ -26,7 +26,7 @@ npm pack
26
26
  Check the tarball contents:
27
27
 
28
28
  ```bash
29
- tar -tf mthanhlm-autodev-0.2.0.tgz
29
+ tar -tf mthanhlm-autodev-0.2.2.tgz
30
30
  ```
31
31
 
32
32
  ## First Public Publish
@@ -328,7 +328,8 @@ function buildRoute(cwd) {
328
328
  if (!projectExists) {
329
329
  return {
330
330
  kind: 'init_project',
331
- command: '/autodev-new-project',
331
+ command: '/autodev',
332
+ manualCommand: '/autodev-new-project',
332
333
  reason: existingCodebase ? 'existing_code_detected_without_project_state' : 'project_state_missing',
333
334
  projectType
334
335
  };
@@ -337,7 +338,8 @@ function buildRoute(cwd) {
337
338
  if (projectType === 'brownfield' && !codebaseMapExists) {
338
339
  return {
339
340
  kind: 'explore_codebase',
340
- command: '/autodev-explore-codebase',
341
+ command: '/autodev',
342
+ manualCommand: '/autodev-explore-codebase',
341
343
  reason: 'brownfield_project_needs_codebase_map',
342
344
  projectType
343
345
  };
@@ -347,6 +349,7 @@ function buildRoute(cwd) {
347
349
  return {
348
350
  kind: 'track_select',
349
351
  command: '/autodev',
352
+ manualCommand: null,
350
353
  reason: tracks.length > 0 ? 'no_active_track_selected' : 'no_tracks_created',
351
354
  projectType
352
355
  };
@@ -357,6 +360,7 @@ function buildRoute(cwd) {
357
360
  return {
358
361
  kind: 'track_setup',
359
362
  command: '/autodev',
363
+ manualCommand: null,
360
364
  reason: 'active_track_missing_required_artifacts',
361
365
  projectType,
362
366
  trackSlug: activeTrack
@@ -368,6 +372,7 @@ function buildRoute(cwd) {
368
372
  return {
369
373
  kind: 'track_setup',
370
374
  command: '/autodev',
375
+ manualCommand: null,
371
376
  reason: 'active_track_has_no_phases',
372
377
  projectType,
373
378
  trackSlug: activeTrack
@@ -378,7 +383,8 @@ function buildRoute(cwd) {
378
383
  if (nextReview && config.workflow.review_after_execute !== false) {
379
384
  return {
380
385
  kind: 'review_phase',
381
- command: `/autodev-review-phase ${nextReview.number}`,
386
+ command: '/autodev',
387
+ manualCommand: `/autodev-review-phase ${nextReview.number}`,
382
388
  reason: 'phase_executed_but_not_reviewed',
383
389
  projectType,
384
390
  trackSlug: activeTrack,
@@ -390,7 +396,8 @@ function buildRoute(cwd) {
390
396
  if (nextVerify) {
391
397
  return {
392
398
  kind: 'verify_phase',
393
- command: `/autodev-verify-work ${nextVerify.number}`,
399
+ command: '/autodev',
400
+ manualCommand: `/autodev-verify-work ${nextVerify.number}`,
394
401
  reason: 'phase_reviewed_but_not_verified',
395
402
  projectType,
396
403
  trackSlug: activeTrack,
@@ -402,7 +409,8 @@ function buildRoute(cwd) {
402
409
  if (nextExecute) {
403
410
  return {
404
411
  kind: 'execute_phase',
405
- command: `/autodev-execute-phase ${nextExecute.number}`,
412
+ command: '/autodev',
413
+ manualCommand: `/autodev-execute-phase ${nextExecute.number}`,
406
414
  reason: 'phase_planned_but_not_executed',
407
415
  projectType,
408
416
  trackSlug: activeTrack,
@@ -414,7 +422,8 @@ function buildRoute(cwd) {
414
422
  if (nextPlan) {
415
423
  return {
416
424
  kind: 'plan_phase',
417
- command: `/autodev-plan-phase ${nextPlan.number}`,
425
+ command: '/autodev',
426
+ manualCommand: `/autodev-plan-phase ${nextPlan.number}`,
418
427
  reason: 'phase_not_planned',
419
428
  projectType,
420
429
  trackSlug: activeTrack,
@@ -424,7 +433,8 @@ function buildRoute(cwd) {
424
433
 
425
434
  return {
426
435
  kind: 'track_complete',
427
- command: '/autodev-cleanup',
436
+ command: '/autodev',
437
+ manualCommand: '/autodev-cleanup',
428
438
  reason: 'active_track_fully_verified',
429
439
  projectType,
430
440
  trackSlug: activeTrack
@@ -460,7 +470,8 @@ function buildProgress(cwd) {
460
470
  verified: phases.filter(phase => phase.uatExists).length
461
471
  },
462
472
  route,
463
- nextCommand: route.command
473
+ nextCommand: route.command,
474
+ manualNextCommand: route.manualCommand || null
464
475
  };
465
476
  }
466
477
 
@@ -482,10 +493,11 @@ function renderProgressTable(progress) {
482
493
  `Reviewed: ${progress.counts.reviewed}`,
483
494
  `Verified: ${progress.counts.verified}`,
484
495
  `Next: ${progress.route.command}`,
496
+ progress.route.manualCommand ? `Manual Shortcut: ${progress.route.manualCommand}` : null,
485
497
  '',
486
498
  '| Phase | Type | Name | Plan | Summary | Review | UAT | Status |',
487
499
  '| --- | --- | --- | --- | --- | --- | --- | --- |'
488
- ];
500
+ ].filter(Boolean);
489
501
 
490
502
  for (const phase of progress.phases) {
491
503
  lines.push(
@@ -514,6 +526,67 @@ function codebasePaths(cwd) {
514
526
  return Object.fromEntries(CODEBASE_FILES.map(name => [name.replace(/\.md$/, ''), path.join(codebaseDir, name)]));
515
527
  }
516
528
 
529
+ function buildStatus(cwd) {
530
+ const paths = rootPaths(cwd);
531
+ const route = buildRoute(cwd);
532
+ const config = loadConfig(cwd);
533
+ const existingCodebase = detectExistingCodebase(cwd);
534
+ const projectType = config.project.type || (existingCodebase ? 'brownfield' : 'greenfield');
535
+ const activeTrack = readActiveTrack(cwd);
536
+ const tracks = listTracks(cwd);
537
+
538
+ return {
539
+ cwd,
540
+ autodev_exists: fileExists(paths.root),
541
+ project_exists: fileExists(paths.project),
542
+ existing_code_detected: existingCodebase,
543
+ project_type: projectType,
544
+ project_path: paths.project,
545
+ project_state_path: paths.state,
546
+ active_track_path: paths.activeTrack,
547
+ active_track: activeTrack,
548
+ track_count: tracks.length,
549
+ tracks: tracks.map(track => ({
550
+ slug: track.slug,
551
+ name: track.name,
552
+ active: track.active
553
+ })),
554
+ codebase_map_exists: fileExists(paths.codebaseSummary),
555
+ route
556
+ };
557
+ }
558
+
559
+ function buildCleanupPayload(cwd) {
560
+ const paths = rootPaths(cwd);
561
+ const route = buildRoute(cwd);
562
+ const activeTrack = readActiveTrack(cwd);
563
+ const track = trackPaths(cwd, activeTrack);
564
+ const phases = activeTrack ? listPhases(cwd, activeTrack) : [];
565
+ const verifiedPhases = phases.filter(phase => phase.uatExists);
566
+ const completedPhases = phases.filter(phase => phase.summaryExists || phase.reviewExists || phase.uatExists);
567
+
568
+ return {
569
+ cwd,
570
+ autodev_exists: fileExists(paths.root),
571
+ project_exists: fileExists(paths.project),
572
+ project_state_path: paths.state,
573
+ active_track_path: paths.activeTrack,
574
+ active_track: activeTrack,
575
+ track_path: track ? track.dir : null,
576
+ track_state_path: track ? track.state : null,
577
+ phases_dir: track ? track.phasesDir : null,
578
+ archive_root: path.join(paths.root, 'archive'),
579
+ route,
580
+ phase_counts: {
581
+ total: phases.length,
582
+ completed: completedPhases.length,
583
+ verified: verifiedPhases.length
584
+ },
585
+ verified_phase_numbers: verifiedPhases.map(phase => phase.number),
586
+ verified_phase_dirs: verifiedPhases.map(phase => phase.dir)
587
+ };
588
+ }
589
+
517
590
  function initPayload(cwd, mode, requestedPhase) {
518
591
  const paths = rootPaths(cwd);
519
592
  const config = loadConfig(cwd);
@@ -614,6 +687,16 @@ function main() {
614
687
  return;
615
688
  }
616
689
 
690
+ if (command === 'status') {
691
+ printJson(buildStatus(cwd));
692
+ return;
693
+ }
694
+
695
+ if (command === 'cleanup') {
696
+ printJson(buildCleanupPayload(cwd));
697
+ return;
698
+ }
699
+
617
700
  if (command === 'route') {
618
701
  const mode = rest[0] || 'json';
619
702
  const route = buildRoute(cwd);
@@ -646,8 +729,10 @@ if (require.main === module) {
646
729
 
647
730
  module.exports = {
648
731
  autodevDir,
732
+ buildCleanupPayload,
649
733
  buildProgress,
650
734
  buildRoute,
735
+ buildStatus,
651
736
  detectExistingCodebase,
652
737
  initPayload,
653
738
  listPhases,
@@ -14,10 +14,10 @@ Use `/autodev` as the single entrypoint for the normal workflow. Route automatic
14
14
  1. Run:
15
15
 
16
16
  ```bash
17
- node "$HOME/.claude/autodev/bin/autodev-tools.cjs" init autodev
17
+ node "$HOME/.claude/autodev/bin/autodev-tools.cjs" status
18
18
  ```
19
19
 
20
- 2. Inspect the returned `route.kind`, `project_type`, `tracks`, and active phase data.
20
+ 2. Inspect the returned `route.kind`, `project_type`, `tracks`, and active track data.
21
21
 
22
22
  3. Route as follows, and complete the selected workflow in the same turn:
23
23
  - `init_project`: perform the new-project workflow.
@@ -27,7 +27,9 @@ node "$HOME/.claude/autodev/bin/autodev-tools.cjs" init autodev
27
27
  - `review_phase`: perform the review-phase workflow.
28
28
  - `verify_phase`: perform the verify-work workflow.
29
29
 
30
- 4. If the route is `track_select` or `track_setup`, handle it directly:
30
+ 4. Do not stop after identifying a brownfield codebase route. If the route is `explore_codebase`, perform the exploration as part of the same `/autodev` run instead of telling the user to switch commands.
31
+
32
+ 5. If the route is `track_select` or `track_setup`, handle it directly:
31
33
  - If tracks exist, ask whether to continue one of them or create a new track.
32
34
  - If no tracks exist, ask only for the current initiative name, desired outcome, and likely phase types.
33
35
  - Create or repair:
@@ -45,18 +47,18 @@ node "$HOME/.claude/autodev/bin/autodev-tools.cjs" init autodev
45
47
 
46
48
  - After track setup, continue in the same turn by re-running the route logic mentally and executing the next step.
47
49
 
48
- 5. If the route is `track_complete`, ask whether the user wants to:
50
+ 6. If the route is `track_complete`, ask whether the user wants to:
49
51
  - start a new track
50
52
  - run cleanup
51
53
  - stop here
52
54
 
53
- 6. When the user chooses a new track at step 5, create it immediately and continue routing in the same turn.
55
+ 7. When the user chooses a new track at step 6, create it immediately and continue routing in the same turn.
54
56
 
55
- 7. Every time you finish a routed step, keep both project-level and track-level state aligned. Default the state files to `Next Command: /autodev`.
57
+ 8. Every time you finish a routed step, keep both project-level and track-level state aligned. Default the state files to `Next Command: /autodev`.
56
58
 
57
- 8. End with:
59
+ 9. End with:
58
60
  - what step you completed
59
61
  - the current route reason in plain language
60
62
  - `/autodev` as the default next command
61
- - the matching manual shortcut when useful
63
+ - the matching manual shortcut only as an optional escape hatch
62
64
  </process>
@@ -13,12 +13,13 @@ Clean or archive autodev state without flags. Prefer preserving useful project c
13
13
  1. Run:
14
14
 
15
15
  ```bash
16
- node "$HOME/.claude/autodev/bin/autodev-tools.cjs" init autodev
16
+ node "$HOME/.claude/autodev/bin/autodev-tools.cjs" cleanup
17
17
  ```
18
18
 
19
19
  2. If no `.autodev/` project exists, stop and say there is nothing to clean.
20
20
 
21
- 3. Ask the user to choose one action:
21
+ 3. Use the `AskUserQuestion` tool for the choice below. Do not ask this in plain assistant text.
22
+ Ask the user to choose one action:
22
23
  - archive completed phase artifacts only
23
24
  - archive the current track and clear the active selection
24
25
  - delete all `.autodev/` state
@@ -35,7 +36,7 @@ node "$HOME/.claude/autodev/bin/autodev-tools.cjs" init autodev
35
36
  - update `.autodev/STATE.md` to `Current Step: track-selection` and `Next Command: /autodev`
36
37
 
37
38
  6. For `delete all .autodev state`:
38
- - ask the user to type `DELETE AUTODEV`
39
+ - use the `AskUserQuestion` tool to ask the user to type `DELETE AUTODEV`
39
40
  - only then remove `.autodev/`
40
41
 
41
42
  7. End with:
@@ -53,5 +53,5 @@ node "$HOME/.claude/autodev/bin/autodev-tools.cjs" init explore-codebase
53
53
  - the biggest structural insight
54
54
  - the biggest risk
55
55
  - `/autodev` as the next command
56
- - `/autodev-plan-phase <n>` as the manual shortcut when obvious
56
+ - `/autodev-plan-phase <n>` only as the optional manual shortcut when obvious
57
57
  </process>
@@ -83,7 +83,7 @@ Each phase must include:
83
83
  - `Next Command: /autodev`
84
84
  - current ISO timestamp
85
85
 
86
- 13. If the project is brownfield, do not fake a codebase map. Leave that for `/autodev-explore-codebase`, and make that the default next step. Otherwise, the next step is planning phase 1.
86
+ 13. If the project is brownfield, do not fake a codebase map. Continue into codebase exploration inside `/autodev` by default. Mention `/autodev-explore-codebase` only as a manual shortcut. Otherwise, the next step is planning phase 1 through `/autodev`.
87
87
 
88
88
  14. End with a short summary and direct the user to `/autodev`. Mention the manual shortcut only if useful.
89
89
  </process>
@@ -13,5 +13,5 @@ node "$HOME/.claude/autodev/bin/autodev-tools.cjs" progress table
13
13
 
14
14
  3. If a project exists, add one short line after the table with:
15
15
  - `/autodev` as the default next command
16
- - the routed manual shortcut from the table when useful
16
+ - the routed manual shortcut from the table only when useful
17
17
  </process>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mthanhlm/autodev",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "A lean Claude Code workflow system with a single entrypoint, brownfield codebase mapping, and read-only git.",
5
5
  "bin": {
6
6
  "autodev": "bin/install.js"