@artblocks/abx-cli 0.1.0-alpha.9 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (201) hide show
  1. package/CHANGELOG.md +429 -0
  2. package/assets/renderer-scaffold/README.md +44 -13
  3. package/assets/renderer-scaffold/foundry.toml +5 -0
  4. package/assets/renderer-scaffold/remappings.txt +1 -1
  5. package/assets/renderer-scaffold/script/DeployHooks.s.sol +24 -0
  6. package/assets/renderer-scaffold/script/Preview.s.sol +99 -0
  7. package/assets/renderer-scaffold/src/MyHooks.sol +20 -0
  8. package/assets/renderer-scaffold/src/MyRenderer.sol +4 -4
  9. package/assets/renderer-scaffold/src/MyTraits.sol +2 -2
  10. package/assets/renderer-scaffold/test/MyRenderer.t.sol +60 -3
  11. package/dist/bin.d.ts +26 -0
  12. package/dist/bin.d.ts.map +1 -0
  13. package/dist/bin.js +63 -0
  14. package/dist/bin.js.map +1 -0
  15. package/dist/capabilities.d.ts +132 -0
  16. package/dist/capabilities.d.ts.map +1 -0
  17. package/dist/capabilities.js +175 -0
  18. package/dist/capabilities.js.map +1 -0
  19. package/dist/commands/auth.d.ts +54 -0
  20. package/dist/commands/auth.d.ts.map +1 -0
  21. package/dist/commands/auth.js +483 -0
  22. package/dist/commands/auth.js.map +1 -0
  23. package/dist/commands/contract.d.ts +19 -0
  24. package/dist/commands/contract.d.ts.map +1 -0
  25. package/dist/commands/contract.js +171 -0
  26. package/dist/commands/contract.js.map +1 -0
  27. package/dist/commands/deploy.d.ts +296 -0
  28. package/dist/commands/deploy.d.ts.map +1 -0
  29. package/dist/commands/deploy.js +5756 -0
  30. package/dist/commands/deploy.js.map +1 -0
  31. package/dist/commands/feedback.d.ts +7 -0
  32. package/dist/commands/feedback.d.ts.map +1 -0
  33. package/dist/commands/feedback.js +154 -0
  34. package/dist/commands/feedback.js.map +1 -0
  35. package/dist/commands/maintenance.d.ts +4 -0
  36. package/dist/commands/maintenance.d.ts.map +1 -0
  37. package/dist/commands/maintenance.js +114 -0
  38. package/dist/commands/maintenance.js.map +1 -0
  39. package/dist/commands/project.d.ts +458 -0
  40. package/dist/commands/project.d.ts.map +1 -0
  41. package/dist/commands/project.js +1837 -0
  42. package/dist/commands/project.js.map +1 -0
  43. package/dist/commands/reads.d.ts +85 -0
  44. package/dist/commands/reads.d.ts.map +1 -0
  45. package/dist/commands/reads.js +881 -0
  46. package/dist/commands/reads.js.map +1 -0
  47. package/dist/commands/scaffold.d.ts +89 -0
  48. package/dist/commands/scaffold.d.ts.map +1 -0
  49. package/dist/commands/scaffold.js +741 -0
  50. package/dist/commands/scaffold.js.map +1 -0
  51. package/dist/commands/service.d.ts +67 -0
  52. package/dist/commands/service.d.ts.map +1 -0
  53. package/dist/commands/service.js +761 -0
  54. package/dist/commands/service.js.map +1 -0
  55. package/dist/commands/storage.d.ts +51 -0
  56. package/dist/commands/storage.d.ts.map +1 -0
  57. package/dist/commands/storage.js +399 -0
  58. package/dist/commands/storage.js.map +1 -0
  59. package/dist/commands/submit-app.d.ts +102 -0
  60. package/dist/commands/submit-app.d.ts.map +1 -0
  61. package/dist/commands/submit-app.js +638 -0
  62. package/dist/commands/submit-app.js.map +1 -0
  63. package/dist/config.d.ts +94 -2
  64. package/dist/config.d.ts.map +1 -1
  65. package/dist/config.js +332 -12
  66. package/dist/config.js.map +1 -1
  67. package/dist/conformance.d.ts +31 -0
  68. package/dist/conformance.d.ts.map +1 -0
  69. package/dist/conformance.js +400 -0
  70. package/dist/conformance.js.map +1 -0
  71. package/dist/contract-read-error.d.ts +5 -0
  72. package/dist/contract-read-error.d.ts.map +1 -0
  73. package/dist/contract-read-error.js +37 -0
  74. package/dist/contract-read-error.js.map +1 -0
  75. package/dist/creator-agent.d.ts +49 -0
  76. package/dist/creator-agent.d.ts.map +1 -0
  77. package/dist/creator-agent.js +363 -0
  78. package/dist/creator-agent.js.map +1 -0
  79. package/dist/creator-keyring.d.ts +26 -0
  80. package/dist/creator-keyring.d.ts.map +1 -0
  81. package/dist/creator-keyring.js +57 -0
  82. package/dist/creator-keyring.js.map +1 -0
  83. package/dist/creator-signer.d.ts +52 -0
  84. package/dist/creator-signer.d.ts.map +1 -0
  85. package/dist/creator-signer.js +267 -0
  86. package/dist/creator-signer.js.map +1 -0
  87. package/dist/deploy-plan.d.ts +218 -0
  88. package/dist/deploy-plan.d.ts.map +1 -0
  89. package/dist/deploy-plan.js +20 -0
  90. package/dist/deploy-plan.js.map +1 -0
  91. package/dist/deps.d.ts +6 -39
  92. package/dist/deps.d.ts.map +1 -1
  93. package/dist/deps.js +4 -68
  94. package/dist/deps.js.map +1 -1
  95. package/dist/errors.d.ts +22 -0
  96. package/dist/errors.d.ts.map +1 -0
  97. package/dist/errors.js +32 -0
  98. package/dist/errors.js.map +1 -0
  99. package/dist/flag-allowlists.d.ts +53 -0
  100. package/dist/flag-allowlists.d.ts.map +1 -0
  101. package/dist/flag-allowlists.js +188 -0
  102. package/dist/flag-allowlists.js.map +1 -0
  103. package/dist/flags.d.ts +53 -0
  104. package/dist/flags.d.ts.map +1 -1
  105. package/dist/flags.js +151 -1
  106. package/dist/flags.js.map +1 -1
  107. package/dist/jsonout.d.ts +37 -0
  108. package/dist/jsonout.d.ts.map +1 -0
  109. package/dist/jsonout.js +79 -0
  110. package/dist/jsonout.js.map +1 -0
  111. package/dist/kind.d.ts +57 -0
  112. package/dist/kind.d.ts.map +1 -0
  113. package/dist/kind.js +122 -0
  114. package/dist/kind.js.map +1 -0
  115. package/dist/main.js +859 -5374
  116. package/dist/main.js.map +1 -1
  117. package/dist/mintpage.d.ts +17 -2
  118. package/dist/mintpage.d.ts.map +1 -1
  119. package/dist/mintpage.js +241 -54
  120. package/dist/mintpage.js.map +1 -1
  121. package/dist/output.d.ts +184 -0
  122. package/dist/output.d.ts.map +1 -0
  123. package/dist/output.js +774 -0
  124. package/dist/output.js.map +1 -0
  125. package/dist/ownerops.d.ts +463 -59
  126. package/dist/ownerops.d.ts.map +1 -1
  127. package/dist/ownerops.js +2329 -366
  128. package/dist/ownerops.js.map +1 -1
  129. package/dist/preview.d.ts +23 -5
  130. package/dist/preview.d.ts.map +1 -1
  131. package/dist/preview.js +95 -43
  132. package/dist/preview.js.map +1 -1
  133. package/dist/provision.d.ts +3 -13
  134. package/dist/provision.d.ts.map +1 -1
  135. package/dist/provision.js +19 -21
  136. package/dist/provision.js.map +1 -1
  137. package/dist/remote.d.ts +116 -9
  138. package/dist/remote.d.ts.map +1 -1
  139. package/dist/remote.js +371 -14
  140. package/dist/remote.js.map +1 -1
  141. package/dist/riskgate.d.ts +101 -0
  142. package/dist/riskgate.d.ts.map +1 -0
  143. package/dist/riskgate.js +343 -0
  144. package/dist/riskgate.js.map +1 -0
  145. package/dist/scaffold.d.ts +12 -0
  146. package/dist/scaffold.d.ts.map +1 -0
  147. package/dist/scaffold.js +56 -0
  148. package/dist/scaffold.js.map +1 -0
  149. package/dist/schema.d.ts +36 -1
  150. package/dist/schema.d.ts.map +1 -1
  151. package/dist/schema.js +121 -26
  152. package/dist/schema.js.map +1 -1
  153. package/dist/script-chunks.d.ts +8 -0
  154. package/dist/script-chunks.d.ts.map +1 -0
  155. package/dist/script-chunks.js +35 -0
  156. package/dist/script-chunks.js.map +1 -0
  157. package/dist/served.d.ts +30 -0
  158. package/dist/served.d.ts.map +1 -0
  159. package/dist/served.js +112 -0
  160. package/dist/served.js.map +1 -0
  161. package/dist/signer.d.ts +20 -1
  162. package/dist/signer.d.ts.map +1 -1
  163. package/dist/signer.js +110 -18
  164. package/dist/signer.js.map +1 -1
  165. package/dist/update-check.d.ts +60 -9
  166. package/dist/update-check.d.ts.map +1 -1
  167. package/dist/update-check.js +105 -18
  168. package/dist/update-check.js.map +1 -1
  169. package/package.json +17 -12
  170. package/skill/SKILL.md +213 -354
  171. package/skill/agents/openai.yaml +4 -0
  172. package/skill/reference/capabilities.md +195 -0
  173. package/skill/reference/code.md +236 -0
  174. package/skill/reference/creator-token.md +94 -0
  175. package/skill/reference/deploy.md +191 -0
  176. package/skill/reference/diagnose.md +178 -0
  177. package/skill/reference/hosting.md +191 -102
  178. package/skill/reference/operate.md +237 -0
  179. package/skill/reference/services.md +173 -0
  180. package/skill/reference/setup.md +221 -42
  181. package/assets/renderer-scaffold/src/interfaces/IAbxFieldRenderer.sol +0 -32
  182. package/assets/renderer-scaffold/src/interfaces/IAbxParams.sol +0 -26
  183. package/dist/inspect.d.ts +0 -48
  184. package/dist/inspect.d.ts.map +0 -1
  185. package/dist/inspect.js +0 -184
  186. package/dist/inspect.js.map +0 -1
  187. package/dist/migrate.d.ts +0 -65
  188. package/dist/migrate.d.ts.map +0 -1
  189. package/dist/migrate.js +0 -180
  190. package/dist/migrate.js.map +0 -1
  191. package/dist/onchain-uri.d.ts +0 -97
  192. package/dist/onchain-uri.d.ts.map +0 -1
  193. package/dist/onchain-uri.js +0 -243
  194. package/dist/onchain-uri.js.map +0 -1
  195. package/dist/upload.d.ts +0 -28
  196. package/dist/upload.d.ts.map +0 -1
  197. package/dist/upload.js +0 -41
  198. package/dist/upload.js.map +0 -1
  199. package/skill/reference/code-projects.md +0 -246
  200. package/skill/reference/operating.md +0 -118
  201. package/skill/reference/troubleshooting.md +0 -28
