ai-rulez 4.24.2 → 5.0.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 (3) hide show
  1. package/README.md +109 -211
  2. package/install.js +33 -15
  3. package/package.json +28 -4
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  <h1 align="center">ai-rulez</h1>
6
6
 
7
7
  <p align="center">
8
- <strong>A complete development workflow for AI coding tools</strong>
8
+ <strong>The standards-compliant lifecycle tool for agent knowledge and capabilities: author, generate, bundle, validate, govern, publish</strong>
9
9
  </p>
10
10
 
11
11
  <p align="center">
@@ -21,247 +21,133 @@
21
21
  <a href="https://goldziher.github.io/ai-rulez/examples/"><strong>Examples</strong></a>
22
22
  </p>
23
23
 
24
- ---
25
-
26
- ## The Problem
27
24
 
28
- Every AI coding tool wants its own config: Claude needs `CLAUDE.md`, Cursor wants `.cursor/rules/`, Copilot expects `.github/copilot-instructions.md`. Each has different formats, frontmatter, and directory conventions. If you use more than one tool, you're maintaining duplicate rules that inevitably drift apart.
25
+ ---
29
26
 
30
- ## The Solution
27
+ ## What it is
31
28
 
32
- Write your rules, context, skills, agents, and commands once in `.ai-rulez/`. Run `generate`. Get native configs for every tool you use.
29
+ ai-rulez is a standards-compliant lifecycle tool for agent knowledge and capabilities. You keep rules, context, skills,
30
+ agents, commands, hooks, permissions and MCP servers in one source of truth, `.ai-rulez/`, and ai-rulez takes them
31
+ through the whole lifecycle:
33
32
 
