Skip to content

Commit be7cf95

Browse files
authored
Merge pull request #37 from itsflaid/codex/add-onboarding-command
Improve onboarding guide generation
2 parents 4d79a99 + ad38cc7 commit be7cf95

18 files changed

Lines changed: 1786 additions & 43 deletions

PRD.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -618,7 +618,7 @@ DevMap automatically detects the language used by the user.
618618

619619
- `devmap ask`
620620
- `devmap explain` *(future)*
621-
- `devmap onboard` *(future)*
621+
- `devmap onboarding`
622622
- `devmap docs` *(future)*
623623

624624
### CLI Metadata
@@ -1072,7 +1072,7 @@ Future CI should test:
10721072

10731073
| Command | Phase | Priority |
10741074
|---|---|---|
1075-
| `devmap onboard` | Phase 3 | High |
1075+
| `devmap onboarding` | MVP 0.1.0 candidate | High |
10761076
| `devmap docs` | Phase 3 | Medium |
10771077
| `devmap flow` | Phase 4 | Medium |
10781078
| `devmap trace` | Phase 4 | Medium |
@@ -1083,7 +1083,7 @@ Future CI should test:
10831083

10841084
---
10851085

1086-
### `devmap onboard` *(Phase 3 — High Priority)*
1086+
### `devmap onboarding` *(MVP 0.1.0 Candidate)*
10871087

10881088
Purpose: developer productivity accelerator.
10891089

@@ -1120,7 +1120,8 @@ docs/
11201120
```
11211121

11221122
`devmap docs` generates documentation artifacts.
1123-
`devmap onboard` generates a learning/productivity guide.
1123+
`devmap onboarding` generates a learning/productivity guide from the current
1124+
snapshot. `devmap onboard` remains a shorthand alias.
11241125

11251126
These are related but not the same.
11261127

README.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ snapshot.json
105105
| `DEVMAP.md` | DevMap instructions |
106106
| `AGENTS.md` | AI agent entry point |
107107
| `.devmap/snapshot.json` | Core project context |
108+
| `ONBOARDING.md` | Optional onboarding guide |
108109

109110
The snapshot is the primary output of DevMap.
110111

@@ -136,13 +137,19 @@ devmap analyze
136137
# Verify your setup
137138
devmap doctor
138139

140+
# Generate a reading guide from the snapshot
141+
devmap onboarding
142+
devmap onboarding --write
143+
devmap onboarding --write --language id
144+
139145
# Ask questions about your codebase
140146
devmap ask "explain the main architecture"
141147
devmap ask "where is the auth logic?"
142148
devmap ask "what external services does this use?"
143149

144150
# Machine-readable output for AI agents and scripts
145151
devmap ask "where is the auth logic?" --json
152+
devmap onboarding --json
146153
```
147154

148155
---
@@ -295,19 +302,19 @@ Node.js 18+
295302
* [x] `devmap init`
296303
* [x] `devmap analyze`
297304
* [x] `devmap ask`
305+
* [x] `devmap onboarding`
298306
* [x] `devmap doctor`
299307

300308
### Next
301309

302-
* [ ] `devmap onboard`
303310
* [ ] `devmap features`
311+
* [ ] `devmap flow`
304312
* [ ] OpenAI provider
305313
* [ ] Gemini provider
306314

307315
### Later
308316

309317
* [ ] `devmap explain`
310-
* [ ] `devmap flow`
311318
* [ ] `devmap docs`
312319
* [ ] Local AI mode
313320
* [ ] VS Code Extension

docs/commands.md

Lines changed: 85 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,17 @@
66

77
## Overview
88

9-
DevMap MVP provides four core project commands and one configuration command:
9+
DevMap MVP provides five core project commands and one configuration command:
1010

1111
* `devmap init`
12-
* `devmap analyze`
13-
* `devmap ask`
12+
* `devmap analyze`
13+
* `devmap ask`
14+
* `devmap onboarding`
1415
* `devmap doctor`
1516
* `devmap config model`
1617

