@surph_ai/cli 0.0.23 → 0.0.25

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@surph_ai/cli",
3
- "version": "0.0.23",
3
+ "version": "0.0.25",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "types": "./types.d.ts",
package/scaffold/index.js CHANGED
@@ -5,6 +5,20 @@ const fs = require('fs')
5
5
  const dotenv = require('dotenv')
6
6
  const utils = require('../utils')
7
7
 
8
+ // Cross-platform browser opener. Falls back to printing the URL — matters for
9
+ // SSH / headless / broken default handlers, where `open` silently no-ops.
10
+ const openBrowser = (url) => {
11
+ const cmd = process.platform === 'darwin' ? `open "${url}"`
12
+ : process.platform === 'win32' ? `start "" "${url}"`
13
+ : `xdg-open "${url}"`
14
+ exec(cmd, (err) => {
15
+ if (err) {
16
+ console.log(colors.yellow(`\nCouldn't open browser automatically. Open this URL manually:\n`))
17
+ console.log(colors.cyan(url) + '\n')
18
+ }
19
+ })
20
+ }
21
+
8
22
  function generateRandomSuffix(length = 6) {
9
23
  const chars = 'abcdefghijklmnopqrstuvwxyz0123456789';
10
24
  let result = '';
@@ -79,9 +93,9 @@ module.exports = async (name, type = 'app') => {
79
93
  shell.cp('-R', path.join(__dirname, `tool/examples/weather/index.ts`), 'examples/weather/index.ts')
80
94
  shell.cp('-R', path.join(__dirname, `tool/examples/weather/manifest.json`), 'examples/weather/manifest.json')
81
95
 
82
- shell.mkdir('-p', 'examples/dealfinder')
83
- shell.cp('-R', path.join(__dirname, `tool/examples/dealfinder/index.ts`), 'examples/dealfinder/index.ts')
84
- shell.cp('-R', path.join(__dirname, `tool/examples/dealfinder/manifest.json`), 'examples/dealfinder/manifest.json')
96
+ // shell.mkdir('-p', 'examples/dealfinder')
97
+ // shell.cp('-R', path.join(__dirname, `tool/examples/dealfinder/index.ts`), 'examples/dealfinder/index.ts')
98
+ // shell.cp('-R', path.join(__dirname, `tool/examples/dealfinder/manifest.json`), 'examples/dealfinder/manifest.json')
85
99
 
86
100
 
87
101
  utils.write('manifest-example.json', JSON.stringify({
@@ -145,12 +159,18 @@ module.exports = async (name, type = 'app') => {
145
159
  const cheatsheetResp = await fetch('https://surph.s3.us-east-1.amazonaws.com/tools/cli/CHEATSHEET.md')
146
160
  utils.write('CHEATSHEET.md', await cheatsheetResp.text())
147
161
 
162
+ shell.cd(name)
163
+ shell.exec('npm install')
164
+ shell.exec('npm run dev')
165
+ openBrowser('http://localhost:6767')
166
+
148
167
  console.log('\n- - - - - Next Steps - - - - - ')
149
- console.log('1. $ cd ' + name)
150
- console.log('2. $ npm install or $ yarn install')
151
- console.log('3. $ npm run dev')
152
- console.log('4. Open http://localhost:6767 in a browser')
168
+ console.log('Open codebase in a code editor and navigate to /tools/index.ts - this is where your tool code goes.')
153
169
  console.log('\nFor full documentation, visit https://docs.surph.ai\n')
170
+ // console.log('1. $ cd ' + name)
171
+ // console.log('2. $ npm install or $ yarn install')
172
+ // console.log('3. $ npm run dev')
173
+ // console.log('4. Open http://localhost:6767 in a browser')
154
174
 
155
175
  }
156
176
  }
@@ -4,7 +4,7 @@
4
4
  "private": true,
5
5
  "type": "module",
6
6
  "scripts": {
7
- "dev": "npm run build && concurrently \"npm run watch\" \"surph toolserver\" \"surph chatserver\"",
7
+ "dev": "npm run build && concurrently \"npm run watch\" \"surph toolserver\" \"surph chatserver\" \"surph browser 'http://localhost:6767'\"",
8
8
  "test": "",
9
9
  "build": "rimraf dist && tsc",
10
10
  "watch": "tsc -w",