34
- ```bash
35
- npx ai-rulez@latest init && npx ai-rulez@latest generate
33
+ ```text
34
+ author -> generate -> bundle -> lint / validate -> govern -> publish
36
35
  ```
37
36
 
38
- Prefer the project-level [`.config/` convention](https://github.com/pi0/config-dir)? `ai-rulez` auto-discovers `.config/ai-rulez/` as well, and `ai-rulez init --config-dir .config/ai-rulez` scaffolds it.
39
-
40
- ai-rulez generates correct, tool-native output for **15 platforms**: Claude, Cursor, Windsurf, Copilot, Gemini, Cline, Continue.dev, Codex, OpenCode, Hermes, Amp, Junie, Antigravity, Xum, and pi. Each preset respects the target tool's conventions — proper frontmatter, directory structure, file extensions, agent formats.
41
-
42
- For a tool that isn't built in, a custom preset can point at a declarative **provider spec** (`provider = ".ai-rulez/providers/my-tool.toml"`) and get the same full feature set as a built-in — root instructions file, skills/agents/commands, per-agent frontmatter, and MCP sidecars. See [Custom Presets](docs/configuration.md#provider-backed-presets-full-parity).
43
-
44
- Set `agents_md = true` to write `AGENTS.md` and `.agents/skills/` once for the tools that read them (Codex, Cursor, Copilot, Gemini, Claude through an `@AGENTS.md` shim, and more) instead of one copy per tool. Off by default. See [docs/agents-md.md](docs/agents-md.md).
45
-
46
- ## Generate Plugins, Not Just Config
47
-
48
- ai-rulez doesn't only write config into _your_ repo — it also packages your project as **distributable plugins**. Run `ai-rulez generate --plugin` and the same `.ai-rulez/` source (skills, commands, agents, MCP servers) becomes installable **plugin bundles and a marketplace index** for Claude, Cursor, Codex, Gemini, Kimi, OpenCode, Factory, and Hermes Agent. An opt-in **Agent Plugins** runtime (`runtimes = ["agent-plugins"]`) additionally emits portable [Agent Plugins 1.0.0](https://agent-plugins.org) packages.
37
+ | Stage | What happens | Commands | Docs |
38
+ | ----- | ------------ | -------- | ---- |
39
+ | **Author** | Rules, context, skills, agents, commands and checks as markdown in `.ai-rulez/`, with domains, profiles, roles and includes. `.ai-rulez/` is an [OKF](docs/okf.md) bundle: OKF is the internal format, and `init`, `add` and the MCP tools write it. A pre-OKF tree still loads, with a deprecation notice; `migrate okf` converts it. | `init`, `add`, `convert`, `import`, `migrate okf` | [Author](docs/configuration.md) |
40
+ | **Generate** | Native files for 52 harnesses (Claude Code, Cursor, Codex, Copilot, Gemini CLI, OpenCode, Devin, Kilo and more), per project or per user. | `generate`, `doctor`, `clean` | [Harnesses](docs/harnesses.md) |
41
+ | **Bundle** | Distributable plugin bundles, an Agent Plugins package, an OKF bundle, an ARD manifest, `AGENTS.md` and `llms.txt`. | `generate --plugin`, `export okf` | [Plugins](docs/plugins.md) |
42
+ | **Lint and validate** | Content and security checks with stable `AR` codes, plus each standard's own schema or rules. | `validate`, `scan`, `okf validate`, `verify` | [Validate](docs/strict-validation.md) |
43
+ | **Govern** | A content-pinning lock, reviewer approvals, Sigstore signing, an organization policy and an SBOM. | `lock`, `approve`, `sign`, `verify --attestation`, `sbom` | [Trust model](docs/trust-model.md) |
44
+ | **Publish** | Reproducible, checksummed release artifacts to GitHub releases, npm, OCI and marketplaces. | `publish` | [Publish](docs/publish.md) |
45
+
46
+ ## Standards
47
+
48
+ The claim is "standards compliant", so each format ai-rulez names is generated or bundled from the same sources and
49
+ checked against that standard's own schema or rules. A standard is marked **supported** when the code generates it and
50
+ validates it today, and **planned** when it does not yet.
51
+ [docs/standards.md](docs/standards.md) carries the pinned spec version, the conformance test suite and the known gaps for
52
+ each row, and is the source of truth for test status.
53
+
54
+ | Standard | Status | Generate / bundle | Lint / validate |
55
+ | -------- | ------ | ----------------- | --------------- |
56
+ | [OKF](docs/okf.md) (Open Knowledge Format, v0.2), the internal format of `.ai-rulez/` | supported | `export okf`, the `okf` preset | `okf validate` |
57
+ | [Agent Plugins](docs/agent-plugins.md) (agent-plugins.org) | supported | `generate --plugin`, `publish --emit agent-plugins` | `validate --strict` (AR9O codes) |
58
+ | [ARD](docs/ard.md) (Agentic Resource Discovery, a proposal) | supported | `publish --emit ard` | `validate` (entry schema, URN grammar) |
59
+ | [Agent Skills](docs/skills.md) (agentskills.io) | supported | `generate` | `validate` (frontmatter checks; partial) |
60
+ | [AGENTS.md](docs/agents-md.md) | supported | `generate` | `validate` |
61
+ | [llms.txt](docs/llms-txt.md) | supported | the `llms-txt` preset | `validate` |
62
+ | MCP server config | supported | `generate` | `validate` (partial) |
63
+ | MCP server card | planned | not generated | none |
64
+ | [CycloneDX / SPDX SBOM](docs/sbom.md) | supported | `sbom` | `sbom --check` |
65
+ | [in-toto / DSSE / Sigstore](docs/signing.md) | supported | `sign` | `verify --attestation` |
66
+ | [OpenTelemetry (OTLP)](docs/telemetry.md) | supported | `telemetry export --to otlp` | not applicable |
67
+ | "Agent bundle" | planned | spec to be confirmed | spec to be confirmed |
68
+
69
+ ## Quick start
49
70
 
50
71
  ```bash
51
- ai-rulez generate --plugin # write plugin bundles + marketplace.json
52
- ai-rulez generate --plugin --dry-run # preview
53
- ai-rulez verify --plugin # prove committed output matches its sources
72
+ npx ai-rulez@latest init # author: scaffold .ai-rulez/ with config.toml
54
73
  ```
55
74
 
56
- Write MCP launch commands and hooks once with the canonical `${PLUGIN_ROOT}` variable — a hook either runs a command already on the consumer’s machine or bundles a project script into the plugin’s `hooks/` directory, so it works in a fresh clone — and each runtime gets its own manifest with the variable and hook format rewritten to fit. Hermes generation emits both a project plugin and a buildable Python entry-point package. Use `plugin.content_root` to keep distributable skills separate from contributor governance. Supports single-plugin repos and monorepos (`[marketplace].members`), plus a Claude statusline passthrough. See [Authoring Plugins](docs/plugins.md).
57
-
58
- ## What Ships Out of the Box
59
-
60
- ai-rulez isn't just a config generator. It ships with **33 builtin domains** containing opinionated rules, skills, agents, and workflows that establish a professional development baseline immediately.
61
-
62
- ### Auto-Included Domains
63
-
64
- Set `builtins` in your config — `true` for every domain, or a list to pick — and these seven come along
65
- without being named, unless you exclude one with `!`. Omit the `builtins` field entirely and no builtin
66
- content is loaded at all.
67
-
68
- Each one ships **always-on content** (rules, or context such as the agent roster) that is read on every
69
- request — rules in `.claude/rules/` under the default split mode (inlined into `CLAUDE.md` with
70
- `[rules] mode = "inline"`), context and the agent roster in `CLAUDE.md` — and some also ship
71
- **on-demand skills**, whose body costs nothing until the assistant loads it.
72
-
73
- | Domain | Always-on rules | On-demand skills |
74
- | -------------------- | -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------- |
75
- | **ai-governance** | No AI signatures in commits. Concise communication. Read before write. Minimal changes. Systematic debugging. Verification before claiming success. Critical review of subagent output. Reasoning stated for non-obvious decisions. | — |
76
- | **git-workflow** | Atomic commits. Conventional commit messages. Safe operations. Branch hygiene. | — |
77
- | **security** | Secrets handling. Input validation. Least privilege. | `owasp-quick-reference`, `dependency-awareness` |
78
- | **token-efficiency** | Context preservation. Output awareness. | `task-runner`, `incremental-approach` |
79
- | **testing** | Tests ship with the behaviour change; failing test before a bug fix; full suite before committing. | `tdd-workflow`, `testing-conventions` |
80
- | **code-quality** | — | `code-quality-standards`, `error-handling` |
81
- | **agent-delegation** | Multi-agent coordination and delegation patterns (emitted as context). | — |
82
-
83
- ### Builtin Agents
84
-
85
- Specialized agents ready to use as subagents:
86
-
87
- | Agent | Domain | Model | What it does |
88
- | -------------------- | ------------- | ------ | -------------------------------------------------------------------------------- |
89
- | **code-reviewer** | ai-governance | sonnet | Reviews changes for correctness, security, and conventions. Reports by severity. |
90
- | **test-writer** | testing | sonnet | Writes tests following strict TDD. Fails first, then implements. |
91
- | **security-auditor** | security | sonnet | Audits dependencies, scans for CVEs, reviews input validation. |
92
- | **docs-writer** | ai-governance | sonnet | Writes clear, concise documentation. No fluff. |
93
- | **devops-engineer** | cicd | sonnet | CI/CD pipelines, GitHub Actions, Docker, deployment automation. |
94
- | **release-engineer** | cicd | sonnet | Version management, changelogs, multi-registry publishing. |
95
- | **ffi-engineer** | polyglot-bindings | sonnet | Native FFI and cross-language binding work. |
96
- | **polyglot-architect** | polyglot-bindings | opus | Cross-language architecture and binding design. |
97
-
98
- ### Opt-in Domains
99
-
100
- Enable these based on your stack:
101
-
102
- **Languages** (10): `rust`, `python`, `typescript`, `go`, `java`, `ruby`, `php`, `elixir`, `csharp`, `r`
103
-
104
- **Bindings** (10): `pyo3`, `napi-rs`, `magnus`, `ext-php-rs`, `rustler`, `wasm`, `jni-rs`, `extendr`, `cgo`, `vite-plus`
105
-
106
- **Operational**: `cicd`, `docker`, `observability`, `documentation`, `polyglot-bindings`, `default-commands`
107
-
108
75
  ```toml
109
76
  # .ai-rulez/config.toml
