agent-wisdom 0.1.0 → 0.1.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/CHANGELOG.md CHANGED
@@ -9,6 +9,18 @@ versions are listed plainly.
9
9
 
10
10
  ## [Unreleased]
11
11
 
12
+ ## [0.1.1] - 2026-11-29
13
+
14
+ ### Fixed
15
+
16
+ - **The example Claude Code hook reads unusual file names as themselves.** It now lists staged paths with `git diff --cached --name-only -z`. Before, git quoted names with non-ASCII characters or quotes, so they were queried and logged as escaped text (`"r\303\251sum\303\251.md"`, stray quotes and backslashes), and a non-ASCII word such as `résumé` could not match as a whole word. Quote characters are also dropped when a name is split into words.
17
+ - **A large staged set no longer empties the query.** The hook gives git a 16 MiB output buffer. Before, more than 1 MiB of names killed git and the query fell back to the fixed words only.
18
+ - **The hook always exits 0.** Reading the hook input now sits inside the same error guard as everything else, so a broken input stream can never fail the hook.
19
+
20
+ ### Changed
21
+
22
+ - This is the first release published from CI through npm Trusted Publishing, with provenance. No change to the `wisdom` command.
23
+
12
24
  ## [0.1.0] - 2026-11-29
13
25
 
14
26
  First release. `wisdom` is a read-only command over a directory of conditional entries; it started as a read-path prototype inside a larger agent orchestrator and is now a standalone package.
@@ -141,19 +141,20 @@ export function pointFor(command) {
141
141
  return null;
142
142
  }
143
143
 
144
- /** Run git without a shell; returns trimmed stdout, or '' on any failure. */
144
+ /** Run git without a shell; returns raw stdout (callers trim or split it), or '' on any failure. */
145
145
  function git(args, cwd, env) {
146
146
  try {
147
- const r = spawnSync('git', args, { cwd, env, encoding: 'utf8', timeout: 2000, stdio: ['ignore', 'pipe', 'ignore'] });
148
- return r.status === 0 ? (r.stdout ?? '').trim() : '';
147
+ // maxBuffer: a large staged set must not kill git and drop every path word.
148
+ const r = spawnSync('git', args, { cwd, env, encoding: 'utf8', timeout: 2000, maxBuffer: 16 * 1024 * 1024, stdio: ['ignore', 'pipe', 'ignore'] });
149
+ return r.status === 0 ? (r.stdout ?? '') : '';
149
150
  } catch {
150
151
  return '';
151
152
  }
152
153
  }
153
154
 
154
- /** Words of a path or branch name: split on `/`, `.`, `-`, `_` and whitespace. */
155
+ /** Words of a path or branch name: split on `/`, `.`, `-`, `_`, whitespace and quote characters. */
155
156
  function wordsOf(text) {
156
- return text.split(/[\/._\-\s]+/).filter(Boolean);
157
+ return text.split(/[\/._\-\s"'`]+/).filter(Boolean);
157
158
  }
158
159
 
159
160
  /**
@@ -164,10 +165,11 @@ function wordsOf(text) {
164
165
  export function queryFor(point, cwd = process.cwd(), env = process.env) {
165
166
  const words = [];
166
167
  if (point === 'commit') {
167
- const paths = git(['diff', '--cached', '--name-only'], cwd, env).split('\n').filter(Boolean).slice(0, MAX_PATHS);
168
+ // -z: NUL-separated, unquoted names, so unusual characters arrive as themselves.
169
+ const paths = git(['diff', '--cached', '--name-only', '-z'], cwd, env).split('\0').filter(Boolean).slice(0, MAX_PATHS);
168
170
  for (const p of paths) words.push(...wordsOf(p));
169
171
  } else {
170
- const branch = git(['rev-parse', '--abbrev-ref', 'HEAD'], cwd, env);
172
+ const branch = git(['rev-parse', '--abbrev-ref', 'HEAD'], cwd, env).trim();
171
173
  if (branch && branch !== 'HEAD') words.push(...wordsOf(branch));
172
174
  }
173
175
  const unique = [...new Set(words)];
@@ -197,9 +199,9 @@ export function contextFor(payload, env = process.env) {
197
199
  }
198
200
 
199
201
  async function main() {
200
- let raw = '';
201
- for await (const chunk of process.stdin) raw += chunk;
202
202
  try {
203
+ let raw = '';
204
+ for await (const chunk of process.stdin) raw += chunk;
203
205
  const out = contextFor(JSON.parse(raw));
204
206
  if (out) process.stdout.write(out + '\n');
205
207
  } catch { /* fail open: a hook must never break the agent */ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "agent-wisdom",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "A read-only, deterministic store of conditional wisdom for AI agents: entries that say when they apply, when they fail, and what the opposite advice is. One dependency (yaml), no embeddings, no network.",
5
5
  "license": "MIT",
6
6
  "author": "Jean Ibarz",