@@ -0,0 +1,20 @@
1
+ // SPDX-License-Identifier: MIT
2
+ pragma solidity 0.8.28;
3
+
4
+ import {MaxDataLengthConfigureHook} from "abx-contracts/src/reference/MaxDataLengthConfigureHook.sol";
5
+ import {TransferCounterHook} from "abx-contracts/src/reference/TransferCounterHook.sol";
6
+ import {TransferCountAugmentHook} from "abx-contracts/src/reference/TransferCountAugmentHook.sol";
7
+
8
+ /// Fork these thin wrappers when your project needs different policy. Keeping each lifecycle role
9
+ /// in its own contract means a project only deploys and grants the authority it actually uses.
10
+ contract MyConfigureHook is MaxDataLengthConfigureHook {
11
+ constructor(address token, uint256 maxDataLength) MaxDataLengthConfigureHook(token, maxDataLength) {}
12
+ }
13
+
14
+ contract MyTransferHook is TransferCounterHook {
15
+ constructor(address token) TransferCounterHook(token) {}
16
+ }
17
+
18
+ contract MyAugmentHook is TransferCountAugmentHook {
19
+ constructor(TransferCounterHook counter) TransferCountAugmentHook(counter) {}
20
+ }
@@ -2,8 +2,8 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {LibString} from "solady/utils/LibString.sol";
5
- import {IAbxFieldRenderer} from "abx/IAbxFieldRenderer.sol";
6
- import {IAbxParams} from "abx/IAbxParams.sol";
5
+ import {IAbxFieldRenderer} from "abx-contracts/src/uri/IAbxFieldRenderer.sol";
6
+ import {IAbxParams} from "abx-contracts/src/extensions/params/IAbxParams.sol";
7
7
 
