@supernal/interface 1.0.12 → 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.
@@ -0,0 +1,270 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * si-upgrade - Upgrade from open-source to enterprise
4
+ *
5
+ * Handles:
6
+ * 1. GitHub authentication check
7
+ * 2. npm registry configuration for @supernalintelligence scope
8
+ * 3. Enterprise package installation
9
+ * 4. Claude Code setup
10
+ *
11
+ * Usage:
12
+ * npx @supernal/interface upgrade
13
+ * # or if installed globally:
14
+ * si-oss upgrade
15
+ */
16
+ import { execSync, spawnSync } from 'child_process';
17
+ import * as fs from 'fs';
18
+ import * as path from 'path';
19
+ import * as readline from 'readline';
20
+ const ENTERPRISE_PACKAGE = '@supernalintelligence/interface-enterprise';
21
+ const REGISTRY = 'https://npm.pkg.github.com';
22
+ // Colors for terminal output
23
+ const colors = {
24
+ reset: '\x1b[0m',
25
+ bold: '\x1b[1m',
26
+ red: '\x1b[31m',
27
+ green: '\x1b[32m',
28
+ yellow: '\x1b[33m',
29
+ blue: '\x1b[34m',
30
+ cyan: '\x1b[36m',
31
+ };
32
+ function print(message) {
33
+ console.log(message);
34
+ }
35
+ function printHeader(message) {
36
+ print(`\n${colors.bold}${colors.cyan}${message}${colors.reset}\n`);
37
+ }
38
+ function printSuccess(message) {
39
+ print(`${colors.green}✓${colors.reset} ${message}`);
40
+ }
41
+ function printError(message) {
42
+ print(`${colors.red}✗${colors.reset} ${message}`);
43
+ }
44
+ function printWarning(message) {
45
+ print(`${colors.yellow}⚠${colors.reset} ${message}`);
46
+ }
47
+ function printInfo(message) {
48
+ print(`${colors.blue}→${colors.reset} ${message}`);
49
+ }
50
+ function commandExists(cmd) {
51
+ try {
52
+ execSync(`which ${cmd}`, { stdio: 'ignore' });
53
+ return true;
54
+ }
55
+ catch {
56
+ return false;
57
+ }
58
+ }
59
+ function runCommand(cmd, silent = false) {
60
+ try {
61
+ const output = execSync(cmd, {
62
+ encoding: 'utf-8',
63
+ stdio: silent ? 'pipe' : 'inherit',
64
+ });
65
+ return { success: true, output: output || '' };
66
+ }
67
+ catch (error) {
68
+ return { success: false, output: error.message || '' };
69
+ }
70
+ }
71
+ async function prompt(question) {
72
+ const rl = readline.createInterface({
73
+ input: process.stdin,
74
+ output: process.stdout,
75
+ });
76
+ return new Promise((resolve) => {
77
+ rl.question(question, (answer) => {
78
+ rl.close();
79
+ resolve(answer.trim());
80
+ });
81
+ });
82
+ }
83
+ async function checkGitHubAuth() {
84
+ printInfo('Checking GitHub authentication...');
85
+ if (!commandExists('gh')) {
86
+ printWarning('GitHub CLI (gh) not found.');
87
+ print('');
88
+ print(' Install it:');
89
+ print(' macOS: brew install gh');
90
+ print(' Windows: winget install GitHub.cli');
91
+ print(' Linux: https://cli.github.com/manual/installation');
92
+ print('');
93
+ return false;
94
+ }
95
+ const result = runCommand('gh auth status', true);
96
+ if (result.success) {
97
+ printSuccess('GitHub CLI authenticated');
98
+ return true;
99
+ }
100
+ printWarning('GitHub CLI not authenticated');
101
+ print('');
102
+ const answer = await prompt('Would you like to authenticate now? (y/n): ');
103
+ if (answer.toLowerCase() === 'y') {
104
+ printInfo('Starting GitHub authentication...');
105
+ const authResult = spawnSync('gh', ['auth', 'login'], {
106
+ stdio: 'inherit',
107
+ });
108
+ if (authResult.status === 0) {
109
+ printSuccess('GitHub authentication successful');
110
+ return true;
111
+ }
112
+ else {
113
+ printError('GitHub authentication failed');
114
+ return false;
115
+ }
116
+ }
117
+ return false;
118
+ }
119
+ async function configureNpmRegistry() {
120
+ printInfo('Configuring npm for GitHub Packages...');
121
+ // Check if already configured
122
+ try {
123
+ const npmrc = fs.readFileSync(path.join(process.env.HOME || '', '.npmrc'), 'utf-8');
124
+ if (npmrc.includes('@supernalintelligence:registry=')) {
125
+ printSuccess('npm already configured for @supernalintelligence');
126
+ return true;
127
+ }
128
+ }
129
+ catch {
130
+ // .npmrc doesn't exist, we'll create it
131
+ }
132
+ // Get GitHub token
133
+ let token = '';
134
+ try {
135
+ token = execSync('gh auth token', { encoding: 'utf-8' }).trim();
136
+ }
137
+ catch {
138
+ printError('Could not get GitHub token. Please run: gh auth login');
139
+ return false;
140
+ }
141
+ // Configure npm
142
+ const npmrcPath = path.join(process.env.HOME || '', '.npmrc');
143
+ const npmrcContent = `
144
+ //npm.pkg.github.com/:_authToken=${token}
145
+ @supernalintelligence:registry=${REGISTRY}
146
+ `.trim();
147
+ try {
148
+ let existingContent = '';
149
+ try {
150
+ existingContent = fs.readFileSync(npmrcPath, 'utf-8');
151
+ }
152
+ catch {
153
+ // File doesn't exist
154
+ }
155
+ // Append if not already present
156
+ if (!existingContent.includes('@supernalintelligence:registry=')) {
157
+ fs.appendFileSync(npmrcPath, '\n' + npmrcContent + '\n');
158
+ printSuccess('npm configured for GitHub Packages');
159
+ }
160
+ return true;
161
+ }
162
+ catch (error) {
163
+ printError(`Failed to configure npm: ${error.message}`);
164
+ return false;
165
+ }
166
+ }
167
+ async function installEnterprise() {
168
+ printInfo(`Installing ${ENTERPRISE_PACKAGE}...`);
169
+ const result = spawnSync('npm', ['install', '-D', ENTERPRISE_PACKAGE], {
170
+ stdio: 'inherit',
171
+ });
172
+ if (result.status === 0) {
173
+ printSuccess('Enterprise package installed');
174
+ return true;
175
+ }
176
+ else {
177
+ printError('Failed to install enterprise package');
178
+ return false;
179
+ }
180
+ }
181
+ async function runSetup() {
182
+ printInfo('Running enterprise setup...');
183
+ // Run si setup-claude
184
+ const setupResult = spawnSync('npx', ['si', 'setup-claude', '--force'], {
185
+ stdio: 'inherit',
186
+ });
187
+ if (setupResult.status === 0) {
188
+ printSuccess('Claude Code skills and agents installed');
189
+ }
190
+ else {
191
+ printWarning('Claude Code setup had issues (you can run it manually later)');
192
+ }
193
+ }
194
+ async function main() {
195
+ print('');
196
+ print(`${colors.bold}${colors.cyan}╔════════════════════════════════════════════════════════════╗${colors.reset}`);
197
+ print(`${colors.bold}${colors.cyan}║ Supernal Interface - Upgrade to Enterprise ║${colors.reset}`);
198
+ print(`${colors.bold}${colors.cyan}╚════════════════════════════════════════════════════════════╝${colors.reset}`);
199
+ print('');
200
+ print('This will upgrade your project from the free open-source package');
201
+ print('to the full enterprise edition with:');
202
+ print('');
203
+ print(` ${colors.green}+${colors.reset} 15 CLI commands (si init, si validate, etc.)`);
204
+ print(` ${colors.green}+${colors.reset} 12 Claude Code skills`);
205
+ print(` ${colors.green}+${colors.reset} 3 specialized AI agents`);
206
+ print(` ${colors.green}+${colors.reset} Story System (6,000x faster E2E tests)`);
207
+ print(` ${colors.green}+${colors.reset} Auto-generated tests from Gherkin and @Tool`);
208
+ print(` ${colors.green}+${colors.reset} Navigation graph validation`);
209
+ print('');
210
+ const proceed = await prompt('Continue with upgrade? (y/n): ');
211
+ if (proceed.toLowerCase() !== 'y') {
212
+ print('Upgrade cancelled.');
213
+ process.exit(0);
214
+ }
215
+ // Step 1: Check GitHub auth
216
+ printHeader('Step 1/4: GitHub Authentication');
217
+ const authOk = await checkGitHubAuth();
218
+ if (!authOk) {
219
+ printError('GitHub authentication required for enterprise package.');
220
+ print('');
221
+ print('Run this command to authenticate:');
222
+ print(' gh auth login');
223
+ print('');
224
+ print('Then run the upgrade again.');
225
+ process.exit(1);
226
+ }
227
+ // Step 2: Configure npm registry
228
+ printHeader('Step 2/4: Configure npm Registry');
229
+ const npmOk = await configureNpmRegistry();
230
+ if (!npmOk) {
231
+ printError('Failed to configure npm for GitHub Packages.');
232
+ process.exit(1);
233
+ }
234
+ // Step 3: Install enterprise package
235
+ printHeader('Step 3/4: Install Enterprise Package');
236
+ const installOk = await installEnterprise();
237
+ if (!installOk) {
238
+ printError('Failed to install enterprise package.');
239
+ print('');
240
+ print('You can try manually:');
241
+ print(` npm install -D ${ENTERPRISE_PACKAGE}`);
242
+ process.exit(1);
243
+ }
244
+ // Step 4: Run setup
245
+ printHeader('Step 4/4: Setup Claude Code Integration');
246
+ await runSetup();
247
+ // Done!
248
+ printHeader('Upgrade Complete!');
249
+ print('Your project now has the full enterprise edition.');
250
+ print('');
251
+ print(`${colors.bold}Available commands:${colors.reset}`);
252
+ print(' npx si --help Show all CLI commands');
253
+ print(' npx si init . Initialize contracts');
254
+ print(' npx si validate --all Validate everything');
255
+ print(' npx si generate-tests Generate tests');
256
+ print('');
257
+ print(`${colors.bold}Claude Code skills:${colors.reset}`);
258
+ print(' /si-init, /si-validate, /si-generate-tests, and 9 more');
259
+ print('');
260
+ print(`${colors.bold}Next steps:${colors.reset}`);
261
+ print(' 1. Run: npx si init . --output src/architecture');
262
+ print(' 2. Run: npx si validate --all');
263
+ print('');
264
+ }
265
+ // Run
266
+ main().catch((error) => {
267
+ printError(`Upgrade failed: ${error.message}`);
268
+ process.exit(1);
269
+ });
270
+ //# sourceMappingURL=upgrade.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"upgrade.js","sourceRoot":"","sources":["../../../../src/cli/upgrade.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;GAaG;AAEH,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAC7B,OAAO,KAAK,QAAQ,MAAM,UAAU,CAAC;AAErC,MAAM,kBAAkB,GAAG,4CAA4C,CAAC;AACxE,MAAM,QAAQ,GAAG,4BAA4B,CAAC;AAE9C,6BAA6B;AAC7B,MAAM,MAAM,GAAG;IACb,KAAK,EAAE,SAAS;IAChB,IAAI,EAAE,SAAS;IACf,GAAG,EAAE,UAAU;IACf,KAAK,EAAE,UAAU;IACjB,MAAM,EAAE,UAAU;IAClB,IAAI,EAAE,UAAU;IAChB,IAAI,EAAE,UAAU;CACjB,CAAC;AAEF,SAAS,KAAK,CAAC,OAAe;IAC5B,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AACvB,CAAC;AAED,SAAS,WAAW,CAAC,OAAe;IAClC,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AM;AACN,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACrB,UAAU,CAAC,mBAAmB,KAAK,CAAC,OAAO,EAAE,CAAC,CAAC;IAC/C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supernal/interface",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "Universal AI Interface - Make any application AI-controllable with decorators (Open Source Edition)",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",
@@ -135,8 +135,13 @@
135
135
  "ts-jest": "^29.4.6",
