claudekit-cli 3.33.0-dev.2 → 3.33.0-dev.3

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.
Files changed (2) hide show
  1. package/dist/index.js +76 -79
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -45375,7 +45375,7 @@ var package_default;
45375
45375
  var init_package = __esm(() => {
45376
45376
  package_default = {
45377
45377
  name: "claudekit-cli",
45378
- version: "3.33.0-dev.2",
45378
+ version: "3.33.0-dev.3",
45379
45379
  description: "CLI tool for bootstrapping and updating ClaudeKit projects",
45380
45380
  type: "module",
45381
45381
  repository: {
@@ -59709,19 +59709,24 @@ async function checkPort(port) {
59709
59709
  init_config();
59710
59710
  async function handleGet(key, options2) {
59711
59711
  const { global: globalOnly, json } = options2;
59712
- let config;
59713
- if (globalOnly) {
59714
- ConfigManager.setGlobalFlag(true);
59715
- config = await ConfigManager.load();
59716
- } else {
59717
- ConfigManager.setGlobalFlag(true);
59718
- const globalConfig = await ConfigManager.load();
59719
- const localConfig = await ConfigManager.loadProjectConfig(process.cwd(), false);
59720
- config = deepMerge3(globalConfig, localConfig ? { paths: localConfig } : {});
59712
+ const projectDir = process.cwd();
59713
+ let value;
59714
+ try {
59715
+ if (globalOnly) {
59716
+ const scoped = await CkConfigManager.loadScope("global", projectDir);
59717
+ value = scoped ? getNestedValue2(scoped, key) : undefined;
59718
+ } else {
59719
+ const { value: v2 } = await CkConfigManager.getFieldWithSource(key, projectDir);
59720
+ value = v2;
59721
+ }
59722
+ } catch (error) {
59723
+ console.error(`Failed to read config: ${error instanceof Error ? error.message : "Unknown error"}`);
59724
+ process.exitCode = 1;
59725
+ return;
59721
59726
  }
59722
- const value = getNestedValue2(config, key);
59723
59727
  if (value === undefined) {
59724
59728
  console.error(`Key not found: ${key}`);
59729
+ console.error(`Run: ck config show --json | jq 'keys'`);
59725
59730
  process.exitCode = 1;
59726
59731
  return;
59727
59732
  }
@@ -59739,18 +59744,6 @@ function getNestedValue2(obj, path2) {
59739
59744
  return;
59740
59745
  }, obj);
59741
59746
  }
59742
- function deepMerge3(target, source) {
59743
- const result = { ...target };
59744
- for (const key of Object.keys(source)) {
59745
- const sourceVal = source[key];
59746
- if (sourceVal && typeof sourceVal === "object" && !Array.isArray(sourceVal)) {
59747
- result[key] = deepMerge3(result[key] || {}, sourceVal);
59748
- } else {
59749
- result[key] = sourceVal;
59750
- }
59751
- }
59752
- return result;
59753
- }
59754
59747
 
59755
59748
  // src/commands/config/phases/set-handler.ts
59756
59749
  init_config();
@@ -59758,6 +59751,11 @@ init_logger();
59758
59751
  init_dist2();
59759
59752
  async function handleSet(key, value, options2) {
59760
59753
  const { global: globalOnly, local: localOnly } = options2;
59754
+ if (globalOnly && localOnly) {
59755
+ console.error("Cannot use both --global and --local flags together");
59756
+ process.exitCode = 1;
59757
+ return;
59758
+ }
59761
59759
  let parsedValue;
59762
59760
  try {
59763
59761
  parsedValue = JSON.parse(value);
@@ -59768,13 +59766,13 @@ async function handleSet(key, value, options2) {
59768
59766
  if (globalOnly) {
59769
59767
  scope = "global";
59770
59768
  } else if (localOnly) {
59771
- scope = "local";
59769
+ scope = "project";
59772
59770
  } else {
59773
59771
  const selectedScope = await ie({
59774
59772
  message: "Where do you want to save this setting?",
59775
59773
  options: [
59776
- { value: "local", label: "Local (project)", hint: ".claude/.ck.json" },
59777
- { value: "global", label: "Global (user)", hint: "~/.claudekit/config.json" }
59774
+ { value: "project", label: "Local (project)", hint: ".claude/.ck.json" },
59775
+ { value: "global", label: "Global (user)", hint: "~/.claude/.ck.json" }
59778
59776
  ]
59779
59777
  });
59780
59778
  if (lD(selectedScope)) {
@@ -59784,51 +59782,40 @@ async function handleSet(key, value, options2) {
59784
59782
  }
59785
59783
  scope = selectedScope;
59786
59784
  }
59787
- if (scope === "global") {
59788
- ConfigManager.setGlobalFlag(true);
59789
- await ConfigManager.set(key, parsedValue);
59790
- logger.success(`Set ${key} = ${JSON.stringify(parsedValue)} (global)`);
59791
- } else {
59792
- const projectDir = process.cwd();
59793
- const existing = await ConfigManager.loadProjectConfig(projectDir, false) || {};
59794
- setNestedValue2(existing, key, parsedValue);
59795
- await ConfigManager.saveProjectConfig(projectDir, existing, false);
59796
- logger.success(`Set ${key} = ${JSON.stringify(parsedValue)} (local)`);
59797
- }
59798
- }
59799
- function setNestedValue2(obj, path2, value) {
59800
- const keys = path2.split(".");
59801
- let current = obj;
59802
- for (let i = 0;i < keys.length - 1; i++) {
59803
- const k2 = keys[i];
59804
- if (!(k2 in current) || typeof current[k2] !== "object") {
59805
- current[k2] = {};
59806
- }
59807
- current = current[k2];
59785
+ const projectDir = process.cwd();
59786
+ try {
59787
+ await CkConfigManager.updateField(key, parsedValue, scope, projectDir);
59788
+ logger.success(`Set ${key} = ${JSON.stringify(parsedValue)} (${scope === "project" ? "local" : "global"})`);
59789
+ } catch (error) {
59790
+ logger.error(`Invalid value for ${key}: ${error instanceof Error ? error.message : "Unknown"}`);
59791
+ process.exitCode = 1;
59792
+ return;
59808
59793
  }
59809
- current[keys[keys.length - 1]] = value;
59810
59794
  }
59811
59795
 
59812
59796
  // src/commands/config/phases/show-handler.ts
59813
59797
  init_config();
59814
59798
  async function handleShow(options2) {
59815
59799
  const { global: globalOnly, local: localOnly, json } = options2;
59800
+ const projectDir = process.cwd();
59801
+ if (globalOnly && localOnly) {
59802
+ console.error("Cannot use both --global and --local flags together");
59803
+ process.exitCode = 1;
59804
+ return;
59805
+ }
59816
59806
  let config;
59817
59807
  let label;
59818
59808
  if (globalOnly) {
59819
- ConfigManager.setGlobalFlag(true);
59820
- config = await ConfigManager.load();
59809
+ const scoped = await CkConfigManager.loadScope("global", projectDir);
59810
+ config = scoped || {};
59821
59811
  label = "Global config";
59822
59812
  } else if (localOnly) {
59823
- const projectDir = process.cwd();
59824
- const projectConfig = await ConfigManager.loadProjectConfig(projectDir, false);
59825
- config = projectConfig ? { paths: projectConfig } : {};
59813
+ const scoped = await CkConfigManager.loadScope("project", projectDir);
59814
+ config = scoped || {};
59826
59815
  label = "Local config";
59827
59816
  } else {
59828
- ConfigManager.setGlobalFlag(true);
59829
- const globalConfig = await ConfigManager.load();
59830
- const localConfig = await ConfigManager.loadProjectConfig(process.cwd(), false);
59831
- config = deepMerge4(globalConfig, localConfig ? { paths: localConfig } : {});
59817
+ const { config: merged } = await CkConfigManager.loadFull(projectDir);
59818
+ config = merged;
59832
59819
  label = "Merged config";
59833
59820
  }
59834
59821
  if (json) {
@@ -59837,35 +59824,30 @@ async function handleShow(options2) {
59837
59824
  console.log(`
59838
59825
  ${label}:
59839
59826
  `);
59840
- console.log(formatConfig(config));
59841
- }
59842
- }
59843
- function deepMerge4(target, source) {
59844
- const result = { ...target };
59845
- for (const key of Object.keys(source)) {
59846
- const sourceVal = source[key];
59847
- if (sourceVal && typeof sourceVal === "object" && !Array.isArray(sourceVal)) {
59848
- result[key] = deepMerge4(result[key] || {}, sourceVal);
59849
- } else {
59850
- result[key] = sourceVal;
59851
- }
59827
+ console.log(JSON.stringify(config, null, 2));
59852
59828
  }
59853
- return result;
59854
- }
59855
- function formatConfig(config) {
59856
- return JSON.stringify(config, null, 2);
59857
59829
  }
59858
59830
 
59859
59831
  // src/commands/config/config-command.ts
59860
59832
  async function configCommand(action, keyOrOptions, valueOrOptions, options2) {
59861
59833
  if (action === "ui") {
59862
- const uiOpts = options2 || (typeof keyOrOptions === "object" ? keyOrOptions : {});
59863
- return configUICommand(uiOpts);
59834
+ const uiOpts2 = options2 || (typeof keyOrOptions === "object" ? keyOrOptions : {});
59835
+ return configUICommand(uiOpts2);
59864
59836
  }
59865
- if (action === "get" && typeof keyOrOptions === "string") {
59837
+ if (action === "get") {
59838
+ if (typeof keyOrOptions !== "string" || !keyOrOptions.trim()) {
59839
+ console.error("Usage: ck config get <key>");
59840
+ process.exitCode = 1;
59841
+ return;
59842
+ }
59866
59843
  return handleGet(keyOrOptions, options2 || {});
59867
59844
  }
59868
- if (action === "set" && typeof keyOrOptions === "string") {
59845
+ if (action === "set") {
59846
+ if (typeof keyOrOptions !== "string" || !keyOrOptions.trim()) {
59847
+ console.error("Usage: ck config set <key> <value>");
59848
+ process.exitCode = 1;
59849
+ return;
59850
+ }
59869
59851
  if (typeof valueOrOptions !== "string") {
59870
59852
  console.error("Usage: ck config set <key> <value>");
59871
59853
  process.exitCode = 1;
@@ -59873,8 +59855,23 @@ async function configCommand(action, keyOrOptions, valueOrOptions, options2) {
59873
59855
  }
59874
59856
  return handleSet(keyOrOptions, valueOrOptions, options2 || {});
59875
59857
  }
59876
- const opts = typeof keyOrOptions === "object" ? keyOrOptions : options2 || {};
59877
- return handleShow(opts);
59858
+ if (action === "show") {
59859
+ const opts = typeof keyOrOptions === "object" ? keyOrOptions : options2 || {};
59860
+ return handleShow(opts);
59861
+ }
59862
+ if (action && !["ui", "get", "set", "show"].includes(action)) {
59863
+ console.error(`Unknown action: ${action}`);
59864
+ console.error("Valid actions: get, set, show, ui");
59865
+ process.exitCode = 1;
59866
+ return;
59867
+ }
59868
+ const rawOpts = options2 || (typeof keyOrOptions === "object" ? keyOrOptions : {});
59869
+ const uiOpts = {
59870
+ port: rawOpts?.port,
59871
+ noOpen: rawOpts?.noOpen,
59872
+ dev: rawOpts?.dev
59873
+ };
59874
+ return configUICommand(uiOpts);
59878
59875
  }
59879
59876
  // src/domains/health-checks/types.ts
59880
59877
  init_zod();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claudekit-cli",
3
- "version": "3.33.0-dev.2",
3
+ "version": "3.33.0-dev.3",
4
4
  "description": "CLI tool for bootstrapping and updating ClaudeKit projects",
5
5
  "type": "module",
6
6
  "repository": {