110
- builtins = ["rust", "python", "pyo3", "cicd", "docker", "default-commands"]
111
- ```
112
-
113
- Anything scoped to one technology or one activity is emitted as an **on-demand Agent Skill**
114
- (`.claude/skills/<id>/SKILL.md`) rather than inlined into `CLAUDE.md`, so the always-loaded file stays
115
- small and the guidance arrives only when it is relevant: every language and binding domain,
116
- `polyglot-bindings`, `security`'s OWASP and dependency references, all of `code-quality`, most of
117
- `testing`, `token-efficiency`'s `task-runner` and `incremental-approach`, and the whole of `docker` and
118
- `observability`. What stays inline is behavioural governance that has to land before the first file is
119
- read — `ai-governance`, `git-workflow`, `security`'s secrets and boundary rules, and the one `testing`
120
- rule that says tests ship with the change. `!domain` and `!domain/name` exclusions work for skill
121
- entries too, so an exclusion written against a rule keeps working after it becomes a skill.
122
-
123
- ## Content Types
124
-
125
- | Type | Purpose | Example |
126
- | ------------ | ------------------------------ | -------------------------------------- |
127
- | **Rules** | What AI must/must not do | Security standards, coding conventions |
128
- | **Context** | What AI should know | Architecture docs, domain knowledge |
129
- | **Skills** | Reusable prompts and workflows | Deployment checklist, review protocol |
130
- | **Agents** | Specialized AI personas | Code reviewer, performance engineer |
131
- | **Commands** | Slash commands across tools | `/review`, `/deploy`, `/test` |
132
-
133
- ## Organization at Scale
134
-
135
- ai-rulez scales from solo projects to large organizations:
136
-
137
- **Domains** — Group content by feature, language, or team:
138
-
139
- ```text
140
- .ai-rulez/domains/backend/rules/
141
- .ai-rulez/domains/frontend/rules/
142
- ```
143
-
144
- **Profiles** — Generate different configs for different audiences:
145
-
146
- ```toml
147
- [profiles]
148
- backend = ["backend", "database"]
149
- frontend = ["frontend", "ui"]
77
+ presets = ["claude", "cursor", "codex", "copilot", "gemini"] # any of the 52 harnesses
150
78
  ```
151
79
 
152
- **Remote Includes** — Share rules across repositories:
153
-
154
- ```toml
155
- [[includes]]
156
- name = "company-standards"
157
- source = "https://github.com/company/ai-rules.git"
158
- merge_strategy = "local-override"
80
+ ```bash
81
+ npx ai-rulez@latest generate # generate: write native files for each preset
82
+ npx ai-rulez@latest validate --strict # validate: content and security checks, warnings fail
83
+ npx ai-rulez@latest lock # govern: pin includes, skills and authored content in ai-rulez.lock
84
+ npx ai-rulez@latest export okf # bundle: an OKF bundle of your knowledge in docs/okf
159
85
  ```
160
86
 
161
- Include sources can use a bare/flattened layout — expose `rules/`, `context/`, `skills/`, `agents/`
162
- directly (at the repo root or a sub-path via `path = "modules/core"`) with no `.ai-rulez/` wrapper.
163
- Recommended for shared, skill-first modules.
164
-
165
- **Native rules folders** — Rules are written to each tool's own rules folder (`.claude/rules`, `.cursor/rules`, `.github/instructions`, `.windsurf/rules`, ...) with native `paths`/`globs` frontmatter, so path-scoped rules load only when relevant. `split` is the default since 4.22.0; set `[rules] mode = "inline"` to keep rules in the root files. See [docs/rules.md](docs/rules.md).
166
-
167
- **Local configuration** — Personal, machine-local content and settings that never get committed:
87
+ Day-to-day:
168
88
 
169
89
  ```bash
170
- ai-rulez add rule my-scratch-notes --local # → .ai-rulez/local/rules/, generates .claude/rules/my-scratch-notes.local.md
171
- ai-rulez local set presets '["codex", "!cursor"]' # → .ai-rulez/config.local.toml overlay
90
+ ai-rulez generate --watch # regenerate on every change to .ai-rulez/
91
+ ai-rulez generate --check # CI: exit 2 when committed outputs differ from the sources
92
+ ai-rulez doctor # read-only diagnostics: drift, removed presets, missing tools
93
+ ai-rulez generate --user # the same, for your home directory (~/.claude, ~/.codex, ...)
172
94
  ```
173
95
 
