@hasna/todos 0.10.15 → 0.10.16
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/cli/index.js +39 -0
- package/package.json +1 -1
package/dist/cli/index.js
CHANGED
|
@@ -17576,6 +17576,45 @@ Use ${chalk.cyan(`--agent ${result.id}`)} on future commands.`);
|
|
|
17576
17576
|
handleError(e);
|
|
17577
17577
|
}
|
|
17578
17578
|
});
|
|
17579
|
+
program2.command("heartbeat [agent]").description("Update last_seen_at to signal you're still active").action((agent) => {
|
|
17580
|
+
const globalOpts = program2.opts();
|
|
17581
|
+
const agentId = agent || globalOpts.agent;
|
|
17582
|
+
if (!agentId) {
|
|
17583
|
+
console.error(chalk.red("Agent ID required. Use --agent or pass as argument."));
|
|
17584
|
+
process.exit(1);
|
|
17585
|
+
}
|
|
17586
|
+
const { updateAgentActivity: updateAgentActivity2, getAgent: getAgent2 } = (init_agents(), __toCommonJS(exports_agents));
|
|
17587
|
+
const a = getAgent2(agentId) || (init_agents(), __toCommonJS(exports_agents)).getAgentByName(agentId);
|
|
17588
|
+
if (!a) {
|
|
17589
|
+
console.error(chalk.red(`Agent not found: ${agentId}`));
|
|
17590
|
+
process.exit(1);
|
|
17591
|
+
}
|
|
17592
|
+
updateAgentActivity2(a.id);
|
|
17593
|
+
if (globalOpts.json) {
|
|
17594
|
+
console.log(JSON.stringify({ agent_id: a.id, name: a.name, last_seen_at: new Date().toISOString() }));
|
|
17595
|
+
} else {
|
|
17596
|
+
console.log(chalk.green(`\u2665 ${a.name} (${a.id.slice(0, 8)}) \u2014 heartbeat sent`));
|
|
17597
|
+
}
|
|
17598
|
+
});
|
|
17599
|
+
program2.command("focus [project]").description("Focus on a project (or clear focus if no project given)").action((project) => {
|
|
17600
|
+
const globalOpts = program2.opts();
|
|
17601
|
+
const agentId = globalOpts.agent;
|
|
17602
|
+
if (!agentId) {
|
|
17603
|
+
console.error(chalk.red("Agent ID required. Use --agent."));
|
|
17604
|
+
process.exit(1);
|
|
17605
|
+
}
|
|
17606
|
+
const db = getDatabase();
|
|
17607
|
+
if (project) {
|
|
17608
|
+
const { getProjectByPath: getProjectByPath2, getProjectByName } = (init_projects(), __toCommonJS(exports_projects));
|
|
17609
|
+
const p = getProjectByPath2(process.cwd(), db) || getProjectByName(project, db);
|
|
17610
|
+
const projectId = p?.id || project;
|
|
17611
|
+
db.run("UPDATE agents SET active_project_id = ? WHERE id = ? OR name = ?", [projectId, agentId, agentId]);
|
|
17612
|
+
console.log(chalk.green(`Focused on: ${p?.name || projectId}`));
|
|
17613
|
+
} else {
|
|
17614
|
+
db.run("UPDATE agents SET active_project_id = NULL WHERE id = ? OR name = ?", [agentId, agentId]);
|
|
17615
|
+
console.log(chalk.dim("Focus cleared."));
|
|
17616
|
+
}
|
|
17617
|
+
});
|
|
17579
17618
|
program2.command("agents").description("List registered agents").action(() => {
|
|
17580
17619
|
const globalOpts = program2.opts();
|
|
17581
17620
|
try {
|