@octanejs/mcp-server 0.2.6 → 0.2.8

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.
package/README.md CHANGED
@@ -57,11 +57,12 @@ maintainer tools):
57
57
 
58
58
  ## Tools (always available)
59
59
 
60
- The server initialization instructions direct coding agents to call
61
- `octane_engineering_plan` and load `build-octane-software` before creating or
62
- materially changing Octane code. This makes the correctness, performance
63
- evidence, adversarial self-review, and handoff requirements available even when
64
- the host does not automatically discover skills.
60
+ The server initialization instructions are one orienting sentence plus a pointer
61
+ to `octane_engineering_plan`, because they are injected into every session
62
+ whether or not it touches Octane. The correctness, performance-evidence,
63
+ self-review, and handoff requirements live in that tool response, so they stay
64
+ reachable even on hosts that do not discover skills. Each tool description says
65
+ when to call it.
65
66
 
66
67
  ### `octane_engineering_plan`
67
68
 
@@ -112,24 +113,30 @@ without registering its React-package mapping fails CI.
112
113
 
113
114
  Returns a skill by name. Bundled skills (shipped with this package):
114
115
 
115
- - `bridge-react-package` the full workflow for porting a React library.
116
- - `build-octane-software` production engineering, performance, validation,
116
+ - `bridge-react-package`: the full workflow for porting a React library.
117
+ - `build-octane-software`: production engineering, performance, validation,
117
118
  and adversarial self-review gates for Octane code.
118
- - `migrate-react-component` React JSX to `.tsrx` conversion reference.
119
- - `react-divergences` Octane's intentional differences from React.
120
- - `setup-ssr` server rendering and hydration setup.
119
+ - `migrate-react-component`: React JSX to `.tsrx` conversion reference.
120
+ - `react-divergences`: Octane's intentional differences from React.
121
+ - `setup-ssr`: server rendering and hydration setup.
121
122
 
122
- When running inside the octane monorepo, the maintainer skills from
123
- `.ai/skills` are also available: `react-library-port`, `bug-hunter`,
123
+ When running inside the octane monorepo, the skills from `.rulesync/skills` are
124
+ also available: `authoring-tsrx`, `react-library-port`, `bug-hunter`,
124
125
  `create-a-pr`, `handle-issue`, `octane-core-extend`, `triage`,
125
- `performance-audit`.
126
+ `performance-audit`. A test compares this map against the directory in both
127
+ directions, so a new skill cannot stay unreachable here. This tool reads the RuleSync source, and
128
+ `pnpm rules:generate` writes the per-agent copies (`.claude/skills/`,
129
+ `.github/skills/`, `.cursor/skills/`, `.gemini/skills/`) from the same text, so
130
+ hosts that discover skills natively and hosts that call this tool see the same
131
+ thing.
126
132
 
127
133
  ## Tools (octane monorepo only)
128
134
 
129
135
  ### `octane_project_map`
130
136
 
131
- Returns `.ai/project-map.md` with package layout, authoritative sources,
132
- invariants, and validation commands.
137
+ Returns `AGENTS.md`: the RuleSync-generated root rule, covering what Octane is,
138
+ which source owns which behavior, the intentional divergences from React, and the
139
+ validation commands. CI fails if it drifts from its source in `.rulesync/rules/`.
133
140
 
134
141
  ### `octane_triage_paths`
135
142
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@octanejs/mcp-server",
3
- "version": "0.2.6",
3
+ "version": "0.2.8",
4
4
  "type": "module",
5
5
  "engines": {
6
6
  "node": ">=22"
@@ -36,7 +36,7 @@
36
36
  "zod": "^4.4.3"
37
37
  },
38
38
  "devDependencies": {
39
- "vitest": "^4.1.9"
39
+ "vitest": "^4.1.10"
40
40
  },
