heximon 0.9.0 → 0.11.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
@@ -8,14 +8,18 @@ after your last `pnpm build`.
8
8
 
9
9
  ## Why you want it
10
10
 
11
- - **One binary for the whole surface.** `create`, `check`, `routes`, `graph`, `doctor`, `deploy`,
12
- `provision`, `migrations`, `task`, and `workflows` are one command each.
11
+ - **One binary for the whole surface.** `create`, `check`, `routes`, `graph`, `doctor`, `freshness`,
12
+ `deploy`, `provision`, `migrations`, `task`, and `workflows` are one command each.
13
13
  - **`heximon check` catches a dependency-injection error before `tsgo` does.** It compiles your app
14
14
  headlessly and reports every compile error with its position and a fix.
15
15
  - **`heximon doctor` finds a package installed twice.** Class identity is the only dependency-injection
16
16
  token, so two copies of one package bind two different sets of classes. `doctor` names both directories.
17
+ - **`heximon freshness` finds the packages that need a new `vp pack`.** It runs from any folder of a
18
+ workspace, lists every package that has a pack record, and names the file that made a package stale.
17
19
  - **`heximon deploy` ships with the platform's own tool.** It builds your app, then runs `wrangler`,
18
20
  `vercel`, `netlify`, or `deployctl` for you, with the right flags for your environment.
21
+ - **Agents and CI read one JSON document.** Every command takes `--json`: stdout gets one document with
22
+ `ok` and `diagnostics`, logs go to stderr, and the command never prompts.
19
23
  - **Shell completion is built in.** `heximon complete zsh` (or `bash`, `fish`, `powershell`, `fig`) sets
20
24
  up tab completion for every command and flag.
21
25
 
