impeccable 2.3.2 → 3.0.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.
@@ -0,0 +1,119 @@
1
+ /**
2
+ * CLI-side reader/writer for the unified `.impeccable` config.
3
+ *
4
+ * The CLI (published to npm) and the skill scripts (bundled into the install)
5
+ * live in separate trees and cannot share runtime code, so this duplicates a
6
+ * small slice of skill/scripts/hook-lib.mjs — the config-path layout and the
7
+ * `.git/info/exclude` handling. Keep the schema and exclude marker in sync if
8
+ * either side changes.
9
+ *
10
+ * Schema (config.json shared / config.local.json gitignored, per-developer):
11
+ * { "hook": { "consent": "accepted" | "declined", ... }, "updateCheck": bool }
12
+ */
13
+
14
+ import { existsSync, readFileSync, writeFileSync, mkdirSync, statSync } from 'node:fs';
15
+ import { join, dirname, isAbsolute } from 'node:path';
16
+
17
+ export function getConfigPath(root) {
18
+ return join(root, '.impeccable', 'config.json');
19
+ }
20
+
21
+ export function getLocalConfigPath(root) {
22
+ return join(root, '.impeccable', 'config.local.json');
23
+ }
24
+
25
+ function safeReadJson(filePath) {
26
+ try {
27
+ const raw = JSON.parse(readFileSync(filePath, 'utf-8'));
28
+ return raw && typeof raw === 'object' && !Array.isArray(raw) ? raw : null;
29
+ } catch {
30
+ return null;
31
+ }
32
+ }
33
+
34
+ function hookSection(raw) {
35
+ return raw && raw.hook && typeof raw.hook === 'object' && !Array.isArray(raw.hook) ? raw.hook : null;
36
+ }
37
+
38
+ /**
39
+ * The recorded design-hook decision: 'accepted' | 'declined' | undefined.
40
+ * config.local.json (per-developer) overrides config.json.
41
+ */
42
+ export function getHookConsent(root) {
43
+ let consent;
44
+ for (const filePath of [getConfigPath(root), getLocalConfigPath(root)]) {
45
+ const hook = hookSection(safeReadJson(filePath));
46
+ if (hook && (hook.consent === 'accepted' || hook.consent === 'declined')) consent = hook.consent;
47
+ }
48
+ return consent;
49
+ }
50
+
51
+ /**
52
+ * Persist the per-developer decision to config.local.json, preserving any
53
+ * sibling keys, and ensure the file is gitignored.
54
+ */
55
+ export function setHookConsent(root, value) {
56
+ const filePath = getLocalConfigPath(root);
57
+ const existing = safeReadJson(filePath) || {};
58
+ const hook = hookSection(existing) || {};
59
+ const next = { ...existing, hook: { ...hook, consent: value } };
60
+ mkdirSync(dirname(filePath), { recursive: true });
61
+ writeFileSync(filePath, `${JSON.stringify(next, null, 2)}\n`);
62
+ ensureConfigGitExclude(root);
63
+ return filePath;
64
+ }
65
+
66
+ const EXCLUDE_OPEN = '# impeccable-config-ignore-start';
67
+ const EXCLUDE_CLOSE = '# impeccable-config-ignore-end';
68
+ const EXCLUDE_PATTERNS = ['.impeccable/config.local.json'];
69
+
70
+ /**
71
+ * Add config.local.json to `.git/info/exclude` so a developer's decision is
72
+ * never committed. Idempotent via marker comments. Best-effort; returns false
73
+ * when there is no resolvable git dir.
74
+ */
75
+ export function ensureConfigGitExclude(root) {
76
+ try {
77
+ const gitDir = resolveGitDir(root);
78
+ if (!gitDir) return false;
79
+ const target = join(gitDir, 'info', 'exclude');
80
+ const existing = existsSync(target) ? readFileSync(target, 'utf-8') : '';
81
+ const block = [EXCLUDE_OPEN, ...EXCLUDE_PATTERNS, EXCLUDE_CLOSE].join('\n');
82
+ const markerRe = new RegExp(`${escapeRegExp(EXCLUDE_OPEN)}[\\s\\S]*?${escapeRegExp(EXCLUDE_CLOSE)}`);
83
+ let updated;
84
+ if (markerRe.test(existing)) {
85
+ updated = existing.replace(markerRe, block);
86
+ } else {
87
+ const prefix = existing.length === 0 ? '' : existing.endsWith('\n') ? existing : `${existing}\n`;
88
+ updated = `${prefix}${block}\n`;
89
+ }
90
+ if (updated !== existing) {
91
+ mkdirSync(dirname(target), { recursive: true });
92
+ writeFileSync(target, updated);
93
+ }
94
+ return true;
95
+ } catch {
96
+ return false;
97
+ }
98
+ }
99
+
100
+ function resolveGitDir(root) {
101
+ const dotGit = join(root, '.git');
102
+ if (!existsSync(dotGit)) return null;
103
+ try {
104
+ if (statSync(dotGit).isDirectory()) return dotGit;
105
+ // A `.git` file (worktree/submodule) points elsewhere: "gitdir: <path>".
106
+ const match = readFileSync(dotGit, 'utf-8').match(/gitdir:\s*(.+)/);
107
+ if (match) {
108
+ const resolved = match[1].trim();
109
+ return isAbsolute(resolved) ? resolved : join(root, resolved);
110
+ }
111
+ } catch {
112
+ /* fall through */
113
+ }
114
+ return null;
115
+ }
116
+
117
+ function escapeRegExp(value) {
118
+ return value.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
119
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "impeccable",
3
- "version": "2.3.2",
3
+ "version": "3.0.1",
4
4
  "author": "Paul Bakaus",
5
5
  "description": "Design skills, commands, and anti-pattern detection for AI coding agents",
6
6
  "keywords": [
@@ -24,7 +24,7 @@
24
24
  "url": "git+https://github.com/pbakaus/impeccable.git"
25
25
  },
26
26
  "engines": {
27
- "node": ">=18"
27
+ "node": ">=24"
28
28
  },
29
29
  "type": "module",
30
30
  "bin": {
@@ -40,21 +40,32 @@
40
40
  "LICENSE"
41
41
  ],
42
42
  "scripts": {
43
- "build:skills": "bun run scripts/build.js",
43
+ "build:skills": "bun run scripts/build.js --skip-root-sync",
44
+ "build:skills:release": "bun run scripts/build.js",
44
45
  "build:site": "npx astro build",
45
46
  "build": "bun run build:skills && bun run build:site && cp -R dist build/_data/dist",
47
+ "build:release": "bun run build:skills:release && bun run build:site && cp -R dist build/_data/dist",
46
48
  "build:browser": "node scripts/build-browser-detector.js",
47
49
  "build:extension": "node scripts/build-extension.js",
48
50
  "clean": "rm -rf dist build",
49
51
  "rebuild": "bun run clean && bun run build",
50
- "dev": "npx astro dev",
52
+ "rebuild:release": "bun run clean && bun run build:release",
53
+ "dev": "bun run scripts/gen-dev-api.mjs && npx astro dev",
51
54
  "preview": "bun run build && npx astro preview",
52
55
  "deploy": "bun run build && wrangler pages deploy build/",
53
- "test": "bun test tests/build.test.js tests/detect-antipatterns.test.js tests/windows-path-fix.test.js tests/lib/detector-bundle.test.js tests/lib/provider-blocks.test.js tests/lib/transformers/provider-blocks.test.js tests/lib/utils.test.js tests/lib/transformers/factory.test.js tests/lib/transformers/providers.test.js tests/skills-cli.test.js && node --test tests/critique-storage.test.mjs && node --test tests/detect-antipatterns-fixtures.test.mjs && node --test tests/detect-antipatterns-browser.test.mjs && node --test tests/cleanup-deprecated.test.mjs && node --test tests/impeccable-paths.test.mjs && node --test tests/live-wrap.test.mjs && node --test tests/live-wrap-buffer-aware.test.mjs && node --test tests/live-insert.test.mjs && node --test tests/live-insert-ui.test.mjs && node --test tests/live-event-validation.test.mjs && node --test tests/live-reference.test.mjs && node --test tests/live-e2e-agent-output.test.mjs && node --test tests/live-e2e-llm-agent.test.mjs && node --test tests/live-e2e-cli-options.test.mjs && node --test tests/live-accept.test.mjs && node --test tests/live-accept-scrub.test.mjs && node --test tests/live-commit-manual-edits.test.mjs && node --test tests/live-discard-manual-edits.test.mjs && node --test tests/live-manual-edits-buffer.test.mjs && node --test tests/live-inject.test.mjs && node --test tests/live-poll.test.mjs && node --test tests/live-poll-stream.test.mjs && node --test tests/live-server.test.mjs && node --test tests/live-copy-edit-agent.test.mjs && node --test tests/live-browser-regression.test.mjs && node --test tests/live-session-store.test.mjs && node --test tests/live-browser-session.test.mjs && node --test tests/live-browser-source.test.mjs && node --test tests/live-completion.test.mjs && node --test tests/live-recovery-commands.test.mjs && node --test tests/framework-fixtures.test.mjs",
54
- "test:cli-e2e": "IMPECCABLE_CLI_E2E=1 bun test tests/skills-cli.test.js",
55
- "test:live-e2e": "node --test --test-timeout=600000 tests/live-e2e.test.mjs",
56
- "test:live-e2e-agent": "node --test tests/live-e2e/agent-insert.test.mjs",
57
- "test:skill-behavior": "node --test --test-timeout=300000 tests/skill-behavior/scenarios.test.mjs",
56
+ "test": "node scripts/run-tests.mjs default",
57
+ "test:core": "node scripts/run-tests.mjs core",
58
+ "test:detector": "node scripts/run-tests.mjs detector",
59
+ "test:framework": "node scripts/run-tests.mjs framework",
60
+ "test:live": "node scripts/run-tests.mjs live",
61
+ "test:cli-e2e": "node scripts/run-tests.mjs cli-e2e",
62
+ "test:cli-remote-e2e": "node scripts/run-tests.mjs cli-remote-e2e",
63
+ "test:live-e2e": "node scripts/run-tests.mjs live-e2e",
64
+ "test:live-e2e-accept-cleanup": "node scripts/run-tests.mjs live-e2e-accept-cleanup",
65
+ "test:live-e2e-agent": "node scripts/run-tests.mjs live-e2e-agent",
66
+ "test:skill-behavior": "node scripts/run-tests.mjs skill-behavior",
67
+ "test:live-svelte-adapter-deepseek": "node scripts/run-tests.mjs live-svelte-adapter-deepseek",
68
+ "smoke:hooks": "node scripts/smoke-provider-hooks.mjs",
58
69
  "bench:detector": "node scripts/benchmark-detector.mjs",
59
70
  "bench:detector:browser": "node scripts/benchmark-detector.mjs --browser",
60
71
  "audit": "bun audit --audit-level=moderate",
@@ -67,25 +78,26 @@
67
78
  "og-image": "bun run scripts/generate-og-image.js"
68
79
  },
69
80
  "dependencies": {
70
- "css-select": "^5.2.2",
81
+ "css-select": "^7.0.0",
71
82
  "css-tree": "^3.2.1",
72
- "domutils": "^3.2.2",
73
- "htmlparser2": "^10.0.0",
74
- "marked": "^16.4.2"
83
+ "domutils": "^4.0.2",
84
+ "extract-zip": "^2.0.1",
85
+ "htmlparser2": "^12.0.0",
86
+ "marked": "^18.0.5"
75
87
  },
76
88
  "optionalDependencies": {
77
- "puppeteer": "^24.42.0"
89
+ "puppeteer": "^25.1.0"
78
90
  },
79
91
  "devDependencies": {
80
92
  "@ai-sdk/anthropic": "^3.0.71",
81
93
  "@ai-sdk/google": "^3.0.75",
82
94
  "@ai-sdk/openai": "^3.0.53",
83
- "@anthropic-ai/claude-agent-sdk": "^0.2.119",
84
- "@anthropic-ai/sdk": "^0.91.1",
85
- "@google/genai": "^1.50.1",
95
+ "@anthropic-ai/claude-agent-sdk": "^0.3.165",
96
+ "@anthropic-ai/sdk": "^0.102.0",
97
+ "@google/genai": "^2.8.0",
86
98
  "@paper-design/shaders": "^0.0.76",
87
99
  "ai": "^6.0.168",
88
- "archiver": "^7.0.1",
100
+ "archiver": "^8.0.0",
89
101
  "astro": "^6.2.1",
90
102
  "fontkit": "^2.0.4",
91
103
  "modern-screenshot": "^4.7.0",