claudekit-cli 3.3.0 → 3.3.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 +52 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -13078,7 +13078,7 @@ var cac = (name = "") => new CAC(name);
|
|
|
13078
13078
|
// package.json
|
|
13079
13079
|
var package_default = {
|
|
13080
13080
|
name: "claudekit-cli",
|
|
13081
|
-
version: "3.3.
|
|
13081
|
+
version: "3.3.1",
|
|
13082
13082
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
13083
13083
|
type: "module",
|
|
13084
13084
|
repository: {
|
|
@@ -31066,7 +31066,7 @@ init_types2();
|
|
|
31066
31066
|
init_types2();
|
|
31067
31067
|
init_logger();
|
|
31068
31068
|
import { existsSync as existsSync5 } from "node:fs";
|
|
31069
|
-
import { mkdir as mkdir8, readFile as readFile12, writeFile as writeFile10 } from "node:fs/promises";
|
|
31069
|
+
import { mkdir as mkdir8, readFile as readFile12, rename as rename2, rm as rm3, writeFile as writeFile10 } from "node:fs/promises";
|
|
31070
31070
|
import { chmod as chmod2 } from "node:fs/promises";
|
|
31071
31071
|
import { platform as platform8 } from "node:os";
|
|
31072
31072
|
import { join as join24 } from "node:path";
|
|
@@ -31075,6 +31075,9 @@ var PROJECT_CONFIG_FILE = ".ck.json";
|
|
|
31075
31075
|
class ConfigManager {
|
|
31076
31076
|
static config = null;
|
|
31077
31077
|
static globalFlag = false;
|
|
31078
|
+
static getProjectConfigDir(projectDir, global3) {
|
|
31079
|
+
return global3 ? projectDir : join24(projectDir, ".claude");
|
|
31080
|
+
}
|
|
31078
31081
|
static setGlobalFlag(global3) {
|
|
31079
31082
|
ConfigManager.globalFlag = global3;
|
|
31080
31083
|
ConfigManager.config = null;
|
|
@@ -31138,8 +31141,9 @@ class ConfigManager {
|
|
|
31138
31141
|
current[keys[keys.length - 1]] = value;
|
|
31139
31142
|
await ConfigManager.save(config);
|
|
31140
31143
|
}
|
|
31141
|
-
static async loadProjectConfig(projectDir) {
|
|
31142
|
-
const
|
|
31144
|
+
static async loadProjectConfig(projectDir, global3 = false) {
|
|
31145
|
+
const configDir = ConfigManager.getProjectConfigDir(projectDir, global3);
|
|
31146
|
+
const configPath = join24(configDir, PROJECT_CONFIG_FILE);
|
|
31143
31147
|
try {
|
|
31144
31148
|
if (existsSync5(configPath)) {
|
|
31145
31149
|
const content = await readFile12(configPath, "utf-8");
|
|
@@ -31153,12 +31157,12 @@ class ConfigManager {
|
|
|
31153
31157
|
}
|
|
31154
31158
|
return null;
|
|
31155
31159
|
}
|
|
31156
|
-
static async saveProjectConfig(projectDir, folders) {
|
|
31157
|
-
const
|
|
31158
|
-
const configPath = join24(
|
|
31160
|
+
static async saveProjectConfig(projectDir, folders, global3 = false) {
|
|
31161
|
+
const configDir = ConfigManager.getProjectConfigDir(projectDir, global3);
|
|
31162
|
+
const configPath = join24(configDir, PROJECT_CONFIG_FILE);
|
|
31159
31163
|
try {
|
|
31160
|
-
if (!existsSync5(
|
|
31161
|
-
await mkdir8(
|
|
31164
|
+
if (!existsSync5(configDir)) {
|
|
31165
|
+
await mkdir8(configDir, { recursive: true });
|
|
31162
31166
|
}
|
|
31163
31167
|
const validFolders = FoldersConfigSchema.parse(folders);
|
|
31164
31168
|
await writeFile10(configPath, JSON.stringify({ paths: validFolders }, null, 2), "utf-8");
|
|
@@ -31167,14 +31171,14 @@ class ConfigManager {
|
|
|
31167
31171
|
throw new Error(`Failed to save project config: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
31168
31172
|
}
|
|
31169
31173
|
}
|
|
31170
|
-
static async resolveFoldersConfig(projectDir, cliOptions) {
|
|
31174
|
+
static async resolveFoldersConfig(projectDir, cliOptions, global3 = false) {
|
|
31171
31175
|
const result = { ...DEFAULT_FOLDERS };
|
|
31172
31176
|
const globalConfig = await ConfigManager.load();
|
|
31173
31177
|
if (globalConfig.folders?.docs)
|
|
31174
31178
|
result.docs = globalConfig.folders.docs;
|
|
31175
31179
|
if (globalConfig.folders?.plans)
|
|
31176
31180
|
result.plans = globalConfig.folders.plans;
|
|
31177
|
-
const projectConfig = await ConfigManager.loadProjectConfig(projectDir);
|
|
31181
|
+
const projectConfig = await ConfigManager.loadProjectConfig(projectDir, global3);
|
|
31178
31182
|
if (projectConfig?.docs)
|
|
31179
31183
|
result.docs = projectConfig.docs;
|
|
31180
31184
|
if (projectConfig?.plans)
|
|
@@ -31185,8 +31189,36 @@ class ConfigManager {
|
|
|
31185
31189
|
result.plans = cliOptions.plansDir;
|
|
31186
31190
|
return result;
|
|
31187
31191
|
}
|
|
31188
|
-
static projectConfigExists(projectDir) {
|
|
31189
|
-
|
|
31192
|
+
static projectConfigExists(projectDir, global3 = false) {
|
|
31193
|
+
const configDir = ConfigManager.getProjectConfigDir(projectDir, global3);
|
|
31194
|
+
return existsSync5(join24(configDir, PROJECT_CONFIG_FILE));
|
|
31195
|
+
}
|
|
31196
|
+
static async migrateNestedConfig(globalDir) {
|
|
31197
|
+
const correctPath = join24(globalDir, PROJECT_CONFIG_FILE);
|
|
31198
|
+
const incorrectPath = join24(globalDir, ".claude", PROJECT_CONFIG_FILE);
|
|
31199
|
+
if (existsSync5(correctPath)) {
|
|
31200
|
+
logger.debug("Config already exists at correct location, skipping migration");
|
|
31201
|
+
return false;
|
|
31202
|
+
}
|
|
31203
|
+
if (existsSync5(incorrectPath)) {
|
|
31204
|
+
try {
|
|
31205
|
+
logger.info("Migrating .ck.json from nested location to correct location...");
|
|
31206
|
+
await rename2(incorrectPath, correctPath);
|
|
31207
|
+
logger.success(`Migrated ${PROJECT_CONFIG_FILE} to ${correctPath}`);
|
|
31208
|
+
const nestedClaudeDir = join24(globalDir, ".claude");
|
|
31209
|
+
try {
|
|
31210
|
+
await rm3(nestedClaudeDir, { recursive: false });
|
|
31211
|
+
logger.debug("Removed empty nested .claude directory");
|
|
31212
|
+
} catch (rmError) {
|
|
31213
|
+
logger.debug(`Could not remove nested .claude dir (may contain other files): ${rmError instanceof Error ? rmError.message : "Unknown"}`);
|
|
31214
|
+
}
|
|
31215
|
+
return true;
|
|
31216
|
+
} catch (error2) {
|
|
31217
|
+
logger.warning(`Failed to migrate config: ${error2 instanceof Error ? error2.message : "Unknown error"}`);
|
|
31218
|
+
return false;
|
|
31219
|
+
}
|
|
31220
|
+
}
|
|
31221
|
+
return false;
|
|
31190
31222
|
}
|
|
31191
31223
|
}
|
|
31192
31224
|
|
|
@@ -31469,10 +31501,13 @@ async function initCommand(options) {
|
|
|
31469
31501
|
});
|
|
31470
31502
|
logger.success(`Transformed ${transformResult.totalChanges} path(s) in ${transformResult.filesTransformed} file(s)`);
|
|
31471
31503
|
}
|
|
31504
|
+
if (validOptions.global) {
|
|
31505
|
+
await ConfigManager.migrateNestedConfig(resolvedDir);
|
|
31506
|
+
}
|
|
31472
31507
|
const foldersConfig = await ConfigManager.resolveFoldersConfig(resolvedDir, {
|
|
31473
31508
|
docsDir: validOptions.docsDir,
|
|
31474
31509
|
plansDir: validOptions.plansDir
|
|
31475
|
-
});
|
|
31510
|
+
}, validOptions.global);
|
|
31476
31511
|
validateFolderOptions(validOptions);
|
|
31477
31512
|
const hasCustomFolders = foldersConfig.docs !== DEFAULT_FOLDERS.docs || foldersConfig.plans !== DEFAULT_FOLDERS.plans;
|
|
31478
31513
|
if (hasCustomFolders) {
|
|
@@ -31485,8 +31520,8 @@ async function initCommand(options) {
|
|
|
31485
31520
|
await ConfigManager.saveProjectConfig(resolvedDir, {
|
|
31486
31521
|
docs: foldersConfig.docs,
|
|
31487
31522
|
plans: foldersConfig.plans
|
|
31488
|
-
});
|
|
31489
|
-
logger.debug("Saved folder configuration to .claude/.ck.json");
|
|
31523
|
+
}, validOptions.global);
|
|
31524
|
+
logger.debug(validOptions.global ? "Saved folder configuration to ~/.claude/.ck.json" : "Saved folder configuration to .claude/.ck.json");
|
|
31490
31525
|
}
|
|
31491
31526
|
}
|
|
31492
31527
|
if (!validOptions.fresh) {
|
|
@@ -32136,7 +32171,7 @@ import { promisify as promisify6 } from "node:util";
|
|
|
32136
32171
|
// package.json
|
|
32137
32172
|
var package_default2 = {
|
|
32138
32173
|
name: "claudekit-cli",
|
|
32139
|
-
version: "3.3.
|
|
32174
|
+
version: "3.3.1",
|
|
32140
32175
|
description: "CLI tool for bootstrapping and updating ClaudeKit projects",
|
|
32141
32176
|
type: "module",
|
|
32142
32177
|
repository: {
|