claudekit-cli 3.34.1-dev.4 → 3.34.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -29190,10 +29190,8 @@ var init_ck_config = __esm(() => {
|
|
|
29190
29190
|
CkHooksConfigSchema = exports_external.object({
|
|
29191
29191
|
"session-init": exports_external.boolean().optional(),
|
|
29192
29192
|
"subagent-init": exports_external.boolean().optional(),
|
|
29193
|
-
"descriptive-name": exports_external.boolean().optional(),
|
|
29194
29193
|
"dev-rules-reminder": exports_external.boolean().optional(),
|
|
29195
29194
|
"usage-context-awareness": exports_external.boolean().optional(),
|
|
29196
|
-
"context-tracking": exports_external.boolean().optional(),
|
|
29197
29195
|
"scout-block": exports_external.boolean().optional(),
|
|
29198
29196
|
"privacy-block": exports_external.boolean().optional(),
|
|
29199
29197
|
"post-edit-simplify-reminder": exports_external.boolean().optional()
|
|
@@ -29266,10 +29264,8 @@ var init_ck_config = __esm(() => {
|
|
|
29266
29264
|
hooks: {
|
|
29267
29265
|
"session-init": true,
|
|
29268
29266
|
"subagent-init": true,
|
|
29269
|
-
"descriptive-name": true,
|
|
29270
29267
|
"dev-rules-reminder": true,
|
|
29271
29268
|
"usage-context-awareness": true,
|
|
29272
|
-
"context-tracking": true,
|
|
29273
29269
|
"scout-block": true,
|
|
29274
29270
|
"privacy-block": true,
|
|
29275
29271
|
"post-edit-simplify-reminder": true
|
|
@@ -29278,10 +29274,8 @@ var init_ck_config = __esm(() => {
|
|
|
29278
29274
|
CK_HOOK_NAMES = [
|
|
29279
29275
|
"session-init",
|
|
29280
29276
|
"subagent-init",
|
|
29281
|
-
"descriptive-name",
|
|
29282
29277
|
"dev-rules-reminder",
|
|
29283
29278
|
"usage-context-awareness",
|
|
29284
|
-
"context-tracking",
|
|
29285
29279
|
"scout-block",
|
|
29286
29280
|
"privacy-block",
|
|
29287
29281
|
"post-edit-simplify-reminder"
|
|
@@ -29562,9 +29556,6 @@ function getNestedValue(obj, path2) {
|
|
|
29562
29556
|
}
|
|
29563
29557
|
function setNestedValue(obj, path2, value) {
|
|
29564
29558
|
const keys = path2.split(".");
|
|
29565
|
-
if (keys.some((k) => DANGEROUS_KEYS.includes(k))) {
|
|
29566
|
-
throw new Error("Invalid field path: dangerous key detected");
|
|
29567
|
-
}
|
|
29568
29559
|
let current = obj;
|
|
29569
29560
|
for (let i = 0;i < keys.length - 1; i++) {
|
|
29570
29561
|
const key = keys[i];
|
|
@@ -29578,8 +29569,6 @@ function setNestedValue(obj, path2, value) {
|
|
|
29578
29569
|
function deepMerge(target, source) {
|
|
29579
29570
|
const result = { ...target };
|
|
29580
29571
|
for (const key of Object.keys(source)) {
|
|
29581
|
-
if (DANGEROUS_KEYS.includes(key))
|
|
29582
|
-
continue;
|
|
29583
29572
|
const sourceVal = source[key];
|
|
29584
29573
|
const targetVal = result[key];
|
|
29585
29574
|
if (sourceVal !== null && typeof sourceVal === "object" && !Array.isArray(sourceVal) && targetVal !== null && typeof targetVal === "object" && !Array.isArray(targetVal)) {
|
|
@@ -29718,10 +29707,6 @@ class CkConfigManager {
|
|
|
29718
29707
|
return null;
|
|
29719
29708
|
return CkConfigManager.loadConfigFile(CkConfigManager.getProjectConfigPath(projectDir));
|
|
29720
29709
|
}
|
|
29721
|
-
static projectConfigExists(dir, isGlobal) {
|
|
29722
|
-
const configPath = isGlobal ? join3(dir, ".ck.json") : CkConfigManager.getProjectConfigPath(dir);
|
|
29723
|
-
return existsSync3(configPath);
|
|
29724
|
-
}
|
|
29725
29710
|
static configExists(scope, projectDir) {
|
|
29726
29711
|
if (scope === "global") {
|
|
29727
29712
|
return existsSync3(CkConfigManager.getGlobalConfigPath());
|
|
@@ -29742,11 +29727,10 @@ class CkConfigManager {
|
|
|
29742
29727
|
await CkConfigManager.saveFull(existing, scope, projectDir);
|
|
29743
29728
|
}
|
|
29744
29729
|
}
|
|
29745
|
-
var CK_CONFIG_FILE = ".ck.json"
|
|
29730
|
+
var CK_CONFIG_FILE = ".ck.json";
|
|
29746
29731
|
var init_ck_config_manager = __esm(() => {
|
|
29747
29732
|
init_logger();
|
|
29748
29733
|
init_types2();
|
|
29749
|
-
DANGEROUS_KEYS = ["__proto__", "constructor", "prototype"];
|
|
29750
29734
|
});
|
|
29751
29735
|
|
|
29752
29736
|
// src/shared/environment.ts
|
|
@@ -38125,12 +38109,17 @@ class FileWatcher {
|
|
|
38125
38109
|
if (this.isConfigFile(path2)) {
|
|
38126
38110
|
try {
|
|
38127
38111
|
const scope = this.getConfigScope(path2);
|
|
38128
|
-
|
|
38129
|
-
|
|
38130
|
-
|
|
38112
|
+
let config;
|
|
38113
|
+
if (scope === "global") {
|
|
38114
|
+
ConfigManager.setGlobalFlag(true);
|
|
38115
|
+
config = await ConfigManager.load();
|
|
38116
|
+
} else {
|
|
38117
|
+
const projectConfig = await ConfigManager.loadProjectConfig(process.cwd(), false);
|
|
38118
|
+
config = projectConfig ? { paths: projectConfig } : {};
|
|
38119
|
+
}
|
|
38131
38120
|
this.wsManager.broadcast({
|
|
38132
38121
|
type: "config:updated",
|
|
38133
|
-
payload: { scope, config
|
|
38122
|
+
payload: { scope, config }
|
|
38134
38123
|
});
|
|
38135
38124
|
} catch (error) {
|
|
38136
38125
|
logger.error(`Failed to reload config: ${error}`);
|
|
@@ -38888,9 +38877,6 @@ var init_projects_registry = __esm(() => {
|
|
|
38888
38877
|
});
|
|
38889
38878
|
|
|
38890
38879
|
// src/domains/web-server/routes/ck-config-routes.ts
|
|
38891
|
-
import { existsSync as existsSync6 } from "node:fs";
|
|
38892
|
-
import { readFile as readFile5 } from "node:fs/promises";
|
|
38893
|
-
import { join as join9 } from "node:path";
|
|
38894
38880
|
async function resolveProjectDir(projectId) {
|
|
38895
38881
|
if (!projectId)
|
|
38896
38882
|
return null;
|
|
@@ -39013,6 +38999,92 @@ function registerCkConfigRoutes(app) {
|
|
|
39013
38999
|
res.status(500).json({ error: "Failed to update field" });
|
|
39014
39000
|
}
|
|
39015
39001
|
});
|
|
39002
|
+
}
|
|
39003
|
+
var init_ck_config_routes = __esm(() => {
|
|
39004
|
+
init_config();
|
|
39005
|
+
init_ck_config_schema();
|
|
39006
|
+
init_logger();
|
|
39007
|
+
init_types2();
|
|
39008
|
+
});
|
|
39009
|
+
|
|
39010
|
+
// src/domains/web-server/routes/config-routes.ts
|
|
39011
|
+
import { existsSync as existsSync6 } from "node:fs";
|
|
39012
|
+
import { mkdir as mkdir4, readFile as readFile5, writeFile as writeFile6 } from "node:fs/promises";
|
|
39013
|
+
import { join as join9 } from "node:path";
|
|
39014
|
+
function registerConfigRoutes(app) {
|
|
39015
|
+
app.get("/api/config", async (_req, res) => {
|
|
39016
|
+
try {
|
|
39017
|
+
const projectDir = process.cwd();
|
|
39018
|
+
const globalConfigPath = getEngineerKitConfigPath();
|
|
39019
|
+
let globalConfig = {};
|
|
39020
|
+
if (existsSync6(globalConfigPath)) {
|
|
39021
|
+
const content = await readFile5(globalConfigPath, "utf-8");
|
|
39022
|
+
try {
|
|
39023
|
+
globalConfig = JSON.parse(content);
|
|
39024
|
+
} catch {}
|
|
39025
|
+
}
|
|
39026
|
+
const localConfig = await ConfigManager.loadProjectConfig(projectDir, false);
|
|
39027
|
+
const merged = deepMerge2(globalConfig, localConfig ? { paths: localConfig } : {});
|
|
39028
|
+
const response = {
|
|
39029
|
+
global: globalConfig,
|
|
39030
|
+
local: localConfig ? { paths: localConfig } : null,
|
|
39031
|
+
merged
|
|
39032
|
+
};
|
|
39033
|
+
res.json(response);
|
|
39034
|
+
} catch (error) {
|
|
39035
|
+
logger.error(`Failed to load config: ${error}`);
|
|
39036
|
+
res.status(500).json({ error: "Failed to load configuration" });
|
|
39037
|
+
}
|
|
39038
|
+
});
|
|
39039
|
+
app.get("/api/config/global", async (_req, res) => {
|
|
39040
|
+
try {
|
|
39041
|
+
const globalConfigPath = getEngineerKitConfigPath();
|
|
39042
|
+
let config = {};
|
|
39043
|
+
if (existsSync6(globalConfigPath)) {
|
|
39044
|
+
const content = await readFile5(globalConfigPath, "utf-8");
|
|
39045
|
+
try {
|
|
39046
|
+
config = JSON.parse(content);
|
|
39047
|
+
} catch {}
|
|
39048
|
+
}
|
|
39049
|
+
res.json(config);
|
|
39050
|
+
} catch (error) {
|
|
39051
|
+
res.status(500).json({ error: "Failed to load global config" });
|
|
39052
|
+
}
|
|
39053
|
+
});
|
|
39054
|
+
app.get("/api/config/local", async (_req, res) => {
|
|
39055
|
+
try {
|
|
39056
|
+
const projectDir = process.cwd();
|
|
39057
|
+
const config = await ConfigManager.loadProjectConfig(projectDir, false);
|
|
39058
|
+
res.json(config ? { paths: config } : {});
|
|
39059
|
+
} catch (error) {
|
|
39060
|
+
res.status(500).json({ error: "Failed to load local config" });
|
|
39061
|
+
}
|
|
39062
|
+
});
|
|
39063
|
+
app.post("/api/config", async (req, res) => {
|
|
39064
|
+
try {
|
|
39065
|
+
const { scope = "local", config } = req.body;
|
|
39066
|
+
if (!config || typeof config !== "object") {
|
|
39067
|
+
res.status(400).json({ error: "Invalid config payload" });
|
|
39068
|
+
return;
|
|
39069
|
+
}
|
|
39070
|
+
if (scope === "global") {
|
|
39071
|
+
const globalConfigPath = getEngineerKitConfigPath();
|
|
39072
|
+
const globalDir = PathResolver.getGlobalKitDir();
|
|
39073
|
+
if (!existsSync6(globalDir)) {
|
|
39074
|
+
await mkdir4(globalDir, { recursive: true });
|
|
39075
|
+
}
|
|
39076
|
+
await writeFile6(globalConfigPath, JSON.stringify(config, null, 2), "utf-8");
|
|
39077
|
+
logger.debug(`Engineer kit config saved to ${globalConfigPath}`);
|
|
39078
|
+
} else {
|
|
39079
|
+
const projectDir = process.cwd();
|
|
39080
|
+
await ConfigManager.saveProjectConfig(projectDir, config.paths || config, false);
|
|
39081
|
+
}
|
|
39082
|
+
res.json({ success: true, scope });
|
|
39083
|
+
} catch (error) {
|
|
39084
|
+
logger.error(`Failed to save config: ${error}`);
|
|
39085
|
+
res.status(500).json({ error: "Failed to save configuration" });
|
|
39086
|
+
}
|
|
39087
|
+
});
|
|
39016
39088
|
app.get("/api/metadata/global", async (_req, res) => {
|
|
39017
39089
|
try {
|
|
39018
39090
|
const metadataPath = join9(PathResolver.getGlobalKitDir(), "metadata.json");
|
|
@@ -39021,9 +39093,7 @@ function registerCkConfigRoutes(app) {
|
|
|
39021
39093
|
const content = await readFile5(metadataPath, "utf-8");
|
|
39022
39094
|
try {
|
|
39023
39095
|
metadata = JSON.parse(content);
|
|
39024
|
-
} catch
|
|
39025
|
-
logger.warning(`Invalid JSON in metadata.json: ${err}`);
|
|
39026
|
-
}
|
|
39096
|
+
} catch {}
|
|
39027
39097
|
}
|
|
39028
39098
|
res.json(metadata);
|
|
39029
39099
|
} catch (error) {
|
|
@@ -39031,13 +39101,92 @@ function registerCkConfigRoutes(app) {
|
|
|
39031
39101
|
res.status(500).json({ error: "Failed to load metadata" });
|
|
39032
39102
|
}
|
|
39033
39103
|
});
|
|
39104
|
+
app.get("/api/config/project/:id", async (req, res) => {
|
|
39105
|
+
try {
|
|
39106
|
+
const id = String(req.params.id);
|
|
39107
|
+
let projectDir;
|
|
39108
|
+
if (id.startsWith("discovered-")) {
|
|
39109
|
+
const encodedPath = id.slice("discovered-".length);
|
|
39110
|
+
projectDir = Buffer.from(encodedPath, "base64url").toString("utf-8");
|
|
39111
|
+
} else {
|
|
39112
|
+
const { ProjectsRegistryManager: ProjectsRegistryManager2 } = await Promise.resolve().then(() => (init_projects_registry(), exports_projects_registry));
|
|
39113
|
+
const project = await ProjectsRegistryManager2.getProject(id);
|
|
39114
|
+
if (!project) {
|
|
39115
|
+
res.status(404).json({ error: "Project not found" });
|
|
39116
|
+
return;
|
|
39117
|
+
}
|
|
39118
|
+
projectDir = project.path;
|
|
39119
|
+
}
|
|
39120
|
+
const globalConfigPath = getEngineerKitConfigPath();
|
|
39121
|
+
let globalConfig = {};
|
|
39122
|
+
if (existsSync6(globalConfigPath)) {
|
|
39123
|
+
const content = await readFile5(globalConfigPath, "utf-8");
|
|
39124
|
+
try {
|
|
39125
|
+
globalConfig = JSON.parse(content);
|
|
39126
|
+
} catch {}
|
|
39127
|
+
}
|
|
39128
|
+
const localConfig = await ConfigManager.loadProjectConfig(projectDir, false);
|
|
39129
|
+
const merged = deepMerge2(globalConfig, localConfig ? { paths: localConfig } : {});
|
|
39130
|
+
const response = {
|
|
39131
|
+
global: globalConfig,
|
|
39132
|
+
local: localConfig ? { paths: localConfig } : null,
|
|
39133
|
+
merged
|
|
39134
|
+
};
|
|
39135
|
+
res.json(response);
|
|
39136
|
+
} catch (error) {
|
|
39137
|
+
logger.error(`Failed to load project config: ${error}`);
|
|
39138
|
+
res.status(500).json({ error: "Failed to load project configuration" });
|
|
39139
|
+
}
|
|
39140
|
+
});
|
|
39141
|
+
app.post("/api/config/project/:id", async (req, res) => {
|
|
39142
|
+
try {
|
|
39143
|
+
const id = String(req.params.id);
|
|
39144
|
+
const { config } = req.body;
|
|
39145
|
+
if (!config || typeof config !== "object") {
|
|
39146
|
+
res.status(400).json({ error: "Invalid config payload" });
|
|
39147
|
+
return;
|
|
39148
|
+
}
|
|
39149
|
+
let projectDir;
|
|
39150
|
+
if (id.startsWith("discovered-")) {
|
|
39151
|
+
const encodedPath = id.slice("discovered-".length);
|
|
39152
|
+
projectDir = Buffer.from(encodedPath, "base64url").toString("utf-8");
|
|
39153
|
+
} else {
|
|
39154
|
+
const { ProjectsRegistryManager: ProjectsRegistryManager2 } = await Promise.resolve().then(() => (init_projects_registry(), exports_projects_registry));
|
|
39155
|
+
const project = await ProjectsRegistryManager2.getProject(id);
|
|
39156
|
+
if (!project) {
|
|
39157
|
+
res.status(404).json({ error: "Project not found" });
|
|
39158
|
+
return;
|
|
39159
|
+
}
|
|
39160
|
+
projectDir = project.path;
|
|
39161
|
+
}
|
|
39162
|
+
await ConfigManager.saveProjectConfig(projectDir, config.paths || config, false);
|
|
39163
|
+
res.json({ success: true });
|
|
39164
|
+
} catch (error) {
|
|
39165
|
+
logger.error(`Failed to save project config: ${error}`);
|
|
39166
|
+
res.status(500).json({ error: "Failed to save project configuration" });
|
|
39167
|
+
}
|
|
39168
|
+
});
|
|
39034
39169
|
}
|
|
39035
|
-
|
|
39170
|
+
function deepMerge2(target, source) {
|
|
39171
|
+
const result = { ...target };
|
|
39172
|
+
const dangerousKeys = ["__proto__", "constructor", "prototype"];
|
|
39173
|
+
for (const key of Object.keys(source)) {
|
|
39174
|
+
if (dangerousKeys.includes(key))
|
|
39175
|
+
continue;
|
|
39176
|
+
const sourceVal = source[key];
|
|
39177
|
+
if (sourceVal && typeof sourceVal === "object" && !Array.isArray(sourceVal)) {
|
|
39178
|
+
result[key] = deepMerge2(result[key] || {}, sourceVal);
|
|
39179
|
+
} else {
|
|
39180
|
+
result[key] = sourceVal;
|
|
39181
|
+
}
|
|
39182
|
+
}
|
|
39183
|
+
return result;
|
|
39184
|
+
}
|
|
39185
|
+
var getEngineerKitConfigPath = () => join9(PathResolver.getGlobalKitDir(), ".ck.json");
|
|
39186
|
+
var init_config_routes = __esm(() => {
|
|
39036
39187
|
init_config();
|
|
39037
|
-
init_ck_config_schema();
|
|
39038
39188
|
init_logger();
|
|
39039
39189
|
init_path_resolver();
|
|
39040
|
-
init_types2();
|
|
39041
39190
|
});
|
|
39042
39191
|
|
|
39043
39192
|
// src/domains/web-server/routes/health-routes.ts
|
|
@@ -43459,7 +43608,7 @@ async function buildProjectInfoFromRegistry(registered) {
|
|
|
43459
43608
|
} catch {}
|
|
43460
43609
|
}
|
|
43461
43610
|
} catch {}
|
|
43462
|
-
const hasLocalConfig = hasClaudeDir &&
|
|
43611
|
+
const hasLocalConfig = hasClaudeDir && ConfigManager.projectConfigExists(registered.path, false);
|
|
43463
43612
|
const settings = await readSettings();
|
|
43464
43613
|
const skills = await scanSkills();
|
|
43465
43614
|
const settingsPath = join17(homedir10(), ".claude", "settings.json");
|
|
@@ -43500,7 +43649,7 @@ async function detectAndBuildProjectInfo(path2, id) {
|
|
|
43500
43649
|
} catch {}
|
|
43501
43650
|
}
|
|
43502
43651
|
} catch {}
|
|
43503
|
-
const hasLocalConfig =
|
|
43652
|
+
const hasLocalConfig = ConfigManager.projectConfigExists(path2, id === "global");
|
|
43504
43653
|
const settings = await readSettings();
|
|
43505
43654
|
const skills = await scanSkills();
|
|
43506
43655
|
const settingsPath = join17(homedir10(), ".claude", "settings.json");
|
|
@@ -43849,7 +43998,7 @@ var init_skills_discovery = __esm(() => {
|
|
|
43849
43998
|
|
|
43850
43999
|
// src/commands/skills/skills-registry.ts
|
|
43851
44000
|
import { existsSync as existsSync14 } from "node:fs";
|
|
43852
|
-
import { mkdir as
|
|
44001
|
+
import { mkdir as mkdir5, readFile as readFile12, writeFile as writeFile7 } from "node:fs/promises";
|
|
43853
44002
|
import { homedir as homedir14 } from "node:os";
|
|
43854
44003
|
import { dirname as dirname6, join as join21 } from "node:path";
|
|
43855
44004
|
function getCliVersion() {
|
|
@@ -43886,9 +44035,9 @@ async function readRegistry() {
|
|
|
43886
44035
|
async function writeRegistry(registry) {
|
|
43887
44036
|
const dir = dirname6(REGISTRY_PATH);
|
|
43888
44037
|
if (!existsSync14(dir)) {
|
|
43889
|
-
await
|
|
44038
|
+
await mkdir5(dir, { recursive: true });
|
|
43890
44039
|
}
|
|
43891
|
-
await
|
|
44040
|
+
await writeFile7(REGISTRY_PATH, JSON.stringify(registry, null, 2), "utf-8");
|
|
43892
44041
|
}
|
|
43893
44042
|
async function addInstallation(skill, agent, global3, path2, sourcePath) {
|
|
43894
44043
|
const registry = await readRegistry();
|
|
@@ -43962,7 +44111,7 @@ var init_skills_registry = __esm(() => {
|
|
|
43962
44111
|
|
|
43963
44112
|
// src/commands/skills/skills-installer.ts
|
|
43964
44113
|
import { existsSync as existsSync15 } from "node:fs";
|
|
43965
|
-
import { cp, mkdir as
|
|
44114
|
+
import { cp, mkdir as mkdir6, stat as stat7 } from "node:fs/promises";
|
|
43966
44115
|
import { dirname as dirname7, resolve as resolve6 } from "node:path";
|
|
43967
44116
|
function isSamePath(path1, path2) {
|
|
43968
44117
|
try {
|
|
@@ -44007,7 +44156,7 @@ async function installSkillForAgent(skill, agent, options2) {
|
|
|
44007
44156
|
try {
|
|
44008
44157
|
const parentDir = dirname7(targetPath);
|
|
44009
44158
|
if (!existsSync15(parentDir)) {
|
|
44010
|
-
await
|
|
44159
|
+
await mkdir6(parentDir, { recursive: true });
|
|
44011
44160
|
}
|
|
44012
44161
|
if (existsSync15(targetPath)) {
|
|
44013
44162
|
const stats = await stat7(targetPath);
|
|
@@ -44586,7 +44735,7 @@ var init_pnpm_detector = __esm(() => {
|
|
|
44586
44735
|
|
|
44587
44736
|
// src/domains/installation/package-managers/detection-core.ts
|
|
44588
44737
|
import { existsSync as existsSync17 } from "node:fs";
|
|
44589
|
-
import { chmod as chmod2, mkdir as
|
|
44738
|
+
import { chmod as chmod2, mkdir as mkdir7, readFile as readFile13, writeFile as writeFile8 } from "node:fs/promises";
|
|
44590
44739
|
import { platform as platform4 } from "node:os";
|
|
44591
44740
|
import { join as join23 } from "node:path";
|
|
44592
44741
|
function detectFromEnv() {
|
|
@@ -44651,7 +44800,7 @@ async function saveCachedPm(pm, getVersion) {
|
|
|
44651
44800
|
const configDir = PathResolver.getConfigDir(false);
|
|
44652
44801
|
const cacheFile = join23(configDir, CACHE_FILE);
|
|
44653
44802
|
if (!existsSync17(configDir)) {
|
|
44654
|
-
await
|
|
44803
|
+
await mkdir7(configDir, { recursive: true });
|
|
44655
44804
|
if (platform4() !== "win32") {
|
|
44656
44805
|
await chmod2(configDir, 448);
|
|
44657
44806
|
}
|
|
@@ -44662,7 +44811,7 @@ async function saveCachedPm(pm, getVersion) {
|
|
|
44662
44811
|
detectedAt: Date.now(),
|
|
44663
44812
|
version: version ?? undefined
|
|
44664
44813
|
};
|
|
44665
|
-
await
|
|
44814
|
+
await writeFile8(cacheFile, JSON.stringify(data, null, 2), "utf-8");
|
|
44666
44815
|
if (platform4() !== "win32") {
|
|
44667
44816
|
await chmod2(cacheFile, 384);
|
|
44668
44817
|
}
|
|
@@ -45236,7 +45385,7 @@ var package_default;
|
|
|
45236
45385
|
var init_package = __esm(() => {
|
|
45237
45386
|
package_default = {
|
|
45238
45387
|
name: "claudekit-cli",
|
|
45239
|
-
version: "3.34.1
|
|
45388
|
+
version: "3.34.1",
|
|
45240
45389
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
45241
45390
|
type: "module",
|
|
45242
45391
|
repository: {
|
|
@@ -45335,6 +45484,7 @@ var init_package = __esm(() => {
|
|
|
45335
45484
|
"@types/tar": "^6.1.13",
|
|
45336
45485
|
"@types/tmp": "^0.2.6",
|
|
45337
45486
|
"@types/ws": "^8.18.1",
|
|
45487
|
+
"conventional-changelog-conventionalcommits": "^9.1.0",
|
|
45338
45488
|
"semantic-release": "^24.2.0",
|
|
45339
45489
|
typescript: "^5.7.2"
|
|
45340
45490
|
}
|
|
@@ -46050,7 +46200,7 @@ var init_error_handler2 = __esm(() => {
|
|
|
46050
46200
|
|
|
46051
46201
|
// src/domains/versioning/release-cache.ts
|
|
46052
46202
|
import { existsSync as existsSync18 } from "node:fs";
|
|
46053
|
-
import { mkdir as
|
|
46203
|
+
import { mkdir as mkdir8, readFile as readFile17, unlink as unlink3, writeFile as writeFile10 } from "node:fs/promises";
|
|
46054
46204
|
import { join as join27 } from "node:path";
|
|
46055
46205
|
var ReleaseCacheEntrySchema, ReleaseCache;
|
|
46056
46206
|
var init_release_cache = __esm(() => {
|
|
@@ -46096,12 +46246,12 @@ var init_release_cache = __esm(() => {
|
|
|
46096
46246
|
async set(key, releases) {
|
|
46097
46247
|
const cacheFile = this.getCachePath(key);
|
|
46098
46248
|
try {
|
|
46099
|
-
await
|
|
46249
|
+
await mkdir8(this.cacheDir, { recursive: true, mode: 448 });
|
|
46100
46250
|
const cacheEntry = {
|
|
46101
46251
|
timestamp: Date.now(),
|
|
46102
46252
|
releases
|
|
46103
46253
|
};
|
|
46104
|
-
await
|
|
46254
|
+
await writeFile10(cacheFile, JSON.stringify(cacheEntry, null, 2), "utf-8");
|
|
46105
46255
|
logger.debug(`Release cache set for key: ${key}, cached ${releases.length} releases`);
|
|
46106
46256
|
} catch (error) {
|
|
46107
46257
|
logger.debug(`Failed to set release cache for key ${key}: ${error}`);
|
|
@@ -46812,7 +46962,7 @@ var init_version_utils = __esm(() => {
|
|
|
46812
46962
|
|
|
46813
46963
|
// src/domains/versioning/version-cache.ts
|
|
46814
46964
|
import { existsSync as existsSync19 } from "node:fs";
|
|
46815
|
-
import { mkdir as
|
|
46965
|
+
import { mkdir as mkdir9, readFile as readFile18, writeFile as writeFile11 } from "node:fs/promises";
|
|
46816
46966
|
import { join as join28 } from "node:path";
|
|
46817
46967
|
var VersionCacheManager;
|
|
46818
46968
|
var init_version_cache = __esm(() => {
|
|
@@ -46850,9 +47000,9 @@ var init_version_cache = __esm(() => {
|
|
|
46850
47000
|
const cacheDir = PathResolver.getCacheDir(false);
|
|
46851
47001
|
try {
|
|
46852
47002
|
if (!existsSync19(cacheDir)) {
|
|
46853
|
-
await
|
|
47003
|
+
await mkdir9(cacheDir, { recursive: true, mode: 448 });
|
|
46854
47004
|
}
|
|
46855
|
-
await
|
|
47005
|
+
await writeFile11(cacheFile, JSON.stringify(cache3, null, 2), "utf-8");
|
|
46856
47006
|
logger.debug(`Version check cache saved to ${cacheFile}`);
|
|
46857
47007
|
} catch (error) {
|
|
46858
47008
|
logger.debug(`Failed to save version check cache: ${error}`);
|
|
@@ -47432,6 +47582,7 @@ var init_user_routes = __esm(() => {
|
|
|
47432
47582
|
function registerRoutes(app) {
|
|
47433
47583
|
registerHealthRoutes(app);
|
|
47434
47584
|
registerActionRoutes(app);
|
|
47585
|
+
registerConfigRoutes(app);
|
|
47435
47586
|
registerCkConfigRoutes(app);
|
|
47436
47587
|
registerProjectRoutes(app);
|
|
47437
47588
|
registerSkillRoutes(app);
|
|
@@ -47443,6 +47594,7 @@ function registerRoutes(app) {
|
|
|
47443
47594
|
var init_routes = __esm(() => {
|
|
47444
47595
|
init_action_routes();
|
|
47445
47596
|
init_ck_config_routes();
|
|
47597
|
+
init_config_routes();
|
|
47446
47598
|
init_project_routes();
|
|
47447
47599
|
init_session_routes();
|
|
47448
47600
|
init_settings_routes();
|
|
@@ -52895,7 +53047,7 @@ var init_skills_installer2 = __esm(() => {
|
|
|
52895
53047
|
|
|
52896
53048
|
// src/services/package-installer/gemini-mcp/config-manager.ts
|
|
52897
53049
|
import { existsSync as existsSync32 } from "node:fs";
|
|
52898
|
-
import { mkdir as
|
|
53050
|
+
import { mkdir as mkdir13, readFile as readFile26, writeFile as writeFile16 } from "node:fs/promises";
|
|
52899
53051
|
import { dirname as dirname11, join as join50 } from "node:path";
|
|
52900
53052
|
async function readJsonFile(filePath) {
|
|
52901
53053
|
try {
|
|
@@ -52926,7 +53078,7 @@ async function addGeminiToGitignore(projectDir) {
|
|
|
52926
53078
|
`) || content === "" ? "" : `
|
|
52927
53079
|
`;
|
|
52928
53080
|
const comment = "# Gemini CLI settings (contains user-specific config)";
|
|
52929
|
-
await
|
|
53081
|
+
await writeFile16(gitignorePath, `${content}${newLine}${comment}
|
|
52930
53082
|
${geminiPattern}
|
|
52931
53083
|
`, "utf-8");
|
|
52932
53084
|
logger.debug(`Added ${geminiPattern} to .gitignore`);
|
|
@@ -52938,7 +53090,7 @@ ${geminiPattern}
|
|
|
52938
53090
|
async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
52939
53091
|
const linkDir = dirname11(geminiSettingsPath);
|
|
52940
53092
|
if (!existsSync32(linkDir)) {
|
|
52941
|
-
await
|
|
53093
|
+
await mkdir13(linkDir, { recursive: true });
|
|
52942
53094
|
logger.debug(`Created directory: ${linkDir}`);
|
|
52943
53095
|
}
|
|
52944
53096
|
const mcpConfig = await readJsonFile(mcpConfigPath);
|
|
@@ -52951,7 +53103,7 @@ async function createNewSettingsWithMerge(geminiSettingsPath, mcpConfigPath) {
|
|
|
52951
53103
|
}
|
|
52952
53104
|
const newSettings = { mcpServers };
|
|
52953
53105
|
try {
|
|
52954
|
-
await
|
|
53106
|
+
await writeFile16(geminiSettingsPath, JSON.stringify(newSettings, null, 2), "utf-8");
|
|
52955
53107
|
logger.debug(`Created new Gemini settings with mcpServers: ${geminiSettingsPath}`);
|
|
52956
53108
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
52957
53109
|
} catch (error) {
|
|
@@ -52981,7 +53133,7 @@ async function mergeGeminiSettings(geminiSettingsPath, mcpConfigPath) {
|
|
|
52981
53133
|
mcpServers
|
|
52982
53134
|
};
|
|
52983
53135
|
try {
|
|
52984
|
-
await
|
|
53136
|
+
await writeFile16(geminiSettingsPath, JSON.stringify(mergedSettings, null, 2), "utf-8");
|
|
52985
53137
|
logger.debug(`Merged mcpServers into: ${geminiSettingsPath}`);
|
|
52986
53138
|
return { success: true, method: "merge", targetPath: mcpConfigPath };
|
|
52987
53139
|
} catch (error) {
|
|
@@ -53054,12 +53206,12 @@ var init_validation = __esm(() => {
|
|
|
53054
53206
|
|
|
53055
53207
|
// src/services/package-installer/gemini-mcp/linker-core.ts
|
|
53056
53208
|
import { existsSync as existsSync34 } from "node:fs";
|
|
53057
|
-
import { mkdir as
|
|
53209
|
+
import { mkdir as mkdir14, symlink as symlink2 } from "node:fs/promises";
|
|
53058
53210
|
import { dirname as dirname12, join as join52 } from "node:path";
|
|
53059
53211
|
async function createSymlink(targetPath, linkPath, projectDir, isGlobal) {
|
|
53060
53212
|
const linkDir = dirname12(linkPath);
|
|
53061
53213
|
if (!existsSync34(linkDir)) {
|
|
53062
|
-
await
|
|
53214
|
+
await mkdir14(linkDir, { recursive: true });
|
|
53063
53215
|
logger.debug(`Created directory: ${linkDir}`);
|
|
53064
53216
|
}
|
|
53065
53217
|
let symlinkTarget;
|
|
@@ -60863,7 +61015,7 @@ function checkComponentCounts(setup) {
|
|
|
60863
61015
|
// src/domains/health-checks/checkers/permissions-checker.ts
|
|
60864
61016
|
init_logger();
|
|
60865
61017
|
init_path_resolver();
|
|
60866
|
-
import { constants as constants2, access as access2, unlink as unlink4, writeFile as
|
|
61018
|
+
import { constants as constants2, access as access2, unlink as unlink4, writeFile as writeFile12 } from "node:fs/promises";
|
|
60867
61019
|
import { join as join34 } from "node:path";
|
|
60868
61020
|
|
|
60869
61021
|
// src/domains/health-checks/checkers/shared.ts
|
|
@@ -60934,7 +61086,7 @@ async function checkGlobalDirWritable() {
|
|
|
60934
61086
|
const random = Math.random().toString(36).substring(2);
|
|
60935
61087
|
const testFile = join34(globalDir, `.ck-write-test-${timestamp}-${random}`);
|
|
60936
61088
|
try {
|
|
60937
|
-
await
|
|
61089
|
+
await writeFile12(testFile, "test", { encoding: "utf-8", flag: "wx" });
|
|
60938
61090
|
} catch (error) {
|
|
60939
61091
|
return {
|
|
60940
61092
|
id: "ck-global-dir-writable",
|
|
@@ -61964,7 +62116,7 @@ import { platform as platform6 } from "node:os";
|
|
|
61964
62116
|
|
|
61965
62117
|
// src/domains/health-checks/platform/environment-checker.ts
|
|
61966
62118
|
init_path_resolver();
|
|
61967
|
-
import { constants as constants3, access as access3, mkdir as
|
|
62119
|
+
import { constants as constants3, access as access3, mkdir as mkdir10, readFile as readFile23, unlink as unlink5, writeFile as writeFile13 } from "node:fs/promises";
|
|
61968
62120
|
import { arch as arch2, homedir as homedir16, platform as platform5 } from "node:os";
|
|
61969
62121
|
import { join as join42, normalize as normalize6 } from "node:path";
|
|
61970
62122
|
var IS_WINDOWS = platform5() === "win32";
|
|
@@ -62062,8 +62214,8 @@ async function checkGlobalDirAccess() {
|
|
|
62062
62214
|
}
|
|
62063
62215
|
const testFile = join42(globalDir, ".ck-doctor-access-test");
|
|
62064
62216
|
try {
|
|
62065
|
-
await
|
|
62066
|
-
await
|
|
62217
|
+
await mkdir10(globalDir, { recursive: true });
|
|
62218
|
+
await writeFile13(testFile, "test", "utf-8");
|
|
62067
62219
|
const content = await readFile23(testFile, "utf-8");
|
|
62068
62220
|
await unlink5(testFile);
|
|
62069
62221
|
if (content !== "test")
|
|
@@ -62137,7 +62289,7 @@ async function checkWSLBoundary() {
|
|
|
62137
62289
|
|
|
62138
62290
|
// src/domains/health-checks/platform/windows-checker.ts
|
|
62139
62291
|
init_path_resolver();
|
|
62140
|
-
import { mkdir as
|
|
62292
|
+
import { mkdir as mkdir11, symlink, unlink as unlink6, writeFile as writeFile14 } from "node:fs/promises";
|
|
62141
62293
|
import { join as join43 } from "node:path";
|
|
62142
62294
|
async function checkLongPathSupport() {
|
|
62143
62295
|
if (shouldSkipExpensiveOperations4()) {
|
|
@@ -62193,8 +62345,8 @@ async function checkSymlinkSupport() {
|
|
|
62193
62345
|
const target = join43(testDir, ".ck-symlink-test-target");
|
|
62194
62346
|
const link = join43(testDir, ".ck-symlink-test-link");
|
|
62195
62347
|
try {
|
|
62196
|
-
await
|
|
62197
|
-
await
|
|
62348
|
+
await mkdir11(testDir, { recursive: true });
|
|
62349
|
+
await writeFile14(target, "test", "utf-8");
|
|
62198
62350
|
await symlink(target, link);
|
|
62199
62351
|
await unlink6(link);
|
|
62200
62352
|
await unlink6(target);
|
|
@@ -62948,7 +63100,7 @@ init_github_client();
|
|
|
62948
63100
|
init_logger();
|
|
62949
63101
|
init_path_resolver();
|
|
62950
63102
|
var import_compare_versions5 = __toESM(require_umd(), 1);
|
|
62951
|
-
import { mkdir as
|
|
63103
|
+
import { mkdir as mkdir12, readFile as readFile24, unlink as unlink7, writeFile as writeFile15 } from "node:fs/promises";
|
|
62952
63104
|
import { join as join45 } from "node:path";
|
|
62953
63105
|
var CACHE_TTL_HOURS = 24;
|
|
62954
63106
|
var DEFAULT_CACHE_TTL_MS = CACHE_TTL_HOURS * 60 * 60 * 1000;
|
|
@@ -63006,8 +63158,8 @@ class ConfigVersionChecker {
|
|
|
63006
63158
|
try {
|
|
63007
63159
|
const cachePath = ConfigVersionChecker.getCacheFilePath(kitType, global3);
|
|
63008
63160
|
const cacheDir = PathResolver.getCacheDir(global3);
|
|
63009
|
-
await
|
|
63010
|
-
await
|
|
63161
|
+
await mkdir12(cacheDir, { recursive: true });
|
|
63162
|
+
await writeFile15(cachePath, JSON.stringify(cache3, null, 2));
|
|
63011
63163
|
} catch (error) {
|
|
63012
63164
|
logger.debug(`Cache write failed: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
63013
63165
|
}
|
|
@@ -65668,7 +65820,7 @@ init_logger();
|
|
|
65668
65820
|
// src/shared/process-lock.ts
|
|
65669
65821
|
init_logger();
|
|
65670
65822
|
var import_proper_lockfile = __toESM(require_proper_lockfile(), 1);
|
|
65671
|
-
import { mkdir as
|
|
65823
|
+
import { mkdir as mkdir15 } from "node:fs/promises";
|
|
65672
65824
|
import os5 from "node:os";
|
|
65673
65825
|
import { join as join53 } from "node:path";
|
|
65674
65826
|
var LOCK_CONFIG = {
|
|
@@ -65701,7 +65853,7 @@ function registerCleanupHandlers() {
|
|
|
65701
65853
|
}
|
|
65702
65854
|
async function ensureLocksDir() {
|
|
65703
65855
|
const lockDir = getLocksDir();
|
|
65704
|
-
await
|
|
65856
|
+
await mkdir15(lockDir, { recursive: true });
|
|
65705
65857
|
}
|
|
65706
65858
|
async function withProcessLock(lockName, fn) {
|
|
65707
65859
|
registerCleanupHandlers();
|
|
@@ -65856,7 +66008,7 @@ init_github_client();
|
|
|
65856
66008
|
init_environment();
|
|
65857
66009
|
init_logger();
|
|
65858
66010
|
init_safe_spinner();
|
|
65859
|
-
import { mkdir as
|
|
66011
|
+
import { mkdir as mkdir21, stat as stat12 } from "node:fs/promises";
|
|
65860
66012
|
import { tmpdir as tmpdir3 } from "node:os";
|
|
65861
66013
|
import { join as join61 } from "node:path";
|
|
65862
66014
|
|
|
@@ -65876,7 +66028,7 @@ var import_ignore = __toESM(require_ignore(), 1);
|
|
|
65876
66028
|
init_logger();
|
|
65877
66029
|
init_output_manager();
|
|
65878
66030
|
import { createWriteStream as createWriteStream2, rmSync } from "node:fs";
|
|
65879
|
-
import { mkdir as
|
|
66031
|
+
import { mkdir as mkdir16 } from "node:fs/promises";
|
|
65880
66032
|
import { join as join55 } from "node:path";
|
|
65881
66033
|
|
|
65882
66034
|
// src/shared/progress-bar.ts
|
|
@@ -66088,7 +66240,7 @@ class FileDownloader {
|
|
|
66088
66240
|
async downloadAsset(asset, destDir) {
|
|
66089
66241
|
try {
|
|
66090
66242
|
const destPath = join55(destDir, asset.name);
|
|
66091
|
-
await
|
|
66243
|
+
await mkdir16(destDir, { recursive: true });
|
|
66092
66244
|
output.info(`Downloading ${asset.name} (${formatBytes(asset.size)})...`);
|
|
66093
66245
|
logger.verbose("Download details", {
|
|
66094
66246
|
url: asset.browser_download_url,
|
|
@@ -66173,7 +66325,7 @@ class FileDownloader {
|
|
|
66173
66325
|
async downloadFile(params) {
|
|
66174
66326
|
const { url, name, size, destDir, token } = params;
|
|
66175
66327
|
const destPath = join55(destDir, name);
|
|
66176
|
-
await
|
|
66328
|
+
await mkdir16(destDir, { recursive: true });
|
|
66177
66329
|
output.info(`Downloading ${name}${size ? ` (${formatBytes(size)})` : ""}...`);
|
|
66178
66330
|
const headers = {};
|
|
66179
66331
|
if (token && url.includes("api.github.com")) {
|
|
@@ -66291,7 +66443,7 @@ async function validateExtraction(extractDir) {
|
|
|
66291
66443
|
|
|
66292
66444
|
// src/domains/installation/extraction/tar-extractor.ts
|
|
66293
66445
|
init_logger();
|
|
66294
|
-
import { copyFile as copyFile3, mkdir as
|
|
66446
|
+
import { copyFile as copyFile3, mkdir as mkdir19, readdir as readdir11, rm as rm3, stat as stat10 } from "node:fs/promises";
|
|
66295
66447
|
import { join as join59 } from "node:path";
|
|
66296
66448
|
|
|
66297
66449
|
// node_modules/@isaacs/fs-minipass/dist/esm/index.js
|
|
@@ -71921,7 +72073,7 @@ var checkCwd = (dir, cb) => {
|
|
|
71921
72073
|
cb(er);
|
|
71922
72074
|
});
|
|
71923
72075
|
};
|
|
71924
|
-
var
|
|
72076
|
+
var mkdir17 = (dir, opt, cb) => {
|
|
71925
72077
|
dir = normalizeWindowsPath(dir);
|
|
71926
72078
|
const umask = opt.umask ?? 18;
|
|
71927
72079
|
const mode = opt.mode | 448;
|
|
@@ -72444,7 +72596,7 @@ class Unpack extends Parser {
|
|
|
72444
72596
|
}
|
|
72445
72597
|
}
|
|
72446
72598
|
[MKDIR](dir, mode, cb) {
|
|
72447
|
-
|
|
72599
|
+
mkdir17(normalizeWindowsPath(dir), {
|
|
72448
72600
|
uid: this.uid,
|
|
72449
72601
|
gid: this.gid,
|
|
72450
72602
|
processUid: this.processUid,
|
|
@@ -73160,7 +73312,7 @@ function decodeFilePath(path10) {
|
|
|
73160
73312
|
// src/domains/installation/utils/file-utils.ts
|
|
73161
73313
|
init_logger();
|
|
73162
73314
|
init_types2();
|
|
73163
|
-
import { copyFile as copyFile2, lstat as lstat4, mkdir as
|
|
73315
|
+
import { copyFile as copyFile2, lstat as lstat4, mkdir as mkdir18, readdir as readdir10 } from "node:fs/promises";
|
|
73164
73316
|
import { join as join58, relative as relative6 } from "node:path";
|
|
73165
73317
|
async function withRetry(fn, retries = 3) {
|
|
73166
73318
|
for (let i = 0;i < retries; i++) {
|
|
@@ -73180,7 +73332,7 @@ var isRetryable = (e2) => {
|
|
|
73180
73332
|
};
|
|
73181
73333
|
var delay = (ms) => new Promise((r2) => setTimeout(r2, ms));
|
|
73182
73334
|
async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
73183
|
-
await
|
|
73335
|
+
await mkdir18(destDir, { recursive: true });
|
|
73184
73336
|
const entries = await readdir10(sourceDir, { encoding: "utf8" });
|
|
73185
73337
|
for (const entry of entries) {
|
|
73186
73338
|
const sourcePath = join58(sourceDir, entry);
|
|
@@ -73208,7 +73360,7 @@ async function moveDirectoryContents(sourceDir, destDir, shouldExclude, sizeTrac
|
|
|
73208
73360
|
}
|
|
73209
73361
|
}
|
|
73210
73362
|
async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
73211
|
-
await
|
|
73363
|
+
await mkdir18(destDir, { recursive: true });
|
|
73212
73364
|
const entries = await readdir10(sourceDir, { encoding: "utf8" });
|
|
73213
73365
|
for (const entry of entries) {
|
|
73214
73366
|
const sourcePath = join58(sourceDir, entry);
|
|
@@ -73240,7 +73392,7 @@ async function copyDirectory(sourceDir, destDir, shouldExclude, sizeTracker) {
|
|
|
73240
73392
|
class TarExtractor {
|
|
73241
73393
|
async extract(archivePath, destDir, shouldExclude, sizeTracker) {
|
|
73242
73394
|
const tempExtractDir = `${destDir}-temp`;
|
|
73243
|
-
await
|
|
73395
|
+
await mkdir19(tempExtractDir, { recursive: true });
|
|
73244
73396
|
try {
|
|
73245
73397
|
await extract({
|
|
73246
73398
|
file: archivePath,
|
|
@@ -73275,7 +73427,7 @@ class TarExtractor {
|
|
|
73275
73427
|
await moveDirectoryContents(tempExtractDir, destDir, shouldExclude, sizeTracker);
|
|
73276
73428
|
}
|
|
73277
73429
|
} else {
|
|
73278
|
-
await
|
|
73430
|
+
await mkdir19(destDir, { recursive: true });
|
|
73279
73431
|
await copyFile3(rootPath, join59(destDir, rootEntry));
|
|
73280
73432
|
}
|
|
73281
73433
|
} else {
|
|
@@ -73298,7 +73450,7 @@ init_environment();
|
|
|
73298
73450
|
init_logger();
|
|
73299
73451
|
var import_extract_zip = __toESM(require_extract_zip(), 1);
|
|
73300
73452
|
import { execFile as execFile8 } from "node:child_process";
|
|
73301
|
-
import { copyFile as copyFile4, mkdir as
|
|
73453
|
+
import { copyFile as copyFile4, mkdir as mkdir20, readdir as readdir12, rm as rm4, stat as stat11 } from "node:fs/promises";
|
|
73302
73454
|
import { join as join60 } from "node:path";
|
|
73303
73455
|
class ZipExtractor {
|
|
73304
73456
|
async tryNativeUnzip(archivePath, destDir) {
|
|
@@ -73306,7 +73458,7 @@ class ZipExtractor {
|
|
|
73306
73458
|
return false;
|
|
73307
73459
|
}
|
|
73308
73460
|
return new Promise((resolve11) => {
|
|
73309
|
-
|
|
73461
|
+
mkdir20(destDir, { recursive: true }).then(() => {
|
|
73310
73462
|
execFile8("unzip", ["-o", "-q", archivePath, "-d", destDir], (error, _stdout, stderr) => {
|
|
73311
73463
|
if (error) {
|
|
73312
73464
|
logger.debug(`Native unzip failed: ${stderr || error.message}`);
|
|
@@ -73324,7 +73476,7 @@ class ZipExtractor {
|
|
|
73324
73476
|
}
|
|
73325
73477
|
async extract(archivePath, destDir, shouldExclude, sizeTracker) {
|
|
73326
73478
|
const tempExtractDir = `${destDir}-temp`;
|
|
73327
|
-
await
|
|
73479
|
+
await mkdir20(tempExtractDir, { recursive: true });
|
|
73328
73480
|
try {
|
|
73329
73481
|
const nativeSuccess = await this.tryNativeUnzip(archivePath, tempExtractDir);
|
|
73330
73482
|
if (!nativeSuccess) {
|
|
@@ -73362,7 +73514,7 @@ class ZipExtractor {
|
|
|
73362
73514
|
await moveDirectoryContents(tempExtractDir, destDir, shouldExclude, sizeTracker);
|
|
73363
73515
|
}
|
|
73364
73516
|
} else {
|
|
73365
|
-
await
|
|
73517
|
+
await mkdir20(destDir, { recursive: true });
|
|
73366
73518
|
await copyFile4(rootPath, join60(destDir, rootEntry));
|
|
73367
73519
|
}
|
|
73368
73520
|
} else {
|
|
@@ -73437,7 +73589,7 @@ class DownloadManager {
|
|
|
73437
73589
|
try {
|
|
73438
73590
|
this.sizeTracker.reset();
|
|
73439
73591
|
const detectedType = archiveType || detectArchiveType(archivePath);
|
|
73440
|
-
await
|
|
73592
|
+
await mkdir21(destDir, { recursive: true });
|
|
73441
73593
|
if (detectedType === "tar.gz") {
|
|
73442
73594
|
await this.tarExtractor.extract(archivePath, destDir, this.shouldExclude, this.sizeTracker);
|
|
73443
73595
|
} else if (detectedType === "zip") {
|
|
@@ -73464,7 +73616,7 @@ class DownloadManager {
|
|
|
73464
73616
|
const counter = DownloadManager.tempDirCounter++;
|
|
73465
73617
|
const primaryTempDir = join61(tmpdir3(), `claudekit-${timestamp}-${counter}`);
|
|
73466
73618
|
try {
|
|
73467
|
-
await
|
|
73619
|
+
await mkdir21(primaryTempDir, { recursive: true });
|
|
73468
73620
|
logger.debug(`Created temp directory: ${primaryTempDir}`);
|
|
73469
73621
|
registerTempDir(primaryTempDir);
|
|
73470
73622
|
return primaryTempDir;
|
|
@@ -73481,7 +73633,7 @@ Solutions:
|
|
|
73481
73633
|
}
|
|
73482
73634
|
const fallbackTempDir = join61(homeDir, ".claudekit", "tmp", `claudekit-${timestamp}-${counter}`);
|
|
73483
73635
|
try {
|
|
73484
|
-
await
|
|
73636
|
+
await mkdir21(fallbackTempDir, { recursive: true });
|
|
73485
73637
|
logger.debug(`Created temp directory (fallback): ${fallbackTempDir}`);
|
|
73486
73638
|
logger.warning(`Using fallback temp directory: ${fallbackTempDir}
|
|
73487
73639
|
(OS temp directory was not accessible)`);
|
|
@@ -75850,13 +76002,10 @@ class FileScanner {
|
|
|
75850
76002
|
}
|
|
75851
76003
|
}
|
|
75852
76004
|
|
|
75853
|
-
// src/domains/installation/merger/settings-processor.ts
|
|
75854
|
-
import { execSync as execSync4 } from "node:child_process";
|
|
75855
|
-
|
|
75856
76005
|
// src/domains/config/installed-settings-tracker.ts
|
|
75857
76006
|
init_shared();
|
|
75858
76007
|
import { existsSync as existsSync36 } from "node:fs";
|
|
75859
|
-
import { mkdir as
|
|
76008
|
+
import { mkdir as mkdir22, readFile as readFile29, writeFile as writeFile18 } from "node:fs/promises";
|
|
75860
76009
|
import { dirname as dirname15, join as join66 } from "node:path";
|
|
75861
76010
|
var CK_JSON_FILE = ".ck.json";
|
|
75862
76011
|
|
|
@@ -75908,8 +76057,8 @@ class InstalledSettingsTracker {
|
|
|
75908
76057
|
data.kits[this.kitName] = {};
|
|
75909
76058
|
}
|
|
75910
76059
|
data.kits[this.kitName].installedSettings = settings;
|
|
75911
|
-
await
|
|
75912
|
-
await
|
|
76060
|
+
await mkdir22(dirname15(ckJsonPath), { recursive: true });
|
|
76061
|
+
await writeFile18(ckJsonPath, JSON.stringify(data, null, 2), "utf-8");
|
|
75913
76062
|
logger.debug(`Saved installed settings to ${ckJsonPath}`);
|
|
75914
76063
|
} catch (error) {
|
|
75915
76064
|
logger.warning(`Failed to save installed settings: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -75951,17 +76100,14 @@ init_settings_merger();
|
|
|
75951
76100
|
init_environment();
|
|
75952
76101
|
init_logger();
|
|
75953
76102
|
var import_fs_extra11 = __toESM(require_lib3(), 1);
|
|
75954
|
-
var import_semver2 = __toESM(require_semver2(), 1);
|
|
75955
76103
|
|
|
75956
76104
|
class SettingsProcessor {
|
|
75957
|
-
static MIN_TEAM_HOOKS_VERSION = "2.1.33";
|
|
75958
76105
|
isGlobal = false;
|
|
75959
76106
|
forceOverwriteSettings = false;
|
|
75960
76107
|
projectDir = "";
|
|
75961
76108
|
kitName = "engineer";
|
|
75962
76109
|
tracker = null;
|
|
75963
76110
|
installingKit;
|
|
75964
|
-
cachedVersion = undefined;
|
|
75965
76111
|
setGlobalFlag(isGlobal) {
|
|
75966
76112
|
this.isGlobal = isGlobal;
|
|
75967
76113
|
}
|
|
@@ -76007,9 +76153,8 @@ class SettingsProcessor {
|
|
|
76007
76153
|
} else {
|
|
76008
76154
|
const formattedContent = this.formatJsonContent(transformedSource);
|
|
76009
76155
|
await import_fs_extra11.writeFile(destFile, formattedContent, "utf-8");
|
|
76010
|
-
let parsedSettings;
|
|
76011
76156
|
try {
|
|
76012
|
-
parsedSettings = JSON.parse(formattedContent);
|
|
76157
|
+
const parsedSettings = JSON.parse(formattedContent);
|
|
76013
76158
|
if (this.forceOverwriteSettings && destExists) {
|
|
76014
76159
|
logger.debug("Force overwrite enabled, replaced settings.json completely");
|
|
76015
76160
|
if (this.tracker) {
|
|
@@ -76018,7 +76163,6 @@ class SettingsProcessor {
|
|
|
76018
76163
|
}
|
|
76019
76164
|
await this.trackInstalledSettings(parsedSettings);
|
|
76020
76165
|
} catch {}
|
|
76021
|
-
await this.injectTeamHooksIfSupported(destFile, parsedSettings);
|
|
76022
76166
|
}
|
|
76023
76167
|
} catch (error) {
|
|
76024
76168
|
logger.error(`Failed to process settings.json: ${error}`);
|
|
@@ -76079,7 +76223,6 @@ class SettingsProcessor {
|
|
|
76079
76223
|
}
|
|
76080
76224
|
await SettingsMerger.writeSettingsFile(destFile, mergeResult.merged);
|
|
76081
76225
|
logger.success("Merged settings.json (user customizations preserved)");
|
|
76082
|
-
await this.injectTeamHooksIfSupported(destFile, mergeResult.merged);
|
|
76083
76226
|
}
|
|
76084
76227
|
async trackInstalledSettings(settings) {
|
|
76085
76228
|
if (!this.tracker)
|
|
@@ -76151,80 +76294,6 @@ class SettingsProcessor {
|
|
|
76151
76294
|
}
|
|
76152
76295
|
return transformed;
|
|
76153
76296
|
}
|
|
76154
|
-
detectClaudeCodeVersion() {
|
|
76155
|
-
if (this.cachedVersion !== undefined)
|
|
76156
|
-
return this.cachedVersion;
|
|
76157
|
-
try {
|
|
76158
|
-
const output2 = execSync4("claude --version", {
|
|
76159
|
-
encoding: "utf-8",
|
|
76160
|
-
timeout: 5000,
|
|
76161
|
-
stdio: ["ignore", "pipe", "ignore"]
|
|
76162
|
-
});
|
|
76163
|
-
const match2 = output2.match(/(\d+\.\d+\.\d+)/);
|
|
76164
|
-
this.cachedVersion = match2 ? match2[1] : null;
|
|
76165
|
-
} catch {
|
|
76166
|
-
this.cachedVersion = null;
|
|
76167
|
-
}
|
|
76168
|
-
return this.cachedVersion;
|
|
76169
|
-
}
|
|
76170
|
-
isVersionAtLeast(version, minimum) {
|
|
76171
|
-
const coerced = import_semver2.default.coerce(version);
|
|
76172
|
-
if (!coerced)
|
|
76173
|
-
return false;
|
|
76174
|
-
return import_semver2.default.gte(coerced, minimum);
|
|
76175
|
-
}
|
|
76176
|
-
async injectTeamHooksIfSupported(destFile, existingSettings) {
|
|
76177
|
-
const version = this.detectClaudeCodeVersion();
|
|
76178
|
-
if (!version) {
|
|
76179
|
-
logger.debug("Claude Code version not detected, skipping team hooks injection");
|
|
76180
|
-
return;
|
|
76181
|
-
}
|
|
76182
|
-
if (!this.isVersionAtLeast(version, SettingsProcessor.MIN_TEAM_HOOKS_VERSION)) {
|
|
76183
|
-
logger.debug(`Claude Code ${version} does not support team hooks (requires >= 2.1.33), skipping injection`);
|
|
76184
|
-
return;
|
|
76185
|
-
}
|
|
76186
|
-
logger.debug(`Claude Code ${version} detected, checking team hooks`);
|
|
76187
|
-
const settings = existingSettings ?? await SettingsMerger.readSettingsFile(destFile);
|
|
76188
|
-
if (!settings) {
|
|
76189
|
-
logger.warning("Failed to read settings file for team hooks injection");
|
|
76190
|
-
return;
|
|
76191
|
-
}
|
|
76192
|
-
const prefix = this.isGlobal ? isWindows() ? "%USERPROFILE%" : "$HOME" : isWindows() ? "%CLAUDE_PROJECT_DIR%" : "$CLAUDE_PROJECT_DIR";
|
|
76193
|
-
if (!settings.hooks) {
|
|
76194
|
-
settings.hooks = {};
|
|
76195
|
-
}
|
|
76196
|
-
let injected = false;
|
|
76197
|
-
const installedSettings = this.tracker ? await this.tracker.loadInstalledSettings() : { hooks: [], mcpServers: [] };
|
|
76198
|
-
const teamHooks = [
|
|
76199
|
-
{ event: "TaskCompleted", handler: "task-completed-handler.cjs" },
|
|
76200
|
-
{ event: "TeammateIdle", handler: "teammate-idle-handler.cjs" }
|
|
76201
|
-
];
|
|
76202
|
-
for (const { event, handler } of teamHooks) {
|
|
76203
|
-
const hookCommand = `node ${prefix}/.claude/hooks/${handler}`;
|
|
76204
|
-
const eventHooks = settings.hooks[event];
|
|
76205
|
-
if (eventHooks && eventHooks.length > 0)
|
|
76206
|
-
continue;
|
|
76207
|
-
if (this.tracker?.wasHookInstalled(hookCommand, installedSettings)) {
|
|
76208
|
-
logger.debug(`Skipping ${event} hook injection (previously removed by user)`);
|
|
76209
|
-
continue;
|
|
76210
|
-
}
|
|
76211
|
-
settings.hooks[event] = [{ hooks: [{ type: "command", command: hookCommand }] }];
|
|
76212
|
-
logger.info(`Injected ${event} hook`);
|
|
76213
|
-
injected = true;
|
|
76214
|
-
if (this.tracker) {
|
|
76215
|
-
this.tracker.trackHook(hookCommand, installedSettings);
|
|
76216
|
-
}
|
|
76217
|
-
}
|
|
76218
|
-
if (injected) {
|
|
76219
|
-
await SettingsMerger.writeSettingsFile(destFile, settings);
|
|
76220
|
-
if (this.tracker) {
|
|
76221
|
-
await this.tracker.saveInstalledSettings(installedSettings);
|
|
76222
|
-
}
|
|
76223
|
-
logger.success("Team hooks injected successfully");
|
|
76224
|
-
} else {
|
|
76225
|
-
logger.debug("Team hooks already present, no injection needed");
|
|
76226
|
-
}
|
|
76227
|
-
}
|
|
76228
76297
|
}
|
|
76229
76298
|
|
|
76230
76299
|
// src/domains/installation/merger/copy-executor.ts
|
|
@@ -77161,12 +77230,12 @@ class FileScanner2 {
|
|
|
77161
77230
|
// src/services/transformers/commands-prefix/prefix-applier.ts
|
|
77162
77231
|
init_logger();
|
|
77163
77232
|
var import_fs_extra17 = __toESM(require_lib3(), 1);
|
|
77164
|
-
import { lstat as lstat7, mkdir as
|
|
77233
|
+
import { lstat as lstat7, mkdir as mkdir23, readdir as readdir17, stat as stat15 } from "node:fs/promises";
|
|
77165
77234
|
import { join as join74 } from "node:path";
|
|
77166
77235
|
|
|
77167
77236
|
// src/services/transformers/commands-prefix/content-transformer.ts
|
|
77168
77237
|
init_logger();
|
|
77169
|
-
import { readFile as readFile33, readdir as readdir16, writeFile as
|
|
77238
|
+
import { readFile as readFile33, readdir as readdir16, writeFile as writeFile22 } from "node:fs/promises";
|
|
77170
77239
|
import { join as join73 } from "node:path";
|
|
77171
77240
|
var TRANSFORMABLE_EXTENSIONS = new Set([
|
|
77172
77241
|
".md",
|
|
@@ -77242,7 +77311,7 @@ async function transformCommandReferences(directory, options2 = {}) {
|
|
|
77242
77311
|
if (options2.dryRun) {
|
|
77243
77312
|
logger.debug(`[dry-run] Would transform ${changes} command ref(s) in ${fullPath}`);
|
|
77244
77313
|
} else {
|
|
77245
|
-
await
|
|
77314
|
+
await writeFile22(fullPath, transformed, "utf-8");
|
|
77246
77315
|
if (options2.verbose) {
|
|
77247
77316
|
logger.verbose(`Transformed ${changes} command ref(s) in ${fullPath}`);
|
|
77248
77317
|
}
|
|
@@ -77327,9 +77396,9 @@ async function applyPrefix(extractDir) {
|
|
|
77327
77396
|
}
|
|
77328
77397
|
await import_fs_extra17.copy(commandsDir, backupDir);
|
|
77329
77398
|
logger.verbose("Created backup of commands directory");
|
|
77330
|
-
await
|
|
77399
|
+
await mkdir23(tempDir, { recursive: true });
|
|
77331
77400
|
const ckDir = join74(tempDir, "ck");
|
|
77332
|
-
await
|
|
77401
|
+
await mkdir23(ckDir, { recursive: true });
|
|
77333
77402
|
let processedCount = 0;
|
|
77334
77403
|
for (const entry of entries) {
|
|
77335
77404
|
const sourcePath = join74(commandsDir, entry);
|
|
@@ -77767,7 +77836,7 @@ init_skip_directories();
|
|
|
77767
77836
|
init_types2();
|
|
77768
77837
|
var import_fs_extra21 = __toESM(require_lib3(), 1);
|
|
77769
77838
|
import { createHash as createHash2 } from "node:crypto";
|
|
77770
|
-
import { readFile as readFile35, readdir as readdir20, writeFile as
|
|
77839
|
+
import { readFile as readFile35, readdir as readdir20, writeFile as writeFile23 } from "node:fs/promises";
|
|
77771
77840
|
import { join as join78, relative as relative12 } from "node:path";
|
|
77772
77841
|
|
|
77773
77842
|
class SkillsManifestManager {
|
|
@@ -77791,7 +77860,7 @@ class SkillsManifestManager {
|
|
|
77791
77860
|
}
|
|
77792
77861
|
static async writeManifest(skillsDir2, manifest) {
|
|
77793
77862
|
const manifestPath = join78(skillsDir2, SkillsManifestManager.MANIFEST_FILENAME);
|
|
77794
|
-
await
|
|
77863
|
+
await writeFile23(manifestPath, JSON.stringify(manifest, null, 2), "utf-8");
|
|
77795
77864
|
logger.debug(`Wrote manifest to: ${manifestPath}`);
|
|
77796
77865
|
}
|
|
77797
77866
|
static async readManifest(skillsDir2) {
|
|
@@ -78184,7 +78253,7 @@ import { join as join84 } from "node:path";
|
|
|
78184
78253
|
|
|
78185
78254
|
// src/domains/skills/migrator/migration-executor.ts
|
|
78186
78255
|
init_logger();
|
|
78187
|
-
import { copyFile as copyFile5, mkdir as
|
|
78256
|
+
import { copyFile as copyFile5, mkdir as mkdir24, readdir as readdir22, rm as rm5 } from "node:fs/promises";
|
|
78188
78257
|
import { join as join80 } from "node:path";
|
|
78189
78258
|
var import_fs_extra24 = __toESM(require_lib3(), 1);
|
|
78190
78259
|
|
|
@@ -78347,7 +78416,7 @@ Detected changes:`;
|
|
|
78347
78416
|
|
|
78348
78417
|
// src/domains/skills/migrator/migration-executor.ts
|
|
78349
78418
|
async function copySkillDirectory(sourceDir, destDir) {
|
|
78350
|
-
await
|
|
78419
|
+
await mkdir24(destDir, { recursive: true });
|
|
78351
78420
|
const entries = await readdir22(sourceDir, { withFileTypes: true });
|
|
78352
78421
|
for (const entry of entries) {
|
|
78353
78422
|
const sourcePath = join80(sourceDir, entry.name);
|
|
@@ -78367,7 +78436,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
78367
78436
|
const preserved = [];
|
|
78368
78437
|
const errors2 = [];
|
|
78369
78438
|
const tempDir = join80(currentSkillsDir, "..", ".skills-migration-temp");
|
|
78370
|
-
await
|
|
78439
|
+
await mkdir24(tempDir, { recursive: true });
|
|
78371
78440
|
try {
|
|
78372
78441
|
for (const mapping of mappings) {
|
|
78373
78442
|
try {
|
|
@@ -78389,7 +78458,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
78389
78458
|
const category = mapping.category;
|
|
78390
78459
|
const targetPath = category ? join80(tempDir, category, skillName) : join80(tempDir, skillName);
|
|
78391
78460
|
if (category) {
|
|
78392
|
-
await
|
|
78461
|
+
await mkdir24(join80(tempDir, category), { recursive: true });
|
|
78393
78462
|
}
|
|
78394
78463
|
await copySkillDirectory(currentSkillPath, targetPath);
|
|
78395
78464
|
migrated.push(skillName);
|
|
@@ -78408,7 +78477,7 @@ async function executeInternal(mappings, customizations, currentSkillsDir, inter
|
|
|
78408
78477
|
}
|
|
78409
78478
|
}
|
|
78410
78479
|
await rm5(currentSkillsDir, { recursive: true, force: true });
|
|
78411
|
-
await
|
|
78480
|
+
await mkdir24(currentSkillsDir, { recursive: true });
|
|
78412
78481
|
await copySkillDirectory(tempDir, currentSkillsDir);
|
|
78413
78482
|
await rm5(tempDir, { recursive: true, force: true });
|
|
78414
78483
|
return { migrated, preserved, errors: errors2 };
|
|
@@ -78455,7 +78524,7 @@ function validateMigrationPath(path12, paramName) {
|
|
|
78455
78524
|
init_logger();
|
|
78456
78525
|
init_types2();
|
|
78457
78526
|
var import_fs_extra25 = __toESM(require_lib3(), 1);
|
|
78458
|
-
import { copyFile as copyFile6, mkdir as
|
|
78527
|
+
import { copyFile as copyFile6, mkdir as mkdir25, readdir as readdir23, rm as rm6, stat as stat16 } from "node:fs/promises";
|
|
78459
78528
|
import { basename as basename8, join as join81, normalize as normalize8 } from "node:path";
|
|
78460
78529
|
function validatePath2(path12, paramName) {
|
|
78461
78530
|
if (!path12 || typeof path12 !== "string") {
|
|
@@ -78485,7 +78554,7 @@ class SkillsBackupManager {
|
|
|
78485
78554
|
const backupDir = parentDir ? join81(parentDir, backupDirName) : join81(skillsDir2, "..", backupDirName);
|
|
78486
78555
|
logger.info(`Creating backup at: ${backupDir}`);
|
|
78487
78556
|
try {
|
|
78488
|
-
await
|
|
78557
|
+
await mkdir25(backupDir, { recursive: true });
|
|
78489
78558
|
await SkillsBackupManager.copyDirectory(skillsDir2, backupDir);
|
|
78490
78559
|
logger.success("Backup created successfully");
|
|
78491
78560
|
return backupDir;
|
|
@@ -78507,7 +78576,7 @@ class SkillsBackupManager {
|
|
|
78507
78576
|
if (await import_fs_extra25.pathExists(targetDir)) {
|
|
78508
78577
|
await rm6(targetDir, { recursive: true, force: true });
|
|
78509
78578
|
}
|
|
78510
|
-
await
|
|
78579
|
+
await mkdir25(targetDir, { recursive: true });
|
|
78511
78580
|
await SkillsBackupManager.copyDirectory(backupDir, targetDir);
|
|
78512
78581
|
logger.success("Backup restored successfully");
|
|
78513
78582
|
} catch (error) {
|
|
@@ -78567,7 +78636,7 @@ class SkillsBackupManager {
|
|
|
78567
78636
|
continue;
|
|
78568
78637
|
}
|
|
78569
78638
|
if (entry.isDirectory()) {
|
|
78570
|
-
await
|
|
78639
|
+
await mkdir25(destPath, { recursive: true });
|
|
78571
78640
|
await SkillsBackupManager.copyDirectory(sourcePath, destPath);
|
|
78572
78641
|
} else if (entry.isFile()) {
|
|
78573
78642
|
await copyFile6(sourcePath, destPath);
|
|
@@ -78986,7 +79055,7 @@ import { join as join87 } from "node:path";
|
|
|
78986
79055
|
|
|
78987
79056
|
// src/services/transformers/opencode-path-transformer.ts
|
|
78988
79057
|
init_logger();
|
|
78989
|
-
import { readFile as readFile37, readdir as readdir26, writeFile as
|
|
79058
|
+
import { readFile as readFile37, readdir as readdir26, writeFile as writeFile24 } from "node:fs/promises";
|
|
78990
79059
|
import { platform as platform12 } from "node:os";
|
|
78991
79060
|
import { extname as extname3, join as join86 } from "node:path";
|
|
78992
79061
|
var IS_WINDOWS3 = platform12() === "win32";
|
|
@@ -79060,7 +79129,7 @@ async function transformPathsForGlobalOpenCode(directory, options2 = {}) {
|
|
|
79060
79129
|
const content = await readFile37(fullPath, "utf-8");
|
|
79061
79130
|
const { transformed, changes } = transformOpenCodeContent(content);
|
|
79062
79131
|
if (changes > 0) {
|
|
79063
|
-
await
|
|
79132
|
+
await writeFile24(fullPath, transformed, "utf-8");
|
|
79064
79133
|
filesTransformed++;
|
|
79065
79134
|
totalChanges += changes;
|
|
79066
79135
|
if (options2.verbose) {
|
|
@@ -79281,7 +79350,7 @@ async function handlePostInstall(ctx) {
|
|
|
79281
79350
|
// src/commands/init/phases/selection-handler.ts
|
|
79282
79351
|
init_config_manager();
|
|
79283
79352
|
init_github_client();
|
|
79284
|
-
import { mkdir as
|
|
79353
|
+
import { mkdir as mkdir26 } from "node:fs/promises";
|
|
79285
79354
|
import { join as join90, resolve as resolve15 } from "node:path";
|
|
79286
79355
|
|
|
79287
79356
|
// src/domains/github/kit-access-checker.ts
|
|
@@ -79804,7 +79873,7 @@ async function handleSelection(ctx) {
|
|
|
79804
79873
|
}
|
|
79805
79874
|
if (!await import_fs_extra32.pathExists(resolvedDir)) {
|
|
79806
79875
|
if (ctx.options.global) {
|
|
79807
|
-
await
|
|
79876
|
+
await mkdir26(resolvedDir, { recursive: true });
|
|
79808
79877
|
logger.info(`Created global directory: ${resolvedDir}`);
|
|
79809
79878
|
} else {
|
|
79810
79879
|
logger.error(`Directory does not exist: ${resolvedDir}`);
|
|
@@ -79939,7 +80008,7 @@ async function handleSelection(ctx) {
|
|
|
79939
80008
|
};
|
|
79940
80009
|
}
|
|
79941
80010
|
// src/commands/init/phases/sync-handler.ts
|
|
79942
|
-
import { copyFile as copyFile7, mkdir as
|
|
80011
|
+
import { copyFile as copyFile7, mkdir as mkdir27, open as open4, readFile as readFile39, rename as rename3, stat as stat17, unlink as unlink8, writeFile as writeFile26 } from "node:fs/promises";
|
|
79943
80012
|
import { dirname as dirname18, join as join91, resolve as resolve16 } from "node:path";
|
|
79944
80013
|
init_logger();
|
|
79945
80014
|
init_path_resolver();
|
|
@@ -80059,7 +80128,7 @@ async function acquireSyncLock(global3) {
|
|
|
80059
80128
|
const lockPath = join91(cacheDir, ".sync-lock");
|
|
80060
80129
|
const startTime = Date.now();
|
|
80061
80130
|
const lockTimeout = getLockTimeout();
|
|
80062
|
-
await
|
|
80131
|
+
await mkdir27(dirname18(lockPath), { recursive: true });
|
|
80063
80132
|
while (Date.now() - startTime < lockTimeout) {
|
|
80064
80133
|
try {
|
|
80065
80134
|
const handle = await open4(lockPath, "wx");
|
|
@@ -80139,7 +80208,7 @@ async function executeSyncMerge(ctx) {
|
|
|
80139
80208
|
const targetPath = await validateSyncPath(ctx.claudeDir, file.path);
|
|
80140
80209
|
const targetDir = join91(targetPath, "..");
|
|
80141
80210
|
try {
|
|
80142
|
-
await
|
|
80211
|
+
await mkdir27(targetDir, { recursive: true });
|
|
80143
80212
|
} catch (mkdirError) {
|
|
80144
80213
|
const errCode = mkdirError.code;
|
|
80145
80214
|
if (errCode === "ENOSPC") {
|
|
@@ -80218,7 +80287,7 @@ async function executeSyncMerge(ctx) {
|
|
|
80218
80287
|
try {
|
|
80219
80288
|
const tempPath = `${currentPath}.tmp.${Date.now()}`;
|
|
80220
80289
|
try {
|
|
80221
|
-
await
|
|
80290
|
+
await writeFile26(tempPath, result.result, "utf-8");
|
|
80222
80291
|
await rename3(tempPath, currentPath);
|
|
80223
80292
|
} catch (atomicError) {
|
|
80224
80293
|
await unlink8(tempPath).catch(() => {});
|
|
@@ -80302,14 +80371,14 @@ function displaySyncPlan(plan) {
|
|
|
80302
80371
|
console.log(import_picocolors21.default.dim("─".repeat(40)));
|
|
80303
80372
|
}
|
|
80304
80373
|
async function createBackup(claudeDir2, files, backupDir) {
|
|
80305
|
-
await
|
|
80374
|
+
await mkdir27(backupDir, { recursive: true });
|
|
80306
80375
|
for (const file of files) {
|
|
80307
80376
|
try {
|
|
80308
80377
|
const sourcePath = await validateSyncPath(claudeDir2, file.path);
|
|
80309
80378
|
if (await import_fs_extra33.pathExists(sourcePath)) {
|
|
80310
80379
|
const targetPath = await validateSyncPath(backupDir, file.path);
|
|
80311
80380
|
const targetDir = join91(targetPath, "..");
|
|
80312
|
-
await
|
|
80381
|
+
await mkdir27(targetDir, { recursive: true });
|
|
80313
80382
|
await copyFile7(sourcePath, targetPath);
|
|
80314
80383
|
}
|
|
80315
80384
|
} catch (error) {
|
|
@@ -80405,7 +80474,7 @@ async function renameFolders(dirsToRename, extractDir, options2) {
|
|
|
80405
80474
|
// src/services/transformers/folder-transform/path-replacer.ts
|
|
80406
80475
|
init_logger();
|
|
80407
80476
|
init_types2();
|
|
80408
|
-
import { readFile as readFile40, readdir as readdir28, writeFile as
|
|
80477
|
+
import { readFile as readFile40, readdir as readdir28, writeFile as writeFile27 } from "node:fs/promises";
|
|
80409
80478
|
import { join as join93, relative as relative16 } from "node:path";
|
|
80410
80479
|
var TRANSFORMABLE_FILE_PATTERNS = [
|
|
80411
80480
|
".md",
|
|
@@ -80488,7 +80557,7 @@ async function transformFileContents(dir, compiledReplacements, options2) {
|
|
|
80488
80557
|
if (options2.dryRun) {
|
|
80489
80558
|
logger.debug(`[dry-run] Would update ${relative16(dir, fullPath)}: ${changeCount} replacement(s)`);
|
|
80490
80559
|
} else {
|
|
80491
|
-
await
|
|
80560
|
+
await writeFile27(fullPath, newContent, "utf-8");
|
|
80492
80561
|
logger.debug(`Updated ${relative16(dir, fullPath)}: ${changeCount} replacement(s)`);
|
|
80493
80562
|
}
|
|
80494
80563
|
filesChanged++;
|
|
@@ -80594,7 +80663,7 @@ async function transformFolderPaths(extractDir, folders, options2 = {}) {
|
|
|
80594
80663
|
|
|
80595
80664
|
// src/services/transformers/global-path-transformer.ts
|
|
80596
80665
|
init_logger();
|
|
80597
|
-
import { readFile as readFile41, readdir as readdir29, writeFile as
|
|
80666
|
+
import { readFile as readFile41, readdir as readdir29, writeFile as writeFile28 } from "node:fs/promises";
|
|
80598
80667
|
import { platform as platform13 } from "node:os";
|
|
80599
80668
|
import { extname as extname4, join as join94 } from "node:path";
|
|
80600
80669
|
var IS_WINDOWS4 = platform13() === "win32";
|
|
@@ -80717,7 +80786,7 @@ async function transformPathsForGlobalInstall(directory, options2 = {}) {
|
|
|
80717
80786
|
const content = await readFile41(fullPath, "utf-8");
|
|
80718
80787
|
const { transformed, changes } = transformContent(content);
|
|
80719
80788
|
if (changes > 0) {
|
|
80720
|
-
await
|
|
80789
|
+
await writeFile28(fullPath, transformed, "utf-8");
|
|
80721
80790
|
filesTransformed++;
|
|
80722
80791
|
totalChanges += changes;
|
|
80723
80792
|
if (options2.verbose) {
|
|
@@ -81575,10 +81644,10 @@ init_dist2();
|
|
|
81575
81644
|
|
|
81576
81645
|
// src/commands/setup/phases/preflight-check.ts
|
|
81577
81646
|
init_dist2();
|
|
81578
|
-
import { execSync as
|
|
81647
|
+
import { execSync as execSync4 } from "node:child_process";
|
|
81579
81648
|
function isGhInstalled() {
|
|
81580
81649
|
try {
|
|
81581
|
-
|
|
81650
|
+
execSync4("gh --version", { stdio: "pipe" });
|
|
81582
81651
|
return true;
|
|
81583
81652
|
} catch {
|
|
81584
81653
|
return false;
|
|
@@ -81586,7 +81655,7 @@ function isGhInstalled() {
|
|
|
81586
81655
|
}
|
|
81587
81656
|
function checkGhAuth() {
|
|
81588
81657
|
try {
|
|
81589
|
-
|
|
81658
|
+
execSync4("gh auth status", { stdio: "pipe" });
|
|
81590
81659
|
return true;
|
|
81591
81660
|
} catch {
|
|
81592
81661
|
return false;
|
|
@@ -81603,11 +81672,11 @@ function checkNodeVersion() {
|
|
|
81603
81672
|
}
|
|
81604
81673
|
function checkPython() {
|
|
81605
81674
|
try {
|
|
81606
|
-
|
|
81675
|
+
execSync4("python3 --version", { stdio: "pipe" });
|
|
81607
81676
|
return true;
|
|
81608
81677
|
} catch {
|
|
81609
81678
|
try {
|
|
81610
|
-
|
|
81679
|
+
execSync4("python --version", { stdio: "pipe" });
|
|
81611
81680
|
return true;
|
|
81612
81681
|
} catch {
|
|
81613
81682
|
return false;
|