drafted 1.19.34 → 1.19.35

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 +18 -4
  2. package/package.json +1 -1
package/mcp/server.mjs CHANGED
@@ -3275,8 +3275,8 @@ tool('fs', 'Navigate Drafted like a local filesystem. A FOLDER is the single con
3275
3275
  // Name the org, or don't search. See searchNeedsOrg: an unaddressed search
3276
3276
  // returns "no matches" from ONE org and reads as "nowhere", which is the
3277
3277
  // one wrong answer a search can give that nothing announces.
3278
+ const orgs = await getOrgList();
3278
3279
  {
3279
- const orgs = await getOrgList();
3280
3280
  if (searchNeedsOrg({ explicitOrg: org, orgFromPath, orgCount: orgs.length })) {
3281
3281
  // Work is almost always org-specific, and this session usually already
3282
3282
  // knows WHICH — a binding, an open project, or the linked repo of the
@@ -3312,7 +3312,21 @@ tool('fs', 'Navigate Drafted like a local filesystem. A FOLDER is the single con
3312
3312
  ));
3313
3313
  }
3314
3314
  }
3315
- const scope = orgFromPath ? `/o/${orgFromPath}` : '';
3315
+ // THE CANONICAL SLUG, not the spelling the caller used. /o/beoflow resolves
3316
+ // (the org NAME is a resolution rung alongside id and slug) but its slug is
3317
+ // beoflow-mnczl0zt — and fs(ls) already prints that. Echoing the input
3318
+ // instead made ls and search disagree about the address of one thing, which
3319
+ // is the same defect as dropping the folder segment, one axis over.
3320
+ // Computed HERE, before any section renders: section() runs its renderer
3321
+ // immediately, so a later assignment would leave wiki + skills on the old
3322
+ // spelling while projects + frames used the new one.
3323
+ const addressed = orgFromPath || org || null;
3324
+ const canonicalOrg = addressed
3325
+ ? (orgs.find(o => o.id === addressed
3326
+ || (o.slug || '').toLowerCase() === String(addressed).toLowerCase()
3327
+ || (o.name || '').toLowerCase() === String(addressed).toLowerCase())?.slug || addressed)
3328
+ : null;
3329
+ const scope = canonicalOrg ? `/o/${canonicalOrg}` : '';
3316
3330
  const leg = async (fn) => { try { return { v: await fn() }; } catch (e) { return { e: e?.message || String(e) }; } };
3317
3331
  const [wiki, skills, projects, frames, repos] = await Promise.all([
3318
3332
  leg(() => api('GET', `/api/wiki/search?q=${encodeURIComponent(q)}&limit=10`, undefined, orgHeader)),
@@ -3391,7 +3405,7 @@ tool('fs', 'Navigate Drafted like a local filesystem. A FOLDER is the single con
3391
3405
  const projectRows = (Array.isArray(projects.v?.projects) ? projects.v.projects : [])
3392
3406
  .filter(x => x.folder !== '__archived');
3393
3407
  const folderById = new Map(projectRows.map(x => [x.id, x.folder || '']));
3394
- const orgAs = orgFromPath || null;
3408
+ const orgAs = canonicalOrg;
3395
3409
  section('Projects', projects, () => {
3396
3410
  const hits = projectRows.filter(x => matchesAllTerms([x.name, x.slug, x.description], q)).slice(0, 10);
3397
3411
  return hits.length
@@ -3414,7 +3428,7 @@ tool('fs', 'Navigate Drafted like a local filesystem. A FOLDER is the single con
3414
3428
  out.push('Marked [git: …] = wiki/skill owned by that repo; edit via commit. Projects and tasks in the same folder write normally.');
3415
3429
  }
3416
3430
 
3417
- const searched = orgFromPath || org || null;
3431
+ const searched = canonicalOrg;
3418
3432
  // ALWAYS say where this looked. "No matches" is only safe to act on when
3419
3433
  // the reader can see the scope it was computed over.
3420
3434
  return ok(`Search "${q}" in ${searched ? `/o/${searched}` : 'your only org'}\n\n${out.join('\n\n')}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.19.34",
3
+ "version": "1.19.35",
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": [