@endgame-build/khub 0.27.0 → 0.29.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/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![CI](https://github.com/endgame-build/khub/actions/workflows/ci.yml/badge.svg)](https://github.com/endgame-build/khub/actions/workflows/ci.yml)
4
4
  ![License: Apache 2.0](https://img.shields.io/badge/license-Apache%202.0-blue.svg)
5
- ![Go 1.25+](https://img.shields.io/badge/go-1.25%2B-00ADD8.svg)
5
+ ![Go 1.26+](https://img.shields.io/badge/go-1.26%2B-00ADD8.svg)
6
6
 
7
7
  **Schema-bound, agent-facing context management.**
8
8
 
@@ -23,20 +23,20 @@ Built on top of the [Open Knowledge Format (OKF)](https://github.com/GoogleCloud
23
23
  - **Gate** — `validate` (per-entity well-formedness, including body structure against the type's template: required section headings as an ordered subsequence; per-section rules report as `gaps`, which never gate) and `check` (graph-wide completeness, dangling edges, strays, cycles, missing required singletons, body shape; orphans informational unless `--strict`, thin bodies informational as `thin`); `stale` reads git at entity altitude, row-accurate even inside collections.
24
24
  - **Project** — `reindex` (OKF `index.md`), `viz` (Cytoscape HTML), `backfill` (git-derived dates and scaffolding).
25
25
  - **Store** — per-type `layout` (file / folder / collection / singleton) × `format` (md / json / yaml; collections take json / jsonl / yaml). A singleton is one fixed file whose slug is the type name (`khub get prd`). Non-md entities carry prose in a reserved `body` field. Every existing-workspace mutation holds one workspace-wide lock from scan through publication; atomic writes preserve existing permissions and refuse workspace storage symlinks.
26
- - **Scaffold** — presets are directories (`<name>/{ontology,policy,storage}.yaml` + `templates/*.yaml`); `khub init` copies them into `.khub/` and creates every missing md singleton from its template (creations only — an existing file is never touched); `khub upgrade --dry-run` preflights the complete candidate and tails without workspace artifacts. A real upgrade publishes schema, templates and scaffolds transactionally, preserves edited files as `<name>.bak`, writes the version last, then refreshes skills, wiring and `index.md` as non-fatal tails.
26
+ - **Scaffold** — presets are directories (`<name>/{ontology,policy,storage}.yaml` + `templates/*.yaml`); `khub init` copies them into `.khub/` and creates every missing md singleton from its template (creations only — an existing file is never touched); `khub upgrade --dry-run` preflights the complete candidate and tails without workspace artifacts. A real upgrade publishes schema, templates and scaffolds transactionally, preserves edited files as `<name>.bak`, writes the version last, then refreshes wiring and `index.md` as non-fatal tails.
27
27
  - **Wire** — `wire`: link the schema into a project's agent files. Bare `wire` updates whichever of `CLAUDE.md` / `AGENTS.md` exist; `--target claude|agents|both` creates one. `CLAUDE.md` gets `@.khub/ontology.yaml` (+ policy/storage) imports, `AGENTS.md` a schema pointer, both with the command surface — so an agent reasons in the ontology with or without the CLI.
28
28
 
29
29
  Full command surface and JSON contracts: [`docs/cli.md`](docs/cli.md). Feature history: [`CHANGELOG.md`](CHANGELOG.md). All documentation: [`docs/`](docs/).
30
30
 
31
31
  ## Quickstart
32
32
 
33
- khub is a single static binary for macOS and Linux (amd64, arm64). The primary install is the npm package [`@endgame-build/khub`](https://www.npmjs.com/package/@endgame-build/khub) — one package carrying a prebuilt binary per platform behind a launcher that picks the matching one — pinned per repo, so everyone (and every agent) touching that repo runs the same khub:
33
+ khub is a single static binary for macOS, Linux and Windows (amd64, arm64; Windows is experimental). The primary install is the npm package [`@endgame-build/khub`](https://www.npmjs.com/package/@endgame-build/khub) — one package carrying a prebuilt binary per platform behind a launcher that picks the matching one — pinned per repo, so everyone (and every agent) touching that repo runs the same khub:
34
34
 
35
35
  ```bash
36
36
  npm install -D @endgame-build/khub # exact per-repo pin (required: later commands run it)
37
37
  npx @endgame-build/khub init firm-ops ./my-hub # scaffold .khub/ (+ templates, singletons), wire agent files
38
38
  cd my-hub
39
- npx @endgame-build/khub install-skills # copy the agent skills in (offline)
39
+ npx skills add endgame-build/khub # the agent skills (Claude Code: the plugin, below)
40
40
  ```
41
41
 
42
42
  With no version after the name, `npx @endgame-build/khub` runs the version `package.json` pins.
@@ -84,24 +84,30 @@ A preset is a canonical ontology for one domain — a directory holding its thre
84
84
 
85
85
  ## Agent skills
86
86
 
87
- khub ships two skills: `khub` (the read and write verbs) and `setup` (install the CLI, set up a project). They work in Claude Code, opencode, Cursor, Codex, Gemini CLI, and any other agent that reads a `SKILL.md`.
87
+ khub ships two skills: `khub` (the read and write verbs) and `setup` (install the CLI, set up a project). They live in this repo under `plugin/skills/`, apart from the binary.
88
88
 
89
- **Option 1 — the CLI, then its skills.** A file copy out of the binary itself: offline, safe to re-run.
89
+ **Claude Code — the plugin.** The repo is a plugin marketplace. The `khub` plugin carries both skills and a small session mod. The mod draws a one-line band above the prompt with the entity count, what the session added, removed and edited, the draft count and the `check` verdict. In a verbose session it also draws each khub call Claude makes as a compact row. See [`docs/plugin.md`](docs/plugin.md).
90
90
 
91
- ```bash
92
- npm install -D @endgame-build/khub
93
- npx @endgame-build/khub install-skills
91
+ ```text
92
+ /plugin marketplace add endgame-build/khub
93
+ /plugin install khub@khub
94
94
  ```
95
95
 
96
- That writes both skills into `.claude/skills/`, `.agents/skills/`, and `.opencode/skills/`, and gitignores them (they are reproducible from the CLI). Narrow it with `--target claude|agents|opencode` or `--skill khub|setup`; `--global` installs into your home directories instead, once per machine; `--dry-run` shows the writes first.
96
+ To update the plugin later, run these from a shell, then start a new session or run `/reload-plugins`:
97
+
98
+ ```bash
99
+ claude plugin marketplace update khub
100
+ claude plugin update khub@khub
101
+ ```
97
102
 
98
- **Option 2 — let an agent do it.** Installs the `setup` skill, which tells the agent how to install the CLI and set up the project. Needs Node and network:
103
+ **Every other agent — `npx skills`.** opencode, Cursor, Codex, Gemini CLI and any other agent that reads a `SKILL.md` get the two skills, with no mod. Needs Node and access to the repo:
99
104
 
100
105
  ```bash
101
- npx skills add endgame-build/khub -s setup
106
+ npx skills add endgame-build/khub # both skills, into the agents it finds
107
+ npx skills add endgame-build/khub -s setup # only setup, on a machine with no khub yet
102
108
  ```
103
109
 
104
- Use option 2 on a machine with no khub yet; option 1 is what you re-run afterwards.
110
+ On a machine with no khub yet, install `setup` and ask the agent to set khub up.
105
111
 
106
112
  **Status:** v1 engine shipped and in daily use on a live firm-operations corpus that cut over from hand-rolled scripts. Design rationale in [`docs/design-memo.md`](docs/design-memo.md); the collections row model in [`docs/collections-design.md`](docs/collections-design.md).
107
113
 
package/bin/khub.js CHANGED
@@ -2,7 +2,8 @@
2
2
  "use strict";
3
3
  // Launcher for the khub static binary.
4
4
  //
5
- // One package carries every binary, under binaries/<platform>-<arch>/khub.
5
+ // One package carries every binary, under binaries/<platform>-<arch>/khub
6
+ // (khub.exe on win32, which is experimental).
6
7
  // package.json's `bin` is a single path, so this shim exists to pick the right
7
8
  // one at run time and hand over: stdio is inherited (khub's own TTY detection
8
9
  // and EPIPE handling see the real file descriptors), the exit code is forwarded
@@ -22,7 +23,7 @@ const path = require("path");
22
23
 
23
24
  const root = path.join(__dirname, "..", "binaries");
24
25
  const target = `${process.platform}-${process.arch}`;
25
- const bin = path.join(root, target, "khub");
26
+ const bin = path.join(root, target, process.platform === "win32" ? "khub.exe" : "khub");
26
27
 
27
28
  if (!fs.existsSync(bin)) {
28
29
  // No fallback if binaries/ is unreadable: node's own ENOENT names the path,
@@ -43,6 +44,13 @@ if (result.error) {
43
44
  }
44
45
  if (result.signal) {
45
46
  // Re-raise so the parent observes the same termination the binary did.
46
- process.kill(process.pid, result.signal);
47
+ // Windows has no signals to re-raise: node emulates SIGINT, SIGTERM and
48
+ // SIGKILL as an unconditional kill and throws for any other name, so a
49
+ // failed re-raise falls through to the exit below rather than crashing.
50
+ try {
51
+ process.kill(process.pid, result.signal);
52
+ } catch {
53
+ // fall through
54
+ }
47
55
  }
48
56
  process.exit(result.status === null ? 1 : result.status);
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@endgame-build/khub",
3
- "version": "0.27.0",
3
+ "version": "0.29.0",
4
4
  "description": "Schema-bound, agent-facing context management. A single static binary; this package carries one per supported platform and launches the matching one.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "ENDGAME",