heximon 0.16.0 → 0.17.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 +1 -1
- package/dist/bin.mjs +118 -18
- package/dist/index.d.mts +2 -0
- package/package.json +16 -16
package/README.md
CHANGED
|
@@ -83,7 +83,7 @@ const main = defineCommand({
|
|
|
83
83
|
| `heximon deploy` | Builds the app, then ships it with the target platform's own command-line tool. |
|
|
84
84
|
| `heximon provision` | Creates a resource your build needs an identifier for, before the build runs. |
|
|
85
85
|
| `heximon migrations` | Runs `generate`, `migrate`, `status`, or `push` against your database, with no hand-written `drizzle-kit` config. |
|
|
86
|
-
| `heximon workflows` | Compares a durable workflow's current shape against its committed upgrade baseline. |
|
|
86
|
+
| `heximon workflows` | Compares a durable workflow's current shape against its committed upgrade baseline. With Cloudflare credentials it also lists the live instances, under the deployed workflow name. It finds that name with the same merge as the deploy build: the `cloudflare.resourcePrefix` goes before it, `CLOUDFLARE_ENV` selects the prefix and `workflowNames` of that environment, and a `workflows` entry that you write by hand in the wrangler base config or the committed wrangler file wins for its binding. A Nitro or Nuxt app reads `wrangler.json` before `wrangler.jsonc`, as Nitro does. A wrangler environment that does not bind a workflow has no live instances of it, so the command skips that workflow and says why. Outside Nitro, a `CLOUDFLARE_ENV` that a wrangler config with `env` blocks does not define fails the enumeration, as it fails `wrangler deploy`. The command runs no Nitro config, so it does not see the `cloudflare.wrangler` and `cloudflare.wranglerEnv` options of a Nitro config. |
|
|
87
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. |
|
|
88
88
|
| `heximon skills` | `add <url>` records an agent-skill source in `package.json` (`heximon.skills`) and installs it. `sync` re-installs every recorded source. |
|
|
89
89
|
| `heximon complete <shell>` | Installs shell completion for `zsh`, `bash`, `fish`, `powershell`, or `fig`. |
|
package/dist/bin.mjs
CHANGED
|
@@ -4626,7 +4626,7 @@ var NitroStaticConfig = class NitroStaticConfig {
|
|
|
4626
4626
|
serverDir: { kind: "none" },
|
|
4627
4627
|
scanDirs: { kind: "none" }
|
|
4628
4628
|
};
|
|
4629
|
-
if (
|
|
4629
|
+
if (NitroStaticConfig.isNuxtProject(rootDir)) return notAHost;
|
|
4630
4630
|
const configFiles = NitroStaticConfig.configFilesOf(rootDir);
|
|
4631
4631
|
const nitroFile = configFiles.length === 1 && NitroStaticConfig.nitroConfigNames.some((name) => join(rootDir, name) === configFiles[0]) ? configFiles[0] : void 0;
|
|
4632
4632
|
const viteFile = find(NitroStaticConfig.viteConfigNames);
|
|
@@ -4660,6 +4660,15 @@ var NitroStaticConfig = class NitroStaticConfig {
|
|
|
4660
4660
|
};
|
|
4661
4661
|
}
|
|
4662
4662
|
/**
|
|
4663
|
+
* Whether the project has a Nuxt config file. Nuxt creates its own Nitro, so {@link read} does not report
|
|
4664
|
+
* such a project as a Nitro host, although it deploys through Nitro.
|
|
4665
|
+
*
|
|
4666
|
+
* @param rootDir - The project root.
|
|
4667
|
+
*/
|
|
4668
|
+
static isNuxtProject(rootDir) {
|
|
4669
|
+
return NitroStaticConfig.nuxtConfigNames.some((name) => existsSync(join(rootDir, name)));
|
|
4670
|
+
}
|
|
4671
|
+
/**
|
|
4663
4672
|
* Sources of options that the project has but the reader cannot read: a `.nitrorc` file (in the project or the
|
|
4664
4673
|
* home directory), the `nitro` key of `package.json`, and a dependency on `nitro` when no config file or
|
|
4665
4674
|
* provable plugin call exists.
|
|
@@ -6144,10 +6153,12 @@ var WorkflowStatusReport = class WorkflowStatusReport {
|
|
|
6144
6153
|
ok: enumerationDiagnostics.length === 0 && upgradeDiagnostics.length === 0,
|
|
6145
6154
|
workflows: options.entries.map((entry) => {
|
|
6146
6155
|
const enumerationError = options.enumerationErrors.get(entry.resourceName);
|
|
6156
|
+
const enumerationSkipped = options.enumerationSkips?.get(entry.resourceName);
|
|
6147
6157
|
return {
|
|
6148
6158
|
...entry,
|
|
6149
6159
|
inventory: options.inventories.get(entry.resourceName) ?? null,
|
|
6150
|
-
...enumerationError === void 0 ? {} : { enumerationError }
|
|
6160
|
+
...enumerationError === void 0 ? {} : { enumerationError },
|
|
6161
|
+
...enumerationSkipped === void 0 ? {} : { enumerationSkipped }
|
|
6151
6162
|
};
|
|
6152
6163
|
}),
|
|
6153
6164
|
cloudflare: {
|
|
@@ -6286,7 +6297,8 @@ var CloudflareInspectorLoader = class {
|
|
|
6286
6297
|
/**
|
|
6287
6298
|
* @param rootDir - The app root whose `@heximon/cloudflare` install is resolved from.
|
|
6288
6299
|
* @param credentials - The REST credentials the instances client authenticates with.
|
|
6289
|
-
* @returns The inspector, or `undefined` when the package is absent or
|
|
6300
|
+
* @returns The inspector and the deployed-name resolver, or `undefined` when the package is absent or does
|
|
6301
|
+
* not export both inspector classes.
|
|
6290
6302
|
*/
|
|
6291
6303
|
static async load(rootDir, credentials) {
|
|
6292
6304
|
try {
|
|
@@ -6295,7 +6307,10 @@ var CloudflareInspectorLoader = class {
|
|
|
6295
6307
|
const InstancesClient = loaded["CloudflareWorkflowInstancesClient"];
|
|
6296
6308
|
const Inspector = loaded["CloudflareWorkflowInspector"];
|
|
6297
6309
|
if (InstancesClient === void 0 || Inspector === void 0) return;
|
|
6298
|
-
return
|
|
6310
|
+
return {
|
|
6311
|
+
inspector: new Inspector(new InstancesClient(credentials)),
|
|
6312
|
+
workflowNames: loaded["DeployedWorkflowNames"]
|
|
6313
|
+
};
|
|
6299
6314
|
} catch {
|
|
6300
6315
|
return;
|
|
6301
6316
|
}
|
|
@@ -6340,11 +6355,12 @@ const workflowsCommand = defineCommand({
|
|
|
6340
6355
|
const rootDir = ProjectRoot.resolve(args.cwd);
|
|
6341
6356
|
const sourceDirectories = SourceDirectories.resolve(rootDir, args.src);
|
|
6342
6357
|
if (!commandOutput.isJson()) intro(`heximon workflows — ${basename(rootDir)}`);
|
|
6343
|
-
const
|
|
6358
|
+
const session = await ProjectCompileSession.open({
|
|
6344
6359
|
rootDir,
|
|
6345
6360
|
environment: args.env,
|
|
6346
6361
|
...sourceDirectories === void 0 ? {} : { sourceDirectories }
|
|
6347
|
-
})
|
|
6362
|
+
});
|
|
6363
|
+
const output = session.compile();
|
|
6348
6364
|
const errors = output.diagnostics.filter((diagnostic) => diagnostic.severity === DiagnosticSeverity.Error);
|
|
6349
6365
|
const upgradeErrors = errors.filter((diagnostic) => UpgradeBaseline.isBreaking(diagnostic.code));
|
|
6350
6366
|
const blockingErrors = errors.filter((diagnostic) => !UpgradeBaseline.isBreaking(diagnostic.code));
|
|
@@ -6384,34 +6400,63 @@ const workflowsCommand = defineCommand({
|
|
|
6384
6400
|
const entries = WorkflowStatusReport.classify(current.workflows, committed.document);
|
|
6385
6401
|
const inventories = /* @__PURE__ */ new Map();
|
|
6386
6402
|
const enumerationErrors = /* @__PURE__ */ new Map();
|
|
6403
|
+
const enumerationSkips = /* @__PURE__ */ new Map();
|
|
6387
6404
|
let cloudflareSkipped;
|
|
6388
6405
|
const accountId = process.env["CLOUDFLARE_ACCOUNT_ID"];
|
|
6389
6406
|
const apiToken = process.env["CLOUDFLARE_API_TOKEN"];
|
|
6390
6407
|
if (accountId === void 0 || accountId === "" || apiToken === void 0 || apiToken === "") cloudflareSkipped = "CLOUDFLARE_ACCOUNT_ID + CLOUDFLARE_API_TOKEN are not both set — Cloudflare live-instance enumeration skipped.";
|
|
6391
6408
|
else {
|
|
6392
|
-
const
|
|
6409
|
+
const cloudflare = await CloudflareInspectorLoader.load(rootDir, {
|
|
6393
6410
|
accountId,
|
|
6394
6411
|
apiToken
|
|
6395
6412
|
});
|
|
6396
|
-
if (
|
|
6397
|
-
else
|
|
6398
|
-
|
|
6399
|
-
|
|
6400
|
-
|
|
6401
|
-
|
|
6402
|
-
|
|
6403
|
-
|
|
6413
|
+
if (cloudflare === void 0) cloudflareSkipped = "@heximon/cloudflare is not installed in this app — Cloudflare live-instance enumeration skipped.";
|
|
6414
|
+
else {
|
|
6415
|
+
const environment = process.env["CLOUDFLARE_ENV"] || void 0;
|
|
6416
|
+
let deployedNames = /* @__PURE__ */ new Map();
|
|
6417
|
+
let namesFailure;
|
|
6418
|
+
try {
|
|
6419
|
+
deployedNames = cloudflare.workflowNames?.resolve({
|
|
6420
|
+
host: WorkflowsCommand.isNitroDeploy(rootDir) ? WorkflowsCommand.wranglerHost.Nitro : WorkflowsCommand.wranglerHost.Standalone,
|
|
6421
|
+
rootDir,
|
|
6422
|
+
contributions: output.buildConfigContributions,
|
|
6423
|
+
environment,
|
|
6424
|
+
base: WorkflowsCommand.wranglerBaseOf(session.config?.platform)
|
|
6425
|
+
}) ?? /* @__PURE__ */ new Map();
|
|
6426
|
+
} catch (error) {
|
|
6427
|
+
namesFailure = `the deployed workflow name could not be resolved — ${error instanceof Error ? error.message : String(error)}`;
|
|
6428
|
+
}
|
|
6429
|
+
for (const entry of entries) {
|
|
6430
|
+
if (namesFailure !== void 0) {
|
|
6431
|
+
enumerationErrors.set(entry.resourceName, namesFailure);
|
|
6432
|
+
continue;
|
|
6433
|
+
}
|
|
6434
|
+
const deployed = deployedNames.get(entry.resourceName);
|
|
6435
|
+
if (deployed !== void 0 && deployed.name === void 0) {
|
|
6436
|
+
enumerationSkips.set(entry.resourceName, `${environment === void 0 ? "the root Worker" : `the wrangler environment "${environment}"`} does not bind this workflow, so it has no live instances there.`);
|
|
6437
|
+
continue;
|
|
6438
|
+
}
|
|
6439
|
+
try {
|
|
6440
|
+
inventories.set(entry.resourceName, await cloudflare.inspector.inspect({
|
|
6441
|
+
workflowName: deployed?.name ?? WorkflowsCommand.deployedWorkflowName(entry.resourceName, output.buildConfigContributions, environment),
|
|
6442
|
+
currentFingerprint: entry.fingerprint
|
|
6443
|
+
}));
|
|
6444
|
+
} catch (error) {
|
|
6445
|
+
enumerationErrors.set(entry.resourceName, error instanceof Error ? error.message : String(error));
|
|
6446
|
+
}
|
|
6447
|
+
}
|
|
6404
6448
|
}
|
|
6405
6449
|
}
|
|
6406
6450
|
if (commandOutput.isJson()) commandOutput.emit(WorkflowStatusReport.toJson({
|
|
6407
6451
|
entries,
|
|
6408
6452
|
inventories,
|
|
6409
6453
|
enumerationErrors,
|
|
6454
|
+
enumerationSkips,
|
|
6410
6455
|
cloudflareSkipped,
|
|
6411
6456
|
upgradeDiagnostics: CliDiagnostics.fromCompiler(upgradeErrors)
|
|
6412
6457
|
}));
|
|
6413
6458
|
else {
|
|
6414
|
-
WorkflowsCommand.report(entries, inventories, enumerationErrors, cloudflareSkipped);
|
|
6459
|
+
WorkflowsCommand.report(entries, inventories, enumerationErrors, enumerationSkips, cloudflareSkipped);
|
|
6415
6460
|
if (upgradeErrors.length > 0) CompileDiagnostics.renderToStderr(rootDir, upgradeErrors);
|
|
6416
6461
|
}
|
|
6417
6462
|
if (enumerationErrors.size > 0 || upgradeErrors.length > 0) process.exitCode = 1;
|
|
@@ -6419,7 +6464,60 @@ const workflowsCommand = defineCommand({
|
|
|
6419
6464
|
}
|
|
6420
6465
|
});
|
|
6421
6466
|
/** Output helpers for {@link workflowsCommand}: the committed-baseline read and the pretty report. */
|
|
6422
|
-
var WorkflowsCommand = class {
|
|
6467
|
+
var WorkflowsCommand = class WorkflowsCommand {
|
|
6468
|
+
/**
|
|
6469
|
+
* The Cloudflare build-config sections that name a deployed workflow. Matched by value: the CLI takes no
|
|
6470
|
+
* dependency on `@heximon/cloudflare`.
|
|
6471
|
+
*/
|
|
6472
|
+
static cloudflareSection = {
|
|
6473
|
+
/** The root `cloudflare.resourcePrefix`: `{ prefix }`. */
|
|
6474
|
+
resourcePrefix: "resource-prefix",
|
|
6475
|
+
/** The wrangler environments: `{ environments: { <name>: { resource_prefix?, workflow_names? } } }`. */
|
|
6476
|
+
environments: "environments",
|
|
6477
|
+
/** The workflow bindings: `{ workflows: [{ binding, name }] }`. */
|
|
6478
|
+
workflowBindings: "workflow-bindings"
|
|
6479
|
+
};
|
|
6480
|
+
/** The `WranglerHost` values of `@heximon/cloudflare`: the host whose deploy merge names a workflow. */
|
|
6481
|
+
static wranglerHost = {
|
|
6482
|
+
Standalone: "standalone",
|
|
6483
|
+
Nitro: "nitro"
|
|
6484
|
+
};
|
|
6485
|
+
/**
|
|
6486
|
+
* Whether the app deploys through Nitro, so the Nitro rules name its workflows: a Nitro host, or a Nuxt
|
|
6487
|
+
* app, whose own Nitro deploys it.
|
|
6488
|
+
*/
|
|
6489
|
+
static isNitroDeploy(rootDir) {
|
|
6490
|
+
return NitroStaticConfig.read(rootDir).isNitroHost || NitroStaticConfig.isNuxtProject(rootDir);
|
|
6491
|
+
}
|
|
6492
|
+
/**
|
|
6493
|
+
* The explicit `wrangler.base` of a `CloudflareWorkersStrategy` platform, read by its `wranglerBase()` method.
|
|
6494
|
+
*
|
|
6495
|
+
* @returns The base, or `undefined` for another platform or a strategy without a base.
|
|
6496
|
+
*/
|
|
6497
|
+
static wranglerBaseOf(platform) {
|
|
6498
|
+
const wranglerBase = platform?.wranglerBase;
|
|
6499
|
+
return typeof wranglerBase === "function" ? wranglerBase.call(platform) : void 0;
|
|
6500
|
+
}
|
|
6501
|
+
/**
|
|
6502
|
+
* The name of a workflow on Cloudflare from the build-config contributions alone. It is the fallback for a
|
|
6503
|
+
* `@heximon/cloudflare` without `DeployedWorkflowNames`, and for a workflow that it does not resolve. For a
|
|
6504
|
+
* wrangler environment of the build, that environment's `resourcePrefix` and `workflowNames` apply;
|
|
6505
|
+
* otherwise the root `cloudflare.resourcePrefix` goes before the resource name.
|
|
6506
|
+
*
|
|
6507
|
+
* @param contributions - The build-config contributions of the compile.
|
|
6508
|
+
* @param environment - The wrangler environment that is deployed (`CLOUDFLARE_ENV`), or `undefined` for the root.
|
|
6509
|
+
*/
|
|
6510
|
+
static deployedWorkflowName(resourceName, contributions, environment) {
|
|
6511
|
+
const payloadOf = (section) => contributions.find((contribution) => contribution.target === "cloudflare" && contribution.section === section)?.payload;
|
|
6512
|
+
const rootPrefix = payloadOf(WorkflowsCommand.cloudflareSection.resourcePrefix)?.prefix;
|
|
6513
|
+
const environments = payloadOf(WorkflowsCommand.cloudflareSection.environments)?.environments;
|
|
6514
|
+
const overrides = environment !== void 0 && environments !== void 0 && Object.hasOwn(environments, environment) ? environments[environment] : void 0;
|
|
6515
|
+
if (overrides === void 0) return typeof rootPrefix === "string" ? `${rootPrefix}${resourceName}` : resourceName;
|
|
6516
|
+
const binding = payloadOf(WorkflowsCommand.cloudflareSection.workflowBindings)?.workflows?.find((workflow) => workflow.name === resourceName)?.binding;
|
|
6517
|
+
const renamed = binding !== void 0 && overrides.workflow_names !== void 0 && Object.hasOwn(overrides.workflow_names, binding) ? overrides.workflow_names[binding] : void 0;
|
|
6518
|
+
const prefix = overrides.resource_prefix ?? rootPrefix;
|
|
6519
|
+
return `${typeof prefix === "string" ? prefix : ""}${typeof renamed === "string" ? renamed : resourceName}`;
|
|
6520
|
+
}
|
|
6423
6521
|
/**
|
|
6424
6522
|
* Read the committed `heximon.upgrade.json`, keeping "absent" and "unreadable" apart.
|
|
6425
6523
|
*
|
|
@@ -6464,7 +6562,7 @@ var WorkflowsCommand = class {
|
|
|
6464
6562
|
};
|
|
6465
6563
|
}
|
|
6466
6564
|
/** Print the per-workflow report wrapped in clack framing: one status line + inventory block each. */
|
|
6467
|
-
static report(entries, inventories, enumerationErrors, cloudflareSkipped) {
|
|
6565
|
+
static report(entries, inventories, enumerationErrors, enumerationSkips, cloudflareSkipped) {
|
|
6468
6566
|
for (const entry of entries) {
|
|
6469
6567
|
const line = WorkflowStatusReport.renderEntry(entry);
|
|
6470
6568
|
if (entry.state === WorkflowBaselineState.Diverged) log.error(line);
|
|
@@ -6472,6 +6570,8 @@ var WorkflowsCommand = class {
|
|
|
6472
6570
|
else log.warn(line);
|
|
6473
6571
|
const inventory = inventories.get(entry.resourceName);
|
|
6474
6572
|
if (inventory !== void 0) log.message(WorkflowStatusReport.renderInventory(inventory));
|
|
6573
|
+
const enumerationSkipped = enumerationSkips.get(entry.resourceName);
|
|
6574
|
+
if (enumerationSkipped !== void 0) log.info(`Cloudflare enumeration skipped for ${entry.resourceName}: ${enumerationSkipped}`);
|
|
6475
6575
|
const enumerationError = enumerationErrors.get(entry.resourceName);
|
|
6476
6576
|
if (enumerationError !== void 0) log.error(`Cloudflare enumeration failed for ${entry.resourceName}: ${enumerationError}`);
|
|
6477
6577
|
}
|
package/dist/index.d.mts
CHANGED
|
@@ -1499,6 +1499,8 @@ interface WorkflowStatusJsonEntry extends WorkflowStatusEntry {
|
|
|
1499
1499
|
/** The Cloudflare live-fleet inventory, or `null` when enumeration was skipped or failed. */
|
|
1500
1500
|
readonly inventory: WorkflowInstanceInventory | null;
|
|
1501
1501
|
readonly enumerationError?: string;
|
|
1502
|
+
/** Why the live fleet of this workflow was not enumerated, when the deployed Worker does not bind it. */
|
|
1503
|
+
readonly enumerationSkipped?: string;
|
|
1502
1504
|
}
|
|
1503
1505
|
/** The stable codes of the failures `heximon workflows` raises itself, beside the compiler's own. */
|
|
1504
1506
|
declare const WorkflowsDiagnosticCode: {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "heximon",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "The Heximon CLI: create, develop, build, migrate, and deploy Heximon apps.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -38,26 +38,26 @@
|
|
|
38
38
|
"dependencies": {
|
|
39
39
|
"@bomb.sh/tab": "^0.0.22",
|
|
40
40
|
"@clack/prompts": "^1.8.1",
|
|
41
|
-
"@heximon/compiler": "0.
|
|
42
|
-
"@heximon/cqrs": "0.
|
|
43
|
-
"@heximon/deploy": "0.
|
|
44
|
-
"@heximon/http": "0.
|
|
45
|
-
"@heximon/node": "0.
|
|
46
|
-
"@heximon/runtime": "0.
|
|
47
|
-
"@heximon/testing": "0.
|
|
41
|
+
"@heximon/compiler": "0.17.0",
|
|
42
|
+
"@heximon/cqrs": "0.17.0",
|
|
43
|
+
"@heximon/deploy": "0.17.0",
|
|
44
|
+
"@heximon/http": "0.17.0",
|
|
45
|
+
"@heximon/node": "0.17.0",
|
|
46
|
+
"@heximon/runtime": "0.17.0",
|
|
47
|
+
"@heximon/testing": "0.17.0",
|
|
48
48
|
"citty": "^0.2.2",
|
|
49
49
|
"giget": "^3.3.1",
|
|
50
50
|
"pathe": "^2.0.3"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@heximon/cloudflare": "0.
|
|
54
|
-
"@heximon/durable": "0.
|
|
55
|
-
"@heximon/integration": "0.
|
|
56
|
-
"@heximon/library": "0.
|
|
57
|
-
"@heximon/nitro": "0.
|
|
58
|
-
"@heximon/queue": "0.
|
|
59
|
-
"@heximon/schedule": "0.
|
|
60
|
-
"@heximon/schema": "0.
|
|
53
|
+
"@heximon/cloudflare": "0.17.0",
|
|
54
|
+
"@heximon/durable": "0.17.0",
|
|
55
|
+
"@heximon/integration": "0.17.0",
|
|
56
|
+
"@heximon/library": "0.17.0",
|
|
57
|
+
"@heximon/nitro": "0.17.0",
|
|
58
|
+
"@heximon/queue": "0.17.0",
|
|
59
|
+
"@heximon/schedule": "0.17.0",
|
|
60
|
+
"@heximon/schema": "0.17.0",
|
|
61
61
|
"@heximon/test-support": "0.0.1",
|
|
62
62
|
"@types/node": "^24.19.0",
|
|
63
63
|
"@typescript/native-preview": "^7.0.0-dev.20260707.2",
|