@withandeo/cli 0.11.0 → 0.13.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.
Files changed (69) hide show
  1. package/README.md +42 -0
  2. package/dist/api.d.ts +8 -2
  3. package/dist/api.d.ts.map +1 -1
  4. package/dist/api.js +12 -2
  5. package/dist/api.js.map +1 -1
  6. package/dist/artifact-limits.d.ts +8 -0
  7. package/dist/artifact-limits.d.ts.map +1 -0
  8. package/dist/artifact-limits.js +10 -0
  9. package/dist/artifact-limits.js.map +1 -0
  10. package/dist/artifact.d.ts.map +1 -1
  11. package/dist/artifact.js +28 -11
  12. package/dist/artifact.js.map +1 -1
  13. package/dist/capability-preflight.d.ts +7 -0
  14. package/dist/capability-preflight.d.ts.map +1 -0
  15. package/dist/capability-preflight.js +48 -0
  16. package/dist/capability-preflight.js.map +1 -0
  17. package/dist/contracts.d.ts +20 -0
  18. package/dist/contracts.d.ts.map +1 -1
  19. package/dist/documentation.d.ts +13 -0
  20. package/dist/documentation.d.ts.map +1 -0
  21. package/dist/documentation.js +70 -0
  22. package/dist/documentation.js.map +1 -0
  23. package/dist/files.d.ts.map +1 -1
  24. package/dist/files.js +16 -1
  25. package/dist/files.js.map +1 -1
  26. package/dist/index.d.ts +2 -0
  27. package/dist/index.d.ts.map +1 -1
  28. package/dist/index.js +2 -0
  29. package/dist/index.js.map +1 -1
  30. package/dist/main.d.ts.map +1 -1
  31. package/dist/main.js +135 -15
  32. package/dist/main.js.map +1 -1
  33. package/dist/workflow-config.d.ts +9 -0
  34. package/dist/workflow-config.d.ts.map +1 -0
  35. package/dist/workflow-config.js +76 -0
  36. package/dist/workflow-config.js.map +1 -0
  37. package/dist/workflow-contract.d.ts +34 -0
  38. package/dist/workflow-contract.d.ts.map +1 -0
  39. package/dist/workflow-contract.js +96 -0
  40. package/dist/workflow-contract.js.map +1 -0
  41. package/dist/workflow-coordinator.d.ts +4 -0
  42. package/dist/workflow-coordinator.d.ts.map +1 -0
  43. package/dist/workflow-coordinator.js +49 -0
  44. package/dist/workflow-coordinator.js.map +1 -0
  45. package/dist/workflow-dev-host.d.ts +2 -0
  46. package/dist/workflow-dev-host.d.ts.map +1 -0
  47. package/dist/workflow-dev-host.js +34 -0
  48. package/dist/workflow-dev-host.js.map +1 -0
  49. package/dist/workflow-dev.d.ts +5 -0
  50. package/dist/workflow-dev.d.ts.map +1 -0
  51. package/dist/workflow-dev.js +112 -0
  52. package/dist/workflow-dev.js.map +1 -0
  53. package/dist/workflow-package.d.ts +5 -0
  54. package/dist/workflow-package.d.ts.map +1 -0
  55. package/dist/workflow-package.js +116 -0
  56. package/dist/workflow-package.js.map +1 -0
  57. package/package.json +8 -1
  58. package/skill/tender-accounts/SKILL.md +48 -376
  59. package/skill/tender-accounts/references/authentication.md +38 -0
  60. package/skill/tender-accounts/references/configuration-secrets.md +9 -0
  61. package/skill/tender-accounts/references/delivery.md +125 -0
  62. package/skill/tender-accounts/references/domains-auth.md +13 -0
  63. package/skill/tender-accounts/references/managed-source.md +131 -0
  64. package/skill/tender-accounts/references/observability.md +18 -0
  65. package/skill/tender-accounts/references/releases-recovery.md +16 -0
  66. package/skill/tender-accounts/references/services.md +11 -0
  67. package/skill/tender-accounts/references/storage.md +13 -0
  68. package/skill/tender-accounts/references/workflows.md +69 -0
  69. package/templates/shopify-customer-account/apps/gateway/README.md +2 -0
