@itd2902/auggw 1.0.7 → 1.0.8
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/package.json +1 -1
- package/src/commands/logout.js +8 -0
- package/src/commands/status.js +2 -0
- package/src/commands/update.js +33 -0
- package/src/index.js +12 -0
package/package.json
CHANGED
package/src/commands/status.js
CHANGED
|
@@ -0,0 +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;
|
package/src/index.js
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
const { Command } = require('commander');
|
|
2
2
|
const loginCommand = require('./commands/login');
|
|
3
|
+
const logoutCommand = require('./commands/logout');
|
|
3
4
|
const switchCommand = require('./commands/switch');
|
|
4
5
|
const statusCommand = require('./commands/status');
|
|
6
|
+
const updateCommand = require('./commands/update');
|
|
5
7
|
const { checkUpdate } = require('./utils/update');
|
|
6
8
|
const pkg = require('../package.json');
|
|
7
9
|
|
|
@@ -17,6 +19,11 @@ program
|
|
|
17
19
|
.description('Authenticate with the session rotator backend')
|
|
18
20
|
.action(loginCommand);
|
|
19
21
|
|
|
22
|
+
program
|
|
23
|
+
.command('logout')
|
|
24
|
+
.description('Remove saved token and log out')
|
|
25
|
+
.action(logoutCommand);
|
|
26
|
+
|
|
20
27
|
program
|
|
21
28
|
.command('switch')
|
|
22
29
|
.description('Switch to the next available Augment session')
|
|
@@ -27,6 +34,11 @@ program
|
|
|
27
34
|
.description('View current account and pool status')
|
|
28
35
|
.action(statusCommand);
|
|
29
36
|
|
|
37
|
+
program
|
|
38
|
+
.command('update')
|
|
39
|
+
.description('Update CLI to the latest version')
|
|
40
|
+
.action(updateCommand);
|
|
41
|
+
|
|
30
42
|
program.parse();
|
|
31
43
|
|
|
32
44
|
// Non-blocking update check — runs after command finishes
|