8
8
  /// @title MyRenderer — a fully on-chain generative image, tinted by a collector PostParam
9
9
  /// @notice FORK THIS. It renders the `image` field as an `image/svg+xml` document computed
@@ -19,7 +19,7 @@ import {IAbxParams} from "abx/IAbxParams.sol";
19
19
  /// (declare the `palette` schema, or the param is fixed at the default and collectors
20
20
  /// can't set it.) Pair with MyTraits.sol so image AND traits read the SAME seed math.
21
21
  ///
22
- /// Swap the geometry/palette math below for your own art. Keep the FIVE INVARIANTS in
22
+ /// Swap the geometry/palette math below for your own work. Keep the FIVE INVARIANTS in
23
23
  /// IAbxFieldRenderer — above all, NEVER revert (a revert bricks the whole tokenURI).
24
24
  contract MyRenderer is IAbxFieldRenderer {
25
25
  using LibString for uint256;
@@ -53,7 +53,7 @@ contract MyRenderer is IAbxFieldRenderer {
53
53
  return (CONTENT_TYPE, bytes(_svg(seed, palette)));
54
54
  }
55
55
 
56
- // ── the art: seed → geometry, palette → tint (replace with your own) ──────────
56
+ // ── the work: seed → geometry, palette → tint (replace with your own) ─────────
57
57
 
58
58
  function _svg(bytes32 seed, string memory palette) private pure returns (string memory) {
59
59
  uint256 rings = 3 + (uint8(seed[0]) % 6); // 3..8 rings (MUST match MyTraits' math)
@@ -2,8 +2,8 @@
2
2
  pragma solidity ^0.8.20;
3
3
 
4
4
  import {LibString} from "solady/utils/LibString.sol";
5
- import {IAbxFieldRenderer} from "abx/IAbxFieldRenderer.sol";
6
- import {IAbxParams} from "abx/IAbxParams.sol";
5
+ import {IAbxFieldRenderer} from "abx-contracts/src/uri/IAbxFieldRenderer.sol";
6
+ import {IAbxParams} from "abx-contracts/src/extensions/params/IAbxParams.sol";
7
7
 
8
8
  /// @title MyTraits — on-chain marketplace traits, coherent with MyRenderer
9
9
  /// @notice FORK THIS. Renders the `attributes` field as an `application/json` array a marketplace
@@ -4,7 +4,7 @@ pragma solidity ^0.8.20;
4
4
  import {Test} from "forge-std/Test.sol";
5
5
  import {MyRenderer} from "../src/MyRenderer.sol";
6
6
  import {MyTraits} from "../src/MyTraits.sol";
7
- import {IAbxParams} from "abx/IAbxParams.sol";
7
+ import {IAbxParams} from "abx-contracts/src/extensions/params/IAbxParams.sol";
8
8
 
9
9
  /// A tiny stand-in for the ABX contract's param surface, so the renderers can be tested in
10
10
  /// isolation — set a seed / palette (or don't) and assert the renderer behaves.
@@ -13,16 +13,47 @@ contract MockParams is IAbxParams {
13
13
  mapping(uint256 => mapping(bytes32 => bool)) private ts;
14
14
  mapping(bytes32 => bytes32) private cv;
15
15
  mapping(bytes32 => bool) private cs;
16
+ // `Bytes`/`String` params: the bytes32 holds keccak(content), the content lives here.
17
+ mapping(uint256 => mapping(bytes32 => bytes)) private td;
18
+ mapping(bytes32 => bytes) private cd;
16
19
 
17
20
  function setToken(uint256 id, bytes32 key, bytes32 val) external { tv[id][key] = val; ts[id][key] = true; }
18
21
  function setContract(bytes32 key, bytes32 val) external { cv[key] = val; cs[key] = true; }
19
22
 
23
+ /// Set a payload-typed (`Bytes`/`String`) param the way the real contract does: the scalar slot
24
+ /// carries the keccak COMMITMENT and `valueIsHash` is true, so a renderer that reads the bytes32
25
+ /// gets a hash — the data reader is the only way to the content.
26
+ function setTokenData(uint256 id, bytes32 key, bytes memory content) external {
27
+ td[id][key] = content;
28
+ tv[id][key] = keccak256(content);
29
+ ts[id][key] = true;
30
+ }
31
+ function setContractData(bytes32 key, bytes memory content) external {
32
+ cd[key] = content;
33
+ cv[key] = keccak256(content);
34
+ cs[key] = true;
35
+ }
36
+
20
37
  function tokenParam(uint256 id, bytes32 key) external view returns (bytes32, bool, bool) {
21
- return (tv[id][key], false, ts[id][key]);
38
+ return (tv[id][key], td[id][key].length > 0, ts[id][key]);
22
39
  }
23
40
  function contractParam(bytes32 key) external view returns (bytes32, bool, bool) {
24
- return (cv[key], false, cs[key]);
41
+ return (cv[key], cd[key].length > 0, cs[key]);
42
+ }
43
+ function tokenParamData(uint256 id, bytes32 key) external view returns (bytes memory) {
44
+ return td[id][key];
45
+ }
46
+ function contractParamData(bytes32 key) external view returns (bytes memory) {
47
+ return cd[key];
25
48
  }
49
+ function tokenParamKeys(uint256) external pure returns (bytes32[] memory) { return new bytes32[](0); }
50
+ function tokenParamKeysPaged(uint256, uint256, uint256)
51
+ external pure returns (bytes32[] memory keys, uint256 total)
52
+ { return (new bytes32[](0), 0); }
53
+ function contractParamKeys() external pure returns (bytes32[] memory) { return new bytes32[](0); }
54
+ function contractParamKeysPaged(uint256, uint256)
55
+ external pure returns (bytes32[] memory keys, uint256 total)
56
+ { return (new bytes32[](0), 0); }
26
57
  }
27
58
 
28
59
  contract MyRendererTest is Test {
@@ -107,4 +138,30 @@ contract MyRendererTest is Test {
107
138
  (, bytes memory data) = img.render(address(params), tokenId, IMAGE);
108
139
  assertTrue(data.length > 0);
109
140
  }
141
+
142
+ /// READING A PAYLOAD PARAM (`Bytes`/`String`) — the pattern for carrying an actual work
143
+ /// payload on-chain. The scalar reader hands you a keccak COMMITMENT with `valueIsHash == true`;
144
+ /// the content only comes from `tokenParamData`. If your renderer reads a `Bytes` param through
145
+ /// `tokenParam` it will draw from a hash and produce garbage, silently — hence this test.
146
+ function test_bytesParam_readViaDataReader() public {
147
+ bytes memory grid = hex"00112233445566778899aabbccddeeff";
148
+ params.setTokenData(0, "grid", grid);
149
+
150
+ // The scalar surface: a commitment, explicitly flagged as one — NOT the content.
151
+ (bytes32 value, bool valueIsHash, bool isSet) = IAbxParams(address(params)).tokenParam(0, "grid");
152
+ assertTrue(isSet);
153
+ assertTrue(valueIsHash, "a Bytes param reports valueIsHash: read the data instead");
154
+ assertEq(value, keccak256(grid));
155
+
156
+ // The data surface: the real bytes, verifiable against that commitment.
157
+ bytes memory got = IAbxParams(address(params)).tokenParamData(0, "grid");
158
+ assertEq(got, grid);
159
+ assertEq(keccak256(got), value, "content must match the on-chain commitment");
160
+ }
161
+
162
+ /// An unset payload param returns empty bytes — your "use a default" signal, never a revert.
163
+ function test_bytesParam_unsetIsEmpty() public view {
164
+ assertEq(IAbxParams(address(params)).tokenParamData(0, "grid").length, 0);
165
+ assertEq(IAbxParams(address(params)).contractParamData("grid").length, 0);
166
+ }
110
167
  }
package/dist/bin.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * abx — the published binary's entry point, and nothing else.
4
+ *
5
+ * This file exists for one reason: **ESM links the entire static import graph before any module
6
+ * body runs.** `main.ts` reaches `@artblocks/abx-indexer` → `node:sqlite` through `output.ts` and
7
+ * `config.ts`, so on a Node that cannot load `node:sqlite` the process dies during *linking* —
8
+ * before a single line of our code executes. A guard at the top of `main.ts` could never fire. The
9
+ * only place a check can run first is a module that imports nothing statically and reaches the rest
10
+ * of the CLI through a dynamic `import()`.
11
+ *
12
+ * What that bought before this file existed: `npm i -g @artblocks/abx-cli && abx doctor` on Node
13
+ * 22.5 printed a raw `ERR_UNKNOWN_BUILTIN_MODULE: No such built-in module: node:sqlite` stack trace.
14
+ * No mention of abx, Node versions, or what to do — on the first command we tell every user to run.
15
+ *
16
+ * We probe the *capability*, not the version number. `node:sqlite` shipped in v22.5.0 behind
17
+ * `--experimental-sqlite` and lost the flag in v22.13.0 / v23.4.0, so an old Node run with
18
+ * `NODE_OPTIONS=--experimental-sqlite` genuinely works — refusing it on a version comparison would
19
+ * be a false negative on a setup the reporter proved out. `engines` states what we *support*; this
20
+ * guard blocks only what is actually broken.
21
+ *
22
+ * KEEP THIS FILE IMPORT-FREE. A single static `import` of anything in the CLI reintroduces the
23
+ * crash it exists to prevent.
24
+ */
25
+ export {};
26
+ //# sourceMappingURL=bin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.d.ts","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;GAsBG"}
package/dist/bin.js ADDED
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * abx — the published binary's entry point, and nothing else.
4
+ *
5
+ * This file exists for one reason: **ESM links the entire static import graph before any module
6
+ * body runs.** `main.ts` reaches `@artblocks/abx-indexer` → `node:sqlite` through `output.ts` and
7
+ * `config.ts`, so on a Node that cannot load `node:sqlite` the process dies during *linking* —
8
+ * before a single line of our code executes. A guard at the top of `main.ts` could never fire. The
9
+ * only place a check can run first is a module that imports nothing statically and reaches the rest
10
+ * of the CLI through a dynamic `import()`.
11
+ *
12
+ * What that bought before this file existed: `npm i -g @artblocks/abx-cli && abx doctor` on Node
13
+ * 22.5 printed a raw `ERR_UNKNOWN_BUILTIN_MODULE: No such built-in module: node:sqlite` stack trace.
14
+ * No mention of abx, Node versions, or what to do — on the first command we tell every user to run.
15
+ *
16
+ * We probe the *capability*, not the version number. `node:sqlite` shipped in v22.5.0 behind
17
+ * `--experimental-sqlite` and lost the flag in v22.13.0 / v23.4.0, so an old Node run with
18
+ * `NODE_OPTIONS=--experimental-sqlite` genuinely works — refusing it on a version comparison would
19
+ * be a false negative on a setup the reporter proved out. `engines` states what we *support*; this
20
+ * guard blocks only what is actually broken.
21
+ *
22
+ * KEEP THIS FILE IMPORT-FREE. A single static `import` of anything in the CLI reintroduces the
23
+ * crash it exists to prevent.
24
+ */
25
+ /** Unflagged `node:sqlite`: v22.13.0 on the 22.x line, v23.4.0 on 23.x (nodejs/node#55890). */
26
+ const NODE_FLOOR = '22.13.0';
27
+ const color = !process.env.NO_COLOR && process.stderr.isTTY;
28
+ const red = (s) => (color ? `\x1b[31m${s}\x1b[0m` : s);
29
+ const dim = (s) => (color ? `\x1b[2m${s}\x1b[0m` : s);
30
+ const green = (s) => (color ? `\x1b[32m${s}\x1b[0m` : s);
31
+ /**
32
+ * True when this Node has `node:sqlite` but only behind `--experimental-sqlite` — i.e. the
33
+ * v22.5.0–v22.12.x window (and v23.0–v23.3, which is EOL and not worth naming). Only then is the
34
+ * NODE_OPTIONS escape hatch real; below v22.5.0 the module does not exist at any flag.
35
+ */
36
+ function flagWouldWork(version) {
37
+ const [major, minor] = version.split('.').map(Number);
38
+ if (major === 22)
39
+ return minor >= 5 && minor < 13;
40
+ return major === 23;
41
+ }
42
+ function nodeSqliteMessage(version) {
43
+ const escape = flagWouldWork(version)
44
+ ? `\n Need to stay on this Node? It has SQLite, just flag-gated — but abx is untested there:\n ${green(`NODE_OPTIONS=--experimental-sqlite abx ${process.argv[2] ?? 'doctor'}`)}\n`
45
+ : '';
46
+ return (`\n${red('✗')} abx needs Node's built-in SQLite (${dim('node:sqlite')}), and this Node can't load it.\n\n` +
47
+ ` you have ${red(`v${version}`)}\n` +
48
+ ` abx needs ${green(`v${NODE_FLOOR}`)} or newer\n\n` +
49
+ ` Upgrade Node, then re-run:\n` +
50
+ ` ${green('nvm install 22 && nvm use 22')} ${dim('# or: brew upgrade node')}\n` +
51
+ ` ${green('abx doctor')}\n` +
52
+ escape);
53
+ }
54
+ try {
55
+ await import('node:sqlite');
56
+ }
57
+ catch {
58
+ process.stderr.write(nodeSqliteMessage(process.versions.node));
59
+ process.exit(1);
60
+ }
61
+ await import('./main.js');
62
+ export {};
63
+ //# sourceMappingURL=bin.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"bin.js","sourceRoot":"","sources":["../src/bin.ts"],"names":[],"mappings":";AACA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,+FAA+F;AAC/F,MAAM,UAAU,GAAG,SAAS,CAAC;AAE7B,MAAM,KAAK,GAAG,CAAC,OAAO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AChC,OAAO,KAAK,CAAC,8BAA8B,CAAC,MAAM,GAAG,CAAC,yBAAyB,CAAC,IAAI;QACpF,OAAO,KAAK,CAAC,YAAY,CAAC,IAAI;QAC9B,MAAM,CACP,CAAC;AACJ,CAAC;AAED,IAAI,CAAC;IACH,MAAM,MAAM,CAAC,aAAa,CAAC,CAAC;AAC9B,CAAC;AAAC,MAAM,CAAC;IACP,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;IAC/D,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC;AAED,MAAM,MAAM,CAAC,WAAW,CAAC,CAAC"}
@@ -0,0 +1,132 @@
1
+ import type { Flags } from './flags.js';
2
+ /**
3
+ * The machine-readable ABX capability contract.
4
+ *
5
+ * Keep this deliberately smaller than command help: it records product boundaries and the
6
+ * supported combinations agents routinely get wrong. Command-specific syntax still belongs to
7
+ * `abx help <command>`, while deploy planning belongs to `<deploy-command> --dry-run --json`.
8
+ * Human help, the shipped skill, and tests consume this object instead of maintaining competing
9
+ * matrices in prose.
10
+ */
11
+ export declare const ABX_CAPABILITIES: {
12
+ readonly schemaVersion: 4;
13
+ readonly defaultChain: string;
14
+ readonly chains: readonly import("@artblocks/abx-sdk").ChainSupport[];
15
+ /** Compatibility field for consumers that only need selectable chain keys. */
16
+ readonly supportedChains: readonly string[];
17
+ readonly signingLanes: {
18
+ readonly send: {
19
+ readonly flag: "--send";
20
+ readonly summary: "local environment key pays gas";
21
+ readonly supportLevel: "supported";
22
+ };
23
+ readonly sign: {
24
+ readonly flag: "--sign";
25
+ readonly summary: "connected browser wallet pays gas";
26
+ readonly supportLevel: "supported";
27
+ };
28
+ readonly sponsor: {
29
+ readonly flag: "--sponsor";
30
+ readonly summary: "account-bound ABX creator wallet; ABX Services pays eligible gas";
31
+ readonly supportLevel: "supported";
32
+ readonly chainIds: readonly [8453, 84532];
33
+ readonly limits: readonly ["zero value", "network and provider gas policy"];
34
+ };
35
+ readonly unsigned: {
36
+ readonly flag: "--unsigned";
37
+ readonly summary: "print for an external signer";
38
+ readonly supportLevel: "supported";
39
+ };
40
+ };
41
+ readonly deploymentCommands: {
42
+ readonly deploy: {
43
+ readonly artifact: "one static work";
44
+ readonly unique: {
45
+ readonly contract: "OneOfOneImage (ERC-721)";
46
+ readonly inputs: readonly ["--image"];
47
+ };
48
+ readonly edition: {
49
+ readonly contract: "OneOfOneEdition (ERC-1155)";
50
+ readonly selector: "--copies <n|open>";
51
+ readonly summary: "one work × copies; supports on-chain bytes, on-chain JSON with external media, or a resolver";
52
+ readonly supported: readonly ["--onchain-image (hot, wallet, or sponsored signing)", "--onchain-uri", "--backend", "--public-base-url"];
53
+ readonly unsupported: readonly ["--onchain-image with --unsigned"];
54
+ };
55
+ };
56
+ readonly deploySeries: {
57
+ readonly artifact: "a folder of distinct static works";
58
+ readonly unique: {
59
+ readonly contract: "SeriesImage (ERC-721)";
60
+ readonly inputs: readonly ["--dir"];
61
+ };
62
+ readonly edition: {
63
+ readonly contract: "EditionImage (ERC-1155)";
64
+ readonly selector: "--copies <n|open>";
65
+ readonly summary: "N folder items × copies per id; supports on-chain bytes, on-chain JSON with external media, or a resolver";
66
+ readonly supported: readonly ["--onchain-image (hot, wallet, or sponsored signing)", "--onchain-uri", "--backend", "--public-base-url"];
67
+ readonly unsupported: readonly ["--onchain-image with --unsigned"];
68
+ };
69
+ };
70
+ readonly deployCode: {
71
+ readonly artifact: "a program or field renderer whose output depends on token state";
72
+ readonly unique: {
73
+ readonly contract: "SeriesCode (ERC-721)";
74
+ readonly inputs: readonly ["--script", "--code-dir", "--image-renderer", "--attributes-renderer"];
75
+ };
76
+ readonly edition: {
77
+ readonly contract: "EditionCode (ERC-1155)";
78
+ readonly selector: "--copies <n|open>";
79
+ readonly summary: "N generated ids × copies per id; supports scripts, directory builds, dependencies, deterministic per-id off-chain stills, and Solidity image/trait renderers";
80
+ readonly supported: readonly ["--script", "--code-dir", "--dep", "--dep-registry", "--image-renderer", "--attributes-renderer", "--image-base", "--onchain-uri", "--public-base-url"];
81
+ readonly unsupported: readonly ["--no-delegation"];
82
+ };
83
+ };
84
+ };
85
+ readonly customContractDeployment: {
86
+ readonly command: "abx deploy-contract";
87
+ readonly input: "exact EVM creation bytecode or a Foundry artifact plus already ABI-encoded constructor arguments";
88
+ readonly signingLanes: readonly ["--send", "--sign", "--sponsor", "--unsigned"];
89
+ readonly boundaries: readonly ["ABX does not compile, link, audit, or infer constructor types", "zero value under --sponsor"];
90
+ };
91
+ readonly extensionRoutes: readonly [{
92
+ readonly route: "custom minter";
93
+ readonly command: "abx set-minter";
94
+ readonly availableOn: "Series and editions";
95
+ readonly useFor: readonly ["auctions", "allowlists", "raffles", "free claims", "ERC-20 pricing"];
96
+ }, {
97
+ readonly route: "configure hook";
98
+ readonly command: "abx deploy-contract, then abx set-param-hooks --configure";
99
+ readonly availableOn: "SeriesCode and EditionCode";
100
+ readonly useFor: readonly ["validated writes", "monotonic values", "structured collector input"];
101
+ }, {
102
+ readonly route: "transfer hook";
103
+ readonly command: "abx deploy-contract, then abx set-param-hooks --transfer";
104
+ readonly availableOn: "SeriesCode and EditionCode";
105
+ readonly useFor: readonly ["transfer restrictions", "soulbinding", "vesting", "redemption", "escrow"];
106
+ }, {
107
+ readonly route: "augment hook";
108
+ readonly command: "abx deploy-contract, then abx set-param-hooks --augment";
109
+ readonly availableOn: "SeriesCode and EditionCode";
110
+ readonly useFor: readonly ["live derived data", "oracle-fed state", "read-time metadata"];
111
+ }, {
112
+ readonly route: "field renderer";
113
+ readonly command: "abx deploy-contract, then abx deploy-code --image-renderer/--attributes-renderer";
114
+ readonly availableOn: "SeriesCode and EditionCode";
115
+ readonly useFor: readonly ["on-chain SVG images", "on-chain computed traits"];
116
+ }, {
117
+ readonly route: "replace an unlocked script";
118
+ readonly command: "abx replace-script";
119
+ readonly availableOn: "SeriesCode and EditionCode, before `abx lock-script`";
120
+ readonly useFor: readonly ["shipping a fix to a live generative program", "iterating pre-lock without a full redeploy"];
121
+ }];
122
+ readonly deployTimeChoices: readonly ["contract shape and token standard (--copies)", "code-capable versus static contract type", "burnability (--burnable)", "ERC-721C/ERC-1155C enrollment (--721c)"];
123
+ readonly unsupportedToday: readonly ["chains whose support level is disabled", "unsupported chains", "secondary-market listings or an order book", "compiling, linking, or auditing custom Solidity through abx", "retrofitting a deploy-time choice on an existing collection"];
124
+ readonly interpretation: {
125
+ readonly native: "A documented command/flag combination performs the request directly.";
126
+ readonly extension: "A canonical extension seam performs it while the token remains a factory clone.";
127
+ readonly unsupported: "The request is listed under unsupportedToday or is blocked by an irreversible choice already made.";
128
+ readonly unknown: "Do not infer support from absence. Inspect command help, contract type, and this contract; report uncertainty if no route is proven.";
129
+ };
130
+ };
131
+ export declare function cmdCapabilities(flags: Flags): void;
132
+ //# sourceMappingURL=capabilities.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.d.ts","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,KAAK,EAAC,MAAM,YAAY,CAAC;AAEtC;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB;;;;IAI3B,8EAA8E;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6HtE,CAAC;AAEX,wBAAgB,eAAe,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,CAqClD"}
@@ -0,0 +1,175 @@
1
+ import { CHAIN_SUPPORT, DEFAULT_CHAIN_KEY, KNOWN_CHAIN_KEYS } from '@artblocks/abx-sdk';
2
+ /**
3
+ * The machine-readable ABX capability contract.
4
+ *
5
+ * Keep this deliberately smaller than command help: it records product boundaries and the
6
+ * supported combinations agents routinely get wrong. Command-specific syntax still belongs to
7
+ * `abx help <command>`, while deploy planning belongs to `<deploy-command> --dry-run --json`.
8
+ * Human help, the shipped skill, and tests consume this object instead of maintaining competing
9
+ * matrices in prose.
10
+ */
11
+ export const ABX_CAPABILITIES = {
12
+ schemaVersion: 4,
13
+ defaultChain: DEFAULT_CHAIN_KEY,
14
+ chains: CHAIN_SUPPORT,
15
+ /** Compatibility field for consumers that only need selectable chain keys. */
16
+ supportedChains: [...KNOWN_CHAIN_KEYS],
17
+ signingLanes: {
18
+ send: { flag: '--send', summary: 'local environment key pays gas', supportLevel: 'supported' },
19
+ sign: { flag: '--sign', summary: 'connected browser wallet pays gas', supportLevel: 'supported' },
20
+ sponsor: {
21
+ flag: '--sponsor',
22
+ summary: 'account-bound ABX creator wallet; ABX Services pays eligible gas',
23
+ supportLevel: 'supported',
24
+ chainIds: [8_453, 84_532],
25
+ limits: ['zero value', 'network and provider gas policy'],
26
+ },
27
+ unsigned: { flag: '--unsigned', summary: 'print for an external signer', supportLevel: 'supported' },
28
+ },
29
+ deploymentCommands: {
30
+ deploy: {
31
+ artifact: 'one static work',
32
+ unique: {
33
+ contract: 'OneOfOneImage (ERC-721)',
34
+ inputs: ['--image'],
35
+ },
36
+ edition: {
37
+ contract: 'OneOfOneEdition (ERC-1155)',
38
+ selector: '--copies <n|open>',
39
+ summary: 'one work × copies; supports on-chain bytes, on-chain JSON with external media, or a resolver',
40
+ supported: ['--onchain-image (hot, wallet, or sponsored signing)', '--onchain-uri', '--backend', '--public-base-url'],
41
+ unsupported: ['--onchain-image with --unsigned'],
42
+ },
43
+ },
44
+ deploySeries: {
45
+ artifact: 'a folder of distinct static works',
46
+ unique: {
47
+ contract: 'SeriesImage (ERC-721)',
48
+ inputs: ['--dir'],
49
+ },
50
+ edition: {
51
+ contract: 'EditionImage (ERC-1155)',
52
+ selector: '--copies <n|open>',
53
+ summary: 'N folder items × copies per id; supports on-chain bytes, on-chain JSON with external media, or a resolver',
54
+ supported: ['--onchain-image (hot, wallet, or sponsored signing)', '--onchain-uri', '--backend', '--public-base-url'],
55
+ unsupported: ['--onchain-image with --unsigned'],
56
+ },
57
+ },
58
+ deployCode: {
59
+ artifact: 'a program or field renderer whose output depends on token state',
60
+ unique: {
61
+ contract: 'SeriesCode (ERC-721)',
62
+ inputs: ['--script', '--code-dir', '--image-renderer', '--attributes-renderer'],
63
+ },
64
+ edition: {
65
+ contract: 'EditionCode (ERC-1155)',
66
+ selector: '--copies <n|open>',
67
+ summary: 'N generated ids × copies per id; supports scripts, directory builds, dependencies, deterministic per-id off-chain stills, and Solidity image/trait renderers',
68
+ supported: ['--script', '--code-dir', '--dep', '--dep-registry', '--image-renderer', '--attributes-renderer', '--image-base', '--onchain-uri', '--public-base-url'],
69
+ // `--resume` isn't listed in `supported`/`unsupported` at all (neither lane lists it — it's a
70
+ // REPAIR verb against an EXISTING contract, not a deploy-time flag): `abx deploy-code --resume
71
+ // <address>` now diffs an EditionCode target's per-id mint shortfall exactly as it always has
72
+ // for a 721 SeriesCode target (see resume.ts's `planEditionResume`).
73
+ unsupported: ['--no-delegation'],
74
+ },
75
+ },
76
+ },
77
+ customContractDeployment: {
78
+ command: 'abx deploy-contract',
79
+ input: 'exact EVM creation bytecode or a Foundry artifact plus already ABI-encoded constructor arguments',
80
+ signingLanes: ['--send', '--sign', '--sponsor', '--unsigned'],
81
+ boundaries: ['ABX does not compile, link, audit, or infer constructor types', 'zero value under --sponsor'],
82
+ },
83
+ extensionRoutes: [
84
+ {
85
+ route: 'custom minter',
86
+ command: 'abx set-minter',
87
+ availableOn: 'Series and editions',
88
+ useFor: ['auctions', 'allowlists', 'raffles', 'free claims', 'ERC-20 pricing'],
89
+ },
90
+ {
91
+ route: 'configure hook',
92
+ command: 'abx deploy-contract, then abx set-param-hooks --configure',
93
+ availableOn: 'SeriesCode and EditionCode',
94
+ useFor: ['validated writes', 'monotonic values', 'structured collector input'],
95
+ },
96
+ {
97
+ route: 'transfer hook',
98
+ command: 'abx deploy-contract, then abx set-param-hooks --transfer',
99
+ availableOn: 'SeriesCode and EditionCode',
100
+ useFor: ['transfer restrictions', 'soulbinding', 'vesting', 'redemption', 'escrow'],
101
+ },
102
+ {
103
+ route: 'augment hook',
104
+ command: 'abx deploy-contract, then abx set-param-hooks --augment',
105
+ availableOn: 'SeriesCode and EditionCode',
106
+ useFor: ['live derived data', 'oracle-fed state', 'read-time metadata'],
107
+ },
108
+ {
109
+ route: 'field renderer',
110
+ command: 'abx deploy-contract, then abx deploy-code --image-renderer/--attributes-renderer',
111
+ availableOn: 'SeriesCode and EditionCode',
112
+ useFor: ['on-chain SVG images', 'on-chain computed traits'],
113
+ },
114
+ {
115
+ route: 'replace an unlocked script',
116
+ command: 'abx replace-script',
117
+ availableOn: 'SeriesCode and EditionCode, before `abx lock-script`',
118
+ useFor: ['shipping a fix to a live generative program', 'iterating pre-lock without a full redeploy'],
119
+ },
120
+ ],
121
+ deployTimeChoices: [
122
+ 'contract shape and token standard (--copies)',
123
+ 'code-capable versus static contract type',
124
+ 'burnability (--burnable)',
125
+ 'ERC-721C/ERC-1155C enrollment (--721c)',
126
+ ],
127
+ unsupportedToday: [
128
+ 'chains whose support level is disabled',
129
+ 'unsupported chains',
130
+ 'secondary-market listings or an order book',
131
+ 'compiling, linking, or auditing custom Solidity through abx',
132
+ 'retrofitting a deploy-time choice on an existing collection',
133
+ ],
134
+ interpretation: {
135
+ native: 'A documented command/flag combination performs the request directly.',
136
+ extension: 'A canonical extension seam performs it while the token remains a factory clone.',
137
+ unsupported: 'The request is listed under unsupportedToday or is blocked by an irreversible choice already made.',
138
+ unknown: 'Do not infer support from absence. Inspect command help, contract type, and this contract; report uncertainty if no route is proven.',
139
+ },
140
+ };
141
+ export function cmdCapabilities(flags) {
142
+ if (flags.json !== undefined) {
143
+ console.log(JSON.stringify(ABX_CAPABILITIES, null, 2));
144
+ return;
145
+ }
146
+ console.log(`ABX capability contract v${ABX_CAPABILITIES.schemaVersion}\n`);
147
+ console.log(`Default chain: ${ABX_CAPABILITIES.defaultChain}`);
148
+ console.log('Networks:');
149
+ for (const chain of ABX_CAPABILITIES.chains) {
150
+ console.log(` ${chain.key} (${chain.chainId}): ${chain.environment} · ${chain.supportLevel} · contracts ${chain.contractStatus}`);
151
+ }
152
+ console.log('Signing lanes:');
153
+ for (const lane of Object.values(ABX_CAPABILITIES.signingLanes)) {
154
+ console.log(` ${lane.flag}: ${lane.summary} · ${lane.supportLevel}`);
155
+ }
156
+ console.log('Native deployment lanes:');
157
+ for (const [name, lane] of Object.entries(ABX_CAPABILITIES.deploymentCommands)) {
158
+ console.log(` ${name}: ${lane.artifact}`);
159
+ console.log(` unique ${lane.unique.contract} — ${lane.unique.inputs.join(' | ')}`);
160
+ console.log(` edition ${lane.edition.contract} — ${lane.edition.summary}`);
161
+ if (lane.edition.unsupported.length)
162
+ console.log(` limits ${lane.edition.unsupported.join(' · ')}`);
163
+ }
164
+ console.log(` deploy-contract: ${ABX_CAPABILITIES.customContractDeployment.input}`);
165
+ console.log('\nCanonical extension routes:');
166
+ for (const seam of ABX_CAPABILITIES.extensionRoutes) {
167
+ console.log(` ${seam.route}: ${seam.availableOn} — ${seam.useFor.join(', ')}`);
168
+ }
169
+ console.log('\nUnsupported today:');
170
+ for (const item of ABX_CAPABILITIES.unsupportedToday)
171
+ console.log(` - ${item}`);
172
+ console.log('\nUse `abx capabilities --json` for the stable machine-readable form,');
173
+ console.log('`abx help <command>` for current flags, and `<deploy-command> --dry-run --json` for a concrete plan.');
174
+ }
175
+ //# sourceMappingURL=capabilities.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"capabilities.js","sourceRoot":"","sources":["../src/capabilities.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAE,iBAAiB,EAAE,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AAGtF;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,aAAa,EAAE,CAAC;IAChB,YAAY,EAAE,iBAAiB;IAC/B,MAAM,EAAE,aAAa;IACrB,8EA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,CAAC,eAAe,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;IAC1G,CAAC;IACD,OAAO,CAAC,GAAG,CAAC,sBAAsB,gBAAgB,CAAC,wBAAwB,CAAC,KAAK,EAAE,CAAC,CAAC;IAErF,OAAO,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;IAC7C,KAAK,MAAM,IAAI,IAAI,gBAAgB,CAAC,eAAe,EAAE,CAAC;QACpD,OAAO,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,KAAK,KAAK,IAAI,CAAC,WAAW,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAClF,CAAC;IAED,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC,CAAC;IACpC,KAAK,MAAM,IAAI,IAAI,gBAAgB,CAAC,gBAAgB;QAAE,OAAO,CAAC,GAAG,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC;IAEjF,OAAO,CAAC,GAAG,CAAC,uEAAuE,CAAC,CAAC;IACrF,OAAO,CAAC,GAAG,CAAC,sGAAsG,CAAC,CAAC;AACtH,CAAC"}
@@ -0,0 +1,54 @@
1
+ import { type Flags } from '../flags.js';
2
+ export interface DeviceLoginDeps {
3
+ fetchImpl?: typeof fetch;
4
+ sleep?: (ms: number) => Promise<void>;
5
+ now?: () => number;
6
+ openBrowser?: (url: string) => boolean;
7
+ line?: (message: string) => void;
8
+ warning?: (message: string) => void;
9
+ }
10
+ export interface DeviceLoginOptions {
11
+ baseUrl: string;
12
+ envVar: string;
13
+ envPath: string;
14
+ force?: boolean;
15
+ noOpen?: boolean;
16
+ }
17
+ export interface OAuthLogoutOptions {
18
+ baseUrl: string;
19
+ envVar: string;
20
+ envPath: string;
21
+ token?: string;
22
+ }
23
+ export interface OAuthLogoutDeps {
24
+ fetchImpl?: typeof fetch;
25
+ }
26
+ export type OAuthLogoutResult = {
27
+ status: 'absent';
28
+ } | {
29
+ status: 'revoked';
30
+ local: 'removed' | 'external' | 'different';
31
+ };
32
+ /** Refuse the two silent secret-exposure modes: replacing a tracked file, or creating an unignored
33
+ * .env inside a Git worktree. A non-Git directory is fine. */
34
+ export declare function assertPrivateEnvPath(envPath: string): void;
35
+ /** Bearer-token grammar (RFC 6750) — the default value shape {@link saveEnvSecret} accepts. Exported
36
+ * so a caller writing something differently-shaped (a URL, say) can pass its own `valuePattern`
37
+ * instead of fighting this one. */
38
+ export declare const BEARER_TOKEN_PATTERN: RegExp;
39
+ export declare function saveEnvSecret(envPath: string, key: string, value: string, valuePattern?: RegExp): void;
40
+ /** Validate and replace several env values with one atomic rename. A credential pair must never
41
+ * land half-updated because the process stopped between two individually-atomic writes. */
42
+ export declare function saveEnvSecrets(envPath: string, entries: Array<{
43
+ key: string;
44
+ value: string;
45
+ valuePattern?: RegExp;
46
+ }>): void;
47
+ /** Standards-only core, dependency-injected for a no-secret-output regression test. */
48
+ export declare function deviceLogin(options: DeviceLoginOptions, deps?: DeviceLoginDeps): Promise<void>;
49
+ /** RFC 7009 logout: revoke remotely first, then remove the matching local assignment. Keeping the
50
+ * credential when discovery or revocation fails preserves the user's ability to retry safely. */
51
+ export declare function oauthLogout(options: OAuthLogoutOptions, deps?: OAuthLogoutDeps): Promise<OAuthLogoutResult>;
52
+ export declare function cmdAuth(args: string[], flags: Flags): Promise<void>;
53
+ export declare const AUTH_HELP: string;
54
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../src/commands/auth.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,KAAK,KAAK,EAAkB,MAAM,aAAa,CAAA;AA8BxD,MAAM,WAAW,eAAe;IAC9B,SAAS,CAAC,EAAE,OAAO,KAAK,CAAA;IACxB,KAAK,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAA;IACrC,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