claudekit-cli 4.5.2-dev.2 → 4.5.2-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 +10 -2
- package/dist/index.js +856 -645
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -15560,6 +15560,128 @@ var init_types2 = __esm(() => {
|
|
|
15560
15560
|
});
|
|
15561
15561
|
});
|
|
15562
15562
|
|
|
15563
|
+
// node_modules/compare-versions/lib/umd/index.js
|
|
15564
|
+
var require_umd = __commonJS((exports, module) => {
|
|
15565
|
+
(function(global2, factory) {
|
|
15566
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2.compareVersions = {}));
|
|
15567
|
+
})(exports, function(exports2) {
|
|
15568
|
+
const semver = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
|
|
15569
|
+
const validateAndParse = (version) => {
|
|
15570
|
+
if (typeof version !== "string") {
|
|
15571
|
+
throw new TypeError("Invalid argument expected string");
|
|
15572
|
+
}
|
|
15573
|
+
const match = version.match(semver);
|
|
15574
|
+
if (!match) {
|
|
15575
|
+
throw new Error(`Invalid argument not valid semver ('${version}' received)`);
|
|
15576
|
+
}
|
|
15577
|
+
match.shift();
|
|
15578
|
+
return match;
|
|
15579
|
+
};
|
|
15580
|
+
const isWildcard = (s) => s === "*" || s === "x" || s === "X";
|
|
15581
|
+
const tryParse = (v2) => {
|
|
15582
|
+
const n = parseInt(v2, 10);
|
|
15583
|
+
return isNaN(n) ? v2 : n;
|
|
15584
|
+
};
|
|
15585
|
+
const forceType = (a3, b3) => typeof a3 !== typeof b3 ? [String(a3), String(b3)] : [a3, b3];
|
|
15586
|
+
const compareStrings = (a3, b3) => {
|
|
15587
|
+
if (isWildcard(a3) || isWildcard(b3))
|
|
15588
|
+
return 0;
|
|
15589
|
+
const [ap, bp] = forceType(tryParse(a3), tryParse(b3));
|
|
15590
|
+
if (ap > bp)
|
|
15591
|
+
return 1;
|
|
15592
|
+
if (ap < bp)
|
|
15593
|
+
return -1;
|
|
15594
|
+
return 0;
|
|
15595
|
+
};
|
|
15596
|
+
const compareSegments = (a3, b3) => {
|
|
15597
|
+
for (let i = 0;i < Math.max(a3.length, b3.length); i++) {
|
|
15598
|
+
const r2 = compareStrings(a3[i] || "0", b3[i] || "0");
|
|
15599
|
+
if (r2 !== 0)
|
|
15600
|
+
return r2;
|
|
15601
|
+
}
|
|
15602
|
+
return 0;
|
|
15603
|
+
};
|
|
15604
|
+
const compareVersions = (v1, v2) => {
|
|
15605
|
+
const n1 = validateAndParse(v1);
|
|
15606
|
+
const n2 = validateAndParse(v2);
|
|
15607
|
+
const p1 = n1.pop();
|
|
15608
|
+
const p2 = n2.pop();
|
|
15609
|
+
const r2 = compareSegments(n1, n2);
|
|
15610
|
+
if (r2 !== 0)
|
|
15611
|
+
return r2;
|
|
15612
|
+
if (p1 && p2) {
|
|
15613
|
+
return compareSegments(p1.split("."), p2.split("."));
|
|
15614
|
+
} else if (p1 || p2) {
|
|
15615
|
+
return p1 ? -1 : 1;
|
|
15616
|
+
}
|
|
15617
|
+
return 0;
|
|
15618
|
+
};
|
|
15619
|
+
const compare = (v1, v2, operator) => {
|
|
15620
|
+
assertValidOperator(operator);
|
|
15621
|
+
const res = compareVersions(v1, v2);
|
|
15622
|
+
return operatorResMap[operator].includes(res);
|
|
15623
|
+
};
|
|
15624
|
+
const operatorResMap = {
|
|
15625
|
+
">": [1],
|
|
15626
|
+
">=": [0, 1],
|
|
15627
|
+
"=": [0],
|
|
15628
|
+
"<=": [-1, 0],
|
|
15629
|
+
"<": [-1],
|
|
15630
|
+
"!=": [-1, 1]
|
|
15631
|
+
};
|
|
15632
|
+
const allowedOperators = Object.keys(operatorResMap);
|
|
15633
|
+
const assertValidOperator = (op) => {
|
|
15634
|
+
if (typeof op !== "string") {
|
|
15635
|
+
throw new TypeError(`Invalid operator type, expected string but got ${typeof op}`);
|
|
15636
|
+
}
|
|
15637
|
+
if (allowedOperators.indexOf(op) === -1) {
|
|
15638
|
+
throw new Error(`Invalid operator, expected one of ${allowedOperators.join("|")}`);
|
|
15639
|
+
}
|
|
15640
|
+
};
|
|
15641
|
+
const satisfies = (version, range) => {
|
|
15642
|
+
range = range.replace(/([><=]+)\s+/g, "$1");
|
|
15643
|
+
if (range.includes("||")) {
|
|
15644
|
+
return range.split("||").some((r5) => satisfies(version, r5));
|
|
15645
|
+
} else if (range.includes(" - ")) {
|
|
15646
|
+
const [a3, b3] = range.split(" - ", 2);
|
|
15647
|
+
return satisfies(version, `>=${a3} <=${b3}`);
|
|
15648
|
+
} else if (range.includes(" ")) {
|
|
15649
|
+
return range.trim().replace(/\s{2,}/g, " ").split(" ").every((r5) => satisfies(version, r5));
|
|
15650
|
+
}
|
|
15651
|
+
const m2 = range.match(/^([<>=~^]+)/);
|
|
15652
|
+
const op = m2 ? m2[1] : "=";
|
|
15653
|
+
if (op !== "^" && op !== "~")
|
|
15654
|
+
return compare(version, range, op);
|
|
15655
|
+
const [v1, v2, v3, , vp] = validateAndParse(version);
|
|
15656
|
+
const [r1, r2, r3, , rp] = validateAndParse(range);
|
|
15657
|
+
const v4 = [v1, v2, v3];
|
|
15658
|
+
const r4 = [r1, r2 !== null && r2 !== undefined ? r2 : "x", r3 !== null && r3 !== undefined ? r3 : "x"];
|
|
15659
|
+
if (rp) {
|
|
15660
|
+
if (!vp)
|
|
15661
|
+
return false;
|
|
15662
|
+
if (compareSegments(v4, r4) !== 0)
|
|
15663
|
+
return false;
|
|
15664
|
+
if (compareSegments(vp.split("."), rp.split(".")) === -1)
|
|
15665
|
+
return false;
|
|
15666
|
+
}
|
|
15667
|
+
const nonZero = r4.findIndex((v5) => v5 !== "0") + 1;
|
|
15668
|
+
const i = op === "~" ? 2 : nonZero > 1 ? nonZero : 1;
|
|
15669
|
+
if (compareSegments(v4.slice(0, i), r4.slice(0, i)) !== 0)
|
|
15670
|
+
return false;
|
|
15671
|
+
if (compareSegments(v4.slice(i), r4.slice(i)) === -1)
|
|
15672
|
+
return false;
|
|
15673
|
+
return true;
|
|
15674
|
+
};
|
|
15675
|
+
const validate = (version) => typeof version === "string" && /^[v\d]/.test(version) && semver.test(version);
|
|
15676
|
+
const validateStrict = (version) => typeof version === "string" && /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/.test(version);
|
|
15677
|
+
exports2.compare = compare;
|
|
15678
|
+
exports2.compareVersions = compareVersions;
|
|
15679
|
+
exports2.satisfies = satisfies;
|
|
15680
|
+
exports2.validate = validate;
|
|
15681
|
+
exports2.validateStrict = validateStrict;
|
|
15682
|
+
});
|
|
15683
|
+
});
|
|
15684
|
+
|
|
15563
15685
|
// src/domains/installation/plugin/install-mode-detector.ts
|
|
15564
15686
|
import { createHash as createHash4 } from "node:crypto";
|
|
15565
15687
|
import { existsSync as existsSync6, readFileSync as readFileSync3, readdirSync as readdirSync2, statSync as statSync2 } from "node:fs";
|
|
@@ -15605,7 +15727,7 @@ function detectPluginState(claudeDir) {
|
|
|
15605
15727
|
state.marketplace = state.marketplace ?? marketplace;
|
|
15606
15728
|
const versions = safeReaddir(ckDir).filter((v2) => isDir(join6(ckDir, v2)));
|
|
15607
15729
|
if (versions.length > 0 && state.version === null) {
|
|
15608
|
-
state.version = versions
|
|
15730
|
+
state.version = selectPluginCacheVersion(versions, ckDir);
|
|
15609
15731
|
}
|
|
15610
15732
|
if (!state.installed)
|
|
15611
15733
|
state.staleCache = true;
|
|
@@ -15615,6 +15737,24 @@ function detectPluginState(claudeDir) {
|
|
|
15615
15737
|
}
|
|
15616
15738
|
return state;
|
|
15617
15739
|
}
|
|
15740
|
+
function selectPluginCacheVersion(versions, ckDir) {
|
|
15741
|
+
const comparable = versions.filter(isComparableSemver);
|
|
15742
|
+
if (comparable.length > 0) {
|
|
15743
|
+
return comparable.sort((a3, b3) => import_compare_versions.compareVersions(normalizeVersion(b3), normalizeVersion(a3)))[0];
|
|
15744
|
+
}
|
|
15745
|
+
return versions.map((v2) => ({ v: v2, mtime: statMtime(join6(ckDir, v2)) })).sort((a3, b3) => b3.mtime - a3.mtime)[0].v;
|
|
15746
|
+
}
|
|
15747
|
+
function isComparableSemver(version) {
|
|
15748
|
+
try {
|
|
15749
|
+
import_compare_versions.compareVersions(normalizeVersion(version), normalizeVersion(version));
|
|
15750
|
+
return true;
|
|
15751
|
+
} catch {
|
|
15752
|
+
return false;
|
|
15753
|
+
}
|
|
15754
|
+
}
|
|
15755
|
+
function normalizeVersion(version) {
|
|
15756
|
+
return version.replace(/^v/, "");
|
|
15757
|
+
}
|
|
15618
15758
|
function detectLegacyState(claudeDir) {
|
|
15619
15759
|
const metadata = readJsonSafe(join6(claudeDir, "metadata.json"));
|
|
15620
15760
|
if (!isRecord(metadata))
|
|
@@ -15773,9 +15913,10 @@ function statMtime(p) {
|
|
|
15773
15913
|
return 0;
|
|
15774
15914
|
}
|
|
15775
15915
|
}
|
|
15776
|
-
var CK_PLUGIN_NAME = "ck", CK_MARKETPLACE_NAME = "claudekit", ENGINEER_KIT_KEY = "engineer", PLUGIN_SUPPLIED_LEGACY_PREFIXES;
|
|
15916
|
+
var import_compare_versions, CK_PLUGIN_NAME = "ck", CK_MARKETPLACE_NAME = "claudekit", ENGINEER_KIT_KEY = "engineer", PLUGIN_SUPPLIED_LEGACY_PREFIXES;
|
|
15777
15917
|
var init_install_mode_detector = __esm(() => {
|
|
15778
15918
|
init_path_resolver();
|
|
15919
|
+
import_compare_versions = __toESM(require_umd(), 1);
|
|
15779
15920
|
PLUGIN_SUPPLIED_LEGACY_PREFIXES = ["agents/", "skills/"];
|
|
15780
15921
|
});
|
|
15781
15922
|
|
|
@@ -15857,7 +15998,7 @@ var init_kit = __esm(() => {
|
|
|
15857
15998
|
});
|
|
15858
15999
|
|
|
15859
16000
|
// src/types/commands.ts
|
|
15860
|
-
var GlobalOutputOptionsSchema, ExcludePatternSchema, FoldersConfigSchema, DEFAULT_FOLDERS, NewCommandOptionsSchema, UpdateCommandOptionsSchema, VersionCommandOptionsSchema, UninstallCommandOptionsSchema, UpdateCliOptionsSchema, DoctorCommandOptionsSchema, SetupCommandOptionsSchema;
|
|
16001
|
+
var GlobalOutputOptionsSchema, ExcludePatternSchema, FoldersConfigSchema, DEFAULT_FOLDERS, SkillsPackageManagerSchema, NewCommandOptionsSchema, UpdateCommandOptionsSchema, VersionCommandOptionsSchema, UninstallCommandOptionsSchema, UpdateCliOptionsSchema, DoctorCommandOptionsSchema, SetupCommandOptionsSchema;
|
|
15861
16002
|
var init_commands = __esm(() => {
|
|
15862
16003
|
init_zod();
|
|
15863
16004
|
init_kit();
|
|
@@ -15874,6 +16015,7 @@ var init_commands = __esm(() => {
|
|
|
15874
16015
|
docs: "docs",
|
|
15875
16016
|
plans: "plans"
|
|
15876
16017
|
};
|
|
16018
|
+
SkillsPackageManagerSchema = exports_external.enum(["auto", "npm", "bun", "pnpm", "yarn"]).default("auto");
|
|
15877
16019
|
NewCommandOptionsSchema = exports_external.object({
|
|
15878
16020
|
dir: exports_external.string().default("."),
|
|
15879
16021
|
kit: exports_external.string().optional(),
|
|
@@ -15883,6 +16025,7 @@ var init_commands = __esm(() => {
|
|
|
15883
16025
|
opencode: exports_external.boolean().default(false),
|
|
15884
16026
|
gemini: exports_external.boolean().default(false),
|
|
15885
16027
|
installSkills: exports_external.boolean().default(false),
|
|
16028
|
+
packageManager: SkillsPackageManagerSchema,
|
|
15886
16029
|
withSudo: exports_external.boolean().default(false),
|
|
15887
16030
|
prefix: exports_external.boolean().default(false),
|
|
15888
16031
|
beta: exports_external.boolean().default(false),
|
|
@@ -15905,6 +16048,7 @@ var init_commands = __esm(() => {
|
|
|
15905
16048
|
fresh: exports_external.boolean().default(false),
|
|
15906
16049
|
force: exports_external.boolean().default(false),
|
|
15907
16050
|
installSkills: exports_external.boolean().default(false),
|
|
16051
|
+
packageManager: SkillsPackageManagerSchema,
|
|
15908
16052
|
withSudo: exports_external.boolean().default(false),
|
|
15909
16053
|
prefix: exports_external.boolean().default(false),
|
|
15910
16054
|
beta: exports_external.boolean().default(false),
|
|
@@ -16664,6 +16808,7 @@ __export(exports_types, {
|
|
|
16664
16808
|
StatuslineSectionConfigSchema: () => StatuslineSectionConfigSchema,
|
|
16665
16809
|
StatuslineModeSchema: () => StatuslineModeSchema,
|
|
16666
16810
|
StatuslineLayoutSchema: () => StatuslineLayoutSchema,
|
|
16811
|
+
SkillsPackageManagerSchema: () => SkillsPackageManagerSchema,
|
|
16667
16812
|
SkillsMigrationError: () => SkillsMigrationError,
|
|
16668
16813
|
SkillsManifestSchema: () => SkillsManifestSchema,
|
|
16669
16814
|
ServicesListSchema: () => ServicesListSchema,
|
|
@@ -64591,7 +64736,7 @@ var package_default;
|
|
|
64591
64736
|
var init_package = __esm(() => {
|
|
64592
64737
|
package_default = {
|
|
64593
64738
|
name: "claudekit-cli",
|
|
64594
|
-
version: "4.5.2-dev.
|
|
64739
|
+
version: "4.5.2-dev.4",
|
|
64595
64740
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
64596
64741
|
type: "module",
|
|
64597
64742
|
repository: {
|
|
@@ -64713,142 +64858,20 @@ var init_package = __esm(() => {
|
|
|
64713
64858
|
};
|
|
64714
64859
|
});
|
|
64715
64860
|
|
|
64716
|
-
// node_modules/compare-versions/lib/umd/index.js
|
|
64717
|
-
var require_umd = __commonJS((exports, module) => {
|
|
64718
|
-
(function(global3, factory) {
|
|
64719
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports) : typeof define === "function" && define.amd ? define(["exports"], factory) : (global3 = typeof globalThis !== "undefined" ? globalThis : global3 || self, factory(global3.compareVersions = {}));
|
|
64720
|
-
})(exports, function(exports2) {
|
|
64721
|
-
const semver3 = /^[v^~<>=]*?(\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+)(?:\.([x*]|\d+))?(?:-([\da-z\-]+(?:\.[\da-z\-]+)*))?(?:\+[\da-z\-]+(?:\.[\da-z\-]+)*)?)?)?$/i;
|
|
64722
|
-
const validateAndParse = (version) => {
|
|
64723
|
-
if (typeof version !== "string") {
|
|
64724
|
-
throw new TypeError("Invalid argument expected string");
|
|
64725
|
-
}
|
|
64726
|
-
const match = version.match(semver3);
|
|
64727
|
-
if (!match) {
|
|
64728
|
-
throw new Error(`Invalid argument not valid semver ('${version}' received)`);
|
|
64729
|
-
}
|
|
64730
|
-
match.shift();
|
|
64731
|
-
return match;
|
|
64732
|
-
};
|
|
64733
|
-
const isWildcard = (s) => s === "*" || s === "x" || s === "X";
|
|
64734
|
-
const tryParse = (v2) => {
|
|
64735
|
-
const n = parseInt(v2, 10);
|
|
64736
|
-
return isNaN(n) ? v2 : n;
|
|
64737
|
-
};
|
|
64738
|
-
const forceType = (a3, b3) => typeof a3 !== typeof b3 ? [String(a3), String(b3)] : [a3, b3];
|
|
64739
|
-
const compareStrings = (a3, b3) => {
|
|
64740
|
-
if (isWildcard(a3) || isWildcard(b3))
|
|
64741
|
-
return 0;
|
|
64742
|
-
const [ap, bp] = forceType(tryParse(a3), tryParse(b3));
|
|
64743
|
-
if (ap > bp)
|
|
64744
|
-
return 1;
|
|
64745
|
-
if (ap < bp)
|
|
64746
|
-
return -1;
|
|
64747
|
-
return 0;
|
|
64748
|
-
};
|
|
64749
|
-
const compareSegments = (a3, b3) => {
|
|
64750
|
-
for (let i = 0;i < Math.max(a3.length, b3.length); i++) {
|
|
64751
|
-
const r2 = compareStrings(a3[i] || "0", b3[i] || "0");
|
|
64752
|
-
if (r2 !== 0)
|
|
64753
|
-
return r2;
|
|
64754
|
-
}
|
|
64755
|
-
return 0;
|
|
64756
|
-
};
|
|
64757
|
-
const compareVersions = (v1, v2) => {
|
|
64758
|
-
const n1 = validateAndParse(v1);
|
|
64759
|
-
const n2 = validateAndParse(v2);
|
|
64760
|
-
const p1 = n1.pop();
|
|
64761
|
-
const p2 = n2.pop();
|
|
64762
|
-
const r2 = compareSegments(n1, n2);
|
|
64763
|
-
if (r2 !== 0)
|
|
64764
|
-
return r2;
|
|
64765
|
-
if (p1 && p2) {
|
|
64766
|
-
return compareSegments(p1.split("."), p2.split("."));
|
|
64767
|
-
} else if (p1 || p2) {
|
|
64768
|
-
return p1 ? -1 : 1;
|
|
64769
|
-
}
|
|
64770
|
-
return 0;
|
|
64771
|
-
};
|
|
64772
|
-
const compare = (v1, v2, operator) => {
|
|
64773
|
-
assertValidOperator(operator);
|
|
64774
|
-
const res = compareVersions(v1, v2);
|
|
64775
|
-
return operatorResMap[operator].includes(res);
|
|
64776
|
-
};
|
|
64777
|
-
const operatorResMap = {
|
|
64778
|
-
">": [1],
|
|
64779
|
-
">=": [0, 1],
|
|
64780
|
-
"=": [0],
|
|
64781
|
-
"<=": [-1, 0],
|
|
64782
|
-
"<": [-1],
|
|
64783
|
-
"!=": [-1, 1]
|
|
64784
|
-
};
|
|
64785
|
-
const allowedOperators = Object.keys(operatorResMap);
|
|
64786
|
-
const assertValidOperator = (op) => {
|
|
64787
|
-
if (typeof op !== "string") {
|
|
64788
|
-
throw new TypeError(`Invalid operator type, expected string but got ${typeof op}`);
|
|
64789
|
-
}
|
|
64790
|
-
if (allowedOperators.indexOf(op) === -1) {
|
|
64791
|
-
throw new Error(`Invalid operator, expected one of ${allowedOperators.join("|")}`);
|
|
64792
|
-
}
|
|
64793
|
-
};
|
|
64794
|
-
const satisfies = (version, range) => {
|
|
64795
|
-
range = range.replace(/([><=]+)\s+/g, "$1");
|
|
64796
|
-
if (range.includes("||")) {
|
|
64797
|
-
return range.split("||").some((r5) => satisfies(version, r5));
|
|
64798
|
-
} else if (range.includes(" - ")) {
|
|
64799
|
-
const [a3, b3] = range.split(" - ", 2);
|
|
64800
|
-
return satisfies(version, `>=${a3} <=${b3}`);
|
|
64801
|
-
} else if (range.includes(" ")) {
|
|
64802
|
-
return range.trim().replace(/\s{2,}/g, " ").split(" ").every((r5) => satisfies(version, r5));
|
|
64803
|
-
}
|
|
64804
|
-
const m2 = range.match(/^([<>=~^]+)/);
|
|
64805
|
-
const op = m2 ? m2[1] : "=";
|
|
64806
|
-
if (op !== "^" && op !== "~")
|
|
64807
|
-
return compare(version, range, op);
|
|
64808
|
-
const [v1, v2, v3, , vp] = validateAndParse(version);
|
|
64809
|
-
const [r1, r2, r3, , rp] = validateAndParse(range);
|
|
64810
|
-
const v4 = [v1, v2, v3];
|
|
64811
|
-
const r4 = [r1, r2 !== null && r2 !== undefined ? r2 : "x", r3 !== null && r3 !== undefined ? r3 : "x"];
|
|
64812
|
-
if (rp) {
|
|
64813
|
-
if (!vp)
|
|
64814
|
-
return false;
|
|
64815
|
-
if (compareSegments(v4, r4) !== 0)
|
|
64816
|
-
return false;
|
|
64817
|
-
if (compareSegments(vp.split("."), rp.split(".")) === -1)
|
|
64818
|
-
return false;
|
|
64819
|
-
}
|
|
64820
|
-
const nonZero = r4.findIndex((v5) => v5 !== "0") + 1;
|
|
64821
|
-
const i = op === "~" ? 2 : nonZero > 1 ? nonZero : 1;
|
|
64822
|
-
if (compareSegments(v4.slice(0, i), r4.slice(0, i)) !== 0)
|
|
64823
|
-
return false;
|
|
64824
|
-
if (compareSegments(v4.slice(i), r4.slice(i)) === -1)
|
|
64825
|
-
return false;
|
|
64826
|
-
return true;
|
|
64827
|
-
};
|
|
64828
|
-
const validate2 = (version) => typeof version === "string" && /^[v\d]/.test(version) && semver3.test(version);
|
|
64829
|
-
const validateStrict = (version) => typeof version === "string" && /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$/.test(version);
|
|
64830
|
-
exports2.compare = compare;
|
|
64831
|
-
exports2.compareVersions = compareVersions;
|
|
64832
|
-
exports2.satisfies = satisfies;
|
|
64833
|
-
exports2.validate = validate2;
|
|
64834
|
-
exports2.validateStrict = validateStrict;
|
|
64835
|
-
});
|
|
64836
|
-
});
|
|
64837
|
-
|
|
64838
64861
|
// src/domains/versioning/checking/version-utils.ts
|
|
64839
64862
|
function isUpdateCheckDisabled() {
|
|
64840
64863
|
return process.env.NO_UPDATE_NOTIFIER === "1" || process.env.NO_UPDATE_NOTIFIER === "true" || !process.stdout.isTTY;
|
|
64841
64864
|
}
|
|
64842
|
-
function
|
|
64865
|
+
function normalizeVersion2(version) {
|
|
64843
64866
|
return version.replace(/^v/i, "");
|
|
64844
64867
|
}
|
|
64845
64868
|
function isPrereleaseVersion(version) {
|
|
64846
64869
|
if (!version)
|
|
64847
64870
|
return false;
|
|
64848
|
-
return /-(beta|alpha|rc|dev)[.\d]/i.test(
|
|
64871
|
+
return /-(beta|alpha|rc|dev)[.\d]/i.test(normalizeVersion2(version));
|
|
64849
64872
|
}
|
|
64850
64873
|
function parseVersionParts(version) {
|
|
64851
|
-
const normalized =
|
|
64874
|
+
const normalized = normalizeVersion2(version);
|
|
64852
64875
|
const [base, ...prereleaseParts] = normalized.split("-");
|
|
64853
64876
|
return {
|
|
64854
64877
|
base,
|
|
@@ -64865,23 +64888,23 @@ function isPrereleaseOfSameBase(currentVersion, latestVersion) {
|
|
|
64865
64888
|
return current.base === latest.base;
|
|
64866
64889
|
}
|
|
64867
64890
|
function versionsMatch(installed, latest) {
|
|
64868
|
-
return
|
|
64891
|
+
return normalizeVersion2(installed) === normalizeVersion2(latest);
|
|
64869
64892
|
}
|
|
64870
64893
|
function isNewerVersion(currentVersion, latestVersion) {
|
|
64871
64894
|
try {
|
|
64872
|
-
const current =
|
|
64873
|
-
const latest =
|
|
64895
|
+
const current = normalizeVersion2(currentVersion);
|
|
64896
|
+
const latest = normalizeVersion2(latestVersion);
|
|
64874
64897
|
if (isPrereleaseOfSameBase(current, latest)) {
|
|
64875
64898
|
return false;
|
|
64876
64899
|
}
|
|
64877
|
-
return
|
|
64900
|
+
return import_compare_versions2.compareVersions(latest, current) > 0;
|
|
64878
64901
|
} catch {
|
|
64879
64902
|
return false;
|
|
64880
64903
|
}
|
|
64881
64904
|
}
|
|
64882
|
-
var
|
|
64905
|
+
var import_compare_versions2;
|
|
64883
64906
|
var init_version_utils = __esm(() => {
|
|
64884
|
-
|
|
64907
|
+
import_compare_versions2 = __toESM(require_umd(), 1);
|
|
64885
64908
|
});
|
|
64886
64909
|
|
|
64887
64910
|
// src/commands/update/error.ts
|
|
@@ -64965,7 +64988,7 @@ var init_registry_client = __esm(() => {
|
|
|
64965
64988
|
|
|
64966
64989
|
// src/commands/update/version-comparator.ts
|
|
64967
64990
|
function compareCliVersions(currentVersion, targetVersion, opts) {
|
|
64968
|
-
const comparison =
|
|
64991
|
+
const comparison = import_compare_versions3.compareVersions(currentVersion, targetVersion);
|
|
64969
64992
|
if (comparison === 0) {
|
|
64970
64993
|
return { status: "up-to-date" };
|
|
64971
64994
|
}
|
|
@@ -64987,10 +65010,10 @@ function parseCliVersionFromOutput(output2) {
|
|
|
64987
65010
|
const match = output2.match(/CLI Version:\s*(\S+)/);
|
|
64988
65011
|
return match ? match[1] : null;
|
|
64989
65012
|
}
|
|
64990
|
-
var
|
|
65013
|
+
var import_compare_versions3;
|
|
64991
65014
|
var init_version_comparator = __esm(() => {
|
|
64992
65015
|
init_version_utils();
|
|
64993
|
-
|
|
65016
|
+
import_compare_versions3 = __toESM(require_umd(), 1);
|
|
64994
65017
|
});
|
|
64995
65018
|
|
|
64996
65019
|
// src/commands/update/package-manager-runner.ts
|
|
@@ -68254,7 +68277,7 @@ class VersionFormatter {
|
|
|
68254
68277
|
static compare(v1, v2) {
|
|
68255
68278
|
const normV1 = VersionFormatter.normalize(v1);
|
|
68256
68279
|
const normV2 = VersionFormatter.normalize(v2);
|
|
68257
|
-
return
|
|
68280
|
+
return import_compare_versions4.compareVersions(normV1, normV2);
|
|
68258
68281
|
}
|
|
68259
68282
|
static formatRelativeTime(dateString) {
|
|
68260
68283
|
if (!dateString)
|
|
@@ -68342,20 +68365,20 @@ class VersionFormatter {
|
|
|
68342
68365
|
const majorA = Number.parseInt(normA.split(".")[0], 10);
|
|
68343
68366
|
const majorB = Number.parseInt(normB.split(".")[0], 10);
|
|
68344
68367
|
if (majorA === 0 && majorB === 0) {
|
|
68345
|
-
return
|
|
68368
|
+
return import_compare_versions4.compareVersions(normB, normA);
|
|
68346
68369
|
}
|
|
68347
68370
|
if (majorA === 0)
|
|
68348
68371
|
return 1;
|
|
68349
68372
|
if (majorB === 0)
|
|
68350
68373
|
return -1;
|
|
68351
|
-
return
|
|
68374
|
+
return import_compare_versions4.compareVersions(normB, normA);
|
|
68352
68375
|
});
|
|
68353
68376
|
}
|
|
68354
68377
|
}
|
|
68355
|
-
var
|
|
68378
|
+
var import_compare_versions4;
|
|
68356
68379
|
var init_version_formatter = __esm(() => {
|
|
68357
68380
|
init_logger();
|
|
68358
|
-
|
|
68381
|
+
import_compare_versions4 = __toESM(require_umd(), 1);
|
|
68359
68382
|
});
|
|
68360
68383
|
|
|
68361
68384
|
// src/domains/versioning/release-filter.ts
|
|
@@ -69026,12 +69049,23 @@ function buildInitArgs(options2) {
|
|
|
69026
69049
|
args.push("--install-mode", options2.installMode);
|
|
69027
69050
|
}
|
|
69028
69051
|
args.push("--install-skills");
|
|
69052
|
+
if (options2.packageManager && options2.packageManager !== "auto") {
|
|
69053
|
+
args.push("--package-manager", options2.packageManager);
|
|
69054
|
+
}
|
|
69029
69055
|
if (options2.beta)
|
|
69030
69056
|
args.push("--beta");
|
|
69031
69057
|
return args;
|
|
69032
69058
|
}
|
|
69033
|
-
function buildInitCommand(isGlobal, kit, beta, yes, restoreCkHooks, installMode) {
|
|
69034
|
-
return `ck ${buildInitArgs({
|
|
69059
|
+
function buildInitCommand(isGlobal, kit, beta, yes, restoreCkHooks, installMode, packageManager) {
|
|
69060
|
+
return `ck ${buildInitArgs({
|
|
69061
|
+
isGlobal,
|
|
69062
|
+
kit,
|
|
69063
|
+
beta,
|
|
69064
|
+
yes,
|
|
69065
|
+
restoreCkHooks,
|
|
69066
|
+
installMode,
|
|
69067
|
+
packageManager
|
|
69068
|
+
}).join(" ")}`;
|
|
69035
69069
|
}
|
|
69036
69070
|
function resolveCkExecutable(platformName = process.platform) {
|
|
69037
69071
|
return platformName === "win32" ? "ck.cmd" : "ck";
|
|
@@ -69110,6 +69144,7 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
69110
69144
|
const findMissingHookDepsFn = deps?.findMissingHookDependenciesFn ?? findMissingHookDependencies;
|
|
69111
69145
|
const detectInstallModeFn = deps?.detectInstallModeFn ?? detectInstallMode;
|
|
69112
69146
|
const hasTrackedPluginSuppliedLegacyFilesFn = deps?.hasTrackedPluginSuppliedLegacyFilesFn ?? hasTrackedPluginSuppliedLegacyFiles;
|
|
69147
|
+
const skillsPackageManager = deps?.skillsPackageManager;
|
|
69113
69148
|
const shouldRefreshCodexPluginFn = deps?.shouldRefreshCodexPluginFn ?? ((options2) => shouldRefreshCodexPlugin(undefined, options2));
|
|
69114
69149
|
const cleanupStaleCodexConfigEntriesFn = deps?.cleanupStaleCodexConfigEntriesFn ?? cleanupStaleCodexConfigEntries;
|
|
69115
69150
|
const setup = await getSetupFn();
|
|
@@ -69290,7 +69325,8 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
69290
69325
|
beta: useBeta,
|
|
69291
69326
|
yes: true,
|
|
69292
69327
|
restoreCkHooks: forceKitReinstall,
|
|
69293
|
-
installMode: installModePreference
|
|
69328
|
+
installMode: installModePreference,
|
|
69329
|
+
packageManager: skillsPackageManager
|
|
69294
69330
|
});
|
|
69295
69331
|
logger.info(`Running: ck ${args.join(" ")}`);
|
|
69296
69332
|
const s = (deps?.spinnerFn ?? de)();
|
|
@@ -69334,7 +69370,8 @@ async function promptKitUpdate(beta, yes, deps) {
|
|
|
69334
69370
|
kit: selection.kit,
|
|
69335
69371
|
beta: useBeta,
|
|
69336
69372
|
restoreCkHooks: forceKitReinstall,
|
|
69337
|
-
installMode: installModePreference
|
|
69373
|
+
installMode: installModePreference,
|
|
69374
|
+
packageManager: skillsPackageManager
|
|
69338
69375
|
});
|
|
69339
69376
|
const displayCmd = `ck ${args.join(" ")}`;
|
|
69340
69377
|
logger.info(`Running: ${displayCmd}`);
|
|
@@ -69580,16 +69617,18 @@ async function updateCliCommand(options2, deps = getDefaultUpdateCliCommandDeps(
|
|
|
69580
69617
|
registryUrl,
|
|
69581
69618
|
spinnerStop: (msg) => s.stop(msg)
|
|
69582
69619
|
});
|
|
69620
|
+
const skillsPackageManager = pm === "unknown" ? "auto" : pm;
|
|
69621
|
+
const promptKitUpdateWithPackageManager = () => promptKitUpdateFn(targetIsPrerelease, opts.yes, { skillsPackageManager });
|
|
69583
69622
|
const outcome = compareCliVersions(currentVersion, targetVersion, opts);
|
|
69584
69623
|
if (outcome.status === "up-to-date") {
|
|
69585
69624
|
outro(`[+] Already on the latest CLI version (${currentVersion})`);
|
|
69586
|
-
await
|
|
69625
|
+
await promptKitUpdateWithPackageManager();
|
|
69587
69626
|
await promptMigrateUpdateFn();
|
|
69588
69627
|
return;
|
|
69589
69628
|
}
|
|
69590
69629
|
if (outcome.status === "newer") {
|
|
69591
69630
|
outro(`[+] Current version (${currentVersion}) is newer than latest (${targetVersion})`);
|
|
69592
|
-
await
|
|
69631
|
+
await promptKitUpdateWithPackageManager();
|
|
69593
69632
|
await promptMigrateUpdateFn();
|
|
69594
69633
|
return;
|
|
69595
69634
|
}
|
|
@@ -69600,7 +69639,7 @@ async function updateCliCommand(options2, deps = getDefaultUpdateCliCommandDeps(
|
|
|
69600
69639
|
note(`CLI update available: ${currentVersion} -> ${targetVersion}
|
|
69601
69640
|
|
|
69602
69641
|
Run 'ck update' to install`, "Update Check");
|
|
69603
|
-
await
|
|
69642
|
+
await promptKitUpdateWithPackageManager();
|
|
69604
69643
|
await promptMigrateUpdateFn();
|
|
69605
69644
|
outro("Check complete");
|
|
69606
69645
|
return;
|
|
@@ -69627,7 +69666,7 @@ Run 'ck update' to install`, "Update Check");
|
|
|
69627
69666
|
spinnerStop: (msg) => s.stop(msg)
|
|
69628
69667
|
});
|
|
69629
69668
|
outro(`[+] Successfully updated ClaudeKit CLI to ${activeVersion}`);
|
|
69630
|
-
await
|
|
69669
|
+
await promptKitUpdateWithPackageManager();
|
|
69631
69670
|
await promptMigrateUpdateFn();
|
|
69632
69671
|
} catch (error) {
|
|
69633
69672
|
if (error instanceof CliUpdateError) {
|
|
@@ -69700,7 +69739,7 @@ class ConfigVersionChecker {
|
|
|
69700
69739
|
return isPrereleaseVersion(currentVersion) ? "beta" : "stable";
|
|
69701
69740
|
}
|
|
69702
69741
|
static isValidSemverCore(version) {
|
|
69703
|
-
const [coreVersion] =
|
|
69742
|
+
const [coreVersion] = normalizeVersion2(version).split(/[-+]/, 1);
|
|
69704
69743
|
const coreParts = coreVersion?.split(".") ?? [];
|
|
69705
69744
|
return coreParts.length === 3 && coreParts.every((part) => /^\d+$/.test(part));
|
|
69706
69745
|
}
|
|
@@ -69711,12 +69750,12 @@ class ConfigVersionChecker {
|
|
|
69711
69750
|
if (!tagName || tagName.length > 256) {
|
|
69712
69751
|
continue;
|
|
69713
69752
|
}
|
|
69714
|
-
const normalizedVersion =
|
|
69753
|
+
const normalizedVersion = normalizeVersion2(tagName);
|
|
69715
69754
|
if (!ConfigVersionChecker.isValidSemverCore(normalizedVersion)) {
|
|
69716
69755
|
logger.debug(`Invalid version format from GitHub: ${tagName}`);
|
|
69717
69756
|
continue;
|
|
69718
69757
|
}
|
|
69719
|
-
if (!highestVersion ||
|
|
69758
|
+
if (!highestVersion || import_compare_versions5.compareVersions(normalizedVersion, highestVersion) > 0) {
|
|
69720
69759
|
highestVersion = normalizedVersion;
|
|
69721
69760
|
}
|
|
69722
69761
|
}
|
|
@@ -69829,7 +69868,7 @@ class ConfigVersionChecker {
|
|
|
69829
69868
|
return null;
|
|
69830
69869
|
}
|
|
69831
69870
|
static async checkForUpdates(kitType, currentVersion, global3 = false, channel) {
|
|
69832
|
-
const normalizedCurrent =
|
|
69871
|
+
const normalizedCurrent = normalizeVersion2(currentVersion);
|
|
69833
69872
|
const resolvedChannel = ConfigVersionChecker.resolveChannel(normalizedCurrent, channel);
|
|
69834
69873
|
const cache3 = await ConfigVersionChecker.loadCache(kitType, global3, resolvedChannel);
|
|
69835
69874
|
const now = Date.now();
|
|
@@ -69904,13 +69943,13 @@ class ConfigVersionChecker {
|
|
|
69904
69943
|
}
|
|
69905
69944
|
}
|
|
69906
69945
|
}
|
|
69907
|
-
var
|
|
69946
|
+
var import_compare_versions5, CACHE_TTL_HOURS = 24, DEFAULT_CACHE_TTL_MS, MIN_CACHE_TTL_MS, MAX_CACHE_TTL_MS, CACHE_TTL_MS, GITHUB_API_TIMEOUT_MS = 1e4, CACHE_FILENAME = "config-update-cache.json", RELEASES_PER_PAGE = 100, KIT_REPOS;
|
|
69908
69947
|
var init_config_version_checker = __esm(() => {
|
|
69909
69948
|
init_version_utils();
|
|
69910
69949
|
init_claudekit_constants();
|
|
69911
69950
|
init_logger();
|
|
69912
69951
|
init_path_resolver();
|
|
69913
|
-
|
|
69952
|
+
import_compare_versions5 = __toESM(require_umd(), 1);
|
|
69914
69953
|
DEFAULT_CACHE_TTL_MS = CACHE_TTL_HOURS * 60 * 60 * 1000;
|
|
69915
69954
|
MIN_CACHE_TTL_MS = 60 * 1000;
|
|
69916
69955
|
MAX_CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
@@ -69958,7 +69997,7 @@ function hasCliUpdate(currentVersion, latestVersion) {
|
|
|
69958
69997
|
return false;
|
|
69959
69998
|
}
|
|
69960
69999
|
try {
|
|
69961
|
-
return
|
|
70000
|
+
return import_compare_versions6.compareVersions(normalizeVersion2(latestVersion), normalizeVersion2(currentVersion)) > 0;
|
|
69962
70001
|
} catch (error) {
|
|
69963
70002
|
logger.debug(`Version comparison failed for "${currentVersion}" vs "${latestVersion}": ${error}`);
|
|
69964
70003
|
return latestVersion !== currentVersion;
|
|
@@ -70229,7 +70268,7 @@ async function getKitMetadata2(kitName) {
|
|
|
70229
70268
|
return null;
|
|
70230
70269
|
}
|
|
70231
70270
|
}
|
|
70232
|
-
var
|
|
70271
|
+
var import_compare_versions6, versionCache, CACHE_TTL_MS2;
|
|
70233
70272
|
var init_system_routes = __esm(() => {
|
|
70234
70273
|
init_update_cli();
|
|
70235
70274
|
init_github_client();
|
|
@@ -70242,7 +70281,7 @@ var init_system_routes = __esm(() => {
|
|
|
70242
70281
|
init_path_resolver();
|
|
70243
70282
|
init_kit();
|
|
70244
70283
|
init_package();
|
|
70245
|
-
|
|
70284
|
+
import_compare_versions6 = __toESM(require_umd(), 1);
|
|
70246
70285
|
versionCache = new Map;
|
|
70247
70286
|
CACHE_TTL_MS2 = 5 * 60 * 1000;
|
|
70248
70287
|
});
|
|
@@ -75762,11 +75801,88 @@ var init_install_error_handler = __esm(() => {
|
|
|
75762
75801
|
];
|
|
75763
75802
|
});
|
|
75764
75803
|
|
|
75765
|
-
// src/services/package-installer/skills-
|
|
75804
|
+
// src/services/package-installer/skills-package-manager.ts
|
|
75805
|
+
import { existsSync as existsSync64 } from "node:fs";
|
|
75806
|
+
import { readFile as readFile49 } from "node:fs/promises";
|
|
75766
75807
|
import { join as join95 } from "node:path";
|
|
75808
|
+
function isSkillsJavascriptPackageManager(value) {
|
|
75809
|
+
return typeof value === "string" && SKILLS_JAVASCRIPT_PACKAGE_MANAGERS.has(value);
|
|
75810
|
+
}
|
|
75811
|
+
function normalizeDetectedPackageManager(packageManager) {
|
|
75812
|
+
return isSkillsJavascriptPackageManager(packageManager) ? packageManager : null;
|
|
75813
|
+
}
|
|
75814
|
+
async function readConfiguredProjectPackageManager(projectDir, isGlobal = false) {
|
|
75815
|
+
const configPath = isGlobal ? join95(projectDir, ".ck.json") : join95(projectDir, ".claude", ".ck.json");
|
|
75816
|
+
if (!existsSync64(configPath))
|
|
75817
|
+
return null;
|
|
75818
|
+
try {
|
|
75819
|
+
const content = await readFile49(configPath, "utf-8");
|
|
75820
|
+
const config = parseJsonContent(content);
|
|
75821
|
+
const project = config.project && typeof config.project === "object" ? config.project : null;
|
|
75822
|
+
const configured = project?.packageManager;
|
|
75823
|
+
return isSkillsJavascriptPackageManager(configured) ? configured : null;
|
|
75824
|
+
} catch (error) {
|
|
75825
|
+
logger.debug(`Could not read project package manager from ${configPath}: ${error instanceof Error ? error.message : "unknown error"}`);
|
|
75826
|
+
return null;
|
|
75827
|
+
}
|
|
75828
|
+
}
|
|
75829
|
+
async function resolveSkillsPackageManager({
|
|
75830
|
+
requested = "auto",
|
|
75831
|
+
projectDir,
|
|
75832
|
+
isGlobal = false,
|
|
75833
|
+
detectPackageManager: detectPackageManager2 = PackageManagerDetector.detect
|
|
75834
|
+
} = {}) {
|
|
75835
|
+
if (requested !== "auto") {
|
|
75836
|
+
return {
|
|
75837
|
+
packageManager: requested,
|
|
75838
|
+
source: "explicit"
|
|
75839
|
+
};
|
|
75840
|
+
}
|
|
75841
|
+
if (projectDir && !isGlobal) {
|
|
75842
|
+
const projectPackageManager = await readConfiguredProjectPackageManager(projectDir, isGlobal);
|
|
75843
|
+
if (projectPackageManager) {
|
|
75844
|
+
return {
|
|
75845
|
+
packageManager: projectPackageManager,
|
|
75846
|
+
source: "project"
|
|
75847
|
+
};
|
|
75848
|
+
}
|
|
75849
|
+
}
|
|
75850
|
+
const detectedPackageManager = normalizeDetectedPackageManager(await detectPackageManager2());
|
|
75851
|
+
if (detectedPackageManager) {
|
|
75852
|
+
return {
|
|
75853
|
+
packageManager: detectedPackageManager,
|
|
75854
|
+
source: "detected"
|
|
75855
|
+
};
|
|
75856
|
+
}
|
|
75857
|
+
return {
|
|
75858
|
+
packageManager: "npm",
|
|
75859
|
+
source: "fallback"
|
|
75860
|
+
};
|
|
75861
|
+
}
|
|
75862
|
+
var SKILLS_JAVASCRIPT_PACKAGE_MANAGERS;
|
|
75863
|
+
var init_skills_package_manager = __esm(() => {
|
|
75864
|
+
init_package_manager_detector();
|
|
75865
|
+
init_logger();
|
|
75866
|
+
SKILLS_JAVASCRIPT_PACKAGE_MANAGERS = new Set([
|
|
75867
|
+
"npm",
|
|
75868
|
+
"bun",
|
|
75869
|
+
"pnpm",
|
|
75870
|
+
"yarn"
|
|
75871
|
+
]);
|
|
75872
|
+
});
|
|
75873
|
+
|
|
75874
|
+
// src/services/package-installer/skills-installer.ts
|
|
75875
|
+
import { join as join96 } from "node:path";
|
|
75767
75876
|
async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
75768
|
-
const {
|
|
75877
|
+
const {
|
|
75878
|
+
skipConfirm = false,
|
|
75879
|
+
packageManager = "auto",
|
|
75880
|
+
projectDir,
|
|
75881
|
+
isGlobal = false,
|
|
75882
|
+
withSudo = false
|
|
75883
|
+
} = options2;
|
|
75769
75884
|
const displayName = "Skills Dependencies";
|
|
75885
|
+
let manualGlobalInstallCommand = "npm install -g pnpm wrangler repomix";
|
|
75770
75886
|
if (isCIEnvironment()) {
|
|
75771
75887
|
logger.info("CI environment detected: skipping skills installation");
|
|
75772
75888
|
return {
|
|
@@ -75785,11 +75901,11 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75785
75901
|
};
|
|
75786
75902
|
}
|
|
75787
75903
|
try {
|
|
75788
|
-
const { existsSync:
|
|
75904
|
+
const { existsSync: existsSync65 } = await import("node:fs");
|
|
75789
75905
|
const clack = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
75790
75906
|
const platform10 = process.platform;
|
|
75791
75907
|
const scriptName = platform10 === "win32" ? "install.ps1" : "install.sh";
|
|
75792
|
-
const scriptPath =
|
|
75908
|
+
const scriptPath = join96(skillsDir2, scriptName);
|
|
75793
75909
|
try {
|
|
75794
75910
|
validateScriptPath(skillsDir2, scriptPath);
|
|
75795
75911
|
} catch (error) {
|
|
@@ -75801,11 +75917,11 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75801
75917
|
error: `Path validation failed: ${errorMessage}`
|
|
75802
75918
|
};
|
|
75803
75919
|
}
|
|
75804
|
-
if (!
|
|
75920
|
+
if (!existsSync65(scriptPath)) {
|
|
75805
75921
|
logger.warning(`Skills installation script not found: ${scriptPath}`);
|
|
75806
75922
|
logger.info("");
|
|
75807
75923
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
75808
|
-
logger.info(` See: ${
|
|
75924
|
+
logger.info(` See: ${join96(skillsDir2, "INSTALLATION.md")}`);
|
|
75809
75925
|
logger.info("");
|
|
75810
75926
|
logger.info("Quick start:");
|
|
75811
75927
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -75819,10 +75935,21 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75819
75935
|
logger.warning("Installation script will execute with user privileges");
|
|
75820
75936
|
logger.info(` Script: ${scriptPath}`);
|
|
75821
75937
|
logger.info(` Platform: ${platform10 === "win32" ? "Windows (PowerShell)" : "Unix (bash)"}`);
|
|
75938
|
+
const resolvedPackageManager = await resolveSkillsPackageManager({
|
|
75939
|
+
requested: packageManager,
|
|
75940
|
+
projectDir,
|
|
75941
|
+
isGlobal
|
|
75942
|
+
});
|
|
75943
|
+
logger.info(` JavaScript package manager: ${resolvedPackageManager.packageManager} (${resolvedPackageManager.source})`);
|
|
75944
|
+
manualGlobalInstallCommand = buildGlobalInstallCommand(resolvedPackageManager.packageManager, [
|
|
75945
|
+
"pnpm",
|
|
75946
|
+
"wrangler",
|
|
75947
|
+
"repomix"
|
|
75948
|
+
]);
|
|
75822
75949
|
if (logger.isVerbose()) {
|
|
75823
75950
|
try {
|
|
75824
|
-
const { readFile:
|
|
75825
|
-
const scriptContent = await
|
|
75951
|
+
const { readFile: readFile50 } = await import("node:fs/promises");
|
|
75952
|
+
const scriptContent = await readFile50(scriptPath, "utf-8");
|
|
75826
75953
|
const previewLines = scriptContent.split(`
|
|
75827
75954
|
`).slice(0, 20);
|
|
75828
75955
|
logger.verbose("Script preview (first 20 lines):");
|
|
@@ -75852,7 +75979,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75852
75979
|
logger.info(` ${platform10 === "win32" ? `powershell -File "${scriptPath}"` : `bash ${scriptPath}`}`);
|
|
75853
75980
|
logger.info("");
|
|
75854
75981
|
logger.info("Or see complete guide:");
|
|
75855
|
-
logger.info(` ${
|
|
75982
|
+
logger.info(` ${join96(skillsDir2, "INSTALLATION.md")}`);
|
|
75856
75983
|
return {
|
|
75857
75984
|
success: false,
|
|
75858
75985
|
package: displayName,
|
|
@@ -75861,7 +75988,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75861
75988
|
}
|
|
75862
75989
|
logger.info(`Installing ${displayName}...`);
|
|
75863
75990
|
logger.info(`Running: ${scriptPath}`);
|
|
75864
|
-
const scriptArgs = ["--yes"];
|
|
75991
|
+
const scriptArgs = ["--yes", "--package-manager", resolvedPackageManager.packageManager];
|
|
75865
75992
|
if (hasInstallState(skillsDir2)) {
|
|
75866
75993
|
if (skipConfirm || isNonInteractive()) {
|
|
75867
75994
|
logger.info("Resuming previous installation...");
|
|
@@ -75924,10 +76051,20 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75924
76051
|
}
|
|
75925
76052
|
const scriptEnv = {
|
|
75926
76053
|
...process.env,
|
|
76054
|
+
CK_SKILLS_PACKAGE_MANAGER: resolvedPackageManager.packageManager,
|
|
75927
76055
|
NON_INTERACTIVE: "1"
|
|
75928
76056
|
};
|
|
75929
76057
|
if (platform10 === "win32") {
|
|
75930
|
-
await executeInteractiveScript("powershell.exe", [
|
|
76058
|
+
await executeInteractiveScript("powershell.exe", [
|
|
76059
|
+
"-NoLogo",
|
|
76060
|
+
"-ExecutionPolicy",
|
|
76061
|
+
"Bypass",
|
|
76062
|
+
"-File",
|
|
76063
|
+
scriptPath,
|
|
76064
|
+
"-Y",
|
|
76065
|
+
"-JsPackageManager",
|
|
76066
|
+
resolvedPackageManager.packageManager
|
|
76067
|
+
], {
|
|
75931
76068
|
timeout: 600000,
|
|
75932
76069
|
cwd: skillsDir2,
|
|
75933
76070
|
env: scriptEnv
|
|
@@ -75973,7 +76110,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75973
76110
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
75974
76111
|
logger.info("");
|
|
75975
76112
|
logger.info("See complete guide:");
|
|
75976
|
-
logger.info(` cat ${
|
|
76113
|
+
logger.info(` cat ${join96(skillsDir2, "INSTALLATION.md")}`);
|
|
75977
76114
|
logger.info("");
|
|
75978
76115
|
logger.info("Quick start:");
|
|
75979
76116
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -75982,7 +76119,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75982
76119
|
logger.info("System tools (optional):");
|
|
75983
76120
|
logger.info(" macOS: brew install ffmpeg imagemagick");
|
|
75984
76121
|
logger.info(" Linux: sudo apt-get install ffmpeg imagemagick");
|
|
75985
|
-
logger.info(
|
|
76122
|
+
logger.info(` Node.js: ${manualGlobalInstallCommand}`);
|
|
75986
76123
|
return {
|
|
75987
76124
|
success: false,
|
|
75988
76125
|
package: displayName,
|
|
@@ -75990,6 +76127,21 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
75990
76127
|
};
|
|
75991
76128
|
}
|
|
75992
76129
|
}
|
|
76130
|
+
function buildGlobalInstallCommand(packageManager, packages) {
|
|
76131
|
+
const packageList = packages.join(" ");
|
|
76132
|
+
switch (packageManager) {
|
|
76133
|
+
case "bun":
|
|
76134
|
+
return `bun add -g ${packageList}`;
|
|
76135
|
+
case "pnpm":
|
|
76136
|
+
return `pnpm add -g ${packageList}`;
|
|
76137
|
+
case "yarn":
|
|
76138
|
+
return `yarn global add ${packageList}`;
|
|
76139
|
+
case "npm":
|
|
76140
|
+
return `npm install -g ${packageList}`;
|
|
76141
|
+
}
|
|
76142
|
+
const exhaustive = packageManager;
|
|
76143
|
+
return exhaustive;
|
|
76144
|
+
}
|
|
75993
76145
|
async function handleSkillsInstallation(skillsDir2, options2 = {}) {
|
|
75994
76146
|
try {
|
|
75995
76147
|
const skillsResult = await installSkillsDependencies(skillsDir2, options2);
|
|
@@ -76013,16 +76165,17 @@ var init_skills_installer2 = __esm(() => {
|
|
|
76013
76165
|
init_logger();
|
|
76014
76166
|
init_install_error_handler();
|
|
76015
76167
|
init_process_executor();
|
|
76168
|
+
init_skills_package_manager();
|
|
76016
76169
|
init_validators();
|
|
76017
76170
|
});
|
|
76018
76171
|
|
|
76019
76172
|
// src/services/package-installer/agy-mcp/config-manager.ts
|
|
76020
|
-
import { existsSync as
|
|
76021
|
-
import { mkdir as mkdir23, readFile as
|
|
76022
|
-
import { dirname as dirname34, join as
|
|
76173
|
+
import { existsSync as existsSync65 } from "node:fs";
|
|
76174
|
+
import { mkdir as mkdir23, readFile as readFile50, writeFile as writeFile25 } from "node:fs/promises";
|
|
76175
|
+
import { dirname as dirname34, join as join97 } from "node:path";
|
|
76023
76176
|
async function readJsonFile(filePath) {
|
|
76024
76177
|
try {
|
|
76025
|
-
const content = await
|
|
76178
|
+
const content = await readFile50(filePath, "utf-8");
|
|
76026
76179
|
return JSON.parse(content);
|
|
76027
76180
|
} catch (error) {
|
|
76028
76181
|
const errorMessage = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -76031,11 +76184,11 @@ async function readJsonFile(filePath) {
|
|
|
76031
76184
|
}
|
|
76032
76185
|
}
|
|
76033
76186
|
async function addAgyToGitignore(projectDir) {
|
|
76034
|
-
const gitignorePath =
|
|
76187
|
+
const gitignorePath = join97(projectDir, ".gitignore");
|
|
76035
76188
|
try {
|
|
76036
76189
|
let content = "";
|
|
76037
|
-
if (
|
|
76038
|
-
content = await
|
|
76190
|
+
if (existsSync65(gitignorePath)) {
|
|
76191
|
+
content = await readFile50(gitignorePath, "utf-8");
|
|
76039
76192
|
const lines = content.split(`
|
|
76040
76193
|
`).map((line) => line.trim()).filter((line) => !line.startsWith("#"));
|
|
76041
76194
|
const agyPatterns = [
|
|
@@ -76063,7 +76216,7 @@ ${AGY_GITIGNORE_PATTERN}
|
|
|
76063
76216
|
}
|
|
76064
76217
|
async function createNewSettingsWithMerge(agyConfigPath, mcpConfigPath) {
|
|
76065
76218
|
const linkDir = dirname34(agyConfigPath);
|
|
76066
|
-
if (!
|
|
76219
|
+
if (!existsSync65(linkDir)) {
|
|
76067
76220
|
await mkdir23(linkDir, { recursive: true });
|
|
76068
76221
|
logger.debug(`Created directory: ${linkDir}`);
|
|
76069
76222
|
}
|
|
@@ -76129,23 +76282,23 @@ var init_config_manager2 = __esm(() => {
|
|
|
76129
76282
|
});
|
|
76130
76283
|
|
|
76131
76284
|
// src/services/package-installer/agy-mcp/validation.ts
|
|
76132
|
-
import { existsSync as
|
|
76285
|
+
import { existsSync as existsSync66, lstatSync, readlinkSync } from "node:fs";
|
|
76133
76286
|
import { homedir as homedir45 } from "node:os";
|
|
76134
|
-
import { join as
|
|
76287
|
+
import { join as join98 } from "node:path";
|
|
76135
76288
|
function getGlobalMcpConfigPath() {
|
|
76136
|
-
return
|
|
76289
|
+
return join98(homedir45(), ".claude", ".mcp.json");
|
|
76137
76290
|
}
|
|
76138
76291
|
function getLocalMcpConfigPath(projectDir) {
|
|
76139
|
-
return
|
|
76292
|
+
return join98(projectDir, ".mcp.json");
|
|
76140
76293
|
}
|
|
76141
76294
|
function findMcpConfigPath(projectDir) {
|
|
76142
76295
|
const localPath = getLocalMcpConfigPath(projectDir);
|
|
76143
|
-
if (
|
|
76296
|
+
if (existsSync66(localPath)) {
|
|
76144
76297
|
logger.debug(`Found local MCP config: ${localPath}`);
|
|
76145
76298
|
return localPath;
|
|
76146
76299
|
}
|
|
76147
76300
|
const globalPath = getGlobalMcpConfigPath();
|
|
76148
|
-
if (
|
|
76301
|
+
if (existsSync66(globalPath)) {
|
|
76149
76302
|
logger.debug(`Found global MCP config: ${globalPath}`);
|
|
76150
76303
|
return globalPath;
|
|
76151
76304
|
}
|
|
@@ -76154,13 +76307,13 @@ function findMcpConfigPath(projectDir) {
|
|
|
76154
76307
|
}
|
|
76155
76308
|
function getAgyMcpConfigPath(projectDir, isGlobal) {
|
|
76156
76309
|
if (isGlobal) {
|
|
76157
|
-
return
|
|
76310
|
+
return join98(homedir45(), ".gemini", "config", "mcp_config.json");
|
|
76158
76311
|
}
|
|
76159
|
-
return
|
|
76312
|
+
return join98(projectDir, ".agents", "mcp_config.json");
|
|
76160
76313
|
}
|
|
76161
76314
|
function checkExistingAgyConfig(projectDir, isGlobal = false) {
|
|
76162
76315
|
const agyConfigPath = getAgyMcpConfigPath(projectDir, isGlobal);
|
|
76163
|
-
if (!
|
|
76316
|
+
if (!existsSync66(agyConfigPath)) {
|
|
76164
76317
|
return { exists: false, isSymlink: false, settingsPath: agyConfigPath };
|
|
76165
76318
|
}
|
|
76166
76319
|
try {
|
|
@@ -76184,12 +76337,12 @@ var init_validation = __esm(() => {
|
|
|
76184
76337
|
});
|
|
76185
76338
|
|
|
76186
76339
|
// src/services/package-installer/agy-mcp/linker-core.ts
|
|
76187
|
-
import { existsSync as
|
|
76340
|
+
import { existsSync as existsSync67 } from "node:fs";
|
|
76188
76341
|
import { mkdir as mkdir24, symlink as symlink3 } from "node:fs/promises";
|
|
76189
|
-
import { dirname as dirname35, join as
|
|
76342
|
+
import { dirname as dirname35, join as join99 } from "node:path";
|
|
76190
76343
|
async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
76191
76344
|
const linkDir = dirname35(linkPath);
|
|
76192
|
-
if (!
|
|
76345
|
+
if (!existsSync67(linkDir)) {
|
|
76193
76346
|
await mkdir24(linkDir, { recursive: true });
|
|
76194
76347
|
logger.debug(`Created directory: ${linkDir}`);
|
|
76195
76348
|
}
|
|
@@ -76197,7 +76350,7 @@ async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
|
76197
76350
|
if (isGlobal) {
|
|
76198
76351
|
symlinkTarget = getGlobalMcpConfigPath();
|
|
76199
76352
|
} else {
|
|
76200
|
-
const localMcpPath =
|
|
76353
|
+
const localMcpPath = join99(projectDir, ".mcp.json");
|
|
76201
76354
|
const isLocalConfig = targetPath === localMcpPath;
|
|
76202
76355
|
symlinkTarget = isLocalConfig ? "../.mcp.json" : targetPath;
|
|
76203
76356
|
}
|
|
@@ -78613,11 +78766,11 @@ __export(exports_worktree_manager, {
|
|
|
78613
78766
|
createWorktree: () => createWorktree,
|
|
78614
78767
|
cleanupAllWorktrees: () => cleanupAllWorktrees
|
|
78615
78768
|
});
|
|
78616
|
-
import { existsSync as
|
|
78617
|
-
import { readFile as
|
|
78618
|
-
import { join as
|
|
78769
|
+
import { existsSync as existsSync79 } from "node:fs";
|
|
78770
|
+
import { readFile as readFile71, writeFile as writeFile41 } from "node:fs/promises";
|
|
78771
|
+
import { join as join163 } from "node:path";
|
|
78619
78772
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
78620
|
-
const worktreePath =
|
|
78773
|
+
const worktreePath = join163(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
78621
78774
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
78622
78775
|
await spawnAndCollect("git", ["fetch", "origin", baseBranch], projectDir).catch(() => {
|
|
78623
78776
|
logger.warning(`[worktree] Could not fetch origin/${baseBranch}, using local`);
|
|
@@ -78635,7 +78788,7 @@ async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
|
78635
78788
|
return worktreePath;
|
|
78636
78789
|
}
|
|
78637
78790
|
async function removeWorktree(projectDir, issueNumber) {
|
|
78638
|
-
const worktreePath =
|
|
78791
|
+
const worktreePath = join163(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
78639
78792
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
78640
78793
|
try {
|
|
78641
78794
|
await spawnAndCollect("git", ["worktree", "remove", worktreePath, "--force"], projectDir);
|
|
@@ -78649,7 +78802,7 @@ async function listActiveWorktrees(projectDir) {
|
|
|
78649
78802
|
try {
|
|
78650
78803
|
const output2 = await spawnAndCollect("git", ["worktree", "list", "--porcelain"], projectDir);
|
|
78651
78804
|
const issueNumbers = [];
|
|
78652
|
-
const worktreePrefix =
|
|
78805
|
+
const worktreePrefix = join163(projectDir, WORKTREE_DIR, "issue-").replace(/\\/g, "/");
|
|
78653
78806
|
for (const line of output2.split(`
|
|
78654
78807
|
`)) {
|
|
78655
78808
|
if (line.startsWith("worktree ")) {
|
|
@@ -78677,9 +78830,9 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
78677
78830
|
await spawnAndCollect("git", ["worktree", "prune"], projectDir).catch(() => {});
|
|
78678
78831
|
}
|
|
78679
78832
|
async function ensureGitignore(projectDir) {
|
|
78680
|
-
const gitignorePath =
|
|
78833
|
+
const gitignorePath = join163(projectDir, ".gitignore");
|
|
78681
78834
|
try {
|
|
78682
|
-
const content =
|
|
78835
|
+
const content = existsSync79(gitignorePath) ? await readFile71(gitignorePath, "utf-8") : "";
|
|
78683
78836
|
if (!content.includes(".worktrees")) {
|
|
78684
78837
|
const newContent = content.endsWith(`
|
|
78685
78838
|
`) ? `${content}.worktrees/
|
|
@@ -78781,13 +78934,13 @@ var init_content_validator = __esm(() => {
|
|
|
78781
78934
|
|
|
78782
78935
|
// src/commands/content/phases/context-cache-manager.ts
|
|
78783
78936
|
import { createHash as createHash11 } from "node:crypto";
|
|
78784
|
-
import { existsSync as
|
|
78937
|
+
import { existsSync as existsSync85, mkdirSync as mkdirSync7, readFileSync as readFileSync25, readdirSync as readdirSync15, statSync as statSync15 } from "node:fs";
|
|
78785
78938
|
import { rename as rename16, writeFile as writeFile43 } from "node:fs/promises";
|
|
78786
78939
|
import { homedir as homedir54 } from "node:os";
|
|
78787
|
-
import { basename as basename34, join as
|
|
78940
|
+
import { basename as basename34, join as join170 } from "node:path";
|
|
78788
78941
|
function getCachedContext(repoPath) {
|
|
78789
78942
|
const cachePath = getCacheFilePath(repoPath);
|
|
78790
|
-
if (!
|
|
78943
|
+
if (!existsSync85(cachePath))
|
|
78791
78944
|
return null;
|
|
78792
78945
|
try {
|
|
78793
78946
|
const raw2 = readFileSync25(cachePath, "utf-8");
|
|
@@ -78804,7 +78957,7 @@ function getCachedContext(repoPath) {
|
|
|
78804
78957
|
}
|
|
78805
78958
|
}
|
|
78806
78959
|
async function saveCachedContext(repoPath, cache5) {
|
|
78807
|
-
if (!
|
|
78960
|
+
if (!existsSync85(CACHE_DIR)) {
|
|
78808
78961
|
mkdirSync7(CACHE_DIR, { recursive: true });
|
|
78809
78962
|
}
|
|
78810
78963
|
const cachePath = getCacheFilePath(repoPath);
|
|
@@ -78827,25 +78980,25 @@ function computeSourceHash(repoPath) {
|
|
|
78827
78980
|
}
|
|
78828
78981
|
function getDocSourcePaths(repoPath) {
|
|
78829
78982
|
const paths = [];
|
|
78830
|
-
const docsDir =
|
|
78831
|
-
if (
|
|
78983
|
+
const docsDir = join170(repoPath, "docs");
|
|
78984
|
+
if (existsSync85(docsDir)) {
|
|
78832
78985
|
try {
|
|
78833
78986
|
const files = readdirSync15(docsDir);
|
|
78834
78987
|
for (const f3 of files) {
|
|
78835
78988
|
if (f3.endsWith(".md"))
|
|
78836
|
-
paths.push(
|
|
78989
|
+
paths.push(join170(docsDir, f3));
|
|
78837
78990
|
}
|
|
78838
78991
|
} catch {}
|
|
78839
78992
|
}
|
|
78840
|
-
const readme =
|
|
78841
|
-
if (
|
|
78993
|
+
const readme = join170(repoPath, "README.md");
|
|
78994
|
+
if (existsSync85(readme))
|
|
78842
78995
|
paths.push(readme);
|
|
78843
|
-
const stylesDir =
|
|
78844
|
-
if (
|
|
78996
|
+
const stylesDir = join170(repoPath, "assets", "writing-styles");
|
|
78997
|
+
if (existsSync85(stylesDir)) {
|
|
78845
78998
|
try {
|
|
78846
78999
|
const files = readdirSync15(stylesDir);
|
|
78847
79000
|
for (const f3 of files) {
|
|
78848
|
-
paths.push(
|
|
79001
|
+
paths.push(join170(stylesDir, f3));
|
|
78849
79002
|
}
|
|
78850
79003
|
} catch {}
|
|
78851
79004
|
}
|
|
@@ -78854,11 +79007,11 @@ function getDocSourcePaths(repoPath) {
|
|
|
78854
79007
|
function getCacheFilePath(repoPath) {
|
|
78855
79008
|
const repoName = basename34(repoPath).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
78856
79009
|
const pathHash = createHash11("sha256").update(repoPath).digest("hex").slice(0, 8);
|
|
78857
|
-
return
|
|
79010
|
+
return join170(CACHE_DIR, `${repoName}-${pathHash}-context-cache.json`);
|
|
78858
79011
|
}
|
|
78859
79012
|
var CACHE_DIR, CACHE_TTL_MS5;
|
|
78860
79013
|
var init_context_cache_manager = __esm(() => {
|
|
78861
|
-
CACHE_DIR =
|
|
79014
|
+
CACHE_DIR = join170(homedir54(), ".claudekit", "cache");
|
|
78862
79015
|
CACHE_TTL_MS5 = 24 * 60 * 60 * 1000;
|
|
78863
79016
|
});
|
|
78864
79017
|
|
|
@@ -79038,8 +79191,8 @@ function extractContentFromResponse(response) {
|
|
|
79038
79191
|
|
|
79039
79192
|
// src/commands/content/phases/docs-summarizer.ts
|
|
79040
79193
|
import { execSync as execSync7 } from "node:child_process";
|
|
79041
|
-
import { existsSync as
|
|
79042
|
-
import { join as
|
|
79194
|
+
import { existsSync as existsSync86, readFileSync as readFileSync26, readdirSync as readdirSync16 } from "node:fs";
|
|
79195
|
+
import { join as join171 } from "node:path";
|
|
79043
79196
|
async function summarizeProjectDocs(repoPath, contentLogger) {
|
|
79044
79197
|
const rawContent = collectRawDocs(repoPath);
|
|
79045
79198
|
if (rawContent.total.length < 200) {
|
|
@@ -79083,7 +79236,7 @@ async function summarizeProjectDocs(repoPath, contentLogger) {
|
|
|
79083
79236
|
function collectRawDocs(repoPath) {
|
|
79084
79237
|
let totalChars = 0;
|
|
79085
79238
|
const readCapped = (filePath, maxChars) => {
|
|
79086
|
-
if (!
|
|
79239
|
+
if (!existsSync86(filePath))
|
|
79087
79240
|
return "";
|
|
79088
79241
|
if (totalChars >= MAX_RAW_CONTENT_CHARS)
|
|
79089
79242
|
return "";
|
|
@@ -79093,12 +79246,12 @@ function collectRawDocs(repoPath) {
|
|
|
79093
79246
|
return capped;
|
|
79094
79247
|
};
|
|
79095
79248
|
const docsContent = [];
|
|
79096
|
-
const docsDir =
|
|
79097
|
-
if (
|
|
79249
|
+
const docsDir = join171(repoPath, "docs");
|
|
79250
|
+
if (existsSync86(docsDir)) {
|
|
79098
79251
|
try {
|
|
79099
79252
|
const files = readdirSync16(docsDir).filter((f3) => f3.endsWith(".md")).sort();
|
|
79100
79253
|
for (const f3 of files) {
|
|
79101
|
-
const content = readCapped(
|
|
79254
|
+
const content = readCapped(join171(docsDir, f3), 5000);
|
|
79102
79255
|
if (content) {
|
|
79103
79256
|
docsContent.push(`### ${f3}
|
|
79104
79257
|
${content}`);
|
|
@@ -79112,21 +79265,21 @@ ${content}`);
|
|
|
79112
79265
|
let brand = "";
|
|
79113
79266
|
const brandCandidates = ["docs/brand-guidelines.md", "docs/design-guidelines.md"];
|
|
79114
79267
|
for (const p of brandCandidates) {
|
|
79115
|
-
brand = readCapped(
|
|
79268
|
+
brand = readCapped(join171(repoPath, p), 3000);
|
|
79116
79269
|
if (brand)
|
|
79117
79270
|
break;
|
|
79118
79271
|
}
|
|
79119
79272
|
let styles3 = "";
|
|
79120
|
-
const stylesDir =
|
|
79121
|
-
if (
|
|
79273
|
+
const stylesDir = join171(repoPath, "assets", "writing-styles");
|
|
79274
|
+
if (existsSync86(stylesDir)) {
|
|
79122
79275
|
try {
|
|
79123
79276
|
const files = readdirSync16(stylesDir).slice(0, 3);
|
|
79124
|
-
styles3 = files.map((f3) => readCapped(
|
|
79277
|
+
styles3 = files.map((f3) => readCapped(join171(stylesDir, f3), 1000)).filter(Boolean).join(`
|
|
79125
79278
|
|
|
79126
79279
|
`);
|
|
79127
79280
|
} catch {}
|
|
79128
79281
|
}
|
|
79129
|
-
const readme = readCapped(
|
|
79282
|
+
const readme = readCapped(join171(repoPath, "README.md"), 3000);
|
|
79130
79283
|
const total = [docs, brand, styles3, readme].join(`
|
|
79131
79284
|
`);
|
|
79132
79285
|
return { docs, brand, styles: styles3, readme, total };
|
|
@@ -79311,12 +79464,12 @@ IMPORTANT: Generate the image and output the path as JSON: {"imagePath": "/path/
|
|
|
79311
79464
|
|
|
79312
79465
|
// src/commands/content/phases/photo-generator.ts
|
|
79313
79466
|
import { execSync as execSync8 } from "node:child_process";
|
|
79314
|
-
import { existsSync as
|
|
79467
|
+
import { existsSync as existsSync87, mkdirSync as mkdirSync8, readdirSync as readdirSync17 } from "node:fs";
|
|
79315
79468
|
import { homedir as homedir55 } from "node:os";
|
|
79316
|
-
import { join as
|
|
79469
|
+
import { join as join172 } from "node:path";
|
|
79317
79470
|
async function generatePhoto(_content, context, config, platform18, contentId, contentLogger) {
|
|
79318
|
-
const mediaDir =
|
|
79319
|
-
if (!
|
|
79471
|
+
const mediaDir = join172(config.contentDir.replace(/^~/, homedir55()), "media", String(contentId));
|
|
79472
|
+
if (!existsSync87(mediaDir)) {
|
|
79320
79473
|
mkdirSync8(mediaDir, { recursive: true });
|
|
79321
79474
|
}
|
|
79322
79475
|
const prompt = buildPhotoPrompt(context, platform18);
|
|
@@ -79332,7 +79485,7 @@ async function generatePhoto(_content, context, config, platform18, contentId, c
|
|
|
79332
79485
|
const parsed = parseClaudeJsonOutput(result);
|
|
79333
79486
|
if (parsed && typeof parsed === "object" && "imagePath" in parsed) {
|
|
79334
79487
|
const imagePath = String(parsed.imagePath);
|
|
79335
|
-
if (
|
|
79488
|
+
if (existsSync87(imagePath)) {
|
|
79336
79489
|
return { path: imagePath, ...dimensions, format: "png" };
|
|
79337
79490
|
}
|
|
79338
79491
|
}
|
|
@@ -79340,7 +79493,7 @@ async function generatePhoto(_content, context, config, platform18, contentId, c
|
|
|
79340
79493
|
const imageFile = files.find((f3) => /\.(png|jpg|jpeg|webp)$/i.test(f3));
|
|
79341
79494
|
if (imageFile) {
|
|
79342
79495
|
const ext2 = imageFile.split(".").pop() ?? "png";
|
|
79343
|
-
return { path:
|
|
79496
|
+
return { path: join172(mediaDir, imageFile), ...dimensions, format: ext2 };
|
|
79344
79497
|
}
|
|
79345
79498
|
contentLogger.warn(`Photo generation produced no image for content ${contentId}`);
|
|
79346
79499
|
return null;
|
|
@@ -79428,9 +79581,9 @@ var init_content_creator = __esm(() => {
|
|
|
79428
79581
|
});
|
|
79429
79582
|
|
|
79430
79583
|
// src/commands/content/phases/content-logger.ts
|
|
79431
|
-
import { createWriteStream as createWriteStream4, existsSync as
|
|
79584
|
+
import { createWriteStream as createWriteStream4, existsSync as existsSync88, mkdirSync as mkdirSync9, statSync as statSync16 } from "node:fs";
|
|
79432
79585
|
import { homedir as homedir56 } from "node:os";
|
|
79433
|
-
import { join as
|
|
79586
|
+
import { join as join173 } from "node:path";
|
|
79434
79587
|
|
|
79435
79588
|
class ContentLogger {
|
|
79436
79589
|
stream = null;
|
|
@@ -79438,11 +79591,11 @@ class ContentLogger {
|
|
|
79438
79591
|
logDir;
|
|
79439
79592
|
maxBytes;
|
|
79440
79593
|
constructor(maxBytes = 0) {
|
|
79441
|
-
this.logDir =
|
|
79594
|
+
this.logDir = join173(homedir56(), ".claudekit", "logs");
|
|
79442
79595
|
this.maxBytes = maxBytes;
|
|
79443
79596
|
}
|
|
79444
79597
|
init() {
|
|
79445
|
-
if (!
|
|
79598
|
+
if (!existsSync88(this.logDir)) {
|
|
79446
79599
|
mkdirSync9(this.logDir, { recursive: true });
|
|
79447
79600
|
}
|
|
79448
79601
|
this.rotateIfNeeded();
|
|
@@ -79470,7 +79623,7 @@ class ContentLogger {
|
|
|
79470
79623
|
}
|
|
79471
79624
|
}
|
|
79472
79625
|
getLogPath() {
|
|
79473
|
-
return
|
|
79626
|
+
return join173(this.logDir, `content-${this.getDateStr()}.log`);
|
|
79474
79627
|
}
|
|
79475
79628
|
write(level, message) {
|
|
79476
79629
|
this.rotateIfNeeded();
|
|
@@ -79487,18 +79640,18 @@ class ContentLogger {
|
|
|
79487
79640
|
if (dateStr !== this.currentDate) {
|
|
79488
79641
|
this.close();
|
|
79489
79642
|
this.currentDate = dateStr;
|
|
79490
|
-
const logPath =
|
|
79643
|
+
const logPath = join173(this.logDir, `content-${dateStr}.log`);
|
|
79491
79644
|
this.stream = createWriteStream4(logPath, { flags: "a", mode: 384 });
|
|
79492
79645
|
return;
|
|
79493
79646
|
}
|
|
79494
79647
|
if (this.maxBytes > 0 && this.stream) {
|
|
79495
|
-
const logPath =
|
|
79648
|
+
const logPath = join173(this.logDir, `content-${this.currentDate}.log`);
|
|
79496
79649
|
try {
|
|
79497
79650
|
const stat26 = statSync16(logPath);
|
|
79498
79651
|
if (stat26.size >= this.maxBytes) {
|
|
79499
79652
|
this.close();
|
|
79500
79653
|
const suffix = Date.now();
|
|
79501
|
-
const rotatedPath =
|
|
79654
|
+
const rotatedPath = join173(this.logDir, `content-${this.currentDate}-${suffix}.log`);
|
|
79502
79655
|
import("node:fs/promises").then(({ rename: rename17 }) => rename17(logPath, rotatedPath).catch(() => {}));
|
|
79503
79656
|
this.stream = createWriteStream4(logPath, { flags: "w", mode: 384 });
|
|
79504
79657
|
}
|
|
@@ -79580,7 +79733,7 @@ var init_sqlite_client = __esm(() => {
|
|
|
79580
79733
|
});
|
|
79581
79734
|
|
|
79582
79735
|
// src/commands/content/phases/db-manager.ts
|
|
79583
|
-
import { existsSync as
|
|
79736
|
+
import { existsSync as existsSync89, mkdirSync as mkdirSync10 } from "node:fs";
|
|
79584
79737
|
import { dirname as dirname56 } from "node:path";
|
|
79585
79738
|
function initDatabase(dbPath) {
|
|
79586
79739
|
ensureParentDir(dbPath);
|
|
@@ -79603,7 +79756,7 @@ function runRetentionCleanup(db, retentionDays = 90) {
|
|
|
79603
79756
|
}
|
|
79604
79757
|
function ensureParentDir(dbPath) {
|
|
79605
79758
|
const dir = dirname56(dbPath);
|
|
79606
|
-
if (dir && !
|
|
79759
|
+
if (dir && !existsSync89(dir)) {
|
|
79607
79760
|
mkdirSync10(dir, { recursive: true });
|
|
79608
79761
|
}
|
|
79609
79762
|
}
|
|
@@ -79768,8 +79921,8 @@ function isNoiseCommit(title, author) {
|
|
|
79768
79921
|
|
|
79769
79922
|
// src/commands/content/phases/change-detector.ts
|
|
79770
79923
|
import { execSync as execSync10, spawnSync as spawnSync9 } from "node:child_process";
|
|
79771
|
-
import { existsSync as
|
|
79772
|
-
import { join as
|
|
79924
|
+
import { existsSync as existsSync90, readFileSync as readFileSync27, readdirSync as readdirSync18, statSync as statSync17 } from "node:fs";
|
|
79925
|
+
import { join as join174 } from "node:path";
|
|
79773
79926
|
function detectCommits(repo, since) {
|
|
79774
79927
|
try {
|
|
79775
79928
|
const fetchUrl = sshToHttps(repo.remoteUrl);
|
|
@@ -79878,8 +80031,8 @@ function detectTags(repo, since) {
|
|
|
79878
80031
|
}
|
|
79879
80032
|
}
|
|
79880
80033
|
function detectCompletedPlans(repo, since) {
|
|
79881
|
-
const plansDir =
|
|
79882
|
-
if (!
|
|
80034
|
+
const plansDir = join174(repo.path, "plans");
|
|
80035
|
+
if (!existsSync90(plansDir))
|
|
79883
80036
|
return [];
|
|
79884
80037
|
const sinceMs = new Date(since).getTime();
|
|
79885
80038
|
const events = [];
|
|
@@ -79888,8 +80041,8 @@ function detectCompletedPlans(repo, since) {
|
|
|
79888
80041
|
for (const entry of entries) {
|
|
79889
80042
|
if (!entry.isDirectory())
|
|
79890
80043
|
continue;
|
|
79891
|
-
const planFile =
|
|
79892
|
-
if (!
|
|
80044
|
+
const planFile = join174(plansDir, entry.name, "plan.md");
|
|
80045
|
+
if (!existsSync90(planFile))
|
|
79893
80046
|
continue;
|
|
79894
80047
|
try {
|
|
79895
80048
|
const stat26 = statSync17(planFile);
|
|
@@ -79966,7 +80119,7 @@ function classifyCommit(event) {
|
|
|
79966
80119
|
// src/commands/content/phases/repo-discoverer.ts
|
|
79967
80120
|
import { execSync as execSync11 } from "node:child_process";
|
|
79968
80121
|
import { readdirSync as readdirSync19 } from "node:fs";
|
|
79969
|
-
import { join as
|
|
80122
|
+
import { join as join175 } from "node:path";
|
|
79970
80123
|
function discoverRepos2(cwd2) {
|
|
79971
80124
|
const repos = [];
|
|
79972
80125
|
if (isGitRepoRoot(cwd2)) {
|
|
@@ -79979,7 +80132,7 @@ function discoverRepos2(cwd2) {
|
|
|
79979
80132
|
for (const entry of entries) {
|
|
79980
80133
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
79981
80134
|
continue;
|
|
79982
|
-
const dirPath =
|
|
80135
|
+
const dirPath = join175(cwd2, entry.name);
|
|
79983
80136
|
if (isGitRepoRoot(dirPath)) {
|
|
79984
80137
|
const info = getRepoInfo(dirPath);
|
|
79985
80138
|
if (info)
|
|
@@ -80646,12 +80799,12 @@ var init_types6 = __esm(() => {
|
|
|
80646
80799
|
});
|
|
80647
80800
|
|
|
80648
80801
|
// src/commands/content/phases/state-manager.ts
|
|
80649
|
-
import { readFile as
|
|
80650
|
-
import { join as
|
|
80802
|
+
import { readFile as readFile73, rename as rename17, writeFile as writeFile44 } from "node:fs/promises";
|
|
80803
|
+
import { join as join176 } from "node:path";
|
|
80651
80804
|
async function loadContentConfig(projectDir) {
|
|
80652
|
-
const configPath =
|
|
80805
|
+
const configPath = join176(projectDir, CK_CONFIG_FILE2);
|
|
80653
80806
|
try {
|
|
80654
|
-
const raw2 = await
|
|
80807
|
+
const raw2 = await readFile73(configPath, "utf-8");
|
|
80655
80808
|
const json = JSON.parse(raw2);
|
|
80656
80809
|
return ContentConfigSchema.parse(json.content ?? {});
|
|
80657
80810
|
} catch {
|
|
@@ -80659,15 +80812,15 @@ async function loadContentConfig(projectDir) {
|
|
|
80659
80812
|
}
|
|
80660
80813
|
}
|
|
80661
80814
|
async function saveContentConfig(projectDir, config) {
|
|
80662
|
-
const configPath =
|
|
80815
|
+
const configPath = join176(projectDir, CK_CONFIG_FILE2);
|
|
80663
80816
|
const json = await readJsonSafe5(configPath);
|
|
80664
80817
|
json.content = { ...json.content, ...config };
|
|
80665
80818
|
await atomicWrite3(configPath, json);
|
|
80666
80819
|
}
|
|
80667
80820
|
async function loadContentState(projectDir) {
|
|
80668
|
-
const configPath =
|
|
80821
|
+
const configPath = join176(projectDir, CK_CONFIG_FILE2);
|
|
80669
80822
|
try {
|
|
80670
|
-
const raw2 = await
|
|
80823
|
+
const raw2 = await readFile73(configPath, "utf-8");
|
|
80671
80824
|
const json = JSON.parse(raw2);
|
|
80672
80825
|
const contentBlock = json.content ?? {};
|
|
80673
80826
|
return ContentStateSchema.parse(contentBlock.state ?? {});
|
|
@@ -80676,7 +80829,7 @@ async function loadContentState(projectDir) {
|
|
|
80676
80829
|
}
|
|
80677
80830
|
}
|
|
80678
80831
|
async function saveContentState(projectDir, state) {
|
|
80679
|
-
const configPath =
|
|
80832
|
+
const configPath = join176(projectDir, CK_CONFIG_FILE2);
|
|
80680
80833
|
const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);
|
|
80681
80834
|
for (const key of Object.keys(state.dailyPostCounts)) {
|
|
80682
80835
|
const dateStr = key.slice(-10);
|
|
@@ -80694,7 +80847,7 @@ async function saveContentState(projectDir, state) {
|
|
|
80694
80847
|
}
|
|
80695
80848
|
async function readJsonSafe5(filePath) {
|
|
80696
80849
|
try {
|
|
80697
|
-
const raw2 = await
|
|
80850
|
+
const raw2 = await readFile73(filePath, "utf-8");
|
|
80698
80851
|
return JSON.parse(raw2);
|
|
80699
80852
|
} catch {
|
|
80700
80853
|
return {};
|
|
@@ -80957,8 +81110,8 @@ var init_platform_setup_x = __esm(() => {
|
|
|
80957
81110
|
});
|
|
80958
81111
|
|
|
80959
81112
|
// src/commands/content/phases/setup-wizard.ts
|
|
80960
|
-
import { existsSync as
|
|
80961
|
-
import { join as
|
|
81113
|
+
import { existsSync as existsSync91 } from "node:fs";
|
|
81114
|
+
import { join as join177 } from "node:path";
|
|
80962
81115
|
async function runSetupWizard2(cwd2, contentLogger) {
|
|
80963
81116
|
console.log();
|
|
80964
81117
|
oe(import_picocolors43.default.bgCyan(import_picocolors43.default.white(" CK Content — Multi-Channel Content Engine ")));
|
|
@@ -81026,8 +81179,8 @@ async function showRepoSummary(cwd2) {
|
|
|
81026
81179
|
function detectBrandAssets(cwd2, contentLogger) {
|
|
81027
81180
|
const repos = discoverRepos2(cwd2);
|
|
81028
81181
|
for (const repo of repos) {
|
|
81029
|
-
const hasGuidelines =
|
|
81030
|
-
const hasStyles =
|
|
81182
|
+
const hasGuidelines = existsSync91(join177(repo.path, "docs", "brand-guidelines.md"));
|
|
81183
|
+
const hasStyles = existsSync91(join177(repo.path, "assets", "writing-styles"));
|
|
81031
81184
|
if (!hasGuidelines) {
|
|
81032
81185
|
f2.warning(`${repo.name}: No docs/brand-guidelines.md — content will use generic tone.`);
|
|
81033
81186
|
contentLogger.warn(`${repo.name}: missing docs/brand-guidelines.md`);
|
|
@@ -81093,13 +81246,13 @@ var init_setup_wizard = __esm(() => {
|
|
|
81093
81246
|
});
|
|
81094
81247
|
|
|
81095
81248
|
// src/commands/content/content-review-commands.ts
|
|
81096
|
-
import { existsSync as
|
|
81249
|
+
import { existsSync as existsSync92 } from "node:fs";
|
|
81097
81250
|
import { homedir as homedir57 } from "node:os";
|
|
81098
81251
|
async function queueContent() {
|
|
81099
81252
|
const cwd2 = process.cwd();
|
|
81100
81253
|
const config = await loadContentConfig(cwd2);
|
|
81101
81254
|
const dbPath = config.dbPath.replace(/^~/, homedir57());
|
|
81102
|
-
if (!
|
|
81255
|
+
if (!existsSync92(dbPath)) {
|
|
81103
81256
|
logger.info("No content database found. Run 'ck content setup' first.");
|
|
81104
81257
|
return;
|
|
81105
81258
|
}
|
|
@@ -81167,12 +81320,12 @@ __export(exports_content_subcommands, {
|
|
|
81167
81320
|
logsContent: () => logsContent,
|
|
81168
81321
|
approveContentCmd: () => approveContentCmd
|
|
81169
81322
|
});
|
|
81170
|
-
import { existsSync as
|
|
81323
|
+
import { existsSync as existsSync93, readFileSync as readFileSync28, unlinkSync as unlinkSync6 } from "node:fs";
|
|
81171
81324
|
import { homedir as homedir58 } from "node:os";
|
|
81172
|
-
import { join as
|
|
81325
|
+
import { join as join178 } from "node:path";
|
|
81173
81326
|
function isDaemonRunning() {
|
|
81174
|
-
const lockFile =
|
|
81175
|
-
if (!
|
|
81327
|
+
const lockFile = join178(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
81328
|
+
if (!existsSync93(lockFile))
|
|
81176
81329
|
return { running: false, pid: null };
|
|
81177
81330
|
try {
|
|
81178
81331
|
const pidStr = readFileSync28(lockFile, "utf-8").trim();
|
|
@@ -81203,8 +81356,8 @@ async function startContent(options2) {
|
|
|
81203
81356
|
await contentCommand(options2);
|
|
81204
81357
|
}
|
|
81205
81358
|
async function stopContent() {
|
|
81206
|
-
const lockFile =
|
|
81207
|
-
if (!
|
|
81359
|
+
const lockFile = join178(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
81360
|
+
if (!existsSync93(lockFile)) {
|
|
81208
81361
|
logger.info("Content daemon is not running.");
|
|
81209
81362
|
return;
|
|
81210
81363
|
}
|
|
@@ -81242,10 +81395,10 @@ async function statusContent() {
|
|
|
81242
81395
|
} catch {}
|
|
81243
81396
|
}
|
|
81244
81397
|
async function logsContent(options2) {
|
|
81245
|
-
const logDir =
|
|
81398
|
+
const logDir = join178(homedir58(), ".claudekit", "logs");
|
|
81246
81399
|
const dateStr = new Date().toISOString().slice(0, 10).replace(/-/g, "");
|
|
81247
|
-
const logPath =
|
|
81248
|
-
if (!
|
|
81400
|
+
const logPath = join178(logDir, `content-${dateStr}.log`);
|
|
81401
|
+
if (!existsSync93(logPath)) {
|
|
81249
81402
|
logger.info("No content logs found for today.");
|
|
81250
81403
|
return;
|
|
81251
81404
|
}
|
|
@@ -81276,13 +81429,13 @@ var init_content_subcommands = __esm(() => {
|
|
|
81276
81429
|
init_setup_wizard();
|
|
81277
81430
|
init_state_manager();
|
|
81278
81431
|
init_content_review_commands();
|
|
81279
|
-
LOCK_DIR =
|
|
81432
|
+
LOCK_DIR = join178(homedir58(), ".claudekit", "locks");
|
|
81280
81433
|
});
|
|
81281
81434
|
|
|
81282
81435
|
// src/commands/content/content-command.ts
|
|
81283
|
-
import { existsSync as
|
|
81436
|
+
import { existsSync as existsSync94, mkdirSync as mkdirSync11, unlinkSync as unlinkSync7, writeFileSync as writeFileSync9 } from "node:fs";
|
|
81284
81437
|
import { homedir as homedir59 } from "node:os";
|
|
81285
|
-
import { join as
|
|
81438
|
+
import { join as join179 } from "node:path";
|
|
81286
81439
|
async function contentCommand(options2) {
|
|
81287
81440
|
const cwd2 = process.cwd();
|
|
81288
81441
|
const contentLogger = new ContentLogger;
|
|
@@ -81311,7 +81464,7 @@ async function contentCommand(options2) {
|
|
|
81311
81464
|
}
|
|
81312
81465
|
contentLogger.info("Setup complete. Starting daemon...");
|
|
81313
81466
|
}
|
|
81314
|
-
if (!
|
|
81467
|
+
if (!existsSync94(LOCK_DIR2))
|
|
81315
81468
|
mkdirSync11(LOCK_DIR2, { recursive: true });
|
|
81316
81469
|
writeFileSync9(LOCK_FILE, String(process.pid), "utf-8");
|
|
81317
81470
|
const dbPath = config.dbPath.replace(/^~/, homedir59());
|
|
@@ -81460,8 +81613,8 @@ var init_content_command = __esm(() => {
|
|
|
81460
81613
|
init_publisher();
|
|
81461
81614
|
init_review_manager();
|
|
81462
81615
|
init_state_manager();
|
|
81463
|
-
LOCK_DIR2 =
|
|
81464
|
-
LOCK_FILE =
|
|
81616
|
+
LOCK_DIR2 = join179(homedir59(), ".claudekit", "locks");
|
|
81617
|
+
LOCK_FILE = join179(LOCK_DIR2, "ck-content.lock");
|
|
81465
81618
|
});
|
|
81466
81619
|
|
|
81467
81620
|
// src/commands/content/index.ts
|
|
@@ -82604,6 +82757,10 @@ var init_init_command_help = __esm(() => {
|
|
|
82604
82757
|
flags: "--install-skills",
|
|
82605
82758
|
description: "Install skills dependencies (non-interactive mode)"
|
|
82606
82759
|
},
|
|
82760
|
+
{
|
|
82761
|
+
flags: "--package-manager <manager>",
|
|
82762
|
+
description: "Package manager for skills JavaScript dependencies: auto, npm, bun, pnpm, or yarn"
|
|
82763
|
+
},
|
|
82607
82764
|
{
|
|
82608
82765
|
flags: "--with-sudo",
|
|
82609
82766
|
description: "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)"
|
|
@@ -82866,6 +83023,10 @@ var init_new_command_help = __esm(() => {
|
|
|
82866
83023
|
flags: "--install-skills",
|
|
82867
83024
|
description: "Install skills dependencies (non-interactive mode)"
|
|
82868
83025
|
},
|
|
83026
|
+
{
|
|
83027
|
+
flags: "--package-manager <manager>",
|
|
83028
|
+
description: "Package manager for skills JavaScript dependencies: auto, npm, bun, pnpm, or yarn"
|
|
83029
|
+
},
|
|
82869
83030
|
{
|
|
82870
83031
|
flags: "--with-sudo",
|
|
82871
83032
|
description: "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)"
|
|
@@ -88639,7 +88800,7 @@ init_logger();
|
|
|
88639
88800
|
import { readFileSync as readFileSync17 } from "node:fs";
|
|
88640
88801
|
var MIN_GH_CLI_VERSION = "2.20.0";
|
|
88641
88802
|
var GH_COMMAND_TIMEOUT_MS = 1e4;
|
|
88642
|
-
function
|
|
88803
|
+
function compareVersions7(a3, b3) {
|
|
88643
88804
|
const partsA = a3.split(".").map(Number);
|
|
88644
88805
|
const partsB = b3.split(".").map(Number);
|
|
88645
88806
|
const maxLen = Math.max(partsA.length, partsB.length);
|
|
@@ -88860,7 +89021,7 @@ async function getCommandVersion(command, versionFlag, versionRegex) {
|
|
|
88860
89021
|
return null;
|
|
88861
89022
|
}
|
|
88862
89023
|
}
|
|
88863
|
-
function
|
|
89024
|
+
function compareVersions8(current, required) {
|
|
88864
89025
|
const parseCurrent = current.split(".").map((n) => Number.parseInt(n, 10));
|
|
88865
89026
|
const parseRequired = required.split(".").map((n) => Number.parseInt(n, 10));
|
|
88866
89027
|
for (let i = 0;i < 3; i++) {
|
|
@@ -88884,7 +89045,7 @@ async function checkDependency(config) {
|
|
|
88884
89045
|
let meetsRequirements = true;
|
|
88885
89046
|
let message;
|
|
88886
89047
|
if (config.minVersion && version) {
|
|
88887
|
-
meetsRequirements =
|
|
89048
|
+
meetsRequirements = compareVersions8(version, config.minVersion);
|
|
88888
89049
|
if (!meetsRequirements) {
|
|
88889
89050
|
message = `Version ${version} is below minimum ${config.minVersion}`;
|
|
88890
89051
|
}
|
|
@@ -89279,7 +89440,7 @@ class SystemChecker {
|
|
|
89279
89440
|
const { stdout } = await execAsync6("gh --version");
|
|
89280
89441
|
const match = stdout.match(/(\d+\.\d+\.\d+)/);
|
|
89281
89442
|
const version = match?.[1];
|
|
89282
|
-
if (version &&
|
|
89443
|
+
if (version && compareVersions7(version, MIN_GH_CLI_VERSION) < 0) {
|
|
89283
89444
|
return {
|
|
89284
89445
|
id: "gh-cli-version",
|
|
89285
89446
|
name: "GitHub CLI",
|
|
@@ -94796,7 +94957,7 @@ async function getLatestVersion(kit, includePrereleases = false) {
|
|
|
94796
94957
|
init_logger();
|
|
94797
94958
|
init_path_resolver();
|
|
94798
94959
|
init_safe_prompts();
|
|
94799
|
-
import { join as
|
|
94960
|
+
import { join as join100 } from "node:path";
|
|
94800
94961
|
async function promptUpdateMode() {
|
|
94801
94962
|
const updateEverything = await se({
|
|
94802
94963
|
message: "Do you want to update everything?"
|
|
@@ -94838,7 +94999,7 @@ async function promptDirectorySelection(global3 = false) {
|
|
|
94838
94999
|
return selectedCategories;
|
|
94839
95000
|
}
|
|
94840
95001
|
async function promptFreshConfirmation(targetPath, analysis) {
|
|
94841
|
-
const backupRoot =
|
|
95002
|
+
const backupRoot = join100(PathResolver.getConfigDir(false), "backups");
|
|
94842
95003
|
logger.warning("[!] Fresh installation will remove ClaudeKit files:");
|
|
94843
95004
|
logger.info(`Path: ${targetPath}`);
|
|
94844
95005
|
logger.info(`Recovery backup: ${backupRoot}`);
|
|
@@ -95115,7 +95276,7 @@ init_logger();
|
|
|
95115
95276
|
init_logger();
|
|
95116
95277
|
init_path_resolver();
|
|
95117
95278
|
var import_fs_extra10 = __toESM(require_lib(), 1);
|
|
95118
|
-
import { join as
|
|
95279
|
+
import { join as join101 } from "node:path";
|
|
95119
95280
|
async function handleConflicts(ctx) {
|
|
95120
95281
|
if (ctx.cancelled)
|
|
95121
95282
|
return ctx;
|
|
@@ -95124,7 +95285,7 @@ async function handleConflicts(ctx) {
|
|
|
95124
95285
|
if (PathResolver.isLocalSameAsGlobal()) {
|
|
95125
95286
|
return ctx;
|
|
95126
95287
|
}
|
|
95127
|
-
const localSettingsPath =
|
|
95288
|
+
const localSettingsPath = join101(process.cwd(), ".claude", "settings.json");
|
|
95128
95289
|
if (!await import_fs_extra10.pathExists(localSettingsPath)) {
|
|
95129
95290
|
return ctx;
|
|
95130
95291
|
}
|
|
@@ -95139,7 +95300,7 @@ async function handleConflicts(ctx) {
|
|
|
95139
95300
|
return { ...ctx, cancelled: true };
|
|
95140
95301
|
}
|
|
95141
95302
|
if (choice === "remove") {
|
|
95142
|
-
const localClaudeDir =
|
|
95303
|
+
const localClaudeDir = join101(process.cwd(), ".claude");
|
|
95143
95304
|
try {
|
|
95144
95305
|
await import_fs_extra10.remove(localClaudeDir);
|
|
95145
95306
|
logger.success("Removed local .claude/ directory");
|
|
@@ -95236,7 +95397,7 @@ init_logger();
|
|
|
95236
95397
|
init_safe_spinner();
|
|
95237
95398
|
import { mkdir as mkdir30, stat as stat17 } from "node:fs/promises";
|
|
95238
95399
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
95239
|
-
import { join as
|
|
95400
|
+
import { join as join108 } from "node:path";
|
|
95240
95401
|
|
|
95241
95402
|
// src/shared/temp-cleanup.ts
|
|
95242
95403
|
init_logger();
|
|
@@ -95255,7 +95416,7 @@ init_logger();
|
|
|
95255
95416
|
init_output_manager();
|
|
95256
95417
|
import { createWriteStream as createWriteStream2, rmSync } from "node:fs";
|
|
95257
95418
|
import { mkdir as mkdir25 } from "node:fs/promises";
|
|
95258
|
-
import { join as
|
|
95419
|
+
import { join as join102 } from "node:path";
|
|
95259
95420
|
|
|
95260
95421
|
// src/shared/progress-bar.ts
|
|
95261
95422
|
init_output_manager();
|
|
@@ -95465,7 +95626,7 @@ var MAX_DOWNLOAD_SIZE = 500 * 1024 * 1024;
|
|
|
95465
95626
|
class FileDownloader {
|
|
95466
95627
|
async downloadAsset(asset, destDir) {
|
|
95467
95628
|
try {
|
|
95468
|
-
const destPath =
|
|
95629
|
+
const destPath = join102(destDir, asset.name);
|
|
95469
95630
|
await mkdir25(destDir, { recursive: true });
|
|
95470
95631
|
output.info(`Downloading ${asset.name} (${formatBytes2(asset.size)})...`);
|
|
95471
95632
|
logger.verbose("Download details", {
|
|
@@ -95550,7 +95711,7 @@ class FileDownloader {
|
|
|
95550
95711
|
}
|
|
95551
95712
|
async downloadFile(params) {
|
|
95552
95713
|
const { url, name, size, destDir, token } = params;
|
|
95553
|
-
const destPath =
|
|
95714
|
+
const destPath = join102(destDir, name);
|
|
95554
95715
|
await mkdir25(destDir, { recursive: true });
|
|
95555
95716
|
output.info(`Downloading ${name}${size ? ` (${formatBytes2(size)})` : ""}...`);
|
|
95556
95717
|
const headers = {};
|
|
@@ -95636,7 +95797,7 @@ init_logger();
|
|
|
95636
95797
|
init_types3();
|
|
95637
95798
|
import { constants as constants4 } from "node:fs";
|
|
95638
95799
|
import { access as access5, readdir as readdir23 } from "node:fs/promises";
|
|
95639
|
-
import { join as
|
|
95800
|
+
import { join as join103 } from "node:path";
|
|
95640
95801
|
async function pathExists11(path8) {
|
|
95641
95802
|
try {
|
|
95642
95803
|
await access5(path8, constants4.F_OK);
|
|
@@ -95655,7 +95816,7 @@ async function validateExtraction(extractDir) {
|
|
|
95655
95816
|
const criticalPaths = [".claude"];
|
|
95656
95817
|
const missingPaths = [];
|
|
95657
95818
|
for (const path8 of criticalPaths) {
|
|
95658
|
-
if (await pathExists11(
|
|
95819
|
+
if (await pathExists11(join103(extractDir, path8))) {
|
|
95659
95820
|
logger.debug(`Found: ${path8}`);
|
|
95660
95821
|
continue;
|
|
95661
95822
|
}
|
|
@@ -95665,7 +95826,7 @@ async function validateExtraction(extractDir) {
|
|
|
95665
95826
|
const guidancePaths = ["CLAUDE.md", ".claude/CLAUDE.md", ".claude/rules/CLAUDE.md"];
|
|
95666
95827
|
let guidancePath = null;
|
|
95667
95828
|
for (const path8 of guidancePaths) {
|
|
95668
|
-
if (await pathExists11(
|
|
95829
|
+
if (await pathExists11(join103(extractDir, path8))) {
|
|
95669
95830
|
guidancePath = path8;
|
|
95670
95831
|
break;
|
|
95671
95832
|
}
|
|
@@ -95690,7 +95851,7 @@ async function validateExtraction(extractDir) {
|
|
|
95690
95851
|
// src/domains/installation/extraction/tar-extractor.ts
|
|
95691
95852
|
init_logger();
|
|
95692
95853
|
import { copyFile as copyFile4, mkdir as mkdir28, readdir as readdir25, rm as rm11, stat as stat15 } from "node:fs/promises";
|
|
95693
|
-
import { join as
|
|
95854
|
+
import { join as join106 } from "node:path";
|
|
95694
95855
|
|
|
95695
95856
|
// node_modules/@isaacs/fs-minipass/dist/esm/index.js
|
|
95696
95857
|
import EE from "events";
|
|
@@ -101452,7 +101613,7 @@ var mkdirSync4 = (dir, opt) => {
|
|
|
101452
101613
|
};
|
|
101453
101614
|
|
|
101454
101615
|
// node_modules/tar/dist/esm/path-reservations.js
|
|
101455
|
-
import { join as
|
|
101616
|
+
import { join as join104 } from "node:path";
|
|
101456
101617
|
|
|
101457
101618
|
// node_modules/tar/dist/esm/normalize-unicode.js
|
|
101458
101619
|
var normalizeCache = Object.create(null);
|
|
@@ -101485,7 +101646,7 @@ var getDirs = (path13) => {
|
|
|
101485
101646
|
const dirs = path13.split("/").slice(0, -1).reduce((set, path14) => {
|
|
101486
101647
|
const s = set[set.length - 1];
|
|
101487
101648
|
if (s !== undefined) {
|
|
101488
|
-
path14 =
|
|
101649
|
+
path14 = join104(s, path14);
|
|
101489
101650
|
}
|
|
101490
101651
|
set.push(path14 || "/");
|
|
101491
101652
|
return set;
|
|
@@ -101499,7 +101660,7 @@ class PathReservations {
|
|
|
101499
101660
|
#running = new Set;
|
|
101500
101661
|
reserve(paths, fn) {
|
|
101501
101662
|
paths = isWindows4 ? ["win32 parallelization disabled"] : paths.map((p) => {
|
|
101502
|
-
return stripTrailingSlashes(
|
|
101663
|
+
return stripTrailingSlashes(join104(normalizeUnicode(p))).toLowerCase();
|
|
101503
101664
|
});
|
|
101504
101665
|
const dirs = new Set(paths.map((path13) => getDirs(path13)).reduce((a3, b3) => a3.concat(b3)));
|
|
101505
101666
|
this.#reservations.set(fn, { dirs, paths });
|
|
@@ -102559,7 +102720,7 @@ function decodeFilePath(path15) {
|
|
|
102559
102720
|
init_logger();
|
|
102560
102721
|
init_types3();
|
|
102561
102722
|
import { copyFile as copyFile3, lstat as lstat7, mkdir as mkdir27, readdir as readdir24 } from "node:fs/promises";
|
|
102562
|
-
import { join as
|
|
102723
|
+
import { join as join105, relative as relative21 } from "node:path";
|
|
102563
102724
|
async function withRetry(fn, retries = 3) {
|
|
102564
102725
|
for (let i = 0;i < retries; i++) {
|
|
102565
102726
|
try {
|
|
@@ -102581,8 +102742,8 @@ async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTrac
|
|
|
102581
102742
|
await mkdir27(destDir, { recursive: true });
|
|
102582
102743
|
const entries = await readdir24(sourceDir, { encoding: "utf8" });
|
|
102583
102744
|
for (const entry of entries) {
|
|
102584
|
-
const sourcePath =
|
|
102585
|
-
const destPath =
|
|
102745
|
+
const sourcePath = join105(sourceDir, entry);
|
|
102746
|
+
const destPath = join105(destDir, entry);
|
|
102586
102747
|
const relativePath = relative21(sourceDir, sourcePath);
|
|
102587
102748
|
if (!isPathSafe(destDir, destPath)) {
|
|
102588
102749
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -102609,8 +102770,8 @@ async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
|
102609
102770
|
await mkdir27(destDir, { recursive: true });
|
|
102610
102771
|
const entries = await readdir24(sourceDir, { encoding: "utf8" });
|
|
102611
102772
|
for (const entry of entries) {
|
|
102612
|
-
const sourcePath =
|
|
102613
|
-
const destPath =
|
|
102773
|
+
const sourcePath = join105(sourceDir, entry);
|
|
102774
|
+
const destPath = join105(destDir, entry);
|
|
102614
102775
|
const relativePath = relative21(sourceDir, sourcePath);
|
|
102615
102776
|
if (!isPathSafe(destDir, destPath)) {
|
|
102616
102777
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -102658,7 +102819,7 @@ class TarExtractor {
|
|
|
102658
102819
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
102659
102820
|
if (entries.length === 1) {
|
|
102660
102821
|
const rootEntry = entries[0];
|
|
102661
|
-
const rootPath =
|
|
102822
|
+
const rootPath = join106(tempExtractDir, rootEntry);
|
|
102662
102823
|
const rootStat = await stat15(rootPath);
|
|
102663
102824
|
if (rootStat.isDirectory()) {
|
|
102664
102825
|
const rootContents = await readdir25(rootPath, { encoding: "utf8" });
|
|
@@ -102674,7 +102835,7 @@ class TarExtractor {
|
|
|
102674
102835
|
}
|
|
102675
102836
|
} else {
|
|
102676
102837
|
await mkdir28(destDir, { recursive: true });
|
|
102677
|
-
await copyFile4(rootPath,
|
|
102838
|
+
await copyFile4(rootPath, join106(destDir, rootEntry));
|
|
102678
102839
|
}
|
|
102679
102840
|
} else {
|
|
102680
102841
|
logger.debug("Multiple root entries - moving all");
|
|
@@ -102696,7 +102857,7 @@ init_logger();
|
|
|
102696
102857
|
var import_extract_zip = __toESM(require_extract_zip(), 1);
|
|
102697
102858
|
import { execFile as execFile11 } from "node:child_process";
|
|
102698
102859
|
import { copyFile as copyFile5, mkdir as mkdir29, readdir as readdir26, rm as rm12, stat as stat16 } from "node:fs/promises";
|
|
102699
|
-
import { join as
|
|
102860
|
+
import { join as join107 } from "node:path";
|
|
102700
102861
|
import { promisify as promisify16 } from "node:util";
|
|
102701
102862
|
|
|
102702
102863
|
// src/domains/installation/extraction/native-zip-commands.ts
|
|
@@ -102788,7 +102949,7 @@ class ZipExtractor {
|
|
|
102788
102949
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
102789
102950
|
if (entries.length === 1) {
|
|
102790
102951
|
const rootEntry = entries[0];
|
|
102791
|
-
const rootPath =
|
|
102952
|
+
const rootPath = join107(tempExtractDir, rootEntry);
|
|
102792
102953
|
const rootStat = await stat16(rootPath);
|
|
102793
102954
|
if (rootStat.isDirectory()) {
|
|
102794
102955
|
const rootContents = await readdir26(rootPath, { encoding: "utf8" });
|
|
@@ -102804,7 +102965,7 @@ class ZipExtractor {
|
|
|
102804
102965
|
}
|
|
102805
102966
|
} else {
|
|
102806
102967
|
await mkdir29(destDir, { recursive: true });
|
|
102807
|
-
await copyFile5(rootPath,
|
|
102968
|
+
await copyFile5(rootPath, join107(destDir, rootEntry));
|
|
102808
102969
|
}
|
|
102809
102970
|
} else {
|
|
102810
102971
|
logger.debug("Multiple root entries - moving all");
|
|
@@ -102905,7 +103066,7 @@ class DownloadManager {
|
|
|
102905
103066
|
async createTempDir() {
|
|
102906
103067
|
const timestamp = Date.now();
|
|
102907
103068
|
const counter = DownloadManager.tempDirCounter++;
|
|
102908
|
-
const primaryTempDir =
|
|
103069
|
+
const primaryTempDir = join108(tmpdir4(), `claudekit-${timestamp}-${counter}`);
|
|
102909
103070
|
try {
|
|
102910
103071
|
await mkdir30(primaryTempDir, { recursive: true });
|
|
102911
103072
|
logger.debug(`Created temp directory: ${primaryTempDir}`);
|
|
@@ -102922,7 +103083,7 @@ Solutions:
|
|
|
102922
103083
|
2. Set HOME environment variable
|
|
102923
103084
|
3. Try running from a different directory`);
|
|
102924
103085
|
}
|
|
102925
|
-
const fallbackTempDir =
|
|
103086
|
+
const fallbackTempDir = join108(homeDir, ".claudekit", "tmp", `claudekit-${timestamp}-${counter}`);
|
|
102926
103087
|
try {
|
|
102927
103088
|
await mkdir30(fallbackTempDir, { recursive: true });
|
|
102928
103089
|
logger.debug(`Created temp directory (fallback): ${fallbackTempDir}`);
|
|
@@ -103382,20 +103543,20 @@ async function handleDownload(ctx) {
|
|
|
103382
103543
|
};
|
|
103383
103544
|
}
|
|
103384
103545
|
// src/commands/init/phases/merge-handler.ts
|
|
103385
|
-
import { join as
|
|
103546
|
+
import { join as join126 } from "node:path";
|
|
103386
103547
|
|
|
103387
103548
|
// src/domains/installation/deletion-handler.ts
|
|
103388
|
-
import { existsSync as
|
|
103389
|
-
import { dirname as dirname38, join as
|
|
103549
|
+
import { existsSync as existsSync68, lstatSync as lstatSync3, readdirSync as readdirSync10, rmSync as rmSync2, rmdirSync, unlinkSync as unlinkSync4 } from "node:fs";
|
|
103550
|
+
import { dirname as dirname38, join as join111, relative as relative22, resolve as resolve44, sep as sep12 } from "node:path";
|
|
103390
103551
|
|
|
103391
103552
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
103392
103553
|
init_metadata_migration();
|
|
103393
103554
|
init_logger();
|
|
103394
103555
|
init_types3();
|
|
103395
103556
|
var import_fs_extra11 = __toESM(require_lib(), 1);
|
|
103396
|
-
import { join as
|
|
103557
|
+
import { join as join110 } from "node:path";
|
|
103397
103558
|
async function readManifest(claudeDir3) {
|
|
103398
|
-
const metadataPath =
|
|
103559
|
+
const metadataPath = join110(claudeDir3, "metadata.json");
|
|
103399
103560
|
if (!await import_fs_extra11.pathExists(metadataPath)) {
|
|
103400
103561
|
return null;
|
|
103401
103562
|
}
|
|
@@ -103576,12 +103737,12 @@ function shouldDeletePath(path16, metadata, kitType) {
|
|
|
103576
103737
|
}
|
|
103577
103738
|
function collectFilesRecursively(dir, baseDir) {
|
|
103578
103739
|
const results = [];
|
|
103579
|
-
if (!
|
|
103740
|
+
if (!existsSync68(dir))
|
|
103580
103741
|
return results;
|
|
103581
103742
|
try {
|
|
103582
103743
|
const entries = readdirSync10(dir, { withFileTypes: true });
|
|
103583
103744
|
for (const entry of entries) {
|
|
103584
|
-
const fullPath =
|
|
103745
|
+
const fullPath = join111(dir, entry.name);
|
|
103585
103746
|
const relativePath = relative22(baseDir, fullPath);
|
|
103586
103747
|
if (entry.isDirectory()) {
|
|
103587
103748
|
results.push(...collectFilesRecursively(fullPath, baseDir));
|
|
@@ -103649,7 +103810,7 @@ function deletePath(fullPath, claudeDir3) {
|
|
|
103649
103810
|
}
|
|
103650
103811
|
}
|
|
103651
103812
|
async function updateMetadataAfterDeletion(claudeDir3, deletedPaths) {
|
|
103652
|
-
const metadataPath =
|
|
103813
|
+
const metadataPath = join111(claudeDir3, "metadata.json");
|
|
103653
103814
|
if (!await import_fs_extra12.pathExists(metadataPath)) {
|
|
103654
103815
|
return;
|
|
103655
103816
|
}
|
|
@@ -103704,7 +103865,7 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
|
|
|
103704
103865
|
const userMetadata = await readManifest(claudeDir3);
|
|
103705
103866
|
const result = { deletedPaths: [], preservedPaths: [], errors: [] };
|
|
103706
103867
|
for (const path16 of deletions) {
|
|
103707
|
-
const fullPath =
|
|
103868
|
+
const fullPath = join111(claudeDir3, path16);
|
|
103708
103869
|
const normalizedPath = resolve44(fullPath);
|
|
103709
103870
|
const normalizedClaudeDir = resolve44(claudeDir3);
|
|
103710
103871
|
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep12}`)) {
|
|
@@ -103717,7 +103878,7 @@ async function handleDeletions(sourceMetadata, claudeDir3, kitType) {
|
|
|
103717
103878
|
logger.verbose(`Preserved user file: ${path16}`);
|
|
103718
103879
|
continue;
|
|
103719
103880
|
}
|
|
103720
|
-
if (
|
|
103881
|
+
if (existsSync68(fullPath)) {
|
|
103721
103882
|
try {
|
|
103722
103883
|
deletePath(fullPath, claudeDir3);
|
|
103723
103884
|
result.deletedPaths.push(path16);
|
|
@@ -103744,7 +103905,7 @@ init_logger();
|
|
|
103744
103905
|
init_types3();
|
|
103745
103906
|
var import_fs_extra16 = __toESM(require_lib(), 1);
|
|
103746
103907
|
var import_ignore3 = __toESM(require_ignore(), 1);
|
|
103747
|
-
import { dirname as dirname42, join as
|
|
103908
|
+
import { dirname as dirname42, join as join116, relative as relative25 } from "node:path";
|
|
103748
103909
|
|
|
103749
103910
|
// src/domains/installation/selective-merger.ts
|
|
103750
103911
|
import { stat as stat18 } from "node:fs/promises";
|
|
@@ -103920,7 +104081,7 @@ class SelectiveMerger {
|
|
|
103920
104081
|
|
|
103921
104082
|
// src/domains/installation/merger/deleted-skill-preservation.ts
|
|
103922
104083
|
init_metadata_migration();
|
|
103923
|
-
import { dirname as dirname39, join as
|
|
104084
|
+
import { dirname as dirname39, join as join112, relative as relative23 } from "node:path";
|
|
103924
104085
|
var import_fs_extra13 = __toESM(require_lib(), 1);
|
|
103925
104086
|
async function findIgnoredSkillDirectories({
|
|
103926
104087
|
files,
|
|
@@ -103948,7 +104109,7 @@ async function findIgnoredSkillDirectories({
|
|
|
103948
104109
|
return root ? [root] : [];
|
|
103949
104110
|
}));
|
|
103950
104111
|
for (const [metadataRoot, sourceRoot] of sourceSkillRoots) {
|
|
103951
|
-
const destSkillRoot =
|
|
104112
|
+
const destSkillRoot = join112(destDir, ...sourceRoot.split("/"));
|
|
103952
104113
|
const skillExists = await import_fs_extra13.pathExists(destSkillRoot);
|
|
103953
104114
|
if (existingIgnoredRoots.has(metadataRoot) || !skillExists && previouslyTrackedRoots.has(metadataRoot)) {
|
|
103954
104115
|
ignoredSkillDirectories.add(metadataRoot);
|
|
@@ -103998,7 +104159,7 @@ init_logger();
|
|
|
103998
104159
|
var import_fs_extra14 = __toESM(require_lib(), 1);
|
|
103999
104160
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
104000
104161
|
import { relative as relative24 } from "node:path";
|
|
104001
|
-
import { join as
|
|
104162
|
+
import { join as join113 } from "node:path";
|
|
104002
104163
|
|
|
104003
104164
|
// node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
104004
104165
|
var balanced = (a3, b3, str2) => {
|
|
@@ -105454,7 +105615,7 @@ class FileScanner {
|
|
|
105454
105615
|
const files = [];
|
|
105455
105616
|
const entries = await import_fs_extra14.readdir(dir, { encoding: "utf8" });
|
|
105456
105617
|
for (const entry of entries) {
|
|
105457
|
-
const fullPath =
|
|
105618
|
+
const fullPath = join113(dir, entry);
|
|
105458
105619
|
const relativePath = relative24(baseDir, fullPath);
|
|
105459
105620
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
105460
105621
|
const stats = await import_fs_extra14.lstat(fullPath);
|
|
@@ -105490,13 +105651,13 @@ class FileScanner {
|
|
|
105490
105651
|
// src/domains/installation/merger/settings-processor.ts
|
|
105491
105652
|
import { execSync as execSync5 } from "node:child_process";
|
|
105492
105653
|
import { homedir as homedir46 } from "node:os";
|
|
105493
|
-
import { dirname as dirname41, join as
|
|
105654
|
+
import { dirname as dirname41, join as join115 } from "node:path";
|
|
105494
105655
|
|
|
105495
105656
|
// src/domains/config/installed-settings-tracker.ts
|
|
105496
105657
|
init_shared();
|
|
105497
|
-
import { existsSync as
|
|
105498
|
-
import { mkdir as mkdir31, readFile as
|
|
105499
|
-
import { dirname as dirname40, join as
|
|
105658
|
+
import { existsSync as existsSync69 } from "node:fs";
|
|
105659
|
+
import { mkdir as mkdir31, readFile as readFile53, writeFile as writeFile27 } from "node:fs/promises";
|
|
105660
|
+
import { dirname as dirname40, join as join114 } from "node:path";
|
|
105500
105661
|
var CK_JSON_FILE = ".ck.json";
|
|
105501
105662
|
|
|
105502
105663
|
class InstalledSettingsTracker {
|
|
@@ -105510,17 +105671,17 @@ class InstalledSettingsTracker {
|
|
|
105510
105671
|
}
|
|
105511
105672
|
getCkJsonPath() {
|
|
105512
105673
|
if (this.isGlobal) {
|
|
105513
|
-
return
|
|
105674
|
+
return join114(this.projectDir, CK_JSON_FILE);
|
|
105514
105675
|
}
|
|
105515
|
-
return
|
|
105676
|
+
return join114(this.projectDir, ".claude", CK_JSON_FILE);
|
|
105516
105677
|
}
|
|
105517
105678
|
async loadInstalledSettings() {
|
|
105518
105679
|
const ckJsonPath = this.getCkJsonPath();
|
|
105519
|
-
if (!
|
|
105680
|
+
if (!existsSync69(ckJsonPath)) {
|
|
105520
105681
|
return { hooks: [], mcpServers: [] };
|
|
105521
105682
|
}
|
|
105522
105683
|
try {
|
|
105523
|
-
const content = await
|
|
105684
|
+
const content = await readFile53(ckJsonPath, "utf-8");
|
|
105524
105685
|
const data = parseJsonContent(content);
|
|
105525
105686
|
const installed = data.kits?.[this.kitName]?.installedSettings;
|
|
105526
105687
|
if (installed) {
|
|
@@ -105536,8 +105697,8 @@ class InstalledSettingsTracker {
|
|
|
105536
105697
|
const ckJsonPath = this.getCkJsonPath();
|
|
105537
105698
|
try {
|
|
105538
105699
|
let data = {};
|
|
105539
|
-
if (
|
|
105540
|
-
const content = await
|
|
105700
|
+
if (existsSync69(ckJsonPath)) {
|
|
105701
|
+
const content = await readFile53(ckJsonPath, "utf-8");
|
|
105541
105702
|
data = parseJsonContent(content);
|
|
105542
105703
|
}
|
|
105543
105704
|
if (!data.kits) {
|
|
@@ -105780,10 +105941,10 @@ class SettingsProcessor {
|
|
|
105780
105941
|
};
|
|
105781
105942
|
try {
|
|
105782
105943
|
if (this.isGlobal) {
|
|
105783
|
-
await addFromConfig(
|
|
105944
|
+
await addFromConfig(join115(this.projectDir, ".ck.json"));
|
|
105784
105945
|
} else {
|
|
105785
|
-
await addFromConfig(
|
|
105786
|
-
await addFromConfig(
|
|
105946
|
+
await addFromConfig(join115(PathResolver.getGlobalKitDir(), ".ck.json"));
|
|
105947
|
+
await addFromConfig(join115(this.projectDir, ".claude", ".ck.json"));
|
|
105787
105948
|
}
|
|
105788
105949
|
} catch (error) {
|
|
105789
105950
|
logger.debug(`Failed to load .ck.json hook preferences: ${error instanceof Error ? error.message : "unknown"}`);
|
|
@@ -106170,7 +106331,7 @@ class SettingsProcessor {
|
|
|
106170
106331
|
return false;
|
|
106171
106332
|
}
|
|
106172
106333
|
const configuredGlobalDir = PathResolver.getGlobalKitDir().replace(/\\/g, "/").replace(/\/+$/, "");
|
|
106173
|
-
const defaultGlobalDir =
|
|
106334
|
+
const defaultGlobalDir = join115(homedir46(), ".claude").replace(/\\/g, "/");
|
|
106174
106335
|
return configuredGlobalDir !== defaultGlobalDir;
|
|
106175
106336
|
}
|
|
106176
106337
|
getClaudeCommandRoot() {
|
|
@@ -106190,7 +106351,7 @@ class SettingsProcessor {
|
|
|
106190
106351
|
return true;
|
|
106191
106352
|
}
|
|
106192
106353
|
async repairSiblingSettingsLocal(destFile) {
|
|
106193
|
-
const settingsLocalPath =
|
|
106354
|
+
const settingsLocalPath = join115(dirname41(destFile), "settings.local.json");
|
|
106194
106355
|
if (settingsLocalPath === destFile || !await import_fs_extra15.pathExists(settingsLocalPath)) {
|
|
106195
106356
|
return;
|
|
106196
106357
|
}
|
|
@@ -106287,7 +106448,7 @@ class SettingsProcessor {
|
|
|
106287
106448
|
}
|
|
106288
106449
|
}
|
|
106289
106450
|
async dynamicTeamHookHandlerExists(destFile, handler) {
|
|
106290
|
-
return import_fs_extra15.pathExists(
|
|
106451
|
+
return import_fs_extra15.pathExists(join115(dirname41(destFile), "hooks", handler));
|
|
106291
106452
|
}
|
|
106292
106453
|
removeDynamicTeamHookRegistrations(settings) {
|
|
106293
106454
|
let removed = 0;
|
|
@@ -106428,7 +106589,7 @@ class CopyExecutor {
|
|
|
106428
106589
|
for (const file of files) {
|
|
106429
106590
|
const relativePath = relative25(sourceDir, file);
|
|
106430
106591
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
106431
|
-
const destPath =
|
|
106592
|
+
const destPath = join116(destDir, relativePath);
|
|
106432
106593
|
if (await import_fs_extra16.pathExists(destPath)) {
|
|
106433
106594
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
106434
106595
|
logger.debug(`Security-sensitive file exists but won't be overwritten: ${normalizedRelativePath}`);
|
|
@@ -106452,7 +106613,7 @@ class CopyExecutor {
|
|
|
106452
106613
|
for (const file of files) {
|
|
106453
106614
|
const relativePath = relative25(sourceDir, file);
|
|
106454
106615
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
106455
|
-
const destPath =
|
|
106616
|
+
const destPath = join116(destDir, relativePath);
|
|
106456
106617
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
106457
106618
|
logger.debug(`Skipping security-sensitive file: ${normalizedRelativePath}`);
|
|
106458
106619
|
skippedCount++;
|
|
@@ -106664,15 +106825,15 @@ class FileMerger {
|
|
|
106664
106825
|
|
|
106665
106826
|
// src/domains/migration/legacy-migration.ts
|
|
106666
106827
|
import { readdir as readdir28, stat as stat19 } from "node:fs/promises";
|
|
106667
|
-
import { join as
|
|
106828
|
+
import { join as join120, relative as relative26 } from "node:path";
|
|
106668
106829
|
// src/services/file-operations/manifest/manifest-tracker.ts
|
|
106669
|
-
import { join as
|
|
106830
|
+
import { join as join119 } from "node:path";
|
|
106670
106831
|
|
|
106671
106832
|
// src/domains/migration/release-manifest.ts
|
|
106672
106833
|
init_logger();
|
|
106673
106834
|
init_zod();
|
|
106674
106835
|
var import_fs_extra17 = __toESM(require_lib(), 1);
|
|
106675
|
-
import { join as
|
|
106836
|
+
import { join as join117 } from "node:path";
|
|
106676
106837
|
var ReleaseManifestFileSchema = exports_external.object({
|
|
106677
106838
|
path: exports_external.string(),
|
|
106678
106839
|
checksum: exports_external.string().regex(/^[a-f0-9]{64}$/),
|
|
@@ -106687,7 +106848,7 @@ var ReleaseManifestSchema = exports_external.object({
|
|
|
106687
106848
|
|
|
106688
106849
|
class ReleaseManifestLoader {
|
|
106689
106850
|
static async load(extractDir) {
|
|
106690
|
-
const manifestPath =
|
|
106851
|
+
const manifestPath = join117(extractDir, "release-manifest.json");
|
|
106691
106852
|
try {
|
|
106692
106853
|
const content = await import_fs_extra17.readFile(manifestPath, "utf-8");
|
|
106693
106854
|
const parsed = JSON.parse(content);
|
|
@@ -106710,12 +106871,12 @@ init_p_limit();
|
|
|
106710
106871
|
|
|
106711
106872
|
// src/services/file-operations/manifest/manifest-updater.ts
|
|
106712
106873
|
init_metadata_migration();
|
|
106713
|
-
import { join as
|
|
106874
|
+
import { join as join118 } from "node:path";
|
|
106714
106875
|
init_logger();
|
|
106715
106876
|
init_types3();
|
|
106716
106877
|
var import_fs_extra18 = __toESM(require_lib(), 1);
|
|
106717
106878
|
async function writeManifest(claudeDir3, kitName, version, scope, kitType, trackedFiles, userConfigFiles, ignoredSkills = [], installModePreference) {
|
|
106718
|
-
const metadataPath =
|
|
106879
|
+
const metadataPath = join118(claudeDir3, "metadata.json");
|
|
106719
106880
|
const kit = kitType || (/\bmarketing\b/i.test(kitName) ? "marketing" : "engineer");
|
|
106720
106881
|
await import_fs_extra18.ensureFile(metadataPath);
|
|
106721
106882
|
let release = null;
|
|
@@ -106789,7 +106950,7 @@ function uniqueNormalizedSkillRoots(paths) {
|
|
|
106789
106950
|
}))).sort();
|
|
106790
106951
|
}
|
|
106791
106952
|
async function removeKitFromManifest(claudeDir3, kit, options2) {
|
|
106792
|
-
const metadataPath =
|
|
106953
|
+
const metadataPath = join118(claudeDir3, "metadata.json");
|
|
106793
106954
|
if (!await import_fs_extra18.pathExists(metadataPath))
|
|
106794
106955
|
return false;
|
|
106795
106956
|
let release = null;
|
|
@@ -106821,7 +106982,7 @@ async function removeKitFromManifest(claudeDir3, kit, options2) {
|
|
|
106821
106982
|
}
|
|
106822
106983
|
}
|
|
106823
106984
|
async function retainTrackedFilesInManifest(claudeDir3, retainedPaths, options2) {
|
|
106824
|
-
const metadataPath =
|
|
106985
|
+
const metadataPath = join118(claudeDir3, "metadata.json");
|
|
106825
106986
|
if (!await import_fs_extra18.pathExists(metadataPath))
|
|
106826
106987
|
return false;
|
|
106827
106988
|
const normalizedPaths = new Set(retainedPaths.map((path17) => path17.replace(/\\/g, "/")));
|
|
@@ -107002,7 +107163,7 @@ function buildFileTrackingList(options2) {
|
|
|
107002
107163
|
if (!isGlobal && !installedPath.startsWith(".claude/"))
|
|
107003
107164
|
continue;
|
|
107004
107165
|
const relativePath = isGlobal ? installedPath : installedPath.replace(/^\.claude\//, "");
|
|
107005
|
-
const filePath =
|
|
107166
|
+
const filePath = join119(claudeDir3, relativePath);
|
|
107006
107167
|
const manifestEntry = releaseManifest ? ReleaseManifestLoader.findFile(releaseManifest, installedPath) : null;
|
|
107007
107168
|
const ownership = manifestEntry ? "ck" : "user";
|
|
107008
107169
|
filesToTrack.push({
|
|
@@ -107113,7 +107274,7 @@ class LegacyMigration {
|
|
|
107113
107274
|
continue;
|
|
107114
107275
|
if (SKIP_DIRS_ALL.includes(entry))
|
|
107115
107276
|
continue;
|
|
107116
|
-
const fullPath =
|
|
107277
|
+
const fullPath = join120(dir, entry);
|
|
107117
107278
|
let stats;
|
|
107118
107279
|
try {
|
|
107119
107280
|
stats = await stat19(fullPath);
|
|
@@ -107223,7 +107384,7 @@ User-created files (sample):`);
|
|
|
107223
107384
|
];
|
|
107224
107385
|
if (filesToChecksum.length > 0) {
|
|
107225
107386
|
const checksumResults = await mapWithLimit(filesToChecksum, async ({ relativePath, ownership }) => {
|
|
107226
|
-
const fullPath =
|
|
107387
|
+
const fullPath = join120(claudeDir3, relativePath);
|
|
107227
107388
|
const checksum = await OwnershipChecker.calculateChecksum(fullPath);
|
|
107228
107389
|
return { relativePath, checksum, ownership };
|
|
107229
107390
|
}, getOptimalConcurrency());
|
|
@@ -107244,7 +107405,7 @@ User-created files (sample):`);
|
|
|
107244
107405
|
installedAt: new Date().toISOString(),
|
|
107245
107406
|
files: trackedFiles
|
|
107246
107407
|
};
|
|
107247
|
-
const metadataPath =
|
|
107408
|
+
const metadataPath = join120(claudeDir3, "metadata.json");
|
|
107248
107409
|
await import_fs_extra19.writeFile(metadataPath, JSON.stringify(updatedMetadata, null, 2));
|
|
107249
107410
|
logger.success(`Migration complete: tracked ${trackedFiles.length} files`);
|
|
107250
107411
|
return true;
|
|
@@ -107350,7 +107511,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
|
|
|
107350
107511
|
init_logger();
|
|
107351
107512
|
init_skip_directories();
|
|
107352
107513
|
var import_fs_extra20 = __toESM(require_lib(), 1);
|
|
107353
|
-
import { join as
|
|
107514
|
+
import { join as join121, relative as relative27, resolve as resolve45 } from "node:path";
|
|
107354
107515
|
|
|
107355
107516
|
class FileScanner2 {
|
|
107356
107517
|
static async getFiles(dirPath, relativeTo) {
|
|
@@ -107366,7 +107527,7 @@ class FileScanner2 {
|
|
|
107366
107527
|
logger.debug(`Skipping directory: ${entry}`);
|
|
107367
107528
|
continue;
|
|
107368
107529
|
}
|
|
107369
|
-
const fullPath =
|
|
107530
|
+
const fullPath = join121(dirPath, entry);
|
|
107370
107531
|
if (!FileScanner2.isSafePath(basePath, fullPath)) {
|
|
107371
107532
|
logger.warning(`Skipping potentially unsafe path: ${entry}`);
|
|
107372
107533
|
continue;
|
|
@@ -107401,8 +107562,8 @@ class FileScanner2 {
|
|
|
107401
107562
|
return files;
|
|
107402
107563
|
}
|
|
107403
107564
|
static async findCustomFiles(destDir, sourceDir, subPath) {
|
|
107404
|
-
const destSubDir =
|
|
107405
|
-
const sourceSubDir =
|
|
107565
|
+
const destSubDir = join121(destDir, subPath);
|
|
107566
|
+
const sourceSubDir = join121(sourceDir, subPath);
|
|
107406
107567
|
logger.debug(`findCustomFiles - destDir: ${destDir}`);
|
|
107407
107568
|
logger.debug(`findCustomFiles - sourceDir: ${sourceDir}`);
|
|
107408
107569
|
logger.debug(`findCustomFiles - subPath: "${subPath}"`);
|
|
@@ -107443,12 +107604,12 @@ class FileScanner2 {
|
|
|
107443
107604
|
init_logger();
|
|
107444
107605
|
var import_fs_extra21 = __toESM(require_lib(), 1);
|
|
107445
107606
|
import { lstat as lstat10, mkdir as mkdir32, readdir as readdir31, stat as stat20 } from "node:fs/promises";
|
|
107446
|
-
import { join as
|
|
107607
|
+
import { join as join123 } from "node:path";
|
|
107447
107608
|
|
|
107448
107609
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
107449
107610
|
init_logger();
|
|
107450
|
-
import { readFile as
|
|
107451
|
-
import { join as
|
|
107611
|
+
import { readFile as readFile57, readdir as readdir30, writeFile as writeFile31 } from "node:fs/promises";
|
|
107612
|
+
import { join as join122 } from "node:path";
|
|
107452
107613
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
107453
107614
|
".md",
|
|
107454
107615
|
".txt",
|
|
@@ -107508,7 +107669,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
107508
107669
|
async function processDirectory(dir) {
|
|
107509
107670
|
const entries = await readdir30(dir, { withFileTypes: true });
|
|
107510
107671
|
for (const entry of entries) {
|
|
107511
|
-
const fullPath =
|
|
107672
|
+
const fullPath = join122(dir, entry.name);
|
|
107512
107673
|
if (entry.isDirectory()) {
|
|
107513
107674
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
107514
107675
|
continue;
|
|
@@ -107516,7 +107677,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
107516
107677
|
await processDirectory(fullPath);
|
|
107517
107678
|
} else if (entry.isFile() && shouldTransformFile(entry.name)) {
|
|
107518
107679
|
try {
|
|
107519
|
-
const content = await
|
|
107680
|
+
const content = await readFile57(fullPath, "utf-8");
|
|
107520
107681
|
const { transformed, changes } = transformCommandContent(content);
|
|
107521
107682
|
if (changes > 0) {
|
|
107522
107683
|
if (options2.dryRun) {
|
|
@@ -107583,14 +107744,14 @@ function shouldApplyPrefix(options2) {
|
|
|
107583
107744
|
// src/services/transformers/commands-prefix/prefix-applier.ts
|
|
107584
107745
|
async function applyPrefix(extractDir) {
|
|
107585
107746
|
validatePath(extractDir, "extractDir");
|
|
107586
|
-
const commandsDir =
|
|
107747
|
+
const commandsDir = join123(extractDir, ".claude", "commands");
|
|
107587
107748
|
if (!await import_fs_extra21.pathExists(commandsDir)) {
|
|
107588
107749
|
logger.verbose("No commands directory found, skipping prefix application");
|
|
107589
107750
|
return;
|
|
107590
107751
|
}
|
|
107591
107752
|
logger.info("Applying /ck: prefix to slash commands...");
|
|
107592
|
-
const backupDir =
|
|
107593
|
-
const tempDir =
|
|
107753
|
+
const backupDir = join123(extractDir, ".commands-backup");
|
|
107754
|
+
const tempDir = join123(extractDir, ".commands-prefix-temp");
|
|
107594
107755
|
try {
|
|
107595
107756
|
const entries = await readdir31(commandsDir);
|
|
107596
107757
|
if (entries.length === 0) {
|
|
@@ -107598,7 +107759,7 @@ async function applyPrefix(extractDir) {
|
|
|
107598
107759
|
return;
|
|
107599
107760
|
}
|
|
107600
107761
|
if (entries.length === 1 && entries[0] === "ck") {
|
|
107601
|
-
const ckDir2 =
|
|
107762
|
+
const ckDir2 = join123(commandsDir, "ck");
|
|
107602
107763
|
const ckStat = await stat20(ckDir2);
|
|
107603
107764
|
if (ckStat.isDirectory()) {
|
|
107604
107765
|
logger.verbose("Commands already have /ck: prefix, skipping");
|
|
@@ -107608,17 +107769,17 @@ async function applyPrefix(extractDir) {
|
|
|
107608
107769
|
await import_fs_extra21.copy(commandsDir, backupDir);
|
|
107609
107770
|
logger.verbose("Created backup of commands directory");
|
|
107610
107771
|
await mkdir32(tempDir, { recursive: true });
|
|
107611
|
-
const ckDir =
|
|
107772
|
+
const ckDir = join123(tempDir, "ck");
|
|
107612
107773
|
await mkdir32(ckDir, { recursive: true });
|
|
107613
107774
|
let processedCount = 0;
|
|
107614
107775
|
for (const entry of entries) {
|
|
107615
|
-
const sourcePath =
|
|
107776
|
+
const sourcePath = join123(commandsDir, entry);
|
|
107616
107777
|
const stats = await lstat10(sourcePath);
|
|
107617
107778
|
if (stats.isSymbolicLink()) {
|
|
107618
107779
|
logger.warning(`Skipping symlink for security: ${entry}`);
|
|
107619
107780
|
continue;
|
|
107620
107781
|
}
|
|
107621
|
-
const destPath =
|
|
107782
|
+
const destPath = join123(ckDir, entry);
|
|
107622
107783
|
await import_fs_extra21.copy(sourcePath, destPath, {
|
|
107623
107784
|
overwrite: false,
|
|
107624
107785
|
errorOnExist: true
|
|
@@ -107636,7 +107797,7 @@ async function applyPrefix(extractDir) {
|
|
|
107636
107797
|
await import_fs_extra21.move(tempDir, commandsDir);
|
|
107637
107798
|
await import_fs_extra21.remove(backupDir);
|
|
107638
107799
|
logger.success("Successfully reorganized commands to /ck: prefix");
|
|
107639
|
-
const claudeDir3 =
|
|
107800
|
+
const claudeDir3 = join123(extractDir, ".claude");
|
|
107640
107801
|
logger.info("Transforming command references in file contents...");
|
|
107641
107802
|
const transformResult = await transformCommandReferences(claudeDir3, {
|
|
107642
107803
|
verbose: logger.isVerbose()
|
|
@@ -107674,20 +107835,20 @@ async function applyPrefix(extractDir) {
|
|
|
107674
107835
|
// src/services/transformers/commands-prefix/prefix-cleaner.ts
|
|
107675
107836
|
init_metadata_migration();
|
|
107676
107837
|
import { lstat as lstat12, readdir as readdir33 } from "node:fs/promises";
|
|
107677
|
-
import { join as
|
|
107838
|
+
import { join as join125 } from "node:path";
|
|
107678
107839
|
init_logger();
|
|
107679
107840
|
var import_fs_extra23 = __toESM(require_lib(), 1);
|
|
107680
107841
|
|
|
107681
107842
|
// src/services/transformers/commands-prefix/file-processor.ts
|
|
107682
107843
|
import { lstat as lstat11, readdir as readdir32 } from "node:fs/promises";
|
|
107683
|
-
import { join as
|
|
107844
|
+
import { join as join124 } from "node:path";
|
|
107684
107845
|
init_logger();
|
|
107685
107846
|
var import_fs_extra22 = __toESM(require_lib(), 1);
|
|
107686
107847
|
async function scanDirectoryFiles(dir) {
|
|
107687
107848
|
const files = [];
|
|
107688
107849
|
const entries = await readdir32(dir);
|
|
107689
107850
|
for (const entry of entries) {
|
|
107690
|
-
const fullPath =
|
|
107851
|
+
const fullPath = join124(dir, entry);
|
|
107691
107852
|
const stats = await lstat11(fullPath);
|
|
107692
107853
|
if (stats.isSymbolicLink()) {
|
|
107693
107854
|
continue;
|
|
@@ -107815,8 +107976,8 @@ function isDifferentKitDirectory(dirName, currentKit) {
|
|
|
107815
107976
|
async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
107816
107977
|
const { dryRun = false } = options2;
|
|
107817
107978
|
validatePath(targetDir, "targetDir");
|
|
107818
|
-
const claudeDir3 = isGlobal ? targetDir :
|
|
107819
|
-
const commandsDir =
|
|
107979
|
+
const claudeDir3 = isGlobal ? targetDir : join125(targetDir, ".claude");
|
|
107980
|
+
const commandsDir = join125(claudeDir3, "commands");
|
|
107820
107981
|
const accumulator = {
|
|
107821
107982
|
results: [],
|
|
107822
107983
|
deletedCount: 0,
|
|
@@ -107858,7 +108019,7 @@ async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
|
107858
108019
|
}
|
|
107859
108020
|
const metadataForChecks = options2.kitType ? createKitSpecificMetadata(metadata, options2.kitType) : metadata;
|
|
107860
108021
|
for (const entry of entries) {
|
|
107861
|
-
const entryPath =
|
|
108022
|
+
const entryPath = join125(commandsDir, entry);
|
|
107862
108023
|
const stats = await lstat12(entryPath);
|
|
107863
108024
|
if (stats.isSymbolicLink()) {
|
|
107864
108025
|
addSymlinkSkip(entry, accumulator);
|
|
@@ -107927,7 +108088,7 @@ async function handleMerge(ctx) {
|
|
|
107927
108088
|
let customClaudeFiles = [];
|
|
107928
108089
|
if (!ctx.options.fresh) {
|
|
107929
108090
|
logger.info("Scanning for custom .claude files...");
|
|
107930
|
-
const scanSourceDir = ctx.options.global ?
|
|
108091
|
+
const scanSourceDir = ctx.options.global ? join126(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
107931
108092
|
const scanTargetSubdir = ctx.options.global ? "" : ".claude";
|
|
107932
108093
|
customClaudeFiles = await FileScanner2.findCustomFiles(ctx.resolvedDir, scanSourceDir, scanTargetSubdir);
|
|
107933
108094
|
} else {
|
|
@@ -107966,7 +108127,7 @@ async function handleMerge(ctx) {
|
|
|
107966
108127
|
merger.setRestoreCkHooks(ctx.options.restoreCkHooks);
|
|
107967
108128
|
merger.setProjectDir(ctx.resolvedDir);
|
|
107968
108129
|
merger.setKitName(ctx.kit.name);
|
|
107969
|
-
merger.setZombiePrunerHookDir(
|
|
108130
|
+
merger.setZombiePrunerHookDir(join126(ctx.claudeDir, "hooks"));
|
|
107970
108131
|
if (ctx.kitType) {
|
|
107971
108132
|
merger.setMultiKitContext(ctx.claudeDir, ctx.kitType);
|
|
107972
108133
|
}
|
|
@@ -107995,8 +108156,8 @@ async function handleMerge(ctx) {
|
|
|
107995
108156
|
return { ...ctx, cancelled: true };
|
|
107996
108157
|
}
|
|
107997
108158
|
}
|
|
107998
|
-
const sourceDir = ctx.options.global ?
|
|
107999
|
-
const sourceMetadataPath = ctx.options.global ?
|
|
108159
|
+
const sourceDir = ctx.options.global ? join126(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
108160
|
+
const sourceMetadataPath = ctx.options.global ? join126(sourceDir, "metadata.json") : join126(sourceDir, ".claude", "metadata.json");
|
|
108000
108161
|
let sourceMetadata = null;
|
|
108001
108162
|
try {
|
|
108002
108163
|
if (await import_fs_extra24.pathExists(sourceMetadataPath)) {
|
|
@@ -108057,7 +108218,7 @@ async function handleMerge(ctx) {
|
|
|
108057
108218
|
};
|
|
108058
108219
|
}
|
|
108059
108220
|
// src/commands/init/phases/migration-handler.ts
|
|
108060
|
-
import { join as
|
|
108221
|
+
import { join as join134 } from "node:path";
|
|
108061
108222
|
|
|
108062
108223
|
// src/domains/skills/skills-detector.ts
|
|
108063
108224
|
init_logger();
|
|
@@ -108072,8 +108233,8 @@ init_skip_directories();
|
|
|
108072
108233
|
init_types3();
|
|
108073
108234
|
var import_fs_extra25 = __toESM(require_lib(), 1);
|
|
108074
108235
|
import { createHash as createHash8 } from "node:crypto";
|
|
108075
|
-
import { readFile as
|
|
108076
|
-
import { join as
|
|
108236
|
+
import { readFile as readFile59, readdir as readdir34, writeFile as writeFile32 } from "node:fs/promises";
|
|
108237
|
+
import { join as join127, relative as relative28 } from "node:path";
|
|
108077
108238
|
|
|
108078
108239
|
class SkillsManifestManager {
|
|
108079
108240
|
static MANIFEST_FILENAME = ".skills-manifest.json";
|
|
@@ -108095,18 +108256,18 @@ class SkillsManifestManager {
|
|
|
108095
108256
|
return manifest;
|
|
108096
108257
|
}
|
|
108097
108258
|
static async writeManifest(skillsDir2, manifest) {
|
|
108098
|
-
const manifestPath =
|
|
108259
|
+
const manifestPath = join127(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
108099
108260
|
await writeFile32(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
108100
108261
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
108101
108262
|
}
|
|
108102
108263
|
static async readManifest(skillsDir2) {
|
|
108103
|
-
const manifestPath =
|
|
108264
|
+
const manifestPath = join127(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
108104
108265
|
if (!await import_fs_extra25.pathExists(manifestPath)) {
|
|
108105
108266
|
logger.debug(`No manifest found at: ${manifestPath}`);
|
|
108106
108267
|
return null;
|
|
108107
108268
|
}
|
|
108108
108269
|
try {
|
|
108109
|
-
const content = await
|
|
108270
|
+
const content = await readFile59(manifestPath, "utf-8");
|
|
108110
108271
|
const data = JSON.parse(content);
|
|
108111
108272
|
const manifest = SkillsManifestSchema.parse(data);
|
|
108112
108273
|
logger.debug(`Read manifest from: ${manifestPath}`);
|
|
@@ -108123,7 +108284,7 @@ class SkillsManifestManager {
|
|
|
108123
108284
|
return "flat";
|
|
108124
108285
|
}
|
|
108125
108286
|
for (const dir of dirs.slice(0, 3)) {
|
|
108126
|
-
const dirPath =
|
|
108287
|
+
const dirPath = join127(skillsDir2, dir.name);
|
|
108127
108288
|
const subEntries = await readdir34(dirPath, { withFileTypes: true });
|
|
108128
108289
|
const hasSubdirs = subEntries.some((entry) => entry.isDirectory());
|
|
108129
108290
|
if (hasSubdirs) {
|
|
@@ -108142,7 +108303,7 @@ class SkillsManifestManager {
|
|
|
108142
108303
|
const entries = await readdir34(skillsDir2, { withFileTypes: true });
|
|
108143
108304
|
for (const entry of entries) {
|
|
108144
108305
|
if (entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith(".")) {
|
|
108145
|
-
const skillPath =
|
|
108306
|
+
const skillPath = join127(skillsDir2, entry.name);
|
|
108146
108307
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
108147
108308
|
skills.push({
|
|
108148
108309
|
name: entry.name,
|
|
@@ -108154,11 +108315,11 @@ class SkillsManifestManager {
|
|
|
108154
108315
|
const categories = await readdir34(skillsDir2, { withFileTypes: true });
|
|
108155
108316
|
for (const category of categories) {
|
|
108156
108317
|
if (category.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(category.name) && !category.name.startsWith(".")) {
|
|
108157
|
-
const categoryPath =
|
|
108318
|
+
const categoryPath = join127(skillsDir2, category.name);
|
|
108158
108319
|
const skillEntries = await readdir34(categoryPath, { withFileTypes: true });
|
|
108159
108320
|
for (const skillEntry of skillEntries) {
|
|
108160
108321
|
if (skillEntry.isDirectory() && !skillEntry.name.startsWith(".")) {
|
|
108161
|
-
const skillPath =
|
|
108322
|
+
const skillPath = join127(categoryPath, skillEntry.name);
|
|
108162
108323
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
108163
108324
|
skills.push({
|
|
108164
108325
|
name: skillEntry.name,
|
|
@@ -108178,7 +108339,7 @@ class SkillsManifestManager {
|
|
|
108178
108339
|
files.sort();
|
|
108179
108340
|
for (const file of files) {
|
|
108180
108341
|
const relativePath = relative28(dirPath, file);
|
|
108181
|
-
const content = await
|
|
108342
|
+
const content = await readFile59(file);
|
|
108182
108343
|
hash.update(relativePath);
|
|
108183
108344
|
hash.update(content);
|
|
108184
108345
|
}
|
|
@@ -108188,7 +108349,7 @@ class SkillsManifestManager {
|
|
|
108188
108349
|
const files = [];
|
|
108189
108350
|
const entries = await readdir34(dirPath, { withFileTypes: true });
|
|
108190
108351
|
for (const entry of entries) {
|
|
108191
|
-
const fullPath =
|
|
108352
|
+
const fullPath = join127(dirPath, entry.name);
|
|
108192
108353
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name)) {
|
|
108193
108354
|
continue;
|
|
108194
108355
|
}
|
|
@@ -108310,7 +108471,7 @@ function getPathMapping(skillName, oldBasePath, newBasePath) {
|
|
|
108310
108471
|
// src/domains/skills/detection/script-detector.ts
|
|
108311
108472
|
var import_fs_extra26 = __toESM(require_lib(), 1);
|
|
108312
108473
|
import { readdir as readdir35 } from "node:fs/promises";
|
|
108313
|
-
import { join as
|
|
108474
|
+
import { join as join128 } from "node:path";
|
|
108314
108475
|
async function scanDirectory(skillsDir2) {
|
|
108315
108476
|
if (!await import_fs_extra26.pathExists(skillsDir2)) {
|
|
108316
108477
|
return ["flat", []];
|
|
@@ -108323,12 +108484,12 @@ async function scanDirectory(skillsDir2) {
|
|
|
108323
108484
|
let totalSkillLikeCount = 0;
|
|
108324
108485
|
const allSkills = [];
|
|
108325
108486
|
for (const dir of dirs) {
|
|
108326
|
-
const dirPath =
|
|
108487
|
+
const dirPath = join128(skillsDir2, dir.name);
|
|
108327
108488
|
const subEntries = await readdir35(dirPath, { withFileTypes: true });
|
|
108328
108489
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
108329
108490
|
if (subdirs.length > 0) {
|
|
108330
108491
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
108331
|
-
const subdirPath =
|
|
108492
|
+
const subdirPath = join128(dirPath, subdir.name);
|
|
108332
108493
|
const subdirFiles = await readdir35(subdirPath, { withFileTypes: true });
|
|
108333
108494
|
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"));
|
|
108334
108495
|
if (hasSkillMarker) {
|
|
@@ -108485,12 +108646,12 @@ class SkillsMigrationDetector {
|
|
|
108485
108646
|
// src/domains/skills/skills-migrator.ts
|
|
108486
108647
|
init_logger();
|
|
108487
108648
|
init_types3();
|
|
108488
|
-
import { join as
|
|
108649
|
+
import { join as join133 } from "node:path";
|
|
108489
108650
|
|
|
108490
108651
|
// src/domains/skills/migrator/migration-executor.ts
|
|
108491
108652
|
init_logger();
|
|
108492
108653
|
import { copyFile as copyFile6, mkdir as mkdir33, readdir as readdir36, rm as rm13 } from "node:fs/promises";
|
|
108493
|
-
import { join as
|
|
108654
|
+
import { join as join129 } from "node:path";
|
|
108494
108655
|
var import_fs_extra28 = __toESM(require_lib(), 1);
|
|
108495
108656
|
|
|
108496
108657
|
// src/domains/skills/skills-migration-prompts.ts
|
|
@@ -108655,8 +108816,8 @@ async function copySkillDirectory(sourceDir, destDir) {
|
|
|
108655
108816
|
await mkdir33(destDir, { recursive: true });
|
|
108656
108817
|
const entries = await readdir36(sourceDir, { withFileTypes: true });
|
|
108657
108818
|
for (const entry of entries) {
|
|
108658
|
-
const sourcePath =
|
|
108659
|
-
const destPath =
|
|
108819
|
+
const sourcePath = join129(sourceDir, entry.name);
|
|
108820
|
+
const destPath = join129(destDir, entry.name);
|
|
108660
108821
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
108661
108822
|
continue;
|
|
108662
108823
|
}
|
|
@@ -108671,7 +108832,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
108671
108832
|
const migrated = [];
|
|
108672
108833
|
const preserved = [];
|
|
108673
108834
|
const errors2 = [];
|
|
108674
|
-
const tempDir =
|
|
108835
|
+
const tempDir = join129(currentSkillsDir, "..", ".skills-migration-temp");
|
|
108675
108836
|
await mkdir33(tempDir, { recursive: true });
|
|
108676
108837
|
try {
|
|
108677
108838
|
for (const mapping of mappings) {
|
|
@@ -108692,9 +108853,9 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
108692
108853
|
}
|
|
108693
108854
|
}
|
|
108694
108855
|
const category = mapping.category;
|
|
108695
|
-
const targetPath = category ?
|
|
108856
|
+
const targetPath = category ? join129(tempDir, category, skillName) : join129(tempDir, skillName);
|
|
108696
108857
|
if (category) {
|
|
108697
|
-
await mkdir33(
|
|
108858
|
+
await mkdir33(join129(tempDir, category), { recursive: true });
|
|
108698
108859
|
}
|
|
108699
108860
|
await copySkillDirectory(currentSkillPath, targetPath);
|
|
108700
108861
|
migrated.push(skillName);
|
|
@@ -108761,7 +108922,7 @@ init_logger();
|
|
|
108761
108922
|
init_types3();
|
|
108762
108923
|
var import_fs_extra29 = __toESM(require_lib(), 1);
|
|
108763
108924
|
import { copyFile as copyFile7, mkdir as mkdir34, readdir as readdir37, rm as rm14, stat as stat21 } from "node:fs/promises";
|
|
108764
|
-
import { basename as basename27, join as
|
|
108925
|
+
import { basename as basename27, join as join130, normalize as normalize10 } from "node:path";
|
|
108765
108926
|
function validatePath2(path17, paramName) {
|
|
108766
108927
|
if (!path17 || typeof path17 !== "string") {
|
|
108767
108928
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -108787,7 +108948,7 @@ class SkillsBackupManager {
|
|
|
108787
108948
|
const timestamp = Date.now();
|
|
108788
108949
|
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
|
108789
108950
|
const backupDirName = `${SkillsBackupManager.BACKUP_PREFIX}${timestamp}-${randomSuffix}`;
|
|
108790
|
-
const backupDir = parentDir ?
|
|
108951
|
+
const backupDir = parentDir ? join130(parentDir, backupDirName) : join130(skillsDir2, "..", backupDirName);
|
|
108791
108952
|
logger.info(`Creating backup at: ${backupDir}`);
|
|
108792
108953
|
try {
|
|
108793
108954
|
await mkdir34(backupDir, { recursive: true });
|
|
@@ -108838,7 +108999,7 @@ class SkillsBackupManager {
|
|
|
108838
108999
|
}
|
|
108839
109000
|
try {
|
|
108840
109001
|
const entries = await readdir37(parentDir, { withFileTypes: true });
|
|
108841
|
-
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) =>
|
|
109002
|
+
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) => join130(parentDir, entry.name));
|
|
108842
109003
|
backups.sort().reverse();
|
|
108843
109004
|
return backups;
|
|
108844
109005
|
} catch (error) {
|
|
@@ -108866,8 +109027,8 @@ class SkillsBackupManager {
|
|
|
108866
109027
|
static async copyDirectory(sourceDir, destDir) {
|
|
108867
109028
|
const entries = await readdir37(sourceDir, { withFileTypes: true });
|
|
108868
109029
|
for (const entry of entries) {
|
|
108869
|
-
const sourcePath =
|
|
108870
|
-
const destPath =
|
|
109030
|
+
const sourcePath = join130(sourceDir, entry.name);
|
|
109031
|
+
const destPath = join130(destDir, entry.name);
|
|
108871
109032
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
108872
109033
|
continue;
|
|
108873
109034
|
}
|
|
@@ -108883,7 +109044,7 @@ class SkillsBackupManager {
|
|
|
108883
109044
|
let size = 0;
|
|
108884
109045
|
const entries = await readdir37(dirPath, { withFileTypes: true });
|
|
108885
109046
|
for (const entry of entries) {
|
|
108886
|
-
const fullPath =
|
|
109047
|
+
const fullPath = join130(dirPath, entry.name);
|
|
108887
109048
|
if (entry.isSymbolicLink()) {
|
|
108888
109049
|
continue;
|
|
108889
109050
|
}
|
|
@@ -108918,13 +109079,13 @@ import { relative as relative30 } from "node:path";
|
|
|
108918
109079
|
init_skip_directories();
|
|
108919
109080
|
import { createHash as createHash9 } from "node:crypto";
|
|
108920
109081
|
import { createReadStream as createReadStream2 } from "node:fs";
|
|
108921
|
-
import { readFile as
|
|
108922
|
-
import { join as
|
|
109082
|
+
import { readFile as readFile60, readdir as readdir38 } from "node:fs/promises";
|
|
109083
|
+
import { join as join131, relative as relative29 } from "node:path";
|
|
108923
109084
|
async function getAllFiles(dirPath) {
|
|
108924
109085
|
const files = [];
|
|
108925
109086
|
const entries = await readdir38(dirPath, { withFileTypes: true });
|
|
108926
109087
|
for (const entry of entries) {
|
|
108927
|
-
const fullPath =
|
|
109088
|
+
const fullPath = join131(dirPath, entry.name);
|
|
108928
109089
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name) || entry.isSymbolicLink()) {
|
|
108929
109090
|
continue;
|
|
108930
109091
|
}
|
|
@@ -108957,7 +109118,7 @@ async function hashDirectory(dirPath) {
|
|
|
108957
109118
|
files.sort();
|
|
108958
109119
|
for (const file of files) {
|
|
108959
109120
|
const relativePath = relative29(dirPath, file);
|
|
108960
|
-
const content = await
|
|
109121
|
+
const content = await readFile60(file);
|
|
108961
109122
|
hash.update(relativePath);
|
|
108962
109123
|
hash.update(content);
|
|
108963
109124
|
}
|
|
@@ -109051,7 +109212,7 @@ async function detectFileChanges(currentSkillPath, baselineSkillPath) {
|
|
|
109051
109212
|
init_types3();
|
|
109052
109213
|
var import_fs_extra31 = __toESM(require_lib(), 1);
|
|
109053
109214
|
import { readdir as readdir39 } from "node:fs/promises";
|
|
109054
|
-
import { join as
|
|
109215
|
+
import { join as join132, normalize as normalize11 } from "node:path";
|
|
109055
109216
|
function validatePath3(path17, paramName) {
|
|
109056
109217
|
if (!path17 || typeof path17 !== "string") {
|
|
109057
109218
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -109072,13 +109233,13 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
109072
109233
|
if (dirs.length === 0) {
|
|
109073
109234
|
return ["flat", []];
|
|
109074
109235
|
}
|
|
109075
|
-
const firstDirPath =
|
|
109236
|
+
const firstDirPath = join132(skillsDir2, dirs[0].name);
|
|
109076
109237
|
const subEntries = await readdir39(firstDirPath, { withFileTypes: true });
|
|
109077
109238
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
109078
109239
|
if (subdirs.length > 0) {
|
|
109079
109240
|
let skillLikeCount = 0;
|
|
109080
109241
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
109081
|
-
const subdirPath =
|
|
109242
|
+
const subdirPath = join132(firstDirPath, subdir.name);
|
|
109082
109243
|
const subdirFiles = await readdir39(subdirPath, { withFileTypes: true });
|
|
109083
109244
|
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"));
|
|
109084
109245
|
if (hasSkillMarker) {
|
|
@@ -109088,7 +109249,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
109088
109249
|
if (skillLikeCount > 0) {
|
|
109089
109250
|
const skills = [];
|
|
109090
109251
|
for (const dir of dirs) {
|
|
109091
|
-
const categoryPath =
|
|
109252
|
+
const categoryPath = join132(skillsDir2, dir.name);
|
|
109092
109253
|
const skillDirs = await readdir39(categoryPath, { withFileTypes: true });
|
|
109093
109254
|
skills.push(...skillDirs.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name));
|
|
109094
109255
|
}
|
|
@@ -109098,7 +109259,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
109098
109259
|
return ["flat", dirs.map((dir) => dir.name)];
|
|
109099
109260
|
}
|
|
109100
109261
|
async function findSkillPath(skillsDir2, skillName) {
|
|
109101
|
-
const flatPath =
|
|
109262
|
+
const flatPath = join132(skillsDir2, skillName);
|
|
109102
109263
|
if (await import_fs_extra31.pathExists(flatPath)) {
|
|
109103
109264
|
return { path: flatPath, category: undefined };
|
|
109104
109265
|
}
|
|
@@ -109107,8 +109268,8 @@ async function findSkillPath(skillsDir2, skillName) {
|
|
|
109107
109268
|
if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
109108
109269
|
continue;
|
|
109109
109270
|
}
|
|
109110
|
-
const categoryPath =
|
|
109111
|
-
const skillPath =
|
|
109271
|
+
const categoryPath = join132(skillsDir2, entry.name);
|
|
109272
|
+
const skillPath = join132(categoryPath, skillName);
|
|
109112
109273
|
if (await import_fs_extra31.pathExists(skillPath)) {
|
|
109113
109274
|
return { path: skillPath, category: entry.name };
|
|
109114
109275
|
}
|
|
@@ -109202,7 +109363,7 @@ class SkillsMigrator {
|
|
|
109202
109363
|
}
|
|
109203
109364
|
}
|
|
109204
109365
|
if (options2.backup && !options2.dryRun) {
|
|
109205
|
-
const claudeDir3 =
|
|
109366
|
+
const claudeDir3 = join133(currentSkillsDir, "..");
|
|
109206
109367
|
result.backupPath = await SkillsBackupManager.createBackup(currentSkillsDir, claudeDir3);
|
|
109207
109368
|
logger.success(`Backup created at: ${result.backupPath}`);
|
|
109208
109369
|
}
|
|
@@ -109263,7 +109424,7 @@ async function handleMigration(ctx) {
|
|
|
109263
109424
|
logger.debug("Skipping skills migration (fresh installation)");
|
|
109264
109425
|
return ctx;
|
|
109265
109426
|
}
|
|
109266
|
-
const newSkillsDir =
|
|
109427
|
+
const newSkillsDir = join134(ctx.extractDir, ".claude", "skills");
|
|
109267
109428
|
const currentSkillsDir = PathResolver.buildSkillsPath(ctx.resolvedDir, ctx.options.global);
|
|
109268
109429
|
if (!await import_fs_extra32.pathExists(newSkillsDir) || !await import_fs_extra32.pathExists(currentSkillsDir)) {
|
|
109269
109430
|
return ctx;
|
|
@@ -109287,13 +109448,13 @@ async function handleMigration(ctx) {
|
|
|
109287
109448
|
}
|
|
109288
109449
|
// src/commands/init/phases/opencode-handler.ts
|
|
109289
109450
|
import { cp as cp4, readdir as readdir41, rm as rm15 } from "node:fs/promises";
|
|
109290
|
-
import { join as
|
|
109451
|
+
import { join as join136 } from "node:path";
|
|
109291
109452
|
|
|
109292
109453
|
// src/services/transformers/opencode-path-transformer.ts
|
|
109293
109454
|
init_logger();
|
|
109294
|
-
import { readFile as
|
|
109455
|
+
import { readFile as readFile61, readdir as readdir40, writeFile as writeFile33 } from "node:fs/promises";
|
|
109295
109456
|
import { platform as platform15 } from "node:os";
|
|
109296
|
-
import { extname as extname6, join as
|
|
109457
|
+
import { extname as extname6, join as join135 } from "node:path";
|
|
109297
109458
|
var IS_WINDOWS2 = platform15() === "win32";
|
|
109298
109459
|
function getOpenCodeGlobalPath() {
|
|
109299
109460
|
return "$HOME/.config/opencode/";
|
|
@@ -109354,7 +109515,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
109354
109515
|
async function processDirectory2(dir) {
|
|
109355
109516
|
const entries = await readdir40(dir, { withFileTypes: true });
|
|
109356
109517
|
for (const entry of entries) {
|
|
109357
|
-
const fullPath =
|
|
109518
|
+
const fullPath = join135(dir, entry.name);
|
|
109358
109519
|
if (entry.isDirectory()) {
|
|
109359
109520
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
109360
109521
|
continue;
|
|
@@ -109362,7 +109523,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
109362
109523
|
await processDirectory2(fullPath);
|
|
109363
109524
|
} else if (entry.isFile() && shouldTransformFile2(entry.name)) {
|
|
109364
109525
|
try {
|
|
109365
|
-
const content = await
|
|
109526
|
+
const content = await readFile61(fullPath, "utf-8");
|
|
109366
109527
|
const { transformed, changes } = transformOpenCodeContent(content);
|
|
109367
109528
|
if (changes > 0) {
|
|
109368
109529
|
await writeFile33(fullPath, transformed, "utf-8");
|
|
@@ -109393,7 +109554,7 @@ async function handleOpenCode(ctx) {
|
|
|
109393
109554
|
if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir) {
|
|
109394
109555
|
return ctx;
|
|
109395
109556
|
}
|
|
109396
|
-
const openCodeSource =
|
|
109557
|
+
const openCodeSource = join136(ctx.extractDir, ".opencode");
|
|
109397
109558
|
if (!await import_fs_extra33.pathExists(openCodeSource)) {
|
|
109398
109559
|
logger.debug("No .opencode directory in archive, skipping");
|
|
109399
109560
|
return ctx;
|
|
@@ -109411,8 +109572,8 @@ async function handleOpenCode(ctx) {
|
|
|
109411
109572
|
await import_fs_extra33.ensureDir(targetDir);
|
|
109412
109573
|
const entries = await readdir41(openCodeSource, { withFileTypes: true });
|
|
109413
109574
|
for (const entry of entries) {
|
|
109414
|
-
const sourcePath =
|
|
109415
|
-
const targetPath =
|
|
109575
|
+
const sourcePath = join136(openCodeSource, entry.name);
|
|
109576
|
+
const targetPath = join136(targetDir, entry.name);
|
|
109416
109577
|
if (await import_fs_extra33.pathExists(targetPath)) {
|
|
109417
109578
|
if (!ctx.options.forceOverwrite) {
|
|
109418
109579
|
logger.verbose(`Skipping existing: ${entry.name}`);
|
|
@@ -109451,6 +109612,7 @@ async function resolveOptions(ctx) {
|
|
|
109451
109612
|
docsDir: parsed.docsDir,
|
|
109452
109613
|
plansDir: parsed.plansDir,
|
|
109453
109614
|
installSkills: parsed.installSkills ?? false,
|
|
109615
|
+
packageManager: parsed.packageManager ?? "auto",
|
|
109454
109616
|
withSudo: parsed.withSudo ?? false,
|
|
109455
109617
|
skipSetup: parsed.skipSetup ?? false,
|
|
109456
109618
|
forceOverwrite: parsed.forceOverwrite ?? false,
|
|
@@ -109512,7 +109674,7 @@ Please use only one download method.`);
|
|
|
109512
109674
|
}
|
|
109513
109675
|
// src/commands/init/phases/post-install-handler.ts
|
|
109514
109676
|
init_projects_registry();
|
|
109515
|
-
import { join as
|
|
109677
|
+
import { join as join137 } from "node:path";
|
|
109516
109678
|
init_logger();
|
|
109517
109679
|
init_path_resolver();
|
|
109518
109680
|
var import_fs_extra34 = __toESM(require_lib(), 1);
|
|
@@ -109521,8 +109683,8 @@ async function handlePostInstall(ctx) {
|
|
|
109521
109683
|
return ctx;
|
|
109522
109684
|
}
|
|
109523
109685
|
if (ctx.options.global) {
|
|
109524
|
-
const claudeMdSource =
|
|
109525
|
-
const claudeMdDest =
|
|
109686
|
+
const claudeMdSource = join137(ctx.extractDir, "CLAUDE.md");
|
|
109687
|
+
const claudeMdDest = join137(ctx.resolvedDir, "CLAUDE.md");
|
|
109526
109688
|
if (await import_fs_extra34.pathExists(claudeMdSource)) {
|
|
109527
109689
|
if (ctx.options.fresh || !await import_fs_extra34.pathExists(claudeMdDest)) {
|
|
109528
109690
|
await import_fs_extra34.copy(claudeMdSource, claudeMdDest);
|
|
@@ -109541,6 +109703,9 @@ async function handlePostInstall(ctx) {
|
|
|
109541
109703
|
const skillsDir2 = PathResolver.buildSkillsPath(ctx.resolvedDir, ctx.options.global);
|
|
109542
109704
|
await handleSkillsInstallation2(skillsDir2, {
|
|
109543
109705
|
skipConfirm: ctx.isNonInteractive,
|
|
109706
|
+
packageManager: ctx.options.packageManager,
|
|
109707
|
+
projectDir: ctx.resolvedDir,
|
|
109708
|
+
isGlobal: ctx.options.global,
|
|
109544
109709
|
withSudo: ctx.options.withSudo
|
|
109545
109710
|
});
|
|
109546
109711
|
}
|
|
@@ -109570,7 +109735,7 @@ async function handlePostInstall(ctx) {
|
|
|
109570
109735
|
}
|
|
109571
109736
|
if (!ctx.options.skipSetup) {
|
|
109572
109737
|
await promptSetupWizardIfNeeded({
|
|
109573
|
-
envPath:
|
|
109738
|
+
envPath: join137(ctx.claudeDir, ".env"),
|
|
109574
109739
|
claudeDir: ctx.claudeDir,
|
|
109575
109740
|
isGlobal: ctx.options.global,
|
|
109576
109741
|
isNonInteractive: ctx.isNonInteractive,
|
|
@@ -109592,22 +109757,22 @@ async function handlePostInstall(ctx) {
|
|
|
109592
109757
|
}
|
|
109593
109758
|
// src/commands/init/phases/plugin-install-handler.ts
|
|
109594
109759
|
init_codex_plugin_installer();
|
|
109595
|
-
import { cpSync as cpSync2, existsSync as
|
|
109596
|
-
import { join as
|
|
109760
|
+
import { cpSync as cpSync2, existsSync as existsSync72, mkdirSync as mkdirSync6, readFileSync as readFileSync24, rmSync as rmSync5, writeFileSync as writeFileSync8 } from "node:fs";
|
|
109761
|
+
import { join as join140 } from "node:path";
|
|
109597
109762
|
|
|
109598
109763
|
// src/domains/installation/plugin/migrate-legacy-to-plugin.ts
|
|
109599
109764
|
init_install_mode_detector();
|
|
109600
109765
|
import { createHash as createHash10 } from "node:crypto";
|
|
109601
109766
|
import {
|
|
109602
109767
|
cpSync,
|
|
109603
|
-
existsSync as
|
|
109768
|
+
existsSync as existsSync70,
|
|
109604
109769
|
mkdirSync as mkdirSync5,
|
|
109605
109770
|
readFileSync as readFileSync23,
|
|
109606
109771
|
readdirSync as readdirSync11,
|
|
109607
109772
|
rmSync as rmSync3,
|
|
109608
109773
|
writeFileSync as writeFileSync7
|
|
109609
109774
|
} from "node:fs";
|
|
109610
|
-
import { dirname as dirname43, join as
|
|
109775
|
+
import { dirname as dirname43, join as join138, relative as relative31, resolve as resolve46 } from "node:path";
|
|
109611
109776
|
|
|
109612
109777
|
// src/domains/installation/plugin/plugin-installer.ts
|
|
109613
109778
|
init_install_mode_detector();
|
|
@@ -109710,6 +109875,7 @@ async function migrateLegacyToPlugin(opts) {
|
|
|
109710
109875
|
const ts = opts.now ?? new Date().toISOString();
|
|
109711
109876
|
const before = detectInstallMode(claudeDir3);
|
|
109712
109877
|
if (before.mode === "plugin") {
|
|
109878
|
+
prunePluginSuppliedLegacyFilesFromMetadata(claudeDir3);
|
|
109713
109879
|
return base("noop-already-plugin", before.mode, before.plugin.enabled);
|
|
109714
109880
|
}
|
|
109715
109881
|
if (!await installer.isClaudeAvailable() || !await installer.isPluginSupported()) {
|
|
@@ -109732,9 +109898,10 @@ async function migrateLegacyToPlugin(opts) {
|
|
|
109732
109898
|
let backupDir = null;
|
|
109733
109899
|
let removedPaths = [];
|
|
109734
109900
|
if (before.legacy.installed) {
|
|
109735
|
-
backupDir =
|
|
109901
|
+
backupDir = join138(claudeDir3, "backups", `ck-legacy-${ts.replace(/[:.]/g, "-")}`);
|
|
109736
109902
|
mkdirSync5(backupDir, { recursive: true });
|
|
109737
109903
|
removedPaths = removeLegacy(claudeDir3, backupDir);
|
|
109904
|
+
prunePluginSuppliedLegacyFilesFromMetadata(claudeDir3, removedPaths);
|
|
109738
109905
|
}
|
|
109739
109906
|
const installedVersion = detectPluginState(claudeDir3).version;
|
|
109740
109907
|
const receiptPath = writeReceipt(claudeDir3, {
|
|
@@ -109767,14 +109934,14 @@ function base(action, modeBefore, pluginVerified) {
|
|
|
109767
109934
|
var PLUGIN_SUPPLIED_LEGACY_PREFIXES2 = ["agents/", "skills/"];
|
|
109768
109935
|
var LEGACY_SENTINEL_FILENAMES = new Set([".gitignore"]);
|
|
109769
109936
|
function defaultLegacyRemover(claudeDir3, backupDir) {
|
|
109770
|
-
const meta = readJsonSafe3(
|
|
109937
|
+
const meta = readJsonSafe3(join138(claudeDir3, "metadata.json"));
|
|
109771
109938
|
const files = collectTrackedFiles2(meta);
|
|
109772
109939
|
const removed = [];
|
|
109773
109940
|
for (const file of files) {
|
|
109774
109941
|
const legacyPath = resolveSafePluginSuppliedLegacyPath2(claudeDir3, file.path);
|
|
109775
109942
|
if (!legacyPath)
|
|
109776
109943
|
continue;
|
|
109777
|
-
if (!
|
|
109944
|
+
if (!existsSync70(legacyPath.absolutePath))
|
|
109778
109945
|
continue;
|
|
109779
109946
|
if (!isSafeToRemovePluginSuppliedLegacyFile(file, legacyPath.absolutePath))
|
|
109780
109947
|
continue;
|
|
@@ -109805,8 +109972,8 @@ function removeOrphanLegacySentinels(claudeDir3, backupDir, removedTrackedPaths)
|
|
|
109805
109972
|
}
|
|
109806
109973
|
const removed = [];
|
|
109807
109974
|
for (const root of [...rootsToSweep].sort(compareLegacyPaths)) {
|
|
109808
|
-
const rootAbs =
|
|
109809
|
-
if (!
|
|
109975
|
+
const rootAbs = join138(claudeDir3, root);
|
|
109976
|
+
if (!existsSync70(rootAbs))
|
|
109810
109977
|
continue;
|
|
109811
109978
|
const sentinels = findLegacySentinels(rootAbs).sort((a3, b3) => compareLegacyPaths(relative31(claudeDir3, a3), relative31(claudeDir3, b3)));
|
|
109812
109979
|
for (const sentinelAbs of sentinels) {
|
|
@@ -109829,7 +109996,7 @@ function findLegacySentinels(dir) {
|
|
|
109829
109996
|
return out;
|
|
109830
109997
|
}
|
|
109831
109998
|
for (const entry of entries.sort((a3, b3) => compareLegacyPaths(a3.name, b3.name))) {
|
|
109832
|
-
const abs =
|
|
109999
|
+
const abs = join138(dir, entry.name);
|
|
109833
110000
|
if (entry.isDirectory()) {
|
|
109834
110001
|
out.push(...findLegacySentinels(abs));
|
|
109835
110002
|
} else if (entry.isFile() && LEGACY_SENTINEL_FILENAMES.has(entry.name)) {
|
|
@@ -109857,7 +110024,7 @@ function directoryContainsOnlySentinels(dir) {
|
|
|
109857
110024
|
return false;
|
|
109858
110025
|
}
|
|
109859
110026
|
for (const entry of entries) {
|
|
109860
|
-
const abs =
|
|
110027
|
+
const abs = join138(dir, entry.name);
|
|
109861
110028
|
if (entry.isDirectory()) {
|
|
109862
110029
|
if (!directoryContainsOnlySentinels(abs))
|
|
109863
110030
|
return false;
|
|
@@ -109958,8 +110125,47 @@ function collectTrackedFiles2(meta) {
|
|
|
109958
110125
|
}
|
|
109959
110126
|
return out;
|
|
109960
110127
|
}
|
|
110128
|
+
function prunePluginSuppliedLegacyFilesFromMetadata(claudeDir3, removedPaths) {
|
|
110129
|
+
const metadataPath = join138(claudeDir3, "metadata.json");
|
|
110130
|
+
const meta = readJsonSafe3(metadataPath);
|
|
110131
|
+
if (!isRecord5(meta))
|
|
110132
|
+
return;
|
|
110133
|
+
const removed = removedPaths ? new Set(removedPaths.map(normalizeComparableLegacyPath).filter(Boolean)) : null;
|
|
110134
|
+
let changed = false;
|
|
110135
|
+
const pruneFiles = (files) => {
|
|
110136
|
+
if (!Array.isArray(files))
|
|
110137
|
+
return files;
|
|
110138
|
+
const pruned = files.filter((file) => {
|
|
110139
|
+
if (!isRecord5(file) || typeof file.path !== "string")
|
|
110140
|
+
return true;
|
|
110141
|
+
const normalizedPath = normalizeComparableLegacyPath(file.path);
|
|
110142
|
+
const resolvedPath = resolveSafePluginSuppliedLegacyPath2(claudeDir3, normalizedPath);
|
|
110143
|
+
const shouldPrune = removed ? removed.has(normalizedPath) || resolvedPath !== null && !existsSync70(resolvedPath.absolutePath) : isPluginSuppliedLegacyPath2(normalizedPath);
|
|
110144
|
+
return !shouldPrune;
|
|
110145
|
+
});
|
|
110146
|
+
if (pruned.length !== files.length)
|
|
110147
|
+
changed = true;
|
|
110148
|
+
return pruned;
|
|
110149
|
+
};
|
|
110150
|
+
if (isRecord5(meta.kits)) {
|
|
110151
|
+
const engineer = meta.kits[ENGINEER_KIT_KEY];
|
|
110152
|
+
if (isRecord5(engineer)) {
|
|
110153
|
+
engineer.files = pruneFiles(engineer.files);
|
|
110154
|
+
}
|
|
110155
|
+
} else {
|
|
110156
|
+
meta.files = pruneFiles(meta.files);
|
|
110157
|
+
meta.installedFiles = pruneFiles(meta.installedFiles);
|
|
110158
|
+
}
|
|
110159
|
+
if (changed) {
|
|
110160
|
+
writeFileSync7(metadataPath, `${JSON.stringify(meta, null, 2)}
|
|
110161
|
+
`, "utf-8");
|
|
110162
|
+
}
|
|
110163
|
+
}
|
|
110164
|
+
function normalizeComparableLegacyPath(pathValue) {
|
|
110165
|
+
return normalizeLegacyPath2(pathValue).replace(/^\.\/+/, "").replace(/^\.claude\//, "");
|
|
110166
|
+
}
|
|
109961
110167
|
function writeReceipt(claudeDir3, receipt) {
|
|
109962
|
-
const receiptPath =
|
|
110168
|
+
const receiptPath = join138(claudeDir3, ".ck-migration-log.json");
|
|
109963
110169
|
const existing = readJsonSafe3(receiptPath);
|
|
109964
110170
|
const history = Array.isArray(existing) ? existing : [];
|
|
109965
110171
|
history.push(receipt);
|
|
@@ -110014,8 +110220,8 @@ function isRecord5(value) {
|
|
|
110014
110220
|
|
|
110015
110221
|
// src/domains/installation/plugin/uninstall-plugin.ts
|
|
110016
110222
|
init_install_mode_detector();
|
|
110017
|
-
import { existsSync as
|
|
110018
|
-
import { join as
|
|
110223
|
+
import { existsSync as existsSync71, rmSync as rmSync4 } from "node:fs";
|
|
110224
|
+
import { join as join139 } from "node:path";
|
|
110019
110225
|
init_path_resolver();
|
|
110020
110226
|
async function uninstallEnginePlugin(opts = {}) {
|
|
110021
110227
|
const claudeDir3 = opts.claudeDir ?? PathResolver.getGlobalKitDir();
|
|
@@ -110037,8 +110243,8 @@ async function uninstallEnginePlugin(opts = {}) {
|
|
|
110037
110243
|
}
|
|
110038
110244
|
let staleCacheRemoved = false;
|
|
110039
110245
|
const marketplace = state.marketplace ?? CK_MARKETPLACE_NAME;
|
|
110040
|
-
const cacheDir =
|
|
110041
|
-
if (
|
|
110246
|
+
const cacheDir = join139(claudeDir3, "plugins", "cache", marketplace, CK_PLUGIN_NAME);
|
|
110247
|
+
if (existsSync71(cacheDir)) {
|
|
110042
110248
|
rmSync4(cacheDir, { recursive: true, force: true });
|
|
110043
110249
|
staleCacheRemoved = true;
|
|
110044
110250
|
}
|
|
@@ -110135,14 +110341,14 @@ function logLegacyPluginCleanup(result) {
|
|
|
110135
110341
|
}
|
|
110136
110342
|
}
|
|
110137
110343
|
function stagePluginSource(extractDir, stageBaseDir) {
|
|
110138
|
-
const base2 = stageBaseDir ??
|
|
110139
|
-
const payloadSrc =
|
|
110140
|
-
if (!
|
|
110344
|
+
const base2 = stageBaseDir ?? join140(PathResolver.getCacheDir(true), "ck-plugin-source");
|
|
110345
|
+
const payloadSrc = join140(extractDir, ".claude");
|
|
110346
|
+
if (!existsSync72(payloadSrc)) {
|
|
110141
110347
|
throw new Error(`plugin payload not found in archive: ${payloadSrc}`);
|
|
110142
110348
|
}
|
|
110143
110349
|
rmSync5(base2, { recursive: true, force: true });
|
|
110144
110350
|
mkdirSync6(base2, { recursive: true });
|
|
110145
|
-
const stagedPayload =
|
|
110351
|
+
const stagedPayload = join140(base2, ".claude");
|
|
110146
110352
|
cpSync2(payloadSrc, stagedPayload, { recursive: true });
|
|
110147
110353
|
ensureCodexPluginManifest(stagedPayload);
|
|
110148
110354
|
const claudeMarketplace = {
|
|
@@ -110150,8 +110356,8 @@ function stagePluginSource(extractDir, stageBaseDir) {
|
|
|
110150
110356
|
owner: { name: "ClaudeKit" },
|
|
110151
110357
|
plugins: [{ name: "ck", source: "./.claude", description: "ClaudeKit Engineer" }]
|
|
110152
110358
|
};
|
|
110153
|
-
mkdirSync6(
|
|
110154
|
-
writeFileSync8(
|
|
110359
|
+
mkdirSync6(join140(base2, ".claude-plugin"), { recursive: true });
|
|
110360
|
+
writeFileSync8(join140(base2, ".claude-plugin", "marketplace.json"), `${JSON.stringify(claudeMarketplace, null, 2)}
|
|
110155
110361
|
`, "utf-8");
|
|
110156
110362
|
const codexMarketplace = {
|
|
110157
110363
|
name: "claudekit",
|
|
@@ -110165,16 +110371,16 @@ function stagePluginSource(extractDir, stageBaseDir) {
|
|
|
110165
110371
|
}
|
|
110166
110372
|
]
|
|
110167
110373
|
};
|
|
110168
|
-
mkdirSync6(
|
|
110169
|
-
writeFileSync8(
|
|
110374
|
+
mkdirSync6(join140(base2, ".agents", "plugins"), { recursive: true });
|
|
110375
|
+
writeFileSync8(join140(base2, ".agents", "plugins", "marketplace.json"), `${JSON.stringify(codexMarketplace, null, 2)}
|
|
110170
110376
|
`, "utf-8");
|
|
110171
110377
|
return base2;
|
|
110172
110378
|
}
|
|
110173
110379
|
function ensureCodexPluginManifest(pluginRoot) {
|
|
110174
|
-
const manifestPath =
|
|
110175
|
-
if (
|
|
110380
|
+
const manifestPath = join140(pluginRoot, ".codex-plugin", "plugin.json");
|
|
110381
|
+
if (existsSync72(manifestPath))
|
|
110176
110382
|
return;
|
|
110177
|
-
const claudeManifest = readJsonSafe4(
|
|
110383
|
+
const claudeManifest = readJsonSafe4(join140(pluginRoot, ".claude-plugin", "plugin.json"));
|
|
110178
110384
|
const manifest = pruneUndefined({
|
|
110179
110385
|
name: stringField2(claudeManifest, "name") ?? "ck",
|
|
110180
110386
|
version: stringField2(claudeManifest, "version") ?? "0.0.0",
|
|
@@ -110195,7 +110401,7 @@ function ensureCodexPluginManifest(pluginRoot) {
|
|
|
110195
110401
|
websiteURL: "https://github.com/claudekit/claudekit-engineer"
|
|
110196
110402
|
}
|
|
110197
110403
|
});
|
|
110198
|
-
mkdirSync6(
|
|
110404
|
+
mkdirSync6(join140(pluginRoot, ".codex-plugin"), { recursive: true });
|
|
110199
110405
|
writeFileSync8(manifestPath, `${JSON.stringify(manifest, null, 2)}
|
|
110200
110406
|
`, "utf-8");
|
|
110201
110407
|
}
|
|
@@ -110267,7 +110473,7 @@ function logCodexPluginCleanup(result) {
|
|
|
110267
110473
|
init_config_manager();
|
|
110268
110474
|
init_github_client();
|
|
110269
110475
|
import { mkdir as mkdir36 } from "node:fs/promises";
|
|
110270
|
-
import { join as
|
|
110476
|
+
import { join as join143, resolve as resolve49 } from "node:path";
|
|
110271
110477
|
|
|
110272
110478
|
// src/domains/github/kit-access-checker.ts
|
|
110273
110479
|
init_error2();
|
|
@@ -110401,7 +110607,7 @@ async function runPreflightChecks() {
|
|
|
110401
110607
|
return result;
|
|
110402
110608
|
}
|
|
110403
110609
|
if (result.ghVersion) {
|
|
110404
|
-
const comparison =
|
|
110610
|
+
const comparison = compareVersions7(result.ghVersion, MIN_GH_CLI_VERSION);
|
|
110405
110611
|
result.ghVersionOk = comparison >= 0;
|
|
110406
110612
|
if (!result.ghVersionOk) {
|
|
110407
110613
|
logger.debug(`GitHub CLI version ${result.ghVersion} is below minimum ${MIN_GH_CLI_VERSION}`);
|
|
@@ -110439,8 +110645,8 @@ init_hook_health_checker();
|
|
|
110439
110645
|
|
|
110440
110646
|
// src/domains/installation/fresh-installer.ts
|
|
110441
110647
|
init_metadata_migration();
|
|
110442
|
-
import { existsSync as
|
|
110443
|
-
import { basename as basename28, dirname as dirname44, join as
|
|
110648
|
+
import { existsSync as existsSync73, readdirSync as readdirSync12, rmSync as rmSync6, rmdirSync as rmdirSync2, unlinkSync as unlinkSync5 } from "node:fs";
|
|
110649
|
+
import { basename as basename28, dirname as dirname44, join as join141, resolve as resolve47 } from "node:path";
|
|
110444
110650
|
init_logger();
|
|
110445
110651
|
init_safe_spinner();
|
|
110446
110652
|
var import_fs_extra35 = __toESM(require_lib(), 1);
|
|
@@ -110522,8 +110728,8 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
|
|
|
110522
110728
|
logger.debug(`${KIT_MANIFEST_FILE} was self-tracked; skipping from delete loop — will be rewritten by updateMetadataAfterFresh`);
|
|
110523
110729
|
}
|
|
110524
110730
|
for (const file of filesToRemove) {
|
|
110525
|
-
const fullPath =
|
|
110526
|
-
if (!
|
|
110731
|
+
const fullPath = join141(claudeDir3, file.path);
|
|
110732
|
+
if (!existsSync73(fullPath)) {
|
|
110527
110733
|
continue;
|
|
110528
110734
|
}
|
|
110529
110735
|
try {
|
|
@@ -110550,7 +110756,7 @@ async function removeFilesByOwnership(claudeDir3, analysis, includeModified) {
|
|
|
110550
110756
|
};
|
|
110551
110757
|
}
|
|
110552
110758
|
async function updateMetadataAfterFresh(claudeDir3, removedFiles, metadata) {
|
|
110553
|
-
const metadataPath =
|
|
110759
|
+
const metadataPath = join141(claudeDir3, KIT_MANIFEST_FILE);
|
|
110554
110760
|
const removedSet = new Set(removedFiles);
|
|
110555
110761
|
if (metadata.kits) {
|
|
110556
110762
|
for (const kitName of Object.keys(metadata.kits)) {
|
|
@@ -110581,8 +110787,8 @@ function getFreshBackupTargets(claudeDir3, analysis, includeModified) {
|
|
|
110581
110787
|
mutatePaths: filesToRemove.length > 0 ? ["metadata.json"] : []
|
|
110582
110788
|
};
|
|
110583
110789
|
}
|
|
110584
|
-
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) =>
|
|
110585
|
-
if (
|
|
110790
|
+
const deletePaths = CLAUDEKIT_SUBDIRECTORIES.filter((subdir) => existsSync73(join141(claudeDir3, subdir)));
|
|
110791
|
+
if (existsSync73(join141(claudeDir3, "metadata.json"))) {
|
|
110586
110792
|
deletePaths.push("metadata.json");
|
|
110587
110793
|
}
|
|
110588
110794
|
return {
|
|
@@ -110604,7 +110810,7 @@ async function removeSubdirectoriesFallback(claudeDir3) {
|
|
|
110604
110810
|
const removedFiles = [];
|
|
110605
110811
|
let removedDirCount = 0;
|
|
110606
110812
|
for (const subdir of CLAUDEKIT_SUBDIRECTORIES) {
|
|
110607
|
-
const subdirPath =
|
|
110813
|
+
const subdirPath = join141(claudeDir3, subdir);
|
|
110608
110814
|
if (await import_fs_extra35.pathExists(subdirPath)) {
|
|
110609
110815
|
rmSync6(subdirPath, { recursive: true, force: true });
|
|
110610
110816
|
removedDirCount++;
|
|
@@ -110612,7 +110818,7 @@ async function removeSubdirectoriesFallback(claudeDir3) {
|
|
|
110612
110818
|
logger.debug(`Removed subdirectory: ${subdir}/`);
|
|
110613
110819
|
}
|
|
110614
110820
|
}
|
|
110615
|
-
const metadataPath =
|
|
110821
|
+
const metadataPath = join141(claudeDir3, "metadata.json");
|
|
110616
110822
|
if (await import_fs_extra35.pathExists(metadataPath)) {
|
|
110617
110823
|
unlinkSync5(metadataPath);
|
|
110618
110824
|
removedFiles.push("metadata.json");
|
|
@@ -110690,7 +110896,7 @@ async function handleFreshInstallation(claudeDir3, prompts) {
|
|
|
110690
110896
|
var import_fs_extra36 = __toESM(require_lib(), 1);
|
|
110691
110897
|
import { cp as cp5, mkdir as mkdir35, readdir as readdir42, rename as rename11, rm as rm16, stat as stat22 } from "node:fs/promises";
|
|
110692
110898
|
import { homedir as homedir47 } from "node:os";
|
|
110693
|
-
import { dirname as dirname45, join as
|
|
110899
|
+
import { dirname as dirname45, join as join142, normalize as normalize12, resolve as resolve48 } from "node:path";
|
|
110694
110900
|
var LEGACY_KIT_MARKERS = [
|
|
110695
110901
|
"metadata.json",
|
|
110696
110902
|
".ck.json",
|
|
@@ -110729,10 +110935,10 @@ function getLegacyWindowsGlobalKitDirCandidates(env2 = process.env, homeDir = ho
|
|
|
110729
110935
|
const localAppData = safeEnvPath(env2.LOCALAPPDATA);
|
|
110730
110936
|
const appData = safeEnvPath(env2.APPDATA);
|
|
110731
110937
|
if (localAppData) {
|
|
110732
|
-
candidates.push(
|
|
110938
|
+
candidates.push(join142(localAppData, ".claude"));
|
|
110733
110939
|
}
|
|
110734
110940
|
if (appData) {
|
|
110735
|
-
candidates.push(
|
|
110941
|
+
candidates.push(join142(appData, ".claude"));
|
|
110736
110942
|
}
|
|
110737
110943
|
if (homeDir) {
|
|
110738
110944
|
candidates.push(`${withoutTrailingSeparators(homeDir)}.claude`);
|
|
@@ -110750,7 +110956,7 @@ async function hasKitMarkers(dir) {
|
|
|
110750
110956
|
if (!await isDirectory(dir))
|
|
110751
110957
|
return false;
|
|
110752
110958
|
for (const marker of LEGACY_KIT_MARKERS) {
|
|
110753
|
-
if (await import_fs_extra36.pathExists(
|
|
110959
|
+
if (await import_fs_extra36.pathExists(join142(dir, marker))) {
|
|
110754
110960
|
return true;
|
|
110755
110961
|
}
|
|
110756
110962
|
}
|
|
@@ -111052,7 +111258,7 @@ async function handleSelection(ctx) {
|
|
|
111052
111258
|
}
|
|
111053
111259
|
if (!ctx.options.fresh) {
|
|
111054
111260
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
111055
|
-
const claudeDir3 = prefix ?
|
|
111261
|
+
const claudeDir3 = prefix ? join143(resolvedDir, prefix) : resolvedDir;
|
|
111056
111262
|
try {
|
|
111057
111263
|
const existingMetadata = await readManifest(claudeDir3);
|
|
111058
111264
|
if (existingMetadata?.kits) {
|
|
@@ -111089,7 +111295,7 @@ async function handleSelection(ctx) {
|
|
|
111089
111295
|
}
|
|
111090
111296
|
if (ctx.options.fresh) {
|
|
111091
111297
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
111092
|
-
const claudeDir3 = prefix ?
|
|
111298
|
+
const claudeDir3 = prefix ? join143(resolvedDir, prefix) : resolvedDir;
|
|
111093
111299
|
const canProceed = await handleFreshInstallation(claudeDir3, ctx.prompts);
|
|
111094
111300
|
if (!canProceed) {
|
|
111095
111301
|
return { ...ctx, cancelled: true };
|
|
@@ -111109,7 +111315,7 @@ async function handleSelection(ctx) {
|
|
|
111109
111315
|
let currentVersion = null;
|
|
111110
111316
|
try {
|
|
111111
111317
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
111112
|
-
const claudeDir3 = prefix ?
|
|
111318
|
+
const claudeDir3 = prefix ? join143(resolvedDir, prefix) : resolvedDir;
|
|
111113
111319
|
const existingMetadata = await readManifest(claudeDir3);
|
|
111114
111320
|
currentVersion = existingMetadata?.kits?.[kitType]?.version || null;
|
|
111115
111321
|
if (currentVersion) {
|
|
@@ -111178,7 +111384,7 @@ async function handleSelection(ctx) {
|
|
|
111178
111384
|
if (ctx.options.yes && !ctx.options.fresh && !ctx.options.force && !ctx.options.restoreCkHooks && releaseTag && !isOfflineMode && !pendingKits?.length) {
|
|
111179
111385
|
try {
|
|
111180
111386
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
111181
|
-
const claudeDir3 = prefix ?
|
|
111387
|
+
const claudeDir3 = prefix ? join143(resolvedDir, prefix) : resolvedDir;
|
|
111182
111388
|
const existingMetadata = await readManifest(claudeDir3);
|
|
111183
111389
|
const installedKitVersion = existingMetadata?.kits?.[kitType]?.version;
|
|
111184
111390
|
if (installedKitVersion && versionsMatch(installedKitVersion, releaseTag)) {
|
|
@@ -111206,8 +111412,8 @@ async function handleSelection(ctx) {
|
|
|
111206
111412
|
};
|
|
111207
111413
|
}
|
|
111208
111414
|
// src/commands/init/phases/sync-handler.ts
|
|
111209
|
-
import { copyFile as copyFile8, mkdir as mkdir37, open as open5, readFile as
|
|
111210
|
-
import { dirname as dirname46, join as
|
|
111415
|
+
import { copyFile as copyFile8, mkdir as mkdir37, open as open5, readFile as readFile62, rename as rename12, stat as stat23, unlink as unlink13, writeFile as writeFile35 } from "node:fs/promises";
|
|
111416
|
+
import { dirname as dirname46, join as join144, resolve as resolve50 } from "node:path";
|
|
111211
111417
|
init_logger();
|
|
111212
111418
|
init_path_resolver();
|
|
111213
111419
|
var import_fs_extra38 = __toESM(require_lib(), 1);
|
|
@@ -111217,13 +111423,13 @@ async function handleSync(ctx) {
|
|
|
111217
111423
|
return ctx;
|
|
111218
111424
|
}
|
|
111219
111425
|
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve50(ctx.options.dir || ".");
|
|
111220
|
-
const claudeDir3 = ctx.options.global ? resolvedDir :
|
|
111426
|
+
const claudeDir3 = ctx.options.global ? resolvedDir : join144(resolvedDir, ".claude");
|
|
111221
111427
|
if (!await import_fs_extra38.pathExists(claudeDir3)) {
|
|
111222
111428
|
logger.error("Cannot sync: no .claude directory found");
|
|
111223
111429
|
ctx.prompts.note("Run 'ck init' without --sync to install first.", "No Installation Found");
|
|
111224
111430
|
return { ...ctx, cancelled: true };
|
|
111225
111431
|
}
|
|
111226
|
-
const metadataPath =
|
|
111432
|
+
const metadataPath = join144(claudeDir3, "metadata.json");
|
|
111227
111433
|
if (!await import_fs_extra38.pathExists(metadataPath)) {
|
|
111228
111434
|
logger.error("Cannot sync: no metadata.json found");
|
|
111229
111435
|
ctx.prompts.note(`Your installation may be from an older version.
|
|
@@ -111323,7 +111529,7 @@ function getLockTimeout() {
|
|
|
111323
111529
|
var STALE_LOCK_THRESHOLD_MS = 5 * 60 * 1000;
|
|
111324
111530
|
async function acquireSyncLock(global3) {
|
|
111325
111531
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
111326
|
-
const lockPath =
|
|
111532
|
+
const lockPath = join144(cacheDir, ".sync-lock");
|
|
111327
111533
|
const startTime = Date.now();
|
|
111328
111534
|
const lockTimeout = getLockTimeout();
|
|
111329
111535
|
await mkdir37(dirname46(lockPath), { recursive: true });
|
|
@@ -111369,13 +111575,13 @@ async function executeSyncMerge(ctx) {
|
|
|
111369
111575
|
const releaseLock = await acquireSyncLock(ctx.options.global);
|
|
111370
111576
|
try {
|
|
111371
111577
|
const trackedFiles = ctx.syncTrackedFiles;
|
|
111372
|
-
const upstreamDir = ctx.options.global ?
|
|
111578
|
+
const upstreamDir = ctx.options.global ? join144(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
111373
111579
|
let sourceMetadata = null;
|
|
111374
111580
|
let deletions = [];
|
|
111375
111581
|
try {
|
|
111376
|
-
const sourceMetadataPath =
|
|
111582
|
+
const sourceMetadataPath = join144(upstreamDir, "metadata.json");
|
|
111377
111583
|
if (await import_fs_extra38.pathExists(sourceMetadataPath)) {
|
|
111378
|
-
const content = await
|
|
111584
|
+
const content = await readFile62(sourceMetadataPath, "utf-8");
|
|
111379
111585
|
sourceMetadata = JSON.parse(content);
|
|
111380
111586
|
deletions = sourceMetadata.deletions || [];
|
|
111381
111587
|
}
|
|
@@ -111435,7 +111641,7 @@ async function executeSyncMerge(ctx) {
|
|
|
111435
111641
|
try {
|
|
111436
111642
|
const sourcePath = await validateSyncPath(upstreamDir, file.path);
|
|
111437
111643
|
const targetPath = await validateSyncPath(ctx.claudeDir, file.path);
|
|
111438
|
-
const targetDir =
|
|
111644
|
+
const targetDir = join144(targetPath, "..");
|
|
111439
111645
|
try {
|
|
111440
111646
|
await mkdir37(targetDir, { recursive: true });
|
|
111441
111647
|
} catch (mkdirError) {
|
|
@@ -111606,7 +111812,7 @@ async function createBackup(claudeDir3, files, backupDir) {
|
|
|
111606
111812
|
const sourcePath = await validateSyncPath(claudeDir3, file.path);
|
|
111607
111813
|
if (await import_fs_extra38.pathExists(sourcePath)) {
|
|
111608
111814
|
const targetPath = await validateSyncPath(backupDir, file.path);
|
|
111609
|
-
const targetDir =
|
|
111815
|
+
const targetDir = join144(targetPath, "..");
|
|
111610
111816
|
await mkdir37(targetDir, { recursive: true });
|
|
111611
111817
|
await copyFile8(sourcePath, targetPath);
|
|
111612
111818
|
}
|
|
@@ -111621,7 +111827,7 @@ async function createBackup(claudeDir3, files, backupDir) {
|
|
|
111621
111827
|
}
|
|
111622
111828
|
// src/commands/init/phases/transform-handler.ts
|
|
111623
111829
|
init_config_manager();
|
|
111624
|
-
import { join as
|
|
111830
|
+
import { join as join148 } from "node:path";
|
|
111625
111831
|
|
|
111626
111832
|
// src/services/transformers/folder-path-transformer.ts
|
|
111627
111833
|
init_logger();
|
|
@@ -111632,38 +111838,38 @@ init_logger();
|
|
|
111632
111838
|
init_types3();
|
|
111633
111839
|
var import_fs_extra39 = __toESM(require_lib(), 1);
|
|
111634
111840
|
import { rename as rename13, rm as rm17 } from "node:fs/promises";
|
|
111635
|
-
import { join as
|
|
111841
|
+
import { join as join145, relative as relative32 } from "node:path";
|
|
111636
111842
|
async function collectDirsToRename(extractDir, folders) {
|
|
111637
111843
|
const dirsToRename = [];
|
|
111638
111844
|
if (folders.docs !== DEFAULT_FOLDERS.docs) {
|
|
111639
|
-
const docsPath =
|
|
111845
|
+
const docsPath = join145(extractDir, DEFAULT_FOLDERS.docs);
|
|
111640
111846
|
if (await import_fs_extra39.pathExists(docsPath)) {
|
|
111641
111847
|
dirsToRename.push({
|
|
111642
111848
|
from: docsPath,
|
|
111643
|
-
to:
|
|
111849
|
+
to: join145(extractDir, folders.docs)
|
|
111644
111850
|
});
|
|
111645
111851
|
}
|
|
111646
|
-
const claudeDocsPath =
|
|
111852
|
+
const claudeDocsPath = join145(extractDir, ".claude", DEFAULT_FOLDERS.docs);
|
|
111647
111853
|
if (await import_fs_extra39.pathExists(claudeDocsPath)) {
|
|
111648
111854
|
dirsToRename.push({
|
|
111649
111855
|
from: claudeDocsPath,
|
|
111650
|
-
to:
|
|
111856
|
+
to: join145(extractDir, ".claude", folders.docs)
|
|
111651
111857
|
});
|
|
111652
111858
|
}
|
|
111653
111859
|
}
|
|
111654
111860
|
if (folders.plans !== DEFAULT_FOLDERS.plans) {
|
|
111655
|
-
const plansPath =
|
|
111861
|
+
const plansPath = join145(extractDir, DEFAULT_FOLDERS.plans);
|
|
111656
111862
|
if (await import_fs_extra39.pathExists(plansPath)) {
|
|
111657
111863
|
dirsToRename.push({
|
|
111658
111864
|
from: plansPath,
|
|
111659
|
-
to:
|
|
111865
|
+
to: join145(extractDir, folders.plans)
|
|
111660
111866
|
});
|
|
111661
111867
|
}
|
|
111662
|
-
const claudePlansPath =
|
|
111868
|
+
const claudePlansPath = join145(extractDir, ".claude", DEFAULT_FOLDERS.plans);
|
|
111663
111869
|
if (await import_fs_extra39.pathExists(claudePlansPath)) {
|
|
111664
111870
|
dirsToRename.push({
|
|
111665
111871
|
from: claudePlansPath,
|
|
111666
|
-
to:
|
|
111872
|
+
to: join145(extractDir, ".claude", folders.plans)
|
|
111667
111873
|
});
|
|
111668
111874
|
}
|
|
111669
111875
|
}
|
|
@@ -111703,8 +111909,8 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
111703
111909
|
// src/services/transformers/folder-transform/path-replacer.ts
|
|
111704
111910
|
init_logger();
|
|
111705
111911
|
init_types3();
|
|
111706
|
-
import { readFile as
|
|
111707
|
-
import { join as
|
|
111912
|
+
import { readFile as readFile63, readdir as readdir43, writeFile as writeFile36 } from "node:fs/promises";
|
|
111913
|
+
import { join as join146, relative as relative33 } from "node:path";
|
|
111708
111914
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
111709
111915
|
".md",
|
|
111710
111916
|
".txt",
|
|
@@ -111757,7 +111963,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
111757
111963
|
let replacementsCount = 0;
|
|
111758
111964
|
const entries = await readdir43(dir, { withFileTypes: true });
|
|
111759
111965
|
for (const entry of entries) {
|
|
111760
|
-
const fullPath =
|
|
111966
|
+
const fullPath = join146(dir, entry.name);
|
|
111761
111967
|
if (entry.isDirectory()) {
|
|
111762
111968
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
111763
111969
|
continue;
|
|
@@ -111770,7 +111976,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
111770
111976
|
if (!shouldTransform)
|
|
111771
111977
|
continue;
|
|
111772
111978
|
try {
|
|
111773
|
-
const content = await
|
|
111979
|
+
const content = await readFile63(fullPath, "utf-8");
|
|
111774
111980
|
let newContent = content;
|
|
111775
111981
|
let changeCount = 0;
|
|
111776
111982
|
for (const { regex: regex2, replacement } of compiledReplacements) {
|
|
@@ -111892,9 +112098,9 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
111892
112098
|
|
|
111893
112099
|
// src/services/transformers/global-path-transformer.ts
|
|
111894
112100
|
init_logger();
|
|
111895
|
-
import { readFile as
|
|
112101
|
+
import { readFile as readFile64, readdir as readdir44, writeFile as writeFile37 } from "node:fs/promises";
|
|
111896
112102
|
import { homedir as homedir48, platform as platform16 } from "node:os";
|
|
111897
|
-
import { extname as extname7, join as
|
|
112103
|
+
import { extname as extname7, join as join147 } from "node:path";
|
|
111898
112104
|
var IS_WINDOWS3 = platform16() === "win32";
|
|
111899
112105
|
var HOME_PREFIX = "$HOME";
|
|
111900
112106
|
function getHomeDirPrefix() {
|
|
@@ -111904,7 +112110,7 @@ function normalizeInstallPath(path17) {
|
|
|
111904
112110
|
return path17.replace(/\\/g, "/").replace(/\/+$/, "");
|
|
111905
112111
|
}
|
|
111906
112112
|
function getDefaultGlobalClaudeDir() {
|
|
111907
|
-
return normalizeInstallPath(
|
|
112113
|
+
return normalizeInstallPath(join147(homedir48(), ".claude"));
|
|
111908
112114
|
}
|
|
111909
112115
|
function getCustomGlobalClaudeDir(targetClaudeDir) {
|
|
111910
112116
|
if (!targetClaudeDir)
|
|
@@ -112035,7 +112241,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
112035
112241
|
async function processDirectory2(dir) {
|
|
112036
112242
|
const entries = await readdir44(dir, { withFileTypes: true });
|
|
112037
112243
|
for (const entry of entries) {
|
|
112038
|
-
const fullPath =
|
|
112244
|
+
const fullPath = join147(dir, entry.name);
|
|
112039
112245
|
if (entry.isDirectory()) {
|
|
112040
112246
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
112041
112247
|
continue;
|
|
@@ -112043,7 +112249,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
112043
112249
|
await processDirectory2(fullPath);
|
|
112044
112250
|
} else if (entry.isFile() && shouldTransformFile3(entry.name)) {
|
|
112045
112251
|
try {
|
|
112046
|
-
const content = await
|
|
112252
|
+
const content = await readFile64(fullPath, "utf-8");
|
|
112047
112253
|
const { transformed, changes } = transformContent(content, {
|
|
112048
112254
|
targetClaudeDir: options2.targetClaudeDir
|
|
112049
112255
|
});
|
|
@@ -112114,7 +112320,7 @@ async function handleTransforms(ctx) {
|
|
|
112114
112320
|
logger.debug(ctx.options.global ? "Saved folder configuration to ~/.claude/.ck.json" : "Saved folder configuration to .claude/.ck.json");
|
|
112115
112321
|
}
|
|
112116
112322
|
}
|
|
112117
|
-
const claudeDir3 = ctx.options.global ? ctx.resolvedDir :
|
|
112323
|
+
const claudeDir3 = ctx.options.global ? ctx.resolvedDir : join148(ctx.resolvedDir, ".claude");
|
|
112118
112324
|
return {
|
|
112119
112325
|
...ctx,
|
|
112120
112326
|
foldersConfig,
|
|
@@ -112182,6 +112388,7 @@ function createInitContext(rawOptions, prompts) {
|
|
|
112182
112388
|
exclude: [],
|
|
112183
112389
|
only: [],
|
|
112184
112390
|
installSkills: false,
|
|
112391
|
+
packageManager: "auto",
|
|
112185
112392
|
withSudo: false,
|
|
112186
112393
|
skipSetup: false,
|
|
112187
112394
|
forceOverwrite: false,
|
|
@@ -112339,10 +112546,10 @@ async function initCommand(options2) {
|
|
|
112339
112546
|
// src/commands/migrate/migrate-command.ts
|
|
112340
112547
|
init_dist2();
|
|
112341
112548
|
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
112342
|
-
import { existsSync as
|
|
112343
|
-
import { readFile as
|
|
112549
|
+
import { existsSync as existsSync74 } from "node:fs";
|
|
112550
|
+
import { readFile as readFile68, rm as rm18, unlink as unlink14 } from "node:fs/promises";
|
|
112344
112551
|
import { homedir as homedir52 } from "node:os";
|
|
112345
|
-
import { basename as basename30, dirname as dirname49, join as
|
|
112552
|
+
import { basename as basename30, dirname as dirname49, join as join152, resolve as resolve51 } from "node:path";
|
|
112346
112553
|
init_logger();
|
|
112347
112554
|
|
|
112348
112555
|
// src/ui/ck-cli-design/next-steps-footer.ts
|
|
@@ -112555,15 +112762,15 @@ init_model_taxonomy();
|
|
|
112555
112762
|
init_logger();
|
|
112556
112763
|
init_dist2();
|
|
112557
112764
|
init_model_taxonomy();
|
|
112558
|
-
import { mkdir as mkdir39, readFile as
|
|
112765
|
+
import { mkdir as mkdir39, readFile as readFile67, writeFile as writeFile39 } from "node:fs/promises";
|
|
112559
112766
|
import { homedir as homedir51 } from "node:os";
|
|
112560
|
-
import { dirname as dirname47, join as
|
|
112767
|
+
import { dirname as dirname47, join as join151 } from "node:path";
|
|
112561
112768
|
|
|
112562
112769
|
// src/commands/portable/models-dev-cache.ts
|
|
112563
112770
|
init_logger();
|
|
112564
|
-
import { mkdir as mkdir38, readFile as
|
|
112771
|
+
import { mkdir as mkdir38, readFile as readFile65, rename as rename14, writeFile as writeFile38 } from "node:fs/promises";
|
|
112565
112772
|
import { homedir as homedir49 } from "node:os";
|
|
112566
|
-
import { join as
|
|
112773
|
+
import { join as join149 } from "node:path";
|
|
112567
112774
|
|
|
112568
112775
|
class ModelsDevUnavailableError extends Error {
|
|
112569
112776
|
constructor(message, cause) {
|
|
@@ -112575,18 +112782,18 @@ var MODELS_DEV_URL = "https://models.dev/api.json";
|
|
|
112575
112782
|
var CACHE_TTL_MS3 = 24 * 60 * 60 * 1000;
|
|
112576
112783
|
var FETCH_TIMEOUT_MS = 1e4;
|
|
112577
112784
|
function defaultCacheDir() {
|
|
112578
|
-
return
|
|
112785
|
+
return join149(homedir49(), ".config", "claudekit", "cache");
|
|
112579
112786
|
}
|
|
112580
112787
|
function cacheFilePath(cacheDir) {
|
|
112581
|
-
return
|
|
112788
|
+
return join149(cacheDir, "models-dev.json");
|
|
112582
112789
|
}
|
|
112583
112790
|
function tmpFilePath(cacheDir) {
|
|
112584
|
-
return
|
|
112791
|
+
return join149(cacheDir, "models-dev.json.tmp");
|
|
112585
112792
|
}
|
|
112586
112793
|
async function readCacheEntry(cacheDir) {
|
|
112587
112794
|
const filePath = cacheFilePath(cacheDir);
|
|
112588
112795
|
try {
|
|
112589
|
-
const raw2 = await
|
|
112796
|
+
const raw2 = await readFile65(filePath, "utf-8");
|
|
112590
112797
|
const parsed = JSON.parse(raw2);
|
|
112591
112798
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed) && "fetchedAt" in parsed && typeof parsed.fetchedAt === "string" && "payload" in parsed && typeof parsed.payload === "object" && parsed.payload !== null) {
|
|
112592
112799
|
return parsed;
|
|
@@ -112654,21 +112861,21 @@ async function getModelsDevCatalog(opts = {}) {
|
|
|
112654
112861
|
|
|
112655
112862
|
// src/commands/portable/opencode-model-discovery.ts
|
|
112656
112863
|
init_logger();
|
|
112657
|
-
import { readFile as
|
|
112864
|
+
import { readFile as readFile66 } from "node:fs/promises";
|
|
112658
112865
|
import { homedir as homedir50, platform as platform17 } from "node:os";
|
|
112659
|
-
import { join as
|
|
112866
|
+
import { join as join150 } from "node:path";
|
|
112660
112867
|
function resolveOpenCodeAuthPath(homeDir) {
|
|
112661
112868
|
if (platform17() === "win32") {
|
|
112662
|
-
const dataRoot2 = process.env.LOCALAPPDATA ??
|
|
112663
|
-
return
|
|
112869
|
+
const dataRoot2 = process.env.LOCALAPPDATA ?? join150(homeDir, "AppData", "Local");
|
|
112870
|
+
return join150(dataRoot2, "opencode", "auth.json");
|
|
112664
112871
|
}
|
|
112665
|
-
const dataRoot = process.env.XDG_DATA_HOME ??
|
|
112666
|
-
return
|
|
112872
|
+
const dataRoot = process.env.XDG_DATA_HOME ?? join150(homeDir, ".local", "share");
|
|
112873
|
+
return join150(dataRoot, "opencode", "auth.json");
|
|
112667
112874
|
}
|
|
112668
112875
|
async function readAuthedProviders(homeDir) {
|
|
112669
112876
|
const authPath = resolveOpenCodeAuthPath(homeDir);
|
|
112670
112877
|
try {
|
|
112671
|
-
const raw2 = await
|
|
112878
|
+
const raw2 = await readFile66(authPath, "utf-8");
|
|
112672
112879
|
const parsed = JSON.parse(raw2);
|
|
112673
112880
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
112674
112881
|
return Object.keys(parsed);
|
|
@@ -112765,9 +112972,9 @@ function messageForReason(reason) {
|
|
|
112765
112972
|
}
|
|
112766
112973
|
function getOpenCodeConfigPath(options2) {
|
|
112767
112974
|
if (options2.global) {
|
|
112768
|
-
return
|
|
112975
|
+
return join151(options2.homeDir ?? homedir51(), ".config", "opencode", "opencode.json");
|
|
112769
112976
|
}
|
|
112770
|
-
return
|
|
112977
|
+
return join151(options2.cwd ?? process.cwd(), "opencode.json");
|
|
112771
112978
|
}
|
|
112772
112979
|
function makeCatalogOpts(options2) {
|
|
112773
112980
|
return {
|
|
@@ -112870,7 +113077,7 @@ async function ensureOpenCodeModel(options2) {
|
|
|
112870
113077
|
const configPath = getOpenCodeConfigPath(options2);
|
|
112871
113078
|
let existing = null;
|
|
112872
113079
|
try {
|
|
112873
|
-
const raw2 = await
|
|
113080
|
+
const raw2 = await readFile67(configPath, "utf-8");
|
|
112874
113081
|
const parsed = JSON.parse(raw2);
|
|
112875
113082
|
if (parsed !== null && typeof parsed === "object" && !Array.isArray(parsed)) {
|
|
112876
113083
|
existing = parsed;
|
|
@@ -113640,7 +113847,7 @@ function appendFallbackSkillActionsToPlan(plan, skills, selectedProviders, insta
|
|
|
113640
113847
|
reason: "New item, not previously installed",
|
|
113641
113848
|
reasonCode: "new-item",
|
|
113642
113849
|
reasonCopy: "New - not previously installed",
|
|
113643
|
-
targetPath:
|
|
113850
|
+
targetPath: join152(basePath, skill.name),
|
|
113644
113851
|
type: "skill"
|
|
113645
113852
|
});
|
|
113646
113853
|
}
|
|
@@ -113797,7 +114004,7 @@ async function executeDeleteAction(action, options2) {
|
|
|
113797
114004
|
const preservePaths = options2?.preservePaths ?? new Set;
|
|
113798
114005
|
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve51(action.targetPath));
|
|
113799
114006
|
try {
|
|
113800
|
-
if (!shouldPreserveTarget && action.targetPath &&
|
|
114007
|
+
if (!shouldPreserveTarget && action.targetPath && existsSync74(action.targetPath)) {
|
|
113801
114008
|
await rm18(action.targetPath, { recursive: true, force: true });
|
|
113802
114009
|
}
|
|
113803
114010
|
await removePortableInstallation(action.item, action.type, action.provider, action.global, action.targetPath ? { path: action.targetPath } : undefined);
|
|
@@ -113868,7 +114075,7 @@ function resolveHookTargetPath(item, provider, global3) {
|
|
|
113868
114075
|
const converted = convertItem(item, pathConfig.format, provider, { global: global3 });
|
|
113869
114076
|
if (converted.error)
|
|
113870
114077
|
return null;
|
|
113871
|
-
const targetPath = pathConfig.writeStrategy === "single-file" ? basePath :
|
|
114078
|
+
const targetPath = pathConfig.writeStrategy === "single-file" ? basePath : join152(basePath, converted.filename);
|
|
113872
114079
|
const resolvedTarget = resolve51(targetPath).replace(/\\/g, "/");
|
|
113873
114080
|
const resolvedBase = resolve51(basePath).replace(/\\/g, "/").replace(/\/+$/, "");
|
|
113874
114081
|
if (resolvedTarget !== resolvedBase && !resolvedTarget.startsWith(`${resolvedBase}/`)) {
|
|
@@ -113879,12 +114086,12 @@ function resolveHookTargetPath(item, provider, global3) {
|
|
|
113879
114086
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
113880
114087
|
if (!skillSourcePath)
|
|
113881
114088
|
return;
|
|
113882
|
-
const sourceMetadataPath =
|
|
113883
|
-
if (!
|
|
114089
|
+
const sourceMetadataPath = join152(resolve51(skillSourcePath, ".."), "metadata.json");
|
|
114090
|
+
if (!existsSync74(sourceMetadataPath))
|
|
113884
114091
|
return;
|
|
113885
114092
|
let sourceMetadata;
|
|
113886
114093
|
try {
|
|
113887
|
-
const content = await
|
|
114094
|
+
const content = await readFile68(sourceMetadataPath, "utf-8");
|
|
113888
114095
|
sourceMetadata = JSON.parse(content);
|
|
113889
114096
|
} catch (error) {
|
|
113890
114097
|
logger.debug(`[migrate] Failed to parse source metadata.json: ${error}`);
|
|
@@ -113892,8 +114099,8 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
113892
114099
|
}
|
|
113893
114100
|
if (!sourceMetadata.deletions || sourceMetadata.deletions.length === 0)
|
|
113894
114101
|
return;
|
|
113895
|
-
const claudeDir3 = installGlobally ?
|
|
113896
|
-
if (!
|
|
114102
|
+
const claudeDir3 = installGlobally ? join152(homedir52(), ".claude") : join152(process.cwd(), ".claude");
|
|
114103
|
+
if (!existsSync74(claudeDir3))
|
|
113897
114104
|
return;
|
|
113898
114105
|
try {
|
|
113899
114106
|
const result = await handleDeletions(sourceMetadata, claudeDir3, inferKitTypeFromSourceMetadata(sourceMetadata));
|
|
@@ -114020,8 +114227,8 @@ async function migrateCommand(options2) {
|
|
|
114020
114227
|
let requestedGlobal = options2.global ?? false;
|
|
114021
114228
|
let installGlobally = requestedGlobal;
|
|
114022
114229
|
if (options2.global === undefined && !options2.yes) {
|
|
114023
|
-
const projectTarget =
|
|
114024
|
-
const globalTarget =
|
|
114230
|
+
const projectTarget = join152(process.cwd(), ".claude");
|
|
114231
|
+
const globalTarget = join152(homedir52(), ".claude");
|
|
114025
114232
|
const scopeChoice = await ie({
|
|
114026
114233
|
message: "Installation scope",
|
|
114027
114234
|
options: [
|
|
@@ -114094,7 +114301,7 @@ async function migrateCommand(options2) {
|
|
|
114094
114301
|
}).join(`
|
|
114095
114302
|
`));
|
|
114096
114303
|
if (sourceGlobalOnly) {
|
|
114097
|
-
f2.info(import_picocolors30.default.dim(` Scope: global (--global / -g) - reading from ${formatDisplayPath(
|
|
114304
|
+
f2.info(import_picocolors30.default.dim(` Scope: global (--global / -g) - reading from ${formatDisplayPath(join152(homedir52(), ".claude"))}`));
|
|
114098
114305
|
} else {
|
|
114099
114306
|
f2.info(import_picocolors30.default.dim(` CWD: ${process.cwd()}`));
|
|
114100
114307
|
}
|
|
@@ -114185,9 +114392,9 @@ async function migrateCommand(options2) {
|
|
|
114185
114392
|
const interactive = process.stdout.isTTY && !options2.yes;
|
|
114186
114393
|
const conflictActions = plan.actions.filter((a3) => a3.action === "conflict");
|
|
114187
114394
|
for (const action of conflictActions) {
|
|
114188
|
-
if (!action.diff && action.targetPath &&
|
|
114395
|
+
if (!action.diff && action.targetPath && existsSync74(action.targetPath)) {
|
|
114189
114396
|
try {
|
|
114190
|
-
const targetContent = await
|
|
114397
|
+
const targetContent = await readFile68(action.targetPath, "utf-8");
|
|
114191
114398
|
const sourceItem = effectiveAgents.find((a3) => a3.name === action.item) || effectiveCommands.find((c2) => c2.name === action.item) || (effectiveConfigItem?.name === action.item ? effectiveConfigItem : null) || effectiveRuleItems.find((r2) => r2.name === action.item) || effectiveHookItems.find((h2) => h2.name === action.item);
|
|
114192
114399
|
if (sourceItem) {
|
|
114193
114400
|
const providerConfig = providers[action.provider];
|
|
@@ -114284,7 +114491,7 @@ async function migrateCommand(options2) {
|
|
|
114284
114491
|
const progressSink = createMigrateProgressSink(writeTasks.length + plannedDeleteActions.length);
|
|
114285
114492
|
const writtenPaths = new Set;
|
|
114286
114493
|
const recordHookTargetForSettings = (provider, global3, targetPath) => {
|
|
114287
|
-
if (targetPath.length === 0 || !
|
|
114494
|
+
if (targetPath.length === 0 || !existsSync74(targetPath))
|
|
114288
114495
|
return;
|
|
114289
114496
|
const resolvedPath = resolve51(targetPath);
|
|
114290
114497
|
const entry = successfulHookFiles.get(provider) ?? {
|
|
@@ -114403,7 +114610,7 @@ async function migrateCommand(options2) {
|
|
|
114403
114610
|
for (const [hooksProvider, entry] of successfulHookFiles) {
|
|
114404
114611
|
if (entry.files.length === 0)
|
|
114405
114612
|
continue;
|
|
114406
|
-
const sourceSettingsPath = hooksSource ?
|
|
114613
|
+
const sourceSettingsPath = hooksSource ? join152(dirname49(hooksSource), "settings.json") : undefined;
|
|
114407
114614
|
const mergeResult = await migrateHooksSettings({
|
|
114408
114615
|
sourceProvider: "claude-code",
|
|
114409
114616
|
targetProvider: hooksProvider,
|
|
@@ -114516,7 +114723,7 @@ async function migrateCommand(options2) {
|
|
|
114516
114723
|
async function rollbackResults(results) {
|
|
114517
114724
|
const rolledBackPaths = new Set;
|
|
114518
114725
|
for (const result of results) {
|
|
114519
|
-
if (!result.path || !
|
|
114726
|
+
if (!result.path || !existsSync74(result.path))
|
|
114520
114727
|
continue;
|
|
114521
114728
|
try {
|
|
114522
114729
|
if (result.overwritten)
|
|
@@ -114781,7 +114988,7 @@ async function handleDirectorySetup(ctx) {
|
|
|
114781
114988
|
// src/commands/new/phases/project-creation.ts
|
|
114782
114989
|
init_config_manager();
|
|
114783
114990
|
init_github_client();
|
|
114784
|
-
import { join as
|
|
114991
|
+
import { join as join153 } from "node:path";
|
|
114785
114992
|
init_logger();
|
|
114786
114993
|
init_output_manager();
|
|
114787
114994
|
init_types3();
|
|
@@ -114907,7 +115114,7 @@ async function projectCreation(kit, resolvedDir, validOptions, isNonInteractive2
|
|
|
114907
115114
|
output.section("Installing");
|
|
114908
115115
|
logger.verbose("Installation target", { directory: resolvedDir });
|
|
114909
115116
|
const merger = new FileMerger;
|
|
114910
|
-
const claudeDir3 =
|
|
115117
|
+
const claudeDir3 = join153(resolvedDir, ".claude");
|
|
114911
115118
|
merger.setMultiKitContext(claudeDir3, kit);
|
|
114912
115119
|
if (validOptions.exclude && validOptions.exclude.length > 0) {
|
|
114913
115120
|
merger.addIgnorePatterns(validOptions.exclude);
|
|
@@ -114954,7 +115161,7 @@ async function handleProjectCreation(ctx) {
|
|
|
114954
115161
|
}
|
|
114955
115162
|
// src/commands/new/phases/post-setup.ts
|
|
114956
115163
|
init_projects_registry();
|
|
114957
|
-
import { join as
|
|
115164
|
+
import { join as join154 } from "node:path";
|
|
114958
115165
|
init_package_installer();
|
|
114959
115166
|
init_logger();
|
|
114960
115167
|
init_path_resolver();
|
|
@@ -114983,12 +115190,15 @@ async function postSetup(resolvedDir, validOptions, isNonInteractive2, prompts)
|
|
|
114983
115190
|
const skillsDir2 = PathResolver.buildSkillsPath(resolvedDir, false);
|
|
114984
115191
|
await handleSkillsInstallation2(skillsDir2, {
|
|
114985
115192
|
skipConfirm: isNonInteractive2,
|
|
115193
|
+
packageManager: validOptions.packageManager,
|
|
115194
|
+
projectDir: resolvedDir,
|
|
115195
|
+
isGlobal: false,
|
|
114986
115196
|
withSudo: validOptions.withSudo
|
|
114987
115197
|
});
|
|
114988
115198
|
}
|
|
114989
|
-
const claudeDir3 =
|
|
115199
|
+
const claudeDir3 = join154(resolvedDir, ".claude");
|
|
114990
115200
|
await promptSetupWizardIfNeeded({
|
|
114991
|
-
envPath:
|
|
115201
|
+
envPath: join154(claudeDir3, ".env"),
|
|
114992
115202
|
claudeDir: claudeDir3,
|
|
114993
115203
|
isGlobal: false,
|
|
114994
115204
|
isNonInteractive: isNonInteractive2,
|
|
@@ -115057,8 +115267,8 @@ Please use only one download method.`);
|
|
|
115057
115267
|
}
|
|
115058
115268
|
// src/commands/plan/plan-command.ts
|
|
115059
115269
|
init_output_manager();
|
|
115060
|
-
import { existsSync as
|
|
115061
|
-
import { dirname as dirname53, isAbsolute as isAbsolute15, join as
|
|
115270
|
+
import { existsSync as existsSync77, statSync as statSync13 } from "node:fs";
|
|
115271
|
+
import { dirname as dirname53, isAbsolute as isAbsolute15, join as join157, parse as parse7, resolve as resolve56 } from "node:path";
|
|
115062
115272
|
|
|
115063
115273
|
// src/commands/plan/plan-read-handlers.ts
|
|
115064
115274
|
init_config();
|
|
@@ -115067,15 +115277,15 @@ init_plans_registry();
|
|
|
115067
115277
|
init_logger();
|
|
115068
115278
|
init_output_manager();
|
|
115069
115279
|
var import_picocolors32 = __toESM(require_picocolors(), 1);
|
|
115070
|
-
import { existsSync as
|
|
115071
|
-
import { basename as basename31, dirname as dirname51, join as
|
|
115280
|
+
import { existsSync as existsSync76, statSync as statSync12 } from "node:fs";
|
|
115281
|
+
import { basename as basename31, dirname as dirname51, join as join156, relative as relative34, resolve as resolve54 } from "node:path";
|
|
115072
115282
|
|
|
115073
115283
|
// src/commands/plan/plan-dependencies.ts
|
|
115074
115284
|
init_config();
|
|
115075
115285
|
init_plan_parser();
|
|
115076
115286
|
init_plans_registry();
|
|
115077
|
-
import { existsSync as
|
|
115078
|
-
import { dirname as dirname50, join as
|
|
115287
|
+
import { existsSync as existsSync75 } from "node:fs";
|
|
115288
|
+
import { dirname as dirname50, join as join155 } from "node:path";
|
|
115079
115289
|
async function resolvePlanDependencies(references, currentPlanFile, options2 = {}) {
|
|
115080
115290
|
if (references.length === 0)
|
|
115081
115291
|
return [];
|
|
@@ -115095,9 +115305,9 @@ async function resolvePlanDependencies(references, currentPlanFile, options2 = {
|
|
|
115095
115305
|
};
|
|
115096
115306
|
}
|
|
115097
115307
|
const scopeRoot = resolvePlanDirForScope(scope, projectRoot, config);
|
|
115098
|
-
const planFile =
|
|
115308
|
+
const planFile = join155(scopeRoot, planId, "plan.md");
|
|
115099
115309
|
const isSelfReference = planFile === currentPlanFile;
|
|
115100
|
-
if (!
|
|
115310
|
+
if (!existsSync75(planFile)) {
|
|
115101
115311
|
return {
|
|
115102
115312
|
reference,
|
|
115103
115313
|
scope,
|
|
@@ -115237,7 +115447,7 @@ async function handleStatus(target, options2) {
|
|
|
115237
115447
|
}
|
|
115238
115448
|
const effectiveTarget = !resolvedTarget && globalBaseDir ? globalBaseDir : resolvedTarget;
|
|
115239
115449
|
const t = effectiveTarget ? resolve54(effectiveTarget) : null;
|
|
115240
|
-
const plansDir = t &&
|
|
115450
|
+
const plansDir = t && existsSync76(t) && statSync12(t).isDirectory() && !existsSync76(join156(t, "plan.md")) ? t : null;
|
|
115241
115451
|
if (plansDir) {
|
|
115242
115452
|
const planFiles = scanPlanDir(plansDir);
|
|
115243
115453
|
if (planFiles.length === 0) {
|
|
@@ -115655,27 +115865,27 @@ function resolveTargetPath(target, baseDir) {
|
|
|
115655
115865
|
return resolve56(target);
|
|
115656
115866
|
}
|
|
115657
115867
|
const cwdCandidate = resolve56(target);
|
|
115658
|
-
if (
|
|
115868
|
+
if (existsSync77(cwdCandidate)) {
|
|
115659
115869
|
return cwdCandidate;
|
|
115660
115870
|
}
|
|
115661
115871
|
return resolve56(baseDir, target);
|
|
115662
115872
|
}
|
|
115663
115873
|
function resolvePlanFile(target, baseDir) {
|
|
115664
115874
|
const t = target ? resolveTargetPath(target, baseDir) : baseDir ? resolve56(baseDir) : process.cwd();
|
|
115665
|
-
if (
|
|
115875
|
+
if (existsSync77(t)) {
|
|
115666
115876
|
const stat24 = statSync13(t);
|
|
115667
115877
|
if (stat24.isFile())
|
|
115668
115878
|
return t;
|
|
115669
|
-
const candidate =
|
|
115670
|
-
if (
|
|
115879
|
+
const candidate = join157(t, "plan.md");
|
|
115880
|
+
if (existsSync77(candidate))
|
|
115671
115881
|
return candidate;
|
|
115672
115882
|
}
|
|
115673
115883
|
if (!target && !baseDir) {
|
|
115674
115884
|
let dir = process.cwd();
|
|
115675
115885
|
const root = parse7(dir).root;
|
|
115676
115886
|
while (dir !== root) {
|
|
115677
|
-
const candidate =
|
|
115678
|
-
if (
|
|
115887
|
+
const candidate = join157(dir, "plan.md");
|
|
115888
|
+
if (existsSync77(candidate))
|
|
115679
115889
|
return candidate;
|
|
115680
115890
|
dir = dirname53(dir);
|
|
115681
115891
|
}
|
|
@@ -115725,7 +115935,7 @@ async function planCommand(action, target, options2) {
|
|
|
115725
115935
|
let resolvedTarget = target;
|
|
115726
115936
|
if (resolvedAction && !knownActions.has(resolvedAction)) {
|
|
115727
115937
|
const looksLikePath = resolvedAction.includes("/") || resolvedAction.includes("\\") || resolvedAction.endsWith(".md") || resolvedAction === "." || resolvedAction === "..";
|
|
115728
|
-
const existsOnDisk = !looksLikePath &&
|
|
115938
|
+
const existsOnDisk = !looksLikePath && existsSync77(resolve56(resolvedAction));
|
|
115729
115939
|
if (looksLikePath || existsOnDisk) {
|
|
115730
115940
|
resolvedTarget = resolvedAction;
|
|
115731
115941
|
resolvedAction = undefined;
|
|
@@ -115767,13 +115977,13 @@ init_claudekit_data2();
|
|
|
115767
115977
|
init_logger();
|
|
115768
115978
|
init_safe_prompts();
|
|
115769
115979
|
var import_picocolors34 = __toESM(require_picocolors(), 1);
|
|
115770
|
-
import { existsSync as
|
|
115980
|
+
import { existsSync as existsSync78 } from "node:fs";
|
|
115771
115981
|
import { resolve as resolve57 } from "node:path";
|
|
115772
115982
|
async function handleAdd(projectPath, options2) {
|
|
115773
115983
|
logger.debug(`Adding project: ${projectPath}, options: ${JSON.stringify(options2)}`);
|
|
115774
115984
|
intro("Add Project");
|
|
115775
115985
|
const absolutePath = resolve57(projectPath);
|
|
115776
|
-
if (!
|
|
115986
|
+
if (!existsSync78(absolutePath)) {
|
|
115777
115987
|
log.error(`Path does not exist: ${absolutePath}`);
|
|
115778
115988
|
process.exitCode = 1;
|
|
115779
115989
|
return;
|
|
@@ -116123,6 +116333,7 @@ async function handleKitSelection(ctx) {
|
|
|
116123
116333
|
fresh: false,
|
|
116124
116334
|
force: false,
|
|
116125
116335
|
installSkills: false,
|
|
116336
|
+
packageManager: "auto",
|
|
116126
116337
|
withSudo: false,
|
|
116127
116338
|
prefix: false,
|
|
116128
116339
|
beta: false,
|
|
@@ -116194,11 +116405,11 @@ init_logger();
|
|
|
116194
116405
|
init_agents();
|
|
116195
116406
|
var import_gray_matter12 = __toESM(require_gray_matter(), 1);
|
|
116196
116407
|
var import_picocolors37 = __toESM(require_picocolors(), 1);
|
|
116197
|
-
import { readFile as
|
|
116198
|
-
import { join as
|
|
116408
|
+
import { readFile as readFile69 } from "node:fs/promises";
|
|
116409
|
+
import { join as join159 } from "node:path";
|
|
116199
116410
|
|
|
116200
116411
|
// src/commands/skills/installed-skills-inventory.ts
|
|
116201
|
-
import { join as
|
|
116412
|
+
import { join as join158, resolve as resolve58 } from "node:path";
|
|
116202
116413
|
init_path_resolver();
|
|
116203
116414
|
var SCOPE_SORT_ORDER = {
|
|
116204
116415
|
project: 0,
|
|
@@ -116210,8 +116421,8 @@ async function getActiveClaudeSkillInstallations(options2 = {}) {
|
|
|
116210
116421
|
const projectClaudeDir = resolve58(projectDir, ".claude");
|
|
116211
116422
|
const projectScopeAliasesGlobal = projectClaudeDir === globalDir;
|
|
116212
116423
|
const [projectSkills, globalSkills] = await Promise.all([
|
|
116213
|
-
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(
|
|
116214
|
-
scanSkills2(
|
|
116424
|
+
projectScopeAliasesGlobal ? Promise.resolve([]) : scanSkills2(join158(projectClaudeDir, "skills")),
|
|
116425
|
+
scanSkills2(join158(globalDir, "skills"))
|
|
116215
116426
|
]);
|
|
116216
116427
|
const projectIds = new Set(projectSkills.map((skill) => skill.id));
|
|
116217
116428
|
const globalIds = new Set(globalSkills.map((skill) => skill.id));
|
|
@@ -116372,9 +116583,9 @@ async function handleValidate2(sourcePath) {
|
|
|
116372
116583
|
spinner.stop(`Checked ${skills.length} skill(s)`);
|
|
116373
116584
|
let hasIssues = false;
|
|
116374
116585
|
for (const skill of skills) {
|
|
116375
|
-
const skillMdPath =
|
|
116586
|
+
const skillMdPath = join159(skill.path, "SKILL.md");
|
|
116376
116587
|
try {
|
|
116377
|
-
const content = await
|
|
116588
|
+
const content = await readFile69(skillMdPath, "utf-8");
|
|
116378
116589
|
const { data } = import_gray_matter12.default(content, {
|
|
116379
116590
|
engines: { javascript: { parse: () => ({}) } }
|
|
116380
116591
|
});
|
|
@@ -116955,7 +117166,7 @@ async function detectInstallations() {
|
|
|
116955
117166
|
|
|
116956
117167
|
// src/commands/uninstall/removal-handler.ts
|
|
116957
117168
|
import { readdirSync as readdirSync14, rmSync as rmSync8 } from "node:fs";
|
|
116958
|
-
import { basename as basename33, join as
|
|
117169
|
+
import { basename as basename33, join as join162, resolve as resolve59, sep as sep14 } from "node:path";
|
|
116959
117170
|
init_logger();
|
|
116960
117171
|
init_safe_prompts();
|
|
116961
117172
|
init_safe_spinner();
|
|
@@ -116964,7 +117175,7 @@ var import_fs_extra44 = __toESM(require_lib(), 1);
|
|
|
116964
117175
|
// src/commands/uninstall/analysis-handler.ts
|
|
116965
117176
|
init_metadata_migration();
|
|
116966
117177
|
import { readdirSync as readdirSync13, rmSync as rmSync7 } from "node:fs";
|
|
116967
|
-
import { dirname as dirname54, join as
|
|
117178
|
+
import { dirname as dirname54, join as join160 } from "node:path";
|
|
116968
117179
|
init_logger();
|
|
116969
117180
|
init_safe_prompts();
|
|
116970
117181
|
var import_fs_extra42 = __toESM(require_lib(), 1);
|
|
@@ -117024,7 +117235,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
117024
117235
|
const remainingFiles = metadata.kits?.[remainingKit]?.files || [];
|
|
117025
117236
|
for (const file of remainingFiles) {
|
|
117026
117237
|
const relativePath = normalizeTrackedPath(file.path);
|
|
117027
|
-
if (await import_fs_extra42.pathExists(
|
|
117238
|
+
if (await import_fs_extra42.pathExists(join160(installation.path, relativePath))) {
|
|
117028
117239
|
result.retainedManifestPaths.push(relativePath);
|
|
117029
117240
|
}
|
|
117030
117241
|
}
|
|
@@ -117032,7 +117243,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
117032
117243
|
const kitFiles = metadata.kits[kit].files || [];
|
|
117033
117244
|
for (const trackedFile of kitFiles) {
|
|
117034
117245
|
const relativePath = normalizeTrackedPath(trackedFile.path);
|
|
117035
|
-
const filePath =
|
|
117246
|
+
const filePath = join160(installation.path, relativePath);
|
|
117036
117247
|
if (preservedPaths.has(relativePath)) {
|
|
117037
117248
|
result.toPreserve.push({ path: relativePath, reason: "shared with other kit" });
|
|
117038
117249
|
continue;
|
|
@@ -117065,7 +117276,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
117065
117276
|
}
|
|
117066
117277
|
for (const trackedFile of allTrackedFiles) {
|
|
117067
117278
|
const relativePath = normalizeTrackedPath(trackedFile.path);
|
|
117068
|
-
const filePath =
|
|
117279
|
+
const filePath = join160(installation.path, relativePath);
|
|
117069
117280
|
const ownershipResult = await OwnershipChecker.checkOwnership(filePath, metadata, installation.path);
|
|
117070
117281
|
if (!ownershipResult.exists)
|
|
117071
117282
|
continue;
|
|
@@ -117116,7 +117327,7 @@ init_settings_merger();
|
|
|
117116
117327
|
init_command_normalizer();
|
|
117117
117328
|
init_logger();
|
|
117118
117329
|
var import_fs_extra43 = __toESM(require_lib(), 1);
|
|
117119
|
-
import { join as
|
|
117330
|
+
import { join as join161 } from "node:path";
|
|
117120
117331
|
var CK_JSON_FILE2 = ".ck.json";
|
|
117121
117332
|
var SETTINGS_FILE = "settings.json";
|
|
117122
117333
|
var EMPTY_RESULT = {
|
|
@@ -117238,7 +117449,7 @@ async function cleanupCkJson(ckJsonPath, data, removedKitNames, dryRun) {
|
|
|
117238
117449
|
return false;
|
|
117239
117450
|
}
|
|
117240
117451
|
async function cleanupUninstalledSettings(installationPath, options2) {
|
|
117241
|
-
const ckJsonPath =
|
|
117452
|
+
const ckJsonPath = join161(installationPath, CK_JSON_FILE2);
|
|
117242
117453
|
if (!await import_fs_extra43.pathExists(ckJsonPath)) {
|
|
117243
117454
|
return { ...EMPTY_RESULT };
|
|
117244
117455
|
}
|
|
@@ -117253,7 +117464,7 @@ async function cleanupUninstalledSettings(installationPath, options2) {
|
|
|
117253
117464
|
const removedKitNames = options2.kit ? [options2.kit] : Object.keys(kits);
|
|
117254
117465
|
const { hooks, servers } = resolveRemovalTargets(kits, removedKitNames, options2.remainingKits);
|
|
117255
117466
|
const result = { ...EMPTY_RESULT };
|
|
117256
|
-
const settingsPath =
|
|
117467
|
+
const settingsPath = join161(installationPath, SETTINGS_FILE);
|
|
117257
117468
|
const settings = await SettingsMerger.readSettingsFile(settingsPath);
|
|
117258
117469
|
if (settings) {
|
|
117259
117470
|
result.hooksRemoved = removeHooksFromSettings(settings, hooks);
|
|
@@ -117367,8 +117578,8 @@ async function removeInstallations(installations, options2) {
|
|
|
117367
117578
|
}
|
|
117368
117579
|
const mutatePaths = getUninstallMutatePaths({
|
|
117369
117580
|
retainedManifestPaths: analysis.retainedManifestPaths,
|
|
117370
|
-
settingsFileExists: await import_fs_extra44.pathExists(
|
|
117371
|
-
ckJsonExists: await import_fs_extra44.pathExists(
|
|
117581
|
+
settingsFileExists: await import_fs_extra44.pathExists(join162(installation.path, "settings.json")),
|
|
117582
|
+
ckJsonExists: await import_fs_extra44.pathExists(join162(installation.path, ".ck.json"))
|
|
117372
117583
|
});
|
|
117373
117584
|
let backup = null;
|
|
117374
117585
|
if (analysis.toDelete.length > 0 || mutatePaths.length > 0) {
|
|
@@ -117396,7 +117607,7 @@ async function removeInstallations(installations, options2) {
|
|
|
117396
117607
|
let removedCount = 0;
|
|
117397
117608
|
let cleanedDirs = 0;
|
|
117398
117609
|
for (const item of analysis.toDelete) {
|
|
117399
|
-
const filePath =
|
|
117610
|
+
const filePath = join162(installation.path, item.path);
|
|
117400
117611
|
if (!await import_fs_extra44.pathExists(filePath))
|
|
117401
117612
|
continue;
|
|
117402
117613
|
if (!await isPathSafeToRemove(filePath, installation.path)) {
|
|
@@ -117821,9 +118032,9 @@ ${import_picocolors40.default.bold(import_picocolors40.default.cyan(result.kitCo
|
|
|
117821
118032
|
|
|
117822
118033
|
// src/commands/watch/watch-command.ts
|
|
117823
118034
|
init_logger();
|
|
117824
|
-
import { existsSync as
|
|
118035
|
+
import { existsSync as existsSync84 } from "node:fs";
|
|
117825
118036
|
import { rm as rm19 } from "node:fs/promises";
|
|
117826
|
-
import { join as
|
|
118037
|
+
import { join as join169 } from "node:path";
|
|
117827
118038
|
var import_picocolors41 = __toESM(require_picocolors(), 1);
|
|
117828
118039
|
|
|
117829
118040
|
// src/commands/watch/phases/implementation-runner.ts
|
|
@@ -118342,7 +118553,7 @@ function spawnAndCollect3(command, args) {
|
|
|
118342
118553
|
|
|
118343
118554
|
// src/commands/watch/phases/issue-processor.ts
|
|
118344
118555
|
import { mkdir as mkdir40, writeFile as writeFile42 } from "node:fs/promises";
|
|
118345
|
-
import { join as
|
|
118556
|
+
import { join as join165 } from "node:path";
|
|
118346
118557
|
|
|
118347
118558
|
// src/commands/watch/phases/approval-detector.ts
|
|
118348
118559
|
init_logger();
|
|
@@ -118720,9 +118931,9 @@ async function checkAwaitingApproval(state, setup, options2, watchLog, projectDi
|
|
|
118720
118931
|
|
|
118721
118932
|
// src/commands/watch/phases/plan-dir-finder.ts
|
|
118722
118933
|
import { readdir as readdir46, stat as stat24 } from "node:fs/promises";
|
|
118723
|
-
import { join as
|
|
118934
|
+
import { join as join164 } from "node:path";
|
|
118724
118935
|
async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
118725
|
-
const plansRoot =
|
|
118936
|
+
const plansRoot = join164(cwd2, "plans");
|
|
118726
118937
|
try {
|
|
118727
118938
|
const entries = await readdir46(plansRoot);
|
|
118728
118939
|
const tenMinAgo = Date.now() - 10 * 60 * 1000;
|
|
@@ -118731,14 +118942,14 @@ async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
|
118731
118942
|
for (const entry of entries) {
|
|
118732
118943
|
if (entry === "watch" || entry === "reports" || entry === "visuals")
|
|
118733
118944
|
continue;
|
|
118734
|
-
const dirPath =
|
|
118945
|
+
const dirPath = join164(plansRoot, entry);
|
|
118735
118946
|
const dirStat = await stat24(dirPath);
|
|
118736
118947
|
if (!dirStat.isDirectory())
|
|
118737
118948
|
continue;
|
|
118738
118949
|
if (dirStat.mtimeMs < tenMinAgo)
|
|
118739
118950
|
continue;
|
|
118740
118951
|
try {
|
|
118741
|
-
await stat24(
|
|
118952
|
+
await stat24(join164(dirPath, "plan.md"));
|
|
118742
118953
|
} catch {
|
|
118743
118954
|
continue;
|
|
118744
118955
|
}
|
|
@@ -118969,13 +119180,13 @@ async function handlePlanGeneration(issue, state, config, setup, options2, watch
|
|
|
118969
119180
|
stats.plansCreated++;
|
|
118970
119181
|
const detectedPlanDir = await findRecentPlanDir(projectDir, issue.number, watchLog);
|
|
118971
119182
|
if (detectedPlanDir) {
|
|
118972
|
-
state.activeIssues[numStr].planPath =
|
|
119183
|
+
state.activeIssues[numStr].planPath = join165(detectedPlanDir, "plan.md");
|
|
118973
119184
|
watchLog.info(`Plan directory detected: ${detectedPlanDir}`);
|
|
118974
119185
|
} else {
|
|
118975
119186
|
try {
|
|
118976
|
-
const planDir =
|
|
119187
|
+
const planDir = join165(projectDir, "plans", "watch");
|
|
118977
119188
|
await mkdir40(planDir, { recursive: true });
|
|
118978
|
-
const planFilePath =
|
|
119189
|
+
const planFilePath = join165(planDir, `issue-${issue.number}-plan.md`);
|
|
118979
119190
|
await writeFile42(planFilePath, planResult.planText, "utf-8");
|
|
118980
119191
|
state.activeIssues[numStr].planPath = planFilePath;
|
|
118981
119192
|
watchLog.info(`Plan saved (fallback) to ${planFilePath}`);
|
|
@@ -119120,16 +119331,16 @@ function cleanExpiredIssues(state, ttlDays) {
|
|
|
119120
119331
|
init_ck_config_manager();
|
|
119121
119332
|
init_file_io();
|
|
119122
119333
|
init_logger();
|
|
119123
|
-
import { existsSync as
|
|
119124
|
-
import { mkdir as mkdir41, readFile as
|
|
119334
|
+
import { existsSync as existsSync80 } from "node:fs";
|
|
119335
|
+
import { mkdir as mkdir41, readFile as readFile72 } from "node:fs/promises";
|
|
119125
119336
|
import { dirname as dirname55 } from "node:path";
|
|
119126
119337
|
var PROCESSED_ISSUES_CAP = 500;
|
|
119127
119338
|
async function readCkJson(projectDir) {
|
|
119128
119339
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
119129
119340
|
try {
|
|
119130
|
-
if (!
|
|
119341
|
+
if (!existsSync80(configPath))
|
|
119131
119342
|
return {};
|
|
119132
|
-
const content = await
|
|
119343
|
+
const content = await readFile72(configPath, "utf-8");
|
|
119133
119344
|
return JSON.parse(content);
|
|
119134
119345
|
} catch (error) {
|
|
119135
119346
|
logger.warning(`Failed to parse .ck.json: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -119153,7 +119364,7 @@ async function loadWatchState(projectDir) {
|
|
|
119153
119364
|
async function saveWatchState(projectDir, state) {
|
|
119154
119365
|
const configPath = CkConfigManager.getProjectConfigPath(projectDir);
|
|
119155
119366
|
const configDir = dirname55(configPath);
|
|
119156
|
-
if (!
|
|
119367
|
+
if (!existsSync80(configDir)) {
|
|
119157
119368
|
await mkdir41(configDir, { recursive: true });
|
|
119158
119369
|
}
|
|
119159
119370
|
const raw2 = await readCkJson(projectDir);
|
|
@@ -119280,21 +119491,21 @@ async function processImplementationQueue(state, config, setup, options2, watchL
|
|
|
119280
119491
|
// src/commands/watch/phases/repo-scanner.ts
|
|
119281
119492
|
init_logger();
|
|
119282
119493
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
119283
|
-
import { existsSync as
|
|
119494
|
+
import { existsSync as existsSync81 } from "node:fs";
|
|
119284
119495
|
import { readdir as readdir47, stat as stat25 } from "node:fs/promises";
|
|
119285
|
-
import { join as
|
|
119496
|
+
import { join as join166 } from "node:path";
|
|
119286
119497
|
async function scanForRepos(parentDir) {
|
|
119287
119498
|
const repos = [];
|
|
119288
119499
|
const entries = await readdir47(parentDir);
|
|
119289
119500
|
for (const entry of entries) {
|
|
119290
119501
|
if (entry.startsWith("."))
|
|
119291
119502
|
continue;
|
|
119292
|
-
const fullPath =
|
|
119503
|
+
const fullPath = join166(parentDir, entry);
|
|
119293
119504
|
const entryStat = await stat25(fullPath);
|
|
119294
119505
|
if (!entryStat.isDirectory())
|
|
119295
119506
|
continue;
|
|
119296
|
-
const gitDir =
|
|
119297
|
-
if (!
|
|
119507
|
+
const gitDir = join166(fullPath, ".git");
|
|
119508
|
+
if (!existsSync81(gitDir))
|
|
119298
119509
|
continue;
|
|
119299
119510
|
const result = spawnSync7("gh", ["repo", "view", "--json", "owner,name"], {
|
|
119300
119511
|
encoding: "utf-8",
|
|
@@ -119318,9 +119529,9 @@ async function scanForRepos(parentDir) {
|
|
|
119318
119529
|
// src/commands/watch/phases/setup-validator.ts
|
|
119319
119530
|
init_logger();
|
|
119320
119531
|
import { spawnSync as spawnSync8 } from "node:child_process";
|
|
119321
|
-
import { existsSync as
|
|
119532
|
+
import { existsSync as existsSync82 } from "node:fs";
|
|
119322
119533
|
import { homedir as homedir53 } from "node:os";
|
|
119323
|
-
import { join as
|
|
119534
|
+
import { join as join167 } from "node:path";
|
|
119324
119535
|
async function validateSetup(cwd2) {
|
|
119325
119536
|
const workDir = cwd2 ?? process.cwd();
|
|
119326
119537
|
const ghVersion = spawnSync8("gh", ["--version"], { encoding: "utf-8", timeout: 1e4 });
|
|
@@ -119351,8 +119562,8 @@ Run this command from a directory with a GitHub remote.`);
|
|
|
119351
119562
|
} catch {
|
|
119352
119563
|
throw new Error(`Failed to parse repository info: ${ghRepo.stdout}`);
|
|
119353
119564
|
}
|
|
119354
|
-
const skillsPath =
|
|
119355
|
-
const skillsAvailable =
|
|
119565
|
+
const skillsPath = join167(homedir53(), ".claude", "skills");
|
|
119566
|
+
const skillsAvailable = existsSync82(skillsPath);
|
|
119356
119567
|
if (!skillsAvailable) {
|
|
119357
119568
|
logger.warning(`ClaudeKit Engineer skills not found at ${skillsPath}`);
|
|
119358
119569
|
}
|
|
@@ -119368,9 +119579,9 @@ Run this command from a directory with a GitHub remote.`);
|
|
|
119368
119579
|
init_logger();
|
|
119369
119580
|
init_path_resolver();
|
|
119370
119581
|
import { createWriteStream as createWriteStream3, statSync as statSync14 } from "node:fs";
|
|
119371
|
-
import { existsSync as
|
|
119582
|
+
import { existsSync as existsSync83 } from "node:fs";
|
|
119372
119583
|
import { mkdir as mkdir42, rename as rename15 } from "node:fs/promises";
|
|
119373
|
-
import { join as
|
|
119584
|
+
import { join as join168 } from "node:path";
|
|
119374
119585
|
|
|
119375
119586
|
class WatchLogger {
|
|
119376
119587
|
logStream = null;
|
|
@@ -119378,16 +119589,16 @@ class WatchLogger {
|
|
|
119378
119589
|
logPath = null;
|
|
119379
119590
|
maxBytes;
|
|
119380
119591
|
constructor(logDir, maxBytes = 0) {
|
|
119381
|
-
this.logDir = logDir ??
|
|
119592
|
+
this.logDir = logDir ?? join168(PathResolver.getClaudeKitDir(), "logs");
|
|
119382
119593
|
this.maxBytes = maxBytes;
|
|
119383
119594
|
}
|
|
119384
119595
|
async init() {
|
|
119385
119596
|
try {
|
|
119386
|
-
if (!
|
|
119597
|
+
if (!existsSync83(this.logDir)) {
|
|
119387
119598
|
await mkdir42(this.logDir, { recursive: true });
|
|
119388
119599
|
}
|
|
119389
119600
|
const dateStr = formatDate(new Date);
|
|
119390
|
-
this.logPath =
|
|
119601
|
+
this.logPath = join168(this.logDir, `watch-${dateStr}.log`);
|
|
119391
119602
|
this.logStream = createWriteStream3(this.logPath, { flags: "a", mode: 384 });
|
|
119392
119603
|
} catch (error) {
|
|
119393
119604
|
logger.warning(`Cannot create watch log file: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -119569,7 +119780,7 @@ async function watchCommand(options2) {
|
|
|
119569
119780
|
}
|
|
119570
119781
|
async function discoverRepos(options2, watchLog) {
|
|
119571
119782
|
const cwd2 = process.cwd();
|
|
119572
|
-
const isGitRepo =
|
|
119783
|
+
const isGitRepo = existsSync84(join169(cwd2, ".git"));
|
|
119573
119784
|
if (options2.force) {
|
|
119574
119785
|
await forceRemoveLock(watchLog);
|
|
119575
119786
|
}
|
|
@@ -119686,13 +119897,13 @@ function sleep(ms) {
|
|
|
119686
119897
|
// src/cli/command-registry.ts
|
|
119687
119898
|
init_logger();
|
|
119688
119899
|
function registerCommands(cli) {
|
|
119689
|
-
cli.command("new", "Bootstrap a new ClaudeKit project (with interactive version selection)").option("--dir <dir>", "Target directory (default: .)").option("--kit <kit>", "Kit to use: engineer, marketing, all, or comma-separated").option("-r, --release <version>", "Skip version selection, use specific version (e.g., latest, v1.0.0)").option("--force", "Overwrite existing files without confirmation").option("--exclude <pattern>", "Exclude files matching glob pattern (can be used multiple times)").option("--opencode", "Install OpenCode CLI package (non-interactive mode)").option("--gemini", "Install Google Gemini CLI package (non-interactive mode)").option("--install-skills", "Install skills dependencies (non-interactive mode)").option("--with-sudo", "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)").option("--prefix", "Add /ck: prefix to all slash commands by moving them to commands/ck/ subdirectory").option("--beta", "Show beta versions in selection prompt").option("--refresh", "Bypass release cache to fetch latest versions from GitHub").option("--docs-dir <name>", "Custom docs folder name (default: docs)").option("--plans-dir <name>", "Custom plans folder name (default: plans)").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").option("--use-git", "Use git clone instead of GitHub API (uses SSH/HTTPS credentials)").option("--archive <path>", "Use local archive file instead of downloading (zip/tar.gz)").option("--kit-path <path>", "Use local kit directory instead of downloading").action(async (options2) => {
|
|
119900
|
+
cli.command("new", "Bootstrap a new ClaudeKit project (with interactive version selection)").option("--dir <dir>", "Target directory (default: .)").option("--kit <kit>", "Kit to use: engineer, marketing, all, or comma-separated").option("-r, --release <version>", "Skip version selection, use specific version (e.g., latest, v1.0.0)").option("--force", "Overwrite existing files without confirmation").option("--exclude <pattern>", "Exclude files matching glob pattern (can be used multiple times)").option("--opencode", "Install OpenCode CLI package (non-interactive mode)").option("--gemini", "Install Google Gemini CLI package (non-interactive mode)").option("--install-skills", "Install skills dependencies (non-interactive mode)").option("--package-manager <manager>", "Package manager for skills JavaScript dependencies: auto, npm, bun, pnpm, or yarn").option("--with-sudo", "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)").option("--prefix", "Add /ck: prefix to all slash commands by moving them to commands/ck/ subdirectory").option("--beta", "Show beta versions in selection prompt").option("--refresh", "Bypass release cache to fetch latest versions from GitHub").option("--docs-dir <name>", "Custom docs folder name (default: docs)").option("--plans-dir <name>", "Custom plans folder name (default: plans)").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").option("--use-git", "Use git clone instead of GitHub API (uses SSH/HTTPS credentials)").option("--archive <path>", "Use local archive file instead of downloading (zip/tar.gz)").option("--kit-path <path>", "Use local kit directory instead of downloading").action(async (options2) => {
|
|
119690
119901
|
if (options2.exclude && !Array.isArray(options2.exclude)) {
|
|
119691
119902
|
options2.exclude = [options2.exclude];
|
|
119692
119903
|
}
|
|
119693
119904
|
await newCommand(options2);
|
|
119694
119905
|
});
|
|
119695
|
-
cli.command("init", "Initialize or update ClaudeKit project (with interactive version selection)").option("--dir <dir>", "Target directory (default: .)").option("--kit <kit>", "Kit to use: engineer, marketing, all, or comma-separated").option("-r, --release <version>", "Skip version selection, use specific version (e.g., latest, v1.0.0)").option("--exclude <pattern>", "Exclude files matching glob pattern (can be used multiple times)").option("--only <pattern>", "Include only files matching glob pattern (can be used multiple times)").option("-g, --global", "Use platform-specific user configuration directory").option("--fresh", "Full reset: remove CK files, replace settings.json and CLAUDE.md, reinstall from scratch").option("--force", "Force reinstall even if already at latest version (use with --yes; re-onboards missing files without full reset)").option("--install-skills", "Install skills dependencies (non-interactive mode)").option("--with-sudo", "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)").option("--prefix", "Add /ck: prefix to all slash commands by moving them to commands/ck/ subdirectory").option("--beta", "Show beta versions in selection prompt").option("--refresh", "Bypass release cache to fetch latest versions from GitHub").option("--dry-run", "Preview changes without applying them (requires --prefix)").option("--force-overwrite", "Override ownership protections and delete user-modified files (requires --prefix)").option("--force-overwrite-settings", "Fully replace settings.json instead of selective merge (destroys user customizations)").option("--restore-ck-hooks", "Restore CK-managed hook registrations during update self-heal").option("--skip-setup", "Skip interactive configuration wizard").option("--docs-dir <name>", "Custom docs folder name (default: docs)").option("--plans-dir <name>", "Custom plans folder name (default: plans)").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").option("--sync", "Sync config files from upstream with interactive hunk-by-hunk merge").option("--install-mode <mode>", "Engineer global install mode: auto, plugin, or legacy (default: auto)").option("--use-git", "Use git clone instead of GitHub API (uses SSH/HTTPS credentials)").option("--archive <path>", "Use local archive file instead of downloading (zip/tar.gz)").option("--kit-path <path>", "Use local kit directory instead of downloading").action(async (options2) => {
|
|
119906
|
+
cli.command("init", "Initialize or update ClaudeKit project (with interactive version selection)").option("--dir <dir>", "Target directory (default: .)").option("--kit <kit>", "Kit to use: engineer, marketing, all, or comma-separated").option("-r, --release <version>", "Skip version selection, use specific version (e.g., latest, v1.0.0)").option("--exclude <pattern>", "Exclude files matching glob pattern (can be used multiple times)").option("--only <pattern>", "Include only files matching glob pattern (can be used multiple times)").option("-g, --global", "Use platform-specific user configuration directory").option("--fresh", "Full reset: remove CK files, replace settings.json and CLAUDE.md, reinstall from scratch").option("--force", "Force reinstall even if already at latest version (use with --yes; re-onboards missing files without full reset)").option("--install-skills", "Install skills dependencies (non-interactive mode)").option("--package-manager <manager>", "Package manager for skills JavaScript dependencies: auto, npm, bun, pnpm, or yarn").option("--with-sudo", "Include system packages requiring sudo (Linux: ffmpeg, imagemagick)").option("--prefix", "Add /ck: prefix to all slash commands by moving them to commands/ck/ subdirectory").option("--beta", "Show beta versions in selection prompt").option("--refresh", "Bypass release cache to fetch latest versions from GitHub").option("--dry-run", "Preview changes without applying them (requires --prefix)").option("--force-overwrite", "Override ownership protections and delete user-modified files (requires --prefix)").option("--force-overwrite-settings", "Fully replace settings.json instead of selective merge (destroys user customizations)").option("--restore-ck-hooks", "Restore CK-managed hook registrations during update self-heal").option("--skip-setup", "Skip interactive configuration wizard").option("--docs-dir <name>", "Custom docs folder name (default: docs)").option("--plans-dir <name>", "Custom plans folder name (default: plans)").option("-y, --yes", "Non-interactive mode with sensible defaults (skip all prompts)").option("--sync", "Sync config files from upstream with interactive hunk-by-hunk merge").option("--install-mode <mode>", "Engineer global install mode: auto, plugin, or legacy (default: auto)").option("--use-git", "Use git clone instead of GitHub API (uses SSH/HTTPS credentials)").option("--archive <path>", "Use local archive file instead of downloading (zip/tar.gz)").option("--kit-path <path>", "Use local kit directory instead of downloading").action(async (options2) => {
|
|
119696
119907
|
if (options2.exclude && !Array.isArray(options2.exclude)) {
|
|
119697
119908
|
options2.exclude = [options2.exclude];
|
|
119698
119909
|
}
|
|
@@ -119826,8 +120037,8 @@ function registerCommands(cli) {
|
|
|
119826
120037
|
// src/cli/version-display.ts
|
|
119827
120038
|
init_package();
|
|
119828
120039
|
init_config_version_checker();
|
|
119829
|
-
import { existsSync as
|
|
119830
|
-
import { join as
|
|
120040
|
+
import { existsSync as existsSync96, readFileSync as readFileSync29 } from "node:fs";
|
|
120041
|
+
import { join as join181 } from "node:path";
|
|
119831
120042
|
|
|
119832
120043
|
// src/domains/versioning/version-checker.ts
|
|
119833
120044
|
init_version_utils();
|
|
@@ -119840,25 +120051,25 @@ init_types3();
|
|
|
119840
120051
|
// src/domains/versioning/version-cache.ts
|
|
119841
120052
|
init_logger();
|
|
119842
120053
|
init_path_resolver();
|
|
119843
|
-
import { existsSync as
|
|
119844
|
-
import { mkdir as mkdir43, readFile as
|
|
119845
|
-
import { join as
|
|
120054
|
+
import { existsSync as existsSync95 } from "node:fs";
|
|
120055
|
+
import { mkdir as mkdir43, readFile as readFile74, writeFile as writeFile45 } from "node:fs/promises";
|
|
120056
|
+
import { join as join180 } from "node:path";
|
|
119846
120057
|
|
|
119847
120058
|
class VersionCacheManager {
|
|
119848
120059
|
static CACHE_FILENAME = "version-check.json";
|
|
119849
120060
|
static CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
119850
120061
|
static getCacheFile() {
|
|
119851
120062
|
const cacheDir = PathResolver.getCacheDir(false);
|
|
119852
|
-
return
|
|
120063
|
+
return join180(cacheDir, VersionCacheManager.CACHE_FILENAME);
|
|
119853
120064
|
}
|
|
119854
120065
|
static async load() {
|
|
119855
120066
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
119856
120067
|
try {
|
|
119857
|
-
if (!
|
|
120068
|
+
if (!existsSync95(cacheFile)) {
|
|
119858
120069
|
logger.debug("Version check cache not found");
|
|
119859
120070
|
return null;
|
|
119860
120071
|
}
|
|
119861
|
-
const content = await
|
|
120072
|
+
const content = await readFile74(cacheFile, "utf-8");
|
|
119862
120073
|
const cache5 = JSON.parse(content);
|
|
119863
120074
|
if (!cache5.lastCheck || !cache5.currentVersion || !cache5.latestVersion) {
|
|
119864
120075
|
logger.debug("Invalid cache structure, ignoring");
|
|
@@ -119875,7 +120086,7 @@ class VersionCacheManager {
|
|
|
119875
120086
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
119876
120087
|
const cacheDir = PathResolver.getCacheDir(false);
|
|
119877
120088
|
try {
|
|
119878
|
-
if (!
|
|
120089
|
+
if (!existsSync95(cacheDir)) {
|
|
119879
120090
|
await mkdir43(cacheDir, { recursive: true, mode: 448 });
|
|
119880
120091
|
}
|
|
119881
120092
|
await writeFile45(cacheFile, JSON.stringify(cache5, null, 2), "utf-8");
|
|
@@ -119897,7 +120108,7 @@ class VersionCacheManager {
|
|
|
119897
120108
|
static async clear() {
|
|
119898
120109
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
119899
120110
|
try {
|
|
119900
|
-
if (
|
|
120111
|
+
if (existsSync95(cacheFile)) {
|
|
119901
120112
|
const fs20 = await import("node:fs/promises");
|
|
119902
120113
|
await fs20.unlink(cacheFile);
|
|
119903
120114
|
logger.debug("Version check cache cleared");
|
|
@@ -119968,7 +120179,7 @@ init_npm_registry();
|
|
|
119968
120179
|
init_claudekit_constants();
|
|
119969
120180
|
init_logger();
|
|
119970
120181
|
init_version_utils();
|
|
119971
|
-
var
|
|
120182
|
+
var import_compare_versions7 = __toESM(require_umd(), 1);
|
|
119972
120183
|
|
|
119973
120184
|
class CliVersionChecker {
|
|
119974
120185
|
static async check(currentVersion) {
|
|
@@ -119982,13 +120193,13 @@ class CliVersionChecker {
|
|
|
119982
120193
|
logger.debug("Failed to fetch latest CLI version from npm");
|
|
119983
120194
|
return null;
|
|
119984
120195
|
}
|
|
119985
|
-
const current =
|
|
119986
|
-
const latest =
|
|
120196
|
+
const current = normalizeVersion2(currentVersion);
|
|
120197
|
+
const latest = normalizeVersion2(latestVersion);
|
|
119987
120198
|
if (isPrereleaseOfSameBase(current, latest)) {
|
|
119988
120199
|
logger.debug(`CLI version check: skipping update - prerelease (${current}) is same base as stable (${latest})`);
|
|
119989
120200
|
return null;
|
|
119990
120201
|
}
|
|
119991
|
-
const updateAvailable =
|
|
120202
|
+
const updateAvailable = import_compare_versions7.compareVersions(latest, current) > 0;
|
|
119992
120203
|
logger.debug(`CLI version check: current=${current}, latest=${latest}, updateAvailable=${updateAvailable}`);
|
|
119993
120204
|
return {
|
|
119994
120205
|
currentVersion: current,
|
|
@@ -120026,8 +120237,8 @@ function displayKitNotification(result, options2 = {}) {
|
|
|
120026
120237
|
return;
|
|
120027
120238
|
const { currentVersion, latestVersion } = result;
|
|
120028
120239
|
const { isGlobal = false, kitName } = options2;
|
|
120029
|
-
const displayCurrent =
|
|
120030
|
-
const displayLatest =
|
|
120240
|
+
const displayCurrent = normalizeVersion2(currentVersion);
|
|
120241
|
+
const displayLatest = normalizeVersion2(latestVersion);
|
|
120031
120242
|
const boxWidth = 52;
|
|
120032
120243
|
const { topBorder, bottomBorder, emptyLine, padLine } = createNotificationBox2(import_picocolors44.default.cyan, boxWidth);
|
|
120033
120244
|
const headerText = import_picocolors44.default.bold(import_picocolors44.default.yellow("⬆ Kit Update Available"));
|
|
@@ -120160,11 +120371,11 @@ async function displayVersion() {
|
|
|
120160
120371
|
let localInstalledKits = [];
|
|
120161
120372
|
let globalInstalledKits = [];
|
|
120162
120373
|
const globalKitDir = PathResolver.getGlobalKitDir();
|
|
120163
|
-
const globalMetadataPath =
|
|
120374
|
+
const globalMetadataPath = join181(globalKitDir, "metadata.json");
|
|
120164
120375
|
const prefix = PathResolver.getPathPrefix(false);
|
|
120165
|
-
const localMetadataPath = prefix ?
|
|
120376
|
+
const localMetadataPath = prefix ? join181(process.cwd(), prefix, "metadata.json") : join181(process.cwd(), "metadata.json");
|
|
120166
120377
|
const isLocalSameAsGlobal = localMetadataPath === globalMetadataPath;
|
|
120167
|
-
if (!isLocalSameAsGlobal &&
|
|
120378
|
+
if (!isLocalSameAsGlobal && existsSync96(localMetadataPath)) {
|
|
120168
120379
|
try {
|
|
120169
120380
|
const rawMetadata = JSON.parse(readFileSync29(localMetadataPath, "utf-8"));
|
|
120170
120381
|
const metadata = MetadataSchema.parse(rawMetadata);
|
|
@@ -120178,7 +120389,7 @@ async function displayVersion() {
|
|
|
120178
120389
|
logger.verbose("Failed to parse local metadata.json", { error });
|
|
120179
120390
|
}
|
|
120180
120391
|
}
|
|
120181
|
-
if (
|
|
120392
|
+
if (existsSync96(globalMetadataPath)) {
|
|
120182
120393
|
try {
|
|
120183
120394
|
const rawMetadata = JSON.parse(readFileSync29(globalMetadataPath, "utf-8"));
|
|
120184
120395
|
const metadata = MetadataSchema.parse(rawMetadata);
|