@maskweaver/plugin 0.3.0 → 0.3.1

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.
Files changed (2) hide show
  1. package/dist/index.js +33 -40
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  // src/index.ts
2
- import { tool } from "@opencode-ai/plugin";
3
2
  import * as fs from "node:fs";
4
3
  import * as path from "node:path";
5
4
  function parseSimpleYaml(content) {
@@ -169,7 +168,7 @@ class MaskLoader {
169
168
  return this.catalog;
170
169
  const indexPath = path.join(this.masksDir, "index.json");
171
170
  if (!fs.existsSync(indexPath))
172
- throw new Error(`Mask catalog not found: ${indexPath}`);
171
+ throw new Error(`Catalog not found: ${indexPath}`);
173
172
  const content = fs.readFileSync(indexPath, "utf-8");
174
173
  this.catalog = JSON.parse(content);
175
174
  return this.catalog;
@@ -192,7 +191,7 @@ class MaskLoader {
192
191
  return null;
193
192
  const filePath = path.join(this.masksDir, entry.file);
194
193
  if (!fs.existsSync(filePath))
195
- throw new Error(`Mask file not found: ${filePath}`);
194
+ throw new Error(`File not found: ${filePath}`);
196
195
  const content = fs.readFileSync(filePath, "utf-8");
197
196
  const parsed = filePath.endsWith(".yaml") || filePath.endsWith(".yml") ? parseSimpleYaml(content) : JSON.parse(content);
198
197
  const loadedMask = { ...parsed, category: categoryId, filePath };
@@ -272,7 +271,7 @@ var MaskweaverPlugin = async ({ client, directory }) => {
272
271
  client.app.log({
273
272
  service: "maskweaver",
274
273
  level: "info",
275
- message: "Maskweaver plugin loaded v0.3.0"
274
+ message: "Maskweaver plugin loaded v0.3.1"
276
275
  });
277
276
  if (fs.existsSync(masksDir)) {
278
277
  state.maskLoader = new MaskLoader(masksDir);
@@ -304,12 +303,12 @@ ${buildRichPrompt(state.activeMask)}
304
303
  }
305
304
  },
306
305
  tool: {
307
- list_masks: tool({
308
- description: "List all available expert persona masks. Shows mask IDs, names, categories, and tags.",
306
+ list_masks: {
307
+ description: "List all available expert persona masks.",
309
308
  args: {
310
- category: tool.schema.string().optional().describe("Filter by category (software-engineering, ai-ml, architecture)")
309
+ category: { type: "string", description: "Filter by category" }
311
310
  },
312
- async execute(args, _context) {
311
+ async execute(args) {
313
312
  if (!state?.maskLoader) {
314
313
  return "Error: No masks directory found. Create .opencode/masks/index.json";
315
314
  }
@@ -321,7 +320,7 @@ ${buildRichPrompt(state.activeMask)}
321
320
  filtered = masks.filter((m) => m.category === args.category);
322
321
  }
323
322
  const lines = [];
324
- lines.push(`Maskweaver v0.3.0 - ${filtered.length} masks available`);
323
+ lines.push(`Maskweaver v0.3.1 - ${filtered.length} masks available`);
325
324
  lines.push(`Active mask: ${state.activeMask?.metadata.id || "none"}`);
326
325
  lines.push("");
327
326
  lines.push("Categories:");
@@ -332,7 +331,6 @@ ${buildRichPrompt(state.activeMask)}
332
331
  lines.push("Masks:");
333
332
  for (const mask of filtered) {
334
333
  lines.push(` - ${mask.id}: ${mask.name} [${mask.category}]`);
335
- lines.push(` Tags: ${mask.tags.join(", ")}`);
336
334
  }
337
335
  return lines.join(`
338
336
  `);
@@ -340,13 +338,13 @@ ${buildRichPrompt(state.activeMask)}
340
338
  return `Error: ${e}`;
341
339
  }
342
340
  }
343
- }),
344
- select_mask: tool({
345
- description: "Select and apply an expert persona mask. The AI will embody this expert personality.",
341
+ },
342
+ select_mask: {
343
+ description: "Select and apply an expert persona mask.",
346
344
  args: {
347
- maskId: tool.schema.string().describe('Mask ID (e.g., "kent-beck", "linus-torvalds", "martin-fowler")')
345
+ maskId: { type: "string", description: 'Mask ID (e.g., "kent-beck")' }
348
346
  },
349
- async execute(args, _context) {
347
+ async execute(args) {
350
348
  if (!state?.maskLoader) {
351
349
  return "Error: No masks directory found.";
352
350
  }
@@ -364,16 +362,16 @@ Available: ${available.map((m) => m.id).join(", ")}`;
364
362
 
365
363
  Expertise: ${mask.profile.expertise.join(", ")}
366
364
 
367
- The mask prompt will be injected into all future messages in this session.`;
365
+ The mask prompt will be injected into all future messages.`;
368
366
  } catch (e) {
369
367
  return `Error: ${e}`;
370
368
  }
371
369
  }
372
- }),
373
- deselect_mask: tool({
374
- description: "Remove the current mask and return to default AI behavior.",
370
+ },
371
+ deselect_mask: {
372
+ description: "Remove the current mask and return to default behavior.",
375
373
  args: {},
376
- async execute(_args, _context) {
374
+ async execute() {
377
375
  const prev = state?.activeMask;
378
376
  if (state)
379
377
  state.activeMask = null;
@@ -383,13 +381,13 @@ Returned to default behavior.`;
383
381
  }
384
382
  return "No mask was active.";
385
383
  }
386
- }),
387
- get_mask_prompt: tool({
384
+ },
385
+ get_mask_prompt: {
388
386
  description: "View the full system prompt for a mask.",
389
387
  args: {
390
- maskId: tool.schema.string().optional().describe("Mask ID. Uses active mask if not specified.")
388
+ maskId: { type: "string", description: "Mask ID (uses active mask if not specified)" }
391
389
  },
392
- async execute(args, _context) {
390
+ async execute(args) {
393
391
  if (!state?.maskLoader)
394
392
  return "Error: No masks directory.";
395
393
  const maskId = args.maskId || state.activeMask?.metadata.id;
@@ -406,11 +404,11 @@ ${buildRichPrompt(mask)}`;
406
404
  return `Error: ${e}`;
407
405
  }
408
406
  }
409
- }),
410
- maskweaver_status: tool({
411
- description: "Check Maskweaver status and active mask.",
407
+ },
408
+ maskweaver_status: {
409
+ description: "Check Maskweaver status.",
412
410
  args: {},
413
- async execute(_args, _context) {
411
+ async execute() {
414
412
  let masksCount = 0;
415
413
  let categoriesCount = 0;
416
414
  if (state?.maskLoader) {
@@ -421,19 +419,14 @@ ${buildRichPrompt(mask)}`;
421
419
  categoriesCount = categories.length;
422
420
  } catch (_e) {}
423
421
  }
424
- const lines = [
425
- "Maskweaver v0.3.0",
426
- `Masks directory: ${state?.masksDir}`,
427
- `Available: ${state?.maskLoader ? "yes" : "no"}`,
428
- `Total masks: ${masksCount}`,
429
- `Categories: ${categoriesCount}`,
430
- "",
431
- `Active mask: ${state?.activeMask ? `${state.activeMask.profile.name} (${state.activeMask.metadata.id})` : "none"}`
432
- ];
433
- return lines.join(`
434
- `);
422
+ return `Maskweaver v0.3.1
423
+ Masks directory: ${state?.masksDir}
424
+ Available: ${state?.maskLoader ? "yes" : "no"}
425
+ Total masks: ${masksCount}
426
+ Categories: ${categoriesCount}
427
+ Active mask: ${state?.activeMask ? `${state.activeMask.profile.name} (${state.activeMask.metadata.id})` : "none"}`;
435
428
  }
436
- })
429
+ }
437
430
  }
438
431
  };
439
432
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@maskweaver/plugin",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Maskweaver plugin for opencode - Expert AI personas",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",