docutrack 0.1.1 → 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/README.md +86 -81
- package/bin/docutrack.js +73 -67
- package/package.json +5 -3
- package/src/commands/init.js +245 -80
- package/src/commands/install-global.js +93 -0
- package/src/commands/scan.js +3 -15
- package/src/commands/setup.js +126 -0
- package/src/hooks/global-on-stop.js +18 -0
- package/src/hooks/global-post-tool-use.js +25 -0
- package/src/utils/daemon.js +48 -0
- package/src/viewer/index.html +1545 -1641
- package/src/viewer/server.js +383 -694
- package/templates/agents/documentalista.md +47 -28
- package/templates/claude-snippet.md +53 -39
- package/templates/hooks/on-stop.js +59 -11
- package/templates/hooks/post-tool-use.js +12 -8
package/README.md
CHANGED
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
[](https://www.npmjs.com/package/docutrack)
|
|
8
8
|
[](LICENSE)
|
|
9
9
|
[](https://nodejs.org)
|
|
10
|
-
[](CONTRIBUTING.md)
|
|
11
10
|
|
|
12
11
|
</div>
|
|
13
12
|
|
|
@@ -19,139 +18,145 @@ Claude Code edits 30 files in a session. When it's done, none of them have updat
|
|
|
19
18
|
|
|
20
19
|
## The solution
|
|
21
20
|
|
|
22
|
-
DocuTrack hooks into Claude Code's lifecycle
|
|
21
|
+
DocuTrack hooks into Claude Code's lifecycle to automatically track every file your AI agent touches. When the session ends, a specialized subagent documents everything — in your language, at your preferred depth.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Install once, use everywhere
|
|
23
26
|
|
|
24
27
|
```bash
|
|
25
|
-
|
|
28
|
+
npm install -g docutrack
|
|
29
|
+
docutrack install-global
|
|
26
30
|
```
|
|
27
31
|
|
|
28
|
-
|
|
32
|
+
`install-global` does two things:
|
|
29
33
|
|
|
30
|
-
|
|
34
|
+
1. Registers global PostToolUse and Stop hooks in `~/.claude/settings.json` — active in every Claude Code session from now on
|
|
35
|
+
2. Writes a `~/.claude/CLAUDE.md` snippet that teaches Claude how to set up DocuTrack for any project
|
|
31
36
|
|
|
32
|
-
|
|
37
|
+
After this, you never think about DocuTrack again — Claude handles the rest.
|
|
33
38
|
|
|
34
|
-
|
|
35
|
-
Claude edits a file
|
|
36
|
-
↓
|
|
37
|
-
PostToolUse hook fires → file added to .docutrack/queue.json
|
|
38
|
-
↓
|
|
39
|
-
Session ends → documentalista subagent runs
|
|
40
|
-
↓
|
|
41
|
-
Docs written to docs/modules/ and docs/api/
|
|
42
|
-
↓
|
|
43
|
-
docutrack serve → beautiful web viewer at localhost:4242
|
|
44
|
-
```
|
|
39
|
+
---
|
|
45
40
|
|
|
46
|
-
|
|
41
|
+
## How it works per project
|
|
47
42
|
|
|
48
|
-
|
|
49
|
-
- **Stop** — fires at end of session, triggers the documentalista subagent
|
|
43
|
+
### The recommended flow — let Claude do it
|
|
50
44
|
|
|
51
|
-
|
|
45
|
+
Open any project in Claude Code and ask:
|
|
52
46
|
|
|
53
|
-
|
|
47
|
+
> *"Build me an inventory API and use docutrack for documentation"*
|
|
54
48
|
|
|
55
|
-
|
|
49
|
+
Claude will:
|
|
50
|
+
1. Ask you four quick questions in the chat (in your language)
|
|
51
|
+
2. Run `docutrack init --lang=… --description="…" --audience=… --depth=…`
|
|
52
|
+
3. Build your project — every file created is queued automatically via the global hooks
|
|
53
|
+
4. At session end, run the documentalista subagent to write all docs
|
|
54
|
+
5. Start the viewer at `http://localhost:4242`
|
|
56
55
|
|
|
57
|
-
|
|
58
|
-
- **Architecture** — AI-generated overview of your tech stack, structure, and data flow
|
|
59
|
-
- **API Explorer** — interactive Swagger-like explorer built from your route files
|
|
60
|
-
- **Decisions** — Architecture Decision Records (ADRs)
|
|
61
|
-
- **Health Check** — drift analysis, complexity heatmap, stale doc detection
|
|
62
|
-
- **Multilingual** — generates docs in Spanish or English, switchable from the UI
|
|
56
|
+
### The manual flow — you control the init
|
|
63
57
|
|
|
64
|
-
|
|
58
|
+
```bash
|
|
59
|
+
cd my-project
|
|
60
|
+
docutrack init # interactive questionnaire in the terminal
|
|
61
|
+
```
|
|
65
62
|
|
|
66
|
-
|
|
63
|
+
Then open Claude Code. It reads `CLAUDE.md`, sees pending files, and documents everything without being asked.
|
|
67
64
|
|
|
68
65
|
---
|
|
69
66
|
|
|
70
|
-
##
|
|
67
|
+
## The questionnaire
|
|
71
68
|
|
|
72
|
-
|
|
73
|
-
# Initialize in your project
|
|
74
|
-
npx docutrack init
|
|
69
|
+
Whether run interactively or via Claude, DocuTrack asks four questions before setting up:
|
|
75
70
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
71
|
+
| Question | Options |
|
|
72
|
+
|----------|---------|
|
|
73
|
+
| Documentation language | Spanish, English, or any other |
|
|
74
|
+
| Project description | One sentence |
|
|
75
|
+
| Who reads the docs | `team` · `onboarding` · `mixed` |
|
|
76
|
+
| Documentation depth | `concise` · `standard` · `detailed` |
|
|
79
77
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
78
|
+
These preferences are saved to `docutrack.config.json` and used by every documentation run.
|
|
79
|
+
|
|
80
|
+
---
|
|
83
81
|
|
|
84
|
-
|
|
82
|
+
## What gets generated
|
|
85
83
|
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
|
|
84
|
+
```
|
|
85
|
+
docs/
|
|
86
|
+
├── modules/ ← one .md per source file
|
|
87
|
+
│ responsibility · public API · dependencies · data shapes · notes
|
|
88
|
+
├── api/ ← one .md per API router + openapi.json
|
|
89
|
+
├── decisions/ ← Architecture Decision Records (ADRs)
|
|
90
|
+
└── ONBOARDING.md ← assembled guide for new team members
|
|
91
|
+
ARCHITECTURE.md ← tech stack · module map · data flow · env vars
|
|
89
92
|
```
|
|
90
93
|
|
|
91
94
|
---
|
|
92
95
|
|
|
96
|
+
## The web viewer
|
|
97
|
+
|
|
98
|
+
`docutrack serve` opens a local documentation browser at `http://localhost:4242`:
|
|
99
|
+
|
|
100
|
+
- Browse modules, API docs, decisions, and architecture in one place
|
|
101
|
+
- Full-text search with `Cmd/Ctrl+K`
|
|
102
|
+
- Mermaid diagram rendering
|
|
103
|
+
- Dark/light mode
|
|
104
|
+
- Persistent URLs — reload lands on the same page
|
|
105
|
+
|
|
106
|
+
---
|
|
107
|
+
|
|
93
108
|
## Commands
|
|
94
109
|
|
|
95
110
|
| Command | Description |
|
|
96
111
|
|---------|-------------|
|
|
97
|
-
| `docutrack
|
|
98
|
-
| `docutrack
|
|
112
|
+
| `docutrack install-global` | **One-time setup** — registers global hooks and Claude instructions |
|
|
113
|
+
| `docutrack init` | Initialize DocuTrack in a project (interactive questionnaire) |
|
|
114
|
+
| `docutrack init --lang=es --description="…" --audience=team --depth=standard` | Non-interactive init (used by Claude Code) |
|
|
115
|
+
| `docutrack init --template <name>` | Init with a specific stack template |
|
|
116
|
+
| `docutrack serve` | Open the web viewer at `http://localhost:4242` |
|
|
99
117
|
| `docutrack scan` | Queue all existing source files for documentation |
|
|
118
|
+
| `docutrack scan --dry-run` | Preview what would be queued |
|
|
100
119
|
| `docutrack status` | Show coverage, pending files, and stale docs |
|
|
101
|
-
| `docutrack
|
|
102
|
-
| `docutrack
|
|
103
|
-
| `docutrack
|
|
104
|
-
| `docutrack
|
|
105
|
-
| `docutrack
|
|
120
|
+
| `docutrack status --json` | Machine-readable output for CI |
|
|
121
|
+
| `docutrack clear` | Clear the documentation queue |
|
|
122
|
+
| `docutrack check` | Full health check: drift, complexity, stale docs |
|
|
123
|
+
| `docutrack analyze` | Scan routes and generate `docs/api/openapi.json` |
|
|
124
|
+
| `docutrack onboard` | Generate `docs/ONBOARDING.md` |
|
|
125
|
+
| `docutrack badge` | Generate a coverage badge SVG |
|
|
126
|
+
| `docutrack export --format mintlify` | Export docs to Mintlify format |
|
|
127
|
+
| `docutrack export --format docusaurus` | Export docs to Docusaurus format |
|
|
106
128
|
|
|
107
129
|
---
|
|
108
130
|
|
|
109
131
|
## Stack templates
|
|
110
132
|
|
|
111
|
-
DocuTrack auto-detects your stack from `package.json`, `go.mod`, etc.
|
|
133
|
+
DocuTrack auto-detects your stack from `package.json`, `go.mod`, etc.
|
|
112
134
|
|
|
113
135
|
```bash
|
|
114
|
-
docutrack init --template nextjs
|
|
115
|
-
docutrack init --template fastapi
|
|
116
|
-
docutrack init --template express
|
|
117
|
-
docutrack init --template monorepo
|
|
118
|
-
docutrack init --template go
|
|
136
|
+
docutrack init --template nextjs # Next.js App Router
|
|
137
|
+
docutrack init --template fastapi # Python FastAPI
|
|
138
|
+
docutrack init --template express # Node.js Express / Fastify / Koa
|
|
139
|
+
docutrack init --template monorepo # Turborepo / pnpm workspaces
|
|
140
|
+
docutrack init --template go # Go modules
|
|
119
141
|
```
|
|
120
142
|
|
|
121
|
-
Each template ships with a stack-specific `documentalista` subagent that understands your framework's conventions.
|
|
122
|
-
|
|
123
143
|
---
|
|
124
144
|
|
|
125
|
-
##
|
|
145
|
+
## How the hooks work
|
|
126
146
|
|
|
127
|
-
|
|
128
|
-
docs/
|
|
129
|
-
├── modules/ ← one .md per source file (responsibility, exports, dependencies)
|
|
130
|
-
├── api/ ← one .md per API route + openapi.json
|
|
131
|
-
└── decisions/ ← Architecture Decision Records
|
|
132
|
-
ARCHITECTURE.md ← AI-generated: tech stack, app structure, data flow, module map
|
|
133
|
-
docs/ONBOARDING.md ← AI-generated: setup guide, conventions, key modules
|
|
134
|
-
```
|
|
135
|
-
|
|
136
|
-
---
|
|
147
|
+
DocuTrack registers two hooks globally (via `install-global`) and per-project (via `init`):
|
|
137
148
|
|
|
138
|
-
|
|
149
|
+
- **PostToolUse** — fires after every Write/Edit, adds the file to `.docutrack/queue.json`
|
|
150
|
+
- **Stop** — fires when the session ends; scans for any files that were missed, then prompts Claude to run the documentalista
|
|
139
151
|
|
|
140
|
-
|
|
152
|
+
The global hooks silently skip projects that haven't been initialized. No noise in other projects.
|
|
141
153
|
|
|
142
154
|
---
|
|
143
155
|
|
|
144
156
|
## Requirements
|
|
145
157
|
|
|
146
158
|
- Node.js 18+
|
|
147
|
-
- [Claude Code](https://claude.ai/code)
|
|
148
|
-
- `ANTHROPIC_API_KEY` (only required for AI doc generation)
|
|
149
|
-
|
|
150
|
-
---
|
|
151
|
-
|
|
152
|
-
## Contributing
|
|
153
|
-
|
|
154
|
-
Contributions are welcome. Read [CONTRIBUTING.md](CONTRIBUTING.md) to get started.
|
|
159
|
+
- [Claude Code](https://claude.ai/code)
|
|
155
160
|
|
|
156
161
|
---
|
|
157
162
|
|
package/bin/docutrack.js
CHANGED
|
@@ -1,67 +1,73 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
'use strict'
|
|
4
|
-
|
|
5
|
-
const [, , command, ...args] = process.argv
|
|
6
|
-
|
|
7
|
-
const commands = {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
docutrack
|
|
28
|
-
docutrack
|
|
29
|
-
docutrack
|
|
30
|
-
docutrack
|
|
31
|
-
|
|
32
|
-
docutrack
|
|
33
|
-
docutrack
|
|
34
|
-
docutrack
|
|
35
|
-
docutrack
|
|
36
|
-
docutrack
|
|
37
|
-
docutrack
|
|
38
|
-
docutrack
|
|
39
|
-
docutrack
|
|
40
|
-
docutrack
|
|
41
|
-
docutrack
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
--
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
if (
|
|
60
|
-
console.
|
|
61
|
-
process.exit(
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
handler
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
'use strict'
|
|
4
|
+
|
|
5
|
+
const [, , command, ...args] = process.argv
|
|
6
|
+
|
|
7
|
+
const commands = {
|
|
8
|
+
'install-global': () => require('../src/commands/install-global'),
|
|
9
|
+
setup: () => require('../src/commands/setup'),
|
|
10
|
+
init: () => require('../src/commands/init'),
|
|
11
|
+
serve: () => require('../src/commands/serve'),
|
|
12
|
+
analyze: () => require('../src/commands/analyze'),
|
|
13
|
+
status: () => require('../src/commands/status'),
|
|
14
|
+
clear: () => require('../src/commands/clear'),
|
|
15
|
+
badge: () => require('../src/commands/badge'),
|
|
16
|
+
export: () => require('../src/commands/export'),
|
|
17
|
+
check: () => require('../src/commands/check'),
|
|
18
|
+
onboard: () => require('../src/commands/onboard'),
|
|
19
|
+
scan: () => require('../src/commands/scan'),
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
if (!command || command === '--help' || command === '-h') {
|
|
23
|
+
console.log(`
|
|
24
|
+
docutrack — Claude Code documentation plugin
|
|
25
|
+
|
|
26
|
+
Usage:
|
|
27
|
+
docutrack install-global Install hooks globally — run once after npm install
|
|
28
|
+
docutrack setup One-command setup: init + scan + start viewer
|
|
29
|
+
docutrack init Initialize DocuTrack (runs interactive questionnaire)
|
|
30
|
+
docutrack init --lang=es --description="<desc>" --audience=team --depth=standard
|
|
31
|
+
Non-interactive init (for Claude Code or CI)
|
|
32
|
+
docutrack init --template <name> Init with a specific stack template
|
|
33
|
+
docutrack serve Start the documentation web viewer (port 4242)
|
|
34
|
+
docutrack analyze Scan routes and generate docs/api/openapi.json
|
|
35
|
+
docutrack status Show coverage, pending files, and stale docs
|
|
36
|
+
docutrack status --json Machine-readable output for CI
|
|
37
|
+
docutrack badge Generate docs/badge.svg for your README
|
|
38
|
+
docutrack clear Clear the documentation queue
|
|
39
|
+
docutrack export --format mintlify Export docs to Mintlify format
|
|
40
|
+
docutrack export --format docusaurus Export docs to Docusaurus format
|
|
41
|
+
docutrack export --format <f> --out <dir> Export to a custom output directory
|
|
42
|
+
docutrack check Full health: drift, complexity, stale docs
|
|
43
|
+
docutrack check --json Machine-readable health report for CI
|
|
44
|
+
docutrack onboard Generate docs/ONBOARDING.md
|
|
45
|
+
docutrack onboard --force Regenerate ONBOARDING.md
|
|
46
|
+
docutrack scan Queue ALL existing source files for initial documentation
|
|
47
|
+
docutrack scan --dry-run Preview what would be queued
|
|
48
|
+
|
|
49
|
+
Templates (auto-detected from project files):
|
|
50
|
+
nextjs, fastapi, express, monorepo, go
|
|
51
|
+
|
|
52
|
+
Options:
|
|
53
|
+
--help, -h Show this help message
|
|
54
|
+
--version, -v Show version
|
|
55
|
+
`)
|
|
56
|
+
process.exit(0)
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (command === '--version' || command === '-v') {
|
|
60
|
+
console.log(require('../package.json').version)
|
|
61
|
+
process.exit(0)
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const handler = commands[command]
|
|
65
|
+
if (!handler) {
|
|
66
|
+
console.error(`Unknown command: ${command}\nRun "docutrack --help" for usage.`)
|
|
67
|
+
process.exit(1)
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
handler().run(args).catch(err => {
|
|
71
|
+
console.error(`\nError: ${err.message}`)
|
|
72
|
+
process.exit(1)
|
|
73
|
+
})
|
package/package.json
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "docutrack",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "Claude Code plugin
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "Claude Code plugin — your AI agent writes code, DocuTrack documents it automatically.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"claude-code",
|
|
7
7
|
"claude",
|
|
8
8
|
"documentation",
|
|
9
9
|
"ai-agents",
|
|
10
10
|
"architecture",
|
|
11
|
-
"developer-tools"
|
|
11
|
+
"developer-tools",
|
|
12
|
+
"living-docs",
|
|
13
|
+
"docutrack"
|
|
12
14
|
],
|
|
13
15
|
"license": "MIT",
|
|
14
16
|
"type": "commonjs",
|