skillwiki 0.2.0-beta.1 → 0.2.0-beta.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/cli.js CHANGED
@@ -1238,7 +1238,7 @@ async function runLint(input) {
1238
1238
 
1239
1239
  // src/cli.ts
1240
1240
  var program = new Command();
1241
- program.name("skillwiki").description("Deterministic helpers for CodeWiki skills").version("0.1.0");
1241
+ program.name("skillwiki").description("Deterministic helpers for CodeWiki skills").version("0.2.0-beta.3");
1242
1242
  program.option("--human", "render terminal-readable output instead of JSON");
1243
1243
  function emit(r) {
1244
1244
  if (program.opts().human) printHuman(r.result);
@@ -1257,7 +1257,7 @@ program.command("orphans [vault]").action(async (vault) => emit(await runOrphans
1257
1257
  })));
1258
1258
  program.command("audit <file>").action(async (file) => emit(await runAudit({ file })));
1259
1259
  program.command("install").option("--target <dir>", "target install directory", `${process.env.HOME ?? ""}/.claude/skills/`).option("--dry-run", "preview only", false).option("--skills-root <dir>", "source skills directory (defaults to packaged)").action(async (opts) => {
1260
- const skillsRoot = opts.skillsRoot ?? new URL("../../skills/", import.meta.url).pathname;
1260
+ const skillsRoot = opts.skillsRoot ?? new URL("../skills/", import.meta.url).pathname;
1261
1261
  emit(await runInstall({ skillsRoot, target: opts.target, dryRun: !!opts.dryRun }));
1262
1262
  });
