drafted 1.25.8 → 1.25.9

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 +15 -2
  2. package/package.json +1 -1
package/mcp/server.mjs CHANGED
@@ -3830,8 +3830,21 @@ tool('fs', 'Navigate Drafted like a local filesystem. A FOLDER is the single con
3830
3830
  // (/o/<org>/projects/eng/x). The chain wins when both are given.
3831
3831
  const projectFolder = folder || (parts.length === 2 ? parts[0] : null);
3832
3832
  const projectRef = parts[parts.length - 1];
3833
- const existing = await resolveProjectRef(projectRef, orgFromPath || org || null).catch(() => null);
3834
- if (existing) return err(new Error(`project already exists: ${projectRef}`));
3833
+ // "Already exists" means IN THE ORG THIS CREATE LANDS IN, and nothing wider.
3834
+ // resolveProjectRef scopes its first lookup to the org (correct) but then
3835
+ // takes one unscoped look before answering "not found" — right for resolving
3836
+ // an id or a project that changed org, WRONG as an existence test: it made a
3837
+ // same-named project in ANY org make the name uncreatable everywhere. Measured
3838
+ // on prod 2026-10-26: Flow2's 'architecture' blocked
3839
+ // /o/causeway-1781450760/projects/architecture. So ask the same org-identity
3840
+ // question the project-path guard asks a few blocks below (pathOrgMatches),
3841
+ // which also makes the answer independent of projectRefCache — an earlier
3842
+ // path in this session can have cached a cross-org answer under this org's key.
3843
+ const targetOrg = orgFromPath || org || null;
3844
+ const existing = await resolveProjectRef(projectRef, targetOrg).catch(() => null);
3845
+ if (existing && (!targetOrg || await pathOrgMatches(targetOrg, existing))) {
3846
+ return err(new Error(`project already exists: ${projectRef}`));
3847
+ }
3835
3848
  const projectName = projectRef.replace(/[-_]/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
3836
3849
  const created = await api('POST', '/api/projects', { name: projectName, ...(projectFolder ? { folder: projectFolder } : {}) }, orgHeader);
3837
3850
  if (!created?.id) return err(new Error('project create returned no id'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drafted",
3
- "version": "1.25.8",
3
+ "version": "1.25.9",
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
  "bin": {