agentplane 0.1.0 → 0.1.2
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/prompts.js +1 -1
- package/dist/cli/recipes-bundled.js +3 -3
- package/dist/comment-format.d.ts +1 -1
- package/dist/comment-format.d.ts.map +1 -1
- package/dist/run-cli.d.ts.map +1 -1
- package/dist/run-cli.js +1153 -366
- package/dist/run-cli.test-helpers.d.ts +1 -1
- package/dist/run-cli.test-helpers.d.ts.map +1 -1
- package/dist/run-cli.test-helpers.js +1 -1
- package/dist/task-backend.d.ts +1 -1
- package/dist/task-backend.d.ts.map +1 -1
- package/dist/task-backend.js +38 -23
- package/dist/version.js +1 -1
- package/package.json +3 -3
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run-cli.test-helpers.d.ts","sourceRoot":"","sources":["../src/run-cli.test-helpers.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"run-cli.test-helpers.d.ts","sourceRoot":"","sources":["../src/run-cli.test-helpers.ts"],"names":[],"mappings":"AAQA,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAiCpD,wBAAgB,sBAAsB,IAAI,IAAI,CAgB7C;AAED,wBAAgB,iBAAiB,IAAI,MAAM,GAAG,IAAI,CAEjD;AAED,wBAAgB,YAAY;;;;EAgC3B;AAED,wBAAsB,aAAa,IAAI,OAAO,CAAC,MAAM,CAAC,CAKrD;AAED,wBAAsB,SAAS,IAAI,OAAO,CAAC,MAAM,CAAC,CAEjD;AAED,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAKpE;AAED,wBAAsB,WAAW,CAC/B,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,GACvC,OAAO,CAAC,IAAI,CAAC,CAKf;AAED,wBAAsB,0BA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UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOnE;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAYpF;AAED,wBAAsB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAG5E;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAIzE"}
|
|
@@ -5,7 +5,7 @@ import os from "node:os";
|
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { promisify } from "node:util";
|
|
7
7
|
import { afterAll, beforeAll } from "vitest";
|
|
8
|
-
import { defaultConfig } from "@
|
|
8
|
+
import { defaultConfig } from "@agentplaneorg/core";
|
|
9
9
|
const execFileAsync = promisify(execFile);
|
|
10
10
|
let agentplaneHome = null;
|
|
11
11
|
const originalAgentplaneHome = process.env.AGENTPLANE_HOME;
|
package/dist/task-backend.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AgentplaneConfig, type ResolvedProject, type TaskRecord } from "@
|
|
1
|
+
import { type AgentplaneConfig, type ResolvedProject, type TaskRecord } from "@agentplaneorg/core";
|
|
2
2
|
export declare function extractTaskDoc(body: string): string;
|
|
3
3
|
export declare function mergeTaskDoc(body: string, doc: string): string;
|
|
4
4
|
export type TaskData = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-backend.d.ts","sourceRoot":"","sources":["../src/task-backend.ts"],"names":[],"mappings":"AAIA,OAAO,EAOL,KAAK,gBAAgB,EACrB,KAAK,eAAe,EACpB,KAAK,UAAU,EAChB,MAAM,
|
|
1
|
+
{"version":3,"file":"task-backend.d.ts","sourceRoot":"","sources":["../src/task-backend.ts"],"names":[],"mappings":"AAIA,OAAO,EAOL,KAAK,gBAAgB,EACr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CAAC,iBAAiB;IAazB,OAAO,CAAC,eAAe;IAWvB,OAAO,CAAC,iBAAiB;YAMX,kBAAkB;IA6BhC,OAAO,CAAC,mBAAmB;IAW3B,OAAO,CAAC,kBAAkB;IAM1B,OAAO,CAAC,gBAAgB;IAYxB,OAAO,CAAC,cAAc;IActB,OAAO,CAAC,gBAAgB;YAQV,WAAW;CA4D1B;AA+CD,wBAAsB,eAAe,CAAC,IAAI,EAAE;IAC1C,GAAG,EAAE,MAAM,CAAC;IACZ,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC9B,GAAG,OAAO,CAAC;IACV,OAAO,EAAE,WAAW,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,eAAe,CAAC;IAC1B,MAAM,EAAE,gBAAgB,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC,CAuBD"}
|
package/dist/task-backend.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createHash, randomInt } from "node:crypto";
|
|
2
2
|
import { mkdir, readdir, readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import path from "node:path";
|
|
4
|
-
import { canonicalizeJson, loadConfig, parseTaskReadme, renderTaskReadme, resolveProject, taskReadmePath, } from "@
|
|
4
|
+
import { canonicalizeJson, loadConfig, parseTaskReadme, renderTaskReadme, resolveProject, taskReadmePath, } from "@agentplaneorg/core";
|
|
5
5
|
import { loadDotEnv } from "./env.js";
|
|
6
6
|
const ID_ALPHABET = "0123456789ABCDEFGHJKMNPQRSTVWXYZ";
|
|
7
7
|
const TASK_ID_RE = new RegExp(String.raw `^\d{12}-[${ID_ALPHABET}]{4,}$`);
|
|
@@ -106,7 +106,22 @@ export function mergeTaskDoc(body, doc) {
|
|
|
106
106
|
function validateTaskId(taskId) {
|
|
107
107
|
if (TASK_ID_RE.test(taskId))
|
|
108
108
|
return;
|
|
109
|
-
throw new Error(`Invalid task id: ${taskId}`);
|
|
109
|
+
throw new Error(`Invalid task id: ${taskId} (expected YYYYMMDDHHMM-XXXX)`);
|
|
110
|
+
}
|
|
111
|
+
function missingTaskIdMessage() {
|
|
112
|
+
return "Missing task id (expected non-empty value)";
|
|
113
|
+
}
|
|
114
|
+
function unknownTaskIdMessage(taskId) {
|
|
115
|
+
return `Unknown task id: ${taskId}`;
|
|
116
|
+
}
|
|
117
|
+
function invalidLengthMessage(value, min) {
|
|
118
|
+
return `Invalid length: ${value} (expected >= ${min})`;
|
|
119
|
+
}
|
|
120
|
+
function redmineConfigMissingMessage(detail) {
|
|
121
|
+
return `Missing required Redmine config: ${detail}`;
|
|
122
|
+
}
|
|
123
|
+
function redmineIssueIdMissingMessage() {
|
|
124
|
+
return "Missing Redmine issue id for task";
|
|
110
125
|
}
|
|
111
126
|
export class BackendError extends Error {
|
|
112
127
|
code;
|
|
@@ -232,7 +247,7 @@ export class LocalBackend {
|
|
|
232
247
|
async generateTaskId(opts) {
|
|
233
248
|
const length = opts.length;
|
|
234
249
|
if (length < 4)
|
|
235
|
-
throw new Error(
|
|
250
|
+
throw new Error(invalidLengthMessage(length, 4));
|
|
236
251
|
const attempts = Math.max(1, opts.attempts);
|
|
237
252
|
for (let i = 0; i < attempts; i++) {
|
|
238
253
|
const now = new Date();
|
|
@@ -258,7 +273,7 @@ export class LocalBackend {
|
|
|
258
273
|
throw err;
|
|
259
274
|
}
|
|
260
275
|
}
|
|
261
|
-
throw new Error("Failed to generate a unique task id");
|
|
276
|
+
throw new Error("Failed to generate a unique task id (exhausted attempts)");
|
|
262
277
|
}
|
|
263
278
|
async listTasks() {
|
|
264
279
|
const tasks = [];
|
|
@@ -333,7 +348,7 @@ export class LocalBackend {
|
|
|
333
348
|
async writeTask(task) {
|
|
334
349
|
const taskId = task.id.trim();
|
|
335
350
|
if (!taskId)
|
|
336
|
-
throw new Error(
|
|
351
|
+
throw new Error(missingTaskIdMessage());
|
|
337
352
|
validateTaskId(taskId);
|
|
338
353
|
const readme = taskReadmePath(this.root, taskId);
|
|
339
354
|
let body = "";
|
|
@@ -454,10 +469,10 @@ export class RedmineBackend {
|
|
|
454
469
|
this.ownerAgent = firstNonEmptyString(envOwner, settings.owner_agent, "REDMINE");
|
|
455
470
|
this.cache = opts.cache ?? null;
|
|
456
471
|
if (!this.baseUrl || !this.apiKey || !this.projectId) {
|
|
457
|
-
throw new BackendError("
|
|
472
|
+
throw new BackendError(redmineConfigMissingMessage("url, api_key, project_id"), "E_BACKEND");
|
|
458
473
|
}
|
|
459
474
|
if (!this.customFields?.task_id) {
|
|
460
|
-
throw new BackendError("
|
|
475
|
+
throw new BackendError(redmineConfigMissingMessage("custom_fields.task_id"), "E_BACKEND");
|
|
461
476
|
}
|
|
462
477
|
for (const [key, value] of Object.entries(this.statusMap)) {
|
|
463
478
|
if (typeof value === "number")
|
|
@@ -526,20 +541,20 @@ export class RedmineBackend {
|
|
|
526
541
|
async getTaskDoc(taskId) {
|
|
527
542
|
const task = await this.getTask(taskId);
|
|
528
543
|
if (!task)
|
|
529
|
-
throw new Error(
|
|
544
|
+
throw new Error(unknownTaskIdMessage(taskId));
|
|
530
545
|
return toStringSafe(task.doc);
|
|
531
546
|
}
|
|
532
547
|
async setTaskDoc(taskId, doc, updatedBy) {
|
|
533
548
|
if (!this.customFields.doc) {
|
|
534
|
-
throw new BackendError("
|
|
549
|
+
throw new BackendError(redmineConfigMissingMessage("custom_fields.doc"), "E_BACKEND");
|
|
535
550
|
}
|
|
536
551
|
try {
|
|
537
552
|
const issue = await this.findIssueByTaskId(taskId);
|
|
538
553
|
if (!issue)
|
|
539
|
-
throw new Error(
|
|
554
|
+
throw new Error(unknownTaskIdMessage(taskId));
|
|
540
555
|
const issueIdText = toStringSafe(issue.id);
|
|
541
556
|
if (!issueIdText)
|
|
542
|
-
throw new Error(
|
|
557
|
+
throw new Error(redmineIssueIdMissingMessage());
|
|
543
558
|
const taskDoc = { doc: String(doc ?? "") };
|
|
544
559
|
ensureDocMetadata(taskDoc, updatedBy);
|
|
545
560
|
const customFields = [];
|
|
@@ -565,7 +580,7 @@ export class RedmineBackend {
|
|
|
565
580
|
throw err;
|
|
566
581
|
const cached = await this.cache.getTask(taskId);
|
|
567
582
|
if (!cached)
|
|
568
|
-
throw new Error(
|
|
583
|
+
throw new Error(unknownTaskIdMessage(taskId));
|
|
569
584
|
cached.doc = String(doc ?? "");
|
|
570
585
|
ensureDocMetadata(cached, updatedBy);
|
|
571
586
|
cached.dirty = true;
|
|
@@ -579,10 +594,10 @@ export class RedmineBackend {
|
|
|
579
594
|
try {
|
|
580
595
|
const issue = await this.findIssueByTaskId(taskId);
|
|
581
596
|
if (!issue)
|
|
582
|
-
throw new Error(
|
|
597
|
+
throw new Error(unknownTaskIdMessage(taskId));
|
|
583
598
|
const issueIdText = toStringSafe(issue.id);
|
|
584
599
|
if (!issueIdText)
|
|
585
|
-
throw new Error(
|
|
600
|
+
throw new Error(redmineIssueIdMissingMessage());
|
|
586
601
|
const docValue = this.customFieldValue(issue, this.customFields.doc);
|
|
587
602
|
const taskDoc = { doc: docValue ?? "" };
|
|
588
603
|
ensureDocMetadata(taskDoc, updatedBy);
|
|
@@ -609,7 +624,7 @@ export class RedmineBackend {
|
|
|
609
624
|
throw err;
|
|
610
625
|
const cached = await this.cache.getTask(taskId);
|
|
611
626
|
if (!cached)
|
|
612
|
-
throw new Error(
|
|
627
|
+
throw new Error(unknownTaskIdMessage(taskId));
|
|
613
628
|
ensureDocMetadata(cached, updatedBy);
|
|
614
629
|
cached.dirty = true;
|
|
615
630
|
await this.cache.writeTask(cached);
|
|
@@ -621,7 +636,7 @@ export class RedmineBackend {
|
|
|
621
636
|
async writeTask(task) {
|
|
622
637
|
const taskId = toStringSafe(task.id).trim();
|
|
623
638
|
if (!taskId)
|
|
624
|
-
throw new Error(
|
|
639
|
+
throw new Error(missingTaskIdMessage());
|
|
625
640
|
validateTaskId(taskId);
|
|
626
641
|
try {
|
|
627
642
|
this.ensureDocMetadata(task);
|
|
@@ -690,7 +705,7 @@ export class RedmineBackend {
|
|
|
690
705
|
await this.syncPull(opts.conflict, opts.quiet);
|
|
691
706
|
return;
|
|
692
707
|
}
|
|
693
|
-
throw new BackendError("
|
|
708
|
+
throw new BackendError("Invalid sync direction (expected push|pull)", "E_BACKEND");
|
|
694
709
|
}
|
|
695
710
|
ensureDocMetadata(task) {
|
|
696
711
|
if (task.doc === undefined)
|
|
@@ -708,7 +723,7 @@ export class RedmineBackend {
|
|
|
708
723
|
const dirty = tasks.filter((task) => task.dirty);
|
|
709
724
|
if (dirty.length === 0) {
|
|
710
725
|
if (!quiet)
|
|
711
|
-
process.stdout.write("ℹ️ no
|
|
726
|
+
process.stdout.write("ℹ️ no local task changes to push\n");
|
|
712
727
|
return;
|
|
713
728
|
}
|
|
714
729
|
if (!confirm) {
|
|
@@ -719,7 +734,7 @@ export class RedmineBackend {
|
|
|
719
734
|
}
|
|
720
735
|
await this.writeTasks(dirty);
|
|
721
736
|
if (!quiet)
|
|
722
|
-
process.stdout.write(`✅ pushed ${dirty.length}
|
|
737
|
+
process.stdout.write(`✅ pushed ${dirty.length} task(s) (dirty)\n`);
|
|
723
738
|
}
|
|
724
739
|
async syncPull(conflict, quiet) {
|
|
725
740
|
if (!this.cache) {
|
|
@@ -753,7 +768,7 @@ export class RedmineBackend {
|
|
|
753
768
|
await this.cacheTask(remoteTask, false);
|
|
754
769
|
}
|
|
755
770
|
if (!quiet)
|
|
756
|
-
process.stdout.write(`✅ pulled ${remoteById.size} task(s)\n`);
|
|
771
|
+
process.stdout.write(`✅ pulled ${remoteById.size} task(s) (remote)\n`);
|
|
757
772
|
}
|
|
758
773
|
async handleConflict(taskId, localTask, remoteTask, conflict) {
|
|
759
774
|
if (conflict === "prefer-local") {
|
|
@@ -803,7 +818,7 @@ export class RedmineBackend {
|
|
|
803
818
|
const fieldId = this.customFields?.task_id;
|
|
804
819
|
if (fieldId)
|
|
805
820
|
return fieldId;
|
|
806
|
-
throw new BackendError("
|
|
821
|
+
throw new BackendError(redmineConfigMissingMessage("custom_fields.task_id"), "E_BACKEND");
|
|
807
822
|
}
|
|
808
823
|
setIssueCustomFieldValue(issue, fieldId, value) {
|
|
809
824
|
const fields = Array.isArray(issue.custom_fields) ? issue.custom_fields : [];
|
|
@@ -1174,7 +1189,7 @@ export class RedmineBackend {
|
|
|
1174
1189
|
}
|
|
1175
1190
|
function generateTaskId(existingIds, length, attempts) {
|
|
1176
1191
|
if (length < 4)
|
|
1177
|
-
throw new Error(
|
|
1192
|
+
throw new Error(invalidLengthMessage(length, 4));
|
|
1178
1193
|
for (let i = 0; i < attempts; i++) {
|
|
1179
1194
|
const now = new Date();
|
|
1180
1195
|
const yyyy = String(now.getUTCFullYear()).padStart(4, "0");
|
|
@@ -1190,7 +1205,7 @@ function generateTaskId(existingIds, length, attempts) {
|
|
|
1190
1205
|
if (!existingIds.has(candidate))
|
|
1191
1206
|
return candidate;
|
|
1192
1207
|
}
|
|
1193
|
-
throw new Error("Failed to generate a unique task id");
|
|
1208
|
+
throw new Error("Failed to generate a unique task id (exhausted attempts)");
|
|
1194
1209
|
}
|
|
1195
1210
|
async function loadBackendConfig(configPath) {
|
|
1196
1211
|
try {
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "agentplane",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "Agent Plane CLI for task workflows, recipes, and project automation.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"agentplane",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
],
|
|
23
23
|
"repository": {
|
|
24
24
|
"type": "git",
|
|
25
|
-
"url": "https://github.com/basilisk-labs/agentplane.git"
|
|
25
|
+
"url": "git+https://github.com/basilisk-labs/agentplane.git"
|
|
26
26
|
},
|
|
27
27
|
"homepage": "https://github.com/basilisk-labs/agentplane",
|
|
28
28
|
"bugs": {
|
|
@@ -54,6 +54,6 @@
|
|
|
54
54
|
"prepublishOnly": "npm run prepack"
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@
|
|
57
|
+
"@agentplaneorg/core": "0.1.2"
|
|
58
58
|
}
|
|
59
59
|
}
|