1263
1263
  program.command("path").option("--vault <dir>", "explicit vault override (runtime)").option("--target <dir>", "explicit target override (init-time)").option("--init-time", "use init-time chain instead of runtime", false).option("--explain", "include resolution chain in output", false).action(async (opts) => {
package/package.json CHANGED
@@ -1,22 +1,22 @@
1
1
  {
2
2
  "name": "skillwiki",
3
- "version": "0.2.0-beta.1",
3
+ "version": "0.2.0-beta.3",
4
4
  "type": "module",
5
5
  "bin": { "skillwiki": "dist/cli.js" },
6
- "files": ["dist", "templates", "README.md"],
6
+ "files": ["dist", "templates", "skills", "README.md"],
7
7
  "scripts": {
8
- "build": "tsup",
8
+ "build": "tsup && rm -rf ./skills && cp -r ../skills ./skills",
9
9
  "test": "vitest run",
10
10
  "test:watch": "vitest",
11
11
  "typecheck": "tsc --noEmit"
12
12
  },
13
13
  "dependencies": {
14
- "@skillwiki/shared": "*",
15
14
  "commander": "^12.1.0",
16
15
  "js-yaml": "^4.1.0",
17
16
  "zod": "^3.23.0"
18
17
  },
19
18
  "devDependencies": {
19
+ "@skillwiki/shared": "*",
20
20
  "@types/js-yaml": "^4.0.9",
21
21
  "@types/node": "^20.12.0",
22
22
  "tsup": "^8.3.0",
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "skillwiki",
3
+ "version": "0.1.0",
4
+ "description": "Project-aware Karpathy-style knowledge base for Claude Code: 10 prompt-only skills (wiki-* + proj-*) backed by the deterministic `skillwiki` CLI (8 subcommands, JSON-by-default).",
5
+ "author": {
6
+ "name": "karlorz",
7
+ "url": "https://github.com/karlorz"
8
+ },
9
+ "homepage": "https://github.com/karlorz/llm-wiki",
10
+ "repository": "https://github.com/karlorz/llm-wiki",
11
+ "license": "MIT",
12
+ "keywords": [
13
+ "knowledge-base",
14
+ "wiki",
15
+ "obsidian",
16
+ "claude-code",
17
+ "skills",
18
+ "karpathy",
19
+ "markdown",
20
+ "research",
21
+ "rag-alternative"
22
+ ]
23
+ }
@@ -0,0 +1,10 @@
1
+ # @skillwiki/skills
2
+
3
+ Prompt-only Markdown skills for Claude Code. Installed via `skillwiki install`.
4
+
5
+ | Namespace | Skills |
6
+ |---|---|
7
+ | `wiki-*` | `wiki-init`, `wiki-ingest`, `wiki-query`, `wiki-lint`, `wiki-crystallize`, `wiki-audit` |
8
+ | `proj-*` | `proj-init`, `proj-work`, `proj-distill`, `proj-decide` |
9
+
10
+ Each subdirectory holds one `SKILL.md`. No build step.
@@ -0,0 +1,6 @@
1
+ {
2
+ "name": "@skillwiki/skills",
3
+ "version": "0.1.0",
4
+ "private": true,
5
+ "files": ["wiki-*", "proj-*", ".claude-plugin", "README.md"]
6
+ }
@@ -0,0 +1,24 @@
1
+ ---
2
+ name: proj-decide
3
+ description: Write an Architectural Decision Record (ADR). If the decision generalizes, also create a concepts/ page.
4
+ ---
5
+
6
+ # proj-decide
7
+
8
+ ## When to invoke
9
+ - User commits to an architectural decision worth recording for future reference.
10
+
11
+ ## Pre-orientation reads
12
+ Standard four + project context.
13
+
14
+ ## Steps
15
+ 1. Compose the ADR in `projects/{slug}/architecture/YYYY-MM-DD-{adr-slug}.md`. Frontmatter: kind=decision, status=in-progress or completed, project link.
16
+ 2. `npx skillwiki validate <adr>`. If non-zero, STOP.
17
+ 3. **Generalization check.** If the decision applies beyond this project, create a `concepts/` page with `provenance: project` (or `mixed` if research-informed).
18
+ 4. Apply writes: ADR → (optional) concept page → vault `index.md` → vault `log.md` and project `log.md`.
19
+
20
+ ## Stop conditions
21
+ - `validate` non-zero on either page.
22
+
23
+ ## Forbidden
24
+ - Filing the concept page without explicit `provenance:`.
@@ -0,0 +1,26 @@
1
+ ---
2
+ name: proj-distill
3
+ description: 2-step distillation (E4) — analyze project compound entry, then generate a vault concept page with provenance.
4
+ ---
5
+
6
+ # proj-distill
7
+
8
+ ## When to invoke
9
+ - A project compound entry captures a pattern that generalizes beyond the project.
10
+
11
+ ## Pre-orientation reads
12
+ Standard four + project context.
13
+
14
+ ## Steps (E4 — 2-step pattern)
15
+ 1. **Step 1 — Analyze.** Read the source compound entry + linked work items. Output a candidate concept outline. STOP if no clear universal pattern is found — surface the reasoning instead of forcing a page.
16
+ 2. **Step 2 — Generate.** Compose the vault concept page with `provenance: project` and `provenance_projects: ["[[slug]]"]`. Validate with `npx skillwiki validate`.
17
+ 3. **Backlink.** Set `promoted_to: "[[concept-slug]]"` on the source compound entry.
18
+ 4. **Apply writes in order.** Vault concept page → backlink update → project `log.md` → vault `index.md` → vault `log.md`.
19
+
20
+ ## Stop conditions
21
+ - No clear universal pattern.
22
+ - `validate` non-zero on either page.
23
+
24
+ ## Forbidden
25
+ - Skipping Step 1 (no direct generation).
26
+ - Updating index/logs before `validate` passes.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: proj-init
3
+ description: Bootstrap a project workspace at projects/{slug}/ with README, requirements/, architecture/, work/, compound/.
4
+ ---
5
+
6
+ # proj-init
7
+
8
+ ## When to invoke
9
+ - User starts a new project that should live inside the vault.
10
+
11
+ ## Pre-orientation reads
12
+ Standard four reads (vault SCHEMA, index, log) — no project context yet.
13
+
14
+ ## Inputs
15
+ - Slug (lowercase, hyphenated).
16
+ - One-line intent.
17
+
18
+ ## Steps
19
+ 1. Verify `projects/{slug}/` does not exist.
20
+ 2. Create folders: `projects/{slug}/{requirements,architecture,work,compound}/`.
21
+ 3. Render `projects/{slug}/README.md` from `project-README.md` template, filling `{{slug}}` and `{{date}}`.
22
+ 4. Update vault `index.md` "Projects" section: add `- [[projects/{slug}]]`.
23
+ 5. Append vault `log.md` entry: "Project {slug} initialized."
24
+
25
+ ## Stop conditions
26
+ - `projects/{slug}/` already exists.
27
+
28
+ ## Forbidden
29
+ - Modifying any other project's files.
@@ -0,0 +1,29 @@
1
+ ---
2
+ name: proj-work
3
+ description: Open or run a work item under projects/{slug}/work/YYYY-MM-DD-{slug}/. Redirects brainstorming/writing-plans output paths.
4
+ ---
5
+
6
+ # proj-work
7
+
8
+ ## When to invoke
9
+ - User starts a feature, issue, refactor, or decision inside an existing project.
10
+ - Brainstorming or writing-plans skills would otherwise default-write outside the project tree.
11
+
12
+ ## Pre-orientation reads
13
+ Standard four + project context (project README, last ~5 work logs).
14
+
15
+ ## Steps
16
+ 1. Determine `kind:` (feature | issue | refactor | decision) and slug.
17
+ 2. Create folder `projects/{slug}/work/YYYY-MM-DD-{work-slug}/`.
18
+ 3. Override default output paths for any nested skill: `spec.md`, `plan.md`, and `log.md` are written here, not at vault root.
19
+ 4. Validate work-item frontmatter via `npx skillwiki validate <spec.md>`. If non-zero, STOP.
20
+ 5. Manage status transitions: `planned` → `in-progress` → `completed` (set `completed:` date) or `abandoned`.
21
+ 6. Append vault `log.md` entry on creation and on each status transition.
22
+
23
+ ## Stop conditions
24
+ - `validate` non-zero.
25
+ - Conflicting work folder name.
26
+
27
+ ## Forbidden
28
+ - Writing spec/plan files outside the work folder.
29
+ - Marking `status: completed` without a `completed:` date.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: wiki-audit
3
+ description: Verify per-page that every ^[raw/...] resolves and sources frontmatter matches the body.
4
+ ---
5
+
6
+ # wiki-audit
7
+
8
+ ## When This Skill Activates
9
+
10
+ - User asks for a per-page audit or invokes a pre-merge gate.
11
+ - A vault is resolvable (see step 0).
12
+
13
+ ## Output language
14
+
15
+ Run `skillwiki lang` at the start. Generate audit narrative and `--human` summaries in the resolved language. Frontmatter keys, file names, schema headers, index/log structural lines, citation markers, and wikilink slugs MUST stay English.
16
+
17
+ ## Pre-orientation reads
18
+ Standard four reads.
19
+
20
+ ## Steps
21
+ 0. **Resolve vault and language.** Run `skillwiki path` (fail if NO_VAULT_CONFIGURED) and `skillwiki lang`.
22
+ 1. `npx skillwiki audit <page>`. Read the JSON report.
23
+ 2. Reason over the report:
24
+ - For each unresolved marker: suggest ingesting the missing source or correcting the path.
25
+ - For each `unused_sources` entry: suggest adding a body marker or removing from `sources:`.
26
+ - For each `missing_from_sources` entry: suggest adding to `sources:`.
27
+ 3. Append one `log.md` entry summarizing the audit and any suggested follow-ups.
28
+
29
+ ## Stop conditions
30
+ None — audit always completes.
31
+
32
+ ## Forbidden
33
+ - Auto-applying suggested fixes (audit is observation-only).
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: wiki-crystallize
3
+ description: Distill the current working session into a typed-knowledge page with provenance.
4
+ ---
5
+
6
+ # wiki-crystallize
7
+
8
+ ## When This Skill Activates
9
+
10
+ - User asks to crystallize, consolidate, or promote draft material into typed-knowledge pages.
11
+ - A vault is resolvable (see step 0).
12
+
13
+ ## Output language
14
+
15
+ Run `skillwiki lang` at the start. Generate consolidated page prose and `--human` summaries in the resolved language. Frontmatter keys, file names, schema headers, index/log structural lines, citation markers, and wikilink slugs MUST stay English.
16
+
17
+ ## Pre-orientation reads
18
+ Standard four reads. If cwd is inside `projects/{slug}/`, also read project README and recent work logs.
19
+
20
+ ## Steps
21
+ 0. **Resolve vault and language.** Run `skillwiki path` (fail if NO_VAULT_CONFIGURED) and `skillwiki lang`.
22
+ 1. Identify type: entity / concept / comparison / query / summary.
23
+ 2. Set `provenance:`. Default `research`. If in project context: `project` with `provenance_projects: ["[[slug]]"]`.
24
+ 3. Compose the page with citations pre-attached. Reuse existing `raw/` sources where possible.
25
+ 4. `npx skillwiki validate <page>`. If non-zero, STOP.
26
+ 5. Apply writes: page → `index.md` → `log.md`.
27
+
28
+ ## Stop conditions
29
+ - `validate` non-zero.
30
+ - Missing `provenance:` for project-context runs.
31
+
32
+ ## Forbidden
33
+ - Filing without explicit `provenance:`.
34
+ - Updating `index.md` before `validate` passes.
@@ -0,0 +1,47 @@
1
+ ---
2
+ name: wiki-ingest
3
+ description: Convert URLs, files, or pasted text into typed-knowledge pages with raw provenance. Single-pass v1.
4
+ ---
5
+
6
+ # wiki-ingest
7
+
8
+ ## When This Skill Activates
9
+
10
+ - User shares a URL, paste, or local file to capture in the vault.
11
+ - The output target is `entities/`, `concepts/`, `comparisons/`, or `queries/`.
12
+ - A vault is resolvable (see step 0).
13
+
14
+ ## Output language
15
+
16
+ Run `skillwiki lang` at the start. Generate page-body prose, narrative sections, and `--human` summaries in the resolved language. Frontmatter keys, file names, schema headers, index/log structural lines, citation markers, and wikilink slugs MUST stay English.
17
+
18
+ ## Pre-orientation reads (mandatory before any write)
19
+ 1. `SCHEMA.md`
20
+ 2. `index.md`
21
+ 3. Last 20–30 entries of `log.md`
22
+ 4. (Project context only) `projects/{slug}/README.md` and last ~5 work-item logs.
23
+
24
+ ## Steps (in order — N6, N7, N8)
25
+ 0. **Resolve vault and language.** Run `skillwiki path` (fail if NO_VAULT_CONFIGURED) and `skillwiki lang`. Use the resolved vault path for all writes; use the canonical language for all generated prose.
26
+ 1. **Guard.** For each URL: run `npx skillwiki fetch-guard <url>`. If exit ≠ 0, STOP and surface the error. Do not retry.
27
+ 2. **Fetch.** Use `web_fetch` (or read local file) under Layer 2 controls (the CLI Layer 2 fetcher applies in tests; in skill runtime use `web_fetch` directly and treat any error as STOP).
28
+ 3. **Hash.** Write the raw file (frontmatter + body). Run `npx skillwiki hash <raw-file>` and embed the result in raw frontmatter `sha256:`.
29
+ 4. **Generate page(s).** Compose typed-knowledge page(s) with citations pre-attached (`^[raw/...]` markers).
30
+ 5. **Validate.** For each generated page: run `npx skillwiki validate <page>`. If exit ≠ 0, STOP — do not write index/log.
31
+ 6. **Apply writes in order.** raw → page(s) → `index.md` → `log.md`.
32
+ 7. **Confidence flag.** If only one source is cited, set `confidence: low`.
33
+
34
+ ## Provenance defaults
35
+ - Default `provenance: research`.
36
+ - If cwd is inside `projects/{slug}/`, set `provenance: project` and add `provenance_projects: ["[[slug]]"]`.
37
+
38
+ ## Stop conditions
39
+ - `fetch-guard` non-zero.
40
+ - Fetch timeout / size limit exceeded.
41
+ - `validate` non-zero on any page.
42
+ - sha256 already exists in vault for the same source.
43
+
44
+ ## Forbidden
45
+ - Skipping `fetch-guard`.
46
+ - Updating `index.md` or `log.md` before all pages validate.
47
+ - Modifying any existing file in `raw/`.
@@ -0,0 +1,36 @@
1
+ ---
2
+ name: wiki-init
3
+ description: Bootstrap a CodeWiki vault — domain-aware SCHEMA.md, index.md, log.md, and ~/.skillwiki/.env binding. Use when starting a fresh vault.
4
+ ---
5
+
6
+ # wiki-init
7
+
8
+ ## When This Skill Activates
9
+
10
+ - User asks to create, build, or start a vault, wiki, or knowledge base.
11
+ - The resolved vault path (see step 0) does not yet contain SCHEMA.md.
12
+
13
+ ## Pre-orientation reads
14
+
15
+ None for the first run.
16
+
17
+ ## Steps
18
+
19
+ 0. **Resolve target.** Run `skillwiki path --init-time` to see what target the CLI will pick. Confirm with the user, or override with `--target <dir>`.
20
+ 1. Verify target is empty or has no SCHEMA.md.
21
+ 2. Ask the domain question: "What knowledge domain will this vault cover? Be specific."
22
+ 3. Propose a 10–15 tag taxonomy tailored to the domain. Confirm or accept the user's revision.
23
+ 4. Ask the language question: "What language should generated page prose use? Default is `en`. Aliases like `chinese-traditional` or `zh-Hant` are accepted."
24
+ 5. Run `skillwiki init --target <dir> --domain "<answer>" --taxonomy "<comma list>" --lang "<lang>"`.
25
+ 6. **Suggest first sources.** Propose 3–5 initial sources (URLs, papers, articles) appropriate to the domain. Prompt the user to provide the first one to ingest, then hand off to wiki-ingest.
26
+
27
+ ## Stop conditions
28
+
29
+ - Target non-empty and `--force` not consented.
30
+ - `~/.skillwiki/.env` already binds a different vault or language and `--force` not consented.
31
+
32
+ ## Forbidden
33
+
34
+ - Modifying anything outside the target directory or `~/.skillwiki/.env`.
35
+ - Writing to `~/.hermes/.env` (read-only fallback).
36
+ - Running any LLM-driven content generation in this skill.
@@ -0,0 +1,33 @@
1
+ ---
2
+ name: wiki-lint
3
+ description: Vault health check via the umbrella `skillwiki lint` subcommand. Read-only by default; rotation requires explicit user consent.
4
+ ---
5
+
6
+ # wiki-lint
7
+
8
+ ## When This Skill Activates
9
+
10
+ - User asks for a vault health report, lint, or audit.
11
+ - Periodic maintenance.
12
+
13
+ ## Pre-orientation reads
14
+
15
+ Standard four reads.
16
+
17
+ ## Steps
18
+
19
+ 0. Resolve vault: `skillwiki path` (record source for context).
20
+ 1. Run `skillwiki lint <vault>`. Read the JSON.
21
+ 2. Reason over findings; present grouped by severity with concrete suggested actions per kind.
22
+ 3. If `log_rotate_needed` is present and the user consents, run `skillwiki log-rotate <vault> --apply`. Otherwise leave alone.
23
+ 4. Append one `log.md` entry summarizing the lint counts (errors/warnings/info).
24
+
25
+ ## Stop conditions
26
+
27
+ None — lint reports all findings even on per-page errors.
28
+
29
+ ## Forbidden
30
+
31
+ - Auto-rotating logs.
32
+ - Auto-updating sha256 fields.
33
+ - Modifying any page beyond the lint summary entry in `log.md`.
@@ -0,0 +1,40 @@
1
+ ---
2
+ name: wiki-query
3
+ description: Search the vault and synthesize an answer with E2 4-signal ranking. Optional file to queries/ or comparisons/.
4
+ ---
5
+
6
+ # wiki-query
7
+
8
+ ## When This Skill Activates
9
+
10
+ - User asks a question that should be answered from vault contents.
11
+ - A vault is resolvable (see step 0).
12
+
13
+ ## Output language
14
+
15
+ Run `skillwiki lang` at the start. Generate query-result prose and `--human` summaries in the resolved language. Frontmatter keys, file names, schema headers, index/log structural lines, citation markers, and wikilink slugs MUST stay English.
16
+
17
+ ## Pre-orientation reads
18
+ Standard four reads (SCHEMA, index, log, project context if applicable).
19
+
20
+ ## Steps
21
+ 0. **Resolve vault and language.** Run `skillwiki path` (fail if NO_VAULT_CONFIGURED) and `skillwiki lang`.
22
+ 1. **Determine scope.** Ask the user once if ambiguous: vault | current project | project+concepts.
23
+ 2. **Refresh graph.** If `.skillwiki/graph.json` is missing or older than 24h: `npx skillwiki graph build <vault>`.
24
+ 3. **Compute overlap.** `npx skillwiki overlap <vault>`.
25
+ 4. **Score candidates** in prompt using the 4 signals:
26
+ - Direct wikilink: 3.0×
27
+ - Source overlap: 4.0× (read from overlap output)
28
+ - Adamic-Adar: 1.5× (read from graph output)
29
+ - Type affinity: 1.0×
30
+ 5. **Read top candidates** in full (frontmatter + body).
31
+ 6. **Synthesize answer** with explicit citations to the candidate pages.
32
+ 7. **Optional file.** If user accepts: write to `queries/<slug>.md` or `comparisons/<slug>.md` with full frontmatter, validate, then update `index.md` then `log.md`.
33
+
34
+ ## Stop conditions
35
+ - Zero matching pages.
36
+ - User declines to file.
37
+
38
+ ## Forbidden
39
+ - Filing without `validate` passing.
40
+ - Skipping the orientation reads even for "quick" queries.