specflow-cc 1.18.1 → 1.18.3
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 +17 -0
- package/bin/install.js +38 -4
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,23 @@ All notable changes to SpecFlow will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## [1.18.3] - 2026-04-11
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- **Auto-heal for users upgrading from 1.18.0 / 1.18.1** — the installer now scans `hooks.PostToolUse` during every install and removes any flat `{ type, command }` entry that references `context-monitor`. These entries were written by the buggy `1.18.0`/`1.18.1` installer and would otherwise linger in `settings.json` next to the newly written correct matcher group, still tripping Claude Code's `"Expected array, but received undefined"` parse error. Foreign flat entries (belonging to other tools) are left untouched — only entries unambiguously written by prior SpecFlow versions are removed.
|
|
13
|
+
- Three new smoke tests cover clean auto-heal, preservation of foreign flat entries, and the mixed state (pre-existing correct hook + flat broken duplicate).
|
|
14
|
+
|
|
15
|
+
## [1.18.2] - 2026-04-11
|
|
16
|
+
|
|
17
|
+
### Fixed
|
|
18
|
+
|
|
19
|
+
- **Installer no longer corrupts `settings.json`** — the installer wrote the `context-monitor` PostToolUse hook as a flat `{ type, command }` object, but Claude Code expects every `PostToolUse` entry to be a matcher group of the shape `{ matcher?, hooks: [{ type, command }] }`. Claude Code failed to parse `settings.json` with `"Expected array, but received undefined"`, and permission rules in the affected file were silently disabled
|
|
20
|
+
- The hook is now written as a proper matcher group
|
|
21
|
+
- Broken duplicate-detection fixed: the installer previously checked `entry.command` on the top-level entry, but in the correct format the command lives inside `entry.hooks[i].command`. As a result, every repeat install pushed a new (broken) entry. Detection now walks `entry.hooks[]` and matches the existing hook correctly, so repeat installs are idempotent
|
|
22
|
+
- Smoke test extended with four new cases: format assertion, presence check, repeat-install idempotency, and preservation of a pre-existing correctly-formatted hook
|
|
23
|
+
- **Heads-up:** if you already ran `1.18.0` or `1.18.1` against a `settings.json` that had a pre-existing PostToolUse hook, you may have a duplicate flat entry. Remove any `PostToolUse` element that lacks a `hooks:` array (i.e. has `type`/`command` at the top level) and re-run the installer
|
|
24
|
+
|
|
8
25
|
## [1.18.1] - 2026-04-11
|
|
9
26
|
|
|
10
27
|
### Fixed
|
package/bin/install.js
CHANGED
|
@@ -289,13 +289,47 @@ function finishInstall(settingsPath, settings, statuslineCommand, shouldInstallS
|
|
|
289
289
|
if (!settings.hooks) settings.hooks = {};
|
|
290
290
|
if (!settings.hooks.PostToolUse) settings.hooks.PostToolUse = [];
|
|
291
291
|
|
|
292
|
-
|
|
293
|
-
|
|
292
|
+
// Auto-heal: remove flat, broken context-monitor entries written by
|
|
293
|
+
// installer versions 1.18.0 and 1.18.1. Those versions pushed
|
|
294
|
+
// { type: "command", command: "..." } directly into PostToolUse, but
|
|
295
|
+
// Claude Code requires every PostToolUse entry to be a matcher group
|
|
296
|
+
// of shape { matcher?, hooks: [{ type, command }, ...] }. A flat entry
|
|
297
|
+
// makes Claude Code fail to parse settings.json entirely. Only entries
|
|
298
|
+
// that are unambiguously ours (flat + command references context-monitor)
|
|
299
|
+
// are removed; everything else is left untouched.
|
|
300
|
+
{
|
|
301
|
+
const before = settings.hooks.PostToolUse.length;
|
|
302
|
+
settings.hooks.PostToolUse = settings.hooks.PostToolUse.filter(entry => {
|
|
303
|
+
const isFlatBrokenMonitor =
|
|
304
|
+
entry &&
|
|
305
|
+
!Array.isArray(entry.hooks) &&
|
|
306
|
+
entry.type === 'command' &&
|
|
307
|
+
typeof entry.command === 'string' &&
|
|
308
|
+
entry.command.includes('context-monitor');
|
|
309
|
+
return !isFlatBrokenMonitor;
|
|
310
|
+
});
|
|
311
|
+
const removed = before - settings.hooks.PostToolUse.length;
|
|
312
|
+
if (removed > 0) {
|
|
313
|
+
const plural = removed === 1 ? 'y' : 'ies';
|
|
314
|
+
console.log(` ${green}✓${reset} Repaired settings.json (removed ${removed} broken hook entr${plural} from prior install)`);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// Claude Code expects each PostToolUse entry to be a matcher group:
|
|
319
|
+
// { matcher?: string, hooks: [{ type, command }, ...] }
|
|
320
|
+
// Detect an existing context-monitor hook inside any matcher group.
|
|
321
|
+
const hasMonitor = settings.hooks.PostToolUse.some(entry =>
|
|
322
|
+
Array.isArray(entry && entry.hooks) &&
|
|
323
|
+
entry.hooks.some(h => h && h.command && h.command.includes('context-monitor'))
|
|
294
324
|
);
|
|
295
325
|
if (!hasMonitor) {
|
|
296
326
|
settings.hooks.PostToolUse.push({
|
|
297
|
-
|
|
298
|
-
|
|
327
|
+
hooks: [
|
|
328
|
+
{
|
|
329
|
+
type: 'command',
|
|
330
|
+
command: monitorCommand
|
|
331
|
+
}
|
|
332
|
+
]
|
|
299
333
|
});
|
|
300
334
|
console.log(` ${green}✓${reset} Configured context monitor hook`);
|
|
301
335
|
}
|