@bonesofspring/ai-rules 0.2.52 → 0.2.53

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 (134) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/README.md +27 -3
  3. package/bin/cli.js +551 -60
  4. package/bin/lib/engine-scripts.js +10 -0
  5. package/bin/lib/mcp/clients.js +168 -0
  6. package/bin/lib/mcp/credentials.js +298 -0
  7. package/bin/lib/mcp/doctor.js +394 -0
  8. package/bin/lib/mcp/prompt.js +115 -0
  9. package/bin/lib/mcp/registry.js +170 -0
  10. package/bin/lib/mcp/run.js +123 -0
  11. package/bin/lib/merged-config.js +45 -0
  12. package/bin/lib/seed-ai-local-team.js +5 -0
  13. package/bin/lib/tool-installs.js +27 -0
  14. package/docs/MCP-SETUP.md +62 -0
  15. package/docs/PRESET-CONTRIBUTION.md +3 -1
  16. package/docs/TEAM-DB.md +173 -0
  17. package/docs/openapi/team-db.v1.json +5085 -0
  18. package/mcp/gitlab.mjs +123 -0
  19. package/mcp/lib/envfile.mjs +126 -0
  20. package/mcp/lib/yandex.mjs +384 -0
  21. package/mcp/yandex-mcp-proxy.mjs +155 -0
  22. package/mcp/yandex-token-refresh.mjs +65 -0
  23. package/package.json +14 -1
  24. package/presets/_shared/ai-local/scripts/manifest.mjs +99 -0
  25. package/presets/_shared/ai-local/scripts/team-db-api.mjs +1275 -0
  26. package/presets/_shared/ai-local/scripts/team-db-dashboard.mjs +1067 -0
  27. package/presets/_shared/ai-local/scripts/team-db-openapi.mjs +1301 -0
  28. package/presets/_shared/ai-local/scripts/team-db-project.mjs +1506 -0
  29. package/presets/_shared/ai-local/scripts/team-db-schema.mjs +831 -0
  30. package/presets/_shared/ai-local/scripts/team-db.mjs +251 -0
  31. package/presets/_shared/hooks/chain-team-phases.sh.tmpl +109 -0
  32. package/presets/claude/android-kotlin/hooks/chain-team-phases.sh +109 -0
  33. package/presets/claude/android-kotlin/team/README.md +10 -0
  34. package/presets/claude/go/hooks/chain-team-phases.sh +109 -0
  35. package/presets/claude/go/team/README.md +10 -0
  36. package/presets/claude/ios-swift/hooks/chain-team-phases.sh +109 -0
  37. package/presets/claude/ios-swift/team/README.md +10 -0
  38. package/presets/claude/java/hooks/chain-team-phases.sh +109 -0
  39. package/presets/claude/java/team/README.md +10 -0
  40. package/presets/claude/mcp-ts/hooks/chain-team-phases.sh +109 -0
  41. package/presets/claude/mcp-ts/team/README.md +10 -0
  42. package/presets/claude/next/hooks/chain-team-phases.sh +109 -0
  43. package/presets/claude/next/team/README.md +10 -0
  44. package/presets/claude/nuxt/hooks/chain-team-phases.sh +109 -0
  45. package/presets/claude/nuxt/team/README.md +10 -0
  46. package/presets/claude/php-hexagonal/hooks/chain-team-phases.sh +109 -0
  47. package/presets/claude/php-hexagonal/team/README.md +10 -0
  48. package/presets/claude/php-laravel/hooks/chain-team-phases.sh +109 -0
  49. package/presets/claude/php-laravel/team/README.md +10 -0
  50. package/presets/claude/svelte/hooks/chain-team-phases.sh +109 -0
  51. package/presets/claude/svelte/team/README.md +10 -0
  52. package/presets/cursor/android-kotlin/hooks/chain-team-phases.sh +109 -0
  53. package/presets/cursor/android-kotlin/team/README.md +10 -0
  54. package/presets/cursor/go/hooks/chain-team-phases.sh +109 -0
  55. package/presets/cursor/go/team/README.md +10 -0
  56. package/presets/cursor/ios-swift/hooks/chain-team-phases.sh +109 -0
  57. package/presets/cursor/ios-swift/team/README.md +10 -0
  58. package/presets/cursor/java/hooks/chain-team-phases.sh +109 -0
  59. package/presets/cursor/java/team/README.md +10 -0
  60. package/presets/cursor/mcp-ts/hooks/chain-team-phases.sh +109 -0
  61. package/presets/cursor/mcp-ts/team/README.md +10 -0
  62. package/presets/cursor/next/MCP.md +7 -0
  63. package/presets/cursor/next/hooks/chain-team-phases.sh +109 -0
  64. package/presets/cursor/next/team/README.md +10 -0
  65. package/presets/cursor/nuxt/hooks/chain-team-phases.sh +109 -0
  66. package/presets/cursor/nuxt/team/README.md +10 -0
  67. package/presets/cursor/php-hexagonal/hooks/chain-team-phases.sh +109 -0
  68. package/presets/cursor/php-hexagonal/team/README.md +10 -0
  69. package/presets/cursor/php-laravel/hooks/chain-team-phases.sh +109 -0
  70. package/presets/cursor/php-laravel/team/README.md +10 -0
  71. package/presets/cursor/svelte/hooks/chain-team-phases.sh +109 -0
  72. package/presets/cursor/svelte/team/README.md +10 -0
  73. package/presets/mavis/android-kotlin/adapter-map.json +1 -1
  74. package/presets/mavis/android-kotlin/hooks/chain-team-phases.sh +109 -0
  75. package/presets/mavis/android-kotlin/team/README.md +10 -0
  76. package/presets/mavis/go/adapter-map.json +1 -1
  77. package/presets/mavis/go/hooks/chain-team-phases.sh +109 -0
  78. package/presets/mavis/go/team/README.md +10 -0
  79. package/presets/mavis/ios-swift/adapter-map.json +1 -1
  80. package/presets/mavis/ios-swift/hooks/chain-team-phases.sh +109 -0
  81. package/presets/mavis/ios-swift/team/README.md +10 -0
  82. package/presets/mavis/java/adapter-map.json +1 -1
  83. package/presets/mavis/java/hooks/chain-team-phases.sh +109 -0
  84. package/presets/mavis/java/team/README.md +10 -0
  85. package/presets/mavis/mcp-ts/adapter-map.json +1 -1
  86. package/presets/mavis/mcp-ts/hooks/chain-team-phases.sh +109 -0
  87. package/presets/mavis/mcp-ts/team/README.md +10 -0
  88. package/presets/mavis/next/MCP.md +7 -0
  89. package/presets/mavis/next/adapter-map.json +1 -1
  90. package/presets/mavis/next/hooks/chain-team-phases.sh +109 -0
  91. package/presets/mavis/next/team/README.md +10 -0
  92. package/presets/mavis/nuxt/adapter-map.json +1 -1
  93. package/presets/mavis/nuxt/hooks/chain-team-phases.sh +109 -0
  94. package/presets/mavis/nuxt/team/README.md +10 -0
  95. package/presets/mavis/php-hexagonal/adapter-map.json +1 -1
  96. package/presets/mavis/php-hexagonal/hooks/chain-team-phases.sh +109 -0
  97. package/presets/mavis/php-hexagonal/team/README.md +10 -0
  98. package/presets/mavis/php-laravel/adapter-map.json +1 -1
  99. package/presets/mavis/php-laravel/hooks/chain-team-phases.sh +109 -0
  100. package/presets/mavis/php-laravel/team/README.md +10 -0
  101. package/presets/mavis/svelte/adapter-map.json +1 -1
  102. package/presets/mavis/svelte/hooks/chain-team-phases.sh +109 -0
  103. package/presets/mavis/svelte/team/README.md +10 -0
  104. package/presets/opencode/android-kotlin/adapter-map.json +1 -1
  105. package/presets/opencode/android-kotlin/hooks/chain-team-phases.sh +109 -0
  106. package/presets/opencode/android-kotlin/team/README.md +10 -0
  107. package/presets/opencode/go/adapter-map.json +1 -1
  108. package/presets/opencode/go/hooks/chain-team-phases.sh +109 -0
  109. package/presets/opencode/go/team/README.md +10 -0
  110. package/presets/opencode/ios-swift/adapter-map.json +1 -1
  111. package/presets/opencode/ios-swift/hooks/chain-team-phases.sh +109 -0
  112. package/presets/opencode/ios-swift/team/README.md +10 -0
  113. package/presets/opencode/java/adapter-map.json +1 -1
  114. package/presets/opencode/java/hooks/chain-team-phases.sh +109 -0
  115. package/presets/opencode/java/team/README.md +10 -0
  116. package/presets/opencode/mcp-ts/adapter-map.json +1 -1
  117. package/presets/opencode/mcp-ts/hooks/chain-team-phases.sh +109 -0
  118. package/presets/opencode/mcp-ts/team/README.md +10 -0
  119. package/presets/opencode/next/MCP.md +7 -0
  120. package/presets/opencode/next/adapter-map.json +1 -1
  121. package/presets/opencode/next/hooks/chain-team-phases.sh +109 -0
  122. package/presets/opencode/next/team/README.md +10 -0
  123. package/presets/opencode/nuxt/adapter-map.json +1 -1
  124. package/presets/opencode/nuxt/hooks/chain-team-phases.sh +109 -0
  125. package/presets/opencode/nuxt/team/README.md +10 -0
  126. package/presets/opencode/php-hexagonal/adapter-map.json +1 -1
  127. package/presets/opencode/php-hexagonal/hooks/chain-team-phases.sh +109 -0
  128. package/presets/opencode/php-hexagonal/team/README.md +10 -0
  129. package/presets/opencode/php-laravel/adapter-map.json +1 -1
  130. package/presets/opencode/php-laravel/hooks/chain-team-phases.sh +109 -0
  131. package/presets/opencode/php-laravel/team/README.md +10 -0
  132. package/presets/opencode/svelte/adapter-map.json +1 -1
  133. package/presets/opencode/svelte/hooks/chain-team-phases.sh +109 -0
  134. package/presets/opencode/svelte/team/README.md +10 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.2.53
