claudekit-cli 3.38.0-dev.3 → 3.38.0-dev.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +493 -427
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55546,8 +55546,8 @@ var init_agents = __esm(() => {
|
|
|
55546
55546
|
"gemini-cli": {
|
|
55547
55547
|
name: "gemini-cli",
|
|
55548
55548
|
displayName: "Gemini CLI",
|
|
55549
|
-
projectPath: ".
|
|
55550
|
-
globalPath: join39(home6, ".
|
|
55549
|
+
projectPath: ".agents/skills",
|
|
55550
|
+
globalPath: join39(home6, ".agents/skills"),
|
|
55551
55551
|
detect: async () => existsSync32(join39(home6, ".gemini"))
|
|
55552
55552
|
},
|
|
55553
55553
|
antigravity: {
|
|
@@ -55613,7 +55613,7 @@ var init_agents = __esm(() => {
|
|
|
55613
55613
|
import { existsSync as existsSync33 } from "node:fs";
|
|
55614
55614
|
import { mkdir as mkdir9, readFile as readFile22, writeFile as writeFile11 } from "node:fs/promises";
|
|
55615
55615
|
import { homedir as homedir26 } from "node:os";
|
|
55616
|
-
import { dirname as dirname16, join as join40 } from "node:path";
|
|
55616
|
+
import { dirname as dirname16, join as join40, sep as sep5 } from "node:path";
|
|
55617
55617
|
function getCliVersion3() {
|
|
55618
55618
|
try {
|
|
55619
55619
|
if (process.env.npm_package_version) {
|
|
@@ -55630,6 +55630,19 @@ function getCliVersion3() {
|
|
|
55630
55630
|
return "unknown";
|
|
55631
55631
|
}
|
|
55632
55632
|
}
|
|
55633
|
+
function migrateRegistryPaths(registry) {
|
|
55634
|
+
let changed = false;
|
|
55635
|
+
for (const entry of registry.installations) {
|
|
55636
|
+
for (const migration of REGISTRY_PATH_MIGRATIONS) {
|
|
55637
|
+
if (entry.agent === migration.agent && entry.path.includes(migration.oldSegment)) {
|
|
55638
|
+
entry.path = entry.path.replace(migration.oldSegment, migration.newSegment);
|
|
55639
|
+
changed = true;
|
|
55640
|
+
break;
|
|
55641
|
+
}
|
|
55642
|
+
}
|
|
55643
|
+
}
|
|
55644
|
+
return changed;
|
|
55645
|
+
}
|
|
55633
55646
|
async function readRegistry() {
|
|
55634
55647
|
try {
|
|
55635
55648
|
if (!existsSync33(REGISTRY_PATH2)) {
|
|
@@ -55637,7 +55650,13 @@ async function readRegistry() {
|
|
|
55637
55650
|
}
|
|
55638
55651
|
const content = await readFile22(REGISTRY_PATH2, "utf-8");
|
|
55639
55652
|
const data = JSON.parse(content);
|
|
55640
|
-
|
|
55653
|
+
const registry = SkillRegistrySchema.parse(data);
|
|
55654
|
+
if (migrateRegistryPaths(registry)) {
|
|
55655
|
+
try {
|
|
55656
|
+
await writeFile11(REGISTRY_PATH2, JSON.stringify(registry, null, 2), "utf-8");
|
|
55657
|
+
} catch {}
|
|
55658
|
+
}
|
|
55659
|
+
return registry;
|
|
55641
55660
|
} catch (error) {
|
|
55642
55661
|
const { logger: logger2 } = (init_logger(), __toCommonJS(exports_logger));
|
|
55643
55662
|
const errorMsg = error instanceof Error ? error.message : "Unknown error";
|
|
@@ -55702,7 +55721,7 @@ async function syncRegistry() {
|
|
|
55702
55721
|
}
|
|
55703
55722
|
return { removed };
|
|
55704
55723
|
}
|
|
55705
|
-
var home7, REGISTRY_PATH2, SkillInstallationSchema, SkillRegistrySchema;
|
|
55724
|
+
var home7, REGISTRY_PATH2, SkillInstallationSchema, SkillRegistrySchema, REGISTRY_PATH_MIGRATIONS;
|
|
55706
55725
|
var init_skills_registry = __esm(() => {
|
|
55707
55726
|
init_zod();
|
|
55708
55727
|
home7 = homedir26();
|
|
@@ -55720,12 +55739,25 @@ var init_skills_registry = __esm(() => {
|
|
|
55720
55739
|
version: exports_external.literal("1.0"),
|
|
55721
55740
|
installations: exports_external.array(SkillInstallationSchema)
|
|
55722
55741
|
});
|
|
55742
|
+
REGISTRY_PATH_MIGRATIONS = [
|
|
55743
|
+
{
|
|
55744
|
+
agent: "gemini-cli",
|
|
55745
|
+
oldSegment: `${sep5}.gemini${sep5}skills${sep5}`,
|
|
55746
|
+
newSegment: `${sep5}.agents${sep5}skills${sep5}`
|
|
55747
|
+
},
|
|
55748
|
+
{
|
|
55749
|
+
agent: "gemini-cli",
|
|
55750
|
+
oldSegment: `${sep5}.gemini${sep5}skills`,
|
|
55751
|
+
newSegment: `${sep5}.agents${sep5}skills`
|
|
55752
|
+
}
|
|
55753
|
+
];
|
|
55723
55754
|
});
|
|
55724
55755
|
|
|
55725
55756
|
// src/commands/skills/skills-installer.ts
|
|
55726
55757
|
import { existsSync as existsSync34 } from "node:fs";
|
|
55727
|
-
import { cp as cp2, mkdir as mkdir10, stat as stat7 } from "node:fs/promises";
|
|
55728
|
-
import {
|
|
55758
|
+
import { cp as cp2, mkdir as mkdir10, rm as rm7, stat as stat7 } from "node:fs/promises";
|
|
55759
|
+
import { homedir as homedir27 } from "node:os";
|
|
55760
|
+
import { dirname as dirname17, join as join41, resolve as resolve12 } from "node:path";
|
|
55729
55761
|
function isSamePath2(path1, path22) {
|
|
55730
55762
|
try {
|
|
55731
55763
|
return resolve12(path1) === resolve12(path22);
|
|
@@ -55752,6 +55784,30 @@ function getErrorMessage2(error, targetPath) {
|
|
|
55752
55784
|
}
|
|
55753
55785
|
return error instanceof Error ? error.message : "Unknown error";
|
|
55754
55786
|
}
|
|
55787
|
+
async function cleanupLegacySkillPath(skillName, agent, global3) {
|
|
55788
|
+
const legacy = LEGACY_SKILL_PATHS[agent];
|
|
55789
|
+
if (!legacy)
|
|
55790
|
+
return;
|
|
55791
|
+
const legacyBase = global3 ? legacy.global : legacy.project;
|
|
55792
|
+
const legacyPath = join41(legacyBase, skillName);
|
|
55793
|
+
if (!existsSync34(legacyPath))
|
|
55794
|
+
return;
|
|
55795
|
+
await rm7(legacyPath, { recursive: true, force: true });
|
|
55796
|
+
const registry = await readRegistry();
|
|
55797
|
+
let changed = false;
|
|
55798
|
+
for (const entry of registry.installations) {
|
|
55799
|
+
if (entry.skill === skillName && entry.agent === agent && entry.global === global3) {
|
|
55800
|
+
if (entry.path === legacyPath) {
|
|
55801
|
+
const newBase = global3 ? agents[agent].globalPath : agents[agent].projectPath;
|
|
55802
|
+
entry.path = join41(newBase, skillName);
|
|
55803
|
+
changed = true;
|
|
55804
|
+
}
|
|
55805
|
+
}
|
|
55806
|
+
}
|
|
55807
|
+
if (changed) {
|
|
55808
|
+
await writeRegistry(registry);
|
|
55809
|
+
}
|
|
55810
|
+
}
|
|
55755
55811
|
async function installSkillForAgent(skill, agent, options2) {
|
|
55756
55812
|
const agentConfig = agents[agent];
|
|
55757
55813
|
const targetPath = getInstallPath(skill.name, agent, options2);
|
|
@@ -55767,6 +55823,9 @@ async function installSkillForAgent(skill, agent, options2) {
|
|
|
55767
55823
|
};
|
|
55768
55824
|
}
|
|
55769
55825
|
try {
|
|
55826
|
+
try {
|
|
55827
|
+
await cleanupLegacySkillPath(skill.name, agent, options2.global);
|
|
55828
|
+
} catch {}
|
|
55770
55829
|
const parentDir = dirname17(targetPath);
|
|
55771
55830
|
if (!existsSync34(parentDir)) {
|
|
55772
55831
|
await mkdir10(parentDir, { recursive: true });
|
|
@@ -55821,15 +55880,22 @@ function getInstallPreview(skill, targetAgents, options2) {
|
|
|
55821
55880
|
};
|
|
55822
55881
|
});
|
|
55823
55882
|
}
|
|
55883
|
+
var LEGACY_SKILL_PATHS;
|
|
55824
55884
|
var init_skills_installer = __esm(() => {
|
|
55825
55885
|
init_agents();
|
|
55826
55886
|
init_skills_registry();
|
|
55887
|
+
LEGACY_SKILL_PATHS = {
|
|
55888
|
+
"gemini-cli": {
|
|
55889
|
+
project: ".gemini/skills",
|
|
55890
|
+
global: join41(homedir27(), ".gemini/skills")
|
|
55891
|
+
}
|
|
55892
|
+
};
|
|
55827
55893
|
});
|
|
55828
55894
|
|
|
55829
55895
|
// src/commands/skills/skills-uninstaller.ts
|
|
55830
55896
|
import { existsSync as existsSync35 } from "node:fs";
|
|
55831
|
-
import { rm as
|
|
55832
|
-
import { join as
|
|
55897
|
+
import { rm as rm8 } from "node:fs/promises";
|
|
55898
|
+
import { join as join42 } from "node:path";
|
|
55833
55899
|
async function uninstallSkillFromAgent(skill, agent, global3) {
|
|
55834
55900
|
const agentConfig = agents[agent];
|
|
55835
55901
|
const registry = await readRegistry();
|
|
@@ -55850,7 +55916,7 @@ async function uninstallSkillFromAgent(skill, agent, global3) {
|
|
|
55850
55916
|
const fileExists = existsSync35(path4);
|
|
55851
55917
|
try {
|
|
55852
55918
|
if (fileExists) {
|
|
55853
|
-
await
|
|
55919
|
+
await rm8(path4, { recursive: true, force: true });
|
|
55854
55920
|
}
|
|
55855
55921
|
await removeInstallation(skill, agent, global3);
|
|
55856
55922
|
return {
|
|
@@ -55877,7 +55943,7 @@ async function uninstallSkillFromAgent(skill, agent, global3) {
|
|
|
55877
55943
|
async function forceUninstallSkill(skill, agent, global3) {
|
|
55878
55944
|
const agentConfig = agents[agent];
|
|
55879
55945
|
const basePath = global3 ? agentConfig.globalPath : agentConfig.projectPath;
|
|
55880
|
-
const path4 =
|
|
55946
|
+
const path4 = join42(basePath, skill);
|
|
55881
55947
|
if (!existsSync35(path4)) {
|
|
55882
55948
|
return {
|
|
55883
55949
|
skill,
|
|
@@ -55890,7 +55956,7 @@ async function forceUninstallSkill(skill, agent, global3) {
|
|
|
55890
55956
|
};
|
|
55891
55957
|
}
|
|
55892
55958
|
try {
|
|
55893
|
-
await
|
|
55959
|
+
await rm8(path4, { recursive: true, force: true });
|
|
55894
55960
|
await removeInstallation(skill, agent, global3);
|
|
55895
55961
|
return {
|
|
55896
55962
|
skill,
|
|
@@ -56421,7 +56487,7 @@ var init_pnpm_detector = __esm(() => {
|
|
|
56421
56487
|
import { existsSync as existsSync36, realpathSync as realpathSync2 } from "node:fs";
|
|
56422
56488
|
import { chmod as chmod2, mkdir as mkdir11, readFile as readFile23, writeFile as writeFile12 } from "node:fs/promises";
|
|
56423
56489
|
import { platform as platform4 } from "node:os";
|
|
56424
|
-
import { join as
|
|
56490
|
+
import { join as join43 } from "node:path";
|
|
56425
56491
|
function detectFromBinaryPath() {
|
|
56426
56492
|
const normalizePath2 = (pathValue) => pathValue.replace(/\\/g, "/").toLowerCase();
|
|
56427
56493
|
const detectFromNormalizedPath = (normalized) => {
|
|
@@ -56498,7 +56564,7 @@ function detectFromEnv() {
|
|
|
56498
56564
|
}
|
|
56499
56565
|
async function readCachedPm() {
|
|
56500
56566
|
try {
|
|
56501
|
-
const cacheFile =
|
|
56567
|
+
const cacheFile = join43(PathResolver.getConfigDir(false), CACHE_FILE);
|
|
56502
56568
|
if (!existsSync36(cacheFile)) {
|
|
56503
56569
|
return null;
|
|
56504
56570
|
}
|
|
@@ -56529,7 +56595,7 @@ async function saveCachedPm(pm, getVersion) {
|
|
|
56529
56595
|
return;
|
|
56530
56596
|
try {
|
|
56531
56597
|
const configDir = PathResolver.getConfigDir(false);
|
|
56532
|
-
const cacheFile =
|
|
56598
|
+
const cacheFile = join43(configDir, CACHE_FILE);
|
|
56533
56599
|
if (!existsSync36(configDir)) {
|
|
56534
56600
|
await mkdir11(configDir, { recursive: true });
|
|
56535
56601
|
if (platform4() !== "win32") {
|
|
@@ -56592,7 +56658,7 @@ async function findOwningPm() {
|
|
|
56592
56658
|
async function clearCache() {
|
|
56593
56659
|
try {
|
|
56594
56660
|
const { unlink: unlink6 } = await import("node:fs/promises");
|
|
56595
|
-
const cacheFile =
|
|
56661
|
+
const cacheFile = join43(PathResolver.getConfigDir(false), CACHE_FILE);
|
|
56596
56662
|
if (existsSync36(cacheFile)) {
|
|
56597
56663
|
await unlink6(cacheFile);
|
|
56598
56664
|
logger.debug("Package manager cache cleared");
|
|
@@ -56749,9 +56815,9 @@ var init_package_manager_detector = __esm(() => {
|
|
|
56749
56815
|
});
|
|
56750
56816
|
|
|
56751
56817
|
// src/domains/migration/metadata-migration.ts
|
|
56752
|
-
import { join as
|
|
56818
|
+
import { join as join44 } from "node:path";
|
|
56753
56819
|
async function detectMetadataFormat(claudeDir2) {
|
|
56754
|
-
const metadataPath =
|
|
56820
|
+
const metadataPath = join44(claudeDir2, "metadata.json");
|
|
56755
56821
|
if (!await import_fs_extra3.pathExists(metadataPath)) {
|
|
56756
56822
|
return { format: "none", metadata: null, detectedKit: null };
|
|
56757
56823
|
}
|
|
@@ -56803,7 +56869,7 @@ async function migrateToMultiKit(claudeDir2) {
|
|
|
56803
56869
|
toFormat: "multi-kit"
|
|
56804
56870
|
};
|
|
56805
56871
|
}
|
|
56806
|
-
const metadataPath =
|
|
56872
|
+
const metadataPath = join44(claudeDir2, "metadata.json");
|
|
56807
56873
|
const legacy = detection.metadata;
|
|
56808
56874
|
if (!legacy) {
|
|
56809
56875
|
return {
|
|
@@ -57086,7 +57152,7 @@ var init_version_utils = __esm(() => {
|
|
|
57086
57152
|
});
|
|
57087
57153
|
|
|
57088
57154
|
// src/services/file-operations/claudekit-scanner.ts
|
|
57089
|
-
import { join as
|
|
57155
|
+
import { join as join45 } from "node:path";
|
|
57090
57156
|
async function scanClaudeKitDirectory(directoryPath) {
|
|
57091
57157
|
const counts = {
|
|
57092
57158
|
agents: 0,
|
|
@@ -57100,33 +57166,33 @@ async function scanClaudeKitDirectory(directoryPath) {
|
|
|
57100
57166
|
}
|
|
57101
57167
|
const items = await import_fs_extra4.readdir(directoryPath);
|
|
57102
57168
|
if (items.includes("agents")) {
|
|
57103
|
-
const agentsPath =
|
|
57169
|
+
const agentsPath = join45(directoryPath, "agents");
|
|
57104
57170
|
const agentFiles = await import_fs_extra4.readdir(agentsPath);
|
|
57105
57171
|
counts.agents = agentFiles.filter((file) => file.endsWith(".md")).length;
|
|
57106
57172
|
}
|
|
57107
57173
|
if (items.includes("commands")) {
|
|
57108
|
-
const commandsPath =
|
|
57174
|
+
const commandsPath = join45(directoryPath, "commands");
|
|
57109
57175
|
const commandFiles = await import_fs_extra4.readdir(commandsPath);
|
|
57110
57176
|
counts.commands = commandFiles.filter((file) => file.endsWith(".md")).length;
|
|
57111
57177
|
}
|
|
57112
57178
|
if (items.includes("rules")) {
|
|
57113
|
-
const rulesPath =
|
|
57179
|
+
const rulesPath = join45(directoryPath, "rules");
|
|
57114
57180
|
const ruleFiles = await import_fs_extra4.readdir(rulesPath);
|
|
57115
57181
|
counts.rules = ruleFiles.filter((file) => file.endsWith(".md")).length;
|
|
57116
57182
|
} else if (items.includes("workflows")) {
|
|
57117
|
-
const workflowsPath =
|
|
57183
|
+
const workflowsPath = join45(directoryPath, "workflows");
|
|
57118
57184
|
const workflowFiles = await import_fs_extra4.readdir(workflowsPath);
|
|
57119
57185
|
counts.rules = workflowFiles.filter((file) => file.endsWith(".md")).length;
|
|
57120
57186
|
}
|
|
57121
57187
|
if (items.includes("skills")) {
|
|
57122
|
-
const skillsPath =
|
|
57188
|
+
const skillsPath = join45(directoryPath, "skills");
|
|
57123
57189
|
const skillItems = await import_fs_extra4.readdir(skillsPath);
|
|
57124
57190
|
let skillCount = 0;
|
|
57125
57191
|
for (const item of skillItems) {
|
|
57126
57192
|
if (SKIP_DIRS_CLAUDE_INTERNAL.includes(item)) {
|
|
57127
57193
|
continue;
|
|
57128
57194
|
}
|
|
57129
|
-
const itemPath =
|
|
57195
|
+
const itemPath = join45(skillsPath, item);
|
|
57130
57196
|
const stat8 = await import_fs_extra4.readdir(itemPath).catch(() => null);
|
|
57131
57197
|
if (stat8?.includes("SKILL.md")) {
|
|
57132
57198
|
skillCount++;
|
|
@@ -57168,14 +57234,14 @@ async function getClaudeKitSetup(projectDir = process.cwd()) {
|
|
|
57168
57234
|
const globalDir = getGlobalInstallDir();
|
|
57169
57235
|
if (await import_fs_extra4.pathExists(globalDir)) {
|
|
57170
57236
|
setup.global.path = globalDir;
|
|
57171
|
-
setup.global.metadata = await readClaudeKitMetadata(
|
|
57237
|
+
setup.global.metadata = await readClaudeKitMetadata(join45(globalDir, "metadata.json"));
|
|
57172
57238
|
setup.global.components = await scanClaudeKitDirectory(globalDir);
|
|
57173
57239
|
}
|
|
57174
|
-
const projectClaudeDir =
|
|
57240
|
+
const projectClaudeDir = join45(projectDir, ".claude");
|
|
57175
57241
|
const isLocalSameAsGlobal = projectClaudeDir === globalDir;
|
|
57176
57242
|
if (!isLocalSameAsGlobal && await import_fs_extra4.pathExists(projectClaudeDir)) {
|
|
57177
57243
|
setup.project.path = projectClaudeDir;
|
|
57178
|
-
setup.project.metadata = await readClaudeKitMetadata(
|
|
57244
|
+
setup.project.metadata = await readClaudeKitMetadata(join45(projectClaudeDir, "metadata.json"));
|
|
57179
57245
|
setup.project.components = await scanClaudeKitDirectory(projectClaudeDir);
|
|
57180
57246
|
}
|
|
57181
57247
|
return setup;
|
|
@@ -57192,7 +57258,7 @@ var package_default;
|
|
|
57192
57258
|
var init_package = __esm(() => {
|
|
57193
57259
|
package_default = {
|
|
57194
57260
|
name: "claudekit-cli",
|
|
57195
|
-
version: "3.38.0-dev.
|
|
57261
|
+
version: "3.38.0-dev.4",
|
|
57196
57262
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
57197
57263
|
type: "module",
|
|
57198
57264
|
repository: {
|
|
@@ -57754,7 +57820,7 @@ var init_error_handler2 = __esm(() => {
|
|
|
57754
57820
|
// src/domains/versioning/release-cache.ts
|
|
57755
57821
|
import { existsSync as existsSync37 } from "node:fs";
|
|
57756
57822
|
import { mkdir as mkdir12, readFile as readFile26, unlink as unlink6, writeFile as writeFile14 } from "node:fs/promises";
|
|
57757
|
-
import { join as
|
|
57823
|
+
import { join as join46 } from "node:path";
|
|
57758
57824
|
var ReleaseCacheEntrySchema, ReleaseCache;
|
|
57759
57825
|
var init_release_cache = __esm(() => {
|
|
57760
57826
|
init_logger();
|
|
@@ -57769,7 +57835,7 @@ var init_release_cache = __esm(() => {
|
|
|
57769
57835
|
static CACHE_TTL_SECONDS = Number(process.env.CK_CACHE_TTL) || 3600;
|
|
57770
57836
|
cacheDir;
|
|
57771
57837
|
constructor() {
|
|
57772
|
-
this.cacheDir =
|
|
57838
|
+
this.cacheDir = join46(PathResolver.getCacheDir(false), ReleaseCache.CACHE_DIR);
|
|
57773
57839
|
}
|
|
57774
57840
|
async get(key) {
|
|
57775
57841
|
const cacheFile = this.getCachePath(key);
|
|
@@ -57827,7 +57893,7 @@ var init_release_cache = __esm(() => {
|
|
|
57827
57893
|
const files = await readdir10(this.cacheDir);
|
|
57828
57894
|
for (const file of files) {
|
|
57829
57895
|
if (file.endsWith(".json")) {
|
|
57830
|
-
await unlink6(
|
|
57896
|
+
await unlink6(join46(this.cacheDir, file));
|
|
57831
57897
|
}
|
|
57832
57898
|
}
|
|
57833
57899
|
logger.debug("All release cache cleared");
|
|
@@ -57838,7 +57904,7 @@ var init_release_cache = __esm(() => {
|
|
|
57838
57904
|
}
|
|
57839
57905
|
getCachePath(key) {
|
|
57840
57906
|
const safeKey = key.replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
57841
|
-
return
|
|
57907
|
+
return join46(this.cacheDir, `${safeKey}.json`);
|
|
57842
57908
|
}
|
|
57843
57909
|
isExpired(timestamp) {
|
|
57844
57910
|
const now = Date.now();
|
|
@@ -58479,7 +58545,7 @@ var init_github_client = __esm(() => {
|
|
|
58479
58545
|
|
|
58480
58546
|
// src/commands/update-cli.ts
|
|
58481
58547
|
import { exec as exec2 } from "node:child_process";
|
|
58482
|
-
import { join as
|
|
58548
|
+
import { join as join47 } from "node:path";
|
|
58483
58549
|
import { promisify as promisify8 } from "node:util";
|
|
58484
58550
|
function getDefaultUpdateCliCommandDeps() {
|
|
58485
58551
|
return {
|
|
@@ -58556,7 +58622,7 @@ function selectKitForUpdate(params) {
|
|
|
58556
58622
|
};
|
|
58557
58623
|
}
|
|
58558
58624
|
async function readMetadataFile(claudeDir2) {
|
|
58559
|
-
const metadataPath =
|
|
58625
|
+
const metadataPath = join47(claudeDir2, "metadata.json");
|
|
58560
58626
|
try {
|
|
58561
58627
|
if (!await import_fs_extra5.pathExists(metadataPath)) {
|
|
58562
58628
|
return null;
|
|
@@ -58877,7 +58943,7 @@ var init_update_cli = __esm(() => {
|
|
|
58877
58943
|
// src/domains/versioning/version-cache.ts
|
|
58878
58944
|
import { existsSync as existsSync38 } from "node:fs";
|
|
58879
58945
|
import { mkdir as mkdir13, readFile as readFile28, writeFile as writeFile15 } from "node:fs/promises";
|
|
58880
|
-
import { join as
|
|
58946
|
+
import { join as join48 } from "node:path";
|
|
58881
58947
|
var VersionCacheManager;
|
|
58882
58948
|
var init_version_cache = __esm(() => {
|
|
58883
58949
|
init_logger();
|
|
@@ -58887,7 +58953,7 @@ var init_version_cache = __esm(() => {
|
|
|
58887
58953
|
static CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000;
|
|
58888
58954
|
static getCacheFile() {
|
|
58889
58955
|
const cacheDir = PathResolver.getCacheDir(false);
|
|
58890
|
-
return
|
|
58956
|
+
return join48(cacheDir, VersionCacheManager.CACHE_FILENAME);
|
|
58891
58957
|
}
|
|
58892
58958
|
static async load() {
|
|
58893
58959
|
const cacheFile = VersionCacheManager.getCacheFile();
|
|
@@ -59156,7 +59222,7 @@ var init_version_checker = __esm(() => {
|
|
|
59156
59222
|
import { spawn as spawn2 } from "node:child_process";
|
|
59157
59223
|
import { existsSync as existsSync39 } from "node:fs";
|
|
59158
59224
|
import { readFile as readFile29 } from "node:fs/promises";
|
|
59159
|
-
import { join as
|
|
59225
|
+
import { join as join49 } from "node:path";
|
|
59160
59226
|
function hasCliUpdate(currentVersion, latestVersion) {
|
|
59161
59227
|
if (!latestVersion) {
|
|
59162
59228
|
return false;
|
|
@@ -59399,7 +59465,7 @@ async function getPackageJson() {
|
|
|
59399
59465
|
}
|
|
59400
59466
|
async function getKitMetadata2(kitName) {
|
|
59401
59467
|
try {
|
|
59402
|
-
const metadataPath =
|
|
59468
|
+
const metadataPath = join49(PathResolver.getGlobalKitDir(), "metadata.json");
|
|
59403
59469
|
if (!existsSync39(metadataPath))
|
|
59404
59470
|
return null;
|
|
59405
59471
|
const content = await readFile29(metadataPath, "utf-8");
|
|
@@ -59546,7 +59612,7 @@ var init_routes = __esm(() => {
|
|
|
59546
59612
|
|
|
59547
59613
|
// src/domains/web-server/static-server.ts
|
|
59548
59614
|
import { existsSync as existsSync40 } from "node:fs";
|
|
59549
|
-
import { dirname as dirname18, extname as extname4, join as
|
|
59615
|
+
import { dirname as dirname18, extname as extname4, join as join50, resolve as resolve13 } from "node:path";
|
|
59550
59616
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
59551
59617
|
function tryServeFromEmbedded(app) {
|
|
59552
59618
|
if (typeof globalThis.Bun === "undefined" || !globalThis.Bun.embeddedFiles?.length) {
|
|
@@ -59614,22 +59680,22 @@ function addRuntimeUiCandidate(candidates, runtimePath) {
|
|
|
59614
59680
|
return;
|
|
59615
59681
|
}
|
|
59616
59682
|
const entryDir = dirname18(resolve13(runtimePath));
|
|
59617
|
-
candidates.add(
|
|
59618
|
-
candidates.add(
|
|
59683
|
+
candidates.add(join50(entryDir, "ui"));
|
|
59684
|
+
candidates.add(join50(entryDir, "..", "dist", "ui"));
|
|
59619
59685
|
}
|
|
59620
59686
|
function resolveUiDistPath() {
|
|
59621
59687
|
const candidates = new Set;
|
|
59622
59688
|
addRuntimeUiCandidate(candidates, process.execPath);
|
|
59623
59689
|
addRuntimeUiCandidate(candidates, process.argv[1]);
|
|
59624
|
-
candidates.add(
|
|
59625
|
-
candidates.add(
|
|
59626
|
-
candidates.add(
|
|
59690
|
+
candidates.add(join50(__dirname3, "ui"));
|
|
59691
|
+
candidates.add(join50(process.cwd(), "dist", "ui"));
|
|
59692
|
+
candidates.add(join50(process.cwd(), "src", "ui", "dist"));
|
|
59627
59693
|
for (const path4 of candidates) {
|
|
59628
|
-
if (existsSync40(
|
|
59694
|
+
if (existsSync40(join50(path4, "index.html"))) {
|
|
59629
59695
|
return path4;
|
|
59630
59696
|
}
|
|
59631
59697
|
}
|
|
59632
|
-
return Array.from(candidates)[0] ??
|
|
59698
|
+
return Array.from(candidates)[0] ?? join50(process.cwd(), "dist", "ui");
|
|
59633
59699
|
}
|
|
59634
59700
|
function serveStatic(app) {
|
|
59635
59701
|
if (tryServeFromEmbedded(app)) {
|
|
@@ -59668,7 +59734,7 @@ function serveStatic(app) {
|
|
|
59668
59734
|
if (req.path.startsWith("/assets/") || req.path.match(/\.(js|css|ico|png|jpg|svg|woff2?)$/)) {
|
|
59669
59735
|
return next();
|
|
59670
59736
|
}
|
|
59671
|
-
res.sendFile(
|
|
59737
|
+
res.sendFile(join50(uiDistPath, "index.html"), { dotfiles: "allow" });
|
|
59672
59738
|
});
|
|
59673
59739
|
logger.debug(`Serving static files from ${uiDistPath}`);
|
|
59674
59740
|
}
|
|
@@ -64686,7 +64752,7 @@ var init_gemini_installer = __esm(() => {
|
|
|
64686
64752
|
});
|
|
64687
64753
|
|
|
64688
64754
|
// src/services/package-installer/opencode-installer.ts
|
|
64689
|
-
import { join as
|
|
64755
|
+
import { join as join68 } from "node:path";
|
|
64690
64756
|
async function isOpenCodeInstalled() {
|
|
64691
64757
|
try {
|
|
64692
64758
|
await execAsync7("opencode --version", { timeout: 5000 });
|
|
@@ -64709,7 +64775,7 @@ async function installOpenCode() {
|
|
|
64709
64775
|
logger.info(`Installing ${displayName}...`);
|
|
64710
64776
|
const { unlink: unlink11 } = await import("node:fs/promises");
|
|
64711
64777
|
const { tmpdir: tmpdir4 } = await import("node:os");
|
|
64712
|
-
const tempScriptPath =
|
|
64778
|
+
const tempScriptPath = join68(tmpdir4(), "opencode-install.sh");
|
|
64713
64779
|
try {
|
|
64714
64780
|
logger.info("Downloading OpenCode installation script...");
|
|
64715
64781
|
await execFileAsync5("curl", ["-fsSL", "https://opencode.ai/install", "-o", tempScriptPath], {
|
|
@@ -64761,7 +64827,7 @@ var PARTIAL_INSTALL_VERSION = "partial", EXIT_CODE_CRITICAL_FAILURE = 1, EXIT_CO
|
|
|
64761
64827
|
|
|
64762
64828
|
// src/services/package-installer/install-error-handler.ts
|
|
64763
64829
|
import { existsSync as existsSync51, readFileSync as readFileSync13, unlinkSync as unlinkSync2 } from "node:fs";
|
|
64764
|
-
import { join as
|
|
64830
|
+
import { join as join69 } from "node:path";
|
|
64765
64831
|
function parseNameReason(str2) {
|
|
64766
64832
|
const colonIndex = str2.indexOf(":");
|
|
64767
64833
|
if (colonIndex === -1) {
|
|
@@ -64770,7 +64836,7 @@ function parseNameReason(str2) {
|
|
|
64770
64836
|
return [str2.slice(0, colonIndex).trim(), str2.slice(colonIndex + 1).trim()];
|
|
64771
64837
|
}
|
|
64772
64838
|
function displayInstallErrors(skillsDir2) {
|
|
64773
|
-
const summaryPath =
|
|
64839
|
+
const summaryPath = join69(skillsDir2, ".install-error-summary.json");
|
|
64774
64840
|
if (!existsSync51(summaryPath)) {
|
|
64775
64841
|
logger.error("Skills installation failed. Run with --verbose for details.");
|
|
64776
64842
|
return;
|
|
@@ -64861,7 +64927,7 @@ async function checkNeedsSudoPackages() {
|
|
|
64861
64927
|
}
|
|
64862
64928
|
}
|
|
64863
64929
|
function hasInstallState(skillsDir2) {
|
|
64864
|
-
const stateFilePath =
|
|
64930
|
+
const stateFilePath = join69(skillsDir2, ".install-state.json");
|
|
64865
64931
|
return existsSync51(stateFilePath);
|
|
64866
64932
|
}
|
|
64867
64933
|
var WHICH_COMMAND_TIMEOUT_MS = 5000;
|
|
@@ -64870,7 +64936,7 @@ var init_install_error_handler = __esm(() => {
|
|
|
64870
64936
|
});
|
|
64871
64937
|
|
|
64872
64938
|
// src/services/package-installer/skills-installer.ts
|
|
64873
|
-
import { join as
|
|
64939
|
+
import { join as join70 } from "node:path";
|
|
64874
64940
|
async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
64875
64941
|
const { skipConfirm = false, withSudo = false } = options2;
|
|
64876
64942
|
const displayName = "Skills Dependencies";
|
|
@@ -64896,7 +64962,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
64896
64962
|
const clack = await Promise.resolve().then(() => (init_dist2(), exports_dist));
|
|
64897
64963
|
const platform7 = process.platform;
|
|
64898
64964
|
const scriptName = platform7 === "win32" ? "install.ps1" : "install.sh";
|
|
64899
|
-
const scriptPath =
|
|
64965
|
+
const scriptPath = join70(skillsDir2, scriptName);
|
|
64900
64966
|
try {
|
|
64901
64967
|
validateScriptPath(skillsDir2, scriptPath);
|
|
64902
64968
|
} catch (error) {
|
|
@@ -64912,7 +64978,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
64912
64978
|
logger.warning(`Skills installation script not found: ${scriptPath}`);
|
|
64913
64979
|
logger.info("");
|
|
64914
64980
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
64915
|
-
logger.info(` See: ${
|
|
64981
|
+
logger.info(` See: ${join70(skillsDir2, "INSTALLATION.md")}`);
|
|
64916
64982
|
logger.info("");
|
|
64917
64983
|
logger.info("Quick start:");
|
|
64918
64984
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -64959,7 +65025,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
64959
65025
|
logger.info(` ${platform7 === "win32" ? `powershell -File "${scriptPath}"` : `bash ${scriptPath}`}`);
|
|
64960
65026
|
logger.info("");
|
|
64961
65027
|
logger.info("Or see complete guide:");
|
|
64962
|
-
logger.info(` ${
|
|
65028
|
+
logger.info(` ${join70(skillsDir2, "INSTALLATION.md")}`);
|
|
64963
65029
|
return {
|
|
64964
65030
|
success: false,
|
|
64965
65031
|
package: displayName,
|
|
@@ -65080,7 +65146,7 @@ async function installSkillsDependencies(skillsDir2, options2 = {}) {
|
|
|
65080
65146
|
logger.info("\uD83D\uDCD6 Manual Installation Instructions:");
|
|
65081
65147
|
logger.info("");
|
|
65082
65148
|
logger.info("See complete guide:");
|
|
65083
|
-
logger.info(` cat ${
|
|
65149
|
+
logger.info(` cat ${join70(skillsDir2, "INSTALLATION.md")}`);
|
|
65084
65150
|
logger.info("");
|
|
65085
65151
|
logger.info("Quick start:");
|
|
65086
65152
|
logger.info(" cd .claude/skills/ai-multimodal/scripts");
|
|
@@ -65126,7 +65192,7 @@ var init_skills_installer2 = __esm(() => {
|
|
|
65126
65192
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
65127
65193
|
import { existsSync as existsSync52 } from "node:fs";
|
|
65128
65194
|
import { mkdir as mkdir17, readFile as readFile36, writeFile as writeFile20 } from "node:fs/promises";
|
|
65129
|
-
import { dirname as dirname21, join as
|
|
65195
|
+
import { dirname as dirname21, join as join71 } from "node:path";
|
|
65130
65196
|
async function readJsonFile(filePath) {
|
|
65131
65197
|
try {
|
|
65132
65198
|
const content = await readFile36(filePath, "utf-8");
|
|
@@ -65138,7 +65204,7 @@ async function readJsonFile(filePath) {
|
|
|
65138
65204
|
}
|
|
65139
65205
|
}
|
|
65140
65206
|
async function addGeminiToGitignore(projectDir) {
|
|
65141
|
-
const gitignorePath =
|
|
65207
|
+
const gitignorePath = join71(projectDir, ".gitignore");
|
|
65142
65208
|
const geminiPattern = ".gemini/";
|
|
65143
65209
|
try {
|
|
65144
65210
|
let content = "";
|
|
@@ -65229,13 +65295,13 @@ var init_config_manager2 = __esm(() => {
|
|
|
65229
65295
|
|
|
65230
65296
|
// src/services/package-installer/gemini-mcp/validation.ts
|
|
65231
65297
|
import { existsSync as existsSync53, lstatSync, readlinkSync } from "node:fs";
|
|
65232
|
-
import { homedir as
|
|
65233
|
-
import { join as
|
|
65298
|
+
import { homedir as homedir30 } from "node:os";
|
|
65299
|
+
import { join as join72 } from "node:path";
|
|
65234
65300
|
function getGlobalMcpConfigPath() {
|
|
65235
|
-
return
|
|
65301
|
+
return join72(homedir30(), ".claude", ".mcp.json");
|
|
65236
65302
|
}
|
|
65237
65303
|
function getLocalMcpConfigPath(projectDir) {
|
|
65238
|
-
return
|
|
65304
|
+
return join72(projectDir, ".mcp.json");
|
|
65239
65305
|
}
|
|
65240
65306
|
function findMcpConfigPath(projectDir) {
|
|
65241
65307
|
const localPath = getLocalMcpConfigPath(projectDir);
|
|
@@ -65253,9 +65319,9 @@ function findMcpConfigPath(projectDir) {
|
|
|
65253
65319
|
}
|
|
65254
65320
|
function getGeminiSettingsPath(projectDir, isGlobal) {
|
|
65255
65321
|
if (isGlobal) {
|
|
65256
|
-
return
|
|
65322
|
+
return join72(homedir30(), ".gemini", "settings.json");
|
|
65257
65323
|
}
|
|
65258
|
-
return
|
|
65324
|
+
return join72(projectDir, ".gemini", "settings.json");
|
|
65259
65325
|
}
|
|
65260
65326
|
function checkExistingGeminiConfig(projectDir, isGlobal = false) {
|
|
65261
65327
|
const geminiSettingsPath = getGeminiSettingsPath(projectDir, isGlobal);
|
|
@@ -65285,7 +65351,7 @@ var init_validation = __esm(() => {
|
|
|
65285
65351
|
// src/services/package-installer/gemini-mcp/linker-core.ts
|
|
65286
65352
|
import { existsSync as existsSync54 } from "node:fs";
|
|
65287
65353
|
import { mkdir as mkdir18, symlink as symlink2 } from "node:fs/promises";
|
|
65288
|
-
import { dirname as dirname22, join as
|
|
65354
|
+
import { dirname as dirname22, join as join73 } from "node:path";
|
|
65289
65355
|
async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
65290
65356
|
const linkDir = dirname22(linkPath);
|
|
65291
65357
|
if (!existsSync54(linkDir)) {
|
|
@@ -65296,7 +65362,7 @@ async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
|
65296
65362
|
if (isGlobal) {
|
|
65297
65363
|
symlinkTarget = getGlobalMcpConfigPath();
|
|
65298
65364
|
} else {
|
|
65299
|
-
const localMcpPath =
|
|
65365
|
+
const localMcpPath = join73(projectDir, ".mcp.json");
|
|
65300
65366
|
const isLocalConfig = targetPath === localMcpPath;
|
|
65301
65367
|
symlinkTarget = isLocalConfig ? "../.mcp.json" : targetPath;
|
|
65302
65368
|
}
|
|
@@ -67713,9 +67779,9 @@ __export(exports_worktree_manager, {
|
|
|
67713
67779
|
});
|
|
67714
67780
|
import { existsSync as existsSync62 } from "node:fs";
|
|
67715
67781
|
import { readFile as readFile53, writeFile as writeFile33 } from "node:fs/promises";
|
|
67716
|
-
import { join as
|
|
67782
|
+
import { join as join124 } from "node:path";
|
|
67717
67783
|
async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
67718
|
-
const worktreePath =
|
|
67784
|
+
const worktreePath = join124(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
67719
67785
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
67720
67786
|
await spawnAndCollect("git", ["fetch", "origin", baseBranch], projectDir).catch(() => {
|
|
67721
67787
|
logger.warning(`[worktree] Could not fetch origin/${baseBranch}, using local`);
|
|
@@ -67733,7 +67799,7 @@ async function createWorktree(projectDir, issueNumber, baseBranch) {
|
|
|
67733
67799
|
return worktreePath;
|
|
67734
67800
|
}
|
|
67735
67801
|
async function removeWorktree(projectDir, issueNumber) {
|
|
67736
|
-
const worktreePath =
|
|
67802
|
+
const worktreePath = join124(projectDir, WORKTREE_DIR, `issue-${issueNumber}`);
|
|
67737
67803
|
const branchName = `ck-watch/issue-${issueNumber}`;
|
|
67738
67804
|
try {
|
|
67739
67805
|
await spawnAndCollect("git", ["worktree", "remove", worktreePath, "--force"], projectDir);
|
|
@@ -67747,7 +67813,7 @@ async function listActiveWorktrees(projectDir) {
|
|
|
67747
67813
|
try {
|
|
67748
67814
|
const output2 = await spawnAndCollect("git", ["worktree", "list", "--porcelain"], projectDir);
|
|
67749
67815
|
const issueNumbers = [];
|
|
67750
|
-
const worktreePrefix =
|
|
67816
|
+
const worktreePrefix = join124(projectDir, WORKTREE_DIR, "issue-").replace(/\\/g, "/");
|
|
67751
67817
|
for (const line of output2.split(`
|
|
67752
67818
|
`)) {
|
|
67753
67819
|
if (line.startsWith("worktree ")) {
|
|
@@ -67775,7 +67841,7 @@ async function cleanupAllWorktrees(projectDir) {
|
|
|
67775
67841
|
await spawnAndCollect("git", ["worktree", "prune"], projectDir).catch(() => {});
|
|
67776
67842
|
}
|
|
67777
67843
|
async function ensureGitignore(projectDir) {
|
|
67778
|
-
const gitignorePath =
|
|
67844
|
+
const gitignorePath = join124(projectDir, ".gitignore");
|
|
67779
67845
|
try {
|
|
67780
67846
|
const content = existsSync62(gitignorePath) ? await readFile53(gitignorePath, "utf-8") : "";
|
|
67781
67847
|
if (!content.includes(".worktrees")) {
|
|
@@ -67881,8 +67947,8 @@ var init_content_validator = __esm(() => {
|
|
|
67881
67947
|
import { createHash as createHash6 } from "node:crypto";
|
|
67882
67948
|
import { existsSync as existsSync68, mkdirSync as mkdirSync4, readFileSync as readFileSync14, readdirSync as readdirSync8, statSync as statSync10 } from "node:fs";
|
|
67883
67949
|
import { rename as rename9, writeFile as writeFile35 } from "node:fs/promises";
|
|
67884
|
-
import { homedir as
|
|
67885
|
-
import { basename as basename19, join as
|
|
67950
|
+
import { homedir as homedir34 } from "node:os";
|
|
67951
|
+
import { basename as basename19, join as join131 } from "node:path";
|
|
67886
67952
|
function getCachedContext(repoPath) {
|
|
67887
67953
|
const cachePath = getCacheFilePath(repoPath);
|
|
67888
67954
|
if (!existsSync68(cachePath))
|
|
@@ -67925,25 +67991,25 @@ function computeSourceHash(repoPath) {
|
|
|
67925
67991
|
}
|
|
67926
67992
|
function getDocSourcePaths(repoPath) {
|
|
67927
67993
|
const paths = [];
|
|
67928
|
-
const docsDir =
|
|
67994
|
+
const docsDir = join131(repoPath, "docs");
|
|
67929
67995
|
if (existsSync68(docsDir)) {
|
|
67930
67996
|
try {
|
|
67931
67997
|
const files = readdirSync8(docsDir);
|
|
67932
67998
|
for (const f3 of files) {
|
|
67933
67999
|
if (f3.endsWith(".md"))
|
|
67934
|
-
paths.push(
|
|
68000
|
+
paths.push(join131(docsDir, f3));
|
|
67935
68001
|
}
|
|
67936
68002
|
} catch {}
|
|
67937
68003
|
}
|
|
67938
|
-
const readme =
|
|
68004
|
+
const readme = join131(repoPath, "README.md");
|
|
67939
68005
|
if (existsSync68(readme))
|
|
67940
68006
|
paths.push(readme);
|
|
67941
|
-
const stylesDir =
|
|
68007
|
+
const stylesDir = join131(repoPath, "assets", "writing-styles");
|
|
67942
68008
|
if (existsSync68(stylesDir)) {
|
|
67943
68009
|
try {
|
|
67944
68010
|
const files = readdirSync8(stylesDir);
|
|
67945
68011
|
for (const f3 of files) {
|
|
67946
|
-
paths.push(
|
|
68012
|
+
paths.push(join131(stylesDir, f3));
|
|
67947
68013
|
}
|
|
67948
68014
|
} catch {}
|
|
67949
68015
|
}
|
|
@@ -67952,11 +68018,11 @@ function getDocSourcePaths(repoPath) {
|
|
|
67952
68018
|
function getCacheFilePath(repoPath) {
|
|
67953
68019
|
const repoName = basename19(repoPath).replace(/[^a-zA-Z0-9_-]/g, "_");
|
|
67954
68020
|
const pathHash = createHash6("sha256").update(repoPath).digest("hex").slice(0, 8);
|
|
67955
|
-
return
|
|
68021
|
+
return join131(CACHE_DIR, `${repoName}-${pathHash}-context-cache.json`);
|
|
67956
68022
|
}
|
|
67957
68023
|
var CACHE_DIR, CACHE_TTL_MS4;
|
|
67958
68024
|
var init_context_cache_manager = __esm(() => {
|
|
67959
|
-
CACHE_DIR =
|
|
68025
|
+
CACHE_DIR = join131(homedir34(), ".claudekit", "cache");
|
|
67960
68026
|
CACHE_TTL_MS4 = 24 * 60 * 60 * 1000;
|
|
67961
68027
|
});
|
|
67962
68028
|
|
|
@@ -68137,7 +68203,7 @@ function extractContentFromResponse(response) {
|
|
|
68137
68203
|
// src/commands/content/phases/docs-summarizer.ts
|
|
68138
68204
|
import { execSync as execSync6 } from "node:child_process";
|
|
68139
68205
|
import { existsSync as existsSync69, readFileSync as readFileSync15, readdirSync as readdirSync9 } from "node:fs";
|
|
68140
|
-
import { join as
|
|
68206
|
+
import { join as join132 } from "node:path";
|
|
68141
68207
|
async function summarizeProjectDocs(repoPath, contentLogger) {
|
|
68142
68208
|
const rawContent = collectRawDocs(repoPath);
|
|
68143
68209
|
if (rawContent.total.length < 200) {
|
|
@@ -68191,12 +68257,12 @@ function collectRawDocs(repoPath) {
|
|
|
68191
68257
|
return capped;
|
|
68192
68258
|
};
|
|
68193
68259
|
const docsContent = [];
|
|
68194
|
-
const docsDir =
|
|
68260
|
+
const docsDir = join132(repoPath, "docs");
|
|
68195
68261
|
if (existsSync69(docsDir)) {
|
|
68196
68262
|
try {
|
|
68197
68263
|
const files = readdirSync9(docsDir).filter((f3) => f3.endsWith(".md")).sort();
|
|
68198
68264
|
for (const f3 of files) {
|
|
68199
|
-
const content = readCapped(
|
|
68265
|
+
const content = readCapped(join132(docsDir, f3), 5000);
|
|
68200
68266
|
if (content) {
|
|
68201
68267
|
docsContent.push(`### ${f3}
|
|
68202
68268
|
${content}`);
|
|
@@ -68210,21 +68276,21 @@ ${content}`);
|
|
|
68210
68276
|
let brand = "";
|
|
68211
68277
|
const brandCandidates = ["docs/brand-guidelines.md", "docs/design-guidelines.md"];
|
|
68212
68278
|
for (const p of brandCandidates) {
|
|
68213
|
-
brand = readCapped(
|
|
68279
|
+
brand = readCapped(join132(repoPath, p), 3000);
|
|
68214
68280
|
if (brand)
|
|
68215
68281
|
break;
|
|
68216
68282
|
}
|
|
68217
68283
|
let styles3 = "";
|
|
68218
|
-
const stylesDir =
|
|
68284
|
+
const stylesDir = join132(repoPath, "assets", "writing-styles");
|
|
68219
68285
|
if (existsSync69(stylesDir)) {
|
|
68220
68286
|
try {
|
|
68221
68287
|
const files = readdirSync9(stylesDir).slice(0, 3);
|
|
68222
|
-
styles3 = files.map((f3) => readCapped(
|
|
68288
|
+
styles3 = files.map((f3) => readCapped(join132(stylesDir, f3), 1000)).filter(Boolean).join(`
|
|
68223
68289
|
|
|
68224
68290
|
`);
|
|
68225
68291
|
} catch {}
|
|
68226
68292
|
}
|
|
68227
|
-
const readme = readCapped(
|
|
68293
|
+
const readme = readCapped(join132(repoPath, "README.md"), 3000);
|
|
68228
68294
|
const total = [docs, brand, styles3, readme].join(`
|
|
68229
68295
|
`);
|
|
68230
68296
|
return { docs, brand, styles: styles3, readme, total };
|
|
@@ -68410,10 +68476,10 @@ IMPORTANT: Generate the image and output the path as JSON: {"imagePath": "/path/
|
|
|
68410
68476
|
// src/commands/content/phases/photo-generator.ts
|
|
68411
68477
|
import { execSync as execSync7 } from "node:child_process";
|
|
68412
68478
|
import { existsSync as existsSync70, mkdirSync as mkdirSync5, readdirSync as readdirSync10 } from "node:fs";
|
|
68413
|
-
import { homedir as
|
|
68414
|
-
import { join as
|
|
68479
|
+
import { homedir as homedir35 } from "node:os";
|
|
68480
|
+
import { join as join133 } from "node:path";
|
|
68415
68481
|
async function generatePhoto(_content, context, config, platform14, contentId, contentLogger) {
|
|
68416
|
-
const mediaDir =
|
|
68482
|
+
const mediaDir = join133(config.contentDir.replace(/^~/, homedir35()), "media", String(contentId));
|
|
68417
68483
|
if (!existsSync70(mediaDir)) {
|
|
68418
68484
|
mkdirSync5(mediaDir, { recursive: true });
|
|
68419
68485
|
}
|
|
@@ -68438,7 +68504,7 @@ async function generatePhoto(_content, context, config, platform14, contentId, c
|
|
|
68438
68504
|
const imageFile = files.find((f3) => /\.(png|jpg|jpeg|webp)$/i.test(f3));
|
|
68439
68505
|
if (imageFile) {
|
|
68440
68506
|
const ext2 = imageFile.split(".").pop() ?? "png";
|
|
68441
|
-
return { path:
|
|
68507
|
+
return { path: join133(mediaDir, imageFile), ...dimensions, format: ext2 };
|
|
68442
68508
|
}
|
|
68443
68509
|
contentLogger.warn(`Photo generation produced no image for content ${contentId}`);
|
|
68444
68510
|
return null;
|
|
@@ -68527,8 +68593,8 @@ var init_content_creator = __esm(() => {
|
|
|
68527
68593
|
|
|
68528
68594
|
// src/commands/content/phases/content-logger.ts
|
|
68529
68595
|
import { createWriteStream as createWriteStream4, existsSync as existsSync71, mkdirSync as mkdirSync6, statSync as statSync11 } from "node:fs";
|
|
68530
|
-
import { homedir as
|
|
68531
|
-
import { join as
|
|
68596
|
+
import { homedir as homedir36 } from "node:os";
|
|
68597
|
+
import { join as join134 } from "node:path";
|
|
68532
68598
|
|
|
68533
68599
|
class ContentLogger {
|
|
68534
68600
|
stream = null;
|
|
@@ -68536,7 +68602,7 @@ class ContentLogger {
|
|
|
68536
68602
|
logDir;
|
|
68537
68603
|
maxBytes;
|
|
68538
68604
|
constructor(maxBytes = 0) {
|
|
68539
|
-
this.logDir =
|
|
68605
|
+
this.logDir = join134(homedir36(), ".claudekit", "logs");
|
|
68540
68606
|
this.maxBytes = maxBytes;
|
|
68541
68607
|
}
|
|
68542
68608
|
init() {
|
|
@@ -68568,7 +68634,7 @@ class ContentLogger {
|
|
|
68568
68634
|
}
|
|
68569
68635
|
}
|
|
68570
68636
|
getLogPath() {
|
|
68571
|
-
return
|
|
68637
|
+
return join134(this.logDir, `content-${this.getDateStr()}.log`);
|
|
68572
68638
|
}
|
|
68573
68639
|
write(level, message) {
|
|
68574
68640
|
this.rotateIfNeeded();
|
|
@@ -68585,18 +68651,18 @@ class ContentLogger {
|
|
|
68585
68651
|
if (dateStr !== this.currentDate) {
|
|
68586
68652
|
this.close();
|
|
68587
68653
|
this.currentDate = dateStr;
|
|
68588
|
-
const logPath =
|
|
68654
|
+
const logPath = join134(this.logDir, `content-${dateStr}.log`);
|
|
68589
68655
|
this.stream = createWriteStream4(logPath, { flags: "a", mode: 384 });
|
|
68590
68656
|
return;
|
|
68591
68657
|
}
|
|
68592
68658
|
if (this.maxBytes > 0 && this.stream) {
|
|
68593
|
-
const logPath =
|
|
68659
|
+
const logPath = join134(this.logDir, `content-${this.currentDate}.log`);
|
|
68594
68660
|
try {
|
|
68595
68661
|
const stat20 = statSync11(logPath);
|
|
68596
68662
|
if (stat20.size >= this.maxBytes) {
|
|
68597
68663
|
this.close();
|
|
68598
68664
|
const suffix = Date.now();
|
|
68599
|
-
const rotatedPath =
|
|
68665
|
+
const rotatedPath = join134(this.logDir, `content-${this.currentDate}-${suffix}.log`);
|
|
68600
68666
|
import("node:fs/promises").then(({ rename: rename10 }) => rename10(logPath, rotatedPath).catch(() => {}));
|
|
68601
68667
|
this.stream = createWriteStream4(logPath, { flags: "w", mode: 384 });
|
|
68602
68668
|
}
|
|
@@ -68814,7 +68880,7 @@ function isNoiseCommit(title, author) {
|
|
|
68814
68880
|
// src/commands/content/phases/change-detector.ts
|
|
68815
68881
|
import { execSync as execSync9 } from "node:child_process";
|
|
68816
68882
|
import { existsSync as existsSync73, readFileSync as readFileSync16, readdirSync as readdirSync11, statSync as statSync12 } from "node:fs";
|
|
68817
|
-
import { join as
|
|
68883
|
+
import { join as join135 } from "node:path";
|
|
68818
68884
|
function detectCommits(repo, since) {
|
|
68819
68885
|
try {
|
|
68820
68886
|
const fetchUrl = sshToHttps(repo.remoteUrl);
|
|
@@ -68912,7 +68978,7 @@ function detectTags(repo, since) {
|
|
|
68912
68978
|
}
|
|
68913
68979
|
}
|
|
68914
68980
|
function detectCompletedPlans(repo, since) {
|
|
68915
|
-
const plansDir =
|
|
68981
|
+
const plansDir = join135(repo.path, "plans");
|
|
68916
68982
|
if (!existsSync73(plansDir))
|
|
68917
68983
|
return [];
|
|
68918
68984
|
const sinceMs = new Date(since).getTime();
|
|
@@ -68922,7 +68988,7 @@ function detectCompletedPlans(repo, since) {
|
|
|
68922
68988
|
for (const entry of entries) {
|
|
68923
68989
|
if (!entry.isDirectory())
|
|
68924
68990
|
continue;
|
|
68925
|
-
const planFile =
|
|
68991
|
+
const planFile = join135(plansDir, entry.name, "plan.md");
|
|
68926
68992
|
if (!existsSync73(planFile))
|
|
68927
68993
|
continue;
|
|
68928
68994
|
try {
|
|
@@ -69000,7 +69066,7 @@ function classifyCommit(event) {
|
|
|
69000
69066
|
// src/commands/content/phases/repo-discoverer.ts
|
|
69001
69067
|
import { execSync as execSync10 } from "node:child_process";
|
|
69002
69068
|
import { readdirSync as readdirSync12 } from "node:fs";
|
|
69003
|
-
import { join as
|
|
69069
|
+
import { join as join136 } from "node:path";
|
|
69004
69070
|
function discoverRepos2(cwd2) {
|
|
69005
69071
|
const repos = [];
|
|
69006
69072
|
if (isGitRepoRoot(cwd2)) {
|
|
@@ -69013,7 +69079,7 @@ function discoverRepos2(cwd2) {
|
|
|
69013
69079
|
for (const entry of entries) {
|
|
69014
69080
|
if (!entry.isDirectory() || entry.name.startsWith("."))
|
|
69015
69081
|
continue;
|
|
69016
|
-
const dirPath =
|
|
69082
|
+
const dirPath = join136(cwd2, entry.name);
|
|
69017
69083
|
if (isGitRepoRoot(dirPath)) {
|
|
69018
69084
|
const info = getRepoInfo(dirPath);
|
|
69019
69085
|
if (info)
|
|
@@ -69680,9 +69746,9 @@ var init_types6 = __esm(() => {
|
|
|
69680
69746
|
|
|
69681
69747
|
// src/commands/content/phases/state-manager.ts
|
|
69682
69748
|
import { readFile as readFile55, rename as rename10, writeFile as writeFile36 } from "node:fs/promises";
|
|
69683
|
-
import { join as
|
|
69749
|
+
import { join as join137 } from "node:path";
|
|
69684
69750
|
async function loadContentConfig(projectDir) {
|
|
69685
|
-
const configPath =
|
|
69751
|
+
const configPath = join137(projectDir, CK_CONFIG_FILE2);
|
|
69686
69752
|
try {
|
|
69687
69753
|
const raw2 = await readFile55(configPath, "utf-8");
|
|
69688
69754
|
const json = JSON.parse(raw2);
|
|
@@ -69692,13 +69758,13 @@ async function loadContentConfig(projectDir) {
|
|
|
69692
69758
|
}
|
|
69693
69759
|
}
|
|
69694
69760
|
async function saveContentConfig(projectDir, config) {
|
|
69695
|
-
const configPath =
|
|
69761
|
+
const configPath = join137(projectDir, CK_CONFIG_FILE2);
|
|
69696
69762
|
const json = await readJsonSafe(configPath);
|
|
69697
69763
|
json.content = { ...json.content, ...config };
|
|
69698
69764
|
await atomicWrite(configPath, json);
|
|
69699
69765
|
}
|
|
69700
69766
|
async function loadContentState(projectDir) {
|
|
69701
|
-
const configPath =
|
|
69767
|
+
const configPath = join137(projectDir, CK_CONFIG_FILE2);
|
|
69702
69768
|
try {
|
|
69703
69769
|
const raw2 = await readFile55(configPath, "utf-8");
|
|
69704
69770
|
const json = JSON.parse(raw2);
|
|
@@ -69709,7 +69775,7 @@ async function loadContentState(projectDir) {
|
|
|
69709
69775
|
}
|
|
69710
69776
|
}
|
|
69711
69777
|
async function saveContentState(projectDir, state) {
|
|
69712
|
-
const configPath =
|
|
69778
|
+
const configPath = join137(projectDir, CK_CONFIG_FILE2);
|
|
69713
69779
|
const sevenDaysAgo = new Date(Date.now() - 7 * 24 * 60 * 60 * 1000).toISOString().slice(0, 10);
|
|
69714
69780
|
for (const key of Object.keys(state.dailyPostCounts)) {
|
|
69715
69781
|
const dateStr = key.slice(-10);
|
|
@@ -69991,7 +70057,7 @@ var init_platform_setup_x = __esm(() => {
|
|
|
69991
70057
|
|
|
69992
70058
|
// src/commands/content/phases/setup-wizard.ts
|
|
69993
70059
|
import { existsSync as existsSync74 } from "node:fs";
|
|
69994
|
-
import { join as
|
|
70060
|
+
import { join as join138 } from "node:path";
|
|
69995
70061
|
async function runSetupWizard2(cwd2, contentLogger) {
|
|
69996
70062
|
console.log();
|
|
69997
70063
|
oe(import_picocolors41.default.bgCyan(import_picocolors41.default.white(" CK Content — Multi-Channel Content Engine ")));
|
|
@@ -70059,8 +70125,8 @@ async function showRepoSummary(cwd2) {
|
|
|
70059
70125
|
function detectBrandAssets(cwd2, contentLogger) {
|
|
70060
70126
|
const repos = discoverRepos2(cwd2);
|
|
70061
70127
|
for (const repo of repos) {
|
|
70062
|
-
const hasGuidelines = existsSync74(
|
|
70063
|
-
const hasStyles = existsSync74(
|
|
70128
|
+
const hasGuidelines = existsSync74(join138(repo.path, "docs", "brand-guidelines.md"));
|
|
70129
|
+
const hasStyles = existsSync74(join138(repo.path, "assets", "writing-styles"));
|
|
70064
70130
|
if (!hasGuidelines) {
|
|
70065
70131
|
f2.warning(`${repo.name}: No docs/brand-guidelines.md — content will use generic tone.`);
|
|
70066
70132
|
contentLogger.warn(`${repo.name}: missing docs/brand-guidelines.md`);
|
|
@@ -70127,11 +70193,11 @@ var init_setup_wizard = __esm(() => {
|
|
|
70127
70193
|
|
|
70128
70194
|
// src/commands/content/content-review-commands.ts
|
|
70129
70195
|
import { existsSync as existsSync75 } from "node:fs";
|
|
70130
|
-
import { homedir as
|
|
70196
|
+
import { homedir as homedir37 } from "node:os";
|
|
70131
70197
|
async function queueContent() {
|
|
70132
70198
|
const cwd2 = process.cwd();
|
|
70133
70199
|
const config = await loadContentConfig(cwd2);
|
|
70134
|
-
const dbPath = config.dbPath.replace(/^~/,
|
|
70200
|
+
const dbPath = config.dbPath.replace(/^~/, homedir37());
|
|
70135
70201
|
if (!existsSync75(dbPath)) {
|
|
70136
70202
|
logger.info("No content database found. Run 'ck content setup' first.");
|
|
70137
70203
|
return;
|
|
@@ -70158,7 +70224,7 @@ async function queueContent() {
|
|
|
70158
70224
|
async function approveContentCmd(id) {
|
|
70159
70225
|
const cwd2 = process.cwd();
|
|
70160
70226
|
const config = await loadContentConfig(cwd2);
|
|
70161
|
-
const dbPath = config.dbPath.replace(/^~/,
|
|
70227
|
+
const dbPath = config.dbPath.replace(/^~/, homedir37());
|
|
70162
70228
|
const db = initDatabase(dbPath);
|
|
70163
70229
|
try {
|
|
70164
70230
|
approveContent(db, Number.parseInt(id, 10));
|
|
@@ -70170,7 +70236,7 @@ async function approveContentCmd(id) {
|
|
|
70170
70236
|
async function rejectContentCmd(id, reason) {
|
|
70171
70237
|
const cwd2 = process.cwd();
|
|
70172
70238
|
const config = await loadContentConfig(cwd2);
|
|
70173
|
-
const dbPath = config.dbPath.replace(/^~/,
|
|
70239
|
+
const dbPath = config.dbPath.replace(/^~/, homedir37());
|
|
70174
70240
|
const db = initDatabase(dbPath);
|
|
70175
70241
|
try {
|
|
70176
70242
|
rejectContent(db, Number.parseInt(id, 10), reason);
|
|
@@ -70201,10 +70267,10 @@ __export(exports_content_subcommands, {
|
|
|
70201
70267
|
approveContentCmd: () => approveContentCmd
|
|
70202
70268
|
});
|
|
70203
70269
|
import { existsSync as existsSync76, readFileSync as readFileSync17, unlinkSync as unlinkSync5 } from "node:fs";
|
|
70204
|
-
import { homedir as
|
|
70205
|
-
import { join as
|
|
70270
|
+
import { homedir as homedir38 } from "node:os";
|
|
70271
|
+
import { join as join139 } from "node:path";
|
|
70206
70272
|
function isDaemonRunning() {
|
|
70207
|
-
const lockFile =
|
|
70273
|
+
const lockFile = join139(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
70208
70274
|
if (!existsSync76(lockFile))
|
|
70209
70275
|
return { running: false, pid: null };
|
|
70210
70276
|
try {
|
|
@@ -70236,7 +70302,7 @@ async function startContent(options2) {
|
|
|
70236
70302
|
await contentCommand(options2);
|
|
70237
70303
|
}
|
|
70238
70304
|
async function stopContent() {
|
|
70239
|
-
const lockFile =
|
|
70305
|
+
const lockFile = join139(LOCK_DIR, `${LOCK_NAME2}.lock`);
|
|
70240
70306
|
if (!existsSync76(lockFile)) {
|
|
70241
70307
|
logger.info("Content daemon is not running.");
|
|
70242
70308
|
return;
|
|
@@ -70275,9 +70341,9 @@ async function statusContent() {
|
|
|
70275
70341
|
} catch {}
|
|
70276
70342
|
}
|
|
70277
70343
|
async function logsContent(options2) {
|
|
70278
|
-
const logDir =
|
|
70344
|
+
const logDir = join139(homedir38(), ".claudekit", "logs");
|
|
70279
70345
|
const dateStr = new Date().toISOString().slice(0, 10).replace(/-/g, "");
|
|
70280
|
-
const logPath =
|
|
70346
|
+
const logPath = join139(logDir, `content-${dateStr}.log`);
|
|
70281
70347
|
if (!existsSync76(logPath)) {
|
|
70282
70348
|
logger.info("No content logs found for today.");
|
|
70283
70349
|
return;
|
|
@@ -70309,13 +70375,13 @@ var init_content_subcommands = __esm(() => {
|
|
|
70309
70375
|
init_setup_wizard();
|
|
70310
70376
|
init_state_manager();
|
|
70311
70377
|
init_content_review_commands();
|
|
70312
|
-
LOCK_DIR =
|
|
70378
|
+
LOCK_DIR = join139(homedir38(), ".claudekit", "locks");
|
|
70313
70379
|
});
|
|
70314
70380
|
|
|
70315
70381
|
// src/commands/content/content-command.ts
|
|
70316
70382
|
import { existsSync as existsSync77, mkdirSync as mkdirSync8, unlinkSync as unlinkSync6, writeFileSync as writeFileSync6 } from "node:fs";
|
|
70317
|
-
import { homedir as
|
|
70318
|
-
import { join as
|
|
70383
|
+
import { homedir as homedir39 } from "node:os";
|
|
70384
|
+
import { join as join140 } from "node:path";
|
|
70319
70385
|
async function contentCommand(options2) {
|
|
70320
70386
|
const cwd2 = process.cwd();
|
|
70321
70387
|
const contentLogger = new ContentLogger;
|
|
@@ -70347,7 +70413,7 @@ async function contentCommand(options2) {
|
|
|
70347
70413
|
if (!existsSync77(LOCK_DIR2))
|
|
70348
70414
|
mkdirSync8(LOCK_DIR2, { recursive: true });
|
|
70349
70415
|
writeFileSync6(LOCK_FILE, String(process.pid), "utf-8");
|
|
70350
|
-
const dbPath = config.dbPath.replace(/^~/,
|
|
70416
|
+
const dbPath = config.dbPath.replace(/^~/, homedir39());
|
|
70351
70417
|
const db = initDatabase(dbPath);
|
|
70352
70418
|
contentLogger.info(`Database initialised at ${dbPath}`);
|
|
70353
70419
|
const adapters = initializeAdapters(config);
|
|
@@ -70493,8 +70559,8 @@ var init_content_command = __esm(() => {
|
|
|
70493
70559
|
init_publisher();
|
|
70494
70560
|
init_review_manager();
|
|
70495
70561
|
init_state_manager();
|
|
70496
|
-
LOCK_DIR2 =
|
|
70497
|
-
LOCK_FILE =
|
|
70562
|
+
LOCK_DIR2 = join140(homedir39(), ".claudekit", "locks");
|
|
70563
|
+
LOCK_FILE = join140(LOCK_DIR2, "ck-content.lock");
|
|
70498
70564
|
});
|
|
70499
70565
|
|
|
70500
70566
|
// src/commands/content/index.ts
|
|
@@ -76448,14 +76514,14 @@ async function checkCliInstallMethod() {
|
|
|
76448
76514
|
}
|
|
76449
76515
|
// src/domains/health-checks/checkers/claude-md-checker.ts
|
|
76450
76516
|
import { existsSync as existsSync42, statSync as statSync5 } from "node:fs";
|
|
76451
|
-
import { join as
|
|
76517
|
+
import { join as join51 } from "node:path";
|
|
76452
76518
|
function checkClaudeMd(setup, projectDir) {
|
|
76453
76519
|
const results = [];
|
|
76454
76520
|
if (setup.global.path) {
|
|
76455
|
-
const globalClaudeMd =
|
|
76521
|
+
const globalClaudeMd = join51(setup.global.path, "CLAUDE.md");
|
|
76456
76522
|
results.push(checkClaudeMdFile(globalClaudeMd, "Global CLAUDE.md", "ck-global-claude-md"));
|
|
76457
76523
|
}
|
|
76458
|
-
const projectClaudeMd =
|
|
76524
|
+
const projectClaudeMd = join51(projectDir, ".claude", "CLAUDE.md");
|
|
76459
76525
|
results.push(checkClaudeMdFile(projectClaudeMd, "Project CLAUDE.md", "ck-project-claude-md"));
|
|
76460
76526
|
return results;
|
|
76461
76527
|
}
|
|
@@ -76514,9 +76580,9 @@ function checkClaudeMdFile(path4, name, id) {
|
|
|
76514
76580
|
}
|
|
76515
76581
|
// src/domains/health-checks/checkers/active-plan-checker.ts
|
|
76516
76582
|
import { existsSync as existsSync43, readFileSync as readFileSync10 } from "node:fs";
|
|
76517
|
-
import { join as
|
|
76583
|
+
import { join as join52 } from "node:path";
|
|
76518
76584
|
function checkActivePlan(projectDir) {
|
|
76519
|
-
const activePlanPath =
|
|
76585
|
+
const activePlanPath = join52(projectDir, ".claude", "active-plan");
|
|
76520
76586
|
if (!existsSync43(activePlanPath)) {
|
|
76521
76587
|
return {
|
|
76522
76588
|
id: "ck-active-plan",
|
|
@@ -76530,7 +76596,7 @@ function checkActivePlan(projectDir) {
|
|
|
76530
76596
|
}
|
|
76531
76597
|
try {
|
|
76532
76598
|
const targetPath = readFileSync10(activePlanPath, "utf-8").trim();
|
|
76533
|
-
const fullPath =
|
|
76599
|
+
const fullPath = join52(projectDir, targetPath);
|
|
76534
76600
|
if (!existsSync43(fullPath)) {
|
|
76535
76601
|
return {
|
|
76536
76602
|
id: "ck-active-plan",
|
|
@@ -76568,13 +76634,13 @@ function checkActivePlan(projectDir) {
|
|
|
76568
76634
|
}
|
|
76569
76635
|
// src/domains/health-checks/checkers/skills-checker.ts
|
|
76570
76636
|
import { existsSync as existsSync44 } from "node:fs";
|
|
76571
|
-
import { join as
|
|
76637
|
+
import { join as join53 } from "node:path";
|
|
76572
76638
|
function checkSkillsScripts(setup) {
|
|
76573
76639
|
const results = [];
|
|
76574
76640
|
const platform5 = process.platform;
|
|
76575
76641
|
const scriptName = platform5 === "win32" ? "install.ps1" : "install.sh";
|
|
76576
76642
|
if (setup.global.path) {
|
|
76577
|
-
const globalScriptPath =
|
|
76643
|
+
const globalScriptPath = join53(setup.global.path, "skills", scriptName);
|
|
76578
76644
|
const hasGlobalScript = existsSync44(globalScriptPath);
|
|
76579
76645
|
results.push({
|
|
76580
76646
|
id: "ck-global-skills-script",
|
|
@@ -76589,7 +76655,7 @@ function checkSkillsScripts(setup) {
|
|
|
76589
76655
|
});
|
|
76590
76656
|
}
|
|
76591
76657
|
if (setup.project.metadata) {
|
|
76592
|
-
const projectScriptPath =
|
|
76658
|
+
const projectScriptPath = join53(setup.project.path, "skills", scriptName);
|
|
76593
76659
|
const hasProjectScript = existsSync44(projectScriptPath);
|
|
76594
76660
|
results.push({
|
|
76595
76661
|
id: "ck-project-skills-script",
|
|
@@ -76628,7 +76694,7 @@ function checkComponentCounts(setup) {
|
|
|
76628
76694
|
init_logger();
|
|
76629
76695
|
init_path_resolver();
|
|
76630
76696
|
import { constants as constants2, access as access2, unlink as unlink7, writeFile as writeFile16 } from "node:fs/promises";
|
|
76631
|
-
import { join as
|
|
76697
|
+
import { join as join54 } from "node:path";
|
|
76632
76698
|
|
|
76633
76699
|
// src/domains/health-checks/checkers/shared.ts
|
|
76634
76700
|
init_environment();
|
|
@@ -76694,7 +76760,7 @@ async function checkGlobalDirWritable() {
|
|
|
76694
76760
|
}
|
|
76695
76761
|
const timestamp = Date.now();
|
|
76696
76762
|
const random = Math.random().toString(36).substring(2);
|
|
76697
|
-
const testFile =
|
|
76763
|
+
const testFile = join54(globalDir, `.ck-write-test-${timestamp}-${random}`);
|
|
76698
76764
|
try {
|
|
76699
76765
|
await writeFile16(testFile, "test", { encoding: "utf-8", flag: "wx" });
|
|
76700
76766
|
} catch (error) {
|
|
@@ -76730,7 +76796,7 @@ async function checkGlobalDirWritable() {
|
|
|
76730
76796
|
init_path_resolver();
|
|
76731
76797
|
import { existsSync as existsSync45 } from "node:fs";
|
|
76732
76798
|
import { readdir as readdir10 } from "node:fs/promises";
|
|
76733
|
-
import { join as
|
|
76799
|
+
import { join as join55 } from "node:path";
|
|
76734
76800
|
|
|
76735
76801
|
// src/domains/health-checks/utils/path-normalizer.ts
|
|
76736
76802
|
import { normalize as normalize4 } from "node:path";
|
|
@@ -76742,8 +76808,8 @@ function normalizePath2(filePath) {
|
|
|
76742
76808
|
|
|
76743
76809
|
// src/domains/health-checks/checkers/hooks-checker.ts
|
|
76744
76810
|
async function checkHooksExist(projectDir) {
|
|
76745
|
-
const globalHooksDir =
|
|
76746
|
-
const projectHooksDir =
|
|
76811
|
+
const globalHooksDir = join55(PathResolver.getGlobalKitDir(), "hooks");
|
|
76812
|
+
const projectHooksDir = join55(projectDir, ".claude", "hooks");
|
|
76747
76813
|
const globalExists = existsSync45(globalHooksDir);
|
|
76748
76814
|
const projectExists = existsSync45(projectHooksDir);
|
|
76749
76815
|
let hookCount = 0;
|
|
@@ -76752,7 +76818,7 @@ async function checkHooksExist(projectDir) {
|
|
|
76752
76818
|
const files = await readdir10(globalHooksDir, { withFileTypes: false });
|
|
76753
76819
|
const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((ext) => f3.endsWith(ext)));
|
|
76754
76820
|
hooks.forEach((hook) => {
|
|
76755
|
-
const fullPath =
|
|
76821
|
+
const fullPath = join55(globalHooksDir, hook);
|
|
76756
76822
|
checkedFiles.add(normalizePath2(fullPath));
|
|
76757
76823
|
});
|
|
76758
76824
|
}
|
|
@@ -76762,7 +76828,7 @@ async function checkHooksExist(projectDir) {
|
|
|
76762
76828
|
const files = await readdir10(projectHooksDir, { withFileTypes: false });
|
|
76763
76829
|
const hooks = files.filter((f3) => HOOK_EXTENSIONS2.some((ext) => f3.endsWith(ext)));
|
|
76764
76830
|
hooks.forEach((hook) => {
|
|
76765
|
-
const fullPath =
|
|
76831
|
+
const fullPath = join55(projectHooksDir, hook);
|
|
76766
76832
|
checkedFiles.add(normalizePath2(fullPath));
|
|
76767
76833
|
});
|
|
76768
76834
|
}
|
|
@@ -76794,10 +76860,10 @@ init_logger();
|
|
|
76794
76860
|
init_path_resolver();
|
|
76795
76861
|
import { existsSync as existsSync46 } from "node:fs";
|
|
76796
76862
|
import { readFile as readFile30 } from "node:fs/promises";
|
|
76797
|
-
import { join as
|
|
76863
|
+
import { join as join56 } from "node:path";
|
|
76798
76864
|
async function checkSettingsValid(projectDir) {
|
|
76799
|
-
const globalSettings =
|
|
76800
|
-
const projectSettings =
|
|
76865
|
+
const globalSettings = join56(PathResolver.getGlobalKitDir(), "settings.json");
|
|
76866
|
+
const projectSettings = join56(projectDir, ".claude", "settings.json");
|
|
76801
76867
|
const settingsPath = existsSync46(globalSettings) ? globalSettings : existsSync46(projectSettings) ? projectSettings : null;
|
|
76802
76868
|
if (!settingsPath) {
|
|
76803
76869
|
return {
|
|
@@ -76869,11 +76935,11 @@ init_logger();
|
|
|
76869
76935
|
init_path_resolver();
|
|
76870
76936
|
import { existsSync as existsSync47 } from "node:fs";
|
|
76871
76937
|
import { readFile as readFile31 } from "node:fs/promises";
|
|
76872
|
-
import { homedir as
|
|
76873
|
-
import { dirname as dirname19, join as
|
|
76938
|
+
import { homedir as homedir28 } from "node:os";
|
|
76939
|
+
import { dirname as dirname19, join as join57, normalize as normalize5, resolve as resolve14 } from "node:path";
|
|
76874
76940
|
async function checkPathRefsValid(projectDir) {
|
|
76875
|
-
const globalClaudeMd =
|
|
76876
|
-
const projectClaudeMd =
|
|
76941
|
+
const globalClaudeMd = join57(PathResolver.getGlobalKitDir(), "CLAUDE.md");
|
|
76942
|
+
const projectClaudeMd = join57(projectDir, ".claude", "CLAUDE.md");
|
|
76877
76943
|
const claudeMdPath = existsSync47(globalClaudeMd) ? globalClaudeMd : existsSync47(projectClaudeMd) ? projectClaudeMd : null;
|
|
76878
76944
|
if (!claudeMdPath) {
|
|
76879
76945
|
return {
|
|
@@ -76902,7 +76968,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
76902
76968
|
};
|
|
76903
76969
|
}
|
|
76904
76970
|
const baseDir = dirname19(claudeMdPath);
|
|
76905
|
-
const home8 =
|
|
76971
|
+
const home8 = homedir28();
|
|
76906
76972
|
const broken = [];
|
|
76907
76973
|
for (const ref of refs) {
|
|
76908
76974
|
let refPath;
|
|
@@ -76968,7 +77034,7 @@ async function checkPathRefsValid(projectDir) {
|
|
|
76968
77034
|
// src/domains/health-checks/checkers/config-completeness-checker.ts
|
|
76969
77035
|
import { existsSync as existsSync48 } from "node:fs";
|
|
76970
77036
|
import { readdir as readdir11 } from "node:fs/promises";
|
|
76971
|
-
import { join as
|
|
77037
|
+
import { join as join58 } from "node:path";
|
|
76972
77038
|
async function checkProjectConfigCompleteness(setup, projectDir) {
|
|
76973
77039
|
if (setup.project.path === setup.global.path) {
|
|
76974
77040
|
return {
|
|
@@ -76981,16 +77047,16 @@ async function checkProjectConfigCompleteness(setup, projectDir) {
|
|
|
76981
77047
|
autoFixable: false
|
|
76982
77048
|
};
|
|
76983
77049
|
}
|
|
76984
|
-
const projectClaudeDir =
|
|
77050
|
+
const projectClaudeDir = join58(projectDir, ".claude");
|
|
76985
77051
|
const requiredDirs = ["agents", "commands", "skills"];
|
|
76986
77052
|
const missingDirs = [];
|
|
76987
77053
|
for (const dir of requiredDirs) {
|
|
76988
|
-
const dirPath =
|
|
77054
|
+
const dirPath = join58(projectClaudeDir, dir);
|
|
76989
77055
|
if (!existsSync48(dirPath)) {
|
|
76990
77056
|
missingDirs.push(dir);
|
|
76991
77057
|
}
|
|
76992
77058
|
}
|
|
76993
|
-
const hasRulesOrWorkflows = existsSync48(
|
|
77059
|
+
const hasRulesOrWorkflows = existsSync48(join58(projectClaudeDir, "rules")) || existsSync48(join58(projectClaudeDir, "workflows"));
|
|
76994
77060
|
if (!hasRulesOrWorkflows) {
|
|
76995
77061
|
missingDirs.push("rules");
|
|
76996
77062
|
}
|
|
@@ -77035,7 +77101,7 @@ async function checkProjectConfigCompleteness(setup, projectDir) {
|
|
|
77035
77101
|
};
|
|
77036
77102
|
}
|
|
77037
77103
|
// src/domains/health-checks/checkers/env-keys-checker.ts
|
|
77038
|
-
import { join as
|
|
77104
|
+
import { join as join60 } from "node:path";
|
|
77039
77105
|
|
|
77040
77106
|
// src/domains/installation/setup-wizard.ts
|
|
77041
77107
|
init_config_generator();
|
|
@@ -77044,7 +77110,7 @@ init_logger();
|
|
|
77044
77110
|
init_path_resolver();
|
|
77045
77111
|
init_dist2();
|
|
77046
77112
|
var import_fs_extra6 = __toESM(require_lib3(), 1);
|
|
77047
|
-
import { join as
|
|
77113
|
+
import { join as join59 } from "node:path";
|
|
77048
77114
|
var REQUIRED_ENV_KEYS = [
|
|
77049
77115
|
{ key: "GEMINI_API_KEY", label: "Gemini API Key" }
|
|
77050
77116
|
];
|
|
@@ -77121,7 +77187,7 @@ async function parseEnvFile(path4) {
|
|
|
77121
77187
|
}
|
|
77122
77188
|
}
|
|
77123
77189
|
async function checkGlobalConfig() {
|
|
77124
|
-
const globalEnvPath =
|
|
77190
|
+
const globalEnvPath = join59(PathResolver.getGlobalKitDir(), ".env");
|
|
77125
77191
|
if (!await import_fs_extra6.pathExists(globalEnvPath))
|
|
77126
77192
|
return false;
|
|
77127
77193
|
const env2 = await parseEnvFile(globalEnvPath);
|
|
@@ -77137,7 +77203,7 @@ async function runSetupWizard(options2) {
|
|
|
77137
77203
|
let globalEnv = {};
|
|
77138
77204
|
const hasGlobalConfig = !isGlobal && await checkGlobalConfig();
|
|
77139
77205
|
if (!isGlobal) {
|
|
77140
|
-
const globalEnvPath =
|
|
77206
|
+
const globalEnvPath = join59(PathResolver.getGlobalKitDir(), ".env");
|
|
77141
77207
|
if (await import_fs_extra6.pathExists(globalEnvPath)) {
|
|
77142
77208
|
globalEnv = await parseEnvFile(globalEnvPath);
|
|
77143
77209
|
}
|
|
@@ -77200,7 +77266,7 @@ async function runSetupWizard(options2) {
|
|
|
77200
77266
|
}
|
|
77201
77267
|
}
|
|
77202
77268
|
await generateEnvFile(targetDir, values);
|
|
77203
|
-
f2.success(`Configuration saved to ${
|
|
77269
|
+
f2.success(`Configuration saved to ${join59(targetDir, ".env")}`);
|
|
77204
77270
|
return true;
|
|
77205
77271
|
}
|
|
77206
77272
|
async function promptForAdditionalGeminiKeys(primaryKey) {
|
|
@@ -77275,7 +77341,7 @@ Optional: DISCORD_WEBHOOK_URL, TELEGRAM_BOT_TOKEN`, "Configuration skipped");
|
|
|
77275
77341
|
async function checkEnvKeys(setup) {
|
|
77276
77342
|
const results = [];
|
|
77277
77343
|
if (setup.global.path) {
|
|
77278
|
-
const globalEnvPath =
|
|
77344
|
+
const globalEnvPath = join60(setup.global.path, ".env");
|
|
77279
77345
|
const globalCheck = await checkRequiredKeysExist(globalEnvPath);
|
|
77280
77346
|
if (!globalCheck.allPresent) {
|
|
77281
77347
|
const missingKeys = globalCheck.missing.map((m2) => m2.label).join(", ");
|
|
@@ -77304,7 +77370,7 @@ async function checkEnvKeys(setup) {
|
|
|
77304
77370
|
}
|
|
77305
77371
|
}
|
|
77306
77372
|
if (setup.project.metadata) {
|
|
77307
|
-
const projectEnvPath =
|
|
77373
|
+
const projectEnvPath = join60(setup.project.path, ".env");
|
|
77308
77374
|
const projectCheck = await checkRequiredKeysExist(projectEnvPath);
|
|
77309
77375
|
if (!projectCheck.allPresent) {
|
|
77310
77376
|
const missingKeys = projectCheck.missing.map((m2) => m2.label).join(", ");
|
|
@@ -77342,7 +77408,7 @@ import { spawnSync as spawnSync2 } from "node:child_process";
|
|
|
77342
77408
|
import { existsSync as existsSync49, readFileSync as readFileSync11, statSync as statSync6, writeFileSync as writeFileSync4 } from "node:fs";
|
|
77343
77409
|
import { readdir as readdir12 } from "node:fs/promises";
|
|
77344
77410
|
import { tmpdir } from "node:os";
|
|
77345
|
-
import { join as
|
|
77411
|
+
import { join as join61, resolve as resolve15 } from "node:path";
|
|
77346
77412
|
var HOOK_CHECK_TIMEOUT_MS = 5000;
|
|
77347
77413
|
var PYTHON_CHECK_TIMEOUT_MS = 3000;
|
|
77348
77414
|
var MAX_LOG_FILE_SIZE_BYTES = 10 * 1024 * 1024;
|
|
@@ -77387,7 +77453,7 @@ async function checkHookSyntax(projectDir) {
|
|
|
77387
77453
|
}
|
|
77388
77454
|
const errors2 = [];
|
|
77389
77455
|
for (const file of cjsFiles) {
|
|
77390
|
-
const filePath =
|
|
77456
|
+
const filePath = join61(hooksDir, file);
|
|
77391
77457
|
if (!isPathWithin(filePath, hooksDir))
|
|
77392
77458
|
continue;
|
|
77393
77459
|
const result = spawnSync2("node", ["--check", filePath], {
|
|
@@ -77473,7 +77539,7 @@ async function checkHookDeps(projectDir) {
|
|
|
77473
77539
|
const missingDeps = [];
|
|
77474
77540
|
const requireRegex = /require\(['"]([^'"]+)['"]\)/g;
|
|
77475
77541
|
for (const file of cjsFiles) {
|
|
77476
|
-
const filePath =
|
|
77542
|
+
const filePath = join61(hooksDir, file);
|
|
77477
77543
|
if (!isPathWithin(filePath, hooksDir))
|
|
77478
77544
|
continue;
|
|
77479
77545
|
const content = readFileSync11(filePath, "utf-8");
|
|
@@ -77483,10 +77549,10 @@ async function checkHookDeps(projectDir) {
|
|
|
77483
77549
|
continue;
|
|
77484
77550
|
}
|
|
77485
77551
|
if (depPath.startsWith(".")) {
|
|
77486
|
-
const resolvedPath =
|
|
77552
|
+
const resolvedPath = join61(hooksDir, depPath);
|
|
77487
77553
|
const extensions = [".js", ".cjs", ".mjs", ".json"];
|
|
77488
77554
|
const indexFiles = ["index.js", "index.cjs", "index.mjs"];
|
|
77489
|
-
const exists = existsSync49(resolvedPath) || extensions.some((ext) => existsSync49(resolvedPath + ext)) || indexFiles.some((idx) => existsSync49(
|
|
77555
|
+
const exists = existsSync49(resolvedPath) || extensions.some((ext) => existsSync49(resolvedPath + ext)) || indexFiles.some((idx) => existsSync49(join61(resolvedPath, idx)));
|
|
77490
77556
|
if (!exists) {
|
|
77491
77557
|
missingDeps.push(`${file}: ${depPath}`);
|
|
77492
77558
|
}
|
|
@@ -77603,11 +77669,11 @@ async function checkHookRuntime(projectDir) {
|
|
|
77603
77669
|
}
|
|
77604
77670
|
const syntheticPayload = JSON.stringify({
|
|
77605
77671
|
tool_name: "Read",
|
|
77606
|
-
tool_input: { file_path:
|
|
77672
|
+
tool_input: { file_path: join61(tmpdir(), "ck-doctor-test.txt") }
|
|
77607
77673
|
});
|
|
77608
77674
|
const failures = [];
|
|
77609
77675
|
for (const file of cjsFiles) {
|
|
77610
|
-
const filePath =
|
|
77676
|
+
const filePath = join61(hooksDir, file);
|
|
77611
77677
|
if (!isPathWithin(filePath, hooksDir))
|
|
77612
77678
|
continue;
|
|
77613
77679
|
const result = spawnSync2("node", [filePath], {
|
|
@@ -77669,8 +77735,8 @@ async function checkHookRuntime(projectDir) {
|
|
|
77669
77735
|
}
|
|
77670
77736
|
}
|
|
77671
77737
|
async function checkHookConfig(projectDir) {
|
|
77672
|
-
const projectConfigPath =
|
|
77673
|
-
const globalConfigPath =
|
|
77738
|
+
const projectConfigPath = join61(projectDir, ".claude", ".ck.json");
|
|
77739
|
+
const globalConfigPath = join61(PathResolver.getGlobalKitDir(), ".ck.json");
|
|
77674
77740
|
const configPath = existsSync49(projectConfigPath) ? projectConfigPath : existsSync49(globalConfigPath) ? globalConfigPath : null;
|
|
77675
77741
|
if (!configPath) {
|
|
77676
77742
|
return {
|
|
@@ -77794,7 +77860,7 @@ async function checkHookLogs(projectDir) {
|
|
|
77794
77860
|
autoFixable: false
|
|
77795
77861
|
};
|
|
77796
77862
|
}
|
|
77797
|
-
const logPath =
|
|
77863
|
+
const logPath = join61(hooksDir, ".logs", "hook-log.jsonl");
|
|
77798
77864
|
if (!existsSync49(logPath)) {
|
|
77799
77865
|
return {
|
|
77800
77866
|
id: "hook-logs",
|
|
@@ -78049,9 +78115,9 @@ async function checkCliVersion() {
|
|
|
78049
78115
|
}
|
|
78050
78116
|
async function checkPythonVenv(projectDir) {
|
|
78051
78117
|
const isWindows3 = process.platform === "win32";
|
|
78052
|
-
const venvBin = isWindows3 ?
|
|
78053
|
-
const projectVenvPath =
|
|
78054
|
-
const globalVenvPath =
|
|
78118
|
+
const venvBin = isWindows3 ? join61("Scripts", "python.exe") : join61("bin", "python3");
|
|
78119
|
+
const projectVenvPath = join61(projectDir, ".claude", "skills", ".venv", venvBin);
|
|
78120
|
+
const globalVenvPath = join61(PathResolver.getGlobalKitDir(), "skills", ".venv", venvBin);
|
|
78055
78121
|
const venvPath = existsSync49(projectVenvPath) ? projectVenvPath : existsSync49(globalVenvPath) ? globalVenvPath : null;
|
|
78056
78122
|
if (!venvPath) {
|
|
78057
78123
|
return {
|
|
@@ -78531,8 +78597,8 @@ import { platform as platform6 } from "node:os";
|
|
|
78531
78597
|
init_environment();
|
|
78532
78598
|
init_path_resolver();
|
|
78533
78599
|
import { constants as constants3, access as access3, mkdir as mkdir14, readFile as readFile33, unlink as unlink8, writeFile as writeFile17 } from "node:fs/promises";
|
|
78534
|
-
import { arch as arch2, homedir as
|
|
78535
|
-
import { join as
|
|
78600
|
+
import { arch as arch2, homedir as homedir29, platform as platform5 } from "node:os";
|
|
78601
|
+
import { join as join63, normalize as normalize6 } from "node:path";
|
|
78536
78602
|
function shouldSkipExpensiveOperations4() {
|
|
78537
78603
|
return shouldSkipExpensiveOperations();
|
|
78538
78604
|
}
|
|
@@ -78554,7 +78620,7 @@ async function checkPlatformDetect() {
|
|
|
78554
78620
|
};
|
|
78555
78621
|
}
|
|
78556
78622
|
async function checkHomeDirResolution() {
|
|
78557
|
-
const nodeHome = normalize6(
|
|
78623
|
+
const nodeHome = normalize6(homedir29());
|
|
78558
78624
|
const rawEnvHome = getHomeDirectoryFromEnv(platform5());
|
|
78559
78625
|
const envHome = rawEnvHome ? normalize6(rawEnvHome) : "";
|
|
78560
78626
|
const match = nodeHome === envHome && envHome !== "";
|
|
@@ -78623,7 +78689,7 @@ async function checkGlobalDirAccess() {
|
|
|
78623
78689
|
autoFixable: false
|
|
78624
78690
|
};
|
|
78625
78691
|
}
|
|
78626
|
-
const testFile =
|
|
78692
|
+
const testFile = join63(globalDir, ".ck-doctor-access-test");
|
|
78627
78693
|
try {
|
|
78628
78694
|
await mkdir14(globalDir, { recursive: true });
|
|
78629
78695
|
await writeFile17(testFile, "test", "utf-8");
|
|
@@ -78701,7 +78767,7 @@ async function checkWSLBoundary() {
|
|
|
78701
78767
|
// src/domains/health-checks/platform/windows-checker.ts
|
|
78702
78768
|
init_path_resolver();
|
|
78703
78769
|
import { mkdir as mkdir15, symlink, unlink as unlink9, writeFile as writeFile18 } from "node:fs/promises";
|
|
78704
|
-
import { join as
|
|
78770
|
+
import { join as join64 } from "node:path";
|
|
78705
78771
|
async function checkLongPathSupport() {
|
|
78706
78772
|
if (shouldSkipExpensiveOperations4()) {
|
|
78707
78773
|
return {
|
|
@@ -78753,8 +78819,8 @@ async function checkSymlinkSupport() {
|
|
|
78753
78819
|
};
|
|
78754
78820
|
}
|
|
78755
78821
|
const testDir = PathResolver.getGlobalKitDir();
|
|
78756
|
-
const target =
|
|
78757
|
-
const link =
|
|
78822
|
+
const target = join64(testDir, ".ck-symlink-test-target");
|
|
78823
|
+
const link = join64(testDir, ".ck-symlink-test-link");
|
|
78758
78824
|
try {
|
|
78759
78825
|
await mkdir15(testDir, { recursive: true });
|
|
78760
78826
|
await writeFile18(target, "test", "utf-8");
|
|
@@ -79048,7 +79114,7 @@ class AutoHealer {
|
|
|
79048
79114
|
import { execSync as execSync3, spawnSync as spawnSync5 } from "node:child_process";
|
|
79049
79115
|
import { readFileSync as readFileSync12, unlinkSync, writeFileSync as writeFileSync5 } from "node:fs";
|
|
79050
79116
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
79051
|
-
import { dirname as dirname20, join as
|
|
79117
|
+
import { dirname as dirname20, join as join65 } from "node:path";
|
|
79052
79118
|
import { fileURLToPath as fileURLToPath4 } from "node:url";
|
|
79053
79119
|
init_environment();
|
|
79054
79120
|
init_logger();
|
|
@@ -79056,7 +79122,7 @@ init_dist2();
|
|
|
79056
79122
|
function getCliVersion4() {
|
|
79057
79123
|
try {
|
|
79058
79124
|
const __dirname4 = dirname20(fileURLToPath4(import.meta.url));
|
|
79059
|
-
const pkgPath =
|
|
79125
|
+
const pkgPath = join65(__dirname4, "../../../package.json");
|
|
79060
79126
|
const pkg = JSON.parse(readFileSync12(pkgPath, "utf-8"));
|
|
79061
79127
|
return pkg.version || "unknown";
|
|
79062
79128
|
} catch (err) {
|
|
@@ -79195,7 +79261,7 @@ class ReportGenerator {
|
|
|
79195
79261
|
return null;
|
|
79196
79262
|
}
|
|
79197
79263
|
}
|
|
79198
|
-
const tmpFile =
|
|
79264
|
+
const tmpFile = join65(tmpdir3(), `ck-report-${Date.now()}.txt`);
|
|
79199
79265
|
writeFileSync5(tmpFile, report);
|
|
79200
79266
|
try {
|
|
79201
79267
|
const result = spawnSync5("gh", ["gist", "create", tmpFile, "--desc", "ClaudeKit Diagnostic Report"], {
|
|
@@ -79521,7 +79587,7 @@ init_logger();
|
|
|
79521
79587
|
init_path_resolver();
|
|
79522
79588
|
var import_compare_versions6 = __toESM(require_umd(), 1);
|
|
79523
79589
|
import { mkdir as mkdir16, readFile as readFile34, unlink as unlink10, writeFile as writeFile19 } from "node:fs/promises";
|
|
79524
|
-
import { join as
|
|
79590
|
+
import { join as join66 } from "node:path";
|
|
79525
79591
|
var CACHE_TTL_HOURS = 24;
|
|
79526
79592
|
var DEFAULT_CACHE_TTL_MS = CACHE_TTL_HOURS * 60 * 60 * 1000;
|
|
79527
79593
|
var MIN_CACHE_TTL_MS = 60 * 1000;
|
|
@@ -79558,7 +79624,7 @@ var KIT_REPOS = {
|
|
|
79558
79624
|
class ConfigVersionChecker {
|
|
79559
79625
|
static getCacheFilePath(kitType, global3) {
|
|
79560
79626
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
79561
|
-
return
|
|
79627
|
+
return join66(cacheDir, `${kitType}-${CACHE_FILENAME}`);
|
|
79562
79628
|
}
|
|
79563
79629
|
static async loadCache(kitType, global3) {
|
|
79564
79630
|
try {
|
|
@@ -79721,7 +79787,7 @@ class ConfigVersionChecker {
|
|
|
79721
79787
|
}
|
|
79722
79788
|
// src/domains/sync/sync-engine.ts
|
|
79723
79789
|
import { lstat as lstat3, readFile as readFile35, readlink, realpath as realpath3, stat as stat9 } from "node:fs/promises";
|
|
79724
|
-
import { isAbsolute as isAbsolute3, join as
|
|
79790
|
+
import { isAbsolute as isAbsolute3, join as join67, normalize as normalize7, relative as relative8 } from "node:path";
|
|
79725
79791
|
|
|
79726
79792
|
// src/services/file-operations/ownership-checker.ts
|
|
79727
79793
|
init_metadata_migration();
|
|
@@ -81082,7 +81148,7 @@ async function validateSymlinkChain(path5, basePath, maxDepth = MAX_SYMLINK_DEPT
|
|
|
81082
81148
|
if (!stats.isSymbolicLink())
|
|
81083
81149
|
break;
|
|
81084
81150
|
const target = await readlink(current);
|
|
81085
|
-
const resolvedTarget = isAbsolute3(target) ? target :
|
|
81151
|
+
const resolvedTarget = isAbsolute3(target) ? target : join67(current, "..", target);
|
|
81086
81152
|
const normalizedTarget = normalize7(resolvedTarget);
|
|
81087
81153
|
const rel = relative8(basePath, normalizedTarget);
|
|
81088
81154
|
if (rel.startsWith("..") || isAbsolute3(rel)) {
|
|
@@ -81118,7 +81184,7 @@ async function validateSyncPath(basePath, filePath) {
|
|
|
81118
81184
|
if (normalized.startsWith("..") || normalized.includes("/../")) {
|
|
81119
81185
|
throw new Error(`Path traversal not allowed: ${filePath}`);
|
|
81120
81186
|
}
|
|
81121
|
-
const fullPath =
|
|
81187
|
+
const fullPath = join67(basePath, normalized);
|
|
81122
81188
|
const rel = relative8(basePath, fullPath);
|
|
81123
81189
|
if (rel.startsWith("..") || isAbsolute3(rel)) {
|
|
81124
81190
|
throw new Error(`Path escapes base directory: ${filePath}`);
|
|
@@ -81133,7 +81199,7 @@ async function validateSyncPath(basePath, filePath) {
|
|
|
81133
81199
|
}
|
|
81134
81200
|
} catch (error) {
|
|
81135
81201
|
if (error.code === "ENOENT") {
|
|
81136
|
-
const parentPath =
|
|
81202
|
+
const parentPath = join67(fullPath, "..");
|
|
81137
81203
|
try {
|
|
81138
81204
|
const resolvedBase = await realpath3(basePath);
|
|
81139
81205
|
const resolvedParent = await realpath3(parentPath);
|
|
@@ -82315,7 +82381,7 @@ init_logger();
|
|
|
82315
82381
|
var import_proper_lockfile4 = __toESM(require_proper_lockfile(), 1);
|
|
82316
82382
|
import { mkdir as mkdir19 } from "node:fs/promises";
|
|
82317
82383
|
import os5 from "node:os";
|
|
82318
|
-
import { join as
|
|
82384
|
+
import { join as join74 } from "node:path";
|
|
82319
82385
|
var LOCK_CONFIG = {
|
|
82320
82386
|
stale: 60000,
|
|
82321
82387
|
retries: 0
|
|
@@ -82323,12 +82389,12 @@ var LOCK_CONFIG = {
|
|
|
82323
82389
|
var activeLocks = new Set;
|
|
82324
82390
|
var cleanupRegistered = false;
|
|
82325
82391
|
function getLocksDir() {
|
|
82326
|
-
return
|
|
82392
|
+
return join74(os5.homedir(), ".claudekit", "locks");
|
|
82327
82393
|
}
|
|
82328
82394
|
function cleanupLocks() {
|
|
82329
82395
|
for (const name of activeLocks) {
|
|
82330
82396
|
try {
|
|
82331
|
-
const lockPath =
|
|
82397
|
+
const lockPath = join74(getLocksDir(), `${name}.lock`);
|
|
82332
82398
|
import_proper_lockfile4.default.unlockSync(lockPath, { realpath: false });
|
|
82333
82399
|
} catch {
|
|
82334
82400
|
try {
|
|
@@ -82351,7 +82417,7 @@ async function ensureLocksDir() {
|
|
|
82351
82417
|
async function withProcessLock(lockName, fn) {
|
|
82352
82418
|
registerCleanupHandlers();
|
|
82353
82419
|
await ensureLocksDir();
|
|
82354
|
-
const lockPath =
|
|
82420
|
+
const lockPath = join74(getLocksDir(), `${lockName}.lock`);
|
|
82355
82421
|
let release;
|
|
82356
82422
|
try {
|
|
82357
82423
|
release = await import_proper_lockfile4.default.lock(lockPath, { ...LOCK_CONFIG, realpath: false });
|
|
@@ -82383,7 +82449,7 @@ init_logger();
|
|
|
82383
82449
|
init_logger();
|
|
82384
82450
|
init_path_resolver();
|
|
82385
82451
|
var import_fs_extra7 = __toESM(require_lib3(), 1);
|
|
82386
|
-
import { join as
|
|
82452
|
+
import { join as join75 } from "node:path";
|
|
82387
82453
|
async function handleConflicts(ctx) {
|
|
82388
82454
|
if (ctx.cancelled)
|
|
82389
82455
|
return ctx;
|
|
@@ -82392,7 +82458,7 @@ async function handleConflicts(ctx) {
|
|
|
82392
82458
|
if (PathResolver.isLocalSameAsGlobal()) {
|
|
82393
82459
|
return ctx;
|
|
82394
82460
|
}
|
|
82395
|
-
const localSettingsPath =
|
|
82461
|
+
const localSettingsPath = join75(process.cwd(), ".claude", "settings.json");
|
|
82396
82462
|
if (!await import_fs_extra7.pathExists(localSettingsPath)) {
|
|
82397
82463
|
return ctx;
|
|
82398
82464
|
}
|
|
@@ -82407,7 +82473,7 @@ async function handleConflicts(ctx) {
|
|
|
82407
82473
|
return { ...ctx, cancelled: true };
|
|
82408
82474
|
}
|
|
82409
82475
|
if (choice === "remove") {
|
|
82410
|
-
const localClaudeDir =
|
|
82476
|
+
const localClaudeDir = join75(process.cwd(), ".claude");
|
|
82411
82477
|
try {
|
|
82412
82478
|
await import_fs_extra7.remove(localClaudeDir);
|
|
82413
82479
|
logger.success("Removed local .claude/ directory");
|
|
@@ -82504,7 +82570,7 @@ init_logger();
|
|
|
82504
82570
|
init_safe_spinner();
|
|
82505
82571
|
import { mkdir as mkdir25, stat as stat12 } from "node:fs/promises";
|
|
82506
82572
|
import { tmpdir as tmpdir4 } from "node:os";
|
|
82507
|
-
import { join as
|
|
82573
|
+
import { join as join82 } from "node:path";
|
|
82508
82574
|
|
|
82509
82575
|
// src/shared/temp-cleanup.ts
|
|
82510
82576
|
init_logger();
|
|
@@ -82523,7 +82589,7 @@ init_logger();
|
|
|
82523
82589
|
init_output_manager();
|
|
82524
82590
|
import { createWriteStream as createWriteStream2, rmSync as rmSync2 } from "node:fs";
|
|
82525
82591
|
import { mkdir as mkdir20 } from "node:fs/promises";
|
|
82526
|
-
import { join as
|
|
82592
|
+
import { join as join76 } from "node:path";
|
|
82527
82593
|
|
|
82528
82594
|
// src/shared/progress-bar.ts
|
|
82529
82595
|
init_output_manager();
|
|
@@ -82733,7 +82799,7 @@ var MAX_DOWNLOAD_SIZE = 500 * 1024 * 1024;
|
|
|
82733
82799
|
class FileDownloader {
|
|
82734
82800
|
async downloadAsset(asset, destDir) {
|
|
82735
82801
|
try {
|
|
82736
|
-
const destPath =
|
|
82802
|
+
const destPath = join76(destDir, asset.name);
|
|
82737
82803
|
await mkdir20(destDir, { recursive: true });
|
|
82738
82804
|
output.info(`Downloading ${asset.name} (${formatBytes(asset.size)})...`);
|
|
82739
82805
|
logger.verbose("Download details", {
|
|
@@ -82818,7 +82884,7 @@ class FileDownloader {
|
|
|
82818
82884
|
}
|
|
82819
82885
|
async downloadFile(params) {
|
|
82820
82886
|
const { url, name, size, destDir, token } = params;
|
|
82821
|
-
const destPath =
|
|
82887
|
+
const destPath = join76(destDir, name);
|
|
82822
82888
|
await mkdir20(destDir, { recursive: true });
|
|
82823
82889
|
output.info(`Downloading ${name}${size ? ` (${formatBytes(size)})` : ""}...`);
|
|
82824
82890
|
const headers = {};
|
|
@@ -82904,7 +82970,7 @@ init_logger();
|
|
|
82904
82970
|
init_types3();
|
|
82905
82971
|
import { constants as constants4 } from "node:fs";
|
|
82906
82972
|
import { access as access4, readdir as readdir13 } from "node:fs/promises";
|
|
82907
|
-
import { join as
|
|
82973
|
+
import { join as join77 } from "node:path";
|
|
82908
82974
|
async function validateExtraction(extractDir) {
|
|
82909
82975
|
try {
|
|
82910
82976
|
const entries = await readdir13(extractDir, { encoding: "utf8" });
|
|
@@ -82916,7 +82982,7 @@ async function validateExtraction(extractDir) {
|
|
|
82916
82982
|
const missingPaths = [];
|
|
82917
82983
|
for (const path5 of criticalPaths) {
|
|
82918
82984
|
try {
|
|
82919
|
-
await access4(
|
|
82985
|
+
await access4(join77(extractDir, path5), constants4.F_OK);
|
|
82920
82986
|
logger.debug(`Found: ${path5}`);
|
|
82921
82987
|
} catch {
|
|
82922
82988
|
logger.warning(`Expected path not found: ${path5}`);
|
|
@@ -82937,8 +83003,8 @@ async function validateExtraction(extractDir) {
|
|
|
82937
83003
|
|
|
82938
83004
|
// src/domains/installation/extraction/tar-extractor.ts
|
|
82939
83005
|
init_logger();
|
|
82940
|
-
import { copyFile as copyFile4, mkdir as mkdir23, readdir as readdir15, rm as
|
|
82941
|
-
import { join as
|
|
83006
|
+
import { copyFile as copyFile4, mkdir as mkdir23, readdir as readdir15, rm as rm9, stat as stat10 } from "node:fs/promises";
|
|
83007
|
+
import { join as join80 } from "node:path";
|
|
82942
83008
|
|
|
82943
83009
|
// node_modules/@isaacs/fs-minipass/dist/esm/index.js
|
|
82944
83010
|
import EE from "events";
|
|
@@ -88700,7 +88766,7 @@ var mkdirSync3 = (dir, opt) => {
|
|
|
88700
88766
|
};
|
|
88701
88767
|
|
|
88702
88768
|
// node_modules/tar/dist/esm/path-reservations.js
|
|
88703
|
-
import { join as
|
|
88769
|
+
import { join as join78 } from "node:path";
|
|
88704
88770
|
|
|
88705
88771
|
// node_modules/tar/dist/esm/normalize-unicode.js
|
|
88706
88772
|
var normalizeCache = Object.create(null);
|
|
@@ -88733,7 +88799,7 @@ var getDirs = (path10) => {
|
|
|
88733
88799
|
const dirs = path10.split("/").slice(0, -1).reduce((set, path11) => {
|
|
88734
88800
|
const s = set[set.length - 1];
|
|
88735
88801
|
if (s !== undefined) {
|
|
88736
|
-
path11 =
|
|
88802
|
+
path11 = join78(s, path11);
|
|
88737
88803
|
}
|
|
88738
88804
|
set.push(path11 || "/");
|
|
88739
88805
|
return set;
|
|
@@ -88747,7 +88813,7 @@ class PathReservations {
|
|
|
88747
88813
|
#running = new Set;
|
|
88748
88814
|
reserve(paths, fn) {
|
|
88749
88815
|
paths = isWindows4 ? ["win32 parallelization disabled"] : paths.map((p) => {
|
|
88750
|
-
return stripTrailingSlashes(
|
|
88816
|
+
return stripTrailingSlashes(join78(normalizeUnicode(p))).toLowerCase();
|
|
88751
88817
|
});
|
|
88752
88818
|
const dirs = new Set(paths.map((path10) => getDirs(path10)).reduce((a3, b3) => a3.concat(b3)));
|
|
88753
88819
|
this.#reservations.set(fn, { dirs, paths });
|
|
@@ -89807,7 +89873,7 @@ function decodeFilePath(path12) {
|
|
|
89807
89873
|
init_logger();
|
|
89808
89874
|
init_types3();
|
|
89809
89875
|
import { copyFile as copyFile3, lstat as lstat4, mkdir as mkdir22, readdir as readdir14 } from "node:fs/promises";
|
|
89810
|
-
import { join as
|
|
89876
|
+
import { join as join79, relative as relative10 } from "node:path";
|
|
89811
89877
|
async function withRetry(fn, retries = 3) {
|
|
89812
89878
|
for (let i = 0;i < retries; i++) {
|
|
89813
89879
|
try {
|
|
@@ -89829,8 +89895,8 @@ async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTrac
|
|
|
89829
89895
|
await mkdir22(destDir, { recursive: true });
|
|
89830
89896
|
const entries = await readdir14(sourceDir, { encoding: "utf8" });
|
|
89831
89897
|
for (const entry of entries) {
|
|
89832
|
-
const sourcePath =
|
|
89833
|
-
const destPath =
|
|
89898
|
+
const sourcePath = join79(sourceDir, entry);
|
|
89899
|
+
const destPath = join79(destDir, entry);
|
|
89834
89900
|
const relativePath = relative10(sourceDir, sourcePath);
|
|
89835
89901
|
if (!isPathSafe(destDir, destPath)) {
|
|
89836
89902
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -89857,8 +89923,8 @@ async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
|
89857
89923
|
await mkdir22(destDir, { recursive: true });
|
|
89858
89924
|
const entries = await readdir14(sourceDir, { encoding: "utf8" });
|
|
89859
89925
|
for (const entry of entries) {
|
|
89860
|
-
const sourcePath =
|
|
89861
|
-
const destPath =
|
|
89926
|
+
const sourcePath = join79(sourceDir, entry);
|
|
89927
|
+
const destPath = join79(destDir, entry);
|
|
89862
89928
|
const relativePath = relative10(sourceDir, sourcePath);
|
|
89863
89929
|
if (!isPathSafe(destDir, destPath)) {
|
|
89864
89930
|
logger.warning(`Skipping unsafe path: ${relativePath}`);
|
|
@@ -89906,7 +89972,7 @@ class TarExtractor {
|
|
|
89906
89972
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
89907
89973
|
if (entries.length === 1) {
|
|
89908
89974
|
const rootEntry = entries[0];
|
|
89909
|
-
const rootPath =
|
|
89975
|
+
const rootPath = join80(tempExtractDir, rootEntry);
|
|
89910
89976
|
const rootStat = await stat10(rootPath);
|
|
89911
89977
|
if (rootStat.isDirectory()) {
|
|
89912
89978
|
const rootContents = await readdir15(rootPath, { encoding: "utf8" });
|
|
@@ -89922,17 +89988,17 @@ class TarExtractor {
|
|
|
89922
89988
|
}
|
|
89923
89989
|
} else {
|
|
89924
89990
|
await mkdir23(destDir, { recursive: true });
|
|
89925
|
-
await copyFile4(rootPath,
|
|
89991
|
+
await copyFile4(rootPath, join80(destDir, rootEntry));
|
|
89926
89992
|
}
|
|
89927
89993
|
} else {
|
|
89928
89994
|
logger.debug("Multiple root entries - moving all");
|
|
89929
89995
|
await moveDirectoryContents(tempExtractDir, destDir, shouldExclude, sizeTracker);
|
|
89930
89996
|
}
|
|
89931
89997
|
logger.debug(`Moved contents to: ${destDir}`);
|
|
89932
|
-
await
|
|
89998
|
+
await rm9(tempExtractDir, { recursive: true, force: true });
|
|
89933
89999
|
} catch (error) {
|
|
89934
90000
|
try {
|
|
89935
|
-
await
|
|
90001
|
+
await rm9(tempExtractDir, { recursive: true, force: true });
|
|
89936
90002
|
} catch {}
|
|
89937
90003
|
throw error;
|
|
89938
90004
|
}
|
|
@@ -89944,8 +90010,8 @@ init_environment();
|
|
|
89944
90010
|
init_logger();
|
|
89945
90011
|
var import_extract_zip = __toESM(require_extract_zip(), 1);
|
|
89946
90012
|
import { execFile as execFile8 } from "node:child_process";
|
|
89947
|
-
import { copyFile as copyFile5, mkdir as mkdir24, readdir as readdir16, rm as
|
|
89948
|
-
import { join as
|
|
90013
|
+
import { copyFile as copyFile5, mkdir as mkdir24, readdir as readdir16, rm as rm10, stat as stat11 } from "node:fs/promises";
|
|
90014
|
+
import { join as join81 } from "node:path";
|
|
89949
90015
|
class ZipExtractor {
|
|
89950
90016
|
async tryNativeUnzip(archivePath, destDir) {
|
|
89951
90017
|
if (!isMacOS()) {
|
|
@@ -89993,7 +90059,7 @@ class ZipExtractor {
|
|
|
89993
90059
|
logger.debug(`Root entries: ${entries.join(", ")}`);
|
|
89994
90060
|
if (entries.length === 1) {
|
|
89995
90061
|
const rootEntry = entries[0];
|
|
89996
|
-
const rootPath =
|
|
90062
|
+
const rootPath = join81(tempExtractDir, rootEntry);
|
|
89997
90063
|
const rootStat = await stat11(rootPath);
|
|
89998
90064
|
if (rootStat.isDirectory()) {
|
|
89999
90065
|
const rootContents = await readdir16(rootPath, { encoding: "utf8" });
|
|
@@ -90009,17 +90075,17 @@ class ZipExtractor {
|
|
|
90009
90075
|
}
|
|
90010
90076
|
} else {
|
|
90011
90077
|
await mkdir24(destDir, { recursive: true });
|
|
90012
|
-
await copyFile5(rootPath,
|
|
90078
|
+
await copyFile5(rootPath, join81(destDir, rootEntry));
|
|
90013
90079
|
}
|
|
90014
90080
|
} else {
|
|
90015
90081
|
logger.debug("Multiple root entries - moving all");
|
|
90016
90082
|
await moveDirectoryContents(tempExtractDir, destDir, shouldExclude, sizeTracker);
|
|
90017
90083
|
}
|
|
90018
90084
|
logger.debug(`Moved contents to: ${destDir}`);
|
|
90019
|
-
await
|
|
90085
|
+
await rm10(tempExtractDir, { recursive: true, force: true });
|
|
90020
90086
|
} catch (error) {
|
|
90021
90087
|
try {
|
|
90022
|
-
await
|
|
90088
|
+
await rm10(tempExtractDir, { recursive: true, force: true });
|
|
90023
90089
|
} catch {}
|
|
90024
90090
|
throw error;
|
|
90025
90091
|
}
|
|
@@ -90108,7 +90174,7 @@ class DownloadManager {
|
|
|
90108
90174
|
async createTempDir() {
|
|
90109
90175
|
const timestamp = Date.now();
|
|
90110
90176
|
const counter = DownloadManager.tempDirCounter++;
|
|
90111
|
-
const primaryTempDir =
|
|
90177
|
+
const primaryTempDir = join82(tmpdir4(), `claudekit-${timestamp}-${counter}`);
|
|
90112
90178
|
try {
|
|
90113
90179
|
await mkdir25(primaryTempDir, { recursive: true });
|
|
90114
90180
|
logger.debug(`Created temp directory: ${primaryTempDir}`);
|
|
@@ -90125,7 +90191,7 @@ Solutions:
|
|
|
90125
90191
|
2. Set HOME environment variable
|
|
90126
90192
|
3. Try running from a different directory`);
|
|
90127
90193
|
}
|
|
90128
|
-
const fallbackTempDir =
|
|
90194
|
+
const fallbackTempDir = join82(homeDir, ".claudekit", "tmp", `claudekit-${timestamp}-${counter}`);
|
|
90129
90195
|
try {
|
|
90130
90196
|
await mkdir25(fallbackTempDir, { recursive: true });
|
|
90131
90197
|
logger.debug(`Created temp directory (fallback): ${fallbackTempDir}`);
|
|
@@ -90474,20 +90540,20 @@ async function handleDownload(ctx) {
|
|
|
90474
90540
|
};
|
|
90475
90541
|
}
|
|
90476
90542
|
// src/commands/init/phases/merge-handler.ts
|
|
90477
|
-
import { join as
|
|
90543
|
+
import { join as join98 } from "node:path";
|
|
90478
90544
|
|
|
90479
90545
|
// src/domains/installation/deletion-handler.ts
|
|
90480
90546
|
import { existsSync as existsSync55, lstatSync as lstatSync3, readdirSync as readdirSync4, rmSync as rmSync3, rmdirSync, unlinkSync as unlinkSync3 } from "node:fs";
|
|
90481
|
-
import { dirname as dirname24, join as
|
|
90547
|
+
import { dirname as dirname24, join as join85, relative as relative11, resolve as resolve20, sep as sep6 } from "node:path";
|
|
90482
90548
|
|
|
90483
90549
|
// src/services/file-operations/manifest/manifest-reader.ts
|
|
90484
90550
|
init_metadata_migration();
|
|
90485
90551
|
init_logger();
|
|
90486
90552
|
init_types3();
|
|
90487
90553
|
var import_fs_extra8 = __toESM(require_lib3(), 1);
|
|
90488
|
-
import { join as
|
|
90554
|
+
import { join as join84 } from "node:path";
|
|
90489
90555
|
async function readManifest(claudeDir2) {
|
|
90490
|
-
const metadataPath =
|
|
90556
|
+
const metadataPath = join84(claudeDir2, "metadata.json");
|
|
90491
90557
|
if (!await import_fs_extra8.pathExists(metadataPath)) {
|
|
90492
90558
|
return null;
|
|
90493
90559
|
}
|
|
@@ -90665,7 +90731,7 @@ function collectFilesRecursively(dir, baseDir) {
|
|
|
90665
90731
|
try {
|
|
90666
90732
|
const entries = readdirSync4(dir, { withFileTypes: true });
|
|
90667
90733
|
for (const entry of entries) {
|
|
90668
|
-
const fullPath =
|
|
90734
|
+
const fullPath = join85(dir, entry.name);
|
|
90669
90735
|
const relativePath = relative11(baseDir, fullPath);
|
|
90670
90736
|
if (entry.isDirectory()) {
|
|
90671
90737
|
results.push(...collectFilesRecursively(fullPath, baseDir));
|
|
@@ -90717,7 +90783,7 @@ function cleanupEmptyDirectories(filePath, claudeDir2) {
|
|
|
90717
90783
|
function deletePath(fullPath, claudeDir2) {
|
|
90718
90784
|
const normalizedPath = resolve20(fullPath);
|
|
90719
90785
|
const normalizedClaudeDir = resolve20(claudeDir2);
|
|
90720
|
-
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${
|
|
90786
|
+
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep6}`) && normalizedPath !== normalizedClaudeDir) {
|
|
90721
90787
|
throw new Error(`Path traversal detected: ${fullPath}`);
|
|
90722
90788
|
}
|
|
90723
90789
|
try {
|
|
@@ -90733,7 +90799,7 @@ function deletePath(fullPath, claudeDir2) {
|
|
|
90733
90799
|
}
|
|
90734
90800
|
}
|
|
90735
90801
|
async function updateMetadataAfterDeletion(claudeDir2, deletedPaths) {
|
|
90736
|
-
const metadataPath =
|
|
90802
|
+
const metadataPath = join85(claudeDir2, "metadata.json");
|
|
90737
90803
|
if (!await import_fs_extra9.pathExists(metadataPath)) {
|
|
90738
90804
|
return;
|
|
90739
90805
|
}
|
|
@@ -90788,10 +90854,10 @@ async function handleDeletions(sourceMetadata, claudeDir2) {
|
|
|
90788
90854
|
const userMetadata = await readManifest(claudeDir2);
|
|
90789
90855
|
const result = { deletedPaths: [], preservedPaths: [], errors: [] };
|
|
90790
90856
|
for (const path13 of deletions) {
|
|
90791
|
-
const fullPath =
|
|
90857
|
+
const fullPath = join85(claudeDir2, path13);
|
|
90792
90858
|
const normalizedPath = resolve20(fullPath);
|
|
90793
90859
|
const normalizedClaudeDir = resolve20(claudeDir2);
|
|
90794
|
-
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${
|
|
90860
|
+
if (!normalizedPath.startsWith(`${normalizedClaudeDir}${sep6}`)) {
|
|
90795
90861
|
logger.warning(`Skipping invalid path: ${path13}`);
|
|
90796
90862
|
result.errors.push(path13);
|
|
90797
90863
|
continue;
|
|
@@ -90828,7 +90894,7 @@ init_logger();
|
|
|
90828
90894
|
init_types3();
|
|
90829
90895
|
var import_fs_extra12 = __toESM(require_lib3(), 1);
|
|
90830
90896
|
var import_ignore3 = __toESM(require_ignore(), 1);
|
|
90831
|
-
import { dirname as dirname26, join as
|
|
90897
|
+
import { dirname as dirname26, join as join88, relative as relative13 } from "node:path";
|
|
90832
90898
|
|
|
90833
90899
|
// src/domains/installation/selective-merger.ts
|
|
90834
90900
|
import { stat as stat13 } from "node:fs/promises";
|
|
@@ -91007,7 +91073,7 @@ init_logger();
|
|
|
91007
91073
|
var import_fs_extra10 = __toESM(require_lib3(), 1);
|
|
91008
91074
|
var import_ignore2 = __toESM(require_ignore(), 1);
|
|
91009
91075
|
import { relative as relative12 } from "node:path";
|
|
91010
|
-
import { join as
|
|
91076
|
+
import { join as join86 } from "node:path";
|
|
91011
91077
|
|
|
91012
91078
|
// node_modules/@isaacs/balanced-match/dist/esm/index.js
|
|
91013
91079
|
var balanced = (a3, b3, str2) => {
|
|
@@ -91814,8 +91880,8 @@ var path13 = {
|
|
|
91814
91880
|
win32: { sep: "\\" },
|
|
91815
91881
|
posix: { sep: "/" }
|
|
91816
91882
|
};
|
|
91817
|
-
var
|
|
91818
|
-
minimatch.sep =
|
|
91883
|
+
var sep7 = defaultPlatform === "win32" ? path13.win32.sep : path13.posix.sep;
|
|
91884
|
+
minimatch.sep = sep7;
|
|
91819
91885
|
var GLOBSTAR = Symbol("globstar **");
|
|
91820
91886
|
minimatch.GLOBSTAR = GLOBSTAR;
|
|
91821
91887
|
var qmark2 = "[^/]";
|
|
@@ -92463,7 +92529,7 @@ class FileScanner {
|
|
|
92463
92529
|
const files = [];
|
|
92464
92530
|
const entries = await import_fs_extra10.readdir(dir, { encoding: "utf8" });
|
|
92465
92531
|
for (const entry of entries) {
|
|
92466
|
-
const fullPath =
|
|
92532
|
+
const fullPath = join86(dir, entry);
|
|
92467
92533
|
const relativePath = relative12(baseDir, fullPath);
|
|
92468
92534
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
92469
92535
|
const stats = await import_fs_extra10.lstat(fullPath);
|
|
@@ -92503,7 +92569,7 @@ import { execSync as execSync4 } from "node:child_process";
|
|
|
92503
92569
|
init_shared();
|
|
92504
92570
|
import { existsSync as existsSync56 } from "node:fs";
|
|
92505
92571
|
import { mkdir as mkdir26, readFile as readFile39, writeFile as writeFile22 } from "node:fs/promises";
|
|
92506
|
-
import { dirname as dirname25, join as
|
|
92572
|
+
import { dirname as dirname25, join as join87 } from "node:path";
|
|
92507
92573
|
var CK_JSON_FILE = ".ck.json";
|
|
92508
92574
|
|
|
92509
92575
|
class InstalledSettingsTracker {
|
|
@@ -92517,9 +92583,9 @@ class InstalledSettingsTracker {
|
|
|
92517
92583
|
}
|
|
92518
92584
|
getCkJsonPath() {
|
|
92519
92585
|
if (this.isGlobal) {
|
|
92520
|
-
return
|
|
92586
|
+
return join87(this.projectDir, CK_JSON_FILE);
|
|
92521
92587
|
}
|
|
92522
|
-
return
|
|
92588
|
+
return join87(this.projectDir, ".claude", CK_JSON_FILE);
|
|
92523
92589
|
}
|
|
92524
92590
|
async loadInstalledSettings() {
|
|
92525
92591
|
const ckJsonPath = this.getCkJsonPath();
|
|
@@ -93136,7 +93202,7 @@ class CopyExecutor {
|
|
|
93136
93202
|
for (const file of files) {
|
|
93137
93203
|
const relativePath = relative13(sourceDir, file);
|
|
93138
93204
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
93139
|
-
const destPath =
|
|
93205
|
+
const destPath = join88(destDir, relativePath);
|
|
93140
93206
|
if (await import_fs_extra12.pathExists(destPath)) {
|
|
93141
93207
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
93142
93208
|
logger.debug(`Security-sensitive file exists but won't be overwritten: ${normalizedRelativePath}`);
|
|
@@ -93158,7 +93224,7 @@ class CopyExecutor {
|
|
|
93158
93224
|
for (const file of files) {
|
|
93159
93225
|
const relativePath = relative13(sourceDir, file);
|
|
93160
93226
|
const normalizedRelativePath = relativePath.replace(/\\/g, "/");
|
|
93161
|
-
const destPath =
|
|
93227
|
+
const destPath = join88(destDir, relativePath);
|
|
93162
93228
|
if (this.fileScanner.shouldNeverCopy(normalizedRelativePath)) {
|
|
93163
93229
|
logger.debug(`Skipping security-sensitive file: ${normalizedRelativePath}`);
|
|
93164
93230
|
skippedCount++;
|
|
@@ -93331,15 +93397,15 @@ class FileMerger {
|
|
|
93331
93397
|
|
|
93332
93398
|
// src/domains/migration/legacy-migration.ts
|
|
93333
93399
|
import { readdir as readdir18, stat as stat14 } from "node:fs/promises";
|
|
93334
|
-
import { join as
|
|
93400
|
+
import { join as join92, relative as relative14 } from "node:path";
|
|
93335
93401
|
// src/services/file-operations/manifest/manifest-tracker.ts
|
|
93336
|
-
import { join as
|
|
93402
|
+
import { join as join91 } from "node:path";
|
|
93337
93403
|
|
|
93338
93404
|
// src/domains/migration/release-manifest.ts
|
|
93339
93405
|
init_logger();
|
|
93340
93406
|
init_zod();
|
|
93341
93407
|
var import_fs_extra13 = __toESM(require_lib3(), 1);
|
|
93342
|
-
import { join as
|
|
93408
|
+
import { join as join89 } from "node:path";
|
|
93343
93409
|
var ReleaseManifestFileSchema = exports_external.object({
|
|
93344
93410
|
path: exports_external.string(),
|
|
93345
93411
|
checksum: exports_external.string().regex(/^[a-f0-9]{64}$/),
|
|
@@ -93354,7 +93420,7 @@ var ReleaseManifestSchema = exports_external.object({
|
|
|
93354
93420
|
|
|
93355
93421
|
class ReleaseManifestLoader {
|
|
93356
93422
|
static async load(extractDir) {
|
|
93357
|
-
const manifestPath =
|
|
93423
|
+
const manifestPath = join89(extractDir, "release-manifest.json");
|
|
93358
93424
|
try {
|
|
93359
93425
|
const content = await import_fs_extra13.readFile(manifestPath, "utf-8");
|
|
93360
93426
|
const parsed = JSON.parse(content);
|
|
@@ -93380,9 +93446,9 @@ init_logger();
|
|
|
93380
93446
|
init_types3();
|
|
93381
93447
|
var import_fs_extra14 = __toESM(require_lib3(), 1);
|
|
93382
93448
|
var import_proper_lockfile5 = __toESM(require_proper_lockfile(), 1);
|
|
93383
|
-
import { join as
|
|
93449
|
+
import { join as join90 } from "node:path";
|
|
93384
93450
|
async function writeManifest(claudeDir2, kitName, version, scope, kitType, trackedFiles, userConfigFiles) {
|
|
93385
|
-
const metadataPath =
|
|
93451
|
+
const metadataPath = join90(claudeDir2, "metadata.json");
|
|
93386
93452
|
const kit = kitType || (/\bmarketing\b/i.test(kitName) ? "marketing" : "engineer");
|
|
93387
93453
|
await import_fs_extra14.ensureFile(metadataPath);
|
|
93388
93454
|
let release = null;
|
|
@@ -93438,7 +93504,7 @@ async function writeManifest(claudeDir2, kitName, version, scope, kitType, track
|
|
|
93438
93504
|
}
|
|
93439
93505
|
}
|
|
93440
93506
|
async function removeKitFromManifest(claudeDir2, kit) {
|
|
93441
|
-
const metadataPath =
|
|
93507
|
+
const metadataPath = join90(claudeDir2, "metadata.json");
|
|
93442
93508
|
if (!await import_fs_extra14.pathExists(metadataPath))
|
|
93443
93509
|
return false;
|
|
93444
93510
|
let release = null;
|
|
@@ -93568,7 +93634,7 @@ function buildFileTrackingList(options2) {
|
|
|
93568
93634
|
if (!isGlobal && !installedPath.startsWith(".claude/"))
|
|
93569
93635
|
continue;
|
|
93570
93636
|
const relativePath = isGlobal ? installedPath : installedPath.replace(/^\.claude\//, "");
|
|
93571
|
-
const filePath =
|
|
93637
|
+
const filePath = join91(claudeDir2, relativePath);
|
|
93572
93638
|
const manifestEntry = releaseManifest ? ReleaseManifestLoader.findFile(releaseManifest, installedPath) : null;
|
|
93573
93639
|
const ownership = manifestEntry ? "ck" : "user";
|
|
93574
93640
|
filesToTrack.push({
|
|
@@ -93675,7 +93741,7 @@ class LegacyMigration {
|
|
|
93675
93741
|
continue;
|
|
93676
93742
|
if (SKIP_DIRS_ALL.includes(entry))
|
|
93677
93743
|
continue;
|
|
93678
|
-
const fullPath =
|
|
93744
|
+
const fullPath = join92(dir, entry);
|
|
93679
93745
|
let stats;
|
|
93680
93746
|
try {
|
|
93681
93747
|
stats = await stat14(fullPath);
|
|
@@ -93777,7 +93843,7 @@ User-created files (sample):`);
|
|
|
93777
93843
|
];
|
|
93778
93844
|
if (filesToChecksum.length > 0) {
|
|
93779
93845
|
const checksumResults = await mapWithLimit(filesToChecksum, async ({ relativePath, ownership }) => {
|
|
93780
|
-
const fullPath =
|
|
93846
|
+
const fullPath = join92(claudeDir2, relativePath);
|
|
93781
93847
|
const checksum = await OwnershipChecker.calculateChecksum(fullPath);
|
|
93782
93848
|
return { relativePath, checksum, ownership };
|
|
93783
93849
|
});
|
|
@@ -93798,7 +93864,7 @@ User-created files (sample):`);
|
|
|
93798
93864
|
installedAt: new Date().toISOString(),
|
|
93799
93865
|
files: trackedFiles
|
|
93800
93866
|
};
|
|
93801
|
-
const metadataPath =
|
|
93867
|
+
const metadataPath = join92(claudeDir2, "metadata.json");
|
|
93802
93868
|
await import_fs_extra15.writeFile(metadataPath, JSON.stringify(updatedMetadata, null, 2));
|
|
93803
93869
|
logger.success(`Migration complete: tracked ${trackedFiles.length} files`);
|
|
93804
93870
|
return true;
|
|
@@ -93904,7 +93970,7 @@ function buildConflictSummary(fileConflicts, hookConflicts, mcpConflicts) {
|
|
|
93904
93970
|
init_logger();
|
|
93905
93971
|
init_skip_directories();
|
|
93906
93972
|
var import_fs_extra16 = __toESM(require_lib3(), 1);
|
|
93907
|
-
import { join as
|
|
93973
|
+
import { join as join93, relative as relative15, resolve as resolve21 } from "node:path";
|
|
93908
93974
|
|
|
93909
93975
|
class FileScanner2 {
|
|
93910
93976
|
static async getFiles(dirPath, relativeTo) {
|
|
@@ -93920,7 +93986,7 @@ class FileScanner2 {
|
|
|
93920
93986
|
logger.debug(`Skipping directory: ${entry}`);
|
|
93921
93987
|
continue;
|
|
93922
93988
|
}
|
|
93923
|
-
const fullPath =
|
|
93989
|
+
const fullPath = join93(dirPath, entry);
|
|
93924
93990
|
if (!FileScanner2.isSafePath(basePath, fullPath)) {
|
|
93925
93991
|
logger.warning(`Skipping potentially unsafe path: ${entry}`);
|
|
93926
93992
|
continue;
|
|
@@ -93955,8 +94021,8 @@ class FileScanner2 {
|
|
|
93955
94021
|
return files;
|
|
93956
94022
|
}
|
|
93957
94023
|
static async findCustomFiles(destDir, sourceDir, subPath) {
|
|
93958
|
-
const destSubDir =
|
|
93959
|
-
const sourceSubDir =
|
|
94024
|
+
const destSubDir = join93(destDir, subPath);
|
|
94025
|
+
const sourceSubDir = join93(sourceDir, subPath);
|
|
93960
94026
|
logger.debug(`findCustomFiles - destDir: ${destDir}`);
|
|
93961
94027
|
logger.debug(`findCustomFiles - sourceDir: ${sourceDir}`);
|
|
93962
94028
|
logger.debug(`findCustomFiles - subPath: "${subPath}"`);
|
|
@@ -93997,12 +94063,12 @@ class FileScanner2 {
|
|
|
93997
94063
|
init_logger();
|
|
93998
94064
|
var import_fs_extra17 = __toESM(require_lib3(), 1);
|
|
93999
94065
|
import { lstat as lstat7, mkdir as mkdir27, readdir as readdir21, stat as stat15 } from "node:fs/promises";
|
|
94000
|
-
import { join as
|
|
94066
|
+
import { join as join95 } from "node:path";
|
|
94001
94067
|
|
|
94002
94068
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
94003
94069
|
init_logger();
|
|
94004
94070
|
import { readFile as readFile43, readdir as readdir20, writeFile as writeFile26 } from "node:fs/promises";
|
|
94005
|
-
import { join as
|
|
94071
|
+
import { join as join94 } from "node:path";
|
|
94006
94072
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
94007
94073
|
".md",
|
|
94008
94074
|
".txt",
|
|
@@ -94063,7 +94129,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
94063
94129
|
async function processDirectory(dir) {
|
|
94064
94130
|
const entries = await readdir20(dir, { withFileTypes: true });
|
|
94065
94131
|
for (const entry of entries) {
|
|
94066
|
-
const fullPath =
|
|
94132
|
+
const fullPath = join94(dir, entry.name);
|
|
94067
94133
|
if (entry.isDirectory()) {
|
|
94068
94134
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
94069
94135
|
continue;
|
|
@@ -94138,14 +94204,14 @@ function shouldApplyPrefix(options2) {
|
|
|
94138
94204
|
// src/services/transformers/commands-prefix/prefix-applier.ts
|
|
94139
94205
|
async function applyPrefix(extractDir) {
|
|
94140
94206
|
validatePath(extractDir, "extractDir");
|
|
94141
|
-
const commandsDir =
|
|
94207
|
+
const commandsDir = join95(extractDir, ".claude", "commands");
|
|
94142
94208
|
if (!await import_fs_extra17.pathExists(commandsDir)) {
|
|
94143
94209
|
logger.verbose("No commands directory found, skipping prefix application");
|
|
94144
94210
|
return;
|
|
94145
94211
|
}
|
|
94146
94212
|
logger.info("Applying /ck: prefix to slash commands...");
|
|
94147
|
-
const backupDir =
|
|
94148
|
-
const tempDir =
|
|
94213
|
+
const backupDir = join95(extractDir, ".commands-backup");
|
|
94214
|
+
const tempDir = join95(extractDir, ".commands-prefix-temp");
|
|
94149
94215
|
try {
|
|
94150
94216
|
const entries = await readdir21(commandsDir);
|
|
94151
94217
|
if (entries.length === 0) {
|
|
@@ -94153,7 +94219,7 @@ async function applyPrefix(extractDir) {
|
|
|
94153
94219
|
return;
|
|
94154
94220
|
}
|
|
94155
94221
|
if (entries.length === 1 && entries[0] === "ck") {
|
|
94156
|
-
const ckDir2 =
|
|
94222
|
+
const ckDir2 = join95(commandsDir, "ck");
|
|
94157
94223
|
const ckStat = await stat15(ckDir2);
|
|
94158
94224
|
if (ckStat.isDirectory()) {
|
|
94159
94225
|
logger.verbose("Commands already have /ck: prefix, skipping");
|
|
@@ -94163,17 +94229,17 @@ async function applyPrefix(extractDir) {
|
|
|
94163
94229
|
await import_fs_extra17.copy(commandsDir, backupDir);
|
|
94164
94230
|
logger.verbose("Created backup of commands directory");
|
|
94165
94231
|
await mkdir27(tempDir, { recursive: true });
|
|
94166
|
-
const ckDir =
|
|
94232
|
+
const ckDir = join95(tempDir, "ck");
|
|
94167
94233
|
await mkdir27(ckDir, { recursive: true });
|
|
94168
94234
|
let processedCount = 0;
|
|
94169
94235
|
for (const entry of entries) {
|
|
94170
|
-
const sourcePath =
|
|
94236
|
+
const sourcePath = join95(commandsDir, entry);
|
|
94171
94237
|
const stats = await lstat7(sourcePath);
|
|
94172
94238
|
if (stats.isSymbolicLink()) {
|
|
94173
94239
|
logger.warning(`Skipping symlink for security: ${entry}`);
|
|
94174
94240
|
continue;
|
|
94175
94241
|
}
|
|
94176
|
-
const destPath =
|
|
94242
|
+
const destPath = join95(ckDir, entry);
|
|
94177
94243
|
await import_fs_extra17.copy(sourcePath, destPath, {
|
|
94178
94244
|
overwrite: false,
|
|
94179
94245
|
errorOnExist: true
|
|
@@ -94191,7 +94257,7 @@ async function applyPrefix(extractDir) {
|
|
|
94191
94257
|
await import_fs_extra17.move(tempDir, commandsDir);
|
|
94192
94258
|
await import_fs_extra17.remove(backupDir);
|
|
94193
94259
|
logger.success("Successfully reorganized commands to /ck: prefix");
|
|
94194
|
-
const claudeDir2 =
|
|
94260
|
+
const claudeDir2 = join95(extractDir, ".claude");
|
|
94195
94261
|
logger.info("Transforming command references in file contents...");
|
|
94196
94262
|
const transformResult = await transformCommandReferences(claudeDir2, {
|
|
94197
94263
|
verbose: logger.isVerbose()
|
|
@@ -94229,20 +94295,20 @@ async function applyPrefix(extractDir) {
|
|
|
94229
94295
|
// src/services/transformers/commands-prefix/prefix-cleaner.ts
|
|
94230
94296
|
init_metadata_migration();
|
|
94231
94297
|
import { lstat as lstat9, readdir as readdir23 } from "node:fs/promises";
|
|
94232
|
-
import { join as
|
|
94298
|
+
import { join as join97 } from "node:path";
|
|
94233
94299
|
init_logger();
|
|
94234
94300
|
var import_fs_extra19 = __toESM(require_lib3(), 1);
|
|
94235
94301
|
|
|
94236
94302
|
// src/services/transformers/commands-prefix/file-processor.ts
|
|
94237
94303
|
import { lstat as lstat8, readdir as readdir22 } from "node:fs/promises";
|
|
94238
|
-
import { join as
|
|
94304
|
+
import { join as join96 } from "node:path";
|
|
94239
94305
|
init_logger();
|
|
94240
94306
|
var import_fs_extra18 = __toESM(require_lib3(), 1);
|
|
94241
94307
|
async function scanDirectoryFiles(dir) {
|
|
94242
94308
|
const files = [];
|
|
94243
94309
|
const entries = await readdir22(dir);
|
|
94244
94310
|
for (const entry of entries) {
|
|
94245
|
-
const fullPath =
|
|
94311
|
+
const fullPath = join96(dir, entry);
|
|
94246
94312
|
const stats = await lstat8(fullPath);
|
|
94247
94313
|
if (stats.isSymbolicLink()) {
|
|
94248
94314
|
continue;
|
|
@@ -94370,8 +94436,8 @@ function isDifferentKitDirectory(dirName, currentKit) {
|
|
|
94370
94436
|
async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
94371
94437
|
const { dryRun = false } = options2;
|
|
94372
94438
|
validatePath(targetDir, "targetDir");
|
|
94373
|
-
const claudeDir2 = isGlobal ? targetDir :
|
|
94374
|
-
const commandsDir =
|
|
94439
|
+
const claudeDir2 = isGlobal ? targetDir : join97(targetDir, ".claude");
|
|
94440
|
+
const commandsDir = join97(claudeDir2, "commands");
|
|
94375
94441
|
const accumulator = {
|
|
94376
94442
|
results: [],
|
|
94377
94443
|
deletedCount: 0,
|
|
@@ -94413,7 +94479,7 @@ async function cleanupCommandsDirectory(targetDir, isGlobal, options2 = {}) {
|
|
|
94413
94479
|
}
|
|
94414
94480
|
const metadataForChecks = options2.kitType ? createKitSpecificMetadata(metadata, options2.kitType) : metadata;
|
|
94415
94481
|
for (const entry of entries) {
|
|
94416
|
-
const entryPath =
|
|
94482
|
+
const entryPath = join97(commandsDir, entry);
|
|
94417
94483
|
const stats = await lstat9(entryPath);
|
|
94418
94484
|
if (stats.isSymbolicLink()) {
|
|
94419
94485
|
addSymlinkSkip(entry, accumulator);
|
|
@@ -94470,7 +94536,7 @@ async function handleMerge(ctx) {
|
|
|
94470
94536
|
let customClaudeFiles = [];
|
|
94471
94537
|
if (!ctx.options.fresh) {
|
|
94472
94538
|
logger.info("Scanning for custom .claude files...");
|
|
94473
|
-
const scanSourceDir = ctx.options.global ?
|
|
94539
|
+
const scanSourceDir = ctx.options.global ? join98(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
94474
94540
|
const scanTargetSubdir = ctx.options.global ? "" : ".claude";
|
|
94475
94541
|
customClaudeFiles = await FileScanner2.findCustomFiles(ctx.resolvedDir, scanSourceDir, scanTargetSubdir);
|
|
94476
94542
|
} else {
|
|
@@ -94535,8 +94601,8 @@ async function handleMerge(ctx) {
|
|
|
94535
94601
|
return { ...ctx, cancelled: true };
|
|
94536
94602
|
}
|
|
94537
94603
|
}
|
|
94538
|
-
const sourceDir = ctx.options.global ?
|
|
94539
|
-
const sourceMetadataPath = ctx.options.global ?
|
|
94604
|
+
const sourceDir = ctx.options.global ? join98(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
94605
|
+
const sourceMetadataPath = ctx.options.global ? join98(sourceDir, "metadata.json") : join98(sourceDir, ".claude", "metadata.json");
|
|
94540
94606
|
let sourceMetadata = null;
|
|
94541
94607
|
try {
|
|
94542
94608
|
if (await import_fs_extra20.pathExists(sourceMetadataPath)) {
|
|
@@ -94593,7 +94659,7 @@ async function handleMerge(ctx) {
|
|
|
94593
94659
|
};
|
|
94594
94660
|
}
|
|
94595
94661
|
// src/commands/init/phases/migration-handler.ts
|
|
94596
|
-
import { join as
|
|
94662
|
+
import { join as join106 } from "node:path";
|
|
94597
94663
|
|
|
94598
94664
|
// src/domains/skills/skills-detector.ts
|
|
94599
94665
|
init_logger();
|
|
@@ -94609,7 +94675,7 @@ init_types3();
|
|
|
94609
94675
|
var import_fs_extra21 = __toESM(require_lib3(), 1);
|
|
94610
94676
|
import { createHash as createHash4 } from "node:crypto";
|
|
94611
94677
|
import { readFile as readFile45, readdir as readdir24, writeFile as writeFile27 } from "node:fs/promises";
|
|
94612
|
-
import { join as
|
|
94678
|
+
import { join as join99, relative as relative16 } from "node:path";
|
|
94613
94679
|
|
|
94614
94680
|
class SkillsManifestManager {
|
|
94615
94681
|
static MANIFEST_FILENAME = ".skills-manifest.json";
|
|
@@ -94631,12 +94697,12 @@ class SkillsManifestManager {
|
|
|
94631
94697
|
return manifest;
|
|
94632
94698
|
}
|
|
94633
94699
|
static async writeManifest(skillsDir2, manifest) {
|
|
94634
|
-
const manifestPath =
|
|
94700
|
+
const manifestPath = join99(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
94635
94701
|
await writeFile27(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
94636
94702
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
94637
94703
|
}
|
|
94638
94704
|
static async readManifest(skillsDir2) {
|
|
94639
|
-
const manifestPath =
|
|
94705
|
+
const manifestPath = join99(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
94640
94706
|
if (!await import_fs_extra21.pathExists(manifestPath)) {
|
|
94641
94707
|
logger.debug(`No manifest found at: ${manifestPath}`);
|
|
94642
94708
|
return null;
|
|
@@ -94659,7 +94725,7 @@ class SkillsManifestManager {
|
|
|
94659
94725
|
return "flat";
|
|
94660
94726
|
}
|
|
94661
94727
|
for (const dir of dirs.slice(0, 3)) {
|
|
94662
|
-
const dirPath =
|
|
94728
|
+
const dirPath = join99(skillsDir2, dir.name);
|
|
94663
94729
|
const subEntries = await readdir24(dirPath, { withFileTypes: true });
|
|
94664
94730
|
const hasSubdirs = subEntries.some((entry) => entry.isDirectory());
|
|
94665
94731
|
if (hasSubdirs) {
|
|
@@ -94678,7 +94744,7 @@ class SkillsManifestManager {
|
|
|
94678
94744
|
const entries = await readdir24(skillsDir2, { withFileTypes: true });
|
|
94679
94745
|
for (const entry of entries) {
|
|
94680
94746
|
if (entry.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(entry.name) && !entry.name.startsWith(".")) {
|
|
94681
|
-
const skillPath =
|
|
94747
|
+
const skillPath = join99(skillsDir2, entry.name);
|
|
94682
94748
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
94683
94749
|
skills.push({
|
|
94684
94750
|
name: entry.name,
|
|
@@ -94690,11 +94756,11 @@ class SkillsManifestManager {
|
|
|
94690
94756
|
const categories = await readdir24(skillsDir2, { withFileTypes: true });
|
|
94691
94757
|
for (const category of categories) {
|
|
94692
94758
|
if (category.isDirectory() && !BUILD_ARTIFACT_DIRS.includes(category.name) && !category.name.startsWith(".")) {
|
|
94693
|
-
const categoryPath =
|
|
94759
|
+
const categoryPath = join99(skillsDir2, category.name);
|
|
94694
94760
|
const skillEntries = await readdir24(categoryPath, { withFileTypes: true });
|
|
94695
94761
|
for (const skillEntry of skillEntries) {
|
|
94696
94762
|
if (skillEntry.isDirectory() && !skillEntry.name.startsWith(".")) {
|
|
94697
|
-
const skillPath =
|
|
94763
|
+
const skillPath = join99(categoryPath, skillEntry.name);
|
|
94698
94764
|
const hash = await SkillsManifestManager.hashDirectory(skillPath);
|
|
94699
94765
|
skills.push({
|
|
94700
94766
|
name: skillEntry.name,
|
|
@@ -94724,7 +94790,7 @@ class SkillsManifestManager {
|
|
|
94724
94790
|
const files = [];
|
|
94725
94791
|
const entries = await readdir24(dirPath, { withFileTypes: true });
|
|
94726
94792
|
for (const entry of entries) {
|
|
94727
|
-
const fullPath =
|
|
94793
|
+
const fullPath = join99(dirPath, entry.name);
|
|
94728
94794
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name)) {
|
|
94729
94795
|
continue;
|
|
94730
94796
|
}
|
|
@@ -94846,7 +94912,7 @@ function getPathMapping(skillName, oldBasePath, newBasePath) {
|
|
|
94846
94912
|
// src/domains/skills/detection/script-detector.ts
|
|
94847
94913
|
var import_fs_extra22 = __toESM(require_lib3(), 1);
|
|
94848
94914
|
import { readdir as readdir25 } from "node:fs/promises";
|
|
94849
|
-
import { join as
|
|
94915
|
+
import { join as join100 } from "node:path";
|
|
94850
94916
|
async function scanDirectory(skillsDir2) {
|
|
94851
94917
|
if (!await import_fs_extra22.pathExists(skillsDir2)) {
|
|
94852
94918
|
return ["flat", []];
|
|
@@ -94859,12 +94925,12 @@ async function scanDirectory(skillsDir2) {
|
|
|
94859
94925
|
let totalSkillLikeCount = 0;
|
|
94860
94926
|
const allSkills = [];
|
|
94861
94927
|
for (const dir of dirs) {
|
|
94862
|
-
const dirPath =
|
|
94928
|
+
const dirPath = join100(skillsDir2, dir.name);
|
|
94863
94929
|
const subEntries = await readdir25(dirPath, { withFileTypes: true });
|
|
94864
94930
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
94865
94931
|
if (subdirs.length > 0) {
|
|
94866
94932
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
94867
|
-
const subdirPath =
|
|
94933
|
+
const subdirPath = join100(dirPath, subdir.name);
|
|
94868
94934
|
const subdirFiles = await readdir25(subdirPath, { withFileTypes: true });
|
|
94869
94935
|
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"));
|
|
94870
94936
|
if (hasSkillMarker) {
|
|
@@ -95021,12 +95087,12 @@ class SkillsMigrationDetector {
|
|
|
95021
95087
|
// src/domains/skills/skills-migrator.ts
|
|
95022
95088
|
init_logger();
|
|
95023
95089
|
init_types3();
|
|
95024
|
-
import { join as
|
|
95090
|
+
import { join as join105 } from "node:path";
|
|
95025
95091
|
|
|
95026
95092
|
// src/domains/skills/migrator/migration-executor.ts
|
|
95027
95093
|
init_logger();
|
|
95028
|
-
import { copyFile as copyFile6, mkdir as mkdir28, readdir as readdir26, rm as
|
|
95029
|
-
import { join as
|
|
95094
|
+
import { copyFile as copyFile6, mkdir as mkdir28, readdir as readdir26, rm as rm11 } from "node:fs/promises";
|
|
95095
|
+
import { join as join101 } from "node:path";
|
|
95030
95096
|
var import_fs_extra24 = __toESM(require_lib3(), 1);
|
|
95031
95097
|
|
|
95032
95098
|
// src/domains/skills/skills-migration-prompts.ts
|
|
@@ -95191,8 +95257,8 @@ async function copySkillDirectory(sourceDir, destDir) {
|
|
|
95191
95257
|
await mkdir28(destDir, { recursive: true });
|
|
95192
95258
|
const entries = await readdir26(sourceDir, { withFileTypes: true });
|
|
95193
95259
|
for (const entry of entries) {
|
|
95194
|
-
const sourcePath =
|
|
95195
|
-
const destPath =
|
|
95260
|
+
const sourcePath = join101(sourceDir, entry.name);
|
|
95261
|
+
const destPath = join101(destDir, entry.name);
|
|
95196
95262
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
95197
95263
|
continue;
|
|
95198
95264
|
}
|
|
@@ -95207,7 +95273,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
95207
95273
|
const migrated = [];
|
|
95208
95274
|
const preserved = [];
|
|
95209
95275
|
const errors2 = [];
|
|
95210
|
-
const tempDir =
|
|
95276
|
+
const tempDir = join101(currentSkillsDir, "..", ".skills-migration-temp");
|
|
95211
95277
|
await mkdir28(tempDir, { recursive: true });
|
|
95212
95278
|
try {
|
|
95213
95279
|
for (const mapping of mappings) {
|
|
@@ -95228,9 +95294,9 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
95228
95294
|
}
|
|
95229
95295
|
}
|
|
95230
95296
|
const category = mapping.category;
|
|
95231
|
-
const targetPath = category ?
|
|
95297
|
+
const targetPath = category ? join101(tempDir, category, skillName) : join101(tempDir, skillName);
|
|
95232
95298
|
if (category) {
|
|
95233
|
-
await mkdir28(
|
|
95299
|
+
await mkdir28(join101(tempDir, category), { recursive: true });
|
|
95234
95300
|
}
|
|
95235
95301
|
await copySkillDirectory(currentSkillPath, targetPath);
|
|
95236
95302
|
migrated.push(skillName);
|
|
@@ -95248,14 +95314,14 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
95248
95314
|
logger.error(`Failed to migrate ${mapping.skillName}: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
95249
95315
|
}
|
|
95250
95316
|
}
|
|
95251
|
-
await
|
|
95317
|
+
await rm11(currentSkillsDir, { recursive: true, force: true });
|
|
95252
95318
|
await mkdir28(currentSkillsDir, { recursive: true });
|
|
95253
95319
|
await copySkillDirectory(tempDir, currentSkillsDir);
|
|
95254
|
-
await
|
|
95320
|
+
await rm11(tempDir, { recursive: true, force: true });
|
|
95255
95321
|
return { migrated, preserved, errors: errors2 };
|
|
95256
95322
|
} catch (error) {
|
|
95257
95323
|
try {
|
|
95258
|
-
await
|
|
95324
|
+
await rm11(tempDir, { recursive: true, force: true });
|
|
95259
95325
|
} catch {}
|
|
95260
95326
|
throw error;
|
|
95261
95327
|
}
|
|
@@ -95296,8 +95362,8 @@ function validateMigrationPath(path14, paramName) {
|
|
|
95296
95362
|
init_logger();
|
|
95297
95363
|
init_types3();
|
|
95298
95364
|
var import_fs_extra25 = __toESM(require_lib3(), 1);
|
|
95299
|
-
import { copyFile as copyFile7, mkdir as mkdir29, readdir as readdir27, rm as
|
|
95300
|
-
import { basename as basename15, join as
|
|
95365
|
+
import { copyFile as copyFile7, mkdir as mkdir29, readdir as readdir27, rm as rm12, stat as stat16 } from "node:fs/promises";
|
|
95366
|
+
import { basename as basename15, join as join102, normalize as normalize8 } from "node:path";
|
|
95301
95367
|
function validatePath2(path14, paramName) {
|
|
95302
95368
|
if (!path14 || typeof path14 !== "string") {
|
|
95303
95369
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -95323,7 +95389,7 @@ class SkillsBackupManager {
|
|
|
95323
95389
|
const timestamp = Date.now();
|
|
95324
95390
|
const randomSuffix = Math.random().toString(36).substring(2, 8);
|
|
95325
95391
|
const backupDirName = `${SkillsBackupManager.BACKUP_PREFIX}${timestamp}-${randomSuffix}`;
|
|
95326
|
-
const backupDir = parentDir ?
|
|
95392
|
+
const backupDir = parentDir ? join102(parentDir, backupDirName) : join102(skillsDir2, "..", backupDirName);
|
|
95327
95393
|
logger.info(`Creating backup at: ${backupDir}`);
|
|
95328
95394
|
try {
|
|
95329
95395
|
await mkdir29(backupDir, { recursive: true });
|
|
@@ -95332,7 +95398,7 @@ class SkillsBackupManager {
|
|
|
95332
95398
|
return backupDir;
|
|
95333
95399
|
} catch (error) {
|
|
95334
95400
|
try {
|
|
95335
|
-
await
|
|
95401
|
+
await rm12(backupDir, { recursive: true, force: true });
|
|
95336
95402
|
} catch {}
|
|
95337
95403
|
throw new SkillsMigrationError(`Failed to create backup: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
95338
95404
|
}
|
|
@@ -95346,7 +95412,7 @@ class SkillsBackupManager {
|
|
|
95346
95412
|
logger.info(`Restoring from backup: ${backupDir}`);
|
|
95347
95413
|
try {
|
|
95348
95414
|
if (await import_fs_extra25.pathExists(targetDir)) {
|
|
95349
|
-
await
|
|
95415
|
+
await rm12(targetDir, { recursive: true, force: true });
|
|
95350
95416
|
}
|
|
95351
95417
|
await mkdir29(targetDir, { recursive: true });
|
|
95352
95418
|
await SkillsBackupManager.copyDirectory(backupDir, targetDir);
|
|
@@ -95362,7 +95428,7 @@ class SkillsBackupManager {
|
|
|
95362
95428
|
}
|
|
95363
95429
|
logger.debug(`Deleting backup: ${backupDir}`);
|
|
95364
95430
|
try {
|
|
95365
|
-
await
|
|
95431
|
+
await rm12(backupDir, { recursive: true, force: true });
|
|
95366
95432
|
logger.debug("Backup deleted successfully");
|
|
95367
95433
|
} catch (error) {
|
|
95368
95434
|
logger.warning(`Failed to delete backup: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -95374,7 +95440,7 @@ class SkillsBackupManager {
|
|
|
95374
95440
|
}
|
|
95375
95441
|
try {
|
|
95376
95442
|
const entries = await readdir27(parentDir, { withFileTypes: true });
|
|
95377
|
-
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) =>
|
|
95443
|
+
const backups = entries.filter((entry) => entry.isDirectory() && entry.name.startsWith(SkillsBackupManager.BACKUP_PREFIX)).map((entry) => join102(parentDir, entry.name));
|
|
95378
95444
|
backups.sort().reverse();
|
|
95379
95445
|
return backups;
|
|
95380
95446
|
} catch (error) {
|
|
@@ -95402,8 +95468,8 @@ class SkillsBackupManager {
|
|
|
95402
95468
|
static async copyDirectory(sourceDir, destDir) {
|
|
95403
95469
|
const entries = await readdir27(sourceDir, { withFileTypes: true });
|
|
95404
95470
|
for (const entry of entries) {
|
|
95405
|
-
const sourcePath =
|
|
95406
|
-
const destPath =
|
|
95471
|
+
const sourcePath = join102(sourceDir, entry.name);
|
|
95472
|
+
const destPath = join102(destDir, entry.name);
|
|
95407
95473
|
if (entry.name.startsWith(".") || entry.name === "node_modules" || entry.isSymbolicLink()) {
|
|
95408
95474
|
continue;
|
|
95409
95475
|
}
|
|
@@ -95419,7 +95485,7 @@ class SkillsBackupManager {
|
|
|
95419
95485
|
let size = 0;
|
|
95420
95486
|
const entries = await readdir27(dirPath, { withFileTypes: true });
|
|
95421
95487
|
for (const entry of entries) {
|
|
95422
|
-
const fullPath =
|
|
95488
|
+
const fullPath = join102(dirPath, entry.name);
|
|
95423
95489
|
if (entry.isSymbolicLink()) {
|
|
95424
95490
|
continue;
|
|
95425
95491
|
}
|
|
@@ -95455,12 +95521,12 @@ init_skip_directories();
|
|
|
95455
95521
|
import { createHash as createHash5 } from "node:crypto";
|
|
95456
95522
|
import { createReadStream as createReadStream3 } from "node:fs";
|
|
95457
95523
|
import { readFile as readFile46, readdir as readdir28 } from "node:fs/promises";
|
|
95458
|
-
import { join as
|
|
95524
|
+
import { join as join103, relative as relative17 } from "node:path";
|
|
95459
95525
|
async function getAllFiles(dirPath) {
|
|
95460
95526
|
const files = [];
|
|
95461
95527
|
const entries = await readdir28(dirPath, { withFileTypes: true });
|
|
95462
95528
|
for (const entry of entries) {
|
|
95463
|
-
const fullPath =
|
|
95529
|
+
const fullPath = join103(dirPath, entry.name);
|
|
95464
95530
|
if (entry.name.startsWith(".") || BUILD_ARTIFACT_DIRS.includes(entry.name) || entry.isSymbolicLink()) {
|
|
95465
95531
|
continue;
|
|
95466
95532
|
}
|
|
@@ -95587,7 +95653,7 @@ async function detectFileChanges(currentSkillPath, baselineSkillPath) {
|
|
|
95587
95653
|
init_types3();
|
|
95588
95654
|
var import_fs_extra27 = __toESM(require_lib3(), 1);
|
|
95589
95655
|
import { readdir as readdir29 } from "node:fs/promises";
|
|
95590
|
-
import { join as
|
|
95656
|
+
import { join as join104, normalize as normalize9 } from "node:path";
|
|
95591
95657
|
function validatePath3(path14, paramName) {
|
|
95592
95658
|
if (!path14 || typeof path14 !== "string") {
|
|
95593
95659
|
throw new SkillsMigrationError(`${paramName} must be a non-empty string`);
|
|
@@ -95608,13 +95674,13 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
95608
95674
|
if (dirs.length === 0) {
|
|
95609
95675
|
return ["flat", []];
|
|
95610
95676
|
}
|
|
95611
|
-
const firstDirPath =
|
|
95677
|
+
const firstDirPath = join104(skillsDir2, dirs[0].name);
|
|
95612
95678
|
const subEntries = await readdir29(firstDirPath, { withFileTypes: true });
|
|
95613
95679
|
const subdirs = subEntries.filter((entry) => entry.isDirectory() && !entry.name.startsWith("."));
|
|
95614
95680
|
if (subdirs.length > 0) {
|
|
95615
95681
|
let skillLikeCount = 0;
|
|
95616
95682
|
for (const subdir of subdirs.slice(0, 3)) {
|
|
95617
|
-
const subdirPath =
|
|
95683
|
+
const subdirPath = join104(firstDirPath, subdir.name);
|
|
95618
95684
|
const subdirFiles = await readdir29(subdirPath, { withFileTypes: true });
|
|
95619
95685
|
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"));
|
|
95620
95686
|
if (hasSkillMarker) {
|
|
@@ -95624,7 +95690,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
95624
95690
|
if (skillLikeCount > 0) {
|
|
95625
95691
|
const skills = [];
|
|
95626
95692
|
for (const dir of dirs) {
|
|
95627
|
-
const categoryPath =
|
|
95693
|
+
const categoryPath = join104(skillsDir2, dir.name);
|
|
95628
95694
|
const skillDirs = await readdir29(categoryPath, { withFileTypes: true });
|
|
95629
95695
|
skills.push(...skillDirs.filter((entry) => entry.isDirectory() && !entry.name.startsWith(".")).map((entry) => entry.name));
|
|
95630
95696
|
}
|
|
@@ -95634,7 +95700,7 @@ async function scanSkillsDirectory(skillsDir2) {
|
|
|
95634
95700
|
return ["flat", dirs.map((dir) => dir.name)];
|
|
95635
95701
|
}
|
|
95636
95702
|
async function findSkillPath(skillsDir2, skillName) {
|
|
95637
|
-
const flatPath =
|
|
95703
|
+
const flatPath = join104(skillsDir2, skillName);
|
|
95638
95704
|
if (await import_fs_extra27.pathExists(flatPath)) {
|
|
95639
95705
|
return { path: flatPath, category: undefined };
|
|
95640
95706
|
}
|
|
@@ -95643,8 +95709,8 @@ async function findSkillPath(skillsDir2, skillName) {
|
|
|
95643
95709
|
if (!entry.isDirectory() || entry.name.startsWith(".") || entry.name === "node_modules") {
|
|
95644
95710
|
continue;
|
|
95645
95711
|
}
|
|
95646
|
-
const categoryPath =
|
|
95647
|
-
const skillPath =
|
|
95712
|
+
const categoryPath = join104(skillsDir2, entry.name);
|
|
95713
|
+
const skillPath = join104(categoryPath, skillName);
|
|
95648
95714
|
if (await import_fs_extra27.pathExists(skillPath)) {
|
|
95649
95715
|
return { path: skillPath, category: entry.name };
|
|
95650
95716
|
}
|
|
@@ -95738,7 +95804,7 @@ class SkillsMigrator {
|
|
|
95738
95804
|
}
|
|
95739
95805
|
}
|
|
95740
95806
|
if (options2.backup && !options2.dryRun) {
|
|
95741
|
-
const claudeDir2 =
|
|
95807
|
+
const claudeDir2 = join105(currentSkillsDir, "..");
|
|
95742
95808
|
result.backupPath = await SkillsBackupManager.createBackup(currentSkillsDir, claudeDir2);
|
|
95743
95809
|
logger.success(`Backup created at: ${result.backupPath}`);
|
|
95744
95810
|
}
|
|
@@ -95799,7 +95865,7 @@ async function handleMigration(ctx) {
|
|
|
95799
95865
|
logger.debug("Skipping skills migration (fresh installation)");
|
|
95800
95866
|
return ctx;
|
|
95801
95867
|
}
|
|
95802
|
-
const newSkillsDir =
|
|
95868
|
+
const newSkillsDir = join106(ctx.extractDir, ".claude", "skills");
|
|
95803
95869
|
const currentSkillsDir = PathResolver.buildSkillsPath(ctx.resolvedDir, ctx.options.global);
|
|
95804
95870
|
if (!await import_fs_extra28.pathExists(newSkillsDir) || !await import_fs_extra28.pathExists(currentSkillsDir)) {
|
|
95805
95871
|
return ctx;
|
|
@@ -95822,14 +95888,14 @@ async function handleMigration(ctx) {
|
|
|
95822
95888
|
return ctx;
|
|
95823
95889
|
}
|
|
95824
95890
|
// src/commands/init/phases/opencode-handler.ts
|
|
95825
|
-
import { cp as cp3, readdir as readdir31, rm as
|
|
95826
|
-
import { join as
|
|
95891
|
+
import { cp as cp3, readdir as readdir31, rm as rm13 } from "node:fs/promises";
|
|
95892
|
+
import { join as join108 } from "node:path";
|
|
95827
95893
|
|
|
95828
95894
|
// src/services/transformers/opencode-path-transformer.ts
|
|
95829
95895
|
init_logger();
|
|
95830
95896
|
import { readFile as readFile47, readdir as readdir30, writeFile as writeFile28 } from "node:fs/promises";
|
|
95831
95897
|
import { platform as platform12 } from "node:os";
|
|
95832
|
-
import { extname as extname6, join as
|
|
95898
|
+
import { extname as extname6, join as join107 } from "node:path";
|
|
95833
95899
|
var IS_WINDOWS2 = platform12() === "win32";
|
|
95834
95900
|
function getOpenCodeGlobalPath() {
|
|
95835
95901
|
return "$HOME/.config/opencode/";
|
|
@@ -95890,7 +95956,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
95890
95956
|
async function processDirectory2(dir) {
|
|
95891
95957
|
const entries = await readdir30(dir, { withFileTypes: true });
|
|
95892
95958
|
for (const entry of entries) {
|
|
95893
|
-
const fullPath =
|
|
95959
|
+
const fullPath = join107(dir, entry.name);
|
|
95894
95960
|
if (entry.isDirectory()) {
|
|
95895
95961
|
if (entry.name === "node_modules" || entry.name.startsWith(".")) {
|
|
95896
95962
|
continue;
|
|
@@ -95929,7 +95995,7 @@ async function handleOpenCode(ctx) {
|
|
|
95929
95995
|
if (ctx.cancelled || !ctx.extractDir || !ctx.resolvedDir) {
|
|
95930
95996
|
return ctx;
|
|
95931
95997
|
}
|
|
95932
|
-
const openCodeSource =
|
|
95998
|
+
const openCodeSource = join108(ctx.extractDir, ".opencode");
|
|
95933
95999
|
if (!await import_fs_extra29.pathExists(openCodeSource)) {
|
|
95934
96000
|
logger.debug("No .opencode directory in archive, skipping");
|
|
95935
96001
|
return ctx;
|
|
@@ -95947,8 +96013,8 @@ async function handleOpenCode(ctx) {
|
|
|
95947
96013
|
await import_fs_extra29.ensureDir(targetDir);
|
|
95948
96014
|
const entries = await readdir31(openCodeSource, { withFileTypes: true });
|
|
95949
96015
|
for (const entry of entries) {
|
|
95950
|
-
const sourcePath =
|
|
95951
|
-
const targetPath =
|
|
96016
|
+
const sourcePath = join108(openCodeSource, entry.name);
|
|
96017
|
+
const targetPath = join108(targetDir, entry.name);
|
|
95952
96018
|
if (await import_fs_extra29.pathExists(targetPath)) {
|
|
95953
96019
|
if (!ctx.options.forceOverwrite) {
|
|
95954
96020
|
logger.verbose(`Skipping existing: ${entry.name}`);
|
|
@@ -95958,7 +96024,7 @@ async function handleOpenCode(ctx) {
|
|
|
95958
96024
|
await cp3(sourcePath, targetPath, { recursive: true });
|
|
95959
96025
|
logger.verbose(`Copied: ${entry.name}`);
|
|
95960
96026
|
}
|
|
95961
|
-
await
|
|
96027
|
+
await rm13(openCodeSource, { recursive: true, force: true });
|
|
95962
96028
|
logger.success(`OpenCode config installed to ${targetDir}`);
|
|
95963
96029
|
} else {
|
|
95964
96030
|
logger.debug("Local mode: .opencode will be placed at project root");
|
|
@@ -96045,7 +96111,7 @@ Please use only one download method.`);
|
|
|
96045
96111
|
}
|
|
96046
96112
|
// src/commands/init/phases/post-install-handler.ts
|
|
96047
96113
|
init_projects_registry();
|
|
96048
|
-
import { join as
|
|
96114
|
+
import { join as join109 } from "node:path";
|
|
96049
96115
|
init_logger();
|
|
96050
96116
|
init_path_resolver();
|
|
96051
96117
|
var import_fs_extra30 = __toESM(require_lib3(), 1);
|
|
@@ -96164,8 +96230,8 @@ async function handlePostInstall(ctx) {
|
|
|
96164
96230
|
return ctx;
|
|
96165
96231
|
}
|
|
96166
96232
|
if (ctx.options.global) {
|
|
96167
|
-
const claudeMdSource =
|
|
96168
|
-
const claudeMdDest =
|
|
96233
|
+
const claudeMdSource = join109(ctx.extractDir, "CLAUDE.md");
|
|
96234
|
+
const claudeMdDest = join109(ctx.resolvedDir, "CLAUDE.md");
|
|
96169
96235
|
if (await import_fs_extra30.pathExists(claudeMdSource)) {
|
|
96170
96236
|
if (ctx.options.fresh || !await import_fs_extra30.pathExists(claudeMdDest)) {
|
|
96171
96237
|
await import_fs_extra30.copy(claudeMdSource, claudeMdDest);
|
|
@@ -96213,7 +96279,7 @@ async function handlePostInstall(ctx) {
|
|
|
96213
96279
|
}
|
|
96214
96280
|
if (!ctx.options.skipSetup) {
|
|
96215
96281
|
await promptSetupWizardIfNeeded({
|
|
96216
|
-
envPath:
|
|
96282
|
+
envPath: join109(ctx.claudeDir, ".env"),
|
|
96217
96283
|
claudeDir: ctx.claudeDir,
|
|
96218
96284
|
isGlobal: ctx.options.global,
|
|
96219
96285
|
isNonInteractive: ctx.isNonInteractive,
|
|
@@ -96238,7 +96304,7 @@ async function handlePostInstall(ctx) {
|
|
|
96238
96304
|
init_config_manager();
|
|
96239
96305
|
init_github_client();
|
|
96240
96306
|
import { mkdir as mkdir30 } from "node:fs/promises";
|
|
96241
|
-
import { join as
|
|
96307
|
+
import { join as join111, resolve as resolve23 } from "node:path";
|
|
96242
96308
|
|
|
96243
96309
|
// src/domains/github/kit-access-checker.ts
|
|
96244
96310
|
init_logger();
|
|
@@ -96369,7 +96435,7 @@ async function runPreflightChecks() {
|
|
|
96369
96435
|
// src/domains/installation/fresh-installer.ts
|
|
96370
96436
|
init_metadata_migration();
|
|
96371
96437
|
import { existsSync as existsSync57, readdirSync as readdirSync5, rmSync as rmSync4, rmdirSync as rmdirSync2, unlinkSync as unlinkSync4 } from "node:fs";
|
|
96372
|
-
import { dirname as dirname27, join as
|
|
96438
|
+
import { dirname as dirname27, join as join110, resolve as resolve22 } from "node:path";
|
|
96373
96439
|
init_logger();
|
|
96374
96440
|
init_safe_spinner();
|
|
96375
96441
|
var import_fs_extra31 = __toESM(require_lib3(), 1);
|
|
@@ -96442,7 +96508,7 @@ async function removeFilesByOwnership(claudeDir2, analysis, includeModified) {
|
|
|
96442
96508
|
const filesToRemove = includeModified ? [...analysis.ckFiles, ...analysis.ckModifiedFiles] : analysis.ckFiles;
|
|
96443
96509
|
const filesToPreserve = includeModified ? analysis.userFiles : [...analysis.ckModifiedFiles, ...analysis.userFiles];
|
|
96444
96510
|
for (const file of filesToRemove) {
|
|
96445
|
-
const fullPath =
|
|
96511
|
+
const fullPath = join110(claudeDir2, file.path);
|
|
96446
96512
|
try {
|
|
96447
96513
|
if (existsSync57(fullPath)) {
|
|
96448
96514
|
unlinkSync4(fullPath);
|
|
@@ -96467,7 +96533,7 @@ async function removeFilesByOwnership(claudeDir2, analysis, includeModified) {
|
|
|
96467
96533
|
};
|
|
96468
96534
|
}
|
|
96469
96535
|
async function updateMetadataAfterFresh(claudeDir2, removedFiles) {
|
|
96470
|
-
const metadataPath =
|
|
96536
|
+
const metadataPath = join110(claudeDir2, "metadata.json");
|
|
96471
96537
|
if (!await import_fs_extra31.pathExists(metadataPath)) {
|
|
96472
96538
|
return;
|
|
96473
96539
|
}
|
|
@@ -96510,7 +96576,7 @@ async function removeSubdirectoriesFallback(claudeDir2) {
|
|
|
96510
96576
|
const removedFiles = [];
|
|
96511
96577
|
let removedDirCount = 0;
|
|
96512
96578
|
for (const subdir of CLAUDEKIT_SUBDIRECTORIES) {
|
|
96513
|
-
const subdirPath =
|
|
96579
|
+
const subdirPath = join110(claudeDir2, subdir);
|
|
96514
96580
|
if (await import_fs_extra31.pathExists(subdirPath)) {
|
|
96515
96581
|
rmSync4(subdirPath, { recursive: true, force: true });
|
|
96516
96582
|
removedDirCount++;
|
|
@@ -96518,7 +96584,7 @@ async function removeSubdirectoriesFallback(claudeDir2) {
|
|
|
96518
96584
|
logger.debug(`Removed subdirectory: ${subdir}/`);
|
|
96519
96585
|
}
|
|
96520
96586
|
}
|
|
96521
|
-
const metadataPath =
|
|
96587
|
+
const metadataPath = join110(claudeDir2, "metadata.json");
|
|
96522
96588
|
if (await import_fs_extra31.pathExists(metadataPath)) {
|
|
96523
96589
|
unlinkSync4(metadataPath);
|
|
96524
96590
|
removedFiles.push("metadata.json");
|
|
@@ -96771,7 +96837,7 @@ async function handleSelection(ctx) {
|
|
|
96771
96837
|
}
|
|
96772
96838
|
if (!ctx.options.fresh) {
|
|
96773
96839
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
96774
|
-
const claudeDir2 = prefix ?
|
|
96840
|
+
const claudeDir2 = prefix ? join111(resolvedDir, prefix) : resolvedDir;
|
|
96775
96841
|
try {
|
|
96776
96842
|
const existingMetadata = await readManifest(claudeDir2);
|
|
96777
96843
|
if (existingMetadata?.kits) {
|
|
@@ -96803,7 +96869,7 @@ async function handleSelection(ctx) {
|
|
|
96803
96869
|
}
|
|
96804
96870
|
if (ctx.options.fresh) {
|
|
96805
96871
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
96806
|
-
const claudeDir2 = prefix ?
|
|
96872
|
+
const claudeDir2 = prefix ? join111(resolvedDir, prefix) : resolvedDir;
|
|
96807
96873
|
const canProceed = await handleFreshInstallation(claudeDir2, ctx.prompts);
|
|
96808
96874
|
if (!canProceed) {
|
|
96809
96875
|
return { ...ctx, cancelled: true };
|
|
@@ -96822,7 +96888,7 @@ async function handleSelection(ctx) {
|
|
|
96822
96888
|
logger.info("Fetching available versions...");
|
|
96823
96889
|
let currentVersion = null;
|
|
96824
96890
|
try {
|
|
96825
|
-
const metadataPath = ctx.options.global ?
|
|
96891
|
+
const metadataPath = ctx.options.global ? join111(PathResolver.getGlobalKitDir(), "metadata.json") : join111(resolvedDir, ".claude", "metadata.json");
|
|
96826
96892
|
const metadata = await readClaudeKitMetadata(metadataPath);
|
|
96827
96893
|
currentVersion = metadata?.version || null;
|
|
96828
96894
|
if (currentVersion) {
|
|
@@ -96888,7 +96954,7 @@ async function handleSelection(ctx) {
|
|
|
96888
96954
|
if (ctx.options.yes && !ctx.options.fresh && releaseTag && !isOfflineMode && !pendingKits?.length) {
|
|
96889
96955
|
try {
|
|
96890
96956
|
const prefix = PathResolver.getPathPrefix(ctx.options.global);
|
|
96891
|
-
const claudeDir2 = prefix ?
|
|
96957
|
+
const claudeDir2 = prefix ? join111(resolvedDir, prefix) : resolvedDir;
|
|
96892
96958
|
const existingMetadata = await readManifest(claudeDir2);
|
|
96893
96959
|
const installedKitVersion = existingMetadata?.kits?.[kitType]?.version;
|
|
96894
96960
|
if (installedKitVersion && versionsMatch(installedKitVersion, releaseTag)) {
|
|
@@ -96912,7 +96978,7 @@ async function handleSelection(ctx) {
|
|
|
96912
96978
|
}
|
|
96913
96979
|
// src/commands/init/phases/sync-handler.ts
|
|
96914
96980
|
import { copyFile as copyFile8, mkdir as mkdir31, open as open5, readFile as readFile49, rename as rename6, stat as stat17, unlink as unlink11, writeFile as writeFile30 } from "node:fs/promises";
|
|
96915
|
-
import { dirname as dirname28, join as
|
|
96981
|
+
import { dirname as dirname28, join as join112, resolve as resolve24 } from "node:path";
|
|
96916
96982
|
init_logger();
|
|
96917
96983
|
init_path_resolver();
|
|
96918
96984
|
var import_fs_extra33 = __toESM(require_lib3(), 1);
|
|
@@ -96922,13 +96988,13 @@ async function handleSync(ctx) {
|
|
|
96922
96988
|
return ctx;
|
|
96923
96989
|
}
|
|
96924
96990
|
const resolvedDir = ctx.options.global ? PathResolver.getGlobalKitDir() : resolve24(ctx.options.dir || ".");
|
|
96925
|
-
const claudeDir2 = ctx.options.global ? resolvedDir :
|
|
96991
|
+
const claudeDir2 = ctx.options.global ? resolvedDir : join112(resolvedDir, ".claude");
|
|
96926
96992
|
if (!await import_fs_extra33.pathExists(claudeDir2)) {
|
|
96927
96993
|
logger.error("Cannot sync: no .claude directory found");
|
|
96928
96994
|
ctx.prompts.note("Run 'ck init' without --sync to install first.", "No Installation Found");
|
|
96929
96995
|
return { ...ctx, cancelled: true };
|
|
96930
96996
|
}
|
|
96931
|
-
const metadataPath =
|
|
96997
|
+
const metadataPath = join112(claudeDir2, "metadata.json");
|
|
96932
96998
|
if (!await import_fs_extra33.pathExists(metadataPath)) {
|
|
96933
96999
|
logger.error("Cannot sync: no metadata.json found");
|
|
96934
97000
|
ctx.prompts.note(`Your installation may be from an older version.
|
|
@@ -97028,7 +97094,7 @@ function getLockTimeout() {
|
|
|
97028
97094
|
var STALE_LOCK_THRESHOLD_MS = 5 * 60 * 1000;
|
|
97029
97095
|
async function acquireSyncLock(global3) {
|
|
97030
97096
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
97031
|
-
const lockPath =
|
|
97097
|
+
const lockPath = join112(cacheDir, ".sync-lock");
|
|
97032
97098
|
const startTime = Date.now();
|
|
97033
97099
|
const lockTimeout = getLockTimeout();
|
|
97034
97100
|
await mkdir31(dirname28(lockPath), { recursive: true });
|
|
@@ -97074,10 +97140,10 @@ async function executeSyncMerge(ctx) {
|
|
|
97074
97140
|
const releaseLock = await acquireSyncLock(ctx.options.global);
|
|
97075
97141
|
try {
|
|
97076
97142
|
const trackedFiles = ctx.syncTrackedFiles;
|
|
97077
|
-
const upstreamDir = ctx.options.global ?
|
|
97143
|
+
const upstreamDir = ctx.options.global ? join112(ctx.extractDir, ".claude") : ctx.extractDir;
|
|
97078
97144
|
let deletions = [];
|
|
97079
97145
|
try {
|
|
97080
|
-
const sourceMetadataPath =
|
|
97146
|
+
const sourceMetadataPath = join112(upstreamDir, "metadata.json");
|
|
97081
97147
|
if (await import_fs_extra33.pathExists(sourceMetadataPath)) {
|
|
97082
97148
|
const content = await readFile49(sourceMetadataPath, "utf-8");
|
|
97083
97149
|
const sourceMetadata = JSON.parse(content);
|
|
@@ -97109,7 +97175,7 @@ async function executeSyncMerge(ctx) {
|
|
|
97109
97175
|
try {
|
|
97110
97176
|
const sourcePath = await validateSyncPath(upstreamDir, file.path);
|
|
97111
97177
|
const targetPath = await validateSyncPath(ctx.claudeDir, file.path);
|
|
97112
|
-
const targetDir =
|
|
97178
|
+
const targetDir = join112(targetPath, "..");
|
|
97113
97179
|
try {
|
|
97114
97180
|
await mkdir31(targetDir, { recursive: true });
|
|
97115
97181
|
} catch (mkdirError) {
|
|
@@ -97280,7 +97346,7 @@ async function createBackup(claudeDir2, files, backupDir) {
|
|
|
97280
97346
|
const sourcePath = await validateSyncPath(claudeDir2, file.path);
|
|
97281
97347
|
if (await import_fs_extra33.pathExists(sourcePath)) {
|
|
97282
97348
|
const targetPath = await validateSyncPath(backupDir, file.path);
|
|
97283
|
-
const targetDir =
|
|
97349
|
+
const targetDir = join112(targetPath, "..");
|
|
97284
97350
|
await mkdir31(targetDir, { recursive: true });
|
|
97285
97351
|
await copyFile8(sourcePath, targetPath);
|
|
97286
97352
|
}
|
|
@@ -97295,7 +97361,7 @@ async function createBackup(claudeDir2, files, backupDir) {
|
|
|
97295
97361
|
}
|
|
97296
97362
|
// src/commands/init/phases/transform-handler.ts
|
|
97297
97363
|
init_config_manager();
|
|
97298
|
-
import { join as
|
|
97364
|
+
import { join as join116 } from "node:path";
|
|
97299
97365
|
|
|
97300
97366
|
// src/services/transformers/folder-path-transformer.ts
|
|
97301
97367
|
init_logger();
|
|
@@ -97305,39 +97371,39 @@ init_types3();
|
|
|
97305
97371
|
init_logger();
|
|
97306
97372
|
init_types3();
|
|
97307
97373
|
var import_fs_extra34 = __toESM(require_lib3(), 1);
|
|
97308
|
-
import { rename as rename7, rm as
|
|
97309
|
-
import { join as
|
|
97374
|
+
import { rename as rename7, rm as rm14 } from "node:fs/promises";
|
|
97375
|
+
import { join as join113, relative as relative19 } from "node:path";
|
|
97310
97376
|
async function collectDirsToRename(extractDir, folders) {
|
|
97311
97377
|
const dirsToRename = [];
|
|
97312
97378
|
if (folders.docs !== DEFAULT_FOLDERS.docs) {
|
|
97313
|
-
const docsPath =
|
|
97379
|
+
const docsPath = join113(extractDir, DEFAULT_FOLDERS.docs);
|
|
97314
97380
|
if (await import_fs_extra34.pathExists(docsPath)) {
|
|
97315
97381
|
dirsToRename.push({
|
|
97316
97382
|
from: docsPath,
|
|
97317
|
-
to:
|
|
97383
|
+
to: join113(extractDir, folders.docs)
|
|
97318
97384
|
});
|
|
97319
97385
|
}
|
|
97320
|
-
const claudeDocsPath =
|
|
97386
|
+
const claudeDocsPath = join113(extractDir, ".claude", DEFAULT_FOLDERS.docs);
|
|
97321
97387
|
if (await import_fs_extra34.pathExists(claudeDocsPath)) {
|
|
97322
97388
|
dirsToRename.push({
|
|
97323
97389
|
from: claudeDocsPath,
|
|
97324
|
-
to:
|
|
97390
|
+
to: join113(extractDir, ".claude", folders.docs)
|
|
97325
97391
|
});
|
|
97326
97392
|
}
|
|
97327
97393
|
}
|
|
97328
97394
|
if (folders.plans !== DEFAULT_FOLDERS.plans) {
|
|
97329
|
-
const plansPath =
|
|
97395
|
+
const plansPath = join113(extractDir, DEFAULT_FOLDERS.plans);
|
|
97330
97396
|
if (await import_fs_extra34.pathExists(plansPath)) {
|
|
97331
97397
|
dirsToRename.push({
|
|
97332
97398
|
from: plansPath,
|
|
97333
|
-
to:
|
|
97399
|
+
to: join113(extractDir, folders.plans)
|
|
97334
97400
|
});
|
|
97335
97401
|
}
|
|
97336
|
-
const claudePlansPath =
|
|
97402
|
+
const claudePlansPath = join113(extractDir, ".claude", DEFAULT_FOLDERS.plans);
|
|
97337
97403
|
if (await import_fs_extra34.pathExists(claudePlansPath)) {
|
|
97338
97404
|
dirsToRename.push({
|
|
97339
97405
|
from: claudePlansPath,
|
|
97340
|
-
to:
|
|
97406
|
+
to: join113(extractDir, ".claude", folders.plans)
|
|
97341
97407
|
});
|
|
97342
97408
|
}
|
|
97343
97409
|
}
|
|
@@ -97350,7 +97416,7 @@ async function moveAcrossDevices(src, dest) {
|
|
|
97350
97416
|
if (e2.code === "EXDEV") {
|
|
97351
97417
|
logger.debug(`Cross-device move detected, using copy+delete: ${src} -> ${dest}`);
|
|
97352
97418
|
await import_fs_extra34.copy(src, dest, { overwrite: true });
|
|
97353
|
-
await
|
|
97419
|
+
await rm14(src, { recursive: true, force: true });
|
|
97354
97420
|
} else {
|
|
97355
97421
|
throw e2;
|
|
97356
97422
|
}
|
|
@@ -97378,7 +97444,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
97378
97444
|
init_logger();
|
|
97379
97445
|
init_types3();
|
|
97380
97446
|
import { readFile as readFile50, readdir as readdir32, writeFile as writeFile31 } from "node:fs/promises";
|
|
97381
|
-
import { join as
|
|
97447
|
+
import { join as join114, relative as relative20 } from "node:path";
|
|
97382
97448
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
97383
97449
|
".md",
|
|
97384
97450
|
".txt",
|
|
@@ -97431,7 +97497,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
97431
97497
|
let replacementsCount = 0;
|
|
97432
97498
|
const entries = await readdir32(dir, { withFileTypes: true });
|
|
97433
97499
|
for (const entry of entries) {
|
|
97434
|
-
const fullPath =
|
|
97500
|
+
const fullPath = join114(dir, entry.name);
|
|
97435
97501
|
if (entry.isDirectory()) {
|
|
97436
97502
|
if (entry.name === "node_modules" || entry.name === ".git") {
|
|
97437
97503
|
continue;
|
|
@@ -97568,7 +97634,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
97568
97634
|
init_logger();
|
|
97569
97635
|
import { readFile as readFile51, readdir as readdir33, writeFile as writeFile32 } from "node:fs/promises";
|
|
97570
97636
|
import { platform as platform13 } from "node:os";
|
|
97571
|
-
import { extname as extname7, join as
|
|
97637
|
+
import { extname as extname7, join as join115 } from "node:path";
|
|
97572
97638
|
var IS_WINDOWS3 = platform13() === "win32";
|
|
97573
97639
|
var HOME_PREFIX = IS_WINDOWS3 ? "%USERPROFILE%" : "$HOME";
|
|
97574
97640
|
function getHomeDirPrefix() {
|
|
@@ -97678,7 +97744,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
97678
97744
|
async function processDirectory2(dir) {
|
|
97679
97745
|
const entries = await readdir33(dir, { withFileTypes: true });
|
|
97680
97746
|
for (const entry of entries) {
|
|
97681
|
-
const fullPath =
|
|
97747
|
+
const fullPath = join115(dir, entry.name);
|
|
97682
97748
|
if (entry.isDirectory()) {
|
|
97683
97749
|
if (entry.name === "node_modules" || entry.name.startsWith(".") && entry.name !== ".claude") {
|
|
97684
97750
|
continue;
|
|
@@ -97754,7 +97820,7 @@ async function handleTransforms(ctx) {
|
|
|
97754
97820
|
logger.debug(ctx.options.global ? "Saved folder configuration to ~/.claude/.ck.json" : "Saved folder configuration to .claude/.ck.json");
|
|
97755
97821
|
}
|
|
97756
97822
|
}
|
|
97757
|
-
const claudeDir2 = ctx.options.global ? ctx.resolvedDir :
|
|
97823
|
+
const claudeDir2 = ctx.options.global ? ctx.resolvedDir : join116(ctx.resolvedDir, ".claude");
|
|
97758
97824
|
return {
|
|
97759
97825
|
...ctx,
|
|
97760
97826
|
foldersConfig,
|
|
@@ -97943,9 +98009,9 @@ async function initCommand(options2) {
|
|
|
97943
98009
|
init_dist2();
|
|
97944
98010
|
var import_picocolors28 = __toESM(require_picocolors(), 1);
|
|
97945
98011
|
import { existsSync as existsSync58 } from "node:fs";
|
|
97946
|
-
import { readFile as readFile52, rm as
|
|
97947
|
-
import { homedir as
|
|
97948
|
-
import { basename as basename16, join as
|
|
98012
|
+
import { readFile as readFile52, rm as rm15, unlink as unlink12 } from "node:fs/promises";
|
|
98013
|
+
import { homedir as homedir31 } from "node:os";
|
|
98014
|
+
import { basename as basename16, join as join117, resolve as resolve25 } from "node:path";
|
|
97949
98015
|
init_logger();
|
|
97950
98016
|
init_agents_discovery();
|
|
97951
98017
|
init_commands_discovery();
|
|
@@ -98346,7 +98412,7 @@ async function executeDeleteAction(action, options2) {
|
|
|
98346
98412
|
const shouldPreserveTarget = action.targetPath.length > 0 && preservePaths.has(resolve25(action.targetPath));
|
|
98347
98413
|
try {
|
|
98348
98414
|
if (!shouldPreserveTarget && action.targetPath && existsSync58(action.targetPath)) {
|
|
98349
|
-
await
|
|
98415
|
+
await rm15(action.targetPath, { recursive: true, force: true });
|
|
98350
98416
|
}
|
|
98351
98417
|
await removePortableInstallation(action.item, action.type, action.provider, action.global);
|
|
98352
98418
|
return {
|
|
@@ -98370,7 +98436,7 @@ async function executeDeleteAction(action, options2) {
|
|
|
98370
98436
|
async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
98371
98437
|
if (!skillSourcePath)
|
|
98372
98438
|
return;
|
|
98373
|
-
const sourceMetadataPath =
|
|
98439
|
+
const sourceMetadataPath = join117(resolve25(skillSourcePath, ".."), "metadata.json");
|
|
98374
98440
|
if (!existsSync58(sourceMetadataPath))
|
|
98375
98441
|
return;
|
|
98376
98442
|
let sourceMetadata;
|
|
@@ -98383,7 +98449,7 @@ async function processMetadataDeletions(skillSourcePath, installGlobally) {
|
|
|
98383
98449
|
}
|
|
98384
98450
|
if (!sourceMetadata.deletions || sourceMetadata.deletions.length === 0)
|
|
98385
98451
|
return;
|
|
98386
|
-
const claudeDir2 = installGlobally ?
|
|
98452
|
+
const claudeDir2 = installGlobally ? join117(homedir31(), ".claude") : join117(process.cwd(), ".claude");
|
|
98387
98453
|
if (!existsSync58(claudeDir2))
|
|
98388
98454
|
return;
|
|
98389
98455
|
try {
|
|
@@ -98531,8 +98597,8 @@ async function migrateCommand(options2) {
|
|
|
98531
98597
|
selectedProviders = Array.from(new Set(selectedProviders));
|
|
98532
98598
|
let installGlobally = options2.global ?? false;
|
|
98533
98599
|
if (options2.global === undefined && !options2.yes) {
|
|
98534
|
-
const projectTarget =
|
|
98535
|
-
const globalTarget =
|
|
98600
|
+
const projectTarget = join117(process.cwd(), ".claude");
|
|
98601
|
+
const globalTarget = join117(homedir31(), ".claude");
|
|
98536
98602
|
const scopeChoice = await ie({
|
|
98537
98603
|
message: "Installation scope",
|
|
98538
98604
|
options: [
|
|
@@ -98584,7 +98650,7 @@ async function migrateCommand(options2) {
|
|
|
98584
98650
|
}
|
|
98585
98651
|
const providerNames = selectedProviders.map((prov) => import_picocolors28.default.cyan(providers[prov].displayName)).join(", ");
|
|
98586
98652
|
f2.message(` Providers: ${providerNames}`);
|
|
98587
|
-
const targetDir = installGlobally ?
|
|
98653
|
+
const targetDir = installGlobally ? join117(homedir31(), ".claude") : join117(process.cwd(), ".claude");
|
|
98588
98654
|
f2.message(` Scope: ${installGlobally ? "Global" : "Project"} ${import_picocolors28.default.dim(`-> ${targetDir}`)}`);
|
|
98589
98655
|
const cmdProviders = getProvidersSupporting("commands");
|
|
98590
98656
|
const unsupportedCmd = selectedProviders.filter((pv) => !cmdProviders.includes(pv));
|
|
@@ -98845,7 +98911,7 @@ async function rollbackResults(results) {
|
|
|
98845
98911
|
continue;
|
|
98846
98912
|
const stat18 = await import("node:fs/promises").then((fs19) => fs19.stat(result.path));
|
|
98847
98913
|
if (stat18.isDirectory()) {
|
|
98848
|
-
await
|
|
98914
|
+
await rm15(result.path, { recursive: true, force: true });
|
|
98849
98915
|
} else {
|
|
98850
98916
|
await unlink12(result.path);
|
|
98851
98917
|
}
|
|
@@ -99080,7 +99146,7 @@ async function handleDirectorySetup(ctx) {
|
|
|
99080
99146
|
// src/commands/new/phases/project-creation.ts
|
|
99081
99147
|
init_config_manager();
|
|
99082
99148
|
init_github_client();
|
|
99083
|
-
import { join as
|
|
99149
|
+
import { join as join118 } from "node:path";
|
|
99084
99150
|
init_logger();
|
|
99085
99151
|
init_output_manager();
|
|
99086
99152
|
init_types3();
|
|
@@ -99206,7 +99272,7 @@ async function projectCreation(kit, resolvedDir, validOptions, isNonInteractive2
|
|
|
99206
99272
|
output.section("Installing");
|
|
99207
99273
|
logger.verbose("Installation target", { directory: resolvedDir });
|
|
99208
99274
|
const merger = new FileMerger;
|
|
99209
|
-
const claudeDir2 =
|
|
99275
|
+
const claudeDir2 = join118(resolvedDir, ".claude");
|
|
99210
99276
|
merger.setMultiKitContext(claudeDir2, kit);
|
|
99211
99277
|
if (validOptions.exclude && validOptions.exclude.length > 0) {
|
|
99212
99278
|
merger.addIgnorePatterns(validOptions.exclude);
|
|
@@ -99253,7 +99319,7 @@ async function handleProjectCreation(ctx) {
|
|
|
99253
99319
|
}
|
|
99254
99320
|
// src/commands/new/phases/post-setup.ts
|
|
99255
99321
|
init_projects_registry();
|
|
99256
|
-
import { join as
|
|
99322
|
+
import { join as join119 } from "node:path";
|
|
99257
99323
|
init_package_installer();
|
|
99258
99324
|
init_logger();
|
|
99259
99325
|
init_path_resolver();
|
|
@@ -99285,9 +99351,9 @@ async function postSetup(resolvedDir, validOptions, isNonInteractive2, prompts)
|
|
|
99285
99351
|
withSudo: validOptions.withSudo
|
|
99286
99352
|
});
|
|
99287
99353
|
}
|
|
99288
|
-
const claudeDir2 =
|
|
99354
|
+
const claudeDir2 = join119(resolvedDir, ".claude");
|
|
99289
99355
|
await promptSetupWizardIfNeeded({
|
|
99290
|
-
envPath:
|
|
99356
|
+
envPath: join119(claudeDir2, ".env"),
|
|
99291
99357
|
claudeDir: claudeDir2,
|
|
99292
99358
|
isGlobal: false,
|
|
99293
99359
|
isNonInteractive: isNonInteractive2,
|
|
@@ -99357,7 +99423,7 @@ Please use only one download method.`);
|
|
|
99357
99423
|
// src/commands/plan/plan-command.ts
|
|
99358
99424
|
init_output_manager();
|
|
99359
99425
|
import { existsSync as existsSync60, statSync as statSync8 } from "node:fs";
|
|
99360
|
-
import { dirname as dirname30, join as
|
|
99426
|
+
import { dirname as dirname30, join as join121, parse as parse6, resolve as resolve29 } from "node:path";
|
|
99361
99427
|
|
|
99362
99428
|
// src/commands/plan/plan-read-handlers.ts
|
|
99363
99429
|
init_plan_parser();
|
|
@@ -99365,7 +99431,7 @@ init_logger();
|
|
|
99365
99431
|
init_output_manager();
|
|
99366
99432
|
var import_picocolors30 = __toESM(require_picocolors(), 1);
|
|
99367
99433
|
import { existsSync as existsSync59, statSync as statSync7 } from "node:fs";
|
|
99368
|
-
import { basename as basename17, dirname as dirname29, join as
|
|
99434
|
+
import { basename as basename17, dirname as dirname29, join as join120, relative as relative21, resolve as resolve27 } from "node:path";
|
|
99369
99435
|
async function handleParse(target, options2) {
|
|
99370
99436
|
const planFile = resolvePlanFile(target);
|
|
99371
99437
|
if (!planFile) {
|
|
@@ -99441,7 +99507,7 @@ async function handleValidate(target, options2) {
|
|
|
99441
99507
|
}
|
|
99442
99508
|
async function handleStatus(target, options2) {
|
|
99443
99509
|
const t = target ? resolve27(target) : null;
|
|
99444
|
-
const plansDir = t && existsSync59(t) && statSync7(t).isDirectory() && !existsSync59(
|
|
99510
|
+
const plansDir = t && existsSync59(t) && statSync7(t).isDirectory() && !existsSync59(join120(t, "plan.md")) ? t : null;
|
|
99445
99511
|
if (plansDir) {
|
|
99446
99512
|
const planFiles = scanPlanDir(plansDir);
|
|
99447
99513
|
if (planFiles.length === 0) {
|
|
@@ -99713,7 +99779,7 @@ function resolvePlanFile(target) {
|
|
|
99713
99779
|
const stat18 = statSync8(t);
|
|
99714
99780
|
if (stat18.isFile())
|
|
99715
99781
|
return t;
|
|
99716
|
-
const candidate =
|
|
99782
|
+
const candidate = join121(t, "plan.md");
|
|
99717
99783
|
if (existsSync60(candidate))
|
|
99718
99784
|
return candidate;
|
|
99719
99785
|
}
|
|
@@ -99721,7 +99787,7 @@ function resolvePlanFile(target) {
|
|
|
99721
99787
|
let dir = process.cwd();
|
|
99722
99788
|
const root = parse6(dir).root;
|
|
99723
99789
|
while (dir !== root) {
|
|
99724
|
-
const candidate =
|
|
99790
|
+
const candidate = join121(dir, "plan.md");
|
|
99725
99791
|
if (existsSync60(candidate))
|
|
99726
99792
|
return candidate;
|
|
99727
99793
|
dir = dirname30(dir);
|
|
@@ -100748,7 +100814,7 @@ async function detectInstallations() {
|
|
|
100748
100814
|
|
|
100749
100815
|
// src/commands/uninstall/removal-handler.ts
|
|
100750
100816
|
import { readdirSync as readdirSync7, rmSync as rmSync6 } from "node:fs";
|
|
100751
|
-
import { join as
|
|
100817
|
+
import { join as join123, resolve as resolve31, sep as sep8 } from "node:path";
|
|
100752
100818
|
init_logger();
|
|
100753
100819
|
init_safe_prompts();
|
|
100754
100820
|
init_safe_spinner();
|
|
@@ -100757,7 +100823,7 @@ var import_fs_extra37 = __toESM(require_lib3(), 1);
|
|
|
100757
100823
|
// src/commands/uninstall/analysis-handler.ts
|
|
100758
100824
|
init_metadata_migration();
|
|
100759
100825
|
import { readdirSync as readdirSync6, rmSync as rmSync5 } from "node:fs";
|
|
100760
|
-
import { dirname as dirname31, join as
|
|
100826
|
+
import { dirname as dirname31, join as join122 } from "node:path";
|
|
100761
100827
|
init_logger();
|
|
100762
100828
|
init_safe_prompts();
|
|
100763
100829
|
var import_picocolors36 = __toESM(require_picocolors(), 1);
|
|
@@ -100805,7 +100871,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
100805
100871
|
if (uninstallManifest.isMultiKit && kit && metadata?.kits?.[kit]) {
|
|
100806
100872
|
const kitFiles = metadata.kits[kit].files || [];
|
|
100807
100873
|
for (const trackedFile of kitFiles) {
|
|
100808
|
-
const filePath =
|
|
100874
|
+
const filePath = join122(installation.path, trackedFile.path);
|
|
100809
100875
|
if (uninstallManifest.filesToPreserve.includes(trackedFile.path)) {
|
|
100810
100876
|
result.toPreserve.push({ path: trackedFile.path, reason: "shared with other kit" });
|
|
100811
100877
|
continue;
|
|
@@ -100835,7 +100901,7 @@ async function analyzeInstallation(installation, forceOverwrite, kit) {
|
|
|
100835
100901
|
return result;
|
|
100836
100902
|
}
|
|
100837
100903
|
for (const trackedFile of allTrackedFiles) {
|
|
100838
|
-
const filePath =
|
|
100904
|
+
const filePath = join122(installation.path, trackedFile.path);
|
|
100839
100905
|
const ownershipResult = await OwnershipChecker.checkOwnership(filePath, metadata, installation.path);
|
|
100840
100906
|
if (!ownershipResult.exists)
|
|
100841
100907
|
continue;
|
|
@@ -100891,7 +100957,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
|
|
|
100891
100957
|
try {
|
|
100892
100958
|
const resolvedPath = resolve31(filePath);
|
|
100893
100959
|
const resolvedBase = resolve31(baseDir);
|
|
100894
|
-
if (!resolvedPath.startsWith(resolvedBase +
|
|
100960
|
+
if (!resolvedPath.startsWith(resolvedBase + sep8) && resolvedPath !== resolvedBase) {
|
|
100895
100961
|
logger.debug(`Path outside installation directory: ${filePath}`);
|
|
100896
100962
|
return false;
|
|
100897
100963
|
}
|
|
@@ -100899,7 +100965,7 @@ async function isPathSafeToRemove(filePath, baseDir) {
|
|
|
100899
100965
|
if (stats.isSymbolicLink()) {
|
|
100900
100966
|
const realPath = await import_fs_extra37.realpath(filePath);
|
|
100901
100967
|
const resolvedReal = resolve31(realPath);
|
|
100902
|
-
if (!resolvedReal.startsWith(resolvedBase +
|
|
100968
|
+
if (!resolvedReal.startsWith(resolvedBase + sep8) && resolvedReal !== resolvedBase) {
|
|
100903
100969
|
logger.debug(`Symlink points outside installation directory: ${filePath} -> ${realPath}`);
|
|
100904
100970
|
return false;
|
|
100905
100971
|
}
|
|
@@ -100932,7 +100998,7 @@ async function removeInstallations(installations, options2) {
|
|
|
100932
100998
|
let removedCount = 0;
|
|
100933
100999
|
let cleanedDirs = 0;
|
|
100934
101000
|
for (const item of analysis.toDelete) {
|
|
100935
|
-
const filePath =
|
|
101001
|
+
const filePath = join123(installation.path, item.path);
|
|
100936
101002
|
if (!await import_fs_extra37.pathExists(filePath))
|
|
100937
101003
|
continue;
|
|
100938
101004
|
if (!await isPathSafeToRemove(filePath, installation.path)) {
|
|
@@ -101234,9 +101300,9 @@ ${import_picocolors38.default.bold(import_picocolors38.default.cyan(result.kitCo
|
|
|
101234
101300
|
// src/commands/watch/watch-command.ts
|
|
101235
101301
|
init_logger();
|
|
101236
101302
|
import { existsSync as existsSync67 } from "node:fs";
|
|
101237
|
-
import { rm as
|
|
101238
|
-
import { homedir as
|
|
101239
|
-
import { join as
|
|
101303
|
+
import { rm as rm16 } from "node:fs/promises";
|
|
101304
|
+
import { homedir as homedir33 } from "node:os";
|
|
101305
|
+
import { join as join130 } from "node:path";
|
|
101240
101306
|
var import_picocolors39 = __toESM(require_picocolors(), 1);
|
|
101241
101307
|
|
|
101242
101308
|
// src/commands/watch/phases/implementation-runner.ts
|
|
@@ -101755,7 +101821,7 @@ function spawnAndCollect3(command, args) {
|
|
|
101755
101821
|
|
|
101756
101822
|
// src/commands/watch/phases/issue-processor.ts
|
|
101757
101823
|
import { mkdir as mkdir32, writeFile as writeFile34 } from "node:fs/promises";
|
|
101758
|
-
import { join as
|
|
101824
|
+
import { join as join126 } from "node:path";
|
|
101759
101825
|
|
|
101760
101826
|
// src/commands/watch/phases/approval-detector.ts
|
|
101761
101827
|
init_logger();
|
|
@@ -102130,9 +102196,9 @@ async function checkAwaitingApproval(state, setup, options2, watchLog, projectDi
|
|
|
102130
102196
|
|
|
102131
102197
|
// src/commands/watch/phases/plan-dir-finder.ts
|
|
102132
102198
|
import { readdir as readdir35, stat as stat18 } from "node:fs/promises";
|
|
102133
|
-
import { join as
|
|
102199
|
+
import { join as join125 } from "node:path";
|
|
102134
102200
|
async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
102135
|
-
const plansRoot =
|
|
102201
|
+
const plansRoot = join125(cwd2, "plans");
|
|
102136
102202
|
try {
|
|
102137
102203
|
const entries = await readdir35(plansRoot);
|
|
102138
102204
|
const tenMinAgo = Date.now() - 10 * 60 * 1000;
|
|
@@ -102141,14 +102207,14 @@ async function findRecentPlanDir(cwd2, issueNumber, watchLog) {
|
|
|
102141
102207
|
for (const entry of entries) {
|
|
102142
102208
|
if (entry === "watch" || entry === "reports" || entry === "visuals")
|
|
102143
102209
|
continue;
|
|
102144
|
-
const dirPath =
|
|
102210
|
+
const dirPath = join125(plansRoot, entry);
|
|
102145
102211
|
const dirStat = await stat18(dirPath);
|
|
102146
102212
|
if (!dirStat.isDirectory())
|
|
102147
102213
|
continue;
|
|
102148
102214
|
if (dirStat.mtimeMs < tenMinAgo)
|
|
102149
102215
|
continue;
|
|
102150
102216
|
try {
|
|
102151
|
-
await stat18(
|
|
102217
|
+
await stat18(join125(dirPath, "plan.md"));
|
|
102152
102218
|
} catch {
|
|
102153
102219
|
continue;
|
|
102154
102220
|
}
|
|
@@ -102379,13 +102445,13 @@ async function handlePlanGeneration(issue, state, config, setup, options2, watch
|
|
|
102379
102445
|
stats.plansCreated++;
|
|
102380
102446
|
const detectedPlanDir = await findRecentPlanDir(projectDir, issue.number, watchLog);
|
|
102381
102447
|
if (detectedPlanDir) {
|
|
102382
|
-
state.activeIssues[numStr].planPath =
|
|
102448
|
+
state.activeIssues[numStr].planPath = join126(detectedPlanDir, "plan.md");
|
|
102383
102449
|
watchLog.info(`Plan directory detected: ${detectedPlanDir}`);
|
|
102384
102450
|
} else {
|
|
102385
102451
|
try {
|
|
102386
|
-
const planDir =
|
|
102452
|
+
const planDir = join126(projectDir, "plans", "watch");
|
|
102387
102453
|
await mkdir32(planDir, { recursive: true });
|
|
102388
|
-
const planFilePath =
|
|
102454
|
+
const planFilePath = join126(planDir, `issue-${issue.number}-plan.md`);
|
|
102389
102455
|
await writeFile34(planFilePath, planResult.planText, "utf-8");
|
|
102390
102456
|
state.activeIssues[numStr].planPath = planFilePath;
|
|
102391
102457
|
watchLog.info(`Plan saved (fallback) to ${planFilePath}`);
|
|
@@ -102692,18 +102758,18 @@ init_logger();
|
|
|
102692
102758
|
import { spawnSync as spawnSync6 } from "node:child_process";
|
|
102693
102759
|
import { existsSync as existsSync64 } from "node:fs";
|
|
102694
102760
|
import { readdir as readdir36, stat as stat19 } from "node:fs/promises";
|
|
102695
|
-
import { join as
|
|
102761
|
+
import { join as join127 } from "node:path";
|
|
102696
102762
|
async function scanForRepos(parentDir) {
|
|
102697
102763
|
const repos = [];
|
|
102698
102764
|
const entries = await readdir36(parentDir);
|
|
102699
102765
|
for (const entry of entries) {
|
|
102700
102766
|
if (entry.startsWith("."))
|
|
102701
102767
|
continue;
|
|
102702
|
-
const fullPath =
|
|
102768
|
+
const fullPath = join127(parentDir, entry);
|
|
102703
102769
|
const entryStat = await stat19(fullPath);
|
|
102704
102770
|
if (!entryStat.isDirectory())
|
|
102705
102771
|
continue;
|
|
102706
|
-
const gitDir =
|
|
102772
|
+
const gitDir = join127(fullPath, ".git");
|
|
102707
102773
|
if (!existsSync64(gitDir))
|
|
102708
102774
|
continue;
|
|
102709
102775
|
const result = spawnSync6("gh", ["repo", "view", "--json", "owner,name"], {
|
|
@@ -102729,8 +102795,8 @@ async function scanForRepos(parentDir) {
|
|
|
102729
102795
|
init_logger();
|
|
102730
102796
|
import { spawnSync as spawnSync7 } from "node:child_process";
|
|
102731
102797
|
import { existsSync as existsSync65 } from "node:fs";
|
|
102732
|
-
import { homedir as
|
|
102733
|
-
import { join as
|
|
102798
|
+
import { homedir as homedir32 } from "node:os";
|
|
102799
|
+
import { join as join128 } from "node:path";
|
|
102734
102800
|
async function validateSetup(cwd2) {
|
|
102735
102801
|
const workDir = cwd2 ?? process.cwd();
|
|
102736
102802
|
const ghVersion = spawnSync7("gh", ["--version"], { encoding: "utf-8", timeout: 1e4 });
|
|
@@ -102761,7 +102827,7 @@ Run this command from a directory with a GitHub remote.`);
|
|
|
102761
102827
|
} catch {
|
|
102762
102828
|
throw new Error(`Failed to parse repository info: ${ghRepo.stdout}`);
|
|
102763
102829
|
}
|
|
102764
|
-
const skillsPath =
|
|
102830
|
+
const skillsPath = join128(homedir32(), ".claude", "skills");
|
|
102765
102831
|
const skillsAvailable = existsSync65(skillsPath);
|
|
102766
102832
|
if (!skillsAvailable) {
|
|
102767
102833
|
logger.warning(`ClaudeKit Engineer skills not found at ${skillsPath}`);
|
|
@@ -102780,7 +102846,7 @@ init_path_resolver();
|
|
|
102780
102846
|
import { createWriteStream as createWriteStream3, statSync as statSync9 } from "node:fs";
|
|
102781
102847
|
import { existsSync as existsSync66 } from "node:fs";
|
|
102782
102848
|
import { mkdir as mkdir34, rename as rename8 } from "node:fs/promises";
|
|
102783
|
-
import { join as
|
|
102849
|
+
import { join as join129 } from "node:path";
|
|
102784
102850
|
|
|
102785
102851
|
class WatchLogger {
|
|
102786
102852
|
logStream = null;
|
|
@@ -102788,7 +102854,7 @@ class WatchLogger {
|
|
|
102788
102854
|
logPath = null;
|
|
102789
102855
|
maxBytes;
|
|
102790
102856
|
constructor(logDir, maxBytes = 0) {
|
|
102791
|
-
this.logDir = logDir ??
|
|
102857
|
+
this.logDir = logDir ?? join129(PathResolver.getClaudeKitDir(), "logs");
|
|
102792
102858
|
this.maxBytes = maxBytes;
|
|
102793
102859
|
}
|
|
102794
102860
|
async init() {
|
|
@@ -102797,7 +102863,7 @@ class WatchLogger {
|
|
|
102797
102863
|
await mkdir34(this.logDir, { recursive: true });
|
|
102798
102864
|
}
|
|
102799
102865
|
const dateStr = formatDate(new Date);
|
|
102800
|
-
this.logPath =
|
|
102866
|
+
this.logPath = join129(this.logDir, `watch-${dateStr}.log`);
|
|
102801
102867
|
this.logStream = createWriteStream3(this.logPath, { flags: "a", mode: 384 });
|
|
102802
102868
|
} catch (error) {
|
|
102803
102869
|
logger.warning(`Cannot create watch log file: ${error instanceof Error ? error.message : "Unknown"}`);
|
|
@@ -102977,7 +103043,7 @@ async function watchCommand(options2) {
|
|
|
102977
103043
|
}
|
|
102978
103044
|
async function discoverRepos(options2, watchLog) {
|
|
102979
103045
|
const cwd2 = process.cwd();
|
|
102980
|
-
const isGitRepo = existsSync67(
|
|
103046
|
+
const isGitRepo = existsSync67(join130(cwd2, ".git"));
|
|
102981
103047
|
if (options2.force) {
|
|
102982
103048
|
await forceRemoveLock(watchLog);
|
|
102983
103049
|
}
|
|
@@ -103047,9 +103113,9 @@ async function resetState(state, projectDir, watchLog) {
|
|
|
103047
103113
|
watchLog.info(`Watch state reset (--force) for ${projectDir}`);
|
|
103048
103114
|
}
|
|
103049
103115
|
async function forceRemoveLock(watchLog) {
|
|
103050
|
-
const lockPath =
|
|
103116
|
+
const lockPath = join130(homedir33(), ".claudekit", "locks", `${LOCK_NAME}.lock`);
|
|
103051
103117
|
try {
|
|
103052
|
-
await
|
|
103118
|
+
await rm16(lockPath, { recursive: true, force: true });
|
|
103053
103119
|
watchLog.info("Removed existing lock file (--force)");
|
|
103054
103120
|
} catch {}
|
|
103055
103121
|
}
|
|
@@ -103231,7 +103297,7 @@ init_logger();
|
|
|
103231
103297
|
init_path_resolver();
|
|
103232
103298
|
init_types3();
|
|
103233
103299
|
import { existsSync as existsSync78, readFileSync as readFileSync18 } from "node:fs";
|
|
103234
|
-
import { join as
|
|
103300
|
+
import { join as join141 } from "node:path";
|
|
103235
103301
|
var packageVersion = package_default.version;
|
|
103236
103302
|
function formatInstalledKits(metadata) {
|
|
103237
103303
|
if (!metadata.kits || Object.keys(metadata.kits).length === 0) {
|
|
@@ -103263,9 +103329,9 @@ async function displayVersion() {
|
|
|
103263
103329
|
let localKitVersion = null;
|
|
103264
103330
|
let isGlobalOnlyKit = false;
|
|
103265
103331
|
const globalKitDir = PathResolver.getGlobalKitDir();
|
|
103266
|
-
const globalMetadataPath =
|
|
103332
|
+
const globalMetadataPath = join141(globalKitDir, "metadata.json");
|
|
103267
103333
|
const prefix = PathResolver.getPathPrefix(false);
|
|
103268
|
-
const localMetadataPath = prefix ?
|
|
103334
|
+
const localMetadataPath = prefix ? join141(process.cwd(), prefix, "metadata.json") : join141(process.cwd(), "metadata.json");
|
|
103269
103335
|
const isLocalSameAsGlobal = localMetadataPath === globalMetadataPath;
|
|
103270
103336
|
if (!isLocalSameAsGlobal && existsSync78(localMetadataPath)) {
|
|
103271
103337
|
try {
|