@fluidgrids/cli 2026.1110.1 → 2026.1113.2

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 +80 -0
  2. package/dist/cli.js +1998 -557
  3. package/package.json +2 -2
package/README.md CHANGED
@@ -397,6 +397,86 @@ 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, the replay debugger and standalone activities (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
+ # One node operation as a durable activity (fluidgrids.standalone-activities)
424
+ fluidgrids activity start internal:http request --args '{"url":"https://example.com"}' --wait
425
+ ```
426
+
427
+ - `generate` writes the draft the service lifted from a validated definition
428
+ (the model never writes code), so the files always lower back to it; the
429
+ result carries the draft's `irHash` and fidelity report. `--import` creates
430
+ the workflow from exactly those files and compares the stored version's
431
+ `irHash` with the draft's. Python drafts are imported inside a Python project
432
+ through the installed SDK. `--format ts|py` works as well as `--as`.
433
+ `--out` is checked before the generation starts. A generation is never lost
434
+ once it has started: every later failure prints its id, and
435
+ `generate --resume <generationId>` fetches that draft again without a new
436
+ generation. When the draft would overwrite files that differ (without
437
+ `--force`), it is written to `.fluidgrids-drafts/<generationId>/` instead.
438
+ - `import --from n8n` sends the export to the service, which converts it
439
+ (nothing in it is evaluated). The result counts the n8n nodes, the mapped
440
+ ones, the disabled placeholders (nodes with no FluidGrids equivalent), the
441
+ expressions to rewrite and the connections to create; each item is also a
442
+ diagnostic (`--output json`). Credentials are never imported: each node that
443
+ needs one is listed with its connection provider. Without `--preview` the
444
+ service first confirms the file is an n8n export, then stores it as a DRAFT.
445
+ - `replay --trace` prints every step: the command the code issued, the recorded
446
+ event it matched and the TypeScript line. `--break-on-mismatch` stops an
447
+ attached debugger at the diverging line; `--inspect[=host:port]` re-runs the
448
+ command under `node --inspect-brk` on a loopback address (default
449
+ `127.0.0.1:9229`). `--remote-code` rebuilds the run's code from its source
450
+ archive and refuses unless the `buildId` is the run's and this CLI bundles
451
+ the `@fluidgrids/workflows` version that built it. The replay runs that code
452
+ on your machine in a Node `vm`, which is not a sandbox (the managed workers
453
+ use the QuickJS isolate), so debug only code from people you trust.
454
+ - `activity start` (also `activities start`) takes literal arguments; routing
455
+ nodes such as `internal:if` are refused. A repeated `--idempotency-key` (1 to
456
+ 128 letters, digits, `.`, `_`, `:` or `-`) from the same caller returns the
457
+ run it started (needs fluidgrids.durable-parity). Durations take a unit
458
+ (`250ms`, `30s`, `5m`, `2h`, `1d`, `PT2H`); a bare number is milliseconds and
459
+ is sent as `<n>ms`.
460
+
461
+ ### Machine-readable output (`--output json`)
462
+
463
+ `--output json` (or `--json`) makes any command print exactly one object on
464
+ stdout, the contract the VS Code extension reads (C-CLIJSON):
465
+
466
+ ```json
467
+ { "ok": false, "data": { "valid": false }, "diagnostics": [
468
+ { "path": "workflows/lead.ts", "line": 12, "column": 5, "severity": "error",
469
+ "code": "replay.nonDeterminism", "message": "…" } ] }
470
+ ```
471
+
472
+ `data` is what `--format json` prints, `diagnostics` lists the findings and
473
+ errors (a stable `code`, 1-based positions or null), and `ok` is false exactly
474
+ when the command fails. Everything else goes to stderr, including the output
475
+ of programs a command runs (the project's test script, a Python worker). A
476
+ service refusal carries the service's code (`FEATURE_DISABLED`, or the reason
477
+ such as `durable.activityTypeNotAllowed`). The shape is frozen in
478
+ `src/output/json-contract.ts`.
479
+
400
480
  ## Credentials, webhooks, scheduled jobs
401
481
 
402
482
  A credential is an integration connection. Creating one is a two-step flow: