kennel 0.2.33 → 0.2.34
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/package.json +4 -2
- package/scripts/verify-config.mjs +59 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kennel",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.34",
|
|
4
4
|
"description": "Open-source pop-up previews for AI output: markdown, HTML artifacts, email, images, code, tables, notes, and calendars, from the terminal or your agent session.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -43,13 +43,15 @@
|
|
|
43
43
|
"bin",
|
|
44
44
|
"dist",
|
|
45
45
|
"schemas",
|
|
46
|
+
"scripts/verify-config.mjs",
|
|
46
47
|
"templates",
|
|
47
48
|
"web"
|
|
48
49
|
],
|
|
49
50
|
"scripts": {
|
|
50
51
|
"build": "node scripts/build.mjs",
|
|
51
52
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
52
|
-
"check": "npm run build && node --check bin/kennel.mjs && node --check dist/main.js && npm run smoke",
|
|
53
|
+
"check": "npm run build && node --check bin/kennel.mjs && node --check dist/main.js && npm run smoke && npm run verify:config",
|
|
54
|
+
"verify:config": "node scripts/verify-config.mjs .",
|
|
53
55
|
"smoke": "node --input-type=module -e \"await import('./dist/mcp/generate.js')\"",
|
|
54
56
|
"prepack": "node scripts/build.mjs",
|
|
55
57
|
"pack:check": "bun pm pack --dry-run",
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import assert from "node:assert/strict"
|
|
2
|
+
import { spawnSync } from "node:child_process"
|
|
3
|
+
import { mkdtemp, mkdir, readFile, rm, writeFile } from "node:fs/promises"
|
|
4
|
+
import { createRequire } from "node:module"
|
|
5
|
+
import { tmpdir } from "node:os"
|
|
6
|
+
import { join, resolve } from "node:path"
|
|
7
|
+
|
|
8
|
+
// Run against the built checkout, a packed install, or a released npm install.
|
|
9
|
+
// Usage: node packages/cli/scripts/verify-config.mjs <CLI package directory>
|
|
10
|
+
const [directory] = process.argv.slice(2)
|
|
11
|
+
if (!directory) throw new Error("Supply the CLI package directory")
|
|
12
|
+
const root = resolve(directory)
|
|
13
|
+
const require = createRequire(join(root, "package.json"))
|
|
14
|
+
const { z } = require("zod")
|
|
15
|
+
const schema = JSON.parse(await readFile(join(root, "schemas/config.schema.json"), "utf8"))
|
|
16
|
+
assert.equal(schema.$id, "https://raggle.co/kennel/config.json")
|
|
17
|
+
const validator = z.fromJSONSchema(schema)
|
|
18
|
+
const temporary = await mkdtemp(join(tmpdir(), "kennel-config-verify-"))
|
|
19
|
+
|
|
20
|
+
try {
|
|
21
|
+
const configHome = join(temporary, "config")
|
|
22
|
+
const configFile = join(configHome, "kennel/config.json")
|
|
23
|
+
await mkdir(join(configHome, "kennel"), { recursive: true })
|
|
24
|
+
const config = {
|
|
25
|
+
$schema: schema.$id,
|
|
26
|
+
allowedRoots: [temporary],
|
|
27
|
+
externalPlugins: [],
|
|
28
|
+
repositoryNotes: { enabled: true },
|
|
29
|
+
}
|
|
30
|
+
const cases = [
|
|
31
|
+
{ name: "repository notes enabled", value: config, valid: true },
|
|
32
|
+
{ name: "invalid repository notes flag", value: { ...config, repositoryNotes: { enabled: "true" } }, valid: false, field: "repositoryNotes" },
|
|
33
|
+
{ name: "unknown setting", value: { ...config, unknownSetting: true }, valid: false, field: "unknownSetting" },
|
|
34
|
+
]
|
|
35
|
+
|
|
36
|
+
for (const { name, value, valid, field } of cases) {
|
|
37
|
+
assert.equal(validator.safeParse(value).success, valid, `${name}: packaged schema verdict`)
|
|
38
|
+
await writeFile(configFile, `${JSON.stringify(value, null, 2)}\n`)
|
|
39
|
+
const result = spawnSync(process.execPath, [join(root, "bin/kennel.mjs"), "plugin", "list"], {
|
|
40
|
+
cwd: temporary,
|
|
41
|
+
env: { ...process.env, XDG_CONFIG_HOME: configHome, XDG_CACHE_HOME: join(temporary, "cache") },
|
|
42
|
+
encoding: "utf8",
|
|
43
|
+
timeout: 30_000,
|
|
44
|
+
})
|
|
45
|
+
if (result.error) throw result.error
|
|
46
|
+
assert.equal(result.signal, null, `${name}: CLI terminated by signal`)
|
|
47
|
+
if (valid) {
|
|
48
|
+
assert.equal(result.status, 0, `${name}: ${result.stderr}`)
|
|
49
|
+
assert.match(result.stdout, /No external plugins installed\./)
|
|
50
|
+
} else {
|
|
51
|
+
assert.equal(result.status, 2, `${name}: CLI must reject invalid config`)
|
|
52
|
+
assert.ok(result.stderr.includes(`Invalid Kennel config at ${configFile}`), `${name}: expected config validation error, got ${result.stderr}`)
|
|
53
|
+
assert.ok(result.stderr.includes(field), `${name}: error must identify ${field}`)
|
|
54
|
+
}
|
|
55
|
+
console.log(`PASS: ${name} (packaged schema and installed CLI)`)
|
|
56
|
+
}
|
|
57
|
+
} finally {
|
|
58
|
+
await rm(temporary, { recursive: true, force: true })
|
|
59
|
+
}
|