@gowelle/stint-agent 1.0.4 → 1.0.6
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/README.md
CHANGED
|
@@ -254,7 +254,7 @@ var AuthServiceImpl = class {
|
|
|
254
254
|
return null;
|
|
255
255
|
}
|
|
256
256
|
try {
|
|
257
|
-
const { apiService: apiService2 } = await import("./api-
|
|
257
|
+
const { apiService: apiService2 } = await import("./api-N3FEQDDP.js");
|
|
258
258
|
const user = await apiService2.getCurrentUser();
|
|
259
259
|
logger.info("auth", `Token validated for user: ${user.email}`);
|
|
260
260
|
return user;
|
|
@@ -274,7 +274,7 @@ var AuthServiceImpl = class {
|
|
|
274
274
|
var authService = new AuthServiceImpl();
|
|
275
275
|
|
|
276
276
|
// src/services/api.ts
|
|
277
|
-
var AGENT_VERSION = "1.0.
|
|
277
|
+
var AGENT_VERSION = "1.0.6";
|
|
278
278
|
var ApiServiceImpl = class {
|
|
279
279
|
sessionId = null;
|
|
280
280
|
async getHeaders() {
|
package/dist/daemon/runner.js
CHANGED
|
@@ -5,13 +5,13 @@ import {
|
|
|
5
5
|
projectService,
|
|
6
6
|
removePidFile,
|
|
7
7
|
writePidFile
|
|
8
|
-
} from "../chunk-
|
|
8
|
+
} from "../chunk-RWHZ5ULY.js";
|
|
9
9
|
import {
|
|
10
10
|
apiService,
|
|
11
11
|
authService,
|
|
12
12
|
config,
|
|
13
13
|
logger
|
|
14
|
-
} from "../chunk-
|
|
14
|
+
} from "../chunk-NCWEPWZN.js";
|
|
15
15
|
|
|
16
16
|
// src/daemon/runner.ts
|
|
17
17
|
import "dotenv/config";
|
package/dist/index.js
CHANGED
|
@@ -8,18 +8,18 @@ import {
|
|
|
8
8
|
projectService,
|
|
9
9
|
spawnDetached,
|
|
10
10
|
validatePidFile
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-RWHZ5ULY.js";
|
|
12
12
|
import {
|
|
13
13
|
apiService,
|
|
14
14
|
authService,
|
|
15
15
|
config,
|
|
16
16
|
logger
|
|
17
|
-
} from "./chunk-
|
|
17
|
+
} from "./chunk-NCWEPWZN.js";
|
|
18
18
|
|
|
19
19
|
// src/index.ts
|
|
20
20
|
import "dotenv/config";
|
|
21
21
|
import { Command } from "commander";
|
|
22
|
-
import
|
|
22
|
+
import chalk12 from "chalk";
|
|
23
23
|
|
|
24
24
|
// src/commands/login.ts
|
|
25
25
|
import open from "open";
|
|
@@ -1266,20 +1266,81 @@ function registerUninstallCommand(program2) {
|
|
|
1266
1266
|
});
|
|
1267
1267
|
}
|
|
1268
1268
|
|
|
1269
|
+
// src/commands/update.ts
|
|
1270
|
+
import ora11 from "ora";
|
|
1271
|
+
import chalk11 from "chalk";
|
|
1272
|
+
import { exec as exec2 } from "child_process";
|
|
1273
|
+
import { promisify as promisify2 } from "util";
|
|
1274
|
+
var execAsync2 = promisify2(exec2);
|
|
1275
|
+
function registerUpdateCommand(program2) {
|
|
1276
|
+
program2.command("update").description("Update stint agent to the latest version").action(async () => {
|
|
1277
|
+
const spinner = ora11("Checking for updates...").start();
|
|
1278
|
+
try {
|
|
1279
|
+
const currentVersion = program2.version();
|
|
1280
|
+
const { stdout: latestVersion } = await execAsync2("npm view @gowelle/stint-agent version");
|
|
1281
|
+
const cleanLatestVersion = latestVersion.trim();
|
|
1282
|
+
if (currentVersion === cleanLatestVersion) {
|
|
1283
|
+
spinner.succeed("Already up to date");
|
|
1284
|
+
console.log(chalk11.gray(`
|
|
1285
|
+
Current version: ${currentVersion}`));
|
|
1286
|
+
console.log(chalk11.gray(`Latest version: ${cleanLatestVersion}
|
|
1287
|
+
`));
|
|
1288
|
+
return;
|
|
1289
|
+
}
|
|
1290
|
+
spinner.info(`Update available: ${currentVersion} \u2192 ${cleanLatestVersion}`);
|
|
1291
|
+
spinner.text = "Installing update...";
|
|
1292
|
+
await execAsync2("npm install -g @gowelle/stint-agent@latest");
|
|
1293
|
+
spinner.succeed(`Updated to version ${cleanLatestVersion}`);
|
|
1294
|
+
const { valid, pid } = validatePidFile();
|
|
1295
|
+
if (valid && pid) {
|
|
1296
|
+
console.log(chalk11.blue("\n\u{1F504} Restarting daemon with new version..."));
|
|
1297
|
+
const restartSpinner = ora11("Restarting daemon...").start();
|
|
1298
|
+
try {
|
|
1299
|
+
killProcess(pid, "SIGTERM");
|
|
1300
|
+
let attempts = 0;
|
|
1301
|
+
while (attempts < 10 && isProcessRunning(pid)) {
|
|
1302
|
+
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
1303
|
+
attempts++;
|
|
1304
|
+
}
|
|
1305
|
+
if (isProcessRunning(pid)) {
|
|
1306
|
+
killProcess(pid, "SIGKILL");
|
|
1307
|
+
}
|
|
1308
|
+
await new Promise((resolve) => setTimeout(resolve, 1e3));
|
|
1309
|
+
await execAsync2("stint daemon start");
|
|
1310
|
+
restartSpinner.succeed("Daemon restarted successfully");
|
|
1311
|
+
logger.success("update", `Daemon restarted after update`);
|
|
1312
|
+
} catch (error) {
|
|
1313
|
+
restartSpinner.fail("Failed to restart daemon");
|
|
1314
|
+
logger.error("update", "Daemon restart failed", error);
|
|
1315
|
+
console.log(chalk11.yellow('\nPlease run "stint daemon start" manually.\n'));
|
|
1316
|
+
}
|
|
1317
|
+
}
|
|
1318
|
+
logger.success("update", `Updated to version ${cleanLatestVersion}`);
|
|
1319
|
+
} catch (error) {
|
|
1320
|
+
spinner.fail("Update failed");
|
|
1321
|
+
logger.error("update", "Update command failed", error);
|
|
1322
|
+
console.error(chalk11.red(`
|
|
1323
|
+
\u2716 Error: ${error.message}
|
|
1324
|
+
`));
|
|
1325
|
+
process.exit(1);
|
|
1326
|
+
}
|
|
1327
|
+
});
|
|
1328
|
+
}
|
|
1329
|
+
|
|
1269
1330
|
// src/index.ts
|
|
1270
|
-
var AGENT_VERSION = "1.0.
|
|
1331
|
+
var AGENT_VERSION = "1.0.6";
|
|
1271
1332
|
var program = new Command();
|
|
1272
|
-
program.name("stint").description("Stint Agent - Local daemon for Stint Project Assistant").version(AGENT_VERSION, "-V, --version", "output the current version").addHelpText("after", `
|
|
1273
|
-
${
|
|
1274
|
-
${
|
|
1275
|
-
${
|
|
1276
|
-
${
|
|
1277
|
-
${
|
|
1278
|
-
${
|
|
1279
|
-
${
|
|
1333
|
+
program.name("stint").description("Stint Agent - Local daemon for Stint Project Assistant").version(AGENT_VERSION, "-v, -V, --version", "output the current version").addHelpText("after", `
|
|
1334
|
+
${chalk12.bold("Examples:")}
|
|
1335
|
+
${chalk12.cyan("$")} stint login ${chalk12.gray("# Authenticate with Stint")}
|
|
1336
|
+
${chalk12.cyan("$")} stint install ${chalk12.gray("# Install agent to run on startup")}
|
|
1337
|
+
${chalk12.cyan("$")} stint link ${chalk12.gray("# Link current directory to a project")}
|
|
1338
|
+
${chalk12.cyan("$")} stint daemon start ${chalk12.gray("# Start background daemon")}
|
|
1339
|
+
${chalk12.cyan("$")} stint status ${chalk12.gray("# Check status")}
|
|
1340
|
+
${chalk12.cyan("$")} stint commits ${chalk12.gray("# List pending commits")}
|
|
1280
1341
|
|
|
1281
|
-
${
|
|
1282
|
-
For more information, visit: ${
|
|
1342
|
+
${chalk12.bold("Documentation:")}
|
|
1343
|
+
For more information, visit: ${chalk12.blue("https://stint.codes/docs")}
|
|
1283
1344
|
`);
|
|
1284
1345
|
registerLoginCommand(program);
|
|
1285
1346
|
registerLogoutCommand(program);
|
|
@@ -1292,14 +1353,15 @@ registerDaemonCommands(program);
|
|
|
1292
1353
|
registerCommitCommands(program);
|
|
1293
1354
|
registerInstallCommand(program);
|
|
1294
1355
|
registerUninstallCommand(program);
|
|
1356
|
+
registerUpdateCommand(program);
|
|
1295
1357
|
program.exitOverride();
|
|
1296
1358
|
try {
|
|
1297
1359
|
await program.parseAsync(process.argv);
|
|
1298
1360
|
} catch (error) {
|
|
1299
1361
|
const commanderError = error;
|
|
1300
|
-
if (commanderError.code !== "commander.help" && commanderError.code !== "commander.version") {
|
|
1362
|
+
if (commanderError.code !== "commander.help" && commanderError.code !== "commander.version" && commanderError.code !== "commander.helpDisplayed") {
|
|
1301
1363
|
logger.error("cli", "Command execution failed", error);
|
|
1302
|
-
console.error(
|
|
1364
|
+
console.error(chalk12.red(`
|
|
1303
1365
|
\u2716 Error: ${error.message}
|
|
1304
1366
|
`));
|
|
1305
1367
|
process.exit(1);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gowelle/stint-agent",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.6",
|
|
4
4
|
"description": "Local agent for Stint - Project Assistant",
|
|
5
5
|
"author": "Gowelle John <gowelle.john@icloud.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
"prepublishOnly": "npm run build"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@inquirer/prompts": "^
|
|
39
|
+
"@inquirer/prompts": "^8.1.0",
|
|
40
40
|
"chalk": "^5.3.0",
|
|
41
41
|
"commander": "^12.0.0",
|
|
42
42
|
"conf": "^12.0.0",
|
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
"eslint": "^8.56.0",
|
|
58
58
|
"tsup": "^8.0.1",
|
|
59
59
|
"typescript": "^5.3.3",
|
|
60
|
-
"vitest": "^
|
|
60
|
+
"vitest": "^4.0.16"
|
|
61
61
|
},
|
|
62
62
|
"engines": {
|
|
63
63
|
"node": ">=20.0.0"
|