drafted 1.7.7 → 1.7.11

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/mcp/server.mjs +8 -5
  2. package/package.json +1 -1
package/mcp/server.mjs CHANGED
@@ -133,7 +133,7 @@ const TOOL_ANNOTATIONS = {
133
133
 
134
134
  // Projects
135
135
  project: { title: 'Projects', readOnlyHint: false, destructiveHint: false, openWorldHint: false, widgetUri: 'ui://widget/drafted-canvas-overview.html', description: 'Manage projects: list (start here), open (switch active project), create, update, move to another org.' },
136
- get_org: { title: 'Get organization', readOnlyHint: true, destructiveHint: false, openWorldHint: false, description: 'Get the current organization and membership info.' },
136
+ get_org: { title: 'Organization', readOnlyHint: false, destructiveHint: false, openWorldHint: false, description: 'Get the active organization (action="get", default) or switch to a different org (action="switch", orgId=...). Use switch when you need wiki/skill work in an org that has no projects — opening a project also switches, but is unavailable in empty orgs.' },
137
137
 
138
138
  // Templates
139
139
  template: { title: 'Templates', readOnlyHint: false, destructiveHint: true, openWorldHint: false, description: 'Manage project templates: list, create, update, delete, fork.' },
@@ -980,12 +980,13 @@ tool('project', 'START HERE for project management. Dispatch by `action`: list (
980
980
  } catch (error) { return err(error); }
981
981
  });
982
982
 
983
- tool('template', 'Manage project templates in the org. Dispatch by `action`: list/create/update/delete/fork. A template bundles layer definitions that new projects can be created from.', {
983
+ tool('template', 'Manage project templates in the org. Dispatch by `action`: list/create/update/delete/fork. A template bundles layer definitions and an optional list of skill slugs that auto-attach to projects created from it.', {
984
984
  action: z.enum(['list', 'create', 'update', 'delete', 'fork']).describe('Operation to perform.'),
985
985
  templateId: z.string().optional().describe('[update|delete|fork] template ID'),
986
986
  name: z.string().optional().describe('[create|update|fork] template name (required for create; optional rename for fork)'),
987
987
  description: z.string().optional().describe('[create|update] template description'),
988
988
  layers: z.array(z.object({}).passthrough()).optional().describe('[create|update] array of layer definitions'),
989
+ skillSlugs: z.array(z.string()).optional().describe('[create|update] skill slugs to auto-attach to projects created from this template. Slugs are resolved against the org\'s skills (org-local first, built-in fallback) at project-create time; missing slugs are silently skipped. Pass an empty array on update to clear.'),
989
990
  visibility: z.string().optional().describe('[create|update] "org" or "public"'),
990
991
  }, async (args) => {
991
992
  try {
@@ -994,19 +995,21 @@ tool('template', 'Manage project templates in the org. Dispatch by `action`: lis
994
995
  case 'list':
995
996
  return ok(await api('GET', '/api/templates'));
996
997
  case 'create': {
997
- const { name, description, layers, visibility } = args;
998
+ const { name, description, layers, skillSlugs, visibility } = args;
998
999
  if (!name || !description || !layers) throw new Error('name, description, layers required for action=create');
999
1000
  const body = { name, description, layers };
1001
+ if (Array.isArray(skillSlugs)) body.skillSlugs = skillSlugs;
1000
1002
  if (visibility) body.visibility = visibility;
1001
1003
  return ok(await api('POST', '/api/templates', body));
1002
1004
  }
1003
1005
  case 'update': {
1004
- const { templateId, name, description, layers, visibility } = args;
1006
+ const { templateId, name, description, layers, skillSlugs, visibility } = args;
1005
1007
  if (!templateId) throw new Error('templateId required for action=update');
1006
1008
  const body = {};
1007
1009
  if (name) body.name = name;
1008
1010
  if (description) body.description = description;
1009
1011
  if (layers) body.layers = layers;
1012
+ if (Array.isArray(skillSlugs)) body.skillSlugs = skillSlugs;
1010
1013
  if (visibility) body.visibility = visibility;
1011
1014
  if (Object.keys(body).length === 0) throw new Error('At least one field is required for action=update');
1012
1015
  return ok(await api('PUT', `/api/templates/${templateId}`, body));
@@ -1934,7 +1937,7 @@ tool('skill', 'Manage the Drafted skill library. Skills are reusable prompts/gui
1934
1937
  // All 11 actions dispatch from one tool. Read-only actions skip the
1935
1938
  // skill gate; mutations require org-level wiki-maintainer skills loaded.
1936
1939
 
1937
- tool('wiki', 'Per-org wiki. Markdown pages with paths as hierarchy. You and other agents/humans share maintenance — every edit broadcasts live, and edits from others appear in `recent` and on `read`.\n\nBefore mutating: check `recent` and `search` for relevant existing pages. Before mv/rm: check `links` (or pass `dryRun=true`). After completing a logical session of work, append a `log` entry.\n\nThe tool handles bookkeeping you\'d otherwise forget: `mv` rewrites inbound references via the link index, `read` shows who edited last and when. Use `health` to find unlinked pages and broken links.\n\n**Skill gate:** the org may attach a `wiki-maintainer` skill that you MUST load before mutations. If you get a skill-gate error, run skill(action="load", skill="wiki-maintainer") then retry.', {
1940
+ tool('wiki', 'Per-org wiki. Markdown pages with paths as hierarchy. You and other agents/humans share maintenance — every edit broadcasts live, and edits from others appear in `recent` and on `read`.\n\n**Wiki always operates on the ACTIVE org.** If the content you need lives in a different org, switch first via `get_org(action="switch", orgId=...)` — don\'t assume "no hits" means the content doesn\'t exist. Verify the active org with `get_org` before searching.\n\nBefore mutating: check `recent` and `search` for relevant existing pages. Before mv/rm: check `links` (or pass `dryRun=true`). After completing a logical session of work, append a `log` entry.\n\nThe tool handles bookkeeping you\'d otherwise forget: `mv` rewrites inbound references via the link index, `read` shows who edited last and when. Use `health` to find unlinked pages and broken links.\n\n**Skill gate:** the org may attach a `wiki-maintainer` skill that you MUST load before mutations. If you get a skill-gate error, run skill(action="load", skill="wiki-maintainer") then retry.', {
1938
1941
  action: z.enum(['ls', 'recent', 'read', 'search', 'links', 'log', 'health', 'write', 'edit', 'mv', 'rm', 'source-register', 'source-list', 'source-get', 'bulk-write']).describe('Operation to perform.'),
1939
1942
  path: z.string().optional().describe('[ls|read|links] wiki path. For ls: default / (root). For read: required. For links: required.'),
1940
1943
  recursive: z.boolean().optional().describe('[ls] list recursively with depth indicators'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.7.7",
3
+ "version": "1.7.11",
4
4
  "description": "Drafted — visual thinking surface for humans and AI agents. Renders HTML, markdown, images, and code as frames on a zoomable canvas, with MCP tools for AI agents and real-time sync for humans.",
5
5
  "type": "module",
6
6
  "files": [