@whittlelabs/sifter 0.42.13 → 0.42.14

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 (3) hide show
  1. package/bin.js +28 -4
  2. package/bin.js.map +2 -2
  3. package/package.json +1 -1
package/bin.js CHANGED
@@ -3024,7 +3024,7 @@ var require_apply = __commonJS({
3024
3024
  "../../packages/shuttle/dist/branding/apply.js"(exports2) {
3025
3025
  "use strict";
3026
3026
  Object.defineProperty(exports2, "__esModule", { value: true });
3027
- exports2.DEFAULT_PROFILE = void 0;
3027
+ exports2.PROFILE_NAME = exports2.DEFAULT_PROFILE = void 0;
3028
3028
  exports2.expandHome = expandHome;
3029
3029
  exports2.resolveProfile = resolveProfile;
3030
3030
  exports2.resolvePaths = resolvePaths;
@@ -3040,10 +3040,11 @@ var require_apply = __commonJS({
3040
3040
  return p;
3041
3041
  }
3042
3042
  exports2.DEFAULT_PROFILE = "default";
3043
+ exports2.PROFILE_NAME = /^[a-z0-9][a-z0-9-]*$/;
3043
3044
  function resolveProfile(brand, explicit) {
3044
3045
  const envKey = `${brand.product.id.toUpperCase().replace(/[^A-Z0-9]/g, "_")}_PROFILE`;
3045
3046
  const candidate = explicit ?? process.env[envKey] ?? exports2.DEFAULT_PROFILE;
3046
- if (!/^[a-z0-9][a-z0-9-]*$/.test(candidate)) {
3047
+ if (!exports2.PROFILE_NAME.test(candidate)) {
3047
3048
  throw new Error(`Invalid profile "${candidate}": use lowercase letters, digits, and hyphens (e.g. "stage", "local").`);
3048
3049
  }
3049
3050
  return candidate;
@@ -67724,7 +67725,7 @@ var require_checks3 = __commonJS({
67724
67725
  return fail("pairing-present", `${subject.paths.configFile} could not be read: ${result.error}`, `run \`${subject.brand.product.cliBinary} init\` to pair again`);
67725
67726
  }
67726
67727
  if (result.value === null) {
67727
- return fail("pairing-present", `no pairing at ${subject.paths.configFile}`, `run \`${subject.brand.product.cliBinary} init\` to pair`);
67728
+ return fail("pairing-present", `no pairing at ${subject.paths.configFile}`, pairElsewhereRemedy(probes, subject) ?? `run \`${subject.brand.product.cliBinary} init\` to pair`);
67728
67729
  }
67729
67730
  const mode = await probes.stat(subject.paths.configFile);
67730
67731
  if (mode !== null && (mode.mode & 63) !== 0) {
@@ -67733,6 +67734,17 @@ var require_checks3 = __commonJS({
67733
67734
  return pass("pairing-present", `paired as ${result.value.serviceIdentity.displayName}`);
67734
67735
  }
67735
67736
  };
67737
+ function pairElsewhereRemedy(probes, subject) {
67738
+ const others = probes.pairedProfiles().filter((p) => p !== subject.paths.profile);
67739
+ if (others.length === 0)
67740
+ return null;
67741
+ const cli = subject.brand.product.cliBinary;
67742
+ const command = (profile) => `\`${cli} ${subject.phase}${profile === apply_1.DEFAULT_PROFILE ? "" : ` --profile ${profile}`}\``;
67743
+ if (others.length === 1) {
67744
+ return `this machine is paired under the "${others[0]}" profile: run ${command(others[0])}`;
67745
+ }
67746
+ return `this machine is paired under the ${others.map((p) => `"${p}"`).join(", ")} profiles: run the one you mean, e.g. ${command(others[0])}, or \`${cli} init\` to pair this one`;
67747
+ }
67736
67748
  var configLoadable = {
67737
67749
  name: "config-loadable",
67738
67750
  phases: ["run", "doctor"],
@@ -69653,6 +69665,7 @@ var require_probes = __commonJS({
69653
69665
  var yaml_1 = require_dist5();
69654
69666
  var keep_1 = require_dist4();
69655
69667
  var jobs_1 = require_dist7();
69668
+ var apply_1 = require_apply();
69656
69669
  var scaffold_1 = require_scaffold();
69657
69670
  var loader_1 = require_loader();
69658
69671
  var codex_1 = require_codex();
@@ -69782,6 +69795,17 @@ var require_probes = __commonJS({
69782
69795
  }
69783
69796
  return pairingRead;
69784
69797
  },
69798
+ pairedProfiles() {
69799
+ const base = (0, apply_1.resolvePaths)(options.brand, apply_1.DEFAULT_PROFILE).configDir;
69800
+ const paired = (profile) => (0, fs_1.existsSync)((0, apply_1.resolvePaths)(options.brand, profile).configFile);
69801
+ let named;
69802
+ try {
69803
+ named = (0, fs_1.readdirSync)(base, { withFileTypes: true }).filter((entry) => entry.isDirectory() && apply_1.PROFILE_NAME.test(entry.name)).map((entry) => entry.name);
69804
+ } catch {
69805
+ named = [];
69806
+ }
69807
+ return [...paired(apply_1.DEFAULT_PROFILE) ? [apply_1.DEFAULT_PROFILE] : [], ...named.filter(paired).sort()];
69808
+ },
69785
69809
  readConfig() {
69786
69810
  if (configRead !== void 0)
69787
69811
  return configRead;
@@ -76082,7 +76106,7 @@ var import_shuttle2 = __toESM(require_dist8());
76082
76106
 
76083
76107
  // src/brand.ts
76084
76108
  var import_shuttle = __toESM(require_dist8());
76085
- var buildVersion = true ? "0.42.13" : pkg.version;
76109
+ var buildVersion = true ? "0.42.14" : pkg.version;
76086
76110
  var AGENT_EXECUTORS = ["claude-code", "codex", "copilot"];
76087
76111
  var sifterBrand = {
76088
76112
  product: {