@nitrostack/cli 1.0.4 → 1.0.7

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 (55) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +39 -96
  3. package/dist/commands/build.d.ts.map +1 -1
  4. package/dist/commands/build.js +4 -1
  5. package/dist/commands/dev.d.ts.map +1 -1
  6. package/dist/commands/dev.js +24 -52
  7. package/dist/commands/generate-types.d.ts +0 -1
  8. package/dist/commands/generate-types.d.ts.map +1 -1
  9. package/dist/commands/generate-types.js +18 -39
  10. package/dist/commands/generate.d.ts.map +1 -1
  11. package/dist/commands/generate.js +23 -15
  12. package/dist/commands/init.d.ts.map +1 -1
  13. package/dist/commands/init.js +18 -17
  14. package/dist/commands/install.d.ts.map +1 -1
  15. package/dist/commands/install.js +3 -1
  16. package/dist/commands/start.d.ts.map +1 -1
  17. package/dist/commands/start.js +4 -4
  18. package/dist/commands/upgrade.d.ts.map +1 -1
  19. package/dist/commands/upgrade.js +92 -77
  20. package/dist/ui/branding.d.ts +21 -4
  21. package/dist/ui/branding.d.ts.map +1 -1
  22. package/dist/ui/branding.js +121 -52
  23. package/package.json +6 -7
  24. package/templates/typescript-oauth/.env.example +5 -5
  25. package/templates/typescript-oauth/README.md +36 -231
  26. package/templates/typescript-oauth/package.json +1 -1
  27. package/templates/typescript-oauth/src/app.module.ts +1 -1
  28. package/templates/typescript-oauth/src/guards/oauth.guard.ts +1 -1
  29. package/templates/typescript-oauth/src/health/system.health.ts +1 -1
  30. package/templates/typescript-oauth/src/index.ts +1 -1
  31. package/templates/typescript-oauth/src/modules/flights/booking.tools.ts +1 -1
  32. package/templates/typescript-oauth/src/modules/flights/flights.module.ts +1 -1
  33. package/templates/typescript-oauth/src/modules/flights/flights.prompts.ts +1 -1
  34. package/templates/typescript-oauth/src/modules/flights/flights.resources.ts +1 -1
  35. package/templates/typescript-oauth/src/modules/flights/flights.tools.ts +1 -1
  36. package/templates/typescript-oauth/src/services/duffel.service.ts +1 -1
  37. package/templates/typescript-pizzaz/.env.example +8 -0
  38. package/templates/typescript-pizzaz/README.md +42 -217
  39. package/templates/typescript-pizzaz/package.json +1 -1
  40. package/templates/typescript-pizzaz/src/app.module.ts +1 -1
  41. package/templates/typescript-pizzaz/src/index.ts +1 -1
  42. package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.module.ts +3 -2
  43. package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.service.ts +1 -1
  44. package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.tasks.ts +294 -0
  45. package/templates/typescript-pizzaz/src/modules/pizzaz/pizzaz.tools.ts +1 -1
  46. package/templates/typescript-starter/.env.example +7 -0
  47. package/templates/typescript-starter/README.md +51 -284
  48. package/templates/typescript-starter/package.json +1 -1
  49. package/templates/typescript-starter/src/app.module.ts +1 -1
  50. package/templates/typescript-starter/src/health/system.health.ts +1 -1
  51. package/templates/typescript-starter/src/index.ts +1 -1
  52. package/templates/typescript-starter/src/modules/calculator/calculator.module.ts +1 -1
  53. package/templates/typescript-starter/src/modules/calculator/calculator.prompts.ts +1 -1
  54. package/templates/typescript-starter/src/modules/calculator/calculator.resources.ts +1 -1
  55. package/templates/typescript-starter/src/modules/calculator/calculator.tools.ts +1 -1
@@ -1,263 +1,68 @@
1
1
  # ✈️ NitroStack Flight Booking
2
2
 
3
- A production-ready NitroStack template showcasing real-time flight search and booking with **Duffel API** integration. Search flights, view details, select seats, and book - all through beautiful interactive widgets.
3
+ A production-ready template showcasing real-time flight search and booking with **Duffel API** integration. Learn how to build complex, authenticated MCP servers with high-impact visual widgets.
4
4
 
5
5
  ## ✨ Features
6
6
 
7
- ### 🔌 **Duffel API Integration**
8
- - Real-time flight search across 300+ airlines
9
- - Live pricing and availability
10
- - Seat selection with cabin maps
11
- - Booking and order management
7
+ - **Real-time Search** — Powered by the Duffel API (300+ airlines).
8
+ - **Seat Selection** Interactive visual cabin maps with seat pickers.
9
+ - **Secure Payments** — Simulated secure booking and confirmation flows.
10
+ - **Advanced Auth** Optional OAuth 2.1 support for protected MCP servers.
12
11
 
13
- ### 🎨 **Interactive Widgets**
14
- - **Airport Search** - Autocomplete airport selection
15
- - **Flight Search Results** - Compare flights with prices
16
- - **Flight Details** - Comprehensive flight information
17
- - **Seat Selection** - Visual cabin map with seat picker
18
- - **Order Summary** - Complete booking overview
19
- - **Payment Confirmation** - Secure payment flow
20
-
21
- ### 🛠️ **MCP Tools**
22
- - `search_airports` - Find airports by name/code
23
- - `search_flights` - Search available flights
24
- - `show_flight_details` - Detailed flight information
25
- - `select_seats` - Interactive seat selection
26
- - `create_booking` - Book flights
27
- - `get_order` - Retrieve booking details
12
+ ---
28
13
 
29
14
  ## 🚀 Quick Start
30
15
 
31
- ### Prerequisites
32
-
33
- ```bash
34
- # Install NitroStack CLI globally
35
- npm install -g nitrostack
36
-
37
- # Or use npx
38
- npx nitrostack --version
39
- ```
40
-
41
- ### 1. Create Your Project
16
+ ### 1. Initialize Your Project
42
17
 
43
18
  ```bash
44
- # Create a new project
45
- nitrostack init my-flight-app --template typescript-oauth
19
+ npx nitrostack init my-flight-app --template typescript-oauth
46
20
  cd my-flight-app
47
-
48
- # Install all dependencies (root + widgets)
49
- nitrostack install
50
21
  ```
51
22
 