41
41
  "scripts": {
42
42
  "start": "node src/index.js",
package/src/bridge.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import { readdir, readFile } from 'node:fs/promises';
2
2
  import { join, resolve } from 'node:path';
3
3
 
4
- // React package → maintained @octanejs binding. bridge.test.js derives the
5
- // expected value set from the workspace manifests, so publishing a new binding
6
- // without registering it here fails the mcp-server tests.
4
+ // React package → maintained @octanejs binding. Bindings with no React-package
5
+ // equivalent live in KNOWN_NATIVE_BINDINGS below. bridge.test.js derives the
6
+ // expected union from the workspace manifests, so publishing a new binding
7
+ // without registering it in either catalog fails the mcp-server tests.
7
8
  export const KNOWN_BINDINGS = {
8
9
  zustand: '@octanejs/zustand',
9
10
  jotai: '@octanejs/jotai',
@@ -14,6 +15,9 @@ export const KNOWN_BINDINGS = {
14
15
  '@tanstack/react-query': '@octanejs/tanstack-query',
15
16
  '@tanstack/react-router': '@octanejs/tanstack-router',
16
17
  '@tanstack/react-store': '@octanejs/tanstack-store',
18
+ '@tanstack/react-router-ssr-query': '@octanejs/tanstack-router-ssr-query',
19
+ '@tanstack/react-hotkeys': '@octanejs/tanstack-hotkeys',
20
+ '@tanstack/react-pacer': '@octanejs/tanstack-pacer',
17
21
  '@tanstack/react-table': '@octanejs/tanstack-table',
18
22
  '@tanstack/react-virtual': '@octanejs/tanstack-virtual',
19
23
  'framer-motion': '@octanejs/motion',
@@ -35,6 +39,7 @@ export const KNOWN_BINDINGS = {
35
39
  '@base-ui-components/react': '@octanejs/base-ui',
36
40
  '@dnd-kit/react': '@octanejs/dnd-kit',
37
41
  sonner: '@octanejs/sonner',
42
+ shadcn: '@octanejs/shadcn',
38
43
  recharts: '@octanejs/recharts',
39
44
  '@react-three/fiber': '@octanejs/three',
40
45
  '@visx/visx': '@octanejs/visx',
@@ -94,11 +99,18 @@ export const KNOWN_BINDINGS = {
94
99
  'dexie-react-hooks': '@octanejs/dexie',
95
100
  };
96
101
 
102
+ // Octane-specific ecosystem packages that have no React import to rewrite.
103
+ // Keep these out of KNOWN_BINDINGS so the React bridge never invents a source
104
+ // package mapping for native tooling.
105
+ export const KNOWN_NATIVE_BINDINGS = new Set(['@octanejs/devtools']);
106
+
97
107
  // Workspace directory names for the maintained bindings. Keep this derived
98
- // from KNOWN_BINDINGS so repository path routing cannot drift from the public
108
+ // from both catalogs so repository path routing cannot drift from the public
99
109
  // binding list (aliases such as `motion` intentionally collapse to one dir).
100
110
  export const KNOWN_BINDING_PACKAGE_DIRS = new Set(
101
- Object.values(KNOWN_BINDINGS).map((name) => name.slice('@octanejs/'.length)),
111
+ [...Object.values(KNOWN_BINDINGS), ...KNOWN_NATIVE_BINDINGS].map((name) =>
112
+ name.slice('@octanejs/'.length),
113
+ ),
102
114
  );
103
115
 
104
116
  export const KNOWN_VANILLA_CORES = {
@@ -10,6 +10,7 @@ import {
10
10
  detectVanillaCore,
11
11
  scanSource,
12
12
  KNOWN_BINDINGS,
13
+ KNOWN_NATIVE_BINDINGS,
13
14
  KNOWN_BINDING_PACKAGE_DIRS,
14
15
  } from './bridge.js';
15
16
 
@@ -267,7 +268,7 @@ describe('KNOWN_BINDINGS', () => {
267
268
  // metaframeworks and infrastructure cannot drift into the binding catalog.
268
269
  const bindings = getBindingPackages();
269
270
  expect(bindings.length).toBeGreaterThan(0);
270
- expect(new Set(Object.values(KNOWN_BINDINGS))).toEqual(
271
+ expect(new Set([...Object.values(KNOWN_BINDINGS), ...KNOWN_NATIVE_BINDINGS])).toEqual(
271
272
  new Set(bindings.map(({ name }) => name)),
272
273
  );
273
274
  expect(KNOWN_BINDING_PACKAGE_DIRS).toEqual(new Set(bindings.map(({ dir }) => dir)));
package/src/index.js CHANGED
@@ -13,9 +13,10 @@ const __filename = fileURLToPath(import.meta.url);
13
13
  const PACKAGE_ROOT = resolve(dirname(__filename), '..');
14
14
 
15
15
  // Bundled skills ship with the npm package and work in ANY project using
16
- // octane. Repo skills live in the octane monorepo's .ai/skills and are only
17
- // available when the server runs against a checkout (they cover maintainer
18
- // workflows: triage, PRs, core changes).
16
+ // octane. Repo skills are read from the RuleSync source, not a generated copy,
17
+ // so this server and every per-agent output (.claude/skills, .github/skills,
18
+ // …) serve the same text. They cover maintainer workflows: triage, PRs, core
19
+ // changes, and are only available when the server runs against a checkout.
19
20
  export const BUNDLED_SKILLS = {
20
21
  'bridge-react-package': 'skills/bridge-react-package.md',
21
22
  'build-octane-software': 'skills/build-octane-software.md',
@@ -25,13 +26,14 @@ export const BUNDLED_SKILLS = {
25
26
  };
26
27
 
27
28
  export const REPO_SKILLS = {
28
- 'bug-hunter': '.ai/skills/bug-hunter.md',
29
- 'create-a-pr': '.ai/skills/create-a-pr.md',
30
- 'handle-issue': '.ai/skills/handle-issue.md',
31
- 'octane-core-extend': '.ai/skills/octane-core-extend.md',
32
- 'performance-audit': '.ai/skills/performance-audit.md',
33
- 'react-library-port': '.ai/skills/react-library-port.md',
34
- triage: '.ai/skills/triage.md',
29
+ 'authoring-tsrx': '.rulesync/skills/authoring-tsrx/SKILL.md',
30
+ 'bug-hunter': '.rulesync/skills/bug-hunter/SKILL.md',
31
+ 'create-a-pr': '.rulesync/skills/create-a-pr/SKILL.md',
32
+ 'handle-issue': '.rulesync/skills/handle-issue/SKILL.md',
33
+ 'octane-core-extend': '.rulesync/skills/octane-core-extend/SKILL.md',
34
+ 'performance-audit': '.rulesync/skills/performance-audit/SKILL.md',
35
+ 'react-library-port': '.rulesync/skills/react-library-port/SKILL.md',
36
+ triage: '.rulesync/skills/triage/SKILL.md',
35
37
  };
36
38
 
37
39
  // Suite names from the unified runner manifest (`SUITES` in
@@ -48,6 +50,7 @@ export const BENCHMARK_SUITES = [
48
50
  'recursive-context',
49
51
  'signal-favoring',
50
52
  'news',
53
+ 'hydration-interactivity',
51
54
  'effectful-list',
52
55
  'memo-wall',
53
56
  'portal-swarm',
@@ -62,6 +65,7 @@ export const BENCHMARK_SUITES = [
62
65
  'async-waterfall',
63
66
  'async-composition',
64
67
  'lynx-list',
68
+ 'lynx-bundle-size',
65
69
  'codegen-size',
66
70
  'bundle-size',
67
71
  'three-renderer',
@@ -71,10 +75,15 @@ export const BENCHMARK_SUITES = [
71
75
  const DEFAULT_TIMEOUT_MS = 120_000;
72
76
 
73
77
  export function instructionsFor(repoMode) {
78
+ // This text is injected into every session of every connected agent, whether
79
+ // or not it touches Octane, so it stays one orienting sentence plus one
80
+ // pointer. The gates themselves live in octane_engineering_plan, and each
81
+ // tool's own description says when to call it: that is where a model looks
82
+ // when it is actually deciding.
74
83
  const common =
75
- 'Before creating or materially changing Octane software, call octane_engineering_plan and load the build-octane-software skill. Treat its correctness, performance evidence, and adversarial self-review gates as required. Load the task-specific migration, binding, divergence, or SSR skill in addition when relevant. Do not claim a performance improvement without comparable measurements.';
84
+ "Octane is a compiler-first UI framework with React's programming model, so React habits are the main source of wrong changes here. Before creating or materially changing Octane code, call octane_engineering_plan: it returns the gates that apply and names the skills to load.";
76
85
  return repoMode
77
- ? `${common} For Octane framework-fundamental work, also load octane-core-extend and performance-audit, establish a relevant baseline before editing, and use octane_validate_plan for the final changed paths.`
86
+ ? `${common} Inside this monorepo checkout it also returns the repository validation commands for the paths you changed.`
78
87
  : common;
79
88
  }
80
89
 
@@ -108,7 +117,7 @@ export function areaForPath(path) {
108
117
  if (path.startsWith('benchmarks/')) return 'benchmark';
109
118
  if (path.startsWith('website/')) return 'website';
110
119
  if (path.startsWith('.rulesync/')) return 'rulesync-source';
111
- if (path.startsWith('.ai/') || path.startsWith('.codex/') || path.startsWith('.claude/')) {
120
+ if (path.startsWith('.codex/') || path.startsWith('.claude/')) {
112
121
  return 'agent-instructions';
113
122
  }
114
123
  if (path.startsWith('docs/') || path.endsWith('.md')) return 'docs';
@@ -390,7 +399,7 @@ function registerUserTools(server, repoRoot, repoMode) {
390
399
  {
391
400
  title: 'Octane skill',
392
401
  description:
393
- 'Return an Octane agent skill by name. Load build-octane-software before creating or materially changing Octane code; other bundled skills cover React package bridges, component migration, intentional divergences, and SSR setup.' +
402
+ 'Fetch an Octane agent skill by name. Call when starting work the skill covers: build-octane-software for engineering gates, bridge-react-package for porting a React library, migrate-react-component for JSX to .tsrx, react-divergences before assuming React behavior, setup-ssr for server rendering.' +
394
403
  (repoMode ? ' Repo skills cover octane maintainer workflows.' : ''),
395
404
  inputSchema: {
396
405
  name: z.enum(Object.keys(skills)),
@@ -476,12 +485,19 @@ function registerRepoTools(server, repoRoot) {
476
485
  {
477
486
  title: 'Octane project map',
478
487
  description:
479
- 'Return Octane repository map, source ownership, validation commands, and skill paths.',
488
+ 'Call when you need Octane repo orientation: what the framework is, which source owns which behavior, the intentional divergences from React, the validation commands, and the full package inventory.',
480
489
  inputSchema: {},
481
490
  },
482
491
  async () => {
483
- const projectMap = await readFile(resolve(repoRoot, '.ai/project-map.md'), 'utf8');
484
- return text(projectMap);
492
+ // Composed from the two generated sources rather than a hand-written
493
+ // summary, because both are CI-gated: AGENTS.md against .rulesync/rules,
494
+ // and packages.md against the workspace manifests. A third restatement
495
+ // would be the one free to drift.
496
+ const [rootRule, packages] = await Promise.all([
497
+ readFile(resolve(repoRoot, 'AGENTS.md'), 'utf8'),
498
+ readFile(resolve(repoRoot, 'docs/packages.md'), 'utf8'),
499
+ ]);
500
+ return text(`${rootRule.trimEnd()}\n\n---\n\n${packages.trimStart()}`);
485
501
  },
486
502
  );
487
503
 
@@ -489,7 +505,8 @@ function registerRepoTools(server, repoRoot) {
489
505
  'octane_triage_paths',
490
506
  {
491
507
  title: 'Triage Octane paths',
492
- description: 'Classify changed paths by Octane repo area.',
508
+ description:
509
+ 'Call before editing unfamiliar paths in this monorepo to learn which area owns them.',
493
510
  inputSchema: {
494
511
  paths: z.array(z.string()).describe('Repository-relative paths'),
495
512
  },
@@ -504,7 +521,8 @@ function registerRepoTools(server, repoRoot) {
504
521
  'octane_validate_plan',
505
522
  {
506
523
  title: 'Octane validation plan',
507
- description: 'Recommend validation commands for changed paths and task kind.',
524
+ description:
525
+ 'Call when a change is finished to get the validation commands that cover the paths you touched.',
508
526
  inputSchema: {
509
527
  paths: z.array(z.string()).default([]).describe('Repository-relative changed paths'),
510
528
  taskKind: z
@@ -534,7 +552,8 @@ function registerRepoTools(server, repoRoot) {
534
552
  'octane_scaffold_react_port',
535
553
  {
536
554
  title: 'Scaffold React test port',
537
- description: 'Run scripts/scaffold-react-port.mjs for a React upstream test file.',
555
+ description:
556
+ 'Call when porting a React test file into the conformance suite, returns a triage skeleton of in-scope cases and out-of-scope reasons.',
538
557
  inputSchema: {
539
558
  reactTestFile: z
540
559
  .string()
package/src/index.test.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { describe, expect, it } from 'vitest';
2
2
  import { Client } from '@modelcontextprotocol/sdk/client/index.js';
3
3
  import { InMemoryTransport } from '@modelcontextprotocol/sdk/inMemory.js';
4
- import { existsSync } from 'node:fs';
4
+ import { existsSync, readdirSync } from 'node:fs';
5
5
  import { mkdir, mkdtemp, readFile, writeFile } from 'node:fs/promises';
6
6
  import { tmpdir } from 'node:os';
7
7
  import { dirname, join, resolve } from 'node:path';
@@ -10,6 +10,7 @@ import {
10
10
  areaForPath,
11
11
  BENCHMARK_SUITES,
12
12
  BUNDLED_SKILLS,
13
+ REPO_SKILLS,
13
14
  createServer,
14
15
  engineeringPlanFor,
15
16
  isOctaneRepo,
@@ -173,20 +174,50 @@ describe('@octanejs/mcp-server helpers', () => {
173
174
  }
174
175
  });
175
176
 
176
- it('advertises the engineering gates during MCP initialization', async () => {
177
+ it('routes to the engineering gates without restating them at initialization', async () => {
178
+ // Initialization instructions are injected into every session, so they stay
179
+ // short and point at the tool. The gates themselves must still be reachable
180
+ //: that is the contract, not any particular wording.
177
181
  const server = createServer({ repoRoot: resolve(PACKAGE_ROOT, '../..') });
178
182
  const client = new Client({ name: 'octane-mcp-test', version: '1.0.0' });
179
183
  const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
180
184
 
181
185
  try {
182
186
  await Promise.all([server.connect(serverTransport), client.connect(clientTransport)]);
183
- expect(client.getInstructions()).toContain(
184
- 'Before creating or materially changing Octane software',
185
- );
186
- expect(client.getInstructions()).toContain('establish a relevant baseline before editing');
187
+ const instructions = client.getInstructions();
188
+ expect(instructions).toContain('octane_engineering_plan');
189
+ expect(instructions.length).toBeLessThan(600);
187
190
 
188
191
  const tools = await client.listTools();
189
192
  expect(tools.tools.map((tool) => tool.name)).toContain('octane_engineering_plan');
193
+
194
+ const plan = await client.callTool({
195
+ name: 'octane_engineering_plan',
196
+ arguments: { scope: 'framework-core', changeKind: 'performance' },
197
+ });
198
+ const body = plan.content[0].text;
199
+ expect(body).toContain('Identify hot paths and record a relevant baseline before editing.');
200
+ expect(body).toContain('build-octane-software');
201
+ } finally {
202
+ await client.close();
203
+ await server.close();
204
+ }
205
+ });
206
+
207
+ it('serves the project map from both generated, CI-gated sources', async () => {
208
+ // A hand-written map is the copy free to drift, which is why the old one
209
+ // did. Both halves here are regenerated and checked by CI.
210
+ const server = createServer({ repoRoot: resolve(PACKAGE_ROOT, '../..') });
211
+ const client = new Client({ name: 'octane-mcp-test', version: '1.0.0' });
212
+ const [clientTransport, serverTransport] = InMemoryTransport.createLinkedPair();
213
+
214
+ try {
215
+ await Promise.all([server.connect(serverTransport), client.connect(clientTransport)]);
216
+ const map = (await client.callTool({ name: 'octane_project_map', arguments: {} })).content[0]
217
+ .text;
218
+ expect(map).toContain('Your React instincts are the main failure mode here');
219
+ expect(map).toContain('Package inventory (generated)');
220
+ expect(map).toContain('framework binding');
190
221
  } finally {
191
222
  await client.close();
192
223
  await server.close();
@@ -207,6 +238,26 @@ describe('@octanejs/mcp-server helpers', () => {
207
238
  }
208
239
  });
209
240
 
241
+ it('serves every RuleSync skill, and only skills that exist', async () => {
242
+ // Checking that each mapped path resolves catches a dangling entry but not
243
+ // a missing one, which is how authoring-tsrx was added to .rulesync and
244
+ // stayed unreachable through octane_skill. Compare both directions.
245
+ const repoRoot = resolve(PACKAGE_ROOT, '../..');
246
+ const onDisk = readdirSync(resolve(repoRoot, '.rulesync/skills'), { withFileTypes: true })
247
+ .filter((entry) => entry.isDirectory())
248
+ .map((entry) => entry.name)
249
+ .sort();
250
+
251
+ expect(Object.keys(REPO_SKILLS).sort()).toEqual(onDisk);
252
+
253
+ for (const file of Object.values(REPO_SKILLS)) {
254
+ expect(file.startsWith('.rulesync/skills/')).toBe(true);
255
+ expect(existsSync(resolve(repoRoot, file))).toBe(true);
256
+ const body = await readFile(resolve(repoRoot, file), 'utf8');
257
+ expect(body).toMatch(/^---\n[\s\S]*?\ndescription: /);
258
+ }
259
+ });
260
+
210
261
  it('runs the React port scaffolder wrapper', async () => {
211
262
  const repoRoot = await mkdtemp(join(tmpdir(), 'octane-mcp-test-'));
212
263
  await mkdir(join(repoRoot, 'scripts'), { recursive: true });