@moderniser/plugin 0.1.2 → 0.1.4
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/context.d.ts +1 -0
- package/dist/index.js +38 -6
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function moderniserContext(): string;
|
package/dist/index.js
CHANGED
|
@@ -166,11 +166,39 @@ function moderniserAuth() {
|
|
|
166
166
|
};
|
|
167
167
|
}
|
|
168
168
|
|
|
169
|
+
// packages/plugin/src/context.ts
|
|
170
|
+
function moderniserContext() {
|
|
171
|
+
const lines = [
|
|
172
|
+
"You are the Moderniser agent — part of a platform for modernising enterprise " + "systems. Moderniser keeps a board (projects containing tasks containing " + "subtasks) and a Context Hub (the company's own wiki, searchable and citable).",
|
|
173
|
+
"",
|
|
174
|
+
"Vocabulary that means something specific here, not the generic sense:",
|
|
175
|
+
"- Project: an area of work on the board. Not a folder, not a repo scaffold.",
|
|
176
|
+
"- Task: one unit of work a team would plan together.",
|
|
177
|
+
"- Subtask: one concrete change in one codebase, small enough to finish and check off.",
|
|
178
|
+
"",
|
|
179
|
+
"When the user says project, task, board or ticket, they mean Moderniser's — " + "reach for the board tools (list_projects first, then create_task / " + "update_task / create_subtask / …). Do not answer by scaffolding files or " + "writing a spec document instead, unless a document is what they actually asked for."
|
|
180
|
+
];
|
|
181
|
+
const workspace = process.env.MODERNISER_WORKSPACE_NAME;
|
|
182
|
+
const company = process.env.MODERNISER_COMPANY_NAME;
|
|
183
|
+
const repo = process.env.REPO_URL;
|
|
184
|
+
if (workspace || company || repo) {
|
|
185
|
+
lines.push("", "Where you are right now:");
|
|
186
|
+
if (workspace)
|
|
187
|
+
lines.push(`- Workspace: ${workspace}`);
|
|
188
|
+
if (company)
|
|
189
|
+
lines.push(`- Company: ${company}`);
|
|
190
|
+
if (repo)
|
|
191
|
+
lines.push(`- Repository: ${repo}`);
|
|
192
|
+
}
|
|
193
|
+
return lines.join(`
|
|
194
|
+
`);
|
|
195
|
+
}
|
|
196
|
+
|
|
169
197
|
// packages/plugin/src/tools-boards.ts
|
|
170
198
|
import { tool } from "@opencode-ai/plugin";
|
|
171
199
|
var z = tool.schema;
|
|
172
200
|
var STATUS = ["todo", "in_progress", "in_review", "blocked", "done"];
|
|
173
|
-
var TYPE = ["feature", "bug", "improvement"
|
|
201
|
+
var TYPE = ["feature", "bug", "improvement"];
|
|
174
202
|
var FILES_TO_MODIFY = "Paths you have actually opened, written exactly as you reached them from the folder this session started in — 'orders/src/Order.java', not an absolute path and not a path you have rewritten. When a task spans two codebases the leading folder is the only thing telling a reader which one a change is in. Leave this empty rather than guessing.";
|
|
175
203
|
function commentPath(taskId, subtaskId) {
|
|
176
204
|
if (Boolean(taskId) === Boolean(subtaskId)) {
|
|
@@ -201,7 +229,7 @@ var boardTools = {
|
|
|
201
229
|
description: "List the tasks in a project with their status. Use this to see what already exists before creating more.",
|
|
202
230
|
args: {
|
|
203
231
|
projectId: z.string().describe("Project id from list_projects"),
|
|
204
|
-
status: z.
|
|
232
|
+
status: z.string().describe(`Only tasks in this status. Defaults: ${STATUS.join(", ")}; a project may define its own`).optional()
|
|
205
233
|
},
|
|
206
234
|
async execute({ projectId, status }) {
|
|
207
235
|
const query = status ? `?status=${status}` : "";
|
|
@@ -221,7 +249,7 @@ var boardTools = {
|
|
|
221
249
|
projectId: z.string().describe("Project id from list_projects"),
|
|
222
250
|
title: z.string().max(300).describe("Imperative and specific: 'Replace deprecated FlexibleSearch calls'"),
|
|
223
251
|
description: z.string().describe("What needs doing and why, including what you found in the code — current version, affected modules, known blockers"),
|
|
224
|
-
type: z.
|
|
252
|
+
type: z.string().describe(`Task type. Defaults to feature; usual values: ${TYPE.join(", ")}; a project may define its own`).optional()
|
|
225
253
|
},
|
|
226
254
|
async execute({ projectId, ...body }) {
|
|
227
255
|
return json((await post(`/projects/${projectId}/tasks`, body)).task);
|
|
@@ -233,8 +261,8 @@ var boardTools = {
|
|
|
233
261
|
taskId: z.string().describe("Task id"),
|
|
234
262
|
title: z.string().max(300).describe("New title").optional(),
|
|
235
263
|
description: z.string().describe("New description").optional(),
|
|
236
|
-
type: z.
|
|
237
|
-
status: z.
|
|
264
|
+
type: z.string().describe(`New type (usual values: ${TYPE.join(", ")}; a project may define its own)`).optional(),
|
|
265
|
+
status: z.string().describe(`New status (defaults: ${STATUS.join(", ")}; a project may define its own — a 400 lists the real ones)`).optional()
|
|
238
266
|
},
|
|
239
267
|
async execute({ taskId, ...body }) {
|
|
240
268
|
return json((await patch(`/projects/tasks/${taskId}`, body)).task);
|
|
@@ -267,7 +295,7 @@ var boardTools = {
|
|
|
267
295
|
subtaskId: z.string().describe("Subtask id"),
|
|
268
296
|
title: z.string().max(300).describe("New title").optional(),
|
|
269
297
|
description: z.string().describe("New description").optional(),
|
|
270
|
-
status: z.
|
|
298
|
+
status: z.string().describe(`New status (defaults: ${STATUS.join(", ")}; a project may define its own — a 400 lists the real ones)`).optional(),
|
|
271
299
|
filesToModify: z.array(z.string()).describe(FILES_TO_MODIFY).optional(),
|
|
272
300
|
implementationNotes: z.string().describe("Notes for whoever picks this up").optional(),
|
|
273
301
|
order: z.number().int().describe("Position in the list").optional()
|
|
@@ -419,6 +447,7 @@ var ModerniserPlugin = async () => {
|
|
|
419
447
|
options: { baseURL: GATEWAY(), ...key ? { apiKey: key } : {} },
|
|
420
448
|
models
|
|
421
449
|
};
|
|
450
|
+
config.enabled_providers ??= [PROVIDER_ID];
|
|
422
451
|
const requested = process.env.MODERNISER_MODEL;
|
|
423
452
|
if (requested !== "off") {
|
|
424
453
|
config.model ??= requested || DEFAULT_MODEL;
|
|
@@ -426,6 +455,9 @@ var ModerniserPlugin = async () => {
|
|
|
426
455
|
}
|
|
427
456
|
},
|
|
428
457
|
tool: { ...boardTools, ...contextHubTools },
|
|
458
|
+
"experimental.chat.system.transform": async (_input, output) => {
|
|
459
|
+
output.system.push(moderniserContext());
|
|
460
|
+
},
|
|
429
461
|
auth: moderniserAuth(),
|
|
430
462
|
event: async ({ event }) => {
|
|
431
463
|
const type = event?.type;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moderniser/plugin",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Moderniser plugin for opencode: points inference at the gateway, carries the board and Context Hub tools, and reports session telemetry",
|
|
6
6
|
"license": "MIT",
|