claudekit-cli 4.4.0-dev.2 → 4.4.0-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cli-manifest.json +2 -2
- package/dist/index.js +596 -457
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15655,6 +15655,7 @@ var init_metadata = __esm(() => {
|
|
|
15655
15655
|
version: exports_external.string(),
|
|
15656
15656
|
installedAt: exports_external.string(),
|
|
15657
15657
|
files: exports_external.array(TrackedFileSchema).optional(),
|
|
15658
|
+
ignoredSkills: exports_external.array(exports_external.string()).optional(),
|
|
15658
15659
|
lastUpdateCheck: exports_external.string().optional(),
|
|
15659
15660
|
dismissedVersion: exports_external.string().optional(),
|
|
15660
15661
|
installedSettings: InstalledSettingsSchema.optional()
|
|
@@ -63852,7 +63853,7 @@ var package_default;
|
|
|
63852
63853
|
var init_package = __esm(() => {
|
|
63853
63854
|
package_default = {
|
|
63854
63855
|
name: "claudekit-cli",
|
|
63855
|
-
version: "4.4.0-dev.
|
|
63856
|
+
version: "4.4.0-dev.4",
|
|
63856
63857
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
63857
63858
|
type: "module",
|
|
63858
63859
|
repository: {
|
|
@@ -68483,17 +68484,18 @@ function registerSystemRoutes(app) {
|
|
|
68483
68484
|
});
|
|
68484
68485
|
app.get("/api/system/info", async (_req, res) => {
|
|
68485
68486
|
try {
|
|
68486
|
-
const [packageJson, installLocation, gitVersion, ghVersion] = await Promise.all([
|
|
68487
|
+
const [packageJson, installLocation, gitVersion, ghVersion, bunVersion] = await Promise.all([
|
|
68487
68488
|
getPackageJson(),
|
|
68488
68489
|
runCommand("which", ["ck"], "not found"),
|
|
68489
68490
|
runCommand("git", ["--version"], "unknown"),
|
|
68490
68491
|
runCommand("gh", ["--version"], "unknown").then((out) => out.split(`
|
|
68491
|
-
`)[0] ?? "unknown")
|
|
68492
|
+
`)[0] ?? "unknown"),
|
|
68493
|
+
runCommand("bun", ["--version"], "").then((out) => out || null)
|
|
68492
68494
|
]);
|
|
68493
68495
|
const response = {
|
|
68494
68496
|
configPath: PathResolver.getGlobalKitDir(),
|
|
68495
68497
|
nodeVersion: process.version,
|
|
68496
|
-
bunVersion
|
|
68498
|
+
bunVersion,
|
|
68497
68499
|
os: `${process.platform} ${process.arch}`,
|
|
68498
68500
|
cliVersion: packageJson?.version ?? "unknown",
|
|
68499
68501
|
packageManager: detectPackageManager(),
|
|
@@ -76947,9 +76949,9 @@ __export(exports_worktree_manager, {
|
|
|
76947
76949
|
});
|
|
76948
76950
|
import { existsSync as existsSync73 } from "node:fs";
|
|
76949
76951
|
import { readFile as readFile67, writeFile as writeFile38 } from "node:fs/promises";
|
|
76950
|
-
import { join as
|
|
76952
|
+
import { join as join154 } from "node:path";
|
|
76951
76953
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
76952
|
-
const worktreePath =
|
|
76954
|
+
const worktreePath = join154(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
76953
76955
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
76954
76956
|
await spawnAndCollect("git", ["fetch", "origin", baseBranch], projectDir).catch(() => {
|
|
76955
76957
|
logger.warning(`[worktree] Could not fetch origin/${baseBranch}, using local`);
|
|
@@ -76967,7 +76969,7 @@ async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
|
76967
76969
|
return worktreePath;
|
|
76968
76970
|
}
|
|
76969
76971
|
async function removeWorktree(projectDir, issueNumber) {
|
|
76970
|
-
const worktreePath =
|
|
76972
|
+
const worktreePath = join154(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
76971
76973
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
76972
76974
|
try {
|
|
76973
76975
|
await spawnAndCollect("git", ["worktree", "remove", worktreePath, "--force"], projectDir);
|
|
@@ -76981,7 +76983,7 @@ async function listActiveWorktrees(projectDir) {
|
|
|
76981
76983
|
try {
|
|
76982
76984
|
const output2 = await spawnAndCollect("git", ["worktree", "list", "--porcelain"], projectDir);
|
|
76983
76985
|
const issueNumbers = [];
|
|
76984
|
-
const worktreePrefix =
|
|
76986
|
+
const worktreePrefix = join154(projectDir, WORKTREE_DIR, "issue-").replace(/\\/g, "/");
|
|
76985
76987
|
for (const line of output2.split(`
|
|
76986
76988
|
`)) {
|
|
76987
76989
|
if (line.startsWith("worktree ")) {
|
|
@@ -77009,7 +77011,7 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
77009
77011
|
await spawnAndCollect("git", ["worktree", "prune"], projectDir).catch(() => {});
|
|
77010
77012
|
}
|
|
77011
77013
|
async function ensureGitignore(projectDir) {
|
|
77012
|
-
const gitignorePath =
|
|
77014
|
+
const gitignorePath = join154(projectDir, ".gitignore");
|
|
77013
77015
|
try {
|
|
77014
77016
|
const content = existsSync73(gitignorePath) ? await readFile67(gitignorePath, "utf-8") : "";
|
|
77015
77017
|
if (!content.includes(".worktrees")) {
|
|
@@ -77116,7 +77118,7 @@ import { createHash as createHash9 } from "node:crypto";
|
|
|
77116
77118
|
import { existsSync as existsSync79, mkdirSync as mkdirSync5, readFileSync as readFileSync19, readdirSync as readdirSync13, statSync as statSync14 } from "node:fs";
|
|
77117
77119
|
import { rename as rename16, writeFile as writeFile40 } from "node:fs/promises";
|
|
77118
77120
|
import { homedir as homedir54 } from "node:os";
|
|
77119
|
-
import { basename as basename34, join as
|
|
77121
|
+
import { basename as basename34, join as join161 } from "node:path";
|
|
77120
77122
|
function getCachedContext(repoPath) {
|
|
77121
77123
|
const cachePath = getCacheFilePath(repoPath);
|
|
77122
77124
|
if (!existsSync79(cachePath))
|
|
@@ -77159,25 +77161,25 @@ function computeSourceHash(repoPath) {
|
|
|
77159
77161
|
}
|
|
77160
77162
|
function getDocSourcePaths(repoPath) {
|
|
77161
77163
|
const paths = [];
|
|
77162
|
-
const docsDir =
|
|
77164
|
+
const docsDir = join161(repoPath, "docs");
|
|
77163
77165
|
if (existsSync79(docsDir)) {
|
|
77164
77166
|
try {
|
|
77165
77167
|
const files = readdirSync13(docsDir);
|
|
77166
77168
|
for (const f3 of files) {
|
|
77167
77169
|
if (f3.endsWith(".md"))
|
|
77168
|
-
paths.push(
|
|
77170
|
+
paths.push(join161(docsDir, f3));
|
|
77169
77171
|
}
|
|
77170
77172
|
} catch {}
|
|
77171
77173
|
}
|
|
77172
|
-
const readme =
|
|
77174
|
+
const readme = join161(repoPath, "README.md");
|
|
77173
77175
|
if (existsSync79(readme))
|
|
77174
77176
|
paths.push(readme);
|
|
77175
|
-
const stylesDir =
|
|
77177
|
+
const stylesDir = join161(repoPath, "assets", "writing-styles");
|
|
77176
77178
|
if (existsSync79(stylesDir)) {
|
|
77177
77179
|
try {
|
|
77178
77180
|
const files = readdirSync13(stylesDir);
|
|
77179
77181
|
for (const f3 of files) {
|
|
77180
|
-
paths.push(
|
|
77182
|
+
paths.push(join161(stylesDir, f3));
|
|
77181
77183
|
}
|
|
77182
77184
|
} catch {}
|
|
77183
77185
|
}
|
|
@@ -77186,11 +77188,11 @@ function getDocSourcePaths(repoPath) {
|
|
|
77186
77188
|
function getCacheFilePath(repoPath) {
|
|
77187
77189
|
const repoName = basename34(repoPath).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
77188
77190
|
const pathHash = createHash9("sha256").update(repoPath).digest("hex").slice(0, 8);
|
|
77189
|
-
return
|
|
77191
|
+
return join161(CACHE_DIR, `${repoName}-${pathHash}-context-cache.json`);
|
|
77190
77192
|
}
|
|
77191
77193
|
var CACHE_DIR, CACHE_TTL_MS5;
|
|
77192
77194
|
var init_context_cache_manager = __esm(() => {
|
|
77193
|
-
CACHE_DIR =
|
|
77195
|
+
CACHE_DIR = join161(homedir54(), ".claudekit", "cache");
|
|
77194
77196
|
CACHE_TTL_MS5 = 24 * 60 * 60 * 1000;
|
|
77195
77197
|
});
|
|
77196
77198
|
|
|
@@ -77371,7 +77373,7 @@ function extractContentFromResponse(response) {
|
|
|
77371
77373
|
// src/commands/content/phases/docs-summarizer.ts
|
|
77372
77374
|
import { execSync as execSync7 } from "node:child_process";
|
|
77373
77375
|
import { existsSync as existsSync80, readFileSync as readFileSync20, readdirSync as readdirSync14 } from "node:fs";
|
|
77374
|
-
import { join as
|
|
77376
|
+
import { join as join162 } from "node:path";
|
|
77375
77377
|
async function summarizeProjectDocs(repoPath, contentLogger) {
|
|
77376
77378
|
const rawContent = collectRawDocs(repoPath);
|
|
77377
77379
|
if (rawContent.total.length < 200) {
|
|
@@ -77425,12 +77427,12 @@ function collectRawDocs(repoPath) {
|
|
|
77425
77427
|
return capped;
|
|
77426
77428
|
};
|
|
77427
77429
|
const docsContent = [];
|
|
77428
|
-
const docsDir =
|
|
77430
|
+
const docsDir = join162(repoPath, "docs");
|
|
77429
77431
|
if (existsSync80(docsDir)) {
|
|
77430
77432
|
try {
|
|
77431
77433
|
const files = readdirSync14(docsDir).filter((f3) => f3.endsWith(".md")).sort();
|
|
77432
77434
|
for (const f3 of files) {
|
|
77433
|
-
const content = readCapped(
|
|
77435
|
+
const content = readCapped(join162(docsDir, f3), 5000);
|
|
77434
77436
|
if (content) {
|
|
77435
77437
|
docsContent.push(`### ${f3}
|
|
77436
77438
|
${content}`);
|
|
@@ -77444,21 +77446,21 @@ ${content}`);
|
|
|
77444
77446
|
let brand = "";
|
|
77445
77447
|
const brandCandidates = ["docs/brand-guidelines.md", "docs/design-guidelines.md"];
|
|
77446
77448
|
for (const p of brandCandidates) {
|
|
77447
|
-
brand = readCapped(
|
|
77449
|
+
brand = readCapped(join162(repoPath, p), 3000);
|
|
77448
77450
|
if (brand)
|
|
77449
77451
|
break;
|
|
77450
77452
|
}
|
|
77451
77453
|
let styles3 = "";
|
|
77452
|
-
const stylesDir =
|
|
77454
|
+
const stylesDir = join162(repoPath, "assets", "writing-styles");
|
|
77453
77455
|
if (existsSync80(stylesDir)) {
|
|
77454
77456
|
try {
|
|
77455
77457
|
const files = readdirSync14(stylesDir).slice(0, 3);
|
|
77456
|
-
styles3 = files.map((f3) => readCapped(
|
|
77458
|
+
styles3 = files.map((f3) => readCapped(join162(stylesDir, f3), 1000)).filter(Boolean).join(`
|
|
77457
77459
|
|
|
77458
77460
|
`);
|
|
77459
77461
|
} catch {}
|
|
77460
77462
|
}
|
|
77461
|
-
const readme = readCapped(
|
|
77463
|
+
const readme = readCapped(join162(repoPath, "README.md"), 3000);
|
|
77462
77464
|
const total = [docs, brand, styles3, readme].join(`
|
|
77463
77465
|
`);
|
|
77464
77466
|
return { docs, brand, styles: styles3, readme, total };
|
|
@@ -77645,9 +77647,9 @@ IMPORTANT: Generate the image and output the path as JSON: {"imagePath": "/path/
|
|
|
77645
77647
|
import { execSync as execSync8 } from "node:child_process";
|
|
77646
77648
|
import { existsSync as existsSync81, mkdirSync as mkdirSync6, readdirSync as readdirSync15 } from "node:fs";
|
|
77647
77649
|
import { homedir as homedir55 } from "node:os";
|
|
77648
|
-
import { join as
|
|
77650
|
+
import { join as join163 } from "node:path";
|
|
77649
77651
|
async function generatePhoto(_content, context, config, platform18, contentId, contentLogger) {
|
|
77650
|
-
const mediaDir =
|
|
77652
|
+
const mediaDir = join163(config.contentDir.replace(/^~/, homedir55()), "media", String(contentId));
|
|
77651
77653
|
if (!existsSync81(mediaDir)) {
|
|
77652
77654
|
mkdirSync6(mediaDir, { recursive: true });
|
|
77653
77655
|
}
|
|
@@ -77672,7 +77674,7 @@ async function generatePhoto(_content, context, config, platform18, contentId, c
|
|
|
77672
77674
|
const imageFile = files.find((f3) => /\.(png|jpg|jpeg|webp)$/i.test(f3));
|
|
77673
77675
|
if (imageFile) {
|
|
77674
77676
|
const ext2 = imageFile.split(".").pop() ?? "png";
|
|
77675
|
-
return { path:
|
|
77677
|
+
return { path: join163(mediaDir, imageFile), ...dimensions, format: ext2 };
|
|
77676
77678
|
}
|
|
77677
77679
|
contentLogger.warn(`Photo generation produced no image for content ${contentId}`);
|
|
77678
77680
|
return null;
|
|
@@ -77762,7 +77764,7 @@ var init_content_creator = __esm(() => {
|
|
|
77762
77764
|
// src/commands/content/phases/content-logger.ts
|
|
77763
77765
|
import { createWriteStream as createWriteStream4, existsSync as existsSync82, mkdirSync as mkdirSync7, statSync as statSync15 } from "node:fs";
|
|
77764
77766
|
import { homedir as homedir56 } from "node:os";
|
|
77765
|
-
import { join as
|
|
77767
|
+
import { join as join164 } from "node:path";
|
|
77766
77768
|
|
|
77767
77769
|
class ContentLogger {
|
|
77768
77770
|
stream = null;
|
|
@@ -77770,7 +77772,7 @@ class ContentLogger {
|
|
|
77770
77772
|
logDir;
|
|
77771
77773
|
maxBytes;
|
|
77772
77774
|
constructor(maxBytes = 0) {
|
|
77773
|
-
this.logDir =
|
|
77775
|
+
this.logDir = join164(homedir56(), ".claudekit", "logs");
|
|
77774
77776
|
this.maxBytes = maxBytes;
|
|
77775
77777
|
}
|
|
77776
77778
|
init() {
|
|
@@ -77802,7 +77804,7 @@ class ContentLogger {
|
|
|
77802
77804
|
}
|
|
77803
77805
|
}
|
|
77804
77806
|
getLogPath() {
|
|
77805
|
-
return
|
|
77807
|
+
return join164(this.logDir, `content-${this.getDateStr()}.log`);
|
|
77806
77808
|
}
|
|
77807
77809
|
write(level, message) {
|
|
77808
77810
|
this.rotateIfNeeded();
|
|
@@ -77819,18 +77821,18 @@ class ContentLogger {
|
|
|
77819
77821
|
if (dateStr !== this.currentDate) {
|
|
77820
77822
|
this.close();
|
|
77821
77823
|
this.currentDate = dateStr;
|
|
77822
|
-
const logPath =
|
|
77824
|
+
const logPath = join164(this.logDir, `content-${dateStr}.log`);
|
|
77823
77825
|
this.stream = createWriteStream4(logPath, { flags: "a", mode: 384 });
|
|
77824
77826
|
return;
|
|
77825
77827
|
}
|
|
77826
77828
|
if (this.maxBytes > 0 && this.stream) {
|
|
77827
|
-
const logPath =
|
|
77829
|
+
const logPath = join164(this.logDir, `content-${this.currentDate}.log`);
|
|
77828
77830
|
try {
|
|
77829
77831
|
const stat26 = statSync15(logPath);
|
|
77830
77832
|
if (stat26.size >= this.maxBytes) {
|
|
77831
77833
|
this.close();
|
|
77832
77834
|
const suffix = Date.now();
|
|
77833
|
-
const rotatedPath =
|
|
77835
|
+
const rotatedPath = join164(this.logDir, `content-${this.currentDate}-${suffix}.log`);
|
|
77834
77836
|
import("node:fs/promises").then(({ rename: rename17 }) => rename17(logPath, rotatedPath).catch(() => {}));
|
|
77835
77837
|
this.stream = createWriteStream4(logPath, { flags: "w", mode: 384 });
|
|
77836
77838
|
}
|
|
@@ -77913,7 +77915,7 @@ var init_sqlite_client = __esm(() => {
|
|
|
77913
77915
|
|
|
77914
77916
|
// src/commands/content/phases/db-manager.ts
|
|
77915
77917
|
import { existsSync as existsSync83, mkdirSync as mkdirSync8 } from "node:fs";
|
|
77916
|
-
import { dirname as
|
|
77918
|
+
import { dirname as dirname53 } from "node:path";
|
|
77917
77919
|
function initDatabase(dbPath) {
|
|
77918
77920
|
ensureParentDir(dbPath);
|
|
77919
77921
|
const db = openDatabase(dbPath);
|
|
@@ -77934,7 +77936,7 @@ function runRetentionCleanup(db, retentionDays = 90) {
|
|
|
77934
77936
|
db.prepare("DELETE FROM git_events WHERE processed = 1 AND created_at < ?").run(cutoff);
|
|
77935
77937
|
}
|
|
77936
77938
|
function ensureParentDir(dbPath) {
|
|
77937
|
-
const dir =
|
|
77939
|
+
const dir = dirname53(dbPath);
|
|
77938
77940
|
if (dir && !existsSync83(dir)) {
|
|
77939
77941
|
mkdirSync8(dir, { recursive: true });
|
|
77940
77942
|
}
|
|
@@ -78101,7 +78103,7 @@ function isNoiseCommit(title, author) {
|
|
|
78101
78103
|
// src/commands/content/phases/change-detector.ts
|
|
78102
78104
|
import { execSync as execSync10, spawnSync as spawnSync9 } from "node:child_process";
|
|
78103
78105
|
import { existsSync as existsSync84, readFileSync as readFileSync21, readdirSync as readdirSync16, statSync as statSync16 } from "node:fs";
|
|
78104
|
-
import { join as
|
|
78106
|
+
import { join as join165 } from "node:path";
|
|
78105
78107
|
function detectCommits(repo, since) {
|
|
78106
78108
|
try {
|
|
78107
78109
|
const fetchUrl = sshToHttps(repo.remoteUrl);
|
|
@@ -78210,7 +78212,7 @@ function detectTags(repo, since) {
|
|
|
78210
78212
|
}
|
|
78211
78213
|
}
|
|
78212
78214
|
function detectCompletedPlans(repo, since) {
|
|
78213
|
-
const plansDir =
|
|
78215
|
+
const plansDir = join165(repo.path, "plans");
|
|
78214
78216
|
if (!existsSync84(plansDir))
|
|
78215
78217
|
return [];
|
|
78216
78218
|
const sinceMs = new Date(since).getTime();
|
|
@@ -78220,7 +78222,7 @@ function detectCompletedPlans(repo, since) {
|
|
|
78220
78222
|
for (const entry of entries) {
|
|
78221
78223
|
if (!entry.isDirectory())
|
|
78222
78224
|
continue;
|
|
78223
|
-
const planFile =
|
|
78225
|
+
const planFile = join165(plansDir, entry.name, "plan.md");
|
|
78224
78226
|
if (!existsSync84(planFile))
|
|
78225
78227
|
continue;
|
|
78226
78228
|
try {
|
|
@@ -78298,7 +78300,7 @@ function classifyCommit(event) {
|
|
|
78298
78300
|
// src/commands/content/phases/repo-discoverer.ts
|
|
78299
78301
|
import { execSync as execSync11 } from "node:child_process";
|
|
78300
78302
|
import { readdirSync as readdirSync17 } from "node:fs";
|
|
78301
|
-
import { join as
|
|
78303
|
+
import { join as join166 } from "node:path";
|
|
78302
78304
|
function discoverRepos2(cwd2) {
|
|
78303
78305
|
const repos = [];
|
|
78304
78306
|
if (isGitRepoRoot(cwd2)) {
|
|
@@ -78311,7 +78313,7 @@ function discoverRepos2(cwd2) {
|
|
|
78311
78313
|
for (const entry of entries) {
|
|
78312
78314
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
78313
78315
|
continue;
|
|
78314
|
-
const dirPath =
|
|
78316
|
+
const dirPath = join166(cwd2, entry.name);
|
|
78315
78317
|
if (isGitRepoRoot(dirPath)) {
|
|
78316
78318
|
const info = getRepoInfo(dirPath);
|
|
78317
78319
|
if (info)
|
|
@@ -78979,9 +78981,9 @@ var init_types6 = __esm(() => {
|
|
|
78979
78981
|
|
|
78980
78982
|
// src/commands/content/phases/state-manager.ts
|
|
78981
78983
|
import { readFile as readFile69, rename as rename17, writeFile as writeFile41 } from "node:fs/promises";
|
|
78982
|
-
import { join as
|
|
78984
|
+
import { join as join167 } from "node:path";
|
|
78983
78985
|
async function loadContentConfig(projectDir) {
|
|
78984
|
-
const configPath =
|
|
78986
|
+
const configPath = join167(projectDir, CK_CONFIG_FILE2);
|
|
78985
78987
|
try {
|
|
78986
78988
|
const raw2 = await readFile69(configPath, "utf-8");
|
|
78987
78989
|
const json = JSON.parse(raw2);
|
|
@@ -78991,13 +78993,13 @@ async function loadContentConfig(projectDir) {
|
|
|
78991
78993
|
}
|
|
78992
78994
|
}
|
|
78993
78995
|
async function saveContentConfig(projectDir, config) {
|
|
78994
|
-
const configPath =
|
|
78996
|
+
const configPath = join167(projectDir, CK_CONFIG_FILE2);
|
|
78995
78997
|
const json = await readJsonSafe(configPath);
|
|
78996
78998
|
json.content = { ...json.content, ...config };
|
|
78997
78999
|
await atomicWrite3(configPath, json);
|
|
78998
79000
|
}
|
|
78999
79001
|
async function loadContentState(projectDir) {
|
|
79000
|
-
const configPath =
|
|
79002
|
+
const configPath = join167(projectDir, CK_CONFIG_FILE2);
|
|
79001
79003
|
try {
|
|
79002
79004
|
const raw2 = await readFile69(configPath, "utf-8");
|
|
79003
79005
|
const json = JSON.parse(raw2);
|
|
@@ -79008,7 +79010,7 @@ async function loadContentState(projectDir) {
|
|
|
79008
79010
|
}
|
|
79009
79011
|
}
|
|
79010
79012
|
async function saveContentState(projectDir, state) {
|
|
79011
|
-
const configPath =
|
|
79013
|
+
const configPath = join167(projectDir, CK_CONFIG_FILE2);
|
|
79012
79014
|
const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);
|
|
79013
79015
|
for (const key of Object.keys(state.dailyPostCounts)) {
|
|
79014
79016
|
const dateStr = key.slice(-10);
|
|
@@ -79290,7 +79292,7 @@ var init_platform_setup_x = __esm(() => {
|
|
|
79290
79292
|
|
|
79291
79293
|
// src/commands/content/phases/setup-wizard.ts
|
|
79292
79294
|
import { existsSync as existsSync85 } from "node:fs";
|
|
79293
|
-
import { join as
|
|
79295
|
+
import { join as join168 } from "node:path";
|
|
79294
79296
|
async function runSetupWizard2(cwd2, contentLogger) {
|
|
79295
79297
|
console.log();
|
|
79296
79298
|
oe(import_picocolors43.default.bgCyan(import_picocolors43.default.white(" CK Content — Multi-Channel Content Engine ")));
|
|
@@ -79358,8 +79360,8 @@ async function showRepoSummary(cwd2) {
|
|
|
79358
79360
|
function detectBrandAssets(cwd2, contentLogger) {
|
|
79359
79361
|
const repos = discoverRepos2(cwd2);
|
|
79360
79362
|
for (const repo of repos) {
|
|
79361
|
-
const hasGuidelines = existsSync85(
|
|
79362
|
-
const hasStyles = existsSync85(
|
|
79363
|
+
const hasGuidelines = existsSync85(join168(repo.path, "docs", "brand-guidelines.md"));
|
|
79364
|
+
const hasStyles = existsSync85(join168(repo.path, "assets", "writing-styles"));
|
|
79363
79365
|
if (!hasGuidelines) {
|
|
79364
79366
|
f2.warning(`${repo.name}: No docs/brand-guidelines.md — content will use generic tone.`);
|
|
79365
79367
|
contentLogger.warn(`${repo.name}: missing docs/brand-guidelines.md`);
|
|
@@ -79501,9 +79503,9 @@ __export(exports_content_subcommands, {
|
|
|
79501
79503
|
});
|
|
79502
79504
|
import { existsSync as existsSync87, readFileSync as readFileSync22, unlinkSync as unlinkSync6 } from "node:fs";
|
|
79503
79505
|
import { homedir as homedir58 } from "node:os";
|
|
79504
|
-
import { join as
|
|
79506
|
+
import { join as join169 } from "node:path";
|
|
79505
79507
|
function isDaemonRunning() {
|
|
79506
|
-
const lockFile =
|
|
79508
|
+
const lockFile = join169(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
79507
79509
|
if (!existsSync87(lockFile))
|
|
79508
79510
|
return { running: false, pid: null };
|
|
79509
79511
|
try {
|
|
@@ -79535,7 +79537,7 @@ async function startContent(options2) {
|
|
|
79535
79537
|
await contentCommand(options2);
|
|
79536
79538
|
}
|
|
79537
79539
|
async function stopContent() {
|
|
79538
|
-
const lockFile =
|
|
79540
|
+
const lockFile = join169(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
79539
79541
|
if (!existsSync87(lockFile)) {
|
|
79540
79542
|
logger.info("Content daemon is not running.");
|
|
79541
79543
|
return;
|
|
@@ -79574,9 +79576,9 @@ async function statusContent() {
|
|
|
79574
79576
|
} catch {}
|
|
79575
79577
|
}
|
|
79576
79578
|
async function logsContent(options2) {
|
|
79577
|
-
const logDir =
|
|
79579
|
+
const logDir = join169(homedir58(), ".claudekit", "logs");
|
|
79578
79580
|
const dateStr = new Date().toISOString().slice(0, 10).replace(/-/g, "");
|
|
79579
|
-
const logPath =
|
|
79581
|
+
const logPath = join169(logDir, `content-${dateStr}.log`);
|
|
79580
79582
|
if (!existsSync87(logPath)) {
|
|
79581
79583
|
logger.info("No content logs found for today.");
|
|
79582
79584
|
return;
|
|
@@ -79608,13 +79610,13 @@ var init_content_subcommands = __esm(() => {
|
|
|
79608
79610
|
init_setup_wizard();
|
|
79609
79611
|
init_state_manager();
|
|
79610
79612
|
init_content_review_commands();
|
|
79611
|
-
LOCK_DIR =
|
|
79613
|
+
LOCK_DIR = join169(homedir58(), ".claudekit", "locks");
|
|
79612
79614
|
});
|
|
79613
79615
|
|
|
79614
79616
|
// src/commands/content/content-command.ts
|
|
79615
79617
|
import { existsSync as existsSync88, mkdirSync as mkdirSync9, unlinkSync as unlinkSync7, writeFileSync as writeFileSync7 } from "node:fs";
|
|
79616
79618
|
import { homedir as homedir59 } from "node:os";
|
|
79617
|
-
import { join as
|
|
79619
|
+
import { join as join170 } from "node:path";
|
|
79618
79620
|
async function contentCommand(options2) {
|
|
79619
79621
|
const cwd2 = process.cwd();
|
|
79620
79622
|
const contentLogger = new ContentLogger;
|
|
@@ -79792,8 +79794,8 @@ var init_content_command = __esm(() => {
|
|
|
79792
79794
|
init_publisher();
|
|
79793
79795
|
init_review_manager();
|
|
79794
79796
|
init_state_manager();
|
|
79795
|
-
LOCK_DIR2 =
|
|
79796
|
-
LOCK_FILE =
|
|
79797
|
+
LOCK_DIR2 = join170(homedir59(), ".claudekit", "locks");
|
|
79798
|
+
LOCK_FILE = join170(LOCK_DIR2, "ck-content.lock");
|
|
79797
79799
|
});
|
|
79798
79800
|
|
|
79799
79801
|
// src/commands/content/index.ts
|
|
@@ -101545,7 +101547,7 @@ async function handleDownload(ctx) {
|
|
|
101545
101547
|
};
|
|
101546
101548
|
}
|
|
101547
101549
|
// src/commands/init/phases/merge-handler.ts
|
|
101548
|
-
import { join as
|
|
101550
|
+
import { join as join121 } from "node:path";
|
|
101549
101551
|
|
|
101550
101552
|
// src/domains/installation/deletion-handler.ts
|
|
101551
101553
|
import { existsSync as existsSync65, lstatSync as lstatSync3, readdirSync as readdirSync9, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
@@ -101905,9 +101907,9 @@ init_dist2();
|
|
|
101905
101907
|
// src/domains/installation/merger/copy-executor.ts
|
|
101906
101908
|
init_logger();
|
|
101907
101909
|
init_types3();
|
|
101908
|
-
var
|
|
101910
|
+
var import_fs_extra16 = __toESM(require_lib(), 1);
|
|
101909
101911
|
var import_ignore3 = __toESM(require_ignore(), 1);
|
|
101910
|
-
import { dirname as
|
|
101912
|
+
import { dirname as dirname41, join as join111, relative as relative24 } from "node:path";
|
|
101911
101913
|
|
|
101912
101914
|
// src/domains/installation/selective-merger.ts
|
|
101913
101915
|
import { stat as stat18 } from "node:fs/promises";
|
|
@@ -102081,12 +102083,87 @@ class SelectiveMerger {
|
|
|
102081
102083
|
}
|
|
102082
102084
|
}
|
|
102083
102085
|
|
|
102086
|
+
// src/domains/installation/merger/deleted-skill-preservation.ts
|
|
102087
|
+
init_metadata_migration();
|
|
102088
|
+
import { dirname as dirname38, join as join107, relative as relative22 } from "node:path";
|
|
102089
|
+
var import_fs_extra13 = __toESM(require_lib(), 1);
|
|
102090
|
+
async function findIgnoredSkillDirectories({
|
|
102091
|
+
files,
|
|
102092
|
+
sourceDir,
|
|
102093
|
+
destDir,
|
|
102094
|
+
claudeDir: claudeDir3,
|
|
102095
|
+
installingKit
|
|
102096
|
+
}) {
|
|
102097
|
+
const sourceSkillRoots = findSourceSkillRoots(files, sourceDir);
|
|
102098
|
+
const ignoredSkillDirectories = new Set;
|
|
102099
|
+
if (sourceSkillRoots.size === 0)
|
|
102100
|
+
return ignoredSkillDirectories;
|
|
102101
|
+
const metadata = await readManifest(claudeDir3);
|
|
102102
|
+
const kitMetadata = metadata ? getKitMetadata(metadata, installingKit) : null;
|
|
102103
|
+
if (!kitMetadata)
|
|
102104
|
+
return ignoredSkillDirectories;
|
|
102105
|
+
const previouslyTrackedRoots = new Set;
|
|
102106
|
+
for (const file of kitMetadata.files ?? []) {
|
|
102107
|
+
const skillRoot = findSkillRoot(file.path, sourceSkillRoots.keys());
|
|
102108
|
+
if (skillRoot)
|
|
102109
|
+
previouslyTrackedRoots.add(skillRoot);
|
|
102110
|
+
}
|
|
102111
|
+
const existingIgnoredRoots = new Set((kitMetadata.ignoredSkills ?? []).flatMap((path16) => {
|
|
102112
|
+
const root = normalizeSkillRoot(path16);
|
|
102113
|
+
return root ? [root] : [];
|
|
102114
|
+
}));
|
|
102115
|
+
for (const [metadataRoot, sourceRoot] of sourceSkillRoots) {
|
|
102116
|
+
const destSkillRoot = join107(destDir, ...sourceRoot.split("/"));
|
|
102117
|
+
const skillExists = await import_fs_extra13.pathExists(destSkillRoot);
|
|
102118
|
+
if (existingIgnoredRoots.has(metadataRoot) || !skillExists && previouslyTrackedRoots.has(metadataRoot)) {
|
|
102119
|
+
ignoredSkillDirectories.add(metadataRoot);
|
|
102120
|
+
}
|
|
102121
|
+
}
|
|
102122
|
+
return ignoredSkillDirectories;
|
|
102123
|
+
}
|
|
102124
|
+
function shouldSkipIgnoredSkill(normalizedRelativePath, ignoredSkillDirectories) {
|
|
102125
|
+
const metadataPath = toMetadataPath(normalizedRelativePath);
|
|
102126
|
+
if (!metadataPath)
|
|
102127
|
+
return false;
|
|
102128
|
+
return findSkillRoot(metadataPath, ignoredSkillDirectories) !== null;
|
|
102129
|
+
}
|
|
102130
|
+
function findSourceSkillRoots(files, sourceDir) {
|
|
102131
|
+
const sourceSkillRoots = new Map;
|
|
102132
|
+
for (const file of files) {
|
|
102133
|
+
const normalizedPath = relative22(sourceDir, file).replace(/\\/g, "/");
|
|
102134
|
+
const metadataPath = toMetadataPath(normalizedPath);
|
|
102135
|
+
if (!metadataPath?.endsWith("/SKILL.md"))
|
|
102136
|
+
continue;
|
|
102137
|
+
const metadataRoot = dirname38(metadataPath).replace(/\\/g, "/");
|
|
102138
|
+
const sourceRoot = dirname38(normalizedPath).replace(/\\/g, "/");
|
|
102139
|
+
sourceSkillRoots.set(metadataRoot, sourceRoot);
|
|
102140
|
+
}
|
|
102141
|
+
return sourceSkillRoots;
|
|
102142
|
+
}
|
|
102143
|
+
function toMetadataPath(normalizedRelativePath) {
|
|
102144
|
+
const path16 = normalizedRelativePath.replace(/^\.claude\//, "");
|
|
102145
|
+
return path16.startsWith("skills/") ? path16 : null;
|
|
102146
|
+
}
|
|
102147
|
+
function normalizeSkillRoot(path16) {
|
|
102148
|
+
const normalized = path16.replace(/\\/g, "/").replace(/^\.claude\//, "").replace(/\/+$/, "");
|
|
102149
|
+
return normalized.startsWith("skills/") && normalized.split("/").length >= 2 ? normalized : null;
|
|
102150
|
+
}
|
|
102151
|
+
function findSkillRoot(path16, skillRoots) {
|
|
102152
|
+
const normalizedPath = path16.replace(/\\/g, "/").replace(/^\.claude\//, "");
|
|
102153
|
+
for (const root of skillRoots) {
|
|
102154
|
+
if (normalizedPath === `${root}/SKILL.md` || normalizedPath.startsWith(`${root}/`)) {
|
|
102155
|
+
return root;
|
|
102156
|
+
}
|
|
102157
|
+
}
|
|
102158
|
+
return null;
|
|
102159
|
+
}
|
|
102160
|
+
|
|
102084
102161
|
// src/domains/installation/merger/file-scanner.ts
|
|
102085
102162
|
init_logger();
|
|
102086
|
-
var
|
|
102163
|
+
var import_fs_extra14 = __toESM(require_lib(), 1);
|
|
102087
102164
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
102088
|
-
import { relative as
|
|
102089
|
-
import { join as
|
|
102165
|
+
import { relative as relative23 } from "node:path";
|
|
102166
|
+
import { join as join108 } from "node:path";
|
|
102090
102167
|
|
|
102091
102168
|
// node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
102092
102169
|
var balanced = (a3, b3, str2) => {
|
|
@@ -103540,12 +103617,12 @@ class FileScanner {
|
|
|
103540
103617
|
}
|
|
103541
103618
|
async getFiles(dir, baseDir = dir) {
|
|
103542
103619
|
const files = [];
|
|
103543
|
-
const entries = await
|
|
103620
|
+
const entries = await import_fs_extra14.readdir(dir, { encoding: "utf8" });
|
|
103544
103621
|
for (const entry of entries) {
|
|
103545
|
-
const fullPath =
|
|
103546
|
-
const relativePath =
|
|
103622
|
+
const fullPath = join108(dir, entry);
|
|
103623
|
+
const relativePath = relative23(baseDir, fullPath);
|
|
103547
103624
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
103548
|
-
const stats = await
|
|
103625
|
+
const stats = await import_fs_extra14.lstat(fullPath);
|
|
103549
103626
|
if (stats.isSymbolicLink()) {
|
|
103550
103627
|
logger.warning(`Skipping symbolic link: ${normalizedRelativePath}`);
|
|
103551
103628
|
continue;
|
|
@@ -103578,13 +103655,13 @@ class FileScanner {
|
|
|
103578
103655
|
// src/domains/installation/merger/settings-processor.ts
|
|
103579
103656
|
import { execSync as execSync5 } from "node:child_process";
|
|
103580
103657
|
import { homedir as homedir45 } from "node:os";
|
|
103581
|
-
import { dirname as
|
|
103658
|
+
import { dirname as dirname40, join as join110 } from "node:path";
|
|
103582
103659
|
|
|
103583
103660
|
// src/domains/config/installed-settings-tracker.ts
|
|
103584
103661
|
init_shared();
|
|
103585
103662
|
import { existsSync as existsSync66 } from "node:fs";
|
|
103586
103663
|
import { mkdir as mkdir31, readFile as readFile50, writeFile as writeFile25 } from "node:fs/promises";
|
|
103587
|
-
import { dirname as
|
|
103664
|
+
import { dirname as dirname39, join as join109 } from "node:path";
|
|
103588
103665
|
var CK_JSON_FILE = ".ck.json";
|
|
103589
103666
|
|
|
103590
103667
|
class InstalledSettingsTracker {
|
|
@@ -103598,9 +103675,9 @@ class InstalledSettingsTracker {
|
|
|
103598
103675
|
}
|
|
103599
103676
|
getCkJsonPath() {
|
|
103600
103677
|
if (this.isGlobal) {
|
|
103601
|
-
return
|
|
103678
|
+
return join109(this.projectDir, CK_JSON_FILE);
|
|
103602
103679
|
}
|
|
103603
|
-
return
|
|
103680
|
+
return join109(this.projectDir, ".claude", CK_JSON_FILE);
|
|
103604
103681
|
}
|
|
103605
103682
|
async loadInstalledSettings() {
|
|
103606
103683
|
const ckJsonPath = this.getCkJsonPath();
|
|
@@ -103635,7 +103712,7 @@ class InstalledSettingsTracker {
|
|
|
103635
103712
|
data.kits[this.kitName] = {};
|
|
103636
103713
|
}
|
|
103637
103714
|
data.kits[this.kitName].installedSettings = settings;
|
|
103638
|
-
await mkdir31(
|
|
103715
|
+
await mkdir31(dirname39(ckJsonPath), { recursive: true });
|
|
103639
103716
|
await writeFile25(ckJsonPath, JSON.stringify(data, null, 2), "utf-8");
|
|
103640
103717
|
logger.debug(`Saved installed settings to ${ckJsonPath}`);
|
|
103641
103718
|
} catch (error) {
|
|
@@ -103679,7 +103756,7 @@ init_zombie_wirings_pruner();
|
|
|
103679
103756
|
init_command_normalizer();
|
|
103680
103757
|
init_logger();
|
|
103681
103758
|
init_path_resolver();
|
|
103682
|
-
var
|
|
103759
|
+
var import_fs_extra15 = __toESM(require_lib(), 1);
|
|
103683
103760
|
var import_semver4 = __toESM(require_semver2(), 1);
|
|
103684
103761
|
|
|
103685
103762
|
class SettingsProcessor {
|
|
@@ -103727,7 +103804,7 @@ class SettingsProcessor {
|
|
|
103727
103804
|
}
|
|
103728
103805
|
async processSettingsJson(sourceFile, destFile) {
|
|
103729
103806
|
try {
|
|
103730
|
-
const sourceContent = await
|
|
103807
|
+
const sourceContent = await import_fs_extra15.readFile(sourceFile, "utf-8");
|
|
103731
103808
|
let transformedSource = sourceContent;
|
|
103732
103809
|
if (this.isGlobal) {
|
|
103733
103810
|
const globalRoot = this.getCanonicalGlobalCommandRoot();
|
|
@@ -103741,7 +103818,7 @@ class SettingsProcessor {
|
|
|
103741
103818
|
logger.debug('Transformed .claude/ paths to "$CLAUDE_PROJECT_DIR"/.claude/ in settings.json for local installation');
|
|
103742
103819
|
}
|
|
103743
103820
|
}
|
|
103744
|
-
const destExists = await
|
|
103821
|
+
const destExists = await import_fs_extra15.pathExists(destFile);
|
|
103745
103822
|
if (destExists && !this.forceOverwriteSettings) {
|
|
103746
103823
|
await this.selectiveMergeSettings(transformedSource, destFile);
|
|
103747
103824
|
} else {
|
|
@@ -103763,14 +103840,14 @@ class SettingsProcessor {
|
|
|
103763
103840
|
}
|
|
103764
103841
|
} catch {
|
|
103765
103842
|
const formattedContent = this.formatJsonContent(transformedSource);
|
|
103766
|
-
await
|
|
103843
|
+
await import_fs_extra15.writeFile(destFile, formattedContent, "utf-8");
|
|
103767
103844
|
}
|
|
103768
103845
|
await this.injectTeamHooksIfSupported(destFile);
|
|
103769
103846
|
}
|
|
103770
103847
|
await this.repairSiblingSettingsLocal(destFile);
|
|
103771
103848
|
} catch (error) {
|
|
103772
103849
|
logger.error(`Failed to process settings.json: ${error}`);
|
|
103773
|
-
await
|
|
103850
|
+
await import_fs_extra15.copy(sourceFile, destFile, { overwrite: true });
|
|
103774
103851
|
}
|
|
103775
103852
|
}
|
|
103776
103853
|
async selectiveMergeSettings(transformedSourceContent, destFile) {
|
|
@@ -103781,7 +103858,7 @@ class SettingsProcessor {
|
|
|
103781
103858
|
} catch {
|
|
103782
103859
|
logger.warning("Failed to parse source settings.json, falling back to overwrite");
|
|
103783
103860
|
const formattedContent = this.formatJsonContent(transformedSourceContent);
|
|
103784
|
-
await
|
|
103861
|
+
await import_fs_extra15.writeFile(destFile, formattedContent, "utf-8");
|
|
103785
103862
|
return;
|
|
103786
103863
|
}
|
|
103787
103864
|
let destSettings;
|
|
@@ -103863,10 +103940,10 @@ class SettingsProcessor {
|
|
|
103863
103940
|
};
|
|
103864
103941
|
try {
|
|
103865
103942
|
if (this.isGlobal) {
|
|
103866
|
-
await addFromConfig(
|
|
103943
|
+
await addFromConfig(join110(this.projectDir, ".ck.json"));
|
|
103867
103944
|
} else {
|
|
103868
|
-
await addFromConfig(
|
|
103869
|
-
await addFromConfig(
|
|
103945
|
+
await addFromConfig(join110(PathResolver.getGlobalKitDir(), ".ck.json"));
|
|
103946
|
+
await addFromConfig(join110(this.projectDir, ".claude", ".ck.json"));
|
|
103870
103947
|
}
|
|
103871
103948
|
} catch (error) {
|
|
103872
103949
|
logger.debug(`Failed to load .ck.json hook preferences: ${error instanceof Error ? error.message : "unknown"}`);
|
|
@@ -103874,9 +103951,9 @@ class SettingsProcessor {
|
|
|
103874
103951
|
return disabled;
|
|
103875
103952
|
}
|
|
103876
103953
|
async readDisabledHookNamesFromConfig(configPath) {
|
|
103877
|
-
if (!await
|
|
103954
|
+
if (!await import_fs_extra15.pathExists(configPath))
|
|
103878
103955
|
return new Set;
|
|
103879
|
-
const raw2 = parseJsonContent(await
|
|
103956
|
+
const raw2 = parseJsonContent(await import_fs_extra15.readFile(configPath, "utf-8"));
|
|
103880
103957
|
const hooks = raw2.hooks;
|
|
103881
103958
|
if (!hooks || typeof hooks !== "object")
|
|
103882
103959
|
return new Set;
|
|
@@ -104113,7 +104190,7 @@ class SettingsProcessor {
|
|
|
104113
104190
|
}
|
|
104114
104191
|
async readAndNormalizeGlobalSettings(destFile) {
|
|
104115
104192
|
try {
|
|
104116
|
-
const content = await
|
|
104193
|
+
const content = await import_fs_extra15.readFile(destFile, "utf-8");
|
|
104117
104194
|
if (!content.trim())
|
|
104118
104195
|
return null;
|
|
104119
104196
|
const parsedSettings = JSON.parse(content);
|
|
@@ -104223,7 +104300,7 @@ class SettingsProcessor {
|
|
|
104223
104300
|
return false;
|
|
104224
104301
|
}
|
|
104225
104302
|
const configuredGlobalDir = PathResolver.getGlobalKitDir().replace(/\\/g, "/").replace(/\/+$/, "");
|
|
104226
|
-
const defaultGlobalDir =
|
|
104303
|
+
const defaultGlobalDir = join110(homedir45(), ".claude").replace(/\\/g, "/");
|
|
104227
104304
|
return configuredGlobalDir !== defaultGlobalDir;
|
|
104228
104305
|
}
|
|
104229
104306
|
getClaudeCommandRoot() {
|
|
@@ -104243,8 +104320,8 @@ class SettingsProcessor {
|
|
|
104243
104320
|
return true;
|
|
104244
104321
|
}
|
|
104245
104322
|
async repairSiblingSettingsLocal(destFile) {
|
|
104246
|
-
const settingsLocalPath =
|
|
104247
|
-
if (settingsLocalPath === destFile || !await
|
|
104323
|
+
const settingsLocalPath = join110(dirname40(destFile), "settings.local.json");
|
|
104324
|
+
if (settingsLocalPath === destFile || !await import_fs_extra15.pathExists(settingsLocalPath)) {
|
|
104248
104325
|
return;
|
|
104249
104326
|
}
|
|
104250
104327
|
await this.repairSettingsFile(settingsLocalPath);
|
|
@@ -104355,6 +104432,8 @@ class CopyExecutor {
|
|
|
104355
104432
|
fileConflicts = [];
|
|
104356
104433
|
claudeDir = null;
|
|
104357
104434
|
installingKit = null;
|
|
104435
|
+
ignoredSkillDirectories = new Set;
|
|
104436
|
+
preserveDeletedSkills = true;
|
|
104358
104437
|
constructor(neverCopyPatterns) {
|
|
104359
104438
|
this.userConfigChecker = import_ignore3.default().add(USER_CONFIG_PATTERNS);
|
|
104360
104439
|
this.fileScanner = new FileScanner(neverCopyPatterns);
|
|
@@ -104374,6 +104453,9 @@ class CopyExecutor {
|
|
|
104374
104453
|
setForceOverwriteSettings(force) {
|
|
104375
104454
|
this.settingsProcessor.setForceOverwriteSettings(force);
|
|
104376
104455
|
}
|
|
104456
|
+
setPreserveDeletedSkills(preserve) {
|
|
104457
|
+
this.preserveDeletedSkills = preserve;
|
|
104458
|
+
}
|
|
104377
104459
|
setRestoreCkHooks(restore) {
|
|
104378
104460
|
this.settingsProcessor.setRestoreCkHooks(restore);
|
|
104379
104461
|
}
|
|
@@ -104408,10 +104490,10 @@ class CopyExecutor {
|
|
|
104408
104490
|
const conflicts = [];
|
|
104409
104491
|
const files = await this.fileScanner.getFiles(sourceDir, sourceDir);
|
|
104410
104492
|
for (const file of files) {
|
|
104411
|
-
const relativePath =
|
|
104493
|
+
const relativePath = relative24(sourceDir, file);
|
|
104412
104494
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
104413
|
-
const destPath =
|
|
104414
|
-
if (await
|
|
104495
|
+
const destPath = join111(destDir, relativePath);
|
|
104496
|
+
if (await import_fs_extra16.pathExists(destPath)) {
|
|
104415
104497
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
104416
104498
|
logger.debug(`Security-sensitive file exists but won't be overwritten: ${normalizedRelativePath}`);
|
|
104417
104499
|
continue;
|
|
@@ -104427,19 +104509,26 @@ class CopyExecutor {
|
|
|
104427
104509
|
}
|
|
104428
104510
|
async copyFiles(sourceDir, destDir) {
|
|
104429
104511
|
const files = await this.fileScanner.getFiles(sourceDir, sourceDir);
|
|
104512
|
+
await this.loadIgnoredSkillDirectories(files, sourceDir, destDir);
|
|
104430
104513
|
let copiedCount = 0;
|
|
104431
104514
|
let skippedCount = 0;
|
|
104515
|
+
let ignoredSkillSkipped = 0;
|
|
104432
104516
|
for (const file of files) {
|
|
104433
|
-
const relativePath =
|
|
104517
|
+
const relativePath = relative24(sourceDir, file);
|
|
104434
104518
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
104435
|
-
const destPath =
|
|
104519
|
+
const destPath = join111(destDir, relativePath);
|
|
104436
104520
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
104437
104521
|
logger.debug(`Skipping security-sensitive file: ${normalizedRelativePath}`);
|
|
104438
104522
|
skippedCount++;
|
|
104439
104523
|
continue;
|
|
104440
104524
|
}
|
|
104525
|
+
if (this.shouldSkipIgnoredSkill(normalizedRelativePath)) {
|
|
104526
|
+
logger.debug(`Preserving ignored skill file: ${normalizedRelativePath}`);
|
|
104527
|
+
ignoredSkillSkipped++;
|
|
104528
|
+
continue;
|
|
104529
|
+
}
|
|
104441
104530
|
if (this.userConfigChecker.ignores(normalizedRelativePath)) {
|
|
104442
|
-
const fileExists = await
|
|
104531
|
+
const fileExists = await import_fs_extra16.pathExists(destPath);
|
|
104443
104532
|
if (fileExists) {
|
|
104444
104533
|
logger.debug(`Preserving user config: ${normalizedRelativePath}`);
|
|
104445
104534
|
skippedCount++;
|
|
@@ -104470,7 +104559,7 @@ class CopyExecutor {
|
|
|
104470
104559
|
continue;
|
|
104471
104560
|
}
|
|
104472
104561
|
}
|
|
104473
|
-
await withRetry2(() =>
|
|
104562
|
+
await withRetry2(() => import_fs_extra16.copy(file, destPath, { overwrite: true }));
|
|
104474
104563
|
this.trackInstalledFile(normalizedRelativePath);
|
|
104475
104564
|
copiedCount++;
|
|
104476
104565
|
}
|
|
@@ -104481,6 +104570,8 @@ class CopyExecutor {
|
|
|
104481
104570
|
parts.push(`skipped ${this.unchangedSkipped} unchanged`);
|
|
104482
104571
|
if (this.sharedSkipped > 0)
|
|
104483
104572
|
parts.push(`preserved ${this.sharedSkipped} shared`);
|
|
104573
|
+
if (ignoredSkillSkipped > 0)
|
|
104574
|
+
parts.push(`preserved ${ignoredSkillSkipped} ignored skill file(s)`);
|
|
104484
104575
|
if (skippedCount > 0)
|
|
104485
104576
|
parts.push(`skipped ${skippedCount} protected`);
|
|
104486
104577
|
if (parts.length > 0) {
|
|
@@ -104507,14 +104598,34 @@ class CopyExecutor {
|
|
|
104507
104598
|
getFileConflicts() {
|
|
104508
104599
|
return this.fileConflicts;
|
|
104509
104600
|
}
|
|
104601
|
+
getIgnoredSkillDirectories() {
|
|
104602
|
+
return Array.from(this.ignoredSkillDirectories).sort();
|
|
104603
|
+
}
|
|
104510
104604
|
trackInstalledFile(relativePath) {
|
|
104511
104605
|
this.installedFiles.add(relativePath);
|
|
104512
|
-
let dir =
|
|
104606
|
+
let dir = dirname41(relativePath);
|
|
104513
104607
|
while (dir && dir !== "." && dir !== "/") {
|
|
104514
104608
|
this.installedDirectories.add(`${dir}/`);
|
|
104515
|
-
dir =
|
|
104609
|
+
dir = dirname41(dir);
|
|
104516
104610
|
}
|
|
104517
104611
|
}
|
|
104612
|
+
async loadIgnoredSkillDirectories(files, sourceDir, destDir) {
|
|
104613
|
+
this.ignoredSkillDirectories.clear();
|
|
104614
|
+
if (!this.preserveDeletedSkills)
|
|
104615
|
+
return;
|
|
104616
|
+
if (!this.claudeDir || !this.installingKit)
|
|
104617
|
+
return;
|
|
104618
|
+
this.ignoredSkillDirectories = await findIgnoredSkillDirectories({
|
|
104619
|
+
files,
|
|
104620
|
+
sourceDir,
|
|
104621
|
+
destDir,
|
|
104622
|
+
claudeDir: this.claudeDir,
|
|
104623
|
+
installingKit: this.installingKit
|
|
104624
|
+
});
|
|
104625
|
+
}
|
|
104626
|
+
shouldSkipIgnoredSkill(normalizedRelativePath) {
|
|
104627
|
+
return shouldSkipIgnoredSkill(normalizedRelativePath, this.ignoredSkillDirectories);
|
|
104628
|
+
}
|
|
104518
104629
|
}
|
|
104519
104630
|
|
|
104520
104631
|
// src/domains/installation/file-merger.ts
|
|
@@ -104549,6 +104660,9 @@ class FileMerger {
|
|
|
104549
104660
|
setForceOverwriteSettings(force) {
|
|
104550
104661
|
this.copyExecutor.setForceOverwriteSettings(force);
|
|
104551
104662
|
}
|
|
104663
|
+
setPreserveDeletedSkills(preserve) {
|
|
104664
|
+
this.copyExecutor.setPreserveDeletedSkills(preserve);
|
|
104665
|
+
}
|
|
104552
104666
|
setRestoreCkHooks(restore) {
|
|
104553
104667
|
this.copyExecutor.setRestoreCkHooks(restore);
|
|
104554
104668
|
}
|
|
@@ -104607,19 +104721,22 @@ class FileMerger {
|
|
|
104607
104721
|
getFileConflicts() {
|
|
104608
104722
|
return this.copyExecutor.getFileConflicts();
|
|
104609
104723
|
}
|
|
104724
|
+
getIgnoredSkillDirectories() {
|
|
104725
|
+
return this.copyExecutor.getIgnoredSkillDirectories();
|
|
104726
|
+
}
|
|
104610
104727
|
}
|
|
104611
104728
|
|
|
104612
104729
|
// src/domains/migration/legacy-migration.ts
|
|
104613
104730
|
import { readdir as readdir28, stat as stat19 } from "node:fs/promises";
|
|
104614
|
-
import { join as
|
|
104731
|
+
import { join as join115, relative as relative25 } from "node:path";
|
|
104615
104732
|
// src/services/file-operations/manifest/manifest-tracker.ts
|
|
104616
|
-
import { join as
|
|
104733
|
+
import { join as join114 } from "node:path";
|
|
104617
104734
|
|
|
104618
104735
|
// src/domains/migration/release-manifest.ts
|
|
104619
104736
|
init_logger();
|
|
104620
104737
|
init_zod();
|
|
104621
|
-
var
|
|
104622
|
-
import { join as
|
|
104738
|
+
var import_fs_extra17 = __toESM(require_lib(), 1);
|
|
104739
|
+
import { join as join112 } from "node:path";
|
|
104623
104740
|
var ReleaseManifestFileSchema = exports_external.object({
|
|
104624
104741
|
path: exports_external.string(),
|
|
104625
104742
|
checksum: exports_external.string().regex(/^[a-f0-9]{64}$/),
|
|
@@ -104634,9 +104751,9 @@ var ReleaseManifestSchema = exports_external.object({
|
|
|
104634
104751
|
|
|
104635
104752
|
class ReleaseManifestLoader {
|
|
104636
104753
|
static async load(extractDir) {
|
|
104637
|
-
const manifestPath =
|
|
104754
|
+
const manifestPath = join112(extractDir, "release-manifest.json");
|
|
104638
104755
|
try {
|
|
104639
|
-
const content = await
|
|
104756
|
+
const content = await import_fs_extra17.readFile(manifestPath, "utf-8");
|
|
104640
104757
|
const parsed = JSON.parse(content);
|
|
104641
104758
|
return ReleaseManifestSchema.parse(parsed);
|
|
104642
104759
|
} catch (error) {
|
|
@@ -104657,14 +104774,14 @@ init_p_limit();
|
|
|
104657
104774
|
|
|
104658
104775
|
// src/services/file-operations/manifest/manifest-updater.ts
|
|
104659
104776
|
init_metadata_migration();
|
|
104660
|
-
import { join as
|
|
104777
|
+
import { join as join113 } from "node:path";
|
|
104661
104778
|
init_logger();
|
|
104662
104779
|
init_types3();
|
|
104663
|
-
var
|
|
104664
|
-
async function writeManifest(claudeDir3, kitName, version, scope, kitType, trackedFiles, userConfigFiles) {
|
|
104665
|
-
const metadataPath =
|
|
104780
|
+
var import_fs_extra18 = __toESM(require_lib(), 1);
|
|
104781
|
+
async function writeManifest(claudeDir3, kitName, version, scope, kitType, trackedFiles, userConfigFiles, ignoredSkills = []) {
|
|
104782
|
+
const metadataPath = join113(claudeDir3, "metadata.json");
|
|
104666
104783
|
const kit = kitType || (/\bmarketing\b/i.test(kitName) ? "marketing" : "engineer");
|
|
104667
|
-
await
|
|
104784
|
+
await import_fs_extra18.ensureFile(metadataPath);
|
|
104668
104785
|
let release = null;
|
|
104669
104786
|
try {
|
|
104670
104787
|
release = await acquireInstallationStateLock(claudeDir3);
|
|
@@ -104673,9 +104790,9 @@ async function writeManifest(claudeDir3, kitName, version, scope, kitType, track
|
|
|
104673
104790
|
logger.warning(`Metadata migration warning: ${migrationResult.error}`);
|
|
104674
104791
|
}
|
|
104675
104792
|
let existingMetadata = { kits: {} };
|
|
104676
|
-
if (await
|
|
104793
|
+
if (await import_fs_extra18.pathExists(metadataPath)) {
|
|
104677
104794
|
try {
|
|
104678
|
-
const content = await
|
|
104795
|
+
const content = await import_fs_extra18.readFile(metadataPath, "utf-8");
|
|
104679
104796
|
const parsed = JSON.parse(content);
|
|
104680
104797
|
if (parsed && typeof parsed === "object" && Object.keys(parsed).length > 0) {
|
|
104681
104798
|
existingMetadata = parsed;
|
|
@@ -104684,13 +104801,20 @@ async function writeManifest(claudeDir3, kitName, version, scope, kitType, track
|
|
|
104684
104801
|
logger.debug(`Could not read existing metadata: ${error}`);
|
|
104685
104802
|
}
|
|
104686
104803
|
}
|
|
104804
|
+
const existingKits = existingMetadata.kits || {};
|
|
104805
|
+
const normalizedTrackedPaths = trackedFiles.map((file) => normalizeMetadataPath(file.path));
|
|
104806
|
+
const existingIgnoredSkills = existingKits[kit]?.ignoredSkills ?? [];
|
|
104807
|
+
const mergedIgnoredSkills = uniqueNormalizedSkillRoots([
|
|
104808
|
+
...existingIgnoredSkills,
|
|
104809
|
+
...ignoredSkills
|
|
104810
|
+
]).filter((skillRoot) => !normalizedTrackedPaths.some((path17) => path17 === `${skillRoot}/SKILL.md` || path17.startsWith(`${skillRoot}/`)));
|
|
104687
104811
|
const installedAt = new Date().toISOString();
|
|
104688
104812
|
const kitMetadata = {
|
|
104689
104813
|
version,
|
|
104690
104814
|
installedAt,
|
|
104691
|
-
files: trackedFiles.length > 0 ? trackedFiles : undefined
|
|
104815
|
+
files: trackedFiles.length > 0 ? trackedFiles : undefined,
|
|
104816
|
+
ignoredSkills: mergedIgnoredSkills.length > 0 ? mergedIgnoredSkills : undefined
|
|
104692
104817
|
};
|
|
104693
|
-
const existingKits = existingMetadata.kits || {};
|
|
104694
104818
|
const otherKitsExist = Object.keys(existingKits).some((k2) => k2 !== kit);
|
|
104695
104819
|
const metadata = {
|
|
104696
104820
|
kits: {
|
|
@@ -104704,7 +104828,7 @@ async function writeManifest(claudeDir3, kitName, version, scope, kitType, track
|
|
|
104704
104828
|
userConfigFiles: [...USER_CONFIG_PATTERNS, ...userConfigFiles]
|
|
104705
104829
|
};
|
|
104706
104830
|
const validated = MetadataSchema.parse(metadata);
|
|
104707
|
-
await
|
|
104831
|
+
await import_fs_extra18.writeFile(metadataPath, JSON.stringify(validated, null, 2), "utf-8");
|
|
104708
104832
|
logger.debug(`Wrote manifest for kit "${kit}" with ${trackedFiles.length} tracked files`);
|
|
104709
104833
|
} finally {
|
|
104710
104834
|
if (release) {
|
|
@@ -104713,9 +104837,22 @@ async function writeManifest(claudeDir3, kitName, version, scope, kitType, track
|
|
|
104713
104837
|
}
|
|
104714
104838
|
}
|
|
104715
104839
|
}
|
|
104840
|
+
function normalizeMetadataPath(path17) {
|
|
104841
|
+
return path17.replace(/\\/g, "/").replace(/^\.claude\//, "").replace(/\/+$/, "");
|
|
104842
|
+
}
|
|
104843
|
+
function normalizeSkillRoot2(path17) {
|
|
104844
|
+
const normalized = normalizeMetadataPath(path17);
|
|
104845
|
+
return normalized.startsWith("skills/") && normalized.split("/").length >= 2 ? normalized : null;
|
|
104846
|
+
}
|
|
104847
|
+
function uniqueNormalizedSkillRoots(paths) {
|
|
104848
|
+
return Array.from(new Set(paths.flatMap((path17) => {
|
|
104849
|
+
const root = normalizeSkillRoot2(path17);
|
|
104850
|
+
return root ? [root] : [];
|
|
104851
|
+
}))).sort();
|
|
104852
|
+
}
|
|
104716
104853
|
async function removeKitFromManifest(claudeDir3, kit, options2) {
|
|
104717
|
-
const metadataPath =
|
|
104718
|
-
if (!await
|
|
104854
|
+
const metadataPath = join113(claudeDir3, "metadata.json");
|
|
104855
|
+
if (!await import_fs_extra18.pathExists(metadataPath))
|
|
104719
104856
|
return false;
|
|
104720
104857
|
let release = null;
|
|
104721
104858
|
try {
|
|
@@ -104727,7 +104864,7 @@ async function removeKitFromManifest(claudeDir3, kit, options2) {
|
|
|
104727
104864
|
return false;
|
|
104728
104865
|
const { [kit]: _removed, ...remainingKits } = metadata.kits;
|
|
104729
104866
|
if (Object.keys(remainingKits).length === 0) {
|
|
104730
|
-
await
|
|
104867
|
+
await import_fs_extra18.remove(metadataPath);
|
|
104731
104868
|
logger.debug("No kits remaining, removed metadata.json");
|
|
104732
104869
|
return true;
|
|
104733
104870
|
}
|
|
@@ -104735,7 +104872,7 @@ async function removeKitFromManifest(claudeDir3, kit, options2) {
|
|
|
104735
104872
|
...metadata,
|
|
104736
104873
|
kits: remainingKits
|
|
104737
104874
|
};
|
|
104738
|
-
await
|
|
104875
|
+
await import_fs_extra18.writeFile(metadataPath, JSON.stringify(updated, null, 2), "utf-8");
|
|
104739
104876
|
logger.debug(`Removed kit "${kit}" from metadata, ${Object.keys(remainingKits).length} kit(s) remaining`);
|
|
104740
104877
|
return true;
|
|
104741
104878
|
} finally {
|
|
@@ -104746,8 +104883,8 @@ async function removeKitFromManifest(claudeDir3, kit, options2) {
|
|
|
104746
104883
|
}
|
|
104747
104884
|
}
|
|
104748
104885
|
async function retainTrackedFilesInManifest(claudeDir3, retainedPaths, options2) {
|
|
104749
|
-
const metadataPath =
|
|
104750
|
-
if (!await
|
|
104886
|
+
const metadataPath = join113(claudeDir3, "metadata.json");
|
|
104887
|
+
if (!await import_fs_extra18.pathExists(metadataPath))
|
|
104751
104888
|
return false;
|
|
104752
104889
|
const normalizedPaths = new Set(retainedPaths.map((path17) => path17.replace(/\\/g, "/")));
|
|
104753
104890
|
if (normalizedPaths.size === 0)
|
|
@@ -104796,7 +104933,7 @@ async function retainTrackedFilesInManifest(claudeDir3, retainedPaths, options2)
|
|
|
104796
104933
|
files: retainedFiles2.length > 0 ? retainedFiles2 : undefined,
|
|
104797
104934
|
installedFiles: retainedInstalledFiles2.length > 0 ? retainedInstalledFiles2 : undefined
|
|
104798
104935
|
});
|
|
104799
|
-
await
|
|
104936
|
+
await import_fs_extra18.writeFile(metadataPath, JSON.stringify(updated2, null, 2), "utf-8");
|
|
104800
104937
|
return true;
|
|
104801
104938
|
}
|
|
104802
104939
|
const retainedFiles = (metadata.files || []).flatMap((file) => {
|
|
@@ -104820,7 +104957,7 @@ async function retainTrackedFilesInManifest(claudeDir3, retainedPaths, options2)
|
|
|
104820
104957
|
files: retainedFiles.length > 0 ? retainedFiles : undefined,
|
|
104821
104958
|
installedFiles: retainedInstalledFiles.length > 0 ? retainedInstalledFiles : undefined
|
|
104822
104959
|
});
|
|
104823
|
-
await
|
|
104960
|
+
await import_fs_extra18.writeFile(metadataPath, JSON.stringify(updated, null, 2), "utf-8");
|
|
104824
104961
|
return true;
|
|
104825
104962
|
} finally {
|
|
104826
104963
|
if (release) {
|
|
@@ -104927,7 +105064,7 @@ function buildFileTrackingList(options2) {
|
|
|
104927
105064
|
if (!isGlobal && !installedPath.startsWith(".claude/"))
|
|
104928
105065
|
continue;
|
|
104929
105066
|
const relativePath = isGlobal ? installedPath : installedPath.replace(/^\.claude\//, "");
|
|
104930
|
-
const filePath =
|
|
105067
|
+
const filePath = join114(claudeDir3, relativePath);
|
|
104931
105068
|
const manifestEntry = releaseManifest ? ReleaseManifestLoader.findFile(releaseManifest, installedPath) : null;
|
|
104932
105069
|
const ownership = manifestEntry ? "ck" : "user";
|
|
104933
105070
|
filesToTrack.push({
|
|
@@ -104951,7 +105088,7 @@ async function trackFilesWithProgress(filesToTrack, manifestOptions) {
|
|
|
104951
105088
|
}
|
|
104952
105089
|
});
|
|
104953
105090
|
trackingSpinner.succeed(`Tracked ${trackResult.success} files`);
|
|
104954
|
-
await writeManifest(manifestOptions.claudeDir, manifestOptions.kitName, manifestOptions.releaseTag, manifestOptions.mode, manifestOptions.kitType, tracker.getTrackedFiles(), tracker.getUserConfigFiles());
|
|
105091
|
+
await writeManifest(manifestOptions.claudeDir, manifestOptions.kitName, manifestOptions.releaseTag, manifestOptions.mode, manifestOptions.kitType, tracker.getTrackedFiles(), tracker.getUserConfigFiles(), manifestOptions.ignoredSkills);
|
|
104955
105092
|
return trackResult;
|
|
104956
105093
|
}
|
|
104957
105094
|
// src/services/file-operations/manifest-writer.ts
|
|
@@ -104981,8 +105118,8 @@ class ManifestWriter {
|
|
|
104981
105118
|
getTrackedFiles() {
|
|
104982
105119
|
return this.tracker.getTrackedFiles();
|
|
104983
105120
|
}
|
|
104984
|
-
async writeManifest(claudeDir3, kitName, version, scope, kitType) {
|
|
104985
|
-
return writeManifest(claudeDir3, kitName, version, scope, kitType, this.getTrackedFiles(), this.getUserConfigFiles());
|
|
105121
|
+
async writeManifest(claudeDir3, kitName, version, scope, kitType, ignoredSkills) {
|
|
105122
|
+
return writeManifest(claudeDir3, kitName, version, scope, kitType, this.getTrackedFiles(), this.getUserConfigFiles(), ignoredSkills);
|
|
104986
105123
|
}
|
|
104987
105124
|
static async readManifest(claudeDir3) {
|
|
104988
105125
|
return readManifest(claudeDir3);
|
|
@@ -105005,7 +105142,7 @@ class ManifestWriter {
|
|
|
105005
105142
|
init_environment();
|
|
105006
105143
|
init_logger();
|
|
105007
105144
|
init_skip_directories();
|
|
105008
|
-
var
|
|
105145
|
+
var import_fs_extra19 = __toESM(require_lib(), 1);
|
|
105009
105146
|
class LegacyMigration {
|
|
105010
105147
|
static async detectLegacy(claudeDir3) {
|
|
105011
105148
|
const metadata = await ManifestWriter.readManifest(claudeDir3);
|
|
@@ -105038,7 +105175,7 @@ class LegacyMigration {
|
|
|
105038
105175
|
continue;
|
|
105039
105176
|
if (SKIP_DIRS_ALL.includes(entry))
|
|
105040
105177
|
continue;
|
|
105041
|
-
const fullPath =
|
|
105178
|
+
const fullPath = join115(dir, entry);
|
|
105042
105179
|
let stats;
|
|
105043
105180
|
try {
|
|
105044
105181
|
stats = await stat19(fullPath);
|
|
@@ -105064,7 +105201,7 @@ class LegacyMigration {
|
|
|
105064
105201
|
static async classifyFiles(claudeDir3, manifest) {
|
|
105065
105202
|
const files = await LegacyMigration.scanFiles(claudeDir3);
|
|
105066
105203
|
const relevantFiles = files.filter((file) => {
|
|
105067
|
-
const relativePath =
|
|
105204
|
+
const relativePath = relative25(claudeDir3, file);
|
|
105068
105205
|
return !hasSkippedDirectorySegment(relativePath);
|
|
105069
105206
|
});
|
|
105070
105207
|
const skippedRuntimeArtifacts = files.length - relevantFiles.length;
|
|
@@ -105079,7 +105216,7 @@ class LegacyMigration {
|
|
|
105079
105216
|
};
|
|
105080
105217
|
const filesInManifest = [];
|
|
105081
105218
|
for (const file of relevantFiles) {
|
|
105082
|
-
const relativePath =
|
|
105219
|
+
const relativePath = relative25(claudeDir3, file).replace(/\\/g, "/");
|
|
105083
105220
|
const manifestEntry = ReleaseManifestLoader.findFile(manifest, relativePath);
|
|
105084
105221
|
if (!manifestEntry) {
|
|
105085
105222
|
preview.userCreated.push(relativePath);
|
|
@@ -105148,7 +105285,7 @@ User-created files (sample):`);
|
|
|
105148
105285
|
];
|
|
105149
105286
|
if (filesToChecksum.length > 0) {
|
|
105150
105287
|
const checksumResults = await mapWithLimit(filesToChecksum, async ({ relativePath, ownership }) => {
|
|
105151
|
-
const fullPath =
|
|
105288
|
+
const fullPath = join115(claudeDir3, relativePath);
|
|
105152
105289
|
const checksum = await OwnershipChecker.calculateChecksum(fullPath);
|
|
105153
105290
|
return { relativePath, checksum, ownership };
|
|
105154
105291
|
}, getOptimalConcurrency());
|
|
@@ -105169,8 +105306,8 @@ User-created files (sample):`);
|
|
|
105169
105306
|
installedAt: new Date().toISOString(),
|
|
105170
105307
|
files: trackedFiles
|
|
105171
105308
|
};
|
|
105172
|
-
const metadataPath =
|
|
105173
|
-
await
|
|
105309
|
+
const metadataPath = join115(claudeDir3, "metadata.json");
|
|
105310
|
+
await import_fs_extra19.writeFile(metadataPath, JSON.stringify(updatedMetadata, null, 2));
|
|
105174
105311
|
logger.success(`Migration complete: tracked ${trackedFiles.length} files`);
|
|
105175
105312
|
return true;
|
|
105176
105313
|
}
|
|
@@ -105274,31 +105411,31 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
|
|
|
105274
105411
|
// src/services/file-operations/file-scanner.ts
|
|
105275
105412
|
init_logger();
|
|
105276
105413
|
init_skip_directories();
|
|
105277
|
-
var
|
|
105278
|
-
import { join as
|
|
105414
|
+
var import_fs_extra20 = __toESM(require_lib(), 1);
|
|
105415
|
+
import { join as join116, relative as relative26, resolve as resolve43 } from "node:path";
|
|
105279
105416
|
|
|
105280
105417
|
class FileScanner2 {
|
|
105281
105418
|
static async getFiles(dirPath, relativeTo) {
|
|
105282
105419
|
const basePath = relativeTo || dirPath;
|
|
105283
105420
|
const files = [];
|
|
105284
|
-
if (!await
|
|
105421
|
+
if (!await import_fs_extra20.pathExists(dirPath)) {
|
|
105285
105422
|
return files;
|
|
105286
105423
|
}
|
|
105287
105424
|
try {
|
|
105288
|
-
const entries = await
|
|
105425
|
+
const entries = await import_fs_extra20.readdir(dirPath, { encoding: "utf8" });
|
|
105289
105426
|
for (const entry of entries) {
|
|
105290
105427
|
if (SKIP_DIRS_ALL.includes(entry)) {
|
|
105291
105428
|
logger.debug(`Skipping directory: ${entry}`);
|
|
105292
105429
|
continue;
|
|
105293
105430
|
}
|
|
105294
|
-
const fullPath =
|
|
105431
|
+
const fullPath = join116(dirPath, entry);
|
|
105295
105432
|
if (!FileScanner2.isSafePath(basePath, fullPath)) {
|
|
105296
105433
|
logger.warning(`Skipping potentially unsafe path: ${entry}`);
|
|
105297
105434
|
continue;
|
|
105298
105435
|
}
|
|
105299
105436
|
let stats;
|
|
105300
105437
|
try {
|
|
105301
|
-
stats = await
|
|
105438
|
+
stats = await import_fs_extra20.lstat(fullPath);
|
|
105302
105439
|
} catch (error) {
|
|
105303
105440
|
if (error instanceof Error && "code" in error && (error.code === "EACCES" || error.code === "EPERM")) {
|
|
105304
105441
|
logger.warning(`Skipping inaccessible path: ${entry}`);
|
|
@@ -105314,7 +105451,7 @@ class FileScanner2 {
|
|
|
105314
105451
|
const subFiles = await FileScanner2.getFiles(fullPath, basePath);
|
|
105315
105452
|
files.push(...subFiles);
|
|
105316
105453
|
} else if (stats.isFile()) {
|
|
105317
|
-
const relativePath =
|
|
105454
|
+
const relativePath = relative26(basePath, fullPath);
|
|
105318
105455
|
files.push(FileScanner2.toPosixPath(relativePath));
|
|
105319
105456
|
}
|
|
105320
105457
|
}
|
|
@@ -105326,8 +105463,8 @@ class FileScanner2 {
|
|
|
105326
105463
|
return files;
|
|
105327
105464
|
}
|
|
105328
105465
|
static async findCustomFiles(destDir, sourceDir, subPath) {
|
|
105329
|
-
const destSubDir =
|
|
105330
|
-
const sourceSubDir =
|
|
105466
|
+
const destSubDir = join116(destDir, subPath);
|
|
105467
|
+
const sourceSubDir = join116(sourceDir, subPath);
|
|
105331
105468
|
logger.debug(`findCustomFiles - destDir: ${destDir}`);
|
|
105332
105469
|
logger.debug(`findCustomFiles - sourceDir: ${sourceDir}`);
|
|
105333
105470
|
logger.debug(`findCustomFiles - subPath: "${subPath}"`);
|
|
@@ -105337,7 +105474,7 @@ class FileScanner2 {
|
|
|
105337
105474
|
const sourceFiles = await FileScanner2.getFiles(sourceSubDir, sourceDir);
|
|
105338
105475
|
logger.debug(`findCustomFiles - destFiles count: ${destFiles.length}`);
|
|
105339
105476
|
logger.debug(`findCustomFiles - sourceFiles count: ${sourceFiles.length}`);
|
|
105340
|
-
const sourceExists = await
|
|
105477
|
+
const sourceExists = await import_fs_extra20.pathExists(sourceSubDir);
|
|
105341
105478
|
if (sourceExists && sourceFiles.length === 0 && destFiles.length > 100) {
|
|
105342
105479
|
logger.warning(`Source directory exists but is empty while destination has ${destFiles.length} files. This may indicate an extraction issue. Skipping custom file detection.`);
|
|
105343
105480
|
return [];
|
|
@@ -105366,14 +105503,14 @@ class FileScanner2 {
|
|
|
105366
105503
|
|
|
105367
105504
|
// src/services/transformers/commands-prefix/prefix-applier.ts
|
|
105368
105505
|
init_logger();
|
|
105369
|
-
var
|
|
105506
|
+
var import_fs_extra21 = __toESM(require_lib(), 1);
|
|
105370
105507
|
import { lstat as lstat10, mkdir as mkdir32, readdir as readdir31, stat as stat20 } from "node:fs/promises";
|
|
105371
|
-
import { join as
|
|
105508
|
+
import { join as join118 } from "node:path";
|
|
105372
105509
|
|
|
105373
105510
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
105374
105511
|
init_logger();
|
|
105375
105512
|
import { readFile as readFile54, readdir as readdir30, writeFile as writeFile29 } from "node:fs/promises";
|
|
105376
|
-
import { join as
|
|
105513
|
+
import { join as join117 } from "node:path";
|
|
105377
105514
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
105378
105515
|
".md",
|
|
105379
105516
|
".txt",
|
|
@@ -105433,7 +105570,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
105433
105570
|
async function processDirectory(dir) {
|
|
105434
105571
|
const entries = await readdir30(dir, { withFileTypes: true });
|
|
105435
105572
|
for (const entry of entries) {
|
|
105436
|
-
const fullPath =
|
|
105573
|
+
const fullPath = join117(dir, entry.name);
|
|
105437
105574
|
if (entry.isDirectory()) {
|
|
105438
105575
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
105439
105576
|
continue;
|
|
@@ -105508,14 +105645,14 @@ function shouldApplyPrefix(options2) {
|
|
|
105508
105645
|
// src/services/transformers/commands-prefix/prefix-applier.ts
|
|
105509
105646
|
async function applyPrefix(extractDir) {
|
|
105510
105647
|
validatePath(extractDir, "extractDir");
|
|
105511
|
-
const commandsDir =
|
|
105512
|
-
if (!await
|
|
105648
|
+
const commandsDir = join118(extractDir, ".claude", "commands");
|
|
105649
|
+
if (!await import_fs_extra21.pathExists(commandsDir)) {
|
|
105513
105650
|
logger.verbose("No commands directory found, skipping prefix application");
|
|
105514
105651
|
return;
|
|
105515
105652
|
}
|
|
105516
105653
|
logger.info("Applying /ck: prefix to slash commands...");
|
|
105517
|
-
const backupDir =
|
|
105518
|
-
const tempDir =
|
|
105654
|
+
const backupDir = join118(extractDir, ".commands-backup");
|
|
105655
|
+
const tempDir = join118(extractDir, ".commands-prefix-temp");
|
|
105519
105656
|
try {
|
|
105520
105657
|
const entries = await readdir31(commandsDir);
|
|
105521
105658
|
if (entries.length === 0) {
|
|
@@ -105523,28 +105660,28 @@ async function applyPrefix(extractDir) {
|
|
|
105523
105660
|
return;
|
|
105524
105661
|
}
|
|
105525
105662
|
if (entries.length === 1 && entries[0] === "ck") {
|
|
105526
|
-
const ckDir2 =
|
|
105663
|
+
const ckDir2 = join118(commandsDir, "ck");
|
|
105527
105664
|
const ckStat = await stat20(ckDir2);
|
|
105528
105665
|
if (ckStat.isDirectory()) {
|
|
105529
105666
|
logger.verbose("Commands already have /ck: prefix, skipping");
|
|
105530
105667
|
return;
|
|
105531
105668
|
}
|
|
105532
105669
|
}
|
|
105533
|
-
await
|
|
105670
|
+
await import_fs_extra21.copy(commandsDir, backupDir);
|
|
105534
105671
|
logger.verbose("Created backup of commands directory");
|
|
105535
105672
|
await mkdir32(tempDir, { recursive: true });
|
|
105536
|
-
const ckDir =
|
|
105673
|
+
const ckDir = join118(tempDir, "ck");
|
|
105537
105674
|
await mkdir32(ckDir, { recursive: true });
|
|
105538
105675
|
let processedCount = 0;
|
|
105539
105676
|
for (const entry of entries) {
|
|
105540
|
-
const sourcePath =
|
|
105677
|
+
const sourcePath = join118(commandsDir, entry);
|
|
105541
105678
|
const stats = await lstat10(sourcePath);
|
|
105542
105679
|
if (stats.isSymbolicLink()) {
|
|
105543
105680
|
logger.warning(`Skipping symlink for security: ${entry}`);
|
|
105544
105681
|
continue;
|
|
105545
105682
|
}
|
|
105546
|
-
const destPath =
|
|
105547
|
-
await
|
|
105683
|
+
const destPath = join118(ckDir, entry);
|
|
105684
|
+
await import_fs_extra21.copy(sourcePath, destPath, {
|
|
105548
105685
|
overwrite: false,
|
|
105549
105686
|
errorOnExist: true
|
|
105550
105687
|
});
|
|
@@ -105553,15 +105690,15 @@ async function applyPrefix(extractDir) {
|
|
|
105553
105690
|
}
|
|
105554
105691
|
if (processedCount === 0) {
|
|
105555
105692
|
logger.warning("No files to move (all were symlinks or invalid)");
|
|
105556
|
-
await
|
|
105557
|
-
await
|
|
105693
|
+
await import_fs_extra21.remove(backupDir);
|
|
105694
|
+
await import_fs_extra21.remove(tempDir);
|
|
105558
105695
|
return;
|
|
105559
105696
|
}
|
|
105560
|
-
await
|
|
105561
|
-
await
|
|
105562
|
-
await
|
|
105697
|
+
await import_fs_extra21.remove(commandsDir);
|
|
105698
|
+
await import_fs_extra21.move(tempDir, commandsDir);
|
|
105699
|
+
await import_fs_extra21.remove(backupDir);
|
|
105563
105700
|
logger.success("Successfully reorganized commands to /ck: prefix");
|
|
105564
|
-
const claudeDir3 =
|
|
105701
|
+
const claudeDir3 = join118(extractDir, ".claude");
|
|
105565
105702
|
logger.info("Transforming command references in file contents...");
|
|
105566
105703
|
const transformResult = await transformCommandReferences(claudeDir3, {
|
|
105567
105704
|
verbose: logger.isVerbose()
|
|
@@ -105572,26 +105709,26 @@ async function applyPrefix(extractDir) {
|
|
|
105572
105709
|
logger.verbose("No command references needed transformation");
|
|
105573
105710
|
}
|
|
105574
105711
|
} catch (error) {
|
|
105575
|
-
if (await
|
|
105712
|
+
if (await import_fs_extra21.pathExists(backupDir)) {
|
|
105576
105713
|
try {
|
|
105577
|
-
await
|
|
105578
|
-
await
|
|
105714
|
+
await import_fs_extra21.remove(commandsDir).catch(() => {});
|
|
105715
|
+
await import_fs_extra21.move(backupDir, commandsDir);
|
|
105579
105716
|
logger.info("Restored original commands directory from backup");
|
|
105580
105717
|
} catch (rollbackError) {
|
|
105581
105718
|
logger.error(`Rollback failed: ${rollbackError}`);
|
|
105582
105719
|
}
|
|
105583
105720
|
}
|
|
105584
|
-
if (await
|
|
105585
|
-
await
|
|
105721
|
+
if (await import_fs_extra21.pathExists(tempDir)) {
|
|
105722
|
+
await import_fs_extra21.remove(tempDir).catch(() => {});
|
|
105586
105723
|
}
|
|
105587
105724
|
logger.error("Failed to apply /ck: prefix to commands");
|
|
105588
105725
|
throw error;
|
|
105589
105726
|
} finally {
|
|
105590
|
-
if (await
|
|
105591
|
-
await
|
|
105727
|
+
if (await import_fs_extra21.pathExists(backupDir)) {
|
|
105728
|
+
await import_fs_extra21.remove(backupDir).catch(() => {});
|
|
105592
105729
|
}
|
|
105593
|
-
if (await
|
|
105594
|
-
await
|
|
105730
|
+
if (await import_fs_extra21.pathExists(tempDir)) {
|
|
105731
|
+
await import_fs_extra21.remove(tempDir).catch(() => {});
|
|
105595
105732
|
}
|
|
105596
105733
|
}
|
|
105597
105734
|
}
|
|
@@ -105599,20 +105736,20 @@ async function applyPrefix(extractDir) {
|
|
|
105599
105736
|
// src/services/transformers/commands-prefix/prefix-cleaner.ts
|
|
105600
105737
|
init_metadata_migration();
|
|
105601
105738
|
import { lstat as lstat12, readdir as readdir33 } from "node:fs/promises";
|
|
105602
|
-
import { join as
|
|
105739
|
+
import { join as join120 } from "node:path";
|
|
105603
105740
|
init_logger();
|
|
105604
|
-
var
|
|
105741
|
+
var import_fs_extra23 = __toESM(require_lib(), 1);
|
|
105605
105742
|
|
|
105606
105743
|
// src/services/transformers/commands-prefix/file-processor.ts
|
|
105607
105744
|
import { lstat as lstat11, readdir as readdir32 } from "node:fs/promises";
|
|
105608
|
-
import { join as
|
|
105745
|
+
import { join as join119 } from "node:path";
|
|
105609
105746
|
init_logger();
|
|
105610
|
-
var
|
|
105747
|
+
var import_fs_extra22 = __toESM(require_lib(), 1);
|
|
105611
105748
|
async function scanDirectoryFiles(dir) {
|
|
105612
105749
|
const files = [];
|
|
105613
105750
|
const entries = await readdir32(dir);
|
|
105614
105751
|
for (const entry of entries) {
|
|
105615
|
-
const fullPath =
|
|
105752
|
+
const fullPath = join119(dir, entry);
|
|
105616
105753
|
const stats = await lstat11(fullPath);
|
|
105617
105754
|
if (stats.isSymbolicLink()) {
|
|
105618
105755
|
continue;
|
|
@@ -105635,7 +105772,7 @@ async function processFileOwnership(file, relativePath, metadata, claudeDir3, op
|
|
|
105635
105772
|
action: "delete"
|
|
105636
105773
|
});
|
|
105637
105774
|
if (!dryRun) {
|
|
105638
|
-
await
|
|
105775
|
+
await import_fs_extra22.remove(file);
|
|
105639
105776
|
logger.verbose(`Deleted CK file: ${relativePath}`);
|
|
105640
105777
|
}
|
|
105641
105778
|
accumulator.deletedCount++;
|
|
@@ -105650,7 +105787,7 @@ async function processFileOwnership(file, relativePath, metadata, claudeDir3, op
|
|
|
105650
105787
|
reason: "force overwrite"
|
|
105651
105788
|
});
|
|
105652
105789
|
if (!dryRun) {
|
|
105653
|
-
await
|
|
105790
|
+
await import_fs_extra22.remove(file);
|
|
105654
105791
|
logger.verbose(`Force-deleted modified file: ${relativePath}`);
|
|
105655
105792
|
}
|
|
105656
105793
|
accumulator.deletedCount++;
|
|
@@ -105674,7 +105811,7 @@ async function processFileOwnership(file, relativePath, metadata, claudeDir3, op
|
|
|
105674
105811
|
reason: "force overwrite"
|
|
105675
105812
|
});
|
|
105676
105813
|
if (!dryRun) {
|
|
105677
|
-
await
|
|
105814
|
+
await import_fs_extra22.remove(file);
|
|
105678
105815
|
logger.verbose(`Force-deleted user file: ${relativePath}`);
|
|
105679
105816
|
}
|
|
105680
105817
|
accumulator.deletedCount++;
|
|
@@ -105740,8 +105877,8 @@ function isDifferentKitDirectory(dirName, currentKit) {
|
|
|
105740
105877
|
async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
105741
105878
|
const { dryRun = false } = options2;
|
|
105742
105879
|
validatePath(targetDir, "targetDir");
|
|
105743
|
-
const claudeDir3 = isGlobal ? targetDir :
|
|
105744
|
-
const commandsDir =
|
|
105880
|
+
const claudeDir3 = isGlobal ? targetDir : join120(targetDir, ".claude");
|
|
105881
|
+
const commandsDir = join120(claudeDir3, "commands");
|
|
105745
105882
|
const accumulator = {
|
|
105746
105883
|
results: [],
|
|
105747
105884
|
deletedCount: 0,
|
|
@@ -105753,7 +105890,7 @@ async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
|
105753
105890
|
preservedCount: 0,
|
|
105754
105891
|
wasDryRun: dryRun
|
|
105755
105892
|
};
|
|
105756
|
-
if (!await
|
|
105893
|
+
if (!await import_fs_extra23.pathExists(commandsDir)) {
|
|
105757
105894
|
logger.verbose(`Commands directory does not exist: ${commandsDir}`);
|
|
105758
105895
|
return result;
|
|
105759
105896
|
}
|
|
@@ -105783,7 +105920,7 @@ async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
|
105783
105920
|
}
|
|
105784
105921
|
const metadataForChecks = options2.kitType ? createKitSpecificMetadata(metadata, options2.kitType) : metadata;
|
|
105785
105922
|
for (const entry of entries) {
|
|
105786
|
-
const entryPath =
|
|
105923
|
+
const entryPath = join120(commandsDir, entry);
|
|
105787
105924
|
const stats = await lstat12(entryPath);
|
|
105788
105925
|
if (stats.isSymbolicLink()) {
|
|
105789
105926
|
addSymlinkSkip(entry, accumulator);
|
|
@@ -105816,7 +105953,7 @@ async function processDirectory(entryPath, entry, claudeDir3, metadata, options2
|
|
|
105816
105953
|
}
|
|
105817
105954
|
}
|
|
105818
105955
|
if (canDeleteDir && !dryRun) {
|
|
105819
|
-
await
|
|
105956
|
+
await import_fs_extra23.remove(entryPath);
|
|
105820
105957
|
logger.verbose(`Removed directory: ${entry}`);
|
|
105821
105958
|
}
|
|
105822
105959
|
}
|
|
@@ -105831,7 +105968,7 @@ class CommandsPrefix {
|
|
|
105831
105968
|
// src/commands/init/phases/merge-handler.ts
|
|
105832
105969
|
init_logger();
|
|
105833
105970
|
init_output_manager();
|
|
105834
|
-
var
|
|
105971
|
+
var import_fs_extra24 = __toESM(require_lib(), 1);
|
|
105835
105972
|
async function handleMerge(ctx) {
|
|
105836
105973
|
if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir || !ctx.claudeDir || !ctx.kit || !ctx.kitType) {
|
|
105837
105974
|
return ctx;
|
|
@@ -105840,7 +105977,7 @@ async function handleMerge(ctx) {
|
|
|
105840
105977
|
let customClaudeFiles = [];
|
|
105841
105978
|
if (!ctx.options.fresh) {
|
|
105842
105979
|
logger.info("Scanning for custom .claude files...");
|
|
105843
|
-
const scanSourceDir = ctx.options.global ?
|
|
105980
|
+
const scanSourceDir = ctx.options.global ? join121(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
105844
105981
|
const scanTargetSubdir = ctx.options.global ? "" : ".claude";
|
|
105845
105982
|
customClaudeFiles = await FileScanner2.findCustomFiles(ctx.resolvedDir, scanSourceDir, scanTargetSubdir);
|
|
105846
105983
|
} else {
|
|
@@ -105875,10 +106012,11 @@ async function handleMerge(ctx) {
|
|
|
105875
106012
|
}
|
|
105876
106013
|
merger.setGlobalFlag(ctx.options.global);
|
|
105877
106014
|
merger.setForceOverwriteSettings(ctx.options.forceOverwriteSettings);
|
|
106015
|
+
merger.setPreserveDeletedSkills(!ctx.options.forceOverwrite && !ctx.options.fresh);
|
|
105878
106016
|
merger.setRestoreCkHooks(ctx.options.restoreCkHooks);
|
|
105879
106017
|
merger.setProjectDir(ctx.resolvedDir);
|
|
105880
106018
|
merger.setKitName(ctx.kit.name);
|
|
105881
|
-
merger.setZombiePrunerHookDir(
|
|
106019
|
+
merger.setZombiePrunerHookDir(join121(ctx.claudeDir, "hooks"));
|
|
105882
106020
|
if (ctx.kitType) {
|
|
105883
106021
|
merger.setMultiKitContext(ctx.claudeDir, ctx.kitType);
|
|
105884
106022
|
}
|
|
@@ -105886,7 +106024,7 @@ async function handleMerge(ctx) {
|
|
|
105886
106024
|
if (releaseManifest) {
|
|
105887
106025
|
merger.setManifest(releaseManifest);
|
|
105888
106026
|
}
|
|
105889
|
-
if (!ctx.options.fresh && await
|
|
106027
|
+
if (!ctx.options.fresh && await import_fs_extra24.pathExists(ctx.claudeDir)) {
|
|
105890
106028
|
const legacyDetection = await LegacyMigration.detectLegacy(ctx.claudeDir);
|
|
105891
106029
|
if (legacyDetection.isLegacy && releaseManifest) {
|
|
105892
106030
|
logger.info("Legacy installation detected - migrating to ownership tracking...");
|
|
@@ -105907,12 +106045,12 @@ async function handleMerge(ctx) {
|
|
|
105907
106045
|
return { ...ctx, cancelled: true };
|
|
105908
106046
|
}
|
|
105909
106047
|
}
|
|
105910
|
-
const sourceDir = ctx.options.global ?
|
|
105911
|
-
const sourceMetadataPath = ctx.options.global ?
|
|
106048
|
+
const sourceDir = ctx.options.global ? join121(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
106049
|
+
const sourceMetadataPath = ctx.options.global ? join121(sourceDir, "metadata.json") : join121(sourceDir, ".claude", "metadata.json");
|
|
105912
106050
|
let sourceMetadata = null;
|
|
105913
106051
|
try {
|
|
105914
|
-
if (await
|
|
105915
|
-
const metadataContent = await
|
|
106052
|
+
if (await import_fs_extra24.pathExists(sourceMetadataPath)) {
|
|
106053
|
+
const metadataContent = await import_fs_extra24.readFile(sourceMetadataPath, "utf-8");
|
|
105916
106054
|
sourceMetadata = JSON.parse(metadataContent);
|
|
105917
106055
|
}
|
|
105918
106056
|
} catch (error) {
|
|
@@ -105956,7 +106094,8 @@ async function handleMerge(ctx) {
|
|
|
105956
106094
|
kitName: ctx.kit.name,
|
|
105957
106095
|
releaseTag: installedVersion,
|
|
105958
106096
|
mode: ctx.options.global ? "global" : "local",
|
|
105959
|
-
kitType: ctx.kitType
|
|
106097
|
+
kitType: ctx.kitType,
|
|
106098
|
+
ignoredSkills: merger.getIgnoredSkillDirectories()
|
|
105960
106099
|
});
|
|
105961
106100
|
return {
|
|
105962
106101
|
...ctx,
|
|
@@ -105965,11 +106104,11 @@ async function handleMerge(ctx) {
|
|
|
105965
106104
|
};
|
|
105966
106105
|
}
|
|
105967
106106
|
// src/commands/init/phases/migration-handler.ts
|
|
105968
|
-
import { join as
|
|
106107
|
+
import { join as join129 } from "node:path";
|
|
105969
106108
|
|
|
105970
106109
|
// src/domains/skills/skills-detector.ts
|
|
105971
106110
|
init_logger();
|
|
105972
|
-
var
|
|
106111
|
+
var import_fs_extra27 = __toESM(require_lib(), 1);
|
|
105973
106112
|
|
|
105974
106113
|
// src/domains/skills/detection/config-detector.ts
|
|
105975
106114
|
init_logger();
|
|
@@ -105978,17 +106117,17 @@ init_logger();
|
|
|
105978
106117
|
init_logger();
|
|
105979
106118
|
init_skip_directories();
|
|
105980
106119
|
init_types3();
|
|
105981
|
-
var
|
|
106120
|
+
var import_fs_extra25 = __toESM(require_lib(), 1);
|
|
105982
106121
|
import { createHash as createHash7 } from "node:crypto";
|
|
105983
106122
|
import { readFile as readFile56, readdir as readdir34, writeFile as writeFile30 } from "node:fs/promises";
|
|
105984
|
-
import { join as
|
|
106123
|
+
import { join as join122, relative as relative27 } from "node:path";
|
|
105985
106124
|
|
|
105986
106125
|
class SkillsManifestManager {
|
|
105987
106126
|
static MANIFEST_FILENAME = ".skills-manifest.json";
|
|
105988
106127
|
static MANIFEST_VERSION = "1.0.0";
|
|
105989
106128
|
static async generateManifest(skillsDir2) {
|
|
105990
106129
|
logger.debug(`Generating manifest for: ${skillsDir2}`);
|
|
105991
|
-
if (!await
|
|
106130
|
+
if (!await import_fs_extra25.pathExists(skillsDir2)) {
|
|
105992
106131
|
throw new SkillsMigrationError(`Skills directory does not exist: ${skillsDir2}`);
|
|
105993
106132
|
}
|
|
105994
106133
|
const structure = await SkillsManifestManager.detectStructure(skillsDir2);
|
|
@@ -106003,13 +106142,13 @@ class SkillsManifestManager {
|
|
|
106003
106142
|
return manifest;
|
|
106004
106143
|
}
|
|
106005
106144
|
static async writeManifest(skillsDir2, manifest) {
|
|
106006
|
-
const manifestPath =
|
|
106145
|
+
const manifestPath = join122(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
106007
106146
|
await writeFile30(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
106008
106147
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
106009
106148
|
}
|
|
106010
106149
|
static async readManifest(skillsDir2) {
|
|
106011
|
-
const manifestPath =
|
|
106012
|
-
if (!await
|
|
106150
|
+
const manifestPath = join122(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
106151
|
+
if (!await import_fs_extra25.pathExists(manifestPath)) {
|
|
106013
106152
|
logger.debug(`No manifest found at: ${manifestPath}`);
|
|
106014
106153
|
return null;
|
|
106015
106154
|
}
|
|
@@ -106031,7 +106170,7 @@ class SkillsManifestManager {
|
|
|
106031
106170
|
return "flat";
|
|
106032
106171
|
}
|
|
106033
106172
|
for (const dir of dirs.slice(0, 3)) {
|
|
106034
|
-
const dirPath =
|
|
106173
|
+
const dirPath = join122(skillsDir2, dir.name);
|
|
106035
106174
|
const subEntries = await readdir34(dirPath, { withFileTypes: true });
|
|
106036
106175
|
const hasSubdirs = subEntries.some((entry) => entry.isDirectory());
|
|
106037
106176
|
if (hasSubdirs) {
|
|
@@ -106050,7 +106189,7 @@ class SkillsManifestManager {
|
|
|
106050
106189
|
const entries = await readdir34(skillsDir2, { withFileTypes: true });
|
|
106051
106190
|
for (const entry of entries) {
|
|
106052
106191
|
if (entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith(".")) {
|
|
106053
|
-
const skillPath =
|
|
106192
|
+
const skillPath = join122(skillsDir2, entry.name);
|
|
106054
106193
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
106055
106194
|
skills.push({
|
|
106056
106195
|
name: entry.name,
|
|
@@ -106062,11 +106201,11 @@ class SkillsManifestManager {
|
|
|
106062
106201
|
const categories = await readdir34(skillsDir2, { withFileTypes: true });
|
|
106063
106202
|
for (const category of categories) {
|
|
106064
106203
|
if (category.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(category.name) && !category.name.startsWith(".")) {
|
|
106065
|
-
const categoryPath =
|
|
106204
|
+
const categoryPath = join122(skillsDir2, category.name);
|
|
106066
106205
|
const skillEntries = await readdir34(categoryPath, { withFileTypes: true });
|
|
106067
106206
|
for (const skillEntry of skillEntries) {
|
|
106068
106207
|
if (skillEntry.isDirectory() && !skillEntry.name.startsWith(".")) {
|
|
106069
|
-
const skillPath =
|
|
106208
|
+
const skillPath = join122(categoryPath, skillEntry.name);
|
|
106070
106209
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
106071
106210
|
skills.push({
|
|
106072
106211
|
name: skillEntry.name,
|
|
@@ -106085,7 +106224,7 @@ class SkillsManifestManager {
|
|
|
106085
106224
|
const files = await SkillsManifestManager.getAllFiles(dirPath);
|
|
106086
106225
|
files.sort();
|
|
106087
106226
|
for (const file of files) {
|
|
106088
|
-
const relativePath =
|
|
106227
|
+
const relativePath = relative27(dirPath, file);
|
|
106089
106228
|
const content = await readFile56(file);
|
|
106090
106229
|
hash.update(relativePath);
|
|
106091
106230
|
hash.update(content);
|
|
@@ -106096,7 +106235,7 @@ class SkillsManifestManager {
|
|
|
106096
106235
|
const files = [];
|
|
106097
106236
|
const entries = await readdir34(dirPath, { withFileTypes: true });
|
|
106098
106237
|
for (const entry of entries) {
|
|
106099
|
-
const fullPath =
|
|
106238
|
+
const fullPath = join122(dirPath, entry.name);
|
|
106100
106239
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name)) {
|
|
106101
106240
|
continue;
|
|
106102
106241
|
}
|
|
@@ -106216,11 +106355,11 @@ function getPathMapping(skillName, oldBasePath, newBasePath) {
|
|
|
106216
106355
|
}
|
|
106217
106356
|
|
|
106218
106357
|
// src/domains/skills/detection/script-detector.ts
|
|
106219
|
-
var
|
|
106358
|
+
var import_fs_extra26 = __toESM(require_lib(), 1);
|
|
106220
106359
|
import { readdir as readdir35 } from "node:fs/promises";
|
|
106221
|
-
import { join as
|
|
106360
|
+
import { join as join123 } from "node:path";
|
|
106222
106361
|
async function scanDirectory(skillsDir2) {
|
|
106223
|
-
if (!await
|
|
106362
|
+
if (!await import_fs_extra26.pathExists(skillsDir2)) {
|
|
106224
106363
|
return ["flat", []];
|
|
106225
106364
|
}
|
|
106226
106365
|
const entries = await readdir35(skillsDir2, { withFileTypes: true });
|
|
@@ -106231,12 +106370,12 @@ async function scanDirectory(skillsDir2) {
|
|
|
106231
106370
|
let totalSkillLikeCount = 0;
|
|
106232
106371
|
const allSkills = [];
|
|
106233
106372
|
for (const dir of dirs) {
|
|
106234
|
-
const dirPath =
|
|
106373
|
+
const dirPath = join123(skillsDir2, dir.name);
|
|
106235
106374
|
const subEntries = await readdir35(dirPath, { withFileTypes: true });
|
|
106236
106375
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
106237
106376
|
if (subdirs.length > 0) {
|
|
106238
106377
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
106239
|
-
const subdirPath =
|
|
106378
|
+
const subdirPath = join123(dirPath, subdir.name);
|
|
106240
106379
|
const subdirFiles = await readdir35(subdirPath, { withFileTypes: true });
|
|
106241
106380
|
const hasSkillMarker = subdirFiles.some((file) => file.isFile() && (file.name === "skill.md" || file.name === "README.md" || file.name === "readme.md" || file.name === "config.json" || file.name === "package.json"));
|
|
106242
106381
|
if (hasSkillMarker) {
|
|
@@ -106358,8 +106497,8 @@ async function detectViaManifest(oldSkillsDir, currentSkillsDir) {
|
|
|
106358
106497
|
class SkillsMigrationDetector {
|
|
106359
106498
|
static async detectMigration(oldSkillsDir, currentSkillsDir) {
|
|
106360
106499
|
logger.debug("Detecting skills migration need...");
|
|
106361
|
-
const oldExists = await
|
|
106362
|
-
const currentExists = await
|
|
106500
|
+
const oldExists = await import_fs_extra27.pathExists(oldSkillsDir);
|
|
106501
|
+
const currentExists = await import_fs_extra27.pathExists(currentSkillsDir);
|
|
106363
106502
|
if (!oldExists && !currentExists) {
|
|
106364
106503
|
logger.debug("No skills directories found, migration not needed");
|
|
106365
106504
|
return {
|
|
@@ -106393,13 +106532,13 @@ class SkillsMigrationDetector {
|
|
|
106393
106532
|
// src/domains/skills/skills-migrator.ts
|
|
106394
106533
|
init_logger();
|
|
106395
106534
|
init_types3();
|
|
106396
|
-
import { join as
|
|
106535
|
+
import { join as join128 } from "node:path";
|
|
106397
106536
|
|
|
106398
106537
|
// src/domains/skills/migrator/migration-executor.ts
|
|
106399
106538
|
init_logger();
|
|
106400
106539
|
import { copyFile as copyFile6, mkdir as mkdir33, readdir as readdir36, rm as rm13 } from "node:fs/promises";
|
|
106401
|
-
import { join as
|
|
106402
|
-
var
|
|
106540
|
+
import { join as join124 } from "node:path";
|
|
106541
|
+
var import_fs_extra28 = __toESM(require_lib(), 1);
|
|
106403
106542
|
|
|
106404
106543
|
// src/domains/skills/skills-migration-prompts.ts
|
|
106405
106544
|
init_environment();
|
|
@@ -106563,8 +106702,8 @@ async function copySkillDirectory(sourceDir, destDir) {
|
|
|
106563
106702
|
await mkdir33(destDir, { recursive: true });
|
|
106564
106703
|
const entries = await readdir36(sourceDir, { withFileTypes: true });
|
|
106565
106704
|
for (const entry of entries) {
|
|
106566
|
-
const sourcePath =
|
|
106567
|
-
const destPath =
|
|
106705
|
+
const sourcePath = join124(sourceDir, entry.name);
|
|
106706
|
+
const destPath = join124(destDir, entry.name);
|
|
106568
106707
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
106569
106708
|
continue;
|
|
106570
106709
|
}
|
|
@@ -106579,14 +106718,14 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
106579
106718
|
const migrated = [];
|
|
106580
106719
|
const preserved = [];
|
|
106581
106720
|
const errors2 = [];
|
|
106582
|
-
const tempDir =
|
|
106721
|
+
const tempDir = join124(currentSkillsDir, "..", ".skills-migration-temp");
|
|
106583
106722
|
await mkdir33(tempDir, { recursive: true });
|
|
106584
106723
|
try {
|
|
106585
106724
|
for (const mapping of mappings) {
|
|
106586
106725
|
try {
|
|
106587
106726
|
const skillName = mapping.skillName;
|
|
106588
106727
|
const currentSkillPath = mapping.oldPath;
|
|
106589
|
-
if (!await
|
|
106728
|
+
if (!await import_fs_extra28.pathExists(currentSkillPath)) {
|
|
106590
106729
|
logger.warning(`Skill not found, skipping: ${skillName}`);
|
|
106591
106730
|
continue;
|
|
106592
106731
|
}
|
|
@@ -106600,9 +106739,9 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
106600
106739
|
}
|
|
106601
106740
|
}
|
|
106602
106741
|
const category = mapping.category;
|
|
106603
|
-
const targetPath = category ?
|
|
106742
|
+
const targetPath = category ? join124(tempDir, category, skillName) : join124(tempDir, skillName);
|
|
106604
106743
|
if (category) {
|
|
106605
|
-
await mkdir33(
|
|
106744
|
+
await mkdir33(join124(tempDir, category), { recursive: true });
|
|
106606
106745
|
}
|
|
106607
106746
|
await copySkillDirectory(currentSkillPath, targetPath);
|
|
106608
106747
|
migrated.push(skillName);
|
|
@@ -106667,9 +106806,9 @@ function validateMigrationPath(path17, paramName) {
|
|
|
106667
106806
|
// src/domains/skills/skills-backup-manager.ts
|
|
106668
106807
|
init_logger();
|
|
106669
106808
|
init_types3();
|
|
106670
|
-
var
|
|
106809
|
+
var import_fs_extra29 = __toESM(require_lib(), 1);
|
|
106671
106810
|
import { copyFile as copyFile7, mkdir as mkdir34, readdir as readdir37, rm as rm14, stat as stat21 } from "node:fs/promises";
|
|
106672
|
-
import { basename as basename27, join as
|
|
106811
|
+
import { basename as basename27, join as join125, normalize as normalize9 } from "node:path";
|
|
106673
106812
|
function validatePath2(path17, paramName) {
|
|
106674
106813
|
if (!path17 || typeof path17 !== "string") {
|
|
106675
106814
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -106689,13 +106828,13 @@ class SkillsBackupManager {
|
|
|
106689
106828
|
if (parentDir) {
|
|
106690
106829
|
validatePath2(parentDir, "parentDir");
|
|
106691
106830
|
}
|
|
106692
|
-
if (!await
|
|
106831
|
+
if (!await import_fs_extra29.pathExists(skillsDir2)) {
|
|
106693
106832
|
throw new SkillsMigrationError(`Cannot create backup: Skills directory does not exist: ${skillsDir2}`);
|
|
106694
106833
|
}
|
|
106695
106834
|
const timestamp = Date.now();
|
|
106696
106835
|
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
|
106697
106836
|
const backupDirName = `${SkillsBackupManager.BACKUP_PREFIX}${timestamp}-${randomSuffix}`;
|
|
106698
|
-
const backupDir = parentDir ?
|
|
106837
|
+
const backupDir = parentDir ? join125(parentDir, backupDirName) : join125(skillsDir2, "..", backupDirName);
|
|
106699
106838
|
logger.info(`Creating backup at: ${backupDir}`);
|
|
106700
106839
|
try {
|
|
106701
106840
|
await mkdir34(backupDir, { recursive: true });
|
|
@@ -106712,12 +106851,12 @@ class SkillsBackupManager {
|
|
|
106712
106851
|
static async restoreBackup(backupDir, targetDir) {
|
|
106713
106852
|
validatePath2(backupDir, "backupDir");
|
|
106714
106853
|
validatePath2(targetDir, "targetDir");
|
|
106715
|
-
if (!await
|
|
106854
|
+
if (!await import_fs_extra29.pathExists(backupDir)) {
|
|
106716
106855
|
throw new SkillsMigrationError(`Cannot restore: Backup directory does not exist: ${backupDir}`);
|
|
106717
106856
|
}
|
|
106718
106857
|
logger.info(`Restoring from backup: ${backupDir}`);
|
|
106719
106858
|
try {
|
|
106720
|
-
if (await
|
|
106859
|
+
if (await import_fs_extra29.pathExists(targetDir)) {
|
|
106721
106860
|
await rm14(targetDir, { recursive: true, force: true });
|
|
106722
106861
|
}
|
|
106723
106862
|
await mkdir34(targetDir, { recursive: true });
|
|
@@ -106728,7 +106867,7 @@ class SkillsBackupManager {
|
|
|
106728
106867
|
}
|
|
106729
106868
|
}
|
|
106730
106869
|
static async deleteBackup(backupDir) {
|
|
106731
|
-
if (!await
|
|
106870
|
+
if (!await import_fs_extra29.pathExists(backupDir)) {
|
|
106732
106871
|
logger.warning(`Backup directory does not exist: ${backupDir}`);
|
|
106733
106872
|
return;
|
|
106734
106873
|
}
|
|
@@ -106741,12 +106880,12 @@ class SkillsBackupManager {
|
|
|
106741
106880
|
}
|
|
106742
106881
|
}
|
|
106743
106882
|
static async listBackups(parentDir) {
|
|
106744
|
-
if (!await
|
|
106883
|
+
if (!await import_fs_extra29.pathExists(parentDir)) {
|
|
106745
106884
|
return [];
|
|
106746
106885
|
}
|
|
106747
106886
|
try {
|
|
106748
106887
|
const entries = await readdir37(parentDir, { withFileTypes: true });
|
|
106749
|
-
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) =>
|
|
106888
|
+
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) => join125(parentDir, entry.name));
|
|
106750
106889
|
backups.sort().reverse();
|
|
106751
106890
|
return backups;
|
|
106752
106891
|
} catch (error) {
|
|
@@ -106766,7 +106905,7 @@ class SkillsBackupManager {
|
|
|
106766
106905
|
}
|
|
106767
106906
|
}
|
|
106768
106907
|
static async getBackupSize(backupDir) {
|
|
106769
|
-
if (!await
|
|
106908
|
+
if (!await import_fs_extra29.pathExists(backupDir)) {
|
|
106770
106909
|
return 0;
|
|
106771
106910
|
}
|
|
106772
106911
|
return await SkillsBackupManager.getDirectorySize(backupDir);
|
|
@@ -106774,8 +106913,8 @@ class SkillsBackupManager {
|
|
|
106774
106913
|
static async copyDirectory(sourceDir, destDir) {
|
|
106775
106914
|
const entries = await readdir37(sourceDir, { withFileTypes: true });
|
|
106776
106915
|
for (const entry of entries) {
|
|
106777
|
-
const sourcePath =
|
|
106778
|
-
const destPath =
|
|
106916
|
+
const sourcePath = join125(sourceDir, entry.name);
|
|
106917
|
+
const destPath = join125(destDir, entry.name);
|
|
106779
106918
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
106780
106919
|
continue;
|
|
106781
106920
|
}
|
|
@@ -106791,7 +106930,7 @@ class SkillsBackupManager {
|
|
|
106791
106930
|
let size = 0;
|
|
106792
106931
|
const entries = await readdir37(dirPath, { withFileTypes: true });
|
|
106793
106932
|
for (const entry of entries) {
|
|
106794
|
-
const fullPath =
|
|
106933
|
+
const fullPath = join125(dirPath, entry.name);
|
|
106795
106934
|
if (entry.isSymbolicLink()) {
|
|
106796
106935
|
continue;
|
|
106797
106936
|
}
|
|
@@ -106819,20 +106958,20 @@ class SkillsBackupManager {
|
|
|
106819
106958
|
init_logger();
|
|
106820
106959
|
|
|
106821
106960
|
// src/domains/skills/customization/comparison-engine.ts
|
|
106822
|
-
var
|
|
106823
|
-
import { relative as
|
|
106961
|
+
var import_fs_extra30 = __toESM(require_lib(), 1);
|
|
106962
|
+
import { relative as relative29 } from "node:path";
|
|
106824
106963
|
|
|
106825
106964
|
// src/domains/skills/customization/hash-calculator.ts
|
|
106826
106965
|
init_skip_directories();
|
|
106827
106966
|
import { createHash as createHash8 } from "node:crypto";
|
|
106828
106967
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
106829
106968
|
import { readFile as readFile57, readdir as readdir38 } from "node:fs/promises";
|
|
106830
|
-
import { join as
|
|
106969
|
+
import { join as join126, relative as relative28 } from "node:path";
|
|
106831
106970
|
async function getAllFiles(dirPath) {
|
|
106832
106971
|
const files = [];
|
|
106833
106972
|
const entries = await readdir38(dirPath, { withFileTypes: true });
|
|
106834
106973
|
for (const entry of entries) {
|
|
106835
|
-
const fullPath =
|
|
106974
|
+
const fullPath = join126(dirPath, entry.name);
|
|
106836
106975
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name) || entry.isSymbolicLink()) {
|
|
106837
106976
|
continue;
|
|
106838
106977
|
}
|
|
@@ -106864,7 +107003,7 @@ async function hashDirectory(dirPath) {
|
|
|
106864
107003
|
const files = await getAllFiles(dirPath);
|
|
106865
107004
|
files.sort();
|
|
106866
107005
|
for (const file of files) {
|
|
106867
|
-
const relativePath =
|
|
107006
|
+
const relativePath = relative28(dirPath, file);
|
|
106868
107007
|
const content = await readFile57(file);
|
|
106869
107008
|
hash.update(relativePath);
|
|
106870
107009
|
hash.update(content);
|
|
@@ -106898,8 +107037,8 @@ async function compareDirectories(dir1, dir2) {
|
|
|
106898
107037
|
if (files1.length !== files2.length) {
|
|
106899
107038
|
return true;
|
|
106900
107039
|
}
|
|
106901
|
-
const relFiles1 = files1.map((f3) =>
|
|
106902
|
-
const relFiles2 = files2.map((f3) =>
|
|
107040
|
+
const relFiles1 = files1.map((f3) => relative29(dir1, f3)).sort();
|
|
107041
|
+
const relFiles2 = files2.map((f3) => relative29(dir2, f3)).sort();
|
|
106903
107042
|
if (JSON.stringify(relFiles1) !== JSON.stringify(relFiles2)) {
|
|
106904
107043
|
return true;
|
|
106905
107044
|
}
|
|
@@ -106915,14 +107054,14 @@ async function compareDirectories(dir1, dir2) {
|
|
|
106915
107054
|
async function detectFileChanges(currentSkillPath, baselineSkillPath) {
|
|
106916
107055
|
const changes = [];
|
|
106917
107056
|
const currentFiles = await getAllFiles(currentSkillPath);
|
|
106918
|
-
const baselineFiles = await
|
|
107057
|
+
const baselineFiles = await import_fs_extra30.pathExists(baselineSkillPath) ? await getAllFiles(baselineSkillPath) : [];
|
|
106919
107058
|
const currentFileMap = new Map(await Promise.all(currentFiles.map(async (f3) => {
|
|
106920
|
-
const relPath =
|
|
107059
|
+
const relPath = relative29(currentSkillPath, f3);
|
|
106921
107060
|
const hash = await hashFile(f3);
|
|
106922
107061
|
return [relPath, hash];
|
|
106923
107062
|
})));
|
|
106924
107063
|
const baselineFileMap = new Map(await Promise.all(baselineFiles.map(async (f3) => {
|
|
106925
|
-
const relPath =
|
|
107064
|
+
const relPath = relative29(baselineSkillPath, f3);
|
|
106926
107065
|
const hash = await hashFile(f3);
|
|
106927
107066
|
return [relPath, hash];
|
|
106928
107067
|
})));
|
|
@@ -106957,9 +107096,9 @@ async function detectFileChanges(currentSkillPath, baselineSkillPath) {
|
|
|
106957
107096
|
|
|
106958
107097
|
// src/domains/skills/customization/scan-reporter.ts
|
|
106959
107098
|
init_types3();
|
|
106960
|
-
var
|
|
107099
|
+
var import_fs_extra31 = __toESM(require_lib(), 1);
|
|
106961
107100
|
import { readdir as readdir39 } from "node:fs/promises";
|
|
106962
|
-
import { join as
|
|
107101
|
+
import { join as join127, normalize as normalize10 } from "node:path";
|
|
106963
107102
|
function validatePath3(path17, paramName) {
|
|
106964
107103
|
if (!path17 || typeof path17 !== "string") {
|
|
106965
107104
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -106972,7 +107111,7 @@ function validatePath3(path17, paramName) {
|
|
|
106972
107111
|
}
|
|
106973
107112
|
}
|
|
106974
107113
|
async function scanSkillsDirectory(skillsDir2) {
|
|
106975
|
-
if (!await
|
|
107114
|
+
if (!await import_fs_extra31.pathExists(skillsDir2)) {
|
|
106976
107115
|
return ["flat", []];
|
|
106977
107116
|
}
|
|
106978
107117
|
const entries = await readdir39(skillsDir2, { withFileTypes: true });
|
|
@@ -106980,13 +107119,13 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
106980
107119
|
if (dirs.length === 0) {
|
|
106981
107120
|
return ["flat", []];
|
|
106982
107121
|
}
|
|
106983
|
-
const firstDirPath =
|
|
107122
|
+
const firstDirPath = join127(skillsDir2, dirs[0].name);
|
|
106984
107123
|
const subEntries = await readdir39(firstDirPath, { withFileTypes: true });
|
|
106985
107124
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
106986
107125
|
if (subdirs.length > 0) {
|
|
106987
107126
|
let skillLikeCount = 0;
|
|
106988
107127
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
106989
|
-
const subdirPath =
|
|
107128
|
+
const subdirPath = join127(firstDirPath, subdir.name);
|
|
106990
107129
|
const subdirFiles = await readdir39(subdirPath, { withFileTypes: true });
|
|
106991
107130
|
const hasSkillMarker = subdirFiles.some((file) => file.isFile() && (file.name === "skill.md" || file.name === "README.md" || file.name === "readme.md" || file.name === "config.json" || file.name === "package.json"));
|
|
106992
107131
|
if (hasSkillMarker) {
|
|
@@ -106996,7 +107135,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
106996
107135
|
if (skillLikeCount > 0) {
|
|
106997
107136
|
const skills = [];
|
|
106998
107137
|
for (const dir of dirs) {
|
|
106999
|
-
const categoryPath =
|
|
107138
|
+
const categoryPath = join127(skillsDir2, dir.name);
|
|
107000
107139
|
const skillDirs = await readdir39(categoryPath, { withFileTypes: true });
|
|
107001
107140
|
skills.push(...skillDirs.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name));
|
|
107002
107141
|
}
|
|
@@ -107006,8 +107145,8 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
107006
107145
|
return ["flat", dirs.map((dir) => dir.name)];
|
|
107007
107146
|
}
|
|
107008
107147
|
async function findSkillPath(skillsDir2, skillName) {
|
|
107009
|
-
const flatPath =
|
|
107010
|
-
if (await
|
|
107148
|
+
const flatPath = join127(skillsDir2, skillName);
|
|
107149
|
+
if (await import_fs_extra31.pathExists(flatPath)) {
|
|
107011
107150
|
return { path: flatPath, category: undefined };
|
|
107012
107151
|
}
|
|
107013
107152
|
const entries = await readdir39(skillsDir2, { withFileTypes: true });
|
|
@@ -107015,9 +107154,9 @@ async function findSkillPath(skillsDir2, skillName) {
|
|
|
107015
107154
|
if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
107016
107155
|
continue;
|
|
107017
107156
|
}
|
|
107018
|
-
const categoryPath =
|
|
107019
|
-
const skillPath =
|
|
107020
|
-
if (await
|
|
107157
|
+
const categoryPath = join127(skillsDir2, entry.name);
|
|
107158
|
+
const skillPath = join127(categoryPath, skillName);
|
|
107159
|
+
if (await import_fs_extra31.pathExists(skillPath)) {
|
|
107021
107160
|
return { path: skillPath, category: entry.name };
|
|
107022
107161
|
}
|
|
107023
107162
|
}
|
|
@@ -107110,7 +107249,7 @@ class SkillsMigrator {
|
|
|
107110
107249
|
}
|
|
107111
107250
|
}
|
|
107112
107251
|
if (options2.backup && !options2.dryRun) {
|
|
107113
|
-
const claudeDir3 =
|
|
107252
|
+
const claudeDir3 = join128(currentSkillsDir, "..");
|
|
107114
107253
|
result.backupPath = await SkillsBackupManager.createBackup(currentSkillsDir, claudeDir3);
|
|
107115
107254
|
logger.success(`Backup created at: ${result.backupPath}`);
|
|
107116
107255
|
}
|
|
@@ -107163,7 +107302,7 @@ class SkillsMigrator {
|
|
|
107163
107302
|
// src/commands/init/phases/migration-handler.ts
|
|
107164
107303
|
init_logger();
|
|
107165
107304
|
init_path_resolver();
|
|
107166
|
-
var
|
|
107305
|
+
var import_fs_extra32 = __toESM(require_lib(), 1);
|
|
107167
107306
|
async function handleMigration(ctx) {
|
|
107168
107307
|
if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir)
|
|
107169
107308
|
return ctx;
|
|
@@ -107171,9 +107310,9 @@ async function handleMigration(ctx) {
|
|
|
107171
107310
|
logger.debug("Skipping skills migration (fresh installation)");
|
|
107172
107311
|
return ctx;
|
|
107173
107312
|
}
|
|
107174
|
-
const newSkillsDir =
|
|
107313
|
+
const newSkillsDir = join129(ctx.extractDir, ".claude", "skills");
|
|
107175
107314
|
const currentSkillsDir = PathResolver.buildSkillsPath(ctx.resolvedDir, ctx.options.global);
|
|
107176
|
-
if (!await
|
|
107315
|
+
if (!await import_fs_extra32.pathExists(newSkillsDir) || !await import_fs_extra32.pathExists(currentSkillsDir)) {
|
|
107177
107316
|
return ctx;
|
|
107178
107317
|
}
|
|
107179
107318
|
logger.info("Checking for skills directory migration...");
|
|
@@ -107195,13 +107334,13 @@ async function handleMigration(ctx) {
|
|
|
107195
107334
|
}
|
|
107196
107335
|
// src/commands/init/phases/opencode-handler.ts
|
|
107197
107336
|
import { cp as cp4, readdir as readdir41, rm as rm15 } from "node:fs/promises";
|
|
107198
|
-
import { join as
|
|
107337
|
+
import { join as join131 } from "node:path";
|
|
107199
107338
|
|
|
107200
107339
|
// src/services/transformers/opencode-path-transformer.ts
|
|
107201
107340
|
init_logger();
|
|
107202
107341
|
import { readFile as readFile58, readdir as readdir40, writeFile as writeFile31 } from "node:fs/promises";
|
|
107203
107342
|
import { platform as platform14 } from "node:os";
|
|
107204
|
-
import { extname as extname6, join as
|
|
107343
|
+
import { extname as extname6, join as join130 } from "node:path";
|
|
107205
107344
|
var IS_WINDOWS2 = platform14() === "win32";
|
|
107206
107345
|
function getOpenCodeGlobalPath() {
|
|
107207
107346
|
return "$HOME/.config/opencode/";
|
|
@@ -107262,7 +107401,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
107262
107401
|
async function processDirectory2(dir) {
|
|
107263
107402
|
const entries = await readdir40(dir, { withFileTypes: true });
|
|
107264
107403
|
for (const entry of entries) {
|
|
107265
|
-
const fullPath =
|
|
107404
|
+
const fullPath = join130(dir, entry.name);
|
|
107266
107405
|
if (entry.isDirectory()) {
|
|
107267
107406
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
107268
107407
|
continue;
|
|
@@ -107296,13 +107435,13 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
107296
107435
|
// src/commands/init/phases/opencode-handler.ts
|
|
107297
107436
|
init_logger();
|
|
107298
107437
|
init_path_resolver();
|
|
107299
|
-
var
|
|
107438
|
+
var import_fs_extra33 = __toESM(require_lib(), 1);
|
|
107300
107439
|
async function handleOpenCode(ctx) {
|
|
107301
107440
|
if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir) {
|
|
107302
107441
|
return ctx;
|
|
107303
107442
|
}
|
|
107304
|
-
const openCodeSource =
|
|
107305
|
-
if (!await
|
|
107443
|
+
const openCodeSource = join131(ctx.extractDir, ".opencode");
|
|
107444
|
+
if (!await import_fs_extra33.pathExists(openCodeSource)) {
|
|
107306
107445
|
logger.debug("No .opencode directory in archive, skipping");
|
|
107307
107446
|
return ctx;
|
|
107308
107447
|
}
|
|
@@ -107316,12 +107455,12 @@ async function handleOpenCode(ctx) {
|
|
|
107316
107455
|
if (transformResult.totalChanges > 0) {
|
|
107317
107456
|
logger.success(`Transformed ${transformResult.totalChanges} OpenCode path(s) in ${transformResult.filesTransformed} file(s)`);
|
|
107318
107457
|
}
|
|
107319
|
-
await
|
|
107458
|
+
await import_fs_extra33.ensureDir(targetDir);
|
|
107320
107459
|
const entries = await readdir41(openCodeSource, { withFileTypes: true });
|
|
107321
107460
|
for (const entry of entries) {
|
|
107322
|
-
const sourcePath =
|
|
107323
|
-
const targetPath =
|
|
107324
|
-
if (await
|
|
107461
|
+
const sourcePath = join131(openCodeSource, entry.name);
|
|
107462
|
+
const targetPath = join131(targetDir, entry.name);
|
|
107463
|
+
if (await import_fs_extra33.pathExists(targetPath)) {
|
|
107325
107464
|
if (!ctx.options.forceOverwrite) {
|
|
107326
107465
|
logger.verbose(`Skipping existing: ${entry.name}`);
|
|
107327
107466
|
continue;
|
|
@@ -107419,20 +107558,20 @@ Please use only one download method.`);
|
|
|
107419
107558
|
}
|
|
107420
107559
|
// src/commands/init/phases/post-install-handler.ts
|
|
107421
107560
|
init_projects_registry();
|
|
107422
|
-
import { join as
|
|
107561
|
+
import { join as join132 } from "node:path";
|
|
107423
107562
|
init_logger();
|
|
107424
107563
|
init_path_resolver();
|
|
107425
|
-
var
|
|
107564
|
+
var import_fs_extra34 = __toESM(require_lib(), 1);
|
|
107426
107565
|
async function handlePostInstall(ctx) {
|
|
107427
107566
|
if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir || !ctx.claudeDir) {
|
|
107428
107567
|
return ctx;
|
|
107429
107568
|
}
|
|
107430
107569
|
if (ctx.options.global) {
|
|
107431
|
-
const claudeMdSource =
|
|
107432
|
-
const claudeMdDest =
|
|
107433
|
-
if (await
|
|
107434
|
-
if (ctx.options.fresh || !await
|
|
107435
|
-
await
|
|
107570
|
+
const claudeMdSource = join132(ctx.extractDir, "CLAUDE.md");
|
|
107571
|
+
const claudeMdDest = join132(ctx.resolvedDir, "CLAUDE.md");
|
|
107572
|
+
if (await import_fs_extra34.pathExists(claudeMdSource)) {
|
|
107573
|
+
if (ctx.options.fresh || !await import_fs_extra34.pathExists(claudeMdDest)) {
|
|
107574
|
+
await import_fs_extra34.copy(claudeMdSource, claudeMdDest);
|
|
107436
107575
|
logger.success(ctx.options.fresh ? "Replaced CLAUDE.md in global directory (fresh install)" : "Copied CLAUDE.md to global directory");
|
|
107437
107576
|
} else {
|
|
107438
107577
|
logger.debug("CLAUDE.md already exists in global directory (preserved)");
|
|
@@ -107477,7 +107616,7 @@ async function handlePostInstall(ctx) {
|
|
|
107477
107616
|
}
|
|
107478
107617
|
if (!ctx.options.skipSetup) {
|
|
107479
107618
|
await promptSetupWizardIfNeeded({
|
|
107480
|
-
envPath:
|
|
107619
|
+
envPath: join132(ctx.claudeDir, ".env"),
|
|
107481
107620
|
claudeDir: ctx.claudeDir,
|
|
107482
107621
|
isGlobal: ctx.options.global,
|
|
107483
107622
|
isNonInteractive: ctx.isNonInteractive,
|
|
@@ -107501,7 +107640,7 @@ async function handlePostInstall(ctx) {
|
|
|
107501
107640
|
init_config_manager();
|
|
107502
107641
|
init_github_client();
|
|
107503
107642
|
import { mkdir as mkdir36 } from "node:fs/promises";
|
|
107504
|
-
import { join as
|
|
107643
|
+
import { join as join135, resolve as resolve47 } from "node:path";
|
|
107505
107644
|
|
|
107506
107645
|
// src/domains/github/kit-access-checker.ts
|
|
107507
107646
|
init_error2();
|
|
@@ -107671,10 +107810,10 @@ async function runPreflightChecks() {
|
|
|
107671
107810
|
// src/domains/installation/fresh-installer.ts
|
|
107672
107811
|
init_metadata_migration();
|
|
107673
107812
|
import { existsSync as existsSync67, readdirSync as readdirSync10, rmSync as rmSync3, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
|
|
107674
|
-
import { basename as basename28, dirname as
|
|
107813
|
+
import { basename as basename28, dirname as dirname42, join as join133, resolve as resolve45 } from "node:path";
|
|
107675
107814
|
init_logger();
|
|
107676
107815
|
init_safe_spinner();
|
|
107677
|
-
var
|
|
107816
|
+
var import_fs_extra35 = __toESM(require_lib(), 1);
|
|
107678
107817
|
var KIT_MANIFEST_FILE = "metadata.json";
|
|
107679
107818
|
var CLAUDEKIT_SUBDIRECTORIES = ["commands", "agents", "skills", "rules", "hooks"];
|
|
107680
107819
|
async function analyzeFreshInstallation(claudeDir3) {
|
|
@@ -107724,14 +107863,14 @@ async function analyzeFreshInstallation(claudeDir3) {
|
|
|
107724
107863
|
}
|
|
107725
107864
|
function cleanupEmptyDirectories2(filePath, claudeDir3) {
|
|
107726
107865
|
const normalizedClaudeDir = resolve45(claudeDir3);
|
|
107727
|
-
let currentDir = resolve45(
|
|
107866
|
+
let currentDir = resolve45(dirname42(filePath));
|
|
107728
107867
|
while (currentDir !== normalizedClaudeDir && currentDir.startsWith(normalizedClaudeDir)) {
|
|
107729
107868
|
try {
|
|
107730
107869
|
const entries = readdirSync10(currentDir);
|
|
107731
107870
|
if (entries.length === 0) {
|
|
107732
107871
|
rmdirSync2(currentDir);
|
|
107733
107872
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
107734
|
-
currentDir = resolve45(
|
|
107873
|
+
currentDir = resolve45(dirname42(currentDir));
|
|
107735
107874
|
} else {
|
|
107736
107875
|
break;
|
|
107737
107876
|
}
|
|
@@ -107753,7 +107892,7 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
|
|
|
107753
107892
|
logger.debug(`${KIT_MANIFEST_FILE} was self-tracked; skipping from delete loop — will be rewritten by updateMetadataAfterFresh`);
|
|
107754
107893
|
}
|
|
107755
107894
|
for (const file of filesToRemove) {
|
|
107756
|
-
const fullPath =
|
|
107895
|
+
const fullPath = join133(claudeDir3, file.path);
|
|
107757
107896
|
if (!existsSync67(fullPath)) {
|
|
107758
107897
|
continue;
|
|
107759
107898
|
}
|
|
@@ -107781,7 +107920,7 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
|
|
|
107781
107920
|
};
|
|
107782
107921
|
}
|
|
107783
107922
|
async function updateMetadataAfterFresh(claudeDir3, removedFiles, metadata) {
|
|
107784
|
-
const metadataPath =
|
|
107923
|
+
const metadataPath = join133(claudeDir3, KIT_MANIFEST_FILE);
|
|
107785
107924
|
const removedSet = new Set(removedFiles);
|
|
107786
107925
|
if (metadata.kits) {
|
|
107787
107926
|
for (const kitName of Object.keys(metadata.kits)) {
|
|
@@ -107794,11 +107933,11 @@ async function updateMetadataAfterFresh(claudeDir3, removedFiles, metadata) {
|
|
|
107794
107933
|
if (metadata.files) {
|
|
107795
107934
|
metadata.files = metadata.files.filter((f3) => !removedSet.has(f3.path));
|
|
107796
107935
|
}
|
|
107797
|
-
if (!await
|
|
107936
|
+
if (!await import_fs_extra35.pathExists(metadataPath)) {
|
|
107798
107937
|
logger.warning(`${KIT_MANIFEST_FILE} was absent at write time (self-tracked or race condition) — recreating from in-memory snapshot`);
|
|
107799
107938
|
}
|
|
107800
107939
|
try {
|
|
107801
|
-
await
|
|
107940
|
+
await import_fs_extra35.writeFile(metadataPath, JSON.stringify(metadata, null, 2));
|
|
107802
107941
|
logger.debug(`Updated ${KIT_MANIFEST_FILE}, removed ${removedFiles.length} file entries`);
|
|
107803
107942
|
} catch (writeError) {
|
|
107804
107943
|
throw new Error(`Failed to write ${KIT_MANIFEST_FILE}: ${writeError instanceof Error ? writeError.message : String(writeError)}`);
|
|
@@ -107812,8 +107951,8 @@ function getFreshBackupTargets(claudeDir3, analysis, includeModified) {
|
|
|
107812
107951
|
mutatePaths: filesToRemove.length > 0 ? ["metadata.json"] : []
|
|
107813
107952
|
};
|
|
107814
107953
|
}
|
|
107815
|
-
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync67(
|
|
107816
|
-
if (existsSync67(
|
|
107954
|
+
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync67(join133(claudeDir3, subdir)));
|
|
107955
|
+
if (existsSync67(join133(claudeDir3, "metadata.json"))) {
|
|
107817
107956
|
deletePaths.push("metadata.json");
|
|
107818
107957
|
}
|
|
107819
107958
|
return {
|
|
@@ -107835,16 +107974,16 @@ async function removeSubdirectoriesFallback(claudeDir3) {
|
|
|
107835
107974
|
const removedFiles = [];
|
|
107836
107975
|
let removedDirCount = 0;
|
|
107837
107976
|
for (const subdir of CLAUDEKIT_SUBDIRECTORIES) {
|
|
107838
|
-
const subdirPath =
|
|
107839
|
-
if (await
|
|
107977
|
+
const subdirPath = join133(claudeDir3, subdir);
|
|
107978
|
+
if (await import_fs_extra35.pathExists(subdirPath)) {
|
|
107840
107979
|
rmSync3(subdirPath, { recursive: true, force: true });
|
|
107841
107980
|
removedDirCount++;
|
|
107842
107981
|
removedFiles.push(`${subdir}/ (entire directory)`);
|
|
107843
107982
|
logger.debug(`Removed subdirectory: ${subdir}/`);
|
|
107844
107983
|
}
|
|
107845
107984
|
}
|
|
107846
|
-
const metadataPath =
|
|
107847
|
-
if (await
|
|
107985
|
+
const metadataPath = join133(claudeDir3, "metadata.json");
|
|
107986
|
+
if (await import_fs_extra35.pathExists(metadataPath)) {
|
|
107848
107987
|
unlinkSync5(metadataPath);
|
|
107849
107988
|
removedFiles.push("metadata.json");
|
|
107850
107989
|
}
|
|
@@ -107857,7 +107996,7 @@ async function removeSubdirectoriesFallback(claudeDir3) {
|
|
|
107857
107996
|
};
|
|
107858
107997
|
}
|
|
107859
107998
|
async function handleFreshInstallation(claudeDir3, prompts) {
|
|
107860
|
-
if (!await
|
|
107999
|
+
if (!await import_fs_extra35.pathExists(claudeDir3)) {
|
|
107861
108000
|
logger.info(".claude directory does not exist, proceeding with fresh installation");
|
|
107862
108001
|
return true;
|
|
107863
108002
|
}
|
|
@@ -107918,10 +108057,10 @@ async function handleFreshInstallation(claudeDir3, prompts) {
|
|
|
107918
108057
|
}
|
|
107919
108058
|
|
|
107920
108059
|
// src/domains/installation/global-kit-legacy-repair.ts
|
|
107921
|
-
var
|
|
108060
|
+
var import_fs_extra36 = __toESM(require_lib(), 1);
|
|
107922
108061
|
import { cp as cp5, mkdir as mkdir35, readdir as readdir42, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
|
|
107923
108062
|
import { homedir as homedir46 } from "node:os";
|
|
107924
|
-
import { dirname as
|
|
108063
|
+
import { dirname as dirname43, join as join134, normalize as normalize11, resolve as resolve46 } from "node:path";
|
|
107925
108064
|
var LEGACY_KIT_MARKERS = [
|
|
107926
108065
|
"metadata.json",
|
|
107927
108066
|
".ck.json",
|
|
@@ -107960,10 +108099,10 @@ function getLegacyWindowsGlobalKitDirCandidates(env2 = process.env, homeDir = ho
|
|
|
107960
108099
|
const localAppData = safeEnvPath(env2.LOCALAPPDATA);
|
|
107961
108100
|
const appData = safeEnvPath(env2.APPDATA);
|
|
107962
108101
|
if (localAppData) {
|
|
107963
|
-
candidates.push(
|
|
108102
|
+
candidates.push(join134(localAppData, ".claude"));
|
|
107964
108103
|
}
|
|
107965
108104
|
if (appData) {
|
|
107966
|
-
candidates.push(
|
|
108105
|
+
candidates.push(join134(appData, ".claude"));
|
|
107967
108106
|
}
|
|
107968
108107
|
if (homeDir) {
|
|
107969
108108
|
candidates.push(`${withoutTrailingSeparators(homeDir)}.claude`);
|
|
@@ -107981,7 +108120,7 @@ async function hasKitMarkers(dir) {
|
|
|
107981
108120
|
if (!await isDirectory(dir))
|
|
107982
108121
|
return false;
|
|
107983
108122
|
for (const marker of LEGACY_KIT_MARKERS) {
|
|
107984
|
-
if (await
|
|
108123
|
+
if (await import_fs_extra36.pathExists(join134(dir, marker))) {
|
|
107985
108124
|
return true;
|
|
107986
108125
|
}
|
|
107987
108126
|
}
|
|
@@ -108027,14 +108166,14 @@ async function repairLegacyWindowsGlobalKitDir(options2) {
|
|
|
108027
108166
|
return { status: "skipped", reason: "ambiguous-legacy-dirs", candidateDirs };
|
|
108028
108167
|
}
|
|
108029
108168
|
const [legacyDir] = legacyDirs;
|
|
108030
|
-
const targetExists = await
|
|
108169
|
+
const targetExists = await import_fs_extra36.pathExists(targetDir);
|
|
108031
108170
|
if (targetExists && !await isEmptyDirectory(targetDir)) {
|
|
108032
108171
|
return { status: "skipped", reason: "target-exists", legacyDir, candidateDirs };
|
|
108033
108172
|
}
|
|
108034
108173
|
if (targetExists) {
|
|
108035
108174
|
await rm16(targetDir, { recursive: true, force: true });
|
|
108036
108175
|
}
|
|
108037
|
-
await mkdir35(
|
|
108176
|
+
await mkdir35(dirname43(targetDir), { recursive: true });
|
|
108038
108177
|
await moveDirectory(legacyDir, targetDir);
|
|
108039
108178
|
return { status: "repaired", reason: "repaired", legacyDir, candidateDirs };
|
|
108040
108179
|
}
|
|
@@ -108044,7 +108183,7 @@ init_version_utils();
|
|
|
108044
108183
|
init_logger();
|
|
108045
108184
|
init_path_resolver();
|
|
108046
108185
|
init_types3();
|
|
108047
|
-
var
|
|
108186
|
+
var import_fs_extra37 = __toESM(require_lib(), 1);
|
|
108048
108187
|
|
|
108049
108188
|
// src/commands/init/types.ts
|
|
108050
108189
|
function isSyncContext(ctx) {
|
|
@@ -108271,7 +108410,7 @@ async function handleSelection(ctx) {
|
|
|
108271
108410
|
return { ...ctx, cancelled: true };
|
|
108272
108411
|
}
|
|
108273
108412
|
}
|
|
108274
|
-
if (!await
|
|
108413
|
+
if (!await import_fs_extra37.pathExists(resolvedDir)) {
|
|
108275
108414
|
if (ctx.options.global) {
|
|
108276
108415
|
await mkdir36(resolvedDir, { recursive: true });
|
|
108277
108416
|
logger.info(`Created global directory: ${resolvedDir}`);
|
|
@@ -108283,7 +108422,7 @@ async function handleSelection(ctx) {
|
|
|
108283
108422
|
}
|
|
108284
108423
|
if (!ctx.options.fresh) {
|
|
108285
108424
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
108286
|
-
const claudeDir3 = prefix ?
|
|
108425
|
+
const claudeDir3 = prefix ? join135(resolvedDir, prefix) : resolvedDir;
|
|
108287
108426
|
try {
|
|
108288
108427
|
const existingMetadata = await readManifest(claudeDir3);
|
|
108289
108428
|
if (existingMetadata?.kits) {
|
|
@@ -108320,7 +108459,7 @@ async function handleSelection(ctx) {
|
|
|
108320
108459
|
}
|
|
108321
108460
|
if (ctx.options.fresh) {
|
|
108322
108461
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
108323
|
-
const claudeDir3 = prefix ?
|
|
108462
|
+
const claudeDir3 = prefix ? join135(resolvedDir, prefix) : resolvedDir;
|
|
108324
108463
|
const canProceed = await handleFreshInstallation(claudeDir3, ctx.prompts);
|
|
108325
108464
|
if (!canProceed) {
|
|
108326
108465
|
return { ...ctx, cancelled: true };
|
|
@@ -108340,7 +108479,7 @@ async function handleSelection(ctx) {
|
|
|
108340
108479
|
let currentVersion = null;
|
|
108341
108480
|
try {
|
|
108342
108481
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
108343
|
-
const claudeDir3 = prefix ?
|
|
108482
|
+
const claudeDir3 = prefix ? join135(resolvedDir, prefix) : resolvedDir;
|
|
108344
108483
|
const existingMetadata = await readManifest(claudeDir3);
|
|
108345
108484
|
currentVersion = existingMetadata?.kits?.[kitType]?.version || null;
|
|
108346
108485
|
if (currentVersion) {
|
|
@@ -108409,7 +108548,7 @@ async function handleSelection(ctx) {
|
|
|
108409
108548
|
if (ctx.options.yes && !ctx.options.fresh && !ctx.options.force && !ctx.options.restoreCkHooks && releaseTag && !isOfflineMode && !pendingKits?.length) {
|
|
108410
108549
|
try {
|
|
108411
108550
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
108412
|
-
const claudeDir3 = prefix ?
|
|
108551
|
+
const claudeDir3 = prefix ? join135(resolvedDir, prefix) : resolvedDir;
|
|
108413
108552
|
const existingMetadata = await readManifest(claudeDir3);
|
|
108414
108553
|
const installedKitVersion = existingMetadata?.kits?.[kitType]?.version;
|
|
108415
108554
|
if (installedKitVersion && versionsMatch(installedKitVersion, releaseTag)) {
|
|
@@ -108433,24 +108572,24 @@ async function handleSelection(ctx) {
|
|
|
108433
108572
|
}
|
|
108434
108573
|
// src/commands/init/phases/sync-handler.ts
|
|
108435
108574
|
import { copyFile as copyFile8, mkdir as mkdir37, open as open5, readFile as readFile59, rename as rename12, stat as stat23, unlink as unlink13, writeFile as writeFile33 } from "node:fs/promises";
|
|
108436
|
-
import { dirname as
|
|
108575
|
+
import { dirname as dirname44, join as join136, resolve as resolve48 } from "node:path";
|
|
108437
108576
|
init_logger();
|
|
108438
108577
|
init_path_resolver();
|
|
108439
|
-
var
|
|
108578
|
+
var import_fs_extra38 = __toESM(require_lib(), 1);
|
|
108440
108579
|
var import_picocolors26 = __toESM(require_picocolors(), 1);
|
|
108441
108580
|
async function handleSync(ctx) {
|
|
108442
108581
|
if (!ctx.options.sync) {
|
|
108443
108582
|
return ctx;
|
|
108444
108583
|
}
|
|
108445
108584
|
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve48(ctx.options.dir || ".");
|
|
108446
|
-
const claudeDir3 = ctx.options.global ? resolvedDir :
|
|
108447
|
-
if (!await
|
|
108585
|
+
const claudeDir3 = ctx.options.global ? resolvedDir : join136(resolvedDir, ".claude");
|
|
108586
|
+
if (!await import_fs_extra38.pathExists(claudeDir3)) {
|
|
108448
108587
|
logger.error("Cannot sync: no .claude directory found");
|
|
108449
108588
|
ctx.prompts.note("Run 'ck init' without --sync to install first.", "No Installation Found");
|
|
108450
108589
|
return { ...ctx, cancelled: true };
|
|
108451
108590
|
}
|
|
108452
|
-
const metadataPath =
|
|
108453
|
-
if (!await
|
|
108591
|
+
const metadataPath = join136(claudeDir3, "metadata.json");
|
|
108592
|
+
if (!await import_fs_extra38.pathExists(metadataPath)) {
|
|
108454
108593
|
logger.error("Cannot sync: no metadata.json found");
|
|
108455
108594
|
ctx.prompts.note(`Your installation may be from an older version.
|
|
108456
108595
|
Run 'ck init' to update.`, "Legacy Installation");
|
|
@@ -108549,10 +108688,10 @@ function getLockTimeout() {
|
|
|
108549
108688
|
var STALE_LOCK_THRESHOLD_MS = 5 * 60 * 1000;
|
|
108550
108689
|
async function acquireSyncLock(global3) {
|
|
108551
108690
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
108552
|
-
const lockPath =
|
|
108691
|
+
const lockPath = join136(cacheDir, ".sync-lock");
|
|
108553
108692
|
const startTime = Date.now();
|
|
108554
108693
|
const lockTimeout = getLockTimeout();
|
|
108555
|
-
await mkdir37(
|
|
108694
|
+
await mkdir37(dirname44(lockPath), { recursive: true });
|
|
108556
108695
|
while (Date.now() - startTime < lockTimeout) {
|
|
108557
108696
|
try {
|
|
108558
108697
|
const handle = await open5(lockPath, "wx");
|
|
@@ -108595,11 +108734,11 @@ async function executeSyncMerge(ctx) {
|
|
|
108595
108734
|
const releaseLock = await acquireSyncLock(ctx.options.global);
|
|
108596
108735
|
try {
|
|
108597
108736
|
const trackedFiles = ctx.syncTrackedFiles;
|
|
108598
|
-
const upstreamDir = ctx.options.global ?
|
|
108737
|
+
const upstreamDir = ctx.options.global ? join136(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
108599
108738
|
let deletions = [];
|
|
108600
108739
|
try {
|
|
108601
|
-
const sourceMetadataPath =
|
|
108602
|
-
if (await
|
|
108740
|
+
const sourceMetadataPath = join136(upstreamDir, "metadata.json");
|
|
108741
|
+
if (await import_fs_extra38.pathExists(sourceMetadataPath)) {
|
|
108603
108742
|
const content = await readFile59(sourceMetadataPath, "utf-8");
|
|
108604
108743
|
const sourceMetadata = JSON.parse(content);
|
|
108605
108744
|
deletions = sourceMetadata.deletions || [];
|
|
@@ -108630,7 +108769,7 @@ async function executeSyncMerge(ctx) {
|
|
|
108630
108769
|
try {
|
|
108631
108770
|
const sourcePath = await validateSyncPath(upstreamDir, file.path);
|
|
108632
108771
|
const targetPath = await validateSyncPath(ctx.claudeDir, file.path);
|
|
108633
|
-
const targetDir =
|
|
108772
|
+
const targetDir = join136(targetPath, "..");
|
|
108634
108773
|
try {
|
|
108635
108774
|
await mkdir37(targetDir, { recursive: true });
|
|
108636
108775
|
} catch (mkdirError) {
|
|
@@ -108799,9 +108938,9 @@ async function createBackup(claudeDir3, files, backupDir) {
|
|
|
108799
108938
|
for (const file of files) {
|
|
108800
108939
|
try {
|
|
108801
108940
|
const sourcePath = await validateSyncPath(claudeDir3, file.path);
|
|
108802
|
-
if (await
|
|
108941
|
+
if (await import_fs_extra38.pathExists(sourcePath)) {
|
|
108803
108942
|
const targetPath = await validateSyncPath(backupDir, file.path);
|
|
108804
|
-
const targetDir =
|
|
108943
|
+
const targetDir = join136(targetPath, "..");
|
|
108805
108944
|
await mkdir37(targetDir, { recursive: true });
|
|
108806
108945
|
await copyFile8(sourcePath, targetPath);
|
|
108807
108946
|
}
|
|
@@ -108816,7 +108955,7 @@ async function createBackup(claudeDir3, files, backupDir) {
|
|
|
108816
108955
|
}
|
|
108817
108956
|
// src/commands/init/phases/transform-handler.ts
|
|
108818
108957
|
init_config_manager();
|
|
108819
|
-
import { join as
|
|
108958
|
+
import { join as join140 } from "node:path";
|
|
108820
108959
|
|
|
108821
108960
|
// src/services/transformers/folder-path-transformer.ts
|
|
108822
108961
|
init_logger();
|
|
@@ -108825,40 +108964,40 @@ init_types3();
|
|
|
108825
108964
|
// src/services/transformers/folder-transform/folder-renamer.ts
|
|
108826
108965
|
init_logger();
|
|
108827
108966
|
init_types3();
|
|
108828
|
-
var
|
|
108967
|
+
var import_fs_extra39 = __toESM(require_lib(), 1);
|
|
108829
108968
|
import { rename as rename13, rm as rm17 } from "node:fs/promises";
|
|
108830
|
-
import { join as
|
|
108969
|
+
import { join as join137, relative as relative30 } from "node:path";
|
|
108831
108970
|
async function collectDirsToRename(extractDir, folders) {
|
|
108832
108971
|
const dirsToRename = [];
|
|
108833
108972
|
if (folders.docs !== DEFAULT_FOLDERS.docs) {
|
|
108834
|
-
const docsPath =
|
|
108835
|
-
if (await
|
|
108973
|
+
const docsPath = join137(extractDir, DEFAULT_FOLDERS.docs);
|
|
108974
|
+
if (await import_fs_extra39.pathExists(docsPath)) {
|
|
108836
108975
|
dirsToRename.push({
|
|
108837
108976
|
from: docsPath,
|
|
108838
|
-
to:
|
|
108977
|
+
to: join137(extractDir, folders.docs)
|
|
108839
108978
|
});
|
|
108840
108979
|
}
|
|
108841
|
-
const claudeDocsPath =
|
|
108842
|
-
if (await
|
|
108980
|
+
const claudeDocsPath = join137(extractDir, ".claude", DEFAULT_FOLDERS.docs);
|
|
108981
|
+
if (await import_fs_extra39.pathExists(claudeDocsPath)) {
|
|
108843
108982
|
dirsToRename.push({
|
|
108844
108983
|
from: claudeDocsPath,
|
|
108845
|
-
to:
|
|
108984
|
+
to: join137(extractDir, ".claude", folders.docs)
|
|
108846
108985
|
});
|
|
108847
108986
|
}
|
|
108848
108987
|
}
|
|
108849
108988
|
if (folders.plans !== DEFAULT_FOLDERS.plans) {
|
|
108850
|
-
const plansPath =
|
|
108851
|
-
if (await
|
|
108989
|
+
const plansPath = join137(extractDir, DEFAULT_FOLDERS.plans);
|
|
108990
|
+
if (await import_fs_extra39.pathExists(plansPath)) {
|
|
108852
108991
|
dirsToRename.push({
|
|
108853
108992
|
from: plansPath,
|
|
108854
|
-
to:
|
|
108993
|
+
to: join137(extractDir, folders.plans)
|
|
108855
108994
|
});
|
|
108856
108995
|
}
|
|
108857
|
-
const claudePlansPath =
|
|
108858
|
-
if (await
|
|
108996
|
+
const claudePlansPath = join137(extractDir, ".claude", DEFAULT_FOLDERS.plans);
|
|
108997
|
+
if (await import_fs_extra39.pathExists(claudePlansPath)) {
|
|
108859
108998
|
dirsToRename.push({
|
|
108860
108999
|
from: claudePlansPath,
|
|
108861
|
-
to:
|
|
109000
|
+
to: join137(extractDir, ".claude", folders.plans)
|
|
108862
109001
|
});
|
|
108863
109002
|
}
|
|
108864
109003
|
}
|
|
@@ -108870,7 +109009,7 @@ async function moveAcrossDevices(src, dest) {
|
|
|
108870
109009
|
} catch (e2) {
|
|
108871
109010
|
if (e2.code === "EXDEV") {
|
|
108872
109011
|
logger.debug(`Cross-device move detected, using copy+delete: ${src} -> ${dest}`);
|
|
108873
|
-
await
|
|
109012
|
+
await import_fs_extra39.copy(src, dest, { overwrite: true });
|
|
108874
109013
|
await rm17(src, { recursive: true, force: true });
|
|
108875
109014
|
} else {
|
|
108876
109015
|
throw e2;
|
|
@@ -108881,11 +109020,11 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
108881
109020
|
let foldersRenamed = 0;
|
|
108882
109021
|
for (const { from, to } of dirsToRename) {
|
|
108883
109022
|
if (options2.dryRun) {
|
|
108884
|
-
logger.info(`[dry-run] Would rename: ${
|
|
109023
|
+
logger.info(`[dry-run] Would rename: ${relative30(extractDir, from)} -> ${relative30(extractDir, to)}`);
|
|
108885
109024
|
} else {
|
|
108886
109025
|
try {
|
|
108887
109026
|
await moveAcrossDevices(from, to);
|
|
108888
|
-
logger.debug(`Renamed: ${
|
|
109027
|
+
logger.debug(`Renamed: ${relative30(extractDir, from)} -> ${relative30(extractDir, to)}`);
|
|
108889
109028
|
foldersRenamed++;
|
|
108890
109029
|
} catch (error) {
|
|
108891
109030
|
logger.warning(`Failed to rename ${from}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -108899,7 +109038,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
108899
109038
|
init_logger();
|
|
108900
109039
|
init_types3();
|
|
108901
109040
|
import { readFile as readFile60, readdir as readdir43, writeFile as writeFile34 } from "node:fs/promises";
|
|
108902
|
-
import { join as
|
|
109041
|
+
import { join as join138, relative as relative31 } from "node:path";
|
|
108903
109042
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
108904
109043
|
".md",
|
|
108905
109044
|
".txt",
|
|
@@ -108952,7 +109091,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
108952
109091
|
let replacementsCount = 0;
|
|
108953
109092
|
const entries = await readdir43(dir, { withFileTypes: true });
|
|
108954
109093
|
for (const entry of entries) {
|
|
108955
|
-
const fullPath =
|
|
109094
|
+
const fullPath = join138(dir, entry.name);
|
|
108956
109095
|
if (entry.isDirectory()) {
|
|
108957
109096
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
108958
109097
|
continue;
|
|
@@ -108979,10 +109118,10 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
108979
109118
|
}
|
|
108980
109119
|
if (changeCount > 0) {
|
|
108981
109120
|
if (options2.dryRun) {
|
|
108982
|
-
logger.debug(`[dry-run] Would update ${
|
|
109121
|
+
logger.debug(`[dry-run] Would update ${relative31(dir, fullPath)}: ${changeCount} replacement(s)`);
|
|
108983
109122
|
} else {
|
|
108984
109123
|
await writeFile34(fullPath, newContent, "utf-8");
|
|
108985
|
-
logger.debug(`Updated ${
|
|
109124
|
+
logger.debug(`Updated ${relative31(dir, fullPath)}: ${changeCount} replacement(s)`);
|
|
108986
109125
|
}
|
|
108987
109126
|
filesChanged++;
|
|
108988
109127
|
replacementsCount += changeCount;
|
|
@@ -109089,7 +109228,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
109089
109228
|
init_logger();
|
|
109090
109229
|
import { readFile as readFile61, readdir as readdir44, writeFile as writeFile35 } from "node:fs/promises";
|
|
109091
109230
|
import { homedir as homedir47, platform as platform15 } from "node:os";
|
|
109092
|
-
import { extname as extname7, join as
|
|
109231
|
+
import { extname as extname7, join as join139 } from "node:path";
|
|
109093
109232
|
var IS_WINDOWS3 = platform15() === "win32";
|
|
109094
109233
|
var HOME_PREFIX = "$HOME";
|
|
109095
109234
|
function getHomeDirPrefix() {
|
|
@@ -109099,7 +109238,7 @@ function normalizeInstallPath(path17) {
|
|
|
109099
109238
|
return path17.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
109100
109239
|
}
|
|
109101
109240
|
function getDefaultGlobalClaudeDir() {
|
|
109102
|
-
return normalizeInstallPath(
|
|
109241
|
+
return normalizeInstallPath(join139(homedir47(), ".claude"));
|
|
109103
109242
|
}
|
|
109104
109243
|
function getCustomGlobalClaudeDir(targetClaudeDir) {
|
|
109105
109244
|
if (!targetClaudeDir)
|
|
@@ -109230,7 +109369,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
109230
109369
|
async function processDirectory2(dir) {
|
|
109231
109370
|
const entries = await readdir44(dir, { withFileTypes: true });
|
|
109232
109371
|
for (const entry of entries) {
|
|
109233
|
-
const fullPath =
|
|
109372
|
+
const fullPath = join139(dir, entry.name);
|
|
109234
109373
|
if (entry.isDirectory()) {
|
|
109235
109374
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
109236
109375
|
continue;
|
|
@@ -109309,7 +109448,7 @@ async function handleTransforms(ctx) {
|
|
|
109309
109448
|
logger.debug(ctx.options.global ? "Saved folder configuration to ~/.claude/.ck.json" : "Saved folder configuration to .claude/.ck.json");
|
|
109310
109449
|
}
|
|
109311
109450
|
}
|
|
109312
|
-
const claudeDir3 = ctx.options.global ? ctx.resolvedDir :
|
|
109451
|
+
const claudeDir3 = ctx.options.global ? ctx.resolvedDir : join140(ctx.resolvedDir, ".claude");
|
|
109313
109452
|
return {
|
|
109314
109453
|
...ctx,
|
|
109315
109454
|
foldersConfig,
|
|
@@ -109532,7 +109671,7 @@ var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
|
109532
109671
|
import { existsSync as existsSync68 } from "node:fs";
|
|
109533
109672
|
import { readFile as readFile65, rm as rm18, unlink as unlink14 } from "node:fs/promises";
|
|
109534
109673
|
import { homedir as homedir52 } from "node:os";
|
|
109535
|
-
import { basename as basename30, join as
|
|
109674
|
+
import { basename as basename30, join as join144, resolve as resolve50 } from "node:path";
|
|
109536
109675
|
init_logger();
|
|
109537
109676
|
|
|
109538
109677
|
// src/ui/ck-cli-design/tokens.ts
|
|
@@ -110010,13 +110149,13 @@ init_dist2();
|
|
|
110010
110149
|
init_model_taxonomy();
|
|
110011
110150
|
import { mkdir as mkdir39, readFile as readFile64, writeFile as writeFile37 } from "node:fs/promises";
|
|
110012
110151
|
import { homedir as homedir51 } from "node:os";
|
|
110013
|
-
import { dirname as
|
|
110152
|
+
import { dirname as dirname45, join as join143 } from "node:path";
|
|
110014
110153
|
|
|
110015
110154
|
// src/commands/portable/models-dev-cache.ts
|
|
110016
110155
|
init_logger();
|
|
110017
110156
|
import { mkdir as mkdir38, readFile as readFile62, rename as rename14, writeFile as writeFile36 } from "node:fs/promises";
|
|
110018
110157
|
import { homedir as homedir49 } from "node:os";
|
|
110019
|
-
import { join as
|
|
110158
|
+
import { join as join141 } from "node:path";
|
|
110020
110159
|
|
|
110021
110160
|
class ModelsDevUnavailableError extends Error {
|
|
110022
110161
|
constructor(message, cause) {
|
|
@@ -110028,13 +110167,13 @@ var MODELS_DEV_URL = "https://models.dev/api.json";
|
|
|
110028
110167
|
var CACHE_TTL_MS3 = 24 * 60 * 60 * 1000;
|
|
110029
110168
|
var FETCH_TIMEOUT_MS = 1e4;
|
|
110030
110169
|
function defaultCacheDir() {
|
|
110031
|
-
return
|
|
110170
|
+
return join141(homedir49(), ".config", "claudekit", "cache");
|
|
110032
110171
|
}
|
|
110033
110172
|
function cacheFilePath(cacheDir) {
|
|
110034
|
-
return
|
|
110173
|
+
return join141(cacheDir, "models-dev.json");
|
|
110035
110174
|
}
|
|
110036
110175
|
function tmpFilePath(cacheDir) {
|
|
110037
|
-
return
|
|
110176
|
+
return join141(cacheDir, "models-dev.json.tmp");
|
|
110038
110177
|
}
|
|
110039
110178
|
async function readCacheEntry(cacheDir) {
|
|
110040
110179
|
const filePath = cacheFilePath(cacheDir);
|
|
@@ -110109,14 +110248,14 @@ async function getModelsDevCatalog(opts = {}) {
|
|
|
110109
110248
|
init_logger();
|
|
110110
110249
|
import { readFile as readFile63 } from "node:fs/promises";
|
|
110111
110250
|
import { homedir as homedir50, platform as platform17 } from "node:os";
|
|
110112
|
-
import { join as
|
|
110251
|
+
import { join as join142 } from "node:path";
|
|
110113
110252
|
function resolveOpenCodeAuthPath(homeDir) {
|
|
110114
110253
|
if (platform17() === "win32") {
|
|
110115
|
-
const dataRoot2 = process.env.LOCALAPPDATA ??
|
|
110116
|
-
return
|
|
110254
|
+
const dataRoot2 = process.env.LOCALAPPDATA ?? join142(homeDir, "AppData", "Local");
|
|
110255
|
+
return join142(dataRoot2, "opencode", "auth.json");
|
|
110117
110256
|
}
|
|
110118
|
-
const dataRoot = process.env.XDG_DATA_HOME ??
|
|
110119
|
-
return
|
|
110257
|
+
const dataRoot = process.env.XDG_DATA_HOME ?? join142(homeDir, ".local", "share");
|
|
110258
|
+
return join142(dataRoot, "opencode", "auth.json");
|
|
110120
110259
|
}
|
|
110121
110260
|
async function readAuthedProviders(homeDir) {
|
|
110122
110261
|
const authPath = resolveOpenCodeAuthPath(homeDir);
|
|
@@ -110218,9 +110357,9 @@ function messageForReason(reason) {
|
|
|
110218
110357
|
}
|
|
110219
110358
|
function getOpenCodeConfigPath(options2) {
|
|
110220
110359
|
if (options2.global) {
|
|
110221
|
-
return
|
|
110360
|
+
return join143(options2.homeDir ?? homedir51(), ".config", "opencode", "opencode.json");
|
|
110222
110361
|
}
|
|
110223
|
-
return
|
|
110362
|
+
return join143(options2.cwd ?? process.cwd(), "opencode.json");
|
|
110224
110363
|
}
|
|
110225
110364
|
function makeCatalogOpts(options2) {
|
|
110226
110365
|
return {
|
|
@@ -110363,7 +110502,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110363
110502
|
}
|
|
110364
110503
|
const chosenModel2 = response2.action === "custom" ? response2.value : suggestion2.model;
|
|
110365
110504
|
const next2 = { ...existing, model: chosenModel2 };
|
|
110366
|
-
await mkdir39(
|
|
110505
|
+
await mkdir39(dirname45(configPath), { recursive: true });
|
|
110367
110506
|
await writeFile37(configPath, `${JSON.stringify(next2, null, 2)}
|
|
110368
110507
|
`, "utf-8");
|
|
110369
110508
|
return { path: configPath, action: "added", model: chosenModel2, reason: suggestion2.reason };
|
|
@@ -110374,7 +110513,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110374
110513
|
throw new OpenCodeAuthRequiredError(suggestion.failure);
|
|
110375
110514
|
}
|
|
110376
110515
|
const next2 = { ...existing ?? {}, model: suggestion.model };
|
|
110377
|
-
await mkdir39(
|
|
110516
|
+
await mkdir39(dirname45(configPath), { recursive: true });
|
|
110378
110517
|
await writeFile37(configPath, `${JSON.stringify(next2, null, 2)}
|
|
110379
110518
|
`, "utf-8");
|
|
110380
110519
|
return {
|
|
@@ -110396,7 +110535,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110396
110535
|
}
|
|
110397
110536
|
const chosenModel = response.action === "custom" ? response.value : suggestion.ok ? suggestion.model : "";
|
|
110398
110537
|
const next = { ...existing ?? {}, model: chosenModel };
|
|
110399
|
-
await mkdir39(
|
|
110538
|
+
await mkdir39(dirname45(configPath), { recursive: true });
|
|
110400
110539
|
await writeFile37(configPath, `${JSON.stringify(next, null, 2)}
|
|
110401
110540
|
`, "utf-8");
|
|
110402
110541
|
return {
|
|
@@ -110409,7 +110548,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
110409
110548
|
|
|
110410
110549
|
// src/commands/portable/plan-display.ts
|
|
110411
110550
|
var import_picocolors28 = __toESM(require_picocolors(), 1);
|
|
110412
|
-
import { basename as basename29, dirname as
|
|
110551
|
+
import { basename as basename29, dirname as dirname46, extname as extname8 } from "node:path";
|
|
110413
110552
|
var DEFAULT_MAX_PLAN_GROUP_ITEMS = 20;
|
|
110414
110553
|
var TYPE_ORDER = [
|
|
110415
110554
|
"agent",
|
|
@@ -110635,21 +110774,21 @@ function collectPlannedWhereLines(plan) {
|
|
|
110635
110774
|
return destinations.map((destination) => `${formatDisplayPath(destination)} -> ${formatCdHint(resolveCdTarget(destination))}`);
|
|
110636
110775
|
}
|
|
110637
110776
|
function resolveCdTarget(destination) {
|
|
110638
|
-
return extname8(destination).length > 0 ?
|
|
110777
|
+
return extname8(destination).length > 0 ? dirname46(destination) : destination;
|
|
110639
110778
|
}
|
|
110640
110779
|
function normalizeWhereDestination(path17, portableType) {
|
|
110641
110780
|
if (portableType === "agent" || portableType === "command" || portableType === "skill") {
|
|
110642
|
-
return
|
|
110781
|
+
return dirname46(path17);
|
|
110643
110782
|
}
|
|
110644
110783
|
if (portableType === "hooks") {
|
|
110645
|
-
return
|
|
110784
|
+
return dirname46(path17);
|
|
110646
110785
|
}
|
|
110647
110786
|
if (portableType === "rules") {
|
|
110648
110787
|
const fileName = basename29(path17).toLowerCase();
|
|
110649
110788
|
if (fileName === "agents.md" || fileName === "gemini.md" || fileName === ".goosehints" || fileName === "custom_modes.yaml" || fileName === "custom_modes.yml") {
|
|
110650
110789
|
return path17;
|
|
110651
110790
|
}
|
|
110652
|
-
return
|
|
110791
|
+
return dirname46(path17);
|
|
110653
110792
|
}
|
|
110654
110793
|
return path17;
|
|
110655
110794
|
}
|
|
@@ -111212,7 +111351,7 @@ async function executeDeleteAction(action, options2) {
|
|
|
111212
111351
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
111213
111352
|
if (!skillSourcePath)
|
|
111214
111353
|
return;
|
|
111215
|
-
const sourceMetadataPath =
|
|
111354
|
+
const sourceMetadataPath = join144(resolve50(skillSourcePath, ".."), "metadata.json");
|
|
111216
111355
|
if (!existsSync68(sourceMetadataPath))
|
|
111217
111356
|
return;
|
|
111218
111357
|
let sourceMetadata;
|
|
@@ -111225,7 +111364,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
111225
111364
|
}
|
|
111226
111365
|
if (!sourceMetadata.deletions || sourceMetadata.deletions.length === 0)
|
|
111227
111366
|
return;
|
|
111228
|
-
const claudeDir3 = installGlobally ?
|
|
111367
|
+
const claudeDir3 = installGlobally ? join144(homedir52(), ".claude") : join144(process.cwd(), ".claude");
|
|
111229
111368
|
if (!existsSync68(claudeDir3))
|
|
111230
111369
|
return;
|
|
111231
111370
|
try {
|
|
@@ -111353,8 +111492,8 @@ async function migrateCommand(options2) {
|
|
|
111353
111492
|
let requestedGlobal = options2.global ?? false;
|
|
111354
111493
|
let installGlobally = requestedGlobal;
|
|
111355
111494
|
if (options2.global === undefined && !options2.yes) {
|
|
111356
|
-
const projectTarget =
|
|
111357
|
-
const globalTarget =
|
|
111495
|
+
const projectTarget = join144(process.cwd(), ".claude");
|
|
111496
|
+
const globalTarget = join144(homedir52(), ".claude");
|
|
111358
111497
|
const scopeChoice = await ie({
|
|
111359
111498
|
message: "Installation scope",
|
|
111360
111499
|
options: [
|
|
@@ -111427,7 +111566,7 @@ async function migrateCommand(options2) {
|
|
|
111427
111566
|
}).join(`
|
|
111428
111567
|
`));
|
|
111429
111568
|
if (sourceGlobalOnly) {
|
|
111430
|
-
f2.info(import_picocolors30.default.dim(` Scope: global (--global / -g) - reading from ${formatDisplayPath(
|
|
111569
|
+
f2.info(import_picocolors30.default.dim(` Scope: global (--global / -g) - reading from ${formatDisplayPath(join144(homedir52(), ".claude"))}`));
|
|
111431
111570
|
} else {
|
|
111432
111571
|
f2.info(import_picocolors30.default.dim(` CWD: ${process.cwd()}`));
|
|
111433
111572
|
}
|
|
@@ -111966,7 +112105,7 @@ function buildDryRunFallbackResults(skills, selectedProviders, installGlobally,
|
|
|
111966
112105
|
results.push({
|
|
111967
112106
|
itemName: skill.name,
|
|
111968
112107
|
operation: "apply",
|
|
111969
|
-
path:
|
|
112108
|
+
path: join144(basePath, skill.name),
|
|
111970
112109
|
portableType: "skill",
|
|
111971
112110
|
provider,
|
|
111972
112111
|
providerDisplayName: providers[provider].displayName,
|
|
@@ -111988,7 +112127,7 @@ import { resolve as resolve51 } from "node:path";
|
|
|
111988
112127
|
init_logger();
|
|
111989
112128
|
init_path_resolver();
|
|
111990
112129
|
init_types3();
|
|
111991
|
-
var
|
|
112130
|
+
var import_fs_extra40 = __toESM(require_lib(), 1);
|
|
111992
112131
|
async function directorySetup(validOptions, prompts) {
|
|
111993
112132
|
const isNonInteractive2 = !process.stdin.isTTY || process.env.CI === "true" || process.env.NON_INTERACTIVE === "true";
|
|
111994
112133
|
const config = await ConfigManager.get();
|
|
@@ -112087,8 +112226,8 @@ async function directorySetup(validOptions, prompts) {
|
|
|
112087
112226
|
return null;
|
|
112088
112227
|
}
|
|
112089
112228
|
}
|
|
112090
|
-
if (await
|
|
112091
|
-
const files = await
|
|
112229
|
+
if (await import_fs_extra40.pathExists(resolvedDir)) {
|
|
112230
|
+
const files = await import_fs_extra40.readdir(resolvedDir);
|
|
112092
112231
|
const isEmpty = files.length === 0;
|
|
112093
112232
|
if (!isEmpty) {
|
|
112094
112233
|
if (isNonInteractive2) {
|
|
@@ -112126,7 +112265,7 @@ async function handleDirectorySetup(ctx) {
|
|
|
112126
112265
|
// src/commands/new/phases/project-creation.ts
|
|
112127
112266
|
init_config_manager();
|
|
112128
112267
|
init_github_client();
|
|
112129
|
-
import { join as
|
|
112268
|
+
import { join as join145 } from "node:path";
|
|
112130
112269
|
init_logger();
|
|
112131
112270
|
init_output_manager();
|
|
112132
112271
|
init_types3();
|
|
@@ -112252,7 +112391,7 @@ async function projectCreation(kit, resolvedDir, validOptions, isNonInteractive2
|
|
|
112252
112391
|
output.section("Installing");
|
|
112253
112392
|
logger.verbose("Installation target", { directory: resolvedDir });
|
|
112254
112393
|
const merger = new FileMerger;
|
|
112255
|
-
const claudeDir3 =
|
|
112394
|
+
const claudeDir3 = join145(resolvedDir, ".claude");
|
|
112256
112395
|
merger.setMultiKitContext(claudeDir3, kit);
|
|
112257
112396
|
if (validOptions.exclude && validOptions.exclude.length > 0) {
|
|
112258
112397
|
merger.addIgnorePatterns(validOptions.exclude);
|
|
@@ -112299,7 +112438,7 @@ async function handleProjectCreation(ctx) {
|
|
|
112299
112438
|
}
|
|
112300
112439
|
// src/commands/new/phases/post-setup.ts
|
|
112301
112440
|
init_projects_registry();
|
|
112302
|
-
import { join as
|
|
112441
|
+
import { join as join146 } from "node:path";
|
|
112303
112442
|
init_package_installer();
|
|
112304
112443
|
init_logger();
|
|
112305
112444
|
init_path_resolver();
|
|
@@ -112331,9 +112470,9 @@ async function postSetup(resolvedDir, validOptions, isNonInteractive2, prompts)
|
|
|
112331
112470
|
withSudo: validOptions.withSudo
|
|
112332
112471
|
});
|
|
112333
112472
|
}
|
|
112334
|
-
const claudeDir3 =
|
|
112473
|
+
const claudeDir3 = join146(resolvedDir, ".claude");
|
|
112335
112474
|
await promptSetupWizardIfNeeded({
|
|
112336
|
-
envPath:
|
|
112475
|
+
envPath: join146(claudeDir3, ".env"),
|
|
112337
112476
|
claudeDir: claudeDir3,
|
|
112338
112477
|
isGlobal: false,
|
|
112339
112478
|
isNonInteractive: isNonInteractive2,
|
|
@@ -112403,7 +112542,7 @@ Please use only one download method.`);
|
|
|
112403
112542
|
// src/commands/plan/plan-command.ts
|
|
112404
112543
|
init_output_manager();
|
|
112405
112544
|
import { existsSync as existsSync71, statSync as statSync12 } from "node:fs";
|
|
112406
|
-
import { dirname as
|
|
112545
|
+
import { dirname as dirname50, isAbsolute as isAbsolute14, join as join149, parse as parse7, resolve as resolve55 } from "node:path";
|
|
112407
112546
|
|
|
112408
112547
|
// src/commands/plan/plan-read-handlers.ts
|
|
112409
112548
|
init_config();
|
|
@@ -112413,18 +112552,18 @@ init_logger();
|
|
|
112413
112552
|
init_output_manager();
|
|
112414
112553
|
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
112415
112554
|
import { existsSync as existsSync70, statSync as statSync11 } from "node:fs";
|
|
112416
|
-
import { basename as basename31, dirname as
|
|
112555
|
+
import { basename as basename31, dirname as dirname48, join as join148, relative as relative32, resolve as resolve53 } from "node:path";
|
|
112417
112556
|
|
|
112418
112557
|
// src/commands/plan/plan-dependencies.ts
|
|
112419
112558
|
init_config();
|
|
112420
112559
|
init_plan_parser();
|
|
112421
112560
|
init_plans_registry();
|
|
112422
112561
|
import { existsSync as existsSync69 } from "node:fs";
|
|
112423
|
-
import { dirname as
|
|
112562
|
+
import { dirname as dirname47, join as join147 } from "node:path";
|
|
112424
112563
|
async function resolvePlanDependencies(references, currentPlanFile, options2 = {}) {
|
|
112425
112564
|
if (references.length === 0)
|
|
112426
112565
|
return [];
|
|
112427
|
-
const currentPlanDir =
|
|
112566
|
+
const currentPlanDir = dirname47(currentPlanFile);
|
|
112428
112567
|
const projectRoot = findProjectRoot(currentPlanDir);
|
|
112429
112568
|
const config = options2.preloadedConfig ?? (await CkConfigManager.loadFull(projectRoot)).config;
|
|
112430
112569
|
const defaultScope = inferPlanScopeForDir(currentPlanDir, config);
|
|
@@ -112440,7 +112579,7 @@ async function resolvePlanDependencies(references, currentPlanFile, options2 = {
|
|
|
112440
112579
|
};
|
|
112441
112580
|
}
|
|
112442
112581
|
const scopeRoot = resolvePlanDirForScope(scope, projectRoot, config);
|
|
112443
|
-
const planFile =
|
|
112582
|
+
const planFile = join147(scopeRoot, planId, "plan.md");
|
|
112444
112583
|
const isSelfReference = planFile === currentPlanFile;
|
|
112445
112584
|
if (!existsSync69(planFile)) {
|
|
112446
112585
|
return {
|
|
@@ -112508,10 +112647,10 @@ async function handleParse(target, options2) {
|
|
|
112508
112647
|
return;
|
|
112509
112648
|
}
|
|
112510
112649
|
if (isJsonOutput(options2)) {
|
|
112511
|
-
console.log(JSON.stringify({ file:
|
|
112650
|
+
console.log(JSON.stringify({ file: relative32(process.cwd(), planFile), frontmatter, phases }, null, 2));
|
|
112512
112651
|
return;
|
|
112513
112652
|
}
|
|
112514
|
-
const title = typeof frontmatter.title === "string" ? frontmatter.title : basename31(
|
|
112653
|
+
const title = typeof frontmatter.title === "string" ? frontmatter.title : basename31(dirname48(planFile));
|
|
112515
112654
|
console.log();
|
|
112516
112655
|
console.log(import_picocolors32.default.bold(` Plan: ${title}`));
|
|
112517
112656
|
console.log(` File: ${planFile}`);
|
|
@@ -112582,7 +112721,7 @@ async function handleStatus(target, options2) {
|
|
|
112582
112721
|
}
|
|
112583
112722
|
const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
|
|
112584
112723
|
const t = effectiveTarget ? resolve53(effectiveTarget) : null;
|
|
112585
|
-
const plansDir = t && existsSync70(t) && statSync11(t).isDirectory() && !existsSync70(
|
|
112724
|
+
const plansDir = t && existsSync70(t) && statSync11(t).isDirectory() && !existsSync70(join148(t, "plan.md")) ? t : null;
|
|
112586
112725
|
if (plansDir) {
|
|
112587
112726
|
const planFiles = scanPlanDir(plansDir);
|
|
112588
112727
|
if (planFiles.length === 0) {
|
|
@@ -112622,7 +112761,7 @@ async function handleStatus(target, options2) {
|
|
|
112622
112761
|
const blockedBy2 = await resolvePlanDependencies(s.blockedBy, pf, { preloadedConfig });
|
|
112623
112762
|
const blocks2 = await resolvePlanDependencies(s.blocks, pf, { preloadedConfig });
|
|
112624
112763
|
const bar = progressBar(s.completed, s.totalPhases);
|
|
112625
|
-
const title2 = s.title ?? basename31(
|
|
112764
|
+
const title2 = s.title ?? basename31(dirname48(pf));
|
|
112626
112765
|
console.log(` ${import_picocolors32.default.bold(title2)}`);
|
|
112627
112766
|
console.log(` ${bar}`);
|
|
112628
112767
|
if (s.inProgress > 0)
|
|
@@ -112641,7 +112780,7 @@ async function handleStatus(target, options2) {
|
|
|
112641
112780
|
}
|
|
112642
112781
|
console.log();
|
|
112643
112782
|
} catch {
|
|
112644
|
-
console.log(` [X] Failed to read: ${basename31(
|
|
112783
|
+
console.log(` [X] Failed to read: ${basename31(dirname48(pf))}`);
|
|
112645
112784
|
console.log();
|
|
112646
112785
|
}
|
|
112647
112786
|
}
|
|
@@ -112668,7 +112807,7 @@ async function handleStatus(target, options2) {
|
|
|
112668
112807
|
console.log(JSON.stringify({ ...summary, dependencyStatus: { blockedBy, blocks } }, null, 2));
|
|
112669
112808
|
return;
|
|
112670
112809
|
}
|
|
112671
|
-
const title = summary.title ?? basename31(
|
|
112810
|
+
const title = summary.title ?? basename31(dirname48(planFile));
|
|
112672
112811
|
console.log();
|
|
112673
112812
|
console.log(import_picocolors32.default.bold(` ${title}`));
|
|
112674
112813
|
if (summary.status)
|
|
@@ -112731,7 +112870,7 @@ async function handleKanban(target, options2) {
|
|
|
112731
112870
|
process.exitCode = 1;
|
|
112732
112871
|
return;
|
|
112733
112872
|
}
|
|
112734
|
-
const route = `/plans?dir=${encodeURIComponent(
|
|
112873
|
+
const route = `/plans?dir=${encodeURIComponent(dirname48(dirname48(planFile)))}&view=kanban`;
|
|
112735
112874
|
const url = `http://localhost:${server.port}${route}`;
|
|
112736
112875
|
console.log();
|
|
112737
112876
|
console.log(import_picocolors32.default.bold(" ClaudeKit Dashboard — Plans"));
|
|
@@ -112766,12 +112905,12 @@ init_plan_parser();
|
|
|
112766
112905
|
init_plans_registry();
|
|
112767
112906
|
init_output_manager();
|
|
112768
112907
|
var import_picocolors33 = __toESM(require_picocolors(), 1);
|
|
112769
|
-
import { basename as basename32, dirname as
|
|
112908
|
+
import { basename as basename32, dirname as dirname49, relative as relative33, resolve as resolve54 } from "node:path";
|
|
112770
112909
|
function quoteReadTarget(filePath) {
|
|
112771
112910
|
return `"${filePath.replace(/\\/g, "/").replace(/"/g, "\\\"")}"`;
|
|
112772
112911
|
}
|
|
112773
112912
|
function buildPlanCreateReadReminder(planFile, phaseFiles, cwd2 = process.cwd()) {
|
|
112774
|
-
const files = [planFile, ...phaseFiles].map((file) => quoteReadTarget(
|
|
112913
|
+
const files = [planFile, ...phaseFiles].map((file) => quoteReadTarget(relative33(cwd2, file)));
|
|
112775
112914
|
return [
|
|
112776
112915
|
" [i] Claude Code agents: read plan.md and every phase-*.md before editing.",
|
|
112777
112916
|
" These files already exist; Write/Edit without Read may be rejected after wasting tokens.",
|
|
@@ -112843,8 +112982,8 @@ async function handleCreate(target, options2) {
|
|
|
112843
112982
|
if (isJsonOutput(options2)) {
|
|
112844
112983
|
const cwd2 = process.cwd();
|
|
112845
112984
|
console.log(JSON.stringify({
|
|
112846
|
-
planFile:
|
|
112847
|
-
phaseFiles: result.phaseFiles.map((f3) =>
|
|
112985
|
+
planFile: relative33(cwd2, result.planFile),
|
|
112986
|
+
phaseFiles: result.phaseFiles.map((f3) => relative33(cwd2, f3))
|
|
112848
112987
|
}, null, 2));
|
|
112849
112988
|
return;
|
|
112850
112989
|
}
|
|
@@ -112880,7 +113019,7 @@ async function handleCheck(target, options2) {
|
|
|
112880
113019
|
process.exitCode = 1;
|
|
112881
113020
|
return;
|
|
112882
113021
|
}
|
|
112883
|
-
const planDir =
|
|
113022
|
+
const planDir = dirname49(planFile);
|
|
112884
113023
|
let planStatus = "pending";
|
|
112885
113024
|
try {
|
|
112886
113025
|
const projectRoot = findProjectRoot(planDir);
|
|
@@ -112903,7 +113042,7 @@ async function handleCheck(target, options2) {
|
|
|
112903
113042
|
console.log(JSON.stringify({
|
|
112904
113043
|
phaseId: target,
|
|
112905
113044
|
status: newStatus,
|
|
112906
|
-
planFile:
|
|
113045
|
+
planFile: relative33(process.cwd(), planFile)
|
|
112907
113046
|
}));
|
|
112908
113047
|
return;
|
|
112909
113048
|
}
|
|
@@ -112929,7 +113068,7 @@ async function handleUncheck(target, options2) {
|
|
|
112929
113068
|
process.exitCode = 1;
|
|
112930
113069
|
return;
|
|
112931
113070
|
}
|
|
112932
|
-
const planDir =
|
|
113071
|
+
const planDir = dirname49(planFile);
|
|
112933
113072
|
try {
|
|
112934
113073
|
const projectRoot = findProjectRoot(planDir);
|
|
112935
113074
|
const summary = buildPlanSummary(planFile);
|
|
@@ -112947,7 +113086,7 @@ async function handleUncheck(target, options2) {
|
|
|
112947
113086
|
console.log(JSON.stringify({
|
|
112948
113087
|
phaseId: target,
|
|
112949
113088
|
status: "pending",
|
|
112950
|
-
planFile:
|
|
113089
|
+
planFile: relative33(process.cwd(), planFile)
|
|
112951
113090
|
}));
|
|
112952
113091
|
return;
|
|
112953
113092
|
}
|
|
@@ -112968,7 +113107,7 @@ async function handleAddPhase(target, options2) {
|
|
|
112968
113107
|
try {
|
|
112969
113108
|
const result = addPhase(planFile, target, options2.after);
|
|
112970
113109
|
try {
|
|
112971
|
-
const planDir =
|
|
113110
|
+
const planDir = dirname49(planFile);
|
|
112972
113111
|
const projectRoot = findProjectRoot(planDir);
|
|
112973
113112
|
updateRegistryAddPhase({
|
|
112974
113113
|
planDir,
|
|
@@ -112979,7 +113118,7 @@ async function handleAddPhase(target, options2) {
|
|
|
112979
113118
|
if (isJsonOutput(options2)) {
|
|
112980
113119
|
console.log(JSON.stringify({
|
|
112981
113120
|
phaseId: result.phaseId,
|
|
112982
|
-
phaseFile:
|
|
113121
|
+
phaseFile: relative33(process.cwd(), result.phaseFile)
|
|
112983
113122
|
}));
|
|
112984
113123
|
return;
|
|
112985
113124
|
}
|
|
@@ -113011,7 +113150,7 @@ function resolvePlanFile(target, baseDir) {
|
|
|
113011
113150
|
const stat24 = statSync12(t);
|
|
113012
113151
|
if (stat24.isFile())
|
|
113013
113152
|
return t;
|
|
113014
|
-
const candidate =
|
|
113153
|
+
const candidate = join149(t, "plan.md");
|
|
113015
113154
|
if (existsSync71(candidate))
|
|
113016
113155
|
return candidate;
|
|
113017
113156
|
}
|
|
@@ -113019,10 +113158,10 @@ function resolvePlanFile(target, baseDir) {
|
|
|
113019
113158
|
let dir = process.cwd();
|
|
113020
113159
|
const root = parse7(dir).root;
|
|
113021
113160
|
while (dir !== root) {
|
|
113022
|
-
const candidate =
|
|
113161
|
+
const candidate = join149(dir, "plan.md");
|
|
113023
113162
|
if (existsSync71(candidate))
|
|
113024
113163
|
return candidate;
|
|
113025
|
-
dir =
|
|
113164
|
+
dir = dirname50(dir);
|
|
113026
113165
|
}
|
|
113027
113166
|
}
|
|
113028
113167
|
return null;
|
|
@@ -113539,10 +113678,10 @@ init_agents();
|
|
|
113539
113678
|
var import_gray_matter12 = __toESM(require_gray_matter(), 1);
|
|
113540
113679
|
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
113541
113680
|
import { readFile as readFile66 } from "node:fs/promises";
|
|
113542
|
-
import { join as
|
|
113681
|
+
import { join as join151 } from "node:path";
|
|
113543
113682
|
|
|
113544
113683
|
// src/commands/skills/installed-skills-inventory.ts
|
|
113545
|
-
import { join as
|
|
113684
|
+
import { join as join150, resolve as resolve57 } from "node:path";
|
|
113546
113685
|
init_path_resolver();
|
|
113547
113686
|
var SCOPE_SORT_ORDER = {
|
|
113548
113687
|
project: 0,
|
|
@@ -113554,8 +113693,8 @@ async function getActiveClaudeSkillInstallations(options2 = {}) {
|
|
|
113554
113693
|
const projectClaudeDir = resolve57(projectDir, ".claude");
|
|
113555
113694
|
const projectScopeAliasesGlobal = projectClaudeDir === globalDir;
|
|
113556
113695
|
const [projectSkills, globalSkills] = await Promise.all([
|
|
113557
|
-
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(
|
|
113558
|
-
scanSkills2(
|
|
113696
|
+
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(join150(projectClaudeDir, "skills")),
|
|
113697
|
+
scanSkills2(join150(globalDir, "skills"))
|
|
113559
113698
|
]);
|
|
113560
113699
|
const projectIds = new Set(projectSkills.map((skill) => skill.id));
|
|
113561
113700
|
const globalIds = new Set(globalSkills.map((skill) => skill.id));
|
|
@@ -113715,7 +113854,7 @@ async function handleValidate2(sourcePath) {
|
|
|
113715
113854
|
spinner.stop(`Checked ${skills.length} skill(s)`);
|
|
113716
113855
|
let hasIssues = false;
|
|
113717
113856
|
for (const skill of skills) {
|
|
113718
|
-
const skillMdPath =
|
|
113857
|
+
const skillMdPath = join151(skill.path, "SKILL.md");
|
|
113719
113858
|
try {
|
|
113720
113859
|
const content = await readFile66(skillMdPath, "utf-8");
|
|
113721
113860
|
const { data } = import_gray_matter12.default(content, {
|
|
@@ -114259,7 +114398,7 @@ var import_picocolors39 = __toESM(require_picocolors(), 1);
|
|
|
114259
114398
|
// src/commands/uninstall/installation-detector.ts
|
|
114260
114399
|
init_claudekit_scanner();
|
|
114261
114400
|
init_path_resolver();
|
|
114262
|
-
var
|
|
114401
|
+
var import_fs_extra41 = __toESM(require_lib(), 1);
|
|
114263
114402
|
function hasClaudeKitComponents(components) {
|
|
114264
114403
|
return components.agents > 0 || components.commands > 0 || components.rules > 0 || components.skills > 0;
|
|
114265
114404
|
}
|
|
@@ -114274,7 +114413,7 @@ async function detectInstallations() {
|
|
|
114274
114413
|
installations.push({
|
|
114275
114414
|
type: "local",
|
|
114276
114415
|
path: setup.project.path,
|
|
114277
|
-
exists: await
|
|
114416
|
+
exists: await import_fs_extra41.pathExists(setup.project.path),
|
|
114278
114417
|
hasMetadata,
|
|
114279
114418
|
components: setup.project.components
|
|
114280
114419
|
});
|
|
@@ -114287,7 +114426,7 @@ async function detectInstallations() {
|
|
|
114287
114426
|
installations.push({
|
|
114288
114427
|
type: "global",
|
|
114289
114428
|
path: setup.global.path,
|
|
114290
|
-
exists: await
|
|
114429
|
+
exists: await import_fs_extra41.pathExists(setup.global.path),
|
|
114291
114430
|
hasMetadata,
|
|
114292
114431
|
components: setup.global.components
|
|
114293
114432
|
});
|
|
@@ -114298,19 +114437,19 @@ async function detectInstallations() {
|
|
|
114298
114437
|
|
|
114299
114438
|
// src/commands/uninstall/removal-handler.ts
|
|
114300
114439
|
import { readdirSync as readdirSync12, rmSync as rmSync5 } from "node:fs";
|
|
114301
|
-
import { basename as basename33, join as
|
|
114440
|
+
import { basename as basename33, join as join153, resolve as resolve58, sep as sep14 } from "node:path";
|
|
114302
114441
|
init_logger();
|
|
114303
114442
|
init_safe_prompts();
|
|
114304
114443
|
init_safe_spinner();
|
|
114305
|
-
var
|
|
114444
|
+
var import_fs_extra43 = __toESM(require_lib(), 1);
|
|
114306
114445
|
|
|
114307
114446
|
// src/commands/uninstall/analysis-handler.ts
|
|
114308
114447
|
init_metadata_migration();
|
|
114309
114448
|
import { readdirSync as readdirSync11, rmSync as rmSync4 } from "node:fs";
|
|
114310
|
-
import { dirname as
|
|
114449
|
+
import { dirname as dirname51, join as join152 } from "node:path";
|
|
114311
114450
|
init_logger();
|
|
114312
114451
|
init_safe_prompts();
|
|
114313
|
-
var
|
|
114452
|
+
var import_fs_extra42 = __toESM(require_lib(), 1);
|
|
114314
114453
|
var import_picocolors38 = __toESM(require_picocolors(), 1);
|
|
114315
114454
|
function normalizeTrackedPath(relativePath) {
|
|
114316
114455
|
return relativePath.replace(/\\/g, "/");
|
|
@@ -114329,7 +114468,7 @@ function classifyFileByOwnership(ownership, forceOverwrite, deleteReason) {
|
|
|
114329
114468
|
}
|
|
114330
114469
|
async function cleanupEmptyDirectories3(filePath, installationRoot) {
|
|
114331
114470
|
let cleaned = 0;
|
|
114332
|
-
let currentDir =
|
|
114471
|
+
let currentDir = dirname51(filePath);
|
|
114333
114472
|
while (currentDir !== installationRoot && currentDir.startsWith(installationRoot)) {
|
|
114334
114473
|
try {
|
|
114335
114474
|
const entries = readdirSync11(currentDir);
|
|
@@ -114337,7 +114476,7 @@ async function cleanupEmptyDirectories3(filePath, installationRoot) {
|
|
|
114337
114476
|
rmSync4(currentDir, { recursive: true });
|
|
114338
114477
|
cleaned++;
|
|
114339
114478
|
logger.debug(`Removed empty directory: ${currentDir}`);
|
|
114340
|
-
currentDir =
|
|
114479
|
+
currentDir = dirname51(currentDir);
|
|
114341
114480
|
} else {
|
|
114342
114481
|
break;
|
|
114343
114482
|
}
|
|
@@ -114367,7 +114506,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
114367
114506
|
const remainingFiles = metadata.kits?.[remainingKit]?.files || [];
|
|
114368
114507
|
for (const file of remainingFiles) {
|
|
114369
114508
|
const relativePath = normalizeTrackedPath(file.path);
|
|
114370
|
-
if (await
|
|
114509
|
+
if (await import_fs_extra42.pathExists(join152(installation.path, relativePath))) {
|
|
114371
114510
|
result.retainedManifestPaths.push(relativePath);
|
|
114372
114511
|
}
|
|
114373
114512
|
}
|
|
@@ -114375,7 +114514,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
114375
114514
|
const kitFiles = metadata.kits[kit].files || [];
|
|
114376
114515
|
for (const trackedFile of kitFiles) {
|
|
114377
114516
|
const relativePath = normalizeTrackedPath(trackedFile.path);
|
|
114378
|
-
const filePath =
|
|
114517
|
+
const filePath = join152(installation.path, relativePath);
|
|
114379
114518
|
if (preservedPaths.has(relativePath)) {
|
|
114380
114519
|
result.toPreserve.push({ path: relativePath, reason: "shared with other kit" });
|
|
114381
114520
|
continue;
|
|
@@ -114408,7 +114547,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
114408
114547
|
}
|
|
114409
114548
|
for (const trackedFile of allTrackedFiles) {
|
|
114410
114549
|
const relativePath = normalizeTrackedPath(trackedFile.path);
|
|
114411
|
-
const filePath =
|
|
114550
|
+
const filePath = join152(installation.path, relativePath);
|
|
114412
114551
|
const ownershipResult = await OwnershipChecker.checkOwnership(filePath, metadata, installation.path);
|
|
114413
114552
|
if (!ownershipResult.exists)
|
|
114414
114553
|
continue;
|
|
@@ -114457,7 +114596,7 @@ function displayDryRunPreview(analysis, installationType) {
|
|
|
114457
114596
|
// src/commands/uninstall/removal-handler.ts
|
|
114458
114597
|
async function isDirectory2(filePath) {
|
|
114459
114598
|
try {
|
|
114460
|
-
const stats = await
|
|
114599
|
+
const stats = await import_fs_extra43.lstat(filePath);
|
|
114461
114600
|
return stats.isDirectory();
|
|
114462
114601
|
} catch {
|
|
114463
114602
|
logger.debug(`Failed to check if path is directory: ${filePath}`);
|
|
@@ -114488,9 +114627,9 @@ async function isPathSafeToRemove(filePath, baseDir) {
|
|
|
114488
114627
|
logger.debug(`Path outside installation directory: ${filePath}`);
|
|
114489
114628
|
return false;
|
|
114490
114629
|
}
|
|
114491
|
-
const stats = await
|
|
114630
|
+
const stats = await import_fs_extra43.lstat(filePath);
|
|
114492
114631
|
if (stats.isSymbolicLink()) {
|
|
114493
|
-
const realPath = await
|
|
114632
|
+
const realPath = await import_fs_extra43.realpath(filePath);
|
|
114494
114633
|
const resolvedReal = resolve58(realPath);
|
|
114495
114634
|
if (!resolvedReal.startsWith(resolvedBase + sep14) && resolvedReal !== resolvedBase) {
|
|
114496
114635
|
logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
|
|
@@ -114551,15 +114690,15 @@ async function removeInstallations(installations, options2) {
|
|
|
114551
114690
|
let removedCount = 0;
|
|
114552
114691
|
let cleanedDirs = 0;
|
|
114553
114692
|
for (const item of analysis.toDelete) {
|
|
114554
|
-
const filePath =
|
|
114555
|
-
if (!await
|
|
114693
|
+
const filePath = join153(installation.path, item.path);
|
|
114694
|
+
if (!await import_fs_extra43.pathExists(filePath))
|
|
114556
114695
|
continue;
|
|
114557
114696
|
if (!await isPathSafeToRemove(filePath, installation.path)) {
|
|
114558
114697
|
logger.debug(`Skipping unsafe path: ${item.path}`);
|
|
114559
114698
|
continue;
|
|
114560
114699
|
}
|
|
114561
114700
|
const isDir = await isDirectory2(filePath);
|
|
114562
|
-
await
|
|
114701
|
+
await import_fs_extra43.remove(filePath);
|
|
114563
114702
|
removedCount++;
|
|
114564
114703
|
logger.debug(`Removed ${isDir ? "directory" : "file"}: ${item.path}`);
|
|
114565
114704
|
if (!isDir) {
|
|
@@ -114960,7 +115099,7 @@ ${import_picocolors40.default.bold(import_picocolors40.default.cyan(result.kitCo
|
|
|
114960
115099
|
init_logger();
|
|
114961
115100
|
import { existsSync as existsSync78 } from "node:fs";
|
|
114962
115101
|
import { rm as rm19 } from "node:fs/promises";
|
|
114963
|
-
import { join as
|
|
115102
|
+
import { join as join160 } from "node:path";
|
|
114964
115103
|
var import_picocolors41 = __toESM(require_picocolors(), 1);
|
|
114965
115104
|
|
|
114966
115105
|
// src/commands/watch/phases/implementation-runner.ts
|
|
@@ -115479,7 +115618,7 @@ function spawnAndCollect3(command, args) {
|
|
|
115479
115618
|
|
|
115480
115619
|
// src/commands/watch/phases/issue-processor.ts
|
|
115481
115620
|
import { mkdir as mkdir40, writeFile as writeFile39 } from "node:fs/promises";
|
|
115482
|
-
import { join as
|
|
115621
|
+
import { join as join156 } from "node:path";
|
|
115483
115622
|
|
|
115484
115623
|
// src/commands/watch/phases/approval-detector.ts
|
|
115485
115624
|
init_logger();
|
|
@@ -115857,9 +115996,9 @@ async function checkAwaitingApproval(state, setup, options2, watchLog, projectDi
|
|
|
115857
115996
|
|
|
115858
115997
|
// src/commands/watch/phases/plan-dir-finder.ts
|
|
115859
115998
|
import { readdir as readdir46, stat as stat24 } from "node:fs/promises";
|
|
115860
|
-
import { join as
|
|
115999
|
+
import { join as join155 } from "node:path";
|
|
115861
116000
|
async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
115862
|
-
const plansRoot =
|
|
116001
|
+
const plansRoot = join155(cwd2, "plans");
|
|
115863
116002
|
try {
|
|
115864
116003
|
const entries = await readdir46(plansRoot);
|
|
115865
116004
|
const tenMinAgo = Date.now() - 10 * 60 * 1000;
|
|
@@ -115868,14 +116007,14 @@ async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
|
115868
116007
|
for (const entry of entries) {
|
|
115869
116008
|
if (entry === "watch" || entry === "reports" || entry === "visuals")
|
|
115870
116009
|
continue;
|
|
115871
|
-
const dirPath =
|
|
116010
|
+
const dirPath = join155(plansRoot, entry);
|
|
115872
116011
|
const dirStat = await stat24(dirPath);
|
|
115873
116012
|
if (!dirStat.isDirectory())
|
|
115874
116013
|
continue;
|
|
115875
116014
|
if (dirStat.mtimeMs < tenMinAgo)
|
|
115876
116015
|
continue;
|
|
115877
116016
|
try {
|
|
115878
|
-
await stat24(
|
|
116017
|
+
await stat24(join155(dirPath, "plan.md"));
|
|
115879
116018
|
} catch {
|
|
115880
116019
|
continue;
|
|
115881
116020
|
}
|
|
@@ -116106,13 +116245,13 @@ async function handlePlanGeneration(issue, state, config, setup, options2, watch
|
|
|
116106
116245
|
stats.plansCreated++;
|
|
116107
116246
|
const detectedPlanDir = await findRecentPlanDir(projectDir, issue.number, watchLog);
|
|
116108
116247
|
if (detectedPlanDir) {
|
|
116109
|
-
state.activeIssues[numStr].planPath =
|
|
116248
|
+
state.activeIssues[numStr].planPath = join156(detectedPlanDir, "plan.md");
|
|
116110
116249
|
watchLog.info(`Plan directory detected: ${detectedPlanDir}`);
|
|
116111
116250
|
} else {
|
|
116112
116251
|
try {
|
|
116113
|
-
const planDir =
|
|
116252
|
+
const planDir = join156(projectDir, "plans", "watch");
|
|
116114
116253
|
await mkdir40(planDir, { recursive: true });
|
|
116115
|
-
const planFilePath =
|
|
116254
|
+
const planFilePath = join156(planDir, `issue-${issue.number}-plan.md`);
|
|
116116
116255
|
await writeFile39(planFilePath, planResult.planText, "utf-8");
|
|
116117
116256
|
state.activeIssues[numStr].planPath = planFilePath;
|
|
116118
116257
|
watchLog.info(`Plan saved (fallback) to ${planFilePath}`);
|
|
@@ -116259,7 +116398,7 @@ init_file_io();
|
|
|
116259
116398
|
init_logger();
|
|
116260
116399
|
import { existsSync as existsSync74 } from "node:fs";
|
|
116261
116400
|
import { mkdir as mkdir41, readFile as readFile68 } from "node:fs/promises";
|
|
116262
|
-
import { dirname as
|
|
116401
|
+
import { dirname as dirname52 } from "node:path";
|
|
116263
116402
|
var PROCESSED_ISSUES_CAP = 500;
|
|
116264
116403
|
async function readCkJson(projectDir) {
|
|
116265
116404
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
@@ -116289,7 +116428,7 @@ async function loadWatchState(projectDir) {
|
|
|
116289
116428
|
}
|
|
116290
116429
|
async function saveWatchState(projectDir, state) {
|
|
116291
116430
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
116292
|
-
const configDir =
|
|
116431
|
+
const configDir = dirname52(configPath);
|
|
116293
116432
|
if (!existsSync74(configDir)) {
|
|
116294
116433
|
await mkdir41(configDir, { recursive: true });
|
|
116295
116434
|
}
|
|
@@ -116419,18 +116558,18 @@ init_logger();
|
|
|
116419
116558
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
116420
116559
|
import { existsSync as existsSync75 } from "node:fs";
|
|
116421
116560
|
import { readdir as readdir47, stat as stat25 } from "node:fs/promises";
|
|
116422
|
-
import { join as
|
|
116561
|
+
import { join as join157 } from "node:path";
|
|
116423
116562
|
async function scanForRepos(parentDir) {
|
|
116424
116563
|
const repos = [];
|
|
116425
116564
|
const entries = await readdir47(parentDir);
|
|
116426
116565
|
for (const entry of entries) {
|
|
116427
116566
|
if (entry.startsWith("."))
|
|
116428
116567
|
continue;
|
|
116429
|
-
const fullPath =
|
|
116568
|
+
const fullPath = join157(parentDir, entry);
|
|
116430
116569
|
const entryStat = await stat25(fullPath);
|
|
116431
116570
|
if (!entryStat.isDirectory())
|
|
116432
116571
|
continue;
|
|
116433
|
-
const gitDir =
|
|
116572
|
+
const gitDir = join157(fullPath, ".git");
|
|
116434
116573
|
if (!existsSync75(gitDir))
|
|
116435
116574
|
continue;
|
|
116436
116575
|
const result = spawnSync7("gh", ["repo", "view", "--json", "owner,name"], {
|
|
@@ -116457,7 +116596,7 @@ init_logger();
|
|
|
116457
116596
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
116458
116597
|
import { existsSync as existsSync76 } from "node:fs";
|
|
116459
116598
|
import { homedir as homedir53 } from "node:os";
|
|
116460
|
-
import { join as
|
|
116599
|
+
import { join as join158 } from "node:path";
|
|
116461
116600
|
async function validateSetup(cwd2) {
|
|
116462
116601
|
const workDir = cwd2 ?? process.cwd();
|
|
116463
116602
|
const ghVersion = spawnSync8("gh", ["--version"], { encoding: "utf-8", timeout: 1e4 });
|
|
@@ -116488,7 +116627,7 @@ Run this command from a directory with a GitHub remote.`);
|
|
|
116488
116627
|
} catch {
|
|
116489
116628
|
throw new Error(`Failed to parse repository info: ${ghRepo.stdout}`);
|
|
116490
116629
|
}
|
|
116491
|
-
const skillsPath =
|
|
116630
|
+
const skillsPath = join158(homedir53(), ".claude", "skills");
|
|
116492
116631
|
const skillsAvailable = existsSync76(skillsPath);
|
|
116493
116632
|
if (!skillsAvailable) {
|
|
116494
116633
|
logger.warning(`ClaudeKit Engineer skills not found at ${skillsPath}`);
|
|
@@ -116507,7 +116646,7 @@ init_path_resolver();
|
|
|
116507
116646
|
import { createWriteStream as createWriteStream3, statSync as statSync13 } from "node:fs";
|
|
116508
116647
|
import { existsSync as existsSync77 } from "node:fs";
|
|
116509
116648
|
import { mkdir as mkdir42, rename as rename15 } from "node:fs/promises";
|
|
116510
|
-
import { join as
|
|
116649
|
+
import { join as join159 } from "node:path";
|
|
116511
116650
|
|
|
116512
116651
|
class WatchLogger {
|
|
116513
116652
|
logStream = null;
|
|
@@ -116515,7 +116654,7 @@ class WatchLogger {
|
|
|
116515
116654
|
logPath = null;
|
|
116516
116655
|
maxBytes;
|
|
116517
116656
|
constructor(logDir, maxBytes = 0) {
|
|
116518
|
-
this.logDir = logDir ??
|
|
116657
|
+
this.logDir = logDir ?? join159(PathResolver.getClaudeKitDir(), "logs");
|
|
116519
116658
|
this.maxBytes = maxBytes;
|
|
116520
116659
|
}
|
|
116521
116660
|
async init() {
|
|
@@ -116524,7 +116663,7 @@ class WatchLogger {
|
|
|
116524
116663
|
await mkdir42(this.logDir, { recursive: true });
|
|
116525
116664
|
}
|
|
116526
116665
|
const dateStr = formatDate(new Date);
|
|
116527
|
-
this.logPath =
|
|
116666
|
+
this.logPath = join159(this.logDir, `watch-${dateStr}.log`);
|
|
116528
116667
|
this.logStream = createWriteStream3(this.logPath, { flags: "a", mode: 384 });
|
|
116529
116668
|
} catch (error) {
|
|
116530
116669
|
logger.warning(`Cannot create watch log file: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -116706,7 +116845,7 @@ async function watchCommand(options2) {
|
|
|
116706
116845
|
}
|
|
116707
116846
|
async function discoverRepos(options2, watchLog) {
|
|
116708
116847
|
const cwd2 = process.cwd();
|
|
116709
|
-
const isGitRepo = existsSync78(
|
|
116848
|
+
const isGitRepo = existsSync78(join160(cwd2, ".git"));
|
|
116710
116849
|
if (options2.force) {
|
|
116711
116850
|
await forceRemoveLock(watchLog);
|
|
116712
116851
|
}
|
|
@@ -116964,7 +117103,7 @@ function registerCommands(cli) {
|
|
|
116964
117103
|
init_package();
|
|
116965
117104
|
init_config_version_checker();
|
|
116966
117105
|
import { existsSync as existsSync90, readFileSync as readFileSync23 } from "node:fs";
|
|
116967
|
-
import { join as
|
|
117106
|
+
import { join as join172 } from "node:path";
|
|
116968
117107
|
|
|
116969
117108
|
// src/domains/versioning/version-checker.ts
|
|
116970
117109
|
init_version_utils();
|
|
@@ -116979,14 +117118,14 @@ init_logger();
|
|
|
116979
117118
|
init_path_resolver();
|
|
116980
117119
|
import { existsSync as existsSync89 } from "node:fs";
|
|
116981
117120
|
import { mkdir as mkdir43, readFile as readFile70, writeFile as writeFile42 } from "node:fs/promises";
|
|
116982
|
-
import { join as
|
|
117121
|
+
import { join as join171 } from "node:path";
|
|
116983
117122
|
|
|
116984
117123
|
class VersionCacheManager {
|
|
116985
117124
|
static CACHE_FILENAME = "version-check.json";
|
|
116986
117125
|
static CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
116987
117126
|
static getCacheFile() {
|
|
116988
117127
|
const cacheDir = PathResolver.getCacheDir(false);
|
|
116989
|
-
return
|
|
117128
|
+
return join171(cacheDir, VersionCacheManager.CACHE_FILENAME);
|
|
116990
117129
|
}
|
|
116991
117130
|
static async load() {
|
|
116992
117131
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
@@ -117297,9 +117436,9 @@ async function displayVersion() {
|
|
|
117297
117436
|
let localInstalledKits = [];
|
|
117298
117437
|
let globalInstalledKits = [];
|
|
117299
117438
|
const globalKitDir = PathResolver.getGlobalKitDir();
|
|
117300
|
-
const globalMetadataPath =
|
|
117439
|
+
const globalMetadataPath = join172(globalKitDir, "metadata.json");
|
|
117301
117440
|
const prefix = PathResolver.getPathPrefix(false);
|
|
117302
|
-
const localMetadataPath = prefix ?
|
|
117441
|
+
const localMetadataPath = prefix ? join172(process.cwd(), prefix, "metadata.json") : join172(process.cwd(), "metadata.json");
|
|
117303
117442
|
const isLocalSameAsGlobal = localMetadataPath === globalMetadataPath;
|
|
117304
117443
|
if (!isLocalSameAsGlobal && existsSync90(localMetadataPath)) {
|
|
117305
117444
|
try {
|
|
@@ -117687,7 +117826,7 @@ var output2 = new OutputManager2;
|
|
|
117687
117826
|
|
|
117688
117827
|
// src/shared/temp-cleanup.ts
|
|
117689
117828
|
init_logger();
|
|
117690
|
-
var
|
|
117829
|
+
var import_fs_extra44 = __toESM(require_lib(), 1);
|
|
117691
117830
|
import { rmSync as rmSync6 } from "node:fs";
|
|
117692
117831
|
var tempDirs2 = new Set;
|
|
117693
117832
|
async function cleanup() {
|
|
@@ -117696,7 +117835,7 @@ async function cleanup() {
|
|
|
117696
117835
|
logger.debug(`Cleaning up ${tempDirs2.size} temporary director(ies)...`);
|
|
117697
117836
|
for (const dir of tempDirs2) {
|
|
117698
117837
|
try {
|
|
117699
|
-
await
|
|
117838
|
+
await import_fs_extra44.remove(dir);
|
|
117700
117839
|
logger.debug(`Cleaned up temp directory: ${dir}`);
|
|
117701
117840
|
} catch (error) {
|
|
117702
117841
|
logger.debug(`Failed to clean temp directory ${dir}: ${error}`);
|