claude-launchpad 1.7.0 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3UJYOWGF.js → chunk-GQUR7T56.js} +36 -7
- package/dist/chunk-GQUR7T56.js.map +1 -0
- package/dist/{chunk-ZI2PZSG4.js → chunk-N3K4VF6G.js} +4 -3
- package/dist/chunk-N3K4VF6G.js.map +1 -0
- package/dist/cli.js +7 -7
- package/dist/cli.js.map +1 -1
- package/dist/commands/memory/server.js +1 -1
- package/dist/{context-G2GSE7TY.js → context-JVL7IDP7.js} +2 -2
- package/dist/{pull-TP2Y7CQS.js → pull-6WW6IT7C.js} +2 -2
- package/dist/{push-STHV7MT7.js → push-6IVUPQVG.js} +2 -2
- package/dist/{sync-clean-HLV2XJPT.js → sync-clean-EFMXNNJ2.js} +2 -2
- package/dist/{sync-status-XH3Z5LC5.js → sync-status-PLC3TSTQ.js} +2 -2
- package/package.json +1 -1
- package/dist/chunk-3UJYOWGF.js.map +0 -1
- package/dist/chunk-ZI2PZSG4.js.map +0 -1
- /package/dist/{context-G2GSE7TY.js.map → context-JVL7IDP7.js.map} +0 -0
- /package/dist/{pull-TP2Y7CQS.js.map → pull-6WW6IT7C.js.map} +0 -0
- /package/dist/{push-STHV7MT7.js.map → push-6IVUPQVG.js.map} +0 -0
- /package/dist/{sync-clean-HLV2XJPT.js.map → sync-clean-EFMXNNJ2.js.map} +0 -0
- /package/dist/{sync-status-XH3Z5LC5.js.map → sync-status-PLC3TSTQ.js.map} +0 -0
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
log
|
|
4
|
+
} from "./chunk-AGDE4BJA.js";
|
|
2
5
|
|
|
3
6
|
// src/commands/memory/utils/gist-transport.ts
|
|
4
7
|
import { execSync } from "child_process";
|
|
@@ -52,21 +55,47 @@ function readSyncConfig() {
|
|
|
52
55
|
return null;
|
|
53
56
|
}
|
|
54
57
|
function loadSyncConfig() {
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
const
|
|
58
|
-
if (
|
|
59
|
-
|
|
58
|
+
const stored = readSyncConfig();
|
|
59
|
+
if (stored) {
|
|
60
|
+
const status = probeGist(stored.gistId);
|
|
61
|
+
if (status === "alive") return stored;
|
|
62
|
+
if (status === "missing") {
|
|
63
|
+
log.warn(`Sync gist ${stored.gistId} no longer exists. Re-discovering...`);
|
|
64
|
+
clearSyncConfig();
|
|
65
|
+
} else {
|
|
66
|
+
return stored;
|
|
60
67
|
}
|
|
61
|
-
} catch {
|
|
62
68
|
}
|
|
63
69
|
const discovered = discoverSyncGist();
|
|
64
70
|
if (discovered) {
|
|
65
71
|
saveSyncConfig({ gistId: discovered });
|
|
72
|
+
if (stored) log.success(`Reconnected to sync gist ${discovered}`);
|
|
66
73
|
return { gistId: discovered };
|
|
67
74
|
}
|
|
68
75
|
return null;
|
|
69
76
|
}
|
|
77
|
+
function probeGist(gistId) {
|
|
78
|
+
try {
|
|
79
|
+
execSync(
|
|
80
|
+
`gh api "/gists/${gistId}" --silent`,
|
|
81
|
+
{ ...EXEC_OPTS, stdio: ["pipe", "pipe", "pipe"] }
|
|
82
|
+
);
|
|
83
|
+
return "alive";
|
|
84
|
+
} catch (err) {
|
|
85
|
+
const stderr = err.stderr?.toString() ?? "";
|
|
86
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
87
|
+
if (/HTTP 404/i.test(stderr) || /HTTP 404/i.test(msg) || /Not Found/i.test(stderr)) {
|
|
88
|
+
return "missing";
|
|
89
|
+
}
|
|
90
|
+
return "unknown";
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
function clearSyncConfig() {
|
|
94
|
+
try {
|
|
95
|
+
unlinkSync(syncConfigPath());
|
|
96
|
+
} catch {
|
|
97
|
+
}
|
|
98
|
+
}
|
|
70
99
|
function discoverSyncGist() {
|
|
71
100
|
try {
|
|
72
101
|
const output = execSync(
|
|
@@ -182,4 +211,4 @@ export {
|
|
|
182
211
|
deleteGistFile,
|
|
183
212
|
updateGistFiles
|
|
184
213
|
};
|
|
185
|
-
//# sourceMappingURL=chunk-
|
|
214
|
+
//# sourceMappingURL=chunk-GQUR7T56.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/memory/utils/gist-transport.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\nimport { readFileSync, writeFileSync, unlinkSync, mkdirSync } from 'node:fs';\nimport { join, dirname } from 'node:path';\nimport { tmpdir } from 'node:os';\nimport { homedir } from 'node:os';\nimport { log } from '../../../lib/output.js';\n\nexport interface SyncConfig {\n readonly gistId: string;\n}\n\nconst EXEC_OPTS = { encoding: 'utf-8' as const, timeout: 30_000 };\nconst GIST_DESCRIPTION = 'agentic-memory sync';\nconst SYNC_CONFIG_FILE = 'sync-config.json';\nconst DATA_DIR = join(homedir(), '.agentic-memory');\n\nfunction syncConfigPath(): string {\n return join(DATA_DIR, SYNC_CONFIG_FILE);\n}\n\nfunction slugify(project: string): string {\n return project.replace(/[^a-zA-Z0-9._-]/g, '-');\n}\n\nexport function projectToFilename(project: string): string {\n if (!project) throw new Error('Project name cannot be empty');\n return `memories-${slugify(project)}.json`;\n}\n\nexport function filenameToProject(filename: string): string | null {\n const match = filename.match(/^memories-(.+)\\.json$/);\n return match?.[1] ?? null;\n}\n\n\nexport function assertGhAvailable(): void {\n try {\n execSync('gh --version', { ...EXEC_OPTS, stdio: 'pipe' });\n } catch {\n throw new Error(\n 'Memory sync requires the GitHub CLI.\\n' +\n 'Install: https://cli.github.com/\\n' +\n 'Then run: gh auth login'\n );\n }\n try {\n execSync('gh auth status', { ...EXEC_OPTS, stdio: 'pipe' });\n } catch {\n throw new Error(\n 'gh is installed but not authenticated.\\n' +\n 'Run: gh auth login'\n );\n }\n}\n\n/**\n * Read sync config from disk only — no network discovery.\n * Safe to call from lightweight contexts like doctor analyzers.\n */\nexport function readSyncConfig(): SyncConfig | null {\n try {\n const raw = readFileSync(syncConfigPath(), 'utf-8');\n const parsed = JSON.parse(raw) as Record<string, unknown>;\n if (typeof parsed.gistId === 'string' && /^[a-f0-9]+$/.test(parsed.gistId)) {\n return { gistId: parsed.gistId };\n }\n } catch { /* no config file */ }\n return null;\n}\n\nexport function loadSyncConfig(): SyncConfig | null {\n const stored = readSyncConfig();\n if (stored) {\n const status = probeGist(stored.gistId);\n if (status === 'alive') return stored;\n if (status === 'missing') {\n log.warn(`Sync gist ${stored.gistId} no longer exists. Re-discovering...`);\n clearSyncConfig();\n // fall through to discovery\n } else {\n // unknown error (network, auth, rate limit) — trust stored config\n return stored;\n }\n }\n\n const discovered = discoverSyncGist();\n if (discovered) {\n saveSyncConfig({ gistId: discovered });\n if (stored) log.success(`Reconnected to sync gist ${discovered}`);\n return { gistId: discovered };\n }\n return null;\n}\n\nfunction probeGist(gistId: string): 'alive' | 'missing' | 'unknown' {\n try {\n execSync(\n `gh api \"/gists/${gistId}\" --silent`,\n { ...EXEC_OPTS, stdio: ['pipe', 'pipe', 'pipe'] },\n );\n return 'alive';\n } catch (err) {\n const stderr = (err as { stderr?: Buffer | string }).stderr?.toString() ?? '';\n const msg = err instanceof Error ? err.message : String(err);\n if (/HTTP 404/i.test(stderr) || /HTTP 404/i.test(msg) || /Not Found/i.test(stderr)) {\n return 'missing';\n }\n return 'unknown';\n }\n}\n\nfunction clearSyncConfig(): void {\n try { unlinkSync(syncConfigPath()); } catch { /* already gone */ }\n}\n\nfunction discoverSyncGist(): string | null {\n try {\n const output = execSync(\n 'gh gist list --limit 100',\n { ...EXEC_OPTS, stdio: ['pipe', 'pipe', 'pipe'] },\n );\n for (const line of output.split('\\n')) {\n const cols = line.split('\\t');\n if (cols[1]?.trim() === GIST_DESCRIPTION) {\n const gistId = cols[0]?.trim();\n if (gistId && /^[a-f0-9]+$/.test(gistId)) return gistId;\n }\n }\n } catch { /* gh list failed */ }\n return null;\n}\n\nexport function saveSyncConfig(config: SyncConfig): void {\n const filePath = syncConfigPath();\n mkdirSync(dirname(filePath), { recursive: true });\n writeFileSync(filePath, JSON.stringify(config, null, 2) + '\\n', 'utf-8');\n}\n\nexport function createGist(filename: string, content: string): string {\n const safeFilename = slugify(filename.replace(/\\.json$/, '')) + '.json';\n const tmpFile = join(tmpdir(), safeFilename);\n try {\n writeFileSync(tmpFile, content, 'utf-8');\n const result = execSync(\n `gh gist create \"${tmpFile}\" --desc \"${GIST_DESCRIPTION}\" --public=false`,\n { ...EXEC_OPTS, stdio: ['pipe', 'pipe', 'pipe'] },\n ).trim();\n const gistId = result.split('/').pop()?.trim() ?? '';\n if (!gistId || !/^[a-f0-9]+$/.test(gistId)) {\n throw new Error(`Failed to parse gist ID from: ${result}`);\n }\n saveSyncConfig({ gistId });\n return gistId;\n } finally {\n try { unlinkSync(tmpFile); } catch { /* ignore */ }\n }\n}\n\nexport function readGistFile(gistId: string, filename: string): string | null {\n try {\n const escapedFilename = JSON.stringify(filename);\n return execSync(\n `gh api \"/gists/${gistId}\" --jq '.files[${escapedFilename}].content'`,\n { ...EXEC_OPTS, stdio: ['pipe', 'pipe', 'pipe'] },\n ).trimEnd();\n } catch {\n return null;\n }\n}\n\nexport function listGistFiles(gistId: string): readonly string[] {\n try {\n const output = execSync(\n `gh api \"/gists/${gistId}\" --jq '.files | keys[]'`,\n { ...EXEC_OPTS, stdio: ['pipe', 'pipe', 'pipe'] },\n );\n return output.trim().split('\\n').filter(Boolean);\n } catch {\n return [];\n }\n}\n\nexport function deleteGistFile(gistId: string, filename: string): void {\n const payload = { files: { [filename]: null } };\n const tmpFile = join(tmpdir(), `gist-delete-${Date.now()}.json`);\n try {\n writeFileSync(tmpFile, JSON.stringify(payload), 'utf-8');\n execSync(\n `gh api --method PATCH \"/gists/${gistId}\" --input \"${tmpFile}\"`,\n { ...EXEC_OPTS, stdio: ['pipe', 'pipe', 'pipe'] },\n );\n } finally {\n try { unlinkSync(tmpFile); } catch { /* ignore */ }\n }\n}\n\nexport function updateGistFiles(\n gistId: string,\n files: Record<string, string>,\n): void {\n const payload = {\n files: Object.fromEntries(\n Object.entries(files).map(([name, content]) => [name, { content }]),\n ),\n };\n const tmpFile = join(tmpdir(), `gist-patch-${Date.now()}.json`);\n try {\n writeFileSync(tmpFile, JSON.stringify(payload), 'utf-8');\n execSync(\n `gh api --method PATCH \"/gists/${gistId}\" --input \"${tmpFile}\"`,\n { ...EXEC_OPTS, stdio: ['pipe', 'pipe', 'pipe'] },\n );\n } finally {\n try { unlinkSync(tmpFile); } catch { /* ignore */ }\n }\n}\n"],"mappings":";;;;;;AAAA,SAAS,gBAAgB;AACzB,SAAS,cAAc,eAAe,YAAY,iBAAiB;AACnE,SAAS,MAAM,eAAe;AAC9B,SAAS,cAAc;AACvB,SAAS,eAAe;AAOxB,IAAM,YAAY,EAAE,UAAU,SAAkB,SAAS,IAAO;AAChE,IAAM,mBAAmB;AACzB,IAAM,mBAAmB;AACzB,IAAM,WAAW,KAAK,QAAQ,GAAG,iBAAiB;AAElD,SAAS,iBAAyB;AAChC,SAAO,KAAK,UAAU,gBAAgB;AACxC;AAEA,SAAS,QAAQ,SAAyB;AACxC,SAAO,QAAQ,QAAQ,oBAAoB,GAAG;AAChD;AAEO,SAAS,kBAAkB,SAAyB;AACzD,MAAI,CAAC,QAAS,OAAM,IAAI,MAAM,8BAA8B;AAC5D,SAAO,YAAY,QAAQ,OAAO,CAAC;AACrC;AAEO,SAAS,kBAAkB,UAAiC;AACjE,QAAM,QAAQ,SAAS,MAAM,uBAAuB;AACpD,SAAO,QAAQ,CAAC,KAAK;AACvB;AAGO,SAAS,oBAA0B;AACxC,MAAI;AACF,aAAS,gBAAgB,EAAE,GAAG,WAAW,OAAO,OAAO,CAAC;AAAA,EAC1D,QAAQ;AACN,UAAM,IAAI;AAAA,MACR;AAAA,IAGF;AAAA,EACF;AACA,MAAI;AACF,aAAS,kBAAkB,EAAE,GAAG,WAAW,OAAO,OAAO,CAAC;AAAA,EAC5D,QAAQ;AACN,UAAM,IAA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MAAM,EAAE,QAAQ,CAAC,CAAC;AAAA,IACpE;AAAA,EACF;AACA,QAAM,UAAU,KAAK,OAAO,GAAG,cAAc,KAAK,IAAI,CAAC,OAAO;AAC9D,MAAI;AACF,kBAAc,SAAS,KAAK,UAAU,OAAO,GAAG,OAAO;AACvD;AAAA,MACE,iCAAiC,MAAM,cAAc,OAAO;AAAA,MAC5D,EAAE,GAAG,WAAW,OAAO,CAAC,QAAQ,QAAQ,MAAM,EAAE;AAAA,IAClD;AAAA,EACF,UAAE;AACA,QAAI;AAAE,iBAAW,OAAO;AAAA,IAAG,QAAQ;AAAA,IAAe;AAAA,EACpD;AACF;","names":[]}
|
|
@@ -7,12 +7,13 @@ function getGitContext() {
|
|
|
7
7
|
if (cached) return cached;
|
|
8
8
|
let branch = null;
|
|
9
9
|
let recentFiles = [];
|
|
10
|
+
const GIT_OPTS = { encoding: "utf-8", timeout: 3e3, stdio: ["pipe", "pipe", "pipe"] };
|
|
10
11
|
try {
|
|
11
|
-
branch = execSync("git rev-parse --abbrev-ref HEAD",
|
|
12
|
+
branch = execSync("git rev-parse --abbrev-ref HEAD", GIT_OPTS).trim() || null;
|
|
12
13
|
} catch {
|
|
13
14
|
}
|
|
14
15
|
try {
|
|
15
|
-
const raw = execSync("git diff --name-only HEAD~5",
|
|
16
|
+
const raw = execSync("git diff --name-only HEAD~5", GIT_OPTS).trim();
|
|
16
17
|
recentFiles = raw ? raw.split("\n").filter(Boolean) : [];
|
|
17
18
|
} catch {
|
|
18
19
|
}
|
|
@@ -143,4 +144,4 @@ export {
|
|
|
143
144
|
jaccardOverlap,
|
|
144
145
|
smallerSetOverlap
|
|
145
146
|
};
|
|
146
|
-
//# sourceMappingURL=chunk-
|
|
147
|
+
//# sourceMappingURL=chunk-N3K4VF6G.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/commands/memory/utils/git-context.ts","../src/commands/memory/utils/similarity.ts"],"sourcesContent":["import { execSync } from 'node:child_process';\n\nexport interface GitContext {\n readonly branch: string | null;\n readonly recentFiles: readonly string[];\n}\n\nlet cached: GitContext | null = null;\n\nexport function getGitContext(): GitContext {\n if (cached) return cached;\n\n let branch: string | null = null;\n let recentFiles: string[] = [];\n\n const GIT_OPTS = { encoding: 'utf-8' as const, timeout: 3000, stdio: ['pipe', 'pipe', 'pipe'] as ('pipe' | 'ignore' | 'inherit')[] };\n\n try {\n branch = execSync('git rev-parse --abbrev-ref HEAD', GIT_OPTS).trim() || null;\n } catch { /* not in a git repo or git not available */ }\n\n try {\n const raw = execSync('git diff --name-only HEAD~5', GIT_OPTS).trim();\n recentFiles = raw ? raw.split('\\n').filter(Boolean) : [];\n } catch { /* shallow clone or fewer than 5 commits */ }\n\n cached = { branch, recentFiles };\n return cached;\n}\n\nexport function clearGitContextCache(): void {\n cached = null;\n}\n\nexport function computeContextScore(\n storedContext: string | null,\n currentContext: GitContext,\n query: string,\n): number {\n if (!storedContext) return 0;\n\n let parsed: { files?: string[]; branch?: string; intent?: string };\n try {\n parsed = JSON.parse(storedContext) as { files?: string[]; branch?: string; intent?: string };\n } catch {\n return 0;\n }\n\n // Branch match (weight 0.4)\n const branchScore = (parsed.branch && currentContext.branch && parsed.branch === currentContext.branch) ? 1.0 : 0;\n\n // File overlap — Jaccard similarity (weight 0.4)\n let fileScore = 0;\n if (parsed.files?.length && currentContext.recentFiles.length) {\n const stored = new Set(parsed.files);\n const current = new Set(currentContext.recentFiles);\n let intersection = 0;\n for (const f of stored) {\n if (current.has(f)) intersection++;\n }\n const union = stored.size + current.size - intersection;\n fileScore = union > 0 ? intersection / union : 0;\n }\n\n // Intent keyword overlap with query (weight 0.2)\n let intentScore = 0;\n if (parsed.intent && query) {\n const intentWords = new Set(parsed.intent.toLowerCase().split(/\\s+/).filter(Boolean));\n const queryWords = new Set(query.toLowerCase().split(/\\s+/).filter(Boolean));\n let overlap = 0;\n for (const w of intentWords) {\n if (queryWords.has(w)) overlap++;\n }\n const union = intentWords.size + queryWords.size - overlap;\n intentScore = union > 0 ? overlap / union : 0;\n }\n\n return branchScore * 0.4 + fileScore * 0.4 + intentScore * 0.2;\n}\n","// ── Similarity Primitives ──────────────────────────────────────\n// Pure utilities for text and set similarity. Shared between\n// contradiction detection and MMR diversity re-ranking.\n\nconst MIN_KEYWORD_LENGTH = 3;\n\nconst STOP_WORDS: ReadonlySet<string> = new Set([\n 'the', 'and', 'for', 'are', 'but', 'not', 'you', 'all', 'can', 'had',\n 'her', 'was', 'one', 'our', 'out', 'has', 'have', 'been', 'from', 'that',\n 'this', 'with', 'they', 'will', 'each', 'make', 'like', 'than', 'them',\n 'then', 'what', 'when', 'into', 'more', 'some', 'such', 'also', 'use',\n 'used', 'using', 'should', 'would', 'could', 'about', 'which', 'their',\n 'there', 'these', 'those', 'does', 'done', 'just', 'very',\n]);\n\nexport function extractKeywords(text: string): ReadonlySet<string> {\n const words = text.toLowerCase().match(/[a-z][a-z0-9_-]+/g) ?? [];\n return new Set(\n words.filter((w) => w.length >= MIN_KEYWORD_LENGTH && !STOP_WORDS.has(w)),\n );\n}\n\nfunction intersectionSize<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): number {\n const [smaller, larger] = a.size <= b.size ? [a, b] : [b, a];\n let count = 0;\n for (const item of smaller) {\n if (larger.has(item)) count++;\n }\n return count;\n}\n\nexport function jaccardOverlap<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): number {\n if (a.size === 0 || b.size === 0) return 0;\n const inter = intersectionSize(a, b);\n const union = a.size + b.size - inter;\n return union === 0 ? 0 : inter / union;\n}\n\nexport function smallerSetOverlap<T>(a: ReadonlySet<T>, b: ReadonlySet<T>): number {\n if (a.size === 0 || b.size === 0) return 0;\n const inter = intersectionSize(a, b);\n return inter / Math.min(a.size, b.size);\n}\n"],"mappings":";;;AAAA,SAAS,gBAAgB;AAOzB,IAAI,SAA4B;AAEzB,SAAS,gBAA4B;AAC1C,MAAI,OAAQ,QAAO;AAEnB,MAAI,SAAwB;AAC5B,MAAI,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,IAAI,EAAE,QAAQ,EAAE,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC;AAC3D,MAAI,QAAQ;AACZ,aAAW,QAAQ,SAAS;AAC1B,QAAI,OAAO,IAAI,IAAI,EAAG;AAAA,EACxB;AACA,SAAO;AACT;AAEO,SAAS,eAAkB,GAAmB,GAA2B;AAC9E,MAAI,EAAE,SAAS,KAAK,EAAE,SAAS,EAAG,QAAO;AACzC,QAAM,QAAQ,iBAAiB,GAAG,CAAC;AACnC,QAAM,QAAQ,EAAE,OAAO,EAAE,OAAO;AAChC,SAAO,UAAU,IAAI,IAAI,QAAQ;AACnC;AAEO,SAAS,kBAAqB,GAAmB,GAA2B;AACjF,MAAI,EAAE,SAAS,KAAK,EAAE,SAAS,EAAG,QAAO;AACzC,QAAM,QAAQ,iBAAiB,GAAG,CAAC;AACnC,SAAO,QAAQ,KAAK,IAAI,EAAE,MAAM,EAAE,IAAI;AACxC;","names":[]}
|
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
import {
|
|
3
3
|
readSyncConfig
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GQUR7T56.js";
|
|
5
5
|
import {
|
|
6
6
|
BACKLOG_CONTENT,
|
|
7
7
|
ENHANCE_SKILL_VERSION,
|
|
@@ -2359,7 +2359,7 @@ function createMemoryCommand() {
|
|
|
2359
2359
|
});
|
|
2360
2360
|
memory.addCommand(
|
|
2361
2361
|
new Command4("context").description("Load session context (hook handler)").option("--json", "JSON output").action(async (opts) => {
|
|
2362
|
-
const { runContext } = await import("./context-
|
|
2362
|
+
const { runContext } = await import("./context-JVL7IDP7.js");
|
|
2363
2363
|
await runContext(opts);
|
|
2364
2364
|
}).helpCommand(false),
|
|
2365
2365
|
{ hidden: true }
|
|
@@ -2374,7 +2374,7 @@ function createMemoryCommand() {
|
|
|
2374
2374
|
memory.addCommand(
|
|
2375
2375
|
new Command4("push").description("Push current project's memories to GitHub Gist").option("--all", "Push all projects").option("-y, --yes", "Skip confirmation prompt").action(async (opts) => {
|
|
2376
2376
|
await handleSyncErrors(async () => {
|
|
2377
|
-
const { runPush } = await import("./push-
|
|
2377
|
+
const { runPush } = await import("./push-6IVUPQVG.js");
|
|
2378
2378
|
await runPush(opts);
|
|
2379
2379
|
});
|
|
2380
2380
|
})
|
|
@@ -2382,7 +2382,7 @@ function createMemoryCommand() {
|
|
|
2382
2382
|
memory.addCommand(
|
|
2383
2383
|
new Command4("pull").description("Pull current project's memories from GitHub Gist").option("--all", "Pull all projects").option("-y, --yes", "Non-interactive (accepted for symmetry with push; pull never prompts)").action(async (opts) => {
|
|
2384
2384
|
await handleSyncErrors(async () => {
|
|
2385
|
-
const { runPull } = await import("./pull-
|
|
2385
|
+
const { runPull } = await import("./pull-6WW6IT7C.js");
|
|
2386
2386
|
await runPull(opts);
|
|
2387
2387
|
});
|
|
2388
2388
|
})
|
|
@@ -2391,7 +2391,7 @@ function createMemoryCommand() {
|
|
|
2391
2391
|
sync.addCommand(
|
|
2392
2392
|
new Command4("status").description("Show local vs remote memory counts per project").action(async () => {
|
|
2393
2393
|
await handleSyncErrors(async () => {
|
|
2394
|
-
const { runSyncStatus } = await import("./sync-status-
|
|
2394
|
+
const { runSyncStatus } = await import("./sync-status-PLC3TSTQ.js");
|
|
2395
2395
|
await runSyncStatus();
|
|
2396
2396
|
});
|
|
2397
2397
|
})
|
|
@@ -2399,7 +2399,7 @@ function createMemoryCommand() {
|
|
|
2399
2399
|
sync.addCommand(
|
|
2400
2400
|
new Command4("clean").description("Remove a project from the sync gist").argument("<project>", "Project slug to remove").option("-y, --yes", "Skip confirmation prompt").action(async (project, opts) => {
|
|
2401
2401
|
await handleSyncErrors(async () => {
|
|
2402
|
-
const { runSyncClean } = await import("./sync-clean-
|
|
2402
|
+
const { runSyncClean } = await import("./sync-clean-EFMXNNJ2.js");
|
|
2403
2403
|
await runSyncClean(project, opts);
|
|
2404
2404
|
});
|
|
2405
2405
|
})
|
|
@@ -2409,7 +2409,7 @@ function createMemoryCommand() {
|
|
|
2409
2409
|
}
|
|
2410
2410
|
|
|
2411
2411
|
// src/cli.ts
|
|
2412
|
-
var program = new Command5().name("claude-launchpad").description("CLI toolkit that makes Claude Code setups measurably good").version("1.7.
|
|
2412
|
+
var program = new Command5().name("claude-launchpad").description("CLI toolkit that makes Claude Code setups measurably good").version("1.7.1", "-v, --version").action(async () => {
|
|
2413
2413
|
const hasConfig = await fileExists(join9(process.cwd(), "CLAUDE.md")) || await fileExists(join9(process.cwd(), ".claude", "settings.json"));
|
|
2414
2414
|
if (hasConfig) {
|
|
2415
2415
|
await program.commands.find((c) => c.name() === "doctor")?.parseAsync([], { from: "user" });
|