@mfittko/repo-wiki 0.2.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.
Files changed (190) hide show
  1. package/.llmwiki/schema.md +107 -0
  2. package/AGENTS.md +42 -0
  3. package/CHANGELOG.md +91 -0
  4. package/LICENSE +21 -0
  5. package/README.md +254 -0
  6. package/dist/bin/repo-wiki.d.ts +2 -0
  7. package/dist/bin/repo-wiki.js +7 -0
  8. package/dist/bin/repo-wiki.js.map +1 -0
  9. package/dist/src/cli.d.ts +1 -0
  10. package/dist/src/cli.js +404 -0
  11. package/dist/src/cli.js.map +1 -0
  12. package/dist/src/compiler.d.ts +55 -0
  13. package/dist/src/compiler.js +2046 -0
  14. package/dist/src/compiler.js.map +1 -0
  15. package/dist/src/config.d.ts +63 -0
  16. package/dist/src/config.js +86 -0
  17. package/dist/src/config.js.map +1 -0
  18. package/dist/src/context-assembler.d.ts +68 -0
  19. package/dist/src/context-assembler.js +378 -0
  20. package/dist/src/context-assembler.js.map +1 -0
  21. package/dist/src/data-model-signals.d.ts +1 -0
  22. package/dist/src/data-model-signals.js +13 -0
  23. package/dist/src/data-model-signals.js.map +1 -0
  24. package/dist/src/docs-ingestor.d.ts +138 -0
  25. package/dist/src/docs-ingestor.js +844 -0
  26. package/dist/src/docs-ingestor.js.map +1 -0
  27. package/dist/src/docs-linter.d.ts +14 -0
  28. package/dist/src/docs-linter.js +164 -0
  29. package/dist/src/docs-linter.js.map +1 -0
  30. package/dist/src/docs-validation.d.ts +36 -0
  31. package/dist/src/docs-validation.js +297 -0
  32. package/dist/src/docs-validation.js.map +1 -0
  33. package/dist/src/extractors.d.ts +50 -0
  34. package/dist/src/extractors.js +2275 -0
  35. package/dist/src/extractors.js.map +1 -0
  36. package/dist/src/frontmatter.d.ts +46 -0
  37. package/dist/src/frontmatter.js +377 -0
  38. package/dist/src/frontmatter.js.map +1 -0
  39. package/dist/src/index.d.ts +26 -0
  40. package/dist/src/index.js +18 -0
  41. package/dist/src/index.js.map +1 -0
  42. package/dist/src/init.d.ts +12 -0
  43. package/dist/src/init.js +121 -0
  44. package/dist/src/init.js.map +1 -0
  45. package/dist/src/language.d.ts +2 -0
  46. package/dist/src/language.js +62 -0
  47. package/dist/src/language.js.map +1 -0
  48. package/dist/src/linter.d.ts +33 -0
  49. package/dist/src/linter.js +398 -0
  50. package/dist/src/linter.js.map +1 -0
  51. package/dist/src/llm-provider.d.ts +267 -0
  52. package/dist/src/llm-provider.js +474 -0
  53. package/dist/src/llm-provider.js.map +1 -0
  54. package/dist/src/page-ownership.d.ts +38 -0
  55. package/dist/src/page-ownership.js +96 -0
  56. package/dist/src/page-ownership.js.map +1 -0
  57. package/dist/src/planner.d.ts +55 -0
  58. package/dist/src/planner.js +422 -0
  59. package/dist/src/planner.js.map +1 -0
  60. package/dist/src/prompts.d.ts +103 -0
  61. package/dist/src/prompts.js +344 -0
  62. package/dist/src/prompts.js.map +1 -0
  63. package/dist/src/publisher.d.ts +68 -0
  64. package/dist/src/publisher.js +662 -0
  65. package/dist/src/publisher.js.map +1 -0
  66. package/dist/src/repository-analysis.d.ts +88 -0
  67. package/dist/src/repository-analysis.js +485 -0
  68. package/dist/src/repository-analysis.js.map +1 -0
  69. package/dist/src/scanner.d.ts +122 -0
  70. package/dist/src/scanner.js +309 -0
  71. package/dist/src/scanner.js.map +1 -0
  72. package/dist/src/search.d.ts +71 -0
  73. package/dist/src/search.js +410 -0
  74. package/dist/src/search.js.map +1 -0
  75. package/dist/src/secret-patterns.d.ts +3 -0
  76. package/dist/src/secret-patterns.js +14 -0
  77. package/dist/src/secret-patterns.js.map +1 -0
  78. package/dist/src/utils/args.d.ts +2 -0
  79. package/dist/src/utils/args.js +19 -0
  80. package/dist/src/utils/args.js.map +1 -0
  81. package/dist/src/utils/dotenv.d.ts +7 -0
  82. package/dist/src/utils/dotenv.js +73 -0
  83. package/dist/src/utils/dotenv.js.map +1 -0
  84. package/dist/src/utils/fs.d.ts +22 -0
  85. package/dist/src/utils/fs.js +83 -0
  86. package/dist/src/utils/fs.js.map +1 -0
  87. package/dist/src/utils/git.d.ts +13 -0
  88. package/dist/src/utils/git.js +39 -0
  89. package/dist/src/utils/git.js.map +1 -0
  90. package/dist/src/wiki-graph.d.ts +74 -0
  91. package/dist/src/wiki-graph.js +335 -0
  92. package/dist/src/wiki-graph.js.map +1 -0
  93. package/dist/src/wiki-patch.d.ts +152 -0
  94. package/dist/src/wiki-patch.js +489 -0
  95. package/dist/src/wiki-patch.js.map +1 -0
  96. package/dist/src/wiki-query.d.ts +63 -0
  97. package/dist/src/wiki-query.js +255 -0
  98. package/dist/src/wiki-query.js.map +1 -0
  99. package/dist/test/cli.test.d.ts +1 -0
  100. package/dist/test/cli.test.js +514 -0
  101. package/dist/test/cli.test.js.map +1 -0
  102. package/dist/test/compiler-eval.test.d.ts +1 -0
  103. package/dist/test/compiler-eval.test.js +234 -0
  104. package/dist/test/compiler-eval.test.js.map +1 -0
  105. package/dist/test/compiler.test.d.ts +1 -0
  106. package/dist/test/compiler.test.js +2537 -0
  107. package/dist/test/compiler.test.js.map +1 -0
  108. package/dist/test/context-assembler.test.d.ts +1 -0
  109. package/dist/test/context-assembler.test.js +379 -0
  110. package/dist/test/context-assembler.test.js.map +1 -0
  111. package/dist/test/docs-linter.test.d.ts +1 -0
  112. package/dist/test/docs-linter.test.js +900 -0
  113. package/dist/test/docs-linter.test.js.map +1 -0
  114. package/dist/test/dotenv.test.d.ts +1 -0
  115. package/dist/test/dotenv.test.js +77 -0
  116. package/dist/test/dotenv.test.js.map +1 -0
  117. package/dist/test/extractors-go.test.d.ts +1 -0
  118. package/dist/test/extractors-go.test.js +393 -0
  119. package/dist/test/extractors-go.test.js.map +1 -0
  120. package/dist/test/extractors-rust.test.d.ts +1 -0
  121. package/dist/test/extractors-rust.test.js +219 -0
  122. package/dist/test/extractors-rust.test.js.map +1 -0
  123. package/dist/test/extractors-utils.test.d.ts +1 -0
  124. package/dist/test/extractors-utils.test.js +786 -0
  125. package/dist/test/extractors-utils.test.js.map +1 -0
  126. package/dist/test/fixtures/compiler-e2e/basic-node-service/repo/infra/deploy.d.ts +1 -0
  127. package/dist/test/fixtures/compiler-e2e/basic-node-service/repo/infra/deploy.js +4 -0
  128. package/dist/test/fixtures/compiler-e2e/basic-node-service/repo/infra/deploy.js.map +1 -0
  129. package/dist/test/frontmatter.test.d.ts +1 -0
  130. package/dist/test/frontmatter.test.js +287 -0
  131. package/dist/test/frontmatter.test.js.map +1 -0
  132. package/dist/test/init-planner.test.d.ts +1 -0
  133. package/dist/test/init-planner.test.js +688 -0
  134. package/dist/test/init-planner.test.js.map +1 -0
  135. package/dist/test/linter.test.d.ts +1 -0
  136. package/dist/test/linter.test.js +426 -0
  137. package/dist/test/linter.test.js.map +1 -0
  138. package/dist/test/llm-provider.test.d.ts +1 -0
  139. package/dist/test/llm-provider.test.js +783 -0
  140. package/dist/test/llm-provider.test.js.map +1 -0
  141. package/dist/test/page-ownership.test.d.ts +1 -0
  142. package/dist/test/page-ownership.test.js +247 -0
  143. package/dist/test/page-ownership.test.js.map +1 -0
  144. package/dist/test/publisher.test.d.ts +1 -0
  145. package/dist/test/publisher.test.js +1297 -0
  146. package/dist/test/publisher.test.js.map +1 -0
  147. package/dist/test/repository-analysis.test.d.ts +1 -0
  148. package/dist/test/repository-analysis.test.js +182 -0
  149. package/dist/test/repository-analysis.test.js.map +1 -0
  150. package/dist/test/run-compiled-tests.d.ts +1 -0
  151. package/dist/test/run-compiled-tests.js +48 -0
  152. package/dist/test/run-compiled-tests.js.map +1 -0
  153. package/dist/test/scanner.test.d.ts +1 -0
  154. package/dist/test/scanner.test.js +551 -0
  155. package/dist/test/scanner.test.js.map +1 -0
  156. package/dist/test/search.test.d.ts +1 -0
  157. package/dist/test/search.test.js +92 -0
  158. package/dist/test/search.test.js.map +1 -0
  159. package/dist/test/update-changelog.test.d.ts +1 -0
  160. package/dist/test/update-changelog.test.js +125 -0
  161. package/dist/test/update-changelog.test.js.map +1 -0
  162. package/dist/test/wiki-graph.test.d.ts +1 -0
  163. package/dist/test/wiki-graph.test.js +164 -0
  164. package/dist/test/wiki-graph.test.js.map +1 -0
  165. package/dist/test/wiki-patch.test.d.ts +1 -0
  166. package/dist/test/wiki-patch.test.js +610 -0
  167. package/dist/test/wiki-patch.test.js.map +1 -0
  168. package/dist/test/wiki-query.test.d.ts +1 -0
  169. package/dist/test/wiki-query.test.js +163 -0
  170. package/dist/test/wiki-query.test.js.map +1 -0
  171. package/docs/PLAN.md +993 -0
  172. package/docs/WHY.md +61 -0
  173. package/docs/plans/agent-integration.md +85 -0
  174. package/docs/plans/ci-publishing.md +111 -0
  175. package/docs/plans/doc-validation.md +92 -0
  176. package/docs/plans/github-action.md +113 -0
  177. package/docs/plans/incremental-mode.md +98 -0
  178. package/docs/plans/karpathy-llm-wiki-alignment.md +84 -0
  179. package/docs/plans/llm-compiler.md +160 -0
  180. package/docs/plans/production-scanner.md +104 -0
  181. package/docs/plans/query-and-file-back.md +103 -0
  182. package/docs/plans/search-index.md +118 -0
  183. package/docs/plans/trust-hardening.md +74 -0
  184. package/docs/plans/wiki-graph.md +183 -0
  185. package/docs/plans/wiki-health.md +76 -0
  186. package/package.json +83 -0
  187. package/prompts/compiler.md +16 -0
  188. package/prompts/lint.md +18 -0
  189. package/prompts/page-templates.md +25 -0
  190. package/skills/repo-wiki-cli/SKILL.md +139 -0
