@fluidgrids/cli 2026.1109.1 → 2026.1113.1

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 (3) hide show
  1. package/README.md +74 -0
  2. package/dist/cli.js +1843 -579
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -397,6 +397,80 @@ fluidgrids --profile alpha runs list
397
397
  profile; `FLUIDGRIDS_<KEY>` variables and the usual `FLUIDGRIDS_*` overrides
398
398
  win over it key by key. Without a config file nothing changes.
399
399
 
400
+ ## AI to code, n8n import and the replay debugger (Phase D)
401
+
402
+ Each command except the n8n import needs its Phase D flag on the workspace;
403
+ the service refuses with `FEATURE_DISABLED` otherwise, and the CLI names the
404
+ flag in a hint. Nothing is pre-checked locally, and Generate with AI is refused
405
+ before any model call, so no AI credit is spent. The n8n import uses the
406
+ workspace's live n8n import (the same one the canvas import dialog uses), which
407
+ needs no flag.
408
+
409
+ ```bash
410
+ # Generate with AI, as code (fluidgrids.code-first + fluidgrids.ai-code)
411
+ fluidgrids generate "Post every new HubSpot lead to #sales" --as ts --out .
412
+ fluidgrids generate "Post every new HubSpot lead to #sales" --import --key new-leads
413
+
414
+ # n8n import: preview, then import as a DRAFT
415
+ fluidgrids import export.json --from n8n --preview
416
+ fluidgrids import export.json --from n8n --key my-flow --allow-missing-nodes
417
+
418
+ # The replay debugger (local code needs no flag; --remote-code needs durable functions)
419
+ fluidgrids replay histories/run.history.json --trace
420
+ fluidgrids replay <runId> --trace --remote-code # the exact code that ran (DD8)
421
+ fluidgrids replay <runId> --inspect # node --inspect-brk, stops at the mismatch
422
+
423
+ ```
424
+
425
+ - `generate` writes the draft the service lifted from a validated definition
426
+ (the model never writes code), so the files always lower back to it; the
427
+ result carries the draft's `irHash` and fidelity report. `--import` creates
428
+ the workflow from exactly those files and compares the stored version's
429
+ `irHash` with the draft's. Python drafts are imported inside a Python project
430
+ through the installed SDK. `--format ts|py` works as well as `--as`.
431
+ `--out` is checked before the generation starts. A generation is never lost
432
+ once it has started: every later failure prints its id, and
433
+ `generate --resume <generationId>` fetches that draft again without a new
434
+ generation. When the draft would overwrite files that differ (without
435
+ `--force`), it is written to `.fluidgrids-drafts/<generationId>/` instead.
436
+ - `import --from n8n` sends the export to the service, which converts it
437
+ (nothing in it is evaluated). The result counts the n8n nodes, the mapped
438
+ ones, the disabled placeholders (nodes with no FluidGrids equivalent), the
439
+ expressions to rewrite and the connections to create; each item is also a
440
+ diagnostic (`--output json`). Credentials are never imported: each node that
441
+ needs one is listed with its connection provider. Without `--preview` the
442
+ service first confirms the file is an n8n export, then stores it as a DRAFT.
443
+ - `replay --trace` prints every step: the command the code issued, the recorded
444
+ event it matched and the TypeScript line. `--break-on-mismatch` stops an
445
+ attached debugger at the diverging line; `--inspect[=host:port]` re-runs the
446
+ command under `node --inspect-brk` on a loopback address (default
447
+ `127.0.0.1:9229`). `--remote-code` rebuilds the run's code from its source
448
+ archive and refuses unless the `buildId` is the run's and this CLI bundles
449
+ the `@fluidgrids/workflows` version that built it. The replay runs that code
450
+ on your machine in a Node `vm`, which is not a sandbox (the managed workers
451
+ use the QuickJS isolate), so debug only code from people you trust.
452
+ - `activity start` (standalone activities) is not in this release; it ships
453
+ once the service serves it.
454
+
455
+ ### Machine-readable output (`--output json`)
456
+
457
+ `--output json` (or `--json`) makes any command print exactly one object on
458
+ stdout, the contract the VS Code extension reads (C-CLIJSON):
459
+
460
+ ```json
461
+ { "ok": false, "data": { "valid": false }, "diagnostics": [
462
+ { "path": "workflows/lead.ts", "line": 12, "column": 5, "severity": "error",
463
+ "code": "replay.nonDeterminism", "message": "…" } ] }
464
+ ```
465
+
466
+ `data` is what `--format json` prints, `diagnostics` lists the findings and
467
+ errors (a stable `code`, 1-based positions or null), and `ok` is false exactly
468
+ when the command fails. Everything else goes to stderr, including the output
469
+ of programs a command runs (the project's test script, a Python worker). A
470
+ service refusal carries the service's code (`FEATURE_DISABLED`, or the reason
471
+ such as `durable.activityTypeNotAllowed`). The shape is frozen in
472
+ `src/output/json-contract.ts`.
473
+
400
474
  ## Credentials, webhooks, scheduled jobs
401
475
 
402
476
  A credential is an integration connection. Creating one is a two-step flow: