@ainative/cody-cli 0.7.15 → 0.7.17
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/cli.js +119 -36
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -125344,7 +125344,12 @@ async function getOauthProfileFromApiKey() {
|
|
|
125344
125344
|
}
|
|
125345
125345
|
}
|
|
125346
125346
|
async function getOauthProfileFromOauthToken(accessToken) {
|
|
125347
|
-
const
|
|
125347
|
+
const baseUrl = getOauthConfig().BASE_API_URL;
|
|
125348
|
+
const isAINative = baseUrl.includes("ainative.studio");
|
|
125349
|
+
if (isAINative) {
|
|
125350
|
+
return getAINativeProfile(baseUrl, accessToken);
|
|
125351
|
+
}
|
|
125352
|
+
const endpoint = `${baseUrl}/api/oauth/profile`;
|
|
125348
125353
|
try {
|
|
125349
125354
|
const response = await axios_default.get(endpoint, {
|
|
125350
125355
|
headers: {
|
|
@@ -125358,6 +125363,64 @@ async function getOauthProfileFromOauthToken(accessToken) {
|
|
|
125358
125363
|
logError2(error41);
|
|
125359
125364
|
}
|
|
125360
125365
|
}
|
|
125366
|
+
async function getAINativeProfile(baseUrl, accessToken) {
|
|
125367
|
+
try {
|
|
125368
|
+
const response = await axios_default.get(`${baseUrl}/api/v1/auth/me`, {
|
|
125369
|
+
headers: {
|
|
125370
|
+
Authorization: `Bearer ${accessToken}`,
|
|
125371
|
+
"Content-Type": "application/json"
|
|
125372
|
+
},
|
|
125373
|
+
timeout: 1e4
|
|
125374
|
+
});
|
|
125375
|
+
const user = response.data?.data;
|
|
125376
|
+
if (!user)
|
|
125377
|
+
return;
|
|
125378
|
+
return {
|
|
125379
|
+
account: {
|
|
125380
|
+
uuid: user.id || crypto.randomUUID(),
|
|
125381
|
+
email: user.email || "",
|
|
125382
|
+
display_name: user.name || undefined,
|
|
125383
|
+
created_at: user.createdAt || new Date().toISOString()
|
|
125384
|
+
},
|
|
125385
|
+
organization: {
|
|
125386
|
+
uuid: user.organizationId || crypto.randomUUID(),
|
|
125387
|
+
name: user.organization || "AINative"
|
|
125388
|
+
}
|
|
125389
|
+
};
|
|
125390
|
+
} catch (error41) {
|
|
125391
|
+
const apiKey = process.env.AINATIVE_API_KEY || process.env.ANTHROPIC_API_KEY;
|
|
125392
|
+
if (apiKey) {
|
|
125393
|
+
try {
|
|
125394
|
+
const response = await axios_default.get(`${baseUrl}/api/v1/auth/me`, {
|
|
125395
|
+
headers: {
|
|
125396
|
+
"x-api-key": apiKey,
|
|
125397
|
+
"Content-Type": "application/json"
|
|
125398
|
+
},
|
|
125399
|
+
timeout: 1e4
|
|
125400
|
+
});
|
|
125401
|
+
const user = response.data?.data;
|
|
125402
|
+
if (!user)
|
|
125403
|
+
return;
|
|
125404
|
+
return {
|
|
125405
|
+
account: {
|
|
125406
|
+
uuid: user.id || crypto.randomUUID(),
|
|
125407
|
+
email: user.email || "",
|
|
125408
|
+
display_name: user.name || undefined,
|
|
125409
|
+
created_at: user.createdAt || new Date().toISOString()
|
|
125410
|
+
},
|
|
125411
|
+
organization: {
|
|
125412
|
+
uuid: user.organizationId || crypto.randomUUID(),
|
|
125413
|
+
name: user.organization || "AINative"
|
|
125414
|
+
}
|
|
125415
|
+
};
|
|
125416
|
+
} catch {
|
|
125417
|
+
logError2(error41);
|
|
125418
|
+
}
|
|
125419
|
+
} else {
|
|
125420
|
+
logError2(error41);
|
|
125421
|
+
}
|
|
125422
|
+
}
|
|
125423
|
+
}
|
|
125361
125424
|
var init_getOauthProfile = __esm(() => {
|
|
125362
125425
|
init_axios2();
|
|
125363
125426
|
init_oauth();
|
|
@@ -180961,7 +181024,7 @@ var init_metadata = __esm(() => {
|
|
|
180961
181024
|
isClaudeAiAuth: isClaudeAISubscriber(),
|
|
180962
181025
|
version: "0.7.15",
|
|
180963
181026
|
versionBase: getVersionBase(),
|
|
180964
|
-
buildTime: "
|
|
181027
|
+
buildTime: "1775422356",
|
|
180965
181028
|
deploymentEnvironment: env4.detectDeploymentEnvironment(),
|
|
180966
181029
|
...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
|
|
180967
181030
|
githubEventName: process.env.GITHUB_EVENT_NAME,
|
|
@@ -247523,7 +247586,12 @@ function getTelemetryAttributes() {
|
|
|
247523
247586
|
attributes["user.email"] = email3;
|
|
247524
247587
|
if (accountUuid && shouldIncludeAttribute("OTEL_METRICS_INCLUDE_ACCOUNT_UUID")) {
|
|
247525
247588
|
attributes["user.account_uuid"] = accountUuid;
|
|
247526
|
-
|
|
247589
|
+
const isValidUuid = /^[0-9a-f]{8}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{4}-?[0-9a-f]{12}$/i.test(accountUuid);
|
|
247590
|
+
if (isValidUuid) {
|
|
247591
|
+
attributes["user.account_id"] = process.env.CLAUDE_CODE_ACCOUNT_TAGGED_ID || toTaggedId("user", accountUuid);
|
|
247592
|
+
} else {
|
|
247593
|
+
attributes["user.account_id"] = process.env.CLAUDE_CODE_ACCOUNT_TAGGED_ID || accountUuid;
|
|
247594
|
+
}
|
|
247527
247595
|
}
|
|
247528
247596
|
}
|
|
247529
247597
|
if (envDynamic.terminal) {
|
|
@@ -336401,9 +336469,10 @@ async function installOAuthTokens(tokens) {
|
|
|
336401
336469
|
organizationUuid: tokens.tokenAccount.organizationUuid
|
|
336402
336470
|
});
|
|
336403
336471
|
} else if (isAINative) {
|
|
336404
|
-
const
|
|
336472
|
+
const { randomUUID: randomUUID10 } = await import("crypto");
|
|
336473
|
+
const email3 = process.env.AINATIVE_USERNAME || process.env.USER_EMAIL || "admin@ainative.studio";
|
|
336405
336474
|
storeOAuthAccountInfo({
|
|
336406
|
-
accountUuid:
|
|
336475
|
+
accountUuid: randomUUID10(),
|
|
336407
336476
|
emailAddress: email3,
|
|
336408
336477
|
organizationUuid: undefined
|
|
336409
336478
|
});
|
|
@@ -336478,8 +336547,8 @@ async function authLogin({
|
|
|
336478
336547
|
const envScopes = process.env.CLAUDE_CODE_OAUTH_SCOPES;
|
|
336479
336548
|
if (!envScopes) {
|
|
336480
336549
|
process.stderr.write(`CLAUDE_CODE_OAUTH_SCOPES is required when using CLAUDE_CODE_OAUTH_REFRESH_TOKEN.
|
|
336481
|
-
|
|
336482
|
-
|
|
336550
|
+
Set it to the space-separated scopes the refresh token was issued with
|
|
336551
|
+
(e.g. "user:inference" or "user:profile user:inference user:sessions:claude_code user:mcp_servers").
|
|
336483
336552
|
`);
|
|
336484
336553
|
process.exit(1);
|
|
336485
336554
|
}
|
|
@@ -377602,41 +377671,55 @@ var require_color_diff_napi = __commonJS((exports, module) => {
|
|
|
377602
377671
|
var A = { r: "\x1B[0m", g: "\x1B[32m", rd: "\x1B[31m", c: "\x1B[36m", m: "\x1B[35m", d: "\x1B[2m" };
|
|
377603
377672
|
|
|
377604
377673
|
class ColorDiff {
|
|
377605
|
-
constructor(
|
|
377606
|
-
this.
|
|
377607
|
-
this.
|
|
377674
|
+
constructor(hunk, firstLine, filePath, prefixContent) {
|
|
377675
|
+
this.hunk = hunk;
|
|
377676
|
+
this.filePath = filePath;
|
|
377677
|
+
this.firstLine = firstLine;
|
|
377678
|
+
this.prefixContent = prefixContent ?? null;
|
|
377608
377679
|
}
|
|
377609
|
-
render(
|
|
377610
|
-
if (!this.
|
|
377680
|
+
render(themeName, width, dim2) {
|
|
377681
|
+
if (!this.hunk || !this.hunk.lines)
|
|
377611
377682
|
return null;
|
|
377612
|
-
|
|
377613
|
-
|
|
377614
|
-
|
|
377615
|
-
|
|
377616
|
-
|
|
377617
|
-
|
|
377618
|
-
|
|
377619
|
-
|
|
377620
|
-
|
|
377621
|
-
|
|
377622
|
-
|
|
377623
|
-
|
|
377683
|
+
const maxLineNum = Math.max(this.hunk.oldStart + this.hunk.oldLines - 1, this.hunk.newStart + this.hunk.newLines - 1, 1);
|
|
377684
|
+
const maxDigits = String(maxLineNum).length;
|
|
377685
|
+
let oldLine = this.hunk.oldStart;
|
|
377686
|
+
let newLine = this.hunk.newStart;
|
|
377687
|
+
const out = [];
|
|
377688
|
+
for (const rawLine of this.hunk.lines) {
|
|
377689
|
+
const marker = rawLine[0];
|
|
377690
|
+
const code = rawLine.slice(1);
|
|
377691
|
+
let lineNumber;
|
|
377692
|
+
if (marker === "+") {
|
|
377693
|
+
lineNumber = newLine++;
|
|
377694
|
+
out.push(A.g + String(lineNumber).padStart(maxDigits) + " +" + code + A.r);
|
|
377695
|
+
} else if (marker === "-") {
|
|
377696
|
+
lineNumber = oldLine++;
|
|
377697
|
+
out.push(A.rd + " ".repeat(maxDigits) + " -" + code + A.r);
|
|
377698
|
+
} else {
|
|
377699
|
+
lineNumber = newLine;
|
|
377700
|
+
oldLine++;
|
|
377701
|
+
newLine++;
|
|
377702
|
+
out.push(String(lineNumber).padStart(maxDigits) + " " + code);
|
|
377624
377703
|
}
|
|
377625
|
-
|
|
377626
|
-
|
|
377704
|
+
}
|
|
377705
|
+
return out;
|
|
377627
377706
|
}
|
|
377628
377707
|
}
|
|
377629
377708
|
|
|
377630
377709
|
class ColorFile {
|
|
377631
|
-
constructor(
|
|
377632
|
-
this.
|
|
377633
|
-
this.
|
|
377710
|
+
constructor(code, filePath) {
|
|
377711
|
+
this.code = code;
|
|
377712
|
+
this.filePath = filePath;
|
|
377713
|
+
this.ext = (filePath || "").split(".").pop();
|
|
377634
377714
|
}
|
|
377635
|
-
render(
|
|
377636
|
-
if (!this.
|
|
377715
|
+
render(themeName, width) {
|
|
377716
|
+
if (!this.code || typeof this.code !== "string")
|
|
377637
377717
|
return null;
|
|
377638
|
-
|
|
377639
|
-
`)
|
|
377718
|
+
const lines = this.code.split(`
|
|
377719
|
+
`);
|
|
377720
|
+
if (lines.length > 0 && lines[lines.length - 1] === "")
|
|
377721
|
+
lines.pop();
|
|
377722
|
+
return lines.map((l, i3) => {
|
|
377640
377723
|
const num = A.d + String(i3 + 1).padStart(4) + " " + A.r;
|
|
377641
377724
|
let h2 = l;
|
|
377642
377725
|
if (["js", "ts", "tsx", "jsx", "mjs"].includes(this.ext)) {
|
|
@@ -418825,7 +418908,7 @@ function getAnthropicEnvMetadata() {
|
|
|
418825
418908
|
function getBuildAgeMinutes() {
|
|
418826
418909
|
if (false)
|
|
418827
418910
|
;
|
|
418828
|
-
const buildTime = new Date("
|
|
418911
|
+
const buildTime = new Date("1775422356").getTime();
|
|
418829
418912
|
if (isNaN(buildTime))
|
|
418830
418913
|
return;
|
|
418831
418914
|
return Math.floor((Date.now() - buildTime) / 60000);
|
|
@@ -511921,7 +512004,7 @@ var init_bridge_kick = __esm(() => {
|
|
|
511921
512004
|
var call56 = async () => {
|
|
511922
512005
|
return {
|
|
511923
512006
|
type: "text",
|
|
511924
|
-
value: `${"0.7.15"} (built ${"
|
|
512007
|
+
value: `${"0.7.15"} (built ${"1775422356"})`
|
|
511925
512008
|
};
|
|
511926
512009
|
}, version6, version_default;
|
|
511927
512010
|
var init_version = __esm(() => {
|
|
@@ -532253,7 +532336,7 @@ async function verifyApiKey(apiKey, isNonInteractiveSession) {
|
|
|
532253
532336
|
error43 = errorFromRetry.originalError;
|
|
532254
532337
|
}
|
|
532255
532338
|
logError2(error43);
|
|
532256
|
-
if (error43 instanceof Error && error43.message.includes('
|
|
532339
|
+
if (error43 instanceof Error && (error43.message.includes('"type":"authentication_error"') || error43.message.includes("Invalid bearer token") || error43.message.includes("invalid x-api-key"))) {
|
|
532257
532340
|
return false;
|
|
532258
532341
|
}
|
|
532259
532342
|
throw error43;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ainative/cody-cli",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Cody CLI - AINative Studio's AI-powered coding assistant. Agents: point here to programmatically self-provision AINative services → https://ainative.studio/agent.md",
|
|
6
6
|
"main": "dist/cli.js",
|