@ainative/cody-cli 0.7.16 → 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.
Files changed (2) hide show
  1. package/dist/cli.js +112 -34
  2. 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 endpoint = `${getOauthConfig().BASE_API_URL}/api/oauth/profile`;
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: "1775421369",
181027
+ buildTime: "1775422356",
180965
181028
  deploymentEnvironment: env4.detectDeploymentEnvironment(),
180966
181029
  ...isEnvTruthy(process.env.GITHUB_ACTIONS) && {
180967
181030
  githubEventName: process.env.GITHUB_EVENT_NAME,
@@ -336406,9 +336469,10 @@ async function installOAuthTokens(tokens) {
336406
336469
  organizationUuid: tokens.tokenAccount.organizationUuid
336407
336470
  });
336408
336471
  } else if (isAINative) {
336409
- const email3 = process.env.AINATIVE_USERNAME || process.env.USER_EMAIL || "user@ainative.studio";
336472
+ const { randomUUID: randomUUID10 } = await import("crypto");
336473
+ const email3 = process.env.AINATIVE_USERNAME || process.env.USER_EMAIL || "admin@ainative.studio";
336410
336474
  storeOAuthAccountInfo({
336411
- accountUuid: tokens.accessToken.substring(0, 36),
336475
+ accountUuid: randomUUID10(),
336412
336476
  emailAddress: email3,
336413
336477
  organizationUuid: undefined
336414
336478
  });
@@ -336483,8 +336547,8 @@ async function authLogin({
336483
336547
  const envScopes = process.env.CLAUDE_CODE_OAUTH_SCOPES;
336484
336548
  if (!envScopes) {
336485
336549
  process.stderr.write(`CLAUDE_CODE_OAUTH_SCOPES is required when using CLAUDE_CODE_OAUTH_REFRESH_TOKEN.
336486
- ` + `Set it to the space-separated scopes the refresh token was issued with
336487
- ` + `(e.g. "user:inference" or "user:profile user:inference user:sessions:claude_code user:mcp_servers").
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").
336488
336552
  `);
336489
336553
  process.exit(1);
336490
336554
  }
@@ -377607,41 +377671,55 @@ var require_color_diff_napi = __commonJS((exports, module) => {
377607
377671
  var A = { r: "\x1B[0m", g: "\x1B[32m", rd: "\x1B[31m", c: "\x1B[36m", m: "\x1B[35m", d: "\x1B[2m" };
377608
377672
 
377609
377673
  class ColorDiff {
377610
- constructor(p, f, fp, fc) {
377611
- this.p = p;
377612
- this.firstLine = f;
377674
+ constructor(hunk, firstLine, filePath, prefixContent) {
377675
+ this.hunk = hunk;
377676
+ this.filePath = filePath;
377677
+ this.firstLine = firstLine;
377678
+ this.prefixContent = prefixContent ?? null;
377613
377679
  }
377614
- render(t, w2, d) {
377615
- if (!this.p)
377680
+ render(themeName, width, dim2) {
377681
+ if (!this.hunk || !this.hunk.lines)
377616
377682
  return null;
377617
- let n2 = this.firstLine || 1;
377618
- return this.p.split(`
377619
- `).map((l) => {
377620
- if (l[0] == "+")
377621
- return A.g + String(n2++).padStart(4) + " " + l.slice(1) + A.r;
377622
- if (l[0] == "-")
377623
- return A.rd + " " + l.slice(1) + A.r;
377624
- if (l.startsWith("@@")) {
377625
- const m2 = l.match(/@@ -\d+(?:,\d+)? \+(\d+)/);
377626
- if (m2)
377627
- n2 = parseInt(m2[1]);
377628
- return A.c + l + A.r;
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);
377629
377703
  }
377630
- return String(n2++).padStart(4) + " " + (l[0] == " " ? l.slice(1) : l);
377631
- });
377704
+ }
377705
+ return out;
377632
377706
  }
377633
377707
  }
377634
377708
 
377635
377709
  class ColorFile {
377636
- constructor(c6, f) {
377637
- this.c = c6;
377638
- this.ext = (f || "").split(".").pop();
377710
+ constructor(code, filePath) {
377711
+ this.code = code;
377712
+ this.filePath = filePath;
377713
+ this.ext = (filePath || "").split(".").pop();
377639
377714
  }
377640
- render(t, w2) {
377641
- if (!this.c)
377715
+ render(themeName, width) {
377716
+ if (!this.code || typeof this.code !== "string")
377642
377717
  return null;
377643
- return this.c.split(`
377644
- `).map((l, i3) => {
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) => {
377645
377723
  const num = A.d + String(i3 + 1).padStart(4) + " " + A.r;
377646
377724
  let h2 = l;
377647
377725
  if (["js", "ts", "tsx", "jsx", "mjs"].includes(this.ext)) {
@@ -418830,7 +418908,7 @@ function getAnthropicEnvMetadata() {
418830
418908
  function getBuildAgeMinutes() {
418831
418909
  if (false)
418832
418910
  ;
418833
- const buildTime = new Date("1775421369").getTime();
418911
+ const buildTime = new Date("1775422356").getTime();
418834
418912
  if (isNaN(buildTime))
418835
418913
  return;
418836
418914
  return Math.floor((Date.now() - buildTime) / 60000);
@@ -511926,7 +512004,7 @@ var init_bridge_kick = __esm(() => {
511926
512004
  var call56 = async () => {
511927
512005
  return {
511928
512006
  type: "text",
511929
- value: `${"0.7.15"} (built ${"1775421369"})`
512007
+ value: `${"0.7.15"} (built ${"1775422356"})`
511930
512008
  };
511931
512009
  }, version6, version_default;
511932
512010
  var init_version = __esm(() => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ainative/cody-cli",
3
- "version": "0.7.16",
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",