@nitrostack/cli 1.0.7 → 1.0.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.
@@ -1,5 +1,7 @@
1
1
  interface InitOptions {
2
- template: string;
2
+ template?: string;
3
+ description?: string;
4
+ author?: string;
3
5
  skipInstall?: boolean;
4
6
  }
5
7
  export declare function initCommand(projectName: string | undefined, options: InitOptions): Promise<void>;
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAoDA,UAAU,WAAW;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,WAAW,iBAgNtF"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/commands/init.ts"],"names":[],"mappings":"AAoDA,UAAU,WAAW;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,wBAAsB,WAAW,CAAC,WAAW,EAAE,MAAM,GAAG,SAAS,EAAE,OAAO,EAAE,WAAW,iBA4NtF"}
@@ -77,7 +77,7 @@ export async function initCommand(projectName, options) {
77
77
  }
78
78
  fs.removeSync(targetDir);
79
79
  }
80
- // Prompt for template and details
80
+ // Prompt for template and details if not provided via flags
81
81
  const answers = await inquirer.prompt([
82
82
  {
83
83
  type: 'list',
@@ -98,40 +98,51 @@ export async function initCommand(projectName, options) {
98
98
  },
99
99
  ],
100
100
  default: 'typescript-starter',
101
+ when: !options.template,
101
102
  },
102
103
  {
103
104
  type: 'input',
104
105
  name: 'description',
105
106
  message: chalk.white('Description:'),
106
107
  default: 'My awesome MCP server',
108
+ when: !options.description,
107
109
  },
108
110
  {
109
111
  type: 'input',
110
112
  name: 'author',
111
113
  message: chalk.white('Author:'),
112
114
  default: '',
115
+ when: !options.author,
113
116
  },
114
117
  ]);
118
+ // Merge flag values with prompt answers
119
+ const finalTemplate = options.template || answers.template || 'typescript-starter';
120
+ const finalDescription = options.description || answers.description || 'My awesome MCP server';
121
+ const finalAuthor = options.author || answers.author || '';
115
122
  spacer();
116
123
  spinner = new NitroSpinner('Creating project structure...').start();
117
124
  // Create project directory
118
125
  fs.mkdirSync(targetDir, { recursive: true });
119
126
  // Get template path - templates are in the CLI package root
120
- const templateDir = path.join(__dirname, '../../templates', answers.template);
127
+ const templateDir = path.join(__dirname, '../../templates', finalTemplate);
121
128
  // Copy template files
122
129
  if (fs.existsSync(templateDir)) {
123
130
  fs.copySync(templateDir, targetDir);
124
131
  }
125
132
  else {
126
- await createProjectFromScratch(targetDir, finalProjectName, answers);
133
+ await createProjectFromScratch(targetDir, finalProjectName, {
134
+ template: finalTemplate,
135
+ description: finalDescription,
136
+ author: finalAuthor,
137
+ });
127
138
  }
128
139
  // Update package.json
129
140
  const packageJsonPath = path.join(targetDir, 'package.json');
130
141
  if (fs.existsSync(packageJsonPath)) {
131
142
  const packageJson = fs.readJSONSync(packageJsonPath);
132
143
  packageJson.name = finalProjectName;
133
- packageJson.description = answers.description;
134
- packageJson.author = answers.author;
144
+ packageJson.description = finalDescription;
145
+ packageJson.author = finalAuthor;
135
146
  fs.writeJSONSync(packageJsonPath, packageJson, { spaces: 2 });
136
147
  }
137
148
  spinner.succeed('Project created');
@@ -150,7 +161,7 @@ export async function initCommand(projectName, options) {
150
161
  }
151
162
  }
152
163
  // Handle widgets
153
- if (!options.skipInstall && ['typescript-starter', 'typescript-pizzaz', 'typescript-oauth'].includes(answers.template)) {
164
+ if (!options.skipInstall && ['typescript-starter', 'typescript-pizzaz', 'typescript-oauth'].includes(finalTemplate)) {
154
165
  const fromNpm = isNitrostackFromNpm();
155
166
  const isLocalDev = isLocalDevelopment();
156
167
  if (isLocalDev && !fromNpm) {
@@ -192,7 +203,7 @@ export async function initCommand(projectName, options) {
192
203
  spacer();
193
204
  console.log(createSuccessBox('Project Ready', [
194
205
  `Name: ${finalProjectName}`,
195
- `Template: ${answers.template}`,
206
+ `Template: ${finalTemplate}`,
196
207
  `Path: ${targetDir}`,
197
208
  ]));
198
209
  // Next steps
@@ -202,16 +213,16 @@ export async function initCommand(projectName, options) {
202
213
  if (options.skipInstall) {
203
214
  steps.push('npm install');
204
215
  }
205
- if (answers.template === 'typescript-oauth') {
216
+ if (finalTemplate === 'typescript-oauth') {
206
217
  steps.push('cp .env.example .env # Configure OAuth');
207
218
  }
208
219
  steps.push('npm run dev');
209
220
  nextSteps(steps);
210
221
  // Template-specific tips
211
- if (answers.template === 'typescript-oauth') {
222
+ if (finalTemplate === 'typescript-oauth') {
212
223
  console.log(chalk.dim(' OAuth Setup: See OAUTH_SETUP.md for provider guides\n'));
213
224
  }
214
- else if (answers.template === 'typescript-pizzaz') {
225
+ else if (finalTemplate === 'typescript-pizzaz') {
215
226
  console.log(chalk.dim(' Mapbox (optional): Get free key from mapbox.com\n'));
216
227
  }
217
228
  console.log(chalk.dim(' Happy coding! 🎉\n'));
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,wBAAgB,aAAa,YA8D5B;AAGD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,wBAAgB,aAAa,YAgE5B;AAGD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,QAAQ,EAAE,MAAM,wBAAwB,CAAC;AAClD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC"}
package/dist/index.js CHANGED
@@ -20,7 +20,9 @@ export function createProgram() {
20
20
  .command('init')
21
21
  .description('Initialize a new NitroStack project')
22
22
  .argument('[project-name]', 'Name of the project')
23
- .option('--template <template>', 'Template to use (typescript, typescript-auth)', 'typescript')
23
+ .option('--template <template>', 'Template to use (typescript-starter, typescript-pizzaz, typescript-oauth)', 'typescript-starter')
24
+ .option('--description <description>', 'Description of the project')
25
+ .option('--author <author>', 'Author of the project')
24
26
  .option('--skip-install', 'Skip installing dependencies')
25
27
  .action(initCommand);
26
28
  program
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nitrostack/cli",
3
- "version": "1.0.7",
3
+ "version": "1.0.8",
4
4
  "description": "CLI for NitroStack - Create and manage MCP server projects",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",