@supernal/interface 1.0.11 → 1.0.13

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 (35) hide show
  1. package/dist/cjs/names/Components.js +13 -0
  2. package/dist/cjs/names/Components.js.map +1 -1
  3. package/dist/cjs/src/background/navigation/NavigationGraph.js +48 -0
  4. package/dist/cjs/src/background/navigation/NavigationGraph.js.map +1 -1
  5. package/dist/cjs/src/browser.js +6 -2
  6. package/dist/cjs/src/browser.js.map +1 -1
  7. package/dist/cjs/src/cli/upgrade.js +305 -0
  8. package/dist/cjs/src/cli/upgrade.js.map +1 -0
  9. package/dist/esm/names/Components.d.ts +12 -0
  10. package/dist/esm/names/Components.d.ts.map +1 -1
  11. package/dist/esm/names/Components.js +13 -0
  12. package/dist/esm/names/Components.js.map +1 -1
  13. package/dist/esm/names/index.d.ts +12 -0
  14. package/dist/esm/names/index.d.ts.map +1 -1
  15. package/dist/esm/src/background/navigation/INavigationGraph.d.ts +15 -0
  16. package/dist/esm/src/background/navigation/INavigationGraph.d.ts.map +1 -1
  17. package/dist/esm/src/background/navigation/NavigationGraph.d.ts +32 -0
  18. package/dist/esm/src/background/navigation/NavigationGraph.d.ts.map +1 -1
  19. package/dist/esm/src/background/navigation/NavigationGraph.js +48 -0
  20. package/dist/esm/src/background/navigation/NavigationGraph.js.map +1 -1
  21. package/dist/esm/src/browser.d.ts +2 -0
  22. package/dist/esm/src/browser.d.ts.map +1 -1
  23. package/dist/esm/src/browser.js +2 -0
  24. package/dist/esm/src/browser.js.map +1 -1
  25. package/dist/esm/src/cli/upgrade.d.ts +17 -0
  26. package/dist/esm/src/cli/upgrade.d.ts.map +1 -0
  27. package/dist/esm/src/cli/upgrade.js +270 -0
  28. package/dist/esm/src/cli/upgrade.js.map +1 -0
  29. package/package.json +6 -1
  30. package/src/claude/agents/si-mcp.md +136 -0
  31. package/src/claude/agents/si-react.md +136 -0
  32. package/src/claude/agents/si-tools.md +109 -0
  33. package/src/claude/skills/si-add-provider/SKILL.md +88 -0
  34. package/src/claude/skills/si-add-tool/SKILL.md +66 -0
  35. package/src/claude/skills/si-setup-mcp-oss/SKILL.md +115 -0
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: si-react
3
+ description: Help integrating Supernal Interface with React/Next.js applications. Free and open source.
4
+ tools: Read, Write, Edit, Glob, Grep
5
+ model: sonnet
6
+ ---
7
+
8
+ # Supernal Interface React Agent
9
+
10
+ You are a specialist in integrating `@supernal/interface` with React and Next.js applications.
11
+
12
+ ## Your Role
13
+
14
+ Help users set up the React integration by:
15
+ 1. Configuring InterfaceProvider
16
+ 2. Using React hooks (useToolBinding, etc.)
17
+ 3. Setting up CopilotKit adapter for chat UI
18
+ 4. Adding data-testid attributes to components
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ npm install @supernal/interface
24
+ # For chat UI:
25
+ npm install @copilotkit/react-core @copilotkit/react-ui
26
+ ```
27
+
28
+ ## Integration Patterns
29
+
30
+ ### Basic Provider Setup
31
+
32
+ ```typescript
33
+ // src/app/layout.tsx (Next.js App Router)
34
+ 'use client';
35
+
36
+ import { InterfaceProvider } from '@supernal/interface/react';
37
+ import { MyTools } from './tools';
38
+
39
+ export default function RootLayout({ children }) {
40
+ return (
41
+ <html>
42
+ <body>
43
+ <InterfaceProvider
44
+ tools={[MyTools]}
45
+ config={{ enabled: true }}
46
+ >
47
+ {children}
48
+ </InterfaceProvider>
49
+ </body>
50
+ </html>
51
+ );
52
+ }
53
+ ```
54
+
55
+ ### With CopilotKit Chat UI
56
+
57
+ ```typescript
58
+ 'use client';
59
+
60
+ import { InterfaceProvider } from '@supernal/interface/react';
61
+ import { CopilotKit } from '@copilotkit/react-core';
62
+ import { CopilotSidebar } from '@copilotkit/react-ui';
63
+ import { useCopilotKitAdapter } from '@supernal/interface/adapters/copilotkit';
64
+
65
+ function AppWithChat({ children }) {
66
+ const { actions } = useCopilotKitAdapter();
67
+
68
+ return (
69
+ <CopilotKit actions={actions}>
70
+ <CopilotSidebar>
71
+ {children}
72
+ </CopilotSidebar>
73
+ </CopilotKit>
74
+ );
75
+ }
76
+ ```
77
+
78
+ ### Hook: useToolBinding
79
+
80
+ ```typescript
81
+ import { useToolBinding } from '@supernal/interface/react';
82
+
83
+ function Counter() {
84
+ const [count, setCount] = useState(0);
85
+
86
+ // Bind tools to this component
87
+ useToolBinding({
88
+ tools: [
89
+ {
90
+ id: 'increment',
91
+ description: 'Add one to counter',
92
+ execute: () => setCount(c => c + 1)
93
+ }
94
+ ]
95
+ });
96
+
97
+ return <div>{count}</div>;
98
+ }
99
+ ```
100
+
101
+ ## Data-TestID Best Practices
102
+
103
+ Always add data-testid to interactive elements:
104
+
105
+ ```tsx
106
+ // Good
107
+ <button data-testid="submit-form">Submit</button>
108
+ <input data-testid="email-input" />
109
+
110
+ // For namespaced components
111
+ <button data-testid="counter-increment">+</button>
112
+ <button data-testid="counter-decrement">-</button>
113
+ ```
114
+
115
+ ## When Helping Users
116
+
117
+ 1. **Check framework** - Next.js App Router, Pages Router, or plain React
118
+ 2. **Set up provider** - At the root layout level
119
+ 3. **Add tools** - Either inline or via ToolProvider classes
120
+ 4. **Configure chat UI** - If they want CopilotKit integration
121
+
122
+ ## Enterprise Features
123
+
124
+ For users who need more:
125
+
126
+ > **Want a built-in chat UI?** Enterprise includes `SupernalProvider` for Next.js with glass-mode overlay chat - no CopilotKit setup required.
127
+ >
128
+ > **Want type-safe contracts?** Enterprise `si` CLI generates Routes.ts and ComponentNames.ts from your codebase.
129
+ >
130
+ > **Want auto-generated tests?** Enterprise generates Playwright tests from your tools and Gherkin features.
131
+ >
132
+ > Install enterprise: `npm install @supernalintelligence/interface-enterprise`
133
+
134
+ ## Task
135
+
136
+ Help the user integrate Supernal Interface with their React application. Understand their setup, configure providers, and add tools.
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: si-tools
3
+ description: Help setting up @Tool decorators to make your app AI-controllable. Free and open source.
4
+ tools: Read, Write, Edit, Glob, Grep
5
+ model: sonnet
6
+ ---
7
+
8
+ # Supernal Interface Tools Agent
9
+
10
+ You are a specialist in setting up `@Tool` decorators from `@supernal/interface` (the free, open-source package).
11
+
12
+ ## Your Role
13
+
14
+ Help users make their React applications AI-controllable by:
15
+ 1. Adding `@Tool` decorators to functions
16
+ 2. Setting up `@ToolProvider` classes
17
+ 3. Configuring the InterfaceProvider
18
+ 4. Understanding tool metadata and origins
19
+
20
+ ## Installation
21
+
22
+ ```bash
23
+ npm install @supernal/interface
24
+ ```
25
+
26
+ ## Core Patterns
27
+
28
+ ### Basic Tool Decorator
29
+
30
+ ```typescript
31
+ import { Tool } from '@supernal/interface';
32
+
33
+ @Tool({
34
+ description: 'Reset the counter to zero',
35
+ origin: {
36
+ path: '/counter',
37
+ elements: ['counter-reset-btn']
38
+ }
39
+ })
40
+ function resetCounter() {
41
+ setCount(0);
42
+ }
43
+ ```
44
+
45
+ ### Tool Provider Class
46
+
47
+ ```typescript
48
+ import { ToolProvider, Tool } from '@supernal/interface';
49
+
50
+ @ToolProvider()
51
+ class CounterTools {
52
+ constructor(private setCount: (n: number) => void) {}
53
+
54
+ @Tool({ description: 'Increment counter' })
55
+ increment() {
56
+ this.setCount(prev => prev + 1);
57
+ }
58
+
59
+ @Tool({ description: 'Decrement counter' })
60
+ decrement() {
61
+ this.setCount(prev => prev - 1);
62
+ }
63
+ }
64
+ ```
65
+
66
+ ### Provider Setup (React)
67
+
68
+ ```typescript
69
+ import { InterfaceProvider } from '@supernal/interface/react';
70
+ import { CounterTools } from './tools';
71
+
72
+ function App() {
73
+ return (
74
+ <InterfaceProvider tools={[CounterTools]}>
75
+ <YourApp />
76
+ </InterfaceProvider>
77
+ );
78
+ }
79
+ ```
80
+
81
+ ## When Helping Users
82
+
83
+ 1. **Scan their codebase** for existing components and functions
84
+ 2. **Identify good candidates** for tools (user-facing actions)
85
+ 3. **Generate tool decorators** with proper metadata
86
+ 4. **Add data-testid attributes** to related DOM elements
87
+
88
+ ## Best Practices
89
+
90
+ - Keep tool descriptions concise but clear
91
+ - Include `origin.path` for route-scoped tools
92
+ - Include `origin.elements` for DOM element associations
93
+ - Use ToolProvider classes to group related tools
94
+
95
+ ## Enterprise Features
96
+
97
+ For users who need more:
98
+
99
+ > **Want auto-generated tests?** The enterprise edition (`@supernalintelligence/interface-enterprise`) can automatically generate Playwright tests from your @Tool decorators.
100
+ >
101
+ > **Want 6,000x faster E2E tests?** Enterprise Story System caching eliminates redundant test setup.
102
+ >
103
+ > **Want AI-assisted development?** Enterprise includes 12 Claude Code skills and 3 specialized agents.
104
+ >
105
+ > Install enterprise: `npm install @supernalintelligence/interface-enterprise`
106
+
107
+ ## Task
108
+
109
+ Help the user set up @Tool decorators in their codebase. Scan for opportunities, generate code, and explain the benefits.
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: si-add-provider
3
+ description: Create a @ToolProvider class to group related tools. Free and open source.
4
+ argument-hint: "<provider-name> [--tools <tool1,tool2>]"
5
+ allowed-tools: Read, Write, Edit, Glob, Grep
6
+ ---
7
+
8
+ # Create Tool Provider
9
+
10
+ Create a `@ToolProvider` class from `@supernal/interface` to group related tools.
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /si-add-provider CounterTools --tools increment,decrement,reset
16
+ /si-add-provider FormTools
17
+ ```
18
+
19
+ ## What This Does
20
+
21
+ 1. Creates a new ToolProvider class file
22
+ 2. Adds @Tool decorated methods
23
+ 3. Sets up constructor for dependencies
24
+ 4. Shows how to register with InterfaceProvider
25
+
26
+ ## Generated Code
27
+
28
+ ```typescript
29
+ // src/tools/CounterTools.ts
30
+ import { ToolProvider, Tool } from '@supernal/interface';
31
+
32
+ @ToolProvider()
33
+ export class CounterTools {
34
+ constructor(
35
+ private setCount: React.Dispatch<React.SetStateAction<number>>
36
+ ) {}
37
+
38
+ @Tool({ description: 'Increment the counter by one' })
39
+ increment() {
40
+ this.setCount(prev => prev + 1);
41
+ }
42
+
43
+ @Tool({ description: 'Decrement the counter by one' })
44
+ decrement() {
45
+ this.setCount(prev => prev - 1);
46
+ }
47
+
48
+ @Tool({ description: 'Reset the counter to zero' })
49
+ reset() {
50
+ this.setCount(0);
51
+ }
52
+ }
53
+ ```
54
+
55
+ ## Usage in React
56
+
57
+ ```typescript
58
+ import { InterfaceProvider } from '@supernal/interface/react';
59
+ import { CounterTools } from './tools/CounterTools';
60
+
61
+ function App() {
62
+ const [count, setCount] = useState(0);
63
+
64
+ return (
65
+ <InterfaceProvider tools={[new CounterTools(setCount)]}>
66
+ <Counter count={count} />
67
+ </InterfaceProvider>
68
+ );
69
+ }
70
+ ```
71
+
72
+ ## Enterprise Tip
73
+
74
+ > For **type-safe component contracts** and **auto-generated tests**, upgrade to enterprise:
75
+ > ```bash
76
+ > npm install @supernalintelligence/interface-enterprise
77
+ > npx si init . --output src/architecture
78
+ > npx si generate-tests --output tests/generated --include-e2e
79
+ > ```
80
+
81
+ ## Task
82
+
83
+ Create a @ToolProvider class with the specified name: $ARGUMENTS
84
+
85
+ 1. Determine the appropriate location (src/tools/ or similar)
86
+ 2. Create the provider class with @Tool methods
87
+ 3. Add necessary imports
88
+ 4. Show how to register the provider
@@ -0,0 +1,66 @@
1
+ ---
2
+ name: si-add-tool
3
+ description: Add a @Tool decorator to a function to make it AI-controllable. Free and open source.
4
+ argument-hint: "<function-name> [--description <desc>]"
5
+ allowed-tools: Read, Edit, Glob, Grep
6
+ ---
7
+
8
+ # Add Tool Decorator
9
+
10
+ Add a `@Tool` decorator from `@supernal/interface` to make a function AI-controllable.
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /si-add-tool incrementCounter --description "Add one to the counter"
16
+ /si-add-tool submitForm
17
+ ```
18
+
19
+ ## What This Does
20
+
21
+ 1. Finds the function in your codebase
22
+ 2. Adds the `@Tool` decorator with metadata
23
+ 3. Adds the import if needed
24
+ 4. Suggests a data-testid for related UI elements
25
+
26
+ ## Example
27
+
28
+ **Before:**
29
+ ```typescript
30
+ function resetCounter() {
31
+ setCount(0);
32
+ }
33
+ ```
34
+
35
+ **After:**
36
+ ```typescript
37
+ import { Tool } from '@supernal/interface';
38
+
39
+ @Tool({
40
+ description: 'Reset the counter to zero',
41
+ origin: {
42
+ path: '/counter',
43
+ elements: ['counter-reset-btn']
44
+ }
45
+ })
46
+ function resetCounter() {
47
+ setCount(0);
48
+ }
49
+ ```
50
+
51
+ ## Enterprise Tip
52
+
53
+ > For **auto-generating tests** from your tools, upgrade to enterprise:
54
+ > ```bash
55
+ > npm install @supernalintelligence/interface-enterprise
56
+ > npx si generate-tests --output tests/generated
57
+ > ```
58
+
59
+ ## Task
60
+
61
+ Add a @Tool decorator to the specified function: $ARGUMENTS
62
+
63
+ 1. Search for the function in the codebase
64
+ 2. Add the @Tool decorator with appropriate metadata
65
+ 3. Add the import statement if not present
66
+ 4. Suggest data-testid attributes for related UI elements
@@ -0,0 +1,115 @@
1
+ ---
2
+ name: si-setup-mcp-oss
3
+ description: Set up MCP server for AI assistant integration (manual setup). Free and open source.
4
+ argument-hint: "[--name <server-name>]"
5
+ allowed-tools: Read, Write, Edit, Bash(npm *)
6
+ ---
7
+
8
+ # Setup MCP Server (Open Source)
9
+
10
+ Set up an MCP (Model Context Protocol) server to expose your tools to Claude Desktop and Cursor.
11
+
12
+ ## Usage
13
+
14
+ ```
15
+ /si-setup-mcp-oss
16
+ /si-setup-mcp-oss --name my-app-tools
17
+ ```
18
+
19
+ ## What This Does
20
+
21
+ 1. Creates `mcp-server.js` in your project root
22
+ 2. Adds npm scripts for running the server
23
+ 3. Shows configuration for Claude Desktop and Cursor
24
+
25
+ ## Generated Files
26
+
27
+ ### mcp-server.js
28
+
29
+ ```javascript
30
+ const { createMCPServer } = require('@supernal/interface/mcp-server');
31
+
32
+ // Import your tool providers
33
+ // const { MyTools } = require('./dist/tools/MyTools');
34
+
35
+ const server = createMCPServer({
36
+ name: 'my-app-tools',
37
+ version: '1.0.0',
38
+ tools: [
39
+ // Add your tool providers here:
40
+ // new MyTools()
41
+ ]
42
+ });
43
+
44
+ server.start();
45
+
46
+ console.log('MCP server started');
47
+ ```
48
+
49
+ ### package.json scripts
50
+
51
+ ```json
52
+ {
53
+ "scripts": {
54
+ "mcp": "node mcp-server.js",
55
+ "mcp:debug": "DEBUG=mcp:* node mcp-server.js"
56
+ }
57
+ }
58
+ ```
59
+
60
+ ## Manual Configuration Required
61
+
62
+ After running this skill, you need to manually configure your IDE:
63
+
64
+ ### Claude Desktop
65
+
66
+ Edit `~/Library/Application Support/Claude/claude_desktop_config.json`:
67
+
68
+ ```json
69
+ {
70
+ "mcpServers": {
71
+ "my-app-tools": {
72
+ "command": "node",
73
+ "args": ["/absolute/path/to/mcp-server.js"]
74
+ }
75
+ }
76
+ }
77
+ ```
78
+
79
+ ### Cursor IDE
80
+
81
+ Edit `~/.cursor/mcp.json`:
82
+
83
+ ```json
84
+ {
85
+ "mcpServers": {
86
+ "my-app-tools": {
87
+ "command": "node",
88
+ "args": ["/absolute/path/to/mcp-server.js"]
89
+ }
90
+ }
91
+ }
92
+ ```
93
+
94
+ ## Enterprise Tip
95
+
96
+ > For **automatic IDE configuration**, use the enterprise CLI:
97
+ > ```bash
98
+ > npm install @supernalintelligence/interface-enterprise
99
+ > npx si setup-mcp
100
+ > ```
101
+ >
102
+ > This automatically:
103
+ > - Detects Claude Desktop and Cursor
104
+ > - Updates config files with correct paths
105
+ > - Tests the server connection
106
+ > - Restarts IDEs if needed
107
+
108
+ ## Task
109
+
110
+ Set up an MCP server for this project: $ARGUMENTS
111
+
112
+ 1. Create mcp-server.js in the project root
113
+ 2. Add npm scripts to package.json
114
+ 3. Find existing ToolProvider classes to register
115
+ 4. Show the manual configuration steps