claude-use 2.0.0 → 2.0.2

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/cli.cjs +36 -10
  2. package/package.json +1 -1
package/dist/cli.cjs CHANGED
@@ -221857,7 +221857,7 @@ var categories_default_default = {
221857
221857
  // package.json
221858
221858
  var package_default = {
221859
221859
  name: "claude-use",
221860
- version: "2.0.0",
221860
+ version: "2.0.2",
221861
221861
  description: "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
221862
221862
  license: "Apache-2.0",
221863
221863
  author: "Joseph Mearman <joseph@mearman.co.uk>",
@@ -240354,11 +240354,15 @@ function createProfile(paths, name, extendsList) {
240354
240354
  if (profileExists(paths, name)) {
240355
240355
  throw new ProfileAlreadyExistsError(name);
240356
240356
  }
240357
- const profile = ConfigProfileSchema.parse(
240357
+ const filePath = profileJsonPath(paths, name);
240358
+ const parsed = ConfigProfileSchema.safeParse(
240358
240359
  extendsList !== void 0 && extendsList.length > 0 ? { extends: [...extendsList] } : {}
240359
240360
  );
240360
- writeJsonAtomic(profileJsonPath(paths, name), profile);
240361
- return profile;
240361
+ if (!parsed.success) {
240362
+ throw new ConfigValidationError(filePath, parsed.error.issues);
240363
+ }
240364
+ writeJsonAtomic(filePath, parsed.data);
240365
+ return parsed.data;
240362
240366
  }
240363
240367
  function listProfiles(paths) {
240364
240368
  if (!import_node_fs4.default.existsSync(paths.configProfilesDir)) {
@@ -240502,6 +240506,16 @@ var IdentityAlreadyExistsError = class extends CliError {
240502
240506
  }
240503
240507
  identityName;
240504
240508
  };
240509
+ var InvalidIdentityNameError = class extends CliError {
240510
+ constructor(attemptedName) {
240511
+ super(
240512
+ `"${attemptedName}" is not a valid identity name \u2014 identity names must start with a letter or number and may only contain letters, numbers, dots, hyphens, and underscores.`
240513
+ );
240514
+ this.attemptedName = attemptedName;
240515
+ this.name = "InvalidIdentityNameError";
240516
+ }
240517
+ attemptedName;
240518
+ };
240505
240519
  function identityJsonPath(paths, name) {
240506
240520
  return import_node_path16.default.join(paths.identitiesDir, name, "identity.json");
240507
240521
  }
@@ -240515,9 +240529,12 @@ function addIdentity(paths, name) {
240515
240529
  if (identityExists(paths, name)) {
240516
240530
  throw new IdentityAlreadyExistsError(name);
240517
240531
  }
240518
- const identity = IdentitySchema.parse({ name, allowAmbientCredential: false });
240519
- writeJsonAtomic(identityJsonPath(paths, name), identity);
240520
- return identity;
240532
+ const parsed = IdentitySchema.safeParse({ name, allowAmbientCredential: false });
240533
+ if (!parsed.success) {
240534
+ throw new InvalidIdentityNameError(name);
240535
+ }
240536
+ writeJsonAtomic(identityJsonPath(paths, name), parsed.data);
240537
+ return parsed.data;
240521
240538
  }
240522
240539
  function useIdentity(paths, name) {
240523
240540
  if (!identityExists(paths, name)) {
@@ -240719,19 +240736,28 @@ var DirectoryRuleNotFoundError = class extends CliError {
240719
240736
  }
240720
240737
  rulePath;
240721
240738
  };
240739
+ var DirectoryRuleMissingTargetError = class extends CliError {
240740
+ constructor() {
240741
+ super("A directory rule must set at least one of --profile or --identity.");
240742
+ this.name = "DirectoryRuleMissingTargetError";
240743
+ }
240744
+ };
240722
240745
  function readDirectoryRules(paths) {
240723
240746
  return readJson(paths.directoryRulesFile, DirectoryRulesSchema) ?? { rules: [] };
240724
240747
  }
240725
240748
  function writeDirectoryRules(paths, rules) {
240726
- const validated = DirectoryRulesSchema.parse(rules);
240727
- writeJsonAtomic(paths.directoryRulesFile, validated);
240749
+ const parsed = DirectoryRulesSchema.safeParse(rules);
240750
+ if (!parsed.success) {
240751
+ throw new ConfigValidationError(paths.directoryRulesFile, parsed.error.issues);
240752
+ }
240753
+ writeJsonAtomic(paths.directoryRulesFile, parsed.data);
240728
240754
  }
240729
240755
  function listDirectoryRules(paths) {
240730
240756
  return readDirectoryRules(paths).rules;
240731
240757
  }
240732
240758
  function addDirectoryRule(paths, rulePath, options) {
240733
240759
  if (options.configProfile === void 0 && options.identity === void 0) {
240734
- throw new Error("A directory rule must set at least one of --profile or --identity.");
240760
+ throw new DirectoryRuleMissingTargetError();
240735
240761
  }
240736
240762
  const current = readDirectoryRules(paths);
240737
240763
  const existingIndex = current.rules.findIndex((rule) => rule.path === rulePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-use",
3
- "version": "2.0.0",
3
+ "version": "2.0.2",
4
4
  "description": "A profile manager and launcher for Claude Code that lets one person run multiple logins from one machine while controlling what gets shared between them.",
5
5
  "license": "Apache-2.0",
6
6
  "author": "Joseph Mearman <joseph@mearman.co.uk>",