@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.
- package/.llmwiki/schema.md +107 -0
- package/AGENTS.md +42 -0
- package/CHANGELOG.md +91 -0
- package/LICENSE +21 -0
- package/README.md +254 -0
- package/dist/bin/repo-wiki.d.ts +2 -0
- package/dist/bin/repo-wiki.js +7 -0
- package/dist/bin/repo-wiki.js.map +1 -0
- package/dist/src/cli.d.ts +1 -0
- package/dist/src/cli.js +404 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/compiler.d.ts +55 -0
- package/dist/src/compiler.js +2046 -0
- package/dist/src/compiler.js.map +1 -0
- package/dist/src/config.d.ts +63 -0
- package/dist/src/config.js +86 -0
- package/dist/src/config.js.map +1 -0
- package/dist/src/context-assembler.d.ts +68 -0
- package/dist/src/context-assembler.js +378 -0
- package/dist/src/context-assembler.js.map +1 -0
- package/dist/src/data-model-signals.d.ts +1 -0
- package/dist/src/data-model-signals.js +13 -0
- package/dist/src/data-model-signals.js.map +1 -0
- package/dist/src/docs-ingestor.d.ts +138 -0
- package/dist/src/docs-ingestor.js +844 -0
- package/dist/src/docs-ingestor.js.map +1 -0
- package/dist/src/docs-linter.d.ts +14 -0
- package/dist/src/docs-linter.js +164 -0
- package/dist/src/docs-linter.js.map +1 -0
- package/dist/src/docs-validation.d.ts +36 -0
- package/dist/src/docs-validation.js +297 -0
- package/dist/src/docs-validation.js.map +1 -0
- package/dist/src/extractors.d.ts +50 -0
- package/dist/src/extractors.js +2275 -0
- package/dist/src/extractors.js.map +1 -0
- package/dist/src/frontmatter.d.ts +46 -0
- package/dist/src/frontmatter.js +377 -0
- package/dist/src/frontmatter.js.map +1 -0
- package/dist/src/index.d.ts +26 -0
- package/dist/src/index.js +18 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/init.d.ts +12 -0
- package/dist/src/init.js +121 -0
- package/dist/src/init.js.map +1 -0
- package/dist/src/language.d.ts +2 -0
- package/dist/src/language.js +62 -0
- package/dist/src/language.js.map +1 -0
- package/dist/src/linter.d.ts +33 -0
- package/dist/src/linter.js +398 -0
- package/dist/src/linter.js.map +1 -0
- package/dist/src/llm-provider.d.ts +267 -0
- package/dist/src/llm-provider.js +474 -0
- package/dist/src/llm-provider.js.map +1 -0
- package/dist/src/page-ownership.d.ts +38 -0
- package/dist/src/page-ownership.js +96 -0
- package/dist/src/page-ownership.js.map +1 -0
- package/dist/src/planner.d.ts +55 -0
- package/dist/src/planner.js +422 -0
- package/dist/src/planner.js.map +1 -0
- package/dist/src/prompts.d.ts +103 -0
- package/dist/src/prompts.js +344 -0
- package/dist/src/prompts.js.map +1 -0
- package/dist/src/publisher.d.ts +68 -0
- package/dist/src/publisher.js +662 -0
- package/dist/src/publisher.js.map +1 -0
- package/dist/src/repository-analysis.d.ts +88 -0
- package/dist/src/repository-analysis.js +485 -0
- package/dist/src/repository-analysis.js.map +1 -0
- package/dist/src/scanner.d.ts +122 -0
- package/dist/src/scanner.js +309 -0
- package/dist/src/scanner.js.map +1 -0
- package/dist/src/search.d.ts +71 -0
- package/dist/src/search.js +410 -0
- package/dist/src/search.js.map +1 -0
- package/dist/src/secret-patterns.d.ts +3 -0
- package/dist/src/secret-patterns.js +14 -0
- package/dist/src/secret-patterns.js.map +1 -0
- package/dist/src/utils/args.d.ts +2 -0
- package/dist/src/utils/args.js +19 -0
- package/dist/src/utils/args.js.map +1 -0
- package/dist/src/utils/dotenv.d.ts +7 -0
- package/dist/src/utils/dotenv.js +73 -0
- package/dist/src/utils/dotenv.js.map +1 -0
- package/dist/src/utils/fs.d.ts +22 -0
- package/dist/src/utils/fs.js +83 -0
- package/dist/src/utils/fs.js.map +1 -0
- package/dist/src/utils/git.d.ts +13 -0
- package/dist/src/utils/git.js +39 -0
- package/dist/src/utils/git.js.map +1 -0
- package/dist/src/wiki-graph.d.ts +74 -0
- package/dist/src/wiki-graph.js +335 -0
- package/dist/src/wiki-graph.js.map +1 -0
- package/dist/src/wiki-patch.d.ts +152 -0
- package/dist/src/wiki-patch.js +489 -0
- package/dist/src/wiki-patch.js.map +1 -0
- package/dist/src/wiki-query.d.ts +63 -0
- package/dist/src/wiki-query.js +255 -0
- package/dist/src/wiki-query.js.map +1 -0
- package/dist/test/cli.test.d.ts +1 -0
- package/dist/test/cli.test.js +514 -0
- package/dist/test/cli.test.js.map +1 -0
- package/dist/test/compiler-eval.test.d.ts +1 -0
- package/dist/test/compiler-eval.test.js +234 -0
- package/dist/test/compiler-eval.test.js.map +1 -0
- package/dist/test/compiler.test.d.ts +1 -0
- package/dist/test/compiler.test.js +2537 -0
- package/dist/test/compiler.test.js.map +1 -0
- package/dist/test/context-assembler.test.d.ts +1 -0
- package/dist/test/context-assembler.test.js +379 -0
- package/dist/test/context-assembler.test.js.map +1 -0
- package/dist/test/docs-linter.test.d.ts +1 -0
- package/dist/test/docs-linter.test.js +900 -0
- package/dist/test/docs-linter.test.js.map +1 -0
- package/dist/test/dotenv.test.d.ts +1 -0
- package/dist/test/dotenv.test.js +77 -0
- package/dist/test/dotenv.test.js.map +1 -0
- package/dist/test/extractors-go.test.d.ts +1 -0
- package/dist/test/extractors-go.test.js +393 -0
- package/dist/test/extractors-go.test.js.map +1 -0
- package/dist/test/extractors-rust.test.d.ts +1 -0
- package/dist/test/extractors-rust.test.js +219 -0
- package/dist/test/extractors-rust.test.js.map +1 -0
- package/dist/test/extractors-utils.test.d.ts +1 -0
- package/dist/test/extractors-utils.test.js +786 -0
- package/dist/test/extractors-utils.test.js.map +1 -0
- package/dist/test/fixtures/compiler-e2e/basic-node-service/repo/infra/deploy.d.ts +1 -0
- package/dist/test/fixtures/compiler-e2e/basic-node-service/repo/infra/deploy.js +4 -0
- package/dist/test/fixtures/compiler-e2e/basic-node-service/repo/infra/deploy.js.map +1 -0
- package/dist/test/frontmatter.test.d.ts +1 -0
- package/dist/test/frontmatter.test.js +287 -0
- package/dist/test/frontmatter.test.js.map +1 -0
- package/dist/test/init-planner.test.d.ts +1 -0
- package/dist/test/init-planner.test.js +688 -0
- package/dist/test/init-planner.test.js.map +1 -0
- package/dist/test/linter.test.d.ts +1 -0
- package/dist/test/linter.test.js +426 -0
- package/dist/test/linter.test.js.map +1 -0
- package/dist/test/llm-provider.test.d.ts +1 -0
- package/dist/test/llm-provider.test.js +783 -0
- package/dist/test/llm-provider.test.js.map +1 -0
- package/dist/test/page-ownership.test.d.ts +1 -0
- package/dist/test/page-ownership.test.js +247 -0
- package/dist/test/page-ownership.test.js.map +1 -0
- package/dist/test/publisher.test.d.ts +1 -0
- package/dist/test/publisher.test.js +1297 -0
- package/dist/test/publisher.test.js.map +1 -0
- package/dist/test/repository-analysis.test.d.ts +1 -0
- package/dist/test/repository-analysis.test.js +182 -0
- package/dist/test/repository-analysis.test.js.map +1 -0
- package/dist/test/run-compiled-tests.d.ts +1 -0
- package/dist/test/run-compiled-tests.js +48 -0
- package/dist/test/run-compiled-tests.js.map +1 -0
- package/dist/test/scanner.test.d.ts +1 -0
- package/dist/test/scanner.test.js +551 -0
- package/dist/test/scanner.test.js.map +1 -0
- package/dist/test/search.test.d.ts +1 -0
- package/dist/test/search.test.js +92 -0
- package/dist/test/search.test.js.map +1 -0
- package/dist/test/update-changelog.test.d.ts +1 -0
- package/dist/test/update-changelog.test.js +125 -0
- package/dist/test/update-changelog.test.js.map +1 -0
- package/dist/test/wiki-graph.test.d.ts +1 -0
- package/dist/test/wiki-graph.test.js +164 -0
- package/dist/test/wiki-graph.test.js.map +1 -0
- package/dist/test/wiki-patch.test.d.ts +1 -0
- package/dist/test/wiki-patch.test.js +610 -0
- package/dist/test/wiki-patch.test.js.map +1 -0
- package/dist/test/wiki-query.test.d.ts +1 -0
- package/dist/test/wiki-query.test.js +163 -0
- package/dist/test/wiki-query.test.js.map +1 -0
- package/docs/PLAN.md +993 -0
- package/docs/WHY.md +61 -0
- package/docs/plans/agent-integration.md +85 -0
- package/docs/plans/ci-publishing.md +111 -0
- package/docs/plans/doc-validation.md +92 -0
- package/docs/plans/github-action.md +113 -0
- package/docs/plans/incremental-mode.md +98 -0
- package/docs/plans/karpathy-llm-wiki-alignment.md +84 -0
- package/docs/plans/llm-compiler.md +160 -0
- package/docs/plans/production-scanner.md +104 -0
- package/docs/plans/query-and-file-back.md +103 -0
- package/docs/plans/search-index.md +118 -0
- package/docs/plans/trust-hardening.md +74 -0
- package/docs/plans/wiki-graph.md +183 -0
- package/docs/plans/wiki-health.md +76 -0
- package/package.json +83 -0
- package/prompts/compiler.md +16 -0
- package/prompts/lint.md +18 -0
- package/prompts/page-templates.md +25 -0
- package/skills/repo-wiki-cli/SKILL.md +139 -0
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Epic: Wiki Knowledge Graph
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
Build a plugin-based knowledge graph system that models relationships between wiki pages, source modules, documentation topics, and ownership state. The core graph is backend-agnostic — adapters translate it to different storage and rendering targets (GitHub Wiki, Neo4j, Confluence, Obsidian, flat JSON). The graph powers navigation generation, cross-link validation, agent query routing, affected-page detection for incremental updates, and safe reconciliation with existing wikis.
|
|
6
|
+
|
|
7
|
+
## Current shipped foundation (Phase 1)
|
|
8
|
+
|
|
9
|
+
The repository now ships a local deterministic graph foundation at `.llmwiki/graph.json` (`schema_version: 1`) with internal loader/index/traversal helpers.
|
|
10
|
+
|
|
11
|
+
- Shipped node kinds: `page`, `source`, `documentation`, `module`
|
|
12
|
+
- Shipped edge kinds: `wiki_link`, `provenance`, `affects`, `owns`
|
|
13
|
+
- Shipped validation gates: malformed IDs, duplicate IDs, dangling endpoints, invalid edge endpoint kinds
|
|
14
|
+
|
|
15
|
+
This foundation is intentionally local and JSON-based. `.llmwiki/wiki` remains the primary derived artifact.
|
|
16
|
+
|
|
17
|
+
## Still planned (not shipped in Phase 1)
|
|
18
|
+
|
|
19
|
+
- backend adapters (Neo4j/SQLite/other)
|
|
20
|
+
- plugin discovery and adapter registration
|
|
21
|
+
- public runtime query/path/explain/watch transports
|
|
22
|
+
|
|
23
|
+
## Architecture
|
|
24
|
+
|
|
25
|
+
```mermaid
|
|
26
|
+
flowchart TD
|
|
27
|
+
subgraph Core["Core Graph Model"]
|
|
28
|
+
Nodes[Nodes: page, module, source-file, doc-topic]
|
|
29
|
+
Edges[Edges: links-to, depends-on, parent-of, related-to, supersedes, tests, documents]
|
|
30
|
+
Traversal[Traversal Engine]
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
Core --> StorageLayer[Storage Adapter Interface]
|
|
34
|
+
Core --> RenderLayer[Render Adapter Interface]
|
|
35
|
+
Core --> QueryLayer[Query Adapter Interface]
|
|
36
|
+
|
|
37
|
+
StorageLayer --> JSON[JSON File]
|
|
38
|
+
StorageLayer --> Neo4j[Neo4j]
|
|
39
|
+
StorageLayer --> SQLite[SQLite]
|
|
40
|
+
StorageLayer --> CustomS[Custom Plugin]
|
|
41
|
+
|
|
42
|
+
RenderLayer --> GHWiki[GitHub Wiki]
|
|
43
|
+
RenderLayer --> Obsidian[Obsidian]
|
|
44
|
+
RenderLayer --> Confluence[Confluence]
|
|
45
|
+
RenderLayer --> CustomR[Custom Plugin]
|
|
46
|
+
|
|
47
|
+
QueryLayer --> InMemory[In-Memory]
|
|
48
|
+
QueryLayer --> Cypher[Cypher / Neo4j]
|
|
49
|
+
QueryLayer --> MCP[MCP Endpoint]
|
|
50
|
+
QueryLayer --> CustomQ[Custom Plugin]
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
```mermaid
|
|
54
|
+
flowchart TD
|
|
55
|
+
Scanner[Production Scanner] --> ImportGraph[Import Graph]
|
|
56
|
+
WikiPages[Wiki Pages] --> LinkExtract[Link Extraction]
|
|
57
|
+
Frontmatter[Page Frontmatter] --> Metadata[Relationship Metadata]
|
|
58
|
+
OwnershipMarkers[Ownership + Preserve Markers] --> Metadata
|
|
59
|
+
|
|
60
|
+
ImportGraph --> GraphBuilder[Graph Builder]
|
|
61
|
+
LinkExtract --> GraphBuilder
|
|
62
|
+
Metadata --> GraphBuilder
|
|
63
|
+
|
|
64
|
+
GraphBuilder --> CoreGraph[Core Graph]
|
|
65
|
+
CoreGraph --> NavGen[Navigation Generation]
|
|
66
|
+
CoreGraph --> OrphanDetect[Orphan Detection]
|
|
67
|
+
CoreGraph --> AffectedCalc[Affected Page Calculation]
|
|
68
|
+
CoreGraph --> Reconcile[Reconcile / Delete Decisions]
|
|
69
|
+
CoreGraph --> AgentQuery[Agent Query Routing]
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```mermaid
|
|
73
|
+
graph LR
|
|
74
|
+
subgraph "Example Graph"
|
|
75
|
+
Home((Home)) --> Arch((Architecture))
|
|
76
|
+
Home --> Index((Index))
|
|
77
|
+
Home --> Agent((Agent-Context-Pack))
|
|
78
|
+
Index --> ModA((Module-A))
|
|
79
|
+
Index --> ModB((Module-B))
|
|
80
|
+
Arch --> ModA
|
|
81
|
+
ModA --> ModB
|
|
82
|
+
ModB --> DepMap((Dependency-Map))
|
|
83
|
+
ModA --> TestStrat((Testing-Strategy))
|
|
84
|
+
end
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
## Plugin Contract
|
|
88
|
+
|
|
89
|
+
Each adapter type implements a minimal interface:
|
|
90
|
+
|
|
91
|
+
**Storage adapter** — persist and load the graph
|
|
92
|
+
- `save(graph)` → serialize graph to backend
|
|
93
|
+
- `load()` → deserialize graph from backend
|
|
94
|
+
- `patch(delta)` → apply incremental changes
|
|
95
|
+
|
|
96
|
+
**Render adapter** — produce navigation/linking artifacts for the target platform
|
|
97
|
+
- `renderNavigation(graph)` → platform-specific nav (e.g., `_Sidebar.md`, Obsidian MOC, Confluence space tree)
|
|
98
|
+
- `renderPageLinks(node)` → "Related pages" section in platform format
|
|
99
|
+
- `renderBreadcrumbs(node)` → ancestry path
|
|
100
|
+
|
|
101
|
+
**Query adapter** — expose graph queries to consumers
|
|
102
|
+
- `related(nodeId, depth)` → connected nodes within N hops
|
|
103
|
+
- `path(from, to)` → shortest path between nodes
|
|
104
|
+
- `affected(changedNodes)` → transitively affected pages
|
|
105
|
+
- `orphans()` → nodes with no inbound edges
|
|
106
|
+
- `clusters()` → disconnected subgraphs
|
|
107
|
+
|
|
108
|
+
## Key Deliverables
|
|
109
|
+
|
|
110
|
+
### Core graph model
|
|
111
|
+
- Node types: page, module, source-file, documentation-topic
|
|
112
|
+
- Edge types: links-to, depends-on, parent-of, related-to, supersedes, tests, documents, owns, preserves
|
|
113
|
+
- Edge metadata: weight, direction, source (explicit link vs. inferred)
|
|
114
|
+
- Graph construction from wiki content (extracted links, frontmatter)
|
|
115
|
+
- Graph construction from existing wiki ownership metadata and preserved sections
|
|
116
|
+
- Graph construction from source relationships (import graph → page graph)
|
|
117
|
+
- Orphan and cluster detection
|
|
118
|
+
- Generated/human/mixed page classification
|
|
119
|
+
- Deterministic serialization format (JSON reference schema)
|
|
120
|
+
|
|
121
|
+
### Built-in adapters
|
|
122
|
+
- **Storage: JSON file** — default, zero-dependency, works offline
|
|
123
|
+
- **Storage: Neo4j** — optional, for teams wanting native graph queries at scale
|
|
124
|
+
- **Render: GitHub Wiki** — `_Sidebar.md`, `Index.md`, wikilink format
|
|
125
|
+
- **Render: Obsidian** — MOC pages, `[[wikilink]]` format, graph metadata in YAML frontmatter
|
|
126
|
+
- **Query: In-memory** — default traversal engine for CLI and agent use
|
|
127
|
+
- **Query: MCP** — expose graph queries via Model Context Protocol for agent tooling
|
|
128
|
+
|
|
129
|
+
### Plugin registration
|
|
130
|
+
- Config-driven adapter selection in `.llmwiki/config.json`
|
|
131
|
+
- Plugin discovery via package exports or local file path
|
|
132
|
+
- Adapter validation (schema compliance check on load)
|
|
133
|
+
|
|
134
|
+
## Success Criteria
|
|
135
|
+
|
|
136
|
+
- Core graph model is independent of any specific wiki platform or storage backend
|
|
137
|
+
- Swapping adapters requires only config changes, no code modifications
|
|
138
|
+
- Every wiki page has explicit relationship metadata (inbound/outbound links, module associations)
|
|
139
|
+
- Every wiki page can be classified as generated, human-owned, mixed, or unmanaged
|
|
140
|
+
- Navigation artifacts are generated from the graph via the render adapter, not hardcoded
|
|
141
|
+
- Orphan and under-connected pages are surfaced as lint warnings
|
|
142
|
+
- Agents can query "what pages should I read for task X?" via the query adapter
|
|
143
|
+
- Incremental mode uses the graph to determine affected pages from a source change
|
|
144
|
+
- Reconcile and delete decisions can be derived from graph ownership data instead of filename heuristics
|
|
145
|
+
- A new adapter can be added without modifying core graph code
|
|
146
|
+
|
|
147
|
+
## Configuration Example
|
|
148
|
+
|
|
149
|
+
```json
|
|
150
|
+
{
|
|
151
|
+
"graph": {
|
|
152
|
+
"storage": {
|
|
153
|
+
"adapter": "json-file",
|
|
154
|
+
"options": { "path": ".llmwiki/graph.json" }
|
|
155
|
+
},
|
|
156
|
+
"render": {
|
|
157
|
+
"adapter": "github-wiki",
|
|
158
|
+
"options": { "sidebar": true, "breadcrumbs": false }
|
|
159
|
+
},
|
|
160
|
+
"query": {
|
|
161
|
+
"adapter": "in-memory",
|
|
162
|
+
"options": { "maxDepth": 3 }
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
## Dependencies
|
|
169
|
+
|
|
170
|
+
- Upstream: Production scanner (source-to-module mapping, import graph), LLM compiler (page generation with relationship metadata)
|
|
171
|
+
- Downstream: Incremental mode (affected-page detection via query adapter), agent-integration (query routing via MCP adapter), CI publishing (navigation regeneration via render adapter)
|
|
172
|
+
|
|
173
|
+
## Open Questions
|
|
174
|
+
|
|
175
|
+
- How to handle bidirectional link consistency (if A links to B, should B always link back)?
|
|
176
|
+
- Should the graph support weighted relationships (strong vs. weak connections)?
|
|
177
|
+
- How to model cross-repo wiki relationships for monorepo scenarios?
|
|
178
|
+
- Should the graph include documentation-to-source edges or only page-to-page?
|
|
179
|
+
- What's the minimum adapter interface that covers all current use cases without over-abstracting?
|
|
180
|
+
- Should adapters be npm packages, local files, or both?
|
|
181
|
+
- How to handle adapter-specific features (e.g., Neo4j Cypher queries) without leaking into the core model?
|
|
182
|
+
- Should preserved sections be modeled as subnodes, annotations, or opaque page metadata?
|
|
183
|
+
- How should ownership transfer be represented when a human takes over a previously generated page?
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
# Epic: Wiki Health Linting
|
|
2
|
+
|
|
3
|
+
## Summary
|
|
4
|
+
|
|
5
|
+
Extend the existing `repo-wiki lint` gate with wiki health checks that detect graph-level problems: orphan pages, stale generated pages, missing cross-references, recurring unpaged concepts, broken wiki links, and generated pages whose sources no longer exist. Health findings should be deterministic, config-driven for severity, and consumable by both CI and agents proposing repair patches.
|
|
6
|
+
|
|
7
|
+
## Architecture
|
|
8
|
+
|
|
9
|
+
```mermaid
|
|
10
|
+
flowchart TD
|
|
11
|
+
Wiki["Local wiki pages"] --> Graph["Wiki link graph"]
|
|
12
|
+
Manifest["Manifest + source cards"] --> Graph
|
|
13
|
+
Graph --> Orphan["Orphan detector<br/>(no inbound links)"]
|
|
14
|
+
Graph --> Stale["Stale page detector<br/>(source commit far behind HEAD)"]
|
|
15
|
+
Graph --> BrokenLinks["Broken link checker"]
|
|
16
|
+
Graph --> MissingCross["Missing cross-reference detector"]
|
|
17
|
+
Graph --> Concepts["Recurring concept detector<br/>(unpaged concepts)"]
|
|
18
|
+
Manifest --> DeletedSource["Deleted/renamed source detector"]
|
|
19
|
+
DeletedSource --> StaleGen["Stale generated page report"]
|
|
20
|
+
Orphan --> Report["Health report"]
|
|
21
|
+
Stale --> Report
|
|
22
|
+
BrokenLinks --> Report
|
|
23
|
+
MissingCross --> Report
|
|
24
|
+
Concepts --> Report
|
|
25
|
+
StaleGen --> Report
|
|
26
|
+
Report --> CI["CI exit code policy"]
|
|
27
|
+
Report --> Agent["Agent repair patch input"]
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Key Deliverables
|
|
31
|
+
|
|
32
|
+
- Orphan-page detection: pages with no inbound wiki links.
|
|
33
|
+
- Stale-page detection: generated pages whose `source_commit` is far behind HEAD.
|
|
34
|
+
- Broken wiki link checker: links to pages that do not exist.
|
|
35
|
+
- Missing cross-reference detector: related module and cross-cutting pages not linked to each other.
|
|
36
|
+
- Recurring concept detector: terms mentioned frequently across pages that lack their own dedicated page.
|
|
37
|
+
- Deleted/renamed source detector: generated pages for files or modules that no longer exist.
|
|
38
|
+
- Config-driven severity: each check independently set to `warning` or `error`.
|
|
39
|
+
- Machine-readable JSON output for CI and agent consumption alongside human-readable text.
|
|
40
|
+
- Integration with `repo-wiki lint` as the primary gate; optionally surfaced via a future `repo-wiki health` command.
|
|
41
|
+
|
|
42
|
+
## Success Criteria
|
|
43
|
+
|
|
44
|
+
- Health findings are deterministic for the same wiki and manifest inputs.
|
|
45
|
+
- CI can fail on error-level findings while surfacing warnings without blocking.
|
|
46
|
+
- An agent can consume the JSON output and propose targeted repair patches.
|
|
47
|
+
- Stale generated pages for deleted sources are identified and eligible for safe deletion by the publisher.
|
|
48
|
+
|
|
49
|
+
## Acceptance Criteria (from PLAN.md)
|
|
50
|
+
|
|
51
|
+
- Health findings are deterministic under the same wiki and manifest inputs.
|
|
52
|
+
- Config controls warning vs error severity per check.
|
|
53
|
+
- Lint output is consumable by CI and by an agent proposing repair patches.
|
|
54
|
+
|
|
55
|
+
## Severity Defaults
|
|
56
|
+
|
|
57
|
+
| Check | Default |
|
|
58
|
+
|---|---|
|
|
59
|
+
| Orphan pages | warning |
|
|
60
|
+
| Stale pages (source commit) | warning or error by policy |
|
|
61
|
+
| Broken wiki links | warning (should become error for navigation-critical links) |
|
|
62
|
+
| Missing cross-references | warning |
|
|
63
|
+
| Recurring unpaged concepts | warning |
|
|
64
|
+
| Stale generated pages (deleted sources) | error |
|
|
65
|
+
| Oversized pages | warning |
|
|
66
|
+
|
|
67
|
+
## Dependencies
|
|
68
|
+
|
|
69
|
+
- Upstream: wiki linter, publisher, scanner (for source commit and file-existence data).
|
|
70
|
+
- Downstream: incremental mode (uses stale/deleted page data for safe deletes), agent integration (consumes health JSON for repair prompts).
|
|
71
|
+
|
|
72
|
+
## Open Questions
|
|
73
|
+
|
|
74
|
+
- How should the health linter distinguish useful hub pages from pages that are merely large?
|
|
75
|
+
- Should recurring concept detection run on compiled page content or on source card metadata?
|
|
76
|
+
- What threshold (number of mentions, number of pages) triggers a "missing page" suggestion?
|
package/package.json
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mfittko/repo-wiki",
|
|
3
|
+
"version": "0.2.1",
|
|
4
|
+
"description": "Node.js CLI and library for compiling any Git repository and its validated documentation into a GitHub Wiki knowledge base.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"private": false,
|
|
7
|
+
"bin": {
|
|
8
|
+
"repo-wiki": "./dist/bin/repo-wiki.js"
|
|
9
|
+
},
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./dist/src/index.d.ts",
|
|
13
|
+
"import": "./dist/src/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist/",
|
|
18
|
+
"docs/",
|
|
19
|
+
"prompts/",
|
|
20
|
+
"skills/",
|
|
21
|
+
".llmwiki/schema.md",
|
|
22
|
+
".llmwiki/config.json",
|
|
23
|
+
"CHANGELOG.md",
|
|
24
|
+
"README.md",
|
|
25
|
+
"AGENTS.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=24"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"clean": "rm -rf dist .tsbuildinfo",
|
|
33
|
+
"prepare": "npm run build",
|
|
34
|
+
"lint:code": "tsc --project tsconfig.json --noEmit",
|
|
35
|
+
"smoke:consumer": "set -eu; tmp_dir=$(mktemp -d); trap 'rm -rf \"$tmp_dir\"' EXIT; pack_out=$(npm pack --pack-destination \"$tmp_dir\"); tarball=$(printf '%s\\n' \"$pack_out\" | tail -n 1); tarball_path=\"$tmp_dir/$tarball\"; if [ ! -f \"$tarball_path\" ]; then echo 'No tarball produced' >&2; exit 1; fi; consumer_dir=\"$tmp_dir/consumer\"; mkdir -p \"$consumer_dir\"; cd \"$consumer_dir\"; npm init -y >/dev/null; npm install --no-audit --no-fund \"$tarball_path\" >/dev/null; npx --no-install repo-wiki --help >/dev/null",
|
|
36
|
+
"build": "tsc --project tsconfig.json",
|
|
37
|
+
"test:compiled": "node ./dist/test/run-compiled-tests.js",
|
|
38
|
+
"coverage:compiled": "c8 --include=dist/src/**/*.js --reporter=text --check-coverage --lines 95 node ./dist/test/run-compiled-tests.js",
|
|
39
|
+
"coverage": "npm run build && npm run coverage:compiled",
|
|
40
|
+
"check": "npm run build && npm run test:compiled",
|
|
41
|
+
"test": "npm run check",
|
|
42
|
+
"repo-wiki": "npm run build --silent && node ./dist/bin/repo-wiki.js",
|
|
43
|
+
"scan:bootstrap": "npm run build --silent && node ./dist/bin/repo-wiki.js scan --mode bootstrap --repo . --out .llmwiki/run",
|
|
44
|
+
"plan:bootstrap": "npm run build --silent && node ./dist/bin/repo-wiki.js plan --scan .llmwiki/run --out .llmwiki/bootstrap-plan.json",
|
|
45
|
+
"compile:local": "npm run build --silent && node ./dist/bin/repo-wiki.js compile --scan .llmwiki/run --plan .llmwiki/bootstrap-plan.json --wiki .llmwiki/wiki",
|
|
46
|
+
"lint:local": "npm run build --silent && node ./dist/bin/repo-wiki.js lint --wiki .llmwiki/wiki --scan .llmwiki/run",
|
|
47
|
+
"kb:bootstrap": "npm run build --silent && node ./dist/bin/repo-wiki.js run --mode bootstrap --repo . --scan .llmwiki/run --plan .llmwiki/bootstrap-plan.json --wiki .llmwiki/wiki",
|
|
48
|
+
"kb:incremental": "npm run build --silent && node ./dist/bin/repo-wiki.js run --mode incremental --repo . --scan .llmwiki/run --plan .llmwiki/incremental-plan.json --wiki .llmwiki/wiki",
|
|
49
|
+
"kb:publish": "npm run build --silent && node ./dist/bin/repo-wiki.js publish --wiki .llmwiki/wiki",
|
|
50
|
+
"self:wiki": "npm run kb:bootstrap",
|
|
51
|
+
"pack:check": "npm run build --silent && npm pack --dry-run",
|
|
52
|
+
"lint:docs": "npm run build --silent && node ./dist/bin/repo-wiki.js lint-docs --repo . --scan .llmwiki/run",
|
|
53
|
+
"changelog:ensure": "node ./scripts/update-changelog.mjs ensure",
|
|
54
|
+
"changelog:release": "node ./scripts/update-changelog.mjs release",
|
|
55
|
+
"changelog:update": "node ./scripts/update-changelog.mjs update",
|
|
56
|
+
"verify": "npm test"
|
|
57
|
+
},
|
|
58
|
+
"keywords": [
|
|
59
|
+
"llm-wiki",
|
|
60
|
+
"knowledge-base",
|
|
61
|
+
"github-wiki",
|
|
62
|
+
"repository-analysis",
|
|
63
|
+
"agent-context",
|
|
64
|
+
"codex",
|
|
65
|
+
"documentation-generator",
|
|
66
|
+
"markdown-lint",
|
|
67
|
+
"documentation-debt",
|
|
68
|
+
"github-actions"
|
|
69
|
+
],
|
|
70
|
+
"license": "MIT",
|
|
71
|
+
"types": "./dist/src/index.d.ts",
|
|
72
|
+
"dependencies": {
|
|
73
|
+
"typescript": "^5.8.3"
|
|
74
|
+
},
|
|
75
|
+
"devDependencies": {
|
|
76
|
+
"@types/node": "^22.15.21",
|
|
77
|
+
"c8": "^10.1.3"
|
|
78
|
+
},
|
|
79
|
+
"publishConfig": {
|
|
80
|
+
"access": "public",
|
|
81
|
+
"provenance": true
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# Wiki Compiler Prompt
|
|
2
|
+
|
|
3
|
+
You are compiling a Git repository into a GitHub Wiki knowledge base.
|
|
4
|
+
|
|
5
|
+
Rules:
|
|
6
|
+
|
|
7
|
+
- Source code at the pinned commit is authoritative.
|
|
8
|
+
- Tests, CI, configuration, schemas, and migrations are high-authority evidence.
|
|
9
|
+
- Markdown documentation is secondary evidence. Use it for intent, terminology, onboarding, and rationale, but validate operational or behavioral claims before presenting them as current truth.
|
|
10
|
+
- If markdown conflicts with code, trust code and add the conflict to Documentation-Debt-Report.md or Open-Questions.md.
|
|
11
|
+
- Preserve human-maintained sections between HUMAN_NOTES markers.
|
|
12
|
+
- Prefer updating existing pages over creating new pages.
|
|
13
|
+
- Every material claim should be tied to source paths or documentation cards.
|
|
14
|
+
- Do not copy secrets, tokens, private keys, or full .env values.
|
|
15
|
+
|
|
16
|
+
Output should be a structured patch of markdown pages.
|
package/prompts/lint.md
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# Wiki and Documentation Lint Prompt
|
|
2
|
+
|
|
3
|
+
Validate the compiled wiki and ingested markdown.
|
|
4
|
+
|
|
5
|
+
Check for:
|
|
6
|
+
|
|
7
|
+
- missing required pages
|
|
8
|
+
- broken wiki links
|
|
9
|
+
- orphan pages
|
|
10
|
+
- missing source commit metadata
|
|
11
|
+
- secret-like content
|
|
12
|
+
- stale documentation influencing authoritative wiki text
|
|
13
|
+
- documentation claims contradicted by code, tests, CI, config, schemas, or migrations
|
|
14
|
+
- unvalidated operational claims from markdown
|
|
15
|
+
- duplicate pages or concepts
|
|
16
|
+
- oversized pages
|
|
17
|
+
|
|
18
|
+
Documentation is not rejected by default; it is scored, labeled, and reported.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
# Page Templates
|
|
2
|
+
|
|
3
|
+
## Module page
|
|
4
|
+
|
|
5
|
+
- Purpose
|
|
6
|
+
- Main source paths
|
|
7
|
+
- Entry points and symbols
|
|
8
|
+
- Runtime behavior
|
|
9
|
+
- Dependencies
|
|
10
|
+
- Tests
|
|
11
|
+
- Documentation-derived context, clearly labeled
|
|
12
|
+
- Known risks
|
|
13
|
+
- Open questions
|
|
14
|
+
- Human notes block
|
|
15
|
+
|
|
16
|
+
## Documentation Debt Report
|
|
17
|
+
|
|
18
|
+
- Documentation ingestion config
|
|
19
|
+
- Status table
|
|
20
|
+
- Stale documentation candidates
|
|
21
|
+
- Contradiction-review candidates
|
|
22
|
+
- Unvalidated operational claims
|
|
23
|
+
- Commands found in markdown
|
|
24
|
+
- Environment variables mentioned in markdown
|
|
25
|
+
- Recommended follow-up
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: repo-wiki-cli
|
|
3
|
+
description: "Use when running repo-wiki CLI workflows in this repository or as a distributed plugin for external repositories: scanning, planning, compiling, linting, local wiki regeneration, and GitHub Wiki publishing. Keywords: repo-wiki CLI, npx repo-wiki, self:wiki, kb:bootstrap, lint:local, lint-docs, publish wiki, GitHub Wiki, .llmwiki."
|
|
4
|
+
user-invocable: false
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# repo-wiki CLI Operations
|
|
8
|
+
|
|
9
|
+
Use this skill when operating the `repo-wiki` CLI for this repository or for an external repository that uses repo-wiki.
|
|
10
|
+
|
|
11
|
+
## Safety and authority
|
|
12
|
+
|
|
13
|
+
- Source, tests, CI, and configuration are authoritative. Generated wiki pages under `.llmwiki/wiki/` are derived artifacts.
|
|
14
|
+
- Prefer the installed/public CLI shape (`repo-wiki` or `npx repo-wiki`) in examples so this skill works both inside this repository and as a distributed plugin.
|
|
15
|
+
- Inside the repo-wiki source repository, package scripts are acceptable because they build the local TypeScript implementation first.
|
|
16
|
+
- Do not run `repo-wiki init` in an already configured repository unless explicitly asked; it mutates `.llmwiki/config.json` and may create setup files.
|
|
17
|
+
- Command-specific `--help` may execute defaults in older scaffold versions. Use top-level `repo-wiki --help`, `npx repo-wiki --help`, package README/docs, or source inspection for exact options.
|
|
18
|
+
- `lint-docs` warnings are currently advisory in the scaffold. `repo-wiki lint` / `npm run lint:local` is the required local wiki gate before publishing.
|
|
19
|
+
- Publishing pushes to the GitHub Wiki repository. Only publish trusted local wiki output from a trusted branch/context.
|
|
20
|
+
|
|
21
|
+
## Common commands
|
|
22
|
+
|
|
23
|
+
Portable CLI form for any repository:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx repo-wiki run --mode bootstrap --repo . --scan .llmwiki/run --plan .llmwiki/bootstrap-plan.json --wiki .llmwiki/wiki
|
|
27
|
+
npx repo-wiki lint-docs --repo . --scan .llmwiki/run
|
|
28
|
+
npx repo-wiki lint --wiki .llmwiki/wiki --scan .llmwiki/run
|
|
29
|
+
npx repo-wiki publish --wiki .llmwiki/wiki --remote https://github.com/OWNER/REPO.wiki.git
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Source-repository package scripts, useful while developing repo-wiki itself:
|
|
33
|
+
|
|
34
|
+
```bash
|
|
35
|
+
npm run build # Compile TypeScript to dist/
|
|
36
|
+
npm run check # Build and run compiled tests
|
|
37
|
+
npm run coverage # Build and run coverage gate
|
|
38
|
+
npm run self:wiki # Bootstrap/regenerate this repo's local .llmwiki/wiki
|
|
39
|
+
npm run lint:docs # Validate ingested markdown documentation; warnings may be expected
|
|
40
|
+
npm run lint:local # Validate generated local wiki; must pass before publish
|
|
41
|
+
npm run kb:publish # Publish .llmwiki/wiki; requires LLMWIKI_PUBLISH_REMOTE or GITHUB_WIKI_REMOTE
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Regenerate the local wiki snapshot
|
|
45
|
+
|
|
46
|
+
Use this when source/docs changed and the local generated wiki should reflect the current checkout.
|
|
47
|
+
|
|
48
|
+
Portable form:
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx repo-wiki run --mode bootstrap --repo . --scan .llmwiki/run --plan .llmwiki/bootstrap-plan.json --wiki .llmwiki/wiki
|
|
52
|
+
npx repo-wiki lint --wiki .llmwiki/wiki --scan .llmwiki/run
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Source-repository package-script form:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
npm run self:wiki
|
|
59
|
+
npm run lint:local
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
Expected success signal from `repo-wiki lint` or `lint:local`:
|
|
63
|
+
|
|
64
|
+
```json
|
|
65
|
+
{
|
|
66
|
+
"errors": 0,
|
|
67
|
+
"warnings": 0
|
|
68
|
+
}
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
If `lint:docs` reports warnings, inspect whether they are expected documentation-debt findings before treating them as blockers. Error-level findings should be fixed or explicitly escalated before publication.
|
|
72
|
+
|
|
73
|
+
## Publish a GitHub Wiki
|
|
74
|
+
|
|
75
|
+
Always use the external GitHub Wiki remote form in instructions and examples:
|
|
76
|
+
|
|
77
|
+
```text
|
|
78
|
+
https://github.com/OWNER/REPO.wiki.git
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
For this repository, that is:
|
|
82
|
+
|
|
83
|
+
```text
|
|
84
|
+
https://github.com/mfittko/repo-wiki.wiki.git
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
Portable publish workflow:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
npx repo-wiki lint --wiki .llmwiki/wiki --scan .llmwiki/run
|
|
91
|
+
npx repo-wiki publish --wiki .llmwiki/wiki --remote https://github.com/OWNER/REPO.wiki.git
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Source-repository publish workflow while developing repo-wiki itself:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
npm run lint:local
|
|
98
|
+
LLMWIKI_PUBLISH_REMOTE=https://github.com/mfittko/repo-wiki.wiki.git npm run kb:publish
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
A successful publish returns JSON similar to:
|
|
102
|
+
|
|
103
|
+
```json
|
|
104
|
+
{
|
|
105
|
+
"status": "published",
|
|
106
|
+
"remote": "https://github.com/OWNER/REPO.wiki.git",
|
|
107
|
+
"branch": "master",
|
|
108
|
+
"pages": 37
|
|
109
|
+
}
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
If the publish response is `skipped-no-remote`, rerun with `LLMWIKI_PUBLISH_REMOTE`, `GITHUB_WIKI_REMOTE`, or pass `--remote` directly to the CLI.
|
|
113
|
+
|
|
114
|
+
## External repository bootstrap pattern
|
|
115
|
+
|
|
116
|
+
For another repository, the public workflow is:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
npx repo-wiki init --repo . --write-agents
|
|
120
|
+
npx repo-wiki run --mode bootstrap --repo . --wiki .llmwiki/wiki
|
|
121
|
+
npx repo-wiki publish --wiki .llmwiki/wiki --remote https://github.com/OWNER/REPO.wiki.git
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
Do not publish from untrusted pull requests. Prefer dry-run or local artifacts in CI unless publish credentials and event context are trusted.
|
|
125
|
+
|
|
126
|
+
## Artifact map
|
|
127
|
+
|
|
128
|
+
- `.llmwiki/run/` - scan artifacts, manifest, source cards, documentation cards.
|
|
129
|
+
- `.llmwiki/bootstrap-plan.json` - bootstrap page plan.
|
|
130
|
+
- `.llmwiki/incremental-plan.json` - incremental page plan.
|
|
131
|
+
- `.llmwiki/wiki/` - generated local GitHub Wiki markdown.
|
|
132
|
+
- `.llmwiki/schema.md` - schema and operating conventions for generated wiki maintenance.
|
|
133
|
+
|
|
134
|
+
## Troubleshooting
|
|
135
|
+
|
|
136
|
+
- If publish skips with no remote, set `LLMWIKI_PUBLISH_REMOTE=https://github.com/OWNER/REPO.wiki.git` or pass `--remote https://github.com/OWNER/REPO.wiki.git`.
|
|
137
|
+
- If `lint:local` or `repo-wiki lint` fails, inspect the JSON `issues` array and fix generated wiki links, required pages, frontmatter, or secret-like content before publishing.
|
|
138
|
+
- If package scripts fail because `dist/` is stale or absent, run `npm run build` or the package script again; most scripts already build first.
|
|
139
|
+
- If local scans unexpectedly include `tmp/` worktrees or scratch directories, inspect source filtering configuration and scanner behavior before trusting the generated wiki.
|