setorra 0.1.0 → 0.1.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.
Files changed (2) hide show
  1. package/dist/setorra.js +32 -24
  2. package/package.json +1 -1
package/dist/setorra.js CHANGED
@@ -22302,18 +22302,24 @@ function parseArguments(argv) {
22302
22302
  }
22303
22303
  return { command, agent, credential, force, dryRun, root: process.cwd() };
22304
22304
  }
22305
- function git(root, args) {
22305
+ function run(binary, root, args) {
22306
22306
  try {
22307
- return execFileSync("git", args, {
22307
+ return execFileSync(binary, args, {
22308
22308
  cwd: root,
22309
22309
  encoding: "utf8",
22310
22310
  stdio: ["ignore", "pipe", "pipe"]
22311
22311
  }).trim();
22312
22312
  } catch (error51) {
22313
- const stderr = error51.stderr ?? "";
22314
- throw new Error(`git ${args[0]} failed: ${stderr.trim() || String(error51)}`);
22313
+ const failure = error51;
22314
+ const detail = [failure.stderr, failure.stdout].map((stream) => stream?.trim() ?? "").filter((stream) => stream.length > 0).join("\n");
22315
+ throw new Error(
22316
+ `${binary} ${args[0]} failed: ${detail || String(error51)}`
22317
+ );
22315
22318
  }
22316
22319
  }
22320
+ function git(root, args) {
22321
+ return run("git", root, args);
22322
+ }
22317
22323
  function readManaged(root) {
22318
22324
  const existing = /* @__PURE__ */ new Map();
22319
22325
  for (const path of managedPaths()) {
@@ -22410,7 +22416,7 @@ function openPullRequest(root, agent, credential, touched) {
22410
22416
  "Merging authorizes the platform. Deleting this workflow revokes it."
22411
22417
  ].join("\n");
22412
22418
  try {
22413
- const url2 = execFileSync("gh", [
22419
+ const url3 = run("gh", root, [
22414
22420
  "pr",
22415
22421
  "create",
22416
22422
  "--head",
@@ -22419,22 +22425,23 @@ function openPullRequest(root, agent, credential, touched) {
22419
22425
  `Configure automated API migration (${agent})`,
22420
22426
  "--body",
22421
22427
  body
22422
- ], { cwd: root, encoding: "utf8" }).trim();
22428
+ ]);
22423
22429
  console.log(`
22424
- pull request: ${url2}`);
22430
+ pull request: ${url3}`);
22431
+ return;
22425
22432
  } catch {
22426
- const url2 = execFileSync("gh", [
22427
- "pr",
22428
- "view",
22429
- BRANCH,
22430
- "--json",
22431
- "url",
22432
- "--jq",
22433
- ".url"
22434
- ], { cwd: root, encoding: "utf8" }).trim();
22435
- console.log(`
22436
- pull request updated: ${url2}`);
22437
22433
  }
22434
+ const url2 = run("gh", root, [
22435
+ "pr",
22436
+ "view",
22437
+ BRANCH,
22438
+ "--json",
22439
+ "url",
22440
+ "--jq",
22441
+ ".url"
22442
+ ]);
22443
+ console.log(`
22444
+ pull request updated: ${url2}`);
22438
22445
  }
22439
22446
  function runStatus(options) {
22440
22447
  const existing = readManaged(options.root);
@@ -22534,11 +22541,7 @@ function runReconcile(options) {
22534
22541
  ${blocker}`);
22535
22542
  return 1;
22536
22543
  }
22537
- try {
22538
- git(options.root, ["checkout", "-b", BRANCH]);
22539
- } catch {
22540
- git(options.root, ["checkout", BRANCH]);
22541
- }
22544
+ git(options.root, ["checkout", "-B", BRANCH]);
22542
22545
  const touched = applyActions(options.root, plan.actions);
22543
22546
  openPullRequest(options.root, agent, credential, touched);
22544
22547
  return 0;
@@ -22551,7 +22554,12 @@ function main(argv) {
22551
22554
  console.error(error51 instanceof UsageError ? error51.message : String(error51));
22552
22555
  return 1;
22553
22556
  }
22554
- return options.command === "status" ? runStatus(options) : runReconcile(options);
22557
+ try {
22558
+ return options.command === "status" ? runStatus(options) : runReconcile(options);
22559
+ } catch (error51) {
22560
+ console.error(error51 instanceof Error ? error51.message : String(error51));
22561
+ return 1;
22562
+ }
22555
22563
  }
22556
22564
 
22557
22565
  // src/bin.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "setorra",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Configure automated API migration for a GitHub repository.",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",