heximon 0.9.0 → 0.10.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/README.md CHANGED
@@ -16,6 +16,8 @@ after your last `pnpm build`.
16
16
  token, so two copies of one package bind two different sets of classes. `doctor` names both directories.
17
17
  - **`heximon deploy` ships with the platform's own tool.** It builds your app, then runs `wrangler`,
18
18
  `vercel`, `netlify`, or `deployctl` for you, with the right flags for your environment.
19
+ - **Agents and CI read one JSON document.** Every command takes `--json`: stdout gets one document with
20
+ `ok` and `diagnostics`, logs go to stderr, and the command never prompts.
19
21
  - **Shell completion is built in.** `heximon complete zsh` (or `bash`, `fish`, `powershell`, `fig`) sets
20
22
  up tab completion for every command and flag.
21
23
 
@@ -78,10 +80,58 @@ const main = defineCommand({
78
80
  | `heximon provision` | Creates a resource your build needs an identifier for, before the build runs. |
79
81
  | `heximon migrations` | Runs `generate`, `migrate`, `status`, or `push` against your database, with no hand-written `drizzle-kit` config. |
80
82
  | `heximon workflows` | Compares a durable workflow's current shape against its committed upgrade baseline. |
81
- | `heximon task run <Module> <Task>` | Runs one task against the production graph of the app, prints its result as JSON, and exits. It starts no HTTP listener, no schedule timer, no polling loop, and no outbox relay (`--with-outbox-relay` starts it). It refuses a graph that needs platform bindings. The module can be a packed library module: the command runs the tasks that the module exports. `--payload` sets the event payload, and `--env-file` loads variables. Exit status: `0` when the task returned, `2` when the task itself threw (stdout then holds one `{"error":{"name":…,"message":…}}` line), `1` for every other failure. |
83
+ | `heximon task run <Module> <Task>` | Runs one task against the production graph of the app, prints its result as JSON, and exits. It starts no HTTP listener, no schedule timer, no polling loop, and no outbox relay (`--with-outbox-relay` starts it). It refuses a graph that needs platform bindings. The module can be a packed library module: the command runs the tasks that the module exports. `--payload` sets the event payload, and `--env-file` loads variables. Exit status: `0` when the task returned, `2` when the task itself threw (stdout then holds one `{"error":{"name":…,"message":…}}` line), `1` for every other failure. `--json` prints one document for every outcome, with the same exit status. |
82
84
  | `heximon skills` | `add <url>` records an agent-skill source in `package.json` (`heximon.skills`) and installs it. `sync` re-installs every recorded source. |
83
85
  | `heximon complete <shell>` | Installs shell completion for `zsh`, `bash`, `fish`, `powershell`, or `fig`. |
84
86
 
87
+ ## Machine-readable output
88
+
89
+ Pass `--json` to any command except `complete`. The command then follows one contract:
90
+
91
+ - stdout holds one JSON document, written when the command ends, and nothing else;
92
+ - progress, app logs and the output of `vp build`, `drizzle-kit` or a vendor tool go to stderr;
93
+ - the command never prompts: a question it would ask fails the run with a `cli.option-required` diagnostic
94
+ that names the option (or environment variable) that answers it;
95
+ - `ok` is `false` exactly when the exit status is not `0`.
96
+
97
+ Each document has `ok` and `diagnostics` at the top level, beside the fields of the command. A diagnostic has
98
+ `severity`, `message`, `code`, `hint`, `file`, `line`, `column` and `option` where they apply. A run that
99
+ stops before it has its own fields (a `heximon.config.ts` that throws, an invalid option, arguments the
100
+ command cannot parse) prints `{ ok: false, diagnostics }` only. `check` and `workflows` also accept `--format json`.
101
+
102
+ ```json
103
+ {"ok":false,"diagnostics":[{"severity":"error","code":"cli.config-unreadable","message":"heximon.config.ts could not be loaded: DATABASE_URL is not set","hint":"Fix the error in the config file, then run the command again.","file":"/tmp/shop/heximon.config.ts"}]}
104
+ ```
105
+
106
+ The document types are exported as types from the package root:
107
+
108
+ | Command | Document type | Its own codes |
109
+ | :-- | :-- | :-- |
110
+ | every command | `CliJsonDocument`, `CliFailureDocument`, `CliDiagnostic` | `CliDiagnosticCode` |
111
+ | `create` | `CreateJsonDocument` | `CreateDiagnosticCode` |
112
+ | `check` | `CheckJsonDocument` | the compiler codes |
113
+ | `workflows` | `WorkflowsJsonDocument` | `WorkflowsDiagnosticCode` |
114
+ | `routes` | `RoutesJsonDocument` | `RoutesDiagnosticCode` |
115
+ | `graph` | `GraphJsonDocument` | `GraphDiagnosticCode` |
116
+ | `doctor` | `DoctorJsonDocument` | `DoctorDiagnosticCode` |
117
+ | `skills add`, `skills sync` | `SkillsAddJsonDocument`, `SkillsSyncJsonDocument` | `SkillsDiagnosticCode` |
118
+ | `task run` | `TaskRunJsonDocument` | `TaskDiagnosticCode` |
119
+ | `migrations generate`, `migrate`, `push`, `status` | `MigrationsGenerateJsonDocument`, `MigrationsMigrateJsonDocument`, `MigrationsPushJsonDocument`, `MigrationsStatusJsonDocument` | `MigrationsDiagnosticCode` |
120
+ | `deploy` | `DeployJsonDocument` | `DeployDiagnosticCode` |
121
+ | `provision` | `ProvisionJsonDocument` | `ProvisionDiagnosticCode` |
122
+
123
+ ```ts
124
+ import type { CheckJsonDocument, CliFailureDocument } from "heximon";
125
+ ```
126
+
127
+ `CliEntry.run(command, rawArgs)` starts a command tree with the same contract: under `--json`, an argument
128
+ error is a document too, and stdout stays on stderr after the document until the process exits.
129
+ `create-heximon` starts `heximon create` this way. A command that you call in your own code, such as
130
+ `createCommand`, gives stdout back when it ends.
131
+
132
+ The fields, the codes and the exit status of each command are in the
133
+ [CLI reference of the agent skill](../../../docs/skills/heximon/references/tooling-cli.md#machine-readable-output).
134
+
85
135
  ## Works with
86
136
 
87
137
  - [`@heximon/deploy`](../deploy) supplies the `deploy` command's logic. This package adds the interactive
@@ -130,7 +180,7 @@ the fix instructions plus a non-zero exit code.
130
180
  - **`heximon check` writes no wiring unless you ask.** Pass `--emit`, or set `debug: true` in
131
181
  `heximon.config.ts`, and the generated files land in `.heximon/` — prettified in place, and the command
132
182
  prints where. This applies to an app. In a published module package, `--emit` and `debug: true` write
133
- nothing, and the pretty output prints a notice (`--format json` omits the notice and `emittedTo`). `vp pack` regenerates the `create<Module>` factory in
183
+ nothing, and the pretty output prints a notice (`--json` omits the notice and `emittedTo`). `vp pack` regenerates the `create<Module>` factory in
134
184
  `.heximon/library/`.
135
185
  - **`heximon skills add` records only what it installed.** A source it could not fetch stays out of
136
186
  `heximon.skills`, so `heximon skills sync` never retries a URL that never worked.
@@ -147,6 +197,8 @@ the fix instructions plus a non-zero exit code.
147
197
 
148
198
  - [The CLI](https://heximon.dev/docs/cli/overview) — every command, every flag.
149
199
  - [Deploy from the CLI](https://heximon.dev/docs/cli/deploy) — the `deploy` command in depth.
200
+ - [Machine-readable output](https://heximon.dev/docs/cli/json-output) — the `--json` contract, for tool
201
+ authors.
150
202
  - [The Heximon agent skill](../../../docs/skills/heximon) — the technical reference for coding agents.
151
203
 
152
204
  ## License