@gowelle/stint-agent 1.2.39 → 1.2.41

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
@@ -91,6 +91,19 @@ stint daemon status
91
91
  | `stint status [--dashboard]` | Show status (use `-d` for interactive dashboard) |
92
92
  | `stint sync` | Manually sync repository information to server |
93
93
 
94
+ ### Task Operations
95
+
96
+ | Command | Description |
97
+ | ------------- | ---------------------------------- |
98
+ | `stint tasks` | List tasks for the current project |
99
+
100
+ **`stint tasks` Options:**
101
+
102
+ | Option | Description |
103
+ | ----------------------- | ---------------------------------------------- |
104
+ | `-b, --branch <branch>` | Filter tasks by specific branch |
105
+ | `-a, --all` | Show all tasks (ignore current branch context) |
106
+
94
107
  ### Commit Operations
95
108
 
96
109
  | Command | Description |
@@ -2,10 +2,10 @@ import {
2
2
  gitService,
3
3
  projectService,
4
4
  validatePidFile
5
- } from "./chunk-LU6CQVSL.js";
5
+ } from "./chunk-YLZKGUKM.js";
6
6
  import {
7
7
  authService
8
- } from "./chunk-PWOHR6IZ.js";
8
+ } from "./chunk-IJAVMAOZ.js";
9
9
 
10
10
  // src/components/StatusDashboard.tsx
11
11
  import { useState, useEffect } from "react";
@@ -0,0 +1,7 @@
1
+ import {
2
+ apiService
3
+ } from "./chunk-H4PLSM7I.js";
4
+ import "./chunk-IJAVMAOZ.js";
5
+ export {
6
+ apiService
7
+ };
@@ -2,7 +2,7 @@ import {
2
2
  authService,
3
3
  config,
4
4
  logger
5
- } from "./chunk-PWOHR6IZ.js";
5
+ } from "./chunk-IJAVMAOZ.js";
6
6
 
7
7
  // src/utils/circuit-breaker.ts
8
8
  var CircuitBreaker = class {
@@ -100,7 +100,7 @@ var CircuitBreaker = class {
100
100
  };
101
101
 
102
102
  // src/services/api.ts
103
- var AGENT_VERSION = "1.2.39";
103
+ var AGENT_VERSION = "1.2.41";
104
104
  var ApiServiceImpl = class {
105
105
  sessionId = null;
106
106
  circuitBreaker = new CircuitBreaker({
@@ -254,9 +254,8 @@ var ApiServiceImpl = class {
254
254
  }
255
255
  /**
256
256
  * Send heartbeat to keep session alive
257
- * @throws Error if no active session
258
257
  */
259
- async heartbeat() {
258
+ async heartbeat(stats) {
260
259
  if (!this.sessionId) {
261
260
  throw new Error("No active session");
262
261
  }
@@ -264,7 +263,8 @@ var ApiServiceImpl = class {
264
263
  const response = await this.request("/api/agent/heartbeat", {
265
264
  method: "POST",
266
265
  body: JSON.stringify({
267
- session_id: this.sessionId
266
+ session_id: this.sessionId,
267
+ ...stats
268
268
  })
269
269
  });
270
270
  if (response.notification_preferences) {
@@ -501,6 +501,24 @@ var ApiServiceImpl = class {
501
501
  );
502
502
  }
503
503
  }
504
+ /**
505
+ * Get tasks for a project, optionally filtered by branch
506
+ * @param projectId - Project ID
507
+ * @param branch - Optional branch name to filter by
508
+ * @returns Array of tasks
509
+ */
510
+ async getProjectTasks(projectId, branch) {
511
+ logger.info("api", `Fetching tasks for project ${projectId}`);
512
+ const queryParams = new URLSearchParams();
513
+ if (branch) {
514
+ queryParams.append("branch", branch);
515
+ }
516
+ const queryString = queryParams.toString() ? `?${queryParams.toString()}` : "";
517
+ const response = await this.request(`/api/agent/projects/${projectId}/tasks${queryString}`);
518
+ const tasks = response.data;
519
+ logger.info("api", `Found ${tasks.length} tasks`);
520
+ return tasks;
521
+ }
504
522
  };
505
523
  var apiService = new ApiServiceImpl();
506
524
 
@@ -346,7 +346,7 @@ var AuthServiceImpl = class {
346
346
  return null;
347
347
  }
348
348
  try {
349
- const { apiService } = await import("./api-JGCDZSG6.js");
349
+ const { apiService } = await import("./api-QDJ4MDEI.js");
350
350
  const user = await apiService.getCurrentUser();
351
351
  logger.info("auth", `Token validated for user: ${user.email}`);
352
352
  return user;
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  apiService
3
- } from "./chunk-4WAUHGFS.js";
3
+ } from "./chunk-H4PLSM7I.js";
4
4
  import {
5
5
  gitService,
6
6
  projectService
7
- } from "./chunk-LU6CQVSL.js";
7
+ } from "./chunk-YLZKGUKM.js";
8
8
  import {
9
9
  authService,
10
10
  config,
11
11
  logger
12
- } from "./chunk-PWOHR6IZ.js";
12
+ } from "./chunk-IJAVMAOZ.js";
13
13
 
14
14
  // src/utils/notify.ts
15
15
  import notifier from "node-notifier";
@@ -911,7 +911,7 @@ var WebSocketServiceImpl = class {
911
911
  "websocket",
912
912
  `Commit ${commit.id} marked as large, fetching full details...`
913
913
  );
914
- const { apiService: apiService2 } = await import("./api-JGCDZSG6.js");
914
+ const { apiService: apiService2 } = await import("./api-QDJ4MDEI.js");
915
915
  const fullCommit = await apiService2.getCommit(commit.id);
916
916
  commit = {
917
917
  ...commit,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  config,
3
3
  logger
4
- } from "./chunk-PWOHR6IZ.js";
4
+ } from "./chunk-IJAVMAOZ.js";
5
5
 
6
6
  // src/services/git.ts
7
7
  import simpleGit from "simple-git";
@@ -3,20 +3,20 @@ import {
3
3
  commitQueue,
4
4
  notify,
5
5
  websocketService
6
- } from "../chunk-IFPIIRU3.js";
6
+ } from "../chunk-NTG3X2HK.js";
7
7
  import {
8
8
  apiService
9
- } from "../chunk-4WAUHGFS.js";
9
+ } from "../chunk-H4PLSM7I.js";
10
10
  import {
11
11
  gitService,
12
12
  projectService,
13
13
  removePidFile,
14
14
  writePidFile
15
- } from "../chunk-LU6CQVSL.js";
15
+ } from "../chunk-YLZKGUKM.js";
16
16
  import {
17
17
  authService,
18
18
  logger
19
- } from "../chunk-PWOHR6IZ.js";
19
+ } from "../chunk-IJAVMAOZ.js";
20
20
 