136
136
  "typescript": "^5.3.2"
137
137
  },
138
+ "bin": {
139
+ "si-oss": "./dist/cjs/src/cli/upgrade.js",
140
+ "supernal-upgrade": "./dist/cjs/src/cli/upgrade.js"
141
+ },
138
142
  "files": [
139
143
  "dist",
144
+ "src/claude",
140
145
  "README.md",
141
146
  "LICENSE"
142
147
  ],
@@ -0,0 +1,136 @@
1
+ ---
2
+ name: si-mcp
3
+ description: Help setting up MCP (Model Context Protocol) server for AI assistant integration. Free and open source.
4
+ tools: Read, Write, Edit, Bash(npm *), Bash(node *)
5
+ model: sonnet
6
+ ---
7
+
8
+ # Supernal Interface MCP Agent
9
+
10
+ You are a specialist in setting up MCP (Model Context Protocol) servers with `@supernal/interface`.
11
+
12
+ ## Your Role
13
+
14
+ Help users expose their @Tool decorated functions to AI assistants via MCP:
15
+ 1. Create an MCP server configuration
16
+ 2. Register with Claude Desktop or Cursor
17
+ 3. Test the connection
18
+ 4. Debug common issues
19
+
20
+ ## What is MCP?
21
+
22
+ MCP allows AI assistants to call functions in your application. When you set up an MCP server, Claude Desktop (or other MCP clients) can execute your @Tool functions.
23
+
24
+ ## Installation
25
+
26
+ ```bash
27
+ npm install @supernal/interface
28
+ ```
29
+
30
+ ## MCP Server Setup
31
+
32
+ ### 1. Create Server File
33
+
34
+ ```javascript
35
+ // mcp-server.js
36
+ const { createMCPServer } = require('@supernal/interface/mcp-server');
37
+
38
+ // Import your tools
39
+ const { MyTools } = require('./dist/tools');
40
+
41
+ const server = createMCPServer({
42
+ name: 'my-app-tools',
43
+ version: '1.0.0',
44
+ tools: [MyTools]
45
+ });
46
+
47
+ server.start();
48
+ ```
49
+
50
+ ### 2. Add npm Script
51
+
52
+ ```json
53
+ {
54
+ "scripts": {
55
+ "mcp": "node mcp-server.js",
56
+ "mcp:debug": "DEBUG=mcp:* node mcp-server.js"
57
+ }
58
+ }
59
+ ```
60
+
61
+ ### 3. Configure Claude Desktop
62
+
63
+ **macOS**: `~/Library/Application Support/Claude/claude_desktop_config.json`
64
+ **Windows**: `%APPDATA%\Claude\claude_desktop_config.json`
65
+
66
+ ```json
67
+ {
68
+ "mcpServers": {
69
+ "my-app": {
70
+ "command": "node",
71
+ "args": ["/path/to/your/project/mcp-server.js"],
72
+ "env": {}
73
+ }
74
+ }
75
+ }
76
+ ```
77
+
78
+ ### 4. Configure Cursor IDE
79
+
80
+ **macOS**: `~/.cursor/mcp.json`
81
+
82
+ ```json
83
+ {
84
+ "mcpServers": {
85
+ "my-app": {
86
+ "command": "node",
87
+ "args": ["/path/to/your/project/mcp-server.js"]
88
+ }
89
+ }
90
+ }
91
+ ```
92
+
93
+ ## Testing
94
+
95
+ ```bash
96
+ # Run server manually to test
97
+ npm run mcp:debug
98
+
99
+ # You should see:
100
+ # mcp:server Starting MCP server...
101
+ # mcp:server Registered 5 tools
102
+ # mcp:server Server ready
103
+ ```
104
+
105
+ ## Troubleshooting
106
+
107
+ ### "Server not found"
108
+ - Check the path in config is absolute
109
+ - Ensure mcp-server.js exists and is executable
110
+ - Restart Claude Desktop after config changes
111
+
112
+ ### "No tools registered"
113
+ - Verify @Tool decorators are on exported functions
114
+ - Check imports in mcp-server.js
115
+ - Add DEBUG=mcp:* to see registration logs
116
+
117
+ ### "Permission denied"
118
+ - Ensure node has permission to run
119
+ - Check file permissions on mcp-server.js
120
+
121
+ ## Enterprise Features
122
+
123
+ For users who need more:
124
+
125
+ > **Want automated MCP setup?** Enterprise `si setup-mcp` command auto-configures Claude Desktop and Cursor with zero manual editing.
126
+ >
127
+ > **Want AI-assisted tool development?** Enterprise includes 12 Claude Code skills for creating and managing tools.
128
+ >
129
+ > **Want comprehensive testing?** Enterprise generates tests from your MCP tools automatically.
130
+ >
131
+ > Install enterprise: `npm install @supernalintelligence/interface-enterprise`
132
+ > Then run: `npx si setup-mcp`
133
+
134
+ ## Task
135
+
136
+ Help the user set up an MCP server to expose their tools to AI assistants. Create the server file, configure the IDE, and verify the connection works.
@@ -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.