From 75dacd653aad9835e0dd20a59462fd3ee1d780b6 Mon Sep 17 00:00:00 2001 From: Dan Lynch Date: Sat, 4 Jul 2026 22:00:30 +0000 Subject: [PATCH] =?UTF-8?q?fix:=20drop=20/route=20from=20node=20type=20ide?= =?UTF-8?q?ntifiers=20=E2=80=94=20category:name=20only?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Remove [/route] suffix from Node Type Convention in @fbp/types README - Add pattern ^[^/]+$ to NodeDefinition name/type in both JSON schemas - Update all README examples from slash-separated (math/add) to colon format (math:add) - Update skill references to use category:name format - Bump @fbp/types to 1.2.0 Closes constructive-io/constructive-planning#1110 --- .agents/skills/fbp/references/fbp-spec.md | 6 +++--- packages/evaluator/README.md | 8 ++++---- packages/graph-editor/README.md | 6 +++--- packages/spec/README.md | 14 +++++++------- packages/spec/graph.schema.json | 3 ++- packages/types/README.md | 8 +++----- packages/types/graph.schema.json | 3 ++- packages/types/package.json | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/.agents/skills/fbp/references/fbp-spec.md b/.agents/skills/fbp/references/fbp-spec.md index 06d9b5e..5c2f49a 100644 --- a/.agents/skills/fbp/references/fbp-spec.md +++ b/.agents/skills/fbp/references/fbp-spec.md @@ -70,13 +70,13 @@ import { insertNode, removeNode, renameNode, moveNode } from '@fbp/spec'; // Insert a node at root scope const newGraph = insertNode(graph, '/', { name: 'add1', - type: 'math/add' + type: 'math:add' }); // Insert into a subnet const newGraph = insertNode(graph, '/subnet1', { name: 'multiply1', - type: 'math/multiply' + type: 'math:multiply' }); // Remove a node and connected edges @@ -130,7 +130,7 @@ const node = getNode(graph, '/subnet1/add1'); const rootNodes = getNodes(graph, '/'); const rootEdges = getEdges(graph, '/'); -const addNodes = findNodes(graph, (node) => node.type === 'math/add'); +const addNodes = findNodes(graph, (node) => node.type === 'math:add'); // [{ node: {...}, path: '/add1' }, { node: {...}, path: '/subnet1/add2' }] const boundary = findBoundaryNodes(graph, '/subnet1'); diff --git a/packages/evaluator/README.md b/packages/evaluator/README.md index 137d0aa..c28efed 100644 --- a/packages/evaluator/README.md +++ b/packages/evaluator/README.md @@ -19,7 +19,7 @@ import type { NodeDefinitionWithImpl } from '@fbp/evaluator'; const addDef: NodeDefinitionWithImpl = { context: 'js', category: 'math', - type: 'js/math/add', + name: 'add', inputs: [ { name: 'a', type: 'number' }, { name: 'b', type: 'number' } @@ -34,9 +34,9 @@ const addDef: NodeDefinitionWithImpl = { const graph: Graph = { name: 'simple-add', nodes: [ - { name: 'num1', type: 'js/const/number', props: [{ name: 'value', type: 'number', value: 5 }] }, - { name: 'num2', type: 'js/const/number', props: [{ name: 'value', type: 'number', value: 3 }] }, - { name: 'add', type: 'js/math/add' } + { name: 'num1', type: 'const:number', props: [{ name: 'value', type: 'number', value: 5 }] }, + { name: 'num2', type: 'const:number', props: [{ name: 'value', type: 'number', value: 3 }] }, + { name: 'add', type: 'math:add' } ], edges: [ { src: { node: 'num1', port: 'value' }, dst: { node: 'add', port: 'a' } }, diff --git a/packages/graph-editor/README.md b/packages/graph-editor/README.md index 925f134..0b8d315 100644 --- a/packages/graph-editor/README.md +++ b/packages/graph-editor/README.md @@ -5,7 +5,7 @@ A Houdini-inspired graph editor for Flow-Based Programming built with React, SVG ## Features - **SVG-based canvas** with pan/zoom support -- **Node rendering** with fully-qualified type paths (e.g., `js/math/add`) +- **Node rendering** with `category:name` type identifiers (e.g., `math:add`) - **Bezier edge connections** between ports - **Selection system** with box select, shift-add/remove, and Cmd+D duplicate - **Properties panel** auto-generated from `PropDefinition` @@ -30,7 +30,7 @@ const graph: Graph = { { context: 'js', category: 'math', - type: 'js/math/add', + name: 'add', inputs: [ { name: 'a', type: 'number' }, { name: 'b', type: 'number' } @@ -41,7 +41,7 @@ const graph: Graph = { } ], nodes: [ - { name: 'add1', type: 'js/math/add', meta: { x: 100, y: 100 } } + { name: 'add1', type: 'math:add', meta: { x: 100, y: 100 } } ], edges: [] }; diff --git a/packages/spec/README.md b/packages/spec/README.md index 2e5023a..9fd075f 100644 --- a/packages/spec/README.md +++ b/packages/spec/README.md @@ -178,7 +178,7 @@ Definition of a reusable node type (like a class). ```typescript interface NodeDefinition { - type: string; // Unique identifier (e.g., "math/add") + type: string; // Unique identifier (e.g., "math:add") context?: string; // Namespace (e.g., "math", "ui") category?: string; // Palette category inputs?: PortDef[]; // Input port definitions @@ -408,13 +408,13 @@ Insert a node at a scope. ```typescript const newGraph = insertNode(graph, '/', { name: 'add1', - type: 'math/add' + type: 'math:add' }); // Insert into a subnet const newGraph = insertNode(graph, '/subnet1', { name: 'multiply1', - type: 'math/multiply' + type: 'math:multiply' }); ``` @@ -531,7 +531,7 @@ const subnetEdges = getEdges(graph, '/subnet1'); Find nodes recursively matching a predicate. ```typescript -const addNodes = findNodes(graph, (node) => node.type === 'math/add'); +const addNodes = findNodes(graph, (node) => node.type === 'math:add'); // [{ node: {...}, path: '/add1' }, { node: {...}, path: '/subnet1/add2' }] ``` @@ -607,7 +607,7 @@ A graph that adds two numbers: "meta": { "x": 0, "y": 100 }, "props": [{ "name": "portName", "value": "b" }, { "name": "dataType", "value": "number" }] }, - { "name": "add1", "type": "math/add", "meta": { "x": 200, "y": 50 } }, + { "name": "add1", "type": "math:add", "meta": { "x": 200, "y": 50 } }, { "name": "output_result", "type": "graphOutput", @@ -646,7 +646,7 @@ A graph with a reusable "double" subnet: "type": "graphInput", "props": [{ "name": "portName", "value": "x" }] }, - { "name": "mult", "type": "math/multiply", "props": [{ "name": "b", "value": 2 }] }, + { "name": "mult", "type": "math:multiply", "props": [{ "name": "b", "value": 2 }] }, { "name": "output_result", "type": "graphOutput", @@ -704,7 +704,7 @@ graph = insertNode(graph, '/', { }); // Add processing node -graph = insertNode(graph, '/', { name: 'add1', type: 'math/add' }); +graph = insertNode(graph, '/', { name: 'add1', type: 'math:add' }); // Connect edges (reference nodes by their keys) graph = addEdge(graph, '/', { diff --git a/packages/spec/graph.schema.json b/packages/spec/graph.schema.json index 30585c4..386eb6a 100644 --- a/packages/spec/graph.schema.json +++ b/packages/spec/graph.schema.json @@ -170,7 +170,8 @@ "name": { "type": "string", "minLength": 1, - "description": "Local identifier within the context (e.g., 'add', 'template', 'request')." + "pattern": "^[^/]+$", + "description": "Local identifier within the context (e.g., 'add', 'template', 'request'). Slash (/) is not allowed." }, "category": { "type": "string", diff --git a/packages/types/README.md b/packages/types/README.md index 6010e7c..75f87fb 100644 --- a/packages/types/README.md +++ b/packages/types/README.md @@ -316,15 +316,14 @@ The `type` field on a `Node` identifies what kind of processing the node perform ### Format ``` -category:name[/route] +category:name ``` * **`category`** (required) — domain grouping (e.g. `math`, `const`, `email`, `json`) -* **`name`** (required) — action name within the category (e.g. `add`, `string`, `send`) -* **`/route`** (optional) — sub-route for multi-method containers where a single service handles multiple actions +* **`name`** (required) — action name within the category (e.g. `add`, `string`, `send`). The name doubles as the HTTP route for HTTP-dispatched nodes. The **colon** (`:`) separates category from name. -The **slash** (`/`) is reserved for optional routing within a function and must not be used as the category separator. +The **slash** (`/`) character is **not allowed** in node type names. ### Examples @@ -333,7 +332,6 @@ math:add — pure math addition const:string — constant string value email:send — send an email json:select — extract a value from JSON -email:postmaster/send — "send" route within the "postmaster" service ``` ### Boundary Nodes diff --git a/packages/types/graph.schema.json b/packages/types/graph.schema.json index 8f6310d..bdbfcd8 100644 --- a/packages/types/graph.schema.json +++ b/packages/types/graph.schema.json @@ -143,7 +143,8 @@ "type": { "type": "string", "minLength": 1, - "description": "Unique type identifier, typically in format 'context/category/name' (e.g. 'js/math/add')." + "pattern": "^[^/]+$", + "description": "Unique type identifier in format 'category:name' (e.g. 'math:add'). Slash (/) is not allowed." }, "inputs": { "type": "array", diff --git a/packages/types/package.json b/packages/types/package.json index ae67615..9a8c330 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@fbp/types", - "version": "1.1.0", + "version": "1.2.0", "author": "Dan Lynch ", "description": "Flow-Based Programming schemas and converters in TypeScript", "main": "index.js",