52
- ### 2. Get Your Duffel API Key (Free)
53
-
54
- [Duffel](https://duffel.com/) provides a free API for flight search and booking:
55
-
56
- 1. **Sign up** at [duffel.com](https://duffel.com/) (click "Start now" - it's free!)
57
- 2. Create a free account (no credit card required)
58
- 3. Go to your **Dashboard** → **Developers** → **Access tokens**
59
- 4. Click **"Create token"** to generate your API key
60
- 5. Copy the token (starts with `duffel_test_` for sandbox)
61
-
62
- > 💡 **Tip**: The test mode (`duffel_test_*` tokens) gives you access to realistic mock data for development. Production tokens (`duffel_live_*`) connect to real airlines.
63
-
64
- ### 3. Configure Environment
65
-
66
- Copy the example environment file and add your Duffel API key:
23
+ ### 2. Install Dependencies
67
24
 
68
25
  ```bash
69
- cp .env.example .env
26
+ npm run install:all
70
27
  ```
71
28
 
72
- Edit `.env` and update:
73
-
74
- ```env
75
- # Duffel API Configuration
76
- DUFFEL_API_KEY=duffel_test_your_api_key_here
77
- ```
78
-
79
- ### 4. Run Development Server
80
-
81
- ```bash
82
- npm run dev
83
- ```
84
-
85
- This starts:
86
- - **MCP Server** - Hot reloads on code changes
87
- - **Studio** on http://localhost:3000 - Visual testing environment
88
- - **Widget Dev Server** on http://localhost:3001 - Hot module replacement
89
-
90
- ### 5. Test in Studio
91
-
92
- Try these prompts in Studio chat:
93
- - "Search flights from London to New York for next week"
94
- - "Show me flight details"
95
- - "I want to select seats"
96
- - "Show me flights from JFK to LAX"
97
-
98
- ## 📁 Project Structure
99
-
100
- ```
101
- typescript-oauth/
102
- ├── src/
103
- │ ├── index.ts # Main server entry
104
- │ ├── app.module.ts # App module
105
- │ ├── services/
106
- │ │ └── duffel.service.ts # Duffel API client
107
- │ └── modules/
108
- │ └── flights/
109
- │ ├── flights.module.ts # Module definition
110
- │ ├── flights.tools.ts # Search & display tools
111
- │ ├── flights.prompts.ts # AI prompts
112
- │ ├── flights.resources.ts # Static resources
113
- │ └── booking.tools.ts # Booking tools
114
- │ └── widgets/
115
- │ ├── app/
116
- │ │ ├── airport-search/ # Airport autocomplete
117
- │ │ ├── flight-search-results/ # Results list
118
- │ │ ├── flight-details/ # Flight info
119
- │ │ ├── seat-selection/ # Seat picker
120
- │ │ ├── order-summary/ # Booking summary
121
- │ │ └── payment-confirmation/ # Payment widget
122
- ├── .env.example # Environment template
123
- ├── OAUTH_SETUP.md # OAuth configuration guide
124
- ├── package.json
125
- └── README.md
126
- ```
127
-
128
- ## 🔧 Commands
129
-
130
- ```bash
131
- # Installation
132
- npm install # Install all dependencies (root + widgets)
133
- nitrostack install # Same as above
29
+ ### 3. Get NitroStudio
134
30
 
135
- # Development
136
- npm run dev # Start dev server with Studio
137
- npm run build # Build TypeScript and widgets for production
138
- npm start # Run production server
31
+ Experience the visual seat selection and flight search as your users would see it.
139
32
 
140
- # Upgrade
141
- npm run upgrade # Upgrade nitrostack to latest version
33
+ 1. **Download NitroStudio**: [nitrostack.ai/studio](https://nitrostack.ai/studio)
34
+ 2. **Open Project**: Launch NitroStudio and select your project folder.
142
35
 
143
- # Widget Management
144
- npm run widget <command> # Run npm command in widgets directory
145
- npm run widget add <pkg> # Add a widget dependency
146
- ```
147
-
148
- ## 🔐 OAuth Setup (Optional)
149
-
150
- This template includes OAuth 2.1 authentication support. If you want to protect your MCP server with authentication:
151
-
152
- 1. Read the detailed guide: **[OAUTH_SETUP.md](./OAUTH_SETUP.md)**
153
- 2. Configure Auth0 (or your OAuth provider)
154
- 3. Update your `.env` with OAuth credentials
155
-
156
- > **Note**: OAuth is optional for local development. The template works without it using Duffel's test API.
157
-
158
- ## 📊 Duffel API Features
159
-
160
- ### Test Mode vs Live Mode
161
-
162
- | Feature | Test Mode (`duffel_test_*`) | Live Mode (`duffel_live_*`) |
163
- |---------|----------------------------|----------------------------|
164
- | API Access | ✅ Full access | ✅ Full access |
165
- | Pricing | Mock data | Real prices |
166
- | Bookings | Simulated | Real bookings |
167
- | Credit Card | Not charged | Charged |
168
- | Rate Limits | Generous | Production limits |
169
-
170
- ### Supported Airlines
171
-
172
- Duffel provides access to 300+ airlines including:
173
- - Major carriers (British Airways, Lufthansa, Emirates, etc.)
174
- - Low-cost carriers (Ryanair, EasyJet, Spirit, etc.)
175
- - Regional airlines
176
-
177
- ### API Capabilities
178
-
179
- - **Search**: Real-time availability and pricing
180
- - **Ancillaries**: Seats, bags, meals
181
- - **Booking**: Create and manage orders
182
- - **Changes**: Modify existing bookings
183
- - **Cancellations**: Cancel and refund
184
-
185
- ## 🎨 Widget Features
186
-
187
- ### Airport Search Widget
188
- - Autocomplete with IATA codes
189
- - City and airport name search
190
- - Recent searches
191
-
192
- ### Flight Search Results Widget
193
- - Compare multiple flights
194
- - Filter by stops, price, time
195
- - Sort options
196
- - Airline logos
197
-
198
- ### Flight Details Widget
199
- - Complete itinerary
200
- - Fare breakdown
201
- - Baggage allowance
202
- - Flight duration and stops
203
-
204
- ### Seat Selection Widget
205
- - Visual cabin map
206
- - Seat categories (standard, extra legroom, etc.)
207
- - Price per seat
208
- - Real-time availability
209
-
210
- ## 🛠️ Customization
211
-
212
- ### Adding New Airlines
213
-
214
- Duffel handles airline integrations automatically. You don't need to configure individual airlines.
215
-
216
- ### Modifying Search Parameters
217
-
218
- Edit `src/modules/flights/flights.tools.ts` to customize:
219
- - Default passenger counts
220
- - Cabin class options
221
- - Date ranges
222
- - Result limits
223
-
224
- ### Styling Widgets
225
-
226
- Each widget in `src/widgets/app/` can be customized:
227
- - Edit page.tsx for layout
228
- - Add custom CSS
229
- - Modify component styles
36
+ ---
230
37
 
231
- ## 📚 Resources
38
+ ## ⚙️ Configuration
232
39
 
233
- ### Duffel Documentation
234
- - [Duffel API Docs](https://duffel.com/docs/api)
235
- - [Duffel SDK (Node.js)](https://github.com/duffel/duffel-api-javascript)
236
- - [Duffel Postman Collection](https://duffel.com/docs/postman)
40
+ ### 1. Duffel API Key
237
41
 
238
- ### NitroStack Documentation
239
- - [NitroStack Docs](https://nitrostack.ai/docs)
240
- - [Widget Development Guide](https://nitrostack.ai/docs/widgets)
42
+ You need a free Duffel API key to see live flight data:
241
43
 
242
- ## 💡 Tips
44
+ 1. Sign up at [duffel.com](https://duffel.com/).
45
+ 2. Copy your **Test Token** from the dashboard.
46
+ 3. Create `.env` from the example:
47
+ ```bash
48
+ cp .env.example .env
49
+ ```
50
+ 4. Update `DUFFEL_API_KEY` in your `.env`.
243
51
 
244
- - **Use Test Mode**: Start with `duffel_test_*` tokens for development
245
- - **Check Rate Limits**: Duffel has rate limits - cache searches when possible
246
- - **Error Handling**: The template includes comprehensive error handling
247
- - **Responsive Design**: Widgets are mobile-friendly out of the box
52
+ ### 2. OAuth (Optional)
248
53
 
249
- ## 📚 Next Steps
54
+ For production scenarios requiring user authentication, refer to [OAUTH_SETUP.md](./OAUTH_SETUP.md).
250
55
 
251
- - Try the **Starter Template** - Learn NitroStack basics
252
- - Try the **Pizza Shop Template** - Interactive maps with Mapbox
253
- - Read the [Duffel Getting Started Guide](https://duffel.com/docs/guides/getting-started)
56
+ ---
254
57
 
255
- ## License
58
+ ## 🛠️ Commands
256
59
 
257
- MIT
60
+ - `npm run dev` — Start the development ecosystem.
61
+ - `npm run build` — Bundle TypeScript and widgets for deployment.
62
+ - `npm run upgrade` — Keep NitroStack core up to date.
258
63
 
259
64
  ---
260
-
261
- **Built with ❤️ using NitroStack + Duffel API**
262
-
263
- Need help? Check [Duffel Support](https://duffel.com/docs) or [NitroStack Docs](https://nitrostack.ai/docs)
65
+ **Official Resources**
66
+ - [Website](https://nitrostack.ai)
67
+ - [Docs](https://docs.nitrostack.ai)
68
+ - [Duffel API](https://duffel.com/docs)
@@ -14,7 +14,7 @@
14
14
  "widget": "npm --prefix src/widgets"
15
15
  },
16
16
  "dependencies": {
17
- "nitrostack": "^1",
17
+ "@nitrostack/core": "^1",
18
18
  "zod": "^3.22.4",
19
19
  "dotenv": "^16.3.1",
20
20
  "@duffel/api": "^4.21.0",
@@ -1,4 +1,4 @@
1
- import { McpApp, Module, ConfigModule, OAuthModule } from 'nitrostack';
1
+ import { McpApp, Module, ConfigModule, OAuthModule } from '@nitrostack/core';
2
2
  import { FlightsModule } from './modules/flights/flights.module.js';
3
3
  import { SystemHealthCheck } from './health/system.health.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Guard, ExecutionContext, OAuthModule, OAuthTokenPayload } from 'nitrostack';
1
+ import { Guard, ExecutionContext, OAuthModule, OAuthTokenPayload } from '@nitrostack/core';
2
2
 
3
3
  /**
4
4
  * OAuth Guard
@@ -1,4 +1,4 @@
1
- import { HealthCheck, HealthCheckInterface, HealthCheckResult } from 'nitrostack';
1
+ import { HealthCheck, HealthCheckInterface, HealthCheckResult } from '@nitrostack/core';
2
2
 
3
3
  /**
4
4
  * System Health Check
@@ -18,7 +18,7 @@
18
18
  */
19
19
 
20
20
  import 'dotenv/config';
21
- import { McpApplicationFactory } from 'nitrostack';
21
+ import { McpApplicationFactory } from '@nitrostack/core';
22
22
  import { AppModule } from './app.module.js';
23
23
 
24
24
  /**
@@ -1,4 +1,4 @@
1
- import { ToolDecorator as Tool, Widget, ExecutionContext, z, UseGuards, Injectable } from 'nitrostack';
1
+ import { ToolDecorator as Tool, Widget, ExecutionContext, z, UseGuards, Injectable } from '@nitrostack/core';
2
2
  import { OAuthGuard } from '../../guards/oauth.guard.js';
3
3
  import { DuffelService } from '../../services/duffel.service.js';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Module } from 'nitrostack';
1
+ import { Module } from '@nitrostack/core';
2
2
  import { FlightTools } from './flights.tools.js';
3
3
  import { BookingTools } from './booking.tools.js';
4
4
  import { FlightPrompts } from './flights.prompts.js';
@@ -1,4 +1,4 @@
1
- import { PromptDecorator as Prompt, ExecutionContext, Injectable } from 'nitrostack';
1
+ import { PromptDecorator as Prompt, ExecutionContext, Injectable } from '@nitrostack/core';
2
2
  import { DuffelService } from '../../services/duffel.service.js';
3
3
 
4
4
  // Note: Using explicit deps for ESM compatibility
@@ -1,4 +1,4 @@
1
- import { ResourceDecorator as Resource, ExecutionContext, z, Injectable } from 'nitrostack';
1
+ import { ResourceDecorator as Resource, ExecutionContext, z, Injectable } from '@nitrostack/core';
2
2
  import { DuffelService } from '../../services/duffel.service.js';
3
3
 
4
4
  // Note: Using explicit deps for ESM compatibility
@@ -1,4 +1,4 @@
1
- import { ToolDecorator as Tool, Widget, ExecutionContext, z, UseGuards, Injectable } from 'nitrostack';
1
+ import { ToolDecorator as Tool, Widget, ExecutionContext, z, UseGuards, Injectable } from '@nitrostack/core';
2
2
  import { OAuthGuard } from '../../guards/oauth.guard.js';
3
3
  import { DuffelService } from '../../services/duffel.service.js';
4
4
  import { format } from 'date-fns';
@@ -1,5 +1,5 @@
1
1
  import { Duffel } from '@duffel/api';
2
- import { Injectable } from 'nitrostack';
2
+ import { Injectable } from '@nitrostack/core';
3
3
 
4
4
  /**
5
5
  * Duffel API Service
@@ -0,0 +1,8 @@
1
+ # Mapbox Configuration (Optional)
2
+ # =============================================================================
3
+ # The map widget uses Mapbox GL for interactive maps.
4
+ # Get a free API key at: https://www.mapbox.com/
5
+ # =============================================================================
6
+
7
+ # Your Mapbox Public Token (starts with pk.)
8
+ NEXT_PUBLIC_MAPBOX_TOKEN=pk.your_mapbox_token_here