@aprimediet/codewalker 1.0.0 → 1.2.0

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.
Files changed (46) hide show
  1. package/README.md +44 -50
  2. package/index.ts +6 -42
  3. package/package.json +20 -39
  4. package/prompts/codewalker.md +7 -0
  5. package/skills/codewalker/SKILL.md +43 -0
  6. package/src/cards.test.ts +88 -0
  7. package/src/cards.ts +87 -0
  8. package/src/db.test.ts +343 -0
  9. package/src/db.ts +363 -0
  10. package/src/extract/ctags-parse.test.ts +108 -0
  11. package/src/extract/ctags-parse.ts +112 -0
  12. package/src/extract/ctags.ts +51 -0
  13. package/src/extract/docs.test.ts +81 -0
  14. package/src/extract/docs.ts +169 -0
  15. package/src/extract/regex.test.ts +202 -0
  16. package/src/extract/regex.ts +192 -0
  17. package/src/format.test.ts +123 -0
  18. package/src/format.ts +69 -0
  19. package/src/git.test.ts +75 -0
  20. package/src/git.ts +62 -0
  21. package/src/index.contract.test.ts +145 -0
  22. package/src/index.ts +173 -0
  23. package/src/indexer.test.ts +138 -0
  24. package/src/indexer.ts +352 -0
  25. package/src/libs/cards.test.ts +86 -0
  26. package/src/libs/cards.ts +53 -0
  27. package/src/libs/dts.test.ts +269 -0
  28. package/src/libs/dts.ts +213 -0
  29. package/src/libs/indexer.test.ts +236 -0
  30. package/src/libs/indexer.ts +291 -0
  31. package/src/libs/resolve.test.ts +218 -0
  32. package/src/libs/resolve.ts +120 -0
  33. package/src/project.test.ts +115 -0
  34. package/src/project.ts +206 -0
  35. package/src/query.test.ts +169 -0
  36. package/src/query.ts +89 -0
  37. package/src/sync.test.ts +116 -0
  38. package/src/types.ts +117 -0
  39. package/vitest.config.ts +28 -0
  40. package/LICENSE +0 -21
  41. package/agents.ts +0 -126
  42. package/compat.ts +0 -217
  43. package/detect.ts +0 -188
  44. package/docs/PRD.md +0 -78
  45. package/prd.ts +0 -106
  46. package/skills/learn-this/SKILL.md +0 -325
