feat: add npx open-stellar bootstrap CLI (#242)#307
Conversation
- Add scripts/cli/bootstrap.mjs — scaffolds a new agent project:
- Creates [project-name]/ directory with guard against existing dirs
- Copies all template files from scripts/templates/agent/
- Substitutes {{PROJECT_NAME}} in package.json, README.md, app/page.tsx
- Runs npm install in the new directory
- Prints colourised success message with next-steps
- Validates project name (lowercase, alphanumeric + hyphens)
- Add scripts/templates/agent/ template files:
- package.json (minimal Next.js + Stellar deps)
- tsconfig.json
- next.config.mjs
- .env.example (all vars from main project with inline comments)
- README.md (with {{PROJECT_NAME}} placeholder)
- lib/agent.ts (minimal agent registration stub)
- app/page.tsx (styled placeholder dashboard)
- Add scripts/cli/bootstrap.test.ts (Vitest):
- Verifies all expected files are created
- Verifies {{PROJECT_NAME}} substitution in package.json, README, page.tsx
- Verifies .env.example contains all required env var keys
- Verifies npm install creates node_modules
- Verifies error on duplicate directory
- Verifies error on missing project name
- Verifies error on invalid project name (uppercase)
- Register open-stellar binary in root package.json
- Add bootstrap convenience npm script
|
CI is failing with a TypeScript error in the template file: In // At the top of the template file or before line 41:
const PROJECT_NAME = process.env.NEXT_PUBLIC_PROJECT_NAME ?? 'My Agent'
// Or if this is a template placeholder string, escape it from TS checking:
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const PROJECT_NAME = (globalThis as any).PROJECT_NAME ?? 'My Agent'Push the fix and CI should pass! |
|
The latest push (fc58135) still has the same error: The fix needs to be in // Option A: declare the variable
const PROJECT_NAME = process.env.NEXT_PUBLIC_APP_NAME ?? 'My Agent'Or if { "exclude": ["scripts/templates/**"] } |
|
Changes made. Kindly re-review. For the second PR, it is an error on my part. It was not meant for this repo. |
|
Kindly rereview please. |
|
leocagli
left a comment
There was a problem hiding this comment.
Thanks @Killerjunior — the required CI ("Typecheck, tests, build, and guards") fails: scripts/cli/bootstrap.test.ts (9 tests) can't resolve scripts/cli/bootstrap.mjs:
Error: Cannot find module '/home/runner/work/Open-Stellar/scripts/cli/bootstrap.mjs'
The test references a source file that isn't included in the PR (or the path is wrong). Please add scripts/cli/bootstrap.mjs (or fix the import path) so the tests pass. SonarCloud and the spec guard are green — once CI is fully green and the branch is rebased on main, this can merge.



Closes #242