@forge/cli-shared 9.11.0-next.10 → 9.11.0-next.11

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.
@@ -1,6 +1,9 @@
1
1
  export declare class ForgeCliAttribution {
2
2
  static isAgent(): boolean;
3
3
  static isCI(): boolean;
4
+ static isAgentV2(): Promise<boolean>;
5
+ static isCIV2(): boolean;
6
+ static ciHint(): string;
4
7
  static skillName(): string;
5
8
  static agentHint(): Promise<string>;
6
9
  static isStudio(): boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"forge-cli-attribution.d.ts","sourceRoot":"","sources":["../../src/shared/forge-cli-attribution.ts"],"names":[],"mappings":"AA0CA,qBAAa,mBAAmB;WAQhB,OAAO,IAAI,OAAO;WAQlB,IAAI,IAAI,OAAO;WAIf,SAAS,IAAI,MAAM;WAIb,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;WAuBlC,QAAQ,IAAI,OAAO;WAWb,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAW7D,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAgDrC,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAK1C,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAStC,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAIjC,OAAO,CAAC,MAAM,CAAC,YAAY;IAK3B,OAAO,CAAC,MAAM,CAAC,eAAe;IAS9B,OAAO,CAAC,MAAM,CAAC,UAAU;CAG1B"}
1
+ {"version":3,"file":"forge-cli-attribution.d.ts","sourceRoot":"","sources":["../../src/shared/forge-cli-attribution.ts"],"names":[],"mappings":"AA2DA,qBAAa,mBAAmB;WAShB,OAAO,IAAI,OAAO;WASlB,IAAI,IAAI,OAAO;WAST,SAAS,IAAI,OAAO,CAAC,OAAO,CAAC;WAKnC,MAAM,IAAI,OAAO;WASjB,MAAM,IAAI,MAAM;WAIhB,SAAS,IAAI,MAAM;WASb,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC;WAwBlC,QAAQ,IAAI,OAAO;WAWb,KAAK,IAAI,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IA6B7D,OAAO,CAAC,MAAM,CAAC,sBAAsB;IAgDrC,OAAO,CAAC,MAAM,CAAC,2BAA2B;IAK1C,OAAO,CAAC,MAAM,CAAC,uBAAuB;IAStC,OAAO,CAAC,MAAM,CAAC,kBAAkB;IAIjC,OAAO,CAAC,MAAM,CAAC,YAAY;IAK3B,OAAO,CAAC,MAAM,CAAC,eAAe;IAS9B,OAAO,CAAC,MAAM,CAAC,UAAU;CAG1B"}
@@ -1,7 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ForgeCliAttribution = void 0;
4
+ const tslib_1 = require("tslib");
4
5
  const detect_agent_1 = require("@vercel/detect-agent");
6
+ const ci = tslib_1.__importStar(require("ci-info"));
7
+ const runner_signals_1 = require("./runner-signals");
5
8
  const ATL_FORGE_ATTRIBUTION_ENV_PREFIX = 'ATL_FORGE_ATTRIBUTION_';
6
9
  const UNKNOWN = 'unknown';
7
10
  const MAX_ATTRIBUTION_VALUE_LENGTH = 512;
@@ -15,10 +18,15 @@ const RESERVED_ATTRIBUTION_FIELDS = new Set([
15
18
  'businessUnit',
16
19
  'isAgent',
17
20
  'isCI',
21
+ 'isAgentV2',
22
+ 'isCIV2',
18
23
  'isStudio',
19
24
  'service',
20
- 'skillName'
21
- ]);
25
+ 'skillName',
26
+ 'ciHint',
27
+ 'isTerminal',
28
+ 'isUnrecognizedNonTTY'
29
+ ].map((field) => field.toLowerCase()));
22
30
  class ForgeCliAttribution {
23
31
  static isAgent() {
24
32
  return !process.stdin.isTTY && !process.stdout.isTTY && !this.isCI();
@@ -26,12 +34,21 @@ class ForgeCliAttribution {
26
34
  static isCI() {
27
35
  return process.env.CI === 'true';
28
36
  }
37
+ static async isAgentV2() {
38
+ return (await this.agentHint()) !== UNKNOWN;
39
+ }
40
+ static isCIV2() {
41
+ return this.ciHint() !== UNKNOWN;
42
+ }
43
+ static ciHint() {
44
+ return ci.id ?? UNKNOWN;
45
+ }
29
46
  static skillName() {
30
47
  return this.getValidAttributionEnvValue('SKILL_NAME') || UNKNOWN;
31
48
  }
32
49
  static async agentHint() {
33
50
  const explicitAgentHint = this.getValidAttributionEnvValue('AGENT_HINT');
34
- if (explicitAgentHint) {
51
+ if (explicitAgentHint && explicitAgentHint.toLowerCase() !== UNKNOWN) {
35
52
  return explicitAgentHint;
36
53
  }
37
54
  if (this.hasEnvKeySet('ROVODEV_CLI')) {
@@ -54,12 +71,22 @@ class ForgeCliAttribution {
54
71
  return this.getValidAttributionEnvValue('IS_STUDIO') === 'true';
55
72
  }
56
73
  static async build() {
74
+ const agentHint = await this.agentHint();
75
+ const ciHint = this.ciHint();
76
+ const isAgentV2 = agentHint !== UNKNOWN;
77
+ const isCIV2 = ciHint !== UNKNOWN;
78
+ const signals = (0, runner_signals_1.readRunnerSignals)(isAgentV2, isCIV2);
57
79
  return {
58
80
  isAgent: this.isAgent(),
59
81
  isCI: this.isCI(),
60
82
  skillName: this.skillName(),
61
- agentHint: await this.agentHint(),
83
+ agentHint,
62
84
  isStudio: this.isStudio(),
85
+ isAgentV2: String(isAgentV2),
86
+ isCIV2: String(isCIV2),
87
+ ciHint,
88
+ isTerminal: String(signals.isTerminal),
89
+ isUnrecognizedNonTTY: String(signals.isUnrecognizedNonTTY),
63
90
  ...this.getWildcardAttribution()
64
91
  };
65
92
  }
@@ -79,7 +106,7 @@ class ForgeCliAttribution {
79
106
  continue;
80
107
  }
81
108
  const attributionKey = this.camelCaseEnvKey(attributionEnvKey);
82
- if (!attributionKey || RESERVED_ATTRIBUTION_FIELDS.has(attributionKey)) {
109
+ if (!attributionKey || RESERVED_ATTRIBUTION_FIELDS.has(attributionKey.toLowerCase())) {
83
110
  continue;
84
111
  }
85
112
  if (attributionKey in wildcardAttribution) {
@@ -0,0 +1,6 @@
1
+ export interface RunnerSignals {
2
+ isTerminal: boolean;
3
+ isUnrecognizedNonTTY: boolean;
4
+ }
5
+ export declare const readRunnerSignals: (isAgent: boolean, isCI: boolean) => RunnerSignals;
6
+ //# sourceMappingURL=runner-signals.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"runner-signals.d.ts","sourceRoot":"","sources":["../../src/shared/runner-signals.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,aAAa;IAM5B,UAAU,EAAE,OAAO,CAAC;IAEpB,oBAAoB,EAAE,OAAO,CAAC;CAC/B;AAGD,eAAO,MAAM,iBAAiB,GAAI,SAAS,OAAO,EAAE,MAAM,OAAO,KAAG,aAMnE,CAAC"}
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.readRunnerSignals = void 0;
4
+ const readRunnerSignals = (isAgent, isCI) => {
5
+ const isTerminal = Boolean(process.stdin.isTTY);
6
+ return {
7
+ isTerminal,
8
+ isUnrecognizedNonTTY: !isTerminal && !isAgent && !isCI
9
+ };
10
+ };
11
+ exports.readRunnerSignals = readRunnerSignals;
package/out/ui/text.js CHANGED
@@ -1847,7 +1847,7 @@ ${buildTerminalLink(link)}\n`,
1847
1847
  info: `To view all environments for this app, run ${forge('environments', 'list')}.`
1848
1848
  },
1849
1849
  nonInteractive: {
1850
- description: 'Run commands without prompts: off (default), on, or auto (when an agent runs the command, not in CI). FORGE_NON_INTERACTIVE overrides it',
1850
+ description: 'Run commands without prompts: off (default), on, or auto (when a known agent, such as Claude Code or Rovo Dev, runs the command). FORGE_NON_INTERACTIVE overrides it',
1851
1851
  invalidValue: 'Invalid value specified. Valid values: auto, on, off'
1852
1852
  },
1853
1853
  customEffects: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@forge/cli-shared",
3
- "version": "9.11.0-next.10",
3
+ "version": "9.11.0-next.11",
4
4
  "description": "Common functionality for Forge CLI",
5
5
  "author": "Atlassian",
6
6
  "license": "SEE LICENSE IN LICENSE.txt",
@@ -17,11 +17,12 @@
17
17
  "@forge/util": "4.1.0-next.1",
18
18
  "@forge/i18n": "1.0.2-next.0",
19
19
  "@sentry/node": "7.106.0",
20
- "@vercel/detect-agent": "^1.2.5",
20
+ "@vercel/detect-agent": "^1.2.7",
21
21
  "adm-zip": "^0.6.1",
22
22
  "archiver": "^8.0.0",
23
23
  "case": "^1.6.3",
24
24
  "chalk": "^4.1.2",
25
+ "ci-info": "^4.4.0",
25
26
  "cheerio": "^1.2.0",
26
27
  "cli-table3": "^0.6.5",
27
28
  "conf": "^10.2.0",