@forge/cli-shared 8.23.0-next.10 → 8.23.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.
- package/CHANGELOG.md +11 -0
- package/out/graphql/graphql-types.d.ts +137 -30
- package/out/graphql/graphql-types.d.ts.map +1 -1
- package/out/graphql/graphql-types.js +68 -40
- package/out/graphql/minimal-graphql-runner.d.ts +3 -3
- package/out/graphql/minimal-graphql-runner.d.ts.map +1 -1
- package/out/graphql/minimal-graphql-runner.js +7 -7
- package/out/shared/forge-cli-attribution.d.ts +3 -7
- package/out/shared/forge-cli-attribution.d.ts.map +1 -1
- package/out/shared/forge-cli-attribution.js +18 -28
- package/package.json +4 -2
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
declare const UNKNOWN = "unknown";
|
|
2
|
-
declare type TriState = boolean | typeof UNKNOWN;
|
|
3
1
|
export declare class ForgeCliAttribution {
|
|
4
2
|
static isAgent(): boolean;
|
|
5
3
|
static isCI(): boolean;
|
|
6
4
|
static skillName(): string;
|
|
7
|
-
static agentHint(): string
|
|
8
|
-
static isStudio():
|
|
9
|
-
static build(): Record<string, unknown
|
|
5
|
+
static agentHint(): Promise<string>;
|
|
6
|
+
static isStudio(): boolean;
|
|
7
|
+
static build(): Promise<Record<string, unknown>>;
|
|
10
8
|
private static getWildcardAttribution;
|
|
11
9
|
private static getValidAttributionEnvValue;
|
|
12
10
|
private static isValidAttributionValue;
|
|
13
11
|
private static isValidWildcardKey;
|
|
14
|
-
private static parseBooleanTriState;
|
|
15
12
|
private static hasEnvKeySet;
|
|
16
13
|
private static camelCaseEnvKey;
|
|
17
14
|
private static capitalize;
|
|
18
15
|
}
|
|
19
|
-
export {};
|
|
20
16
|
//# sourceMappingURL=forge-cli-attribution.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forge-cli-attribution.d.ts","sourceRoot":"","sources":["../../src/shared/forge-cli-attribution.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"forge-cli-attribution.d.ts","sourceRoot":"","sources":["../../src/shared/forge-cli-attribution.ts"],"names":[],"mappings":"AA0CA,qBAAa,mBAAmB;WAOhB,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,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.ForgeCliAttribution = void 0;
|
|
4
|
+
const detect_agent_1 = require("@vercel/detect-agent");
|
|
4
5
|
const ATL_FORGE_ATTRIBUTION_ENV_PREFIX = 'ATL_FORGE_ATTRIBUTION_';
|
|
5
6
|
const UNKNOWN = 'unknown';
|
|
6
7
|
const MAX_ATTRIBUTION_VALUE_LENGTH = 512;
|
|
@@ -9,16 +10,6 @@ const MAX_WILDCARD_FIELDS = 32;
|
|
|
9
10
|
const ATTRIBUTION_VALUE_PATTERN = /^[A-Za-z0-9._\-/:+]+$/;
|
|
10
11
|
const WILDCARD_KEY_PATTERN = /^[A-Za-z][A-Za-z0-9_]*$/;
|
|
11
12
|
const WELL_KNOWN_ATTRIBUTION_ENV_KEYS = new Set(['AGENT_HINT', 'IS_STUDIO', 'SKILL_NAME']);
|
|
12
|
-
const AGENT_HINT_ENV_MAP = new Map([
|
|
13
|
-
['ROVODEV_CLI', 'rovo-dev'],
|
|
14
|
-
['CLAUDECODE', 'claude-code'],
|
|
15
|
-
['CURSOR_AGENT', 'cursor'],
|
|
16
|
-
['CODEX_CI', 'codex'],
|
|
17
|
-
['ANTIGRAVITY_AGENT', 'antigravity'],
|
|
18
|
-
['OPENCODE', 'opencode'],
|
|
19
|
-
['WINDSURF_CASCADE_TERMINAL_KIND', 'windsurf'],
|
|
20
|
-
['GEMINI_CLI', 'gemini']
|
|
21
|
-
]);
|
|
22
13
|
const RESERVED_ATTRIBUTION_FIELDS = new Set([
|
|
23
14
|
'agentHint',
|
|
24
15
|
'businessUnit',
|
|
@@ -38,28 +29,36 @@ class ForgeCliAttribution {
|
|
|
38
29
|
static skillName() {
|
|
39
30
|
return this.getValidAttributionEnvValue('SKILL_NAME') || UNKNOWN;
|
|
40
31
|
}
|
|
41
|
-
static agentHint() {
|
|
32
|
+
static async agentHint() {
|
|
42
33
|
const explicitAgentHint = this.getValidAttributionEnvValue('AGENT_HINT');
|
|
43
34
|
if (explicitAgentHint) {
|
|
44
35
|
return explicitAgentHint;
|
|
45
36
|
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
37
|
+
if (this.hasEnvKeySet('ROVODEV_CLI')) {
|
|
38
|
+
return 'rovo-dev';
|
|
39
|
+
}
|
|
40
|
+
if (this.hasEnvKeySet('WINDSURF_CASCADE_TERMINAL_KIND')) {
|
|
41
|
+
return 'windsurf';
|
|
42
|
+
}
|
|
43
|
+
try {
|
|
44
|
+
const result = await (0, detect_agent_1.determineAgent)();
|
|
45
|
+
if (result?.isAgent && typeof result.agent?.name === 'string' && result.agent.name) {
|
|
46
|
+
return result.agent.name;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
49
50
|
}
|
|
50
|
-
if (process.env.PATH?.includes('github.copilot-chat/copilotCli'))
|
|
51
|
-
return 'github-copilot';
|
|
52
51
|
return UNKNOWN;
|
|
53
52
|
}
|
|
54
53
|
static isStudio() {
|
|
55
|
-
return this.
|
|
54
|
+
return this.getValidAttributionEnvValue('IS_STUDIO') === 'true';
|
|
56
55
|
}
|
|
57
|
-
static build() {
|
|
56
|
+
static async build() {
|
|
58
57
|
return {
|
|
59
58
|
isAgent: this.isAgent(),
|
|
60
59
|
isCI: this.isCI(),
|
|
61
60
|
skillName: this.skillName(),
|
|
62
|
-
agentHint: this.agentHint(),
|
|
61
|
+
agentHint: await this.agentHint(),
|
|
63
62
|
isStudio: this.isStudio(),
|
|
64
63
|
...this.getWildcardAttribution()
|
|
65
64
|
};
|
|
@@ -111,15 +110,6 @@ class ForgeCliAttribution {
|
|
|
111
110
|
static isValidWildcardKey(key) {
|
|
112
111
|
return WILDCARD_KEY_PATTERN.test(key);
|
|
113
112
|
}
|
|
114
|
-
static parseBooleanTriState(value) {
|
|
115
|
-
if (value === 'true') {
|
|
116
|
-
return true;
|
|
117
|
-
}
|
|
118
|
-
if (value === 'false') {
|
|
119
|
-
return false;
|
|
120
|
-
}
|
|
121
|
-
return UNKNOWN;
|
|
122
|
-
}
|
|
123
113
|
static hasEnvKeySet(key) {
|
|
124
114
|
const value = process.env[key];
|
|
125
115
|
return value !== undefined && value !== '';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@forge/cli-shared",
|
|
3
|
-
"version": "8.23.0-next.
|
|
3
|
+
"version": "8.23.0-next.11",
|
|
4
4
|
"description": "Common functionality for Forge CLI",
|
|
5
5
|
"author": "Atlassian",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE.txt",
|
|
@@ -12,10 +12,11 @@
|
|
|
12
12
|
"generate-graphql-types": "graphql-codegen --config src/graphql/codegen.yml"
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@forge/manifest": "12.8.0-next.
|
|
15
|
+
"@forge/manifest": "12.8.0-next.9",
|
|
16
16
|
"@forge/util": "2.0.1",
|
|
17
17
|
"@forge/i18n": "0.0.7",
|
|
18
18
|
"@sentry/node": "7.106.0",
|
|
19
|
+
"@vercel/detect-agent": "^1.2.3",
|
|
19
20
|
"adm-zip": "^0.5.10",
|
|
20
21
|
"array.prototype.flatmap": "^1.3.3",
|
|
21
22
|
"case": "^1.6.3",
|
|
@@ -47,6 +48,7 @@
|
|
|
47
48
|
},
|
|
48
49
|
"devDependencies": {
|
|
49
50
|
"@atlassian/xen-test-util": "^4.2.0",
|
|
51
|
+
"@colors/colors": "1.5.0",
|
|
50
52
|
"@graphql-codegen/add": "^5.0.2",
|
|
51
53
|
"@graphql-codegen/cli": "^5.0.2",
|
|
52
54
|
"@graphql-codegen/typescript": "^4.1.6",
|