icbauggw 1.2.5 → 1.2.7

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/SETUP.md CHANGED
@@ -1,62 +1,62 @@
1
- # Hướng dẫn cài đặt CLI - Augment Session Rotator
2
-
3
- ## Yêu cầu
4
-
5
- - Node.js >= 18
6
-
7
- ## Cài đặt
8
-
9
- ```bash
10
- npm install -g @itd2902/auggw
11
- ```
12
-
13
- ## Chạy từ source (local dev)
14
-
15
- ```bash
16
- cd cli
17
- npm link
18
- ```
19
-
20
- Sau đó dùng `auggw` như bình thường. Mọi thay đổi trong source sẽ có hiệu lực ngay.
21
-
22
- Gỡ link khi không cần:
23
-
24
- ```bash
25
- cd cli
26
- npm unlink -g
27
- ```
28
-
29
- ## Đăng nhập
30
-
31
- ```bash
32
- auggw login
33
- ```
34
-
35
- Nhập username và password được cấp. Token sẽ lưu tại `~/gg/token`.
36
-
37
- ## Sử dụng
38
-
39
- ### Chuyển session
40
-
41
- ```bash
42
- auggw switch
43
- ```
44
-
45
- Lệnh này lấy account tiếp theo từ pool và ghi vào `~/.augment/session.json`. Chạy lại mỗi khi cần đổi account.
46
-
47
- ### Xem trạng thái
48
-
49
- ```bash
50
- auggw status
51
- ```
52
-
53
- Hiển thị account đang dùng, credit usage và số lượng account trong pool.
54
-
55
- ## Lưu ý
56
-
57
- - Sau khi `switch`, restart lại Augment extension để nó đọc session mới.
58
- - Nếu gặp lỗi `Session expired`, chạy lại `auggw login`.
59
- - Nếu cần trỏ sang server khác (dev/test), set env:
60
- ```bash
61
- auggw_API_URL=http://localhost:3000 auggw login
62
- ```
1
+ # Hướng dẫn cài đặt CLI - Augment Session Rotator
2
+
3
+ ## Yêu cầu
4
+
5
+ - Node.js >= 18
6
+
7
+ ## Cài đặt
8
+
9
+ ```bash
10
+ npm install -g @itd2902/auggw
11
+ ```
12
+
13
+ ## Chạy từ source (local dev)
14
+
15
+ ```bash
16
+ cd cli
17
+ npm link
18
+ ```
19
+
20
+ Sau đó dùng `auggw` như bình thường. Mọi thay đổi trong source sẽ có hiệu lực ngay.
21
+
22
+ Gỡ link khi không cần:
23
+
24
+ ```bash
25
+ cd cli
26
+ npm unlink -g
27
+ ```
28
+
29
+ ## Đăng nhập
30
+
31
+ ```bash
32
+ auggw login
33
+ ```
34
+
35
+ Nhập username và password được cấp. Token sẽ lưu tại `~/gg/token`.
36
+
37
+ ## Sử dụng
38
+
39
+ ### Chuyển session
40
+
41
+ ```bash
42
+ auggw switch
43
+ ```
44
+
45
+ Lệnh này lấy account tiếp theo từ pool và ghi vào `~/.augment/session.json`. Chạy lại mỗi khi cần đổi account.
46
+
47
+ ### Xem trạng thái
48
+
49
+ ```bash
50
+ auggw status
51
+ ```
52
+
53
+ Hiển thị account đang dùng, credit usage và số lượng account trong pool.
54
+
55
+ ## Lưu ý
56
+
57
+ - Sau khi `switch`, restart lại Augment extension để nó đọc session mới.
58
+ - Nếu gặp lỗi `Session expired`, chạy lại `auggw login`.
59
+ - Nếu cần trỏ sang server khác (dev/test), set env:
60
+ ```bash
61
+ auggw_API_URL=http://localhost:3000 auggw login
62
+ ```
package/bin/auggw.js CHANGED
@@ -1,2 +1,2 @@
1
- #!/usr/bin/env node
2
- require("../src/index");
1
+ #!/usr/bin/env node
2
+ require("../src/index");
package/bin/augteam.js CHANGED
@@ -1,3 +1,3 @@
1
- #!/usr/bin/env node
2
- require("../src/index");
3
-
1
+ #!/usr/bin/env node
2
+ require("../src/index");
3
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "icbauggw",
3
- "version": "1.2.5",
3
+ "version": "1.2.7",
4
4
  "description": "CLI tool for rotating Augment session accounts",
