@staff0rd/assist 0.1092.1 → 0.1092.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.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.1092.1",
9
+ version: "0.1092.3",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -4708,15 +4708,15 @@ var KIND_LABELS = {
4708
4708
  rejection: "unhandled rejection",
4709
4709
  caught: "caught error"
4710
4710
  };
4711
- function formatClientFailure(failure) {
4712
- if (failure.kind)
4713
- return `client: ${KIND_LABELS[failure.kind]} on ${failure.path}: ${failure.error ?? "unknown error"} at ${failure.at}`;
4714
- const target = failure.node ? `node=${failure.node} via ${failure.base}` : failure.base;
4711
+ function formatClientFailure(failure2) {
4712
+ if (failure2.kind)
4713
+ return `client: ${KIND_LABELS[failure2.kind]} on ${failure2.path}: ${failure2.error ?? "unknown error"} at ${failure2.at}`;
4714
+ const target = failure2.node ? `node=${failure2.node} via ${failure2.base}` : failure2.base;
4715
4715
  const outcome = [
4716
- failure.status === void 0 ? void 0 : `HTTP ${failure.status}`,
4717
- failure.error
4716
+ failure2.status === void 0 ? void 0 : `HTTP ${failure2.status}`,
4717
+ failure2.error
4718
4718
  ].filter(Boolean).join(" ");
4719
- return `client: ${failure.method} ${failure.path} -> ${target} failed: ${outcome || "unknown error"} (${failure.durationMs}ms) at ${failure.at}`;
4719
+ return `client: ${failure2.method} ${failure2.path} -> ${target} failed: ${outcome || "unknown error"} (${failure2.durationMs}ms) at ${failure2.at}`;
4720
4720
  }
4721
4721
  async function clientErrors(req, res) {
4722
4722
  const parsed = clientErrorsSchema.safeParse(
@@ -4726,8 +4726,8 @@ async function clientErrors(req, res) {
4726
4726
  respondJson(res, 400, { error: "Invalid client errors body" });
4727
4727
  return;
4728
4728
  }
4729
- for (const failure of parsed.data.failures)
4730
- console.log(formatClientFailure(failure));
4729
+ for (const failure2 of parsed.data.failures)
4730
+ console.log(formatClientFailure(failure2));
4731
4731
  respondJson(res, 200, { received: parsed.data.failures.length });
4732
4732
  }
4733
4733
 
@@ -7042,7 +7042,7 @@ var testflightConfigHelp = [
7042
7042
  {
7043
7043
  key: "testflight.keyRef",
7044
7044
  setter: "assist config set testflight.keyRef op://<vault>/<item>/<field>",
7045
- note: "1Password reference to the API key .p8 (read via op, never stored)"
7045
+ note: "1Password reference to the API key .p8 (read via op from whichever signed-in account holds it, never stored)"
7046
7046
  },
7047
7047
  {
7048
7048
  key: "testflight.bundleId",
@@ -11020,8 +11020,8 @@ function createInboxScanParser(listener = {}) {
11020
11020
  onUsage(usage.current());
11021
11021
  }
11022
11022
  },
11023
- finish(failure) {
11024
- if (!resultLine) throw new Error(`Inbox scan failed: ${failure}`);
11023
+ finish(failure2) {
11024
+ if (!resultLine) throw new Error(`Inbox scan failed: ${failure2}`);
11025
11025
  return {
11026
11026
  messages: parseInboxScanOutput(resultLine),
11027
11027
  usage: usage.current(),
@@ -12777,24 +12777,74 @@ async function findAppId(client, bundleId) {
12777
12777
  return app.id;
12778
12778
  }
12779
12779
 
12780
- // src/commands/testflight/readAscKey.ts
12780
+ // src/commands/testflight/runOp.ts
12781
12781
  import { execFile as execFile9 } from "child_process";
12782
12782
  import { promisify as promisify10 } from "util";
12783
+
12784
+ // src/commands/testflight/cleanOpStderr.ts
12785
+ var wslWrapperNoise = [
12786
+ /^'\\\\wsl[.$]/i,
12787
+ /^CMD\.EXE was started with the above path/i,
12788
+ /^UNC paths are not supported/i
12789
+ ];
12790
+ function cleanOpStderr(stderr) {
12791
+ return stderr.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !wslWrapperNoise.some((re) => re.test(line))).join("\n");
12792
+ }
12793
+
12794
+ // src/commands/testflight/runOp.ts
12783
12795
  var run = promisify10(execFile9);
12784
- async function readAscKey(reference) {
12785
- if (!reference.startsWith("op://"))
12786
- throw new TestflightError(
12787
- "testflight.keyRef must be a 1Password reference starting with op://"
12788
- );
12796
+ var runOp = async (args) => {
12789
12797
  try {
12790
- const { stdout } = await run("op", ["read", reference]);
12791
- return stdout.trim();
12798
+ const { stdout } = await run("op", args, { maxBuffer: 10 * 1024 * 1024 });
12799
+ return { ok: true, stdout };
12792
12800
  } catch (error) {
12793
- const reason4 = error.stderr?.trim() || (error instanceof Error ? error.message : String(error));
12801
+ const { code, stderr } = error;
12802
+ if (code === "ENOENT")
12803
+ return {
12804
+ ok: false,
12805
+ error: "the 1Password CLI (op) is not installed or not on PATH",
12806
+ missing: false
12807
+ };
12808
+ const reason4 = cleanOpStderr(stderr ?? "") || (error instanceof Error ? error.message : String(error));
12809
+ return {
12810
+ ok: false,
12811
+ error: reason4,
12812
+ missing: /isn't an item|isn't a vault/i.test(reason4)
12813
+ };
12814
+ }
12815
+ };
12816
+
12817
+ // src/commands/testflight/readAscKey.ts
12818
+ async function listAccounts(op) {
12819
+ const result = await op(["account", "list", "--format", "json"]);
12820
+ if (!result.ok) return [];
12821
+ const accounts = JSON.parse(result.stdout);
12822
+ return accounts.map((account) => account.url);
12823
+ }
12824
+ function failure(reason4) {
12825
+ return new TestflightError(
12826
+ `Failed to read testflight.keyRef from 1Password: ${reason4}`
12827
+ );
12828
+ }
12829
+ async function readAscKey(reference, op = runOp) {
12830
+ if (!reference.startsWith("op://"))
12794
12831
  throw new TestflightError(
12795
- `Failed to read testflight.keyRef from 1Password (is op installed and signed in?): ${reason4}`
12832
+ "testflight.keyRef must be a 1Password reference starting with op://"
12796
12833
  );
12834
+ const first = await op(["read", reference]);
12835
+ if (first.ok) return first.stdout.trim();
12836
+ if (!first.missing) throw failure(first.error);
12837
+ const accounts = await listAccounts(op);
12838
+ for (const url of accounts) {
12839
+ const result = await op(["read", "--account", url, reference]);
12840
+ if (result.ok) return result.stdout.trim();
12841
+ if (!result.missing) throw failure(`${url}: ${result.error}`);
12797
12842
  }
12843
+ const searched = accounts.length ? ` (searched ${accounts.join(", ")})` : "";
12844
+ throw failure(
12845
+ `${first.error}
12846
+ The item was not found in any signed-in 1Password account${searched}.`
12847
+ );
12798
12848
  }
12799
12849
 
12800
12850
  // src/commands/testflight/connectAsc.ts
@@ -18972,8 +19022,8 @@ function validateDump({ header, sections }) {
18972
19022
  [tables.length > 0, "Dump header lists no tables; cannot restore."],
18973
19023
  [!missing, `Invalid dump: missing data section for "${missing}".`]
18974
19024
  ];
18975
- const failure = checks2.find(([ok]) => !ok);
18976
- if (failure) throw new Error(failure[1]);
19025
+ const failure2 = checks2.find(([ok]) => !ok);
19026
+ if (failure2) throw new Error(failure2[1]);
18977
19027
  }
18978
19028
 
18979
19029
  // src/commands/backlog/import/confirmReplace.ts
@@ -37981,8 +38031,8 @@ function printPrsStatus(report) {
37981
38031
  }
37982
38032
  if (report.errors.length === 0) return;
37983
38033
  console.log(chalk212.bold("Errors"));
37984
- for (const failure of report.errors) {
37985
- console.log(` ${chalk212.red(failure.repo)}: ${failure.error}`);
38034
+ for (const failure2 of report.errors) {
38035
+ console.log(` ${chalk212.red(failure2.repo)}: ${failure2.error}`);
37986
38036
  }
37987
38037
  console.log();
37988
38038
  }
@@ -53061,11 +53111,11 @@ async function deleteTreeDirectly(clone, worktreePath, why) {
53061
53111
  retryDelay: 200
53062
53112
  });
53063
53113
  } catch (error) {
53064
- const failure = deleteFailure(worktreePath, error);
53114
+ const failure2 = deleteFailure(worktreePath, error);
53065
53115
  daemonLog(
53066
- `worktree ${worktreePath} directory delete failed, left in place for the next reconcile: ${failure}`
53116
+ `worktree ${worktreePath} directory delete failed, left in place for the next reconcile: ${failure2}`
53067
53117
  );
53068
- return { removed: false, reason: failure };
53118
+ return { removed: false, reason: failure2 };
53069
53119
  }
53070
53120
  daemonLog(`worktree ${worktreePath} directory deleted directly`);
53071
53121
  await pruneBookkeeping(clone, worktreePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.1092.1",
3
+ "version": "0.1092.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {