@docyrus/docyrus 0.0.46 → 0.0.48
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/main.js +111 -20
- package/main.js.map +3 -3
- package/package.json +1 -1
- package/resources/pi-agent/prompts/agent-system.md +5 -4
- package/resources/pi-agent/prompts/coder-system.md +5 -4
- package/server-loader.js +33 -13
- package/server-loader.js.map +2 -2
package/main.js
CHANGED
|
@@ -138273,7 +138273,7 @@ function buildInputSchema(args2, env2, options2) {
|
|
|
138273
138273
|
// package.json
|
|
138274
138274
|
var package_default = {
|
|
138275
138275
|
name: "@docyrus/docyrus",
|
|
138276
|
-
version: "0.0.
|
|
138276
|
+
version: "0.0.48",
|
|
138277
138277
|
private: false,
|
|
138278
138278
|
description: "Docyrus API CLI",
|
|
138279
138279
|
main: "./main.js",
|
|
@@ -148246,16 +148246,30 @@ function normalizeTaskId(featureId, type, title) {
|
|
|
148246
148246
|
function compareStrings(left, right) {
|
|
148247
148247
|
return left.localeCompare(right);
|
|
148248
148248
|
}
|
|
148249
|
+
function compareOrder(left, right) {
|
|
148250
|
+
if (left !== void 0 && right !== void 0) {
|
|
148251
|
+
return left - right;
|
|
148252
|
+
}
|
|
148253
|
+
if (left !== void 0) {
|
|
148254
|
+
return -1;
|
|
148255
|
+
}
|
|
148256
|
+
if (right !== void 0) {
|
|
148257
|
+
return 1;
|
|
148258
|
+
}
|
|
148259
|
+
return 0;
|
|
148260
|
+
}
|
|
148249
148261
|
function sortGraph(graph) {
|
|
148250
148262
|
return {
|
|
148251
148263
|
version: 1,
|
|
148252
|
-
sections: [...graph.sections].sort(
|
|
148253
|
-
|
|
148254
|
-
|
|
148255
|
-
|
|
148256
|
-
|
|
148257
|
-
|
|
148258
|
-
|
|
148264
|
+
sections: [...graph.sections].sort(
|
|
148265
|
+
(left, right) => compareOrder(left.order, right.order) || compareStrings(left.id, right.id)
|
|
148266
|
+
),
|
|
148267
|
+
features: [...graph.features].sort(
|
|
148268
|
+
(left, right) => compareOrder(left.order, right.order) || compareStrings(left.sectionId, right.sectionId) || compareStrings(left.title, right.title) || compareStrings(left.id, right.id)
|
|
148269
|
+
),
|
|
148270
|
+
tasks: [...graph.tasks].sort(
|
|
148271
|
+
(left, right) => compareOrder(left.order, right.order) || compareStrings(left.sectionId, right.sectionId) || compareStrings(left.featureId, right.featureId) || compareStrings(left.title, right.title) || compareStrings(left.id, right.id)
|
|
148272
|
+
)
|
|
148259
148273
|
};
|
|
148260
148274
|
}
|
|
148261
148275
|
function resolveProjectPlanDirectory(root) {
|
|
@@ -148283,14 +148297,16 @@ function parseProjectPlanGraph(rawValue) {
|
|
|
148283
148297
|
id: isNonEmptyString(value2.id) ? value2.id.trim() : "",
|
|
148284
148298
|
title: isNonEmptyString(value2.title) ? value2.title.trim() : "",
|
|
148285
148299
|
slug: isNonEmptyString(value2.slug) ? value2.slug.trim() : "",
|
|
148286
|
-
summary: typeof value2.summary === "string" ? value2.summary.trim() : ""
|
|
148300
|
+
summary: typeof value2.summary === "string" ? value2.summary.trim() : "",
|
|
148301
|
+
...typeof value2.order === "number" ? { order: value2.order } : {}
|
|
148287
148302
|
})).filter((value2) => value2.id.length > 0) : [];
|
|
148288
148303
|
const features = Array.isArray(rawValue.features) ? rawValue.features.filter((value2) => isRecord3(value2)).map((value2) => ({
|
|
148289
148304
|
id: isNonEmptyString(value2.id) ? value2.id.trim() : "",
|
|
148290
148305
|
title: isNonEmptyString(value2.title) ? value2.title.trim() : "",
|
|
148291
148306
|
slug: isNonEmptyString(value2.slug) ? value2.slug.trim() : "",
|
|
148292
148307
|
summary: typeof value2.summary === "string" ? value2.summary.trim() : "",
|
|
148293
|
-
sectionId: isNonEmptyString(value2.sectionId) ? value2.sectionId.trim() : ""
|
|
148308
|
+
sectionId: isNonEmptyString(value2.sectionId) ? value2.sectionId.trim() : "",
|
|
148309
|
+
...typeof value2.order === "number" ? { order: value2.order } : {}
|
|
148294
148310
|
})).filter((value2) => value2.id.length > 0) : [];
|
|
148295
148311
|
const tasks = Array.isArray(rawValue.tasks) ? rawValue.tasks.filter((value2) => isRecord3(value2)).map((value2) => ({
|
|
148296
148312
|
id: isNonEmptyString(value2.id) ? value2.id.trim() : "",
|
|
@@ -148301,7 +148317,8 @@ function parseProjectPlanGraph(rawValue) {
|
|
|
148301
148317
|
status: typeof value2.status === "string" ? value2.status : "planned",
|
|
148302
148318
|
acceptanceCriteria: normalizeStringArray(value2.acceptanceCriteria),
|
|
148303
148319
|
featureId: isNonEmptyString(value2.featureId) ? value2.featureId.trim() : "",
|
|
148304
|
-
sectionId: isNonEmptyString(value2.sectionId) ? value2.sectionId.trim() : ""
|
|
148320
|
+
sectionId: isNonEmptyString(value2.sectionId) ? value2.sectionId.trim() : "",
|
|
148321
|
+
...typeof value2.order === "number" ? { order: value2.order } : {}
|
|
148305
148322
|
})).filter((value2) => value2.id.length > 0) : [];
|
|
148306
148323
|
return sortGraph({
|
|
148307
148324
|
version: 1,
|
|
@@ -148671,7 +148688,8 @@ async function upsertProjectPlanSection(params) {
|
|
|
148671
148688
|
id: existing?.id || sectionId,
|
|
148672
148689
|
title: params.title.trim(),
|
|
148673
148690
|
slug,
|
|
148674
|
-
summary: params.summary?.trim() || ""
|
|
148691
|
+
summary: params.summary?.trim() || "",
|
|
148692
|
+
...params.order !== void 0 ? { order: params.order } : existing?.order !== void 0 ? { order: existing.order } : {}
|
|
148675
148693
|
};
|
|
148676
148694
|
const nextSections = existing ? graph.sections.map((section2) => section2.id === existing.id ? nextSection : section2) : [...graph.sections, nextSection];
|
|
148677
148695
|
await writeProjectPlanFiles(params.root, {
|
|
@@ -148703,7 +148721,8 @@ async function upsertProjectPlanFeature(params) {
|
|
|
148703
148721
|
title: params.title.trim(),
|
|
148704
148722
|
slug,
|
|
148705
148723
|
summary: params.summary?.trim() || "",
|
|
148706
|
-
sectionId: params.sectionId
|
|
148724
|
+
sectionId: params.sectionId,
|
|
148725
|
+
...params.order !== void 0 ? { order: params.order } : existing?.order !== void 0 ? { order: existing.order } : {}
|
|
148707
148726
|
};
|
|
148708
148727
|
const nextFeatures = existing ? graph.features.map((feature) => feature.id === existing.id ? nextFeature : feature) : [...graph.features, nextFeature];
|
|
148709
148728
|
await writeProjectPlanFiles(params.root, {
|
|
@@ -148745,7 +148764,8 @@ async function upsertProjectPlanTask(params) {
|
|
|
148745
148764
|
status: params.status || "planned",
|
|
148746
148765
|
acceptanceCriteria: [...new Set((params.acceptanceCriteria || []).map((item) => item.trim()).filter(Boolean))],
|
|
148747
148766
|
featureId: feature.id,
|
|
148748
|
-
sectionId
|
|
148767
|
+
sectionId,
|
|
148768
|
+
...params.order !== void 0 ? { order: params.order } : existing?.order !== void 0 ? { order: existing.order } : {}
|
|
148749
148769
|
};
|
|
148750
148770
|
const nextTasks = existing ? graph.tasks.map((task) => task.id === existing.id ? nextTask : task) : [...graph.tasks, nextTask];
|
|
148751
148771
|
await writeProjectPlanFiles(params.root, {
|
|
@@ -148770,6 +148790,43 @@ async function updateProjectPlanTaskStatus(params) {
|
|
|
148770
148790
|
});
|
|
148771
148791
|
return nextTask;
|
|
148772
148792
|
}
|
|
148793
|
+
async function setProjectPlanOrder(params) {
|
|
148794
|
+
const graph = await readProjectPlanGraph(params.root);
|
|
148795
|
+
if (params.entityType === "section") {
|
|
148796
|
+
const entity2 = graph.sections.find((item) => item.id === params.entityId);
|
|
148797
|
+
if (!entity2) {
|
|
148798
|
+
throw new Error(`Section "${params.entityId}" not found.`);
|
|
148799
|
+
}
|
|
148800
|
+
const next2 = { ...entity2, order: params.order };
|
|
148801
|
+
await writeProjectPlanFiles(params.root, {
|
|
148802
|
+
...graph,
|
|
148803
|
+
sections: graph.sections.map((item) => item.id === entity2.id ? next2 : item)
|
|
148804
|
+
});
|
|
148805
|
+
return next2;
|
|
148806
|
+
}
|
|
148807
|
+
if (params.entityType === "feature") {
|
|
148808
|
+
const entity2 = graph.features.find((item) => item.id === params.entityId);
|
|
148809
|
+
if (!entity2) {
|
|
148810
|
+
throw new Error(`Feature "${params.entityId}" not found.`);
|
|
148811
|
+
}
|
|
148812
|
+
const next2 = { ...entity2, order: params.order };
|
|
148813
|
+
await writeProjectPlanFiles(params.root, {
|
|
148814
|
+
...graph,
|
|
148815
|
+
features: graph.features.map((item) => item.id === entity2.id ? next2 : item)
|
|
148816
|
+
});
|
|
148817
|
+
return next2;
|
|
148818
|
+
}
|
|
148819
|
+
const entity = graph.tasks.find((item) => item.id === params.entityId);
|
|
148820
|
+
if (!entity) {
|
|
148821
|
+
throw new Error(`Task "${params.entityId}" not found.`);
|
|
148822
|
+
}
|
|
148823
|
+
const next = { ...entity, order: params.order };
|
|
148824
|
+
await writeProjectPlanFiles(params.root, {
|
|
148825
|
+
...graph,
|
|
148826
|
+
tasks: graph.tasks.map((item) => item.id === entity.id ? next : item)
|
|
148827
|
+
});
|
|
148828
|
+
return next;
|
|
148829
|
+
}
|
|
148773
148830
|
|
|
148774
148831
|
// src/knowledge/hook.ts
|
|
148775
148832
|
function hasWikiLinks(text3) {
|
|
@@ -150012,7 +150069,8 @@ function createProjectPlanCli(dependencies) {
|
|
|
150012
150069
|
id: external_exports.string().optional().describe("Optional existing section id"),
|
|
150013
150070
|
title: external_exports.string().min(1).describe("Section title"),
|
|
150014
150071
|
slug: external_exports.string().optional().describe("Optional section slug"),
|
|
150015
|
-
summary: external_exports.string().optional().describe("Section summary")
|
|
150072
|
+
summary: external_exports.string().optional().describe("Section summary"),
|
|
150073
|
+
order: external_exports.coerce.number().int().optional().describe("Optional display order (lower = first)")
|
|
150016
150074
|
}),
|
|
150017
150075
|
run: async (context) => {
|
|
150018
150076
|
const section2 = await upsertProjectPlanSection({
|
|
@@ -150020,7 +150078,8 @@ function createProjectPlanCli(dependencies) {
|
|
|
150020
150078
|
id: context.options.id,
|
|
150021
150079
|
title: context.options.title,
|
|
150022
150080
|
slug: context.options.slug,
|
|
150023
|
-
summary: context.options.summary
|
|
150081
|
+
summary: context.options.summary,
|
|
150082
|
+
order: context.options.order
|
|
150024
150083
|
});
|
|
150025
150084
|
maybePrintHuman2(context, `Upserted section ${section2.id}`);
|
|
150026
150085
|
return await wrapPayload(dependencies, section2);
|
|
@@ -150049,7 +150108,8 @@ function createProjectPlanCli(dependencies) {
|
|
|
150049
150108
|
sectionId: external_exports.string().min(1).describe("Project plan section id"),
|
|
150050
150109
|
title: external_exports.string().min(1).describe("Feature title"),
|
|
150051
150110
|
slug: external_exports.string().optional().describe("Optional feature slug"),
|
|
150052
|
-
summary: external_exports.string().optional().describe("Feature summary")
|
|
150111
|
+
summary: external_exports.string().optional().describe("Feature summary"),
|
|
150112
|
+
order: external_exports.coerce.number().int().optional().describe("Optional display order (lower = first)")
|
|
150053
150113
|
}),
|
|
150054
150114
|
run: async (context) => {
|
|
150055
150115
|
const feature = await upsertProjectPlanFeature({
|
|
@@ -150058,7 +150118,8 @@ function createProjectPlanCli(dependencies) {
|
|
|
150058
150118
|
sectionId: context.options.sectionId,
|
|
150059
150119
|
title: context.options.title,
|
|
150060
150120
|
slug: context.options.slug,
|
|
150061
|
-
summary: context.options.summary
|
|
150121
|
+
summary: context.options.summary,
|
|
150122
|
+
order: context.options.order
|
|
150062
150123
|
});
|
|
150063
150124
|
maybePrintHuman2(context, `Upserted feature ${feature.id}`);
|
|
150064
150125
|
return await wrapPayload(dependencies, feature);
|
|
@@ -150077,7 +150138,8 @@ function createProjectPlanCli(dependencies) {
|
|
|
150077
150138
|
type: external_exports.enum(PROJECT_TASK_TYPES).describe("Task type"),
|
|
150078
150139
|
assignee: external_exports.enum(PROJECT_TASK_ASSIGNEES).describe("Task assignee"),
|
|
150079
150140
|
status: external_exports.enum(PROJECT_TASK_STATUSES).optional().describe("Task status"),
|
|
150080
|
-
acceptanceCriteria: external_exports.string().optional().describe("JSON string array of acceptance criteria")
|
|
150141
|
+
acceptanceCriteria: external_exports.string().optional().describe("JSON string array of acceptance criteria"),
|
|
150142
|
+
order: external_exports.coerce.number().int().optional().describe("Optional display order (lower = first)")
|
|
150081
150143
|
}),
|
|
150082
150144
|
run: async (context) => {
|
|
150083
150145
|
const task = await upsertProjectPlanTask({
|
|
@@ -150090,7 +150152,8 @@ function createProjectPlanCli(dependencies) {
|
|
|
150090
150152
|
type: context.options.type,
|
|
150091
150153
|
assignee: context.options.assignee,
|
|
150092
150154
|
status: context.options.status,
|
|
150093
|
-
acceptanceCriteria: parseOptionalStringArray(context.options.acceptanceCriteria, "--acceptanceCriteria")
|
|
150155
|
+
acceptanceCriteria: parseOptionalStringArray(context.options.acceptanceCriteria, "--acceptanceCriteria"),
|
|
150156
|
+
order: context.options.order
|
|
150094
150157
|
});
|
|
150095
150158
|
maybePrintHuman2(context, `Upserted task ${task.id}`);
|
|
150096
150159
|
return await wrapPayload(dependencies, task);
|
|
@@ -150133,6 +150196,34 @@ function createProjectPlanCli(dependencies) {
|
|
|
150133
150196
|
return await wrapPayload(dependencies, task);
|
|
150134
150197
|
}
|
|
150135
150198
|
});
|
|
150199
|
+
projectPlanCli.command("set-order", {
|
|
150200
|
+
description: "Set the display order of a section, feature, or task",
|
|
150201
|
+
env: EnvSchema,
|
|
150202
|
+
outputPolicy: "agent-only",
|
|
150203
|
+
options: external_exports.object({
|
|
150204
|
+
sectionId: external_exports.string().optional().describe("Section id"),
|
|
150205
|
+
featureId: external_exports.string().optional().describe("Feature id"),
|
|
150206
|
+
taskId: external_exports.string().optional().describe("Task id"),
|
|
150207
|
+
order: external_exports.coerce.number().int().describe("Display order (lower = first)")
|
|
150208
|
+
}),
|
|
150209
|
+
run: async (context) => {
|
|
150210
|
+
const { sectionId, featureId, taskId, order: order2 } = context.options;
|
|
150211
|
+
const ids = [sectionId, featureId, taskId].filter(Boolean);
|
|
150212
|
+
if (ids.length !== 1) {
|
|
150213
|
+
throw new UserInputError("Exactly one of --sectionId, --featureId, or --taskId is required.");
|
|
150214
|
+
}
|
|
150215
|
+
const entityType = sectionId ? "section" : featureId ? "feature" : "task";
|
|
150216
|
+
const entityId = sectionId ?? featureId ?? taskId;
|
|
150217
|
+
const entity = await setProjectPlanOrder({
|
|
150218
|
+
root: process.cwd(),
|
|
150219
|
+
entityType,
|
|
150220
|
+
entityId,
|
|
150221
|
+
order: order2
|
|
150222
|
+
});
|
|
150223
|
+
maybePrintHuman2(context, `Set order ${order2} on ${entityType} ${entityId}`);
|
|
150224
|
+
return await wrapPayload(dependencies, entity);
|
|
150225
|
+
}
|
|
150226
|
+
});
|
|
150136
150227
|
projectPlanCli.command("create-linked-todo", {
|
|
150137
150228
|
description: "Create a local .pi/todos subtask linked to a canonical task",
|
|
150138
150229
|
env: EnvSchema,
|