@moikapy/lich 0.3.0 → 0.4.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.
Files changed (36) hide show
  1. package/CHANGELOG.md +35 -1
  2. package/README.md +34 -8
  3. package/dist/{chunk-P52U5M3L.js → chunk-MLFJW4JU.js} +399 -70
  4. package/dist/chunk-MLFJW4JU.js.map +1 -0
  5. package/dist/cli.d.ts +1 -2
  6. package/dist/cli.js +4 -3
  7. package/dist/cli.js.map +1 -1
  8. package/dist/{gateway-CWPVIU3W.js → gateway-XTYDYT67.js} +2 -2
  9. package/dist/index.d.ts +25 -11
  10. package/dist/index.js +1 -1
  11. package/dist/{tui-V7ATLIKW.js → tui-VYBJSGRV.js} +6 -3
  12. package/dist/tui-VYBJSGRV.js.map +1 -0
  13. package/docs/.vitepress/config.mts +1 -0
  14. package/docs/architecture/extending.md +5 -2
  15. package/docs/architecture/overview.md +9 -7
  16. package/docs/architecture/plugins.md +58 -5
  17. package/docs/architecture/tools.md +16 -4
  18. package/docs/design/council/architecture-review-r2.md +36 -0
  19. package/docs/design/council/architecture-review-r3.md +69 -0
  20. package/docs/design/council/index.md +15 -0
  21. package/docs/design/council/security-review-r2.md +32 -0
  22. package/docs/design/council/security-review-r3.md +19 -0
  23. package/docs/design/council/simplicity-review-r2.md +35 -0
  24. package/docs/design/council/simplicity-review-r3.md +22 -0
  25. package/docs/design/self-improvement-loop.md +160 -162
  26. package/docs/getting-started.md +37 -15
  27. package/docs/index.md +11 -11
  28. package/docs/user-guide/cli.md +18 -5
  29. package/docs/user-guide/gateway.md +10 -10
  30. package/docs/user-guide/library.md +15 -9
  31. package/docs/user-guide/plugins.md +59 -6
  32. package/docs/user-guide/tui.md +3 -3
  33. package/package.json +4 -2
  34. package/dist/chunk-P52U5M3L.js.map +0 -1
  35. package/dist/tui-V7ATLIKW.js.map +0 -1
  36. /package/dist/{gateway-CWPVIU3W.js.map → gateway-XTYDYT67.js.map} +0 -0
package/CHANGELOG.md CHANGED
@@ -1,6 +1,40 @@
1
1
  # Changelog
2
2
 
3
- ## Unreleased
3
+ ## 0.4.0
4
+
5
+ - add a self-improvement loop: `run_tests`, a gatekeeper plugin, and
6
+ `git_commit` (one commit per run, never pushes). `git_commit` is
7
+ registered by the gatekeeper, not the builtin tool list.
8
+ - fail-closed unless `LICH_ALLOW_SELF_COMMIT=1` at startup; unset or any
9
+ other value vetoes `git_commit`. a commit also needs a green `run_tests`
10
+ on a tree with no later `write_file`/`edit_file`.
11
+ - `run_tests` runs `LICH_TEST_COMMAND` in `work_dir` (default vitest) and
12
+ appends an optional filter as a quoted shell token.
13
+ - `docs_search` finds markdown skills under `.lich/skills` (fresh walk, no
14
+ `index.md` gate). `MEMORY.md` is never auto-loaded.
15
+ - close gatekeeper fail-open holes: git spawned with `hooksPath=/dev/null`,
16
+ pathspec magic rejected, denylist matches `commit-tree`/`update-ref` on
17
+ any occurrence, abort SIGKILLs the git child.
18
+ - honor per-tool `timeout_ms` (terminal is 5 min) instead of a flat 30s
19
+ executor budget.
20
+
21
+ ## 0.3.1
22
+
23
+ - Fix: published CLI bin now works — `dist/cli.js` shipped without its
24
+ `#!/usr/bin/env node` shebang, so the `lich` command failed after npm
25
+ install; shebang restored (5d7d9c9).
26
+ - Fix: TUI header showed a stale hardcoded version; now reads LICH_VERSION
27
+ to match the package.
28
+ - Docs: npm install is the primary usage path (package now published);
29
+ new Updating section in getting-started; docs-site fixes (dead links,
30
+ vitepress base for the pages subpath).
31
+ - Tests: suite passes under both vitest and `bun test`
32
+ (runner-independent stubs); portable fixtures — no more NAS-hardcoded
33
+ paths.
34
+ - Dev: `bun release patch|minor|major` release pipeline
35
+ (scripts/release.ts) — version bump, pack, and audit.
36
+
37
+ ## 0.3.0
4
38
 
5
39
  - Plugin system (v0.3.0): load user-authored tools and lifecycle hooks from
6
40
  explicit module paths (`plugins` config array). Hooks cover
package/README.md CHANGED
@@ -18,16 +18,20 @@ tool guardrails, context compression, and JSONL session persistence.
18
18
 
19
19
  ## Quick start (CLI)
20
20
 