@@ -1,325 +0,0 @@
1
- ---
2
- name: learn-this
3
- description: Use when the user runs /learn-this or asks to analyze, understand, or get up to speed on the current project. Guides systematic project intelligence gathering across tech stack, goals, status, technical issues, PRD management, and integration detection.
4
- ---
5
-
6
- # Learn This — Project Intelligence
7
-
8
- Build a complete project intelligence snapshot for the current working directory.
9
- Create a task for each phase listed below before starting any of them.
10
-
11
- ---
12
-
13
- ## Phase 1 — Tech Stack
14
-
15
- Read the following files if they exist and record what you find:
16
-
17
- | File | Signals |
18
- |---|---|
19
- | `package.json` | Node.js / JS / TS; read `dependencies` + `devDependencies` for frameworks |
20
- | `tsconfig.json` | TypeScript |
21
- | `bun.lock` / `pnpm-lock.yaml` / `yarn.lock` / `package-lock.json` | Package manager |
22
- | `requirements.txt` / `pyproject.toml` | Python |
23
- | `go.mod` | Go |
24
- | `Cargo.toml` | Rust |
25
- | `pom.xml` / `build.gradle` / `build.gradle.kts` | Java / Kotlin |
26
- | `Gemfile` | Ruby |
27
- | `next.config.*` / `vite.config.*` / `nuxt.config.*` / `astro.config.*` | Frontend framework |
28
- | `tailwind.config.*` | Tailwind CSS |
29
- | `Dockerfile` / `docker-compose.yml` | Docker |
30
- | `.github/workflows/` | GitHub Actions |
31
- | `.gitlab-ci.yml` | GitLab CI |
32
-
33
- Also read `package.json` deps for: `react`, `vue`, `express`, `fastify`, `hono`,
34
- `@nestjs/core`, `prisma`, `@prisma/client`, `drizzle-orm`, `@trpc/server`.
35
-
36
- Record: primary language(s), frameworks, infrastructure, package manager.
37
-
38
- ---
39
-
40
- ## Phase 2 — Goals & Non-Goals
41
-
42
- Search in order:
43
- 1. `README.md` — look for Goals, Non-Goals, About, Overview headings
44
- 2. `docs/PRD.md`, `docs/prd.md`, `PRD.md`, `.pi/prd.md`, `PRODUCT.md`, `SPEC.md`
45
- 3. Any markdown file whose name contains "goals" or "requirements"
46
-
47
- **If goals are NOT found**, gather them interactively — ask ONE question at a time and wait
48
- for the user's answer before asking the next:
49
-
50
- 1. "What problem does this project solve?"
51
- 2. "Who is the primary user or audience?"
52
- 3. "What are the 3 most important features?"
53
- 4. "What is explicitly out of scope?"
54
- 5. "What does success look like for this project?"
55
-
56
- **Do NOT present all five questions at once. Ask one. Wait for the answer. Ask the next.**
57
-
58
- ---
59
-
60
- ## Phase 3 — Boundaries
61
-
62
- From README and code structure, identify:
63
- - Key entry points (main files, API routes, CLI commands)
64
- - External services consumed (databases, third-party APIs, cloud services)
65
- - Exposed interfaces (HTTP endpoints, CLI flags, exported packages)
66
- - Technical constraints (runtime version, OS requirements, required env vars)
67
-
68
- ---
69
-
70
- ## Phase 4 — Project Status
71
-
72
- 1. Run: `git log --oneline -20` — record the output
73
- 2. Check for `CHANGELOG.md`, `TODO.md`, `ISSUES.md`, `ROADMAP.md`
74
- 3. Scan for technical debt markers:
75
- ```
76
- grep -r "TODO:\|FIXME:\|HACK:\|BUG:" --include="*.ts" --include="*.js" --include="*.py" --include="*.go" . 2>/dev/null | head -20
77
- ```
78
-
79
- ---
80
-
81
- ## Phase 5 — Technical Issues
82
-
83
- Detect and report:
84
- - No test directory or test config found (`test/`, `tests/`, `__tests__/`, `vitest.config.*`, `jest.config.*`)
85
- - `.env.example` exists but `.env` is missing
86
- - `tsconfig.json` is not valid JSON
87
- - Count of `// @ts-nocheck` or `// @ts-ignore` occurrences
88
-
89
- Then ask the user:
90
- > "I found [N] potential issues above. Are there additional technical issues you want me to be aware of or address?"
91
-
92
- Record their response.
93
-
94
- ---
95
-
96
- ## Phase 6 — Documentation Generation
97
-
98
- Produce two complementary documents from everything gathered so far, and split the content
99
- by audience. **Never put the same content in both.**
100
-
101
- | Document | Audience | Holds the *what & why* / *how* |
102
- |---|---|---|
103
- | `docs/PRD.md` | Humans (product) | overview, problem, goals, non-goals, target users, key features, success metrics, product-scope boundaries, open questions |
104
- | `AGENTS.md` (repo root) | Coding agents (engineering) | tech stack, project structure, build/test/run commands, conventions, **technical** boundaries, known issues, companion-extension usage, current focus |
105
- | `CLAUDE.md` (repo root) | Claude Code | thin pointer that imports `AGENTS.md` |
106
-
107
- ### 6a — PRD (human, product)
108
-
109
- **Search for existing PRD** in: `docs/PRD.md`, `docs/prd.md`, `PRD.md`, `.pi/prd.md`,
110
- `PRODUCT.md`, `SPEC.md`, or `README.md` with a Goals/Requirements heading.
111
-
112
- **If it exists**: read and summarize key sections for the Phase 8 summary.
113
-
114
- **If it does NOT exist**:
115
- - Ask: "No PRD found. Should I create `docs/PRD.md` with the product information we gathered?"
116
- - If yes, write `docs/PRD.md` using this template (product content only — no commands, no file paths, no conventions):
117
-
118
- ```
119
- # Product Requirements Document: <project-name>
120
-
121
- **Version:** 1.0
122
- **Date:** <today>
123
- **Status:** Draft
124
-
125
- ## Overview
126
- <1-2 sentence vision summary>
127
-
128
- ## Problem Statement
129
- <what problem this solves and who has it>
130
-
131
- ## Goals
132
- - <goal from Phase 2>
133
-
134
- ## Non-Goals
135
- - <non-goal from Phase 2>
136
-
137
- ## Target Users
138
- <from Phase 2>
139
-
140
- ## Key Features
141
- ### <Feature>
142
- <product-level description>
143
-
144
- ## Success Metrics
145
- - <metric from Phase 2>
146
-
147
- ## Scope & Boundaries
148
- <product-scope boundaries from Phase 3 — what the product will and will not do>
149
-
150
- ## Open Questions
151
- - <any unresolved questions>
152
- ```
153
-
154
- ### 6b — AGENTS.md (coding agent, engineering)
155
-
156
- **Search for an existing agent guide** at: `AGENTS.md`, `.agents/AGENTS.md`, `docs/AGENTS.md`.
157
-
158
- **If it exists**: read it; offer to update stale sections rather than overwrite.
159
-
160
- **If it does NOT exist**:
161
- - Ask: "No AGENTS.md found. Should I create one at the repo root for coding agents?"
162
- - If yes, write `AGENTS.md` using this template (engineering content only — NO product goals/users/metrics; link to the PRD for those):
163
-
164
- ```
165
- # AGENTS.md — <project-name>
166
-
167
- Guide for coding agents working in this repository. Product context (goals, users,
168
- features, success metrics): see [docs/PRD.md](docs/PRD.md).
169
-
170
- ## Summary
171
- <one-line: what this codebase is, technically>
172
-
173
- ## Tech Stack
174
- <languages, frameworks, infrastructure, package manager — from Phase 1>
175
-
176
- ## Project Structure
177
- <key entry points and directories — from Phase 3>
178
-
179
- ## Commands
180
- - **Setup:** <install command, if any>
181
- - **Build:** <build command, if any>
182
- - **Test:** <test command, if any>
183
- - **Run:** <run/dev command, if any>
184
- - **Lint:** <lint/format command, if any>
185
-
186
- ## Conventions
187
- <code style, naming, patterns observed in the codebase — match what exists>
188
-
189
- ## Boundaries (technical)
190
- <do-not-touch areas, invariants, generated files, things that must not change — from Phase 3>
191
-
192
- ## Known Issues & Gotchas
193
- - <technical issue from Phase 5>
194
-
195
- ## Companion Extensions
196
- <if minion/memory are active (Phase 7): how the agent should use them — e.g. check the
197
- kanban board before starting, record durable facts to memory. If not active, say so.>
198
-
199
- ## Current Focus
200
- <what is being worked on now — from Phase 4 recent commits / status>
201
- ```
202
-
203
- ### 6c — CLAUDE.md (Claude Code pointer)
204
-
205
- **If `CLAUDE.md` does not already exist** at the repo root, create it as a thin pointer so
206
- Claude Code loads the same guide (do not duplicate AGENTS.md content):
207
-
208
- ```
209
- # CLAUDE.md — <project-name>
210
-
211
- Guidance for Claude Code in this repository.
212
-
213
- All project conventions, architecture, build/test commands, and boundaries live in
214
- **[AGENTS.md](./AGENTS.md)** — the shared guide for every coding agent. Keep that file
215
- as the single source of truth; do not duplicate its content here.
216
-
217
- @AGENTS.md
218
- ```
219
-
220
- If `CLAUDE.md` already exists with its own content, do NOT overwrite it — instead offer to
221
- add the `@AGENTS.md` import line if it is missing.
222
-
223
- ---
224
-
225
- ## Phase 7 — Integration Detection
226
-
227
- **Detect `@aprimediet/minion`:**
228
-
229
- Step-by-step marker detection:
230
- 1. List all `*.md` files inside the `.pi/` directory at the project root
231
- 2. For each file, read its contents
232
- 3. Check if the file contains both `pi-project: true` and an `id:` field (in YAML frontmatter)
233
- 4. If found, extract the value after `id:` — this is the project id
234
-
235
- Then check for minion:
236
- - Check if `~/.pi/projects/<id>/tasks/` directory exists
237
- - If yes: read each `*.md` file in the tasks dir; count those whose frontmatter has `status:` set to one of: `backlog`, `todo`, `in_progress`, `blocked`, `review`
238
- - Report: count of open tasks + their titles + statuses
239
-
240
- **Detect `@aprimediet/memory`:**
241
-
242
- - Use the **same `.pi/<id>.md` marker** (one file serves both extensions — do not create a new one)
243
- - Check if `~/.pi/projects/<id>/memory/` directory exists
244
- - If yes: check for `~/.pi/projects/<id>/memory/MEMORY.md` — read it if present
245
- - Count `*.md` files in `~/.pi/projects/<id>/memory/entries/`
246
- - Report: active/not-detected, entry count, MEMORY.md contents
247
-
248
- ---
249
-
250
- ## Phase 8 — Compile Summary
251
-
252
- Assemble the full project intelligence document using these exact section headers:
253
-
254
- ```
255
- # Project Intelligence: <project-name>
256
- > Generated by /learn-this on <date>
257
-
258
- ## Tech Stack
259
- **Language(s):** ...
260
- **Frameworks:** ...
261
- **Infrastructure:** ...
262
- **Package Manager:** ...
263
-
264
- ## Goals
265
- ...
266
-
267
- ## Non-Goals
268
- ...
269
-
270
- ## Boundaries
271
- ...
272
-
273
- ## Current Status
274
- **Recent commits:**
275
- <git log output>
276
-
277
- **Open TODOs/FIXMEs:** N found
278
-
279
- ## Technical Issues
280
- - ...
281
-
282
- ## Documentation
283
- **PRD (`docs/PRD.md`):** exists | created | not created
284
- **AGENTS.md:** exists | created | not created
285
- **CLAUDE.md:** exists | created | not created
286
- **Key points:** ...
287
-
288
- ## Minion Integration
289
- **Status:** active | not detected
290
- **Project ID:** ...
291
- **Open tasks (N):**
292
- - ...
293
-
294
- ## Memory Integration
295
- **Status:** active (N entries) | not detected
296
- **Index:**
297
- <MEMORY.md contents, or "(empty)">
298
- ```
299
-
300
- ---
301
-
302
- ## Phase 9 — Store to Memory
303
-
304
- **If `@aprimediet/memory` is active** (detected in Phase 7):
305
- - Call `memory_write` with `scope: "project"`, `type: "fact"`, and `text:` set to the full Phase 8 summary
306
- - Report: "Summary stored to project memory."
307
-
308
- **If memory is not active**:
309
- - Display the summary in chat
310
- - Ask: "Would you like me to save this to `docs/project-intelligence.md`?"
311
- - If yes, write the file.
312
-
313
- ---
314
-
315
- ## Checklist
316
-
317
- - [ ] Phase 1: Tech stack identified
318
- - [ ] Phase 2: Goals/non-goals found or gathered interactively (one question at a time)
319
- - [ ] Phase 3: Boundaries documented
320
- - [ ] Phase 4: Project status from git log + TODO scan
321
- - [ ] Phase 5: Technical issues detected + user asked about additional issues
322
- - [ ] Phase 6: Docs generated — PRD (product), AGENTS.md (engineering), CLAUDE.md (pointer), with user confirmation and audience-correct content split
323
- - [ ] Phase 7: minion compatibility detected; memory compatibility detected
324
- - [ ] Phase 8: Full summary compiled
325
- - [ ] Phase 9: Summary stored to memory or saved to file