17-
No additional product commands should be added until the MVP is shipped.
18+
Additional product commands should wait until the MVP is shipped unless the PRD
19+
explicitly promotes them into the `0.1.0` scope.
1820

1921
Future commands are documented in:
2022

@@ -395,9 +397,9 @@ Running quick analysis first...
395397

396398
Then continue answering the question.
397399

398-
### Stale Snapshot Behavior
399-
400-
If project files changed after last analyze:
400+
### Stale Snapshot Behavior
401+
402+
If project files changed after last analyze:
401403

402404
```txt
403405
Project changed since last analyze.
@@ -407,12 +409,78 @@ Use existing snapshot or re-analyze first?
407409
[1] Use existing snapshot
408410
[2] Re-analyze now
409411
```
410-
411-
---
412-
412+
413+
---
414+
415+
## `devmap onboarding`
416+
417+
Generate a project onboarding guide from the current snapshot.
418+
419+
Alias: `devmap onboard`
420+
421+
### Purpose
422+
423+
`devmap onboarding` turns `.devmap/snapshot.json` into a practical reading
424+
guide for humans and AI agents. It should help answer:
425+
426+
> Where should I start reading this project?
427+
428+
### Usage
429+
430+
```bash
431+
devmap onboarding
432+
devmap onboarding --write
433+
devmap onboarding --write --language id
434+
devmap onboarding --json
435+
```
436+
437+
### Responsibilities
438+
439+
* Read `.devmap/snapshot.json`
440+
* Use `project`, `onboarding.recommendedPath`, `features`, `flows`,
441+
`criticalFiles`, and `changeImpact`
442+
* Include a concise project narrative from snapshot facts, with a trimmed
443+
architecture note when useful
444+
* Surface entry points, external services, and critical files before the
445+
reading path
446+
* Print a readable terminal guide by default
447+
* Show a follow-up hint explaining that `--write` creates `ONBOARDING.md`
448+
* Write `ONBOARDING.md` when `--write` is passed
449+
* Ask for Indonesian or English when writing from an interactive terminal and
450+
no language is provided
451+
* Use `--language en` or `--language id` to skip the prompt
452+
* Emit one structured JSON document when `--json` is passed
453+
* Warn when the snapshot is stale
454+
455+
### Output Sections
456+
457+
1. What This Project Does
458+
2. Mental Model
459+
3. Main Concepts
460+
4. Important Areas to Understand
461+
5. Key Flows
462+
6. Where to Start
463+
464+
### Rules
465+
466+
* Do not invent files that are not present in the snapshot
467+
* Prefer snapshot-derived paths over generic advice
468+
* Avoid placeholder wording such as `not inferred yet`; omit unavailable fields
469+
* Explain what each important file is responsible for and why it should be read
470+
* Avoid raw metadata dumps such as scores, import counts, and exported symbol
471+
lists in human onboarding output
472+
* Keep the guide useful without requiring an AI call
473+
* Treat `devmap flow` and full docs generation as future commands
474+
* Include snapshot freshness and agent navigation policy in JSON output
475+
* Keep `--json` non-interactive; never prompt in machine-readable mode
476+
* Default generated onboarding language is English; use `--language id` for
477+
Bahasa Indonesia
478+
479+
---
480+
413481
## `devmap doctor`
414-
415-
Run diagnostics for DevMap setup.
482+
483+
Run diagnostics for DevMap setup.
416484

417485
### Purpose
418486

