claude-launchpad 1.2.0 → 1.2.2

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.
Files changed (32) hide show
  1. package/README.md +1 -1
  2. package/dist/{chunk-KNZNSGG7.js → chunk-IXNWBG7U.js} +2 -2
  3. package/dist/{chunk-AODUVQTD.js → chunk-KKC42IEO.js} +3 -3
  4. package/dist/{chunk-B3TMKRRD.js → chunk-WU3KYYLA.js} +12 -10
  5. package/dist/chunk-WU3KYYLA.js.map +1 -0
  6. package/dist/{chunk-FEHG2YGH.js → chunk-WZ5CLBFU.js} +2 -2
  7. package/dist/cli.js +15 -15
  8. package/dist/cli.js.map +1 -1
  9. package/dist/commands/memory/server.js +3 -3
  10. package/dist/{context-5E5YRTNL.js → context-ZCTBWZ3O.js} +5 -5
  11. package/dist/{install-UJCGFW5S.js → install-7JGAYDND.js} +5 -5
  12. package/dist/{pull-RHLYDRV4.js → pull-2ADXVXJC.js} +6 -6
  13. package/dist/{push-P3WRL737.js → push-ZFF7WWER.js} +6 -6
  14. package/dist/{require-deps-GMTWCZ3R.js → require-deps-Q3XEE5A3.js} +3 -3
  15. package/dist/{stats-WUF5XKCM.js → stats-F7WII23A.js} +6 -6
  16. package/dist/{sync-clean-XEBIFE5G.js → sync-clean-QL3F2FYV.js} +2 -2
  17. package/dist/{sync-status-W7XMCOWL.js → sync-status-P5JFNOPR.js} +6 -6
  18. package/dist/{tui-532LXDAE.js → tui-OZUNI5ZC.js} +4 -4
  19. package/package.json +1 -1
  20. package/dist/chunk-B3TMKRRD.js.map +0 -1
  21. /package/dist/{chunk-KNZNSGG7.js.map → chunk-IXNWBG7U.js.map} +0 -0
  22. /package/dist/{chunk-AODUVQTD.js.map → chunk-KKC42IEO.js.map} +0 -0
  23. /package/dist/{chunk-FEHG2YGH.js.map → chunk-WZ5CLBFU.js.map} +0 -0
  24. /package/dist/{context-5E5YRTNL.js.map → context-ZCTBWZ3O.js.map} +0 -0
  25. /package/dist/{install-UJCGFW5S.js.map → install-7JGAYDND.js.map} +0 -0
  26. /package/dist/{pull-RHLYDRV4.js.map → pull-2ADXVXJC.js.map} +0 -0
  27. /package/dist/{push-P3WRL737.js.map → push-ZFF7WWER.js.map} +0 -0
  28. /package/dist/{require-deps-GMTWCZ3R.js.map → require-deps-Q3XEE5A3.js.map} +0 -0
  29. /package/dist/{stats-WUF5XKCM.js.map → stats-F7WII23A.js.map} +0 -0
  30. /package/dist/{sync-clean-XEBIFE5G.js.map → sync-clean-QL3F2FYV.js.map} +0 -0
  31. /package/dist/{sync-status-W7XMCOWL.js.map → sync-status-P5JFNOPR.js.map} +0 -0
  32. /package/dist/{tui-532LXDAE.js.map → tui-OZUNI5ZC.js.map} +0 -0
@@ -24,9 +24,9 @@ import {
24
24
  loadConfig,
25
25
  migrate,
26
26
  resolveDataDir
27
- } from "../../chunk-AODUVQTD.js";
28
- import "../../chunk-KNZNSGG7.js";
29
- import "../../chunk-B3TMKRRD.js";
27
+ } from "../../chunk-KKC42IEO.js";
28
+ import "../../chunk-IXNWBG7U.js";
29
+ import "../../chunk-WU3KYYLA.js";
30
30
 
31
31
  // src/commands/memory/server.ts
32
32
  import { createRequire } from "module";
@@ -8,7 +8,7 @@ import {
8
8
  } from "./chunk-NAW47BYA.js";
9
9
  import {
10
10
  initStorage
11
- } from "./chunk-FEHG2YGH.js";
11
+ } from "./chunk-WZ5CLBFU.js";
12
12
  import "./chunk-V4NXT4KB.js";
13
13
  import {
14
14
  DEFAULT_DECAY_PARAMS,
@@ -22,9 +22,9 @@ import {
22
22
  RECENCY_HALF_LIFE,
23
23
  TYPE_INJECTION_BONUS,
24
24
  estimateTokens
25
- } from "./chunk-AODUVQTD.js";
26
- import "./chunk-KNZNSGG7.js";
27
- import "./chunk-B3TMKRRD.js";
25
+ } from "./chunk-KKC42IEO.js";
26
+ import "./chunk-IXNWBG7U.js";
27
+ import "./chunk-WU3KYYLA.js";
28
28
 
29
29
  // src/commands/memory/subcommands/context.ts
30
30
  import { readFileSync, writeFileSync } from "fs";
@@ -439,4 +439,4 @@ async function runContext(opts) {
439
439
  export {
440
440
  runContext
441
441
  };
442
- //# sourceMappingURL=context-5E5YRTNL.js.map
442
+ //# sourceMappingURL=context-ZCTBWZ3O.js.map
@@ -5,8 +5,8 @@ import {
5
5
  loadConfig,
6
6
  migrate,
7
7
  resolveDataDir
8
- } from "./chunk-AODUVQTD.js";
9
- import "./chunk-KNZNSGG7.js";
8
+ } from "./chunk-KKC42IEO.js";
9
+ import "./chunk-IXNWBG7U.js";
10
10
  import {
11
11
  getMemoryPlacement,
12
12
  log,
@@ -14,7 +14,7 @@ import {
14
14
  readSettingsLocalJson,
15
15
  writeSettingsJson,
16
16
  writeSettingsLocalJson
17
- } from "./chunk-B3TMKRRD.js";
17
+ } from "./chunk-WU3KYYLA.js";
18
18
 
19
19
  // src/commands/memory/subcommands/install.ts
20
20
  import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
@@ -181,7 +181,7 @@ function addToolPermissions(settings) {
181
181
  };
182
182
  }
183
183
  async function ensureNativeDeps() {
184
- const { cwdRequire } = await import("./require-deps-GMTWCZ3R.js");
184
+ const { cwdRequire } = await import("./require-deps-Q3XEE5A3.js");
185
185
  try {
186
186
  cwdRequire("better-sqlite3");
187
187
  return;
@@ -308,4 +308,4 @@ export {
308
308
  detectExistingSetup,
309
309
  runInstall
310
310
  };
311
- //# sourceMappingURL=install-UJCGFW5S.js.map
311
+ //# sourceMappingURL=install-7JGAYDND.js.map
@@ -17,13 +17,13 @@ import {
17
17
  } from "./chunk-NAW47BYA.js";
18
18
  import {
19
19
  initStorage
20
- } from "./chunk-FEHG2YGH.js";
20
+ } from "./chunk-WZ5CLBFU.js";
21
21
  import "./chunk-V4NXT4KB.js";
22
- import "./chunk-AODUVQTD.js";
23
- import "./chunk-KNZNSGG7.js";
22
+ import "./chunk-KKC42IEO.js";
23
+ import "./chunk-IXNWBG7U.js";
24
24
  import {
25
25
  log
26
- } from "./chunk-B3TMKRRD.js";
26
+ } from "./chunk-WU3KYYLA.js";
27
27
 
28
28
  // src/commands/memory/subcommands/pull.ts
29
29
  async function runPull(opts) {
@@ -33,7 +33,7 @@ async function runPull(opts) {
33
33
  log.error("No sync gist found. Run `memory push` first.");
34
34
  return;
35
35
  }
36
- const { requireMemoryDeps } = await import("./require-deps-GMTWCZ3R.js");
36
+ const { requireMemoryDeps } = await import("./require-deps-Q3XEE5A3.js");
37
37
  await requireMemoryDeps();
38
38
  const ctx = initStorage();
39
39
  try {
@@ -112,4 +112,4 @@ function printResult(result, project) {
112
112
  export {
113
113
  runPull
114
114
  };
115
- //# sourceMappingURL=pull-RHLYDRV4.js.map
115
+ //# sourceMappingURL=pull-2ADXVXJC.js.map
@@ -18,13 +18,13 @@ import {
18
18
  } from "./chunk-NAW47BYA.js";
19
19
  import {
20
20
  initStorage
21
- } from "./chunk-FEHG2YGH.js";
21
+ } from "./chunk-WZ5CLBFU.js";
22
22
  import "./chunk-V4NXT4KB.js";
23
- import "./chunk-AODUVQTD.js";
24
- import "./chunk-KNZNSGG7.js";
23
+ import "./chunk-KKC42IEO.js";
24
+ import "./chunk-IXNWBG7U.js";
25
25
  import {
26
26
  log
27
- } from "./chunk-B3TMKRRD.js";
27
+ } from "./chunk-WU3KYYLA.js";
28
28
 
29
29
  // src/commands/memory/subcommands/push.ts
30
30
  import { hostname } from "os";
@@ -48,7 +48,7 @@ function filterRelations(allRelations, memoryIds) {
48
48
  }
49
49
  async function runPush(opts) {
50
50
  assertGhAvailable();
51
- const { requireMemoryDeps } = await import("./require-deps-GMTWCZ3R.js");
51
+ const { requireMemoryDeps } = await import("./require-deps-Q3XEE5A3.js");
52
52
  await requireMemoryDeps();
53
53
  const ctx = initStorage();
54
54
  try {
@@ -148,4 +148,4 @@ async function confirmCreate() {
148
148
  export {
149
149
  runPush
150
150
  };
151
- //# sourceMappingURL=push-P3WRL737.js.map
151
+ //# sourceMappingURL=push-ZFF7WWER.js.map
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  cwdRequire,
4
4
  requireMemoryDeps
5
- } from "./chunk-KNZNSGG7.js";
6
- import "./chunk-B3TMKRRD.js";
5
+ } from "./chunk-IXNWBG7U.js";
6
+ import "./chunk-WU3KYYLA.js";
7
7
  export {
8
8
  cwdRequire,
9
9
  requireMemoryDeps
10
10
  };
11
- //# sourceMappingURL=require-deps-GMTWCZ3R.js.map
11
+ //# sourceMappingURL=require-deps-Q3XEE5A3.js.map
@@ -1,13 +1,13 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  initStorage
4
- } from "./chunk-FEHG2YGH.js";
4
+ } from "./chunk-WZ5CLBFU.js";
5
5
  import "./chunk-V4NXT4KB.js";