4
+
5
+ ### The team runtime gains a rebuildable SQLite projection and a local dashboard
6
+
7
+ - **Files stay authoritative.** A new `team-db` module family (six scripts in `.ai.local/scripts/`) projects `.ai.local/team/` into `.ai.local/team/team.db`. The two write seams — the chain hook after its file writes and `manifest.mjs` after a receipt — run one bounded 5 s child; a failure logs one line and never fails a file write. `AI_RULES_TEAM_DB_DISABLE=1` is the kill switch.
8
+ - **Read-only surface.** `team-db.mjs serve` binds loopback by default and serves a no-build dashboard and a frozen OpenAPI 3.1 document (`docs/openapi/team-db.v1.json`). `POST /api/v1/sync` is the only mutation; every other route is `GET`/`HEAD`.
9
+ - **Install surface.** `init` now seeds thirteen engine scripts and ignores `team.db`, `team.db-wal`, `team.db-shm`, and `team-db-errors.log` in `.ai.local/.gitignore`; the consumer root `.gitignore` is untouched. `engines` stays `>=18`: `node:sqlite` is required only at runtime (Node 22.13.0+), with a file-only fallback and no dependency change.
10
+ - **Gates.** `yarn test:team-db` runs the schema, project, dual-write, contract, API, security, dashboard, concurrency, and FAIL-direction fixture suites; `check-preset-structure.sh` wires every one. Concurrency covers two first projections on a missing database, mixed writers/readers, `SIGKILL` recovery, a held lock, and the hook budget.
11
+ - **Docs.** [`docs/TEAM-DB.md`](docs/TEAM-DB.md) states the behavior contract, the Node floor with its release-note citation, the exact environment names, retention, privacy, and rollback.
12
+
13
+ ### MCP pack
14
+
15
+ - **Runtime in the package.** The GitLab wrapper over `@zereight/mcp-gitlab`, the Yandex stdio→HTTP proxy, and the `yc` IAM refresh move into `mcp/**` and ship in `files`; no consumer copy and no new dependency. `engines` stays `>=18`, and every `mcp` command stops on Node < 20 with one next step.
16
+ - **One command per provider.** `ai-rules mcp setup|add|remove|doctor|refresh|run` — `setup` prompts once, registers only the clients present, and ends with a four-area doctor; `doctor` exits 0/1/2 and names one next command per failure; `refresh` re-runs the Yandex browser login.
17
+ - **Four clients.** Cursor, Claude Code, Mavis, and OpenCode get their native shape from one registry, pinned to the exact installed version: a re-run is byte-identical, foreign entries are preserved, and no token or absolute path enters a config.
18
+ - **Credentials.** GitLab URL + token live in `.ai-rules/mcp/credentials.env` (`0600`, self-ignored); Yandex writes only non-secret settings and keeps the IAM token in the `yc` profile.
19
+ - **Opt-in.** `init` ships no entry for these servers — a credential-less server would fail in every consumer. Setup guide: [`docs/MCP-SETUP.md`](docs/MCP-SETUP.md).
20
+
21
+ ### Upgrade
22
+
23
+ - Run `npx @bonesofspring/ai-rules update` to refresh the managed preset files and seed the thirteen `.ai.local/scripts/` modules.
24
+ - `team-db` needs Node 22.13.0+ at runtime for `node:sqlite`; older runtimes stay file-only. `AI_RULES_TEAM_DB_DISABLE=1` disables the projection.
25
+ - MCP servers are opt-in: run `npx @bonesofspring/ai-rules@latest mcp setup gitlab` or `... mcp setup yandex`. `init` ships no credential-less entry; MCP commands need Node 20+.
26
+
3
27
  ## 0.2.52