21
+ ```sh
22
+ npm install -g @moikapy/lich
23
+ ```
24
+
21
25
  ```sh
22
26
  # one-shot task
23
- LICH_MODEL=gpt-4.1-mini LICH_PROVIDER_KIND=openai_compat bun src/cli.ts "summarize this repo"
27
+ LICH_MODEL=gpt-4.1-mini LICH_PROVIDER_KIND=openai_compat lich "summarize this repo"
24
28
 
25
29
  # interactive chat (commands: /exit, /quit)
26
- LICH_MODEL=claude-sonnet-4 LICH_PROVIDER_KIND=anthropic bun src/cli.ts chat
30
+ LICH_MODEL=claude-sonnet-4 LICH_PROVIDER_KIND=anthropic lich chat
27
31
 
28
32
  # local ollama (no api key needed)
29
33
  ollama pull llama3.2
30
- LICH_PROVIDER_KIND=ollama LICH_MODEL=llama3.2 bun src/cli.ts "hello"
34
+ LICH_PROVIDER_KIND=ollama LICH_MODEL=llama3.2 lich "hello"
31
35
 
32
36
  # terminal UI
33
37
  lich tui
@@ -40,13 +44,13 @@ The CLI has four modes: **one-shot** (`lich "task"`), **chat**
40
44
  (`lich chat`), **tui** (`lich tui`), and **gateway**
41
45
  (`lich gateway <platform...>`).
42
46
 
43
- Or use a JSON config file: `bun src/cli.ts --config lich.json "task"` (see
47
+ Or use a JSON config file: `lich --config lich.json "task"` (see
44
48
  `AgentConfig` in `src/agent/config.ts` for the schema).
45
49
 
46
50
  ## Library usage
47
51
 
48
52
  ```ts
49
- import { run_agent } from "lich";
53
+ import { run_agent } from "@moikapy/lich";
50
54
 
51
55
  const result = await run_agent(
52
56
  {
@@ -61,8 +65,9 @@ console.log(result.outcome.final?.content);
61
65
 
62
66
  ## Tools
63
67
 
64
- Twelve builtins ship with the agent (`register_builtin_tools`); all accept
68
+ Builtins ship with the agent (`register_builtin_tools`); all accept
65
69
  snake_case args and are registered under the `builtin` toolset.
70
+ `git_commit` is registered by the gatekeeper, not by that list.
66
71
 
67
72
  | Tool | Purpose |
68
73
  | --- | --- |
@@ -79,7 +84,8 @@ snake_case args and are registered under the `builtin` toolset.
79
84
  | `disk_usage` | `du -sb` sizes for depth-1 entries of a directory, sorted with a total. |
80
85
  | `env_get` | Inspect environment variables (names/lengths; secrets always masked). |
81
86
  | `docs_read` | Read a bundled lich doc (path relative to docs root; offset/limit; `.md` optional). |
82
- | `docs_search` | Keyword search across bundled lich docs with scored section snippets. |
87
+ | `docs_search` | Keyword search across bundled lich docs and `.lich/skills/*.md`, with scored section snippets. |
88
+ | `run_tests` | Run `LICH_TEST_COMMAND` in the working directory and return a structured pass/fail. |
83
89
 
84
90
  ## Plugins
85
91
 
@@ -89,6 +95,12 @@ object (`{name, tools?, hooks?}`) in your repo, list its file path in the
89
95
  observe or veto tool calls. See
90
96
  [docs/user-guide/plugins.md](docs/user-guide/plugins.md).
91
97
 
98
+ Skills are markdown files you write to `.lich/skills/` with `write_file`;
99
+ `docs_search` finds them. They are reference data, not instructions.
100
+ `MEMORY.md` is append-only, never auto-loaded; review it between appends and
101
+ the next self-commit. One gated `git_commit` per run requires
102
+ `LICH_ALLOW_SELF_COMMIT=1` and a green `run_tests` on a clean tree.
103
+
92
104
  ## Environment variables
93
105
 
94
106
  | Variable | Purpose |
@@ -97,13 +109,15 @@ observe or veto tool calls. See
97
109
  | `LICH_PROVIDER_KIND` | `openai_compat` \| `anthropic` \| `ollama` (default `openai_compat`) |
98
110
  | `LICH_BASE_URL` | provider base url (ollama default: `http://localhost:11434`) |
99
111
  | `LICH_API_KEY_ENV` | env var holding the api key (unused by ollama) |
112
+ | `LICH_ALLOW_SELF_COMMIT` | set to `1` to allow one gated `git_commit` per run; unset is fail-closed |
113
+ | `LICH_TEST_COMMAND` | command `run_tests` runs (default: `node node_modules/vitest/vitest.mjs run`) |
100
114
 
101
115
  ## Ollama
102
116
 
103
117
  Ollama needs no api key and defaults to `http://localhost:11434`:
104
118
 
105
119
  ```sh
106
- LICH_PROVIDER_KIND=ollama LICH_MODEL=llama3.2 bun src/cli.ts "Reply with ok"
120
+ LICH_PROVIDER_KIND=ollama LICH_MODEL=llama3.2 lich "Reply with ok"
107
121
  ```
108
122
 
109
123
  Notes:
@@ -181,6 +195,18 @@ node node_modules/tsup/dist/cli-default.js src/index.ts src/cli.ts --format esm
181
195
  Use project-local binaries for vitest/tsup (not `bun x`), which would isolate
182
196
  packages in /tmp and break dependency resolution.
183
197
 
198
+ ## Releasing
199
+
200
+ ```sh
201
+ bun release patch # or minor | major
202
+ ```
203
+
204
+ Fails closed on a dirty tree, a non-main branch, a typecheck error, or a
205
+ test failure; bumps via `npm version`, builds, and packs + audits
206
+ `test/.tmp/lich-<version>.tgz` (SHA-512 + scope verification) before
207
+ committing, tagging `v<version>`, and pushing main. Publishing stays manual
208
+ (`npm publish test/.tmp/lich-<version>.tgz`) so npm can prompt for the OTP.
209
+
184
210
  ## License
185
211
 
186
212
  MIT