startup-builder 0.1.0 → 0.3.0

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Longtail Holdings, LLC.
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,179 +1,120 @@
1
1
  # startup-builder
2
2
 
3
- Business-as-Code. Define your startup in minutes.
4
3
 
5
- ## Quick Start
4
+ The command line for [api.sb](https://api.sb), with an optional local MCP server. Agents use it to take work from the queue: see open batches, claim one, read its prompt, close its Tasks, and give back what is left. The grammar is in `docs/grammar.md` in the source repository (a sketch).
6
5
 
7
- ```bash
8
- npx startup-builder
6
+ Requires Node.js 20 or newer. Start by signing in and reading a business:
7
+
8
+ ```sh
9
+ npx startup-builder --help
10
+ npx startup-builder login
11
+ npx startup-builder whoami
12
+ npx startup-builder show /headless.ly --json
13
+ npx startup-builder help do
9
14
  ```
10
15
 
11
- ## Install
16
+ `login` opens id.org.ai in your browser; `login --device` supports terminals without a local browser. Use `--json` where the command's help offers it for structured output.
17
+
18
+ `npx startup-builder` can use a locally installed version. Use `npx startup-builder@latest` to explicitly select the stable release channel, or an exact version to reproduce an earlier run. Keep a resolved version for a long-running assignment; new sessions can pick up releases.
19
+
20
+ Once assigned work, an agent can use the queue:
12
21
 
13
- ```bash
14
- npm install startup-builder
22
+ ```sh
23
+ npx startup-builder queue for:tom
24
+ npx startup-builder claim
25
+ npx startup-builder prompt
26
+ npx startup-builder close 1 --body r1.json
27
+ npx startup-builder release
15
28
  ```
16
29
 
17
- ## What You Get
30
+ Inside a claimed batch, `close <n>` runs in do Mode with the lease's own token. Every write is versioned, so `versions <ref>` and `revert <ref> --to <v>` undo it.
18
31
 
19
- One command. Complete startup foundation.
32
+ In claude-runner's container the dispatcher holds the claim: with `SB_BATCH` set and no local lease, the CLI builds the lease in memory from `GET <SB_BATCH>` and never writes it; `renew` and `release` are the dispatcher's. A 409 `lease_ended` means stop (exit 4).
20
33
 
21
- ```bash
22
- startup-builder "AI code review for engineering teams"
23
- ```
34
+ The Owner steers the loop by editing its prompts: `startup-builder prompt coordinate-review --set new.md` writes the next version (versioned and revertible; a lease token is refused, and so is `--set` inside a batch).
35
+
36
+ `--api` (and the other global options) go before the command: `startup-builder --api <url> show 1`. Inside a batch (`SB_BATCH` set) the API is the batch's own: `--api` is refused, and so is an `SB_API` on another origin.
24
37
 
38
+ ## Hosted MCP with OAuth
39
+
40
+ Connect your agent host to `https://api.sb/mcp` using Streamable HTTP and sign in with id.org.ai through that host. No local CLI process is required. For Claude Code:
41
+
42
+ ```sh
43
+ claude mcp add --transport http sb https://api.sb/mcp
25
44
  ```
26
- ✓ Foundation Sprint Complete problem/solution definition
27
- ✓ Lean Canvas One-page business model
28
- ✓ ICP Ideal customer profile
29
- ✓ Jobs-to-be-Done Customer motivation map
30
- ✓ StoryBrand Clear messaging framework
31
- ✓ Name Startup name + domain
32
- ✓ Landing Page Ready to deploy
45
+
46
+ Then use `/mcp` to authenticate. For Codex, configure the server and authenticate:
47
+
48
+ ```sh
49
+ codex mcp add sb --url https://api.sb/mcp
50
+ codex mcp login sb
33
51
  ```
34
52
 
35
- ## CLI
53
+ The hosted server exposes `search`, `fetch` and `do`. Fetch `/$.d.ts` for the current types; `do` executes TypeScript against `$`, for example `return await $.search('headless.ly')`. Check runtime limitations in the returned definitions. Connecting MCP does not automatically supply an agent's operating instructions or Objectives.
36
54
 
37
- ```bash
38
- # Full guided experience
39
- startup-builder
55
+ CLI `do` instead takes a noun verb and a target. The interfaces share api.sb but do not expose identical tools. Hosted HTTP with OAuth is the integration path for remote and web agents; validate it independently of local stdio.
40
56
 
41
- # Start from idea
42
- startup-builder "your startup idea"
57
+ ## Optional local MCP over stdio
43
58
 
44
- # Run specific modules
45
- startup-builder foundation # Foundation sprint
46
- startup-builder canvas # Lean canvas
47
- startup-builder icp # Ideal customer profile
48
- startup-builder jtbd # Jobs to be done
49
- startup-builder story # StoryBrand messaging
50
- startup-builder name # Name generation
51
- startup-builder landing # Landing page
59
+ The CLI's queue verbs are available as MCP tools (`queue`, `claim`, `prompt`, `show`, `close`, `renew`, `release`, `worklist`, `versions`, `changes`), with the same compact answers:
52
60
 
53
- # Export everything
54
- startup-builder export --format md
55
- startup-builder export --format json
61
+ ```sh
62
+ claude mcp add startup-builder -- npx -y startup-builder mcp
63
+ # with a bearer instead of the stored sign-in:
64
+ claude mcp add startup-builder -e SB_TOKEN=… -- npx -y startup-builder mcp
56
65
  ```
57
66
 
58
- ## SDK
59
-
60
- ```typescript
61
- import { builder } from 'startup-builder'
62
-
63
- // Build complete startup foundation
64
- const startup = await builder.create({
65
- idea: 'AI code review for engineering teams',
66
- founder: {
67
- capabilities: ['ML expertise', 'DevTools experience'],
68
- insight: 'Code review is the biggest bottleneck',
69
- motivation: 'Hated waiting for reviews'
70
- }
71
- })
72
-
73
- // Returns complete startup package
74
- // {
75
- // foundation: { problem, customer, solution, mvp, validation },
76
- // canvas: { ... 9 boxes ... },
77
- // icp: { firmographics, buyer, problems, goals, buying },
78
- // jtbd: { mainJob, relatedJobs, forces },
79
- // story: { character, problem, guide, plan, cta, failure, success },
80
- // name: { name, tagline, domain },
81
- // landing: { url, sections }
82
- // }
83
-
84
- // Build incrementally
85
- const foundation = await builder.foundation('AI code review')
86
- const canvas = await builder.canvas(foundation)
87
- const icp = await builder.icp(foundation)
88
- const story = await builder.story(foundation, icp)
89
- const name = await builder.name(foundation)
90
- const landing = await builder.landing(name, story)
91
- ```
67
+ Authentication works the same as the CLI: `SB_TOKEN`, else the stored sign-in (`startup-builder login`), and for the claimed batch its lease. Leases live in `~/.config/startup-builder/leases/` (mode 0600), shared by the CLI and the MCP server.
92
68
 
93
- ## The Flow
69
+ The Owner's tools are off by default. `startup-builder mcp --owner` adds `revert` and `prompt`'s `set` (a Prompt's next version), acting with the stored sign-in; without it a client holding the server can do neither.
94
70
 
95
- ```
96
- ┌─────────────────────────────────────────────────────────────────────┐
97
- │ 1. FOUNDATION SPRINT │
98
- │ Problem → Customer → Solution → MVP → Validation │
99
- ├─────────────────────────────────────────────────────────────────────┤
100
- │ 2. LEAN CANVAS │
101
- │ Complete business model on one page │
102
- ├─────────────────────────────────────────────────────────────────────┤
103
- │ 3. IDEAL CUSTOMER PROFILE │
104
- │ Know exactly who you're building for │
105
- ├─────────────────────────────────────────────────────────────────────┤
106
- │ 4. JOBS TO BE DONE │
107
- │ Understand why customers will buy │
108
- ├─────────────────────────────────────────────────────────────────────┤
109
- │ 5. STORYBRAND │
110
- │ Clarify your message │
111
- ├─────────────────────────────────────────────────────────────────────┤
112
- │ 6. NAME + DOMAIN │
113
- │ Find the perfect name, claim the domain │
114
- ├─────────────────────────────────────────────────────────────────────┤
115
- │ 7. LANDING PAGE │
116
- │ Deploy and start collecting signups │
117
- └─────────────────────────────────────────────────────────────────────┘
71
+ ```sh
72
+ claude mcp add startup-builder-owner -- npx -y startup-builder mcp --owner
118
73
  ```
119
74
 
120
- ## Output
75
+ ## Run a worker loop
121
76
 
122
- Everything syncs to your Startups.Studio dashboard and exports to code:
77
+ `work` claims the next batch, hands its prompt to an agent, renews the lease while it works, and releases the batch when the agent exits. Unclosed Tasks go back to the queue. Then it claims the next batch.
123
78
 
124
- ```
125
- my-startup/
126
- ├── startup.mdx # Complete startup definition
127
- ├── canvas.mdx # Lean canvas
128
- ├── icp.mdx # Ideal customer profile
129
- ├── messaging.mdx # StoryBrand script
130
- ├── experiments.mdx # Validation experiments
131
- └── landing/ # Deployable landing page
132
- ├── index.html
133
- └── styles.css
79
+ ```sh
80
+ npx startup-builder work --agent claude --for scout # loop until the queue is empty
81
+ npx startup-builder work --agent claude --once # one batch
82
+ npx startup-builder work --agent claude --wait --max-batches 20
83
+ npx startup-builder work --agent claude --max-minutes 45 # a batch's wall-clock cap (default 30)
84
+ npx startup-builder work --agent print # print the prompt; a person or another harness closes the Tasks
134
85
  ```
135
86
 
136
- ## Deploy
87
+ - **`--agent claude`** runs the local Claude Code non-interactively (`claude -p`, stream-json), on the account `claude` is logged into, a Max subscription. Its environment loses API keys, gateway and cloud-provider switches (`ANTHROPIC_API_KEY`, `ANTHROPIC_BASE_URL`, `ANTHROPIC_CUSTOM_HEADERS`, Bedrock, Vertex, Foundry, AWS credentials), other bearers (`SB_RUNNER_TOKEN`) and your lease directory.
88
+ - The model is `claude-opus-5-5` (`DEFAULT_MODEL` in `src/next/models.ts`); `--model` overrides it.
89
+ - Its tools are scoped: the batch subcommands of this CLI (`close`, `show`, `prompt`, `versions`), files in its own working directory, and web reads. `run`, `work`, `login`, `logout`, `claim`, `renew`, `release`, `revert`, `do` and anything else are denied.
90
+ - It is isolated from the machine: `--restricted` ignores your own Claude Code settings (allow rules, auto mode) and keeps file tools inside its working directory, `--strict-mcp-config` loads none of your MCP servers, and `--permission-mode dontAsk` denies anything not allowed.
91
+ - What it runs is out of its reach. Each batch gets two temp directories side by side: `sb-work-*`, its working directory, and `sb-home-*` (mode 0700), holding the `startup-builder` it finds first on its PATH (read-only, in a read-only directory) and its own config directory (`XDG_CONFIG_HOME`) with only its batch's lease. Its file tools cannot rewrite the CLI it runs, and its CLI cannot read or remove your sign-in or your other leases. Both directories are deleted when the batch ends.
92
+ - The lease token reaches it only as `SB_TOKEN` in its environment, never in the prompt or on a command line.
137
93
 
138
- ```typescript
139
- // Deploy everything
140
- const deployed = await builder.deploy(startup, {
141
- domain: 'acme.hq.sb' // Or your own domain
142
- })
94
+ ### Isolation: what a batch agent can and cannot do
143
95
 
144
- // {
145
- // landing: 'https://acme.hq.sb',
146
- // dashboard: 'https://startups.studio/acme'
147
- // }
148
- ```
96
+ Inside a batch (`SB_BATCH` set) the CLI holds to the batch:
149
97
 
150
- ## MCP Server
151
-
152
- ```json
153
- {
154
- "mcpServers": {
155
- "startup-builder": {
156
- "command": "npx",
157
- "args": ["startup-builder", "mcp"]
158
- }
159
- }
160
- }
161
- ```
98
+ - **One API.** The lease token is bound to the API its batch was claimed on, and the stored sign-in to the API it was issued for: neither is sent anywhere else. `--api` is refused, and so is an `SB_API` on another origin.
99
+ - **One directory.** `close --body <file>` reads only a regular file inside the agent's working directory (`SB_WORKDIR`), by its real path: no `..`, no absolute path elsewhere, no symlink out. Anything else is refused before it is read. `--body -` reads stdin.
100
+ - **No lease management.** `renew` and `prompt --set` are refused; the loop renews the lease, and never past its own wall-clock cap (`--max-minutes`, default 30), when it stops the agent and releases the batch.
101
+
102
+ **Accepted risk: the agent holds its own lease token.** It is `SB_TOKEN` in the agent's environment. Its file tools no longer reach the lease copy and its Bash runs only the batch subcommands, but treat the token as readable by the agent: it keeps web reads (WebFetch, WebSearch), which research needs, so an agent that got hold of the token could carry it off in a URL. The damage is bounded instead of prevented: the token reaches one batch (its Tasks, for as long as the lease, at most the wall-clock cap), the CLI will not send it to any other origin, and every write it can make on api.sb is versioned and revertible (`versions`, `revert`).
103
+ - **`--agent codex`** runs `codex exec -` with the prompt on stdin, the same scrubbed environment (including `OPENAI_API_KEY`: codex uses its own `codex login`) and its own config directory. None of the Claude isolation flags apply: codex's own sandbox and config decide what it may run.
104
+ - **Logs:** each batch writes one compact line per event to stdout, and the agent's stream-json to `~/.config/startup-builder/logs/`. Ctrl-C releases the batch before exiting.
105
+
106
+ `run --cloud for:<worker>` hands a Worker's worklist to claude-runner. There is no local `run`: a local agent runs through `work`.
107
+
108
+ On Cloudflare the same loop runs without a laptop. claude-runner's dispatcher claims batches and runs each in a Sandbox container, on a pooled Max token that is added only at egress.
109
+
110
+ With 15 Max accounts, run one `work` per logged-in account (one machine or container each). Each claims its own batches, and a 409 on a batch someone else just took moves it on to the next.
162
111
 
163
- > "Build a startup around AI code review"
164
- > "Create a lean canvas for my idea"
165
- > "What should my MVP look like?"
112
+ ## Library
166
113
 
167
- ## Includes
114
+ `import { Api, Session, work } from 'startup-builder'` uses the same client and work loop as the CLI.
168
115
 
169
- - [foundation-sprint](../foundation-sprint) - Foundation definition
170
- - [lean-canvas](../lean-canvas) - Business model canvas
171
- - [ideal-customer-profile](../ideal-customer-profile) - Customer targeting
172
- - [jobs-to-be-done](../jobs-to-be-done) - Customer jobs
173
- - [storybrand](../storybrand) - Messaging framework
174
- - [startup-names](../startup-names) - Name generation
175
- - [landing-page](../landing-page) - Page generation
116
+ ### Migrating from 0.2
176
117
 
177
- ## License
118
+ 0.3 replaces the Foundation Sprint interface with the api.sb CLI. The former Sprint commands and state-machine exports have been removed; there is no `startup-builder/machines` export. Applications using 0.2's library API must migrate before upgrading. The current exports are listed in the package's TypeScript declarations.
178
119
 
179
- MIT
120
+ The client sends its bearer only to the API's own origin (https, or http on loopback). A URL on another origin is read without it, and a write to one is refused.