kiro-10x-better 1.0.2 → 1.0.3

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 CHANGED
@@ -26,10 +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 and accept defaults |
29
+ | `-y`, `--yes` | Skip interactive prompts and accept core defaults |
30
30
  | `--with-skills` | Also install core `obra/superpowers` skills via `npx skills` |
31
+ | `--web` | Install Web App skills (`agent-browser` + `modern-web-guidance`) without prompting |
32
+ | `--security` | Install Security Audit skills + `better-auth` watcher hook without prompting |
31
33
  | `-h`, `--help` | Show usage help and exit |
32
34
 
35
+ ## Progressive Setup Flow
36
+
37
+ 1. **Fast Core Setup:** Always installs steering rules, the 3 bundled skills, core safety/lint/verify hooks, ignores, and global `permissions.yaml`.
38
+ 2. **Web App Prompt (Opt-In):** Detects web frameworks (`next`, `react`, `vite`, `vue`, `svelte`, `astro`, `nuxt`, `remix`, `@tanstack/react-start`) in `package.json` and asks whether to install `agent-browser` + `modern-web-guidance` (defaulting to `Y/n` when detected, `y/N` otherwise; skipped under `--yes` unless `--web` is passed). Also appends `agent-browser *` and `npx modern-web-guidance*` to `permissions.yaml` `allow:`.
39
+ 3. **Security Audit + Better Auth Watcher (Opt-In):** Prompts to install `security-audit` (Cloudflare) + `security-review` (Sentry), appends `pnpm audit*` / `npm audit*` to `permissions.yaml`, and installs the `stack-skill-sync.json` watcher hook (`SessionStart` + `PostFileSave` on `package.json`) so `better-auth-security-best-practices` is automatically installed whenever `better-auth` is present or added later.
40
+
33
41
  ## What Gets Installed
34
42
 
35
43
  - **Steering (`steering/core-rules.md`):** Karpathy-style minimal diffs, fast CLI preferences (`rg`, `ast-grep`, `jq`, `gh`), token-saving rules, and verification honesty.
package/bin/cli.mjs CHANGED
@@ -9,6 +9,17 @@ import { fileURLToPath } from "node:url";
9
9
 
10
10
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
11
11
  const TEMPLATES_DIR = path.resolve(__dirname, "..", "templates");
12
+ const WEB_FRAMEWORKS = [
13
+ "next",
14
+ "react",
15
+ "vite",
16
+ "vue",
17
+ "svelte",
18
+ "astro",
19
+ "nuxt",
20
+ "remix",
21
+ "@tanstack/react-start"
22
+ ];
12
23
 
13
24
  function printHelp() {
14
25
  console.log(`kiro-10x-better — High-discipline Kiro CLI V3 setup
@@ -21,6 +32,8 @@ Options:
21
32
  -f, --force Overwrite existing files (default: skip existing)
22
33
  -y, --yes Skip interactive prompts and accept defaults
23
34
  --with-skills Install core obra/superpowers skills via npx skills
35
+ --web Install Web App skills (agent-browser + modern-web-guidance)
36
+ --security Install Security Audit skills + better-auth watcher hook
24
37
  -h, --help Show this help message and exit
25
38
  `);
26
39
  }
@@ -31,6 +44,8 @@ function parseArgs(argv) {
31
44
  force: false,
32
45
  yes: false,
33
46
  withSkills: false,
47
+ web: false,
48
+ security: false,
34
49
  help: false
35
50
  };
36
51
 
@@ -51,6 +66,12 @@ function parseArgs(argv) {
51
66
  case "--with-skills":
52
67
  flags.withSkills = true;
53
68
  break;
69
+ case "--web":
70
+ flags.web = true;
71
+ break;
72
+ case "--security":
73
+ flags.security = true;
74
+ break;
54
75
  case "--help":
55
76
  case "-h":
56
77
  flags.help = true;
@@ -63,7 +84,20 @@ function parseArgs(argv) {
63
84
  return flags;
64
85
  }
65
86
 
66
- function detectProjectStack(cwd) {
87
+ function readPackageDeps(cwd) {
88
+ const pkgPath = path.join(cwd, "package.json");
89
+ if (!fs.existsSync(pkgPath)) {
90
+ return {};
91
+ }
92
+ try {
93
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8").replace(/^\uFEFF/, ""));
94
+ return { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };
95
+ } catch {
96
+ return {};
97
+ }
98
+ }
99
+
100
+ function detectProjectStack(cwd, deps) {
67
101
  let pm = "npm";
68
102
  if (fs.existsSync(path.join(cwd, "pnpm-lock.yaml"))) {
69
103
  pm = "pnpm";
@@ -72,21 +106,12 @@ function detectProjectStack(cwd) {
72
106
  }
73
107
 
74
108
  let linter = null;
75
- const pkgPath = path.join(cwd, "package.json");
76
- if (fs.existsSync(pkgPath)) {
77
- try {
78
- const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
79
- const deps = { ...pkg.dependencies, ...pkg.devDependencies };
80
- if ("@biomejs/biome" in deps || "biome" in deps) {
81
- linter = "biome";
82
- } else if ("eslint" in deps) {
83
- linter = "eslint";
84
- } else if ("prettier" in deps) {
85
- linter = "prettier";
86
- }
87
- } catch {
88
- // Ignore malformed package.json and fall back to defaults
89
- }
109
+ if ("@biomejs/biome" in deps || "biome" in deps) {
110
+ linter = "biome";
111
+ } else if ("eslint" in deps) {
112
+ linter = "eslint";
113
+ } else if ("prettier" in deps) {
114
+ linter = "prettier";
90
115
  }
91
116
 
92
117
  const typescript = fs.existsSync(path.join(cwd, "tsconfig.json"));
@@ -243,47 +268,98 @@ function configureMediumEffort(homeKiroDir, tracker) {
243
268
  }
244
269
  }
245
270
 
246
- async function promptYesNo(question) {
271
+ function appendAllowRules(homeKiroDir, commands, tracker) {
272
+ const permPath = path.join(homeKiroDir, "settings", "permissions.yaml");
273
+ if (!fs.existsSync(permPath)) {
274
+ return;
275
+ }
276
+
277
+ const content = fs.readFileSync(permPath, "utf8");
278
+ const eol = content.includes("\r\n") ? "\r\n" : "\n";
279
+ const missing = commands.filter((cmd) => !content.includes(`command: "${cmd}"`));
280
+ if (missing.length === 0) {
281
+ return;
282
+ }
283
+
284
+ const block = missing
285
+ .map((cmd) => ` - tool: shell${eol} command: "${cmd}"`)
286
+ .join(eol);
287
+
288
+ let updatedContent;
289
+ const allowMatch = content.match(/^allow:[ \t]*\r?\n/m);
290
+ if (allowMatch) {
291
+ const insertPos = allowMatch.index + allowMatch[0].length;
292
+ updatedContent = `${content.slice(0, insertPos)}${block}${eol}${content.slice(insertPos)}`;
293
+ } else {
294
+ const prefix = content.length === 0 || content.endsWith("\n") ? "" : eol;
295
+ updatedContent = `${content}${prefix}allow:${eol}${block}${eol}`;
296
+ }
297
+
298
+ fs.writeFileSync(permPath, updatedContent, "utf8");
299
+ tracker.created.push(`~/.kiro/settings/permissions.yaml (+${missing.length} allow rules)`);
300
+ console.log(` update ~/.kiro/settings/permissions.yaml (added ${missing.join(", ")})`);
301
+ }
302
+
303
+ async function promptYesNo(question, defaultYes = true) {
247
304
  const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
248
305
  try {
249
306
  const answer = await rl.question(question);
250
307
  const normalized = answer.trim().toLowerCase();
251
- return normalized === "" || normalized === "y" || normalized === "yes";
308
+ if (normalized === "") {
309
+ return defaultYes;
310
+ }
311
+ return normalized === "y" || normalized === "yes";
252
312
  } finally {
253
313
  rl.close();
254
314
  }
255
315
  }
256
316
 
257
- function runSkillsInstall(isGlobal) {
258
- const args = [
259
- "skills",
260
- "add",
261
- "obra/superpowers",
262
- "-s",
263
- "using-git-worktrees",
264
- "-s",
265
- "subagent-driven-development",
266
- "-s",
267
- "verification-before-completion",
268
- "-s",
269
- "systematic-debugging",
270
- "-a",
271
- "kiro-cli"
272
- ];
273
- if (isGlobal) {
274
- args.push("-g");
317
+ function runNpxSkills(args, isGlobal) {
318
+ const fullArgs = isGlobal ? [...args, "-g"] : [...args];
319
+ const manualCmd = `npx ${fullArgs.join(" ")}`;
320
+ console.log(`\nRunning: ${manualCmd}`);
321
+ try {
322
+ const res = spawnSync("npx", fullArgs, {
323
+ stdio: "inherit",
324
+ shell: process.platform === "win32"
325
+ });
326
+ if (res.error) {
327
+ console.error(`Warning: Failed to run "${manualCmd}": ${res.error.message}`);
328
+ console.error(`Run manually later: ${manualCmd}`);
329
+ return false;
330
+ }
331
+ if (res.status !== 0) {
332
+ console.error(`Warning: "${manualCmd}" exited with status ${res.status}`);
333
+ console.error(`Run manually later: ${manualCmd}`);
334
+ return false;
335
+ }
336
+ return true;
337
+ } catch (err) {
338
+ console.error(`Warning: Failed to run "${manualCmd}": ${err.message}`);
339
+ console.error(`Run manually later: ${manualCmd}`);
340
+ return false;
275
341
  }
342
+ }
276
343
 
277
- console.log(`\nInstalling core skills: npx ${args.join(" ")}`);
278
- const res = spawnSync("npx", args, {
279
- stdio: "inherit",
280
- shell: process.platform === "win32"
281
- });
282
- if (res.error) {
283
- console.error(`Warning: Failed to run npx skills: ${res.error.message}`);
284
- } else if (res.status !== 0) {
285
- console.error(`Warning: npx skills exited with status ${res.status}`);
286
- }
344
+ function runSkillsInstall(isGlobal) {
345
+ runNpxSkills(
346
+ [
347
+ "skills",
348
+ "add",
349
+ "obra/superpowers",
350
+ "-s",
351
+ "using-git-worktrees",
352
+ "-s",
353
+ "subagent-driven-development",
354
+ "-s",
355
+ "verification-before-completion",
356
+ "-s",
357
+ "systematic-debugging",
358
+ "-a",
359
+ "kiro-cli"
360
+ ],
361
+ isGlobal
362
+ );
287
363
  }
288
364
 
289
365
  async function main() {
@@ -299,11 +375,12 @@ async function main() {
299
375
  const prefixLabel = flags.global ? "~/.kiro" : ".kiro";
300
376
  const tracker = { created: [], skipped: [] };
301
377
 
302
- const stack = flags.global ? null : detectProjectStack(cwd);
378
+ const pkgDeps = readPackageDeps(cwd);
379
+ const stack = flags.global ? null : detectProjectStack(cwd, pkgDeps);
303
380
 
304
381
  console.log(`\nSetting up Kiro CLI V3 in ${targetKiroDir}\n`);
305
382
 
306
- // Copy core steering, skills (recursively), and guard script
383
+ // Step 1: Fast Core Setup (steering, bundled skills, core hooks, ignores, global permissions)
307
384
  copyTemplateFile(
308
385
  path.join("steering", "core-rules.md"),
309
386
  path.join(targetKiroDir, "steering", "core-rules.md"),
@@ -321,7 +398,6 @@ async function main() {
321
398
  { force: flags.force, label: `${prefixLabel}/hooks/scripts/guard.cjs`, tracker }
322
399
  );
323
400
 
324
- // Write configured hooks
325
401
  writeTargetFile(
326
402
  path.join(targetKiroDir, "hooks", "security-guard.json"),
327
403
  buildSecurityGuardConfig(flags.global),
@@ -338,7 +414,6 @@ async function main() {
338
414
  { force: flags.force, label: `${prefixLabel}/hooks/verify-after-task.json`, tracker }
339
415
  );
340
416
 
341
- // Project-only .gitignore & .kiroignore
342
417
  if (!flags.global) {
343
418
  updateGitignore(cwd, tracker);
344
419
  copyTemplateFile("kiroignore", path.join(cwd, ".kiroignore"), {
@@ -348,7 +423,6 @@ async function main() {
348
423
  });
349
424
  }
350
425
 
351
- // Global permissions.yaml (Kiro CLI V3 reads permissions.yaml only from ~/.kiro/settings/)
352
426
  const shouldInstallPermissions = flags.global || flags.yes ||
353
427
  (await promptYesNo("\nInstall global permissions.yaml to ~/.kiro/settings/permissions.yaml? (Y/n) "));
354
428
 
@@ -365,6 +439,88 @@ async function main() {
365
439
  runSkillsInstall(flags.global);
366
440
  }
367
441
 
442
+ // Step 2: Web App Prompt (Opt-In)
443
+ const hasWebFramework = !flags.global && WEB_FRAMEWORKS.some((fw) => fw in pkgDeps);
444
+ let installWeb = false;
445
+ if (flags.web) {
446
+ installWeb = true;
447
+ } else if (!flags.yes) {
448
+ const webPrompt = hasWebFramework
449
+ ? "\nIs this a web app? Installs agent-browser + modern-web-guidance (Y/n): "
450
+ : "\nIs this a web app? Installs agent-browser + modern-web-guidance (y/N): ";
451
+ installWeb = await promptYesNo(webPrompt, hasWebFramework);
452
+ }
453
+
454
+ if (installWeb) {
455
+ runNpxSkills(
456
+ [
457
+ "skills",
458
+ "add",
459
+ "vercel-labs/agent-browser",
460
+ "--skill",
461
+ "agent-browser",
462
+ "--skill",
463
+ "modern-web-guidance",
464
+ "-a",
465
+ "kiro-cli",
466
+ "-y"
467
+ ],
468
+ flags.global
469
+ );
470
+ appendAllowRules(homeKiroDir, ["agent-browser *", "npx modern-web-guidance*"], tracker);
471
+ }
472
+
473
+ // Step 3: Security Audit Prompt + Auto-Watcher (Opt-In)
474
+ let installSecurity = false;
475
+ if (flags.security) {
476
+ installSecurity = true;
477
+ } else if (!flags.yes) {
478
+ installSecurity = await promptYesNo("\nAdd code security-audit skills? (y/N): ", false);
479
+ }
480
+
481
+ if (installSecurity) {
482
+ runNpxSkills(
483
+ ["skills", "add", "cloudflare/security-audit-skill", "--skill", "security-audit", "-a", "kiro-cli", "-y"],
484
+ flags.global
485
+ );
486
+ runNpxSkills(
487
+ ["skills", "add", "getsentry/skills", "--skill", "security-review", "-a", "kiro-cli", "-y"],
488
+ flags.global
489
+ );
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
+
501
+ if ("better-auth" in pkgDeps) {
502
+ runNpxSkills(
503
+ [
504
+ "skills",
505
+ "add",
506
+ "better-auth/skills",
507
+ "--skill",
508
+ "better-auth-security-best-practices",
509
+ "-a",
510
+ "kiro-cli",
511
+ "-y"
512
+ ],
513
+ flags.global
514
+ );
515
+ } else {
516
+ console.log(
517
+ "ℹ better-auth not in package.json yet — added auto-watcher to install better-auth-security-best-practices if you add it later!"
518
+ );
519
+ }
520
+
521
+ appendAllowRules(homeKiroDir, ["pnpm audit*", "npm audit*"], tracker);
522
+ }
523
+
368
524
  // Summary
369
525
  const bundledSkills = fs
370
526
  .readdirSync(path.join(TEMPLATES_DIR, "skills"), { withFileTypes: true })
@@ -380,6 +536,11 @@ async function main() {
380
536
  `Detected Stack: pm=${stack.pm}, linter=${stack.linter ?? "none (disabled)"}, typescript=${stack.typescript ? "yes" : "no (disabled)"}`
381
537
  );
382
538
  }
539
+ if (installWeb) {
540
+ console.log(
541
+ "\nWeb tip: Run \"npm install -g agent-browser && agent-browser install\" once if you haven't installed the browser binary yet."
542
+ );
543
+ }
383
544
  console.log("\nNext steps in Kiro CLI V3:");
384
545
  console.log(" 1. Enable \"Approve for me\" and Workflows (chat.enableWorkflows) in Kiro settings.");
385
546
  console.log(" 2. Set /effort medium for daily work (or high for complex debugging) and start a fresh kiro-cli session.");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "kiro-10x-better",
3
- "version": "1.0.2",
3
+ "version": "1.0.3",
4
4
  "description": "Instant, zero-dependency CLI to set up a high-discipline Kiro CLI V3 environment with hooks, steering rules, skills, and permissions.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -0,0 +1,32 @@
1
+ const fs = require("node:fs");
2
+ const path = require("node:path");
3
+ const os = require("node:os");
4
+ const { execFileSync } = require("node:child_process");
5
+
6
+ try {
7
+ const pkgPath = path.join(process.cwd(), "package.json");
8
+ if (!fs.existsSync(pkgPath)) process.exit(0);
9
+
10
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
11
+ const deps = { ...(pkg.dependencies || {}), ...(pkg.devDependencies || {}) };
12
+ if (!deps["better-auth"]) process.exit(0);
13
+
14
+ const skillName = "better-auth-security-best-practices";
15
+ const localSkill = path.join(process.cwd(), ".kiro", "skills", skillName, "SKILL.md");
16
+ const globalSkill = path.join(os.homedir(), ".kiro", "skills", skillName, "SKILL.md");
17
+ if (fs.existsSync(localSkill) || fs.existsSync(globalSkill)) process.exit(0);
18
+
19
+ console.log("[kiro-10x-better] Detected better-auth in package.json — installing security skill...");
20
+ execFileSync(
21
+ "npx",
22
+ ["skills", "add", "better-auth/skills", "--skill", skillName, "-a", "kiro-cli", "-y"],
23
+ {
24
+ stdio: "inherit",
25
+ shell: process.platform === "win32",
26
+ timeout: 40000
27
+ }
28
+ );
29
+ } catch {
30
+ // Never block Kiro CLI startup or file saves if offline or npx is unavailable
31
+ process.exit(0);
32
+ }
@@ -0,0 +1,28 @@
1
+ {
2
+ "version": "v1",
3
+ "hooks": [
4
+ {
5
+ "name": "sync-better-auth-skill-on-start",
6
+ "description": "Auto-installs better-auth-security-best-practices skill if better-auth is added to package.json",
7
+ "trigger": "SessionStart",
8
+ "action": {
9
+ "type": "command",
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
+ },
12
+ "timeout": 45,
13
+ "enabled": true
14
+ },
15
+ {
16
+ "name": "sync-better-auth-skill-on-pkg-save",
17
+ "description": "Auto-installs better-auth-security-best-practices skill when package.json is saved with better-auth",
18
+ "trigger": "PostFileSave",
19
+ "matcher": "package\\.json$",
20
+ "action": {
21
+ "type": "command",
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
+ },
24
+ "timeout": 45,
25
+ "enabled": true
26
+ }
27
+ ]
28
+ }