@@ -0,0 +1,107 @@
1
+ # LLM Wiki Schema
2
+
3
+ This file defines how repository source code is compiled into wiki pages.
4
+
5
+ ## Source of truth
6
+
7
+ The source repository at the pinned commit is authoritative. Generated wiki pages are derived artifacts.
8
+
9
+ ## Required pages
10
+
11
+ ```text
12
+ Home.md
13
+ _Sidebar.md
14
+ Index.md
15
+ Log.md
16
+ Agent-Context-Pack.md
17
+ Repository-Overview.md
18
+ Architecture.md
19
+ Build-Test-and-Run.md
20
+ Open-Questions.md
21
+ ```
22
+
23
+ ## Page policy
24
+
25
+ - Prefer updating existing pages over creating new pages.
26
+ - Keep pages concise enough for coding agents to read.
27
+ - Preserve marked human sections.
28
+ - Add uncertain claims to `Open-Questions.md`.
29
+ - Cite source paths for material claims.
30
+ - Do not copy secrets or private tokens.
31
+
32
+ ## Human-maintained block
33
+
34
+ ```md
35
+ <!-- HUMAN_NOTES_START -->
36
+ <!-- HUMAN_NOTES_END -->
37
+ ```
38
+
39
+ ## Generated page frontmatter
40
+
41
+ ```yaml
42
+ ---
43
+ source_repo: "owner/repo"
44
+ source_commit: "abc123"
45
+ compiled_at: "2026-05-06T00:00:00.000Z"
46
+ page_state: "generated"
47
+ kind: "module"
48
+ source_paths:
49
+ - "src/example.ts"
50
+ ---
51
+ ```
52
+
53
+ `page_state` is emitted for generated pages, including `_Sidebar.md`, and may be `generated`, `mixed`, or `human-owned`. Pages marked `human-owned` or `owned_by: "human"` are skipped by the compiler; generated pages with non-empty preserved HUMAN_NOTES are rewritten as `mixed`. Existing pages without repo-wiki ownership metadata are treated as unmanaged and are not overwritten or adopted by default; adoption must be explicit by adding generated frontmatter/ownership metadata.
54
+
55
+ ## Graph artifact contract
56
+
57
+ `repo-wiki compile` also writes a deterministic graph artifact to `.llmwiki/graph.json`.
58
+
59
+ - `schema_version`: currently `1`
60
+ - node kinds: `page`, `source`, `documentation`, `module`
61
+ - node IDs:
62
+ - `page:<wiki-page-path>` for wiki pages
63
+ - `source:<repo-path>` for source files
64
+ - `documentation:<repo-path>` for documentation files; legacy `source:<repo-path>` documentation IDs are still accepted by the loader for compatibility
65
+ - `module:<stable-module-id>` for planner/compiler module records
66
+ - edge kinds and endpoint rules:
67
+ - `wiki_link`: `page` -> `page`
68
+ - `provenance`: `page` -> `source` or `documentation`
69
+ - `affects`: `source`, `documentation`, or `module` -> `page`
70
+ - `owns`: `module` -> `page`, `source`, or `documentation`
71
+
72
+ The graph artifact is an internal contract for planner/linter/incremental traversal helpers. It is additive and does not replace `.llmwiki/wiki` as the primary generated documentation artifact.
73
+
74
+ ## Citation, provenance, and confidence policy
75
+
76
+ Material claims (repository behavior, commands, APIs, architecture, configuration, dependencies, tests, data models, operations, and security posture) should include at least one provenance signal:
77
+
78
+ - non-empty frontmatter `source_paths` for generated pages;
79
+ - source path/code span snippets such as `` `src/example.ts` ``;
80
+ - commit-pinned GitHub source links produced by compiler helpers;
81
+ - documentation-card paths when explicitly labeled as secondary/unvalidated evidence.
82
+
83
+ Hub/navigation pages (`Home.md`, `_Sidebar.md`, `Index.md`, `Log.md`) are exempt from provenance requirements.
84
+
85
+ Generated pages may include conservative page-level confidence metadata:
86
+
87
+ - `high`: directly scanner-derived inventories/tables with cited source paths.
88
+ - `medium`: deterministic structural summaries derived from source cards/manifest.
89
+ - `low`: open questions, documentation debt, or explicitly unresolved claims.
90
+
91
+ ## Lint gates
92
+
93
+ Error-level:
94
+
95
+ - missing required pages
96
+ - secret-like content
97
+ - invalid generated markdown
98
+ - missing source commit metadata
99
+ - broken required navigation links
100
+
101
+ Warning-level:
102
+
103
+ - orphan pages
104
+ - missing source paths
105
+ - stale source hashes
106
+ - duplicate concept pages
107
+ - excessive page size
package/AGENTS.md ADDED
@@ -0,0 +1,42 @@
1
+ # Agent Instructions
2
+
3
+ This repository sketches a tool that compiles repository source code into a GitHub Wiki knowledge base.
4
+
5
+ Before editing implementation details, read:
6
+
7
+ 1. `docs/PLAN.md`
8
+ 2. `.llmwiki/schema.md`
9
+ 3. Read only the task-relevant source files.
10
+
11
+ Use `src/cli.ts`, `src/scanner.ts`, and `src/compiler.ts` as default anchor files only when the task touches CLI flow, repository scanning, compilation/report rendering, or when the relevant ownership is still unclear after a targeted read.
12
+
13
+ Source code is authoritative. Generated wiki pages are derived artifacts.
14
+
15
+ For repository orientation, use the generated local wiki as a navigation aid before diving into source, but keep the read surface minimal:
16
+
17
+ 1. Start with the single most relevant of `.llmwiki/wiki/Agent-Context-Pack.md`, `.llmwiki/wiki/Index.md`, or `.llmwiki/wiki/Architecture.md`.
18
+ 2. Read only the relevant `.llmwiki/wiki/Module-*.md` page or cross-cutting page for the task area if needed.
19
+
20
+ Do not preload broad source context by default. Prefer targeted reads, narrow line ranges, and task-local files first. The local wiki is not authoritative; verify material claims against source, tests, configuration, and CI.
21
+
22
+ Repository-maintained cross-platform skills can live under `skills/` when they are intended to ship with or describe repo-wiki itself. Integration-specific skill roots such as `.github/skills/` and `.pi/skills/` may also contain integration-only skills, but any shared repo-wiki skill there should be a symlink to the canonical `skills/` directory, not a duplicate copy.
23
+
24
+ GitHub Issues are the execution backlog for this repository. Use milestones, labels, and issue templates for tracking work; do not create or maintain a separate local backlog file unless a task explicitly requires it. When handing an issue to Copilot, assign `copilot-swe-agent` directly rather than `copilot`.
25
+
26
+ When running repository commands or automation:
27
+
28
+ - Treat user wording as authoritative. If the user asks a question about whether an action should be taken (for example, “Would you land this?”, “Can we merge?”, “Should we push?”), answer the question and wait for explicit imperative confirmation before taking action.
29
+ - Before any state-changing action, ask for and receive explicit confirmation unless the user's latest message is already a clear imperative instruction naming that action. State-changing actions include local file edits, generated file updates, dependency changes, commits, pushes, merges, rebases, branch deletion, publishing, assigning issues, changing labels or milestones, closing or resolving issues/PR threads, submitting PR reviews, triggering workflows, installing packages, or any command that mutates repository, filesystem, GitHub, CI, package, or publication state.
30
+ - Questions, preferences, future-tense statements, or implied approval are not confirmation. Confirmation is valid when it is either an imperative instruction naming the action, such as “edit AGENTS.md”, “commit it”, “push to main”, “merge PR #12”, “assign issue #50”, or “resolve the threads”, or a direct response to a confirmation request using “go ahead”, “yes”, or “confirmed”. The bare response “ok” is not confirmation.
31
+ - Prefer single commands where practical. If the logic is too involved for one command, write a temporary `.mjs` script under `tmp/` instead of building up fragile shell sequences.
32
+ - For GitHub issue/PR descriptions and comments, prefer `--body-file` / `-F` or stdin via `-F -` over inline shell strings. Use heredocs or temp files for multi-line content and avoid interpolating untrusted text directly into shell commands.
33
+ - When a PR verdict is requested, first summarize pending inline comments, proposed resolution status, and the intended verdict text, then ask for confirmation before submitting the review so the user can correct wording or the verdict. For a pull request not opened by the active GitHub user (`<self>`), submit the confirmed verdict as a formal GitHub review: use Approve when the verdict is merge-ready, or Request Changes when the verdict includes must-fix findings. Do not leave only a plain PR comment for these verdicts.
34
+
35
+ When adding new capabilities:
36
+
37
+ - Keep scanner behavior deterministic where possible.
38
+ - Prefer small, composable modules under `src/`.
39
+ - Add tests for file traversal, manifest generation, planning, and linting.
40
+ - Preserve human-maintained wiki sections when implementing update logic.
41
+ - Do not copy secrets, `.env` values, or private tokens into generated markdown.
42
+ - Treat LLM output as an untrusted patch that must pass lint before publishing.
package/CHANGELOG.md ADDED
@@ -0,0 +1,91 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.2.1] - 2026-06-13
11
+
12
+ ### Changed
13
+ - Publish package as `@mfittko/repo-wiki` to resolve npm name-squatting conflict with `repowiki`
14
+
15
+ ## [0.2.0] - 2026-06-13
16
+
17
+ ### Added
18
+ - Add GitHub Actions npm publish workflow and configure package for public npm release
19
+ - **Scanner analysis foundation** — new `src/extractors.ts` module with `extractImports`, `extractSymbols`, `extractExportedSymbols`, `extractEnvironmentVariables`, `extractRouteSurfaces`, and `detectRuntimeHints`; framework detection covers Express, Fastify, Hono, and Next.js route-handler files
20
+ - **Repository analysis** — `src/repository-analysis.ts` with `buildRepositoryAnalysis` (dependency graph, test-to-source mapping) and `extractPackageMetadata` (package name and scripts); integrated into the scanner manifest under an `analysis` key
21
+ - **TypeScript migration** — all files under `src/`, `test/`, and `bin/` converted from `.js` to `.ts`; `tsconfig.json` added with strict-off baseline configuration
22
+ - **GitHub Actions CI** — workflow with build, test, coverage (95 % line gate via `c8`), and `pack --dry-run` steps; CI targets Node 24
23
+ - **Agent instruction files** — coordinator, developer, quality, docs, review, and fixer agents added under `.github/agents/`
24
+ - **PR template and Copilot review instructions** — `.github/pull_request_template.md` and Copilot review configuration added
25
+ - **Changelog automation** — `scripts/update-changelog.mjs` with `npm run changelog:update` and `npm run changelog:release` commands
26
+ - **Compiler wiki pages** — dependency map, configuration, HTTP routes, and testing-strategy pages rendered from scanner analysis output
27
+ - Build scanner analysis foundation, TypeScript migration, and CI enforcement.
28
+ - Add repo guidance and simplify agent names.
29
+ - add issue task template and backlog note.
30
+ - Add AST-backed TypeScript/JavaScript symbol extraction in scanner.
31
+ - add Go source extraction support.
32
+ - Add deterministic migration and ORM/model detection with data-model wiki routing.
33
+ - Add deterministic Python source extraction support with docstring-safe parsing.
34
+ - Add affected-page graph inputs for incremental mode.
35
+ - Add deterministic Rust scanner extraction for imports, re-exports, and top-level items.
36
+ - Add deterministic Ruby source extraction with robust scope/heredoc handling.
37
+ - Add provenance-safe line-anchored GitHub citations for package scripts and CI commands with safe multiline backslash handling and command redaction.
38
+ - Add docs-debt strictness and markdown route/API validation with wildcard method matching, source evidence, and conservative path normalization.
39
+ - Add provenance frontmatter rendering for published wiki pages.
40
+ - Add navigation layout for GitHub Pages wiki export.
41
+ - Add ADR recency and supersession validation.
42
+ - Add copilot-cycle shortcut to coordinator agent.
43
+ - Add deterministic graph-health lint findings from `graph.json`.
44
+ - Add internal wiki graph traversal helpers.
45
+ - Add local offline search index and `repo-wiki search`.
46
+ - Phase 1 graph foundation: stabilize `.llmwiki/graph.json` contract and internal traversal surface.
47
+ - Add graph traversal convenience helpers.
48
+ - Add wiki-first query, path, and explain commands.
49
+
50
+ ### Changed
51
+ - Node.js engine requirement raised to `>=24`; removed unsafe incremental cache from scanner
52
+ - CI switched to Node 24
53
+ - Update build, CI, and release automation to support the change.
54
+ - Clarify repository guidance and review workflow expectations.
55
+ - Expand automated test coverage for the updated behavior.
56
+ - Update the main repository implementation to match the pull request scope.
57
+ - map tests to source modules — E2E coverage gaps + Related tests in module pages.
58
+ - LLM provider boundary and prompt templates.
59
+ - validate documented commands against package.json and CI workflows.
60
+ - human section preservation and page ownership metadata.
61
+ - Honor scanner source excludes and suppress nested worktree/repo noise.
62
+ - Validate documented paths and environment variables.
63
+ - Polish GitHub Wiki publishing output and automation.
64
+ - Update roadmap for LLM Wiki publish targets and skills.
65
+ - structured wiki patch format and lint-gated acceptance.
66
+ - Enforce provenance linting and confidence/claim-status metadata for generated wiki pages.
67
+ - Wire LLM compiler mode into compileWiki (module archetype, phased rollout).
68
+ - LLM-enhance Architecture page with dedicated archetype, prompt, and per-archetype budget overrides.
69
+ - Omit temperature for GPT-5 chat compatibility.
70
+ - Tune architecture LLM timeout and reasoning.
71
+ - Tighten repo-local reading guidance.
72
+ - Gate Architecture.md regeneration and patch deterministic architecture sections.
73
+ - Emit a deterministic wiki graph skeleton to `.llmwiki/graph.json`.
74
+ - Enrich `.llmwiki/graph.json` with deterministic `page_state`, `wiki_link`, and `provenance` data.
75
+ - Use `.llmwiki/graph.json` for deterministic incremental affected-page selection with safe attribution fallback.
76
+ - Define artifact-based consumer contract for runnable downstream repo-wiki CLI.
77
+ - Publish repo-wiki to npm on release.
78
+
79
+ ### Fixed
80
+ - Complete deterministic scanner coverage for NestJS, Koa, tRPC, GraphQL, and OpenAPI API surfaces (including GraphQL field-config resolver mapping).
81
+ - Fix Ruby quoted heredocs and inline end counting.
82
+ - Add explicit GitHub Pages publish target with destination-specific frontmatter defaults and remote-error redaction hardening.
83
+ - Apply plan review findings: 6 new plan docs, P5 drift fix, debt-report linter fixes.
84
+ - use html links in github-pages navigation.
85
+ - Gate `repo-wiki run` on docs/wiki lint errors and block publish on lint failures.
86
+ - address unresolved review comments from #108.
87
+
88
+ ### Security
89
+ - Fix Ruby extractor heredoc and end-token edge cases.
90
+ - Implement deterministic compiler context assembly with token budgeting.
91
+ - Handle GPT-5 token params in OpenAI-compatible provider.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Repo Wiki Compiler contributors
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,254 @@
1
+ # repo-wiki
2
+
3
+ `repo-wiki` is a Node.js CLI and library that compiles a Git repository into a source-grounded wiki knowledge base for humans and coding agents.
4
+
5
+ It follows the LLM Wiki pattern described in `docs/PLAN.md`: scan the repository at a pinned commit, ingest markdown as secondary evidence, compile durable wiki pages, and lint the result before publishing. GitHub Wiki is the primary publication target today, and GitHub Pages is also supported.
6
+
7
+ ## What it does
8
+
9
+ - scans repository files into source cards plus a manifest
10
+ - ingests markdown documentation into documentation cards
11
+ - validates documented commands, file paths, environment variables, and route/API claims
12
+ - plans and compiles local wiki pages under `.llmwiki/wiki/`
13
+ - builds a deterministic graph artifact under `.llmwiki/graph.json` for internal traversal and incremental mapping
14
+ - preserves `HUMAN_NOTES` and skips human-owned or unmanaged pages
15
+ - publishes the local wiki to either GitHub Wiki or GitHub Pages
16
+ - builds a deterministic offline search index under `.llmwiki/search/` and exposes `repo-wiki search`, `repo-wiki query`, `repo-wiki path`, and `repo-wiki explain`
17
+ - supports deterministic compilation and an LLM-assisted compilation path
18
+
19
+ ## Current implementation scope
20
+
21
+ Today the package includes:
22
+
23
+ - a working CLI and library API
24
+ - bootstrap and incremental command flow (`incremental` is wired through the CLI, but scanning is still broad rather than diff-minimal)
25
+ - JavaScript/TypeScript AST-backed extraction for imports, symbols, exports, and route-adjacent surfaces
26
+ - regex/baseline extraction for Python, Go, Rust, and Ruby imports and symbols
27
+ - route detection for Express, Fastify, NestJS, Hono, Koa, tRPC, GraphQL, OpenAPI, and file-based route handlers
28
+ - migration/model detection for SQL-style migrations plus Prisma, TypeORM, Sequelize, and Mongoose-style model signals
29
+ - test-to-source mapping, package-script extraction, CI command extraction, dependency-edge analysis, and environment-variable collection
30
+ - documentation linting and a generated `Documentation-Debt-Report.md`
31
+ - GitHub Wiki and GitHub Pages publishing, including target-specific frontmatter handling
32
+ - LLM synthesis for module pages and `Architecture.md` behind a validated provider boundary
33
+
34
+ ## Requirements
35
+
36
+ - Node.js 24+
37
+
38
+ ## Installation
39
+
40
+ `@mfittko/repo-wiki` is published to the npm registry with each GitHub Release. After the first release, the supported downstream install path is:
41
+
42
+ ```bash
43
+ npm install @mfittko/repo-wiki
44
+ ```
45
+
46
+ For local verification or offline installs, you can also install from a tarball produced with `npm pack`:
47
+
48
+ ```bash
49
+ tarball=$(npm pack | tail -n 1)
50
+ npm install "./$tarball"
51
+ ```
52
+
53
+ After install, the runnable CLI is exposed through `dist/bin/repo-wiki.js` declared in `package.json#bin`:
54
+
55
+ ```bash
56
+ npx repo-wiki --help
57
+ ```
58
+
59
+ No clone or local build step is required for normal downstream consumption. The package guarantees the files listed in `package.json#files`, including `dist/`, `README.md`, `CHANGELOG.md`, `.llmwiki/schema.md`, `.llmwiki/config.json`, and the `docs/`, `prompts/`, and `skills/` trees. Local development from a source clone should use `npm install` instead (the `prepare` script runs the build).
60
+
61
+ ## Quick start
62
+
63
+ Initialize a repository for repo-wiki:
64
+
65
+ ```bash
66
+ npx repo-wiki init --repo . --write-agents
67
+ ```
68
+
69
+ Run a full local bootstrap:
70
+
71
+ ```bash
72
+ npx repo-wiki run \
73
+ --mode bootstrap \
74
+ --repo . \
75
+ --scan .llmwiki/run \
76
+ --plan .llmwiki/bootstrap-plan.json \
77
+ --wiki .llmwiki/wiki
78
+ ```
79
+
80
+ The default workflow writes:
81
+
82
+ - `.llmwiki/config.json`
83
+ - `.llmwiki/schema.md`
84
+ - `.llmwiki/run/manifest.json` and card artifacts
85
+ - `.llmwiki/wiki/*.md`
86
+ - `.llmwiki/graph.json`
87
+ - `.llmwiki/search/index.json`
88
+ - an optional agent pointer file when `--write-agents` is used
89
+
90
+ ## Command surface
91
+
92
+ ```text
93
+ repo-wiki init Add .llmwiki config/schema files to a repository.
94
+ repo-wiki scan Scan source files and markdown docs into cards and a manifest.
95
+ repo-wiki plan Create a bootstrap or incremental wiki compilation plan.
96
+ repo-wiki lint-docs Validate ingested markdown documentation before compilation.
97
+ repo-wiki compile Generate or update local wiki markdown pages.
98
+ repo-wiki lint Validate generated wiki pages.
99
+ repo-wiki publish Publish local wiki pages to GitHub Wiki or GitHub Pages.
100
+ repo-wiki search Search local wiki pages through the built-in offline index.
101
+ repo-wiki query Answer from local wiki/search/graph evidence.
102
+ repo-wiki path Traverse `.llmwiki/graph.json` between two nodes or paths.
103
+ repo-wiki explain Explain a page or graph node with local evidence.
104
+ repo-wiki run Run scan -> plan -> lint-docs -> compile -> lint, optionally followed by publish.
105
+ ```
106
+
107
+ `run` blocks compilation and publish when `lint-docs` reports error-level issues.
108
+
109
+ Search is fully local and page-first:
110
+
111
+ ```bash
112
+ repo-wiki search "scanner" --wiki .llmwiki/wiki
113
+ repo-wiki search "architecture" --wiki .llmwiki/wiki --json
114
+ repo-wiki query "How does compile work?" --wiki .llmwiki/wiki --json
115
+ repo-wiki path Architecture.md src/compiler.ts --graph .llmwiki/graph.json --json
116
+ repo-wiki explain Module-compiler-ts.md --wiki .llmwiki/wiki --json
117
+ ```
118
+
119
+ The built-in index is rebuilt deterministically from local wiki pages and stored at `.llmwiki/search/index.json`. Results include page identity, kind, snippet/summary, source paths, and lightweight internal-link graph context for routing follow-up investigation. `query` and `explain` are offline, extractive v1 surfaces: they assemble answers from ranked wiki pages plus graph provenance and include evidence references for material claims. `path` uses the persisted graph artifact for deterministic shortest-path traversal. Hosted synthesis, file-back, and runtime transports are deferred.
120
+
121
+ ## Graph foundation (shipped in v1)
122
+
123
+ The compiler now emits `.llmwiki/graph.json` as a deterministic local artifact. Current v1 graph contract includes:
124
+
125
+ - node kinds: `page`, `source`, `documentation`, `module`
126
+ - edge kinds: `wiki_link`, `provenance`, `affects`, `owns`
127
+ - deterministic validation for duplicate node IDs, malformed IDs, dangling edge endpoints, and invalid edge target kinds
128
+
129
+ The graph is an additive internal foundation used by planner/linter/incremental helpers. `.llmwiki/wiki` remains the primary derived artifact and publication surface.
130
+
131
+ ## Documentation authority model
132
+
133
+ Code at the pinned commit is authoritative. Tests, CI/configuration, and generated schemas are stronger evidence than markdown. Markdown docs are still ingested because they often contain intent, terminology, onboarding, and runbook context.
134
+
135
+ The default documentation config is loaded from `src/config.ts` and includes:
136
+
137
+ - `documentation.ingest=true`
138
+ - `authority="secondary"`
139
+ - include patterns for `README.md`, `docs/**/*.md`, `ADR/**/*.md`, and `.github/**/*.md`
140
+ - default lint behavior for stale docs, contradicted docs, broken file references, unvalidated env vars, and unvalidated route claims
141
+
142
+ `repo-wiki lint-docs` validates documented package scripts/commands, checks relative links and referenced repo paths, and compares route/API claims against scanner-extracted route surfaces when available.
143
+
144
+ ## Deterministic and LLM compilation
145
+
146
+ The default compiler mode is deterministic.
147
+
148
+ LLM mode is also shipped:
149
+
150
+ - set `compiler.mode` to `llm` in `.llmwiki/config.json`, or
151
+ - export `LLMWIKI_COMPILER_MODE=llm`
152
+
153
+ In LLM mode:
154
+
155
+ - module pages and `Architecture.md` are synthesized through the provider boundary
156
+ - generated output must pass structured wiki-patch validation before it is written
157
+ - foundation and cross-cutting pages remain deterministic today
158
+ - the mock provider is still useful for tests and CI, while hosted mode uses the OpenAI-compatible provider
159
+
160
+ Useful environment variables include:
161
+
162
+ - `LLMWIKI_COMPILER_MODE`
163
+ - `LLMWIKI_LLM_PROVIDER`
164
+ - `LLMWIKI_LLM_BASE_URL`
165
+ - `LLMWIKI_LLM_MODEL`
166
+ - `LLMWIKI_LLM_API_KEY`
167
+ - `LLMWIKI_LLM_SYSTEM_PROMPT`
168
+ - `LLMWIKI_LLM_SYSTEM_PROMPT_FILE`
169
+ - `LLMWIKI_LLM_TEMPERATURE`
170
+ - `LLMWIKI_LLM_MAX_OUTPUT_TOKENS`
171
+ - `LLMWIKI_LLM_TIMEOUT_MS`
172
+ - `LLMWIKI_LLM_REASONING_EFFORT`
173
+ - `LLMWIKI_LLM_RETRIES`
174
+ - `LLMWIKI_LLM_VALIDATION_RETRIES`
175
+ - `LLMWIKI_LLM_ARCHITECTURE_MODEL`
176
+ - `LLMWIKI_LLM_ARCHITECTURE_MAX_OUTPUT_TOKENS`
177
+ - `LLMWIKI_LLM_ARCHITECTURE_TIMEOUT_MS`
178
+ - `LLMWIKI_LLM_ARCHITECTURE_REASONING_EFFORT`
179
+
180
+ ## Publish targets
181
+
182
+ Publish to GitHub Wiki:
183
+
184
+ ```bash
185
+ repo-wiki publish \
186
+ --target github-wiki \
187
+ --wiki .llmwiki/wiki \
188
+ --remote https://github.com/OWNER/REPO.wiki.git
189
+ ```
190
+
191
+ Publish to GitHub Pages:
192
+
193
+ ```bash
194
+ repo-wiki publish \
195
+ --target github-pages \
196
+ --wiki .llmwiki/wiki \
197
+ --remote https://github.com/OWNER/REPO.git \
198
+ --branch gh-pages \
199
+ --pages-path .
200
+ ```
201
+
202
+ Notes:
203
+
204
+ - GitHub Wiki defaults to `frontmatter=provenance`
205
+ - GitHub Pages defaults to `frontmatter=preserve`
206
+ - `--frontmatter-policy` and `--frontmatter` are both accepted
207
+ - `--dry-run` reports target, branch/path, page count, and frontmatter policy without pushing
208
+ - `LLMWIKI_PUBLISH_REMOTE` is the primary publish remote env var; GitHub Wiki publishing also falls back to `GITHUB_WIKI_REMOTE`
209
+
210
+ The repository also ships `.github/workflows/wiki.yml`, which compiles on `main`, publishes the GitHub Wiki on `main`, publishes GitHub Pages automatically on pushes to `main`, and can also publish Pages on manual dispatch when `publish_pages=true`.
211
+
212
+ ## Library API
213
+
214
+ ```js
215
+ import {
216
+ initProject,
217
+ scanRepository,
218
+ createBootstrapPlan,
219
+ lintDocs,
220
+ compileWiki,
221
+ lintWiki,
222
+ publishWiki
223
+ } from '@mfittko/repo-wiki';
224
+ ```
225
+
226
+ Advanced exports also expose prompt-building, provider configuration, frontmatter policies, wiki-patch validation, and page-ownership helpers.
227
+
228
+ ## Local development
229
+
230
+ ```bash
231
+ npm install
232
+ npm run build
233
+ npm run lint:code
234
+ npm run check
235
+ npm run coverage
236
+ npm run pack:check
237
+ npm run self:wiki
238
+ npm run lint:docs
239
+ npm run lint:local
240
+ npm run changelog:ensure
241
+ ```
242
+
243
+ Notes:
244
+
245
+ - `npm test` aliases `npm run check`
246
+ - tests run against built output in `dist/`
247
+ - `npm run coverage` enforces a 95% line-coverage gate on compiled source
248
+ - `npm run self:wiki` runs the package against this repository
249
+
250
+ ## Current status and near-term gaps
251
+
252
+ The current package ships a working CLI, scanner, docs linting, deterministic compiler, LLM page synthesis path, wiki linting, publisher, and CI workflows.
253
+
254
+ Still planned rather than shipped are user-facing `doctor`, `diff`, backend graph adapters (for example Neo4j/SQLite), filed-back query pages, hosted answer synthesis, and runtime transport surfaces described in `docs/PLAN.md` and `docs/plans/wiki-graph.md`. The shipped search/query/path/explain surfaces are built-in local page-first commands; external adapters and richer file-back layers remain deferred.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ import { runCli } from '../src/cli.js';
3
+ runCli(process.argv.slice(2)).catch((error) => {
4
+ console.error(error?.stack || error?.message || String(error));
5
+ process.exit(1);
6
+ });
7
+ //# sourceMappingURL=repo-wiki.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"repo-wiki.js","sourceRoot":"","sources":["../../bin/repo-wiki.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IAC5C,OAAO,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,IAAI,KAAK,EAAE,OAAO,IAAI,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare function runCli(argv: string[]): Promise<void>;