@artblocks/abx-cli 0.1.0-alpha.4 → 0.1.0-alpha.41
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 +161 -0
- package/assets/renderer-scaffold/README.md +41 -11
- 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 +99 -0
- package/dist/capabilities.d.ts.map +1 -0
- package/dist/capabilities.js +144 -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 +447 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/deploy.d.ts +242 -0
- package/dist/commands/deploy.d.ts.map +1 -0
- package/dist/commands/deploy.js +5429 -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 +147 -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 +429 -0
- package/dist/commands/project.d.ts.map +1 -0
- package/dist/commands/project.js +1720 -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 +868 -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 +738 -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 +748 -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 +622 -0
- package/dist/commands/submit-app.js.map +1 -0
- package/dist/config.d.ts +105 -2
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +351 -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 +390 -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/deploy-plan.d.ts +150 -0
- package/dist/deploy-plan.d.ts.map +1 -0
- package/dist/deploy-plan.js +31 -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 +20 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +25 -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 +184 -0
- package/dist/flag-allowlists.js.map +1 -0
- package/dist/flags.d.ts +47 -0
- package/dist/flags.d.ts.map +1 -1
- package/dist/flags.js +125 -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 +786 -4838
- 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 +179 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.js +780 -0
- package/dist/output.js.map +1 -0
- package/dist/ownerops.d.ts +381 -57
- package/dist/ownerops.d.ts.map +1 -1
- package/dist/ownerops.js +2014 -359
- 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/prompt.d.ts +17 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +19 -0
- package/dist/prompt.js.map +1 -0
- 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 +157 -52
- package/dist/remote.d.ts.map +1 -1
- package/dist/remote.js +435 -46
- package/dist/remote.js.map +1 -1
- package/dist/riskgate.d.ts +62 -0
- package/dist/riskgate.d.ts.map +1 -0
- package/dist/riskgate.js +234 -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 +13 -0
- package/dist/signer.d.ts.map +1 -1
- package/dist/signer.js +84 -15
- package/dist/signer.js.map +1 -1
- package/dist/update-check.d.ts +86 -5
- package/dist/update-check.d.ts.map +1 -1
- package/dist/update-check.js +161 -20
- package/dist/update-check.js.map +1 -1
- package/package.json +13 -12
- package/skill/SKILL.md +181 -347
- package/skill/agents/openai.yaml +4 -0
- package/skill/reference/capabilities.md +188 -0
- package/skill/reference/code.md +220 -0
- package/skill/reference/creator-token.md +94 -0
- package/skill/reference/deploy.md +174 -0
- package/skill/reference/diagnose.md +178 -0
- package/skill/reference/hosting.md +186 -93
- package/skill/reference/operate.md +220 -0
- package/skill/reference/services.md +121 -0
- package/skill/reference/setup.md +154 -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,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The structured `--dry-run --json` / `--json` deploy plan (issue #123).
|
|
3
|
+
*
|
|
4
|
+
* The issue as filed asked for ONE plan object that both the JSON payload and the human prose are
|
|
5
|
+
* rendered FROM. That full refactor is deliberately out of scope here: deploy is the highest-stakes
|
|
6
|
+
* command family (real gas, address pinning, salt reservation), 17 test files assert on the EXACT
|
|
7
|
+
* dry-run prose, and the end-user skill pattern-matches on it — rewiring the human path through a
|
|
8
|
+
* shared object risks a wording regression for no consumer that needs it yet (there is no strict
|
|
9
|
+
* JSON-schema integrator today). So this module only adds the other half: a versioned, typed object
|
|
10
|
+
* populated from the SAME locals `commands/deploy.ts` already computed for its human narration, at
|
|
11
|
+
* every existing `emit(jsonSafe({...}))` call site. The prose is untouched, byte-for-byte.
|
|
12
|
+
*
|
|
13
|
+
* A field a lane genuinely has no answer for is explicit `null`, never silently absent — that
|
|
14
|
+
* distinction (present-but-empty vs. not-applicable-here) is the whole point of a schema. See each
|
|
15
|
+
* `deploy.ts` call site for the specific reasoning behind its nulls.
|
|
16
|
+
*/
|
|
17
|
+
/** Bump whenever a field is added, renamed, or reinterpreted — a consumer keys behavior off this,
|
|
18
|
+
* not off the CLI's own package version (that changes for reasons unrelated to this shape).
|
|
19
|
+
*
|
|
20
|
+
* `as const` is load-bearing, not decoration: a plain `= 1` is a WIDENING literal, so the moment it
|
|
21
|
+
* is read into an un-annotated intermediate object (the resume lane builds one and spreads it into
|
|
22
|
+
* several emits) the property degrades to `number` and stops satisfying `DeployPlan`. Keep it. */
|
|
23
|
+
export const DEPLOY_PLAN_SCHEMA_VERSION = 1;
|
|
24
|
+
// eslint-disable-next-line no-control-regex
|
|
25
|
+
const ANSI = /\x1b\[[0-9;]*m/g;
|
|
26
|
+
/** Strip the tiny ANSI color wrappers (`bold`/`dim`/`g` from output.ts) so a warning captured for the
|
|
27
|
+
* plan reads as plain text — a JSON consumer has no terminal to render escape codes against. */
|
|
28
|
+
export function stripAnsiForPlan(s) {
|
|
29
|
+
return s.replace(ANSI, '');
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=deploy-plan.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deploy-plan.js","sourceRoot":"","sources":["../src/deploy-plan.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH;;;;;mGAKmG;AACnG,MAAM,CAAC,MAAM,0BAA0B,GAAG,CAAU,CAAC;AA0IrD,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,20 @@
|
|
|
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
|
+
//# 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"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
//# 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"}
|
|
@@ -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", "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,+HAYf,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,CA8G7D,CAAC;AAEF;;;GAGG;AACH,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAMvF"}
|
|
@@ -0,0 +1,184 @@
|
|
|
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 const SHARED_WRITE = [
|
|
32
|
+
'send',
|
|
33
|
+
'sign',
|
|
34
|
+
'unsigned',
|
|
35
|
+
'dry-run',
|
|
36
|
+
'yes',
|
|
37
|
+
'confirm',
|
|
38
|
+
'port',
|
|
39
|
+
'sign-url-file',
|
|
40
|
+
'remote',
|
|
41
|
+
'remote-token',
|
|
42
|
+
'json',
|
|
43
|
+
];
|
|
44
|
+
/**
|
|
45
|
+
* What `storageOverrides()` (config.ts) reads. Any command that resolves a storage backend from flags
|
|
46
|
+
* accepts all twelve — and none of them are documented per-command, which is exactly why a
|
|
47
|
+
* usage-derived allowlist would have been wrong.
|
|
48
|
+
*/
|
|
49
|
+
export const STORAGE_OVERRIDE = [
|
|
50
|
+
'backend',
|
|
51
|
+
'endpoint',
|
|
52
|
+
'bucket',
|
|
53
|
+
'region',
|
|
54
|
+
'prefix',
|
|
55
|
+
'public-base',
|
|
56
|
+
'gateway',
|
|
57
|
+
'mode',
|
|
58
|
+
'api-url',
|
|
59
|
+
'upload-url',
|
|
60
|
+
'provider',
|
|
61
|
+
'storage-signer',
|
|
62
|
+
];
|
|
63
|
+
/** `remoteFlag()` / `resolveRemote()` — a named service plus its token. */
|
|
64
|
+
export const REMOTE = ['remote', 'remote-token'];
|
|
65
|
+
const set = (...groups) => new Set(groups.flat());
|
|
66
|
+
/**
|
|
67
|
+
* Command → accepted flags. Keys are the dispatch names in `main.ts`; a two-word command is keyed by
|
|
68
|
+
* `"<cmd> <sub>"` (e.g. `"storage upload"`) and falls back to the bare command when no subcommand row
|
|
69
|
+
* exists. `deploy`/`deploy-series`/`deploy-code` are deliberately ABSENT: they already enforce their
|
|
70
|
+
* own exhaustive allowlists via `refuseStrayFlags`, and duplicating those sets here would be a second
|
|
71
|
+
* copy to drift.
|
|
72
|
+
*/
|
|
73
|
+
export const COMMAND_FLAGS = {
|
|
74
|
+
// ── read-only ──
|
|
75
|
+
inspect: set(['dep']),
|
|
76
|
+
capabilities: set(['json']),
|
|
77
|
+
predict: set(['salt', 'for', 'factory', 'copies', 'script', 'code-dir', 'image-renderer', 'dir', 'image']),
|
|
78
|
+
tokenuri: set(['token', 'fetch', 'json']),
|
|
79
|
+
contracturi: set([]),
|
|
80
|
+
tokens: set(['json', 'limit', 'from', 'holder']),
|
|
81
|
+
state: set(['json']),
|
|
82
|
+
status: set(['watch'], REMOTE),
|
|
83
|
+
verify: set(['json', 'yes', 'generator'], REMOTE),
|
|
84
|
+
artifacts: set(['json', 'token'], REMOTE, STORAGE_OVERRIDE),
|
|
85
|
+
doctor: set(['for', 'fix', 'global', 'agent']),
|
|
86
|
+
serve: set(['port']),
|
|
87
|
+
vacuum: set([]),
|
|
88
|
+
'vacuum convert': set([]),
|
|
89
|
+
'vacuum incremental': set(['pages']),
|
|
90
|
+
'skill install': set(['target', 'global', 'agent']),
|
|
91
|
+
'skill path': set(['target', 'global', 'agent']),
|
|
92
|
+
// ── indexing / projection ──
|
|
93
|
+
add: set(['from-block', 'factory', 'label', 'description', 'external-url', 'full', 'yes', 'traits', 'attributes', 'no-wait', 'dry-run'], REMOTE, STORAGE_OVERRIDE),
|
|
94
|
+
index: set(['full', 'no-wait', 'yes', 'to-block'], REMOTE),
|
|
95
|
+
forget: set([], REMOTE),
|
|
96
|
+
migrate: set(['from', 'to', 'from-block', 'factory', 'label', 'yes'], REMOTE, STORAGE_OVERRIDE),
|
|
97
|
+
remote: set(['conformance', 'remote-token', 'chain-id', 'address', 'from-block']),
|
|
98
|
+
'remote set': set(['url']),
|
|
99
|
+
feedback: set([
|
|
100
|
+
'remote',
|
|
101
|
+
'remote-token',
|
|
102
|
+
'mine',
|
|
103
|
+
'area',
|
|
104
|
+
'component',
|
|
105
|
+
'kind',
|
|
106
|
+
'summary',
|
|
107
|
+
'detail',
|
|
108
|
+
'detail-file',
|
|
109
|
+
'severity',
|
|
110
|
+
'via',
|
|
111
|
+
'context',
|
|
112
|
+
'context-file',
|
|
113
|
+
'limit',
|
|
114
|
+
'yes',
|
|
115
|
+
'json',
|
|
116
|
+
]),
|
|
117
|
+
'auth login': set(['remote', 'no-open', 'force']),
|
|
118
|
+
'auth logout': set(['remote']),
|
|
119
|
+
// ── rendering / effects ──
|
|
120
|
+
render: set(['force', 'effects-url'], REMOTE, STORAGE_OVERRIDE),
|
|
121
|
+
effects: set(['once', 'port', 'resolver-port', 'interval-ms', 'concurrency'], REMOTE, STORAGE_OVERRIDE),
|
|
122
|
+
'mint-page': set(['dir', 'name', 'rpc', 'minter-contract']),
|
|
123
|
+
'scaffold-renderer': set(['force']),
|
|
124
|
+
'scaffold solidity': set(['force']),
|
|
125
|
+
// ── hosting artifacts ──
|
|
126
|
+
'deploy-resolver': set(['provider', 'domain', 'app', 'dir', 'from-source']),
|
|
127
|
+
'deploy-effects': set(['provider', 'resolver-url', 'app', 'dir', 'interval-ms', 'env-id']),
|
|
128
|
+
// ── storage ──
|
|
129
|
+
// `show` honors the full override set now (it previews what a given set of flags WOULD resolve to);
|
|
130
|
+
// before that it read env-only, and the warning correctly fired because the flags really were ignored.
|
|
131
|
+
storage: set(['check'], STORAGE_OVERRIDE),
|
|
132
|
+
'storage show': set(['check'], STORAGE_OVERRIDE),
|
|
133
|
+
'storage upload': set(['key', 'json', 'dry-run'], STORAGE_OVERRIDE),
|
|
134
|
+
// `status` documents --json and --primary-only in its own usage string; without a row here it fell
|
|
135
|
+
// back to the bare `storage` row and warned "unrecognized flag(s), ignored: --json" while the flag
|
|
136
|
+
// visibly worked — a readout contradicting itself is worse than no readout.
|
|
137
|
+
'storage status': set(['json', 'primary-only'], STORAGE_OVERRIDE),
|
|
138
|
+
'storage balance': set(['for'], STORAGE_OVERRIDE),
|
|
139
|
+
'storage topup': set(['usd'], STORAGE_OVERRIDE),
|
|
140
|
+
'storage backup-key': set(['out']),
|
|
141
|
+
// ── owner writes (every one also takes SHARED_WRITE) ──
|
|
142
|
+
refresh: set(['token']), // sends no tx — SHARED_WRITE deliberately does NOT apply
|
|
143
|
+
'set-minter': set(['minter'], SHARED_WRITE),
|
|
144
|
+
'set-max-invocations': set(['max'], SHARED_WRITE),
|
|
145
|
+
'ping-uri': set(['token-ids'], SHARED_WRITE),
|
|
146
|
+
'configure-param': set(['file', 'remote'], SHARED_WRITE),
|
|
147
|
+
'submit-app': set(['name', 'summary', 'description', 'mark', 'tone', 'category', 'stage', 'url', 'url-label', 'image', 'tags', 'registry', 'minter'], SHARED_WRITE),
|
|
148
|
+
'set-schema': set(['schema', 'force'], SHARED_WRITE),
|
|
149
|
+
'retire-param': set([], SHARED_WRITE),
|
|
150
|
+
'set-param-hooks': set(['configure', 'augment', 'transfer', 'clear'], SHARED_WRITE),
|
|
151
|
+
'set-dependency': set([], SHARED_WRITE),
|
|
152
|
+
'remove-last-dependency': set([], SHARED_WRITE),
|
|
153
|
+
'set-dependency-registry': set([], SHARED_WRITE),
|
|
154
|
+
'lock-dependencies': set([], SHARED_WRITE),
|
|
155
|
+
'lock-script': set([], SHARED_WRITE),
|
|
156
|
+
'lock-param-hooks': set([], SHARED_WRITE),
|
|
157
|
+
'set-primary-payee': set(['payee'], SHARED_WRITE),
|
|
158
|
+
pause: set([], SHARED_WRITE),
|
|
159
|
+
unpause: set([], SHARED_WRITE),
|
|
160
|
+
'set-token-uri': set(['uri', 'override', 'token'], SHARED_WRITE),
|
|
161
|
+
'set-contract-uri': set(['uri', 'override'], SHARED_WRITE),
|
|
162
|
+
'set-royalty': set(['bps', 'receiver'], SHARED_WRITE),
|
|
163
|
+
'set-royalty-cap': set(['cap'], SHARED_WRITE),
|
|
164
|
+
'set-transfer-validator': set([], SHARED_WRITE),
|
|
165
|
+
'set-seed-source': set([], SHARED_WRITE),
|
|
166
|
+
'set-field': set(['field', 'text', 'value', 'representation', 'collection', 'token', 'file', 'compress'], SHARED_WRITE),
|
|
167
|
+
'lock-field': set(['field', 'collection', 'token', 'force-field'], SHARED_WRITE),
|
|
168
|
+
'set-renderer': set(['collection', 'off', 'renderer'], SHARED_WRITE),
|
|
169
|
+
'lock-uri': set(['collection'], SHARED_WRITE),
|
|
170
|
+
'set-admin': set(['to'], SHARED_WRITE),
|
|
171
|
+
};
|
|
172
|
+
/**
|
|
173
|
+
* The allowlist for a dispatched command, preferring a `"<cmd> <sub>"` row. Returns undefined when the
|
|
174
|
+
* command isn't listed, which means "don't check" — never "nothing is allowed".
|
|
175
|
+
*/
|
|
176
|
+
export function allowlistFor(cmd, sub) {
|
|
177
|
+
if (sub) {
|
|
178
|
+
const withSub = COMMAND_FLAGS[`${cmd} ${sub}`];
|
|
179
|
+
if (withSub)
|
|
180
|
+
return withSub;
|
|
181
|
+
}
|
|
182
|
+
return COMMAND_FLAGS[cmd];
|
|
183
|
+
}
|
|
184
|
+
//# sourceMappingURL=flag-allowlists.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"flag-allowlists.js","sourceRoot":"","sources":["../src/flag-allowlists.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AAEH;;;;GAIG;AACH,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,MAAM;IACN,MAAM;IACN,UAAU;IACV,SAAS;IACT,KAAK;IACL,SAAS;IACT,MAAM;IACN,eAAe;IACf,QAAQ;IACR,cAAc;IACd,MAAM;CACE,CAAC;AAEX;;;;GAIG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,SAAS;IACT,UAAU;IACV,QAAQ;IACR,QAAQ;IACR,QAAQ;IACR,aAAa;IACb,SAAS;IACT,MAAM;IACN,SAAS;IACT,YAAY;IACZ,UAAU;IACV,gBAAgB;CACR,CAAC;AAEX,2EAA2E;AAC3E,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,QAAQ,EAAE,cAAc,CAAU,CAAC;AAE1D,MAAM,GAAG,GAAG,CAAC,GAAG,MAAwC,EAAuB,EAAE,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;AAEzG;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAwC;IAChE,kBAAkB;IAClB,OAAO,EAAE,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC;IACrB,YAAY,EAAE,GAAG,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3B,OAAO,EAAE,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,gBAAgB,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;IAC1G,QAAQ,EAAE,GAAG,CAAC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,GAAG,CAAC,EAAE,EAAE,YAAY,CAAC;IAC/C,iBAAiB,EAAE,GAAG,CAAC,EAAE,EAAE,YAAY,CAAC;IACxC,WAAW,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,YAAY,CAAC;IACvH,YAAY,EAAE,GAAG,CAAC,CAAC,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,aAAa,CAAC,EAAE,YAAY,CAAC;IAChF,cAAc,EAAE,GAAG,CAAC,CAAC,YAAY,EAAE,KAAK,EAAE,UAAU,CAAC,EAAE,YAAY,CAAC;IACpE,UAAU,EAAE,GAAG,CAAC,CAAC,YAAY,CAAC,EAAE,YAAY,CAAC;IAC7C,WAAW,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC,EAAE,YAAY,CAAC;CACvC,CAAC;AAEF;;;GAGG;AACH,MAAM,UAAU,YAAY,CAAC,GAAW,EAAE,GAAY;IACpD,IAAI,GAAG,EAAE,CAAC;QACR,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,GAAG,IAAI,GAAG,EAAE,CAAC,CAAC;QAC/C,IAAI,OAAO;YAAE,OAAO,OAAO,CAAC;IAC9B,CAAC;IACD,OAAO,aAAa,CAAC,GAAG,CAAC,CAAC;AAC5B,CAAC"}
|
package/dist/flags.d.ts
CHANGED
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
* the first (a real footgun on a multi-param drop; a Select's options use `|` not `,`, so the
|
|
10
10
|
* comma-join never collides with an option list).
|
|
11
11
|
*/
|
|
12
|
+
import { type Hex } from 'viem';
|
|
13
|
+
import { type ReconstructBlockTag } from '@artblocks/abx-sdk';
|
|
12
14
|
export type Flags = Record<string, string | undefined>;
|
|
13
15
|
/** Flags where every occurrence counts (values comma-join, in argv order). */
|
|
14
16
|
export declare const REPEATABLE_FLAGS: ReadonlySet<string>;
|
|
@@ -18,7 +20,18 @@ export declare const REPEATABLE_FLAGS: ReadonlySet<string>;
|
|
|
18
20
|
* `no-update-check` opts out of the startup update nudge (see update-check.ts).
|
|
19
21
|
*/
|
|
20
22
|
export declare const GLOBAL_FLAGS: ReadonlySet<string>;
|
|
23
|
+
/** Whether `--dry-run` was passed. The one place that truthiness is decided — every write command
|
|
24
|
+
* (owner-op or deploy) reads it through here rather than hand-rolling `!!flags['dry-run']`, so a
|
|
25
|
+
* fresh command can't ship with a *slightly* different spelling of the same check (or skip it). */
|
|
26
|
+
export declare function isDryRun(flags: Flags): boolean;
|
|
21
27
|
export declare function parseFlags(args: string[]): Flags;
|
|
28
|
+
/**
|
|
29
|
+
* The bare (non-flag) arguments, with flag VALUES removed — the mirror of {@link parseFlags}, and
|
|
30
|
+
* deliberately next to it: the two must consume argv by the same rule or a flag's value looks like a
|
|
31
|
+
* positional. (Hand-rolling `args.filter(a => !a.startsWith('-'))` reads `--token 0` as a stray
|
|
32
|
+
* positional `0`, which is exactly the bug a stray-positional check is meant to catch.)
|
|
33
|
+
*/
|
|
34
|
+
export declare function positionalArgs(args: string[]): string[];
|
|
22
35
|
/**
|
|
23
36
|
* The flag keys in `flags` that are NOT in `allowed` — for a non-fatal "unrecognized flag"
|
|
24
37
|
* notice at a command's entry. {@link parseFlags} keeps any `--k` it sees, so a typo'd or
|
|
@@ -28,4 +41,38 @@ export declare function parseFlags(args: string[]): Flags;
|
|
|
28
41
|
* scripted deploy (owner's stateless/scriptable line — see cli-ux-decisions).
|
|
29
42
|
*/
|
|
30
43
|
export declare function unknownFlags(flags: Flags, allowed: Iterable<string>): string[];
|
|
44
|
+
/** Warn (never throw) on a flag the command doesn't recognize — a typo'd or unsupported flag
|
|
45
|
+
* otherwise no-ops INVISIBLY (the worst failure mode for a write-adjacent value like a mistyped
|
|
46
|
+
* --royalty-bps). Non-fatal, per the owner's scriptability line ([[cli-ux-decisions]]). */
|
|
47
|
+
export declare const FLAG_HINTS: Record<string, (cmd: string) => string | undefined>;
|
|
48
|
+
/**
|
|
49
|
+
* Unknown flags on a command that can SEND: refuse, don't warn.
|
|
50
|
+
*
|
|
51
|
+
* This used to warn and carry on, and `--chain sepolia` proved why that isn't enough — the warning was
|
|
52
|
+
* accurate, it scrolled past, and the deploy ran on the DEFAULT chain. On a dry run that costs a
|
|
53
|
+
* confused minute; on a funded send it is a wrong-chain deploy. "Prose that was ignored once will be
|
|
54
|
+
* ignored again" is the standing rule here, so the tx-sending commands stop instead.
|
|
55
|
+
*
|
|
56
|
+
* Safe to refuse rather than warn because a flag absent from the allowlist is, by construction, one
|
|
57
|
+
* the command never reads — verified per command by comparing every `flags.x` read in its body against
|
|
58
|
+
* its allowlist. So refusal cannot break a working flag; it only makes an already-ignored one loud.
|
|
59
|
+
*
|
|
60
|
+
* `--dry-run` refuses identically. A preview that accepts what the real send rejects is its own trap:
|
|
61
|
+
* you'd validate a command in preview and have it fail at the moment it matters.
|
|
62
|
+
*/
|
|
63
|
+
export declare function refuseStrayFlags(flags: Flags, allowed: ReadonlySet<string>, cmd: string): void;
|
|
64
|
+
/** Unknown flags on a READ-ONLY command: warn, don't refuse. Nothing can be mis-sent, and a stray
|
|
65
|
+
* flag on `preview`/`inspect` shouldn't stop a creator mid-iteration. */
|
|
66
|
+
export declare function warnStrayFlags(flags: Flags, allowed: ReadonlySet<string>, cmd: string): void;
|
|
67
|
+
/** The wallet-lane owner-pinning guard: on `--sign` with no `--for`, whichever wallet connects
|
|
68
|
+
* becomes owner + royalty receiver + mint recipient (the launch-readiness "random wallet owns the
|
|
69
|
+
* collection" trap). Fires uniformly on deploy / deploy-series / deploy-code. */
|
|
70
|
+
export declare function warnSignWithoutFor(flags: Flags): void;
|
|
71
|
+
/** Validate `--to-block` for the index lane: only the two REORG-SAFE tags, never a raw block number.
|
|
72
|
+
* A number is deliberately refused — `abx index` is incremental and picks its own scan window, so a
|
|
73
|
+
* hand-pinned height would silently freeze the watermark somewhere the next run can't reason about;
|
|
74
|
+
* the tags are the only values that stay meaningful across runs. Undefined when absent. */
|
|
75
|
+
export declare function parseBlockTagFlag(raw: string | undefined): ReconstructBlockTag | undefined;
|
|
76
|
+
/** Validate an explicit --salt (a 32-byte hex). Undefined when absent. */
|
|
77
|
+
export declare function parseSaltFlag(raw: string | undefined): Hex | undefined;
|
|
31
78
|
//# sourceMappingURL=flags.d.ts.map
|
package/dist/flags.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAEvD,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,
|
|
1
|
+
{"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../src/flags.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AACH,OAAO,EAAC,KAAK,GAAG,EAAC,MAAM,MAAM,CAAC;AAC9B,OAAO,EAAC,KAAK,mBAAmB,EAAC,MAAM,oBAAoB,CAAC;AAG5D,MAAM,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAEvD,8EAA8E;AAC9E,eAAO,MAAM,gBAAgB,EAAE,WAAW,CAAC,MAAM,CAAuC,CAAC;AAEzF;;;;GAIG;AACH,eAAO,MAAM,YAAY,EAAE,WAAW,CAAC,MAAM,CAAgC,CAAC;AAE9E;;oGAEoG;AACpG,wBAAgB,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,OAAO,CAE9C;AAGD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,KAAK,CAchD;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAWvD;AAED;;;;;;;GAOG;AACH,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