@@ -0,0 +1,13 @@
1
+ # Domains and customer authentication
2
+
3
+ Treat three configurations separately:
4
+
5
+ 1. Andeo routing plus merchant DNS and certificate.
6
+ 2. The app's exact hostname allowlist; the Shopify starter uses `ACCOUNT_VANITY_HOSTNAMES`.
7
+ 3. Shopify's registered JavaScript origins, `/auth/callback` and `/auth/logout/callback` URLs.
8
+
9
+ Add only the merchant-approved hostname, preserve existing hosts, package configuration and publish through Andeo. Keep generated-host authentication working. Do not introduce wildcard origins or bypass checks after a 404.
10
+
11
+ Verify `/api/health`, `/api/bootstrap`, `/api/session` and the rendered sign-in/account journey on both domains. HTML 200 does not prove authentication works. In the starter, healthy gateway plus session `not_found` can indicate hostname-policy rejection. Bootstrap should select the custom-domain login URL. Inspect stale browser preview selection before blaming production.
12
+
13
+ Keep customer authentication, Andeo administrator sign-in, protected app visibility and preview grants separate. Use supported administrator controls; do not assume every custom-domain/visibility combination works. Check signed-out denial, signed-in data, renewal and logout. Preserve provider adapter headers, redirects and timeouts when adding authenticated queries.
@@ -0,0 +1,131 @@
1
+ # Managed source
2
+
3
+ If the merchant wants Andeo to own the Git transport, use the CLI for either
4
+ the linked gateway or service project:
5
+
6
+ ```sh
7
+ npx @withandeo/cli source connect --publication preview-only --json
8
+ npx @withandeo/cli source status --json
9
+ npx @withandeo/cli source pull --json
10
+ npx @withandeo/cli source push --json
11
+ ```
12
+
13
+ Run these commands from the independently deployable app directory, or use its
14
+ exact `--cwd`. `source connect` derives the project working directory and build
15
+ contract from Git plus `tender-accounts.json`; do not recreate that contract by
16
+ hand in the admin. Protected gateways must stay `preview-only`. Use
17
+ `--publication default-branch` only for an ordinary service when the merchant
18
+ explicitly wants successful default-branch previews promoted automatically.
19
+
20
+ `source push` includes only the committed revision. On a reviewed repository it
21
+ uploads a bounded Git bundle through Andeo; the trusted runner verifies the
22
+ exact commit and may update only the named non-default branch. The developer
23
+ never receives a provider write credential. On a repository that has not yet
24
+ enabled reviewed changes, the legacy short-lived Git credential path remains
25
+ available during migration. Never copy any credential into a remote URL,
26
+ credential helper, repository file, shell script, or chat. `source pull` is the
27
+ inverse operation for an already connected repository and never creates or
28
+ replaces the source connection. `source token` is read-only.
29
+
30
+ When `source status` reports `changeRequestProtection: enabled`, use the normal
31
+ reviewed flow:
32
+
33
+ ```sh
34
+ npx @withandeo/cli source push --branch feature/account-copy --json
35
+ npx @withandeo/cli source change create \
36
+ --head feature/account-copy \
37
+ --title "Update account copy" --json
38
+ npx @withandeo/cli source change show --change scr_... --json
39
+ ```
40
+
41
+ Return the `scr_` ID and exact preview state to the user. A developer or coding
42
+ agent stops after the exact preview is ready. Approval and **Land in main** are
43
+ merchant-administrator actions in Andeo. Do not push the default branch,
44
+ obtain a raw provider token, call internal APIs, or replace this flow with
45
+ `source promote` after reviewed changes are enabled.
46
+
47
+ After a successful landing, inspect `branchCleanup` in
48
+ `source change show --change scr_... --json`. `requested` and `running` need no
49
+ developer action. `succeeded` means the exact landed feature ref was deleted or
50
+ already absent. `retained` means Andeo deliberately kept a moved, reused, or
51
+ otherwise unsafe ref. `failed` does not undo landing; ask a merchant
52
+ administrator to retry cleanup in Andeo. Never obtain a provider write token
53
+ or delete the branch directly. All immutable build, release, composition,
54
+ approval, landing, and audit records remain available after cleanup.
55
+ Do not reuse the same feature branch or make it the default while cleanup is
56
+ `requested`, `running`, or retryable: Andeo deliberately fences that ref until
57
+ cleanup succeeds, retains it, or exhausts its bounded retry budget.
58
+
59
+ Inspect branches and history through read-only ephemeral credentials:
60
+
61
+ ```sh
62
+ npx @withandeo/cli source branches --json
63
+ npx @withandeo/cli source log --branch main --limit 20 --json
64
+ npx @withandeo/cli source compare --base main --head feature/account-copy --json
65
+ ```
66
+
67
+ Use standalone source-administration commands only for repositories where
68
+ reviewed changes are not enabled and when the user explicitly requests a
69
+ default-branch or history change and the active profile belongs to a merchant
70
+ source administrator. First record `source branches`, `source compare`, the
71
+ successful exact preview for the proposed head, and the current production
72
+ composition. Run the exact operation with `--dry-run` before applying it.
73
+
74
+ For an ordinary checked fast-forward, supply the current target SHA and a
75
+ stable idempotency key:
76
+
77
+ ```sh
78
+ npx @withandeo/cli source promote \
79
+ --head feature/account-copy \
80
+ --expected-current <exact-current-default-sha> \
81
+ --idempotency-key account-copy-v1 \
82
+ --dry-run --json
83
+ ```
84
+
85
+ For an exceptional migration, use only the guarded history workflow:
86
+
87
+ ```sh
88
+ npx @withandeo/cli source history replace \
89
+ --head app-only-main \
90
+ --expected-current <exact-current-default-sha> \
91
+ --confirm <exact-src-repository-id> \
92
+ --idempotency-key app-only-history-v1 \
93
+ --dry-run --json
94
+ ```
95
+
96
+ Inspect the returned `sop_` operation with `source operation status`. Apply the
97
+ same request without `--dry-run` only after the dry-run evidence matches the
98
+ intended repository, project, branches, SHA, preview build, and composition.
99
+ Never substitute a raw token, direct API, Git force push, ref deletion, or database
100
+ edit. Andeo creates and verifies an archive before history replacement and
101
+ uses an expected-SHA compare-and-swap for the target. History migration always
102
+ suppresses automatic production publication; protected gateways always remain
103
+ preview-only.
104
+
105
+ If a durable source operation fails for a transient provider or runner reason,
106
+ inspect and resume that same reviewed intent by ID:
107
+
108
+ ```sh
109
+ npx @withandeo/cli source operation status --operation sop_... --json
110
+ npx @withandeo/cli source operation retry --operation sop_... --json
111
+ ```
112
+
113
+ Do not create a replacement request merely to retry infrastructure. A stale
114
+ target, missing preview, archive conflict, or rejected permission requires the
115
+ stated remediation and a newly reviewed request instead.
116
+
117
+ For reviewed repositories, a moved head invalidates the previous approval and
118
+ the newest source build becomes the next exact snapshot. A moved base makes the
119
+ change stale. Rebase or update the feature branch, push a new committed
120
+ revision, wait for its exact preview, and have the administrator review that
121
+ new snapshot. Source landing never calls the production publisher directly;
122
+ after landing, the repository's already configured default-branch policy may
123
+ publish the same successful exact preview. Protected gateways remain
124
+ preview-only.
125
+
126
+ Treat source administration and production publication as different acts. A
127
+ source operation may create a new immutable preview lineage, but only the
128
+ merchant's established exact-composition control can publish production. For a
129
+ portal and gateway changed together, preview both immutable revisions and
130
+ review the sealed combined composition; do not pretend two repository refs can
131
+ be changed atomically or publish whatever happens to be on each default branch.
@@ -0,0 +1,18 @@
1
+ # Observability and diagnosis
2
+
3
+ | Layer | Investigation |
4
+ | --- | --- |
5
+ | Local setup | `andeo doctor --json`, checks, artifact dry-run |
6
+ | Preview delivery | `andeo delivery status --delivery dly_... --json` |
7
+ | Production publication | Exact `dwf_` in administrator Activity |
8
+ | Preview invocation | `andeo tail --delivery dly_... --status error --json` |
9
+ | Production invocation | `andeo tail --production --status error --json`, with merchant-admin authority |
10
+ | App workflow | `andeo workflows status`, `history`, `diagnostics`, `export` for exact scope/run |
11
+
12
+ Distinguish app runs from deployment workflows. Correlate project, environment, composition/release and safe run/request IDs. Never dump cookies, tokens, customer payloads or full provider errors. Sanitization cannot reliably protect secrets in arbitrary log strings.
13
+
14
+ Live tail is short-lived, not historical search. Workflow lists are projections; exact run status reads engine state. History/export is bounded/sanitized with cursors, not raw native output or a live stream. Service diagnostics identify service revisions and attempts but do not imply equivalent instrumentation for every direct fetch. Record business receipts with non-secret correlation fields when needed.
15
+
16
+ OTLP export is a separate administrator operation that can transmit raw telemetry to a merchant-approved destination. Verify deployment/support and destination approval first; do not invent export commands, install a new provider or promise historical dashboards from platform collection alone.
17
+
18
+ For 503s, distinguish identity lookup, storage, admission/create, execution and callbacks before retrying. Ambiguous create/event/provider outcomes require reconciliation using the same logical operation. Publication or accepted start is not proof of the business effect.
@@ -0,0 +1,16 @@
1
+ # Production releases and recovery
2
+
3
+ Production changes require explicit user authorization and an eligible merchant administrator. Developer preview permission is not production authority. No CLI publish command exists; use the protected policy or administrator console.
4
+
5
+ ```sh
6
+ andeo production releases --json
7
+ andeo production rollback --release TARGET_RELEASE_ID \
8
+ --expected-release CURRENT_RELEASE_ID --expected-revision N \
9
+ --idempotency-key approved-restore-001 --json
10
+ ```
11
+
12
+ Only run rollback when explicitly requested. Select an eligible retained target and current release/revision from platform results; never guess or silently replace stale expectations. Rollback creates a new audited activation, not a Git reset, database restore or old secret-value restoration. Reconcile uncertain outcomes before another request.
13
+
14
+ Recover `dwf_` publications via administrator Activity → Resume exact publish. `delivery retry` accepts `dly_` preview IDs, not production workflows. Preserve the approved intent; never edit platform records or submit duplicates to escape a hold.
15
+
16
+ Verify final state and actual live composition, same-origin authenticated APIs and relevant generated/custom hostnames. Retained artifacts, preview readiness, stale UI toasts or HTML success are insufficient. Running workflows can retain old definitions and service contracts; code rollback does not cancel them.
@@ -0,0 +1,11 @@
1
+ # Connected apps and service bindings
2
+
3
+ Use independently published private apps for secret-backed integrations or reusable operations. Declare the portable artifact connection, for example `services: [{ "name": "DELIVERY_SERVICE", "targetProject": "delivery-service" }]`, using the configured target slug. An administrator must allow the connection in Settings; a declaration cannot grant access.
4
+
5
+ Call `env.DELIVERY_SERVICE.fetch(...)`. Never reference physical Workers, namespaces or platform routing headers. Private apps cannot open directly. Keep browser APIs same-origin through the gateway and authorize business operations server-side.
6
+
7
+ Publish dependencies before consumers. Workflow targets must publish a public string `WORKFLOW_SERVICE_CONTRACT`, such as `delivery-v1`. Preserve compatibility while definitions/runs retain it; drain dependencies or introduce a separately versioned service for breaking changes. Workflow services support bounded fetch, not arbitrary business RPC.
8
+
9
+ Use `andeo preview entries --json` and `andeo preview open --from dly_... --json`. Preview-through permission is distinct from call permission. Apps without a selected preview use published revisions; verify the sealed composition, not an assumed collection of latest previews.
10
+
11
+ Inspect `andeo workflows preview-services --json` and `preview-service-set --help` for explicit workflow preview dependency selection. Never silently cross app/environment boundaries. Verify permitted calls and revoked/unauthorized denial. Revocation does not undo effects or block unrelated direct Internet requests.
@@ -0,0 +1,13 @@
1
+ # App-owned storage
2
+
3
+ Use storage for sessions, workflow receipts and app-owned state, not a replacement source of truth for provider business data. Run `andeo capabilities --json`: recognized resource types and enabled quotas do not prove automated provisioning support.
4
+
5
+ The supported automated database path is D1. Declare a named resource in the portable artifact, for example `resources: [{ "type": "d1", "name": "APP_DB" }]`. Account enablement and quota are prerequisites. Andeo owns trusted provisioning and exact environment bindings; never supply physical IDs or provision through provider credentials.
6
+
7
+ Hosted preview and production databases are separate. Do not assume preview has production rows. Local schema setup is app-owned; use the repository's schema declaration/packaging conventions and validate through preview/publication.
8
+
9
+ Prefer additive, backwards-compatible changes while old code/runs remain active. Code rollback does not restore data or undo migrations. Complex schema evolution, destructive changes and restores require an explicit reviewed plan and supported operator path.
10
+
11
+ KV, R2, Queues and Durable Objects may appear in contracts, entitlements or emulation, but are not automatically provisioned merchant resources without explicit support and hosted proof. Unsupported bindings must fail delivery, never disappear silently. Workflows have their own supported account resource lifecycle; read [Workflows](workflows.md).
12
+
13
+ Verify persistence after reload, customer-scoped queries, cross-customer denial and environment isolation. Parameterize queries; keep customer data out of logs and fixtures.
@@ -0,0 +1,69 @@
1
+ # App-defined workflows
2
+
3
+ Use workflows for durable multi-step work, delays and event waits. An administrator must enable the account's workflow capability and definition quota first; declarations cannot enable it. No separate feature flag is required. Authenticate and authorize the customer in the app action before starting a run.
4
+
5
+ ## Declare and build
6
+
7
+ Export the class from the app's Worker entry module and declare it in that app's Wrangler config:
8
+
9
+ ```jsonc
10
+ { "workflows": [{ "name": "customer-activity", "binding": "CUSTOMER_ACTIVITY", "class_name": "CustomerActivity" }] }
11
+ ```
12
+
13
+ ```ts
14
+ import { WorkflowEntrypoint, type WorkflowEvent, type WorkflowStep } from "cloudflare:workers";
15
+
16
+ export class CustomerActivity extends WorkflowEntrypoint<{}, { runId: string }> {
17
+ async run(event: WorkflowEvent<{ runId: string }>, step: WorkflowStep) {
18
+ await step.do("notify", async () => {
19
+ // Replace this example with a fixed, approved application endpoint.
20
+ const response = await fetch("https://gateway.example.com/api/workflow-receipts", {
21
+ method: "POST",
22
+ headers: { "Content-Type": "application/json" },
23
+ body: JSON.stringify({ runId: event.payload.runId, phase: "started" }),
24
+ redirect: "manual",
25
+ signal: AbortSignal.timeout(10_000),
26
+ });
27
+ await response.body?.cancel();
28
+ if (!response.ok) throw new Error("Receipt failed");
29
+ return { sent: true };
30
+ });
31
+ await step.sleep("delay", "2 seconds");
32
+ }
33
+ }
34
+
35
+ // In an authorized app action, use a stable logical operation ID:
36
+ // const run = await env.CUSTOMER_ACTIVITY.create({ id: runId, params: { runId } });
37
+ // return Response.json({ runId: await run.id }, { status: 202 });
38
+ ```
39
+
40
+ The CLI packages code for Andeo's Dynamic Workflow hosts. Do not deploy a separate Cloudflare workflow. Global `fetch()` works inside durable steps; a service is not required merely for HTTP. Pin approved destinations, validate variable URLs, bound timeouts/redirects, and make external effects idempotent because steps retry. A callback that only knows a run ID is a demo receipt, not sender authentication; use secret-backed verification for trusted callbacks.
41
+
42
+ ## Environment and services
43
+
44
+ Workflow code receives declared public string vars and scoped service capabilities—not app secrets, direct D1/KV/R2 bindings or the platform dispatcher. Never pass tokens through params, events or step results. Put secret-backed HTTP/storage operations in a connected service; read [Services](services.md) and [Configuration](configuration-secrets.md). Publish its `WORKFLOW_SERVICE_CONTRACT` first. Direct outbound access is independent of service permission revocation.
45
+
46
+ ## Local and hosted validation
47
+
48
+ Use `andeo dev` for the local Workflow/Loader runtime. Map service bindings to built local artifact directories in `andeo.workflow-dev.json`, for example `{ "DELIVERY_SERVICE": "../delivery-service/dist/andeo" }`. Build services first. Local state is under `.tender/workflows-local`; restart after source changes (no hot reload). Local schema setup is app-owned. Local success does not prove hosted authorization or isolation.
49
+
50
+ Use normal build/preview delivery. Verify an authenticated start, durable completion, the external effect and persistence after reload. The reference demo writes a requested row and receives started/completed POSTs in its gateway. Customer identity lookups must preserve the provider's required headers; the reference Shopify queries use an explicit User-Agent.
51
+
52
+ ## Inspect and control
53
+
54
+ ```sh
55
+ andeo workflows list --environment preview --json
56
+ andeo workflows runs --scope SCOPE_ID --json
57
+ andeo workflows status --scope SCOPE_ID --run RUN_ID --json
58
+ andeo workflows history --scope SCOPE_ID --run RUN_ID --json
59
+ andeo workflows diagnostics --scope SCOPE_ID --run RUN_ID --json
60
+ andeo workflows export --scope SCOPE_ID --run RUN_ID --limit 100 --offset 0 --json
61
+ ```
62
+
63
+ Read `andeo workflows --help` for start/event/pause/resume/terminate/restart and preview-service selection. Obtain scopes from list results; never invent physical IDs. Identical scoped run IDs and inputs converge; changed inputs conflict. Lists are timestamped projections; single-run status reads the engine. Follow returned cursors/offsets. Exports omit raw payloads, provider errors and free-form logs.
64
+
65
+ Viewers can read; developers can control runs. Termination/restart and uncertain-event acknowledgement require exact run confirmation. Never replay ambiguous events automatically. Acknowledgement clears a fence; it does not prove delivery. Termination cannot reverse completed or in-flight effects. Disabling entitlement blocks new starts/restarts and workflow-bearing releases, not already running work.
66
+
67
+ ## Limits
68
+
69
+ Use the supported adapter surface: create/get/status, bounded createBatch, sendEvent, pause/resume/terminate/restart and bounded history. `createBatch` returns per-member acceptance/error records, not native handle-array parity; use `await run.id`. Schedules, custom retention, cross-app `script_name`, arbitrary business RPC and full native API parity are unsupported. Restart requires a terminal run within the supported retention window. Check runtime errors for current payload/admission/service limits; upstream Cloudflare limits are not Andeo's contract.
@@ -9,3 +9,5 @@ Local HTTP development returns an explicit signed-out state. Real Shopify sign-i
9
9
  The generated `.dev` hostname stays the Shopify callback anchor. When a merchant vanity domain is activated, add it to the public comma-separated `ACCOUNT_VANITY_HOSTNAMES` environment value so the exact-host session policy can safely return the shopper there. Do not move Shopify callback configuration to the vanity hostname.
10
10
 
11
11
  Managed builds retain published settings through `TENDER_PUBLIC_VARS_SOURCE`, which points to the app's verified build envelope and takes precedence over `--vars`. The packager checks the app identity and declared public-variable allowlist. Without that input, local packaging reads `--vars` or `.dev.vars` as usual.
12
+
13
+ If this app needs runtime secrets, declare their names in its app configuration and ask an app administrator to select shared previews, initialize its targets, and save each app-level secret in Settings. Read a native secret directly as a string, such as `env.API_TOKEN`; do not use a Secrets Store `.get()` binding. One saved value applies to preview and production. A new gateway preview replaces its previous preview. The portal can keep independent previews so multiple portal PRs remain available simultaneously. These are explicit project policies, independent of the app's name or kind.