@endora-commerce/cli 0.100.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/LICENSE +21 -0
- package/README.md +37 -0
- package/dist/bin/endora.d.ts +28 -0
- package/dist/bin/endora.d.ts.map +1 -0
- package/dist/bin/endora.js +926 -0
- package/dist/bin/endora.js.map +1 -0
- package/dist/check/estate.d.ts +189 -0
- package/dist/check/estate.d.ts.map +1 -0
- package/dist/check/estate.js +1037 -0
- package/dist/check/estate.js.map +1 -0
- package/dist/check/hosts.d.ts +25 -0
- package/dist/check/hosts.d.ts.map +1 -0
- package/dist/check/hosts.js +1347 -0
- package/dist/check/hosts.js.map +1 -0
- package/dist/check/index.d.ts +60 -0
- package/dist/check/index.d.ts.map +1 -0
- package/dist/check/index.js +111 -0
- package/dist/check/index.js.map +1 -0
- package/dist/check/layout.d.ts +136 -0
- package/dist/check/layout.d.ts.map +1 -0
- package/dist/check/layout.js +262 -0
- package/dist/check/layout.js.map +1 -0
- package/dist/check/ledger.d.ts +98 -0
- package/dist/check/ledger.d.ts.map +1 -0
- package/dist/check/ledger.js +173 -0
- package/dist/check/ledger.js.map +1 -0
- package/dist/check/peer-owners.d.ts +116 -0
- package/dist/check/peer-owners.d.ts.map +1 -0
- package/dist/check/peer-owners.js +225 -0
- package/dist/check/peer-owners.js.map +1 -0
- package/dist/check/report.d.ts +33 -0
- package/dist/check/report.d.ts.map +1 -0
- package/dist/check/report.js +107 -0
- package/dist/check/report.js.map +1 -0
- package/dist/check/run.d.ts +147 -0
- package/dist/check/run.d.ts.map +1 -0
- package/dist/check/run.js +111 -0
- package/dist/check/run.js.map +1 -0
- package/dist/checks.d.ts +17 -0
- package/dist/checks.d.ts.map +1 -0
- package/dist/checks.js +17 -0
- package/dist/checks.js.map +1 -0
- package/dist/dev/index.d.ts +83 -0
- package/dist/dev/index.d.ts.map +1 -0
- package/dist/dev/index.js +298 -0
- package/dist/dev/index.js.map +1 -0
- package/dist/generate/divergence.d.ts +38 -0
- package/dist/generate/divergence.d.ts.map +1 -0
- package/dist/generate/divergence.js +237 -0
- package/dist/generate/divergence.js.map +1 -0
- package/dist/generate/index.d.ts +90 -0
- package/dist/generate/index.d.ts.map +1 -0
- package/dist/generate/index.js +369 -0
- package/dist/generate/index.js.map +1 -0
- package/dist/index.d.ts +23 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/inputs/declaration.d.ts +18 -0
- package/dist/inputs/declaration.d.ts.map +1 -0
- package/dist/inputs/declaration.js +64 -0
- package/dist/inputs/declaration.js.map +1 -0
- package/dist/inputs/env-file.d.ts +73 -0
- package/dist/inputs/env-file.d.ts.map +1 -0
- package/dist/inputs/env-file.js +134 -0
- package/dist/inputs/env-file.js.map +1 -0
- package/dist/inputs/prompt.d.ts +21 -0
- package/dist/inputs/prompt.d.ts.map +1 -0
- package/dist/inputs/prompt.js +59 -0
- package/dist/inputs/prompt.js.map +1 -0
- package/dist/inputs/resolve.d.ts +163 -0
- package/dist/inputs/resolve.d.ts.map +1 -0
- package/dist/inputs/resolve.js +290 -0
- package/dist/inputs/resolve.js.map +1 -0
- package/dist/install/host.d.ts +27 -0
- package/dist/install/host.d.ts.map +1 -0
- package/dist/install/host.js +90 -0
- package/dist/install/host.js.map +1 -0
- package/dist/install/index.d.ts +173 -0
- package/dist/install/index.d.ts.map +1 -0
- package/dist/install/index.js +793 -0
- package/dist/install/index.js.map +1 -0
- package/dist/install/wizard.d.ts +144 -0
- package/dist/install/wizard.d.ts.map +1 -0
- package/dist/install/wizard.js +362 -0
- package/dist/install/wizard.js.map +1 -0
- package/dist/lib/admin-artefacts.d.ts +70 -0
- package/dist/lib/admin-artefacts.d.ts.map +1 -0
- package/dist/lib/admin-artefacts.js +354 -0
- package/dist/lib/admin-artefacts.js.map +1 -0
- package/dist/lib/admin-surfaces.d.ts +298 -0
- package/dist/lib/admin-surfaces.d.ts.map +1 -0
- package/dist/lib/admin-surfaces.js +669 -0
- package/dist/lib/admin-surfaces.js.map +1 -0
- package/dist/lib/delegated-composer.d.ts +85 -0
- package/dist/lib/delegated-composer.d.ts.map +1 -0
- package/dist/lib/delegated-composer.js +241 -0
- package/dist/lib/delegated-composer.js.map +1 -0
- package/dist/lib/divergence-artefacts.d.ts +305 -0
- package/dist/lib/divergence-artefacts.d.ts.map +1 -0
- package/dist/lib/divergence-artefacts.js +828 -0
- package/dist/lib/divergence-artefacts.js.map +1 -0
- package/dist/lib/divergence.d.ts +337 -0
- package/dist/lib/divergence.d.ts.map +1 -0
- package/dist/lib/divergence.js +1005 -0
- package/dist/lib/divergence.js.map +1 -0
- package/dist/lib/docs-artefacts.d.ts +395 -0
- package/dist/lib/docs-artefacts.d.ts.map +1 -0
- package/dist/lib/docs-artefacts.js +781 -0
- package/dist/lib/docs-artefacts.js.map +1 -0
- package/dist/lib/emitted-exports.d.ts +21 -0
- package/dist/lib/emitted-exports.d.ts.map +1 -0
- package/dist/lib/emitted-exports.js +96 -0
- package/dist/lib/emitted-exports.js.map +1 -0
- package/dist/lib/emitted-freshness.d.ts +112 -0
- package/dist/lib/emitted-freshness.d.ts.map +1 -0
- package/dist/lib/emitted-freshness.js +288 -0
- package/dist/lib/emitted-freshness.js.map +1 -0
- package/dist/lib/entity-index-artefact.d.ts +95 -0
- package/dist/lib/entity-index-artefact.d.ts.map +1 -0
- package/dist/lib/entity-index-artefact.js +210 -0
- package/dist/lib/entity-index-artefact.js.map +1 -0
- package/dist/lib/instance-build-inputs.d.ts +108 -0
- package/dist/lib/instance-build-inputs.d.ts.map +1 -0
- package/dist/lib/instance-build-inputs.js +165 -0
- package/dist/lib/instance-build-inputs.js.map +1 -0
- package/dist/lib/module-docs.d.ts +473 -0
- package/dist/lib/module-docs.d.ts.map +1 -0
- package/dist/lib/module-docs.js +711 -0
- package/dist/lib/module-docs.js.map +1 -0
- package/dist/lib/module-package-subpaths.d.ts +56 -0
- package/dist/lib/module-package-subpaths.d.ts.map +1 -0
- package/dist/lib/module-package-subpaths.js +223 -0
- package/dist/lib/module-package-subpaths.js.map +1 -0
- package/dist/lib/module-packages.d.ts +200 -0
- package/dist/lib/module-packages.d.ts.map +1 -0
- package/dist/lib/module-packages.js +580 -0
- package/dist/lib/module-packages.js.map +1 -0
- package/dist/lib/module-population.d.ts +129 -0
- package/dist/lib/module-population.d.ts.map +1 -0
- package/dist/lib/module-population.js +172 -0
- package/dist/lib/module-population.js.map +1 -0
- package/dist/lib/module-roots.d.ts +337 -0
- package/dist/lib/module-roots.d.ts.map +1 -0
- package/dist/lib/module-roots.js +586 -0
- package/dist/lib/module-roots.js.map +1 -0
- package/dist/lib/nested-checkouts.d.ts +33 -0
- package/dist/lib/nested-checkouts.d.ts.map +1 -0
- package/dist/lib/nested-checkouts.js +160 -0
- package/dist/lib/nested-checkouts.js.map +1 -0
- package/dist/lib/platform-root.d.ts +43 -0
- package/dist/lib/platform-root.d.ts.map +1 -0
- package/dist/lib/platform-root.js +134 -0
- package/dist/lib/platform-root.js.map +1 -0
- package/dist/lib/platform-surface.d.ts +235 -0
- package/dist/lib/platform-surface.d.ts.map +1 -0
- package/dist/lib/platform-surface.js +393 -0
- package/dist/lib/platform-surface.js.map +1 -0
- package/dist/lib/port-registrations.d.ts +223 -0
- package/dist/lib/port-registrations.d.ts.map +1 -0
- package/dist/lib/port-registrations.js +532 -0
- package/dist/lib/port-registrations.js.map +1 -0
- package/dist/lib/read-size.d.ts +154 -0
- package/dist/lib/read-size.d.ts.map +1 -0
- package/dist/lib/read-size.js +182 -0
- package/dist/lib/read-size.js.map +1 -0
- package/dist/lib/registration-owners.d.ts +79 -0
- package/dist/lib/registration-owners.d.ts.map +1 -0
- package/dist/lib/registration-owners.js +77 -0
- package/dist/lib/registration-owners.js.map +1 -0
- package/dist/lib/release-index.d.ts +53 -0
- package/dist/lib/release-index.d.ts.map +1 -0
- package/dist/lib/release-index.js +162 -0
- package/dist/lib/release-index.js.map +1 -0
- package/dist/lib/repeating-timers.d.ts +79 -0
- package/dist/lib/repeating-timers.d.ts.map +1 -0
- package/dist/lib/repeating-timers.js +189 -0
- package/dist/lib/repeating-timers.js.map +1 -0
- package/dist/lib/source-text.d.ts +34 -0
- package/dist/lib/source-text.d.ts.map +1 -0
- package/dist/lib/source-text.js +80 -0
- package/dist/lib/source-text.js.map +1 -0
- package/dist/lib/specifiers.d.ts +20 -0
- package/dist/lib/specifiers.d.ts.map +1 -0
- package/dist/lib/specifiers.js +130 -0
- package/dist/lib/specifiers.js.map +1 -0
- package/dist/lib/sql-tables.d.ts +166 -0
- package/dist/lib/sql-tables.d.ts.map +1 -0
- package/dist/lib/sql-tables.js +464 -0
- package/dist/lib/sql-tables.js.map +1 -0
- package/dist/lib/switchable-modules.d.ts +54 -0
- package/dist/lib/switchable-modules.d.ts.map +1 -0
- package/dist/lib/switchable-modules.js +104 -0
- package/dist/lib/switchable-modules.js.map +1 -0
- package/dist/lib/tailwind-sources.d.ts +136 -0
- package/dist/lib/tailwind-sources.d.ts.map +1 -0
- package/dist/lib/tailwind-sources.js +307 -0
- package/dist/lib/tailwind-sources.js.map +1 -0
- package/dist/lib/ui-layer.d.ts +54 -0
- package/dist/lib/ui-layer.d.ts.map +1 -0
- package/dist/lib/ui-layer.js +57 -0
- package/dist/lib/ui-layer.js.map +1 -0
- package/dist/lib/workspace-packages.d.ts +186 -0
- package/dist/lib/workspace-packages.d.ts.map +1 -0
- package/dist/lib/workspace-packages.js +351 -0
- package/dist/lib/workspace-packages.js.map +1 -0
- package/dist/new-instance/deploy.d.ts +211 -0
- package/dist/new-instance/deploy.d.ts.map +1 -0
- package/dist/new-instance/deploy.js +1381 -0
- package/dist/new-instance/deploy.js.map +1 -0
- package/dist/new-instance/docs-toolchain.d.ts +66 -0
- package/dist/new-instance/docs-toolchain.d.ts.map +1 -0
- package/dist/new-instance/docs-toolchain.js +69 -0
- package/dist/new-instance/docs-toolchain.js.map +1 -0
- package/dist/new-instance/host.d.ts +124 -0
- package/dist/new-instance/host.d.ts.map +1 -0
- package/dist/new-instance/host.js +276 -0
- package/dist/new-instance/host.js.map +1 -0
- package/dist/new-instance/index.d.ts +118 -0
- package/dist/new-instance/index.d.ts.map +1 -0
- package/dist/new-instance/index.js +567 -0
- package/dist/new-instance/index.js.map +1 -0
- package/dist/new-instance/modules.d.ts +188 -0
- package/dist/new-instance/modules.d.ts.map +1 -0
- package/dist/new-instance/modules.js +392 -0
- package/dist/new-instance/modules.js.map +1 -0
- package/dist/new-instance/template.d.ts +505 -0
- package/dist/new-instance/template.d.ts.map +1 -0
- package/dist/new-instance/template.js +1886 -0
- package/dist/new-instance/template.js.map +1 -0
- package/dist/new-module/emit.d.ts +67 -0
- package/dist/new-module/emit.d.ts.map +1 -0
- package/dist/new-module/emit.js +1393 -0
- package/dist/new-module/emit.js.map +1 -0
- package/dist/new-module/host.d.ts +67 -0
- package/dist/new-module/host.d.ts.map +1 -0
- package/dist/new-module/host.js +224 -0
- package/dist/new-module/host.js.map +1 -0
- package/dist/new-module/index.d.ts +32 -0
- package/dist/new-module/index.d.ts.map +1 -0
- package/dist/new-module/index.js +193 -0
- package/dist/new-module/index.js.map +1 -0
- package/dist/new-module/spec.d.ts +188 -0
- package/dist/new-module/spec.d.ts.map +1 -0
- package/dist/new-module/spec.js +404 -0
- package/dist/new-module/spec.js.map +1 -0
- package/dist/new-module/text.d.ts +15 -0
- package/dist/new-module/text.d.ts.map +1 -0
- package/dist/new-module/text.js +22 -0
- package/dist/new-module/text.js.map +1 -0
- package/dist/new-storefront/dockerfile.d.ts +20 -0
- package/dist/new-storefront/dockerfile.d.ts.map +1 -0
- package/dist/new-storefront/dockerfile.js +131 -0
- package/dist/new-storefront/dockerfile.js.map +1 -0
- package/dist/new-storefront/gitignore.d.ts +23 -0
- package/dist/new-storefront/gitignore.d.ts.map +1 -0
- package/dist/new-storefront/gitignore.js +39 -0
- package/dist/new-storefront/gitignore.js.map +1 -0
- package/dist/new-storefront/index.d.ts +93 -0
- package/dist/new-storefront/index.d.ts.map +1 -0
- package/dist/new-storefront/index.js +329 -0
- package/dist/new-storefront/index.js.map +1 -0
- package/dist/new-storefront/npmrc.d.ts +98 -0
- package/dist/new-storefront/npmrc.d.ts.map +1 -0
- package/dist/new-storefront/npmrc.js +217 -0
- package/dist/new-storefront/npmrc.js.map +1 -0
- package/dist/new-storefront/reference.d.ts +189 -0
- package/dist/new-storefront/reference.d.ts.map +1 -0
- package/dist/new-storefront/reference.js +430 -0
- package/dist/new-storefront/reference.js.map +1 -0
- package/dist/new-storefront/rewrite.d.ts +171 -0
- package/dist/new-storefront/rewrite.d.ts.map +1 -0
- package/dist/new-storefront/rewrite.js +701 -0
- package/dist/new-storefront/rewrite.js.map +1 -0
- package/dist/release-index.json +284 -0
- package/dist/rules/action-route-permissions.d.ts +141 -0
- package/dist/rules/action-route-permissions.d.ts.map +1 -0
- package/dist/rules/action-route-permissions.js +556 -0
- package/dist/rules/action-route-permissions.js.map +1 -0
- package/dist/rules/bundle-pairing.d.ts +74 -0
- package/dist/rules/bundle-pairing.d.ts.map +1 -0
- package/dist/rules/bundle-pairing.js +281 -0
- package/dist/rules/bundle-pairing.js.map +1 -0
- package/dist/rules/channel-resolution.d.ts +17 -0
- package/dist/rules/channel-resolution.d.ts.map +1 -0
- package/dist/rules/channel-resolution.js +382 -0
- package/dist/rules/channel-resolution.js.map +1 -0
- package/dist/rules/command-coverage.d.ts +210 -0
- package/dist/rules/command-coverage.d.ts.map +1 -0
- package/dist/rules/command-coverage.js +714 -0
- package/dist/rules/command-coverage.js.map +1 -0
- package/dist/rules/container-imports.d.ts +60 -0
- package/dist/rules/container-imports.d.ts.map +1 -0
- package/dist/rules/container-imports.js +158 -0
- package/dist/rules/container-imports.js.map +1 -0
- package/dist/rules/default-language-prose.d.ts +212 -0
- package/dist/rules/default-language-prose.d.ts.map +1 -0
- package/dist/rules/default-language-prose.js +710 -0
- package/dist/rules/default-language-prose.js.map +1 -0
- package/dist/rules/diacritic-folds.d.ts +238 -0
- package/dist/rules/diacritic-folds.d.ts.map +1 -0
- package/dist/rules/diacritic-folds.js +681 -0
- package/dist/rules/diacritic-folds.js.map +1 -0
- package/dist/rules/entity-tenant-classification.d.ts +171 -0
- package/dist/rules/entity-tenant-classification.d.ts.map +1 -0
- package/dist/rules/entity-tenant-classification.js +323 -0
- package/dist/rules/entity-tenant-classification.js.map +1 -0
- package/dist/rules/entry-presence.d.ts +142 -0
- package/dist/rules/entry-presence.d.ts.map +1 -0
- package/dist/rules/entry-presence.js +339 -0
- package/dist/rules/entry-presence.js.map +1 -0
- package/dist/rules/entry-scope.d.ts +91 -0
- package/dist/rules/entry-scope.d.ts.map +1 -0
- package/dist/rules/entry-scope.js +404 -0
- package/dist/rules/entry-scope.js.map +1 -0
- package/dist/rules/env-inputs.d.ts +222 -0
- package/dist/rules/env-inputs.d.ts.map +1 -0
- package/dist/rules/env-inputs.js +951 -0
- package/dist/rules/env-inputs.js.map +1 -0
- package/dist/rules/kernel-boundary.d.ts +37 -0
- package/dist/rules/kernel-boundary.d.ts.map +1 -0
- package/dist/rules/kernel-boundary.js +195 -0
- package/dist/rules/kernel-boundary.js.map +1 -0
- package/dist/rules/nul-bytes.d.ts +233 -0
- package/dist/rules/nul-bytes.d.ts.map +1 -0
- package/dist/rules/nul-bytes.js +332 -0
- package/dist/rules/nul-bytes.js.map +1 -0
- package/dist/rules/platform-surface.d.ts +479 -0
- package/dist/rules/platform-surface.d.ts.map +1 -0
- package/dist/rules/platform-surface.js +749 -0
- package/dist/rules/platform-surface.js.map +1 -0
- package/dist/rules/port-catches.d.ts +225 -0
- package/dist/rules/port-catches.d.ts.map +1 -0
- package/dist/rules/port-catches.js +1374 -0
- package/dist/rules/port-catches.js.map +1 -0
- package/dist/rules/port-shape.d.ts +213 -0
- package/dist/rules/port-shape.d.ts.map +1 -0
- package/dist/rules/port-shape.js +670 -0
- package/dist/rules/port-shape.js.map +1 -0
- package/dist/rules/queue-names.d.ts +108 -0
- package/dist/rules/queue-names.d.ts.map +1 -0
- package/dist/rules/queue-names.js +395 -0
- package/dist/rules/queue-names.js.map +1 -0
- package/dist/rules/singleton-identity.d.ts +205 -0
- package/dist/rules/singleton-identity.d.ts.map +1 -0
- package/dist/rules/singleton-identity.js +830 -0
- package/dist/rules/singleton-identity.js.map +1 -0
- package/dist/rules/subscribe-seam.d.ts +121 -0
- package/dist/rules/subscribe-seam.d.ts.map +1 -0
- package/dist/rules/subscribe-seam.js +594 -0
- package/dist/rules/subscribe-seam.js.map +1 -0
- package/dist/rules/transaction-context.d.ts +40 -0
- package/dist/rules/transaction-context.d.ts.map +1 -0
- package/dist/rules/transaction-context.js +294 -0
- package/dist/rules/transaction-context.js.map +1 -0
- package/package.json +59 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The `.env` a command reads values from and writes values into.
|
|
3
|
+
*
|
|
4
|
+
* `specs/117-instance-bring-up/contracts/input-resolution.md` tier 2, and R1.3:
|
|
5
|
+
* **this is not a configuration file for the tool**. `cli-product.md` R2.5's
|
|
6
|
+
* *"there is no `.endorarc`"* stands unamended. Nothing in a `.env` changes a
|
|
7
|
+
* verdict, a rule or a behaviour of the CLI — it supplies values, exactly as a
|
|
8
|
+
* flag does, and it is the *instance's* own runtime configuration, which is to
|
|
9
|
+
* say the artefact the command's own output already contains.
|
|
10
|
+
*
|
|
11
|
+
* ## Blank does not answer
|
|
12
|
+
*
|
|
13
|
+
* `SESSION_COOKIE_SECRET=` and no line at all are the same state for whoever has
|
|
14
|
+
* to fix it, so a blank value does not resolve an input: it is skipped, and the
|
|
15
|
+
* input goes on to the next tier. Reading it as an answer would let a run print
|
|
16
|
+
* `env-file=6` over six empty strings and a shop boot with an unsigned session
|
|
17
|
+
* cookie — a provenance line that is true about where it looked and false about
|
|
18
|
+
* what it found. `storefront/lib/env.mjs` makes the same call for the same
|
|
19
|
+
* reason and calls the state `missing` rather than malformed.
|
|
20
|
+
*
|
|
21
|
+
* ## What it deliberately does not implement
|
|
22
|
+
*
|
|
23
|
+
* No variable expansion (`${OTHER}`), no multi-line values, no `.env.local`
|
|
24
|
+
* chain. Each is a dialect: `dotenv`, `pnpm`, Next and Docker Compose disagree
|
|
25
|
+
* about all three, and a scaffold that picked one would write a file that means
|
|
26
|
+
* something different to the tool that reads it next. What is implemented is the
|
|
27
|
+
* intersection every one of them agrees on — `KEY=value`, one line, optional
|
|
28
|
+
* quotes, `#` comments — and a line outside it is left alone rather than
|
|
29
|
+
* rewritten.
|
|
30
|
+
*/
|
|
31
|
+
const ASSIGNMENT = /^\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=\s*(.*)$/;
|
|
32
|
+
function unquote(raw) {
|
|
33
|
+
const trimmed = raw.trim();
|
|
34
|
+
const quoted = /^(['"])([\s\S]*)\1$/.exec(trimmed);
|
|
35
|
+
return quoted === null ? trimmed : quoted[2];
|
|
36
|
+
}
|
|
37
|
+
function parseLine(line) {
|
|
38
|
+
if (/^\s*(#|$)/.test(line))
|
|
39
|
+
return { key: null, value: line };
|
|
40
|
+
const match = ASSIGNMENT.exec(line);
|
|
41
|
+
if (match === null)
|
|
42
|
+
return { key: null, value: line };
|
|
43
|
+
return { key: match[1], value: unquote(match[2]) };
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Every value the file supplies, in file order.
|
|
47
|
+
*
|
|
48
|
+
* A blank value is **absent** — see the header. A key repeated in one file keeps
|
|
49
|
+
* the last assignment, which is what every reader of a `.env` does.
|
|
50
|
+
*/
|
|
51
|
+
export function parseEnvFile(text) {
|
|
52
|
+
const values = new Map();
|
|
53
|
+
for (const line of text.split('\n')) {
|
|
54
|
+
const parsed = parseLine(line);
|
|
55
|
+
if (parsed.key === null)
|
|
56
|
+
continue;
|
|
57
|
+
if (parsed.value.length === 0) {
|
|
58
|
+
values.delete(parsed.key);
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
values.set(parsed.key, parsed.value);
|
|
62
|
+
}
|
|
63
|
+
return values;
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* A value as it is written back, quoted only where it has to be.
|
|
67
|
+
*
|
|
68
|
+
* A generated secret is base64 and needs no quoting; a URL needs none. What does
|
|
69
|
+
* is a value carrying a space, a quote or a `#`, because an unquoted `#` starts
|
|
70
|
+
* a comment in every dialect above and would truncate the value silently.
|
|
71
|
+
*/
|
|
72
|
+
export function renderEnvValue(value) {
|
|
73
|
+
if (/^[A-Za-z0-9_@%+=:,./-]*$/.test(value))
|
|
74
|
+
return value;
|
|
75
|
+
return `"${value.replace(/(["\\])/g, '\\$1')}"`;
|
|
76
|
+
}
|
|
77
|
+
/** A commented-out assignment — `# DATABASE_URL=` — and the key it names. */
|
|
78
|
+
const COMMENTED_ASSIGNMENT = /^\s*#\s*(?:export\s+)?([A-Za-z_][A-Za-z0-9_]*)\s*=/;
|
|
79
|
+
/**
|
|
80
|
+
* The file's new text: every existing line kept, in place, with the values this
|
|
81
|
+
* run resolved written over the keys they name and appended where they are new.
|
|
82
|
+
*
|
|
83
|
+
* **Kept in place** rather than re-rendered, because the operator may already
|
|
84
|
+
* have put comments, ordering and their own keys in it, and a scaffold that
|
|
85
|
+
* rewrote the file would silently discard all three. That is the same rule
|
|
86
|
+
* `endora new storefront` applies to a directory it will not merge into, one
|
|
87
|
+
* granularity down.
|
|
88
|
+
*
|
|
89
|
+
* ## A commented-out placeholder is filled in, not duplicated
|
|
90
|
+
*
|
|
91
|
+
* `endora new instance` writes its `.env` with every declared input present and
|
|
92
|
+
* **commented out**, because a blank assignment is not the same state as no
|
|
93
|
+
* assignment: Node's `--env-file` sets `MEILISEARCH_URL=` to the empty string,
|
|
94
|
+
* and the platform's `??` fallbacks read that as a value. Measured — the
|
|
95
|
+
* instance acceptance criterion's health route answered 503 over a search
|
|
96
|
+
* engine that was running, because a file listing every optional input as a
|
|
97
|
+
* blank had turned twenty "unset"s into twenty empty strings.
|
|
98
|
+
*
|
|
99
|
+
* So a value written over such a placeholder replaces the commented line rather
|
|
100
|
+
* than being appended below it, which keeps the operator's ordering and the
|
|
101
|
+
* sentence above it and leaves no second assignment of the same key for a
|
|
102
|
+
* reader to wonder about. A key the run has no value for stays commented, and
|
|
103
|
+
* therefore stays genuinely unset.
|
|
104
|
+
*/
|
|
105
|
+
export function writeEnvFile(existingText, values) {
|
|
106
|
+
const remaining = new Map(values);
|
|
107
|
+
const lines = existingText.length === 0 ? [] : existingText.split('\n');
|
|
108
|
+
const rewritten = lines.map((line) => {
|
|
109
|
+
const parsed = parseLine(line);
|
|
110
|
+
if (parsed.key === null) {
|
|
111
|
+
const commented = COMMENTED_ASSIGNMENT.exec(line);
|
|
112
|
+
if (commented === null || !remaining.has(commented[1]))
|
|
113
|
+
return line;
|
|
114
|
+
const key = commented[1];
|
|
115
|
+
const value = remaining.get(key);
|
|
116
|
+
remaining.delete(key);
|
|
117
|
+
return `${key}=${renderEnvValue(value)}`;
|
|
118
|
+
}
|
|
119
|
+
if (!remaining.has(parsed.key))
|
|
120
|
+
return line;
|
|
121
|
+
const value = remaining.get(parsed.key);
|
|
122
|
+
remaining.delete(parsed.key);
|
|
123
|
+
return `${parsed.key}=${renderEnvValue(value)}`;
|
|
124
|
+
});
|
|
125
|
+
// A trailing empty line is the file's own last newline; append before it so
|
|
126
|
+
// the result ends in exactly one.
|
|
127
|
+
while (rewritten.length > 0 && rewritten[rewritten.length - 1].trim().length === 0) {
|
|
128
|
+
rewritten.pop();
|
|
129
|
+
}
|
|
130
|
+
for (const [key, value] of remaining)
|
|
131
|
+
rewritten.push(`${key}=${renderEnvValue(value)}`);
|
|
132
|
+
return `${rewritten.join('\n')}\n`;
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=env-file.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"env-file.js","sourceRoot":"","sources":["../../src/inputs/env-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AAQH,MAAM,UAAU,GAAG,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AK,CAAC,EAAE,CAAC;QAC3C,CAAC;QACD,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAC;YAAE,OAAO,IAAI,CAAC;QAC5C,MAAM,KAAK,GAAG,SAAS,CAAC,GAAG,CAAC,MAAM,CAAC,GAAG,CAAE,CAAC;QACzC,SAAS,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC7B,OAAO,GAAG,MAAM,CAAC,GAAG,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC;IAClD,CAAC,CAAC,CAAC;IACH,4EAA4E;IAC5E,kCAAkC;IAClC,OAAO,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAE,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACpF,SAAS,CAAC,GAAG,EAAE,CAAC;IAClB,CAAC;IACD,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,SAAS;QAAE,SAAS,CAAC,IAAI,CAAC,GAAG,GAAG,IAAI,cAAc,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IACxF,OAAO,GAAG,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC;AACrC,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { EnvironmentInput } from '@endora-commerce/contracts';
|
|
2
|
+
import type { ResolvedInput } from './resolve.js';
|
|
3
|
+
/** Where the questions are asked and answered. Injected, so a test drives it. */
|
|
4
|
+
export interface PromptIo {
|
|
5
|
+
readonly input: NodeJS.ReadableStream;
|
|
6
|
+
readonly output: NodeJS.WritableStream;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Ask for each input, in the declaration's own order.
|
|
10
|
+
*
|
|
11
|
+
* The order is the declaration's rather than an alphabet's: whoever wrote the
|
|
12
|
+
* declaration decided what an operator is asked first, and a comparator here
|
|
13
|
+
* would take that decision away from them and give it to the alphabet.
|
|
14
|
+
*
|
|
15
|
+
* Each question names **what the value configures**, in the operator's terms —
|
|
16
|
+
* the declaration's `describes` sentence, which is exactly the field that exists
|
|
17
|
+
* for this. A prompt reading `SESSION_COOKIE_SECRET:` and nothing else asks a
|
|
18
|
+
* person to answer a question they have not been told.
|
|
19
|
+
*/
|
|
20
|
+
export declare function promptForInputs(inputs: readonly EnvironmentInput[], language: 'en' | 'pl', io: PromptIo): Promise<readonly ResolvedInput[]>;
|
|
21
|
+
//# sourceMappingURL=prompt.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.d.ts","sourceRoot":"","sources":["../../src/inputs/prompt.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAElD,iFAAiF;AACjF,MAAM,WAAW,QAAQ;IACvB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC,cAAc,CAAC;IACtC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,cAAc,CAAC;CACxC;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,SAAS,gBAAgB,EAAE,EACnC,QAAQ,EAAE,IAAI,GAAG,IAAI,EACrB,EAAE,EAAE,QAAQ,GACX,OAAO,CAAC,SAAS,aAAa,EAAE,CAAC,CAoBnC"}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The prompt — tier 3, and the whole of what
|
|
3
|
+
* `cli-product.md` R2.5 gave up when it was amended to R2.5a–e.
|
|
4
|
+
*
|
|
5
|
+
* ## It costs no dependency, and that is half the amendment's argument
|
|
6
|
+
*
|
|
7
|
+
* `node:readline/promises` is Node core, like the `node:util` `parseArgs` this
|
|
8
|
+
* program already reads its own arguments with, so Constitution IV is untouched.
|
|
9
|
+
* R2.5's *"a prompt is a dependency"* is measured false in the package sense and
|
|
10
|
+
* true in the other one — a prompt depends on a human and a terminal — and that
|
|
11
|
+
* half is answered by {@link mayPrompt}'s conjunction rather than by an
|
|
12
|
+
* argument.
|
|
13
|
+
*
|
|
14
|
+
* ## It is a fallback, never a default-generator
|
|
15
|
+
*
|
|
16
|
+
* Every question here is for a **required** input the flag tier and the `.env`
|
|
17
|
+
* tier did not answer. An empty answer is not a value: it re-asks. That is the
|
|
18
|
+
* one place a prompt could quietly become the thing R2.5a forbids — a prompt
|
|
19
|
+
* that accepted `''` would be a tool inventing the empty string, and it would be
|
|
20
|
+
* counted as `prompted=` in the provenance line, which is worse than inventing
|
|
21
|
+
* it in source because it would carry a human's authority.
|
|
22
|
+
*/
|
|
23
|
+
import { createInterface } from 'node:readline/promises';
|
|
24
|
+
/**
|
|
25
|
+
* Ask for each input, in the declaration's own order.
|
|
26
|
+
*
|
|
27
|
+
* The order is the declaration's rather than an alphabet's: whoever wrote the
|
|
28
|
+
* declaration decided what an operator is asked first, and a comparator here
|
|
29
|
+
* would take that decision away from them and give it to the alphabet.
|
|
30
|
+
*
|
|
31
|
+
* Each question names **what the value configures**, in the operator's terms —
|
|
32
|
+
* the declaration's `describes` sentence, which is exactly the field that exists
|
|
33
|
+
* for this. A prompt reading `SESSION_COOKIE_SECRET:` and nothing else asks a
|
|
34
|
+
* person to answer a question they have not been told.
|
|
35
|
+
*/
|
|
36
|
+
export async function promptForInputs(inputs, language, io) {
|
|
37
|
+
if (inputs.length === 0)
|
|
38
|
+
return [];
|
|
39
|
+
const rl = createInterface({ input: io.input, output: io.output });
|
|
40
|
+
try {
|
|
41
|
+
const answers = [];
|
|
42
|
+
for (const input of inputs) {
|
|
43
|
+
io.output.write(`\n${input.describes[language]}\n`);
|
|
44
|
+
let value = '';
|
|
45
|
+
while (value.length === 0) {
|
|
46
|
+
// An empty answer re-asks rather than resolving to `''`. See the header:
|
|
47
|
+
// accepting it would be the tool inventing a value and reporting it as
|
|
48
|
+
// one a human supplied.
|
|
49
|
+
value = (await rl.question(`${input.name}: `)).trim();
|
|
50
|
+
}
|
|
51
|
+
answers.push({ name: input.name, value, provenance: 'prompt' });
|
|
52
|
+
}
|
|
53
|
+
return answers;
|
|
54
|
+
}
|
|
55
|
+
finally {
|
|
56
|
+
rl.close();
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
//# sourceMappingURL=prompt.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompt.js","sourceRoot":"","sources":["../../src/inputs/prompt.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAYzD;;;;;;;;;;;GAWG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAmC,EACnC,QAAqB,EACrB,EAAY;IAEZ,IAAI,MAAM,CAAC,MAAM,KAAK,CAAC;QAAE,OAAO,EAAE,CAAC;IACnC,MAAM,EAAE,GAAG,eAAe,CAAC,EAAE,KAAK,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,CAAC,CAAC;IACnE,IAAI,CAAC;QACH,MAAM,OAAO,GAAoB,EAAE,CAAC;QACpC,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;YACpD,IAAI,KAAK,GAAG,EAAE,CAAC;YACf,OAAO,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC1B,yEAAyE;gBACzE,uEAAuE;gBACvE,wBAAwB;gBACxB,KAAK,GAAG,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,GAAG,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;YACxD,CAAC;YACD,OAAO,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,KAAK,EAAE,UAAU,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClE,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;YAAS,CAAC;QACT,EAAE,CAAC,KAAK,EAAE,CAAC;IACb,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import { type EnvironmentConsumer, type EnvironmentInput } from '@endora-commerce/contracts';
|
|
2
|
+
/** Where a value came from. Four tiers, closed, and there is no fifth. */
|
|
3
|
+
export type Provenance = 'flag' | 'env-file' | 'prompt' | 'generated';
|
|
4
|
+
export interface ResolvedInput {
|
|
5
|
+
readonly name: string;
|
|
6
|
+
readonly value: string;
|
|
7
|
+
readonly provenance: Provenance;
|
|
8
|
+
}
|
|
9
|
+
/** An input the run needs and could not resolve, with the flag that supplies it. */
|
|
10
|
+
export interface MissingInput {
|
|
11
|
+
readonly name: string;
|
|
12
|
+
/** `--<kebab-cased name>`, so a refusal names the remedy and not only the gap. */
|
|
13
|
+
readonly flag: string;
|
|
14
|
+
/** The declaration's own sentence, in the language this run reports in. */
|
|
15
|
+
readonly describes: string;
|
|
16
|
+
readonly secret: boolean;
|
|
17
|
+
}
|
|
18
|
+
/** The counts the provenance line prints. */
|
|
19
|
+
export interface ProvenanceCounts {
|
|
20
|
+
readonly total: number;
|
|
21
|
+
readonly flags: number;
|
|
22
|
+
readonly envFile: number;
|
|
23
|
+
readonly prompted: number;
|
|
24
|
+
readonly generated: number;
|
|
25
|
+
/** The residue. Contract-bound to `0` — see the header for why by subtraction. */
|
|
26
|
+
readonly defaulted: number;
|
|
27
|
+
}
|
|
28
|
+
/** What the process can prove about its own invocation (R3.1). */
|
|
29
|
+
export interface InteractivityFacts {
|
|
30
|
+
readonly stdinIsTty: boolean;
|
|
31
|
+
readonly stdoutIsTty: boolean;
|
|
32
|
+
readonly nonInteractive: boolean;
|
|
33
|
+
readonly dryRun: boolean;
|
|
34
|
+
readonly environment: Readonly<Record<string, string | undefined>>;
|
|
35
|
+
}
|
|
36
|
+
/** Is a CI marker set to something meaning yes? */
|
|
37
|
+
export declare function ciMarkerSet(environment: Readonly<Record<string, string | undefined>>): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* May this run issue a prompt? (R3.1 — a conjunction of five.)
|
|
40
|
+
*
|
|
41
|
+
* **Checking stdin alone is insufficient and R3.5 forbids it**: a run whose
|
|
42
|
+
* stdout is captured and whose stdin is inherited would prompt into a log nobody
|
|
43
|
+
* reads, which is the same hang wearing different clothes.
|
|
44
|
+
*
|
|
45
|
+
* There is deliberately no `--interactive` (R3.4). A flag that turns the
|
|
46
|
+
* assistance on is a flag the person who needs it does not know about.
|
|
47
|
+
*/
|
|
48
|
+
export declare function mayPrompt(facts: InteractivityFacts): boolean;
|
|
49
|
+
/** The facts, read off this process. The only place the resolution touches globals. */
|
|
50
|
+
export declare function interactivityOf(options: {
|
|
51
|
+
readonly nonInteractive: boolean;
|
|
52
|
+
readonly dryRun: boolean;
|
|
53
|
+
}): InteractivityFacts;
|
|
54
|
+
/**
|
|
55
|
+
* The flag that supplies an input, derived from its name and never written down.
|
|
56
|
+
*
|
|
57
|
+
* `SESSION_COOKIE_SECRET` → `--session-cookie-secret`. Deriving it is what keeps
|
|
58
|
+
* the refusal's remedy true for an input nobody has declared yet — including one
|
|
59
|
+
* a module installed from a registry declares, which no table here could name.
|
|
60
|
+
*/
|
|
61
|
+
export declare function flagFor(name: string): string;
|
|
62
|
+
/** The variable a flag names, inverted from {@link flagFor}. */
|
|
63
|
+
export declare function inputForFlag(flag: string): string;
|
|
64
|
+
/**
|
|
65
|
+
* A value whose only required properties are that it is unguessable and
|
|
66
|
+
* per-environment (R4.1).
|
|
67
|
+
*
|
|
68
|
+
* **32 random bytes, base64**, one format for every generable input, and the
|
|
69
|
+
* format is not arbitrary: the platform's own secret settings are decrypted with
|
|
70
|
+
* `Buffer.from(key, 'base64')` over a 32-byte AES key, so a hex key would fail
|
|
71
|
+
* at the first secret setting an operator wrote. The same string is a perfectly
|
|
72
|
+
* good cookie-signing key, which is why one format serves both and no `format`
|
|
73
|
+
* field exists to get wrong.
|
|
74
|
+
*
|
|
75
|
+
* **Never at boot** (R4.4). That is a rule about the platform rather than about
|
|
76
|
+
* this function, and it is why generation lives in a command an operator ran
|
|
77
|
+
* once: a signing key that changed on restart would invalidate every session,
|
|
78
|
+
* and a settings-encryption key that did would make every stored secret
|
|
79
|
+
* unreadable. Both are worse than a refusal.
|
|
80
|
+
*/
|
|
81
|
+
export declare function generateSecret(): string;
|
|
82
|
+
/**
|
|
83
|
+
* The counts, over a record loose enough for a proof to break.
|
|
84
|
+
*
|
|
85
|
+
* The parameter is `{ provenance: string }` rather than {@link ResolvedInput} on
|
|
86
|
+
* purpose: `defaulted` is a residue and a residue can only be *shown* to work by
|
|
87
|
+
* handing in something outside the partition. With the parameter narrowed, the
|
|
88
|
+
* one assertion that proves the guarantee would not compile.
|
|
89
|
+
*/
|
|
90
|
+
export declare function provenanceCounts(resolved: readonly {
|
|
91
|
+
readonly provenance: string;
|
|
92
|
+
}[]): ProvenanceCounts;
|
|
93
|
+
/** The line itself (R2.1), in the estate's `read:` grammar. */
|
|
94
|
+
export declare function provenanceLine(resolved: readonly {
|
|
95
|
+
readonly provenance: string;
|
|
96
|
+
readonly name: string;
|
|
97
|
+
}[]): string;
|
|
98
|
+
/** Everything a resolution run needs, with no global read inside it. */
|
|
99
|
+
export interface ResolutionRequest {
|
|
100
|
+
/** The whole declaration of the tree being written. */
|
|
101
|
+
readonly declared: readonly EnvironmentInput[];
|
|
102
|
+
/**
|
|
103
|
+
* The members this run actually writes.
|
|
104
|
+
*
|
|
105
|
+
* `specs/118-instance-member-selection/`: an input read by no written member
|
|
106
|
+
* is **out of the population** — not resolved, not prompted for, not counted,
|
|
107
|
+
* not refused. Reading it the other way would force a fifth provenance
|
|
108
|
+
* outcome, because such an input can be neither defaulted (there is nothing to
|
|
109
|
+
* invent) nor honestly reported as resolved.
|
|
110
|
+
*/
|
|
111
|
+
readonly members: readonly EnvironmentConsumer[];
|
|
112
|
+
/** Values given as explicit flags — tier 1. */
|
|
113
|
+
readonly flags: Readonly<Record<string, string | undefined>>;
|
|
114
|
+
/** Values the target directory's own `.env` already supplies — tier 2. */
|
|
115
|
+
readonly envFile: ReadonlyMap<string, string>;
|
|
116
|
+
readonly interactivity: InteractivityFacts;
|
|
117
|
+
/** Which language the reported sentences are in. */
|
|
118
|
+
readonly language: 'en' | 'pl';
|
|
119
|
+
}
|
|
120
|
+
/** What a resolution decided, before anything is asked or written. */
|
|
121
|
+
export interface ResolutionPlan {
|
|
122
|
+
/** Values already in hand, in declaration order. */
|
|
123
|
+
readonly resolved: readonly ResolvedInput[];
|
|
124
|
+
/**
|
|
125
|
+
* Required, unanswered, and this run will ask — or, under `--dry-run`, would
|
|
126
|
+
* have (R2.4).
|
|
127
|
+
*
|
|
128
|
+
* One list for both, because they are one answer to one question: *which
|
|
129
|
+
* inputs is nobody supplying?* A dry run reports it, a real run acts on it,
|
|
130
|
+
* and splitting them would let the two drift into disagreeing about the very
|
|
131
|
+
* thing a dry run exists to preview.
|
|
132
|
+
*/
|
|
133
|
+
readonly toPrompt: readonly EnvironmentInput[];
|
|
134
|
+
/** Secret, generable, unanswered — a value this run may supply (R4.1). */
|
|
135
|
+
readonly toGenerate: readonly EnvironmentInput[];
|
|
136
|
+
/** Required, unanswered, and this run may not ask: the refusal (R3.2). */
|
|
137
|
+
readonly missing: readonly MissingInput[];
|
|
138
|
+
/** Declared, in scope, and legitimately left unset — an optional nobody set. */
|
|
139
|
+
readonly unset: readonly EnvironmentInput[];
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* The first two tiers, and the decision about the other two.
|
|
143
|
+
*
|
|
144
|
+
* Pure: it asks nothing, generates nothing and writes nothing, so a caller can
|
|
145
|
+
* print the whole plan under `--dry-run` (R2.4, R7.3) and a test can assert
|
|
146
|
+
* every branch without a terminal.
|
|
147
|
+
*
|
|
148
|
+
* **A condition is answered against the values this run has resolved**, not
|
|
149
|
+
* against `process.env`, which is the case that happens: a run supplying
|
|
150
|
+
* `--catalog-search-backend meilisearch` on its command line has to be asked for
|
|
151
|
+
* `MEILISEARCH_URL` in the same run rather than in the next one.
|
|
152
|
+
*/
|
|
153
|
+
export declare function planResolution(request: ResolutionRequest): ResolutionPlan;
|
|
154
|
+
/**
|
|
155
|
+
* The refusal a run that may not ask prints, naming **every** missing input
|
|
156
|
+
* (R3.2).
|
|
157
|
+
*
|
|
158
|
+
* Not one per run: a twelve-input setup must not be twelve failed invocations,
|
|
159
|
+
* and that is a design point rather than a nicety — it is precisely the
|
|
160
|
+
* experience the owner asked to have removed.
|
|
161
|
+
*/
|
|
162
|
+
export declare function missingInputsRefusal(missing: readonly MissingInput[], facts: InteractivityFacts): string;
|
|
163
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/inputs/resolve.ts"],"names":[],"mappings":"AAwDA,OAAO,EAGL,KAAK,mBAAmB,EACxB,KAAK,gBAAgB,EACtB,MAAM,4BAA4B,CAAC;AAEpC,0EAA0E;AAC1E,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,GAAG,WAAW,CAAC;AAEtE,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACjC;AAED,oFAAoF;AACpF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,kFAAkF;IAClF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,2EAA2E;IAC3E,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B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