@useguano/create 0.1.6 → 0.1.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.
- package/index.js +12 -11
- package/package.json +1 -1
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// @useguano/create: scaffold a project dir that runs Guano via npm scripts,
|
|
3
|
-
// install it, and connect Claude
|
|
3
|
+
// install it, and connect Claude — all in this one command, so what
|
|
4
4
|
// is left afterwards is `cd my-site && npm run dev`. Zero dependencies —
|
|
5
5
|
// prompts with node:readline.
|
|
6
6
|
//
|
|
@@ -9,7 +9,8 @@
|
|
|
9
9
|
//
|
|
10
10
|
// The MCP connect runs through the just-installed package's own
|
|
11
11
|
// `guano connect --offline`: it mints a PENDING API token into <dir>/data,
|
|
12
|
-
// writes the two agent permissions there, and writes
|
|
12
|
+
// writes the two agent permissions there, and writes the config of every
|
|
13
|
+
// Claude client on the machine (Claude Code and Claude Desktop).
|
|
13
14
|
// The server binds the token to the first admin at /admin setup, and the
|
|
14
15
|
// setup form shows the permissions instead of asking them again.
|
|
15
16
|
import { spawnSync } from 'node:child_process'
|
|
@@ -43,7 +44,7 @@ if (!dir) {
|
|
|
43
44
|
dir = rl ? (await ask(`Project folder (${DEFAULT_DIR}): `)).trim() || DEFAULT_DIR : DEFAULT_DIR
|
|
44
45
|
}
|
|
45
46
|
|
|
46
|
-
// Connect Claude
|
|
47
|
+
// Connect Claude? Flags decide non-interactively (CI never asks and
|
|
47
48
|
// never connects); a terminal asks, default yes.
|
|
48
49
|
let connect = false
|
|
49
50
|
let policyFlags = []
|
|
@@ -52,7 +53,7 @@ if (flag('--no-connect')) {
|
|
|
52
53
|
} else if (flag('--connect') || flag('--main') || flag('--publish')) {
|
|
53
54
|
connect = true
|
|
54
55
|
} else if (rl) {
|
|
55
|
-
connect = await yes('Connect Claude Desktop to this site over MCP?', true)
|
|
56
|
+
connect = await yes('Connect Claude (Code and Desktop) to this site over MCP?', true)
|
|
56
57
|
}
|
|
57
58
|
if (connect) {
|
|
58
59
|
if (flag('--main')) policyFlags.push('--main')
|
|
@@ -197,14 +198,14 @@ site. Your published site is served at http://localhost:${port}/.
|
|
|
197
198
|
This project runs on port ${port} (set in \`.env\`). Each Guano site on a
|
|
198
199
|
machine needs its own, so two of them never answer for one address.
|
|
199
200
|
|
|
200
|
-
If you said yes to Claude
|
|
201
|
+
If you said yes to Claude when scaffolding, it is already connected:
|
|
201
202
|
the agent token is bound to the admin account you create, and the permissions
|
|
202
203
|
you chose (edit the live project, publish) show on the setup form and stay
|
|
203
204
|
editable in Settings → MCP → Agent permissions.
|
|
204
205
|
|
|
205
206
|
- \`npm run start\` — production server (\`NODE_ENV=production\`)
|
|
206
207
|
- \`npm run build\` — export the site as static files to \`./dist-site\`
|
|
207
|
-
- \`npm run connect\` — connect Claude
|
|
208
|
+
- \`npm run connect\` — connect Claude later, or from another machine (writes Claude Code's \`~/.claude.json\` and Claude Desktop's config; quit Desktop first; \`--main\` / \`--publish\` grant the agent permissions, or it asks)
|
|
208
209
|
- everything lives in \`./data\` — **backing up = copying that directory**
|
|
209
210
|
|
|
210
211
|
See the @useguano/guano package README for deploy notes and environment variables.
|
|
@@ -226,7 +227,7 @@ if (install) {
|
|
|
226
227
|
if (!installed) console.error('\nnpm install failed — run it yourself in the project folder.')
|
|
227
228
|
}
|
|
228
229
|
|
|
229
|
-
// ---- connect Claude
|
|
230
|
+
// ---- connect Claude, through the installed package ----
|
|
230
231
|
// GUANO_CREATE_LOCAL_PKG is a dev-only escape hatch: with --no-install there
|
|
231
232
|
// is no node_modules, so a repo checkout names its own packages/guano here.
|
|
232
233
|
let connected = false
|
|
@@ -235,7 +236,7 @@ if (connect) {
|
|
|
235
236
|
? join(target, 'node_modules', '@useguano', 'guano')
|
|
236
237
|
: process.env.GUANO_CREATE_LOCAL_PKG
|
|
237
238
|
if (!pkgDir) {
|
|
238
|
-
console.error('\nClaude
|
|
239
|
+
console.error('\nClaude not connected: guano is not installed yet — run `npm run connect` inside the project later.')
|
|
239
240
|
} else {
|
|
240
241
|
try {
|
|
241
242
|
// the package resolves its data dir from this env at import time
|
|
@@ -245,7 +246,7 @@ if (connect) {
|
|
|
245
246
|
const { main } = await import(pathToFileURL(join(pkgDir, 'mcp', 'connect.mjs')).href)
|
|
246
247
|
const connectArgs = [...policyFlags, '--offline', '--yes']
|
|
247
248
|
if (opt('--config')) connectArgs.push('--config', resolve(opt('--config')))
|
|
248
|
-
console.log('\nConnecting Claude
|
|
249
|
+
console.log('\nConnecting Claude…')
|
|
249
250
|
await main(connectArgs, {
|
|
250
251
|
whenClaudeRunning: async () => {
|
|
251
252
|
if (!rl) return 'skip'
|
|
@@ -257,7 +258,7 @@ if (connect) {
|
|
|
257
258
|
})
|
|
258
259
|
connected = true
|
|
259
260
|
} catch (e) {
|
|
260
|
-
console.error(`\n✗ ${e?.message ?? e}\n Claude
|
|
261
|
+
console.error(`\n✗ ${e?.message ?? e}\n Claude not connected — run \`npm run connect\` inside the project later.`)
|
|
261
262
|
}
|
|
262
263
|
}
|
|
263
264
|
}
|
|
@@ -267,4 +268,4 @@ console.log(`
|
|
|
267
268
|
Next:
|
|
268
269
|
cd ${dir}${installed || !install ? '' : '\n npm install'}
|
|
269
270
|
npm run dev → http://localhost:4174/admin (create your admin account)
|
|
270
|
-
${connected ? '\nThen open Claude
|
|
271
|
+
${connected ? '\nThen open Claude — guano is connected; the agent token is bound to the admin you create.\n' : ''}`)
|