@opentiny/tiny-robot-cli 0.4.1-alpha.0 → 0.4.1-alpha.1

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.
@@ -295,7 +295,7 @@ async function addFeature(targetDir, type) {
295
295
 
296
296
  console.log('\nChange Results\n')
297
297
 
298
- let mainImportChanged = false
298
+ let needsManualStyleImport = false
299
299
  let envChanged = false
300
300
  let dependencyChanged = false
301
301
 
@@ -311,6 +311,8 @@ async function addFeature(targetDir, type) {
311
311
  })
312
312
 
313
313
  if (!mainFile?.target) {
314
+ needsManualStyleImport = true
315
+
314
316
  logUnavailable('main entry style import (main.ts/js not found)')
315
317
  } else {
316
318
  if (isSelected(selectedFiles, mainFile.label)) {
@@ -318,8 +320,6 @@ async function addFeature(targetDir, type) {
318
320
 
319
321
  switch (result.type) {
320
322
  case 'inserted':
321
- mainImportChanged = true
322
-
323
323
  logSuccess('Inserted TinyRobot style import')
324
324
  break
325
325
 
@@ -328,6 +328,8 @@ async function addFeature(targetDir, type) {
328
328
  break
329
329
  }
330
330
  } else {
331
+ needsManualStyleImport = true
332
+
331
333
  logSkippedSelection(mainFile.label)
332
334
  }
333
335
  }
@@ -379,27 +381,52 @@ async function addFeature(targetDir, type) {
379
381
  console.log(`\nSuccessfully added "${type}" feature to ${targetDir}`)
380
382
 
381
383
  printNextSteps({
382
- mainImportChanged,
384
+ needsManualStyleImport,
383
385
  envChanged,
384
386
  dependencyChanged,
385
387
  })
386
388
  }
387
389
 
388
- function printNextSteps({ mainImportChanged, envChanged, dependencyChanged }) {
390
+ function printNextSteps({ needsManualStyleImport, envChanged, dependencyChanged }) {
389
391
  const steps = []
390
392
 
391
- if (!mainImportChanged) {
392
- steps.push(`Add "${STYLE_IMPORT}" to your application entry file.`)
393
+ if (needsManualStyleImport) {
394
+ steps.push(
395
+ ['Import TinyRobot styles in your application entry file.', '', 'Example:', '', ` ${STYLE_IMPORT}`].join('\n'),
396
+ )
393
397
  }
394
398
 
395
- steps.push('Render <TinyRobotChat /> near your main application component.')
399
+ steps.push(
400
+ [
401
+ 'Render <TinyRobotChat /> near your main application component.',
402
+ '',
403
+ "Example ('src/App.vue'):",
404
+ '',
405
+ ' <script setup>',
406
+ " import TinyRobotChat from './TinyRobotChat.vue'",
407
+ ' </script>',
408
+ '',
409
+ ' <template>',
410
+ ' <YourAppComponent />',
411
+ ' <TinyRobotChat />',
412
+ ' </template>',
413
+ ].join('\n'),
414
+ )
396
415
 
397
416
  if (envChanged) {
398
- steps.push('Fill in your API key in .env.')
417
+ steps.push(
418
+ [
419
+ 'Configure your AI provider API key in the .env file.',
420
+ '',
421
+ 'Example:',
422
+ '',
423
+ ' VITE_DEEPSEEK_API_KEY=your_api_key',
424
+ ].join('\n'),
425
+ )
399
426
  }
400
427
 
401
428
  if (dependencyChanged) {
402
- steps.push('Run npm/pnpm install to update dependencies.')
429
+ steps.push(['Install or update project dependencies.', '', 'Example:', '', ' pnpm install'].join('\n'))
403
430
  }
404
431
 
405
432
  if (steps.length === 0) {
@@ -409,7 +436,7 @@ function printNextSteps({ mainImportChanged, envChanged, dependencyChanged }) {
409
436
  console.log('\nNext Steps\n')
410
437
 
411
438
  for (const [index, step] of steps.entries()) {
412
- console.log(`${index + 1}. ${step}`)
439
+ console.log(`${index + 1}. ${step}\n`)
413
440
  }
414
441
  }
415
442
 
package/bin/utils.js CHANGED
@@ -326,7 +326,9 @@ export function mergeEnvFile(templateFile, targetFile) {
326
326
  }
327
327
  }
328
328
 
329
- const nextContent = [targetContent.trimEnd(), '', ...appendLines, ''].join('\n')
329
+ const targetTrimmed = targetContent.replace(/\s*$/, '')
330
+
331
+ const nextContent = targetTrimmed ? `${targetTrimmed}\n${appendLines.join('\n')}\n` : `${appendLines.join('\n')}\n`
330
332
 
331
333
  fs.writeFileSync(targetFile, nextContent)
332
334
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@opentiny/tiny-robot-cli",
3
- "version": "0.4.1-alpha.0",
3
+ "version": "0.4.1-alpha.1",
4
4
  "description": "CLI to scaffold TinyRobot product projects",
5
5
  "type": "module",
6
6
  "bin": {
@@ -24,5 +24,5 @@
24
24
  "picocolors": "^1.1.1",
25
25
  "semver": "^7.8.1"
26
26
  },
27
- "gitHead": "22cb4503b47f2e1d2134d4a90d02b5643672ef6c"
27
+ "gitHead": "4edea25856dc8514a7fe06ea49b18d3672085521"
28
28
  }