@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,344 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Prompt template structure for LLM-backed wiki synthesis.
|
|
3
|
+
*
|
|
4
|
+
* Four page archetypes map to distinct templates:
|
|
5
|
+
* - foundation : repo-wide pages (Home, Build-Test-and-Run, Agent-Context-Pack, …)
|
|
6
|
+
* - architecture : dedicated repository architecture synthesis for Architecture.md
|
|
7
|
+
* - module : per-module pages derived from grouped source cards
|
|
8
|
+
* - cross-cutting: shared-concern pages (Dependency-Map, Testing-Strategy, …)
|
|
9
|
+
*/
|
|
10
|
+
// ── Shared system prompt ───────────────────────────────────────────────────
|
|
11
|
+
const BASE_SYSTEM_PROMPT = `You are compiling a Git repository into a GitHub Wiki knowledge base.
|
|
12
|
+
|
|
13
|
+
Authority rules:
|
|
14
|
+
- Source code at the pinned commit is authoritative.
|
|
15
|
+
- Tests, CI, configuration, schemas, and migrations are high-authority evidence.
|
|
16
|
+
- Markdown documentation is secondary evidence; use it for intent, terminology, and rationale, but validate operational claims before presenting them as current behaviour.
|
|
17
|
+
- If documentation conflicts with code, trust code and add the conflict to Documentation-Debt-Report or Open-Questions.
|
|
18
|
+
- Preserve human-maintained sections between HUMAN_NOTES_START and HUMAN_NOTES_END markers.
|
|
19
|
+
- Every material claim must cite source paths or documentation cards.
|
|
20
|
+
- Do not copy secrets, tokens, private keys, or environment variable values.
|
|
21
|
+
|
|
22
|
+
Output contract:
|
|
23
|
+
- Output only the complete markdown page.
|
|
24
|
+
- The first line of the response must be exactly \`---\`.
|
|
25
|
+
- Do not include preamble, explanation, commentary, a markdown fence, or any code block wrapper around the page.
|
|
26
|
+
- Produce valid GitHub-flavored Markdown.
|
|
27
|
+
- Include a YAML frontmatter block with required keys: source_repo, source_commit, compiled_at, kind, page_state, source_paths.
|
|
28
|
+
- Include conservative confidence metadata and claim status where appropriate (for example confidence and claim_status frontmatter fields).
|
|
29
|
+
- source_paths must be non-empty for generated content and must cite evidence paths used by the page.
|
|
30
|
+
- Use headings, tables, and code blocks where appropriate.
|
|
31
|
+
- End module pages with a human notes block:
|
|
32
|
+
<!-- HUMAN_NOTES_START -->
|
|
33
|
+
<!-- HUMAN_NOTES_END -->`;
|
|
34
|
+
// ── Budget constants ───────────────────────────────────────────────────────
|
|
35
|
+
/**
|
|
36
|
+
* Maximum source cards included per prompt.
|
|
37
|
+
* Keeps prompts within a reasonable LLM context-window budget.
|
|
38
|
+
* Both formatSourceCards and the module file list use this same limit
|
|
39
|
+
* so the two sections stay proportional.
|
|
40
|
+
*/
|
|
41
|
+
const MAX_SOURCE_CARDS = 50;
|
|
42
|
+
/**
|
|
43
|
+
* Maximum documentation cards included per prompt.
|
|
44
|
+
* Doc cards tend to be longer; a smaller cap reduces noise.
|
|
45
|
+
*/
|
|
46
|
+
const MAX_DOC_CARDS = 20;
|
|
47
|
+
// ── Helpers ────────────────────────────────────────────────────────────────
|
|
48
|
+
function formatSourceCards(cards) {
|
|
49
|
+
if (!cards.length)
|
|
50
|
+
return '(none)';
|
|
51
|
+
return cards
|
|
52
|
+
.slice(0, MAX_SOURCE_CARDS)
|
|
53
|
+
.map((card) => {
|
|
54
|
+
const parts = [`- ${card.path} [${card.language}, ${card.category}]`];
|
|
55
|
+
if (card.symbols?.length) {
|
|
56
|
+
parts.push(` symbols: ${card.symbols.slice(0, 10).join(', ')}`);
|
|
57
|
+
}
|
|
58
|
+
if (card.imports?.length) {
|
|
59
|
+
parts.push(` imports: ${card.imports.slice(0, 5).join(', ')}`);
|
|
60
|
+
}
|
|
61
|
+
if (card.reasons?.length) {
|
|
62
|
+
parts.push(` reasons: ${card.reasons.join(', ')}`);
|
|
63
|
+
}
|
|
64
|
+
if (card.runtime_hints?.length) {
|
|
65
|
+
parts.push(` runtime hints: ${card.runtime_hints.join(', ')}`);
|
|
66
|
+
}
|
|
67
|
+
if (card.environment_variables?.length) {
|
|
68
|
+
parts.push(` env vars: ${card.environment_variables.join(', ')}`);
|
|
69
|
+
}
|
|
70
|
+
if (card.routes?.length) {
|
|
71
|
+
parts.push(` routes: ${card.routes.slice(0, 5).map(formatRoute).join('; ')}`);
|
|
72
|
+
}
|
|
73
|
+
if (card.models?.length) {
|
|
74
|
+
parts.push(` models: ${card.models.slice(0, 5).map(formatModel).join('; ')}`);
|
|
75
|
+
}
|
|
76
|
+
if (card.migrations?.length) {
|
|
77
|
+
parts.push(` migrations: ${card.migrations.slice(0, 5).map(formatMigration).join('; ')}`);
|
|
78
|
+
}
|
|
79
|
+
if (card.excerpt) {
|
|
80
|
+
parts.push(` excerpt: ${card.excerpt}`);
|
|
81
|
+
}
|
|
82
|
+
return parts.join('\n');
|
|
83
|
+
})
|
|
84
|
+
.join('\n');
|
|
85
|
+
}
|
|
86
|
+
function formatRoute(route) {
|
|
87
|
+
const methodPrefix = route.methods?.length ? `${route.methods.join('|')} ` : '';
|
|
88
|
+
const pathPart = route.path || '(unknown path)';
|
|
89
|
+
const details = [route.framework, route.kind, route.handler ? `handler=${route.handler}` : ''].filter(Boolean).join(', ');
|
|
90
|
+
return details ? `${methodPrefix}${pathPart} (${details})` : `${methodPrefix}${pathPart}`;
|
|
91
|
+
}
|
|
92
|
+
function formatModel(model) {
|
|
93
|
+
const name = model.name || '(unknown model)';
|
|
94
|
+
const details = [model.kind, model.framework].filter(Boolean).join(', ');
|
|
95
|
+
return details ? `${name} (${details})` : name;
|
|
96
|
+
}
|
|
97
|
+
function formatMigration(migration) {
|
|
98
|
+
const label = [migration.id, migration.name].filter(Boolean).join(' ') || '(unknown migration)';
|
|
99
|
+
return migration.kind ? `${label} (${migration.kind})` : label;
|
|
100
|
+
}
|
|
101
|
+
function formatDocCards(cards) {
|
|
102
|
+
if (!cards.length)
|
|
103
|
+
return '(none)';
|
|
104
|
+
return cards
|
|
105
|
+
.slice(0, MAX_DOC_CARDS)
|
|
106
|
+
.map((card) => {
|
|
107
|
+
const parts = [`- ${card.path} [${card.status}]`];
|
|
108
|
+
if (card.claims?.length) {
|
|
109
|
+
parts.push(` claims: ${card.claims.slice(0, 3).join('; ')}`);
|
|
110
|
+
}
|
|
111
|
+
if (card.excerpt) {
|
|
112
|
+
parts.push(` excerpt: ${card.excerpt}`);
|
|
113
|
+
}
|
|
114
|
+
return parts.join('\n');
|
|
115
|
+
})
|
|
116
|
+
.join('\n');
|
|
117
|
+
}
|
|
118
|
+
function existingContentBlock(existingContent) {
|
|
119
|
+
if (!existingContent)
|
|
120
|
+
return 'No existing wiki content (bootstrap mode).';
|
|
121
|
+
const fence = markdownFenceFor(existingContent);
|
|
122
|
+
return `Existing wiki content to update:\n${fence}\n${existingContent}\n${fence}`;
|
|
123
|
+
}
|
|
124
|
+
function markdownFenceFor(content) {
|
|
125
|
+
const longestTildeRun = Math.max(0, ...Array.from(content.matchAll(/~+/g), (match) => match[0].length));
|
|
126
|
+
return '~'.repeat(Math.max(4, longestTildeRun + 1));
|
|
127
|
+
}
|
|
128
|
+
function assertUnreachable(value) {
|
|
129
|
+
throw new Error(`Unsupported page archetype: ${String(value)}`);
|
|
130
|
+
}
|
|
131
|
+
// ── Archetype template builders ────────────────────────────────────────────
|
|
132
|
+
/**
|
|
133
|
+
* Architecture page: dedicated archetype for `Architecture.md`.
|
|
134
|
+
* Uses a richer system prompt and an outline with Mermaid diagram guidance.
|
|
135
|
+
*/
|
|
136
|
+
export function buildArchitecturePrompt(context) {
|
|
137
|
+
const ARCHITECTURE_SYSTEM_PROMPT = `${BASE_SYSTEM_PROMPT}
|
|
138
|
+
|
|
139
|
+
Architecture synthesis rules:
|
|
140
|
+
- Include Mermaid diagrams only when source cards, CI/config evidence, or verified repository structure directly support the relationship shown.
|
|
141
|
+
- If a diagram is inferred from structure rather than directly verified source evidence, label that limitation explicitly.
|
|
142
|
+
- Do not invent unsupported relationships or architectural layers just to fill a diagram.
|
|
143
|
+
- Prefer fewer accurate diagrams over many speculative ones.
|
|
144
|
+
- Put uncertain or missing evidence into the Caveats and Open Questions section.
|
|
145
|
+
- Suggested Mermaid diagram types (use only when evidence supports them):
|
|
146
|
+
- flowchart: system/context diagram for repository boundaries and external surfaces
|
|
147
|
+
- flowchart or graph: component/module diagram for major internal modules and relationships
|
|
148
|
+
- flowchart: build/test/deploy flow diagram when package scripts, CI workflows, or deployment config exist
|
|
149
|
+
- sequenceDiagram: only when source evidence supports a concrete interaction sequence`;
|
|
150
|
+
return {
|
|
151
|
+
system: ARCHITECTURE_SYSTEM_PROMPT,
|
|
152
|
+
user: `Generate the Architecture wiki page for this repository.
|
|
153
|
+
|
|
154
|
+
Repository:
|
|
155
|
+
- Remote: ${context.repoRemote ?? 'unknown'}
|
|
156
|
+
- Commit: ${context.repoCommit ?? 'unknown'}
|
|
157
|
+
- Page name: ${context.pageName}
|
|
158
|
+
|
|
159
|
+
Source cards (${context.sourceCards.length} files):
|
|
160
|
+
${formatSourceCards(context.sourceCards)}
|
|
161
|
+
|
|
162
|
+
Documentation cards:
|
|
163
|
+
${formatDocCards(context.docCards ?? [])}
|
|
164
|
+
|
|
165
|
+
${existingContentBlock(context.existingContent)}
|
|
166
|
+
|
|
167
|
+
Generate a complete Architecture wiki page with the following output contract:
|
|
168
|
+
- Output only the raw markdown page; do not wrap it in a markdown fence or code block.
|
|
169
|
+
- The first line must be exactly \`---\`.
|
|
170
|
+
- The YAML frontmatter must include: source_repo, source_commit, compiled_at, kind: "architecture", page_state, source_paths, confidence, and claim_status.
|
|
171
|
+
- source_paths must be a non-empty array drawn only from the Source cards listed above.
|
|
172
|
+
- Use conservative confidence and claim status metadata that matches the evidence provided.
|
|
173
|
+
- End with this exact human notes block:
|
|
174
|
+
<!-- HUMAN_NOTES_START -->
|
|
175
|
+
<!-- HUMAN_NOTES_END -->
|
|
176
|
+
|
|
177
|
+
Required sections (use these headings exactly):
|
|
178
|
+
1. ## Executive Architecture Summary
|
|
179
|
+
- A concise overview of the repository's purpose, major subsystems, and key design decisions grounded in source evidence.
|
|
180
|
+
2. ## System and Repository Context
|
|
181
|
+
- Repository structure, external surfaces, and repository boundaries (e.g. entry points, public APIs, external dependencies).
|
|
182
|
+
- Include a \`flowchart\` context diagram when source evidence supports repository boundaries and external surfaces.
|
|
183
|
+
3. ## Major Modules and Responsibilities
|
|
184
|
+
- One subsection per logical module/grouping derived from source cards and plan modules.
|
|
185
|
+
- Include a component/module diagram (\`flowchart\` or \`graph\`) when source structure supports module relationships.
|
|
186
|
+
4. ## Runtime, Data, and Control-Flow Relationships
|
|
187
|
+
- How modules interact at runtime: data flow, dependency chains, control paths.
|
|
188
|
+
- Include dependency or control-flow diagrams only when scanner/import/runtime evidence supports the relationship.
|
|
189
|
+
5. ## Build, Test, Deployment, and Operational Surfaces
|
|
190
|
+
- Package scripts, CI workflows, deployment configuration, operational entry points.
|
|
191
|
+
- Include a build/test/deploy flow diagram when package scripts or CI workflows exist.
|
|
192
|
+
6. ## Cross-Cutting Concerns
|
|
193
|
+
- Configuration, security, APIs, data models, documentation trust, and other shared concerns.
|
|
194
|
+
7. ## Caveats and Open Questions
|
|
195
|
+
- Source-grounded caveats, uncertainty, and open questions.
|
|
196
|
+
- If a diagram or claim is inferred from structure rather than directly verified, document that limitation here.`,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
/**
|
|
200
|
+
* Foundation pages: Home, Build-Test-and-Run, Agent-Context-Pack, etc.
|
|
201
|
+
* These are repo-wide summary pages derived from the full source inventory.
|
|
202
|
+
*/
|
|
203
|
+
export function buildFoundationPrompt(context) {
|
|
204
|
+
return {
|
|
205
|
+
system: BASE_SYSTEM_PROMPT,
|
|
206
|
+
user: `Generate the "${context.pageTitle}" foundation wiki page for this repository.
|
|
207
|
+
|
|
208
|
+
Repository:
|
|
209
|
+
- Remote: ${context.repoRemote ?? 'unknown'}
|
|
210
|
+
- Commit: ${context.repoCommit ?? 'unknown'}
|
|
211
|
+
- Page name: ${context.pageName}
|
|
212
|
+
|
|
213
|
+
Source cards (${context.sourceCards.length} files):
|
|
214
|
+
${formatSourceCards(context.sourceCards)}
|
|
215
|
+
|
|
216
|
+
Documentation cards:
|
|
217
|
+
${formatDocCards(context.docCards ?? [])}
|
|
218
|
+
|
|
219
|
+
${existingContentBlock(context.existingContent)}
|
|
220
|
+
|
|
221
|
+
Generate a complete "${context.pageTitle}" wiki page that:
|
|
222
|
+
- Summarises the repository from source evidence
|
|
223
|
+
- References specific source paths for every material claim
|
|
224
|
+
- Includes all sections required for a foundation page of this type
|
|
225
|
+
- Is accurate, source-grounded, and useful to both humans and coding agents`,
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Module pages: one page per logical code grouping.
|
|
230
|
+
* Grounded in the source cards for the module's files.
|
|
231
|
+
*/
|
|
232
|
+
export function buildModulePrompt(context) {
|
|
233
|
+
const mod = context.moduleInfo;
|
|
234
|
+
const docsOnlyInstructions = context.docsOnlyModule ? `
|
|
235
|
+
|
|
236
|
+
Docs-only evidence constraint:
|
|
237
|
+
- Every module source path is markdown/documentation, so these paths are secondary documentation evidence, not authoritative source evidence.
|
|
238
|
+
- The page body must explicitly state that markdown documentation is secondary evidence and that operational/current-behavior claims must be validated against source code, tests, CI workflows, runtime configuration, or schemas.
|
|
239
|
+
- Use conservative metadata: claim_status: "review-needed" and confidence: "low" (or at most "medium" if the page is purely descriptive of documentation contents).
|
|
240
|
+
- Do not use claim_status: "source-grounded" or confidence: "high" for a docs-only module.
|
|
241
|
+
- Prefer describing what the documentation says, plus validation gaps, over asserting current runtime behavior.` : '';
|
|
242
|
+
return {
|
|
243
|
+
system: BASE_SYSTEM_PROMPT,
|
|
244
|
+
user: `Generate a module wiki page for: ${mod?.name ?? context.pageTitle}
|
|
245
|
+
|
|
246
|
+
Module info:
|
|
247
|
+
- Files: ${mod?.files.length ?? 0}
|
|
248
|
+
- Categories: ${Object.keys(mod?.categories ?? {}).join(', ') || 'unknown'}
|
|
249
|
+
- Languages: ${Object.keys(mod?.languages ?? {}).join(', ') || 'unknown'}
|
|
250
|
+
- Reasons: ${mod?.important_reasons?.join(', ') || 'none'}
|
|
251
|
+
|
|
252
|
+
Source files in this module:
|
|
253
|
+
${mod?.files.slice(0, MAX_SOURCE_CARDS).map((f) => `- ${f}`).join('\n') || '(none)'}
|
|
254
|
+
|
|
255
|
+
Source cards:
|
|
256
|
+
${formatSourceCards(context.sourceCards)}
|
|
257
|
+
|
|
258
|
+
Documentation cards:
|
|
259
|
+
${formatDocCards(context.docCards ?? [])}
|
|
260
|
+
|
|
261
|
+
${existingContentBlock(context.existingContent)}
|
|
262
|
+
|
|
263
|
+
Generate a complete module wiki page with the following constraints:
|
|
264
|
+
- Output only the raw markdown page; do not wrap it in a markdown fence or code block.
|
|
265
|
+
- The first line must be exactly \`---\`.
|
|
266
|
+
- The YAML frontmatter must include: source_repo, source_commit, compiled_at, kind: "module", page_state, source_paths, confidence, and claim_status.
|
|
267
|
+
- source_paths must be a non-empty array drawn only from the Source files in this module and Source cards listed above.
|
|
268
|
+
- Minimal frontmatter skeleton:
|
|
269
|
+
---
|
|
270
|
+
source_repo: "<repository remote or unknown>"
|
|
271
|
+
source_commit: "<commit sha>"
|
|
272
|
+
compiled_at: "<ISO-8601 timestamp>"
|
|
273
|
+
kind: "module"
|
|
274
|
+
page_state: "generated"
|
|
275
|
+
source_paths:
|
|
276
|
+
- "<module source path>"
|
|
277
|
+
confidence: "medium"
|
|
278
|
+
claim_status: "source-grounded"
|
|
279
|
+
---
|
|
280
|
+
- Use conservative confidence and claim status metadata that matches the evidence provided.${docsOnlyInstructions}
|
|
281
|
+
- Include the following sections:
|
|
282
|
+
- Purpose (grounded in source cards, not speculation)
|
|
283
|
+
- Source file list
|
|
284
|
+
- Key symbols and entry points
|
|
285
|
+
- Dependencies and imports
|
|
286
|
+
- Related tests
|
|
287
|
+
- Known gaps or open questions
|
|
288
|
+
- End with this exact human notes block:
|
|
289
|
+
<!-- HUMAN_NOTES_START -->
|
|
290
|
+
<!-- HUMAN_NOTES_END -->`,
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
/**
|
|
294
|
+
* Cross-cutting pages: Dependency-Map, Testing-Strategy, Security-and-Secrets, etc.
|
|
295
|
+
* These aggregate information from multiple modules.
|
|
296
|
+
*/
|
|
297
|
+
export function buildCrossCuttingPrompt(context) {
|
|
298
|
+
return {
|
|
299
|
+
system: BASE_SYSTEM_PROMPT,
|
|
300
|
+
user: `Generate the "${context.pageTitle}" cross-cutting wiki page.
|
|
301
|
+
|
|
302
|
+
Repository:
|
|
303
|
+
- Remote: ${context.repoRemote ?? 'unknown'}
|
|
304
|
+
- Commit: ${context.repoCommit ?? 'unknown'}
|
|
305
|
+
- Page name: ${context.pageName}
|
|
306
|
+
|
|
307
|
+
Source cards (${context.sourceCards.length} files):
|
|
308
|
+
${formatSourceCards(context.sourceCards)}
|
|
309
|
+
|
|
310
|
+
Documentation cards:
|
|
311
|
+
${formatDocCards(context.docCards ?? [])}
|
|
312
|
+
|
|
313
|
+
${existingContentBlock(context.existingContent)}
|
|
314
|
+
|
|
315
|
+
Generate a complete "${context.pageTitle}" cross-cutting wiki page that:
|
|
316
|
+
- Is grounded in source evidence across all modules
|
|
317
|
+
- References specific source paths for every material claim
|
|
318
|
+
- Includes relevant tables and summaries
|
|
319
|
+
- Does not duplicate information already on individual module pages`,
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
// ── Public entry point ─────────────────────────────────────────────────────
|
|
323
|
+
/**
|
|
324
|
+
* Build a prompt for the given page archetype and context.
|
|
325
|
+
*
|
|
326
|
+
* @param archetype - Page archetype ('foundation' | 'architecture' | 'module' | 'cross-cutting')
|
|
327
|
+
* @param context - Assembled context for this page
|
|
328
|
+
* @returns { system, user } prompt pair ready for an LLM provider
|
|
329
|
+
*/
|
|
330
|
+
export function buildPrompt(archetype, context) {
|
|
331
|
+
switch (archetype) {
|
|
332
|
+
case 'architecture':
|
|
333
|
+
return buildArchitecturePrompt(context);
|
|
334
|
+
case 'foundation':
|
|
335
|
+
return buildFoundationPrompt(context);
|
|
336
|
+
case 'module':
|
|
337
|
+
return buildModulePrompt(context);
|
|
338
|
+
case 'cross-cutting':
|
|
339
|
+
return buildCrossCuttingPrompt(context);
|
|
340
|
+
default:
|
|
341
|
+
return assertUnreachable(archetype);
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA+EH,8EAA8E;AAE9E,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;2BAsBA,CAAC;AAE5B,8EAA8E;AAE9E;;;;;GAKG;AACH,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAE5B;;;GAGG;AACH,MAAM,aAAa,GAAG,EAAE,CAAC;AAEzB,8EAA8E;AAE9E,SAAS,iBAAiB,CAAC,KAA0B;IACnD,IAAI,CAAC,KAAK,CAAC,MAAM;QAAE,OAAO,QAAQ,CAAC;IACnC,OAAO,KAAK;SACT,KAAK,CAAC,CAAC,EAAE,gBAAgB,CAAC;SAC1B,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,MAAM,KAAK,GAAa,CAAC,KAAK,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,QAAQ,GAAG,CAAC,CAAC;QAChF,IAAI,IAAI,CAAC,OAA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ACjB,OAAO,uBAAuB,CAAC,OAAO,CAAC,CAAC;QAC1C,KAAK,YAAY;YACf,OAAO,qBAAqB,CAAC,OAAO,CAAC,CAAC;QACxC,KAAK,QAAQ;YACX,OAAO,iBAAiB,CAAC,OAAO,CAAC,CAAC;QACpC,KAAK,eAAe;YAClB,OAAO,uBAAuB,CAAC,OAAO,CAAC,CAAC;QAC1C;YACE,OAAO,iBAAiB,CAAC,SAAS,CAAC,CAAC;IACxC,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { type FrontmatterPolicy } from './frontmatter.js';
|
|
2
|
+
export type PublishTarget = 'github-wiki' | 'github-pages';
|
|
3
|
+
export declare const PUBLISH_TARGETS: readonly PublishTarget[];
|
|
4
|
+
export interface PublishWikiOptions {
|
|
5
|
+
wikiDir?: string;
|
|
6
|
+
remote?: string;
|
|
7
|
+
branch?: string;
|
|
8
|
+
target?: PublishTarget;
|
|
9
|
+
pagesPath?: string;
|
|
10
|
+
message?: string;
|
|
11
|
+
dryRun?: boolean;
|
|
12
|
+
frontmatterPolicy?: FrontmatterPolicy;
|
|
13
|
+
gitUserName?: string;
|
|
14
|
+
gitUserEmail?: string;
|
|
15
|
+
}
|
|
16
|
+
export declare function publishWiki({ wikiDir, remote, branch, target, pagesPath, message, dryRun, frontmatterPolicy, gitUserName, gitUserEmail }: PublishWikiOptions): Promise<{
|
|
17
|
+
summary: {
|
|
18
|
+
status: string;
|
|
19
|
+
wikiDir: string;
|
|
20
|
+
remote: string;
|
|
21
|
+
branch: string;
|
|
22
|
+
target: PublishTarget;
|
|
23
|
+
path: string;
|
|
24
|
+
pages: number;
|
|
25
|
+
frontmatterPolicy: FrontmatterPolicy;
|
|
26
|
+
next_step?: undefined;
|
|
27
|
+
cloned?: undefined;
|
|
28
|
+
};
|
|
29
|
+
} | {
|
|
30
|
+
summary: {
|
|
31
|
+
status: string;
|
|
32
|
+
wikiDir: string;
|
|
33
|
+
remote: any;
|
|
34
|
+
branch: string;
|
|
35
|
+
target: PublishTarget;
|
|
36
|
+
path: string;
|
|
37
|
+
pages: number;
|
|
38
|
+
frontmatterPolicy: FrontmatterPolicy;
|
|
39
|
+
next_step: string;
|
|
40
|
+
cloned?: undefined;
|
|
41
|
+
};
|
|
42
|
+
} | {
|
|
43
|
+
summary: {
|
|
44
|
+
status: string;
|
|
45
|
+
wikiDir: string;
|
|
46
|
+
remote: string;
|
|
47
|
+
branch: string;
|
|
48
|
+
target: PublishTarget;
|
|
49
|
+
path: string;
|
|
50
|
+
pages: number;
|
|
51
|
+
frontmatterPolicy: FrontmatterPolicy;
|
|
52
|
+
cloned: boolean;
|
|
53
|
+
next_step?: undefined;
|
|
54
|
+
};
|
|
55
|
+
}>;
|
|
56
|
+
export declare function defaultFrontmatterPolicyForTarget(target: PublishTarget): FrontmatterPolicy;
|
|
57
|
+
/**
|
|
58
|
+
* Rewrite internal wiki-style links in markdown content so they use the
|
|
59
|
+
* published `.html` page URLs expected under GitHub Pages.
|
|
60
|
+
*
|
|
61
|
+
* Rules:
|
|
62
|
+
* - `[text](PageName)` → `[text](PageName.html)` (bare page-name link)
|
|
63
|
+
* - `[text](./Page.md)` → `[text](Page.html)` (normalize leading `./` and convert markdown source links)
|
|
64
|
+
* - External URLs, `mailto:`, anchor-only, and known asset extensions are left unchanged.
|
|
65
|
+
*
|
|
66
|
+
* Quantifiers are bounded to prevent polynomial backtracking on adversarial input.
|
|
67
|
+
*/
|
|
68
|
+
export declare function rewriteInternalWikiLinks(content: string): string;
|