@artblocks/abx-cli 0.1.0-alpha.7 → 0.1.0-alpha.70
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/CHANGELOG.md +298 -0
- package/assets/renderer-scaffold/README.md +44 -13
- package/assets/renderer-scaffold/foundry.toml +5 -0
- package/assets/renderer-scaffold/remappings.txt +1 -1
- package/assets/renderer-scaffold/script/DeployHooks.s.sol +24 -0
- package/assets/renderer-scaffold/script/Preview.s.sol +99 -0
- package/assets/renderer-scaffold/src/MyHooks.sol +20 -0
- package/assets/renderer-scaffold/src/MyRenderer.sol +4 -4
- package/assets/renderer-scaffold/src/MyTraits.sol +2 -2
- package/assets/renderer-scaffold/test/MyRenderer.t.sol +60 -3
- package/dist/bin.d.ts +26 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +63 -0
- package/dist/bin.js.map +1 -0
- package/dist/capabilities.d.ts +132 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +175 -0
- package/dist/capabilities.js.map +1 -0
- package/dist/commands/auth.d.ts +54 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +483 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/contract.d.ts +19 -0
- package/dist/commands/contract.d.ts.map +1 -0
- package/dist/commands/contract.js +171 -0
- package/dist/commands/contract.js.map +1 -0
- package/dist/commands/deploy.d.ts +296 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +5736 -0
- package/dist/commands/deploy.js.map +1 -0
- package/dist/commands/feedback.d.ts +7 -0
- package/dist/commands/feedback.d.ts.map +1 -0
- package/dist/commands/feedback.js +154 -0
- package/dist/commands/feedback.js.map +1 -0
- package/dist/commands/maintenance.d.ts +4 -0
- package/dist/commands/maintenance.d.ts.map +1 -0
- package/dist/commands/maintenance.js +114 -0
- package/dist/commands/maintenance.js.map +1 -0
- package/dist/commands/project.d.ts +458 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +1837 -0
- package/dist/commands/project.js.map +1 -0
- package/dist/commands/reads.d.ts +85 -0
- package/dist/commands/reads.d.ts.map +1 -0
- package/dist/commands/reads.js +881 -0
- package/dist/commands/reads.js.map +1 -0
- package/dist/commands/scaffold.d.ts +89 -0
- package/dist/commands/scaffold.d.ts.map +1 -0
- package/dist/commands/scaffold.js +741 -0
- package/dist/commands/scaffold.js.map +1 -0
- package/dist/commands/service.d.ts +67 -0
- package/dist/commands/service.d.ts.map +1 -0
- package/dist/commands/service.js +761 -0
- package/dist/commands/service.js.map +1 -0
- package/dist/commands/storage.d.ts +51 -0
- package/dist/commands/storage.d.ts.map +1 -0
- package/dist/commands/storage.js +399 -0
- package/dist/commands/storage.js.map +1 -0
- package/dist/commands/submit-app.d.ts +102 -0
- package/dist/commands/submit-app.d.ts.map +1 -0
- package/dist/commands/submit-app.js +638 -0
- package/dist/commands/submit-app.js.map +1 -0
- package/dist/config.d.ts +94 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +332 -12
- package/dist/config.js.map +1 -1
- package/dist/conformance.d.ts +31 -0
- package/dist/conformance.d.ts.map +1 -0
- package/dist/conformance.js +400 -0
- package/dist/conformance.js.map +1 -0
- package/dist/contract-read-error.d.ts +5 -0
- package/dist/contract-read-error.d.ts.map +1 -0
- package/dist/contract-read-error.js +37 -0
- package/dist/contract-read-error.js.map +1 -0
- package/dist/creator-agent.d.ts +40 -0
- package/dist/creator-agent.d.ts.map +1 -0
- package/dist/creator-agent.js +206 -0
- package/dist/creator-agent.js.map +1 -0
- package/dist/creator-signer.d.ts +52 -0
- package/dist/creator-signer.d.ts.map +1 -0
- package/dist/creator-signer.js +225 -0
- package/dist/creator-signer.js.map +1 -0
- package/dist/deploy-plan.d.ts +218 -0
- package/dist/deploy-plan.d.ts.map +1 -0
- package/dist/deploy-plan.js +20 -0
- package/dist/deploy-plan.js.map +1 -0
- package/dist/deps.d.ts +6 -39
- package/dist/deps.d.ts.map +1 -1
- package/dist/deps.js +4 -68
- package/dist/deps.js.map +1 -1
- package/dist/errors.d.ts +22 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +32 -0
- package/dist/errors.js.map +1 -0
- package/dist/flag-allowlists.d.ts +53 -0
- package/dist/flag-allowlists.d.ts.map +1 -0
- package/dist/flag-allowlists.js +188 -0
- package/dist/flag-allowlists.js.map +1 -0
- package/dist/flags.d.ts +53 -0
- package/dist/flags.d.ts.map +1 -1
- package/dist/flags.js +151 -1
- package/dist/flags.js.map +1 -1
- package/dist/jsonout.d.ts +37 -0
- package/dist/jsonout.d.ts.map +1 -0
- package/dist/jsonout.js +79 -0
- package/dist/jsonout.js.map +1 -0
- package/dist/kind.d.ts +57 -0
- package/dist/kind.d.ts.map +1 -0
- package/dist/kind.js +122 -0
- package/dist/kind.js.map +1 -0
- package/dist/main.js +875 -5214
- package/dist/main.js.map +1 -1
- package/dist/mintpage.d.ts +17 -2
- package/dist/mintpage.d.ts.map +1 -1
- package/dist/mintpage.js +241 -54
- package/dist/mintpage.js.map +1 -1
- package/dist/output.d.ts +184 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +774 -0
- package/dist/output.js.map +1 -0
- package/dist/ownerops.d.ts +450 -57
- package/dist/ownerops.d.ts.map +1 -1
- package/dist/ownerops.js +2232 -379
- package/dist/ownerops.js.map +1 -1
- package/dist/preview.d.ts +23 -5
- package/dist/preview.d.ts.map +1 -1
- package/dist/preview.js +95 -43
- package/dist/preview.js.map +1 -1
- package/dist/provision.d.ts +3 -13
- package/dist/provision.d.ts.map +1 -1
- package/dist/provision.js +19 -21
- package/dist/provision.js.map +1 -1
- package/dist/remote.d.ts +169 -52
- package/dist/remote.d.ts.map +1 -1
- package/dist/remote.js +488 -46
- package/dist/remote.js.map +1 -1
- package/dist/riskgate.d.ts +101 -0
- package/dist/riskgate.d.ts.map +1 -0
- package/dist/riskgate.js +343 -0
- package/dist/riskgate.js.map +1 -0
- package/dist/scaffold.d.ts +12 -0
- package/dist/scaffold.d.ts.map +1 -0
- package/dist/scaffold.js +56 -0
- package/dist/scaffold.js.map +1 -0
- package/dist/schema.d.ts +36 -1
- package/dist/schema.d.ts.map +1 -1
- package/dist/schema.js +121 -26
- package/dist/schema.js.map +1 -1
- package/dist/script-chunks.d.ts +8 -0
- package/dist/script-chunks.d.ts.map +1 -0
- package/dist/script-chunks.js +35 -0
- package/dist/script-chunks.js.map +1 -0
- package/dist/served.d.ts +30 -0
- package/dist/served.d.ts.map +1 -0
- package/dist/served.js +112 -0
- package/dist/served.js.map +1 -0
- package/dist/signer.d.ts +20 -1
- package/dist/signer.d.ts.map +1 -1
- package/dist/signer.js +110 -18
- package/dist/signer.js.map +1 -1
- package/dist/update-check.d.ts +55 -1
- package/dist/update-check.d.ts.map +1 -1
- package/dist/update-check.js +99 -9
- package/dist/update-check.js.map +1 -1
- package/package.json +16 -12
- package/skill/SKILL.md +211 -349
- package/skill/agents/openai.yaml +4 -0
- package/skill/reference/capabilities.md +195 -0
- package/skill/reference/code.md +236 -0
- package/skill/reference/creator-token.md +94 -0
- package/skill/reference/deploy.md +177 -0
- package/skill/reference/diagnose.md +178 -0
- package/skill/reference/hosting.md +192 -92
- package/skill/reference/operate.md +237 -0
- package/skill/reference/services.md +167 -0
- package/skill/reference/setup.md +219 -36
- package/assets/renderer-scaffold/src/interfaces/IAbxFieldRenderer.sol +0 -32
- package/assets/renderer-scaffold/src/interfaces/IAbxParams.sol +0 -26
- package/dist/inspect.d.ts +0 -48
- package/dist/inspect.d.ts.map +0 -1
- package/dist/inspect.js +0 -184
- package/dist/inspect.js.map +0 -1
- package/dist/migrate.d.ts +0 -65
- package/dist/migrate.d.ts.map +0 -1
- package/dist/migrate.js +0 -180
- package/dist/migrate.js.map +0 -1
- package/dist/onchain-uri.d.ts +0 -97
- package/dist/onchain-uri.d.ts.map +0 -1
- package/dist/onchain-uri.js +0 -243
- package/dist/onchain-uri.js.map +0 -1
- package/dist/upload.d.ts +0 -28
- package/dist/upload.d.ts.map +0 -1
- package/dist/upload.js +0 -41
- package/dist/upload.js.map +0 -1
- package/skill/reference/code-projects.md +0 -246
- package/skill/reference/operating.md +0 -116
- package/skill/reference/troubleshooting.md +0 -28
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The structured `--dry-run --json` / `--json` deploy plan.
|
|
3
|
+
*
|
|
4
|
+
* The JSON payload and human prose are rendered from the same values but remain separate surfaces.
|
|
5
|
+
* Deploy is a high-stakes command family (real gas, address pinning, salt reservation), its exact
|
|
6
|
+
* dry-run prose is covered extensively, and the end-user skill depends on that prose. This module
|
|
7
|
+
* therefore provides a versioned, typed object populated from the SAME locals `commands/deploy.ts`
|
|
8
|
+
* uses for human narration at every `emit(jsonSafe({...}))` call site.
|
|
9
|
+
*
|
|
10
|
+
* A field a lane genuinely has no answer for is explicit `null`, never silently absent — that
|
|
11
|
+
* distinction (present-but-empty vs. not-applicable-here) is the whole point of a schema. See each
|
|
12
|
+
* `deploy.ts` call site for the specific reasoning behind its nulls.
|
|
13
|
+
*/
|
|
14
|
+
import type { Address } from '@artblocks/abx-sdk';
|
|
15
|
+
/** Bump whenever a field is added, renamed, or reinterpreted — a consumer keys behavior off this,
|
|
16
|
+
* not off the CLI's own package version (that changes for reasons unrelated to this shape).
|
|
17
|
+
*
|
|
18
|
+
* `as const` is load-bearing, not decoration: a plain `= 1` is a WIDENING literal, so the moment it
|
|
19
|
+
* is read into an un-annotated intermediate object (the resume lane builds one and spreads it into
|
|
20
|
+
* several emits) the property degrades to `number` and stops satisfying `DeployPlan`. Keep it.
|
|
21
|
+
*
|
|
22
|
+
* v2 (this change): added `custody.renderer` and `custody.image`; reinterpreted `transactions.legs`
|
|
23
|
+
* to end with `'deploy'` whenever it is non-null (previously silent about the deploy tx itself —
|
|
24
|
+
* see each field's own doc comment). A consumer keying behavior off `legs`' shape needs to know
|
|
25
|
+
* which version it's reading. */
|
|
26
|
+
export declare const DEPLOY_PLAN_SCHEMA_VERSION: 2;
|
|
27
|
+
/** The six product lanes `deploy.ts` implements — a stable discriminator independent of the legacy
|
|
28
|
+
* `command`/`kind` fields already on the payload (which exist for backward compat and don't fully
|
|
29
|
+
* agree with each other across lanes: `kind: 'edition-code'` vs. this union's `'code-edition'`). */
|
|
30
|
+
export type DeployPlanFamily = '1of1' | '1of1-edition' | 'series' | 'series-edition' | 'code' | 'code-edition';
|
|
31
|
+
/** The signing lanes `laneFromFlags` resolves to, reused verbatim. */
|
|
32
|
+
export type DeployPlanLane = 'send' | 'sign' | 'sponsor' | 'unsigned';
|
|
33
|
+
export interface DeployPlanTransactions {
|
|
34
|
+
/** Wallet TX SIGNATURES this run needs — the exact same count the lane's own dry-run/confirm
|
|
35
|
+
* "approvals" line reports (an off-chain storage upload is a separate signature class, never
|
|
36
|
+
* counted here — see the `approvals` local at each call site). */
|
|
37
|
+
approvals: number;
|
|
38
|
+
/**
|
|
39
|
+
* The ordered, NAMED stages this run signs, ending with `'deploy'` itself — e.g.
|
|
40
|
+
* `['onchain-image-staging', 'deploy']` for an image lane staging bytes into the chunk store first,
|
|
41
|
+
* or `['chunks', 'param-schemas', 'dependencies', 'onchain-uri', 'mints', 'deploy']` for a code
|
|
42
|
+
* project whose setup rides one or more gas-bounded transactions ahead of the deploy tx. `null`
|
|
43
|
+
* when the deploy is a single, self-contained transaction with no named stage worth calling out.
|
|
44
|
+
*
|
|
45
|
+
* A stage name is a GROUP, not a 1:1 tx count: `'chunks'`/`'onchain-image-staging'` can be one
|
|
46
|
+
* atomic write or SEVERAL gas-bounded batch transactions (a 60KB+ script's setup, in particular —
|
|
47
|
+
* see `commands/deploy.ts`'s `planCodeSetupBatches`), and `approvals` is what reports the real
|
|
48
|
+
* total signature count — `legs.length` never needs to equal `approvals`. The one invariant this
|
|
49
|
+
* schema DOES hold: `legs === null` iff `approvals` is exactly the trivial case for that lane (1 for
|
|
50
|
+
* a fresh deploy with nothing riding ahead of it; the resume lane's own fixed count when everything
|
|
51
|
+
* is already done) — i.e. non-null legs always means "something happens beyond the bare minimum."
|
|
52
|
+
*
|
|
53
|
+
* EXCEPTION: the `--resume` lane never deploys (the contract already exists), so its legs name only
|
|
54
|
+
* the groups riding the setup transaction(s) it sends (one or more, gas-bounded, same as a fresh
|
|
55
|
+
* deploy) and never include `'deploy'` — see the `resumeLegs` call sites in `commands/deploy.ts` for
|
|
56
|
+
* why that lane's unit model differs.
|
|
57
|
+
*/
|
|
58
|
+
legs: string[] | null;
|
|
59
|
+
}
|
|
60
|
+
export interface DeployPlanRoles {
|
|
61
|
+
/** The address that signs this deploy. `null` only when genuinely unknown yet (a dry run with no
|
|
62
|
+
* `--for` and no resolvable wallet key — the plan is still previewable; just not addressed to
|
|
63
|
+
* anyone in particular). */
|
|
64
|
+
signer: string | null;
|
|
65
|
+
/** Always equal to `signer` in this codebase — every lane sets `owner: deployer` — carried as its
|
|
66
|
+
* own field because a consumer reasoning about roles shouldn't have to know that fact. */
|
|
67
|
+
owner: string | null;
|
|
68
|
+
royaltyReceiver: string | null;
|
|
69
|
+
/** `null` when no `--primary-payee` was given (sale proceeds go to the owner) — the lanes with no
|
|
70
|
+
* concept of a delegated payee at all (the plain 1/1) also report `null` here. */
|
|
71
|
+
primaryPayee: string | null;
|
|
72
|
+
/** `null` when no `--minter` was given (only the owner can mint) — same "no concept" case as
|
|
73
|
+
* `primaryPayee` on the plain 1/1 lane. */
|
|
74
|
+
minter: string | null;
|
|
75
|
+
}
|
|
76
|
+
export interface DeployPlanRoyalty {
|
|
77
|
+
bps: number;
|
|
78
|
+
capBps: number;
|
|
79
|
+
burnable: boolean;
|
|
80
|
+
}
|
|
81
|
+
export interface DeployPlanCustody {
|
|
82
|
+
/** Does `tokenURI`/`contractURI` (or `uri`/`contractURI` on an edition) resolve on-chain via the
|
|
83
|
+
* canonical renderer, vs. through a resolver base baked on-chain. */
|
|
84
|
+
onChainUri: boolean;
|
|
85
|
+
/** Are the IMAGE bytes themselves on-chain (a chunk-store `reader` field) — distinct from
|
|
86
|
+
* `onChainUri`, which only says the metadata JSON resolves on-chain (see deploy.ts's own
|
|
87
|
+
* "puts the metadata JSON on-chain, not the image" warning). `null` on the code lanes, where an
|
|
88
|
+
* image is one of several independently-disposed surfaces — see `surfaces.thumbnail` instead. */
|
|
89
|
+
imageOnChain: boolean | null;
|
|
90
|
+
/** The off-chain storage backend holding bytes this deploy custodies (e.g. `ipfs`, `arweave`,
|
|
91
|
+
* `fs`) — `null` when nothing is stored off-chain (fully on-chain content, or a code project
|
|
92
|
+
* whose script chunks are on-chain and carries no directory build). */
|
|
93
|
+
backend: string | null;
|
|
94
|
+
/** The on-chain `tokenURIBase`/`contractURIBase` this deploy writes — `null`, not `''`, when the
|
|
95
|
+
* lane deliberately leaves it empty because the on-chain renderer is authoritative (baking a
|
|
96
|
+
* base anyway would be misleading: nothing ever reads it while a renderer is set). */
|
|
97
|
+
tokenUriBase: string | null;
|
|
98
|
+
contractUriBase: string | null;
|
|
99
|
+
/** The on-chain renderer address serving `tokenURI`/`contractURI` — the SAME address the "On-chain
|
|
100
|
+
* renderer" step already prints (`would use renderer 0x…` on a dry run, `using renderer 0x…` on a
|
|
101
|
+
* real send). The zero address there means "would deploy the canonical renderer fresh," never
|
|
102
|
+
* "no renderer" — a consumer reading this field needs the same caveat the prose carries. `null`
|
|
103
|
+
* when `onChainUri` is false: off-chain custody has no renderer question to answer. On a
|
|
104
|
+
* `--resume` emit this is always `null` too — the renderer is an InitParams field fixed at the
|
|
105
|
+
* ORIGINAL deploy (like `royalty`/`mint`, see their own doc comments), and a resume doesn't
|
|
106
|
+
* re-read or re-decide it here. */
|
|
107
|
+
renderer: Address | null;
|
|
108
|
+
/** File-level facts about the `--onchain-image` bytes THIS deploy stages, read locally (no chain
|
|
109
|
+
* call) from the exact path `--image` names — `null` unless `imageOnChain` is `true` on a lane
|
|
110
|
+
* that stages a SINGLE file (the 1/1 and 1/1-edition lanes). `null` on `series`/`series-edition`
|
|
111
|
+
* too even when `imageOnChain` is `true` there: those lanes stage ONE FILE PER TOKEN, so no
|
|
112
|
+
* single-file shape fits — the per-token detail is prose-only today (see the `previewImageStaging`
|
|
113
|
+
* loop in `commands/deploy.ts`). */
|
|
114
|
+
image: DeployPlanImageFile | null;
|
|
115
|
+
}
|
|
116
|
+
export interface DeployPlanImageFile {
|
|
117
|
+
/** Raw size of the file on disk, in bytes — the same number the "Stage on-chain image" step's
|
|
118
|
+
* `NNNB → …` line already prints. */
|
|
119
|
+
bytes: number;
|
|
120
|
+
/** Size after the staging plan's chunking/compression (`--compress fastlz` shrinks per chunk;
|
|
121
|
+
* `gzip` shrinks the whole file; `none` leaves it unchanged) — the same number that line's
|
|
122
|
+
* `[fastlz NNN→MMMB]` bracket already prints. */
|
|
123
|
+
stagedBytes: number;
|
|
124
|
+
/** MIME type sniffed from the file's extension (the same `contentTypeFromPath` helper every other
|
|
125
|
+
* content-type-aware line in this file uses) — not itself printed by the staging preview line,
|
|
126
|
+
* but a deterministic fact about the exact file already opened for that preview, computed locally
|
|
127
|
+
* with no chain read, so reporting it costs nothing and fabricates nothing. */
|
|
128
|
+
mimeType: string;
|
|
129
|
+
/** keccak256 of the RAW (pre-compression) file bytes. This is NOT an on-chain commitment — a
|
|
130
|
+
* reader-backed on-chain image has none; the bytes themselves ARE the on-chain content, so there
|
|
131
|
+
* is nothing to commit to separately. It is a content-addressing fact about the LOCAL file,
|
|
132
|
+
* computed the same way (no chain read) for a `--json` consumer that wants to verify provenance
|
|
133
|
+
* later against what actually got staged. */
|
|
134
|
+
contentHash: string;
|
|
135
|
+
}
|
|
136
|
+
export interface DeployPlanMint {
|
|
137
|
+
/** True when nothing mints at deploy (mint later, or via a delegated minter/sale). */
|
|
138
|
+
deferred: boolean;
|
|
139
|
+
/** How many distinct tokens/ids mint at deploy — `0` when deferred. */
|
|
140
|
+
count: number;
|
|
141
|
+
/** Copies PER id (edition lanes only) — `null` on a unique-token lane, where the concept doesn't
|
|
142
|
+
* exist (every id is exactly one copy by construction). A bigint, stringified (see jsonSafe). */
|
|
143
|
+
amountPerId: string | null;
|
|
144
|
+
recipient: string | null;
|
|
145
|
+
}
|
|
146
|
+
export interface DeployPlanEstimate {
|
|
147
|
+
/**
|
|
148
|
+
* A rough, hedged order-of-magnitude ETH/gas figure for THIS deploy's on-chain write cost.
|
|
149
|
+
*
|
|
150
|
+
* `null` is not "not implemented yet" here — it is the honest answer on every lane that genuinely
|
|
151
|
+
* computes no such number today, including the image lanes' `--onchain-image` staging (1/1,
|
|
152
|
+
* 1/1-edition, series, series-edition all skip this: verified directly — none of them prices gas or
|
|
153
|
+
* prints an "est. on-chain cost" line anywhere on the dry-run path). The ONE lane that does compute
|
|
154
|
+
* and print one is the fresh `code` family's on-chain-byte-storage guidance (a best-effort
|
|
155
|
+
* `~200 gas/byte` heuristic priced at the live gas price, wrapped in a try/catch that skips silently
|
|
156
|
+
* if the RPC can't price gas) — see the `planEstimate` local in `commands/deploy.ts`.
|
|
157
|
+
*
|
|
158
|
+
* This field NEVER re-derives or newly computes a number for the plan — it only carries over the
|
|
159
|
+
* exact estimate the human readout already printed. Do not extend this to a lane that doesn't
|
|
160
|
+
* already print one without saying so explicitly wherever that change is made: an estimate implies
|
|
161
|
+
* an RPC gas-price read, which is a new class of work for a dry run that today makes none.
|
|
162
|
+
*/
|
|
163
|
+
ethApprox: string | null;
|
|
164
|
+
gasApprox: string | null;
|
|
165
|
+
}
|
|
166
|
+
export interface DeployPlanSurface {
|
|
167
|
+
ok: boolean;
|
|
168
|
+
detail: string;
|
|
169
|
+
}
|
|
170
|
+
/** The code lane's "every marketplace-facing dimension, resolved now" block — `null` on every other
|
|
171
|
+
* lane (an image lane's thumbnail is fully covered by `custody`; it has no separate traits/postParam
|
|
172
|
+
* disposition to report). */
|
|
173
|
+
export interface DeployPlanSurfaces {
|
|
174
|
+
thumbnail: DeployPlanSurface;
|
|
175
|
+
traits: DeployPlanSurface;
|
|
176
|
+
postParams: DeployPlanSurface;
|
|
177
|
+
}
|
|
178
|
+
/** `null` on the image lanes, which have no dependency-registry concept. */
|
|
179
|
+
export interface DeployPlanDependencies {
|
|
180
|
+
count: number;
|
|
181
|
+
registry: string | null;
|
|
182
|
+
}
|
|
183
|
+
/** Present only on a `deploy-code --resume` emit — `null` on a fresh deploy. */
|
|
184
|
+
export interface DeployPlanResume {
|
|
185
|
+
target: string;
|
|
186
|
+
sentLegs: number;
|
|
187
|
+
complete: boolean;
|
|
188
|
+
}
|
|
189
|
+
export interface DeployPlan {
|
|
190
|
+
schemaVersion: typeof DEPLOY_PLAN_SCHEMA_VERSION;
|
|
191
|
+
family: DeployPlanFamily;
|
|
192
|
+
lane: DeployPlanLane;
|
|
193
|
+
transactions: DeployPlanTransactions;
|
|
194
|
+
roles: DeployPlanRoles;
|
|
195
|
+
/** `null` on a `--resume` emit: royalty is an InitParams field fixed at the ORIGINAL deploy, and a
|
|
196
|
+
* resume never touches it — reporting the flags passed to `--resume` here would misleadingly
|
|
197
|
+
* imply this run writes them. */
|
|
198
|
+
royalty: DeployPlanRoyalty | null;
|
|
199
|
+
custody: DeployPlanCustody;
|
|
200
|
+
/** `null` on a `--resume` emit — see the field's own module doc for why the mint plan isn't
|
|
201
|
+
* cleanly reducible to one shape there (edition resume mints are a PER-ID list, not a count). */
|
|
202
|
+
mint: DeployPlanMint | null;
|
|
203
|
+
estimate: DeployPlanEstimate;
|
|
204
|
+
/** Every `warn()` line this invocation raised, ANSI-stripped, in print order — see
|
|
205
|
+
* `beginPlanWarnings`/the local `warn` wrapper in deploy.ts. Not exhaustive of every warning this
|
|
206
|
+
* FILE can print (a trust-anchor bootstrap warning from `output.ts`'s `ensureFactory`/etc. isn't
|
|
207
|
+
* captured — those only fire on a real send that also stands up a fresh trust anchor, and are
|
|
208
|
+
* file-scoped to a different module), but covers every warning the LANE ITSELF raises, which is
|
|
209
|
+
* what a dry-run consumer cares about. */
|
|
210
|
+
warnings: string[];
|
|
211
|
+
surfaces: DeployPlanSurfaces | null;
|
|
212
|
+
dependencies: DeployPlanDependencies | null;
|
|
213
|
+
resume: DeployPlanResume | null;
|
|
214
|
+
}
|
|
215
|
+
/** Strip the tiny ANSI color wrappers (`bold`/`dim`/`g` from output.ts) so a warning captured for the
|
|
216
|
+
* plan reads as plain text — a JSON consumer has no terminal to render escape codes against. */
|
|
217
|
+
export declare function stripAnsiForPlan(s: string): string;
|
|
218
|
+
//# sourceMappingURL=deploy-plan.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy-plan.d.ts","sourceRoot":"","sources":["../src/deploy-plan.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Bump whenever a field is added, renamed, or reinterpreted — a consumer keys behavior off this,
|
|
2
|
+
* not off the CLI's own package version (that changes for reasons unrelated to this shape).
|
|
3
|
+
*
|
|
4
|
+
* `as const` is load-bearing, not decoration: a plain `= 1` is a WIDENING literal, so the moment it
|
|
5
|
+
* is read into an un-annotated intermediate object (the resume lane builds one and spreads it into
|
|
6
|
+
* several emits) the property degrades to `number` and stops satisfying `DeployPlan`. Keep it.
|
|
7
|
+
*
|
|
8
|
+
* v2 (this change): added `custody.renderer` and `custody.image`; reinterpreted `transactions.legs`
|
|
9
|
+
* to end with `'deploy'` whenever it is non-null (previously silent about the deploy tx itself —
|
|
10
|
+
* see each field's own doc comment). A consumer keying behavior off `legs`' shape needs to know
|
|
11
|
+
* which version it's reading. */
|
|
12
|
+
export const DEPLOY_PLAN_SCHEMA_VERSION = 2;
|
|
13
|
+
// eslint-disable-next-line no-control-regex
|
|
14
|
+
const ANSI = /\x1b\[[0-9;]*m/g;
|
|
15
|
+
/** Strip the tiny ANSI color wrappers (`bold`/`dim`/`g` from output.ts) so a warning captured for the
|
|
16
|
+
* plan reads as plain text — a JSON consumer has no terminal to render escape codes against. */
|
|
17
|
+
export function stripAnsiForPlan(s) {
|
|
18
|
+
return s.replace(ANSI, '');
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=deploy-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy-plan.js","sourceRoot":"","sources":["../src/deploy-plan.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;kCAUkC;AAClC,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAU,CAAC;AA4MrD,4CAA4C;AAC5C,MAAM,IAAI,GAAG,iBAAiB,CAAC;AAE/B;iGACiG;AACjG,MAAM,UAAU,gBAAgB,CAAC,CAAS;IACxC,OAAO,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;AAC7B,CAAC"}
|
package/dist/deps.d.ts
CHANGED
|
@@ -1,46 +1,13 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* The `--dep` flag grammar for `abx deploy-code` — the one CLI-local piece of the dependency
|
|
3
|
+
* lane. Everything downstream of a parsed ref (registry-pointer resolution, setup-multicall leg
|
|
4
|
+
* composition, the selection-time registry check) lives in `@artblocks/abx-sdk`'s `deps.ts`.
|
|
5
|
+
*/
|
|
6
|
+
import { type ParsedDependencyRef } from '@artblocks/abx-sdk';
|
|
2
7
|
/**
|
|
3
8
|
* Parse the accumulated `--dep` flag value (repeats comma-join — see flags.ts — and each
|
|
4
9
|
* value may itself be comma-separated) into ordered refs. Order is load-bearing: the first
|
|
5
10
|
* ref becomes dependency index 0 — the runtime, by convention.
|
|
6
11
|
*/
|
|
7
12
|
export declare function parseDepFlag(value: string | undefined): ParsedDependencyRef[];
|
|
8
|
-
/**
|
|
9
|
-
* The registry pointer a deploy with ≥1 Registry-resolution dep should set: an explicit
|
|
10
|
-
* `--dep-registry` wins (validated), else the chain's known AB registry (env-overridable),
|
|
11
|
-
* else none — the caller WARNS and skips the leg (soft pointer; the resolver falls back to
|
|
12
|
-
* its built-in CDN map). Never a blocker.
|
|
13
|
-
*/
|
|
14
|
-
export declare function resolveDepRegistryPointer(flagValue: string | undefined, chainId: number): {
|
|
15
|
-
registry: Address | null;
|
|
16
|
-
source: 'flag' | 'default' | 'none';
|
|
17
|
-
};
|
|
18
|
-
/**
|
|
19
|
-
* The dependency legs of the setup multicall: one `setDependency(i, resolution, ref)` per
|
|
20
|
-
* dep in index order, plus the `setDependencyRegistry` leg when a pointer resolved. These
|
|
21
|
-
* ride the SAME atomic setup multicall as script chunks/schemas/mints, in every signing lane.
|
|
22
|
-
*/
|
|
23
|
-
export declare function dependencySetupCalls(deps: ParsedDependencyRef[], registry: Address | null): Hex[];
|
|
24
|
-
/** One dep's selection-time verdict (Registry-resolution deps only — OnChain refs never touch a registry). */
|
|
25
|
-
export type DepCheck = {
|
|
26
|
-
dep: string;
|
|
27
|
-
status: 'found';
|
|
28
|
-
details: RegistryDependencyDetails;
|
|
29
|
-
} | {
|
|
30
|
-
dep: string;
|
|
31
|
-
status: 'not-found';
|
|
32
|
-
} | {
|
|
33
|
-
dep: string;
|
|
34
|
-
status: 'skipped';
|
|
35
|
-
};
|
|
36
|
-
/**
|
|
37
|
-
* Best-effort existence/on-chain-ness check of every Registry-resolution dep against the
|
|
38
|
-
* pointer registry. A revert or an empty record ⇒ `not-found` (a warning — the owner may
|
|
39
|
-
* intend a custom registry). A transport failure ⇒ the remaining checks are `skipped` and
|
|
40
|
-
* `rpcOk: false` — one info line, never an error: the deploy proceeds regardless.
|
|
41
|
-
*/
|
|
42
|
-
export declare function checkRegistryDeps(client: DependencyReadClient, registry: Address, deps: ParsedDependencyRef[]): Promise<{
|
|
43
|
-
checks: DepCheck[];
|
|
44
|
-
rpcOk: boolean;
|
|
45
|
-
}>;
|
|
46
13
|
//# sourceMappingURL=deps.d.ts.map
|
package/dist/deps.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"deps.d.ts","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAqB,KAAK,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAEhF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,GAAG,mBAAmB,EAAE,CAW7E"}
|
package/dist/deps.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The
|
|
3
|
-
*
|
|
4
|
-
*
|
|
5
|
-
* deploy). See specs/protocol/dependency-registry.md — the pointer is soft and non-validating.
|
|
2
|
+
* The `--dep` flag grammar for `abx deploy-code` — the one CLI-local piece of the dependency
|
|
3
|
+
* lane. Everything downstream of a parsed ref (registry-pointer resolution, setup-multicall leg
|
|
4
|
+
* composition, the selection-time registry check) lives in `@artblocks/abx-sdk`'s `deps.ts`.
|
|
6
5
|
*/
|
|
7
|
-
import {
|
|
8
|
-
import { DEP_RESOLUTION, parseDependencyRef, readRegistryDependency, resolveDependencyRegistry, seriesCodeAbi, } from '@artblocks/abx-sdk';
|
|
6
|
+
import { parseDependencyRef } from '@artblocks/abx-sdk';
|
|
9
7
|
/**
|
|
10
8
|
* Parse the accumulated `--dep` flag value (repeats comma-join — see flags.ts — and each
|
|
11
9
|
* value may itself be comma-separated) into ordered refs. Order is load-bearing: the first
|
|
@@ -25,66 +23,4 @@ export function parseDepFlag(value) {
|
|
|
25
23
|
.filter((s) => s && s.toLowerCase() !== 'none')
|
|
26
24
|
.map(parseDependencyRef);
|
|
27
25
|
}
|
|
28
|
-
/**
|
|
29
|
-
* The registry pointer a deploy with ≥1 Registry-resolution dep should set: an explicit
|
|
30
|
-
* `--dep-registry` wins (validated), else the chain's known AB registry (env-overridable),
|
|
31
|
-
* else none — the caller WARNS and skips the leg (soft pointer; the resolver falls back to
|
|
32
|
-
* its built-in CDN map). Never a blocker.
|
|
33
|
-
*/
|
|
34
|
-
export function resolveDepRegistryPointer(flagValue, chainId) {
|
|
35
|
-
if (flagValue !== undefined) {
|
|
36
|
-
if (flagValue === 'true' || !/^0x[0-9a-fA-F]{40}$/.test(flagValue)) {
|
|
37
|
-
throw new Error(`--dep-registry must be an address (0x + 40 hex); got '${flagValue}'`);
|
|
38
|
-
}
|
|
39
|
-
return { registry: flagValue, source: 'flag' };
|
|
40
|
-
}
|
|
41
|
-
const known = resolveDependencyRegistry(chainId);
|
|
42
|
-
return known ? { registry: known, source: 'default' } : { registry: null, source: 'none' };
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* The dependency legs of the setup multicall: one `setDependency(i, resolution, ref)` per
|
|
46
|
-
* dep in index order, plus the `setDependencyRegistry` leg when a pointer resolved. These
|
|
47
|
-
* ride the SAME atomic setup multicall as script chunks/schemas/mints, in every signing lane.
|
|
48
|
-
*/
|
|
49
|
-
export function dependencySetupCalls(deps, registry) {
|
|
50
|
-
const calls = deps.map((d, i) => encodeFunctionData({ abi: seriesCodeAbi, functionName: 'setDependency', args: [BigInt(i), d.resolution, d.ref] }));
|
|
51
|
-
if (deps.length && registry) {
|
|
52
|
-
calls.push(encodeFunctionData({ abi: seriesCodeAbi, functionName: 'setDependencyRegistry', args: [registry] }));
|
|
53
|
-
}
|
|
54
|
-
return calls;
|
|
55
|
-
}
|
|
56
|
-
/**
|
|
57
|
-
* Best-effort existence/on-chain-ness check of every Registry-resolution dep against the
|
|
58
|
-
* pointer registry. A revert or an empty record ⇒ `not-found` (a warning — the owner may
|
|
59
|
-
* intend a custom registry). A transport failure ⇒ the remaining checks are `skipped` and
|
|
60
|
-
* `rpcOk: false` — one info line, never an error: the deploy proceeds regardless.
|
|
61
|
-
*/
|
|
62
|
-
export async function checkRegistryDeps(client, registry, deps) {
|
|
63
|
-
const registryDeps = deps.filter((d) => d.resolution === DEP_RESOLUTION.registry);
|
|
64
|
-
const checks = [];
|
|
65
|
-
let rpcOk = true;
|
|
66
|
-
for (const d of registryDeps) {
|
|
67
|
-
if (!rpcOk) {
|
|
68
|
-
checks.push({ dep: d.display, status: 'skipped' });
|
|
69
|
-
continue;
|
|
70
|
-
}
|
|
71
|
-
try {
|
|
72
|
-
const details = await readRegistryDependency(client, registry, d.ref);
|
|
73
|
-
checks.push(details ? { dep: d.display, status: 'found', details } : { dep: d.display, status: 'not-found' });
|
|
74
|
-
}
|
|
75
|
-
catch (e) {
|
|
76
|
-
// A contract revert means the registry answered "no such dependency"; anything else
|
|
77
|
-
// (DNS, timeout, HTTP) means we couldn't ask — degrade to skipped, not failed.
|
|
78
|
-
const msg = `${e.name ?? ''} ${e.message ?? ''}`;
|
|
79
|
-
if (/ContractFunction|revert|returned no data/i.test(msg)) {
|
|
80
|
-
checks.push({ dep: d.display, status: 'not-found' });
|
|
81
|
-
}
|
|
82
|
-
else {
|
|
83
|
-
rpcOk = false;
|
|
84
|
-
checks.push({ dep: d.display, status: 'skipped' });
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
return { checks, rpcOk };
|
|
89
|
-
}
|
|
90
26
|
//# sourceMappingURL=deps.js.map
|
package/dist/deps.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deps.js","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"deps.js","sourceRoot":"","sources":["../src/deps.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,kBAAkB,EAA2B,MAAM,oBAAoB,CAAC;AAEhF;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,KAAyB;IACpD,IAAI,KAAK,KAAK,MAAM;QAAE,MAAM,IAAI,KAAK,CAAC,oFAAoF,CAAC,CAAC;IAC5H,4FAA4F;IAC5F,mGAAmG;IACnG,8FAA8F;IAC9F,IAAI,KAAK,KAAK,MAAM;QAAE,OAAO,EAAE,CAAC;IAChC,OAAO,MAAM,CAAC,KAAK,IAAI,EAAE,CAAC;SACvB,KAAK,CAAC,GAAG,CAAC;SACV,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;SACpB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,WAAW,EAAE,KAAK,MAAM,CAAC;SAC9C,GAAG,CAAC,kBAAkB,CAAC,CAAC;AAC7B,CAAC"}
|
package/dist/errors.d.ts
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one error type a command throws when it needs to abort with a specific exit code. No command
|
|
3
|
+
* body calls `process.exit()` mid-flow: a local failure sets
|
|
4
|
+
* `process.exitCode` and returns; a DEEP failure that needs to unwind through several calls throws).
|
|
5
|
+
*
|
|
6
|
+
* A plain `Error` still works everywhere (the top-level catch in main.ts prints `.message` with the
|
|
7
|
+
* same `✗` prefix either way) — `CliError` adds two opt-ins:
|
|
8
|
+
* - `exitCode`, for the rare case that isn't 1.
|
|
9
|
+
* - `alreadyPrinted`, for a validation helper (e.g. ownerops.ts's `requireAddress`/`requireFlag`)
|
|
10
|
+
* that has a non-`void` return type and so can't just set `exitCode` and `return` — it has to
|
|
11
|
+
* `throw` to make the "unreachable after this" true to the type checker, but it already printed
|
|
12
|
+
* its own usage text via `console.error` BEFORE this existed and that text doesn't have (and must
|
|
13
|
+
* not gain) the generic catch's `✗` prefix. The top-level catch skips its own printing for these.
|
|
14
|
+
*/
|
|
15
|
+
export declare class CliError extends Error {
|
|
16
|
+
readonly exitCode: number;
|
|
17
|
+
readonly alreadyPrinted: boolean;
|
|
18
|
+
constructor(message: string, exitCode?: number, alreadyPrinted?: boolean);
|
|
19
|
+
}
|
|
20
|
+
/** Mark a completed batch command as failed when any item failed, while preserving command cleanup. */
|
|
21
|
+
export declare function markBatchFailure(failed: number): boolean;
|
|
22
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,qBAAa,QAAS,SAAQ,KAAK;IACjC,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,cAAc,EAAE,OAAO,CAAC;gBAErB,OAAO,EAAE,MAAM,EAAE,QAAQ,SAAI,EAAE,cAAc,UAAQ;CAMlE;AAED,uGAAuG;AACvG,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAIxD"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The one error type a command throws when it needs to abort with a specific exit code. No command
|
|
3
|
+
* body calls `process.exit()` mid-flow: a local failure sets
|
|
4
|
+
* `process.exitCode` and returns; a DEEP failure that needs to unwind through several calls throws).
|
|
5
|
+
*
|
|
6
|
+
* A plain `Error` still works everywhere (the top-level catch in main.ts prints `.message` with the
|
|
7
|
+
* same `✗` prefix either way) — `CliError` adds two opt-ins:
|
|
8
|
+
* - `exitCode`, for the rare case that isn't 1.
|
|
9
|
+
* - `alreadyPrinted`, for a validation helper (e.g. ownerops.ts's `requireAddress`/`requireFlag`)
|
|
10
|
+
* that has a non-`void` return type and so can't just set `exitCode` and `return` — it has to
|
|
11
|
+
* `throw` to make the "unreachable after this" true to the type checker, but it already printed
|
|
12
|
+
* its own usage text via `console.error` BEFORE this existed and that text doesn't have (and must
|
|
13
|
+
* not gain) the generic catch's `✗` prefix. The top-level catch skips its own printing for these.
|
|
14
|
+
*/
|
|
15
|
+
export class CliError extends Error {
|
|
16
|
+
exitCode;
|
|
17
|
+
alreadyPrinted;
|
|
18
|
+
constructor(message, exitCode = 1, alreadyPrinted = false) {
|
|
19
|
+
super(message);
|
|
20
|
+
this.name = 'CliError';
|
|
21
|
+
this.exitCode = exitCode;
|
|
22
|
+
this.alreadyPrinted = alreadyPrinted;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
/** Mark a completed batch command as failed when any item failed, while preserving command cleanup. */
|
|
26
|
+
export function markBatchFailure(failed) {
|
|
27
|
+
if (failed <= 0)
|
|
28
|
+
return false;
|
|
29
|
+
process.exitCode = 1;
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,QAAS,SAAQ,KAAK;IACxB,QAAQ,CAAS;IACjB,cAAc,CAAU;IAEjC,YAAY,OAAe,EAAE,QAAQ,GAAG,CAAC,EAAE,cAAc,GAAG,KAAK;QAC/D,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,UAAU,CAAC;QACvB,IAAI,CAAC,QAAQ,GAAG,QAAQ,CAAC;QACzB,IAAI,CAAC,cAAc,GAAG,cAAc,CAAC;IACvC,CAAC;CACF;AAED,uGAAuG;AACvG,MAAM,UAAU,gBAAgB,CAAC,MAAc;IAC7C,IAAI,MAAM,IAAI,CAAC;QAAE,OAAO,KAAK,CAAC;IAC9B,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACrB,OAAO,IAAI,CAAC;AACd,CAAC"}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Per-command flag allowlists — the one place that knows which flags each command accepts, so the
|
|
3
|
+
* dispatcher can surface a typo'd or unsupported flag instead of silently ignoring it.
|
|
4
|
+
*
|
|
5
|
+
* WHY THIS FILE EXISTS, and why the obvious shortcut doesn't work
|
|
6
|
+
* --------------------------------------------------------------
|
|
7
|
+
* The CLI used to have three different behaviors for an unrecognized flag: `deploy*` REFUSED,
|
|
8
|
+
* `preview`/`tokens`/`storage status`/`attach` WARNED, and ~35 other commands said nothing at all —
|
|
9
|
+
* so `abx set-royalty --bsp 500` or `abx minter buy --quantiy 5` did something quietly different from
|
|
10
|
+
* what was asked. That silence is the worst failure mode the CLI has, because the creator's next
|
|
11
|
+
* action is to believe it worked.
|
|
12
|
+
*
|
|
13
|
+
* The tempting fix is to DERIVE each allowlist from the `usage` string every command already declares.
|
|
14
|
+
* An audit of all ~45 commands says that would be actively harmful: several shared helpers read flags
|
|
15
|
+
* that appear in NO usage string anywhere. `storageOverrides()` reads twelve
|
|
16
|
+
* (`--backend`, `--gateway`, `--public-base`, `--storage-signer`, …) and is pulled in by `add`,
|
|
17
|
+
* `render`, `effects`, `migrate`, `storage upload`, and `storage balance|topup`; `--remote-token` is
|
|
18
|
+
* read by `index`, `verify`, `forget`, `status`, and `migrate`. A usage-derived allowlist would warn on
|
|
19
|
+
* every one of those — a false warning on a VALID flag, which is worse than the silence it replaces,
|
|
20
|
+
* because a notice people learn to distrust stops working for the real cases too.
|
|
21
|
+
*
|
|
22
|
+
* So the sets below are explicit, and composed from the shared groups by name. A command absent from
|
|
23
|
+
* `COMMAND_FLAGS` is simply not checked — this can grow incrementally, and an unlisted command keeps
|
|
24
|
+
* exactly its old behavior rather than acquiring a half-right allowlist.
|
|
25
|
+
*/
|
|
26
|
+
/**
|
|
27
|
+
* Flags EVERY owner write accepts: the signing lane (`laneFromFlags`), the opt-in confirm gate, the
|
|
28
|
+
* wallet-lane plumbing, the post-write reindex nudge (`reindexIfKnown` → `resolveRemote`), and
|
|
29
|
+
* `--json`. Sourced from `riskgate.ts` + `ownerops.ts`, never from a usage string.
|
|
30
|
+
*/
|
|
31
|
+
export declare const SHARED_WRITE: readonly ["send", "sign", "sponsor", "unsigned", "dry-run", "yes", "confirm", "port", "sign-url-file", "remote", "remote-token", "json"];
|
|
32
|
+
/**
|
|
33
|
+
* What `storageOverrides()` (config.ts) reads. Any command that resolves a storage backend from flags
|
|
34
|
+
* accepts all twelve — and none of them are documented per-command, which is exactly why a
|
|
35
|
+
* usage-derived allowlist would have been wrong.
|
|
36
|
+
*/
|
|
37
|
+
export declare const STORAGE_OVERRIDE: readonly ["backend", "endpoint", "bucket", "region", "prefix", "public-base", "gateway", "mode", "api-url", "upload-url", "provider", "storage-signer"];
|
|
38
|
+
/** `remoteFlag()` / `resolveRemote()` — a named service plus its token. */
|
|
39
|
+
export declare const REMOTE: readonly ["remote", "remote-token"];
|
|
40
|
+
/**
|
|
41
|
+
* Command → accepted flags. Keys are the dispatch names in `main.ts`; a two-word command is keyed by
|
|
42
|
+
* `"<cmd> <sub>"` (e.g. `"storage upload"`) and falls back to the bare command when no subcommand row
|
|
43
|
+
* exists. `deploy`/`deploy-series`/`deploy-code` are deliberately ABSENT: they already enforce their
|
|
44
|
+
* own exhaustive allowlists via `refuseStrayFlags`, and duplicating those sets here would be a second
|
|
45
|
+
* copy to drift.
|
|
46
|
+
*/
|
|
47
|
+
export declare const COMMAND_FLAGS: Record<string, ReadonlySet<string>>;
|
|
48
|
+
/**
|
|
49
|
+
* The allowlist for a dispatched command, preferring a `"<cmd> <sub>"` row. Returns undefined when the
|
|
50
|
+
* command isn't listed, which means "don't check" — never "nothing is allowed".
|
|
51
|
+
*/
|
|
52
|
+
export declare function allowlistFor(cmd: string, sub?: string): ReadonlySet<string> | undefined;
|
|
53
|
+
//# sourceMappingURL=flag-allowlists.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flag-allowlists.d.ts","sourceRoot":"","sources":["../src/flag-allowlists.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;GAIG;AACH,eAAO,MAAM,YAAY,0IAaf,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,yJAanB,CAAC;AAEX,2EAA2E;AAC3E,eAAO,MAAM,MAAM,qCAAsC,CAAC;AAI1D;;;;;;GAMG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,CAAC,CAoH7D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAMvF"}
|