@polderlabs/bizar 10.23.1 → 10.23.2
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/cli/commands/models.mjs
CHANGED
|
@@ -1022,6 +1022,12 @@ export function configuredFallbackModels(router) {
|
|
|
1022
1022
|
return filterCandidatesByDisabledProviders(ids, disabled).kept;
|
|
1023
1023
|
}
|
|
1024
1024
|
|
|
1025
|
+
export function configuredEnabledModels(router) {
|
|
1026
|
+
const disabled = extractDisabledProviders(router);
|
|
1027
|
+
const selected = currentSelection(router, { disabledProviders: disabled }).models;
|
|
1028
|
+
return selected.length > 0 ? selected : configuredFallbackModels(router);
|
|
1029
|
+
}
|
|
1030
|
+
|
|
1025
1031
|
/**
|
|
1026
1032
|
* Derive a human-readable label for a model ID. Used to populate the
|
|
1027
1033
|
* `modelPicker` array in settings.json so Claude Code's `/model` picker
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
* - 7 rules mirrored from `config/rules/` → `~/.claude/rules/`
|
|
16
16
|
* - guarded autonomy hooks, including approval, compaction, and advisor context
|
|
17
17
|
* - shipped slash commands in `~/.claude/commands/`
|
|
18
|
-
* - permissions
|
|
18
|
+
* - permissions follow the current hook-enforced policy
|
|
19
19
|
* - the complete hook-enforced approval floor is wired
|
|
20
20
|
* - ~/.config/bizar/ exists (loop/runtime state)
|
|
21
21
|
*
|
|
@@ -27,7 +27,7 @@ import { existsSync, readFileSync, readdirSync, statSync } from 'node:fs';
|
|
|
27
27
|
import { join } from 'node:path';
|
|
28
28
|
import { spawnSync } from 'node:child_process';
|
|
29
29
|
import { resolveBizarHome, resolveClaudeConfigDir, resolveGlobalModelRouter } from '../config-paths.mjs';
|
|
30
|
-
import {
|
|
30
|
+
import { configuredEnabledModels, listModels, resolveEndpoint } from './models.mjs';
|
|
31
31
|
|
|
32
32
|
function claudeDir() { return resolveClaudeConfigDir(); }
|
|
33
33
|
function bizarHome() { return resolveBizarHome(); }
|
|
@@ -159,14 +159,14 @@ const CHECKS = {
|
|
|
159
159
|
return `MCP command OK: ${actual}`;
|
|
160
160
|
},
|
|
161
161
|
|
|
162
|
-
'permissions-
|
|
162
|
+
'permissions-policy-current': async () => {
|
|
163
163
|
const cfg = readJsonSafe(settingsJsonPath());
|
|
164
164
|
const allow = cfg?.permissions?.allow || [];
|
|
165
|
-
const
|
|
166
|
-
if (
|
|
167
|
-
throw new Error('
|
|
165
|
+
const staleWildcard = allow.find((p) => typeof p === 'string' && p === 'mcp__*');
|
|
166
|
+
if (staleWildcard) {
|
|
167
|
+
throw new Error('legacy mcp__* wildcard remains in permissions.allow');
|
|
168
168
|
}
|
|
169
|
-
return
|
|
169
|
+
return `hook-enforced policy active (${allow.length} explicit allow entries)`;
|
|
170
170
|
},
|
|
171
171
|
|
|
172
172
|
'permissions-deny-dangerous': async () => {
|
|
@@ -188,8 +188,9 @@ const CHECKS = {
|
|
|
188
188
|
if (!Array.isArray(arr) || arr.length === 0) {
|
|
189
189
|
throw new Error('no PreToolUse hooks wired in settings.json');
|
|
190
190
|
}
|
|
191
|
-
const m = arr.find((h) => h.matcher
|
|
192
|
-
|
|
191
|
+
const m = arr.find((h) => h.matcher === '*'
|
|
192
|
+
|| (h.matcher && h.matcher.includes('Write') && h.matcher.includes('Edit')));
|
|
193
|
+
if (!m) throw new Error('PreToolUse matcher does not cover Write and Edit');
|
|
193
194
|
return `${arr.length} PreToolUse hook(s) wired (matcher: ${m.matcher})`;
|
|
194
195
|
},
|
|
195
196
|
|
|
@@ -348,24 +349,21 @@ const CHECKS = {
|
|
|
348
349
|
},
|
|
349
350
|
|
|
350
351
|
'provider-reachable': async () => {
|
|
351
|
-
const
|
|
352
|
-
if (!
|
|
352
|
+
const { endpoint, authToken } = resolveEndpoint();
|
|
353
|
+
if (!endpoint) {
|
|
353
354
|
const path = resolveGlobalModelRouter();
|
|
354
355
|
const router = readJsonSafe(path);
|
|
355
|
-
const fallback = router ?
|
|
356
|
+
const fallback = router ? configuredEnabledModels(router) : [];
|
|
356
357
|
if (fallback.length === 0) {
|
|
357
358
|
throw new Error(`no gateway URL or enabled configured model in ${path}; implicit defaults are prohibited`);
|
|
358
359
|
}
|
|
359
360
|
return `no gateway URL; explicit configured fallback is ${fallback[0]}`;
|
|
360
361
|
}
|
|
361
|
-
const ac = new AbortController();
|
|
362
|
-
const timer = setTimeout(() => ac.abort(), 4000);
|
|
363
362
|
try {
|
|
364
|
-
const
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
clearTimeout(timer);
|
|
363
|
+
const models = await listModels({ endpoint, authToken, timeoutMs: 4000 });
|
|
364
|
+
return `provider reachable at ${endpoint} (${models.length} models)`;
|
|
365
|
+
} catch (err) {
|
|
366
|
+
throw new Error(`provider at ${endpoint} unreachable: ${err.message ?? err}`);
|
|
369
367
|
}
|
|
370
368
|
},
|
|
371
369
|
|
|
@@ -387,7 +385,7 @@ const CHECK_ORDER = [
|
|
|
387
385
|
'claude-settings-schema',
|
|
388
386
|
'mcp-server-bizar-registered',
|
|
389
387
|
'mcp-server-bizar-command',
|
|
390
|
-
'permissions-
|
|
388
|
+
'permissions-policy-current',
|
|
391
389
|
'permissions-deny-dangerous',
|
|
392
390
|
'hooks-pretooluse-wired',
|
|
393
391
|
'hooks-posttooluse-wired',
|
|
@@ -431,7 +429,7 @@ export function showValidateHelp() {
|
|
|
431
429
|
integrated with Claude Code:
|
|
432
430
|
• claude CLI reachable + version
|
|
433
431
|
• ~/.claude/settings.json parses + Bizar MCP server registered
|
|
434
|
-
• permissions
|
|
432
|
+
• permissions follow the current hook-enforced policy
|
|
435
433
|
• hook-enforced approval and destructive-action floor
|
|
436
434
|
• all 14 Claude Code lifecycle events wired in settings.json
|
|
437
435
|
• all 16 agent files installed with unique Claude Code names
|
package/cli/doctor.mjs
CHANGED
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
REQUIRED_COMMANDS,
|
|
42
42
|
REQUIRED_HOOKS,
|
|
43
43
|
} from './commands/validate.mjs';
|
|
44
|
-
import {
|
|
44
|
+
import { configuredEnabledModels, listModels, resolveEndpoint } from './commands/models.mjs';
|
|
45
45
|
|
|
46
46
|
const REQUIRED_RULES = [
|
|
47
47
|
'general.md', 'git.md', 'javascript.md', 'python.md',
|
|
@@ -181,8 +181,8 @@ async function checkBizarHome() {
|
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
async function checkProviderReachable() {
|
|
184
|
-
const
|
|
185
|
-
if (!
|
|
184
|
+
const { endpoint, authToken } = resolveEndpoint();
|
|
185
|
+
if (!endpoint) {
|
|
186
186
|
const routerPath = resolveGlobalModelRouter();
|
|
187
187
|
let router;
|
|
188
188
|
try {
|
|
@@ -190,22 +190,18 @@ async function checkProviderReachable() {
|
|
|
190
190
|
} catch {
|
|
191
191
|
throw new Error(`no provider URL and no readable global model router at ${routerPath}`);
|
|
192
192
|
}
|
|
193
|
-
const configured =
|
|
193
|
+
const configured = configuredEnabledModels(router);
|
|
194
194
|
if (configured.length === 0) {
|
|
195
195
|
throw new Error('no enabled configured model; implicit provider defaults are prohibited');
|
|
196
196
|
}
|
|
197
197
|
return `no gateway URL; explicit configured fallback is ${configured[0]}`;
|
|
198
198
|
}
|
|
199
|
-
let res;
|
|
200
199
|
try {
|
|
201
|
-
|
|
200
|
+
const models = await listModels({ endpoint, authToken, timeoutMs: 3000 });
|
|
201
|
+
return `provider at ${endpoint} ok (${models.length} models)`;
|
|
202
202
|
} catch (err) {
|
|
203
|
-
throw new Error(`provider at ${
|
|
203
|
+
throw new Error(`provider at ${endpoint} unreachable: ${err.message ?? err}`);
|
|
204
204
|
}
|
|
205
|
-
if (!res.ok) {
|
|
206
|
-
throw new Error(`provider at ${url} responded HTTP ${res.status}`);
|
|
207
|
-
}
|
|
208
|
-
return `provider at ${url} ok`;
|
|
209
205
|
}
|
|
210
206
|
|
|
211
207
|
// ── runner ──────────────────────────────────────────────────────────────────
|
package/package.json
CHANGED