4
28
 
5
29
  ### The `next` preset catches up with Next 16 and its own gates
package/README.md CHANGED
@@ -23,7 +23,7 @@ Run `init` from the **app root** (`--cwd` if needed). Default `--preset` is `nex
23
23
  | Root agents | `REPO_AGENTS.md` → `AGENTS.md` (same file on all four) | | | |
24
24
  | `/task` artifacts | **`.ai.local/team/`** (shared; templates refreshed; `tasks/<slug>/` never overwritten) | | | |
25
25
  | Template drift | **`.ai.local/.template-base.json`** (shared; one record per tree of files that hold a shipped template byte; `update` prints one drift line, `update --merge-ai-local` fast-forwards a file only when its recorded base still matches and reports the rest) | | | |
26
- | Self-learning engine | **`.ai.local/scripts/`** (shared; seven scripts — the engine plus `manifest.mjs`, the manifest writer; existing files never overwritten) | | | |
26
+ | Self-learning engine | **`.ai.local/scripts/`** (shared; thirteen scripts — the engine, `manifest.mjs`, and the six `team-db*.mjs` projection modules; existing files never overwritten) | | | |
27
27
  | Specs seed | `docs/specs/` copied only if the directory is **absent** | | | |
28
28
 
29
29
  The engine is the in-task self-learning loop: `.ai.local/signals.jsonl` → `.ai.local/rule-changes.jsonl` →
@@ -38,8 +38,9 @@ node .ai.local/scripts/run.mjs --strict # read-only check: exit 1 when capture
38
38
 
39
39
  `init` seeds the engine with **skip-if-exists** — a modified `run.mjs` stays yours and is reported as kept; there is no
40
40
  `--force`. Re-running `init` does not update a seeded module, so delete the file to pick up a newer engine. The seeded
41
- tree is byte-identical to `presets/_shared/ai-local/scripts/`, and `.ai.local/.gitignore` (created only when absent)
42
- ignores `*.lock`, `*.tmp`, and `.rollback/`; the root `.gitignore` is never edited.
41
+ tree is byte-identical to `presets/_shared/ai-local/scripts/`, and `.ai.local/.gitignore` (created when absent, missing
42
+ required lines appended to an existing file) ignores `*.lock`, `*.tmp`, `.rollback/`, `team.db`, `team.db-wal`,
43
+ `team.db-shm`, and `team-db-errors.log`; the root `.gitignore` is never edited.
43
44
 
44
45
  The same seeding ships `manifest.mjs`, the writer for `.ai.local/team/tasks/<slug>/artifact-manifest.json`:
45
46
 
@@ -52,6 +53,28 @@ node .ai.local/scripts/manifest.mjs check --slug <slug>
52
53
 
53
54
  Producers merge their receipt with it — the manifest is a whole-file merge target, never a fragment edit.
54
55
 
56
+ ### SQLite projection
57
+
58
+ The same seeded tree carries a rebuildable projection of `.ai.local/team/` into
59
+ `.ai.local/team/team.db` (SQLite, WAL). The **files stay authoritative**: the database is
60
+ derived, git-ignored, and safe to delete. The two write seams (the chain hook after its
61
+ file writes, and `manifest.mjs` after a receipt is printed) run a bounded 5 s child; a
62
+ failure is written to `team-db-errors.log` and never fails a file write.
63
+
64
+ ```bash
65
+ node .ai.local/scripts/team-db.mjs init # create/migrate the database
66
+ node .ai.local/scripts/team-db.mjs sync # full backfill + reconciliation
67
+ node .ai.local/scripts/team-db.mjs sync --slug <slug> # the bounded hook-shaped projection
68
+ node .ai.local/scripts/team-db.mjs check # schema, fingerprint, integrity
69
+ node .ai.local/scripts/team-db.mjs serve # http://127.0.0.1:4178 + dashboard
70
+ AI_RULES_TEAM_DB_DISABLE=1 node .ai.local/scripts/team-db.mjs sync # no-op: file-only mode
71
+ ```
72
+
73
+ Requires Node 22.13.0+ for `node:sqlite`; older runtimes stay file-only with one line and exit 0.
74
+ `team-db.mjs serve` binds loopback only, is read-only apart from `POST /api/v1/sync`, and
75
+ serves the OpenAPI 3.1 document at `/openapi.json`. Details, environment names, retention,
76
+ and rollback: [`docs/TEAM-DB.md`](docs/TEAM-DB.md).
77
+
55
78
  Living exceptions: **`.ai.local/rules/`** and **`.ai.local/conventions.md`** (`init` does not overwrite them). The only exception is opt-in and hash-gated: `update --merge-ai-local` fast-forwards a file whose recorded base in `.ai.local/.template-base.json` still matches, keeps an edited file byte-identical, and diverts its unified diff to `.ai.local/.rollback/template-drift/` (never a `.md`, never a conflict marker). Plain `update` only prints one drift line and records the files that already hold the shipped template; your own bytes never become a base. Overlay does not load `.ai.local/team/**` as rules; see [`docs/LOCAL-OVERLAY.md`](docs/LOCAL-OVERLAY.md#template-drift).
56
79
 
57
80
  **`clean <tool>`** removes only CLI-managed paths under that tool root. It does **not** wipe the whole `.cursor/` / `.claude/` tree, and it **never** deletes `.ai.local/`. Root `AGENTS.md` is removed only when no other tool install remains.
@@ -99,6 +122,7 @@ Every installed preset ships requestable `anti-hallucination-contract` (not alwa
99
122
  - Layers: [`presets/_shared/README.md`](presets/_shared/README.md)
100
123
  - Guide: [`docs/PRESET-CONTRIBUTION.md`](docs/PRESET-CONTRIBUTION.md)
101
124
  - Overlay: [`docs/LOCAL-OVERLAY.md`](docs/LOCAL-OVERLAY.md)
125
+ - MCP setup: [`docs/MCP-SETUP.md`](docs/MCP-SETUP.md)
102
126
  - Dogfood: [`scripts/sync-dogfood-cursor.sh`](scripts/sync-dogfood-cursor.sh), [`scripts/sync-dogfood-claude.sh`](scripts/sync-dogfood-claude.sh), [`scripts/sync-dogfood-mavis.sh`](scripts/sync-dogfood-mavis.sh), [`scripts/sync-dogfood-opencode.sh`](scripts/sync-dogfood-opencode.sh) — seeds `.ai.local/team`, preserves slugs
103
127
  - Gates: `yarn check:preset-structure`
104
128