impeccable 2.0.0 → 2.0.4
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/README.bak.md +247 -0
- package/README.md +44 -205
- package/README.npm.md +76 -0
- package/bin/commands/skills.mjs +514 -0
- package/bin/impeccable +14 -4
- package/lib/download-providers.js +24 -0
- package/package.json +8 -8
- package/source/skills/critique/scripts/detect-antipatterns.mjs +0 -2131
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `impeccable skills` subcommand
|
|
3
|
+
*
|
|
4
|
+
* Usage:
|
|
5
|
+
* impeccable skills help Show all available skills and commands
|
|
6
|
+
* impeccable skills install Install skills via npx skills add
|
|
7
|
+
* impeccable skills update Update skills to latest version
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import { execSync } from 'node:child_process';
|
|
11
|
+
import { existsSync, readFileSync, readdirSync, statSync, lstatSync, symlinkSync, readlinkSync, unlinkSync, mkdirSync, writeFileSync, rmSync, renameSync, createWriteStream } from 'node:fs';
|
|
12
|
+
import { join, resolve, dirname } from 'node:path';
|
|
13
|
+
import { createInterface } from 'node:readline';
|
|
14
|
+
import { fileURLToPath } from 'node:url';
|
|
15
|
+
import { get } from 'node:https';
|
|
16
|
+
import { tmpdir } from 'node:os';
|
|
17
|
+
|
|
18
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
19
|
+
const API_BASE = 'https://impeccable.style';
|
|
20
|
+
|
|
21
|
+
// Provider folder names in project roots
|
|
22
|
+
const PROVIDER_DIRS = ['.claude', '.cursor', '.gemini', '.codex', '.agents', '.kiro', '.opencode', '.pi', '.trae', '.trae-cn'];
|
|
23
|
+
|
|
24
|
+
function ask(question) {
|
|
25
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
26
|
+
return new Promise(r => rl.question(question, ans => { rl.close(); r(ans.trim().toLowerCase()); }));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// ─── skills help ──────────────────────────────────────────────────────────────
|
|
30
|
+
|
|
31
|
+
async function showHelp() {
|
|
32
|
+
let commands;
|
|
33
|
+
try {
|
|
34
|
+
const res = await fetch(`${API_BASE}/api/commands`);
|
|
35
|
+
commands = await res.json();
|
|
36
|
+
} catch {
|
|
37
|
+
console.error('Could not fetch command list from impeccable.style. Check your network connection.');
|
|
38
|
+
process.exit(1);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const pad = (s, n) => s + ' '.repeat(Math.max(0, n - s.length));
|
|
42
|
+
|
|
43
|
+
console.log('\n Impeccable Skills & Commands\n');
|
|
44
|
+
console.log(' Install: npx impeccable skills install');
|
|
45
|
+
console.log(' Update: npx impeccable skills update');
|
|
46
|
+
console.log(' Docs: https://impeccable.style/cheatsheet\n');
|
|
47
|
+
console.log(` ${pad('Command', 22)} Description`);
|
|
48
|
+
console.log(` ${'-'.repeat(22)} ${'-'.repeat(52)}`);
|
|
49
|
+
|
|
50
|
+
for (const cmd of commands.sort((a, b) => a.id.localeCompare(b.id))) {
|
|
51
|
+
// Trim description to fit terminal
|
|
52
|
+
const desc = cmd.description.length > 72
|
|
53
|
+
? cmd.description.substring(0, 69) + '...'
|
|
54
|
+
: cmd.description;
|
|
55
|
+
console.log(` ${pad('/' + cmd.id, 22)} ${desc}`);
|
|
56
|
+
}
|
|
57
|
+
console.log(`\n ${commands.length} commands available. Run /<command> in your AI harness.\n`);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// ─── skills install ───────────────────────────────────────────────────────────
|
|
61
|
+
|
|
62
|
+
// Check if impeccable skills are already present in any provider folder
|
|
63
|
+
function isAlreadyInstalled(root) {
|
|
64
|
+
for (const d of PROVIDER_DIRS) {
|
|
65
|
+
const skillsDir = join(root, d, 'skills');
|
|
66
|
+
if (!existsSync(skillsDir)) continue;
|
|
67
|
+
try {
|
|
68
|
+
const entries = readdirSync(skillsDir);
|
|
69
|
+
// Look for 'impeccable' skill (or prefixed variant, or legacy 'teach-impeccable')
|
|
70
|
+
if (entries.some(e =>
|
|
71
|
+
e === 'impeccable' || e.endsWith('-impeccable') ||
|
|
72
|
+
e === 'teach-impeccable' || e.endsWith('-teach-impeccable')
|
|
73
|
+
)) {
|
|
74
|
+
return d;
|
|
75
|
+
}
|
|
76
|
+
} catch {}
|
|
77
|
+
}
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
function escapeRegex(str) {
|
|
82
|
+
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
function prefixSkillContent(content, prefix, allSkillNames) {
|
|
86
|
+
// Prefix the name in frontmatter
|
|
87
|
+
let result = content.replace(/^name:\s*(.+)$/m, (_, name) => `name: ${prefix}${name.trim()}`);
|
|
88
|
+
|
|
89
|
+
// Prefix cross-references: /skillname -> /prefix-skillname
|
|
90
|
+
const sorted = [...allSkillNames].sort((a, b) => b.length - a.length);
|
|
91
|
+
for (const name of sorted) {
|
|
92
|
+
// Command invocations: /skillname
|
|
93
|
+
result = result.replace(
|
|
94
|
+
new RegExp(`/(?=${escapeRegex(name)}(?:[^a-zA-Z0-9_-]|$))`, 'g'),
|
|
95
|
+
`/${prefix}`
|
|
96
|
+
);
|
|
97
|
+
// Prose references: "the skillname skill"
|
|
98
|
+
result = result.replace(
|
|
99
|
+
new RegExp(`(the) ${escapeRegex(name)} skill`, 'gi'),
|
|
100
|
+
(_, article) => `${article} ${prefix}${name} skill`
|
|
101
|
+
);
|
|
102
|
+
}
|
|
103
|
+
return result;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function isSkillDir(skillsDir, name) {
|
|
107
|
+
// Skill entries can be real directories or symlinks to directories (npx skills uses symlinks)
|
|
108
|
+
const full = join(skillsDir, name);
|
|
109
|
+
try {
|
|
110
|
+
return statSync(full).isDirectory() && existsSync(join(full, 'SKILL.md'));
|
|
111
|
+
} catch { return false; }
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
function isRealSkillDir(skillsDir, name) {
|
|
115
|
+
// Only real directories, not symlinks -- renaming the real dir renames the symlink targets too
|
|
116
|
+
const full = join(skillsDir, name);
|
|
117
|
+
try {
|
|
118
|
+
const lstat = lstatSync(full);
|
|
119
|
+
return lstat.isDirectory() && !lstat.isSymbolicLink() && existsSync(join(full, 'SKILL.md'));
|
|
120
|
+
} catch { return false; }
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
function renameSkillsWithPrefix(root, prefix) {
|
|
124
|
+
// First pass: collect all skill names across all providers (use first provider found)
|
|
125
|
+
let allSkillNames = [];
|
|
126
|
+
for (const d of PROVIDER_DIRS) {
|
|
127
|
+
const skillsDir = join(root, d, 'skills');
|
|
128
|
+
if (!existsSync(skillsDir)) continue;
|
|
129
|
+
const entries = readdirSync(skillsDir);
|
|
130
|
+
allSkillNames = entries.filter(name => isSkillDir(skillsDir, name));
|
|
131
|
+
if (allSkillNames.length > 0) break;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
// Second pass: rename real dirs and update their content
|
|
135
|
+
let count = 0;
|
|
136
|
+
for (const d of PROVIDER_DIRS) {
|
|
137
|
+
const skillsDir = join(root, d, 'skills');
|
|
138
|
+
if (!existsSync(skillsDir)) continue;
|
|
139
|
+
try {
|
|
140
|
+
const entries = readdirSync(skillsDir);
|
|
141
|
+
for (const name of entries) {
|
|
142
|
+
if (name.startsWith(prefix)) continue;
|
|
143
|
+
if (!isRealSkillDir(skillsDir, name)) continue;
|
|
144
|
+
|
|
145
|
+
const src = join(skillsDir, name);
|
|
146
|
+
const dest = join(skillsDir, prefix + name);
|
|
147
|
+
|
|
148
|
+
renameSync(src, dest);
|
|
149
|
+
|
|
150
|
+
// Prefix frontmatter name + all cross-references in SKILL.md
|
|
151
|
+
let content = readFileSync(join(dest, 'SKILL.md'), 'utf8');
|
|
152
|
+
content = prefixSkillContent(content, prefix, allSkillNames);
|
|
153
|
+
writeFileSync(join(dest, 'SKILL.md'), content);
|
|
154
|
+
count++;
|
|
155
|
+
}
|
|
156
|
+
} catch {}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
// Third pass: fix symlinks that now point to renamed targets (npx skills uses these)
|
|
160
|
+
for (const d of PROVIDER_DIRS) {
|
|
161
|
+
const skillsDir = join(root, d, 'skills');
|
|
162
|
+
if (!existsSync(skillsDir)) continue;
|
|
163
|
+
try {
|
|
164
|
+
const entries = readdirSync(skillsDir);
|
|
165
|
+
for (const name of entries) {
|
|
166
|
+
if (name.startsWith(prefix)) continue;
|
|
167
|
+
const full = join(skillsDir, name);
|
|
168
|
+
try {
|
|
169
|
+
if (!lstatSync(full).isSymbolicLink()) continue;
|
|
170
|
+
const target = readlinkSync(full);
|
|
171
|
+
const newTarget = target.replace(new RegExp(`/${escapeRegex(name)}$`), `/${prefix}${name}`);
|
|
172
|
+
unlinkSync(full);
|
|
173
|
+
symlinkSync(newTarget, join(skillsDir, prefix + name));
|
|
174
|
+
} catch {}
|
|
175
|
+
}
|
|
176
|
+
} catch {}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
return count;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
async function install(flags) {
|
|
183
|
+
const force = flags.includes('--force');
|
|
184
|
+
const yes = flags.includes('-y') || flags.includes('--yes');
|
|
185
|
+
const prefixFlag = flags.find(f => f.startsWith('--prefix='));
|
|
186
|
+
const root = findProjectRoot();
|
|
187
|
+
const existing = isAlreadyInstalled(root);
|
|
188
|
+
|
|
189
|
+
if (existing && !force) {
|
|
190
|
+
console.log(`Impeccable skills are already installed (found in ${existing}/).`);
|
|
191
|
+
console.log('Run with --force to reinstall.\n');
|
|
192
|
+
process.exit(0);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
console.log('Installing impeccable skills via npx skills...\n');
|
|
196
|
+
try {
|
|
197
|
+
execSync(`npx skills add pbakaus/impeccable${yes ? ' -y' : ''}`, { stdio: 'inherit' });
|
|
198
|
+
} catch (e) {
|
|
199
|
+
process.exit(e.status ?? 1);
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Ask about prefixing (skip in CI mode unless --prefix= is set)
|
|
203
|
+
let prefix = '';
|
|
204
|
+
if (prefixFlag) {
|
|
205
|
+
prefix = prefixFlag.split('=')[1] || 'i-';
|
|
206
|
+
} else if (!yes) {
|
|
207
|
+
console.log();
|
|
208
|
+
const wantPrefix = await ask('Prefix commands to avoid conflicts? e.g. /i-audit instead of /audit (y/N) ');
|
|
209
|
+
if (wantPrefix === 'y' || wantPrefix === 'yes') {
|
|
210
|
+
const custom = await ask('Prefix (default: i-): ');
|
|
211
|
+
prefix = custom || 'i-';
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
if (prefix) {
|
|
216
|
+
const count = renameSkillsWithPrefix(root, prefix);
|
|
217
|
+
if (count > 0) {
|
|
218
|
+
console.log(`\nRenamed ${count} skills with "${prefix}" prefix.`);
|
|
219
|
+
console.log(`Commands are now available as /${prefix}<command> (e.g. /${prefix}audit).`);
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
|
|
223
|
+
console.log(`\nDone! Run /${prefix}impeccable teach in your AI harness to set up design context.\n`);
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
/** Detect prefix by looking for the 'impeccable' skill (or legacy 'teach-impeccable') */
|
|
227
|
+
function detectPrefix(root) {
|
|
228
|
+
for (const d of PROVIDER_DIRS) {
|
|
229
|
+
const skillsDir = join(root, d, 'skills');
|
|
230
|
+
if (!existsSync(skillsDir)) continue;
|
|
231
|
+
for (const name of readdirSync(skillsDir)) {
|
|
232
|
+
if (name === 'impeccable') return '';
|
|
233
|
+
if (name.endsWith('-impeccable') && name !== 'teach-impeccable') return name.slice(0, -'impeccable'.length);
|
|
234
|
+
// Legacy fallback
|
|
235
|
+
if (name === 'teach-impeccable') return '';
|
|
236
|
+
if (name.endsWith('-teach-impeccable')) return name.slice(0, -'teach-impeccable'.length);
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
return '';
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
/** Undo prefixing: rename folders back and strip prefix from SKILL.md content */
|
|
243
|
+
function undoPrefix(root, prefix) {
|
|
244
|
+
if (!prefix) return;
|
|
245
|
+
// Collect the unprefixed names (strip our prefix)
|
|
246
|
+
let allPrefixedNames = [];
|
|
247
|
+
for (const d of PROVIDER_DIRS) {
|
|
248
|
+
const skillsDir = join(root, d, 'skills');
|
|
249
|
+
if (!existsSync(skillsDir)) continue;
|
|
250
|
+
allPrefixedNames = readdirSync(skillsDir).filter(n => n.startsWith(prefix) && isRealSkillDir(skillsDir, n));
|
|
251
|
+
if (allPrefixedNames.length > 0) break;
|
|
252
|
+
}
|
|
253
|
+
const unprefixedNames = allPrefixedNames.map(n => n.slice(prefix.length));
|
|
254
|
+
|
|
255
|
+
for (const d of PROVIDER_DIRS) {
|
|
256
|
+
const skillsDir = join(root, d, 'skills');
|
|
257
|
+
if (!existsSync(skillsDir)) continue;
|
|
258
|
+
for (const name of readdirSync(skillsDir)) {
|
|
259
|
+
if (!name.startsWith(prefix)) continue;
|
|
260
|
+
const unprefixed = name.slice(prefix.length);
|
|
261
|
+
const src = join(skillsDir, name);
|
|
262
|
+
const dest = join(skillsDir, unprefixed);
|
|
263
|
+
|
|
264
|
+
if (lstatSync(src).isSymbolicLink()) {
|
|
265
|
+
const target = readlinkSync(src);
|
|
266
|
+
const newTarget = target.replace(`/${name}`, `/${unprefixed}`);
|
|
267
|
+
unlinkSync(src);
|
|
268
|
+
symlinkSync(newTarget, dest);
|
|
269
|
+
} else {
|
|
270
|
+
renameSync(src, dest);
|
|
271
|
+
// Strip prefix from SKILL.md content
|
|
272
|
+
const skillMd = join(dest, 'SKILL.md');
|
|
273
|
+
if (existsSync(skillMd)) {
|
|
274
|
+
let content = readFileSync(skillMd, 'utf8');
|
|
275
|
+
// Reverse the prefixing: replace prefixed names with unprefixed
|
|
276
|
+
content = content.replace(new RegExp(`^name:\\s*${escapeRegex(prefix)}`, 'm'), 'name: ');
|
|
277
|
+
const sorted = [...allPrefixedNames].sort((a, b) => b.length - a.length);
|
|
278
|
+
for (const pName of sorted) {
|
|
279
|
+
const uName = pName.slice(prefix.length);
|
|
280
|
+
content = content.replace(new RegExp(`/${escapeRegex(pName)}(?=[^a-zA-Z0-9_-]|$)`, 'g'), `/${uName}`);
|
|
281
|
+
content = content.replace(new RegExp(`(the) ${escapeRegex(pName)} skill`, 'gi'), `$1 ${uName} skill`);
|
|
282
|
+
}
|
|
283
|
+
writeFileSync(skillMd, content);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// ─── skills update ────────────────────────────────────────────────────────────
|
|
291
|
+
|
|
292
|
+
function findProjectRoot() {
|
|
293
|
+
let dir = process.cwd();
|
|
294
|
+
while (dir !== dirname(dir)) {
|
|
295
|
+
if (existsSync(join(dir, '.git'))) return dir;
|
|
296
|
+
dir = dirname(dir);
|
|
297
|
+
}
|
|
298
|
+
return process.cwd();
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
function findInstalledProviders(root) {
|
|
302
|
+
const found = [];
|
|
303
|
+
for (const d of PROVIDER_DIRS) {
|
|
304
|
+
const skillsDir = join(root, d, 'skills');
|
|
305
|
+
if (!existsSync(skillsDir)) continue;
|
|
306
|
+
try {
|
|
307
|
+
const entries = readdirSync(skillsDir);
|
|
308
|
+
if (entries.some(name => isSkillDir(skillsDir, name))) found.push(d);
|
|
309
|
+
} catch {}
|
|
310
|
+
}
|
|
311
|
+
return found;
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
function getModifiedSkillFiles(root, providerDirs) {
|
|
315
|
+
// Use git to check if any skill files have local modifications
|
|
316
|
+
const modified = [];
|
|
317
|
+
try {
|
|
318
|
+
const status = execSync('git status --porcelain', { cwd: root, encoding: 'utf8' });
|
|
319
|
+
for (const line of status.split('\n')) {
|
|
320
|
+
if (!line.trim()) continue;
|
|
321
|
+
const file = line.substring(3);
|
|
322
|
+
for (const d of providerDirs) {
|
|
323
|
+
if (file.startsWith(`${d}/skills/`)) {
|
|
324
|
+
const flag = line.substring(0, 2).trim();
|
|
325
|
+
modified.push({ file, flag });
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
} catch {
|
|
330
|
+
// Not a git repo or git not available
|
|
331
|
+
}
|
|
332
|
+
return modified;
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
function downloadFile(url, dest) {
|
|
336
|
+
return new Promise((resolve, reject) => {
|
|
337
|
+
const file = createWriteStream(dest);
|
|
338
|
+
get(url, (res) => {
|
|
339
|
+
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
340
|
+
// Follow redirect
|
|
341
|
+
get(res.headers.location, (res2) => {
|
|
342
|
+
res2.pipe(file);
|
|
343
|
+
file.on('finish', () => { file.close(); resolve(); });
|
|
344
|
+
}).on('error', reject);
|
|
345
|
+
return;
|
|
346
|
+
}
|
|
347
|
+
if (res.statusCode !== 200) {
|
|
348
|
+
reject(new Error(`HTTP ${res.statusCode}`));
|
|
349
|
+
return;
|
|
350
|
+
}
|
|
351
|
+
res.pipe(file);
|
|
352
|
+
file.on('finish', () => { file.close(); resolve(); });
|
|
353
|
+
}).on('error', reject);
|
|
354
|
+
});
|
|
355
|
+
}
|
|
356
|
+
|
|
357
|
+
async function update(flags = []) {
|
|
358
|
+
const yes = flags.includes('-y') || flags.includes('--yes');
|
|
359
|
+
// Try npx skills update first
|
|
360
|
+
console.log('Checking for skills manager...');
|
|
361
|
+
let noLockFile = true;
|
|
362
|
+
try {
|
|
363
|
+
const output = execSync('npx skills check', { encoding: 'utf8', timeout: 15000 });
|
|
364
|
+
noLockFile = output.includes('No skills tracked');
|
|
365
|
+
} catch {
|
|
366
|
+
// npx skills not available or errored
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
if (!noLockFile) {
|
|
370
|
+
const root = findProjectRoot();
|
|
371
|
+
const prefix = detectPrefix(root);
|
|
372
|
+
|
|
373
|
+
// Temporarily undo prefix so npx skills can find its tracked skill names
|
|
374
|
+
if (prefix) {
|
|
375
|
+
console.log(`Detected "${prefix}" prefix, temporarily reverting for update...`);
|
|
376
|
+
undoPrefix(root, prefix);
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
console.log('Updating via npx skills...\n');
|
|
380
|
+
try {
|
|
381
|
+
execSync('npx skills update', { stdio: 'inherit' });
|
|
382
|
+
} catch (e) {
|
|
383
|
+
// Re-apply prefix even if update fails
|
|
384
|
+
if (prefix) renameSkillsWithPrefix(root, prefix);
|
|
385
|
+
process.exit(e.status ?? 1);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
// Re-apply prefix after update
|
|
389
|
+
if (prefix) {
|
|
390
|
+
const count = renameSkillsWithPrefix(root, prefix);
|
|
391
|
+
console.log(`\nRe-applied "${prefix}" prefix to ${count} skills.`);
|
|
392
|
+
}
|
|
393
|
+
process.exit(0);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// Fallback: manual update by downloading the universal bundle
|
|
397
|
+
console.log('Skills not managed by npx skills. Using direct download.\n');
|
|
398
|
+
|
|
399
|
+
const root = findProjectRoot();
|
|
400
|
+
const providers = findInstalledProviders(root);
|
|
401
|
+
|
|
402
|
+
if (providers.length === 0) {
|
|
403
|
+
console.log('No impeccable skill folders found in this project.');
|
|
404
|
+
console.log('Run `npx impeccable skills install` to install first.');
|
|
405
|
+
process.exit(1);
|
|
406
|
+
}
|
|
407
|
+
|
|
408
|
+
console.log(`Found impeccable skills in: ${providers.join(', ')}`);
|
|
409
|
+
|
|
410
|
+
// Check for local modifications
|
|
411
|
+
const modified = getModifiedSkillFiles(root, providers);
|
|
412
|
+
if (modified.length > 0) {
|
|
413
|
+
console.log(`\n Warning: ${modified.length} skill file(s) have local changes:\n`);
|
|
414
|
+
for (const m of modified.slice(0, 10)) {
|
|
415
|
+
console.log(` ${m.flag} ${m.file}`);
|
|
416
|
+
}
|
|
417
|
+
if (modified.length > 10) console.log(` ... and ${modified.length - 10} more`);
|
|
418
|
+
console.log();
|
|
419
|
+
if (!yes) {
|
|
420
|
+
const ans = await ask(' Overwrite local changes? (y/N) ');
|
|
421
|
+
if (ans !== 'y' && ans !== 'yes') {
|
|
422
|
+
console.log('Aborted.');
|
|
423
|
+
process.exit(0);
|
|
424
|
+
}
|
|
425
|
+
}
|
|
426
|
+
} else if (!yes) {
|
|
427
|
+
const ans = await ask(`Update skills in ${providers.length} provider folder(s)? (Y/n) `);
|
|
428
|
+
if (ans === 'n' || ans === 'no') {
|
|
429
|
+
console.log('Aborted.');
|
|
430
|
+
process.exit(0);
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
// Download universal bundle
|
|
435
|
+
const tmpZip = join(tmpdir(), `impeccable-update-${Date.now()}.zip`);
|
|
436
|
+
console.log('\nDownloading latest skills...');
|
|
437
|
+
try {
|
|
438
|
+
await downloadFile(`${API_BASE}/api/download/bundle/universal`, tmpZip);
|
|
439
|
+
} catch (e) {
|
|
440
|
+
console.error(`Download failed: ${e.message}`);
|
|
441
|
+
process.exit(1);
|
|
442
|
+
}
|
|
443
|
+
|
|
444
|
+
// Extract and copy to each provider folder
|
|
445
|
+
let unzip;
|
|
446
|
+
try {
|
|
447
|
+
// Use built-in decompress if available (Node 22+), otherwise shell unzip
|
|
448
|
+
const tmpDir = join(tmpdir(), `impeccable-update-${Date.now()}`);
|
|
449
|
+
mkdirSync(tmpDir, { recursive: true });
|
|
450
|
+
execSync(`unzip -qo "${tmpZip}" -d "${tmpDir}"`, { encoding: 'utf8' });
|
|
451
|
+
|
|
452
|
+
// The universal bundle has provider folders at the top level
|
|
453
|
+
let updated = 0;
|
|
454
|
+
for (const provider of providers) {
|
|
455
|
+
const srcDir = join(tmpDir, provider, 'skills');
|
|
456
|
+
const destDir = join(root, provider, 'skills');
|
|
457
|
+
if (!existsSync(srcDir)) continue;
|
|
458
|
+
|
|
459
|
+
// Copy each skill folder
|
|
460
|
+
const skills = readdirSync(srcDir, { withFileTypes: true });
|
|
461
|
+
for (const skill of skills) {
|
|
462
|
+
if (!skill.isDirectory()) continue;
|
|
463
|
+
const src = join(srcDir, skill.name);
|
|
464
|
+
const dest = join(destDir, skill.name);
|
|
465
|
+
// Remove old and copy new
|
|
466
|
+
if (existsSync(dest)) rmSync(dest, { recursive: true });
|
|
467
|
+
copyDirSync(src, dest);
|
|
468
|
+
updated++;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
// Cleanup
|
|
473
|
+
rmSync(tmpDir, { recursive: true, force: true });
|
|
474
|
+
rmSync(tmpZip, { force: true });
|
|
475
|
+
|
|
476
|
+
console.log(`Updated ${updated} skills across ${providers.length} provider(s).`);
|
|
477
|
+
console.log('Done!\n');
|
|
478
|
+
} catch (e) {
|
|
479
|
+
console.error(`Extract failed: ${e.message}`);
|
|
480
|
+
rmSync(tmpZip, { force: true });
|
|
481
|
+
process.exit(1);
|
|
482
|
+
}
|
|
483
|
+
}
|
|
484
|
+
|
|
485
|
+
function copyDirSync(src, dest) {
|
|
486
|
+
mkdirSync(dest, { recursive: true });
|
|
487
|
+
for (const entry of readdirSync(src, { withFileTypes: true })) {
|
|
488
|
+
const s = join(src, entry.name);
|
|
489
|
+
const d = join(dest, entry.name);
|
|
490
|
+
if (entry.isDirectory()) {
|
|
491
|
+
copyDirSync(s, d);
|
|
492
|
+
} else {
|
|
493
|
+
writeFileSync(d, readFileSync(s));
|
|
494
|
+
}
|
|
495
|
+
}
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
// ─── Router ───────────────────────────────────────────────────────────────────
|
|
499
|
+
|
|
500
|
+
export async function run(args) {
|
|
501
|
+
const sub = args[0];
|
|
502
|
+
|
|
503
|
+
if (!sub || sub === 'help' || sub === '--help' || sub === '-h') {
|
|
504
|
+
await showHelp();
|
|
505
|
+
} else if (sub === 'install') {
|
|
506
|
+
await install(args.slice(1));
|
|
507
|
+
} else if (sub === 'update') {
|
|
508
|
+
await update(args.slice(1));
|
|
509
|
+
} else {
|
|
510
|
+
console.error(`Unknown skills command: ${sub}`);
|
|
511
|
+
console.error(`Run 'impeccable skills --help' for available commands.`);
|
|
512
|
+
process.exit(1);
|
|
513
|
+
}
|
|
514
|
+
}
|
package/bin/impeccable
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*
|
|
6
6
|
* Usage:
|
|
7
7
|
* npx impeccable detect [file-or-dir-or-url...]
|
|
8
|
-
* npx impeccable
|
|
8
|
+
* npx impeccable skills help|install|update
|
|
9
9
|
* npx impeccable --help
|
|
10
10
|
*/
|
|
11
11
|
|
|
@@ -22,12 +22,16 @@ if (!command || command === '--help' || command === '-h') {
|
|
|
22
22
|
|
|
23
23
|
Commands:
|
|
24
24
|
detect [file-or-dir-or-url...] Scan for UI anti-patterns and design quality issues
|
|
25
|
+
live [--port=PORT] Start browser detection overlay server
|
|
26
|
+
skills help List all available skills and commands
|
|
27
|
+
skills install Install impeccable skills into your project
|
|
28
|
+
skills update Update skills to the latest version
|
|
25
29
|
|
|
26
30
|
Options:
|
|
27
31
|
--help Show this help message
|
|
28
32
|
--version Show version number
|
|
29
33
|
|
|
30
|
-
Run 'impeccable
|
|
34
|
+
Run 'impeccable <command> --help' for command-specific options.`);
|
|
31
35
|
process.exit(0);
|
|
32
36
|
}
|
|
33
37
|
|
|
@@ -38,10 +42,16 @@ if (command === '--version' || command === '-v') {
|
|
|
38
42
|
}
|
|
39
43
|
|
|
40
44
|
if (command === 'detect') {
|
|
41
|
-
// Remove 'detect' from argv so the detection script sees the right args
|
|
42
45
|
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
43
|
-
const { detectCli } = await import('
|
|
46
|
+
const { detectCli } = await import('@impeccable/detect');
|
|
44
47
|
await detectCli();
|
|
48
|
+
} else if (command === 'live') {
|
|
49
|
+
process.argv = [process.argv[0], process.argv[1], ...args.slice(1)];
|
|
50
|
+
const { liveCli } = await import('@impeccable/detect');
|
|
51
|
+
await liveCli();
|
|
52
|
+
} else if (command === 'skills') {
|
|
53
|
+
const { run } = await import('./commands/skills.mjs');
|
|
54
|
+
await run(args.slice(1));
|
|
45
55
|
} else {
|
|
46
56
|
console.error(`Unknown command: ${command}`);
|
|
47
57
|
console.error(`Run 'impeccable --help' for available commands.`);
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export const FILE_DOWNLOAD_PROVIDER_CONFIG_DIRS = Object.freeze({
|
|
2
|
+
cursor: '.cursor',
|
|
3
|
+
'claude-code': '.claude',
|
|
4
|
+
gemini: '.gemini',
|
|
5
|
+
codex: '.codex',
|
|
6
|
+
agents: '.agents',
|
|
7
|
+
kiro: '.kiro',
|
|
8
|
+
opencode: '.opencode',
|
|
9
|
+
pi: '.pi',
|
|
10
|
+
});
|
|
11
|
+
|
|
12
|
+
export const FILE_DOWNLOAD_PROVIDERS = Object.freeze(
|
|
13
|
+
Object.keys(FILE_DOWNLOAD_PROVIDER_CONFIG_DIRS)
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
export const BUNDLE_DOWNLOAD_PROVIDERS = Object.freeze([
|
|
17
|
+
'universal',
|
|
18
|
+
'universal-prefixed',
|
|
19
|
+
]);
|
|
20
|
+
|
|
21
|
+
export const DOWNLOAD_PROVIDERS = Object.freeze([
|
|
22
|
+
...FILE_DOWNLOAD_PROVIDERS,
|
|
23
|
+
...BUNDLE_DOWNLOAD_PROVIDERS,
|
|
24
|
+
]);
|
package/package.json
CHANGED
|
@@ -1,20 +1,17 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "impeccable",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.4",
|
|
4
4
|
"author": "Paul Bakaus",
|
|
5
5
|
"bin": {
|
|
6
6
|
"impeccable": "./bin/impeccable"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"bin/",
|
|
10
|
-
"
|
|
10
|
+
"lib/download-providers.js",
|
|
11
11
|
"LICENSE"
|
|
12
12
|
],
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"
|
|
15
|
-
},
|
|
16
|
-
"optionalDependencies": {
|
|
17
|
-
"puppeteer": "^24.39.1"
|
|
14
|
+
"@impeccable/detect": "^2.0.4"
|
|
18
15
|
},
|
|
19
16
|
"description": "Detect UI anti-patterns and design quality issues from the command line",
|
|
20
17
|
"keywords": [
|
|
@@ -28,7 +25,8 @@
|
|
|
28
25
|
"html",
|
|
29
26
|
"cli"
|
|
30
27
|
],
|
|
31
|
-
"license": "
|
|
28
|
+
"license": "Apache-2.0",
|
|
29
|
+
"homepage": "https://impeccable.style",
|
|
32
30
|
"repository": {
|
|
33
31
|
"type": "git",
|
|
34
32
|
"url": "git+https://github.com/pbakaus/impeccable.git"
|
|
@@ -37,13 +35,15 @@
|
|
|
37
35
|
"node": ">=18"
|
|
38
36
|
},
|
|
39
37
|
"scripts": {
|
|
38
|
+
"prepublishOnly": "cp README.md README.bak.md && cp README.npm.md README.md",
|
|
39
|
+
"postpublish": "mv README.bak.md README.md",
|
|
40
40
|
"build": "bun run scripts/build.js",
|
|
41
41
|
"clean": "rm -rf dist build",
|
|
42
42
|
"rebuild": "bun run clean && bun run build",
|
|
43
43
|
"dev": "bun run server/index.js",
|
|
44
44
|
"preview": "bun run build && wrangler pages dev",
|
|
45
45
|
"deploy": "bun run build && wrangler pages deploy build/",
|
|
46
|
-
"test": "bun test tests/build.test.js
|
|
46
|
+
"test": "bun test tests/build.test.js",
|
|
47
47
|
"screenshot": "bun run scripts/screenshot-antipatterns.js",
|
|
48
48
|
"og-image": "bun run scripts/generate-og-image.js"
|
|
49
49
|
},
|