@@ -56,6 +60,7 @@ const main = defineCommand({
56
60
  routes: routesCommand,
57
61
  graph: graphCommand,
58
62
  doctor: doctorCommand,
63
+ freshness: freshnessCommand,
59
64
  provision: provisionCommand,
60
65
  migrations: migrationsCommand,
61
66
  workflows: workflowsCommand,
@@ -74,14 +79,64 @@ const main = defineCommand({
74
79
  | `heximon routes` | Prints one table for every path the app answers — routes, SSE streams, and WebSocket upgrades — read from the compiler, with no boot required. |
75
80
  | `heximon graph` | Prints the resolved module dependency graph: modules, providers, and dependencies. |
76
81
  | `heximon doctor` | Reports a package installed twice, an untraced deploy target, and a stale published module. |
82
+ | `heximon freshness` | Lists every workspace package that has a pack record (`dist/heximon.manifest.json` or `dist/heximon.inputs.json`), with its status and the input that made it stale. It finds the workspace root from any folder (`pnpm-workspace.yaml`, or a `workspaces` field in `package.json`), compiles nothing, and exits `1` when a package is stale or its check failed. A record file that exists but cannot be read is a failed check, not a missing record. `--stale` lists only those packages. |
77
83
  | `heximon deploy` | Builds the app, then ships it with the target platform's own command-line tool. |
78
84
  | `heximon provision` | Creates a resource your build needs an identifier for, before the build runs. |
79
85
  | `heximon migrations` | Runs `generate`, `migrate`, `status`, or `push` against your database, with no hand-written `drizzle-kit` config. |
80
86
  | `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. |
87
+ | `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
88
  | `heximon skills` | `add <url>` records an agent-skill source in `package.json` (`heximon.skills`) and installs it. `sync` re-installs every recorded source. |
83
89
  | `heximon complete <shell>` | Installs shell completion for `zsh`, `bash`, `fish`, `powershell`, or `fig`. |
84
90
 
91
+ ## Machine-readable output
92
+
93
+ Pass `--json` to any command except `complete`. The command then follows one contract:
94
+
95
+ - stdout holds one JSON document, written when the command ends, and nothing else;
96
+ - progress, app logs and the output of `vp build`, `drizzle-kit` or a vendor tool go to stderr;
97
+ - the command never prompts: a question it would ask fails the run with a `cli.option-required` diagnostic
98
+ that names the option (or environment variable) that answers it;
99
+ - `ok` is `false` exactly when the exit status is not `0`.
100
+
101
+ Each document has `ok` and `diagnostics` at the top level, beside the fields of the command. A diagnostic has
102
+ `severity`, `message`, `code`, `hint`, `file`, `line`, `column` and `option` where they apply. A run that
103
+ stops before it has its own fields (a `heximon.config.ts` that throws, an invalid option, arguments the
104
+ command cannot parse) prints `{ ok: false, diagnostics }` only. `check` and `workflows` also accept `--format json`.
105
+
106
+ ```json
107
+ {"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"}]}
108
+ ```
109
+
110
+ The document types are exported as types from the package root:
111
+
112
+ | Command | Document type | Its own codes |
113
+ | :-- | :-- | :-- |
114
+ | every command | `CliJsonDocument`, `CliFailureDocument`, `CliDiagnostic` | `CliDiagnosticCode` |
115
+ | `create` | `CreateJsonDocument` | `CreateDiagnosticCode` |
116
+ | `check` | `CheckJsonDocument` | the compiler codes |
117
+ | `workflows` | `WorkflowsJsonDocument` | `WorkflowsDiagnosticCode` |
118
+ | `routes` | `RoutesJsonDocument` | `RoutesDiagnosticCode` |
119
+ | `graph` | `GraphJsonDocument` | `GraphDiagnosticCode` |
120
+ | `doctor` | `DoctorJsonDocument` | `DoctorDiagnosticCode` |
121
+ | `freshness` | `FreshnessJsonDocument` | `FreshnessDiagnosticCode` |
122
+ | `skills add`, `skills sync` | `SkillsAddJsonDocument`, `SkillsSyncJsonDocument` | `SkillsDiagnosticCode` |
123
+ | `task run` | `TaskRunJsonDocument` | `TaskDiagnosticCode` |
124
+ | `migrations generate`, `migrate`, `push`, `status` | `MigrationsGenerateJsonDocument`, `MigrationsMigrateJsonDocument`, `MigrationsPushJsonDocument`, `MigrationsStatusJsonDocument` | `MigrationsDiagnosticCode` |
125
+ | `deploy` | `DeployJsonDocument` | `DeployDiagnosticCode` |
126
+ | `provision` | `ProvisionJsonDocument` | `ProvisionDiagnosticCode` |
127
+
128
+ ```ts
129
+ import type { CheckJsonDocument, CliFailureDocument } from "heximon";
130
+ ```
131
+
132
+ `CliEntry.run(command, rawArgs)` starts a command tree with the same contract: under `--json`, an argument
133
+ error is a document too, and stdout stays on stderr after the document until the process exits.
134
+ `create-heximon` starts `heximon create` this way. A command that you call in your own code, such as
135
+ `createCommand`, gives stdout back when it ends.
136
+
137
+ The fields, the codes and the exit status of each command are in the
138
+ [CLI reference of the agent skill](../../../docs/skills/heximon/references/tooling-cli.md#machine-readable-output).
139
+
85
140
  ## Works with
86
141
 
87
142
  - [`@heximon/deploy`](../deploy) supplies the `deploy` command's logic. This package adds the interactive
@@ -130,7 +185,7 @@ the fix instructions plus a non-zero exit code.
130
185
  - **`heximon check` writes no wiring unless you ask.** Pass `--emit`, or set `debug: true` in
131
186
  `heximon.config.ts`, and the generated files land in `.heximon/` — prettified in place, and the command
132
187
  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
188
+ nothing, and the pretty output prints a notice (`--json` omits the notice and `emittedTo`). `vp pack` regenerates the `create<Module>` factory in
134
189
  `.heximon/library/`.
135
190
  - **`heximon skills add` records only what it installed.** A source it could not fetch stays out of
136
191
  `heximon.skills`, so `heximon skills sync` never retries a URL that never worked.
@@ -147,6 +202,8 @@ the fix instructions plus a non-zero exit code.
147
202
 
148
203
  - [The CLI](https://heximon.dev/docs/cli/overview) — every command, every flag.
149
204
  - [Deploy from the CLI](https://heximon.dev/docs/cli/deploy) — the `deploy` command in depth.
205
+ - [Machine-readable output](https://heximon.dev/docs/cli/json-output) — the `--json` contract, for tool
206
+ authors.
150
207
  - [The Heximon agent skill](../../../docs/skills/heximon) — the technical reference for coding agents.
151
208
 
152
209
  ## License