kiro-10x-better 1.0.3 → 1.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.md +6 -5
- package/bin/cli.mjs +32 -21
- package/package.json +1 -1
- package/templates/hooks/scripts/sync-stack-skills.cjs +73 -17
- package/templates/hooks/stack-skill-sync.json +18 -6
package/README.md
CHANGED
|
@@ -26,17 +26,18 @@ npx kiro-10x-better --global
|
|
|
26
26
|
| :--- | :--- |
|
|
27
27
|
| `-g`, `--global` | Install into `~/.kiro/` instead of `./.kiro/` |
|
|
28
28
|
| `-f`, `--force` | Overwrite existing `.kiro` files (default: skip existing) |
|
|
29
|
-
| `-y`, `--yes` | Skip interactive prompts
|
|
29
|
+
| `-y`, `--yes` | Skip interactive prompts (installs security + detected web skills) |
|
|
30
|
+
| `--core-only` | Skip external `npx skills add` calls (keeps local stack watcher hook) |
|
|
30
31
|
| `--with-skills` | Also install core `obra/superpowers` skills via `npx skills` |
|
|
31
32
|
| `--web` | Install Web App skills (`agent-browser` + `modern-web-guidance`) without prompting |
|
|
32
|
-
| `--security` | Install Security Audit skills
|
|
33
|
+
| `--security` | Install Security Audit skills without prompting |
|
|
33
34
|
| `-h`, `--help` | Show usage help and exit |
|
|
34
35
|
|
|
35
36
|
## Progressive Setup Flow
|
|
36
37
|
|
|
37
|
-
1. **
|
|
38
|
-
2. **Web App
|
|
39
|
-
3. **Security Audit
|
|
38
|
+
1. **Core Setup (Always Runs):** Installs steering rules, the 3 bundled skills, core safety/lint/verify hooks, the always-on `stack-skill-sync.json` watcher hook (`SessionStart`, `PostFileSave` on `package.json`, `PostToolUse` on `shell`), ignores, and global `permissions.yaml`.
|
|
39
|
+
2. **Web App Skills (`--web` / Auto-Detect):** Detects web frameworks (`next`, `react`, `vite`, `vue`, `svelte`, `astro`, `nuxt`, `remix`, `@tanstack/react-start`) in `package.json`. Under `--yes`, installs `agent-browser` + `modern-web-guidance` automatically when a web framework is detected (otherwise the always-on watcher installs them automatically as soon as one is added later).
|
|
40
|
+
3. **Security Audit Skills (`--security` / Smart `--yes`):** Enabled by default under `--yes` and `(Y/n)` interactively—installs `security-audit` (Cloudflare) + `security-review` (Sentry), appends `pnpm audit*` / `npm audit*` to `permissions.yaml`, and installs `better-auth-security-best-practices` immediately if `better-auth` is in `package.json` (or via the watcher hook whenever added later).
|
|
40
41
|
|
|
41
42
|
## What Gets Installed
|
|
42
43
|
|
package/bin/cli.mjs
CHANGED
|
@@ -30,10 +30,11 @@ Usage:
|
|
|
30
30
|
Options:
|
|
31
31
|
-g, --global Install into ~/.kiro/ instead of ./.kiro/
|
|
32
32
|
-f, --force Overwrite existing files (default: skip existing)
|
|
33
|
-
-y, --yes Skip
|
|
33
|
+
-y, --yes Skip prompts (auto-installs security + detected web skills)
|
|
34
|
+
--core-only Skip external npx skills installs (keeps local watcher hook)
|
|
34
35
|
--with-skills Install core obra/superpowers skills via npx skills
|
|
35
36
|
--web Install Web App skills (agent-browser + modern-web-guidance)
|
|
36
|
-
--security Install Security Audit skills
|
|
37
|
+
--security Install Security Audit skills without prompting
|
|
37
38
|
-h, --help Show this help message and exit
|
|
38
39
|
`);
|
|
39
40
|
}
|
|
@@ -43,6 +44,7 @@ function parseArgs(argv) {
|
|
|
43
44
|
global: false,
|
|
44
45
|
force: false,
|
|
45
46
|
yes: false,
|
|
47
|
+
coreOnly: false,
|
|
46
48
|
withSkills: false,
|
|
47
49
|
web: false,
|
|
48
50
|
security: false,
|
|
@@ -63,6 +65,9 @@ function parseArgs(argv) {
|
|
|
63
65
|
case "-y":
|
|
64
66
|
flags.yes = true;
|
|
65
67
|
break;
|
|
68
|
+
case "--core-only":
|
|
69
|
+
flags.coreOnly = true;
|
|
70
|
+
break;
|
|
66
71
|
case "--with-skills":
|
|
67
72
|
flags.withSkills = true;
|
|
68
73
|
break;
|
|
@@ -380,7 +385,7 @@ async function main() {
|
|
|
380
385
|
|
|
381
386
|
console.log(`\nSetting up Kiro CLI V3 in ${targetKiroDir}\n`);
|
|
382
387
|
|
|
383
|
-
// Step 1: Fast Core Setup (steering, bundled skills, core hooks, ignores,
|
|
388
|
+
// Step 1: Fast Core Setup (steering, bundled skills, core + watcher hooks, ignores, permissions)
|
|
384
389
|
copyTemplateFile(
|
|
385
390
|
path.join("steering", "core-rules.md"),
|
|
386
391
|
path.join(targetKiroDir, "steering", "core-rules.md"),
|
|
@@ -397,6 +402,11 @@ async function main() {
|
|
|
397
402
|
path.join(targetKiroDir, "hooks", "scripts", "guard.cjs"),
|
|
398
403
|
{ force: flags.force, label: `${prefixLabel}/hooks/scripts/guard.cjs`, tracker }
|
|
399
404
|
);
|
|
405
|
+
copyTemplateFile(
|
|
406
|
+
path.join("hooks", "scripts", "sync-stack-skills.cjs"),
|
|
407
|
+
path.join(targetKiroDir, "hooks", "scripts", "sync-stack-skills.cjs"),
|
|
408
|
+
{ force: flags.force, label: `${prefixLabel}/hooks/scripts/sync-stack-skills.cjs`, tracker }
|
|
409
|
+
);
|
|
400
410
|
|
|
401
411
|
writeTargetFile(
|
|
402
412
|
path.join(targetKiroDir, "hooks", "security-guard.json"),
|
|
@@ -413,6 +423,11 @@ async function main() {
|
|
|
413
423
|
buildVerifyConfig(stack),
|
|
414
424
|
{ force: flags.force, label: `${prefixLabel}/hooks/verify-after-task.json`, tracker }
|
|
415
425
|
);
|
|
426
|
+
copyTemplateFile(
|
|
427
|
+
path.join("hooks", "stack-skill-sync.json"),
|
|
428
|
+
path.join(targetKiroDir, "hooks", "stack-skill-sync.json"),
|
|
429
|
+
{ force: flags.force, label: `${prefixLabel}/hooks/stack-skill-sync.json`, tracker }
|
|
430
|
+
);
|
|
416
431
|
|
|
417
432
|
if (!flags.global) {
|
|
418
433
|
updateGitignore(cwd, tracker);
|
|
@@ -435,16 +450,20 @@ async function main() {
|
|
|
435
450
|
configureMediumEffort(homeKiroDir, tracker);
|
|
436
451
|
}
|
|
437
452
|
|
|
438
|
-
if (flags.withSkills) {
|
|
453
|
+
if (flags.withSkills && !flags.coreOnly) {
|
|
439
454
|
runSkillsInstall(flags.global);
|
|
440
455
|
}
|
|
441
456
|
|
|
442
|
-
// Step 2: Web App
|
|
457
|
+
// Step 2: Web App Skills (--web / Auto-Detect)
|
|
443
458
|
const hasWebFramework = !flags.global && WEB_FRAMEWORKS.some((fw) => fw in pkgDeps);
|
|
444
459
|
let installWeb = false;
|
|
445
|
-
if (flags.
|
|
460
|
+
if (flags.coreOnly) {
|
|
461
|
+
installWeb = false;
|
|
462
|
+
} else if (flags.web) {
|
|
446
463
|
installWeb = true;
|
|
447
|
-
} else if (
|
|
464
|
+
} else if (flags.yes) {
|
|
465
|
+
installWeb = hasWebFramework;
|
|
466
|
+
} else {
|
|
448
467
|
const webPrompt = hasWebFramework
|
|
449
468
|
? "\nIs this a web app? Installs agent-browser + modern-web-guidance (Y/n): "
|
|
450
469
|
: "\nIs this a web app? Installs agent-browser + modern-web-guidance (y/N): ";
|
|
@@ -470,12 +489,14 @@ async function main() {
|
|
|
470
489
|
appendAllowRules(homeKiroDir, ["agent-browser *", "npx modern-web-guidance*"], tracker);
|
|
471
490
|
}
|
|
472
491
|
|
|
473
|
-
// Step 3: Security Audit
|
|
492
|
+
// Step 3: Security Audit Skills (--security / Smart --yes)
|
|
474
493
|
let installSecurity = false;
|
|
475
|
-
if (flags.
|
|
494
|
+
if (flags.coreOnly) {
|
|
495
|
+
installSecurity = false;
|
|
496
|
+
} else if (flags.security || flags.yes) {
|
|
476
497
|
installSecurity = true;
|
|
477
|
-
} else
|
|
478
|
-
installSecurity = await promptYesNo("\nAdd code security-audit skills? (
|
|
498
|
+
} else {
|
|
499
|
+
installSecurity = await promptYesNo("\nAdd code security-audit skills? (Y/n): ", true);
|
|
479
500
|
}
|
|
480
501
|
|
|
481
502
|
if (installSecurity) {
|
|
@@ -487,16 +508,6 @@ async function main() {
|
|
|
487
508
|
["skills", "add", "getsentry/skills", "--skill", "security-review", "-a", "kiro-cli", "-y"],
|
|
488
509
|
flags.global
|
|
489
510
|
);
|
|
490
|
-
copyTemplateFile(
|
|
491
|
-
path.join("hooks", "stack-skill-sync.json"),
|
|
492
|
-
path.join(targetKiroDir, "hooks", "stack-skill-sync.json"),
|
|
493
|
-
{ force: flags.force, label: `${prefixLabel}/hooks/stack-skill-sync.json`, tracker }
|
|
494
|
-
);
|
|
495
|
-
copyTemplateFile(
|
|
496
|
-
path.join("hooks", "scripts", "sync-stack-skills.cjs"),
|
|
497
|
-
path.join(targetKiroDir, "hooks", "scripts", "sync-stack-skills.cjs"),
|
|
498
|
-
{ force: flags.force, label: `${prefixLabel}/hooks/scripts/sync-stack-skills.cjs`, tracker }
|
|
499
|
-
);
|
|
500
511
|
|
|
501
512
|
if ("better-auth" in pkgDeps) {
|
|
502
513
|
runNpxSkills(
|
package/package.json
CHANGED
|
@@ -3,30 +3,86 @@ const path = require("node:path");
|
|
|
3
3
|
const os = require("node:os");
|
|
4
4
|
const { execFileSync } = require("node:child_process");
|
|
5
5
|
|
|
6
|
+
const WEB_FRAMEWORKS = new Set([
|
|
7
|
+
"next",
|
|
8
|
+
"react",
|
|
9
|
+
"vite",
|
|
10
|
+
"vue",
|
|
11
|
+
"svelte",
|
|
12
|
+
"astro",
|
|
13
|
+
"nuxt",
|
|
14
|
+
"remix",
|
|
15
|
+
"@tanstack/react-start"
|
|
16
|
+
]);
|
|
17
|
+
|
|
18
|
+
function isSkillInstalled(skillName) {
|
|
19
|
+
const localSkill = path.join(process.cwd(), ".kiro", "skills", skillName, "SKILL.md");
|
|
20
|
+
const globalSkill = path.join(os.homedir(), ".kiro", "skills", skillName, "SKILL.md");
|
|
21
|
+
return fs.existsSync(localSkill) || fs.existsSync(globalSkill);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function ensureWebPermissions() {
|
|
25
|
+
const permPath = path.join(os.homedir(), ".kiro", "settings", "permissions.yaml");
|
|
26
|
+
if (!fs.existsSync(permPath)) return;
|
|
27
|
+
let content = fs.readFileSync(permPath, "utf8");
|
|
28
|
+
const rulesToAdd = [];
|
|
29
|
+
if (!content.includes('"agent-browser *"')) {
|
|
30
|
+
rulesToAdd.push(' - tool: shell\n command: "agent-browser *"');
|
|
31
|
+
}
|
|
32
|
+
if (!content.includes('"npx modern-web-guidance*"')) {
|
|
33
|
+
rulesToAdd.push(' - tool: shell\n command: "npx modern-web-guidance*"');
|
|
34
|
+
}
|
|
35
|
+
if (rulesToAdd.length > 0 && content.includes("allow:\n")) {
|
|
36
|
+
content = content.replace("allow:\n", `allow:\n${rulesToAdd.join("\n")}\n`);
|
|
37
|
+
fs.writeFileSync(permPath, content, "utf8");
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
6
41
|
try {
|
|
7
42
|
const pkgPath = path.join(process.cwd(), "package.json");
|
|
8
43
|
if (!fs.existsSync(pkgPath)) process.exit(0);
|
|
9
44
|
|
|
45
|
+
// Fast exit (<1ms) if package.json mtime hasn't changed since last check
|
|
46
|
+
const stat = fs.statSync(pkgPath);
|
|
47
|
+
const kiroDir = path.join(process.cwd(), ".kiro");
|
|
48
|
+
const statePath = path.join(kiroDir, ".stack-sync-state.json");
|
|
49
|
+
if (fs.existsSync(statePath)) {
|
|
50
|
+
try {
|
|
51
|
+
const prev = JSON.parse(fs.readFileSync(statePath, "utf8"));
|
|
52
|
+
if (prev.mtimeMs === stat.mtimeMs) process.exit(0);
|
|
53
|
+
} catch {}
|
|
54
|
+
}
|
|
55
|
+
|
|
10
56
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
11
57
|
const deps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };
|
|
12
|
-
|
|
58
|
+
const depNames = Object.keys(deps);
|
|
13
59
|
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
60
|
+
// 1. Auto-sync Web App skills when Next.js / React / Vite etc. is installed
|
|
61
|
+
const hasWeb = depNames.some((d) => WEB_FRAMEWORKS.has(d));
|
|
62
|
+
if (hasWeb && (!isSkillInstalled("agent-browser") || !isSkillInstalled("modern-web-guidance"))) {
|
|
63
|
+
console.log("[kiro-10x-better] Detected web framework in package.json — installing agent-browser + modern-web-guidance...");
|
|
64
|
+
execFileSync(
|
|
65
|
+
"npx",
|
|
66
|
+
["skills", "add", "vercel-labs/agent-browser", "--skill", "agent-browser", "--skill", "modern-web-guidance", "-a", "kiro-cli", "-y"],
|
|
67
|
+
{ stdio: "inherit", shell: process.platform === "win32", timeout: 50000 }
|
|
68
|
+
);
|
|
69
|
+
ensureWebPermissions();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// 2. Auto-sync Better Auth security skill when better-auth is installed
|
|
73
|
+
if (deps["better-auth"] && !isSkillInstalled("better-auth-security-best-practices")) {
|
|
74
|
+
console.log("[kiro-10x-better] Detected better-auth in package.json — installing better-auth-security-best-practices...");
|
|
75
|
+
execFileSync(
|
|
76
|
+
"npx",
|
|
77
|
+
["skills", "add", "better-auth/skills", "--skill", "better-auth-security-best-practices", "-a", "kiro-cli", "-y"],
|
|
78
|
+
{ stdio: "inherit", shell: process.platform === "win32", timeout: 50000 }
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
if (fs.existsSync(kiroDir)) {
|
|
83
|
+
fs.writeFileSync(statePath, JSON.stringify({ mtimeMs: stat.mtimeMs }), "utf8");
|
|
84
|
+
}
|
|
29
85
|
} catch {
|
|
30
|
-
// Never block Kiro CLI
|
|
86
|
+
// Never block Kiro CLI if offline or npx is unavailable
|
|
31
87
|
process.exit(0);
|
|
32
88
|
}
|
|
@@ -2,26 +2,38 @@
|
|
|
2
2
|
"version": "v1",
|
|
3
3
|
"hooks": [
|
|
4
4
|
{
|
|
5
|
-
"name": "sync-
|
|
6
|
-
"description": "Auto-installs
|
|
5
|
+
"name": "sync-stack-skills-on-start",
|
|
6
|
+
"description": "Auto-installs Web and Better Auth skills when matching packages appear in package.json",
|
|
7
7
|
"trigger": "SessionStart",
|
|
8
8
|
"action": {
|
|
9
9
|
"type": "command",
|
|
10
10
|
"command": "node -e \"const fs=require('fs'),p=require('path'),os=require('os'),loc=p.join('.kiro','hooks','scripts','sync-stack-skills.cjs'),glob=p.join(os.homedir(),'.kiro','hooks','scripts','sync-stack-skills.cjs');require(fs.existsSync(loc)?p.resolve(loc):glob)\""
|
|
11
11
|
},
|
|
12
|
-
"timeout":
|
|
12
|
+
"timeout": 60,
|
|
13
13
|
"enabled": true
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
|
-
"name": "sync-
|
|
17
|
-
"description": "Auto-installs
|
|
16
|
+
"name": "sync-stack-skills-on-pkg-save",
|
|
17
|
+
"description": "Auto-installs Web and Better Auth skills when package.json is saved",
|
|
18
18
|
"trigger": "PostFileSave",
|
|
19
19
|
"matcher": "package\\.json$",
|
|
20
20
|
"action": {
|
|
21
21
|
"type": "command",
|
|
22
22
|
"command": "node -e \"const fs=require('fs'),p=require('path'),os=require('os'),loc=p.join('.kiro','hooks','scripts','sync-stack-skills.cjs'),glob=p.join(os.homedir(),'.kiro','hooks','scripts','sync-stack-skills.cjs');require(fs.existsSync(loc)?p.resolve(loc):glob)\""
|
|
23
23
|
},
|
|
24
|
-
"timeout":
|
|
24
|
+
"timeout": 60,
|
|
25
|
+
"enabled": true
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
"name": "sync-stack-skills-on-shell",
|
|
29
|
+
"description": "Checks package.json mtime after shell installs (e.g. create-next-app or pnpm add)",
|
|
30
|
+
"trigger": "PostToolUse",
|
|
31
|
+
"matcher": "shell",
|
|
32
|
+
"action": {
|
|
33
|
+
"type": "command",
|
|
34
|
+
"command": "node -e \"const fs=require('fs'),p=require('path'),os=require('os'),loc=p.join('.kiro','hooks','scripts','sync-stack-skills.cjs'),glob=p.join(os.homedir(),'.kiro','hooks','scripts','sync-stack-skills.cjs');require(fs.existsSync(loc)?p.resolve(loc):glob)\""
|
|
35
|
+
},
|
|
36
|
+
"timeout": 60,
|
|
25
37
|
"enabled": true
|
|
26
38
|
}
|
|
27
39
|
]
|