@@ -542,6 +610,7 @@ devmap init --json
542610
devmap analyze --json
543611
devmap analyze --deep --json
544612
devmap ask "where is authentication handled?" --json
613+
devmap onboarding --json
545614
devmap doctor --json
546615
devmap config model auto --json
547616
```
@@ -559,8 +628,9 @@ Contract:
559628
DevMap JSON document
560629

561630
`analyze --json` returns the project snapshot. `ask --json` returns the answer,
562-
selected files, model, and token usage. `doctor --json` returns diagnostics and
563-
issues as structured fields.
631+
selected files, model, and token usage. `onboarding --json` returns guide
632+
metadata and Markdown. `doctor --json` returns diagnostics and issues as
633+
structured fields.
564634

565635
---
566636

@@ -575,8 +645,7 @@ They are not part of the current MVP command scope.
575645
| `devmap features` | Detect implemented project features |
576646
| `devmap explain` | Explain folders, modules, and architecture |
577647
| `devmap flow` | Explain system flows as narrative steps |
578-
| `devmap docs` | Generate project documentation |
579-
| `devmap onboard` | Generate onboarding guide |
648+
| `devmap docs` | Generate project documentation |
580649
| `devmap deadcode` | Detect unused files, exports, and functions |
581650
| `devmap report` | Generate project health report |
582651
| `devmap watch` | Auto-update snapshot on file changes |

docs/design.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,9 +172,10 @@ Start with:
172172
173173
Popular commands:
174174
175-
devmap analyze scan current project
176-
devmap ask "..." ask your codebase
177-
```
175+
devmap analyze scan current project
176+
devmap ask "..." ask your codebase
177+
devmap onboarding generate reading guide
178+
```
178179

179180
---
180181

docs/development-testing.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ Packaged-command verification should include machine-readable output:
77
```bash
88
devmap analyze --json
99
devmap ask "where is the main entry point?" --json
10+
devmap onboarding --json
1011
devmap doctor --json
1112
```
1213

@@ -29,6 +30,8 @@ With a live Groq key, run:
2930
devmap analyze --fresh
3031
devmap ask "explain the main architecture"
3132
devmap ask "explain the main architecture" --json
33+
devmap onboarding
34+
devmap onboarding --write
3235
```
3336

3437
Human output should appear progressively without raw Markdown markers. JSON

docs/for-me-personal/PROGRESS.md

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,27 @@
11
# Progress DevMap
22

3-
Terakhir diperbarui: 2026-06-18
3+
Terakhir diperbarui: 2026-06-19
4+
5+
## Update 2026-06-19
6+
7+
### Onboarding Command
8+
9+
- `devmap onboarding` ditambahkan sebagai kandidat MVP 0.1.0, dengan alias
10+
`devmap onboard`.
11+
- Command membaca `.devmap/snapshot.json` dan menghasilkan guide berbasis
12+
snapshot tanpa membutuhkan AI call.
13+
- Output human berisi Project Overview, Recommended Reading Path, Feature Map,
14+
Important Flows, Change Impact Notes, dan Agent Workflow.
15+
- `devmap onboarding --write` menulis `ONBOARDING.md`.
16+
- `devmap onboarding --json` menghasilkan satu dokumen JSON untuk agent,
17+
editor, atau script.
18+
- README, PRD, command docs, roadmap, design docs, dan CLI README diperbarui
19+
supaya onboarding tidak lagi tercatat sebagai future-only command.
20+
- Renderer onboarding direfaktor menjadi guide pemahaman untuk developer dan
21+
AI agent: pembuka menjelaskan tujuan project, mental model, konsep utama,
22+
area penting untuk dibaca, flow penting, dan rekomendasi mulai membaca.
23+
- Default bahasa onboarding tetap English, sementara `--language id` dan prompt
24+
interaktif `--write` tetap dapat menghasilkan Bahasa Indonesia.
425

526
## Update 2026-06-18
627

docs/for-me-personal/TEST.md

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,51 @@ Ada beberapa versi DevMap yang dapat diuji:
1515
| npm link | CLI global sementara | Menguji command `devmap` dari folder mana pun |
1616
| CI/runtime | OS dan versi Node berbeda | Verifikasi lintas platform sebelum release |
1717