21
21
  // src/daemon/runner.ts
22
22
  import "dotenv/config";
@@ -288,6 +288,12 @@ var FileWatcher = class {
288
288
  }
289
289
  }
290
290
  }
291
+ /**
292
+ * Get the number of watched projects
293
+ */
294
+ getWatchedCount() {
295
+ return this.watchers.size;
296
+ }
291
297
  };
292
298
 
293
299
  // src/daemon/sync.ts
@@ -638,7 +644,20 @@ function startHeartbeat() {
638
644
  heartbeatInterval = setInterval(async () => {
639
645
  if (isShuttingDown) return;
640
646
  try {
641
- await apiService.heartbeat();
647
+ const memoryUsage = process.memoryUsage();
648
+ await apiService.heartbeat({
649
+ websocket_connected: websocketService.isConnected(),
650
+ queue_size: commitQueue.getQueueLength(),
651
+ watched_projects_count: fileWatcher.getWatchedCount ? fileWatcher.getWatchedCount() : 0,
652
+ memory_usage: {
653
+ rss: Math.round(memoryUsage.rss / 1024 / 1024),
654
+ // MB
655
+ heapTotal: Math.round(memoryUsage.heapTotal / 1024 / 1024),
656
+ heapUsed: Math.round(memoryUsage.heapUsed / 1024 / 1024),
657
+ external: Math.round(memoryUsage.external / 1024 / 1024)
658
+ },
659
+ uptime: Math.floor(process.uptime())
660
+ });
642
661
  healthMonitor.recordHeartbeat();
643
662
  logger.debug("daemon", "Heartbeat sent successfully");
644
663
  } catch (error) {
package/dist/index.js CHANGED
@@ -2,10 +2,10 @@
2
2
  import {
3
3
  commitQueue,
4
4
  websocketService
5
- } from "./chunk-IFPIIRU3.js";
5
+ } from "./chunk-NTG3X2HK.js";
6
6
  import {
7
7
  apiService
8
- } from "./chunk-4WAUHGFS.js";
8
+ } from "./chunk-H4PLSM7I.js";
9
9
  import {
10
10
  getPidFilePath,
11
11
  gitService,
@@ -14,14 +14,14 @@ import {
14
14
  projectService,
15
15
  spawnDetached,
16
16
  validatePidFile
17
- } from "./chunk-LU6CQVSL.js";
17
+ } from "./chunk-YLZKGUKM.js";
18
18
  import {
19
19
  __commonJS,
20
20
  __toESM,
21
21
  authService,
22
22
  config,
23
23
  logger
24
- } from "./chunk-PWOHR6IZ.js";
24
+ } from "./chunk-IJAVMAOZ.js";
25
25
 
26
26
  // node_modules/semver/internal/constants.js
27
27
  var require_constants = __commonJS({
@@ -1955,8 +1955,8 @@ var require_semver2 = __commonJS({
1955
1955
 
1956
1956
  // src/index.ts
1957
1957
  import "dotenv/config";
1958
- import { Command } from "commander";
1959
- import chalk15 from "chalk";
1958
+ import { Command as Command2 } from "commander";
1959
+ import chalk16 from "chalk";
1960
1960
 
1961
1961
  // src/commands/login.ts
1962
1962
  import open from "open";
@@ -2657,7 +2657,7 @@ function registerStatusCommand(program2) {
2657
2657
  try {
2658
2658
  const { render } = await import("ink");
2659
2659
  const { createElement } = await import("react");
2660
- const { StatusDashboard } = await import("./StatusDashboard-ROFBT73W.js");
2660
+ const { StatusDashboard } = await import("./StatusDashboard-VKR5SXS4.js");
2661
2661
  render(createElement(StatusDashboard, { cwd }));
2662
2662
  return;
2663
2663
  } catch (error) {
@@ -4845,22 +4845,104 @@ ${chalk14.bold("Config file:")} ${chalk14.cyan(configPath)}
4845
4845
  });
4846
4846
  }
4847
4847
 
4848
+ // src/commands/tasks.ts
4849
+ import { Command } from "commander";
4850
+ import chalk15 from "chalk";
4851
+ import ora14 from "ora";
4852
+ var tasksCommand = new Command("tasks").description("List tasks for the current project").option("-b, --branch <branch>", "Filter tasks by specific branch").option("-a, --all", "Show all tasks (ignore current branch context)").action(async (options) => {
4853
+ try {
4854
+ const spinner = ora14("Checking project context...").start();
4855
+ const cwd = process.cwd();
4856
+ const isRepo = await gitService.isRepo(cwd);
4857
+ if (!isRepo) {
4858
+ spinner.fail("Not a git repository");
4859
+ console.log(
4860
+ chalk15.yellow("Please run this command from within a git repository.")
4861
+ );
4862
+ return;
4863
+ }
4864
+ const linkedProject = await projectService.getLinkedProject(cwd);
4865
+ if (!linkedProject) {
4866
+ spinner.fail("Project not linked");
4867
+ console.log(
4868
+ chalk15.yellow(
4869
+ "This repository is not linked to a Stint project.\nRun 'stint link' to link it first."
4870
+ )
4871
+ );
4872
+ return;
4873
+ }
4874
+ let filterBranch;
4875
+ if (options.all) {
4876
+ filterBranch = void 0;
4877
+ } else if (options.branch) {
4878
+ filterBranch = options.branch;
4879
+ } else {
4880
+ try {
4881
+ filterBranch = await gitService.getCurrentBranch(cwd);
4882
+ } catch (_error) {
4883
+ spinner.warn("Could not detect current branch, showing all tasks");
4884
+ }
4885
+ }
4886
+ spinner.text = "Fetching tasks...";
4887
+ const tasks = await apiService.getProjectTasks(
4888
+ linkedProject.projectId,
4889
+ filterBranch
4890
+ );
4891
+ spinner.stop();
4892
+ if (tasks.length === 0) {
4893
+ console.log(chalk15.gray("No tasks found."));
4894
+ if (filterBranch) {
4895
+ console.log(chalk15.gray(`(Filtered by branch: ${filterBranch})`));
4896
+ }
4897
+ return;
4898
+ }
4899
+ console.log(
4900
+ chalk15.bold(
4901
+ `
4902
+ Tasks for project ${chalk15.cyan(linkedProject.projectId)}`
4903
+ )
4904
+ );
4905
+ if (filterBranch) {
4906
+ console.log(chalk15.gray(`Branch: ${filterBranch}`));
4907
+ }
4908
+ console.log("");
4909
+ tasks.forEach((task) => {
4910
+ const priorityColor = task.priority === "urgent" ? chalk15.red : task.priority === "high" ? chalk15.yellow : task.priority === "medium" ? chalk15.blue : chalk15.gray;
4911
+ const statusIcon = task.status === "done" ? "\u2705" : task.status === "in_progress" ? "\u{1F6A7}" : task.status === "todo" ? "\u{1F4C5}" : "\u{1F4C2}";
4912
+ console.log(
4913
+ `${statusIcon} ${chalk15.white.bold(task.title)} ${priorityColor(
4914
+ `[${task.priority}]`
4915
+ )} ${chalk15.gray(`(${task.identifier})`)}`
4916
+ );
4917
+ if (task.description) {
4918
+ const desc = task.description.split("\n")[0].substring(0, 80) + (task.description.length > 80 ? "..." : "");
4919
+ console.log(` ${chalk15.gray(desc)}`);
4920
+ }
4921
+ console.log("");
4922
+ });
4923
+ } catch (error) {
4924
+ ora14().stop();
4925
+ logger.error("cli", "Failed to fetch tasks", error);
4926
+ process.exit(1);
4927
+ }
4928
+ });
4929
+
4848
4930
  // src/index.ts
4849
- var AGENT_VERSION = "1.2.39";
4850
- var program = new Command();
4931
+ var AGENT_VERSION = "1.2.41";
4932
+ var program = new Command2();
4851
4933
  program.name("stint").description("Stint Agent - Local daemon for Stint Project Assistant").version(AGENT_VERSION, "-v, --version", "output the current version").addHelpText(
4852
4934
  "after",
4853
4935
  `
4854
- ${chalk15.bold("Examples:")}
4855
- ${chalk15.cyan("$")} stint login ${chalk15.gray("# Authenticate with Stint")}
4856
- ${chalk15.cyan("$")} stint install ${chalk15.gray("# Install agent to run on startup")}
4857
- ${chalk15.cyan("$")} stint link ${chalk15.gray("# Link current directory to a project")}
4858
- ${chalk15.cyan("$")} stint daemon start ${chalk15.gray("# Start background daemon")}
4859
- ${chalk15.cyan("$")} stint status ${chalk15.gray("# Check status")}
4860
- ${chalk15.cyan("$")} stint commits ${chalk15.gray("# List pending commits")}
4936
+ ${chalk16.bold("Examples:")}
4937
+ ${chalk16.cyan("$")} stint login ${chalk16.gray("# Authenticate with Stint")}
4938
+ ${chalk16.cyan("$")} stint install ${chalk16.gray("# Install agent to run on startup")}
4939
+ ${chalk16.cyan("$")} stint link ${chalk16.gray("# Link current directory to a project")}
4940
+ ${chalk16.cyan("$")} stint daemon start ${chalk16.gray("# Start background daemon")}
4941
+ ${chalk16.cyan("$")} stint status ${chalk16.gray("# Check status")}
4942
+ ${chalk16.cyan("$")} stint commits ${chalk16.gray("# List pending commits")}
4861
4943
 
4862
- ${chalk15.bold("Documentation:")}
4863
- For more information, visit: ${chalk15.blue("https://stint.codes/docs")}
4944
+ ${chalk16.bold("Documentation:")}
4945
+ For more information, visit: ${chalk16.blue("https://stint.codes/docs")}
4864
4946
  `
4865
4947
  );
4866
4948
  registerLoginCommand(program);
@@ -4877,6 +4959,7 @@ registerUninstallCommand(program);
4877
4959
  registerUpdateCommand(program);
4878
4960
  registerDoctorCommand(program);
4879
4961
  registerConfigCommand(program);
4962
+ program.addCommand(tasksCommand);
4880
4963
  program.exitOverride();
4881
4964
  try {
4882
4965
  await program.parseAsync(process.argv);
@@ -4884,7 +4967,7 @@ try {
4884
4967
  const commanderError = error;
4885
4968
  if (commanderError.code !== "commander.help" && commanderError.code !== "commander.version" && commanderError.code !== "commander.helpDisplayed") {
4886
4969
  logger.error("cli", "Command execution failed", error);
4887
- console.error(chalk15.red(`
4970
+ console.error(chalk16.red(`
4888
4971
  \u2716 Error: ${error.message}
4889
4972
  `));
4890
4973
  process.exit(1);
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@gowelle/stint-agent",
3
- "version": "1.2.39",
3
+ "version": "1.2.41",
4
4
  "description": "Local agent for Stint - Project Assistant",
5
5
  "author": "Gowelle John <gowelle.john@icloud.com>",
6
6
  "license": "MIT",
7
7
  "type": "module",
8
8
  "bin": {
9
- "stint": "./dist/index.js"
9
+ "stint": "dist/index.js"
10
10
  },
11
11
  "files": [
12
12
  "dist",
@@ -1,7 +0,0 @@
1
- import {
2
- apiService
3
- } from "./chunk-4WAUHGFS.js";
4
- import "./chunk-PWOHR6IZ.js";
5
- export {
6
- apiService
7
- };