@matthugh1/conductor-cli 0.2.2 → 0.2.3

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.
@@ -71,7 +71,7 @@ function createDaemonClient(baseUrl = "https://conductor-297703646986.europe-wes
71
71
  if (cliConfigLoaded) return;
72
72
  cliConfigLoaded = true;
73
73
  try {
74
- const { readApiKey, readProjectId } = await import("./cli-config-2ZDXUUQN.js");
74
+ const { readApiKey, readProjectId } = await import("./cli-config-LEERSU5N.js");
75
75
  if (!resolvedKey) resolvedKey = readApiKey();
76
76
  if (!defaultProjectId) defaultProjectId = readProjectId();
77
77
  } catch {
@@ -264,6 +264,129 @@ function createDaemonClient(baseUrl = "https://conductor-297703646986.europe-wes
264
264
  "routePendingTasks"
265
265
  );
266
266
  },
267
+ // ── CLI operation methods ─────────────────────────────────────────
268
+ async resolveProjectByPath(path) {
269
+ const res = await get("/api/projects/resolve", { path });
270
+ if (res.status === 404) return null;
271
+ return jsonBody(
272
+ res,
273
+ "resolveProjectByPath"
274
+ );
275
+ },
276
+ async saveHealthSnapshot(projectId, report) {
277
+ const res = await post("/api/environment/health", {
278
+ projectId,
279
+ report
280
+ });
281
+ await assertOk(res, "saveHealthSnapshot");
282
+ },
283
+ async saveGitStatusSnapshot(projectId, snapshot) {
284
+ const res = await post("/api/environment/health/git-snapshot", {
285
+ projectId,
286
+ snapshot
287
+ });
288
+ await assertOk(res, "saveGitStatusSnapshot");
289
+ },
290
+ async saveBranchOverviewSnapshot(projectId, overview) {
291
+ const res = await post("/api/environment/health/branch-overview", {
292
+ projectId,
293
+ overview
294
+ });
295
+ await assertOk(res, "saveBranchOverviewSnapshot");
296
+ },
297
+ async claimNextCliTask(projectId) {
298
+ const res = await post("/api/cli-tasks/claim", { projectId });
299
+ const { task } = await jsonBody(
300
+ res,
301
+ "claimNextCliTask"
302
+ );
303
+ return task;
304
+ },
305
+ async completeCliTask(taskId, result) {
306
+ const body = { status: "done" };
307
+ if (result !== void 0) body.result = result;
308
+ const res = await patch(`/api/cli-tasks/${taskId}`, body);
309
+ await assertOk(res, "completeCliTask");
310
+ },
311
+ async failCliTask(taskId, error) {
312
+ const body = { status: "failed" };
313
+ if (error !== void 0) body.error = error;
314
+ const res = await patch(`/api/cli-tasks/${taskId}`, body);
315
+ await assertOk(res, "failCliTask");
316
+ },
317
+ async failStaleCliTasks(projectId) {
318
+ const res = await post("/api/cli-tasks/fail-stale", { projectId });
319
+ const { count } = await jsonBody(
320
+ res,
321
+ "failStaleCliTasks"
322
+ );
323
+ return count;
324
+ },
325
+ async getWorktreeForInitiative(projectId, initiativeId) {
326
+ const res = await get("/api/git/worktrees", {
327
+ projectId,
328
+ initiativeId,
329
+ status: "active"
330
+ });
331
+ const { worktrees } = await jsonBody(res, "getWorktreeForInitiative");
332
+ return worktrees.length > 0 ? worktrees[0] : null;
333
+ },
334
+ async createWorktreeViaApi(projectId, initiativeId, initiativeTitle) {
335
+ const res = await post("/api/git/worktrees", {
336
+ projectId,
337
+ action: "create",
338
+ initiativeId,
339
+ initiativeTitle
340
+ });
341
+ const { worktree } = await jsonBody(res, "createWorktreeViaApi");
342
+ return worktree;
343
+ },
344
+ async registerWorktree(opts) {
345
+ const res = await post("/api/git/worktrees/register", {
346
+ projectId: opts.projectId,
347
+ initiativeId: opts.initiativeId,
348
+ branchName: opts.branchName,
349
+ worktreePath: opts.worktreePath
350
+ });
351
+ return jsonBody(res, "registerWorktree");
352
+ },
353
+ async scanWorktreesViaApi(projectId) {
354
+ const res = await post("/api/git/worktrees", {
355
+ projectId,
356
+ action: "scan"
357
+ });
358
+ return jsonBody(
359
+ res,
360
+ "scanWorktreesViaApi"
361
+ );
362
+ },
363
+ async listActiveWorktrees(projectId) {
364
+ const res = await get("/api/git/worktrees", {
365
+ projectId,
366
+ status: "active"
367
+ });
368
+ const { worktrees } = await jsonBody(res, "listActiveWorktrees");
369
+ return worktrees;
370
+ },
371
+ async removeWorktreeViaApi(projectId, worktreeId) {
372
+ const res = await post("/api/git/worktrees", {
373
+ projectId,
374
+ action: "remove",
375
+ worktreeId
376
+ });
377
+ await assertOk(res, "removeWorktreeViaApi");
378
+ },
379
+ async logGitActivityViaApi(opts) {
380
+ const res = await post("/api/git/activity/hook", {
381
+ hookName: "cli",
382
+ eventType: opts.eventType,
383
+ branch: opts.branch,
384
+ projectRoot: opts.projectRoot,
385
+ summary: opts.summary,
386
+ detail: opts.detail ?? {}
387
+ });
388
+ await assertOk(res, "logGitActivityViaApi");
389
+ },
267
390
  // ── Agent backlog methods ───────────────────────────────────────
268
391
  async listEnabledAgents(projectId) {
269
392
  const res = await get("/api/daemon/agents", {
@@ -1,8 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runGit
4
- } from "./chunk-FAZ7FCZQ.js";
5
- import "./chunk-4YEHSYVN.js";
4
+ } from "./chunk-N2KKNG4C.js";
6
5
 
7
6
  // ../../src/core/git-hooks.ts
8
7
  import { chmod, mkdir, readFile, writeFile } from "fs/promises";
@@ -11,8 +11,7 @@ import {
11
11
  getRecentCommits,
12
12
  getStatusSummary,
13
13
  runGit
14
- } from "./chunk-FAZ7FCZQ.js";
15
- import "./chunk-4YEHSYVN.js";
14
+ } from "./chunk-N2KKNG4C.js";
16
15
  export {
17
16
  classifyGitCommand,
18
17
  createSafetySnapshot,
package/package.json CHANGED
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "@matthugh1/conductor-cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Conductor CLI — session management, health checks, and autonomous runner for the Conductor pipeline",
5
5
  "type": "module",
6
6
  "bin": {
7
- "conductor": "dist/agent.js"
7
+ "conductor": "./dist/agent.js"
8
8
  },
9
9
  "files": [
10
10
  "dist"
@@ -1,18 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- assertCanQueueMerge,
4
- getBranchOverview,
5
- getConflictBranchesForWorkQueue,
6
- getMergeStats,
7
- isBranchFullyOnMain
8
- } from "./chunk-7S5HKGS5.js";
9
- import "./chunk-FAZ7FCZQ.js";
10
- import "./chunk-PANC6BTV.js";
11
- import "./chunk-4YEHSYVN.js";
12
- export {
13
- assertCanQueueMerge,
14
- getBranchOverview,
15
- getConflictBranchesForWorkQueue,
16
- getMergeStats,
17
- isBranchFullyOnMain
18
- };
@@ -1,75 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- query
4
- } from "./chunk-PANC6BTV.js";
5
-
6
- // ../../src/core/notifications.ts
7
- var VALID_EVENT_TYPES = /* @__PURE__ */ new Set([
8
- "gate_rejection",
9
- "gate_bypassed",
10
- "review_needed",
11
- "handoff_needed",
12
- "decision_pending",
13
- "stale_session",
14
- "abandoned_session",
15
- "missing_checkin",
16
- "orphan_work",
17
- "stage_transition",
18
- "watchdog_flag",
19
- "stale_worktree",
20
- "autonomous_flag_changed"
21
- ]);
22
- var VALID_PRIORITIES = /* @__PURE__ */ new Set([
23
- "info",
24
- "warning",
25
- "action_needed"
26
- ]);
27
- var VALID_LINK_TYPES = /* @__PURE__ */ new Set([
28
- "deliverable",
29
- "decision",
30
- "initiative",
31
- "session"
32
- ]);
33
- async function createNotification(params) {
34
- if (!params.projectId || params.projectId.trim().length === 0) {
35
- throw new Error("A project id is required to create a notification.");
36
- }
37
- if (!VALID_EVENT_TYPES.has(params.eventType)) {
38
- throw new Error(
39
- `Unknown event type "${params.eventType}". Expected one of: ${[...VALID_EVENT_TYPES].join(", ")}.`
40
- );
41
- }
42
- if (!params.message || params.message.trim().length === 0) {
43
- throw new Error("A notification needs a message.");
44
- }
45
- if (!VALID_PRIORITIES.has(params.priority)) {
46
- throw new Error(
47
- `Unknown priority "${params.priority}". Expected info, warning, or action_needed.`
48
- );
49
- }
50
- if (params.linkType !== void 0 && !VALID_LINK_TYPES.has(params.linkType)) {
51
- throw new Error(
52
- `Unknown link type "${params.linkType}". Expected deliverable, decision, initiative, or session.`
53
- );
54
- }
55
- const rows = await query(
56
- `INSERT INTO notifications (project_id, event_type, message, priority, link_type, link_id, agent_type, agent_name)
57
- VALUES ($1, $2, $3, $4, $5, $6, $7, $8)
58
- RETURNING id`,
59
- [
60
- params.projectId,
61
- params.eventType,
62
- params.message.trim(),
63
- params.priority,
64
- params.linkType ?? null,
65
- params.linkId ?? null,
66
- params.agentType ?? null,
67
- params.agentName ?? null
68
- ]
69
- );
70
- return rows[0].id;
71
- }
72
-
73
- export {
74
- createNotification
75
- };
@@ -1,17 +0,0 @@
1
- #!/usr/bin/env node
2
-
3
- // ../../src/core/errors.ts
4
- var ConductorError = class extends Error {
5
- code;
6
- retryable;
7
- constructor(code, message, retryable = false) {
8
- super(message);
9
- this.name = "ConductorError";
10
- this.code = code;
11
- this.retryable = retryable;
12
- }
13
- };
14
-
15
- export {
16
- ConductorError
17
- };
@@ -1,22 +0,0 @@
1
- #!/usr/bin/env node
2
- import {
3
- query
4
- } from "./chunk-PANC6BTV.js";
5
-
6
- // ../../src/core/projects.ts
7
- import path from "path";
8
- async function getProjectPathById(projectId) {
9
- const rows = await query(
10
- `SELECT path FROM projects WHERE id = $1 LIMIT 1`,
11
- [projectId]
12
- );
13
- if (rows.length === 0) {
14
- return null;
15
- }
16
- const p = rows[0].path;
17
- return p !== null && p.trim().length > 0 ? p : null;
18
- }
19
-
20
- export {
21
- getProjectPathById
22
- };