18+
## Onboarding Command
19+
20+
Focused automated test:
21+
22+
```powershell
23+
pnpm --filter devmap exec tsx --test test/onboarding-command.test.ts test/json-output.test.ts
24+
```
25+
26+
Manual source-mode check dari root DevMap:
27+
28+
```powershell
29+
$root = (Get-Location).Path
30+
pnpm dev:cli analyze "$root"
31+
pnpm dev:cli onboarding "$root"
32+
pnpm dev:cli onboarding "$root" --json
33+
pnpm dev:cli onboarding "$root" --write
34+
pnpm dev:cli onboarding "$root" --write --language id
35+
```
36+
37+
Catatan: `pnpm dev:cli` memakai `pnpm --filter devmap`, sehingga command
38+
source-mode berjalan dari `packages/cli`. Untuk mengetes root workspace DevMap,
39+
selalu kirim path target eksplisit seperti contoh di atas.
40+
41+
Expected result:
42+
43+
- `devmap onboarding` membaca `.devmap/snapshot.json` yang sudah ada.
44+
- Jika snapshot belum ada atau stale, jalankan `pnpm dev:cli analyze` dulu.
45+
- Jika snapshot stale, human output memberi warning dan JSON berisi
46+
`snapshot.stale: true`.
47+
- JSON output menyertakan `agentInstructions` agar agent mengikuti policy
48+
snapshot-first.
49+
- Human output berfokus sebagai guide pemahaman, bukan file index: What This
50+
Project Does, Mental Model, Main Concepts, Important Areas to Understand, Key
51+
Flows, dan Where to Start.
52+
- Setiap file penting dalam reading area menyertakan `Purpose` dan
53+
`Why read this`, bukan score/import count/export list mentah.
54+
- Entry point kosong di feature/flow tidak boleh ditampilkan sebagai
55+
`not inferred yet`; field tersebut cukup dihilangkan.
56+
- `--json` menghasilkan satu dokumen JSON tanpa ANSI atau dekorasi terminal.
57+
- `--write` membuat atau memperbarui `ONBOARDING.md` di root project target.
58+
- Di terminal interaktif, `--write` menanyakan bahasa onboarding jika
59+
`--language` belum diberikan. Default bahasa tetap English.
60+
- `--language en` dan `--language id` melewati prompt, cocok untuk automation
61+
dan agent.
62+
1863
## Context Builder Ranking
1964

2065
Jalankan focused test ranking dan evaluation:

docs/roadmap.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,17 +41,19 @@ adding AI on top. If the foundation is wrong, AI output will be wrong too.
4141
- Stale snapshot detection + user prompt
4242
- All error scenarios handled (no raw stack traces)
4343

44-
**Deliverable:** `devmap analyze` with AI interpretation.
45-
`devmap ask` with context-aware answers.
44+
**Deliverable:** `devmap analyze` with AI interpretation,
45+
`devmap ask` with context-aware answers, and `devmap onboarding` for a
46+
snapshot-based reading guide when the output is stable enough for `0.1.0`.
4647

4748
---
4849

4950
## Phase 3 — Documentation Generation
5051
**Goal:** DevMap generates useful project documentation automatically.
5152

5253
**Tasks:**
53-
- `devmap docs` — generate structured markdown docs folder
54-
- `devmap onboard` — generate onboarding guide with reading order
54+
- `devmap docs` — generate structured markdown docs folder
55+
- Expand `devmap onboarding` beyond the MVP guide when richer snapshot fields
56+
are available
5557

5658
**Deliverable:**
5759
```
@@ -118,6 +120,6 @@ Not planned. Not scheduled. Revisit when Phase 5 ships.
118120
| 1.0.0 | 2 | Stable `devmap analyze` + `devmap ask` release |
119121
| 1.1.0 | 2 | Performance improvements, cache optimization |
120122
| 1.2.0 | 2 | Express support solidified |
121-
| 2.0.0 | 3 | `devmap docs` + `devmap onboard` |
123+
| 2.0.0 | 3 | `devmap docs` + expanded onboarding |
122124
| 3.0.0 | 4 | `devmap deadcode` + `devmap flow` + `devmap report` |
123125
| 4.0.0 | 5 | OpenAI + Gemini support |

0 commit comments

Comments
 (0)