@christianirack/create-brainllm 0.0.0-stage → 0.1.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.
Files changed (4) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +389 -2
  3. package/bin/create.js +24 -0
  4. package/package.json +27 -4
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Christian Irack Flores Maldonado
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,3 +1,390 @@
1
- # Temporary Holding Version
1
+ # @christianirack/create-brainllm
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ The BRAINLLM project initializer. Create an app:
4
+
5
+ ```sh
6
+ npm create @christianirack/brainllm@latest my-app
7
+ cd my-app
8
+ npm run dev
9
+ ```
10
+
11
+ Runs the same pinned BRAINLLM compiler and installs the generated app dependencies. Pass `-- --no-install` to skip dependency installation.
12
+
13
+ <p align="center"><img src="https://raw.githubusercontent.com/chrisifm/BRAINLLM/main/docs/site/assets/logo.png" width="88" alt="BRAINLLM brain mark"></p>
14
+
15
+ # BRAINLLM
16
+
17
+ ### The web compiler for LLMs.
18
+
19
+ **Your LLM owns the frontend. Give it a language built for the job.**
20
+
21
+ ![BRAINLLM — The web compiler for LLMs](https://github.com/chrisifm/BRAINLLM/raw/main/docs/site/assets/cover.png)
22
+
23
+ BRAINLLM gives coding agents a compact language, a single specification and a compiler that tells them how to fix
24
+ mistakes. The model builds the frontend. You set the direction, inspect the result and decide what ships.
25
+
26
+ `.brain` components compile to direct-DOM JavaScript and scoped CSS. The Rust toolchain handles parsing, checking,
27
+ code generation, bundling and minification. The agent can operate it through the CLI or MCP.
28
+
29
+ **Build with it. Let your LLM make it better.** Every run is a chance to spot a compiler bug, an expensive step or
30
+ a confusing diagnostic. The agent can turn that finding into a tested proposal and, when configured, push it
31
+ automatically to a review branch. Maintainers decide what merges.
32
+
33
+ **[Visit the site](https://chrisifm.github.io/BRAINLLM/)** · **[Build your first app](#give-your-agent-its-first-task)** · **[Read the spec](https://github.com/chrisifm/BRAINLLM/blob/main/SPEC.md)** · **[See the benchmarks](#show-me-the-numbers)** · **[Contribute](#build-the-tool-your-agent-needs)**
34
+
35
+ ## A frontend language with the model in mind
36
+
37
+ An agent writing your app needs a contract it can follow and feedback it can act on. BRAINLLM makes that loop
38
+ explicit: read the spec, generate a component, check it, apply the fix, test the result.
39
+
40
+ ![An agent reads the BRAINLLM contract, writes a component and uses compiler feedback to validate the app](https://github.com/chrisifm/BRAINLLM/raw/main/docs/site/assets/agent-loop.png)
41
+
42
+ - **Less to guess.** `brain spec` defines the supported language. One component format, a prescribed project
43
+ structure and generators keep the model working inside a known contract.
44
+ - **Feedback it can use.** Diagnostics include the file, location, rule and proposed fix. Mechanical fixes carry
45
+ exact replacement edits; `brain fix` applies them. Decisions that need judgment remain visible to the agent.
46
+ - **Tools for the whole loop.** `brain map --json`, `brain check --json`, `brain doctor` and `brain build` let the
47
+ agent inspect, validate and compile its work. `brain mcp` exposes tools over stdio.
48
+ - **Output for the browser.** Signals update the affected DOM nodes. The toolchain includes its own compiler,
49
+ bundler and minifier, with no Vite, webpack, esbuild or Babel in the build pipeline.
50
+
51
+ BrainScript builds on HTML, CSS and a constrained subset of JavaScript. It is designed to reduce the choices an
52
+ agent has to reconstruct while preserving code that a developer can read and review.
53
+
54
+ ## What your agent gets to work with
55
+
56
+ | Capability | What it does for the app-building loop |
57
+ |---|---|
58
+ | A served language contract | `brain spec` gives the model the implemented syntax and conventions |
59
+ | Components and reactive state | `.brain` files combine markup, BrainScript and scoped styles; `sig`, `drv` and `fx` express updates |
60
+ | Forms and data | Form validation, HTTP resources and server contracts give common app behavior a documented path |
61
+ | Routes and layouts | Views, layouts, loaders and guards put navigation and access checks into the project structure |
62
+ | Diagnostics and repairs | JSON diagnostics identify failures; supported mechanical edits can be applied with `brain fix` |
63
+ | Context and automation | The project map, focused reads, CLI and MCP tools let an agent inspect and operate the app |
64
+ | Verification and delivery | Tests, `brain doctor` and the production build make validation part of the workflow |
65
+ | Tested compiler improvements | Isolated proposals, validation gates and optional review-branch pushes let the agent contribute fixes |
66
+
67
+ Use [SPEC.md](https://github.com/chrisifm/BRAINLLM/blob/main/SPEC.md), the served `brain spec` and [EVOLUTION.md](https://github.com/chrisifm/BRAINLLM/blob/main/docs/EVOLUTION.md) for exact contracts and limits.
68
+
69
+ ## Where it fits in the frontend stack
70
+
71
+ These tools occupy different layers. This is a comparison of their roles, not a universal speed ranking. Linked
72
+ project documentation describes each tool; the BRAINLLM column explains the choice this project makes.
73
+
74
+ | Project | Main role | How BRAINLLM approaches that part of the job |
75
+ |---|---|---|
76
+ | [React](https://react.dev/) | Library for building component-based user interfaces | A dedicated component language, compiler and agent workflow together |
77
+ | [Angular](https://angular.dev/overview) | Web application framework with integrated tooling | A constrained language and normative spec built around LLM authorship |
78
+ | [Vue](https://vuejs.org/guide/introduction.html) | Progressive framework for declarative, reactive interfaces | Prescribed component syntax and structure with compiler-guided repairs |
79
+ | [Astro](https://docs.astro.build/en/concepts/why-astro/) | Web framework focused on content-driven sites and islands | A language and toolchain for agent-authored frontends, with its own rendering contracts |
80
+ | [Vite](https://vite.dev/guide/) | Development server and production build tooling | An integrated Rust pipeline for `.brain` applications |
81
+ | [webpack](https://webpack.js.org/concepts/) | Module bundler with loaders and plugins | Its own bundler and minifier as part of the compiler pipeline |
82
+ | **BRAINLLM** | **Frontend language, compiler, runtime and agent contract** | **The model writes, checks and improves within one documented workflow** |
83
+
84
+ Other projects also offer AI guidance and tooling. BRAINLLM's emphasis is the authoring contract itself. It does
85
+ not run existing React, Angular or Vue components unchanged, and replacing a build tool alone is not a migration.
86
+ The numerical comparison below covers only the measured React/Vite and Svelte/Vite fixture builds.
87
+
88
+ ## A form shouldn't need an ecosystem.
89
+
90
+ Your agent came to build a button. Your stack handed it a committee.
91
+
92
+ If setup decisions are consuming the session, give the model a toolchain with a defined contract.
93
+
94
+ BRAINLLM brings component syntax, state, forms, routing and compiler feedback into one documented workflow. Its
95
+ Rust toolchain owns the build pipeline, and the browser runtime has no third-party dependencies. Start with the
96
+ web behavior you need; give the agent a smaller set of conventions to learn and check.
97
+
98
+ **Less tooling. More web.**
99
+
100
+ ## Show me the numbers
101
+
102
+ **Don't trust the headline. Run the benchmark.**
103
+
104
+ If you like reading raw timings more than launch posts, this part is for you. Inspect the fixture, reproduce the
105
+ run and keep the result even when it disagrees with ours.
106
+
107
+
108
+ **Seven stacks. The same dashboard workflow. 140 measured builds.**
109
+
110
+ | Warm production build | Median, 20 runs | Standard deviation |
111
+ |---|---:|---:|
112
+ | BRAINLLM | 34.32 ms | 13.23 ms |
113
+ | React + Vite | 155.49 ms | 16.71 ms |
114
+ | Vue + Vite | 211.76 ms | 53.56 ms |
115
+ | Svelte + Vite | 243.53 ms | 56.14 ms |
116
+ | Astro + React island | 504.78 ms | 77.45 ms |
117
+ | Angular CLI | 1,262.50 ms | 69.03 ms |
118
+ | React + webpack | 1,334.54 ms | 560.99 ms |
119
+
120
+ All seven implementations passed the same nine Chrome interaction checks, including create, search, edit and delete.
121
+ These measurements use frozen BRAINLLM source `7889787`, Apple M5 with 24 GiB RAM, Node 26.12.0 and two warmups per
122
+ stack. Builds run serially on a shared machine. Variance matters: inspect the raw samples, especially webpack's.
123
+ The output strategies differ (including SSR, client rendering and an Astro React island); this comparison measures
124
+ production build duration for this fixture, not universal app performance or feature equivalence.
125
+
126
+ Read the [expanded method, versions, payloads and results](https://github.com/chrisifm/BRAINLLM/blob/main/bench/build/expanded.md). The original three-stack
127
+ [historical results](https://github.com/chrisifm/BRAINLLM/blob/main/bench/build/results/summary.md) remain available unchanged. Use `bench/build/expanded.mjs`
128
+ with the documented frozen binary and scratch-directory setup to reproduce this seven-stack run.
129
+
130
+ **Ask your agent to challenge the result:**
131
+
132
+ ```text
133
+ Reproduce BRAINLLM's build benchmark and tell me what the evidence supports.
134
+ First inspect bench/build/README.md, bench/build/run.sh, the frozen fixture,
135
+ the React/Svelte reference implementations and their pinned dependencies.
136
+ Explain the output differences and required tools before running anything.
137
+
138
+ Run bench/build/run.sh in an isolated workspace using its documented settings.
139
+ Keep the compared fixture implementations unchanged. Record the compiler hash,
140
+ tool versions, hardware, machine load, warmups and sample count. Preserve the
141
+ raw timings and report cold and warm medians in ms, plus the measured HTML,
142
+ CSS and JavaScript payload in KiB gzip with every excluded asset identified.
143
+
144
+ Compare the local results with the checked-in results. Report failures,
145
+ limitations and regressions as observed. Do not claim a win unless the actual
146
+ numbers support it. Do not upload results or publish anything automatically.
147
+ Clean up only the temporary resources this run created.
148
+ ```
149
+
150
+ A separate [cache-key microbenchmark](https://github.com/chrisifm/BRAINLLM/blob/main/bench/build/results/compiler-cache-lookup.json) measured **43.3× faster key
151
+ lookup** after removing an unnecessary parse: 10,000 lookups of a 1,050-byte input. That number measures this
152
+ internal operation only. It is not a full-build speedup or a webpack comparison.
153
+
154
+ The [benchmark report](https://github.com/chrisifm/BRAINLLM/blob/main/bench/REPORT.md) also tracks agent-generated apps, browser behavior, payload size and
155
+ failure recovery. Historical LLM results describe their frozen model/spec/compiler runs; they do not guarantee
156
+ that a new prompt or compiler revision will pass. This project is open to developers and researchers who want to
157
+ investigate how language design and compiler feedback affect agent behavior. Bring a hypothesis and a reproducer.
158
+
159
+ The compiler pipeline is written in Rust. Browser automation drives real Chrome through CDP for interaction and
160
+ regression checks. Those checks establish the flows they exercise; they do not imply universal browser or app
161
+ compatibility. The repository's recorded LLM evaluations identify the models, tasks and frozen revisions so you can inspect
162
+ what each result actually establishes.
163
+
164
+ ## Tools for an agent that finishes the job
165
+
166
+ | The agent needs to… | The compiler provides… |
167
+ |---|---|
168
+ | Start with consistent files | Generators for views, components, channels, services, typed APIs, schemas, route guards and server modules |
169
+ | Refactor without guessing imports | Checked AST edits for props, component-file rename, move and extraction |
170
+ | Inspect what it built | Chrome screenshots, accessibility outlines and explicit visual baseline comparisons |
171
+ | Keep routes small | Enforced `viewKB` budgets for emitted JS + CSS + HTML |
172
+ | Defer optional UI | Visible, idle or keyboard-accessible interaction loading; async image decoding |
173
+ | Fix and verify | `brain doctor --fix` applies mechanical edits before the full quality check |
174
+ | Let you try production output | A temporary local `brain preview` server with owned-process cleanup |
175
+
176
+ Browser tooling and the preview supervisor currently require macOS or Linux. Screenshot baselines need stable browser,
177
+ font and app-data inputs. Runtime mount-time/heap budgets remain planned; the compiler rejects those settings rather
178
+ than pretending to measure them. See the [implemented contract](https://github.com/chrisifm/BRAINLLM/blob/main/SPEC.md) and [tool internals](https://github.com/chrisifm/BRAINLLM/blob/main/docs/INTERNALS.md).
179
+
180
+ ## Give your agent its first task
181
+
182
+ **Connect your coding agent. Tell it what to build. Try the app.**
183
+
184
+ Open a coding agent with access to your project files and terminal. Give it the prompt below and your product
185
+ brief. It can install the compiler, read the language contract and work through the checks. Once the app runs,
186
+ try the actual workflow and tell the agent what should change. You stay in charge of the product and what ships.
187
+
188
+ BRAINLLM's CLI is the starting point; `brain mcp` also connects through clients that support MCP over stdio.
189
+ Your agent needs Node 22+ and Chrome for browser-based checks on macOS or Linux. Git and Rust stable are needed
190
+ only when building the compiler from source or contributing. It should report missing prerequisites honestly.
191
+
192
+ **Paste this into your coding agent:**
193
+
194
+ ```text
195
+ Build a small task app with BRAINLLM: add, complete and delete tasks,
196
+ and save them locally. Follow https://github.com/chrisifm/BRAINLLM
197
+ for setup. Run the checks and open the app for me.
198
+ ```
199
+
200
+ <details>
201
+ <summary>Expanded agent workflow for a custom project</summary>
202
+
203
+ ```text
204
+ Build my frontend with BRAINLLM.
205
+
206
+ Product brief: [describe the app, its users and the first useful workflow].
207
+
208
+ 1. Inspect the workspace and available tools. Preserve existing files and secrets.
209
+ Verify Node 22+ and Chrome for browser checks. Create a separate app with
210
+ npm create @christianirack/brainll@latest my-app. If npm is unavailable,
211
+ follow the source-install instructions in the README. Report missing prerequisites.
212
+ 2. Enter the generated app. Read its AGENTS.md and run npx brain spec.
213
+ Only use implemented features in the served spec; do not invent APIs.
214
+ 3. Read npx brain map --json. Generate the needed views and components with brain add.
215
+ Implement the first complete user workflow, including loading, empty, error
216
+ and success states. Add meaningful behavior tests.
217
+ 4. Run npx brain fix, then npx brain check --json. Resolve remaining diagnostics.
218
+ Run npx brain doctor and npx brain build. Exercise the workflow in the browser.
219
+ 5. Report actual test results, remaining gaps and how to run the app. Stop
220
+ temporary processes and close only browser resources you created.
221
+ Do not publish or deploy without my instruction.
222
+
223
+ At each completed workflow, look for a concrete compiler defect or measurable
224
+ improvement. Read docs/EVOLUTION.md and docs/AGENT-IDEAS.md in the framework repo.
225
+ Reproduce it, add a regression test and propose the smallest compatible fix.
226
+ Only use automatic contribution when I have explicitly configured it for an
227
+ owned fork or authorized review branch. Never weaken checks or merge automatically.
228
+ ```
229
+
230
+ </details>
231
+
232
+ <details>
233
+ <summary>Prefer to install it yourself? Here are the commands.</summary>
234
+
235
+ Use the public initializer (no npm account required):
236
+
237
+ ```sh
238
+ npm create @christianirack/brainll@latest my-app
239
+ cd my-app
240
+ npm run dev
241
+ ```
242
+
243
+ `npm create @christianirack/brainllm@latest my-app` is the canonical spelling with identical behavior.
244
+ Inside the generated app, use `npx brain` for CLI commands and `npm run build` for production.
245
+ The compiler is prebuilt; Rust is needed only for the source installation below.
246
+
247
+ ```sh
248
+ git clone https://github.com/chrisifm/BRAINLLM.git
249
+ cd BRAINLLM
250
+ cargo install --locked --path crates/brain-cli
251
+ brain new my-app
252
+ cd my-app
253
+ brain run
254
+ ```
255
+
256
+ With a source installation, use the installed `brain` commands directly. That workflow does not require
257
+ `npm install` in the generated app.
258
+
259
+ Cargo installs `brain` into its bin directory; make sure that directory is on your `PATH`. Stop the dev server with
260
+ Ctrl+C. From the app directory, run `brain doctor` to validate it and `brain build` to create production output.
261
+ For an MCP client in an npm-created app, use command `npx` with arguments `["brain", "mcp"]` and the app as its
262
+ working directory. With a source installation, use the installed `brain` executable and argument `mcp`. Follow that client's configuration instructions; merely copying a prompt does not grant tool access.
263
+
264
+ </details>
265
+
266
+ For an existing frontend, start with the [migration workflow](https://github.com/chrisifm/BRAINLLM/blob/main/docs/MIGRATION.md). Its read-only planner recognizes
267
+ React, Angular, Vue, Svelte, Next and Nuxt projects. Port one tested route or component at a time, preserve its
268
+ behavior and keep a rollback path. It is an incremental workflow, not an automatic transpiler.
269
+
270
+ ## The code your agent handles
271
+
272
+ ```html
273
+ <meta props="start:num=0 label:str='Clicks'">
274
+
275
+ <script>
276
+ let n = sig(start)
277
+ let dbl = drv(() => n * 2)
278
+ </script>
279
+
280
+ <button on:click={n++}>{label}: {n} × 2 = {dbl}</button>
281
+ ```
282
+
283
+ The compiler handles signal reads and writes. Derived values update when their inputs change. Styles can live in
284
+ the same file and are scoped to the component. The [served spec](https://github.com/chrisifm/BRAINLLM/blob/main/SPEC.md) defines the supported syntax.
285
+
286
+ ## Readable intent. Lean browser output.
287
+
288
+ An internal function named `back_to_home` can become a short identifier in production. The exact letter depends
289
+ on scope and the other names in the module. Keep meaningful names where the agent reasons about the code; let the
290
+ compiler shorten eligible bindings in what the browser receives.
291
+
292
+ This example comes from the [minifier's scope regression tests](https://github.com/chrisifm/BRAINLLM/blob/main/crates/brain-min/src/mangle.rs):
293
+
294
+ ```js
295
+ // Before
296
+ function outer(longName, other) {
297
+ const total = longName + other.value;
298
+ return total + window.x;
299
+ }
300
+
301
+ // After
302
+ function a(a,b){const c=a+b.value;return c+window.x}
303
+ ```
304
+
305
+ Property names and external references retain their meaning. Exported bindings and other protected names follow
306
+ the minifier's preservation rules. The source stays readable; the production artifact gets smaller identifiers.
307
+ That saves output bytes, not automatically the tokens used by an LLM reading source. Reducing agent context cost
308
+ is a separate design goal served by the language contract, focused reads and project map; quantify it with a
309
+ measured agent workflow before claiming a token saving.
310
+
311
+ ## Errors should give the agent a next move.
312
+
313
+ BRAINLLM includes protections at several stages of the app loop:
314
+
315
+ - **Before it ships:** compiler checks cover supported language rules, accessibility and server/client boundaries.
316
+ Private environment values belong on the server; client access is restricted to `PUBLIC_` values.
317
+ - **At the form:** schemas define required fields and supported types; server field errors return to the form.
318
+ The application still owns its business rules, authorization and server-side validation.
319
+ - **When a component fails:** runtime boundaries capture render and reactive errors, report them and replace the
320
+ affected component with a fallback. A failing event handler reports the error while keeping the component.
321
+ Retry is bounded: three failures within ten seconds remove the retry button.
322
+ - **When work runs away:** runtime budgets stop affected components that exceed monitored limits. The production
323
+ build also probes views with simulated timers for unbounded growth. `brain doctor` runs the project's checks,
324
+ tests and diagnostics; failed stages remain visible to the agent.
325
+
326
+ These are implemented mechanisms, not a promise to catch every bug or repair every failure. The agent still needs
327
+ to test the user's workflow. See [runtime behavior in the spec](https://github.com/chrisifm/BRAINLLM/blob/main/SPEC.md#errors-at-runtime),
328
+ [component boundaries](https://github.com/chrisifm/BRAINLLM/blob/main/runtime/brain-guard.js) and [compiler diagnostics](https://github.com/chrisifm/BRAINLLM/blob/main/crates/brain-check/).
329
+
330
+ ## Build the tool your agent needs
331
+
332
+ **Build with it. Let your LLM make it better.**
333
+
334
+ ![An LLM turns an observed problem into an isolated fix, runs validation and submits a contribution for human review](https://github.com/chrisifm/BRAINLLM/raw/main/docs/site/assets/improvement-loop.png)
335
+
336
+ A failed compilation can become a regression test. A repeated slow step can become a benchmark. A fix made while
337
+ building your app can become a contribution that helps the next developer and their agent.
338
+
339
+ Found a compiler gap while building an app? Turn the smallest reproducible case into a regression test and a
340
+ contribution. BRAINLLM includes an [evolution workflow](https://github.com/chrisifm/BRAINLLM/blob/main/docs/EVOLUTION.md) for isolated proposals, validated compiler
341
+ binaries and reversible activation. Configured automatic pushes go to review branches; merges require the
342
+ principal author's review. This is an explicit development workflow, not a compiler that silently rewrites itself
343
+ on every build. Read the [agent improvement playbook](https://github.com/chrisifm/BRAINLLM/blob/main/docs/AGENT-IDEAS.md) for an opt-in prompt and concrete ideas
344
+ to investigate.
345
+
346
+ Human developers and LLM contributors are welcome. Useful first contributions include reproducible compiler bugs,
347
+ behavior-preserving migration examples, clearer diagnostics and performance improvements with before/after data.
348
+
349
+ 1. Read [CONTRIBUTING.md](https://github.com/chrisifm/BRAINLLM/blob/main/CONTRIBUTING.md) and the relevant [internals](https://github.com/chrisifm/BRAINLLM/blob/main/docs/INTERNALS.md).
350
+ 2. Make a focused change with a regression test and synthetic sample data.
351
+ 3. Run `bash scripts/verify.sh`. It builds the CLI and checks Rust, runtime, tooling, diagnostic fixtures, privacy
352
+ and repository language. Verification also requires ripgrep.
353
+ 4. Open a pull request with the problem, resulting behavior and actual validation evidence.
354
+
355
+ Changes to what app authors write also require the frozen LLM benchmark workflow described in CONTRIBUTING.
356
+ Never include app secrets, private source or customer data in a contribution.
357
+
358
+ ## Know what you are adopting
359
+
360
+ BRAINLLM is **0.1.0**. Start with a small app or an isolated route and test the behavior you need. Features marked
361
+ as planned in the source specification are not a supported promise; `brain spec` serves the implemented contract.
362
+ Third-party React, Angular and Vue components do not become BRAINLLM components automatically. Benchmark wins in
363
+ build time do not imply that every runtime workload is faster.
364
+
365
+ ## Keep building
366
+
367
+ | You want to… | Start here |
368
+ |---|---|
369
+ | Give an agent the project context | [llms.txt](https://github.com/chrisifm/BRAINLLM/blob/main/llms.txt) |
370
+ | Write an app | [SPEC.md](https://github.com/chrisifm/BRAINLLM/blob/main/SPEC.md) and `brain spec` |
371
+ | Migrate an existing frontend | [Migration guide](https://github.com/chrisifm/BRAINLLM/blob/main/docs/MIGRATION.md) |
372
+ | Improve the compiler while using it | [Evolution workflow](https://github.com/chrisifm/BRAINLLM/blob/main/docs/EVOLUTION.md) and [agent ideas](https://github.com/chrisifm/BRAINLLM/blob/main/docs/AGENT-IDEAS.md) |
373
+ | Understand the implementation | [Internals](https://github.com/chrisifm/BRAINLLM/blob/main/docs/INTERNALS.md) and [crates](https://github.com/chrisifm/BRAINLLM/blob/main/crates/) |
374
+ | Inspect examples and reproduce measurements | [Examples](https://github.com/chrisifm/BRAINLLM/blob/main/examples/) and [benchmarks](https://github.com/chrisifm/BRAINLLM/blob/main/bench/) |
375
+ | Contribute a change | [Contributor guide](https://github.com/chrisifm/BRAINLLM/blob/main/CONTRIBUTING.md) |
376
+
377
+ Released under the [MIT license](https://github.com/chrisifm/BRAINLLM/blob/main/LICENSE).
378
+
379
+ Created and maintained by **Christian Irack Flores Maldonado**, principal author.
380
+ [ingenieria.dev](https://ingenieria.dev) · [irack.mx](https://irack.mx) · [christian@irack.mx](mailto:christian@irack.mx)
381
+
382
+ <!-- contributors:start -->
383
+ ## Built by contributors
384
+
385
+ Every merged contribution helps the next developer and their agent. Thank you to the public GitHub accounts credited below.
386
+
387
+ [<img src="https://avatars.githubusercontent.com/u/1562002?v=4" width="48" height="48" alt="chrisifm">](https://github.com/chrisifm) [chrisifm](https://github.com/chrisifm)
388
+
389
+ Attribution is refreshed through a reviewed pull request. [How it works](https://github.com/chrisifm/BRAINLLM/blob/main/docs/CONTRIBUTORS.md).
390
+ <!-- contributors:end -->
package/bin/create.js ADDED
@@ -0,0 +1,24 @@
1
+ #!/usr/bin/env node
2
+ // `npm create @christianirack/brainllm <name>` (also `npx @christianirack/create-brainllm <name>`): runs `brain new`
3
+ // with the brain this package depends on (same version), then installs the app's pinned devDependency.
4
+ // Flags after the name go to `brain new`; `--no-install` skips `npm install`.
5
+ 'use strict'
6
+ const { spawnSync } = require('node:child_process')
7
+ const { join } = require('node:path')
8
+
9
+ const args = process.argv.slice(2)
10
+ const name = args.find((a) => !a.startsWith('-'))
11
+ if (!name) {
12
+ process.stderr.write('usage: npm create @christianirack/brainllm <app-name>\n')
13
+ process.exit(2)
14
+ }
15
+ const launcher = require.resolve('@christianirack/brainllm/bin/brain.js')
16
+ const run = (cmd, argv, cwd) => {
17
+ const r = spawnSync(cmd, argv, { stdio: 'inherit', cwd, shell: process.platform === 'win32' && cmd === 'npm' })
18
+ if (r.status !== 0) process.exit(r.status ?? 1)
19
+ }
20
+ // BRAIN_NO_DELEGATE: the new app has no node_modules yet; use this package's brain
21
+ process.env.BRAIN_NO_DELEGATE = '1'
22
+ run(process.execPath, [launcher, 'new', ...args.filter((a) => a !== '--no-install')], process.cwd())
23
+ if (!args.includes('--no-install')) run('npm', ['install', '--no-audit', '--no-fund'], join(process.cwd(), name))
24
+ process.stdout.write(`\nnext: cd ${name} && npx brain run\n`)
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "@christianirack/create-brainllm",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.1.0",
4
+ "description": "npm create @christianirack/brainllm <app>: a new BRAINLLM app with its brain version pinned.",
5
+ "bin": {
6
+ "create-brainllm": "bin/create.js"
7
+ },
8
+ "files": [
9
+ "bin",
10
+ "README.md"
11
+ ],
12
+ "engines": {
13
+ "node": ">=22"
14
+ },
15
+ "dependencies": {
16
+ "@christianirack/brainllm": "0.1.0"
17
+ },
18
+ "license": "MIT",
19
+ "author": "Christian Irack Flores Maldonado <christian@irack.mx> (https://ingenieria.dev)",
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/chrisifm/BRAINLLM.git"
23
+ },
24
+ "homepage": "https://chrisifm.github.io/BRAINLLM/",
25
+ "publishConfig": {
26
+ "access": "public",
27
+ "registry": "https://registry.npmjs.org/"
28
+ }
29
+ }