@zosmaai/pi-llm-wiki 0.4.0 → 0.6.0
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/CHANGELOG.md +39 -0
- package/README.md +254 -34
- package/extensions/llm-wiki/index.ts +39 -12
- package/extensions/llm-wiki/lib/recall.ts +208 -0
- package/extensions/llm-wiki/lib/retro.ts +203 -0
- package/mcp/index.ts +463 -0
- package/package.json +33 -4
- package/skills/llm-wiki/SKILL.md +45 -10
- package/.coderabbit.yaml +0 -43
- package/.github/codeql/codeql-config.yml +0 -12
- package/.github/workflows/ci.yml +0 -45
- package/.github/workflows/codeql.yml +0 -39
- package/.github/workflows/release.yml +0 -86
- package/AGENTS.md +0 -57
- package/CONTRIBUTING.md +0 -43
- package/biome.json +0 -30
- package/scripts/release.js +0 -72
- package/test/llm-wiki.test.ts +0 -724
- package/tsconfig.json +0 -19
- package/vitest.config.ts +0 -16
package/package.json
CHANGED
|
@@ -1,17 +1,26 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zosmaai/pi-llm-wiki",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "LLM Wiki for Pi —
|
|
3
|
+
"version": "0.6.0",
|
|
4
|
+
"description": "Self-maintaining LLM Wiki for Pi — Karpathy-pattern knowledge base with immutable source capture, automated ingestion, search, linting, and Obsidian-compatible vault. auto-updating personal & company wiki.",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"pi",
|
|
6
7
|
"pi-package",
|
|
7
|
-
"pi-skill",
|
|
8
8
|
"pi-extension",
|
|
9
|
+
"pi-skill",
|
|
9
10
|
"llm-wiki",
|
|
10
11
|
"karpathy",
|
|
11
12
|
"knowledge-base",
|
|
12
13
|
"obsidian",
|
|
13
14
|
"second-brain",
|
|
14
15
|
"wiki",
|
|
16
|
+
"memory",
|
|
17
|
+
"markdown",
|
|
18
|
+
"pkm",
|
|
19
|
+
"personal-knowledge-management",
|
|
20
|
+
"research",
|
|
21
|
+
"vault",
|
|
22
|
+
"zettelkasten",
|
|
23
|
+
"rag",
|
|
15
24
|
"zosmaai"
|
|
16
25
|
],
|
|
17
26
|
"license": "MIT",
|
|
@@ -24,6 +33,20 @@
|
|
|
24
33
|
"url": "https://github.com/zosmaai/pi-llm-wiki/issues"
|
|
25
34
|
},
|
|
26
35
|
"homepage": "https://github.com/zosmaai/pi-llm-wiki#readme",
|
|
36
|
+
"files": [
|
|
37
|
+
"extensions",
|
|
38
|
+
"skills",
|
|
39
|
+
"prompts",
|
|
40
|
+
"mcp",
|
|
41
|
+
"docs",
|
|
42
|
+
"assets",
|
|
43
|
+
"README.md",
|
|
44
|
+
"CHANGELOG.md",
|
|
45
|
+
"LICENSE"
|
|
46
|
+
],
|
|
47
|
+
"publishConfig": {
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
27
50
|
"scripts": {
|
|
28
51
|
"test": "vitest run",
|
|
29
52
|
"test:watch": "vitest",
|
|
@@ -40,7 +63,10 @@
|
|
|
40
63
|
"extensions": ["./extensions"],
|
|
41
64
|
"skills": ["./skills"],
|
|
42
65
|
"prompts": ["./prompts"],
|
|
43
|
-
"image": "https://raw.githubusercontent.com/zosmaai/pi-llm-wiki/main/assets/screenshot.png"
|
|
66
|
+
"image": "https://raw.githubusercontent.com/zosmaai/pi-llm-wiki/main/assets/screenshot.png",
|
|
67
|
+
"mcpservers": {
|
|
68
|
+
"llm-wiki": "node ./mcp/index.js"
|
|
69
|
+
}
|
|
44
70
|
},
|
|
45
71
|
"peerDependencies": {
|
|
46
72
|
"@mariozechner/pi-coding-agent": "*",
|
|
@@ -49,6 +75,9 @@
|
|
|
49
75
|
"engines": {
|
|
50
76
|
"node": ">=18"
|
|
51
77
|
},
|
|
78
|
+
"dependencies": {
|
|
79
|
+
"@modelcontextprotocol/server": "^2.0.0-alpha.2"
|
|
80
|
+
},
|
|
52
81
|
"devDependencies": {
|
|
53
82
|
"@biomejs/biome": "^1.9.4",
|
|
54
83
|
"@mariozechner/pi-coding-agent": "^0.70.2",
|
package/skills/llm-wiki/SKILL.md
CHANGED
|
@@ -45,21 +45,48 @@ WIKI_ROOT/
|
|
|
45
45
|
|
|
46
46
|
## How the Extension Helps You
|
|
47
47
|
|
|
48
|
-
| Task
|
|
49
|
-
|
|
|
50
|
-
| Track ingestion
|
|
51
|
-
| Update INDEX
|
|
52
|
-
| Update LOG
|
|
53
|
-
| Find orphans
|
|
54
|
-
| Block raw edits
|
|
55
|
-
| Create source page
|
|
48
|
+
| Task | Before (skill-only) | Now (extension-backed) |
|
|
49
|
+
| --------------------------- | ---------------------------- | ------------------------------------- |
|
|
50
|
+
| Track ingestion | Manual `history.json` | Automatic via `meta/registry.json` |
|
|
51
|
+
| Update INDEX | Manual edit after every page | Auto-rebuilds on turn end |
|
|
52
|
+
| Update LOG | Manual append | Auto-generated from `events.jsonl` |
|
|
53
|
+
| Find orphans | Shell `grep` scans | Instant from `backlinks.json` |
|
|
54
|
+
| Block raw edits | Skill says "don't" | Extension **enforces** immutability |
|
|
55
|
+
| Create source page | 8 tool calls | `wiki_capture_source` + LLM synthesis |
|
|
56
|
+
| **Recall wiki knowledge** | Never happens | **Auto-search before every turn** |
|
|
57
|
+
| **Save task insights** | Manual capture | `wiki_retro` — one tool call |
|
|
58
|
+
|
|
59
|
+
## 🔄 Auto-Recall (New)
|
|
60
|
+
|
|
61
|
+
**The extension now automatically searches the wiki before every user turn.**
|
|
62
|
+
|
|
63
|
+
When you send a prompt, the extension:
|
|
64
|
+
1. Extracts key terms from your request
|
|
65
|
+
2. Searches the wiki registry for matching pages
|
|
66
|
+
3. Injects matching page titles + summaries into context
|
|
67
|
+
4. You see this as "Relevant Wiki Knowledge" in your system prompt
|
|
68
|
+
|
|
69
|
+
**This means the wiki works as an automatic second brain.**
|
|
70
|
+
You don't need to remember to search — relevant knowledge is surfaced automatically.
|
|
71
|
+
|
|
72
|
+
### Manual recall for deeper searches
|
|
73
|
+
|
|
74
|
+
If the auto-recall doesn't find enough context, call `wiki_recall` explicitly:
|
|
75
|
+
|
|
76
|
+
```
|
|
77
|
+
wiki_recall(query="specific terms...", max_results=10)
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
This gives you more control over the search terms and returns content previews.
|
|
56
81
|
|
|
57
82
|
## Available Tools
|
|
58
83
|
|
|
59
|
-
Use these directly — they handle scaffolding and
|
|
84
|
+
Use these directly — they handle scaffolding, bookkeeping, recall, and capture:
|
|
60
85
|
|
|
61
86
|
- `wiki_bootstrap` — Initialize a new vault
|
|
62
87
|
- `wiki_capture_source` — Capture URL/file/text into immutable packet + skeleton page
|
|
88
|
+
- `wiki_recall` — **Auto-called at turn start.** Search wiki for task-relevant pages
|
|
89
|
+
- `wiki_retro` — Save an atomic insight from a completed task into the wiki
|
|
63
90
|
- `wiki_ingest` — Get batch of uningested sources with extracted text
|
|
64
91
|
- `wiki_ensure_page` — Create entity/concept/synthesis/analysis page from template
|
|
65
92
|
- `wiki_search` — Search registry for existing pages
|
|
@@ -83,12 +110,20 @@ Use these directly — they handle scaffolding and bookkeeping:
|
|
|
83
110
|
|
|
84
111
|
### Query → Answer → File
|
|
85
112
|
|
|
86
|
-
1.
|
|
113
|
+
1. **Auto-recall**: Extension surfaces relevant wiki pages automatically
|
|
87
114
|
2. Read those pages
|
|
88
115
|
3. Synthesize answer with `[[wikilink]]` citations
|
|
89
116
|
4. If novel: create analysis page via `wiki_ensure_page(type="analysis")`
|
|
90
117
|
5. Extension auto-updates metadata
|
|
91
118
|
|
|
119
|
+
### Task → Capture → Retro
|
|
120
|
+
|
|
121
|
+
1. Complete a meaningful task
|
|
122
|
+
2. Call `wiki_retro` to save key insights
|
|
123
|
+
3. The insight is captured as a source packet
|
|
124
|
+
4. Extension auto-updates metadata
|
|
125
|
+
5. Next time, auto-recall surfaces your saved insight
|
|
126
|
+
|
|
92
127
|
## Page Conventions
|
|
93
128
|
|
|
94
129
|
### Naming
|
package/.coderabbit.yaml
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# CodeRabbit AI Code Review Configuration
|
|
2
|
-
# Docs: https://docs.coderabbit.ai/guides/configure-coderabbit
|
|
3
|
-
|
|
4
|
-
language: en-US
|
|
5
|
-
early_access: false
|
|
6
|
-
reviews:
|
|
7
|
-
profile: assertive
|
|
8
|
-
request_changes_workflow: true
|
|
9
|
-
high_level_summary: true
|
|
10
|
-
poem: false
|
|
11
|
-
review_status: true
|
|
12
|
-
collapse_walkthrough: false
|
|
13
|
-
auto_review:
|
|
14
|
-
enabled: true
|
|
15
|
-
ignore_title_keywords:
|
|
16
|
-
- "chore"
|
|
17
|
-
- "WIP"
|
|
18
|
-
- "wip"
|
|
19
|
-
drafts: false
|
|
20
|
-
base_branches:
|
|
21
|
-
- main
|
|
22
|
-
path_instructions:
|
|
23
|
-
- path: "extensions/**/*.ts"
|
|
24
|
-
instructions: |
|
|
25
|
-
Review TypeScript extension files for pi coding agent. Check that:
|
|
26
|
-
1. Tools use pi.registerTool() with TypeBox schemas
|
|
27
|
-
2. Error handling uses try/catch with proper messages
|
|
28
|
-
3. Unused parameters use underscore prefix or are removed
|
|
29
|
-
4. File exports a default function receiving ExtensionAPI
|
|
30
|
-
- path: "skills/**/SKILL.md"
|
|
31
|
-
instructions: |
|
|
32
|
-
Review SKILL.md for pi. Verify:
|
|
33
|
-
1. Frontmatter follows Agent Skills spec (name, description)
|
|
34
|
-
2. Workflows are clearly documented with steps
|
|
35
|
-
3. Golden rules and conventions are explicit
|
|
36
|
-
- path: "prompts/**/*.md"
|
|
37
|
-
instructions: |
|
|
38
|
-
Review prompt templates. Verify:
|
|
39
|
-
1. Frontmatter has description, args, section, topLevelCli
|
|
40
|
-
2. Instructions are actionable and clear
|
|
41
|
-
|
|
42
|
-
chat:
|
|
43
|
-
auto_reply: true
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
name: "CodeQL Config"
|
|
2
|
-
|
|
3
|
-
queries:
|
|
4
|
-
- uses: security-and-quality
|
|
5
|
-
|
|
6
|
-
# Suppress false positives for temporary file creation.
|
|
7
|
-
# This is a single-user CLI tool — TOCTOU race conditions on temp directories
|
|
8
|
-
# are not a valid threat model. The alerts only fire because tests pass
|
|
9
|
-
# os.tmpdir() paths into production capture functions.
|
|
10
|
-
query-filters:
|
|
11
|
-
- exclude:
|
|
12
|
-
id: js/insecure-temporary-file
|
package/.github/workflows/ci.yml
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
name: CI
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [main]
|
|
8
|
-
|
|
9
|
-
concurrency:
|
|
10
|
-
group: ${{ github.workflow }}-${{ github.ref }}
|
|
11
|
-
cancel-in-progress: true
|
|
12
|
-
|
|
13
|
-
jobs:
|
|
14
|
-
quality:
|
|
15
|
-
runs-on: ubuntu-latest
|
|
16
|
-
strategy:
|
|
17
|
-
matrix:
|
|
18
|
-
node-version: [20, 22, 23, 24, 25]
|
|
19
|
-
|
|
20
|
-
steps:
|
|
21
|
-
- uses: actions/checkout@v4
|
|
22
|
-
|
|
23
|
-
- uses: actions/setup-node@v4
|
|
24
|
-
with:
|
|
25
|
-
node-version: ${{ matrix.node-version }}
|
|
26
|
-
cache: npm
|
|
27
|
-
|
|
28
|
-
- run: npm ci
|
|
29
|
-
|
|
30
|
-
- name: Type Check
|
|
31
|
-
run: npm run typecheck
|
|
32
|
-
|
|
33
|
-
- name: Lint
|
|
34
|
-
run: npm run lint
|
|
35
|
-
|
|
36
|
-
- name: Run Tests with Coverage
|
|
37
|
-
run: npm run test:coverage
|
|
38
|
-
|
|
39
|
-
- name: Upload Coverage to Codecov
|
|
40
|
-
if: ${{ matrix.node-version == 22 && github.event_name == 'push' }}
|
|
41
|
-
uses: codecov/codecov-action@v5
|
|
42
|
-
with:
|
|
43
|
-
files: ./coverage/lcov.info
|
|
44
|
-
fail_ci_if_error: false
|
|
45
|
-
verbose: true
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
name: "CodeQL"
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
branches: [main]
|
|
6
|
-
pull_request:
|
|
7
|
-
branches: [main]
|
|
8
|
-
schedule:
|
|
9
|
-
- cron: "0 6 * * 1" # Every Monday at 6 AM
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
analyze:
|
|
13
|
-
name: Analyze (${{ matrix.language }})
|
|
14
|
-
runs-on: ubuntu-latest
|
|
15
|
-
permissions:
|
|
16
|
-
security-events: write
|
|
17
|
-
packages: read
|
|
18
|
-
actions: read
|
|
19
|
-
contents: read
|
|
20
|
-
|
|
21
|
-
strategy:
|
|
22
|
-
fail-fast: false
|
|
23
|
-
matrix:
|
|
24
|
-
include:
|
|
25
|
-
- language: javascript-typescript
|
|
26
|
-
build-mode: none
|
|
27
|
-
|
|
28
|
-
steps:
|
|
29
|
-
- uses: actions/checkout@v4
|
|
30
|
-
|
|
31
|
-
- uses: github/codeql-action/init@v3
|
|
32
|
-
with:
|
|
33
|
-
languages: ${{ matrix.language }}
|
|
34
|
-
build-mode: ${{ matrix.build-mode }}
|
|
35
|
-
config-file: ./.github/codeql/codeql-config.yml
|
|
36
|
-
|
|
37
|
-
- uses: github/codeql-action/analyze@v3
|
|
38
|
-
with:
|
|
39
|
-
category: "/language:${{ matrix.language }}"
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
name: Release
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
push:
|
|
5
|
-
tags:
|
|
6
|
-
- "v*"
|
|
7
|
-
|
|
8
|
-
jobs:
|
|
9
|
-
release:
|
|
10
|
-
runs-on: ubuntu-latest
|
|
11
|
-
permissions:
|
|
12
|
-
contents: write
|
|
13
|
-
id-token: write
|
|
14
|
-
|
|
15
|
-
steps:
|
|
16
|
-
- uses: actions/checkout@v4
|
|
17
|
-
with:
|
|
18
|
-
fetch-depth: 0
|
|
19
|
-
|
|
20
|
-
- uses: actions/setup-node@v4
|
|
21
|
-
with:
|
|
22
|
-
node-version: 22
|
|
23
|
-
registry-url: https://registry.npmjs.org
|
|
24
|
-
cache: npm
|
|
25
|
-
|
|
26
|
-
- run: npm ci
|
|
27
|
-
|
|
28
|
-
- name: Type Check
|
|
29
|
-
run: npm run typecheck
|
|
30
|
-
|
|
31
|
-
- name: Lint
|
|
32
|
-
run: npm run lint
|
|
33
|
-
|
|
34
|
-
- name: Run Tests
|
|
35
|
-
run: npm test
|
|
36
|
-
|
|
37
|
-
- name: Extract Version from Tag
|
|
38
|
-
id: version
|
|
39
|
-
run: echo "VERSION=${GITHUB_REF_NAME#v}" >> $GITHUB_OUTPUT
|
|
40
|
-
|
|
41
|
-
- name: Update package.json version
|
|
42
|
-
run: |
|
|
43
|
-
node -e "const p=require('./package.json'); p.version='${{ steps.version.outputs.VERSION }}'; require('fs').writeFileSync('./package.json', JSON.stringify(p, null, 2)+'\n')"
|
|
44
|
-
npx biome check --fix package.json 2>&1
|
|
45
|
-
|
|
46
|
-
- name: Commit version bump back to main
|
|
47
|
-
run: |
|
|
48
|
-
git config user.name "github-actions[bot]"
|
|
49
|
-
git config user.email "github-actions[bot]@users.noreply.github.com"
|
|
50
|
-
git add package.json
|
|
51
|
-
git commit -m "chore(release): v${{ steps.version.outputs.VERSION }}"
|
|
52
|
-
git push origin HEAD:main
|
|
53
|
-
|
|
54
|
-
- name: Generate Release Notes
|
|
55
|
-
id: notes
|
|
56
|
-
run: |
|
|
57
|
-
CHANGELOG=$(git log --pretty=format:"- %s (%h)" $(git describe --tags --abbrev=0 HEAD~1 2>/dev/null || git rev-list --max-parents=0 HEAD)..HEAD -- . 2>/dev/null || echo "- Initial release")
|
|
58
|
-
echo "NOTES<<EOF" >> $GITHUB_OUTPUT
|
|
59
|
-
echo "$CHANGELOG" >> $GITHUB_OUTPUT
|
|
60
|
-
echo "EOF" >> $GITHUB_OUTPUT
|
|
61
|
-
|
|
62
|
-
- name: Publish to npm
|
|
63
|
-
run: npm publish --provenance --access public
|
|
64
|
-
env:
|
|
65
|
-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
66
|
-
|
|
67
|
-
- name: Create GitHub Release
|
|
68
|
-
uses: softprops/action-gh-release@v2
|
|
69
|
-
with:
|
|
70
|
-
name: "v${{ steps.version.outputs.VERSION }}"
|
|
71
|
-
body: |
|
|
72
|
-
## 📦 @zosmaai/pi-llm-wiki v${{ steps.version.outputs.VERSION }}
|
|
73
|
-
|
|
74
|
-
${{ steps.notes.outputs.NOTES }}
|
|
75
|
-
|
|
76
|
-
### Install
|
|
77
|
-
\`\`\`bash
|
|
78
|
-
pi install npm:@zosmaai/pi-llm-wiki@${{ steps.version.outputs.VERSION }}
|
|
79
|
-
\`\`\`
|
|
80
|
-
|
|
81
|
-
### What's Included
|
|
82
|
-
- **Skill**: Self-maintaining wiki schema (SKILL.md)
|
|
83
|
-
- **Extension**: 10 TypeScript tools (wiki_bootstrap, wiki_capture_source, wiki_ingest, wiki_ensure_page, wiki_search, wiki_lint, wiki_status, wiki_rebuild_meta, wiki_log_event, wiki_watch)
|
|
84
|
-
- **Prompt Templates**: 8 slash commands (/wiki:init, :ingest, :query, :lint, :discover, :run, :status, :digest)
|
|
85
|
-
- **Templates**: INDEX.md, LOG.md, DASHBOARD.md, config.yaml, 5 page templates
|
|
86
|
-
generate_release_notes: false
|
package/AGENTS.md
DELETED
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
# AGENTS.md
|
|
2
|
-
|
|
3
|
-
Instructions for AI agents working on this codebase.
|
|
4
|
-
|
|
5
|
-
## Project
|
|
6
|
-
|
|
7
|
-
`@zosmaai/pi-llm-wiki` — A pi package that implements Andrej Karpathy's LLM Wiki pattern as a self-maintaining knowledge base.
|
|
8
|
-
|
|
9
|
-
## Tech Stack
|
|
10
|
-
|
|
11
|
-
- TypeScript (ES2022, ESM)
|
|
12
|
-
- Vitest for testing
|
|
13
|
-
- Biome for linting/formatting
|
|
14
|
-
- GitHub Actions for CI
|
|
15
|
-
- npm for publishing
|
|
16
|
-
|
|
17
|
-
## File Layout
|
|
18
|
-
|
|
19
|
-
```
|
|
20
|
-
├── extensions/llm-wiki/ # TypeScript extension (10 tools + guardrails)
|
|
21
|
-
│ ├── index.ts # Entry point
|
|
22
|
-
│ └── lib/ # tools.ts, metadata.ts, guardrails.ts, utils.ts, source-packet.ts
|
|
23
|
-
├── skills/llm-wiki/ # SKILL.md + templates
|
|
24
|
-
├── prompts/ # 8 slash command templates
|
|
25
|
-
├── test/ # Vitest tests
|
|
26
|
-
├── docs/ # Documentation
|
|
27
|
-
└── scripts/ # release.js
|
|
28
|
-
```
|
|
29
|
-
|
|
30
|
-
## Conventions
|
|
31
|
-
|
|
32
|
-
- Use `node:fs/promises` for async file I/O, not sync
|
|
33
|
-
- Prefer small, pure functions in `lib/`
|
|
34
|
-
- Extension tools must have: name, label, description, promptSnippet, promptGuidelines, parameters (TypeBox), execute
|
|
35
|
-
- Guardrails block `raw/**` and `meta/**` edits at the tool_call hook level
|
|
36
|
-
- Metadata auto-rebuilds on `turn_end` after `wiki/**` edits
|
|
37
|
-
- Source IDs: `SRC-YYYY-MM-DD-NNN`
|
|
38
|
-
- Page filenames: `kebab-case.md`
|
|
39
|
-
- Wikilinks: folder-qualified, e.g. `[[concepts/retrieval-augmented-generation]]`
|
|
40
|
-
|
|
41
|
-
## Testing
|
|
42
|
-
|
|
43
|
-
```bash
|
|
44
|
-
npm test # run tests
|
|
45
|
-
npm run test:coverage # run with coverage
|
|
46
|
-
npm run typecheck # TypeScript check
|
|
47
|
-
npm run lint # biome check
|
|
48
|
-
```
|
|
49
|
-
|
|
50
|
-
## Release
|
|
51
|
-
|
|
52
|
-
```bash
|
|
53
|
-
npm run release:patch # or minor/major
|
|
54
|
-
npm run release:push # push tags
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
Never edit `package.json` version manually — use the release script.
|
package/CONTRIBUTING.md
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
# Contributing
|
|
2
|
-
|
|
3
|
-
## Local Setup
|
|
4
|
-
|
|
5
|
-
```bash
|
|
6
|
-
git clone https://github.com/zosmaai/pi-llm-wiki.git
|
|
7
|
-
cd pi-llm-wiki
|
|
8
|
-
npm install
|
|
9
|
-
pi install ./
|
|
10
|
-
```
|
|
11
|
-
|
|
12
|
-
## Development
|
|
13
|
-
|
|
14
|
-
```bash
|
|
15
|
-
npm run test # run tests
|
|
16
|
-
npm run test:coverage # run tests with coverage report
|
|
17
|
-
npm run typecheck # TypeScript type check
|
|
18
|
-
npm run lint # biome lint check
|
|
19
|
-
npm run lint:fix # auto-fix lint issues
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
## Release Process
|
|
23
|
-
|
|
24
|
-
```bash
|
|
25
|
-
npm run release:patch # bump patch version
|
|
26
|
-
npm run release:minor # bump minor version
|
|
27
|
-
npm run release:major # bump major version
|
|
28
|
-
npm run release:push # push to origin with tags
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
The release script:
|
|
32
|
-
|
|
33
|
-
1. Verifies clean git tree and `main` branch
|
|
34
|
-
2. Runs typecheck, lint, and tests
|
|
35
|
-
3. Bumps version in `package.json`
|
|
36
|
-
4. Updates `CHANGELOG.md`
|
|
37
|
-
5. Commits and tags
|
|
38
|
-
|
|
39
|
-
CI handles npm publish on tag push.
|
|
40
|
-
|
|
41
|
-
## License
|
|
42
|
-
|
|
43
|
-
MIT
|
package/biome.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "https://biomejs.dev/schemas/1.9.4/schema.json",
|
|
3
|
-
"files": {
|
|
4
|
-
"ignore": ["coverage", "dist", "node_modules"]
|
|
5
|
-
},
|
|
6
|
-
"organizeImports": {
|
|
7
|
-
"enabled": true
|
|
8
|
-
},
|
|
9
|
-
"linter": {
|
|
10
|
-
"enabled": true,
|
|
11
|
-
"rules": {
|
|
12
|
-
"recommended": true,
|
|
13
|
-
"style": {
|
|
14
|
-
"noNonNullAssertion": "off"
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
},
|
|
18
|
-
"formatter": {
|
|
19
|
-
"enabled": true,
|
|
20
|
-
"indentStyle": "space",
|
|
21
|
-
"indentWidth": 2,
|
|
22
|
-
"lineWidth": 100
|
|
23
|
-
},
|
|
24
|
-
"javascript": {
|
|
25
|
-
"formatter": {
|
|
26
|
-
"quoteStyle": "double",
|
|
27
|
-
"semicolons": "always"
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
package/scripts/release.js
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Semantic version release script.
|
|
4
|
-
* Usage: node scripts/release.js [patch|minor|major]
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
const { execSync } = require("node:child_process");
|
|
8
|
-
const fs = require("node:fs");
|
|
9
|
-
const path = require("node:path");
|
|
10
|
-
|
|
11
|
-
const bump = process.argv[2];
|
|
12
|
-
if (!["patch", "minor", "major"].includes(bump)) {
|
|
13
|
-
console.error("Usage: node scripts/release.js [patch|minor|major]");
|
|
14
|
-
process.exit(1);
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
// Verify clean tree
|
|
18
|
-
const status = execSync("git status --porcelain", { encoding: "utf-8" }).trim();
|
|
19
|
-
if (status) {
|
|
20
|
-
console.error("Error: working tree is not clean");
|
|
21
|
-
process.exit(1);
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// Verify main branch
|
|
25
|
-
const branch = execSync("git branch --show-current", { encoding: "utf-8" }).trim();
|
|
26
|
-
if (branch !== "main") {
|
|
27
|
-
console.error("Error: not on main branch");
|
|
28
|
-
process.exit(1);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// Run checks
|
|
32
|
-
execSync("npm run typecheck", { stdio: "inherit" });
|
|
33
|
-
execSync("npm run lint", { stdio: "inherit" });
|
|
34
|
-
execSync("npm test", { stdio: "inherit" });
|
|
35
|
-
|
|
36
|
-
// Read current version
|
|
37
|
-
const pkgPath = path.join(__dirname, "..", "package.json");
|
|
38
|
-
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf-8"));
|
|
39
|
-
const current = pkg.version;
|
|
40
|
-
const [major, minor, patch] = current.split(".").map(Number);
|
|
41
|
-
|
|
42
|
-
let next;
|
|
43
|
-
if (bump === "major") next = `${major + 1}.0.0`;
|
|
44
|
-
else if (bump === "minor") next = `${major}.${minor + 1}.0`;
|
|
45
|
-
else next = `${major}.${minor}.${patch + 1}`;
|
|
46
|
-
|
|
47
|
-
// Update package.json
|
|
48
|
-
pkg.version = next;
|
|
49
|
-
fs.writeFileSync(pkgPath, `${JSON.stringify(pkg, null, 2)}\n`, "utf-8");
|
|
50
|
-
|
|
51
|
-
// Update CHANGELOG
|
|
52
|
-
const changelogPath = path.join(__dirname, "..", "CHANGELOG.md");
|
|
53
|
-
let changelog = "";
|
|
54
|
-
if (fs.existsSync(changelogPath)) {
|
|
55
|
-
changelog = fs.readFileSync(changelogPath, "utf-8");
|
|
56
|
-
}
|
|
57
|
-
const today = new Date().toISOString().split("T")[0];
|
|
58
|
-
const newSection = `## [${next}] - ${today}\n\n### Added\n- Release ${next}\n`;
|
|
59
|
-
if (changelog.includes("## [Unreleased]")) {
|
|
60
|
-
changelog = changelog.replace("## [Unreleased]", `## [Unreleased]\n\n${newSection}`);
|
|
61
|
-
} else {
|
|
62
|
-
changelog = `# Changelog\n\n## [Unreleased]\n\n${newSection}\n${changelog.replace("# Changelog\n\n", "")}`;
|
|
63
|
-
}
|
|
64
|
-
fs.writeFileSync(changelogPath, changelog, "utf-8");
|
|
65
|
-
|
|
66
|
-
// Commit and tag
|
|
67
|
-
execSync("git add package.json CHANGELOG.md", { stdio: "inherit" });
|
|
68
|
-
execSync(`git commit -m "chore(release): v${next}"`, { stdio: "inherit" });
|
|
69
|
-
execSync(`git tag v${next}`, { stdio: "inherit" });
|
|
70
|
-
|
|
71
|
-
console.log(`\n✅ Released v${next}`);
|
|
72
|
-
console.log(`Run "npm run release:push" to publish.`);
|