@opencodehub/cli 0.2.2 → 0.2.3
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/dist/commands/ci-templates/github-nightly.yml +35 -0
- package/dist/commands/ci-templates/github-rescan.yml +52 -0
- package/dist/commands/ci-templates/github-verdict.yml +24 -0
- package/dist/commands/ci-templates/github-weekly.yml +49 -0
- package/dist/commands/ci-templates/gitlab-ci.yml +56 -0
- package/dist/index.js +9 -1
- package/dist/index.js.map +1 -1
- package/dist/plugin-assets/agents/code-analyst.md +18 -0
- package/dist/plugin-assets/commands/audit-deps.md +29 -0
- package/dist/plugin-assets/commands/owners.md +20 -0
- package/dist/plugin-assets/commands/probe.md +21 -0
- package/dist/plugin-assets/commands/rename.md +20 -0
- package/dist/plugin-assets/commands/verdict.md +18 -0
- package/dist/plugin-assets/hooks/augment.sh +128 -0
- package/dist/plugin-assets/hooks/docs-staleness.sh +45 -0
- package/dist/plugin-assets/hooks.json +34 -0
- package/dist/plugin-assets/skills/codehub-code-pack/SKILL.md +181 -0
- package/dist/plugin-assets/skills/codehub-code-pack/references/determinism-contract.md +150 -0
- package/dist/plugin-assets/skills/codehub-contract-map/SKILL.md +144 -0
- package/dist/plugin-assets/skills/codehub-document/SKILL.md +152 -0
- package/dist/plugin-assets/skills/codehub-document/references/cross-reference-spec.md +142 -0
- package/dist/plugin-assets/skills/codehub-document/references/data-source-map.md +139 -0
- package/dist/plugin-assets/skills/codehub-document/references/document-templates.md +347 -0
- package/dist/plugin-assets/skills/codehub-document/references/mermaid-patterns.md +181 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/README.md +64 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-analysis-dead-code.md +104 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-analysis-ownership.md +101 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-analysis-risk-hotspots.md +105 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-architecture-data-flow.md +103 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-architecture-module-map.md +102 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-architecture-system-overview.md +100 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-behavior-processes.md +103 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-behavior-state-machines.md +101 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-cross-repo-contracts-matrix.md +104 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-cross-repo-dependency-flow.md +111 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-cross-repo-portfolio-map.md +106 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-diagrams-components.md +99 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-diagrams-dependency-graph.md +104 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-diagrams-sequences.md +103 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-reference-cli.md +110 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-reference-mcp-tools.md +100 -0
- package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-reference-public-api.md +111 -0
- package/dist/plugin-assets/skills/codehub-document/templates/orchestrator-prompt.md +110 -0
- package/dist/plugin-assets/skills/codehub-onboarding/SKILL.md +111 -0
- package/dist/plugin-assets/skills/codehub-pr-description/SKILL.md +122 -0
- package/dist/plugin-assets/skills/opencodehub-debugging/SKILL.md +144 -0
- package/dist/plugin-assets/skills/opencodehub-exploring/SKILL.md +120 -0
- package/dist/plugin-assets/skills/opencodehub-guide/SKILL.md +180 -0
- package/dist/plugin-assets/skills/opencodehub-impact-analysis/SKILL.md +151 -0
- package/dist/plugin-assets/skills/opencodehub-pr-review/SKILL.md +246 -0
- package/dist/plugin-assets/skills/opencodehub-refactoring/SKILL.md +180 -0
- package/package.json +11 -9
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
role: doc-diagrams-sequences
|
|
3
|
+
model: sonnet
|
|
4
|
+
output: "{{ docs_root }}/diagrams/behavioral/sequences.md"
|
|
5
|
+
depends_on:
|
|
6
|
+
- "{{ context_path }}"
|
|
7
|
+
- "{{ prefetch_path }}"
|
|
8
|
+
status: IN_PROGRESS
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Packet · {{ repo }} · diagrams/behavioral/sequences.md
|
|
12
|
+
|
|
13
|
+
> **Conditional packet.** The orchestrator only seeds this skeleton when `{{ context_path }} § Top processes` reports at least one process with ≥ 3 steps. If the condition is not met, the packet is skipped at seed time and no file is produced.
|
|
14
|
+
|
|
15
|
+
## 1. Objective
|
|
16
|
+
|
|
17
|
+
Produce `{{ docs_root }}/diagrams/behavioral/sequences.md`: up to three Mermaid `sequenceDiagram` blocks, one per top process, each showing the outbound call order across 4-8 participants.
|
|
18
|
+
|
|
19
|
+
## 2. Scope
|
|
20
|
+
|
|
21
|
+
- Create: `{{ docs_root }}/diagrams/behavioral/sequences.md`
|
|
22
|
+
- Do not touch: any other file under `{{ docs_root }}/`, any source file in the repo, `.context.md`, `.prefetch.md`, or any `.packets/*.md` other than this one.
|
|
23
|
+
|
|
24
|
+
## 3. Input specification
|
|
25
|
+
|
|
26
|
+
| Source | Read how | Cache state |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| Shared context | `Read {{ context_path }}` | always first |
|
|
29
|
+
| Prefetch ledger | `Read {{ prefetch_path }}` | always first |
|
|
30
|
+
| Top processes (with step counts) | `{{ context_path }} § Top processes` | cached |
|
|
31
|
+
| Process step order | `mcp__opencodehub__context({symbol: <process-name>})` per top 3 processes | mid-run |
|
|
32
|
+
| Participant labels | `mcp__opencodehub__query({text: <actor-name>})` when a step's symbol is ambiguous | mid-run, on demand |
|
|
33
|
+
|
|
34
|
+
## 4. Process
|
|
35
|
+
|
|
36
|
+
1. `Read {{ context_path }}` and `Read {{ prefetch_path }}`. Confirm which processes in `§ Top processes` have ≥ 3 steps — those are candidates.
|
|
37
|
+
2. Pick the top 3 candidates by step count (ties broken by entry-point centrality from `.context.md`). If fewer than 3 qualify, emit only the qualifying count (1 or 2 diagrams).
|
|
38
|
+
3. For each chosen process, call `mcp__opencodehub__context({symbol: <process-name>})` and extract the outbound call sequence in dispatch order. Cache the digest in this packet's Work log.
|
|
39
|
+
4. Derive 4-8 participant lifelines per process by grouping step targets into community / module bands. Lifelines are listed in dispatch order at the top of each `sequenceDiagram`.
|
|
40
|
+
5. Draft each `sequenceDiagram`: solid arrows (`->>`) for synchronous calls, dashed (`-->>`) for returns. Short labels (≤ 15 chars on edges, ≤ 20 chars on participant names).
|
|
41
|
+
6. If any single diagram exceeds 20 nodes (participants + step-labeled messages), keep the top-20 and move overflow into a `## Legend (overflow)` table below that block.
|
|
42
|
+
7. `Write {{ docs_root }}/diagrams/behavioral/sequences.md` with H1 = `{{ repo }} · Sequences`, one H2 per process, one fenced `sequenceDiagram` per H2.
|
|
43
|
+
|
|
44
|
+
## 5. Document format rules
|
|
45
|
+
|
|
46
|
+
- H1 = `{{ repo }} · Sequences`. One H2 per process — `## <process-name>` — with the `sequenceDiagram` immediately beneath.
|
|
47
|
+
- No YAML frontmatter on the output file.
|
|
48
|
+
- Up to three ` ```mermaid ` fences, each containing exactly one `sequenceDiagram`.
|
|
49
|
+
- 4-8 participants per diagram; solid arrows for calls, dashed for returns.
|
|
50
|
+
- Every participant and step target must correspond to a real symbol from `context` — no invented identifiers.
|
|
51
|
+
- Node labels ≤ 20 chars; edge labels ≤ 15 chars.
|
|
52
|
+
- No emojis. No filler adverbs.
|
|
53
|
+
|
|
54
|
+
## 6. Tool usage guide
|
|
55
|
+
|
|
56
|
+
| Need | Tool | Why |
|
|
57
|
+
|---|---|---|
|
|
58
|
+
| Process list + step counts | `{{ context_path }} § Top processes` | precomputed; gates the conditional |
|
|
59
|
+
| Outbound call order | `mcp__opencodehub__context` | dispatch sequence for lifelines |
|
|
60
|
+
| Actor label disambiguation | `mcp__opencodehub__query` | when a step target has multiple matches |
|
|
61
|
+
| Diagram idioms | `references/mermaid-patterns.md § Top process` | canonical `sequenceDiagram` shape + rules |
|
|
62
|
+
|
|
63
|
+
## 7. Fallback paths
|
|
64
|
+
|
|
65
|
+
- If no process has ≥ 3 steps at seed time, the orchestrator never seeds this packet — you should not be running. If you are and the cached list still shows none ≥ 3: write the gap to Work log and stop.
|
|
66
|
+
- If a process's `context` call errors: skip that process entirely and note the skip in the Work log; proceed with the remaining candidates.
|
|
67
|
+
- If fewer than 3 processes qualify: emit only the qualifying count. Do not pad with sub-3-step processes.
|
|
68
|
+
- If participant count would exceed 8 for a process: group adjacent step targets into a single band (e.g., collapse `Parser` + `Lexer` into `Parsing`) and note the grouping in the Work log.
|
|
69
|
+
|
|
70
|
+
## 8. Success criteria
|
|
71
|
+
|
|
72
|
+
- [ ] `{{ docs_root }}/diagrams/behavioral/sequences.md` exists on disk.
|
|
73
|
+
- [ ] H1 line reads `# {{ repo }} · Sequences`.
|
|
74
|
+
- [ ] Between 1 and 3 ` ```mermaid ` fences, each containing a `sequenceDiagram`.
|
|
75
|
+
- [ ] Every diagram has 4-8 participants with labels ≤ 20 chars.
|
|
76
|
+
- [ ] Every message edge has a label ≤ 15 chars.
|
|
77
|
+
- [ ] One H2 per diagram; H2 text matches the process name from `.context.md § Top processes`.
|
|
78
|
+
- [ ] No YAML frontmatter on the output.
|
|
79
|
+
- [ ] Every participant name maps to a symbol returned by `context` (spot-check 3).
|
|
80
|
+
|
|
81
|
+
## 9. Anti-goals
|
|
82
|
+
|
|
83
|
+
- Do not re-call `sql` or `project_profile` — those are cached in `.prefetch.md` / `.context.md`.
|
|
84
|
+
- Do not invent participants, step targets, or message labels — every identifier must come from a tool response.
|
|
85
|
+
- Do not write YAML frontmatter on the output file.
|
|
86
|
+
- Do not emit more than three `sequenceDiagram` blocks.
|
|
87
|
+
- Do not emit a diagram for any process with fewer than 3 steps, even if it lets you reach 3 total.
|
|
88
|
+
- Do not exceed 20 nodes in any single diagram; overflow goes into a per-diagram Legend table.
|
|
89
|
+
- Do not emit emojis.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Work log
|
|
94
|
+
|
|
95
|
+
{{ subagent fills this section per the write protocol }}
|
|
96
|
+
|
|
97
|
+
## Validation
|
|
98
|
+
|
|
99
|
+
{{ checks run, outputs pasted, any fixes applied }}
|
|
100
|
+
|
|
101
|
+
## Summary
|
|
102
|
+
|
|
103
|
+
{{ one paragraph — what shipped, where, why the process selection and lifeline grouping went the way they did }}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
---
|
|
2
|
+
role: doc-reference-cli
|
|
3
|
+
model: sonnet
|
|
4
|
+
output: "{{ docs_root }}/reference/cli.md"
|
|
5
|
+
depends_on:
|
|
6
|
+
- "{{ context_path }}"
|
|
7
|
+
- "{{ prefetch_path }}"
|
|
8
|
+
status: IN_PROGRESS
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Packet · {{ repo }} · reference/cli.md
|
|
12
|
+
|
|
13
|
+
> **Conditional packet.** The orchestrator only seeds this packet when `project_profile.entry_points` for `{{ repo }}` includes a CLI. If the packet is present on disk, the orchestrator has already confirmed the precondition; do not re-check it as a reason to abort.
|
|
14
|
+
|
|
15
|
+
## 1. Objective
|
|
16
|
+
|
|
17
|
+
Produce `{{ docs_root }}/reference/cli.md`: one H2 per CLI subcommand (derived from `route_map`), each with a fenced usage block, a one-sentence description, a `` `path:LOC` `` citation, and a bulleted flag list where each flag cites `` `path:LOC` ``.
|
|
18
|
+
|
|
19
|
+
## 2. Scope
|
|
20
|
+
|
|
21
|
+
- Create: `{{ docs_root }}/reference/cli.md`
|
|
22
|
+
- Do not touch: any other file under `{{ docs_root }}/`, any source file in the repo, `.context.md`, `.prefetch.md`, or any `.packets/*.md` other than this one. In particular, do not write to `{{ docs_root }}/reference/public-api.md` — the public-api packet owns that file.
|
|
23
|
+
|
|
24
|
+
## 3. Input specification
|
|
25
|
+
|
|
26
|
+
| Source | Read how | Cache state |
|
|
27
|
+
|---|---|---|
|
|
28
|
+
| Shared context | `Read {{ context_path }}` | always first |
|
|
29
|
+
| Prefetch ledger | `Read {{ prefetch_path }}` | always first |
|
|
30
|
+
| Project profile (entry points) | `{{ context_path }} § Repo profile` | cached |
|
|
31
|
+
| CLI subcommand inventory | `{{ prefetch_path }} § route_map` or `mcp__opencodehub__route_map({repo: "{{ repo }}"})` | cached if digest present |
|
|
32
|
+
| Per-command signatures / flags | `mcp__opencodehub__signature({symbol: <id>})` per handler | mid-run (only if cache miss) |
|
|
33
|
+
| Handler source for flag extraction | `Read <file>` at `start_line..start_line+40` | mid-run |
|
|
34
|
+
|
|
35
|
+
## 4. Process
|
|
36
|
+
|
|
37
|
+
1. `Read {{ context_path }}` and `Read {{ prefetch_path }}`. Confirm `project_profile.entry_points` includes a CLI and capture the CLI binary name (e.g., `codehub`).
|
|
38
|
+
2. Pull the `route_map` digest from `.prefetch.md § route_map`. If absent, call `route_map({repo: "{{ repo }}"})` once and cache the digest in this packet's Work log. Each entry maps a subcommand to its handler `path:start_line`.
|
|
39
|
+
3. For each subcommand, `Read` the handler file at `path:start_line-start_line+40` and extract (a) the usage line as exposed to the CLI library, (b) the full flag list with each flag's source line. Reuse `signature({symbol: <handler-id>})` where the flag parser's signature captures the flag set.
|
|
40
|
+
4. If the CLI has more than 40 subcommands: group by top-level verb (`analyze`, `query`, `verdict`, …). Emit one H2 per verb group and nest subcommands as H3 within.
|
|
41
|
+
5. Draft one H2 per subcommand (or verb group). Format: `## <subcommand>`, then a fenced usage block (```` ``` ```` no language), a one-sentence description, a `` `path:LOC` `` citation, then a `Flags:` bullet list with each flag cited `` `path:LOC` ``.
|
|
42
|
+
6. Order subcommands by the order they appear in `route_map`; within a verb group, order alphabetically.
|
|
43
|
+
7. `Write {{ docs_root }}/reference/cli.md` with H1 = `{{ repo }} · CLI` and a one-sentence intro naming the CLI binary before the first H2.
|
|
44
|
+
|
|
45
|
+
## 5. Document format rules
|
|
46
|
+
|
|
47
|
+
- H1 = `{{ repo }} · CLI`. No decorative titles.
|
|
48
|
+
- No YAML frontmatter on the output file.
|
|
49
|
+
- A single one-sentence intro after the H1 names the CLI binary (e.g., ``The `codehub` CLI has the following subcommands.``).
|
|
50
|
+
- Each subcommand is an H2 (`## <subcommand>`), followed by:
|
|
51
|
+
1. A fenced usage block with no language tag (e.g., ```` ``` ```` ... ```` ``` ````), showing the canonical invocation with optional flags in brackets.
|
|
52
|
+
2. A one-sentence description.
|
|
53
|
+
3. A `` `path:LOC` `` citation on its own line.
|
|
54
|
+
4. A `Flags:` label followed by a bullet list; each bullet is `` `--flag` — description. `path:LOC`. ``.
|
|
55
|
+
- If > 40 subcommands: one H2 per verb group, one H3 per subcommand beneath. Otherwise flat H2s.
|
|
56
|
+
- No Mermaid. No emojis. No filler adverbs.
|
|
57
|
+
|
|
58
|
+
## 6. Tool usage guide
|
|
59
|
+
|
|
60
|
+
| Need | Tool | Why |
|
|
61
|
+
|---|---|---|
|
|
62
|
+
| CLI presence signal | `{{ context_path }} § Repo profile` (`project_profile.entry_points`) | precondition for this packet |
|
|
63
|
+
| Subcommand inventory | `mcp__opencodehub__route_map` (cached in `.prefetch.md`) | pre-parsed CLI tree; authoritative over handler grepping |
|
|
64
|
+
| Handler signature / flag parser | `mcp__opencodehub__signature` | captures the parameter shape without paraphrase |
|
|
65
|
+
| Flag source lines | `Read` at `path:start_line-start_line+40` | graph does not record per-flag line numbers |
|
|
66
|
+
|
|
67
|
+
## 7. Fallback paths
|
|
68
|
+
|
|
69
|
+
- If `project_profile.entry_points` does not include a CLI: the orchestrator should not have seeded this packet. Write the mismatch to the Work log, flip `status` to `BLOCKED`, and stop. Do not emit the output file.
|
|
70
|
+
- If `route_map` returns `[]`: log the empty inventory in the Work log and do not emit the file. The orchestrator will prune the empty packet in Phase E.
|
|
71
|
+
- If a subcommand handler has no extractable flags: emit the H2 with the usage block, description, and citation only; omit the `Flags:` bullet list rather than emit an empty one.
|
|
72
|
+
- If a handler file cannot be `Read` (missing or binary): emit the H2 with the usage block and description, mark the citation `*handler unavailable*`, and log the skip.
|
|
73
|
+
- If `route_map` is malformed (schema mismatch): run the `sql` fallback `SELECT name, file_path, start_line FROM nodes WHERE kind='Function' AND file_path LIKE '%cli%commands%'` and treat each hit as a candidate subcommand. Note the fallback in the Work log.
|
|
74
|
+
|
|
75
|
+
## 8. Success criteria
|
|
76
|
+
|
|
77
|
+
- [ ] `{{ docs_root }}/reference/cli.md` exists on disk.
|
|
78
|
+
- [ ] H1 line reads `# {{ repo }} · CLI`.
|
|
79
|
+
- [ ] The H1 is followed by a single one-sentence intro containing the CLI binary name in backticks.
|
|
80
|
+
- [ ] At least one H2 subcommand (or verb group) is present; count matches `route_map` entries (or verb-group count when grouping).
|
|
81
|
+
- [ ] Every H2 has exactly one fenced usage block immediately after the heading.
|
|
82
|
+
- [ ] Every H2 has exactly one `` `path:LOC` `` citation for the handler.
|
|
83
|
+
- [ ] Every `Flags:` bullet has a `` `path:LOC` `` citation (grep each bullet under a `Flags:` label for a backtick span).
|
|
84
|
+
- [ ] When subcommand count > 40: the output uses verb-group H2s with nested H3 subcommands. Otherwise: flat H2 subcommands.
|
|
85
|
+
- [ ] No YAML frontmatter on the output.
|
|
86
|
+
- [ ] No Mermaid fences in the output.
|
|
87
|
+
|
|
88
|
+
## 9. Anti-goals
|
|
89
|
+
|
|
90
|
+
- Do not re-call any MCP tool whose digest is in `.prefetch.md` — read the cached summary. If the cached slice is truncated, call with a narrower filter, not a blanket re-fetch.
|
|
91
|
+
- Do not invent subcommand names, flag names, or `path:LOC` citations — every identifier must come from `route_map`, `signature`, or a verified `Read` of the handler source.
|
|
92
|
+
- Do not paraphrase usage blocks or flag declarations. Quote them verbatim from source.
|
|
93
|
+
- Do not write to `{{ docs_root }}/reference/public-api.md`; that file is owned by the public-api packet.
|
|
94
|
+
- Do not emit the output file when `route_map` is empty or when the CLI precondition fails — flip `status` to `BLOCKED` and stop.
|
|
95
|
+
- Do not write YAML frontmatter on the output file.
|
|
96
|
+
- Do not emit emojis. Do not use filler adverbs.
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## Work log
|
|
101
|
+
|
|
102
|
+
{{ subagent fills this section per the write protocol }}
|
|
103
|
+
|
|
104
|
+
## Validation
|
|
105
|
+
|
|
106
|
+
{{ checks run, outputs pasted, any fixes applied }}
|
|
107
|
+
|
|
108
|
+
## Summary
|
|
109
|
+
|
|
110
|
+
{{ one paragraph — what shipped, where, whether verb grouping was applied, and any route_map gaps encountered }}
|
package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-reference-mcp-tools.md
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
---
|
|
2
|
+
role: doc-reference-mcp-tools
|
|
3
|
+
model: sonnet
|
|
4
|
+
output: "{{ docs_root }}/reference/mcp-tools.md"
|
|
5
|
+
depends_on:
|
|
6
|
+
- "{{ context_path }}"
|
|
7
|
+
- "{{ prefetch_path }}"
|
|
8
|
+
status: IN_PROGRESS
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Packet · {{ repo }} · reference/mcp-tools.md
|
|
12
|
+
|
|
13
|
+
## 1. Objective
|
|
14
|
+
|
|
15
|
+
Produce `{{ docs_root }}/reference/mcp-tools.md`: the authoritative reference for every MCP tool `{{ repo }}` exposes, one H2 per tool, each with a verbatim signature, input/output shapes, a one-sentence purpose, and a `path:LOC` citation to the handler file.
|
|
16
|
+
|
|
17
|
+
## 2. Scope
|
|
18
|
+
|
|
19
|
+
- Create: `{{ docs_root }}/reference/mcp-tools.md`
|
|
20
|
+
- Do not touch: `{{ docs_root }}/reference/public-api.md`, `{{ docs_root }}/reference/cli.md`, or any other file under `{{ docs_root }}/`, any source file in the repo, `.context.md`, `.prefetch.md`, or any `.packets/*.md` other than this one.
|
|
21
|
+
- Conditional file — this packet is only seeded when `{{ repo }}` contains an MCP server package (the orchestrator verified `project_profile.stacks` includes `"MCP"` or `tool_map` is non-empty before spawning).
|
|
22
|
+
|
|
23
|
+
## 3. Input specification
|
|
24
|
+
|
|
25
|
+
| Source | Read how | Cache state |
|
|
26
|
+
|---|---|---|
|
|
27
|
+
| Shared context | `Read {{ context_path }}` | always first |
|
|
28
|
+
| Prefetch ledger | `Read {{ prefetch_path }}` | always first |
|
|
29
|
+
| MCP tool inventory | `{{ prefetch_path }} § tool_map` | cached |
|
|
30
|
+
| Tool handler nodes | `mcp__opencodehub__sql({query: "SELECT name, file_path, start_line FROM nodes WHERE kind='Function' AND file_path LIKE '%mcp%'"})` | mid-run, only if `tool_map` slice is truncated |
|
|
31
|
+
| Verbatim signatures | `Read <file_path>:<start_line>` (signatures are not stored in the graph) | mid-run |
|
|
32
|
+
| Usage count per tool | `mcp__opencodehub__context({symbol: <tool-handler>})` | mid-run |
|
|
33
|
+
|
|
34
|
+
## 4. Process
|
|
35
|
+
|
|
36
|
+
1. `Read {{ context_path }}` and `Read {{ prefetch_path }}`. Confirm the `tool_map` digest is present and non-empty; if empty, follow Fallback paths.
|
|
37
|
+
2. Build the tool roster from `{{ prefetch_path }} § tool_map`: tool name, handler `file_path:start_line`, input/output schema digest.
|
|
38
|
+
3. For each tool in the roster: `Read` the handler file at `start_line..start_line+30` and extract the exact signature (function or registration block). Do not paraphrase.
|
|
39
|
+
4. For each tool: pull a one-sentence purpose from the registration description (the MCP `describe` string); if missing, infer from the handler docstring and mark the inference in the Work log.
|
|
40
|
+
5. Draft `reference/mcp-tools.md`: H1 = `{{ repo }} · MCP tools`, one H2 per tool in alphabetical order. Each H2 contains the verbatim signature fenced as code, a one-sentence purpose, an input/output shape summary, and a `path:LOC` citation.
|
|
41
|
+
6. `Write {{ docs_root }}/reference/mcp-tools.md`.
|
|
42
|
+
|
|
43
|
+
## 5. Document format rules
|
|
44
|
+
|
|
45
|
+
- H1 = `{{ repo }} · MCP tools`. No decorative titles.
|
|
46
|
+
- No YAML frontmatter on the output file.
|
|
47
|
+
- One H2 per tool. Tool order = alphabetical by tool name.
|
|
48
|
+
- Signatures are fenced code blocks, quoted verbatim from the handler file — never paraphrased, never retyped from memory.
|
|
49
|
+
- Every H2 ends with a backtick `path:LOC` citation pointing at the handler `file_path:start_line`.
|
|
50
|
+
- No emojis. No filler adverbs.
|
|
51
|
+
|
|
52
|
+
## 6. Tool usage guide
|
|
53
|
+
|
|
54
|
+
| Need | Tool | Why |
|
|
55
|
+
|---|---|---|
|
|
56
|
+
| Full tool inventory | `{{ prefetch_path }} § tool_map` | precomputed; do not re-call `tool_map` |
|
|
57
|
+
| Verbatim signature text | `Read` at `file_path:start_line` | graph stores names/locs, not signature text |
|
|
58
|
+
| Handler usage count | `mcp__opencodehub__context` | inbound count; signals which tools are load-bearing |
|
|
59
|
+
| Tools not in `tool_map` | `mcp__opencodehub__sql` filtered to MCP files | fallback only when `tool_map` is stale |
|
|
60
|
+
|
|
61
|
+
## 7. Fallback paths
|
|
62
|
+
|
|
63
|
+
- If `{{ prefetch_path }} § tool_map` is empty but `project_profile.stacks` includes `"MCP"`: call `mcp__opencodehub__sql({query: "SELECT name, file_path, start_line FROM nodes WHERE kind='Function' AND (file_path LIKE '%mcp%' OR file_path LIKE '%tools%') ORDER BY file_path"})`, filter to registered handlers by grepping for tool-registration decorators, and cite the fallback in the Work log.
|
|
64
|
+
- If `tool_map` returns `[]` and `project_profile.stacks` does not contain `"MCP"`: do not emit an empty file. Write the gap to the Work log, mark `status: COMPLETE` with a note, and skip the Write step — the orchestrator will prune this packet from the README.
|
|
65
|
+
- If a handler `Read` fails (file moved since the last `codehub analyze`): flag the row with `*graph stale — verify with codehub analyze*` and cite the graph-recorded path.
|
|
66
|
+
- If a tool registration has no description string: infer from the handler's top-level docstring; mark the H2 body `*description inferred from docstring*` in-line.
|
|
67
|
+
|
|
68
|
+
## 8. Success criteria
|
|
69
|
+
|
|
70
|
+
- [ ] `{{ docs_root }}/reference/mcp-tools.md` exists on disk.
|
|
71
|
+
- [ ] H1 line reads `# {{ repo }} · MCP tools`.
|
|
72
|
+
- [ ] Every tool returned by `tool_map` has exactly one H2 in the output.
|
|
73
|
+
- [ ] No H2 exists for a tool name not in `tool_map` (or the sql fallback roster).
|
|
74
|
+
- [ ] Every H2 contains a fenced code block with a verbatim signature.
|
|
75
|
+
- [ ] Every H2 ends with a backtick `path:LOC` citation.
|
|
76
|
+
- [ ] No YAML frontmatter on the output.
|
|
77
|
+
- [ ] Tool H2s are in alphabetical order (spot-check first and last).
|
|
78
|
+
|
|
79
|
+
## 9. Anti-goals
|
|
80
|
+
|
|
81
|
+
- Do not re-call `tool_map` — its digest is cached in `.prefetch.md`.
|
|
82
|
+
- Do not invent tool names, input fields, or output fields — every identifier must come from `tool_map` or a `Read` of the handler file.
|
|
83
|
+
- Do not paraphrase signatures. Quote the source or use the `Read` fallback.
|
|
84
|
+
- Do not emit a `reference/mcp-tools.md` with zero H2s; follow the Fallback path that skips the file instead.
|
|
85
|
+
- Do not write YAML frontmatter on the output file.
|
|
86
|
+
- Do not emit emojis.
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Work log
|
|
91
|
+
|
|
92
|
+
{{ subagent fills this section per the write protocol }}
|
|
93
|
+
|
|
94
|
+
## Validation
|
|
95
|
+
|
|
96
|
+
{{ checks run, outputs pasted, any fixes applied }}
|
|
97
|
+
|
|
98
|
+
## Summary
|
|
99
|
+
|
|
100
|
+
{{ one paragraph — what shipped, where, and any tools that required a fallback }}
|
package/dist/plugin-assets/skills/codehub-document/templates/agents/doc-reference-public-api.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
role: doc-reference-public-api
|
|
3
|
+
model: sonnet
|
|
4
|
+
output: "{{ docs_root }}/reference/public-api.md"
|
|
5
|
+
depends_on:
|
|
6
|
+
- "{{ context_path }}"
|
|
7
|
+
- "{{ prefetch_path }}"
|
|
8
|
+
status: IN_PROGRESS
|
|
9
|
+
---
|
|
10
|
+
|
|
11
|
+
# Packet · {{ repo }} · reference/public-api.md
|
|
12
|
+
|
|
13
|
+
## 1. Objective
|
|
14
|
+
|
|
15
|
+
Produce `{{ docs_root }}/reference/public-api.md`: one H3 per exported symbol for the top 30 public exports of `{{ repo }}`, each with a fenced code block that quotes the symbol's signature verbatim, a one-sentence description, and a `` `path:LOC` `` citation. When `{{ repo }}` is not a CLI, append an `## HTTP` H2 rendered from `route_map` at the bottom of the file.
|
|
16
|
+
|
|
17
|
+
## 2. Scope
|
|
18
|
+
|
|
19
|
+
- Create: `{{ docs_root }}/reference/public-api.md`
|
|
20
|
+
- Do not touch: any other file under `{{ docs_root }}/`, any source file in the repo, `.context.md`, `.prefetch.md`, or any `.packets/*.md` other than this one. In particular, do not write to `{{ docs_root }}/reference/cli.md` — the CLI packet owns that file.
|
|
21
|
+
|
|
22
|
+
## 3. Input specification
|
|
23
|
+
|
|
24
|
+
| Source | Read how | Cache state |
|
|
25
|
+
|---|---|---|
|
|
26
|
+
| Shared context | `Read {{ context_path }}` | always first |
|
|
27
|
+
| Prefetch ledger | `Read {{ prefetch_path }}` | always first |
|
|
28
|
+
| Project profile | `{{ context_path }} § Repo profile` | cached |
|
|
29
|
+
| Exported symbols (public surface) | `{{ prefetch_path }} § exports` or `mcp__opencodehub__sql({query: "SELECT name, kind, file_path, start_line FROM nodes WHERE kind IN ('Function','Class','Method') AND name NOT LIKE '\\_%' ORDER BY file_path LIMIT 500"})` | cached if digest present |
|
|
30
|
+
| Per-symbol signatures | `mcp__opencodehub__signature({symbol: <id>})` | mid-run (only if cache miss) |
|
|
31
|
+
| Per-symbol usage count | `mcp__opencodehub__context({symbol: <id>})` | mid-run (only if cache miss) |
|
|
32
|
+
| HTTP route inventory | `{{ prefetch_path }} § route_map` or `mcp__opencodehub__route_map({repo: "{{ repo }}"})` | cached if digest present |
|
|
33
|
+
| Source fallback for missing signatures | `Read <file>` at `start_line..start_line+20` | mid-run |
|
|
34
|
+
|
|
35
|
+
## 4. Process
|
|
36
|
+
|
|
37
|
+
1. `Read {{ context_path }}` and `Read {{ prefetch_path }}`. Confirm `{{ repo }}` profile; check `project_profile.entry_points` for the CLI flag.
|
|
38
|
+
2. Pull the exported-symbol list from `.prefetch.md § exports`. If absent, run the `sql` query in the input spec and cache the digest in this packet's Work log.
|
|
39
|
+
3. Filter to symbols whose file path is a barrel (`packages/*/src/index.ts`, `src/index.ts`, `mod.rs`, `__init__.py`, or equivalent). Keep that subset as the real exports.
|
|
40
|
+
4. For the top 30 exports (ordered by inbound relation count if cached, else by file path): fetch `signature({symbol: <id>})` and `context({symbol: <id>})`. Record signature, inbound count, and `path:start_line` in the Work log. Reuse cached digests wherever `.prefetch.md` already recorded them.
|
|
41
|
+
5. Determine HTTP rendering: if `project_profile.entry_points` includes a CLI, skip the HTTP section — the CLI packet owns route rendering. Otherwise, read the `route_map` digest (or call `route_map({repo: "{{ repo }}"})` once) and prepare an `## HTTP` H2.
|
|
42
|
+
6. Draft one H3 per export. Format: `### <symbol-name>`, then a fenced code block quoting the signature verbatim, then a one-sentence description, then the `` `path:LOC` `` citation on its own line.
|
|
43
|
+
7. If rendering HTTP, append `## HTTP` as the final H2, with one H3 per route (`### METHOD /path`), a one-sentence description, and a `` `path:LOC` `` citation. Order routes by `path`, then `method`.
|
|
44
|
+
8. `Write {{ docs_root }}/reference/public-api.md` with H1 = `{{ repo }} · Public API`.
|
|
45
|
+
|
|
46
|
+
## 5. Document format rules
|
|
47
|
+
|
|
48
|
+
- H1 = `{{ repo }} · Public API`. No decorative titles.
|
|
49
|
+
- No YAML frontmatter on the output file.
|
|
50
|
+
- Each exported symbol is an H3 (`### <symbol-name>`), followed by:
|
|
51
|
+
1. One fenced code block quoting the signature verbatim from `signature` (or `Read` fallback). Never paraphrase.
|
|
52
|
+
2. A one-sentence description.
|
|
53
|
+
3. A `` `path:LOC` `` citation on its own line.
|
|
54
|
+
- The fenced code block's language tag matches the repo language (`ts`, `py`, `rs`, `go`, etc.) based on file extension.
|
|
55
|
+
- HTTP section (non-CLI repos only): one H2 `## HTTP`, one H3 per route `### <METHOD> <path>`, one-sentence description, `` `path:LOC` `` citation.
|
|
56
|
+
- No Mermaid. No emojis. No filler adverbs.
|
|
57
|
+
|
|
58
|
+
## 6. Tool usage guide
|
|
59
|
+
|
|
60
|
+
| Need | Tool | Why |
|
|
61
|
+
|---|---|---|
|
|
62
|
+
| Public-ish symbol surface | `sql` (cached in `.prefetch.md`) | Filter to non-underscore names grouped by barrel |
|
|
63
|
+
| Verbatim signatures | `mcp__opencodehub__signature` | authoritative signature text; never paraphrase |
|
|
64
|
+
| Usage count / publicness signal | `mcp__opencodehub__context` | inbound count orders the top-30 shortlist |
|
|
65
|
+
| HTTP route inventory | `mcp__opencodehub__route_map` | pre-parsed routes; avoids handler-file grepping |
|
|
66
|
+
| Signature fallback | `Read` at `path:start_line-start_line+20` | paste declaration verbatim when `signature` is empty |
|
|
67
|
+
|
|
68
|
+
## 7. Fallback paths
|
|
69
|
+
|
|
70
|
+
- If `signature` returns nothing for a symbol: `Read` the file at `path:start_line-start_line+20`, paste the declaration verbatim into the fenced code block, and note the fallback in the Work log.
|
|
71
|
+
- If fewer than 30 exports pass the barrel filter: emit whatever is present; do not pad with private helpers. Note the shortfall in the Work log.
|
|
72
|
+
- If `route_map` returns `[]` and `{{ repo }}` is not a CLI: skip the `## HTTP` section entirely rather than emit an empty one.
|
|
73
|
+
- If `{{ repo }}` is a CLI per `project_profile.entry_points`: do not emit the `## HTTP` section here — the `doc-reference-cli` packet renders `reference/cli.md` from `route_map` instead. Record the coordination choice in the Work log.
|
|
74
|
+
- If a barrel file is absent (language without explicit barrels): fall back to symbols whose `start_line == 1` AND whose file has ≥ 3 inbound import edges. Note the heuristic in the Work log.
|
|
75
|
+
|
|
76
|
+
## 8. Success criteria
|
|
77
|
+
|
|
78
|
+
- [ ] `{{ docs_root }}/reference/public-api.md` exists on disk.
|
|
79
|
+
- [ ] H1 line reads `# {{ repo }} · Public API`.
|
|
80
|
+
- [ ] At least 5 H3 entries are present (count `^### ` matches, excluding HTTP routes).
|
|
81
|
+
- [ ] Every H3 symbol block has one fenced code block immediately after the heading.
|
|
82
|
+
- [ ] Every H3 block has exactly one `` `path:LOC` `` citation.
|
|
83
|
+
- [ ] Every fenced signature block's content appears verbatim in either `signature`'s output or the cited source span (spot-check 3 by re-reading).
|
|
84
|
+
- [ ] If `project_profile.entry_points` includes CLI: no `## HTTP` section exists in the output.
|
|
85
|
+
- [ ] If `project_profile.entry_points` excludes CLI and `route_map` returned at least one route: an `## HTTP` section exists with one H3 per route.
|
|
86
|
+
- [ ] No YAML frontmatter on the output.
|
|
87
|
+
- [ ] No Mermaid fences in the output.
|
|
88
|
+
|
|
89
|
+
## 9. Anti-goals
|
|
90
|
+
|
|
91
|
+
- Do not re-call any MCP tool whose digest is in `.prefetch.md` — read the cached summary. If the cached slice is truncated, call with a narrower filter, not a blanket re-fetch.
|
|
92
|
+
- Do not invent symbol names, signatures, route paths, or citations — every identifier must come from a tool response or a `Read` of the source file.
|
|
93
|
+
- Do not paraphrase signatures. Quote them verbatim.
|
|
94
|
+
- Do not write to `{{ docs_root }}/reference/cli.md`; that file is owned by the CLI packet.
|
|
95
|
+
- Do not write YAML frontmatter on the output file.
|
|
96
|
+
- Do not emit emojis. Do not use filler adverbs.
|
|
97
|
+
- Do not emit more than 30 symbol H3 entries — overflow belongs to a future paginated packet.
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Work log
|
|
102
|
+
|
|
103
|
+
{{ subagent fills this section per the write protocol }}
|
|
104
|
+
|
|
105
|
+
## Validation
|
|
106
|
+
|
|
107
|
+
{{ checks run, outputs pasted, any fixes applied }}
|
|
108
|
+
|
|
109
|
+
## Summary
|
|
110
|
+
|
|
111
|
+
{{ one paragraph — what shipped, where, how the export shortlist was filtered, whether HTTP was rendered here or deferred to the CLI packet }}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Orchestrator spawn prompt
|
|
2
|
+
|
|
3
|
+
Canonical prompt the `codehub-document` skill uses when spawning a `general-purpose` subagent for a seeded packet. One source of truth so every subagent gets the same framing.
|
|
4
|
+
|
|
5
|
+
Adapted from `erpaval/references/orchestrator.md § Per-task Agent prompt template`. Paste verbatim into the `Agent` tool's `prompt` parameter, substituting `{{ packet_path }}` with the absolute path of the packet on disk.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
```text
|
|
10
|
+
You are a codehub-document subagent. Your context packet is at the path
|
|
11
|
+
below — read it first, then work through its sections in order, editing
|
|
12
|
+
the packet in place as you go. The packet is both your role prompt and
|
|
13
|
+
your work log.
|
|
14
|
+
|
|
15
|
+
<packet>
|
|
16
|
+
{{ packet_path }}
|
|
17
|
+
</packet>
|
|
18
|
+
|
|
19
|
+
<preamble>
|
|
20
|
+
Before starting section 1, read the packet in full, then read every file
|
|
21
|
+
listed under Input specification that is marked `cached`. Subagents have
|
|
22
|
+
zero context about the codebase — everything you need is in the packet,
|
|
23
|
+
in `.context.md`, in `.prefetch.md`, or in tools the packet explicitly
|
|
24
|
+
authorizes you to call.
|
|
25
|
+
</preamble>
|
|
26
|
+
|
|
27
|
+
<write_protocol>
|
|
28
|
+
Your task packet file is the single source of truth for what you've
|
|
29
|
+
done, decided, and verified. Edit it after every meaningful step, before
|
|
30
|
+
starting the next one. Partial progress written to disk survives
|
|
31
|
+
timeouts, SendMessage interrupts, and orchestrator context pressure;
|
|
32
|
+
state held in working memory does not.
|
|
33
|
+
|
|
34
|
+
The rhythm is: one action → edit the packet with the outcome → next
|
|
35
|
+
action. One exchange at a time.
|
|
36
|
+
|
|
37
|
+
Work through your sections in numbered order. For each section:
|
|
38
|
+
|
|
39
|
+
1. Do one unit of work — read a precompute file, call an authorized
|
|
40
|
+
MCP tool, draft a Markdown block, Write an output file.
|
|
41
|
+
2. Edit the packet under that section with what happened — the exact
|
|
42
|
+
sources read, the tool output digest, the decision made, any
|
|
43
|
+
surprises.
|
|
44
|
+
3. If the section needs more depth, do another unit and edit again.
|
|
45
|
+
4. Move to the next section only after the current one has real
|
|
46
|
+
content.
|
|
47
|
+
|
|
48
|
+
If a check fails (empty tool result, schema mismatch, missing file):
|
|
49
|
+
write the failure to the packet's Fallback paths or Work log, then
|
|
50
|
+
execute the documented fallback, then edit again with the outcome.
|
|
51
|
+
Keep the file ahead of your working memory at all times.
|
|
52
|
+
|
|
53
|
+
**Cite every factual claim with a backtick `path:LOC` reference.**
|
|
54
|
+
"Top community `analysis` has 42 files (`packages/analysis/src/index.ts:1`)."
|
|
55
|
+
beats "Top community has about 40 files."
|
|
56
|
+
|
|
57
|
+
When every section has real content and every Success criterion is
|
|
58
|
+
checked off, change `status: IN_PROGRESS` in the packet frontmatter
|
|
59
|
+
to `status: COMPLETE`.
|
|
60
|
+
</write_protocol>
|
|
61
|
+
|
|
62
|
+
<success_criteria>
|
|
63
|
+
- The output file(s) listed in the packet frontmatter's `output:` field
|
|
64
|
+
exist on disk, with H1 = identifier and no YAML frontmatter.
|
|
65
|
+
- Every factual claim in the output has a backtick citation
|
|
66
|
+
(`path:LOC` or `repo:path:LOC` in group mode).
|
|
67
|
+
- Every Success criterion checkbox in the packet is ticked.
|
|
68
|
+
- The Work log / Validation / Summary sections at the end of the packet
|
|
69
|
+
have real content.
|
|
70
|
+
- The `status:` line in the packet frontmatter is flipped from
|
|
71
|
+
IN_PROGRESS to COMPLETE.
|
|
72
|
+
</success_criteria>
|
|
73
|
+
|
|
74
|
+
<anti_goals>
|
|
75
|
+
- Do not re-call any MCP tool whose digest appears in `.prefetch.md` —
|
|
76
|
+
read the cached summary instead. If the cached slice is truncated and
|
|
77
|
+
you need a wider view, call the tool with a narrower filter, not a
|
|
78
|
+
blanket re-fetch.
|
|
79
|
+
- Do not modify files outside the packet's Scope section.
|
|
80
|
+
- Do not write YAML frontmatter on the output files.
|
|
81
|
+
- Do not invent symbol names, edges, tool names, routes, or community
|
|
82
|
+
names — every such identifier must come from a tool response or a
|
|
83
|
+
`Read` of the source file.
|
|
84
|
+
- Do not emit emojis. Do not use filler adverbs.
|
|
85
|
+
- If a precondition is missing (tool returns empty, schema doesn't
|
|
86
|
+
match, a required source file is absent), write the gap to the
|
|
87
|
+
packet's Work log and stop — do not improvise output from partial
|
|
88
|
+
data.
|
|
89
|
+
</anti_goals>
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## Usage at the orchestrator
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
Agent(
|
|
98
|
+
description="doc: architecture/system-overview",
|
|
99
|
+
subagent_type="general-purpose",
|
|
100
|
+
model="sonnet",
|
|
101
|
+
run_in_background=True,
|
|
102
|
+
name="doc-architecture-system-overview",
|
|
103
|
+
prompt=SPAWN_PROMPT.replace("{{ packet_path }}", absolute_packet_path),
|
|
104
|
+
)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
- `description` — 3-5 words; the UI surface, plus what shows in agent notifications.
|
|
108
|
+
- `name` — file-role; enables `SendMessage` continuation if the orchestrator needs to nudge a stuck subagent.
|
|
109
|
+
- `model` — from the packet frontmatter `model:` field; default sonnet, bump to opus for synthesis-heavy roles (cross-repo, risk-hotspots drill-down) if the packet requests it.
|
|
110
|
+
- `run_in_background` — always `true` for Phase 1 fan-out; the orchestrator monitors via `wc -l` on packet files, not by polling agent output.
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: codehub-onboarding
|
|
3
|
+
description: "Use when the user asks for an ONBOARDING, getting-started, or new-engineer guide for the current repo or group. Examples: \"write ONBOARDING.md\", \"generate an onboarding doc for new hires\", \"what should a new engineer read first\". Produces a ranked reading order from `project_profile` + top processes + entry points + owners + centrality. DO NOT use for full architecture books (use `codehub-document`) or PR summaries (use `codehub-pr-description`)."
|
|
4
|
+
allowed-tools: "Read, Write, Glob, mcp__opencodehub__project_profile, mcp__opencodehub__query, mcp__opencodehub__context, mcp__opencodehub__route_map, mcp__opencodehub__tool_map, mcp__opencodehub__owners, mcp__opencodehub__sql, mcp__opencodehub__list_repos, Task"
|
|
5
|
+
argument-hint: "[output-path] [--committed]"
|
|
6
|
+
color: green
|
|
7
|
+
model: sonnet
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# codehub-onboarding
|
|
11
|
+
|
|
12
|
+
Produces a single ONBOARDING.md with a ranked reading order drawn from graph centrality. The wedge is the ranked reading list — a generic README scaffold cannot produce this.
|
|
13
|
+
|
|
14
|
+
## Preconditions
|
|
15
|
+
|
|
16
|
+
1. `mcp__opencodehub__list_repos` returns the target. If not, emit `Run codehub analyze first — repo <name> is not indexed.` and stop.
|
|
17
|
+
2. `codehub status` is fresh. If stale, emit `Run 'codehub analyze' first — index is stale` and stop.
|
|
18
|
+
|
|
19
|
+
## Arguments
|
|
20
|
+
|
|
21
|
+
- `[output-path]` — where to write. Defaults:
|
|
22
|
+
- without `--committed`: `.codehub/ONBOARDING.md` (gitignored)
|
|
23
|
+
- with `--committed`: `docs/ONBOARDING.md` (gitignored default flipped)
|
|
24
|
+
- `--committed` — write to a committed path instead of `.codehub/`.
|
|
25
|
+
|
|
26
|
+
## Process
|
|
27
|
+
|
|
28
|
+
1. Run the preconditions.
|
|
29
|
+
2. `mcp__opencodehub__project_profile({repo})` — languages, stacks, entry points, 2-sentence summary.
|
|
30
|
+
3. `mcp__opencodehub__route_map({repo})` — HTTP surface (if present).
|
|
31
|
+
4. `mcp__opencodehub__tool_map({repo})` — MCP/CLI surface (if present).
|
|
32
|
+
5. `mcp__opencodehub__sql({query: "SELECT name, file_path, in_degree + out_degree AS centrality FROM nodes WHERE kind IN ('File','Module','Class') ORDER BY centrality DESC LIMIT 15"})` — top-centrality nodes, the "read these first" candidates.
|
|
33
|
+
6. For the top 8 of those: `mcp__opencodehub__context({symbol: <id>})` to pull a one-line summary + owners.
|
|
34
|
+
7. `mcp__opencodehub__owners({path})` on the top-3 folders by file count — gives the "ask these humans" list.
|
|
35
|
+
8. Dispatch a single `Task` with the `doc-onboarding` specialty role (inline in this skill — see `references/onboarding-template.md`).
|
|
36
|
+
9. Assemble the output using the template below.
|
|
37
|
+
10. `Write` to the resolved output path.
|
|
38
|
+
|
|
39
|
+
## Output template
|
|
40
|
+
|
|
41
|
+
```markdown
|
|
42
|
+
# <repo> · Onboarding
|
|
43
|
+
|
|
44
|
+
*Generated <ISO-8601>. Refresh via `/codehub-onboarding`.*
|
|
45
|
+
|
|
46
|
+
## TL;DR
|
|
47
|
+
|
|
48
|
+
2 sentences: what this repo does + the single most important mental model to hold.
|
|
49
|
+
|
|
50
|
+
## Stack
|
|
51
|
+
|
|
52
|
+
| Layer | Tech | Source |
|
|
53
|
+
|---|---|---|
|
|
54
|
+
| Runtime | Node 22 | `package.json:7` |
|
|
55
|
+
| Storage | DuckDB | `packages/storage/src/index.ts:12` |
|
|
56
|
+
| ... | ... | ... |
|
|
57
|
+
|
|
58
|
+
## Read these 10 files first (in order)
|
|
59
|
+
|
|
60
|
+
1. `packages/cli/src/bin.ts` — CLI entry point. `(45 LOC)`
|
|
61
|
+
2. `packages/mcp/src/server.ts` — MCP server bootstrap. `(320 LOC)`
|
|
62
|
+
3. `packages/ingestion/src/pipeline.ts` — the phase DAG. `(180 LOC)`
|
|
63
|
+
... (ranked by centrality; each with a one-sentence reason)
|
|
64
|
+
|
|
65
|
+
## Walk one process end-to-end
|
|
66
|
+
|
|
67
|
+
Pick the highest-step-count process and walk it:
|
|
68
|
+
|
|
69
|
+
1. **Enter** at `packages/cli/src/commands/analyze.ts:14`.
|
|
70
|
+
2. **Dispatches** to `packages/ingestion/src/phases/parse.ts:22`.
|
|
71
|
+
3. **Writes** via `packages/storage/src/write.ts:88`.
|
|
72
|
+
4. **Exits** at `packages/cli/src/commands/analyze.ts:102`.
|
|
73
|
+
|
|
74
|
+
## Ask these humans
|
|
75
|
+
|
|
76
|
+
| Area | Owner | Share |
|
|
77
|
+
|---|---|---|
|
|
78
|
+
| `packages/mcp/` | alice@ | 72% |
|
|
79
|
+
| `packages/ingestion/` | bob@ | 45% |
|
|
80
|
+
| `packages/storage/` | charlie@ | 68% |
|
|
81
|
+
|
|
82
|
+
## Next steps
|
|
83
|
+
|
|
84
|
+
- Run `codehub analyze .` in your checkout to build the local graph.
|
|
85
|
+
- Open the Claude Code plugin and try `/probe "how does X work"`.
|
|
86
|
+
- Read [architecture/system-overview.md](./docs/architecture/system-overview.md) if `codehub-document` has already produced it.
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
## Document format rules
|
|
90
|
+
|
|
91
|
+
- H1 = "{{repo}} · Onboarding".
|
|
92
|
+
- Top reading list is exactly 10 items, ranked.
|
|
93
|
+
- Every file in the reading list has a one-sentence reason + LOC count in backticks.
|
|
94
|
+
- No YAML frontmatter on the output.
|
|
95
|
+
- No emojis.
|
|
96
|
+
|
|
97
|
+
## Fallback paths
|
|
98
|
+
|
|
99
|
+
- If `sql` over centrality returns fewer than 10 rows: pad with highest-fan-out `Function` nodes and note `*graph-small fallback*` in the list header.
|
|
100
|
+
- If no `Process` nodes exist (tiny repo or graph out of sync): skip the "Walk one process" section entirely; emit "This repo's graph does not yet encode processes. Re-run `codehub analyze` if unexpected." as a one-line note.
|
|
101
|
+
- If `owners` returns `[]` for all folders: replace the Ask-these-humans table with a `git shortlog -sn --since=90.days` pointer.
|
|
102
|
+
|
|
103
|
+
## Quality checklist
|
|
104
|
+
|
|
105
|
+
- [ ] Preconditions enforced.
|
|
106
|
+
- [ ] TL;DR is ≤ 2 sentences.
|
|
107
|
+
- [ ] Stack table has ≥ 3 rows.
|
|
108
|
+
- [ ] Reading list has exactly 10 items, each with a backtick citation.
|
|
109
|
+
- [ ] One process walked end-to-end (or the fallback note).
|
|
110
|
+
- [ ] Ask-these-humans table has ≥ 2 rows.
|
|
111
|
+
- [ ] Next-steps section exists with ≥ 3 concrete actions.
|