nitrostack 1.0.74 → 1.0.76
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/dist/auth/__tests__/pkce.test.js +53 -4
- package/dist/auth/__tests__/pkce.test.js.map +1 -1
- package/dist/auth/__tests__/simple-jwt.test.js +153 -2
- package/dist/auth/__tests__/simple-jwt.test.js.map +1 -1
- package/dist/cli/commands/install.d.ts +10 -0
- package/dist/cli/commands/install.d.ts.map +1 -0
- package/dist/cli/commands/install.js +79 -0
- package/dist/cli/commands/install.js.map +1 -0
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +8 -0
- package/dist/cli/index.js.map +1 -1
- package/dist/core/__tests__/errors.test.d.ts +2 -0
- package/dist/core/__tests__/errors.test.d.ts.map +1 -0
- package/dist/core/__tests__/errors.test.js +109 -0
- package/dist/core/__tests__/errors.test.js.map +1 -0
- package/dist/core/__tests__/logger.test.d.ts +2 -0
- package/dist/core/__tests__/logger.test.d.ts.map +1 -0
- package/dist/core/__tests__/logger.test.js +83 -0
- package/dist/core/__tests__/logger.test.js.map +1 -0
- package/dist/core/__tests__/prompt.test.d.ts +2 -0
- package/dist/core/__tests__/prompt.test.d.ts.map +1 -0
- package/dist/core/__tests__/prompt.test.js +126 -0
- package/dist/core/__tests__/prompt.test.js.map +1 -0
- package/dist/core/__tests__/resource.test.d.ts +2 -0
- package/dist/core/__tests__/resource.test.d.ts.map +1 -0
- package/dist/core/__tests__/resource.test.js +173 -0
- package/dist/core/__tests__/resource.test.js.map +1 -0
- package/dist/core/pipes/__tests__/pipes.test.js +113 -1
- package/dist/core/pipes/__tests__/pipes.test.js.map +1 -1
- package/dist/widgets/hooks/__tests__/hooks.test.d.ts +2 -0
- package/dist/widgets/hooks/__tests__/hooks.test.d.ts.map +1 -0
- package/dist/widgets/hooks/__tests__/hooks.test.js +129 -0
- package/dist/widgets/hooks/__tests__/hooks.test.js.map +1 -0
- package/dist/widgets/hooks/__tests__/use-widget-state.test.d.ts +2 -0
- package/dist/widgets/hooks/__tests__/use-widget-state.test.d.ts.map +1 -0
- package/dist/widgets/hooks/__tests__/use-widget-state.test.js +66 -0
- package/dist/widgets/hooks/__tests__/use-widget-state.test.js.map +1 -0
- package/dist/widgets/runtime/__tests__/widget-polyfill.test.d.ts +2 -0
- package/dist/widgets/runtime/__tests__/widget-polyfill.test.d.ts.map +1 -0
- package/dist/widgets/runtime/__tests__/widget-polyfill.test.js +66 -0
- package/dist/widgets/runtime/__tests__/widget-polyfill.test.js.map +1 -0
- package/package.json +6 -2
- package/src/studio/app/chat/page.tsx +21 -0
- package/src/studio/lib/llm-service.ts +77 -10
- package/templates/typescript-oauth/OAUTH_SETUP.md +592 -0
- package/templates/typescript-oauth/README.md +184 -235
- package/templates/typescript-oauth/package.json +4 -3
- package/templates/typescript-pizzaz/README.md +76 -57
- package/templates/typescript-pizzaz/package.json +31 -30
- package/templates/typescript-starter/README.md +20 -14
- package/templates/typescript-starter/package.json +3 -1
- package/templates/typescript-starter/package-lock.json +0 -4112
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
# 🍕
|
|
1
|
+
# 🍕 NitroStack Pizza Shop Finder
|
|
2
2
|
|
|
3
|
-
A comprehensive NitroStack template showcasing interactive pizza shop discovery with maps, lists, and detailed views. This template demonstrates the NitroStack Widget SDK for building interactive widgets.
|
|
3
|
+
A comprehensive NitroStack template showcasing interactive pizza shop discovery with maps, lists, and detailed views. This template demonstrates the NitroStack Widget SDK for building beautiful, interactive widgets.
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
@@ -22,55 +22,62 @@ A comprehensive NitroStack template showcasing interactive pizza shop discovery
|
|
|
22
22
|
- `show_pizza_list` - Show filterable list of shops
|
|
23
23
|
- `show_pizza_shop` - Display detailed shop information
|
|
24
24
|
|
|
25
|
-
## Quick Start
|
|
25
|
+
## 🚀 Quick Start
|
|
26
26
|
|
|
27
|
-
###
|
|
27
|
+
### Prerequisites
|
|
28
28
|
|
|
29
29
|
```bash
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
```
|
|
30
|
+
# Install NitroStack CLI globally
|
|
31
|
+
npm install -g nitrostack
|
|
33
32
|
|
|
34
|
-
|
|
33
|
+
# Or use npx
|
|
34
|
+
npx nitrostack --version
|
|
35
|
+
```
|
|
35
36
|
|
|
36
|
-
|
|
37
|
+
### Setup Your Project
|
|
37
38
|
|
|
38
|
-
1. Get a free API key from [Mapbox](https://www.mapbox.com/)
|
|
39
|
-
2. Create `.env` file:
|
|
40
39
|
```bash
|
|
41
|
-
|
|
40
|
+
# Create a new project
|
|
41
|
+
nitrostack init my-pizza-app --template typescript-pizzaz
|
|
42
|
+
cd my-pizza-app
|
|
43
|
+
|
|
44
|
+
# Install all dependencies (root + widgets)
|
|
45
|
+
nitrostack install
|
|
42
46
|
```
|
|
43
47
|
|
|
44
|
-
|
|
48
|
+
### Configure Mapbox (Optional but Recommended)
|
|
49
|
+
|
|
50
|
+
The map widget uses Mapbox GL for beautiful interactive maps:
|
|
45
51
|
|
|
46
|
-
|
|
52
|
+
1. Get a **free** API key from [Mapbox](https://www.mapbox.com/) (sign up takes 1 minute)
|
|
53
|
+
2. Create `src/widgets/.env` file:
|
|
47
54
|
|
|
48
55
|
```bash
|
|
49
|
-
|
|
56
|
+
NEXT_PUBLIC_MAPBOX_TOKEN=your_mapbox_token_here
|
|
50
57
|
```
|
|
51
58
|
|
|
52
|
-
The
|
|
53
|
-
|
|
54
|
-
### 4. Run Widget Dev Server
|
|
59
|
+
> **Note**: The template works without Mapbox, but the map widget will show a placeholder. You can still use the list and shop detail widgets.
|
|
55
60
|
|
|
56
|
-
|
|
61
|
+
### Run Development Server
|
|
57
62
|
|
|
58
63
|
```bash
|
|
59
|
-
npm run
|
|
64
|
+
npm run dev
|
|
60
65
|
```
|
|
61
66
|
|
|
62
|
-
|
|
67
|
+
This starts:
|
|
68
|
+
- **MCP Server** - Hot reloads on code changes
|
|
69
|
+
- **Studio** on http://localhost:3000 - Visual testing environment
|
|
70
|
+
- **Widget Dev Server** on http://localhost:3001 - Hot module replacement
|
|
63
71
|
|
|
64
|
-
###
|
|
72
|
+
### Test in Studio
|
|
65
73
|
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
- "Show me details for Tony's New York Pizza"
|
|
74
|
+
Try these prompts in Studio chat:
|
|
75
|
+
- "Show me pizza shops on a map"
|
|
76
|
+
- "List all pizza shops"
|
|
77
|
+
- "Show me details for Tony's New York Pizza"
|
|
78
|
+
- "Find pizza shops with high ratings"
|
|
72
79
|
|
|
73
|
-
## Project Structure
|
|
80
|
+
## 📁 Project Structure
|
|
74
81
|
|
|
75
82
|
```
|
|
76
83
|
typescript-pizzaz/
|
|
@@ -94,7 +101,7 @@ typescript-pizzaz/
|
|
|
94
101
|
└── README.md
|
|
95
102
|
```
|
|
96
103
|
|
|
97
|
-
## Widget Features
|
|
104
|
+
## 🎨 Widget Features
|
|
98
105
|
|
|
99
106
|
### Pizza Map Widget
|
|
100
107
|
- **Interactive Mapbox map** with custom markers
|
|
@@ -117,7 +124,27 @@ typescript-pizzaz/
|
|
|
117
124
|
- **Related shops** recommendations
|
|
118
125
|
- **External link handling** via `useWidgetSDK()`
|
|
119
126
|
|
|
120
|
-
##
|
|
127
|
+
## 🔧 Commands
|
|
128
|
+
|
|
129
|
+
```bash
|
|
130
|
+
# Installation
|
|
131
|
+
npm install # Install all dependencies (root + widgets)
|
|
132
|
+
nitrostack install # Same as above
|
|
133
|
+
|
|
134
|
+
# Development
|
|
135
|
+
npm run dev # Start dev server with Studio
|
|
136
|
+
npm run build # Build TypeScript and widgets for production
|
|
137
|
+
npm start # Run production server
|
|
138
|
+
|
|
139
|
+
# Upgrade
|
|
140
|
+
npm run upgrade # Upgrade nitrostack to latest version
|
|
141
|
+
|
|
142
|
+
# Widget Management
|
|
143
|
+
npm run widget <command> # Run npm command in widgets directory
|
|
144
|
+
npm run widget add <pkg> # Add a widget dependency
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
## 🛠️ Customization
|
|
121
148
|
|
|
122
149
|
### Adding More Shops
|
|
123
150
|
|
|
@@ -160,28 +187,7 @@ style: isDark
|
|
|
160
187
|
|
|
161
188
|
Edit `src/modules/pizzaz/pizzaz.service.ts` to add more filter options.
|
|
162
189
|
|
|
163
|
-
##
|
|
164
|
-
|
|
165
|
-
### Build for Production
|
|
166
|
-
|
|
167
|
-
```bash
|
|
168
|
-
npm run build
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
### Deploy to OpenAI ChatGPT
|
|
172
|
-
|
|
173
|
-
1. Build widgets:
|
|
174
|
-
```bash
|
|
175
|
-
cd src/widgets && npm run build
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
2. Widget HTML files will be in `src/widgets/out/`
|
|
179
|
-
|
|
180
|
-
3. Upload to your MCP server
|
|
181
|
-
|
|
182
|
-
4. **Zero code changes needed!** Widgets work identically in OpenAI ChatGPT.
|
|
183
|
-
|
|
184
|
-
## SDK Features Demonstrated
|
|
190
|
+
## 📚 SDK Features Demonstrated
|
|
185
191
|
|
|
186
192
|
### Theme Awareness
|
|
187
193
|
```typescript
|
|
@@ -218,11 +224,24 @@ const { openExternal } = useWidgetSDK();
|
|
|
218
224
|
openExternal('https://example.com');
|
|
219
225
|
```
|
|
220
226
|
|
|
221
|
-
##
|
|
227
|
+
## 🚀 Deployment
|
|
228
|
+
|
|
229
|
+
### Build for Production
|
|
230
|
+
|
|
231
|
+
```bash
|
|
232
|
+
npm run build
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Deploy Widgets
|
|
236
|
+
|
|
237
|
+
Widget HTML files will be generated in `src/widgets/out/` - these work identically in any MCP-compatible client including OpenAI ChatGPT.
|
|
238
|
+
|
|
239
|
+
## 📚 Next Steps
|
|
222
240
|
|
|
223
|
-
-
|
|
224
|
-
-
|
|
225
|
-
- [
|
|
241
|
+
- Try the **Starter Template** - Learn the basics
|
|
242
|
+
- Try the **Flight Booking Template** - API integration with Duffel
|
|
243
|
+
- Read the [NitroStack Documentation](https://nitrostack.ai/docs)
|
|
244
|
+
- Check out [Mapbox GL JS Documentation](https://docs.mapbox.com/mapbox-gl-js/)
|
|
226
245
|
|
|
227
246
|
## License
|
|
228
247
|
|
|
@@ -1,31 +1,32 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
2
|
+
"name": "nitrostack-pizzaz",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "NitroStack Pizza Shop Finder - Interactive map widgets with Mapbox integration",
|
|
7
|
+
"scripts": {
|
|
8
|
+
"dev": "nitrostack dev",
|
|
9
|
+
"build": "nitrostack build",
|
|
10
|
+
"start": "npm run build && nitrostack start",
|
|
11
|
+
"start:prod": "nitrostack start",
|
|
12
|
+
"upgrade": "nitrostack upgrade",
|
|
13
|
+
"widget": "npm --prefix src/widgets"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"nitrostack",
|
|
17
|
+
"mcp",
|
|
18
|
+
"pizza",
|
|
19
|
+
"map",
|
|
20
|
+
"widgets"
|
|
21
|
+
],
|
|
22
|
+
"author": "",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"nitrostack": "^1",
|
|
26
|
+
"zod": "^3.22.4",
|
|
27
|
+
"dotenv": "^16.3.1"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"typescript": "^5.3.3"
|
|
31
|
+
}
|
|
32
|
+
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
# NitroStack Starter Template
|
|
2
2
|
|
|
3
|
-
**The simple starter template** - Learn NitroStack
|
|
3
|
+
**The simple starter template** - Learn NitroStack fundamentals with a clean calculator example.
|
|
4
4
|
|
|
5
5
|
## 🎯 What's Inside
|
|
6
6
|
|
|
7
|
-
This template demonstrates core NitroStack
|
|
7
|
+
This template demonstrates core NitroStack features:
|
|
8
8
|
|
|
9
9
|
- **One Module** - Calculator module with all features
|
|
10
10
|
- **One Tool** - `calculate` - Perform arithmetic operations
|
|
@@ -29,14 +29,17 @@ npx nitrostack --version
|
|
|
29
29
|
### Setup Your Project
|
|
30
30
|
|
|
31
31
|
```bash
|
|
32
|
+
# Create a new project
|
|
32
33
|
nitrostack init my-calculator --template typescript-starter
|
|
33
34
|
cd my-calculator
|
|
35
|
+
|
|
36
|
+
# Install all dependencies (root + widgets)
|
|
37
|
+
nitrostack install
|
|
34
38
|
```
|
|
35
39
|
|
|
36
40
|
That's it! The CLI automatically:
|
|
37
|
-
- ✅ Installs all dependencies
|
|
41
|
+
- ✅ Installs all root dependencies
|
|
38
42
|
- ✅ Installs widget dependencies
|
|
39
|
-
- ✅ Builds the widgets
|
|
40
43
|
- ✅ Sets up the project structure
|
|
41
44
|
|
|
42
45
|
### Run the Project
|
|
@@ -46,11 +49,11 @@ npm run dev
|
|
|
46
49
|
```
|
|
47
50
|
|
|
48
51
|
This starts:
|
|
49
|
-
- **MCP Server** (dual transport: STDIO + HTTP
|
|
52
|
+
- **MCP Server** (dual transport: STDIO + HTTP) - Hot reloads on code changes
|
|
50
53
|
- **Studio** on http://localhost:3000 - Visual testing environment
|
|
51
54
|
- **Widget Dev Server** on http://localhost:3001 - Hot module replacement
|
|
52
55
|
|
|
53
|
-
> 💡 **Dual Transport**: Your server exposes tools via both STDIO (for direct connections) and HTTP (for remote access
|
|
56
|
+
> 💡 **Dual Transport**: Your server exposes tools via both STDIO (for direct connections) and HTTP (for remote access). Switch between transports in Studio → Settings.
|
|
54
57
|
|
|
55
58
|
The `nitrostack dev` command handles everything automatically:
|
|
56
59
|
- ✅ Auto-detects widget directory
|
|
@@ -153,18 +156,23 @@ This template is perfect for learning:
|
|
|
153
156
|
## 🔧 Commands
|
|
154
157
|
|
|
155
158
|
```bash
|
|
159
|
+
# Installation
|
|
160
|
+
npm install # Install all dependencies (root + widgets)
|
|
161
|
+
nitrostack install # Same as above
|
|
162
|
+
|
|
156
163
|
# Development
|
|
157
|
-
npm run dev # Start dev server with Studio
|
|
164
|
+
npm run dev # Start dev server with Studio
|
|
158
165
|
npm run build # Build TypeScript and widgets for production
|
|
159
166
|
npm start # Run production server
|
|
160
167
|
|
|
168
|
+
# Upgrade
|
|
169
|
+
npm run upgrade # Upgrade nitrostack to latest version
|
|
170
|
+
|
|
161
171
|
# Widget Management
|
|
162
172
|
npm run widget <command> # Run npm command in widgets directory
|
|
163
173
|
npm run widget add <pkg> # Add a widget dependency (e.g., @mui/material)
|
|
164
174
|
```
|
|
165
175
|
|
|
166
|
-
**Note:** The NitroStack CLI automatically handles building, installing dependencies, and hot reload. You don't need separate commands for widgets anymore!
|
|
167
|
-
|
|
168
176
|
## 📝 Example Interactions
|
|
169
177
|
|
|
170
178
|
### Basic Calculation
|
|
@@ -284,10 +292,9 @@ nitrostack generate module converter
|
|
|
284
292
|
|
|
285
293
|
Once you understand this template:
|
|
286
294
|
|
|
287
|
-
1. Try the
|
|
288
|
-
2.
|
|
289
|
-
3. Read [
|
|
290
|
-
4. Read [Widgets Guide](/sdk/typescript/ui/widgets) - Build better UIs
|
|
295
|
+
1. Try the **Pizza Shop Template** - Interactive maps and widgets
|
|
296
|
+
2. Try the **Flight Booking Template** - API integration with Duffel
|
|
297
|
+
3. Read the [NitroStack Documentation](https://nitrostack.ai/docs)
|
|
291
298
|
|
|
292
299
|
## 💡 Tips
|
|
293
300
|
|
|
@@ -311,4 +318,3 @@ Use this as a starting point for:
|
|
|
311
318
|
**Happy Learning! 📖**
|
|
312
319
|
|
|
313
320
|
Start simple, learn the patterns, then build something amazing!
|
|
314
|
-
|
|
@@ -1,13 +1,15 @@
|
|
|
1
1
|
{
|
|
2
|
-
"name": "
|
|
2
|
+
"name": "nitrostack-starter",
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"private": true,
|
|
5
5
|
"type": "module",
|
|
6
|
+
"description": "NitroStack starter template - Learn MCP server basics with a simple calculator example",
|
|
6
7
|
"scripts": {
|
|
7
8
|
"dev": "nitrostack dev",
|
|
8
9
|
"build": "nitrostack build",
|
|
9
10
|
"start": "npm run build && nitrostack start",
|
|
10
11
|
"start:prod": "nitrostack start",
|
|
12
|
+
"upgrade": "nitrostack upgrade",
|
|
11
13
|
"widget": "npm --prefix src/widgets"
|
|
12
14
|
},
|
|
13
15
|
"dependencies": {
|