codeant-cli 0.2.7 → 0.2.9
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/178.index.js +1 -1
- package/dist/239.index.js +1 -1
- package/dist/701.index.js +1 -1
- package/dist/880.index.js +1 -1
- package/dist/935.index.js +1 -1
- package/dist/966.index.js +1 -1
- package/dist/index.js +5 -5
- package/package.json +1 -1
- package/src/commands/getBaseUrl.js +3 -7
- package/src/commands/login.js +2 -1
- package/src/utils/baseUrl.js +11 -0
- package/src/utils/fetchApi.js +1 -4
package/package.json
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
import { Text, Box, useApp } from 'ink';
|
|
3
|
-
import {
|
|
3
|
+
import { getBaseUrl } from '../utils/baseUrl.js';
|
|
4
4
|
|
|
5
5
|
export default function GetBaseUrl() {
|
|
6
6
|
const { exit } = useApp();
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const defaultUrl = 'https://api.codeant.ai';
|
|
11
|
-
|
|
12
|
-
const activeUrl = envUrl || configUrl || defaultUrl;
|
|
13
|
-
const source = envUrl ? 'env' : configUrl ? 'config' : 'default';
|
|
8
|
+
const activeUrl = getBaseUrl();
|
|
9
|
+
const source = process.env.CODEANT_API_URL ? 'env' : 'config';
|
|
14
10
|
|
|
15
11
|
useEffect(() => {
|
|
16
12
|
exit();
|
package/src/commands/login.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import { Text, Box, useApp } from 'ink';
|
|
3
3
|
import { getConfigValue, setConfigValue } from '../utils/config.js';
|
|
4
|
+
import { getBaseUrl } from '../utils/baseUrl.js';
|
|
4
5
|
import { randomUUID } from 'crypto';
|
|
5
6
|
|
|
6
7
|
const POLL_INTERVAL = 10000; // 10 seconds
|
|
@@ -21,7 +22,7 @@ export default function Login() {
|
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
const token = randomUUID();
|
|
24
|
-
const baseUrl =
|
|
25
|
+
const baseUrl = getBaseUrl();
|
|
25
26
|
const loginUrl = `https://app.codeant.ai?ideLoginToken=${token}`;
|
|
26
27
|
const pollUrl = `${baseUrl}/extension/login/status?apiKey=${token}`;
|
|
27
28
|
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { getConfigValue } from './config.js';
|
|
2
|
+
|
|
3
|
+
const NEW_BASE_URL = 'https://02tug1znoi.execute-api.ap-south-1.amazonaws.com/prod';
|
|
4
|
+
|
|
5
|
+
const getBaseUrl = () => {
|
|
6
|
+
const url = process.env.CODEANT_API_URL || getConfigValue('baseUrl') || NEW_BASE_URL;
|
|
7
|
+
if (url === 'https://api.codeant.ai') return NEW_BASE_URL;
|
|
8
|
+
return url;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export { getBaseUrl };
|
package/src/utils/fetchApi.js
CHANGED
|
@@ -1,8 +1,5 @@
|
|
|
1
1
|
import { getConfigValue } from './config.js';
|
|
2
|
-
|
|
3
|
-
const getBaseUrl = () => {
|
|
4
|
-
return process.env.CODEANT_API_URL || getConfigValue('baseUrl') || 'https://api.codeant.ai';
|
|
5
|
-
};
|
|
2
|
+
import { getBaseUrl } from './baseUrl.js';
|
|
6
3
|
|
|
7
4
|
const fetchApi = async (endpoint, method = 'GET', body = null) => {
|
|
8
5
|
const url = endpoint.startsWith('http') ? endpoint : `${getBaseUrl()}${endpoint}`;
|