claude-wiki 0.1.0__tar.gz
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.
- claude_wiki-0.1.0/.claude/skills/claude-wiki/SKILL.md +75 -0
- claude_wiki-0.1.0/.claude/skills/claude-wiki-compile/SKILL.md +44 -0
- claude_wiki-0.1.0/.claude/skills/claude-wiki-dev/SKILL.md +103 -0
- claude_wiki-0.1.0/.claude/skills/claude-wiki-lint/SKILL.md +50 -0
- claude_wiki-0.1.0/.claude/skills/claude-wiki-migrate/SKILL.md +46 -0
- claude_wiki-0.1.0/.claude/skills/claude-wiki-query/SKILL.md +40 -0
- claude_wiki-0.1.0/.github/dependabot.yml +10 -0
- claude_wiki-0.1.0/.github/workflows/ci.yml +72 -0
- claude_wiki-0.1.0/.github/workflows/release.yml +67 -0
- claude_wiki-0.1.0/.gitignore +20 -0
- claude_wiki-0.1.0/.gitleaks.toml +10 -0
- claude_wiki-0.1.0/.pre-commit-config.yaml +55 -0
- claude_wiki-0.1.0/CHANGELOG.md +43 -0
- claude_wiki-0.1.0/LICENSE +21 -0
- claude_wiki-0.1.0/Makefile +76 -0
- claude_wiki-0.1.0/PKG-INFO +115 -0
- claude_wiki-0.1.0/README.md +83 -0
- claude_wiki-0.1.0/cliff.toml +73 -0
- claude_wiki-0.1.0/docs/explanation/architecture.md +57 -0
- claude_wiki-0.1.0/docs/explanation/design-principles.md +34 -0
- claude_wiki-0.1.0/docs/how-to/configure-repo.md +69 -0
- claude_wiki-0.1.0/docs/how-to/customize-hooks.md +47 -0
- claude_wiki-0.1.0/docs/how-to/install.md +38 -0
- claude_wiki-0.1.0/docs/index.md +29 -0
- claude_wiki-0.1.0/docs/reference/ci-cd.md +80 -0
- claude_wiki-0.1.0/docs/reference/cli.md +92 -0
- claude_wiki-0.1.0/docs/reference/config-file.md +68 -0
- claude_wiki-0.1.0/docs/reference/contributors.md +95 -0
- claude_wiki-0.1.0/docs/reference/data-models.md +81 -0
- claude_wiki-0.1.0/docs/reference/protocols.md +66 -0
- claude_wiki-0.1.0/docs/tutorials/quickstart.md +69 -0
- claude_wiki-0.1.0/pyproject.toml +64 -0
- claude_wiki-0.1.0/src/claude_wiki/AGENTS.md +56 -0
- claude_wiki-0.1.0/src/claude_wiki/__init__.py +6 -0
- claude_wiki-0.1.0/src/claude_wiki/cli.py +245 -0
- claude_wiki-0.1.0/src/claude_wiki/commands/__init__.py +1 -0
- claude_wiki-0.1.0/src/claude_wiki/commands/compile.py +389 -0
- claude_wiki-0.1.0/src/claude_wiki/commands/lint.py +427 -0
- claude_wiki-0.1.0/src/claude_wiki/commands/query.py +268 -0
- claude_wiki-0.1.0/src/claude_wiki/config.py +76 -0
- claude_wiki-0.1.0/src/claude_wiki/errors.py +17 -0
- claude_wiki-0.1.0/src/claude_wiki/factories.py +92 -0
- claude_wiki-0.1.0/src/claude_wiki/flush.py +371 -0
- claude_wiki-0.1.0/src/claude_wiki/global_index.py +197 -0
- claude_wiki-0.1.0/src/claude_wiki/hook_handlers/__init__.py +1 -0
- claude_wiki-0.1.0/src/claude_wiki/hook_handlers/pre_compact.py +189 -0
- claude_wiki-0.1.0/src/claude_wiki/hook_handlers/session_end.py +128 -0
- claude_wiki-0.1.0/src/claude_wiki/hook_handlers/session_start.py +124 -0
- claude_wiki-0.1.0/src/claude_wiki/hooks.py +53 -0
- claude_wiki-0.1.0/src/claude_wiki/interfaces.py +47 -0
- claude_wiki-0.1.0/src/claude_wiki/migration.py +132 -0
- claude_wiki-0.1.0/src/claude_wiki/models.py +88 -0
- claude_wiki-0.1.0/tests/test_cli.py +151 -0
- claude_wiki-0.1.0/tests/test_compile.py +232 -0
- claude_wiki-0.1.0/tests/test_config.py +177 -0
- claude_wiki-0.1.0/tests/test_global_index.py +266 -0
- claude_wiki-0.1.0/tests/test_hook_registrar.py +92 -0
- claude_wiki-0.1.0/tests/test_integration.py +163 -0
- claude_wiki-0.1.0/tests/test_lint.py +257 -0
- claude_wiki-0.1.0/tests/test_migration.py +273 -0
- claude_wiki-0.1.0/tests/test_pre_compact.py +239 -0
- claude_wiki-0.1.0/tests/test_query.py +336 -0
- claude_wiki-0.1.0/tests/test_session_end.py +332 -0
- claude_wiki-0.1.0/tests/test_session_start.py +172 -0
- claude_wiki-0.1.0/uv.lock +1231 -0
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claude-wiki
|
|
3
|
+
description: |-
|
|
4
|
+
Bootstrap and manage the claude-wiki knowledge base for this repo.
|
|
5
|
+
Covers init, shared rules, safety, and Makefile targets.
|
|
6
|
+
For specific commands, invoke the dedicated /claude-wiki-<command> skills.
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# claude-wiki
|
|
10
|
+
|
|
11
|
+
Knowledge base bootstrap and shared reference.
|
|
12
|
+
|
|
13
|
+
## Init
|
|
14
|
+
|
|
15
|
+
**Trigger**: "set up knowledge base", "init claude-wiki", "configure KB for this repo"
|
|
16
|
+
|
|
17
|
+
Run from the repo root after confirming it is a git repo.
|
|
18
|
+
|
|
19
|
+
1. Run `claude-wiki init`
|
|
20
|
+
1. By default hooks go into repo-local `.claude/settings.local.json`
|
|
21
|
+
1. If user wants user-wide hooks, add `--global` (writes to `~/.claude/settings.json`)
|
|
22
|
+
1. Completion: `.claude-wiki.lock` exists in repo root, repo appears in `~/.local/share/claude-wiki/core.md`
|
|
23
|
+
|
|
24
|
+
## Other Commands
|
|
25
|
+
|
|
26
|
+
Invoke the dedicated skill when needed:
|
|
27
|
+
|
|
28
|
+
- `/claude-wiki-compile` — compile daily logs into knowledge
|
|
29
|
+
- `/claude-wiki-query` — search and ask the knowledge base
|
|
30
|
+
- `/claude-wiki-lint` — run health checks on the KB
|
|
31
|
+
- `/claude-wiki-migrate` — move data when config paths change
|
|
32
|
+
|
|
33
|
+
## Rules
|
|
34
|
+
|
|
35
|
+
- Run from within the target repo root; `init`, `migrate`, and `compile` accept `--path <repo-root>`
|
|
36
|
+
- After any config edit to `kb_dir` or `daily_dir`, run `migrate --dry-run` before `migrate`
|
|
37
|
+
- Do not hand-edit `daily/` files — they are append-only
|
|
38
|
+
- Do not hand-edit `~/.local/share/claude-wiki/.registry.json` or `~/.local/share/claude-wiki/core.md` — they are machine-managed
|
|
39
|
+
|
|
40
|
+
## Safety
|
|
41
|
+
|
|
42
|
+
| Command | Destructive? | Mitigation |
|
|
43
|
+
| --------------- | ------------------------------ | ----------------------------------------------------------------- |
|
|
44
|
+
| `init --force` | Overwrites `.claude-wiki.lock` | Paths compared from the lock file itself; no secondary state file |
|
|
45
|
+
| `migrate` | Moves directories | `--dry-run` preview; warns and skips non-empty dest |
|
|
46
|
+
| `compile --all` | Rebuilds entire KB | Idempotent — recompiles from immutable daily |
|
|
47
|
+
| `lint` | Read-only | None needed |
|
|
48
|
+
|
|
49
|
+
## Global Registry
|
|
50
|
+
|
|
51
|
+
Every `init`, `compile`, and `migrate` registers the repo in `~/.local/share/claude-wiki/core.md` and auto-evicts stale entries (repos whose `.claude-wiki.lock` has disappeared).
|
|
52
|
+
|
|
53
|
+
## Makefile Targets
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
make dev # install with dev dependencies
|
|
57
|
+
make test # run pytest
|
|
58
|
+
make lint # ruff check
|
|
59
|
+
make format # ruff format + mdformat
|
|
60
|
+
make typecheck # mypy
|
|
61
|
+
make precommit # all pre-commit hooks
|
|
62
|
+
make all # full CI gate
|
|
63
|
+
make build # build wheel
|
|
64
|
+
make clean # remove artifacts
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
## Cost Reference
|
|
68
|
+
|
|
69
|
+
| Operation | Approximate |
|
|
70
|
+
| ---------------------- | ----------- |
|
|
71
|
+
| compile one log | $0.45–0.65 |
|
|
72
|
+
| query (no file-back) | $0.15–0.25 |
|
|
73
|
+
| query (with file-back) | $0.25–0.40 |
|
|
74
|
+
| full lint (with LLM) | $0.15–0.25 |
|
|
75
|
+
| structural lint only | $0.00 |
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claude-wiki-compile
|
|
3
|
+
description: Compile daily conversation logs into structured knowledge base articles. Invoke with /claude-wiki-compile.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# claude-wiki compile
|
|
8
|
+
|
|
9
|
+
Turn immutable `daily/` logs into structured KB articles.
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
|
|
13
|
+
- "compile today's logs"
|
|
14
|
+
- "build the KB"
|
|
15
|
+
- "sync knowledge"
|
|
16
|
+
- "run compile"
|
|
17
|
+
|
|
18
|
+
## Process
|
|
19
|
+
|
|
20
|
+
1. Run `claude-wiki compile`
|
|
21
|
+
1. If user asks for full rebuild, add `--all`
|
|
22
|
+
1. If user wants one specific log, add `--file daily/YYYY-MM-DD.md`
|
|
23
|
+
1. If user wants a preview, add `--dry-run`
|
|
24
|
+
1. Completion: `knowledge/index.md` reflects latest daily log, global registry updated.
|
|
25
|
+
|
|
26
|
+
## Flags
|
|
27
|
+
|
|
28
|
+
| Flag | Purpose |
|
|
29
|
+
| --------------- | --------------------------------------------- |
|
|
30
|
+
| `--all` | Force recompile entire KB from all daily logs |
|
|
31
|
+
| `--file <path>` | Compile a single daily log |
|
|
32
|
+
| `--dry-run` | Preview what would compile without writing |
|
|
33
|
+
|
|
34
|
+
## Rules
|
|
35
|
+
|
|
36
|
+
- Compilation is idempotent — re-running on the same log produces the same articles (deduplicated by hash)
|
|
37
|
+
- Do not hand-edit `daily/` files — they are append-only and the source of truth
|
|
38
|
+
- The KB lives under the XDG data dir by default (`~/.local/share/claude-wiki/<owner>/<repo>/`)
|
|
39
|
+
|
|
40
|
+
## Completion
|
|
41
|
+
|
|
42
|
+
- `knowledge/index.md` updated with new article links
|
|
43
|
+
- `knowledge/concepts/`, `connections/`, `qa/` populated or updated
|
|
44
|
+
- Global registry entry refreshed
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claude-wiki-dev
|
|
3
|
+
description: |
|
|
4
|
+
Develop and maintain the claude-wiki package itself.
|
|
5
|
+
Use when modifying CLI commands, hook handlers, migration logic, or adding new features.
|
|
6
|
+
Covers project structure, testing patterns, and release workflow.
|
|
7
|
+
disable-model-invocation: true
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# claude-wiki dev
|
|
11
|
+
|
|
12
|
+
Development reference for the claude-wiki package.
|
|
13
|
+
|
|
14
|
+
## Project Structure
|
|
15
|
+
|
|
16
|
+
```
|
|
17
|
+
src/claude_wiki/
|
|
18
|
+
cli.py # argparse main + subcommand dispatch
|
|
19
|
+
config.py # ConfigManager (repo detection, lock I/O, XDG resolution)
|
|
20
|
+
factories.py # DefaultConfigResolver wiring
|
|
21
|
+
flush.py # Shared context extraction + background flush logic
|
|
22
|
+
global_index.py # ~/.local/share/claude-wiki registry
|
|
23
|
+
hooks.py # Hook dispatcher (SessionStart, SessionEnd, PreCompact)
|
|
24
|
+
interfaces.py # Protocol definitions (RepoDetector, ConfigLoader, etc.)
|
|
25
|
+
migration.py # MigrationManager (path change detection + data move)
|
|
26
|
+
models.py # Immutable dataclasses (ProjectConfig, MigrationResult, etc.)
|
|
27
|
+
commands/ # Dynamically loaded subcommands
|
|
28
|
+
compile.py
|
|
29
|
+
lint.py
|
|
30
|
+
query.py
|
|
31
|
+
hook_handlers/ # Per-event handler modules
|
|
32
|
+
session_start.py
|
|
33
|
+
session_end.py
|
|
34
|
+
pre_compact.py
|
|
35
|
+
tests/ # pytest suite
|
|
36
|
+
docs/ # Documentation
|
|
37
|
+
.claude/skills/ # Claude Code skills for this repo
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Setup
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
make dev # install package with dev deps (uv pip install -e ".[dev]")
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Requires Python >=3.12.
|
|
47
|
+
|
|
48
|
+
## Development Cycle
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
make format # ruff format + mdformat skills/docs
|
|
52
|
+
make lint # ruff check
|
|
53
|
+
make typecheck # mypy --strict src/
|
|
54
|
+
make test # pytest
|
|
55
|
+
make test-cov # pytest with coverage
|
|
56
|
+
make all # format + lint + typecheck + test + precommit (full CI gate)
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Adding a New CLI Command
|
|
60
|
+
|
|
61
|
+
1. Create `src/claude_wiki/commands/<command>.py`
|
|
62
|
+
1. Implement `register(subparsers, handlers)` function
|
|
63
|
+
1. Optionally create `tests/test_<command>.py`
|
|
64
|
+
1. Optionally create `.claude/skills/claude-wiki-<command>/SKILL.md`
|
|
65
|
+
1. Register is auto-discovered by `cli._register_commands()` via `pkgutil`
|
|
66
|
+
|
|
67
|
+
## Hook Architecture
|
|
68
|
+
|
|
69
|
+
- `hooks.py` dispatches to handler modules by event name
|
|
70
|
+
- Each handler in `hook_handlers/` exports `handler(args) -> int` and `register(handlers: dict)`
|
|
71
|
+
- Handlers do fast local I/O only; heavy work is spawned to `flush.py` background process
|
|
72
|
+
- Recursion guard: `CLAUDE_INVOKED_BY` env var prevents nested hook triggers
|
|
73
|
+
|
|
74
|
+
## Testing Patterns
|
|
75
|
+
|
|
76
|
+
- Use `tempfile.TemporaryDirectory()` for CLI integration tests
|
|
77
|
+
- Use `tmp_path` pytest fixture for unit tests
|
|
78
|
+
- Patch `os.environ` for HOME/XDG overrides
|
|
79
|
+
- Mock `claude_wiki.cli.GlobalIndexManager` to avoid filesystem side effects
|
|
80
|
+
- Tests must be deterministic — no external network calls in tests
|
|
81
|
+
|
|
82
|
+
## Config & State
|
|
83
|
+
|
|
84
|
+
- `.claude-wiki.lock` is the single source of truth for repo config
|
|
85
|
+
- No secondary state file (`.claude-wiki.state.json` was removed)
|
|
86
|
+
- Migration compares current lock against previous by loading it as `previous`
|
|
87
|
+
- XDG data dir: `~/.local/share/claude-wiki/<owner>/<repo>/`
|
|
88
|
+
|
|
89
|
+
## Release
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
make build # uv build (wheel in dist/)
|
|
93
|
+
make pypi-start # local PyPI registry on :8080 for smoke testing
|
|
94
|
+
make pypi-stop # tear down local registry
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Conventions
|
|
98
|
+
|
|
99
|
+
- **Commits**: conventional commits (`feat:`, `fix:`, `refactor:`, `test:`, `docs:`, `chore:`)
|
|
100
|
+
- **Branches**: `feat/`, `fix/`, `chore/`, `docs/`, `refactor/`, `test/`, `ci/` prefix
|
|
101
|
+
- **Imports**: `from __future__ import annotations` at top; absolute imports preferred
|
|
102
|
+
- **Types**: `mypy --strict` required; annotate all public APIs
|
|
103
|
+
- **Formatting**: ruff format + mdformat with `mdformat-frontmatter` and `mdformat-gfm`
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claude-wiki-lint
|
|
3
|
+
description: Run health checks on the knowledge base. Invoke with /claude-wiki-lint.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# claude-wiki lint
|
|
8
|
+
|
|
9
|
+
Structural and LLM-based health checks for the KB.
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
|
|
13
|
+
- "lint the knowledge base"
|
|
14
|
+
- "check KB health"
|
|
15
|
+
- "find broken links"
|
|
16
|
+
- "run wiki lint"
|
|
17
|
+
|
|
18
|
+
## Process
|
|
19
|
+
|
|
20
|
+
1. Run `claude-wiki lint`
|
|
21
|
+
1. For structural-only (no LLM cost), add `--structural-only`
|
|
22
|
+
1. Completion: report printed or report file path shown.
|
|
23
|
+
|
|
24
|
+
## Checks
|
|
25
|
+
|
|
26
|
+
| Check | Severity | What it finds |
|
|
27
|
+
| --------------- | ---------- | -------------------------------------------- |
|
|
28
|
+
| Broken links | Error | `[[wikilinks]]` pointing to missing articles |
|
|
29
|
+
| Orphan pages | Warning | Articles with zero inbound links |
|
|
30
|
+
| Orphan sources | Warning | Daily logs not yet compiled |
|
|
31
|
+
| Stale articles | Warning | Daily logs changed since last compile |
|
|
32
|
+
| Sparse articles | Suggestion | Articles below 200 words |
|
|
33
|
+
| Contradictions | Warning | Cross-article conflicts (LLM-only) |
|
|
34
|
+
|
|
35
|
+
## Flags
|
|
36
|
+
|
|
37
|
+
| Flag | Purpose |
|
|
38
|
+
| ------------------- | -------------------------------------------- |
|
|
39
|
+
| `--structural-only` | Skip LLM contradiction checks (free, faster) |
|
|
40
|
+
|
|
41
|
+
## Rules
|
|
42
|
+
|
|
43
|
+
- Reports are saved to `knowledge/reports/` (or the configured `reports_dir`) as `lint-YYYY-MM-DD.md`
|
|
44
|
+
- Structural checks are deterministic and free; contradiction checks cost ~$0.15–0.25
|
|
45
|
+
- Warnings do not fail the lint exit code; errors do
|
|
46
|
+
|
|
47
|
+
## Completion
|
|
48
|
+
|
|
49
|
+
- Terminal shows error/warning/suggestion counts
|
|
50
|
+
- Report path printed (e.g., `knowledge/reports/lint-2026-06-19.md`)
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claude-wiki-migrate
|
|
3
|
+
description: Migrate knowledge base data when config paths change. Invoke with /claude-wiki-migrate.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# claude-wiki migrate
|
|
8
|
+
|
|
9
|
+
Move data when kb_dir, daily_dir, or reports_dir change.
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
|
|
13
|
+
- "moved KB directory"
|
|
14
|
+
- "changed daily_dir"
|
|
15
|
+
- "migrate wiki data"
|
|
16
|
+
- "change knowledge path"
|
|
17
|
+
|
|
18
|
+
## Process
|
|
19
|
+
|
|
20
|
+
1. Run claude-wiki migrate --dry-run first
|
|
21
|
+
1. Review output — confirm paths and absence of errors
|
|
22
|
+
1. Run claude-wiki migrate to execute
|
|
23
|
+
1. Completion: --dry-run showed expected moves; actual run reports "State updated." when paths changed, or "No migration needed — paths are unchanged."
|
|
24
|
+
|
|
25
|
+
## Flags
|
|
26
|
+
|
|
27
|
+
| Flag | Purpose |
|
|
28
|
+
| ---------------------- | --------------------------------------------- |
|
|
29
|
+
| `--dry-run` | Preview what would move without touching disk |
|
|
30
|
+
| `--kb-dir <path>` | Override knowledge base directory |
|
|
31
|
+
| `--daily-dir <path>` | Override daily log directory |
|
|
32
|
+
| `--reports-dir <path>` | Override lint reports directory |
|
|
33
|
+
|
|
34
|
+
## Rules
|
|
35
|
+
|
|
36
|
+
- --dry-run is mandatory before a real migration; review warnings carefully
|
|
37
|
+
- Migration refuses to proceed if new kb_dir and daily_dir would overlap
|
|
38
|
+
- If destination already exists and is not empty, the move is skipped with a warning
|
|
39
|
+
- After migration, .claude-wiki.lock is rewritten with the new paths
|
|
40
|
+
- The lock file itself serves as the previous-state reference; no secondary state file is maintained
|
|
41
|
+
|
|
42
|
+
## Completion
|
|
43
|
+
|
|
44
|
+
- Data moved from old paths to new paths (or skipped if destination occupied)
|
|
45
|
+
- .claude-wiki.lock updated with new directory paths
|
|
46
|
+
- Global registry updated if kb_dir changed
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: claude-wiki-query
|
|
3
|
+
description: Search and query the accumulated knowledge base. Invoke with /claude-wiki-query.
|
|
4
|
+
disable-model-invocation: true
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# claude-wiki query
|
|
8
|
+
|
|
9
|
+
Ask the knowledge base natural-language questions.
|
|
10
|
+
|
|
11
|
+
## Trigger
|
|
12
|
+
|
|
13
|
+
- "search my KB"
|
|
14
|
+
- "what do I know about..."
|
|
15
|
+
- "ask the knowledge base"
|
|
16
|
+
- "query wiki"
|
|
17
|
+
|
|
18
|
+
## Process
|
|
19
|
+
|
|
20
|
+
1. Formulate the query as a single quoted string
|
|
21
|
+
1. Run `claude-wiki query "<question>"`
|
|
22
|
+
1. If user wants the answer saved back to KB, add `--file-back`
|
|
23
|
+
1. Completion: answer printed, and `--file-back` creates `qa/` article and updates `index.md`.
|
|
24
|
+
|
|
25
|
+
## Flags
|
|
26
|
+
|
|
27
|
+
| Flag | Purpose |
|
|
28
|
+
| ------------- | ------------------------------------------------------------ |
|
|
29
|
+
| `--file-back` | Save the answer as a new `qa/` article and update `index.md` |
|
|
30
|
+
|
|
31
|
+
## Rules
|
|
32
|
+
|
|
33
|
+
- Queries are index-guided — the LLM reads `knowledge/index.md` first, then drills into relevant articles
|
|
34
|
+
- No RAG or vector search is used; retrieval relies on the human-maintained index and cross-links
|
|
35
|
+
- `--file-back` compounds knowledge: each saved answer becomes available to future queries
|
|
36
|
+
|
|
37
|
+
## Completion
|
|
38
|
+
|
|
39
|
+
- Answer printed to stdout with inline citations
|
|
40
|
+
- With `--file-back`: new article in `knowledge/qa/` and updated `index.md`
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
name: CI
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
pull_request:
|
|
6
|
+
|
|
7
|
+
permissions:
|
|
8
|
+
contents: read
|
|
9
|
+
|
|
10
|
+
concurrency:
|
|
11
|
+
group: ${{ github.workflow }}-${{ github.ref }}
|
|
12
|
+
cancel-in-progress: true
|
|
13
|
+
|
|
14
|
+
jobs:
|
|
15
|
+
test:
|
|
16
|
+
runs-on: ubuntu-latest
|
|
17
|
+
strategy:
|
|
18
|
+
matrix:
|
|
19
|
+
python-version: ["3.12", "3.13", "3.14"]
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
25
|
+
with:
|
|
26
|
+
version: "latest"
|
|
27
|
+
|
|
28
|
+
- name: Set up Python
|
|
29
|
+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
30
|
+
with:
|
|
31
|
+
python-version: ${{ matrix.python-version }}
|
|
32
|
+
|
|
33
|
+
- name: Sync dependencies
|
|
34
|
+
run: uv sync --extra dev --frozen
|
|
35
|
+
|
|
36
|
+
- name: Run tests
|
|
37
|
+
run: uv run pytest tests/ -v
|
|
38
|
+
|
|
39
|
+
- name: Run ruff check
|
|
40
|
+
run: uvx ruff check .
|
|
41
|
+
|
|
42
|
+
- name: Run ruff format check
|
|
43
|
+
run: uvx ruff format --check .
|
|
44
|
+
|
|
45
|
+
- name: Run mypy
|
|
46
|
+
run: uv run mypy src/
|
|
47
|
+
|
|
48
|
+
- name: Check markdown formatting
|
|
49
|
+
run: |
|
|
50
|
+
uvx --with mdformat-frontmatter --with mdformat-gfm mdformat --check \
|
|
51
|
+
docs/ README.md src/claude_wiki/AGENTS.md .claude/skills/claude-wiki/SKILL.md
|
|
52
|
+
|
|
53
|
+
precommit:
|
|
54
|
+
runs-on: ubuntu-latest
|
|
55
|
+
steps:
|
|
56
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
57
|
+
|
|
58
|
+
- name: Install uv
|
|
59
|
+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
60
|
+
with:
|
|
61
|
+
version: "latest"
|
|
62
|
+
|
|
63
|
+
- name: Set up Python
|
|
64
|
+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
65
|
+
with:
|
|
66
|
+
python-version: "3.12"
|
|
67
|
+
|
|
68
|
+
- name: Sync dependencies
|
|
69
|
+
run: uv sync --extra dev --frozen
|
|
70
|
+
|
|
71
|
+
- name: Run pre-commit
|
|
72
|
+
run: uv run pre-commit run --all-files
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
name: Release
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- "v*"
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
inputs:
|
|
9
|
+
publish:
|
|
10
|
+
description: "Publish to PyPI (requires trusted publisher setup)"
|
|
11
|
+
type: boolean
|
|
12
|
+
default: false
|
|
13
|
+
|
|
14
|
+
permissions:
|
|
15
|
+
contents: read
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
22
|
+
|
|
23
|
+
- name: Install uv
|
|
24
|
+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
25
|
+
with:
|
|
26
|
+
version: "latest"
|
|
27
|
+
|
|
28
|
+
- name: Set up Python
|
|
29
|
+
uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6.2.0
|
|
30
|
+
with:
|
|
31
|
+
python-version: "3.12"
|
|
32
|
+
|
|
33
|
+
- name: Build package
|
|
34
|
+
run: uv build
|
|
35
|
+
|
|
36
|
+
- name: Upload artifacts
|
|
37
|
+
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
38
|
+
with:
|
|
39
|
+
name: dist
|
|
40
|
+
path: dist/
|
|
41
|
+
|
|
42
|
+
publish:
|
|
43
|
+
needs: build
|
|
44
|
+
runs-on: ubuntu-latest
|
|
45
|
+
if: github.event_name == 'workflow_dispatch' && inputs.publish == true
|
|
46
|
+
environment:
|
|
47
|
+
name: pypi
|
|
48
|
+
url: https://pypi.org/project/claude-wiki/${{ github.ref_name }}
|
|
49
|
+
permissions:
|
|
50
|
+
contents: read
|
|
51
|
+
id-token: write
|
|
52
|
+
steps:
|
|
53
|
+
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
|
|
54
|
+
|
|
55
|
+
- name: Download artifacts
|
|
56
|
+
uses: actions/download-artifact@b14cf4c92620c250e1c074ab0a5800e37df86765 # v4.2.0
|
|
57
|
+
with:
|
|
58
|
+
name: dist
|
|
59
|
+
path: dist/
|
|
60
|
+
|
|
61
|
+
- name: Install uv
|
|
62
|
+
uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0
|
|
63
|
+
with:
|
|
64
|
+
version: "latest"
|
|
65
|
+
|
|
66
|
+
- name: Publish to PyPI
|
|
67
|
+
run: uv publish dist/*
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
*$py.class
|
|
4
|
+
*.egg-info/
|
|
5
|
+
.venv/
|
|
6
|
+
.env
|
|
7
|
+
.mypy_cache/
|
|
8
|
+
.pytest_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
dist/
|
|
11
|
+
build/
|
|
12
|
+
*.egg
|
|
13
|
+
*.whl
|
|
14
|
+
.DS_Store
|
|
15
|
+
*.log
|
|
16
|
+
.claude/worktrees/
|
|
17
|
+
.claude/settings.local.json
|
|
18
|
+
reports/lint-*.md
|
|
19
|
+
bin/
|
|
20
|
+
*.code-workspace
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
repos:
|
|
2
|
+
- repo: https://github.com/gitleaks/gitleaks
|
|
3
|
+
rev: v8.30.1
|
|
4
|
+
hooks:
|
|
5
|
+
- id: gitleaks
|
|
6
|
+
name: Scan for secrets
|
|
7
|
+
stages: [pre-commit]
|
|
8
|
+
|
|
9
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
10
|
+
rev: v0.15.18
|
|
11
|
+
hooks:
|
|
12
|
+
- id: ruff
|
|
13
|
+
name: Lint with ruff
|
|
14
|
+
args: [--fix, --exit-non-zero-on-fix]
|
|
15
|
+
- id: ruff-format
|
|
16
|
+
name: Check formatting with ruff
|
|
17
|
+
|
|
18
|
+
- repo: https://github.com/executablebooks/mdformat
|
|
19
|
+
rev: 1.0.0
|
|
20
|
+
hooks:
|
|
21
|
+
- id: mdformat
|
|
22
|
+
name: Check markdown formatting
|
|
23
|
+
additional_dependencies:
|
|
24
|
+
- mdformat-frontmatter
|
|
25
|
+
- mdformat-gfm
|
|
26
|
+
args: [--check]
|
|
27
|
+
|
|
28
|
+
- repo: https://github.com/pre-commit/mirrors-mypy
|
|
29
|
+
rev: v2.1.0
|
|
30
|
+
hooks:
|
|
31
|
+
- id: mypy
|
|
32
|
+
name: Type check with mypy
|
|
33
|
+
additional_dependencies:
|
|
34
|
+
- types-python-dateutil
|
|
35
|
+
pass_filenames: false
|
|
36
|
+
always_run: true
|
|
37
|
+
args: [src/]
|
|
38
|
+
|
|
39
|
+
- repo: local
|
|
40
|
+
hooks:
|
|
41
|
+
- id: pytest
|
|
42
|
+
name: Run pytest
|
|
43
|
+
entry: uv run pytest
|
|
44
|
+
language: system
|
|
45
|
+
types: [python]
|
|
46
|
+
pass_filenames: false
|
|
47
|
+
always_run: true
|
|
48
|
+
stages: [pre-commit]
|
|
49
|
+
|
|
50
|
+
- repo: https://github.com/compilerla/conventional-pre-commit
|
|
51
|
+
rev: v4.4.0
|
|
52
|
+
hooks:
|
|
53
|
+
- id: conventional-pre-commit
|
|
54
|
+
name: Validate conventional commit message
|
|
55
|
+
stages: [commit-msg]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
## [unreleased]
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Claude-wiki knowledge base system
|
|
10
|
+
- Add migration mechanism for config path changes
|
|
11
|
+
- Global knowledge base registry
|
|
12
|
+
- Auto-evict stale entries from global registry
|
|
13
|
+
- Init defaults to repo-local hooks, --global for user-wide
|
|
14
|
+
- Add migrate path overrides, split skills, and remove state file
|
|
15
|
+
|
|
16
|
+
### Changed
|
|
17
|
+
|
|
18
|
+
- Normalize naming — marker, package, and docs
|
|
19
|
+
- Rename global registry index to core.md
|
|
20
|
+
|
|
21
|
+
### Documentation
|
|
22
|
+
|
|
23
|
+
- Audit and fix drift across all docs and skill
|
|
24
|
+
- Update install and contributor guides for uv sync
|
|
25
|
+
- Add CHANGELOG.md
|
|
26
|
+
- Release v0.1.0
|
|
27
|
+
|
|
28
|
+
### Fixed
|
|
29
|
+
|
|
30
|
+
- Resolve gap-analysis blockers and flatten kb_dir resolution
|
|
31
|
+
|
|
32
|
+
### Maintenance
|
|
33
|
+
|
|
34
|
+
- Add pre-commit hooks and align dependencies
|
|
35
|
+
- Add Makefile and fix README stale references
|
|
36
|
+
- Add GitHub workflows, local PyPI registry, and act support
|
|
37
|
+
- Update workflows to 2026 standards with SHA pinning
|
|
38
|
+
- Add mypy to dev dependencies for CI type-check gate
|
|
39
|
+
- Add cliff.toml for automated CHANGELOG generation
|
|
40
|
+
|
|
41
|
+
## Earlier Work
|
|
42
|
+
|
|
43
|
+
See git log for the full commit history prior to formal changelog adoption.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mister Robot
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|