6
- import "./chunk-AODUVQTD.js";
7
- import "./chunk-KNZNSGG7.js";
6
+ import "./chunk-KKC42IEO.js";
7
+ import "./chunk-IXNWBG7U.js";
8
8
  import {
9
9
  log
10
- } from "./chunk-B3TMKRRD.js";
10
+ } from "./chunk-WU3KYYLA.js";
11
11
 
12
12
  // src/commands/memory/subcommands/stats.ts
13
13
  import { existsSync, statSync } from "fs";
@@ -18,7 +18,7 @@ function formatBytes(bytes) {
18
18
  return `${(bytes / (1024 * 1024)).toFixed(1)}MB`;
19
19
  }
20
20
  async function runStats(opts) {
21
- const { requireMemoryDeps } = await import("./require-deps-GMTWCZ3R.js");
21
+ const { requireMemoryDeps } = await import("./require-deps-Q3XEE5A3.js");
22
22
  await requireMemoryDeps();
23
23
  const ctx = initStorage(opts.dbPath);
24
24
  try {
@@ -72,4 +72,4 @@ async function runStats(opts) {
72
72
  export {
73
73
  runStats
74
74
  };
75
- //# sourceMappingURL=stats-WUF5XKCM.js.map
75
+ //# sourceMappingURL=stats-F7WII23A.js.map
@@ -9,7 +9,7 @@ import {
9
9
  } from "./chunk-3UJYOWGF.js";
10
10
  import {
11
11
  log
12
- } from "./chunk-B3TMKRRD.js";
12
+ } from "./chunk-WU3KYYLA.js";
13
13
 
14
14
  // src/commands/memory/subcommands/sync-clean.ts
15
15
  import { confirm } from "@inquirer/prompts";
@@ -50,4 +50,4 @@ async function runSyncClean(project, opts) {
50
50
  export {
51
51
  runSyncClean
52
52
  };
53
- //# sourceMappingURL=sync-clean-XEBIFE5G.js.map
53
+ //# sourceMappingURL=sync-clean-QL3F2FYV.js.map
@@ -12,13 +12,13 @@ import {
12
12
  import "./chunk-F5PNKQKW.js";
13
13
  import {
14
14
  initStorage
15
- } from "./chunk-FEHG2YGH.js";
15
+ } from "./chunk-WZ5CLBFU.js";
16
16
  import "./chunk-V4NXT4KB.js";
17
- import "./chunk-AODUVQTD.js";
18
- import "./chunk-KNZNSGG7.js";
17
+ import "./chunk-KKC42IEO.js";
18
+ import "./chunk-IXNWBG7U.js";
19
19
  import {
20
20
  log
21
- } from "./chunk-B3TMKRRD.js";
21
+ } from "./chunk-WU3KYYLA.js";
22
22
 
23
23
  // src/commands/memory/subcommands/sync-status.ts
24
24
  async function runSyncStatus() {
@@ -28,7 +28,7 @@ async function runSyncStatus() {
28
28
  log.error("No sync gist found. Run `memory push` first.");
29
29
  return;
30
30
  }
31
- const { requireMemoryDeps } = await import("./require-deps-GMTWCZ3R.js");
31
+ const { requireMemoryDeps } = await import("./require-deps-Q3XEE5A3.js");
32
32
  await requireMemoryDeps();
33
33
  const ctx = initStorage();
34
34
  try {
@@ -67,4 +67,4 @@ async function runSyncStatus() {
67
67
  export {
68
68
  runSyncStatus
69
69
  };
70
- //# sourceMappingURL=sync-status-W7XMCOWL.js.map
70
+ //# sourceMappingURL=sync-status-P5JFNOPR.js.map
@@ -11,9 +11,9 @@ import {
11
11
  loadConfig,
12
12
  migrate,
13
13
  resolveDataDir
14
- } from "./chunk-AODUVQTD.js";
15
- import "./chunk-KNZNSGG7.js";
16
- import "./chunk-B3TMKRRD.js";
14
+ } from "./chunk-KKC42IEO.js";
15
+ import "./chunk-IXNWBG7U.js";
16
+ import "./chunk-WU3KYYLA.js";
17
17
 
18
18
  // src/commands/memory/dashboard/tui.tsx
19
19
  import { render } from "ink";
@@ -1138,4 +1138,4 @@ async function startTui(options) {
1138
1138
  export {
1139
1139
  startTui
1140
1140
  };
1141
- //# sourceMappingURL=tui-532LXDAE.js.map
1141
+ //# sourceMappingURL=tui-OZUNI5ZC.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-launchpad",
3
- "version": "1.2.0",
3
+ "version": "1.2.2",
4
4
  "description": "CLI toolkit for Claude Code — scaffold CLAUDE.md, diagnose config, enforce hooks, test with eval, add persistent memory",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/lib/fs-utils.ts","../src/lib/settings.ts","../src/lib/memory-placement.ts","../src/lib/output.ts","../src/commands/doctor/fixer.ts","../src/lib/detect.ts","../src/commands/init/generators/claudeignore.ts","../src/commands/init/generators/skill-enhance.ts","../src/commands/doctor/fixer-memory.ts"],"sourcesContent":["import { readFile, access } from \"node:fs/promises\";\n\nexport async function fileExists(path: string): Promise<boolean> {\n try {\n await access(path);\n return true;\n } catch {\n return false;\n }\n}\n\nexport async function readFileOrNull(path: string): Promise<string | null> {\n try {\n return await readFile(path, \"utf-8\");\n } catch {\n return null;\n }\n}\n\nexport async function readJsonOrNull<T>(path: string): Promise<T | null> {\n try {\n const content = await readFile(path, \"utf-8\");\n return JSON.parse(content) as T;\n } catch {\n return null;\n }\n}\n","import { readFile, writeFile, mkdir } from \"node:fs/promises\";\nimport { join } from \"node:path\";\n\nexport async function readSettingsJson(root: string): Promise<Record<string, unknown>> {\n const path = join(root, \".claude\", \"settings.json\");\n try {\n const content = await readFile(path, \"utf-8\");\n return JSON.parse(content) as Record<string, unknown>;\n } catch {\n return {};\n }\n}\n\nexport async function writeSettingsJson(root: string, settings: Record<string, unknown>): Promise<void> {\n const dir = join(root, \".claude\");\n await mkdir(dir, { recursive: true });\n await writeFile(join(dir, \"settings.json\"), JSON.stringify(settings, null, 2) + \"\\n\");\n}\n\nexport async function readSettingsLocalJson(root: string): Promise<Record<string, unknown>> {\n const path = join(root, \".claude\", \"settings.local.json\");\n try {\n const content = await readFile(path, \"utf-8\");\n return JSON.parse(content) as Record<string, unknown>;\n } catch {\n return {};\n }\n}\n\nexport async function writeSettingsLocalJson(root: string, settings: Record<string, unknown>): Promise<void> {\n const dir = join(root, \".claude\");\n await mkdir(dir, { recursive: true });\n await writeFile(join(dir, \"settings.local.json\"), JSON.stringify(settings, null, 2) + \"\\n\");\n}\n","import { select } from \"@inquirer/prompts\";\nimport { readSettingsJson, readSettingsLocalJson, writeSettingsLocalJson } from \"./settings.js\";\nimport type { MemoryPlacement } from \"../types/index.js\";\n\nfunction hasMemoryPermissions(settings: Record<string, unknown>): boolean {\n const permissions = settings.permissions as Record<string, unknown> | undefined;\n const allow = (permissions?.allow as string[] | undefined) ?? [];\n return allow.some((p) => p.includes(\"agentic-memory\"));\n}\n\nexport async function getMemoryPlacement(root: string, skipPrompt = false): Promise<MemoryPlacement> {\n const local = await readSettingsLocalJson(root);\n const persisted = local.memoryPlacement;\n if (persisted === \"shared\" || persisted === \"local\") {\n return persisted;\n }\n\n // Backfill: infer from where agentic-memory permissions already live\n if (hasMemoryPermissions(local)) {\n await writeSettingsLocalJson(root, { ...local, memoryPlacement: \"local\" });\n return \"local\";\n }\n const shared = await readSettingsJson(root);\n if (hasMemoryPermissions(shared)) {\n await writeSettingsLocalJson(root, { ...local, memoryPlacement: \"shared\" });\n return \"shared\";\n }\n\n if (skipPrompt) return \"shared\";\n\n const choice = await select<MemoryPlacement>({\n message: \"Where should memory config go?\",\n choices: [\n { value: \"shared\", name: \"Shared (team sees it) — CLAUDE.md + settings.json\" },\n { value: \"local\", name: \"Local (only you) — .claude/CLAUDE.md + settings.local.json\" },\n ],\n });\n\n await writeSettingsLocalJson(root, { ...local, memoryPlacement: choice });\n return choice;\n}\n","import chalk from \"chalk\";\nimport type { Severity, AnalyzerResult, DiagnosticIssue } from \"../types/index.js\";\nimport { hasAutoFix } from \"../commands/doctor/fixer.js\";\n\n// ─── Colors ───\n\nexport const colors = {\n success: chalk.green,\n error: chalk.red,\n warn: chalk.yellow,\n info: chalk.cyan,\n dim: chalk.dim,\n bold: chalk.bold,\n score: (score: number): string => {\n if (score >= 80) return chalk.green.bold(`${score}%`);\n if (score >= 60) return chalk.yellow.bold(`${score}%`);\n return chalk.red.bold(`${score}%`);\n },\n severity: (sev: Severity): string => {\n const map: Record<Severity, (s: string) => string> = {\n critical: chalk.bgRed.white.bold,\n high: chalk.red.bold,\n medium: chalk.yellow,\n low: chalk.cyan,\n info: chalk.dim,\n };\n return map[sev](` ${sev.toUpperCase()} `);\n },\n} as const;\n\n// ─── Prefixed Output ───\n\nexport const log = {\n success: (msg: string): void => console.log(` ${chalk.green(\"✓\")} ${msg}`),\n error: (msg: string): void => console.log(` ${chalk.red(\"✗\")} ${msg}`),\n warn: (msg: string): void => console.log(` ${chalk.yellow(\"!\")} ${msg}`),\n step: (msg: string): void => console.log(` ${chalk.cyan(\"→\")} ${msg}`),\n info: (msg: string): void => console.log(` ${chalk.dim(\"·\")} ${msg}`),\n blank: (): void => console.log(),\n} as const;\n\n// ─── Banner ───\n\nexport function printBanner(): void {\n log.blank();\n console.log(chalk.cyan.bold(\" Claude Launchpad\"));\n console.log(chalk.dim(\" Scaffold · Diagnose · Evaluate · Remember\"));\n log.blank();\n}\n\n// ─── Score Display ───\n\nexport function printScoreCard(label: string, score: number, max: number = 100): void {\n const pct = Math.round((score / max) * 100);\n const bar = renderBar(pct, 20);\n console.log(` ${chalk.bold(label.padEnd(22))} ${bar} ${colors.score(pct).padStart(12)}`);\n}\n\nfunction renderBar(pct: number, width: number): string {\n const filled = Math.round((pct / 100) * width);\n const empty = width - filled;\n const color = pct >= 80 ? chalk.green : pct >= 60 ? chalk.yellow : chalk.red;\n return color(\"━\".repeat(filled)) + chalk.dim(\"─\".repeat(empty));\n}\n\n// ─── Issues List (replaces table) ───\n\nexport function printIssue(severity: Severity, _analyzer: string, message: string): void {\n const sevLabel: Record<Severity, string> = {\n critical: chalk.bgRed.white.bold(\" CRIT \"),\n high: chalk.red.bold(\"HIGH\"),\n medium: chalk.yellow(\"MED \"),\n low: chalk.dim(\"LOW \"),\n info: chalk.dim(\"INFO\"),\n };\n console.log(` ${sevLabel[severity]} ${message}`);\n}\n\n// ─── Report Rendering (shared by doctor + watcher) ───\n\nexport function renderDoctorReport(results: ReadonlyArray<AnalyzerResult>, options?: { afterFix?: boolean }): {\n overallScore: number;\n actionableCount: number;\n} {\n const overallScore = Math.round(\n results.reduce((sum, r) => sum + r.score, 0) / results.length,\n );\n\n for (const result of results) {\n printScoreCard(result.name, result.score);\n }\n log.blank();\n printScoreCard(\"Overall\", overallScore);\n log.blank();\n\n const allIssues = results.flatMap((r) => r.issues);\n const actionable = allIssues.filter((i) => i.severity !== \"info\");\n\n if (actionable.length === 0) {\n log.success(\"No issues found. Your configuration looks solid.\");\n return { overallScore, actionableCount: 0 };\n }\n\n const sorted = [...actionable].sort((a, b) => {\n const order: Record<string, number> = { critical: 0, high: 1, medium: 2, low: 3, info: 4 };\n return (order[a.severity] ?? 4) - (order[b.severity] ?? 4);\n });\n\n for (const issue of sorted) {\n printIssue(issue.severity, issue.analyzer, issue.message);\n }\n\n log.blank();\n if (options?.afterFix) {\n log.info(`${actionable.length} remaining issue(s) require manual intervention.`);\n } else {\n const fixable = actionable.filter((i) => hasAutoFix(i));\n if (fixable.length > 0) {\n log.info(`${actionable.length} issue(s). Run ${chalk.bold(\"--fix\")} to auto-repair or ${chalk.bold(\"--fix --dry-run\")} to preview.`);\n } else {\n log.info(`${actionable.length} issue(s) require manual intervention.`);\n }\n }\n return { overallScore, actionableCount: actionable.length };\n}\n","import { readFile, writeFile, mkdir, access } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { homedir } from \"node:os\";\nimport { log } from \"../../lib/output.js\";\nimport { fileExists } from \"../../lib/fs-utils.js\";\nimport { detectProject } from \"../../lib/detect.js\";\nimport { generateClaudeignore } from \"../init/generators/claudeignore.js\";\nimport { generateEnhanceSkill } from \"../init/generators/skill-enhance.js\";\nimport { readSettingsJson, writeSettingsJson } from \"../../lib/settings.js\";\nimport { getMemoryPlacement } from \"../../lib/memory-placement.js\";\nimport {\n disableAutoMemory, addMemoryToolPermissions, addAllowedMcpServers,\n addSessionStartPullHook, addSessionEndPushHook, removeStaleStopHook,\n} from \"./fixer-memory.js\";\nimport type { DiagnosticIssue, DetectedProject, MemoryPlacement } from \"../../types/index.js\";\n\ninterface FixResult {\n readonly fixed: number;\n readonly skipped: number;\n}\n\n/**\n * Auto-apply deterministic fixes for doctor issues.\n * Only applies fixes that are safe and unambiguous.\n */\nexport async function applyFixes(\n issues: ReadonlyArray<DiagnosticIssue>,\n projectRoot: string,\n): Promise<FixResult> {\n const detected = await detectProject(projectRoot);\n const hasMemoryIssues = issues.some((i) => i.analyzer === \"Memory\");\n const placement = hasMemoryIssues ? await getMemoryPlacement(projectRoot) : \"shared\";\n let fixed = 0;\n let skipped = 0;\n\n for (const issue of issues) {\n const applied = await tryFix(issue, projectRoot, detected, placement);\n if (applied) {\n fixed++;\n } else {\n skipped++;\n }\n }\n\n return { fixed, skipped };\n}\n\n// Fix lookup table: [analyzer, message substring] → fix function\ntype FixFn = (root: string, detected: DetectedProject, placement: MemoryPlacement) => Promise<boolean>;\n\nconst FIX_TABLE: ReadonlyArray<{ analyzer: string; match: string; fix: FixFn }> = [\n { analyzer: \"Hooks\", match: \"No hooks configured\", fix: async (root, detected) => {\n const a = await addEnvProtectionHook(root);\n const b = await addAutoFormatHook(root, detected);\n const c = await addForcePushProtection(root);\n const d = await addSessionStartHook(root);\n return a || b || c || d;\n }},\n { analyzer: \"Hooks\", match: \".env file protection\", fix: (root) => addEnvProtectionHook(root) },\n { analyzer: \"Hooks\", match: \"auto-format\", fix: (root, detected) => addAutoFormatHook(root, detected) },\n { analyzer: \"Hooks\", match: \"No PreToolUse\", fix: (root) => addEnvProtectionHook(root) },\n { analyzer: \"Quality\", match: \"Architecture\", fix: (root) => addClaudeMdSection(root, \"## Architecture\", \"<!-- TODO: Describe your codebase structure. Run `/lp-enhance` to auto-fill this. -->\") },\n { analyzer: \"Quality\", match: \"Off-Limits\", fix: (root) => addClaudeMdSection(root, \"## Off-Limits\", \"- Never hardcode secrets - use environment variables\\n- Never write to `.env` files\\n- Never expose internal error details in API responses\") },\n { analyzer: \"Quality\", match: \"Commands\", fix: (root) => addClaudeMdSection(root, \"## Commands\", \"<!-- TODO: Add your dev/build/test commands -->\") },\n { analyzer: \"Quality\", match: \"Stack\", fix: (root, detected) => {\n const content = detected.language\n ? `- **Language**: ${detected.language}${detected.framework ? `\\n- **Framework**: ${detected.framework}` : \"\"}${detected.packageManager ? `\\n- **Package Manager**: ${detected.packageManager}` : \"\"}`\n : \"<!-- TODO: Define your tech stack -->\";\n return addClaudeMdSection(root, \"## Stack\", content);\n }},\n { analyzer: \"Quality\", match: \"Session Start\", fix: (root) => addClaudeMdSection(root, \"## Session Start\", \"- ALWAYS read @TASKS.md first - it tracks progress across sessions\\n- Update TASKS.md as you complete work\") },\n { analyzer: \"Quality\", match: \"Backlog\", fix: (root) => addClaudeMdSection(root, \"## Backlog\", \"- When a feature is discussed but deferred, add it to BACKLOG.md immediately\\n- Never leave future ideas only in TASKS.md or conversation — they get lost\\n- BACKLOG.md is the single source of truth for parked features\") },\n { analyzer: \"Quality\", match: \"When Stuck\", fix: (root) => addClaudeMdSection(root, \"## When Stuck\", \"Three failed iterations on the same problem = stop iterating alone.\\nOn the fourth attempt, spin up at least 3 parallel agents via the Agent tool, each investigating from a different angle:\\n1. Root-cause debug agent\\n2. Upstream library/docs research agent\\n3. Alternative architecture agent\\nWait for all agents to return, synthesize their findings, then act.\\nDon't keep guessing in circles — rotate perspectives.\") },\n { analyzer: \"Rules\", match: \"No BACKLOG.md\", fix: (root) => createBacklogMd(root) },\n { analyzer: \"Rules\", match: \"No .claudeignore\", fix: (root, detected) => createClaudeignore(root, detected) },\n { analyzer: \"Rules\", match: \"No .claude/rules/\", fix: (root) => createStarterRules(root) },\n { analyzer: \"Hooks\", match: \"PostCompact\", fix: (root) => addPostCompactHook(root) },\n { analyzer: \"Permissions\", match: \"force-push\", fix: (root) => addForcePushProtection(root) },\n { analyzer: \"Permissions\", match: \"Credential files not blocked\", fix: (root) => addCredentialDenyRules(root) },\n { analyzer: \"Permissions\", match: \"Bypass permissions mode\", fix: (root) => addBypassDisable(root) },\n { analyzer: \"Permissions\", match: \"Sandbox not enabled\", fix: (root) => addSandboxSettings(root) },\n { analyzer: \"Permissions\", match: \".env is protected by hooks but not in .claudeignore\", fix: (root) => addEnvToClaudeignore(root) },\n { analyzer: \"Rules\", match: \"No skill authoring conventions\", fix: (root) => addSkillAuthoringConventions(root) },\n { analyzer: \"Rules\", match: \"No /lp-enhance skill\", fix: (root) => createEnhanceSkill(root) },\n { analyzer: \"Rules\", match: \"lp-enhance skill is outdated\", fix: (root) => updateEnhanceSkill(root) },\n { analyzer: \"Settings\", match: \"Deprecated includeCoAuthoredBy\", fix: (root) => migrateAttribution(root) },\n { analyzer: \"Hooks\", match: \"SessionStart\", fix: (root) => addSessionStartHook(root) },\n { analyzer: \"Memory\", match: \"Deprecated Stop hook\", fix: (root) => removeStaleStopHook(root) },\n { analyzer: \"Memory\", match: \"autoMemoryEnabled not disabled\", fix: (root, _det, placement) => disableAutoMemory(root, placement) },\n { analyzer: \"Memory\", match: \"MCP tool permission\", fix: (root, _det, placement) => addMemoryToolPermissions(root, placement) },\n { analyzer: \"MCP\", match: \"no allowedMcpServers\", fix: (root, _det, placement) => addAllowedMcpServers(root, placement) },\n { analyzer: \"Memory\", match: \"SessionStart hook to auto-pull\", fix: (root, _det, placement) => addSessionStartPullHook(root, placement) },\n { analyzer: \"Memory\", match: \"SessionEnd hook to auto-push\", fix: (root, _det, placement) => addSessionEndPushHook(root, placement) },\n { analyzer: \"Memory\", match: \"CLAUDE.md missing memory guidance\", fix: (root, _det, placement) => {\n const content = \"Use agentic-memory to persist knowledge across sessions:\\n- Memories are automatically injected at session start\\n- STORE IMMEDIATELY when: a dependency strategy changes, an architecture decision is made, a convention is established, a bug pattern is discovered, or a feature is killed/added\\n- Use memory_search before memory_store to check for duplicates\\n- NEVER store credentials, API keys, tokens, or secrets in memories\";\n const target = placement === \"local\" ? join(root, \".claude\", \"CLAUDE.md\") : undefined;\n return addClaudeMdSection(root, \"## Memory\", content, target);\n }},\n];\n\nexport function hasAutoFix(issue: DiagnosticIssue): boolean {\n return FIX_TABLE.some(\n (e) => e.analyzer === issue.analyzer && issue.message.includes(e.match),\n );\n}\n\nasync function tryFix(\n issue: DiagnosticIssue,\n root: string,\n detected: DetectedProject,\n placement: MemoryPlacement,\n): Promise<boolean> {\n const entry = FIX_TABLE.find(\n (e) => e.analyzer === issue.analyzer && issue.message.includes(e.match),\n );\n return entry ? entry.fix(root, detected, placement) : false;\n}\n\n// ─── Hook Helper ───\n\nasync function addHook(\n root: string,\n event: string,\n dedupKeyword: string,\n entry: Record<string, unknown>,\n successMsg: string,\n): Promise<boolean> {\n const settings = await readSettingsJson(root);\n const hooks = (settings.hooks ?? {}) as Record<string, unknown>;\n const hookList = (hooks[event] as Record<string, unknown>[] | undefined) ?? [];\n\n const alreadyHas = hookList.some((g: Record<string, unknown>) => {\n const nested = g.hooks as Record<string, unknown>[] | undefined;\n return nested?.some((h) => String(h.command ?? \"\").includes(dedupKeyword));\n });\n if (alreadyHas) return false;\n\n const updated = [...hookList, entry];\n const updatedSettings = { ...settings, hooks: { ...hooks, [event]: updated } };\n await writeSettingsJson(root, updatedSettings);\n log.success(successMsg);\n return true;\n}\n\n// ─── Fix Implementations ───\n\nasync function addEnvProtectionHook(root: string): Promise<boolean> {\n return addHook(root, \"PreToolUse\", \".env\", {\n matcher: \"Read|Write|Edit\",\n hooks: [{\n type: \"command\",\n command: \"echo \\\"$TOOL_INPUT_FILE_PATH\\\" | grep -qE '\\\\.(env|env\\\\..*)$' && ! echo \\\"$TOOL_INPUT_FILE_PATH\\\" | grep -q '.env.example' && echo 'BLOCKED: .env files contain secrets' && exit 1; exit 0\",\n }],\n }, \"Added .env file protection hook (PreToolUse)\");\n}\n\nasync function addAutoFormatHook(root: string, detected: DetectedProject): Promise<boolean> {\n if (!detected.language) return false;\n\n const formatters: Record<string, { extensions: string[]; command: string }> = {\n TypeScript: { extensions: [\"ts\", \"tsx\"], command: \"npx prettier --write\" },\n JavaScript: { extensions: [\"js\", \"jsx\"], command: \"npx prettier --write\" },\n Python: { extensions: [\"py\"], command: \"ruff format\" },\n Go: { extensions: [\"go\"], command: \"gofmt -w\" },\n Rust: { extensions: [\"rs\"], command: \"rustfmt\" },\n Ruby: { extensions: [\"rb\"], command: \"rubocop -A\" },\n PHP: { extensions: [\"php\"], command: \"vendor/bin/pint\" },\n };\n\n const config = formatters[detected.language];\n if (!config) return false;\n\n const extChecks = config.extensions.map((ext) => `[ \"$ext\" = \"${ext}\" ]`).join(\" || \");\n return addHook(root, \"PostToolUse\", \"format\", {\n matcher: \"Write|Edit\",\n hooks: [{\n type: \"command\",\n command: `ext=\\${TOOL_INPUT_FILE_PATH##*.}; (${extChecks}) && ${config.command} \"$TOOL_INPUT_FILE_PATH\" 2>/dev/null; exit 0`,\n }],\n }, `Added auto-format hook (PostToolUse → ${config.command})`);\n}\n\nasync function addForcePushProtection(root: string): Promise<boolean> {\n return addHook(root, \"PreToolUse\", \"force\", {\n matcher: \"Bash\",\n hooks: [{\n type: \"command\",\n command: \"echo \\\"$TOOL_INPUT_COMMAND\\\" | grep -qE 'push.*--force|push.*-f' && echo 'WARNING: Force push detected — this can destroy remote history' && exit 1; exit 0\",\n }],\n }, \"Added force-push protection hook (PreToolUse → Bash)\");\n}\n\nasync function addPostCompactHook(root: string): Promise<boolean> {\n return addHook(root, \"PostCompact\", \"TASKS.md\", {\n matcher: \"\",\n hooks: [{\n type: \"command\",\n command: \"cat TASKS.md 2>/dev/null; exit 0\",\n }],\n }, \"Added PostCompact hook (re-injects TASKS.md after compaction)\");\n}\n\nasync function addSessionStartHook(root: string): Promise<boolean> {\n return addHook(root, \"SessionStart\", \"TASKS.md\", {\n matcher: \"startup|resume\",\n hooks: [{\n type: \"command\",\n command: \"cat TASKS.md 2>/dev/null; exit 0\",\n }],\n }, \"Added SessionStart hook (injects TASKS.md at startup)\");\n}\n\nasync function migrateAttribution(root: string): Promise<boolean> {\n const settings = await readSettingsJson(root);\n if (settings.includeCoAuthoredBy === undefined) return false;\n\n const { includeCoAuthoredBy: _, ...rest } = settings;\n const updated = { ...rest, attribution: { commit: \"\", pr: \"\" } };\n await writeSettingsJson(root, updated);\n log.success(\"Migrated includeCoAuthoredBy → attribution object\");\n return true;\n}\n\nasync function addCredentialDenyRules(root: string): Promise<boolean> {\n const settings = await readSettingsJson(root);\n const permissions = (settings.permissions ?? {}) as Record<string, unknown>;\n const deny = (permissions.deny as string[] | undefined) ?? [];\n\n const toAdd = [\"Read(~/.ssh/*)\", \"Read(~/.aws/*)\", \"Read(~/.npmrc)\"];\n const missing = toAdd.filter((p) => !deny.includes(p));\n if (missing.length === 0) return false;\n\n const updated = { ...settings, permissions: { ...permissions, deny: [...deny, ...missing] } };\n await writeSettingsJson(root, updated);\n log.success(\"Added credential deny rules (SSH, AWS, npm)\");\n return true;\n}\n\nasync function addBypassDisable(root: string): Promise<boolean> {\n const settings = await readSettingsJson(root);\n if (settings.disableBypassPermissionsMode === \"disable\") return false;\n\n const updated = { ...settings, disableBypassPermissionsMode: \"disable\" };\n await writeSettingsJson(root, updated);\n log.success(\"Added disableBypassPermissionsMode: disable\");\n return true;\n}\n\nasync function addSandboxSettings(root: string): Promise<boolean> {\n const settings = await readSettingsJson(root);\n const sandbox = settings.sandbox as Record<string, unknown> | undefined;\n if (sandbox?.enabled === true) return false;\n\n const updated = { ...settings, sandbox: { enabled: true, failIfUnavailable: true } };\n await writeSettingsJson(root, updated);\n log.success(\"Enabled sandbox with failIfUnavailable\");\n return true;\n}\n\n\nasync function addEnvToClaudeignore(root: string): Promise<boolean> {\n const ignorePath = join(root, \".claudeignore\");\n let content: string;\n try {\n content = await readFile(ignorePath, \"utf-8\");\n } catch {\n return false; // No .claudeignore to modify\n }\n\n const lines = content.split(\"\\n\").map((l) => l.trim());\n if (lines.some((l) => l === \".env\" || l === \".env.*\" || l === \".env*\")) return false;\n\n await writeFile(ignorePath, content.trimEnd() + \"\\n.env\\n.env.*\\n\");\n log.success(\"Added .env to .claudeignore\");\n return true;\n}\n\nasync function addClaudeMdSection(root: string, heading: string, content: string, targetPath?: string): Promise<boolean> {\n const claudeMdPath = targetPath ?? join(root, \"CLAUDE.md\");\n let existing: string;\n try {\n existing = await readFile(claudeMdPath, \"utf-8\");\n } catch {\n if (!targetPath) return false; // No root CLAUDE.md to add to\n // Create local .claude/CLAUDE.md\n await mkdir(join(root, \".claude\"), { recursive: true });\n existing = \"# Local Claude Config\\n\";\n }\n\n // Don't add if section already exists\n if (existing.includes(heading)) return false;\n\n // Append before Key Decisions if it exists, otherwise at end\n const keyDecisionsIdx = existing.indexOf(\"## Key Decisions\");\n const insertAt = keyDecisionsIdx > -1 ? keyDecisionsIdx : existing.length;\n\n const section = `\\n${heading}\\n${content}\\n\\n`;\n const updated = existing.slice(0, insertAt) + section + existing.slice(insertAt);\n\n await writeFile(claudeMdPath, updated);\n const label = targetPath ? \".claude/CLAUDE.md\" : \"CLAUDE.md\";\n log.success(`Added \"${heading}\" section to ${label}`);\n return true;\n}\n\nasync function createBacklogMd(root: string): Promise<boolean> {\n const backlogPath = join(root, \"BACKLOG.md\");\n try {\n await access(backlogPath);\n return false;\n } catch {\n // Create it\n }\n\n const name = root.split(\"/\").pop() ?? \"Project\";\n await writeFile(backlogPath, `# ${name} - Backlog\n\n> Features discussed but deferred. Pick up when relevant.\n> Priority: P0 = next sprint, P1 = soon, P2 = when relevant.\n`);\n log.success(\"Generated BACKLOG.md\");\n return true;\n}\n\nasync function createClaudeignore(root: string, detected: DetectedProject): Promise<boolean> {\n const ignorePath = join(root, \".claudeignore\");\n try {\n await access(ignorePath);\n return false; // Already exists\n } catch {\n // Create it\n }\n\n const content = generateClaudeignore(detected);\n await writeFile(ignorePath, content);\n log.success(\"Generated .claudeignore with language-specific ignore patterns\");\n return true;\n}\n\nconst SKILL_AUTHORING_SECTION = `\n## Skill Authoring\n\nWhen creating Claude Code skills (.claude/skills/*/SKILL.md):\n\n- Keep SKILL.md under 500 lines — move reference material to supporting files in the same directory\n- Front-load description (first 250 chars shown in listings) with TRIGGER when / DO NOT TRIGGER when clauses\n- Add allowed-tools in frontmatter to restrict tool access (e.g. Read, Glob, Grep for read-only skills)\n- Add argument-hint in frontmatter showing the expected input format (use $ARGUMENTS or $0, $1 for dynamic input)\n- Set disable-model-invocation: true for skills with side effects (deploy, send messages)\n- Structure as phases: Research, Plan, Execute, Verify with \"Done when:\" success criteria per phase\n- Handle edge cases and preconditions before execution\n`;\n\nasync function createStarterRules(root: string): Promise<boolean> {\n const rulesDir = join(root, \".claude\", \"rules\");\n try {\n await access(rulesDir);\n return false; // Already exists\n } catch {\n // Create it\n }\n\n await mkdir(rulesDir, { recursive: true });\n\n await writeFile(\n join(rulesDir, \"conventions.md\"),\n `# Project Conventions\n\n- Use conventional commits (feat:, fix:, docs:, refactor:, test:, chore:)\n- Keep files under 400 lines, functions under 50 lines\n- Handle errors explicitly — no empty catch blocks\n- Validate input at system boundaries\n${SKILL_AUTHORING_SECTION}`,\n );\n\n log.success(\"Created .claude/rules/conventions.md with starter rules\");\n return true;\n}\n\nasync function addSkillAuthoringConventions(root: string): Promise<boolean> {\n const conventionsPath = join(root, \".claude\", \"rules\", \"conventions.md\");\n let content: string;\n try {\n content = await readFile(conventionsPath, \"utf-8\");\n } catch {\n // No conventions.md — createStarterRules will handle it\n return false;\n }\n\n if (/^##\\s+Skill\\s+Authoring/im.test(content)) return false;\n\n await writeFile(conventionsPath, content.trimEnd() + \"\\n\" + SKILL_AUTHORING_SECTION);\n log.success(\"Added Skill Authoring section to .claude/rules/conventions.md\");\n return true;\n}\n\nasync function createEnhanceSkill(root: string): Promise<boolean> {\n const skillDir = join(root, \".claude\", \"skills\", \"lp-enhance\");\n const skillPath = join(skillDir, \"SKILL.md\");\n const globalPath = join(homedir(), \".claude\", \"skills\", \"lp-enhance\", \"SKILL.md\");\n // Also check legacy commands/ location\n const legacyProject = join(root, \".claude\", \"commands\", \"lp-enhance.md\");\n const legacyGlobal = join(homedir(), \".claude\", \"commands\", \"lp-enhance.md\");\n\n if (await fileExists(skillPath) || await fileExists(globalPath)\n || await fileExists(legacyProject) || await fileExists(legacyGlobal)) return false;\n\n await mkdir(skillDir, { recursive: true });\n await writeFile(skillPath, generateEnhanceSkill());\n log.success(\"Generated /lp-enhance skill (.claude/skills/lp-enhance/)\");\n return true;\n}\n\nasync function updateEnhanceSkill(root: string): Promise<boolean> {\n // Update whichever location has the skill installed\n const projectPath = join(root, \".claude\", \"skills\", \"lp-enhance\", \"SKILL.md\");\n const globalPath = join(homedir(), \".claude\", \"skills\", \"lp-enhance\", \"SKILL.md\");\n\n const targetPath = await fileExists(projectPath) ? projectPath\n : await fileExists(globalPath) ? globalPath\n : null;\n\n if (!targetPath) return false;\n\n await writeFile(targetPath, generateEnhanceSkill());\n log.success(\"Updated /lp-enhance skill to latest version\");\n return true;\n}\n\n\n","import { join, basename } from \"node:path\";\nimport { fileExists, readFileOrNull, readJsonOrNull } from \"./fs-utils.js\";\nimport type { DetectedProject } from \"../types/index.js\";\n\n/**\n * Detect project characteristics by scanning manifest files and directory structure.\n * Works with any stack — no hardcoded list of supported frameworks.\n */\nexport async function detectProject(root: string): Promise<DetectedProject> {\n const name = basename(root);\n\n const [pkgJson, goMod, pyProject, gemfile, cargo, pubspec, composerJson, pomXml, buildGradleGroovy, buildGradleKts, packageSwift, mixExs, csproj, lockfiles] = await Promise.all([\n readJsonOrNull<PackageJson>(join(root, \"package.json\")),\n fileExists(join(root, \"go.mod\")),\n readFileOrNull(join(root, \"pyproject.toml\")),\n fileExists(join(root, \"Gemfile\")),\n fileExists(join(root, \"Cargo.toml\")),\n fileExists(join(root, \"pubspec.yaml\")),\n readJsonOrNull<ComposerJson>(join(root, \"composer.json\")),\n fileExists(join(root, \"pom.xml\")),\n fileExists(join(root, \"build.gradle\")),\n fileExists(join(root, \"build.gradle.kts\")),\n fileExists(join(root, \"Package.swift\")),\n fileExists(join(root, \"mix.exs\")),\n globExists(root, \"*.csproj\"),\n detectLockfiles(root),\n ]);\n\n const buildGradle = buildGradleGroovy || buildGradleKts;\n\n const manifests: ManifestState = {\n pkgJson, goMod, pyProject, gemfile, cargo, pubspec,\n composerJson, pomXml, buildGradle, packageSwift, mixExs, csproj,\n };\n\n const language = detectLanguage(manifests);\n const framework = detectFramework(manifests);\n const packageManager = detectPackageManager(manifests, lockfiles);\n const scripts = detectScripts({ pkgJson, pyProject, goMod, gemfile, composerJson, language, packageManager });\n\n return {\n name,\n language,\n framework,\n packageManager,\n hasTests: scripts.testCommand !== null,\n hasLinter: scripts.lintCommand !== null,\n hasFormatter: scripts.formatCommand !== null,\n ...scripts,\n };\n}\n\n// ─── Language Detection ───\n\ninterface ManifestState {\n pkgJson: PackageJson | null;\n goMod: boolean;\n pyProject: string | null;\n gemfile: boolean;\n cargo: boolean;\n pubspec: boolean;\n composerJson: ComposerJson | null;\n pomXml: boolean;\n buildGradle: boolean;\n packageSwift: boolean;\n mixExs: boolean;\n csproj: boolean;\n}\n\nfunction detectLanguage(m: ManifestState): string | null {\n if (m.pkgJson?.devDependencies?.typescript || m.pkgJson?.dependencies?.typescript) return \"TypeScript\";\n if (m.pkgJson) return \"JavaScript\";\n if (m.goMod) return \"Go\";\n if (m.pyProject) return \"Python\";\n if (m.gemfile) return \"Ruby\";\n if (m.cargo) return \"Rust\";\n if (m.pubspec) return \"Dart\";\n if (m.composerJson) return \"PHP\";\n if (m.buildGradle) return \"Kotlin\";\n if (m.pomXml) return \"Java\";\n if (m.packageSwift) return \"Swift\";\n if (m.mixExs) return \"Elixir\";\n if (m.csproj) return \"C#\";\n return null;\n}\n\n// ─── Framework Detection ───\n\nfunction detectFramework(m: ManifestState): string | null {\n const deps = { ...m.pkgJson?.dependencies, ...m.pkgJson?.devDependencies };\n\n // JS/TS frameworks\n if (deps.next) return \"Next.js\";\n if (deps.nuxt) return \"Nuxt\";\n if (deps.svelte || deps[\"@sveltejs/kit\"]) return \"SvelteKit\";\n if (deps.astro) return \"Astro\";\n if (deps[\"@angular/core\"]) return \"Angular\";\n if (deps.remix || deps[\"@remix-run/react\"]) return \"Remix\";\n if (deps.vue) return \"Vue\";\n if (deps.react && !deps.next) return \"React\";\n if (deps.express) return \"Express\";\n if (deps.fastify) return \"Fastify\";\n if (deps.hono) return \"Hono\";\n if (deps.nestjs || deps[\"@nestjs/core\"]) return \"NestJS\";\n\n // Python frameworks\n if (m.pyProject) {\n if (m.pyProject.includes(\"fastapi\")) return \"FastAPI\";\n if (m.pyProject.includes(\"django\")) return \"Django\";\n if (m.pyProject.includes(\"flask\")) return \"Flask\";\n }\n\n // PHP frameworks\n if (m.composerJson) {\n const phpDeps = { ...m.composerJson.require, ...m.composerJson[\"require-dev\"] };\n if (phpDeps[\"laravel/framework\"]) return \"Laravel\";\n if (phpDeps[\"symfony/framework-bundle\"]) return \"Symfony\";\n }\n\n // Ruby\n if (m.gemfile) return \"Rails\";\n\n // JVM\n if (m.buildGradle) return \"Gradle\"; // Could be Spring Boot, Android, etc.\n if (m.pomXml) return \"Maven\";\n\n return null;\n}\n\n// ─── Package Manager Detection ───\n\ninterface DetectedLockfiles {\n pnpmLock: boolean;\n yarnLock: boolean;\n bunLock: boolean;\n npmLock: boolean;\n}\n\nasync function detectLockfiles(root: string): Promise<DetectedLockfiles> {\n const [pnpmLock, yarnLock, bunLock, npmLock] = await Promise.all([\n fileExists(join(root, \"pnpm-lock.yaml\")),\n fileExists(join(root, \"yarn.lock\")),\n fileExists(join(root, \"bun.lockb\")),\n fileExists(join(root, \"package-lock.json\")),\n ]);\n return { pnpmLock, yarnLock, bunLock, npmLock };\n}\n\nfunction detectPackageManager(\n m: Pick<ManifestState, \"pkgJson\" | \"goMod\" | \"pyProject\" | \"gemfile\" | \"cargo\" | \"composerJson\">,\n lockfiles: DetectedLockfiles,\n): string | null {\n if (m.pkgJson) {\n // Check packageManager field first (most explicit)\n const pm = m.pkgJson.packageManager;\n if (pm?.startsWith(\"pnpm\")) return \"pnpm\";\n if (pm?.startsWith(\"yarn\")) return \"yarn\";\n if (pm?.startsWith(\"bun\")) return \"bun\";\n if (pm?.startsWith(\"npm\")) return \"npm\";\n\n // Fall back to lockfile detection\n if (lockfiles.pnpmLock) return \"pnpm\";\n if (lockfiles.yarnLock) return \"yarn\";\n if (lockfiles.bunLock) return \"bun\";\n if (lockfiles.npmLock) return \"npm\";\n\n return \"npm\";\n }\n if (m.goMod) return \"go modules\";\n if (m.pyProject) {\n if (m.pyProject.includes(\"[tool.uv]\")) return \"uv\";\n if (m.pyProject.includes(\"[tool.poetry]\")) return \"poetry\";\n return \"pip\";\n }\n if (m.gemfile) return \"bundler\";\n if (m.cargo) return \"cargo\";\n if (m.composerJson) return \"composer\";\n return null;\n}\n\n// ─── Script Detection ───\n\ninterface DetectedScripts {\n formatCommand: string | null;\n lintCommand: string | null;\n testCommand: string | null;\n devCommand: string | null;\n buildCommand: string | null;\n}\n\n// Language → default scripts config\nconst LANGUAGE_SCRIPTS: Record<string, DetectedScripts> = {\n Go: { devCommand: \"go run .\", buildCommand: \"go build .\", testCommand: \"go test ./...\", lintCommand: \"golangci-lint run\", formatCommand: \"gofmt -w .\" },\n Ruby: { devCommand: \"bin/dev\", buildCommand: null, testCommand: \"bin/rails test\", lintCommand: \"bin/rubocop\", formatCommand: null },\n PHP: { devCommand: \"php artisan serve\", buildCommand: null, testCommand: \"php artisan test\", lintCommand: \"vendor/bin/phpstan analyse\", formatCommand: \"vendor/bin/pint\" },\n Rust: { devCommand: \"cargo run\", buildCommand: \"cargo build\", testCommand: \"cargo test\", lintCommand: \"cargo clippy\", formatCommand: \"cargo fmt\" },\n Java: { devCommand: null, buildCommand: \"mvn package\", testCommand: \"mvn test\", lintCommand: null, formatCommand: null },\n Kotlin: { devCommand: null, buildCommand: \"mvn package\", testCommand: \"mvn test\", lintCommand: null, formatCommand: null },\n Swift: { devCommand: null, buildCommand: \"swift build\", testCommand: \"swift test\", lintCommand: \"swiftlint\", formatCommand: \"swift-format format -r .\" },\n Elixir: { devCommand: \"mix phx.server\", buildCommand: \"mix compile\", testCommand: \"mix test\", lintCommand: \"mix credo\", formatCommand: \"mix format\" },\n \"C#\": { devCommand: \"dotnet run\", buildCommand: \"dotnet build\", testCommand: \"dotnet test\", lintCommand: null, formatCommand: \"dotnet format\" },\n};\n\nfunction detectScripts(m: {\n pkgJson: PackageJson | null;\n pyProject: string | null;\n goMod: boolean;\n gemfile: boolean;\n composerJson: ComposerJson | null;\n language: string | null;\n packageManager: string | null;\n}): DetectedScripts {\n // JS/TS: read from package.json scripts\n if (m.pkgJson) {\n const scripts = m.pkgJson.scripts ?? {};\n const run = pmRun(m.packageManager);\n return {\n devCommand: scripts.dev ? `${run} dev` : null,\n buildCommand: scripts.build ? `${run} build` : null,\n testCommand: scripts.test ? `${run} test` : null,\n lintCommand: scripts.lint ? `${run} lint` : null,\n formatCommand: scripts.format ? `${run} format` : null,\n };\n }\n\n // Python: runner depends on uv vs pip\n if (m.language === \"Python\") {\n const r = m.pyProject?.includes(\"[tool.uv]\") ? \"uv run\" : \"python -m\";\n return { devCommand: null, buildCommand: null, testCommand: `${r} pytest`, lintCommand: `${r} ruff check .`, formatCommand: `${r} ruff format .` };\n }\n\n // Everything else: lookup table\n if (m.language && LANGUAGE_SCRIPTS[m.language]) {\n return LANGUAGE_SCRIPTS[m.language];\n }\n\n return { devCommand: null, buildCommand: null, testCommand: null, lintCommand: null, formatCommand: null };\n}\n\nfunction pmRun(packageManager: string | null): string {\n if (packageManager === \"pnpm\") return \"pnpm\";\n if (packageManager === \"yarn\") return \"yarn\";\n if (packageManager === \"bun\") return \"bun\";\n return \"npm run\";\n}\n\n// ─── Utilities ───\n\ninterface PackageJson {\n name?: string;\n packageManager?: string;\n scripts?: Record<string, string>;\n dependencies?: Record<string, string>;\n devDependencies?: Record<string, string>;\n}\n\ninterface ComposerJson {\n require?: Record<string, string>;\n \"require-dev\"?: Record<string, string>;\n}\n\nasync function globExists(dir: string, pattern: string): Promise<boolean> {\n const { readdir } = await import(\"node:fs/promises\");\n try {\n const entries = await readdir(dir);\n return entries.some((e) => e.endsWith(pattern.replace(\"*\", \"\")));\n } catch {\n return false;\n }\n}\n","import type { DetectedProject } from \"../../../types/index.js\";\n\n/**\n * Generate .claudeignore based on detected project type.\n * Prevents Claude from reading noise files that waste context.\n */\nexport function generateClaudeignore(detected: DetectedProject): string {\n const sections: string[] = [\"# Generated by claude-launchpad\"];\n\n // Universal ignores (every project)\n sections.push(`\n# Build output\ndist/\nbuild/\nout/\n\n# IDE & OS\n.vscode/\n.idea/\n*.swp\n*.swo\n.DS_Store\nThumbs.db\n\n# Test & coverage\ncoverage/\n\n# Environment (should never be read)\n.env\n.env.*\n!.env.example`);\n\n // Language-specific ignores\n const lang = detected.language;\n\n if (lang === \"TypeScript\" || lang === \"JavaScript\") {\n sections.push(`\n# Node\nnode_modules/\n.pnp/\n.yarn/\n.next/\n.nuxt/\n.output/\n.svelte-kit/\n.vercel/\n.turbo/\npnpm-lock.yaml\npackage-lock.json\nyarn.lock\nbun.lockb\n.nyc_output/\n__snapshots__/`);\n }\n\n if (lang === \"Python\") {\n sections.push(`\n# Python\n__pycache__/\n*.pyc\n*.pyo\n.venv/\nvenv/\n.mypy_cache/\n.ruff_cache/\n.pytest_cache/\n*.egg-info/`);\n }\n\n if (lang === \"Go\") {\n sections.push(`\n# Go\nbin/\nvendor/`);\n }\n\n if (lang === \"Rust\") {\n sections.push(`\n# Rust\ntarget/\nCargo.lock`);\n }\n\n if (lang === \"Ruby\") {\n sections.push(`\n# Ruby\nvendor/bundle/\n.bundle/\ntmp/\nlog/`);\n }\n\n if (lang === \"Java\" || lang === \"Kotlin\") {\n sections.push(`\n# JVM\ntarget/\nbuild/\n.gradle/\n*.class\n*.jar`);\n }\n\n if (lang === \"Dart\") {\n sections.push(`\n# Dart/Flutter\n.dart_tool/\n.packages\nbuild/`);\n }\n\n if (lang === \"PHP\") {\n sections.push(`\n# PHP\nvendor/\ncomposer.lock`);\n }\n\n if (lang === \"C#\") {\n sections.push(`\n# .NET\nbin/\nobj/\n*.dll`);\n }\n\n if (lang === \"Elixir\") {\n sections.push(`\n# Elixir\n_build/\ndeps/\n.elixir_ls/`);\n }\n\n if (lang === \"Swift\") {\n sections.push(`\n# Swift\n.build/\nDerivedData/\n*.xcuserdata`);\n }\n\n return sections.join(\"\\n\") + \"\\n\";\n}\n","/**\n * Skill schema version. Bump this when the skill content changes.\n * Doctor compares this against installed skills to detect stale versions.\n */\nexport const ENHANCE_SKILL_VERSION = 6;\n\n/**\n * Generates the /lp-enhance skill markdown content.\n * This skill runs inside the user's active Claude Code session\n * to analyze the codebase and improve CLAUDE.md.\n */\nexport function generateEnhanceSkill(): string {\n return [\n '---',\n 'name: lp-enhance',\n 'description: |',\n ' AI-improve your CLAUDE.md based on codebase analysis. Fills in architecture, conventions, guardrails, and suggests hooks and MCP servers.',\n ' TRIGGER when: user runs /lp-enhance, asks to \"improve CLAUDE.md\", \"fill in architecture\", or after major refactors.',\n ' DO NOT TRIGGER when: user is editing CLAUDE.md manually, doing normal coding, or running doctor/eval.',\n 'allowed-tools: Read, Glob, Grep, Edit, Write',\n 'argument-hint: (no arguments needed)',\n '---',\n '',\n `<!-- lp-enhance-version: ${ENHANCE_SKILL_VERSION} -->`,\n '',\n '# lp-enhance - AI-powered CLAUDE.md improver',\n '',\n 'Read CLAUDE.md and the project\\'s codebase, then update CLAUDE.md to fill in missing or incomplete sections.',\n '',\n '## Phase 1: Research',\n '',\n '1. Read CLAUDE.md (if it exists)',\n '2. Read .claude/settings.json (hooks, permissions, MCP)',\n '3. Read .claude/rules/*.md (existing rules)',\n '4. Read .claudeignore (if it exists)',\n '5. Scan src/ directory structure (top-level dirs, key files)',\n '6. Read package.json / go.mod / pyproject.toml for stack detection',\n '7. Check for monorepo indicators (workspaces, nx.json, lerna.json)',\n '8. Check scenarios/ directory for existing eval scenarios',\n '',\n '**Done when:** you have a mental model of the stack, architecture, and existing config.',\n '',\n '## Phase 2: Plan',\n '',\n 'Count current CLAUDE.md actionable lines. Budget is 200 lines max. Plan which sections to add or improve:',\n '',\n '1. **## Stack** - detect language, framework, package manager',\n '2. **## Architecture** - 3-5 bullets describing codebase shape',\n '3. **## Conventions** - max 8 key patterns. Overflow to .claude/rules/conventions.md',\n '4. **## Off-Limits** - max 8 guardrails specific to this project',\n '5. **## Memory** - ONLY if agentic-memory is configured in settings.json. Max 6 bullets.',\n '6. **## Key Decisions** - only decisions that affect how Claude works in this codebase',\n '',\n '7. **Skill Authoring** - if .claude/rules/conventions.md lacks a Skill Authoring section, plan to add one',\n '',\n 'If any section would exceed 8 bullets, plan a .claude/rules/ file for the overflow.',\n '',\n '**Done when:** you know exactly what to add/change and the line count stays under 200.',\n '',\n '## Phase 3: Execute',\n '',\n 'Edit CLAUDE.md with the planned changes. Then:',\n '',\n '1. Create or update .claude/rules/ files for overflow content',\n '2. Generate path-scoped rules if the project has distinct areas (see below)',\n '3. Review .claudeignore and print suggestions (see below)',\n '4. Generate 2-3 custom eval scenarios in scenarios/custom/ (see below)',\n '5. Verify line count is under 200',\n '',\n '**Rules:**',\n '- Don\\'t remove existing content, only add or improve',\n '- Be specific to THIS project, not generic advice',\n '- Use bullet points, not paragraphs',\n '',\n '## Phase 4: Verify',\n '',\n '1. Run `claude-launchpad doctor` to check the score improved',\n '2. Print suggested hooks (exact JSON) for .claude/settings.json but don\\'t modify it',\n '3. Print suggested MCP servers if external services detected (Postgres, Redis, Stripe, etc.)',\n '4. If eval scenarios were generated, print: \"Run this in your terminal (not inside Claude Code): `claude-launchpad eval --scenarios scenarios/ --runs 1`\"',\n '',\n '**Done when:** doctor score is equal or higher, suggestions printed, eval scenarios created if applicable.',\n '',\n '## Path-scoped rules generation',\n '',\n 'Scan the project structure and generate focused .claude/rules/ files with paths: frontmatter. These load ONLY when Claude works on matching files, saving context tokens.',\n '',\n '**How to detect areas:**',\n '1. List top-level directories under src/ (or equivalent). Each distinct area (api, components, lib, tests) is a candidate.',\n '2. Check for monorepo indicators: workspaces in package.json, pnpm-workspace.yaml, nx.json, lerna.json. Each workspace is a candidate.',\n '3. Check for docs/, tests/, scripts/ as separate scopes.',\n '',\n '**For each detected area, create a rules file with this format:**',\n '',\n '---',\n 'paths: [\"src/api/**\"]',\n '---',\n '# API Rules',\n '- Validate all request input with zod schemas',\n '- Return typed error responses, never throw raw errors',\n '- Keep route handlers under 30 lines',\n '',\n '**Stack-specific patterns to include:**',\n '- Next.js app/: \"Use Server Components by default, add \\'use client\\' only when needed\"',\n '- API routes / src/api/: \"Validate input at boundaries, typed error responses\"',\n '- React components: \"Colocate components near usage, props interface above component\"',\n '- Tests: \"One assertion per test when possible, descriptive test names\"',\n '- Database / prisma/ / drizzle/: \"Never write raw SQL, use the ORM, migrations required\"',\n '- Docs: \"No em dashes, max 3 sentences per paragraph, code examples required\"',\n '',\n '**When NOT to generate:**',\n '- Small projects with < 5 source files (one conventions.md is enough)',\n '- Projects where all code is in one flat directory',\n '- If path-scoped rules already exist, don\\'t overwrite them',\n '',\n '**Monorepo handling:**',\n '- Each package gets its own rules file: .claude/rules/packages-<name>.md',\n '- Suggest claudeMdExcludes in settings.json to skip irrelevant package CLAUDE.md files',\n '',\n '## Skill authoring conventions',\n '',\n 'If .claude/rules/conventions.md exists but has no Skill Authoring section, add this:',\n '',\n '## Skill Authoring',\n '',\n 'When creating Claude Code skills (.claude/skills/*/SKILL.md):',\n '',\n '- Keep SKILL.md under 500 lines - move reference material to supporting files in the same directory',\n '- Front-load description (first 250 chars shown in listings) with TRIGGER when / DO NOT TRIGGER when clauses',\n '- Add allowed-tools in frontmatter to restrict tool access (e.g. Read, Glob, Grep for read-only skills)',\n '- Add argument-hint in frontmatter showing the expected input format (use $ARGUMENTS or $0, $1 for dynamic input)',\n '- Set disable-model-invocation: true for skills with side effects (deploy, send messages)',\n '- Structure as phases: Research, Plan, Execute, Verify with \"Done when:\" success criteria per phase',\n '- Handle edge cases and preconditions before execution',\n '',\n '## Hook review',\n '',\n 'Review .claude/settings.json hooks:',\n '- If you see project-specific patterns that deserve hooks, suggest them',\n '- If no PostCompact hook exists, suggest one that re-injects TASKS.md',\n '- If no SessionStart hook exists, suggest one that injects TASKS.md',\n '- DO NOT modify settings.json directly. Print exact JSON to add.',\n '',\n '## .claudeignore review',\n '',\n 'Read .claudeignore and check if the patterns make sense for the detected stack:',\n '',\n '**Always flag:**',\n '- Missing node_modules/ (JS/TS projects)',\n '- Missing __pycache__/ or .venv/ (Python projects)',\n '- Missing target/ (Rust/Java projects)',\n '- Missing .env / .env.* patterns',\n '- Missing lock files (pnpm-lock.yaml, package-lock.json, yarn.lock, etc.)',\n '- Missing coverage/ directory',\n '- Large generated files that waste context (*.min.js, *.map, migrations/)',\n '',\n '**Never flag:**',\n '- Patterns the user clearly added intentionally',\n '- Test fixtures or seed data (might be needed for context)',\n '',\n 'If .claudeignore is missing entirely, create one with sensible defaults for the detected stack.',\n 'If it exists but has gaps, print suggested additions. Do NOT modify it directly.',\n '',\n '## Eval scenario generation',\n '',\n 'After improving CLAUDE.md, generate 2-3 custom eval scenarios that test whether Claude follows the project\\'s specific rules. Write them as YAML files in scenarios/ at the project root.',\n '',\n '**Scenario YAML format:**',\n '```yaml',\n 'name: custom/scenario-name',\n 'description: What this scenario tests',\n 'setup:',\n ' files:',\n ' - path: src/example.ts',\n ' content: |',\n ' // Starter file that tempts Claude to break a rule',\n ' instructions: |',\n ' The specific rule from CLAUDE.md being tested.',\n 'prompt: \"A task that would tempt Claude to break the rule\"',\n 'checks:',\n ' - type: grep',\n ' pattern: \"expected_pattern\"',\n ' target: src/example.ts',\n ' expect: present',\n ' points: 5',\n ' label: What this check verifies',\n ' - type: file-exists',\n ' target: path/to/expected/file',\n ' expect: present',\n ' points: 5',\n ' label: What this check verifies',\n 'passingScore: 7',\n 'runs: 3',\n '```',\n '',\n '**How to choose scenarios:**',\n '1. Pick the 2-3 most important rules from ## Off-Limits and ## Conventions',\n '2. Design a task that naturally tempts Claude to break each rule',\n '3. Write checks that verify compliance (grep for patterns, file-exists for structure)',\n '',\n '**Check types available:** `grep` (pattern in file), `file-exists` (present/absent), `max-lines` (file length)',\n '',\n '**Examples of good custom scenarios:**',\n '- Off-limits says \"never use any\" → task asks to build types, check for no `any` keyword',\n '- Convention says \"max 400 lines per file\" → task asks to generate a large module, check line count',\n '- Off-limits says \"no raw SQL\" → task asks to add a query, check for ORM usage',\n '',\n '**Skip if:** scenarios/ already has 3+ YAML files, or CLAUDE.md has no project-specific rules worth testing.',\n '',\n '## Other advanced configuration',\n '',\n '- If the project uses external APIs, suggest sandbox.network.allowedDomains',\n '- If you detect a monorepo, suggest claudeMdExcludes in settings.json',\n ].join('\\n');\n}\n","import { readFile } from \"node:fs/promises\";\nimport { join } from \"node:path\";\nimport { log } from \"../../lib/output.js\";\nimport { readSettingsJson, writeSettingsJson, readSettingsLocalJson, writeSettingsLocalJson } from \"../../lib/settings.js\";\nimport type { MemoryPlacement } from \"../../types/index.js\";\n\n// ─── Shared Hook Helper (placement-aware) ───\n\nasync function addPlacementHook(\n root: string,\n placement: MemoryPlacement,\n event: string,\n dedupKeyword: string,\n entry: Record<string, unknown>,\n prepend: boolean,\n successMsg: string,\n): Promise<boolean> {\n const read = placement === \"local\" ? readSettingsLocalJson : readSettingsJson;\n const write = placement === \"local\" ? writeSettingsLocalJson : writeSettingsJson;\n const settings = await read(root);\n const hooks = (settings.hooks ?? {}) as Record<string, unknown[]>;\n const hookList = (hooks[event] as Record<string, unknown>[] | undefined) ?? [];\n\n const alreadyHas = hookList.some((g) => {\n const nested = g.hooks as Record<string, unknown>[] | undefined;\n return nested?.some((h) => String(h.command ?? \"\").includes(dedupKeyword));\n });\n if (alreadyHas) return false;\n\n const updatedList = prepend ? [entry, ...hookList] : [...hookList, entry];\n const updatedSettings = { ...settings, hooks: { ...hooks, [event]: updatedList } };\n await write(root, updatedSettings);\n log.success(successMsg);\n return true;\n}\n\n// ─── Memory Fix Functions ───\n\nexport async function disableAutoMemory(root: string, placement: MemoryPlacement): Promise<boolean> {\n const read = placement === \"local\" ? readSettingsLocalJson : readSettingsJson;\n const write = placement === \"local\" ? writeSettingsLocalJson : writeSettingsJson;\n const settings = await read(root);\n if (settings.autoMemoryEnabled === false) return false;\n\n const updated = { ...settings, autoMemoryEnabled: false };\n await write(root, updated);\n const target = placement === \"local\" ? \"settings.local.json\" : \"settings.json\";\n log.success(`Set autoMemoryEnabled: false in ${target}`);\n return true;\n}\n\nexport async function addMemoryToolPermissions(root: string, placement: MemoryPlacement): Promise<boolean> {\n const read = placement === \"local\" ? readSettingsLocalJson : readSettingsJson;\n const write = placement === \"local\" ? writeSettingsLocalJson : writeSettingsJson;\n const settings = await read(root);\n const permissions = (settings.permissions ?? {}) as Record<string, unknown>;\n const allow = (permissions.allow as string[] | undefined) ?? [];\n\n const tools = [\n \"mcp__agentic-memory__memory_store\",\n \"mcp__agentic-memory__memory_search\",\n \"mcp__agentic-memory__memory_recent\",\n \"mcp__agentic-memory__memory_forget\",\n \"mcp__agentic-memory__memory_relate\",\n \"mcp__agentic-memory__memory_stats\",\n \"mcp__agentic-memory__memory_update\",\n ];\n\n const missing = tools.filter((t) => !allow.includes(t));\n if (missing.length === 0) return false;\n\n const updated = { ...settings, permissions: { ...permissions, allow: [...allow, ...missing] } };\n await write(root, updated);\n const target = placement === \"local\" ? \"settings.local.json\" : \"settings.json\";\n log.success(`Added agentic-memory MCP tool permissions to ${target}`);\n return true;\n}\n\nexport async function addSessionStartPullHook(root: string, placement: MemoryPlacement): Promise<boolean> {\n const target = placement === \"local\" ? \"settings.local.json\" : \"settings.json\";\n return addPlacementHook(root, placement, \"SessionStart\", \"memory pull\", {\n matcher: \"startup\",\n hooks: [{ type: \"command\", command: \"claude-launchpad memory pull -y 2>/dev/null; exit 0\" }],\n }, true, `Added SessionStart hook for memory sync to ${target}`);\n}\n\nexport async function addSessionEndPushHook(root: string, placement: MemoryPlacement): Promise<boolean> {\n const target = placement === \"local\" ? \"settings.local.json\" : \"settings.json\";\n return addPlacementHook(root, placement, \"SessionEnd\", \"memory push\", {\n hooks: [{ type: \"command\", command: \"claude-launchpad memory push -y >/dev/null 2>&1 & exit 0\" }],\n }, false, `Added SessionEnd hook for memory sync to ${target}`);\n}\n\nexport async function removeStaleStopHook(root: string): Promise<boolean> {\n const settings = await readSettingsJson(root);\n const hooks = settings.hooks as Record<string, unknown[]> | undefined;\n if (!hooks?.Stop) return false;\n\n const stopHooks = hooks.Stop as Record<string, unknown>[];\n const filtered = stopHooks.filter((h) => {\n const innerHooks = h.hooks as Record<string, unknown>[] | undefined;\n return !innerHooks?.some(\n (ih) => typeof ih.command === \"string\" && (ih.command as string).includes(\"memory extract\"),\n );\n });\n\n if (filtered.length === stopHooks.length) return false;\n\n const updated = filtered.length === 0\n ? (({ Stop: _, ...rest }) => rest)(hooks as Record<string, unknown>)\n : { ...hooks, Stop: filtered };\n const updatedSettings = { ...settings, hooks: updated };\n await writeSettingsJson(root, updatedSettings);\n log.success(\"Removed deprecated Stop hook (memory extract)\");\n return true;\n}\n\n// ─── MCP Fix Functions ───\n\nexport async function addAllowedMcpServers(root: string, placement: MemoryPlacement): Promise<boolean> {\n const read = placement === \"local\" ? readSettingsLocalJson : readSettingsJson;\n const write = placement === \"local\" ? writeSettingsLocalJson : writeSettingsJson;\n const settings = await read(root);\n if (settings.allowedMcpServers) return false;\n const other = placement === \"local\" ? await readSettingsJson(root) : await readSettingsLocalJson(root);\n if (other.allowedMcpServers) return false;\n\n const serverNames = new Set<string>();\n const settingsServers = settings.mcpServers as Record<string, unknown> | undefined;\n if (settingsServers && typeof settingsServers === \"object\") {\n for (const name of Object.keys(settingsServers)) serverNames.add(name);\n }\n const mcpJsonPath = join(root, \".mcp.json\");\n try {\n const mcpJson = JSON.parse(await readFile(mcpJsonPath, \"utf-8\")) as Record<string, unknown>;\n const mcpServers = mcpJson.mcpServers as Record<string, unknown> | undefined;\n if (mcpServers && typeof mcpServers === \"object\") {\n for (const name of Object.keys(mcpServers)) serverNames.add(name);\n }\n } catch { /* no .mcp.json */ }\n\n if (serverNames.size === 0) return false;\n\n const updatedSettings = {\n ...settings,\n allowedMcpServers: [...serverNames].map((name) => ({ serverName: name })),\n };\n await write(root, updatedSettings);\n const target = placement === \"local\" ? \"settings.local.json\" : \"settings.json\";\n log.success(`Added allowedMcpServers from configured servers to ${target}`);\n return true;\n}\n"],"mappings":";;;;;;;;AAAA,SAAS,UAAU,cAAc;AAEjC,eAAsB,WAAW,MAAgC;AAC/D,MAAI;AACF,UAAM,OAAO,IAAI;AACjB,WAAO;AAAA,EACT,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAsB,eAAe,MAAsC;AACzE,MAAI;AACF,WAAO,MAAM,SAAS,MAAM,OAAO;AAAA,EACrC,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,eAAsB,eAAkB,MAAiC;AACvE,MAAI;AACF,UAAM,UAAU,MAAM,SAAS,MAAM,OAAO;AAC5C,WAAO,KAAK,MAAM,OAAO;AAAA,EAC3B,QAAQ;AACN,WAAO;AAAA,EACT;AACF;;;AC1BA,SAAS,YAAAA,WAAU,WAAW,aAAa;AAC3C,SAAS,YAAY;AAErB,eAAsB,iBAAiB,MAAgD;AACrF,QAAM,OAAO,KAAK,MAAM,WAAW,eAAe;AAClD,MAAI;AACF,UAAM,UAAU,MAAMA,UAAS,MAAM,OAAO;AAC5C,WAAO,KAAK,MAAM,OAAO;AAAA,EAC3B,QAAQ;AACN,WAAO,CAAC;AAAA,EACV;AACF;AAEA,eAAsB,kBAAkB,MAAc,UAAkD;AACtG,QAAM,MAAM,KAAK,MAAM,SAAS;AAChC,QAAM,MAAM,KAAK,EAAE,WAAW,KAAK,CAAC;AACpC,QA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A;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,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,UAAU,WAAW,OAAO,CAAC,MAAM,WAAW,CAAC,CAAC;AACtD,QAAI,QAAQ,SAAS,GAAG;AACtB,UAAI,KAAK,GAAG,WAAW,MAAM,kBAAkB,MAAM,KAAK,OAAO,CAAC,sBAAsB,MAAM,KAAK,iBAAiB,CAAC,cAAc;AAAA,IACrI,OAAO;AACL,UAAI,KAAK,GAAG,WAAW,MAAM,wCAAwC;AAAA,IACvE;AAAA,EACF;AACA,SAAO,EAAE,cAAc,iBAAiB,WAAW,OAAO;AAC5D;","names":["readFile","readFile","writeFile","mkdir","access","join","join","join","readFile","join","join","readFile","join","readFile","writeFile","mkdir","access"]}