@mindbricks/genesis-set 0.0.0-stage → 0.2.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 (41) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/LICENSE +202 -0
  3. package/README.md +148 -2
  4. package/bin/genesis-set.mjs +153 -0
  5. package/corpus/README.md +25 -0
  6. package/corpus/genesis/compile-results.md +246 -0
  7. package/corpus/genesis/compiler-api.md +265 -0
  8. package/corpus/genesis/custom-code.md +519 -0
  9. package/corpus/genesis/deploy.md +190 -0
  10. package/corpus/genesis/pitfalls.md +231 -0
  11. package/corpus/genesis/procedures/README.md +17 -0
  12. package/corpus/genesis/procedures/agent-hub-blueprint.md +13 -0
  13. package/corpus/genesis/procedures/auth-blueprint.md +14 -0
  14. package/corpus/genesis/procedures/bff-blueprint.md +16 -0
  15. package/corpus/genesis/procedures/blueprint-authoring.md +16 -0
  16. package/corpus/genesis/procedures/howto-mail-to-tasks.md +26 -0
  17. package/corpus/genesis/procedures/howto-payment-flow.md +112 -0
  18. package/corpus/genesis/procedures/howto-subscription.md +33 -0
  19. package/corpus/genesis/procedures/notifications-blueprint.md +13 -0
  20. package/corpus/genesis/procedures/patterns-catalog.md +12 -0
  21. package/corpus/genesis/procedures/project-lifecycle.md +27 -0
  22. package/corpus/genesis/run-locally.md +310 -0
  23. package/corpus/genesis/testing.md +532 -0
  24. package/lib/config-cli.mjs +179 -0
  25. package/lib/install.mjs +639 -0
  26. package/lib/mcp-config.mjs +222 -0
  27. package/lib/semver.mjs +94 -0
  28. package/mcp/blueprint.mjs +64 -0
  29. package/mcp/client.mjs +141 -0
  30. package/mcp/config.mjs +166 -0
  31. package/mcp/key-page-html.mjs +275 -0
  32. package/mcp/key-page.mjs +217 -0
  33. package/mcp/key-store.mjs +204 -0
  34. package/mcp/key-tools.mjs +225 -0
  35. package/mcp/server.mjs +164 -0
  36. package/mcp/tools.mjs +270 -0
  37. package/package.json +44 -4
  38. package/skills/genesis-compiler-api/SKILL.md +56 -0
  39. package/skills/genesis-deploy/SKILL.md +36 -0
  40. package/skills/genesis-generated-code/SKILL.md +48 -0
  41. package/skills/genesis-run-and-test/SKILL.md +43 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ The package follows semantic versioning. Each release names the mind-set range it needs
4
+ (`dependencies["@mindbricks/mind-set"]` in `package.json`).
5
+
6
+ ## 0.2.0 (pre-release)
7
+
8
+ Needs mind-set `^0.2.0`.
9
+
10
+ - The command is `genesis`, the same name as its MCP server; `genesis-set` still works as an
11
+ alias (and keeps `npx @mindbricks/genesis-set ...` working). Every message, skill and
12
+ guide names `genesis`. The data folder stays `~/.genesis-set`.
13
+ - The MCP server exits only after its answers are written out; before, an answer over 8 KiB
14
+ could be cut when the client closed stdin.
15
+
16
+ ## 0.1.0 (pre-release)
17
+
18
+ First version, published with the Genesis Compiler API open for dry-run builds.
19
+
20
+ - Published as `@mindbricks/genesis-set` (the command is `genesis-set`), like
21
+ `@mindbricks/mind-set`.
22
+ - `genesis-set install | update | uninstall | doctor` for Claude Code (`~/.claude/skills`)
23
+ and Codex (`~/.agents/skills`); installs or updates mind-set `^0.1.0` when needed and never
24
+ replaces a mind-set skill.
25
+ - A local MCP server (no dependencies) with the tools `genesis_validateApplication`,
26
+ `genesis_validateService`, `genesis_buildService`, `genesis_getBuilds` and
27
+ `genesis_getServiceBuild`; `install` registers it for Claude Code (`~/.claude.json`) and
28
+ Codex (`~/.codex/config.toml`). It reads the blueprint from the local file and sends it
29
+ inline, checks the size first, and authenticates with `GENESIS_API_KEY` or the home config
30
+ file (`genesis-set config set-key`).
31
+ - Keys without the chat: the MCP server serves a local key page (127.0.0.1, token link, closes
32
+ when idle). Four more tools (`genesis_requestKey`, `genesis_listKeys`, `genesis_openKeyManager`,
33
+ `genesis_writeKeyToEnvFile`) register a key, hand the user the page link, report set / empty,
34
+ and copy a stored key into a gitignored env file. The agent never sees a value.
35
+ - `genesis-set install` ends with a key step that names the portal's API keys page and, on a
36
+ terminal, reads the Genesis API key hidden; the missing-key message and `doctor` name the page.
37
+ - Four skills: `genesis-compiler-api` (the five tools), `genesis-generated-code` (procedure
38
+ additions, custom code, runtime pitfalls), `genesis-run-and-test` and `genesis-deploy`.
39
+ - The corpus pages `compile-results`, `custom-code`, `run-locally`, `testing`, `deploy` and
40
+ `pitfalls` (#9168): the shared compiler knowledge genesis-set needs, written in genesis-set's own
41
+ sources (the platform side stays as it is).
42
+ - The corpus: the Compiler API guide and the Genesis additions to the mind-set procedures
43
+ (payment and subscription runtime ladders, webhook and plan provisioning, the mailbox
44
+ runtime check, per-language support, compile steps).
package/LICENSE ADDED
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
package/README.md CHANGED
@@ -1,3 +1,149 @@
1
- # Temporary Holding Version
1
+ # genesis-set
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
+ > **PRE-RELEASE.** The Genesis Compiler API is open at `https://api.genesiscompiler.com`.
4
+ > Builds are dry runs for now: the code is generated and measured, nothing is pushed yet.
5
+
6
+ Skills that teach a coding agent (Claude Code, Codex) to use the **Genesis compiler** on an
7
+ OpenAPPL blueprint: what the generated services do at run time, the Genesis steps next to the
8
+ blueprint procedures, and the Genesis Compiler API (validate, build, follow a build). A local
9
+ MCP server gives the agent the Compiler API as five `genesis_*` tools, plus four tools and a
10
+ local page for the keys the agent needs.
11
+
12
+ genesis-set sits on [mind-set](https://github.com/Mindbricks/mind-set), the OpenAPPL layer.
13
+ mind-set teaches designing and writing the blueprint; genesis-set adds what is specific to
14
+ the Genesis compiler and never repeats a mind-set document. Installing genesis-set installs
15
+ mind-set when it is missing. Node 18 or newer.
16
+
17
+ ```bash
18
+ npm install -g @mindbricks/genesis-set
19
+ genesis install
20
+ ```
21
+
22
+ The npm package is `@mindbricks/genesis-set`; the command is `genesis` (`genesis-set` still works
23
+ as an alias). It depends on
24
+ `@mindbricks/mind-set`, so the global install brings mind-set's package too, and
25
+ `genesis install` runs `mindset install` when mind-set is not installed yet.
26
+
27
+ ## Commands
28
+
29
+ | Command | What it does |
30
+ |---|---|
31
+ | `genesis install [--claude] [--codex] [--force] [--no-mcp] [--no-key] [--dry-run]` | Makes sure a compatible mind-set is installed (it comes with this package and is installed by its own CLI), copies the corpus to `~/.genesis-set/<version>/` (linked as `~/.genesis-set/current`), writes each `genesis-*` skill to Claude Code (`~/.claude/skills/`) and Codex (`~/.agents/skills/`), registers the MCP server (below), and ends with the API key step (below). |
32
+ | `genesis update [...]` | Installs this version for every agent installed before (and every detected one), then deletes older corpus versions. |
33
+ | `genesis uninstall [--dry-run]` | Removes only what `install` recorded in `~/.genesis-set/installed.json`, including the MCP registrations. mind-set and your API key file stay. |
34
+ | `genesis doctor` | Both versions (genesis-set and mind-set) and whether they are compatible, the skills of each package and the MCP server per agent, where the API key comes from (never its value) and the API base. |
35
+ | `genesis config [show \| set-key \| unset-key \| set-base <url> \| unset-base]` | The API key and API base in `~/.genesis-set/config.json` (mode 0600). `set-key` reads the key from stdin (hidden on a terminal), never from the command line. |
36
+ | `genesis keys [--no-open]` | Opens the local key page in your browser: add, change, clear or delete the keys your agent uses. The link is new each time; the page closes after 15 idle minutes or on Ctrl+C. `--no-open` only prints the link. |
37
+ | `genesis mcp` | Runs the MCP server on stdio from the package (for a registration by hand). |
38
+
39
+ ### The MCP server
40
+
41
+ `install` copies the server to `~/.genesis-set/mcp/` and registers it at user scope as the MCP
42
+ server `genesis`: in `~/.claude.json` (`mcpServers.genesis`) for Claude Code and as a marked
43
+ block in `~/.codex/config.toml` (`[mcp_servers.genesis]`, `CODEX_HOME` moves it) for Codex. An
44
+ existing `genesis` entry that genesis-set did not write is left alone (Claude Code: `--force`
45
+ replaces it after a backup). Restart the agent after the install. The server has no
46
+ dependencies besides Node 18.
47
+
48
+ | Tool | Endpoint (below `{apiBase}/genesis/compiler/v1`) |
49
+ |---|---|
50
+ | `genesis_validateApplication` | `POST /validate` |
51
+ | `genesis_validateService` | `POST /validate/service` |
52
+ | `genesis_buildService` | `POST /builds` with one service |
53
+ | `genesis_getBuilds` | `GET /builds` |
54
+ | `genesis_getServiceBuild` | `GET /jobs/:jobId` |
55
+
56
+ A blueprint path is read on your machine, checked against the size limit (10 MiB of compact
57
+ JSON; `GENESIS_MAX_BLUEPRINT_BYTES` when your API says otherwise) and sent inline; the path
58
+ itself is never sent. A repository source (`repo`) is passed through as it is. Every failure
59
+ comes back in the Genesis error shape `{ "error": { "code", "message", "details" } }`.
60
+
61
+ ### Keys: the local key page
62
+
63
+ A coding agent keeps needing secrets: the Genesis API key, and provider keys (payment, mail,
64
+ storage, AI) to run the generated services. The rule is that no value is ever typed into the chat.
65
+ Instead the MCP server serves a local key page, and four tools that never call the API and work
66
+ without a Genesis API key:
67
+
68
+ | Tool | What it does |
69
+ |---|---|
70
+ | `genesis_requestKey` | Registers a key by name (`stripe-secret-key`) with a readable label and a description, empty, and answers the page link. An existing key keeps its value. |
71
+ | `genesis_listKeys` | Every key with its label, description and status (`set` / `empty`); never a value. |
72
+ | `genesis_openKeyManager` | The page link, to add, change, clear or delete keys. |
73
+ | `genesis_writeKeyToEnvFile` | Copies a stored key into a service's env file as `VARIABLE=value`, without the value passing through the agent. |
74
+
75
+ - **The agent's flow:**
76
+ 1. `genesis_requestKey`.
77
+ 2. "Open this link and save the key there".
78
+ 3. `genesis_listKeys` until the key is `set`.
79
+ 4. `genesis_writeKeyToEnvFile` when a service needs it.
80
+ - **Opening the page yourself:** `genesis keys` in any terminal opens it in the browser. The
81
+ port and the link change every time, so there is nothing to remember or bookmark. Asking the
82
+ agent ("open my keys") works too: it calls `genesis_openKeyManager`.
83
+ - **Where the keys live:** in `~/.genesis-set/config.json` (mode 0600).
84
+ - The Genesis API key is the built-in key `genesis-api-key`, the same value `config set-key` stores.
85
+ - Every other key is `keys.<name>`.
86
+ - **What the page shows:** whether a key is set, and the last four characters of a long value. A
87
+ value is sent once, when the user saves it. The field the user types into is hidden, with a
88
+ Show / Hide toggle; the stored value is never shown again.
89
+ - **Env files:** `genesis_writeKeyToEnvFile` accepts only a file named `.env`, `.env.local` or
90
+ `*.secrets.env`. Inside a git repository the file must be one git ignores and does not track.
91
+ - **Security:**
92
+ - The page listens on `127.0.0.1` on a random port, behind a random token in its link.
93
+ - It answers only to its own `Host`, takes writes only from its own `Origin` and only as JSON.
94
+ - It sends `no-store`, `no-referrer` and a nonce Content-Security-Policy.
95
+ - It closes after 15 idle minutes and when the agent session ends. The next key tool call
96
+ gives a new link.
97
+ - **Where it does not work:** on a platform without a local disk and browser (a hosted builder).
98
+
99
+ ### mind-set
100
+
101
+ - The mind-set range is `dependencies["@mindbricks/mind-set"]` in `package.json`. `install` installs the
102
+ bundled mind-set when none is installed, updates an older one, and stops with an error
103
+ when the installed mind-set is outside the range and cannot be updated (it never
104
+ downgrades someone's mind-set).
105
+ - genesis-set skills are all named `genesis-*`. A skill folder that carries mind-set's marker
106
+ is never replaced, not even with `--force`; a folder of another owner is replaced only with
107
+ `--force` (it is backed up to `~/.genesis-set/backup/` first).
108
+ - In a skill's Markdown, `{{CORPUS}}` becomes the genesis-set corpus and `{{MIND_SET}}` the
109
+ mind-set corpus (`~/.mind-set/current`).
110
+
111
+ ### Projects and credentials
112
+
113
+ - The project's identity is the blueprint's (`projectSettings.basicSettings.name`); there is
114
+ no binding file, and genesis-set writes nothing into a project folder.
115
+ - **Getting the key:** the user signs in to the Genesis portal and creates one on its API keys
116
+ page, `https://portal.genesiscompiler.com/keys` (the stage API `sapi.genesiscompiler.com`
117
+ has `https://stage.genesiscompiler.com/keys`). The key is shown once.
118
+ - **The install key step:** with no key set, `genesis install` names that page.
119
+ - On a terminal it reads the key with hidden input and stores it as `set-key` does; Enter
120
+ skips.
121
+ - Without a terminal (an agent runs the install) it only prints the page and the command, and
122
+ never waits.
123
+ - `--no-key` skips the step.
124
+ - The Compiler API key lives in the environment variable `GENESIS_API_KEY` or in
125
+ `~/.genesis-set/config.json` (`genesis config set-key`), never in a file of the project,
126
+ the blueprint or a commit. The environment variable wins. The MCP server never reads the
127
+ folder it runs in for a key or a setting.
128
+ - The API base is `https://api.genesiscompiler.com` unless `GENESIS_API_BASE` or
129
+ `genesis config set-base` says otherwise; a plain-http base is accepted only on a
130
+ loopback address.
131
+
132
+ ### Environment
133
+
134
+ - `HOME`: where the agents' folders are looked up.
135
+ - `GENESIS_SET_HOME` moves `~/.genesis-set`; `MIND_SET_HOME` moves `~/.mind-set`;
136
+ `CODEX_HOME` moves `~/.codex`.
137
+ - `GENESIS_API_KEY`, `GENESIS_API_BASE`, `GENESIS_MAX_BLUEPRINT_BYTES`, `GENESIS_TIMEOUT_MS`
138
+ (default 120000): read by the MCP server on every call.
139
+
140
+ ## Development
141
+
142
+ ```bash
143
+ npm test
144
+ ```
145
+
146
+ runs the `node:test` suites in `test/` against a throwaway package, a fake mind-set package
147
+ and a fake `HOME`; the MCP suites run the server against a local stub of the Compiler API. In a built package (one with a `corpus/` folder) it also packs the package
148
+ with `npm pack`, installs the tarball next to a mind-set tarball into a throwaway project,
149
+ and runs `install`, `doctor` and `uninstall` from there.
@@ -0,0 +1,153 @@
1
+ #!/usr/bin/env node
2
+ // genesis-set: install the Genesis compiler skills for coding agents, on top of
3
+ // mind-set (the OpenAPPL skills). No runtime dependency besides mind-set, Node >= 18.
4
+
5
+ import fs from 'node:fs';
6
+ import path from 'node:path';
7
+ import { fileURLToPath } from 'node:url';
8
+ import { configCommand, offerApiKey } from '../lib/config-cli.mjs';
9
+ import { chooseAgents, doctor, install, resolveContext, uninstall, update } from '../lib/install.mjs';
10
+
11
+ const pkgRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..');
12
+ const pkg = JSON.parse(fs.readFileSync(path.join(pkgRoot, 'package.json'), 'utf8'));
13
+
14
+ const out = (line) => process.stdout.write(`${line}\n`);
15
+ const err = (line) => process.stderr.write(`${line}\n`);
16
+
17
+ const HELP = `genesis ${pkg.version}: Genesis compiler skills for coding agents (PRE-RELEASE; genesis-set is an alias)
18
+
19
+ Usage:
20
+ genesis install [--claude] [--codex] [--force] [--no-mcp] [--no-key] [--dry-run]
21
+ genesis update [--claude] [--codex] [--force] [--no-mcp] [--dry-run]
22
+ genesis uninstall [--dry-run]
23
+ genesis doctor
24
+ genesis config [show | set-key | unset-key | set-base <url> | unset-base]
25
+ genesis keys [--no-open]
26
+ genesis mcp
27
+ genesis --version | --help
28
+
29
+ install makes sure mind-set ${pkg.dependencies?.['@mindbricks/mind-set'] ?? ''} is installed (installs the
30
+ mind-set that comes with this package when it is missing or older),
31
+ copies the genesis-set corpus to ~/.genesis-set/<version>/ (linked as
32
+ ~/.genesis-set/current) and writes the genesis-* skills to every
33
+ detected agent: Claude Code (~/.claude/skills) and Codex
34
+ (~/.agents/skills). --claude / --codex pick the agents. A mind-set
35
+ skill folder is never replaced; another foreign folder only with
36
+ --force (backed up first). It also copies the genesis-set MCP server
37
+ (the genesis_* tools) to ~/.genesis-set/mcp/ and registers it as the
38
+ MCP server "genesis" at user scope: ~/.claude.json for Claude Code,
39
+ ~/.codex/config.toml for Codex (--no-mcp skips that). Last, the
40
+ API key: with none set, it names the portal page that creates one
41
+ and, on a terminal, reads it hidden (Enter skips; --no-key skips
42
+ the step). Nothing is written into a project folder.
43
+ update install for this version (and every agent installed before), then
44
+ delete older genesis-set corpus versions.
45
+ uninstall removes only what install recorded in ~/.genesis-set/installed.json;
46
+ mind-set stays.
47
+ doctor both versions (genesis-set and mind-set) and whether they are
48
+ compatible, the skills and the MCP server per agent, where the API
49
+ key comes from (never its value) and the API base.
50
+ keys opens the local key page in your browser (the page the agent
51
+ links to): add, change, clear or delete the keys your agent uses.
52
+ The link is new every time; the page closes after 15 idle minutes
53
+ or on Ctrl+C. --no-open only prints the link.
54
+ config the Genesis API key and API base in ~/.genesis-set/config.json
55
+ (mode 0600). set-key reads the key from stdin, never from the
56
+ command line. GENESIS_API_KEY / GENESIS_API_BASE win over the file.
57
+ mcp runs the MCP server on stdio from this package (what the agents
58
+ start; for a manual registration).
59
+
60
+ The Genesis Compiler API builds are dry runs for now: the code is generated
61
+ and measured, nothing is pushed yet.
62
+
63
+ Environment: HOME is where the agents live; GENESIS_SET_HOME moves
64
+ ~/.genesis-set; MIND_SET_HOME moves ~/.mind-set; CODEX_HOME moves ~/.codex;
65
+ GENESIS_API_KEY holds the Compiler API key and GENESIS_API_BASE the API base
66
+ (default https://api.genesiscompiler.com). Never put the key in a project.`;
67
+
68
+ function parseArgs(argv) {
69
+ const flags = {};
70
+ const positional = [];
71
+ for (const a of argv) {
72
+ if (a.startsWith('--')) {
73
+ const name = a.slice(2).replace(/-([a-z])/g, (_, c) => c.toUpperCase());
74
+ flags[name] = true;
75
+ } else if (a === '-h') flags.help = true;
76
+ else if (a === '-v') flags.version = true;
77
+ else positional.push(a);
78
+ }
79
+ return { flags, positional };
80
+ }
81
+
82
+ const KNOWN_FLAGS = {
83
+ install: ['claude', 'codex', 'force', 'noMcp', 'noKey', 'dryRun'],
84
+ update: ['claude', 'codex', 'force', 'noMcp', 'dryRun'],
85
+ uninstall: ['dryRun'],
86
+ doctor: [],
87
+ config: [],
88
+ keys: ['noOpen'],
89
+ mcp: [],
90
+ };
91
+
92
+ async function main(argv) {
93
+ const { flags, positional } = parseArgs(argv);
94
+ if (flags.version) {
95
+ out(pkg.version);
96
+ return 0;
97
+ }
98
+ const command = positional[0];
99
+ if (flags.help || !command || command === 'help') {
100
+ out(HELP);
101
+ return command || flags.help ? 0 : 2;
102
+ }
103
+ if (!KNOWN_FLAGS[command]) {
104
+ err(`error: unknown command "${command}" (see genesis --help)`);
105
+ return 2;
106
+ }
107
+ const unknown = Object.keys(flags).filter((f) => !KNOWN_FLAGS[command].includes(f));
108
+ if (unknown.length) {
109
+ err(`error: unknown option for ${command}: ${unknown.map((f) => `--${f}`).join(', ')}`);
110
+ return 2;
111
+ }
112
+ if (command === 'keys') {
113
+ const { ensureKeyPage, keyPageClosed, closeKeyPage } = await import('../mcp/key-page.mjs');
114
+ const { openInBrowser } = await import('../mcp/key-tools.mjs');
115
+ const link = await ensureKeyPage({ env: process.env });
116
+ out(`Genesis keys: ${link.url}`);
117
+ out(`This link works on this machine only. The page closes after ${link.expiresAfterIdleMinutes} idle minutes, or press Ctrl+C.`);
118
+ if (flags.noOpen !== true && !openInBrowser(link.url)) out('Could not open a browser: open the link yourself.');
119
+ process.once('SIGINT', () => closeKeyPage());
120
+ process.once('SIGTERM', () => closeKeyPage());
121
+ const keepAlive = setInterval(() => {}, 1 << 30);
122
+ await keyPageClosed();
123
+ clearInterval(keepAlive);
124
+ out('The key page is closed.');
125
+ return 0;
126
+ }
127
+ if (command === 'mcp') {
128
+ const { serve } = await import('../mcp/server.mjs');
129
+ await serve();
130
+ return 0;
131
+ }
132
+ const ctx = resolveContext({ pkgRoot, pkg, out, dryRun: flags.dryRun === true });
133
+ const opts = { force: flags.force === true, mcp: flags.noMcp !== true };
134
+ switch (command) {
135
+ case 'install': {
136
+ const code = install(ctx, chooseAgents(ctx, flags), opts);
137
+ if (flags.noKey !== true) await offerApiKey({ env: process.env, out, err, dryRun: ctx.dryRun });
138
+ return code;
139
+ }
140
+ case 'update':
141
+ return update(ctx, chooseAgents(ctx, flags, { includeManifest: true }), opts);
142
+ case 'config':
143
+ return configCommand(positional.slice(1), { env: process.env, out, err });
144
+ case 'uninstall':
145
+ return uninstall(ctx);
146
+ case 'doctor':
147
+ return doctor(ctx);
148
+ default:
149
+ return 2;
150
+ }
151
+ }
152
+
153
+ process.exitCode = await main(process.argv.slice(2));
@@ -0,0 +1,25 @@
1
+ # genesis-set corpus
2
+
3
+ The documents the genesis-set skills read. `genesis install` copies this folder to
4
+ `~/.genesis-set/<version>/` and links it as `~/.genesis-set/current`; every skill names its
5
+ files by their absolute path in that copy.
6
+
7
+ genesis-set sits on mind-set and adds to it; nothing here repeats a mind-set document. The
8
+ OpenAPPL corpus (procedures, specification, schema, examples) is mind-set's, at
9
+ `~/.mind-set/current/`. A path written `procedures/<name>.md` in these files is a mind-set
10
+ procedure.
11
+
12
+ ```
13
+ genesis/
14
+ compiler-api.md the Genesis Compiler API and its genesis_* tools
15
+ compile-results.md reading a service build: statuses, job fields, failure codes
16
+ custom-code.md extending the generated code: LIB, API, dbLayer, edge controllers
17
+ run-locally.md running and debugging the generated services on your machine
18
+ testing.md the API test suite, the test transport, the sample-data seed
19
+ deploy.md deploying with your own login: docker-compose, Railway, Fly.io, Render (Genesis never deploys)
20
+ pitfalls.md compiler facts that look like bugs
21
+ procedures/ Genesis additions to the mind-set procedures, one file per
22
+ README.md procedure that has Genesis-specific steps, and their index
23
+ ```
24
+
25
+ Do not edit the files here: a new `genesis update` replaces them.