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