174
- `.ai-rulez/local/`, the `config.local.*` overlay and the generated `*.local.*` outputs are gitignored
175
- unconditionally, and `generate` refuses to let local config change tracked shared files (use
176
- `--no-local` for the teammate view). See [docs/local-overrides.md](docs/local-overrides.md).
96
+ Prefer the project-level [`.config/` convention](https://github.com/pi0/config-dir)? ai-rulez also discovers
97
+ `.config/ai-rulez/`, and `ai-rulez init --config-dir .config/ai-rulez` scaffolds it.
177
98
 
178
- **Reasoning effort across providers** — Tune how hard each AI tool thinks:
179
-
180
- ```yaml
181
- # .ai-rulez/agents/security-reviewer.md
182
- ---
183
- name: security-reviewer
184
- description: Reviews code for security regressions
185
- effort: high
186
- ---
187
- ```
99
+ ## Bundle and publish
188
100
 
189
- ```toml
190
- # .ai-rulez/config.toml
191
- [defaults]
192
- effort = "medium" # global default for every supported preset
101
+ Bundling and publishing need a `[plugin]` block (`name`, `version` and `description`) in `config.toml`:
193
102
 
194
- [defaults.effort_by_preset]
195
- codex = "high" # overrides the global default for Codex
196
- claude = "xhigh" # …and for Claude
103
+ ```bash
104
+ ai-rulez generate --plugin # plugin bundles and a marketplace index from the [plugin] block
105
+ ai-rulez export okf # an OKF bundle of your rules, context and skills (docs/okf)
106
+ ai-rulez publish --emit agent-plugins --emit ard --dry-run
107
+ ai-rulez publish --to github-release --execute --yes
197
108
  ```
198
109
 
199
- Accepted values: `low`, `medium`, `high`, `xhigh`, `max`, `inherit`. ai-rulez emits the right field per preset:
200
-
201
- - **Claude** — `effort` in `.claude/agents/*.md` frontmatter (per-agent)
202
- - **Codex** — `model_reasoning_effort` in `.codex/config.toml` and `.codex/agents/*.toml`
203
- - **Amp** — `amp.anthropic.effort` in `.amp/settings.json` (global)
204
- - **Windsurf** — `reasoning_effort` in `.windsurf/agents/*.md` frontmatter (per-agent)
205
- - **Opencode** — `variant` in `.opencode/agents/*.md` frontmatter (per-agent); a separate key beside the agent's `provider/model`
206
- - **Xum** — `ai.thinkingLevel` in `.xum/agents/*.md` frontmatter (per-agent)
207
- - **pi** — `thinking` in `.pi/agents/*.md` frontmatter (per-agent)
208
-
209
- Each preset maps the value to its own vocabulary; tools without a documented config surface (Cursor, Copilot, Gemini, etc.) are silently skipped. See [docs/configuration.md](docs/configuration.md#defaults) for the full mapping table.
110
+ `publish` runs a preflight first (`validate --strict`, `lock --check`, `verify --plugin`, a secret scan and the policy
111
+ gates), writes a byte-reproducible tar.gz with `SHA256SUMS`, and uploads only when you pass `--execute --yes`. See
112
+ [Publish](docs/publish.md) and [Authoring plugins](docs/plugins.md).
210
113
 
211
- **Per-preset model selection for subagents** — Model strings differ per provider, so the same agent can declare a different model for each preset it targets:
212
-
213
- ```yaml
214
- # .ai-rulez/agents/research-helper.md
215
- ---
216
- name: research-helper
217
- description: Multi-provider research subagent
218
- claude_model: opus
219
- copilot_model: gpt-5
220
- cursor_model: claude-3.7-sonnet
221
- ---
222
- ```
114
+ Pi packages are opt-in with `[plugin] runtimes = ["pi"]`: skills and prompt templates can be installed
115
+ from Git or npm. Publishing to npm preserves Pi and OpenCode runtime metadata while using the
116
+ configured scope and plugin name for the released package.
223
117
 
224
- ```toml
225
- # .ai-rulez/config.toml — project-wide defaults
226
- [defaults.model_by_preset]
227
- claude = "sonnet" # used when an agent doesn't set its own claude_model
228
- copilot = "gpt-5"
229
- ```
118
+ ## Validate
230
119
 
231
- Per-agent `<preset>_model` wins over `defaults.model_by_preset`; the legacy single `model:` field on an agent is the lowest-priority fallback for backward compatibility.
232
-
233
- **Installed Skills** — Pull reusable skills from external repos:
234
-
235
- ```toml
236
- [[installed_skills]]
237
- name = "kreuzberg"
238
- source = "https://github.com/kreuzberg-dev/kreuzberg"
120
+ ```bash
121
+ ai-rulez validate # config plus content checks, exit 2 on findings
122
+ ai-rulez validate --explain AR001 # what a rule checks and how to suppress it
123
+ ai-rulez validate --format sarif --output ai-rulez.sarif
124
+ ai-rulez okf validate docs/okf # lint any OKF bundle, ai-rulez's or a third party's
125
+ ai-rulez generate --check # generated files still match their sources
239
126
  ```
240
127
 
241
- **Committing generated output** — every generated file carries a `Content-Hash` and a `Source-Hash` line. `Source-Hash` covers the whole source set, so editing one skill rewrites a line in every generated file. If you commit the output, keep headers stable:
128
+ ## Govern
242
129
 
243
- ```toml
244
- [header]
245
- hashes = "content" # "full" (default) | "content" (Content-Hash only) | "none"
130
+ ```bash
131
+ ai-rulez lock # pin remote includes, installed skills and authored content
132
+ ai-rulez approve --list # what still needs a reviewer's approval
133
+ ai-rulez sign --lock # a Sigstore bundle (DSSE over an in-toto statement) for the lock
134
+ ai-rulez verify --attestation # check it offline against the [signing] policy
135
+ ai-rulez sbom -o ai-bom.cdx.json # CycloneDX 1.6 (or --type spdx-json)
246
136
  ```
247
137
 
248
- ## MCP Server
138
+ An organization [policy](docs/policy.md) sets tighten-only floors a repository cannot loosen. See the
139
+ [trust model](docs/trust-model.md).
249
140
 
250
- ai-rulez includes a built-in MCP server with 36 tools that lets AI assistants manage their own governance. Add rules, update context, generate configs — all programmatically.
141
+ ## Operate
251
142
 
252
- ```toml
253
- [[mcp_servers]]
254
- name = "ai-rulez"
255
- command = "npx"
256
- args = ["-y", "ai-rulez@latest", "mcp"]
257
- ```
143
+ - **MCP server.** `ai-rulez mcp` lets an assistant manage the configuration; with `--serve-skills` it serves skills on
144
+ demand. See [MCP server](docs/mcp-server.md).
145
+ - **Telemetry.** Item-load records with an optional OTLP export. See [telemetry](docs/telemetry.md).
146
+ - **Evals and improve.** `ai-rulez eval` scores skills; `improve` (experimental) optimizes them behind a held-out eval
147
+ gate. See [evals](docs/evals.md) and [improve](docs/improve.md).
148
+ - **Cost and inventory.** `tokens`, `cost`, `catalog` and `search` report what the configuration contains and costs.
258
149
 
259
- Or let `generate` add it for you. With `[mcp] self_server = true` the entry is merged into the project `.mcp.json`, pinned to the running ai-rulez version, without touching hand-authored servers or `.claude/settings.json`:
260
-
261
- ```toml
262
- [mcp]
263
- self_server = true
264
- ```
150
+ Existing project on 4.x? Run `ai-rulez migrate v5 --dry-run`, then see [Migrating to v5](docs/migration-v5.md).
265
151
 
266
152
  ## Installation
267
153
 
@@ -323,6 +209,17 @@ pipx install ai-rulez
323
209
 
324
210
  </details>
325
211
 
212
+ <details>
213
+ <summary><strong>Go</strong></summary>
214
+
215
+ ```bash
216
+ go install github.com/Goldziher/ai-rulez/v5/cmd/ai-rulez@latest
217
+ ```
218
+
219
+ The module path needs `/v5`; without it `@latest` resolves to an old build.
220
+
221
+ </details>
222
+
326
223
  <details>
327
224
  <summary><strong>pre-commit hook</strong></summary>
328
225
 
@@ -331,7 +228,7 @@ Add to `.pre-commit-config.yaml`:
331
228
  ```yaml
332
229
  repos:
333
230
  - repo: https://github.com/Goldziher/ai-rulez
334
- rev: v4.24.2
231
+ rev: v5.0.0
335
232
  hooks:
336
233
  - id: ai-rulez-recursive # generate outputs across the repo
337
234
  - id: ai-rulez-validate # dry-run validation
@@ -346,13 +243,14 @@ Available hook ids: `ai-rulez-validate`, `ai-rulez-generate`,
346
243
  <summary><strong>poly hook source</strong></summary>
347
244
 
348
245
  Add ai-rulez as a managed source in your existing `poly.toml` and select the hooks your
349
- repository needs. This requires AI-Rulez 4.9.0+ and Poly 0.14.0+:
246
+ repository needs. This requires Poly 0.14.0+; pin `revision` to the AI-Rulez release you want (the
247
+ hooks run that release):
350
248
 
351
249
  ```toml
352
250
  [[hooks.sources]]
353
251
  id = "ai-rulez"
354
252
  git = "https://github.com/Goldziher/ai-rulez.git"
355
- revision = "v4.24.2"
253
+ revision = "v5.0.0"
356
254
  hooks = ["ai-rulez-recursive", "ai-rulez-plugin-verify"]
357
255
  ```
358
256
 
@@ -387,12 +285,12 @@ pre-commit:
387
285
  ```
388
286
 
389
287
  Hooks run on each developer's machine and would otherwise load that developer's gitignored
390
- `config.local.*` overlay and `.ai-rulez/local/` content. Pass `--no-local` (also accepted by `validate`
288
+ `config.local.toml` overlay and `.ai-rulez/local/` content. Pass `--no-local` (also accepted by `validate`
391
289
  and `tokens`) where a hook should see only the shared configuration, as a teammate or CI does. If you do
392
290
  not, `generate` still refuses to write local-derived changes into tracked shared files; never add
393
291
  `--allow-local-drift` to a hook. See [Poly hooks guide](docs/poly-hooks.md#machine-local-configuration-in-hooks).
394
292
 
395
- In a monorepo, `ai-rulez generate --recursive` and `ai-rulez validate --recursive` (`-r`) process every nested
293
+ In a monorepo, `ai-rulez generate --recursive` and `ai-rulez validate --recursive` process every nested
396
294
  `.ai-rulez/` root, report all failures, and exit non-zero if any root failed.
397
295
 
398
296
  Or run `ai-rulez init --setup-hooks` while initializing a repo to wire hooks in automatically.
package/install.js CHANGED
@@ -42,6 +42,22 @@ async function getExpectedChecksum(checksumPath, filename) {
42
42
  }
43
43
  }
44
44
 
45
+ // Fails closed: a missing checksums file, a missing entry, or a mismatch all
46
+ // throw, so an archive is never trusted without a verified digest.
47
+ async function verifyArchiveChecksum(archivePath, checksumPath, archiveName) {
48
+ if (!fs.existsSync(checksumPath)) {
49
+ throw new Error("Checksum verification failed: checksums.txt is unavailable");
50
+ }
51
+ const expectedHash = await getExpectedChecksum(checksumPath, archiveName);
52
+ if (!expectedHash) {
53
+ throw new Error(`Checksum verification failed: no checksum for ${archiveName} in checksums.txt`);
54
+ }
55
+ const actualHash = await calculateSHA256(archivePath);
56
+ if (actualHash !== expectedHash) {
57
+ throw new Error(`Checksum verification failed. Expected: ${expectedHash}, Got: ${actualHash}`);
58
+ }
59
+ }
60
+
45
61
  function getPlatform() {
46
62
  const platform = process.platform;
47
63
  const arch = process.arch;
@@ -339,26 +355,19 @@ async function install(isPostInstall = false) {
339
355
  const checksumPath = path.join(__dirname, "checksums.txt");
340
356
  try {
341
357
  await downloadBinary(checksumUrl, checksumPath);
342
- } catch (_checksumError) {
343
- console.warn("Warning: Could not download checksums, skipping verification");
358
+ } catch (checksumError) {
359
+ throw new Error(`Could not download checksums.txt, refusing to install unverified: ${checksumError.message}`);
344
360
  }
345
361
 
346
362
  await downloadBinary(downloadUrl, archivePath);
347
363
 
348
- if (fs.existsSync(checksumPath)) {
349
- console.log("Verifying checksum...");
350
- const expectedHash = await getExpectedChecksum(checksumPath, archiveName);
351
- if (expectedHash) {
352
- const actualHash = await calculateSHA256(archivePath);
353
- if (actualHash !== expectedHash) {
354
- throw new Error(
355
- `Checksum verification failed. Expected: ${expectedHash}, Got: ${actualHash}`,
356
- );
357
- }
358
- console.log("✓ Checksum verified");
359
- }
360
- fs.unlinkSync(checksumPath);
364
+ console.log("Verifying checksum...");
365
+ try {
366
+ await verifyArchiveChecksum(archivePath, checksumPath, archiveName);
367
+ } finally {
368
+ fs.rmSync(checksumPath, { force: true });
361
369
  }
370
+ console.log("✓ Checksum verified");
362
371
 
363
372
  console.log("Extracting binary...");
364
373
 
@@ -379,6 +388,14 @@ async function install(isPostInstall = false) {
379
388
  fs.unlinkSync(binaryPath);
380
389
  }
381
390
  fs.renameSync(extractedPath, binaryPath);
391
+ // A Windows archive may ship liter_llm_ffi.dll beside ai-rulez.exe; the loader needs it there.
392
+ if (os === "windows") {
393
+ for (const name of fs.readdirSync(tempExtractDir)) {
394
+ if (name.toLowerCase().endsWith(".dll")) {
395
+ fs.renameSync(path.join(tempExtractDir, name), path.join(binDir, name));
396
+ }
397
+ }
398
+ }
382
399
  }
383
400
 
384
401
  fs.rmSync(tempExtractDir, { recursive: true, force: true });
@@ -452,6 +469,7 @@ if (typeof module !== "undefined" && module.exports) {
452
469
  extractArchive,
453
470
  calculateSHA256,
454
471
  getExpectedChecksum,
472
+ verifyArchiveChecksum,
455
473
  install,
456
474
  };
457
475
  }
package/package.json CHANGED
@@ -1,39 +1,63 @@
1
1
  {
2
2
  "name": "ai-rulez",
3
- "version": "4.24.2",
4
- "description": "Complete AI development workflow for 15 AI coding tools. Ships with builtin rules, agents, and conventions. Generate native configs for Claude, Cursor, Copilot, Windsurf, Gemini, Codex and more from a single source.",
3
+ "version": "5.0.0",
4
+ "description": "Standards-compliant lifecycle tool for agent knowledge and capabilities. Author rules, skills, agents and MCP servers once; generate for 52 harnesses; bundle as OKF, Agent Plugins and ARD; validate against each standard; govern with signing, approvals and policy; publish.",
5
5
  "keywords": [
6
+ "agent-plugins",
7
+ "agent-skills",
6
8
  "agents",
9
+ "agents-md",
7
10
  "ai",
8
11
  "ai-assistant",
9
12
  "ai-development",
10
13
  "ai-rules",
14
+ "ard",
11
15
  "assistant-configuration",
12
16
  "automation",
17
+ "baz",
13
18
  "claude",
19
+ "claude-code",
14
20
  "cli",
15
21
  "cline",
16
22
  "code-generation",
23
+ "code-review",
24
+ "codex",
17
25
  "config",
18
26
  "configuration",
19
- "continue-dev",
20
27
  "copilot",
21
28
  "cursor",
29
+ "cyclonedx",
22
30
  "developer-tools",
23
31
  "development",
32
+ "devin",
24
33
  "gemini",
25
34
  "generator",
26
35
  "git-hooks",
27
36
  "go",
28
37
  "golang",
38
+ "governance",
39
+ "hooks",
40
+ "in-toto",
41
+ "lifecycle",
42
+ "llms-txt",
29
43
  "mcp",
30
44
  "model-context-protocol",
31
45
  "monorepo",
46
+ "okf",
47
+ "opencode",
48
+ "permissions",
32
49
  "pre-commit",
33
50
  "presets",
34
51
  "productivity",
52
+ "publish",
35
53
  "rules",
36
- "windsurf",
54
+ "sbom",
55
+ "sigstore",
56
+ "skills",
57
+ "spdx",
58
+ "standards",
59
+ "supply-chain",
60
+ "validation",
37
61
  "workflow"
38
62
  ],
39
63
  "homepage": "https://goldziher.github.io/ai-rulez/",