caveat-cli 0.18.0 → 0.19.1

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
@@ -1,48 +1,72 @@
1
1
  <p align="center">
2
- <img src="https://raw.githubusercontent.com/kitepon-rgb/Caveat/main/.github/og.png" alt="Caveat — long-term memory layer for coding agents" width="100%">
2
+ <img src="https://raw.githubusercontent.com/kitepon/Caveat/main/.github/og.png" alt="Caveat — long-term memory layer for coding agents" width="100%">
3
3
  </p>
4
4
 
5
5
  # Caveat
6
6
 
7
7
  [![npm](https://img.shields.io/npm/v/caveat-cli?color=cb3837&label=caveat-cli)](https://www.npmjs.com/package/caveat-cli)
8
- [![CI](https://github.com/kitepon-rgb/Caveat/actions/workflows/ci.yml/badge.svg)](https://github.com/kitepon-rgb/Caveat/actions/workflows/ci.yml)
9
- [![license](https://img.shields.io/npm/l/caveat-cli?color=blue)](https://github.com/kitepon-rgb/Caveat/blob/main/LICENSE)
8
+ [![CI](https://github.com/kitepon/Caveat/actions/workflows/ci.yml/badge.svg)](https://github.com/kitepon/Caveat/actions/workflows/ci.yml)
9
+ [![license](https://img.shields.io/npm/l/caveat-cli?color=blue)](https://github.com/kitepon/Caveat/blob/main/LICENSE)
10
10
 
11
- > **Stop rediscovering the same trap.** Caveat is a long-term memory layer for Claude Code and Codex: record a hard-won external-spec quirk or repo-specific oddity once, and the relevant note surfaces before an AI repeats it.
11
+ > **Stop rediscovering the same trap.** Caveat is a long-term memory layer for Claude Code, Codex, and Cursor: record a hard-won external-spec quirk or repo-specific oddity once, and the relevant note surfaces before an AI repeats it.
12
12
 
13
- 🇯🇵 **日本語版**: [README.ja.md](https://github.com/kitepon-rgb/Caveat/blob/main/README.ja.md)
13
+ 🇯🇵 **日本語版**: [README.ja.md](https://github.com/kitepon/Caveat/blob/main/README.ja.md)
14
14
 
15
15
  Built and maintained by [Quo](https://x.com/QLyun35332) at [kitepon.dev](https://kitepon.dev/en).
16
16
 
17
- **Source / full docs**: [github.com/kitepon-rgb/Caveat](https://github.com/kitepon-rgb/Caveat)
17
+ **Source / full docs**: [github.com/kitepon/Caveat](https://github.com/kitepon/Caveat)
18
18
 
19
19
  ## Install
20
20
 
21
21
  ```sh
22
22
  npm install -g caveat-cli
23
- caveat init # Claude Code MCP + hooks
24
- caveat codex-hook install # optional: native Codex hooks
25
- caveat cursor-hook install # optional: native Cursor hooks
23
+ caveat init # state + available Claude/Codex/Cursor integrations
26
24
  ```
27
25
 
28
26
  On macOS with Homebrew Node, Caveat installs hook commands through the stable
29
27
  `/opt/homebrew/bin/node` symlink when it points at the current Node binary. This
30
- keeps Claude Code and Codex hooks working after Homebrew moves Node between
28
+ keeps Claude Code, Codex, and Cursor hooks working after Homebrew moves Node between
31
29
  `/opt/homebrew/Cellar/node/<version>/...` directories.
32
30
 
33
- `caveat init` (idempotent, `--dry-run` supported) does the Claude Code setup:
31
+ `caveat init` (idempotent, `--dry-run` supported) does the product setup:
34
32
 
35
33
  1. Scaffolds `~/.caveat/own/` (your personal knowledge repo) + `~/.caveat/index/caveat.db`
36
- 2. Registers the MCP server with Claude Code (`claude mcp add --scope user`)
34
+ 2. Claudeのuser設定へMCPを登録し、既存の環境変数と他の登録を保持
37
35
  3. Merges `UserPromptSubmit` / `PostToolUse` / `PostToolUseFailure` / `Stop` hooks into `~/.claude/settings.json` (existing entries preserved, backup written before any change)
36
+ 4. Installs product-owned Codex and Cursor hooks when those hosts are available
37
+
38
+ 同じ`init`がCodex・Grok・CursorへもMCPを登録します。CodexはCLIまたは設定ディレクトリ、Grok・Cursorは
39
+ 設定ディレクトリの存在で導入対象を決めます。`CODEX_HOME` / `GROK_HOME` / `CURSOR_HOME` /
40
+ `CLAUDE_CONFIG_DIR`を尊重し、既存の環境変数・timeout・無効化指定・他の登録を保持します。
41
+ 設定変更前のバックアップと読戻しを行い、MCP登録失敗は非0終了します。
42
+ `--skip-codex-hook` / `--skip-cursor-hook`はhookだけを省略します。
43
+
44
+ private remoteの初期化・同期は`caveat init --sync --yes`で完結します。端末でも質問を挟まず、
45
+ 公開ミラーは明示しなければ変更しません。新規remoteの作成には認証済みの`gh`が必要です。
46
+ It uses the account already authenticated in `gh`, is idempotent, and exits
47
+ non-zero if the explicitly requested sync fails. Callers do not inspect product
48
+ state or run separate Caveat hook installers around this entry.
38
49
 
39
50
  Opt-out: `--skip-claude`. `caveat uninstall` reverses the Claude Code changes without touching `~/.caveat/`. **No central DB is auto-subscribed** — add knowledge sources explicitly with `caveat community add`.
40
51
 
41
- For Codex, run `caveat codex-hook diagnostics` first if you want a health check,
52
+ For a targeted Codex repair, run `caveat codex-hook diagnostics` first,
42
53
  then `caveat codex-hook install`. It registers Caveat-owned
43
54
  `UserPromptSubmit`, `PostToolUse`, and `Stop` entries in `~/.codex/hooks.json`
44
55
  and enables Codex's native hook runtime.
45
56
 
57
+ For a targeted Cursor repair, run `caveat cursor-hook install`. It upserts Caveat-owned
58
+ `beforeSubmitPrompt`, `postToolUse`, `postToolUseFailure`, and `stop` entries
59
+ in `~/.cursor/hooks.json` while preserving unrelated hooks. Use
60
+ `caveat cursor-hook diagnostics` to inspect the installed contract.
61
+
62
+ Automation uses the aggregate product contract instead:
63
+ `caveat factory-diagnostics --json --require-connector cursor`. Its versioned
64
+ schema, top-level `overall.status`, and exit status are the complete gate. The
65
+ output also exposes `connectors.cursor.compatibility_status` for diagnosis,
66
+ but callers do not duplicate Caveat's Cursor event set, command rules, or
67
+ timeout checks. Without `--require-connector cursor`, the v1 aggregate keeps
68
+ its existing Claude/Codex readiness semantics.
69
+
46
70
  With either host enabled, Caveat surfaces matching entries at three moments:
47
71
  before prompts, after failed tools, and after struggle-heavy sessions. Stop
48
72
  reminders are queued for the next context-capable hook tick so the agent's final
@@ -61,29 +85,38 @@ caveat pull # community pull + re-index everything
61
85
  caveat serve # http://localhost:4242 read-only portal
62
86
  caveat uninstall # reverse `caveat init` Claude integration
63
87
  caveat codex-hook diagnostics # inspect Codex hook availability/install state
88
+ caveat factory-diagnostics --json --require-connector cursor
89
+ # machine gate for a host that requires Cursor
64
90
  ```
65
91
 
66
- ## Sharing with a team
67
-
68
- There is no `caveat push` (since v0.7). To share with teammates, use plain git:
92
+ ## Sharing: two boundaries, two commands
69
93
 
70
- 1. Create a GitHub repo (private or public), e.g. `acme-corp/caveats`, with an `entries/` directory.
71
- 2. Either point your `knowledgeRepo` at that repo (write directly to it) or copy shareable entries into it by hand. Then `git push` as usual.
72
- 3. Each teammate runs `caveat community add https://github.com/acme-corp/caveats` once, and `caveat pull` to refresh.
94
+ - `caveat sync` synchronizes both private and public entries to an authenticated,
95
+ non-anonymously-readable private remote owned by you or your group.
96
+ - `caveat publish` writes only public entries to a separate public mirror. It
97
+ publishes a deterministic AES-256-GCM sealed bundle plus README metadata;
98
+ subscribers decrypt in-process with the configured keyserver.
73
99
 
74
- Trust is defined socially — by who has write access to your group repo — instead of by automated content gates on stranger PRs.
100
+ The publish scan fails closed if private content, an invalid destination, or
101
+ missing keyserver configuration is detected. Trust in a private source is still
102
+ social — subscribers choose which repository owners to trust.
75
103
 
76
104
  ## MCP tools (6)
77
105
 
78
- Exposed to Claude Code via the MCP server that `caveat init` registers:
106
+ `caveat init`が登録するMCPを通じて、Claude Code・Codex・Grok・Cursorから利用できます。
79
107
 
80
108
  `caveat_search`, `caveat_get`, `caveat_record`, `caveat_update`, `caveat_list_recent`, `caveat_pull`.
81
109
 
82
- Claude can autonomously pull subscribed-repo updates (safe, idempotent). Recording / updating writes to your local `~/.caveat/own/` only — sharing is done by you via `git push` to your group repo.
110
+ Claude can autonomously pull subscribed-repo updates (safe, idempotent).
111
+ Recording and updating writes locally; use `caveat sync` for the private
112
+ ownership boundary and `caveat publish` for the public sealed boundary.
83
113
 
84
- Codex uses native hooks rather than MCP for automatic surfacing. The optional
85
- `codex-sidecar` commands remain available for bounded second opinions, review,
86
- risk-check, and isolated work.
114
+ Codex and Cursor use native hooks rather than MCP for automatic surfacing. A
115
+ native reminder inspects an entry with
116
+ `caveat show <id> --source <source>`, then updates or creates Markdown in the
117
+ own knowledge repo and runs `caveat index`. Community entries are subscriptions
118
+ and are not edited locally. The optional `codex-sidecar` commands remain
119
+ available for bounded second opinions, review, risk-check, and isolated work.
87
120
 
88
121
  ## Pointing at a different knowledge repo
89
122
 
@@ -93,9 +126,26 @@ If you want `~/.caveat/own/` to live elsewhere (e.g. a git-tracked directory you
93
126
  { "knowledgeRepo": "/absolute/path/to/your/caveats-repo" }
94
127
  ```
95
128
 
129
+ ## Runtime error diagnostics (explicit opt-in)
130
+
131
+ Local runtime error collection is disabled by default. Enable it in the same
132
+ `~/.caveatrc.json` file while preserving any existing keys:
133
+
134
+ ```json
135
+ { "runtimeErrors": true }
136
+ ```
137
+
138
+ Use `caveat runtime-errors diagnostics --json` and
139
+ `caveat runtime-errors snapshot --json` to inspect it. The lifecycle commands
140
+ are `ack <cursor>`, `resolve <fingerprint>`, `reopen <fingerprint>`, and
141
+ `compact`; each requires `--json`. A missing key or any value other than the
142
+ boolean `true` keeps collection disabled. Runtime state lives under Caveat's
143
+ own state directory, independently of the knowledge index and host hook files.
144
+
96
145
  ## Requirements
97
146
 
98
147
  - Node 22.5+ (for built-in `node:sqlite`)
148
+ - WindowsではPowerShell 7(`pwsh.exe`)を使います。エラー収集用ストレージのACL処理も同じ入口です。
99
149
  - `git` for `caveat community add` / `caveat community pull`
100
150
  - Claude Code installed if you want Claude MCP / hooks integration. Without it, `caveat init --skip-claude` still provisions local state.
101
151
  - Codex installed if you want native Codex hooks via `caveat codex-hook install`.
@@ -104,12 +154,10 @@ If you want `~/.caveat/own/` to live elsewhere (e.g. a git-tracked directory you
104
154
  Release install smoke:
105
155
 
106
156
  ```sh
107
- npm uninstall -g caveat-cli
108
- npm install -g caveat-cli
157
+ npm install -g caveat-cli@latest
109
158
  caveat --version
110
- caveat init
111
- caveat codex-hook install
112
- caveat cursor-hook install
159
+ caveat init --sync --yes
160
+ caveat factory-diagnostics --json --require-connector cursor
113
161
  ```
114
162
 
115
163
  ## License