automata-cli 0.10.0-develop.403 → 0.10.0-develop.418

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 +41 -6
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -372,12 +372,17 @@ function getPrInfo() {
372
372
  }
373
373
 
374
374
  // src/remote/backend.ts
375
+ var AZDO_GAP_DOC = "docs/azdo-gap.md";
375
376
  function selectBackend(config) {
376
377
  return config.remoteType === "azdo" ? "azdo" : "gh";
377
378
  }
378
379
  function isAzdo(config) {
379
380
  return selectBackend(config) === "azdo";
380
381
  }
382
+ function azdoUnsupportedMessage(feature, detail) {
383
+ const extra = detail ? ` ${detail}` : "";
384
+ return `${feature} is not supported for Azure DevOps.${extra} See ${AZDO_GAP_DOC} for details.`;
385
+ }
381
386
  function isExplicitGitHub(config) {
382
387
  return config.remoteType === "gh";
383
388
  }
@@ -1603,7 +1608,7 @@ See docs/azdo-gap.md for details.`
1603
1608
  }
1604
1609
  if (comments === "unsupported") {
1605
1610
  process.stderr.write(
1606
- `Error: get-pr-comments is not supported for Azure DevOps. See docs/azdo-gap.md for details.
1611
+ `Error: ${azdoUnsupportedMessage("get-pr-comments")}
1607
1612
  `
1608
1613
  );
1609
1614
  process.exit(1);
@@ -2803,7 +2808,8 @@ Select issue (1-${issues.length}): `, resolve2)
2803
2808
  function validateConfig(config) {
2804
2809
  if (!isExplicitGitHub(config)) {
2805
2810
  process.stderr.write(
2806
- "Error: implement-next is not supported in Azure DevOps mode. Work item discovery is not available in azdo-cli. See docs/azdo-gap.md for details.\n"
2811
+ `Error: ${azdoUnsupportedMessage("implement-next", "Work item discovery is not available in azdo-cli.")}
2812
+ `
2807
2813
  );
2808
2814
  process.exit(1);
2809
2815
  }
@@ -3233,7 +3239,7 @@ var executeFixCommentsCmd = addAiOptions(
3233
3239
  }
3234
3240
  if (result.kind === "unsupported") {
3235
3241
  process.stderr.write(
3236
- `Error: fix-comments is not supported for Azure DevOps. See docs/azdo-gap.md for details.
3242
+ `Error: ${azdoUnsupportedMessage("fix-comments")}
3237
3243
  `
3238
3244
  );
3239
3245
  process.exit(1);
@@ -3277,7 +3283,8 @@ var executeCheckIssueCmd = addAiOptions(
3277
3283
  const config = readConfig();
3278
3284
  if (isAzdo(config)) {
3279
3285
  process.stderr.write(
3280
- "Error: check-issue is not supported for Azure DevOps. See docs/azdo-gap.md for details.\n"
3286
+ `Error: ${azdoUnsupportedMessage("check-issue")}
3287
+ `
3281
3288
  );
3282
3289
  process.exit(1);
3283
3290
  }
@@ -4681,12 +4688,14 @@ import {
4681
4688
  accessSync as accessSync2,
4682
4689
  appendFileSync,
4683
4690
  constants as constants2,
4691
+ mkdirSync as mkdirSync2,
4684
4692
  readFileSync as readFileSync6,
4685
4693
  renameSync as renameSync2,
4686
4694
  unlinkSync as unlinkSync3,
4687
4695
  writeFileSync as writeFileSync3
4688
4696
  } from "fs";
4689
4697
  import { randomUUID as randomUUID2 } from "crypto";
4698
+ import { tmpdir, userInfo } from "os";
4690
4699
  import { dirname as dirname2, join as join5 } from "path";
4691
4700
  var EXECUTION_LOG_FILE = "automata-execution.log";
4692
4701
  var WORK_LOG_FILE = "automata-work.log";
@@ -4701,7 +4710,25 @@ var OUTCOMES = [
4701
4710
  "deferred"
4702
4711
  ];
4703
4712
  function operationLogDirectory() {
4704
- return dirname2(process.cwd());
4713
+ const parent = dirname2(process.cwd());
4714
+ try {
4715
+ accessSync2(parent, constants2.W_OK);
4716
+ return parent;
4717
+ } catch {
4718
+ return fallbackLogDirectory();
4719
+ }
4720
+ }
4721
+ function fallbackLogDirectory() {
4722
+ return join5(tmpdir(), `automata-${userSegment()}`);
4723
+ }
4724
+ function userSegment() {
4725
+ const uid = process.getuid?.();
4726
+ if (uid !== void 0) return String(uid);
4727
+ try {
4728
+ return userInfo().username.replace(/[^A-Za-z0-9_.-]/g, "_");
4729
+ } catch {
4730
+ return "user";
4731
+ }
4705
4732
  }
4706
4733
  function inspectLogDirectory(dir = operationLogDirectory(), cwd = process.cwd()) {
4707
4734
  try {
@@ -4834,6 +4861,11 @@ function appendWithRetention(dir, file, content, retain) {
4834
4861
  }
4835
4862
  }
4836
4863
  function recordTick(tick, dir = operationLogDirectory()) {
4864
+ try {
4865
+ if (dir === fallbackLogDirectory()) mkdirSync2(dir, { recursive: true, mode: 448 });
4866
+ } catch {
4867
+ return;
4868
+ }
4837
4869
  try {
4838
4870
  accessSync2(dir, constants2.W_OK);
4839
4871
  } catch {
@@ -5773,7 +5805,10 @@ function resolveSettingsResult(options, verifyIdentity) {
5773
5805
  function requireParticipants(config) {
5774
5806
  if (!isExplicitGitHub(config)) {
5775
5807
  failSettings(
5776
- "do-work is only supported for GitHub remotes. Set it with `automata config set type gh`. Azure DevOps lacks the issue conversation APIs this needs \u2014 see docs/azdo-gap.md."
5808
+ azdoUnsupportedMessage(
5809
+ "do-work",
5810
+ "It needs the GitHub issue conversation APIs; set the remote with `automata config set type gh`."
5811
+ )
5777
5812
  );
5778
5813
  }
5779
5814
  if (!config.issueDiscoveryTechnique) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "automata-cli",
3
- "version": "0.10.0-develop.403",
3
+ "version": "0.10.0-develop.418",
4
4
  "description": "Automata CLI tool",
5
5
  "type": "module",
6
6
  "engines": {