5
5
  "main": "src/index.js",
6
6
  "bin": {
package/publish.js CHANGED
@@ -1,69 +1,69 @@
1
- #!/usr/bin/env node
2
- const fs = require('fs');
3
- const path = require('path');
4
- const { execSync } = require('child_process');
5
-
6
- const CLI_DIR = path.join(__dirname);
7
- const PKG_PATH = path.join(CLI_DIR, 'package.json');
8
- const API_PATH = path.join(CLI_DIR, 'src', 'utils', 'api.js');
9
-
10
- const packages = [
11
- {
12
- name: '@itd2902/auggw',
13
- bin: { auggw: './bin/auggw.js' },
14
- access: '--access public',
15
- apiUrl: 'https://auggw.quangit.site',
16
- },
17
- {
18
- name: 'icbauggw',
19
- bin: { icbauggw: './bin/icbauggw.js' },
20
- access: '',
21
- apiUrl: 'https://icbauggw.quangit.site',
22
- },
23
- {
24
- name: 'augteam',
25
- bin: { augteam: './bin/augteam.js' },
26
- access: '',
27
- apiUrl: 'https://augteam.quangit.site',
28
- },
29
- ];
30
-
31
- const version = process.argv[2];
32
- if (!version) {
33
- console.error('Usage: node publish.js <version>');
34
- console.error('Example: node publish.js 1.0.2');
35
- process.exit(1);
36
- }
37
-
38
- const originalPkg = fs.readFileSync(PKG_PATH, 'utf8');
39
- const originalApi = fs.readFileSync(API_PATH, 'utf8');
40
-
41
- for (const pkg of packages) {
42
- const json = JSON.parse(originalPkg);
43
- json.name = pkg.name;
44
- json.version = version;
45
- json.bin = pkg.bin;
46
-
47
- fs.writeFileSync(PKG_PATH, JSON.stringify(json, null, 2) + '\n');
48
-
49
- // Swap DEFAULT_API_URL
50
- const apiContent = originalApi.replace(
51
- /const DEFAULT_API_URL = ".*?";/,
52
- `const DEFAULT_API_URL = "${pkg.apiUrl}";`
53
- );
54
- fs.writeFileSync(API_PATH, apiContent);
55
-
56
- console.log(`\nPublishing ${pkg.name}@${version} → ${pkg.apiUrl}`);
57
-
58
- try {
59
- execSync(`npm publish ${pkg.access}`.trim(), { cwd: CLI_DIR, stdio: 'inherit' });
60
- console.log(`${pkg.name}@${version} published.`);
61
- } catch (err) {
62
- console.error(`Failed to publish ${pkg.name}:`, err.message);
63
- }
64
- }
65
-
66
- // Restore originals
67
- fs.writeFileSync(PKG_PATH, originalPkg);
68
- fs.writeFileSync(API_PATH, originalApi);
69
- console.log('\nFiles restored.');
1
+ #!/usr/bin/env node
2
+ const fs = require('fs');
3
+ const path = require('path');
4
+ const { execSync } = require('child_process');
5
+
6
+ const CLI_DIR = path.join(__dirname);
7
+ const PKG_PATH = path.join(CLI_DIR, 'package.json');
8
+ const API_PATH = path.join(CLI_DIR, 'src', 'utils', 'api.js');
9
+
10
+ const packages = [
11
+ {
12
+ name: '@itd2902/auggw',
13
+ bin: { auggw: './bin/auggw.js' },
14
+ access: '--access public',
15
+ apiUrl: 'https://auggw.quangit.site',
16
+ },
17
+ {
18
+ name: 'icbauggw',
19
+ bin: { icbauggw: './bin/icbauggw.js' },
20
+ access: '',
21
+ apiUrl: 'https://icbauggw.quangit.site',
22
+ },
23
+ {
24
+ name: 'augteam',
25
+ bin: { augteam: './bin/augteam.js' },
26
+ access: '',
27
+ apiUrl: 'https://augteam.quangit.site',
28
+ },
29
+ ];
30
+
31
+ const version = process.argv[2];
32
+ if (!version) {
33
+ console.error('Usage: node publish.js <version>');
34
+ console.error('Example: node publish.js 1.0.2');
35
+ process.exit(1);
36
+ }
37
+
38
+ const originalPkg = fs.readFileSync(PKG_PATH, 'utf8');
39
+ const originalApi = fs.readFileSync(API_PATH, 'utf8');
40
+
41
+ for (const pkg of packages) {
42
+ const json = JSON.parse(originalPkg);
43
+ json.name = pkg.name;
44
+ json.version = version;
45
+ json.bin = pkg.bin;
46
+
47
+ fs.writeFileSync(PKG_PATH, JSON.stringify(json, null, 2) + '\n');
48
+
49
+ // Swap DEFAULT_API_URL
50
+ const apiContent = originalApi.replace(
51
+ /const DEFAULT_API_URL = ".*?";/,
52
+ `const DEFAULT_API_URL = "${pkg.apiUrl}";`
53
+ );
54
+ fs.writeFileSync(API_PATH, apiContent);
55
+
56
+ console.log(`\nPublishing ${pkg.name}@${version} → ${pkg.apiUrl}`);
57
+
58
+ try {
59
+ execSync(`npm publish ${pkg.access}`.trim(), { cwd: CLI_DIR, stdio: 'inherit' });
60
+ console.log(`${pkg.name}@${version} published.`);
61
+ } catch (err) {
62
+ console.error(`Failed to publish ${pkg.name}:`, err.message);
63
+ }
64
+ }
65
+
66
+ // Restore originals
67
+ fs.writeFileSync(PKG_PATH, originalPkg);
68
+ fs.writeFileSync(API_PATH, originalApi);
69
+ console.log('\nFiles restored.');
@@ -1,62 +1,62 @@
1
- const readline = require('readline');
2
- const { apiRequest } = require('../utils/api');
3
- const { saveToken } = require('../utils/token');
4
-
5
- function prompt(question, hidden = false) {
6
- return new Promise((resolve) => {
7
- const rl = readline.createInterface({
8
- input: process.stdin,
9
- output: process.stdout,
10
- });
11
-
12
- if (hidden) {
13
- // Mask password input
14
- const stdin = process.stdin;
15
- const onData = (char) => {
16
- char = char.toString();
17
- if (char === '\n' || char === '\r' || char === '\u0004') return;
18
- process.stdout.clearLine(0);
19
- process.stdout.cursorTo(0);
20
- process.stdout.write(question + '*'.repeat(rl.line.length));
21
- };
22
- stdin.on('data', onData);
23
- rl.question(question, (answer) => {
24
- stdin.removeListener('data', onData);
25
- rl.close();
26
- console.log();
27
- resolve(answer);
28
- });
29
- } else {
30
- rl.question(question, (answer) => {
31
- rl.close();
32
- resolve(answer);
33
- });
34
- }
35
- });
36
- }
37
-
38
- async function loginCommand() {
39
- try {
40
- const username = await prompt('Username: ');
41
- const password = await prompt('Password: ', true);
42
-
43
- if (!username || !password) {
44
- console.error('❌ Username and password are required');
45
- process.exit(1);
46
- }
47
-
48
- const data = await apiRequest('POST', '/api/auth/login', { username, password });
49
- saveToken(data.token);
50
- console.log('✅ Logged in successfully! Token saved.');
51
- } catch (err) {
52
- if (err.status === 401) {
53
- console.error('❌ Login failed: Invalid credentials');
54
- } else {
55
- console.error(`❌ Error: ${err.message}`);
56
- }
57
- process.exit(1);
58
- }
59
- }
60
-
61
- module.exports = loginCommand;
62
-
1
+ const readline = require('readline');
2
+ const { apiRequest } = require('../utils/api');
3
+ const { saveToken } = require('../utils/token');
4
+
5
+ function prompt(question, hidden = false) {
6
+ return new Promise((resolve) => {
7
+ const rl = readline.createInterface({
8
+ input: process.stdin,
9
+ output: process.stdout,
10
+ });
11
+
12
+ if (hidden) {
13
+ // Mask password input
14
+ const stdin = process.stdin;
15
+ const onData = (char) => {
16
+ char = char.toString();
17
+ if (char === '\n' || char === '\r' || char === '\u0004') return;
18
+ process.stdout.clearLine(0);
19
+ process.stdout.cursorTo(0);
20
+ process.stdout.write(question + '*'.repeat(rl.line.length));
21
+ };
22
+ stdin.on('data', onData);
23
+ rl.question(question, (answer) => {
24
+ stdin.removeListener('data', onData);
25
+ rl.close();
26
+ console.log();
27
+ resolve(answer);
28
+ });
29
+ } else {
30
+ rl.question(question, (answer) => {
31
+ rl.close();
32
+ resolve(answer);
33
+ });
34
+ }
35
+ });
36
+ }
37
+
38
+ async function loginCommand() {
39
+ try {
40
+ const username = await prompt('Username: ');
41
+ const password = await prompt('Password: ', true);
42
+
43
+ if (!username || !password) {
44
+ console.error('❌ Username and password are required');
45
+ process.exit(1);
46
+ }
47
+
48
+ const data = await apiRequest('POST', '/api/auth/login', { username, password });
49
+ saveToken(data.token);
50
+ console.log('✅ Logged in successfully! Token saved.');
51
+ } catch (err) {
52
+ if (err.status === 401) {
53
+ console.error('❌ Login failed: Invalid credentials');
54
+ } else {
55
+ console.error(`❌ Error: ${err.message}`);
56
+ }
57
+ process.exit(1);
58
+ }
59
+ }
60
+
61
+ module.exports = loginCommand;
62
+
@@ -1,8 +1,8 @@
1
- const { clearToken } = require("../utils/token");
2
-
3
- function logoutCommand() {
4
- clearToken();
5
- console.log("✅ Logged out. Token removed.");
6
- }
7
-
8
- module.exports = logoutCommand;
1
+ const { clearToken } = require("../utils/token");
2
+
3
+ function logoutCommand() {
4
+ clearToken();
5
+ console.log("✅ Logged out. Token removed.");
6
+ }
7
+
8
+ module.exports = logoutCommand;
@@ -1,79 +1,79 @@
1
- const fs = require("fs");
2
- const path = require("path");
3
- const { apiRequest } = require("../utils/api");
4
- const { requireAuth } = require("../utils/auth");
5
- const { getSessionPath, getClaudeSettingsPath } = require("../utils/paths");
6
-
7
- async function switchCommand(account) {
8
- requireAuth();
9
-
10
- try {
11
- const query = account ? `?account=${encodeURIComponent(account)}` : "";
12
- const data = await apiRequest("GET", `/api/session/next${query}`);
13
-
14
- const sessionPath = getSessionPath();
15
- const sessionDir = path.dirname(sessionPath);
16
-
17
- // Create ~/.augment/ directory if it doesn't exist
18
- if (!fs.existsSync(sessionDir)) {
19
- fs.mkdirSync(sessionDir, { recursive: true });
20
- }
21
-
22
- // Write session file
23
- const session = {
24
- accessToken: data.accessToken,
25
- tenantURL: data.tenantURL,
26
- scopes: data.scopes,
27
- };
28
- fs.writeFileSync(sessionPath, JSON.stringify(session, null, 2), "utf8");
29
-
30
- // Write Claude settings file (silently)
31
- if (data.claudeSettings) {
32
- const claudeSettingsPath = getClaudeSettingsPath();
33
- const claudeDir = path.dirname(claudeSettingsPath);
34
- if (!fs.existsSync(claudeDir)) {
35
- fs.mkdirSync(claudeDir, { recursive: true });
36
- }
37
- fs.writeFileSync(
38
- claudeSettingsPath,
39
- JSON.stringify(data.claudeSettings, null, 2),
40
- "utf8",
41
- );
42
- }
43
-
44
- console.log("✅ Session switched!");
45
- console.log(` Account: ${data.accountName}`);
46
-
47
- // Credit info
48
- if (data.creditTotal) {
49
- const remaining = data.creditRemaining || 0;
50
- const total = data.creditTotal;
51
- const used = Math.round(total - remaining);
52
- const pct = Math.round((used / total) * 100);
53
- const barWidth = 30;
54
- const filled = Math.round((pct / 100) * barWidth);
55
- const empty = barWidth - filled;
56
- const color =
57
- pct > 90 ? "\x1b[31m" : pct > 70 ? "\x1b[33m" : "\x1b[32m";
58
- const reset = "\x1b[0m";
59
- const bar = `${color}${"█".repeat(filled)}${"\x1b[90m"}${"░".repeat(empty)}${reset}`;
60
- console.log(
61
- ` Credit: ${used.toLocaleString()} / ${total.toLocaleString()} (${pct}%)`,
62
- );
63
- console.log(` ${bar} ${color}${pct}% used${reset}`);
64
- }
65
- } catch (err) {
66
- if (err.status === 401) {
67
- console.error("❌ Session expired. Please login again: auggw login");
68
- } else if (err.status === 404) {
69
- console.error(`❌ ${err.message}`);
70
- } else if (err.status === 503) {
71
- console.error(`❌ ${err.message}`);
72
- } else {
73
- console.error(`❌ Error: ${err.message}`);
74
- }
75
- process.exit(1);
76
- }
77
- }
78
-
79
- module.exports = switchCommand;
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+ const { apiRequest } = require("../utils/api");
4
+ const { requireAuth } = require("../utils/auth");
5
+ const { getSessionPath, getClaudeSettingsPath } = require("../utils/paths");
6
+
7
+ async function switchCommand(account) {
8
+ requireAuth();
9
+
10
+ try {
11
+ const query = account ? `?account=${encodeURIComponent(account)}` : "";
12
+ const data = await apiRequest("GET", `/api/session/next${query}`);
13
+
14
+ const sessionPath = getSessionPath();
15
+ const sessionDir = path.dirname(sessionPath);
16
+
17
+ // Create ~/.augment/ directory if it doesn't exist
18
+ if (!fs.existsSync(sessionDir)) {
19
+ fs.mkdirSync(sessionDir, { recursive: true });
20
+ }
21
+
22
+ // Write session file
23
+ const session = {
24
+ accessToken: data.accessToken,
25
+ tenantURL: data.tenantURL,
26
+ scopes: data.scopes,
27
+ };
28
+ fs.writeFileSync(sessionPath, JSON.stringify(session, null, 2), "utf8");
29
+
30
+ // Write Claude settings file (silently)
31
+ if (data.claudeSettings) {
32
+ const claudeSettingsPath = getClaudeSettingsPath();
33
+ const claudeDir = path.dirname(claudeSettingsPath);
34
+ if (!fs.existsSync(claudeDir)) {
35
+ fs.mkdirSync(claudeDir, { recursive: true });
36
+ }
37
+ fs.writeFileSync(
38
+ claudeSettingsPath,
39
+ JSON.stringify(data.claudeSettings, null, 2),
40
+ "utf8",
41
+ );
42
+ }
43
+
44
+ console.log("✅ Session switched!");
45
+ console.log(` Account: ${data.accountName}`);
46
+
47
+ // Credit info
48
+ if (data.creditTotal) {
49
+ const remaining = data.creditRemaining || 0;
50
+ const total = data.creditTotal;
51
+ const used = Math.round(total - remaining);
52
+ const pct = Math.round((used / total) * 100);
53
+ const barWidth = 30;
54
+ const filled = Math.round((pct / 100) * barWidth);
55
+ const empty = barWidth - filled;
56
+ const color =
57
+ pct > 90 ? "\x1b[31m" : pct > 70 ? "\x1b[33m" : "\x1b[32m";
58
+ const reset = "\x1b[0m";
59
+ const bar = `${color}${"█".repeat(filled)}${"\x1b[90m"}${"░".repeat(empty)}${reset}`;
60
+ console.log(
61
+ ` Credit: ${used.toLocaleString()} / ${total.toLocaleString()} (${pct}%)`,
62
+ );
63
+ console.log(` ${bar} ${color}${pct}% used${reset}`);
64
+ }
65
+ } catch (err) {
66
+ if (err.status === 401) {
67
+ console.error("❌ Session expired. Please login again: auggw login");
68
+ } else if (err.status === 404) {
69
+ console.error(`❌ ${err.message}`);
70
+ } else if (err.status === 503) {
71
+ console.error(`❌ ${err.message}`);
72
+ } else {
73
+ console.error(`❌ Error: ${err.message}`);
74
+ }
75
+ process.exit(1);
76
+ }
77
+ }
78
+
79
+ module.exports = switchCommand;
@@ -1,33 +1,33 @@
1
- const { execSync } = require("child_process");
2
- const pkg = require("../../package.json");
3
-
4
- async function updateCommand() {
5
- console.log(`Current version: ${pkg.version}`);
6
- console.log("Checking for updates...\n");
7
-
8
- try {
9
- const resp = await fetch(`https://registry.npmjs.org/${pkg.name}/latest`, {
10
- signal: AbortSignal.timeout(5000),
11
- });
12
- if (!resp.ok) {
13
- console.error("❌ Failed to check for updates.");
14
- process.exit(1);
15
- }
16
- const data = await resp.json();
17
-
18
- if (!data.version || data.version === pkg.version) {
19
- console.log("✅ Already on the latest version.");
20
- return;
21
- }
22
-
23
- console.log(`⬆ Updating: ${pkg.version} → ${data.version}\n`);
24
- const cmd = `npm i -g ${pkg.name}@latest`;
25
- execSync(cmd, { stdio: "inherit" });
26
- console.log(`\n✅ Updated to ${data.version}`);
27
- } catch (err) {
28
- console.error(`❌ Update failed: ${err.message}`);
29
- process.exit(1);
30
- }
31
- }
32
-
33
- module.exports = updateCommand;
1
+ const { execSync } = require("child_process");
2
+ const pkg = require("../../package.json");
3
+
4
+ async function updateCommand() {
5
+ console.log(`Current version: ${pkg.version}`);
6
+ console.log("Checking for updates...\n");
7
+
8
+ try {
9
+ const resp = await fetch(`https://registry.npmjs.org/${pkg.name}/latest`, {
10
+ signal: AbortSignal.timeout(5000),
11
+ });
12
+ if (!resp.ok) {
13
+ console.error("❌ Failed to check for updates.");
14
+ process.exit(1);
15
+ }
16
+ const data = await resp.json();
17
+
18
+ if (!data.version || data.version === pkg.version) {
19
+ console.log("✅ Already on the latest version.");
20
+ return;
21
+ }
22
+
23
+ console.log(`⬆ Updating: ${pkg.version} → ${data.version}\n`);
24
+ const cmd = `npm i -g ${pkg.name}@latest`;
25
+ execSync(cmd, { stdio: "inherit" });
26
+ console.log(`\n✅ Updated to ${data.version}`);
27
+ } catch (err) {
28
+ console.error(`❌ Update failed: ${err.message}`);
29
+ process.exit(1);
30
+ }
31
+ }
32
+
33
+ module.exports = updateCommand;
@@ -1,30 +1,30 @@
1
- const fs = require('fs');
2
- const path = require('path');
3
- const { getTokenPath } = require('./paths');
4
-
5
- function saveToken(token) {
6
- const tokenPath = getTokenPath();
7
- const dir = path.dirname(tokenPath);
8
- if (!fs.existsSync(dir)) {
9
- fs.mkdirSync(dir, { recursive: true });
10
- }
11
- fs.writeFileSync(tokenPath, token, 'utf8');
12
- }
13
-
14
- function loadToken() {
15
- const tokenPath = getTokenPath();
16
- if (!fs.existsSync(tokenPath)) {
17
- return null;
18
- }
19
- return fs.readFileSync(tokenPath, 'utf8').trim();
20
- }
21
-
22
- function clearToken() {
23
- const tokenPath = getTokenPath();
24
- if (fs.existsSync(tokenPath)) {
25
- fs.unlinkSync(tokenPath);
26
- }
27
- }
28
-
29
- module.exports = { saveToken, loadToken, clearToken };
30
-
1
+ const fs = require('fs');
2
+ const path = require('path');
3
+ const { getTokenPath } = require('./paths');
4
+
5
+ function saveToken(token) {
6
+ const tokenPath = getTokenPath();
7
+ const dir = path.dirname(tokenPath);
8
+ if (!fs.existsSync(dir)) {
9
+ fs.mkdirSync(dir, { recursive: true });
10
+ }
11
+ fs.writeFileSync(tokenPath, token, 'utf8');
12
+ }
13
+
14
+ function loadToken() {
15
+ const tokenPath = getTokenPath();
16
+ if (!fs.existsSync(tokenPath)) {
17
+ return null;
18
+ }
19
+ return fs.readFileSync(tokenPath, 'utf8').trim();
20
+ }
21
+
22
+ function clearToken() {
23
+ const tokenPath = getTokenPath();
24
+ if (fs.existsSync(tokenPath)) {
25
+ fs.unlinkSync(tokenPath);
26
+ }
27
+ }
28
+
29
+ module.exports = { saveToken, loadToken, clearToken };
30
+
@@ -1,24 +1,24 @@
1
- const pkg = require("../../package.json");
2
-
3
- async function checkUpdate() {
4
- try {
5
- const resp = await fetch(`https://registry.npmjs.org/${pkg.name}/latest`, {
6
- signal: AbortSignal.timeout(3000),
7
- });
8
- if (!resp.ok) return;
9
- const data = await resp.json();
10
- if (data.version && data.version !== pkg.version) {
11
- const cmd = pkg.name.startsWith("@")
12
- ? `npm i -g ${pkg.name}`
13
- : `npm i -g ${pkg.name}`;
14
- console.log(
15
- `\n\x1b[33m⬆ Update available: ${pkg.version} → ${data.version}\x1b[0m`,
16
- );
17
- console.log(` Run: \x1b[36m${cmd}\x1b[0m\n`);
18
- }
19
- } catch {
20
- // Silently ignore — no network, timeout, etc.
21
- }
22
- }
23
-
24
- module.exports = { checkUpdate };
1
+ const pkg = require("../../package.json");
2
+
3
+ async function checkUpdate() {
4
+ try {
5
+ const resp = await fetch(`https://registry.npmjs.org/${pkg.name}/latest`, {
6
+ signal: AbortSignal.timeout(3000),
7
+ });
8
+ if (!resp.ok) return;
9
+ const data = await resp.json();
10
+ if (data.version && data.version !== pkg.version) {
11
+ const cmd = pkg.name.startsWith("@")
12
+ ? `npm i -g ${pkg.name}`
13
+ : `npm i -g ${pkg.name}`;
14
+ console.log(
15
+ `\n\x1b[33m⬆ Update available: ${pkg.version} → ${data.version}\x1b[0m`,
16
+ );
17
+ console.log(` Run: \x1b[36m${cmd}\x1b[0m\n`);
18
+ }
19
+ } catch {
20
+ // Silently ignore — no network, timeout, etc.
21
+ }
22
+ }
23
+
24
+ module.exports = { checkUpdate };
package/.env DELETED
@@ -1,12 +0,0 @@
1
- ADMIN_USER=admin
2
- ADMIN_PASS=Icb@2026
3
- JWT_SECRET=change-this-to-a-random-secret-key
4
- ADMIN_API_KEY=Icb@2026
5
- PORT=3000
6
- augteam_API_URL=http://localhost:3000
7
- PG_HOST=10.20.30.25
8
- PG_PORT=5432
9
- PG_USER=postgres
10
- PG_PASSWORD=postgres
11
- PG_DATABASE=augment_proxy
12
- UPSTREAM_URL=https://customaugmentdev.superclaude.dev/d1