@whop/cli 0.0.3 → 0.0.5
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/README.md +25 -2
- package/dist/api-NBD5G47Q.js +16 -0
- package/dist/api-NBD5G47Q.js.map +1 -0
- package/dist/chunk-O66TV7ZF.js +30364 -0
- package/dist/chunk-O66TV7ZF.js.map +1 -0
- package/dist/index.js +1800 -20551
- package/dist/index.js.map +1 -1
- package/package.json +7 -5
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/nodes/identity.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/visit.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/doc/directives.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/doc/anchors.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/doc/applyReviver.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/nodes/toJS.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/nodes/Node.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/nodes/Alias.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/nodes/Scalar.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/doc/createNode.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/nodes/Collection.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/stringify/stringifyComment.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/stringify/foldFlowLines.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/stringify/stringifyString.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/stringify/stringify.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/stringify/stringifyPair.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/log.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/yaml-1.1/merge.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/nodes/addPairToJSMap.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/nodes/Pair.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/stringify/stringifyCollection.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/nodes/YAMLMap.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/common/map.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/nodes/YAMLSeq.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/common/seq.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/common/string.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/common/null.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/core/bool.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/stringify/stringifyNumber.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/core/float.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/core/int.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/core/schema.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/json/schema.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/yaml-1.1/binary.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/yaml-1.1/pairs.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/yaml-1.1/omap.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/yaml-1.1/bool.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/yaml-1.1/float.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/yaml-1.1/int.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/yaml-1.1/set.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/yaml-1.1/timestamp.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/yaml-1.1/schema.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/tags.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/schema/Schema.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/stringify/stringifyDocument.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/doc/Document.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/errors.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/resolve-props.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/util-contains-newline.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/util-flow-indent-check.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/util-map-includes.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/resolve-block-map.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/resolve-block-seq.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/resolve-end.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/resolve-flow-collection.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/compose-collection.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/resolve-block-scalar.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/resolve-flow-scalar.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/compose-scalar.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/util-empty-scalar-position.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/compose-node.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/compose-doc.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/compose/composer.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/parse/cst-scalar.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/parse/cst-stringify.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/parse/cst-visit.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/parse/cst.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/parse/lexer.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/parse/line-counter.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/parse/parser.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/public-api.js","../../../node_modules/.pnpm/yaml@2.8.0/node_modules/yaml/dist/index.js","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/Cli.ts","../../../node_modules/.pnpm/tokenx@1.3.0/node_modules/tokenx/dist/index.mjs","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/Completions.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/Errors.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/Fetch.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/Filter.ts","../../../node_modules/.pnpm/@toon-format+toon@2.3.0/node_modules/@toon-format/toon/dist/index.mjs","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/Formatter.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/internal/helpers.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/Parser.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/internal/command.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/Help.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/internal/pm.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/Schema.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/Mcp.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/internal/dereference.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/Openapi.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/Skill.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/SyncMcp.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/SyncSkills.ts","../../../node_modules/.pnpm/incur@https+++codeload.github.com+whopio+incur+tar.gz+ea62f88/node_modules/incur/src/internal/agents.ts","../src/api/native-spec.json","../src/auth/client.ts","../src/auth/config.ts","../src/auth/types.ts","../src/auth/keyring.ts","../src/auth/oauth.ts","../src/auth/callback-server.ts","../src/auth/callback-html.ts","../src/auth/prompts.ts","../src/auth/scopes.ts","../src/auth/profiles.ts","../src/api/index.ts","../src/api/groups.json","../package.json","../src/lib/renderer.ts","../src/auth/commands.ts","../src/cli.ts","../src/index.ts"],"sourcesContent":["'use strict';\n\nconst ALIAS = Symbol.for('yaml.alias');\nconst DOC = Symbol.for('yaml.document');\nconst MAP = Symbol.for('yaml.map');\nconst PAIR = Symbol.for('yaml.pair');\nconst SCALAR = Symbol.for('yaml.scalar');\nconst SEQ = Symbol.for('yaml.seq');\nconst NODE_TYPE = Symbol.for('yaml.node.type');\nconst isAlias = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === ALIAS;\nconst isDocument = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === DOC;\nconst isMap = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === MAP;\nconst isPair = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === PAIR;\nconst isScalar = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SCALAR;\nconst isSeq = (node) => !!node && typeof node === 'object' && node[NODE_TYPE] === SEQ;\nfunction isCollection(node) {\n if (node && typeof node === 'object')\n switch (node[NODE_TYPE]) {\n case MAP:\n case SEQ:\n return true;\n }\n return false;\n}\nfunction isNode(node) {\n if (node && typeof node === 'object')\n switch (node[NODE_TYPE]) {\n case ALIAS:\n case MAP:\n case SCALAR:\n case SEQ:\n return true;\n }\n return false;\n}\nconst hasAnchor = (node) => (isScalar(node) || isCollection(node)) && !!node.anchor;\n\nexports.ALIAS = ALIAS;\nexports.DOC = DOC;\nexports.MAP = MAP;\nexports.NODE_TYPE = NODE_TYPE;\nexports.PAIR = PAIR;\nexports.SCALAR = SCALAR;\nexports.SEQ = SEQ;\nexports.hasAnchor = hasAnchor;\nexports.isAlias = isAlias;\nexports.isCollection = isCollection;\nexports.isDocument = isDocument;\nexports.isMap = isMap;\nexports.isNode = isNode;\nexports.isPair = isPair;\nexports.isScalar = isScalar;\nexports.isSeq = isSeq;\n","'use strict';\n\nvar identity = require('./nodes/identity.js');\n\nconst BREAK = Symbol('break visit');\nconst SKIP = Symbol('skip children');\nconst REMOVE = Symbol('remove node');\n/**\n * Apply a visitor to an AST node or document.\n *\n * Walks through the tree (depth-first) starting from `node`, calling a\n * `visitor` function with three arguments:\n * - `key`: For sequence values and map `Pair`, the node's index in the\n * collection. Within a `Pair`, `'key'` or `'value'`, correspondingly.\n * `null` for the root node.\n * - `node`: The current node.\n * - `path`: The ancestry of the current node.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this node, continue with next\n * sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current node, then continue with the next one\n * - `Node`: Replace the current node, then continue by visiting it\n * - `number`: While iterating the items of a sequence or map, set the index\n * of the next step. This is useful especially if the index of the current\n * node has changed.\n *\n * If `visitor` is a single function, it will be called with all values\n * encountered in the tree, including e.g. `null` values. Alternatively,\n * separate visitor functions may be defined for each `Map`, `Pair`, `Seq`,\n * `Alias` and `Scalar` node. To define the same visitor function for more than\n * one node type, use the `Collection` (map and seq), `Value` (map, seq & scalar)\n * and `Node` (alias, map, seq & scalar) targets. Of all these, only the most\n * specific defined one will be used for each node.\n */\nfunction visit(node, visitor) {\n const visitor_ = initVisitor(visitor);\n if (identity.isDocument(node)) {\n const cd = visit_(null, node.contents, visitor_, Object.freeze([node]));\n if (cd === REMOVE)\n node.contents = null;\n }\n else\n visit_(null, node, visitor_, Object.freeze([]));\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisit.BREAK = BREAK;\n/** Do not visit the children of the current node */\nvisit.SKIP = SKIP;\n/** Remove the current node */\nvisit.REMOVE = REMOVE;\nfunction visit_(key, node, visitor, path) {\n const ctrl = callVisitor(key, node, visitor, path);\n if (identity.isNode(ctrl) || identity.isPair(ctrl)) {\n replaceNode(key, path, ctrl);\n return visit_(key, ctrl, visitor, path);\n }\n if (typeof ctrl !== 'symbol') {\n if (identity.isCollection(node)) {\n path = Object.freeze(path.concat(node));\n for (let i = 0; i < node.items.length; ++i) {\n const ci = visit_(i, node.items[i], visitor, path);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n node.items.splice(i, 1);\n i -= 1;\n }\n }\n }\n else if (identity.isPair(node)) {\n path = Object.freeze(path.concat(node));\n const ck = visit_('key', node.key, visitor, path);\n if (ck === BREAK)\n return BREAK;\n else if (ck === REMOVE)\n node.key = null;\n const cv = visit_('value', node.value, visitor, path);\n if (cv === BREAK)\n return BREAK;\n else if (cv === REMOVE)\n node.value = null;\n }\n }\n return ctrl;\n}\n/**\n * Apply an async visitor to an AST node or document.\n *\n * Walks through the tree (depth-first) starting from `node`, calling a\n * `visitor` function with three arguments:\n * - `key`: For sequence values and map `Pair`, the node's index in the\n * collection. Within a `Pair`, `'key'` or `'value'`, correspondingly.\n * `null` for the root node.\n * - `node`: The current node.\n * - `path`: The ancestry of the current node.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `Promise`: Must resolve to one of the following values\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this node, continue with next\n * sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current node, then continue with the next one\n * - `Node`: Replace the current node, then continue by visiting it\n * - `number`: While iterating the items of a sequence or map, set the index\n * of the next step. This is useful especially if the index of the current\n * node has changed.\n *\n * If `visitor` is a single function, it will be called with all values\n * encountered in the tree, including e.g. `null` values. Alternatively,\n * separate visitor functions may be defined for each `Map`, `Pair`, `Seq`,\n * `Alias` and `Scalar` node. To define the same visitor function for more than\n * one node type, use the `Collection` (map and seq), `Value` (map, seq & scalar)\n * and `Node` (alias, map, seq & scalar) targets. Of all these, only the most\n * specific defined one will be used for each node.\n */\nasync function visitAsync(node, visitor) {\n const visitor_ = initVisitor(visitor);\n if (identity.isDocument(node)) {\n const cd = await visitAsync_(null, node.contents, visitor_, Object.freeze([node]));\n if (cd === REMOVE)\n node.contents = null;\n }\n else\n await visitAsync_(null, node, visitor_, Object.freeze([]));\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisitAsync.BREAK = BREAK;\n/** Do not visit the children of the current node */\nvisitAsync.SKIP = SKIP;\n/** Remove the current node */\nvisitAsync.REMOVE = REMOVE;\nasync function visitAsync_(key, node, visitor, path) {\n const ctrl = await callVisitor(key, node, visitor, path);\n if (identity.isNode(ctrl) || identity.isPair(ctrl)) {\n replaceNode(key, path, ctrl);\n return visitAsync_(key, ctrl, visitor, path);\n }\n if (typeof ctrl !== 'symbol') {\n if (identity.isCollection(node)) {\n path = Object.freeze(path.concat(node));\n for (let i = 0; i < node.items.length; ++i) {\n const ci = await visitAsync_(i, node.items[i], visitor, path);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n node.items.splice(i, 1);\n i -= 1;\n }\n }\n }\n else if (identity.isPair(node)) {\n path = Object.freeze(path.concat(node));\n const ck = await visitAsync_('key', node.key, visitor, path);\n if (ck === BREAK)\n return BREAK;\n else if (ck === REMOVE)\n node.key = null;\n const cv = await visitAsync_('value', node.value, visitor, path);\n if (cv === BREAK)\n return BREAK;\n else if (cv === REMOVE)\n node.value = null;\n }\n }\n return ctrl;\n}\nfunction initVisitor(visitor) {\n if (typeof visitor === 'object' &&\n (visitor.Collection || visitor.Node || visitor.Value)) {\n return Object.assign({\n Alias: visitor.Node,\n Map: visitor.Node,\n Scalar: visitor.Node,\n Seq: visitor.Node\n }, visitor.Value && {\n Map: visitor.Value,\n Scalar: visitor.Value,\n Seq: visitor.Value\n }, visitor.Collection && {\n Map: visitor.Collection,\n Seq: visitor.Collection\n }, visitor);\n }\n return visitor;\n}\nfunction callVisitor(key, node, visitor, path) {\n if (typeof visitor === 'function')\n return visitor(key, node, path);\n if (identity.isMap(node))\n return visitor.Map?.(key, node, path);\n if (identity.isSeq(node))\n return visitor.Seq?.(key, node, path);\n if (identity.isPair(node))\n return visitor.Pair?.(key, node, path);\n if (identity.isScalar(node))\n return visitor.Scalar?.(key, node, path);\n if (identity.isAlias(node))\n return visitor.Alias?.(key, node, path);\n return undefined;\n}\nfunction replaceNode(key, path, node) {\n const parent = path[path.length - 1];\n if (identity.isCollection(parent)) {\n parent.items[key] = node;\n }\n else if (identity.isPair(parent)) {\n if (key === 'key')\n parent.key = node;\n else\n parent.value = node;\n }\n else if (identity.isDocument(parent)) {\n parent.contents = node;\n }\n else {\n const pt = identity.isAlias(parent) ? 'alias' : 'scalar';\n throw new Error(`Cannot replace node with ${pt} parent`);\n }\n}\n\nexports.visit = visit;\nexports.visitAsync = visitAsync;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar visit = require('../visit.js');\n\nconst escapeChars = {\n '!': '%21',\n ',': '%2C',\n '[': '%5B',\n ']': '%5D',\n '{': '%7B',\n '}': '%7D'\n};\nconst escapeTagName = (tn) => tn.replace(/[!,[\\]{}]/g, ch => escapeChars[ch]);\nclass Directives {\n constructor(yaml, tags) {\n /**\n * The directives-end/doc-start marker `---`. If `null`, a marker may still be\n * included in the document's stringified representation.\n */\n this.docStart = null;\n /** The doc-end marker `...`. */\n this.docEnd = false;\n this.yaml = Object.assign({}, Directives.defaultYaml, yaml);\n this.tags = Object.assign({}, Directives.defaultTags, tags);\n }\n clone() {\n const copy = new Directives(this.yaml, this.tags);\n copy.docStart = this.docStart;\n return copy;\n }\n /**\n * During parsing, get a Directives instance for the current document and\n * update the stream state according to the current version's spec.\n */\n atDocument() {\n const res = new Directives(this.yaml, this.tags);\n switch (this.yaml.version) {\n case '1.1':\n this.atNextDocument = true;\n break;\n case '1.2':\n this.atNextDocument = false;\n this.yaml = {\n explicit: Directives.defaultYaml.explicit,\n version: '1.2'\n };\n this.tags = Object.assign({}, Directives.defaultTags);\n break;\n }\n return res;\n }\n /**\n * @param onError - May be called even if the action was successful\n * @returns `true` on success\n */\n add(line, onError) {\n if (this.atNextDocument) {\n this.yaml = { explicit: Directives.defaultYaml.explicit, version: '1.1' };\n this.tags = Object.assign({}, Directives.defaultTags);\n this.atNextDocument = false;\n }\n const parts = line.trim().split(/[ \\t]+/);\n const name = parts.shift();\n switch (name) {\n case '%TAG': {\n if (parts.length !== 2) {\n onError(0, '%TAG directive should contain exactly two parts');\n if (parts.length < 2)\n return false;\n }\n const [handle, prefix] = parts;\n this.tags[handle] = prefix;\n return true;\n }\n case '%YAML': {\n this.yaml.explicit = true;\n if (parts.length !== 1) {\n onError(0, '%YAML directive should contain exactly one part');\n return false;\n }\n const [version] = parts;\n if (version === '1.1' || version === '1.2') {\n this.yaml.version = version;\n return true;\n }\n else {\n const isValid = /^\\d+\\.\\d+$/.test(version);\n onError(6, `Unsupported YAML version ${version}`, isValid);\n return false;\n }\n }\n default:\n onError(0, `Unknown directive ${name}`, true);\n return false;\n }\n }\n /**\n * Resolves a tag, matching handles to those defined in %TAG directives.\n *\n * @returns Resolved tag, which may also be the non-specific tag `'!'` or a\n * `'!local'` tag, or `null` if unresolvable.\n */\n tagName(source, onError) {\n if (source === '!')\n return '!'; // non-specific tag\n if (source[0] !== '!') {\n onError(`Not a valid tag: ${source}`);\n return null;\n }\n if (source[1] === '<') {\n const verbatim = source.slice(2, -1);\n if (verbatim === '!' || verbatim === '!!') {\n onError(`Verbatim tags aren't resolved, so ${source} is invalid.`);\n return null;\n }\n if (source[source.length - 1] !== '>')\n onError('Verbatim tags must end with a >');\n return verbatim;\n }\n const [, handle, suffix] = source.match(/^(.*!)([^!]*)$/s);\n if (!suffix)\n onError(`The ${source} tag has no suffix`);\n const prefix = this.tags[handle];\n if (prefix) {\n try {\n return prefix + decodeURIComponent(suffix);\n }\n catch (error) {\n onError(String(error));\n return null;\n }\n }\n if (handle === '!')\n return source; // local tag\n onError(`Could not resolve tag: ${source}`);\n return null;\n }\n /**\n * Given a fully resolved tag, returns its printable string form,\n * taking into account current tag prefixes and defaults.\n */\n tagString(tag) {\n for (const [handle, prefix] of Object.entries(this.tags)) {\n if (tag.startsWith(prefix))\n return handle + escapeTagName(tag.substring(prefix.length));\n }\n return tag[0] === '!' ? tag : `!<${tag}>`;\n }\n toString(doc) {\n const lines = this.yaml.explicit\n ? [`%YAML ${this.yaml.version || '1.2'}`]\n : [];\n const tagEntries = Object.entries(this.tags);\n let tagNames;\n if (doc && tagEntries.length > 0 && identity.isNode(doc.contents)) {\n const tags = {};\n visit.visit(doc.contents, (_key, node) => {\n if (identity.isNode(node) && node.tag)\n tags[node.tag] = true;\n });\n tagNames = Object.keys(tags);\n }\n else\n tagNames = [];\n for (const [handle, prefix] of tagEntries) {\n if (handle === '!!' && prefix === 'tag:yaml.org,2002:')\n continue;\n if (!doc || tagNames.some(tn => tn.startsWith(prefix)))\n lines.push(`%TAG ${handle} ${prefix}`);\n }\n return lines.join('\\n');\n }\n}\nDirectives.defaultYaml = { explicit: false, version: '1.2' };\nDirectives.defaultTags = { '!!': 'tag:yaml.org,2002:' };\n\nexports.Directives = Directives;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar visit = require('../visit.js');\n\n/**\n * Verify that the input string is a valid anchor.\n *\n * Will throw on errors.\n */\nfunction anchorIsValid(anchor) {\n if (/[\\x00-\\x19\\s,[\\]{}]/.test(anchor)) {\n const sa = JSON.stringify(anchor);\n const msg = `Anchor must not contain whitespace or control characters: ${sa}`;\n throw new Error(msg);\n }\n return true;\n}\nfunction anchorNames(root) {\n const anchors = new Set();\n visit.visit(root, {\n Value(_key, node) {\n if (node.anchor)\n anchors.add(node.anchor);\n }\n });\n return anchors;\n}\n/** Find a new anchor name with the given `prefix` and a one-indexed suffix. */\nfunction findNewAnchor(prefix, exclude) {\n for (let i = 1; true; ++i) {\n const name = `${prefix}${i}`;\n if (!exclude.has(name))\n return name;\n }\n}\nfunction createNodeAnchors(doc, prefix) {\n const aliasObjects = [];\n const sourceObjects = new Map();\n let prevAnchors = null;\n return {\n onAnchor: (source) => {\n aliasObjects.push(source);\n prevAnchors ?? (prevAnchors = anchorNames(doc));\n const anchor = findNewAnchor(prefix, prevAnchors);\n prevAnchors.add(anchor);\n return anchor;\n },\n /**\n * With circular references, the source node is only resolved after all\n * of its child nodes are. This is why anchors are set only after all of\n * the nodes have been created.\n */\n setAnchors: () => {\n for (const source of aliasObjects) {\n const ref = sourceObjects.get(source);\n if (typeof ref === 'object' &&\n ref.anchor &&\n (identity.isScalar(ref.node) || identity.isCollection(ref.node))) {\n ref.node.anchor = ref.anchor;\n }\n else {\n const error = new Error('Failed to resolve repeated object (this should not happen)');\n error.source = source;\n throw error;\n }\n }\n },\n sourceObjects\n };\n}\n\nexports.anchorIsValid = anchorIsValid;\nexports.anchorNames = anchorNames;\nexports.createNodeAnchors = createNodeAnchors;\nexports.findNewAnchor = findNewAnchor;\n","'use strict';\n\n/**\n * Applies the JSON.parse reviver algorithm as defined in the ECMA-262 spec,\n * in section 24.5.1.1 \"Runtime Semantics: InternalizeJSONProperty\" of the\n * 2021 edition: https://tc39.es/ecma262/#sec-json.parse\n *\n * Includes extensions for handling Map and Set objects.\n */\nfunction applyReviver(reviver, obj, key, val) {\n if (val && typeof val === 'object') {\n if (Array.isArray(val)) {\n for (let i = 0, len = val.length; i < len; ++i) {\n const v0 = val[i];\n const v1 = applyReviver(reviver, val, String(i), v0);\n // eslint-disable-next-line @typescript-eslint/no-array-delete\n if (v1 === undefined)\n delete val[i];\n else if (v1 !== v0)\n val[i] = v1;\n }\n }\n else if (val instanceof Map) {\n for (const k of Array.from(val.keys())) {\n const v0 = val.get(k);\n const v1 = applyReviver(reviver, val, k, v0);\n if (v1 === undefined)\n val.delete(k);\n else if (v1 !== v0)\n val.set(k, v1);\n }\n }\n else if (val instanceof Set) {\n for (const v0 of Array.from(val)) {\n const v1 = applyReviver(reviver, val, v0, v0);\n if (v1 === undefined)\n val.delete(v0);\n else if (v1 !== v0) {\n val.delete(v0);\n val.add(v1);\n }\n }\n }\n else {\n for (const [k, v0] of Object.entries(val)) {\n const v1 = applyReviver(reviver, val, k, v0);\n if (v1 === undefined)\n delete val[k];\n else if (v1 !== v0)\n val[k] = v1;\n }\n }\n }\n return reviver.call(obj, key, val);\n}\n\nexports.applyReviver = applyReviver;\n","'use strict';\n\nvar identity = require('./identity.js');\n\n/**\n * Recursively convert any node or its contents to native JavaScript\n *\n * @param value - The input value\n * @param arg - If `value` defines a `toJSON()` method, use this\n * as its first argument\n * @param ctx - Conversion context, originally set in Document#toJS(). If\n * `{ keep: true }` is not set, output should be suitable for JSON\n * stringification.\n */\nfunction toJS(value, arg, ctx) {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-return\n if (Array.isArray(value))\n return value.map((v, i) => toJS(v, String(i), ctx));\n if (value && typeof value.toJSON === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n if (!ctx || !identity.hasAnchor(value))\n return value.toJSON(arg, ctx);\n const data = { aliasCount: 0, count: 1, res: undefined };\n ctx.anchors.set(value, data);\n ctx.onCreate = res => {\n data.res = res;\n delete ctx.onCreate;\n };\n const res = value.toJSON(arg, ctx);\n if (ctx.onCreate)\n ctx.onCreate(res);\n return res;\n }\n if (typeof value === 'bigint' && !ctx?.keep)\n return Number(value);\n return value;\n}\n\nexports.toJS = toJS;\n","'use strict';\n\nvar applyReviver = require('../doc/applyReviver.js');\nvar identity = require('./identity.js');\nvar toJS = require('./toJS.js');\n\nclass NodeBase {\n constructor(type) {\n Object.defineProperty(this, identity.NODE_TYPE, { value: type });\n }\n /** Create a copy of this node. */\n clone() {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /** A plain JavaScript representation of this node. */\n toJS(doc, { mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {\n if (!identity.isDocument(doc))\n throw new TypeError('A document argument is required');\n const ctx = {\n anchors: new Map(),\n doc,\n keep: true,\n mapAsMap: mapAsMap === true,\n mapKeyWarned: false,\n maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100\n };\n const res = toJS.toJS(this, '', ctx);\n if (typeof onAnchor === 'function')\n for (const { count, res } of ctx.anchors.values())\n onAnchor(res, count);\n return typeof reviver === 'function'\n ? applyReviver.applyReviver(reviver, { '': res }, '', res)\n : res;\n }\n}\n\nexports.NodeBase = NodeBase;\n","'use strict';\n\nvar anchors = require('../doc/anchors.js');\nvar visit = require('../visit.js');\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\nvar toJS = require('./toJS.js');\n\nclass Alias extends Node.NodeBase {\n constructor(source) {\n super(identity.ALIAS);\n this.source = source;\n Object.defineProperty(this, 'tag', {\n set() {\n throw new Error('Alias nodes cannot have tags');\n }\n });\n }\n /**\n * Resolve the value of this alias within `doc`, finding the last\n * instance of the `source` anchor before this node.\n */\n resolve(doc, ctx) {\n let nodes;\n if (ctx?.aliasResolveCache) {\n nodes = ctx.aliasResolveCache;\n }\n else {\n nodes = [];\n visit.visit(doc, {\n Node: (_key, node) => {\n if (identity.isAlias(node) || identity.hasAnchor(node))\n nodes.push(node);\n }\n });\n if (ctx)\n ctx.aliasResolveCache = nodes;\n }\n let found = undefined;\n for (const node of nodes) {\n if (node === this)\n break;\n if (node.anchor === this.source)\n found = node;\n }\n return found;\n }\n toJSON(_arg, ctx) {\n if (!ctx)\n return { source: this.source };\n const { anchors, doc, maxAliasCount } = ctx;\n const source = this.resolve(doc, ctx);\n if (!source) {\n const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;\n throw new ReferenceError(msg);\n }\n let data = anchors.get(source);\n if (!data) {\n // Resolve anchors for Node.prototype.toJS()\n toJS.toJS(source, null, ctx);\n data = anchors.get(source);\n }\n /* istanbul ignore if */\n if (!data || data.res === undefined) {\n const msg = 'This should not happen: Alias anchor was not resolved?';\n throw new ReferenceError(msg);\n }\n if (maxAliasCount >= 0) {\n data.count += 1;\n if (data.aliasCount === 0)\n data.aliasCount = getAliasCount(doc, source, anchors);\n if (data.count * data.aliasCount > maxAliasCount) {\n const msg = 'Excessive alias count indicates a resource exhaustion attack';\n throw new ReferenceError(msg);\n }\n }\n return data.res;\n }\n toString(ctx, _onComment, _onChompKeep) {\n const src = `*${this.source}`;\n if (ctx) {\n anchors.anchorIsValid(this.source);\n if (ctx.options.verifyAliasOrder && !ctx.anchors.has(this.source)) {\n const msg = `Unresolved alias (the anchor must be set before the alias): ${this.source}`;\n throw new Error(msg);\n }\n if (ctx.implicitKey)\n return `${src} `;\n }\n return src;\n }\n}\nfunction getAliasCount(doc, node, anchors) {\n if (identity.isAlias(node)) {\n const source = node.resolve(doc);\n const anchor = anchors && source && anchors.get(source);\n return anchor ? anchor.count * anchor.aliasCount : 0;\n }\n else if (identity.isCollection(node)) {\n let count = 0;\n for (const item of node.items) {\n const c = getAliasCount(doc, item, anchors);\n if (c > count)\n count = c;\n }\n return count;\n }\n else if (identity.isPair(node)) {\n const kc = getAliasCount(doc, node.key, anchors);\n const vc = getAliasCount(doc, node.value, anchors);\n return Math.max(kc, vc);\n }\n return 1;\n}\n\nexports.Alias = Alias;\n","'use strict';\n\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\nvar toJS = require('./toJS.js');\n\nconst isScalarValue = (value) => !value || (typeof value !== 'function' && typeof value !== 'object');\nclass Scalar extends Node.NodeBase {\n constructor(value) {\n super(identity.SCALAR);\n this.value = value;\n }\n toJSON(arg, ctx) {\n return ctx?.keep ? this.value : toJS.toJS(this.value, arg, ctx);\n }\n toString() {\n return String(this.value);\n }\n}\nScalar.BLOCK_FOLDED = 'BLOCK_FOLDED';\nScalar.BLOCK_LITERAL = 'BLOCK_LITERAL';\nScalar.PLAIN = 'PLAIN';\nScalar.QUOTE_DOUBLE = 'QUOTE_DOUBLE';\nScalar.QUOTE_SINGLE = 'QUOTE_SINGLE';\n\nexports.Scalar = Scalar;\nexports.isScalarValue = isScalarValue;\n","'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\n\nconst defaultTagPrefix = 'tag:yaml.org,2002:';\nfunction findTagObject(value, tagName, tags) {\n if (tagName) {\n const match = tags.filter(t => t.tag === tagName);\n const tagObj = match.find(t => !t.format) ?? match[0];\n if (!tagObj)\n throw new Error(`Tag ${tagName} not found`);\n return tagObj;\n }\n return tags.find(t => t.identify?.(value) && !t.format);\n}\nfunction createNode(value, tagName, ctx) {\n if (identity.isDocument(value))\n value = value.contents;\n if (identity.isNode(value))\n return value;\n if (identity.isPair(value)) {\n const map = ctx.schema[identity.MAP].createNode?.(ctx.schema, null, ctx);\n map.items.push(value);\n return map;\n }\n if (value instanceof String ||\n value instanceof Number ||\n value instanceof Boolean ||\n (typeof BigInt !== 'undefined' && value instanceof BigInt) // not supported everywhere\n ) {\n // https://tc39.es/ecma262/#sec-serializejsonproperty\n value = value.valueOf();\n }\n const { aliasDuplicateObjects, onAnchor, onTagObj, schema, sourceObjects } = ctx;\n // Detect duplicate references to the same object & use Alias nodes for all\n // after first. The `ref` wrapper allows for circular references to resolve.\n let ref = undefined;\n if (aliasDuplicateObjects && value && typeof value === 'object') {\n ref = sourceObjects.get(value);\n if (ref) {\n ref.anchor ?? (ref.anchor = onAnchor(value));\n return new Alias.Alias(ref.anchor);\n }\n else {\n ref = { anchor: null, node: null };\n sourceObjects.set(value, ref);\n }\n }\n if (tagName?.startsWith('!!'))\n tagName = defaultTagPrefix + tagName.slice(2);\n let tagObj = findTagObject(value, tagName, schema.tags);\n if (!tagObj) {\n if (value && typeof value.toJSON === 'function') {\n // eslint-disable-next-line @typescript-eslint/no-unsafe-call\n value = value.toJSON();\n }\n if (!value || typeof value !== 'object') {\n const node = new Scalar.Scalar(value);\n if (ref)\n ref.node = node;\n return node;\n }\n tagObj =\n value instanceof Map\n ? schema[identity.MAP]\n : Symbol.iterator in Object(value)\n ? schema[identity.SEQ]\n : schema[identity.MAP];\n }\n if (onTagObj) {\n onTagObj(tagObj);\n delete ctx.onTagObj;\n }\n const node = tagObj?.createNode\n ? tagObj.createNode(ctx.schema, value, ctx)\n : typeof tagObj?.nodeClass?.from === 'function'\n ? tagObj.nodeClass.from(ctx.schema, value, ctx)\n : new Scalar.Scalar(value);\n if (tagName)\n node.tag = tagName;\n else if (!tagObj.default)\n node.tag = tagObj.tag;\n if (ref)\n ref.node = node;\n return node;\n}\n\nexports.createNode = createNode;\n","'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar identity = require('./identity.js');\nvar Node = require('./Node.js');\n\nfunction collectionFromPath(schema, path, value) {\n let v = value;\n for (let i = path.length - 1; i >= 0; --i) {\n const k = path[i];\n if (typeof k === 'number' && Number.isInteger(k) && k >= 0) {\n const a = [];\n a[k] = v;\n v = a;\n }\n else {\n v = new Map([[k, v]]);\n }\n }\n return createNode.createNode(v, undefined, {\n aliasDuplicateObjects: false,\n keepUndefined: false,\n onAnchor: () => {\n throw new Error('This should not happen, please report a bug.');\n },\n schema,\n sourceObjects: new Map()\n });\n}\n// Type guard is intentionally a little wrong so as to be more useful,\n// as it does not cover untypable empty non-string iterables (e.g. []).\nconst isEmptyPath = (path) => path == null ||\n (typeof path === 'object' && !!path[Symbol.iterator]().next().done);\nclass Collection extends Node.NodeBase {\n constructor(type, schema) {\n super(type);\n Object.defineProperty(this, 'schema', {\n value: schema,\n configurable: true,\n enumerable: false,\n writable: true\n });\n }\n /**\n * Create a copy of this collection.\n *\n * @param schema - If defined, overwrites the original's schema\n */\n clone(schema) {\n const copy = Object.create(Object.getPrototypeOf(this), Object.getOwnPropertyDescriptors(this));\n if (schema)\n copy.schema = schema;\n copy.items = copy.items.map(it => identity.isNode(it) || identity.isPair(it) ? it.clone(schema) : it);\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /**\n * Adds a value to the collection. For `!!map` and `!!omap` the value must\n * be a Pair instance or a `{ key, value }` object, which may not have a key\n * that already exists in the map.\n */\n addIn(path, value) {\n if (isEmptyPath(path))\n this.add(value);\n else {\n const [key, ...rest] = path;\n const node = this.get(key, true);\n if (identity.isCollection(node))\n node.addIn(rest, value);\n else if (node === undefined && this.schema)\n this.set(key, collectionFromPath(this.schema, rest, value));\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n }\n /**\n * Removes a value from the collection.\n * @returns `true` if the item was found and removed.\n */\n deleteIn(path) {\n const [key, ...rest] = path;\n if (rest.length === 0)\n return this.delete(key);\n const node = this.get(key, true);\n if (identity.isCollection(node))\n return node.deleteIn(rest);\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n /**\n * Returns item at `key`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n getIn(path, keepScalar) {\n const [key, ...rest] = path;\n const node = this.get(key, true);\n if (rest.length === 0)\n return !keepScalar && identity.isScalar(node) ? node.value : node;\n else\n return identity.isCollection(node) ? node.getIn(rest, keepScalar) : undefined;\n }\n hasAllNullValues(allowScalar) {\n return this.items.every(node => {\n if (!identity.isPair(node))\n return false;\n const n = node.value;\n return (n == null ||\n (allowScalar &&\n identity.isScalar(n) &&\n n.value == null &&\n !n.commentBefore &&\n !n.comment &&\n !n.tag));\n });\n }\n /**\n * Checks if the collection includes a value with the key `key`.\n */\n hasIn(path) {\n const [key, ...rest] = path;\n if (rest.length === 0)\n return this.has(key);\n const node = this.get(key, true);\n return identity.isCollection(node) ? node.hasIn(rest) : false;\n }\n /**\n * Sets a value in this collection. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n setIn(path, value) {\n const [key, ...rest] = path;\n if (rest.length === 0) {\n this.set(key, value);\n }\n else {\n const node = this.get(key, true);\n if (identity.isCollection(node))\n node.setIn(rest, value);\n else if (node === undefined && this.schema)\n this.set(key, collectionFromPath(this.schema, rest, value));\n else\n throw new Error(`Expected YAML collection at ${key}. Remaining path: ${rest}`);\n }\n }\n}\n\nexports.Collection = Collection;\nexports.collectionFromPath = collectionFromPath;\nexports.isEmptyPath = isEmptyPath;\n","'use strict';\n\n/**\n * Stringifies a comment.\n *\n * Empty comment lines are left empty,\n * lines consisting of a single space are replaced by `#`,\n * and all other lines are prefixed with a `#`.\n */\nconst stringifyComment = (str) => str.replace(/^(?!$)(?: $)?/gm, '#');\nfunction indentComment(comment, indent) {\n if (/^\\n+$/.test(comment))\n return comment.substring(1);\n return indent ? comment.replace(/^(?! *$)/gm, indent) : comment;\n}\nconst lineComment = (str, indent, comment) => str.endsWith('\\n')\n ? indentComment(comment, indent)\n : comment.includes('\\n')\n ? '\\n' + indentComment(comment, indent)\n : (str.endsWith(' ') ? '' : ' ') + comment;\n\nexports.indentComment = indentComment;\nexports.lineComment = lineComment;\nexports.stringifyComment = stringifyComment;\n","'use strict';\n\nconst FOLD_FLOW = 'flow';\nconst FOLD_BLOCK = 'block';\nconst FOLD_QUOTED = 'quoted';\n/**\n * Tries to keep input at up to `lineWidth` characters, splitting only on spaces\n * not followed by newlines or spaces unless `mode` is `'quoted'`. Lines are\n * terminated with `\\n` and started with `indent`.\n */\nfunction foldFlowLines(text, indent, mode = 'flow', { indentAtStart, lineWidth = 80, minContentWidth = 20, onFold, onOverflow } = {}) {\n if (!lineWidth || lineWidth < 0)\n return text;\n if (lineWidth < minContentWidth)\n minContentWidth = 0;\n const endStep = Math.max(1 + minContentWidth, 1 + lineWidth - indent.length);\n if (text.length <= endStep)\n return text;\n const folds = [];\n const escapedFolds = {};\n let end = lineWidth - indent.length;\n if (typeof indentAtStart === 'number') {\n if (indentAtStart > lineWidth - Math.max(2, minContentWidth))\n folds.push(0);\n else\n end = lineWidth - indentAtStart;\n }\n let split = undefined;\n let prev = undefined;\n let overflow = false;\n let i = -1;\n let escStart = -1;\n let escEnd = -1;\n if (mode === FOLD_BLOCK) {\n i = consumeMoreIndentedLines(text, i, indent.length);\n if (i !== -1)\n end = i + endStep;\n }\n for (let ch; (ch = text[(i += 1)]);) {\n if (mode === FOLD_QUOTED && ch === '\\\\') {\n escStart = i;\n switch (text[i + 1]) {\n case 'x':\n i += 3;\n break;\n case 'u':\n i += 5;\n break;\n case 'U':\n i += 9;\n break;\n default:\n i += 1;\n }\n escEnd = i;\n }\n if (ch === '\\n') {\n if (mode === FOLD_BLOCK)\n i = consumeMoreIndentedLines(text, i, indent.length);\n end = i + indent.length + endStep;\n split = undefined;\n }\n else {\n if (ch === ' ' &&\n prev &&\n prev !== ' ' &&\n prev !== '\\n' &&\n prev !== '\\t') {\n // space surrounded by non-space can be replaced with newline + indent\n const next = text[i + 1];\n if (next && next !== ' ' && next !== '\\n' && next !== '\\t')\n split = i;\n }\n if (i >= end) {\n if (split) {\n folds.push(split);\n end = split + endStep;\n split = undefined;\n }\n else if (mode === FOLD_QUOTED) {\n // white-space collected at end may stretch past lineWidth\n while (prev === ' ' || prev === '\\t') {\n prev = ch;\n ch = text[(i += 1)];\n overflow = true;\n }\n // Account for newline escape, but don't break preceding escape\n const j = i > escEnd + 1 ? i - 2 : escStart - 1;\n // Bail out if lineWidth & minContentWidth are shorter than an escape string\n if (escapedFolds[j])\n return text;\n folds.push(j);\n escapedFolds[j] = true;\n end = j + endStep;\n split = undefined;\n }\n else {\n overflow = true;\n }\n }\n }\n prev = ch;\n }\n if (overflow && onOverflow)\n onOverflow();\n if (folds.length === 0)\n return text;\n if (onFold)\n onFold();\n let res = text.slice(0, folds[0]);\n for (let i = 0; i < folds.length; ++i) {\n const fold = folds[i];\n const end = folds[i + 1] || text.length;\n if (fold === 0)\n res = `\\n${indent}${text.slice(0, end)}`;\n else {\n if (mode === FOLD_QUOTED && escapedFolds[fold])\n res += `${text[fold]}\\\\`;\n res += `\\n${indent}${text.slice(fold + 1, end)}`;\n }\n }\n return res;\n}\n/**\n * Presumes `i + 1` is at the start of a line\n * @returns index of last newline in more-indented block\n */\nfunction consumeMoreIndentedLines(text, i, indent) {\n let end = i;\n let start = i + 1;\n let ch = text[start];\n while (ch === ' ' || ch === '\\t') {\n if (i < start + indent) {\n ch = text[++i];\n }\n else {\n do {\n ch = text[++i];\n } while (ch && ch !== '\\n');\n end = i;\n start = i + 1;\n ch = text[start];\n }\n }\n return end;\n}\n\nexports.FOLD_BLOCK = FOLD_BLOCK;\nexports.FOLD_FLOW = FOLD_FLOW;\nexports.FOLD_QUOTED = FOLD_QUOTED;\nexports.foldFlowLines = foldFlowLines;\n","'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\nvar foldFlowLines = require('./foldFlowLines.js');\n\nconst getFoldOptions = (ctx, isBlock) => ({\n indentAtStart: isBlock ? ctx.indent.length : ctx.indentAtStart,\n lineWidth: ctx.options.lineWidth,\n minContentWidth: ctx.options.minContentWidth\n});\n// Also checks for lines starting with %, as parsing the output as YAML 1.1 will\n// presume that's starting a new document.\nconst containsDocumentMarker = (str) => /^(%|---|\\.\\.\\.)/m.test(str);\nfunction lineLengthOverLimit(str, lineWidth, indentLength) {\n if (!lineWidth || lineWidth < 0)\n return false;\n const limit = lineWidth - indentLength;\n const strLen = str.length;\n if (strLen <= limit)\n return false;\n for (let i = 0, start = 0; i < strLen; ++i) {\n if (str[i] === '\\n') {\n if (i - start > limit)\n return true;\n start = i + 1;\n if (strLen - start <= limit)\n return false;\n }\n }\n return true;\n}\nfunction doubleQuotedString(value, ctx) {\n const json = JSON.stringify(value);\n if (ctx.options.doubleQuotedAsJSON)\n return json;\n const { implicitKey } = ctx;\n const minMultiLineLength = ctx.options.doubleQuotedMinMultiLineLength;\n const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');\n let str = '';\n let start = 0;\n for (let i = 0, ch = json[i]; ch; ch = json[++i]) {\n if (ch === ' ' && json[i + 1] === '\\\\' && json[i + 2] === 'n') {\n // space before newline needs to be escaped to not be folded\n str += json.slice(start, i) + '\\\\ ';\n i += 1;\n start = i;\n ch = '\\\\';\n }\n if (ch === '\\\\')\n switch (json[i + 1]) {\n case 'u':\n {\n str += json.slice(start, i);\n const code = json.substr(i + 2, 4);\n switch (code) {\n case '0000':\n str += '\\\\0';\n break;\n case '0007':\n str += '\\\\a';\n break;\n case '000b':\n str += '\\\\v';\n break;\n case '001b':\n str += '\\\\e';\n break;\n case '0085':\n str += '\\\\N';\n break;\n case '00a0':\n str += '\\\\_';\n break;\n case '2028':\n str += '\\\\L';\n break;\n case '2029':\n str += '\\\\P';\n break;\n default:\n if (code.substr(0, 2) === '00')\n str += '\\\\x' + code.substr(2);\n else\n str += json.substr(i, 6);\n }\n i += 5;\n start = i + 1;\n }\n break;\n case 'n':\n if (implicitKey ||\n json[i + 2] === '\"' ||\n json.length < minMultiLineLength) {\n i += 1;\n }\n else {\n // folding will eat first newline\n str += json.slice(start, i) + '\\n\\n';\n while (json[i + 2] === '\\\\' &&\n json[i + 3] === 'n' &&\n json[i + 4] !== '\"') {\n str += '\\n';\n i += 2;\n }\n str += indent;\n // space after newline needs to be escaped to not be folded\n if (json[i + 2] === ' ')\n str += '\\\\';\n i += 1;\n start = i + 1;\n }\n break;\n default:\n i += 1;\n }\n }\n str = start ? str + json.slice(start) : json;\n return implicitKey\n ? str\n : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_QUOTED, getFoldOptions(ctx, false));\n}\nfunction singleQuotedString(value, ctx) {\n if (ctx.options.singleQuote === false ||\n (ctx.implicitKey && value.includes('\\n')) ||\n /[ \\t]\\n|\\n[ \\t]/.test(value) // single quoted string can't have leading or trailing whitespace around newline\n )\n return doubleQuotedString(value, ctx);\n const indent = ctx.indent || (containsDocumentMarker(value) ? ' ' : '');\n const res = \"'\" + value.replace(/'/g, \"''\").replace(/\\n+/g, `$&\\n${indent}`) + \"'\";\n return ctx.implicitKey\n ? res\n : foldFlowLines.foldFlowLines(res, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));\n}\nfunction quotedString(value, ctx) {\n const { singleQuote } = ctx.options;\n let qs;\n if (singleQuote === false)\n qs = doubleQuotedString;\n else {\n const hasDouble = value.includes('\"');\n const hasSingle = value.includes(\"'\");\n if (hasDouble && !hasSingle)\n qs = singleQuotedString;\n else if (hasSingle && !hasDouble)\n qs = doubleQuotedString;\n else\n qs = singleQuote ? singleQuotedString : doubleQuotedString;\n }\n return qs(value, ctx);\n}\n// The negative lookbehind avoids a polynomial search,\n// but isn't supported yet on Safari: https://caniuse.com/js-regexp-lookbehind\nlet blockEndNewlines;\ntry {\n blockEndNewlines = new RegExp('(^|(?<!\\n))\\n+(?!\\n|$)', 'g');\n}\ncatch {\n blockEndNewlines = /\\n+(?!\\n|$)/g;\n}\nfunction blockString({ comment, type, value }, ctx, onComment, onChompKeep) {\n const { blockQuote, commentString, lineWidth } = ctx.options;\n // 1. Block can't end in whitespace unless the last line is non-empty.\n // 2. Strings consisting of only whitespace are best rendered explicitly.\n if (!blockQuote || /\\n[\\t ]+$/.test(value) || /^\\s*$/.test(value)) {\n return quotedString(value, ctx);\n }\n const indent = ctx.indent ||\n (ctx.forceBlockIndent || containsDocumentMarker(value) ? ' ' : '');\n const literal = blockQuote === 'literal'\n ? true\n : blockQuote === 'folded' || type === Scalar.Scalar.BLOCK_FOLDED\n ? false\n : type === Scalar.Scalar.BLOCK_LITERAL\n ? true\n : !lineLengthOverLimit(value, lineWidth, indent.length);\n if (!value)\n return literal ? '|\\n' : '>\\n';\n // determine chomping from whitespace at value end\n let chomp;\n let endStart;\n for (endStart = value.length; endStart > 0; --endStart) {\n const ch = value[endStart - 1];\n if (ch !== '\\n' && ch !== '\\t' && ch !== ' ')\n break;\n }\n let end = value.substring(endStart);\n const endNlPos = end.indexOf('\\n');\n if (endNlPos === -1) {\n chomp = '-'; // strip\n }\n else if (value === end || endNlPos !== end.length - 1) {\n chomp = '+'; // keep\n if (onChompKeep)\n onChompKeep();\n }\n else {\n chomp = ''; // clip\n }\n if (end) {\n value = value.slice(0, -end.length);\n if (end[end.length - 1] === '\\n')\n end = end.slice(0, -1);\n end = end.replace(blockEndNewlines, `$&${indent}`);\n }\n // determine indent indicator from whitespace at value start\n let startWithSpace = false;\n let startEnd;\n let startNlPos = -1;\n for (startEnd = 0; startEnd < value.length; ++startEnd) {\n const ch = value[startEnd];\n if (ch === ' ')\n startWithSpace = true;\n else if (ch === '\\n')\n startNlPos = startEnd;\n else\n break;\n }\n let start = value.substring(0, startNlPos < startEnd ? startNlPos + 1 : startEnd);\n if (start) {\n value = value.substring(start.length);\n start = start.replace(/\\n+/g, `$&${indent}`);\n }\n const indentSize = indent ? '2' : '1'; // root is at -1\n // Leading | or > is added later\n let header = (startWithSpace ? indentSize : '') + chomp;\n if (comment) {\n header += ' ' + commentString(comment.replace(/ ?[\\r\\n]+/g, ' '));\n if (onComment)\n onComment();\n }\n if (!literal) {\n const foldedValue = value\n .replace(/\\n+/g, '\\n$&')\n .replace(/(?:^|\\n)([\\t ].*)(?:([\\n\\t ]*)\\n(?![\\n\\t ]))?/g, '$1$2') // more-indented lines aren't folded\n // ^ more-ind. ^ empty ^ capture next empty lines only at end of indent\n .replace(/\\n+/g, `$&${indent}`);\n let literalFallback = false;\n const foldOptions = getFoldOptions(ctx, true);\n if (blockQuote !== 'folded' && type !== Scalar.Scalar.BLOCK_FOLDED) {\n foldOptions.onOverflow = () => {\n literalFallback = true;\n };\n }\n const body = foldFlowLines.foldFlowLines(`${start}${foldedValue}${end}`, indent, foldFlowLines.FOLD_BLOCK, foldOptions);\n if (!literalFallback)\n return `>${header}\\n${indent}${body}`;\n }\n value = value.replace(/\\n+/g, `$&${indent}`);\n return `|${header}\\n${indent}${start}${value}${end}`;\n}\nfunction plainString(item, ctx, onComment, onChompKeep) {\n const { type, value } = item;\n const { actualString, implicitKey, indent, indentStep, inFlow } = ctx;\n if ((implicitKey && value.includes('\\n')) ||\n (inFlow && /[[\\]{},]/.test(value))) {\n return quotedString(value, ctx);\n }\n if (/^[\\n\\t ,[\\]{}#&*!|>'\"%@`]|^[?-]$|^[?-][ \\t]|[\\n:][ \\t]|[ \\t]\\n|[\\n\\t ]#|[\\n\\t :]$/.test(value)) {\n // not allowed:\n // - '-' or '?'\n // - start with an indicator character (except [?:-]) or /[?-] /\n // - '\\n ', ': ' or ' \\n' anywhere\n // - '#' not preceded by a non-space char\n // - end with ' ' or ':'\n return implicitKey || inFlow || !value.includes('\\n')\n ? quotedString(value, ctx)\n : blockString(item, ctx, onComment, onChompKeep);\n }\n if (!implicitKey &&\n !inFlow &&\n type !== Scalar.Scalar.PLAIN &&\n value.includes('\\n')) {\n // Where allowed & type not set explicitly, prefer block style for multiline strings\n return blockString(item, ctx, onComment, onChompKeep);\n }\n if (containsDocumentMarker(value)) {\n if (indent === '') {\n ctx.forceBlockIndent = true;\n return blockString(item, ctx, onComment, onChompKeep);\n }\n else if (implicitKey && indent === indentStep) {\n return quotedString(value, ctx);\n }\n }\n const str = value.replace(/\\n+/g, `$&\\n${indent}`);\n // Verify that output will be parsed as a string, as e.g. plain numbers and\n // booleans get parsed with those types in v1.2 (e.g. '42', 'true' & '0.9e-3'),\n // and others in v1.1.\n if (actualString) {\n const test = (tag) => tag.default && tag.tag !== 'tag:yaml.org,2002:str' && tag.test?.test(str);\n const { compat, tags } = ctx.doc.schema;\n if (tags.some(test) || compat?.some(test))\n return quotedString(value, ctx);\n }\n return implicitKey\n ? str\n : foldFlowLines.foldFlowLines(str, indent, foldFlowLines.FOLD_FLOW, getFoldOptions(ctx, false));\n}\nfunction stringifyString(item, ctx, onComment, onChompKeep) {\n const { implicitKey, inFlow } = ctx;\n const ss = typeof item.value === 'string'\n ? item\n : Object.assign({}, item, { value: String(item.value) });\n let { type } = item;\n if (type !== Scalar.Scalar.QUOTE_DOUBLE) {\n // force double quotes on control characters & unpaired surrogates\n if (/[\\x00-\\x08\\x0b-\\x1f\\x7f-\\x9f\\u{D800}-\\u{DFFF}]/u.test(ss.value))\n type = Scalar.Scalar.QUOTE_DOUBLE;\n }\n const _stringify = (_type) => {\n switch (_type) {\n case Scalar.Scalar.BLOCK_FOLDED:\n case Scalar.Scalar.BLOCK_LITERAL:\n return implicitKey || inFlow\n ? quotedString(ss.value, ctx) // blocks are not valid inside flow containers\n : blockString(ss, ctx, onComment, onChompKeep);\n case Scalar.Scalar.QUOTE_DOUBLE:\n return doubleQuotedString(ss.value, ctx);\n case Scalar.Scalar.QUOTE_SINGLE:\n return singleQuotedString(ss.value, ctx);\n case Scalar.Scalar.PLAIN:\n return plainString(ss, ctx, onComment, onChompKeep);\n default:\n return null;\n }\n };\n let res = _stringify(type);\n if (res === null) {\n const { defaultKeyType, defaultStringType } = ctx.options;\n const t = (implicitKey && defaultKeyType) || defaultStringType;\n res = _stringify(t);\n if (res === null)\n throw new Error(`Unsupported default string type ${t}`);\n }\n return res;\n}\n\nexports.stringifyString = stringifyString;\n","'use strict';\n\nvar anchors = require('../doc/anchors.js');\nvar identity = require('../nodes/identity.js');\nvar stringifyComment = require('./stringifyComment.js');\nvar stringifyString = require('./stringifyString.js');\n\nfunction createStringifyContext(doc, options) {\n const opt = Object.assign({\n blockQuote: true,\n commentString: stringifyComment.stringifyComment,\n defaultKeyType: null,\n defaultStringType: 'PLAIN',\n directives: null,\n doubleQuotedAsJSON: false,\n doubleQuotedMinMultiLineLength: 40,\n falseStr: 'false',\n flowCollectionPadding: true,\n indentSeq: true,\n lineWidth: 80,\n minContentWidth: 20,\n nullStr: 'null',\n simpleKeys: false,\n singleQuote: null,\n trueStr: 'true',\n verifyAliasOrder: true\n }, doc.schema.toStringOptions, options);\n let inFlow;\n switch (opt.collectionStyle) {\n case 'block':\n inFlow = false;\n break;\n case 'flow':\n inFlow = true;\n break;\n default:\n inFlow = null;\n }\n return {\n anchors: new Set(),\n doc,\n flowCollectionPadding: opt.flowCollectionPadding ? ' ' : '',\n indent: '',\n indentStep: typeof opt.indent === 'number' ? ' '.repeat(opt.indent) : ' ',\n inFlow,\n options: opt\n };\n}\nfunction getTagObject(tags, item) {\n if (item.tag) {\n const match = tags.filter(t => t.tag === item.tag);\n if (match.length > 0)\n return match.find(t => t.format === item.format) ?? match[0];\n }\n let tagObj = undefined;\n let obj;\n if (identity.isScalar(item)) {\n obj = item.value;\n let match = tags.filter(t => t.identify?.(obj));\n if (match.length > 1) {\n const testMatch = match.filter(t => t.test);\n if (testMatch.length > 0)\n match = testMatch;\n }\n tagObj =\n match.find(t => t.format === item.format) ?? match.find(t => !t.format);\n }\n else {\n obj = item;\n tagObj = tags.find(t => t.nodeClass && obj instanceof t.nodeClass);\n }\n if (!tagObj) {\n const name = obj?.constructor?.name ?? (obj === null ? 'null' : typeof obj);\n throw new Error(`Tag not resolved for ${name} value`);\n }\n return tagObj;\n}\n// needs to be called before value stringifier to allow for circular anchor refs\nfunction stringifyProps(node, tagObj, { anchors: anchors$1, doc }) {\n if (!doc.directives)\n return '';\n const props = [];\n const anchor = (identity.isScalar(node) || identity.isCollection(node)) && node.anchor;\n if (anchor && anchors.anchorIsValid(anchor)) {\n anchors$1.add(anchor);\n props.push(`&${anchor}`);\n }\n const tag = node.tag ?? (tagObj.default ? null : tagObj.tag);\n if (tag)\n props.push(doc.directives.tagString(tag));\n return props.join(' ');\n}\nfunction stringify(item, ctx, onComment, onChompKeep) {\n if (identity.isPair(item))\n return item.toString(ctx, onComment, onChompKeep);\n if (identity.isAlias(item)) {\n if (ctx.doc.directives)\n return item.toString(ctx);\n if (ctx.resolvedAliases?.has(item)) {\n throw new TypeError(`Cannot stringify circular structure without alias nodes`);\n }\n else {\n if (ctx.resolvedAliases)\n ctx.resolvedAliases.add(item);\n else\n ctx.resolvedAliases = new Set([item]);\n item = item.resolve(ctx.doc);\n }\n }\n let tagObj = undefined;\n const node = identity.isNode(item)\n ? item\n : ctx.doc.createNode(item, { onTagObj: o => (tagObj = o) });\n tagObj ?? (tagObj = getTagObject(ctx.doc.schema.tags, node));\n const props = stringifyProps(node, tagObj, ctx);\n if (props.length > 0)\n ctx.indentAtStart = (ctx.indentAtStart ?? 0) + props.length + 1;\n const str = typeof tagObj.stringify === 'function'\n ? tagObj.stringify(node, ctx, onComment, onChompKeep)\n : identity.isScalar(node)\n ? stringifyString.stringifyString(node, ctx, onComment, onChompKeep)\n : node.toString(ctx, onComment, onChompKeep);\n if (!props)\n return str;\n return identity.isScalar(node) || str[0] === '{' || str[0] === '['\n ? `${props} ${str}`\n : `${props}\\n${ctx.indent}${str}`;\n}\n\nexports.createStringifyContext = createStringifyContext;\nexports.stringify = stringify;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyPair({ key, value }, ctx, onComment, onChompKeep) {\n const { allNullValues, doc, indent, indentStep, options: { commentString, indentSeq, simpleKeys } } = ctx;\n let keyComment = (identity.isNode(key) && key.comment) || null;\n if (simpleKeys) {\n if (keyComment) {\n throw new Error('With simple keys, key nodes cannot have comments');\n }\n if (identity.isCollection(key) || (!identity.isNode(key) && typeof key === 'object')) {\n const msg = 'With simple keys, collection cannot be used as a key value';\n throw new Error(msg);\n }\n }\n let explicitKey = !simpleKeys &&\n (!key ||\n (keyComment && value == null && !ctx.inFlow) ||\n identity.isCollection(key) ||\n (identity.isScalar(key)\n ? key.type === Scalar.Scalar.BLOCK_FOLDED || key.type === Scalar.Scalar.BLOCK_LITERAL\n : typeof key === 'object'));\n ctx = Object.assign({}, ctx, {\n allNullValues: false,\n implicitKey: !explicitKey && (simpleKeys || !allNullValues),\n indent: indent + indentStep\n });\n let keyCommentDone = false;\n let chompKeep = false;\n let str = stringify.stringify(key, ctx, () => (keyCommentDone = true), () => (chompKeep = true));\n if (!explicitKey && !ctx.inFlow && str.length > 1024) {\n if (simpleKeys)\n throw new Error('With simple keys, single line scalar must not span more than 1024 characters');\n explicitKey = true;\n }\n if (ctx.inFlow) {\n if (allNullValues || value == null) {\n if (keyCommentDone && onComment)\n onComment();\n return str === '' ? '?' : explicitKey ? `? ${str}` : str;\n }\n }\n else if ((allNullValues && !simpleKeys) || (value == null && explicitKey)) {\n str = `? ${str}`;\n if (keyComment && !keyCommentDone) {\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n }\n else if (chompKeep && onChompKeep)\n onChompKeep();\n return str;\n }\n if (keyCommentDone)\n keyComment = null;\n if (explicitKey) {\n if (keyComment)\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n str = `? ${str}\\n${indent}:`;\n }\n else {\n str = `${str}:`;\n if (keyComment)\n str += stringifyComment.lineComment(str, ctx.indent, commentString(keyComment));\n }\n let vsb, vcb, valueComment;\n if (identity.isNode(value)) {\n vsb = !!value.spaceBefore;\n vcb = value.commentBefore;\n valueComment = value.comment;\n }\n else {\n vsb = false;\n vcb = null;\n valueComment = null;\n if (value && typeof value === 'object')\n value = doc.createNode(value);\n }\n ctx.implicitKey = false;\n if (!explicitKey && !keyComment && identity.isScalar(value))\n ctx.indentAtStart = str.length + 1;\n chompKeep = false;\n if (!indentSeq &&\n indentStep.length >= 2 &&\n !ctx.inFlow &&\n !explicitKey &&\n identity.isSeq(value) &&\n !value.flow &&\n !value.tag &&\n !value.anchor) {\n // If indentSeq === false, consider '- ' as part of indentation where possible\n ctx.indent = ctx.indent.substring(2);\n }\n let valueCommentDone = false;\n const valueStr = stringify.stringify(value, ctx, () => (valueCommentDone = true), () => (chompKeep = true));\n let ws = ' ';\n if (keyComment || vsb || vcb) {\n ws = vsb ? '\\n' : '';\n if (vcb) {\n const cs = commentString(vcb);\n ws += `\\n${stringifyComment.indentComment(cs, ctx.indent)}`;\n }\n if (valueStr === '' && !ctx.inFlow) {\n if (ws === '\\n')\n ws = '\\n\\n';\n }\n else {\n ws += `\\n${ctx.indent}`;\n }\n }\n else if (!explicitKey && identity.isCollection(value)) {\n const vs0 = valueStr[0];\n const nl0 = valueStr.indexOf('\\n');\n const hasNewline = nl0 !== -1;\n const flow = ctx.inFlow ?? value.flow ?? value.items.length === 0;\n if (hasNewline || !flow) {\n let hasPropsLine = false;\n if (hasNewline && (vs0 === '&' || vs0 === '!')) {\n let sp0 = valueStr.indexOf(' ');\n if (vs0 === '&' &&\n sp0 !== -1 &&\n sp0 < nl0 &&\n valueStr[sp0 + 1] === '!') {\n sp0 = valueStr.indexOf(' ', sp0 + 1);\n }\n if (sp0 === -1 || nl0 < sp0)\n hasPropsLine = true;\n }\n if (!hasPropsLine)\n ws = `\\n${ctx.indent}`;\n }\n }\n else if (valueStr === '' || valueStr[0] === '\\n') {\n ws = '';\n }\n str += ws + valueStr;\n if (ctx.inFlow) {\n if (valueCommentDone && onComment)\n onComment();\n }\n else if (valueComment && !valueCommentDone) {\n str += stringifyComment.lineComment(str, ctx.indent, commentString(valueComment));\n }\n else if (chompKeep && onChompKeep) {\n onChompKeep();\n }\n return str;\n}\n\nexports.stringifyPair = stringifyPair;\n","'use strict';\n\nvar node_process = require('process');\n\nfunction debug(logLevel, ...messages) {\n if (logLevel === 'debug')\n console.log(...messages);\n}\nfunction warn(logLevel, warning) {\n if (logLevel === 'debug' || logLevel === 'warn') {\n if (typeof node_process.emitWarning === 'function')\n node_process.emitWarning(warning);\n else\n console.warn(warning);\n }\n}\n\nexports.debug = debug;\nexports.warn = warn;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Scalar = require('../../nodes/Scalar.js');\n\n// If the value associated with a merge key is a single mapping node, each of\n// its key/value pairs is inserted into the current mapping, unless the key\n// already exists in it. If the value associated with the merge key is a\n// sequence, then this sequence is expected to contain mapping nodes and each\n// of these nodes is merged in turn according to its order in the sequence.\n// Keys in mapping nodes earlier in the sequence override keys specified in\n// later mapping nodes. -- http://yaml.org/type/merge.html\nconst MERGE_KEY = '<<';\nconst merge = {\n identify: value => value === MERGE_KEY ||\n (typeof value === 'symbol' && value.description === MERGE_KEY),\n default: 'key',\n tag: 'tag:yaml.org,2002:merge',\n test: /^<<$/,\n resolve: () => Object.assign(new Scalar.Scalar(Symbol(MERGE_KEY)), {\n addToJSMap: addMergeToJSMap\n }),\n stringify: () => MERGE_KEY\n};\nconst isMergeKey = (ctx, key) => (merge.identify(key) ||\n (identity.isScalar(key) &&\n (!key.type || key.type === Scalar.Scalar.PLAIN) &&\n merge.identify(key.value))) &&\n ctx?.doc.schema.tags.some(tag => tag.tag === merge.tag && tag.default);\nfunction addMergeToJSMap(ctx, map, value) {\n value = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;\n if (identity.isSeq(value))\n for (const it of value.items)\n mergeValue(ctx, map, it);\n else if (Array.isArray(value))\n for (const it of value)\n mergeValue(ctx, map, it);\n else\n mergeValue(ctx, map, value);\n}\nfunction mergeValue(ctx, map, value) {\n const source = ctx && identity.isAlias(value) ? value.resolve(ctx.doc) : value;\n if (!identity.isMap(source))\n throw new Error('Merge sources must be maps or map aliases');\n const srcMap = source.toJSON(null, ctx, Map);\n for (const [key, value] of srcMap) {\n if (map instanceof Map) {\n if (!map.has(key))\n map.set(key, value);\n }\n else if (map instanceof Set) {\n map.add(key);\n }\n else if (!Object.prototype.hasOwnProperty.call(map, key)) {\n Object.defineProperty(map, key, {\n value,\n writable: true,\n enumerable: true,\n configurable: true\n });\n }\n }\n return map;\n}\n\nexports.addMergeToJSMap = addMergeToJSMap;\nexports.isMergeKey = isMergeKey;\nexports.merge = merge;\n","'use strict';\n\nvar log = require('../log.js');\nvar merge = require('../schema/yaml-1.1/merge.js');\nvar stringify = require('../stringify/stringify.js');\nvar identity = require('./identity.js');\nvar toJS = require('./toJS.js');\n\nfunction addPairToJSMap(ctx, map, { key, value }) {\n if (identity.isNode(key) && key.addToJSMap)\n key.addToJSMap(ctx, map, value);\n // TODO: Should drop this special case for bare << handling\n else if (merge.isMergeKey(ctx, key))\n merge.addMergeToJSMap(ctx, map, value);\n else {\n const jsKey = toJS.toJS(key, '', ctx);\n if (map instanceof Map) {\n map.set(jsKey, toJS.toJS(value, jsKey, ctx));\n }\n else if (map instanceof Set) {\n map.add(jsKey);\n }\n else {\n const stringKey = stringifyKey(key, jsKey, ctx);\n const jsValue = toJS.toJS(value, stringKey, ctx);\n if (stringKey in map)\n Object.defineProperty(map, stringKey, {\n value: jsValue,\n writable: true,\n enumerable: true,\n configurable: true\n });\n else\n map[stringKey] = jsValue;\n }\n }\n return map;\n}\nfunction stringifyKey(key, jsKey, ctx) {\n if (jsKey === null)\n return '';\n // eslint-disable-next-line @typescript-eslint/no-base-to-string\n if (typeof jsKey !== 'object')\n return String(jsKey);\n if (identity.isNode(key) && ctx?.doc) {\n const strCtx = stringify.createStringifyContext(ctx.doc, {});\n strCtx.anchors = new Set();\n for (const node of ctx.anchors.keys())\n strCtx.anchors.add(node.anchor);\n strCtx.inFlow = true;\n strCtx.inStringifyKey = true;\n const strKey = key.toString(strCtx);\n if (!ctx.mapKeyWarned) {\n let jsonStr = JSON.stringify(strKey);\n if (jsonStr.length > 40)\n jsonStr = jsonStr.substring(0, 36) + '...\"';\n log.warn(ctx.doc.options.logLevel, `Keys with collection values will be stringified due to JS Object restrictions: ${jsonStr}. Set mapAsMap: true to use object keys.`);\n ctx.mapKeyWarned = true;\n }\n return strKey;\n }\n return JSON.stringify(jsKey);\n}\n\nexports.addPairToJSMap = addPairToJSMap;\n","'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar stringifyPair = require('../stringify/stringifyPair.js');\nvar addPairToJSMap = require('./addPairToJSMap.js');\nvar identity = require('./identity.js');\n\nfunction createPair(key, value, ctx) {\n const k = createNode.createNode(key, undefined, ctx);\n const v = createNode.createNode(value, undefined, ctx);\n return new Pair(k, v);\n}\nclass Pair {\n constructor(key, value = null) {\n Object.defineProperty(this, identity.NODE_TYPE, { value: identity.PAIR });\n this.key = key;\n this.value = value;\n }\n clone(schema) {\n let { key, value } = this;\n if (identity.isNode(key))\n key = key.clone(schema);\n if (identity.isNode(value))\n value = value.clone(schema);\n return new Pair(key, value);\n }\n toJSON(_, ctx) {\n const pair = ctx?.mapAsMap ? new Map() : {};\n return addPairToJSMap.addPairToJSMap(ctx, pair, this);\n }\n toString(ctx, onComment, onChompKeep) {\n return ctx?.doc\n ? stringifyPair.stringifyPair(this, ctx, onComment, onChompKeep)\n : JSON.stringify(this);\n }\n}\n\nexports.Pair = Pair;\nexports.createPair = createPair;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyCollection(collection, ctx, options) {\n const flow = ctx.inFlow ?? collection.flow;\n const stringify = flow ? stringifyFlowCollection : stringifyBlockCollection;\n return stringify(collection, ctx, options);\n}\nfunction stringifyBlockCollection({ comment, items }, ctx, { blockItemPrefix, flowChars, itemIndent, onChompKeep, onComment }) {\n const { indent, options: { commentString } } = ctx;\n const itemCtx = Object.assign({}, ctx, { indent: itemIndent, type: null });\n let chompKeep = false; // flag for the preceding node's status\n const lines = [];\n for (let i = 0; i < items.length; ++i) {\n const item = items[i];\n let comment = null;\n if (identity.isNode(item)) {\n if (!chompKeep && item.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, item.commentBefore, chompKeep);\n if (item.comment)\n comment = item.comment;\n }\n else if (identity.isPair(item)) {\n const ik = identity.isNode(item.key) ? item.key : null;\n if (ik) {\n if (!chompKeep && ik.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, ik.commentBefore, chompKeep);\n }\n }\n chompKeep = false;\n let str = stringify.stringify(item, itemCtx, () => (comment = null), () => (chompKeep = true));\n if (comment)\n str += stringifyComment.lineComment(str, itemIndent, commentString(comment));\n if (chompKeep && comment)\n chompKeep = false;\n lines.push(blockItemPrefix + str);\n }\n let str;\n if (lines.length === 0) {\n str = flowChars.start + flowChars.end;\n }\n else {\n str = lines[0];\n for (let i = 1; i < lines.length; ++i) {\n const line = lines[i];\n str += line ? `\\n${indent}${line}` : '\\n';\n }\n }\n if (comment) {\n str += '\\n' + stringifyComment.indentComment(commentString(comment), indent);\n if (onComment)\n onComment();\n }\n else if (chompKeep && onChompKeep)\n onChompKeep();\n return str;\n}\nfunction stringifyFlowCollection({ items }, ctx, { flowChars, itemIndent }) {\n const { indent, indentStep, flowCollectionPadding: fcPadding, options: { commentString } } = ctx;\n itemIndent += indentStep;\n const itemCtx = Object.assign({}, ctx, {\n indent: itemIndent,\n inFlow: true,\n type: null\n });\n let reqNewline = false;\n let linesAtValue = 0;\n const lines = [];\n for (let i = 0; i < items.length; ++i) {\n const item = items[i];\n let comment = null;\n if (identity.isNode(item)) {\n if (item.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, item.commentBefore, false);\n if (item.comment)\n comment = item.comment;\n }\n else if (identity.isPair(item)) {\n const ik = identity.isNode(item.key) ? item.key : null;\n if (ik) {\n if (ik.spaceBefore)\n lines.push('');\n addCommentBefore(ctx, lines, ik.commentBefore, false);\n if (ik.comment)\n reqNewline = true;\n }\n const iv = identity.isNode(item.value) ? item.value : null;\n if (iv) {\n if (iv.comment)\n comment = iv.comment;\n if (iv.commentBefore)\n reqNewline = true;\n }\n else if (item.value == null && ik?.comment) {\n comment = ik.comment;\n }\n }\n if (comment)\n reqNewline = true;\n let str = stringify.stringify(item, itemCtx, () => (comment = null));\n if (i < items.length - 1)\n str += ',';\n if (comment)\n str += stringifyComment.lineComment(str, itemIndent, commentString(comment));\n if (!reqNewline && (lines.length > linesAtValue || str.includes('\\n')))\n reqNewline = true;\n lines.push(str);\n linesAtValue = lines.length;\n }\n const { start, end } = flowChars;\n if (lines.length === 0) {\n return start + end;\n }\n else {\n if (!reqNewline) {\n const len = lines.reduce((sum, line) => sum + line.length + 2, 2);\n reqNewline = ctx.options.lineWidth > 0 && len > ctx.options.lineWidth;\n }\n if (reqNewline) {\n let str = start;\n for (const line of lines)\n str += line ? `\\n${indentStep}${indent}${line}` : '\\n';\n return `${str}\\n${indent}${end}`;\n }\n else {\n return `${start}${fcPadding}${lines.join(' ')}${fcPadding}${end}`;\n }\n }\n}\nfunction addCommentBefore({ indent, options: { commentString } }, lines, comment, chompKeep) {\n if (comment && chompKeep)\n comment = comment.replace(/^\\n+/, '');\n if (comment) {\n const ic = stringifyComment.indentComment(commentString(comment), indent);\n lines.push(ic.trimStart()); // Avoid double indent on first line\n }\n}\n\nexports.stringifyCollection = stringifyCollection;\n","'use strict';\n\nvar stringifyCollection = require('../stringify/stringifyCollection.js');\nvar addPairToJSMap = require('./addPairToJSMap.js');\nvar Collection = require('./Collection.js');\nvar identity = require('./identity.js');\nvar Pair = require('./Pair.js');\nvar Scalar = require('./Scalar.js');\n\nfunction findPair(items, key) {\n const k = identity.isScalar(key) ? key.value : key;\n for (const it of items) {\n if (identity.isPair(it)) {\n if (it.key === key || it.key === k)\n return it;\n if (identity.isScalar(it.key) && it.key.value === k)\n return it;\n }\n }\n return undefined;\n}\nclass YAMLMap extends Collection.Collection {\n static get tagName() {\n return 'tag:yaml.org,2002:map';\n }\n constructor(schema) {\n super(identity.MAP, schema);\n this.items = [];\n }\n /**\n * A generic collection parsing method that can be extended\n * to other node classes that inherit from YAMLMap\n */\n static from(schema, obj, ctx) {\n const { keepUndefined, replacer } = ctx;\n const map = new this(schema);\n const add = (key, value) => {\n if (typeof replacer === 'function')\n value = replacer.call(obj, key, value);\n else if (Array.isArray(replacer) && !replacer.includes(key))\n return;\n if (value !== undefined || keepUndefined)\n map.items.push(Pair.createPair(key, value, ctx));\n };\n if (obj instanceof Map) {\n for (const [key, value] of obj)\n add(key, value);\n }\n else if (obj && typeof obj === 'object') {\n for (const key of Object.keys(obj))\n add(key, obj[key]);\n }\n if (typeof schema.sortMapEntries === 'function') {\n map.items.sort(schema.sortMapEntries);\n }\n return map;\n }\n /**\n * Adds a value to the collection.\n *\n * @param overwrite - If not set `true`, using a key that is already in the\n * collection will throw. Otherwise, overwrites the previous value.\n */\n add(pair, overwrite) {\n let _pair;\n if (identity.isPair(pair))\n _pair = pair;\n else if (!pair || typeof pair !== 'object' || !('key' in pair)) {\n // In TypeScript, this never happens.\n _pair = new Pair.Pair(pair, pair?.value);\n }\n else\n _pair = new Pair.Pair(pair.key, pair.value);\n const prev = findPair(this.items, _pair.key);\n const sortEntries = this.schema?.sortMapEntries;\n if (prev) {\n if (!overwrite)\n throw new Error(`Key ${_pair.key} already set`);\n // For scalars, keep the old node & its comments and anchors\n if (identity.isScalar(prev.value) && Scalar.isScalarValue(_pair.value))\n prev.value.value = _pair.value;\n else\n prev.value = _pair.value;\n }\n else if (sortEntries) {\n const i = this.items.findIndex(item => sortEntries(_pair, item) < 0);\n if (i === -1)\n this.items.push(_pair);\n else\n this.items.splice(i, 0, _pair);\n }\n else {\n this.items.push(_pair);\n }\n }\n delete(key) {\n const it = findPair(this.items, key);\n if (!it)\n return false;\n const del = this.items.splice(this.items.indexOf(it), 1);\n return del.length > 0;\n }\n get(key, keepScalar) {\n const it = findPair(this.items, key);\n const node = it?.value;\n return (!keepScalar && identity.isScalar(node) ? node.value : node) ?? undefined;\n }\n has(key) {\n return !!findPair(this.items, key);\n }\n set(key, value) {\n this.add(new Pair.Pair(key, value), true);\n }\n /**\n * @param ctx - Conversion context, originally set in Document#toJS()\n * @param {Class} Type - If set, forces the returned collection type\n * @returns Instance of Type, Map, or Object\n */\n toJSON(_, ctx, Type) {\n const map = Type ? new Type() : ctx?.mapAsMap ? new Map() : {};\n if (ctx?.onCreate)\n ctx.onCreate(map);\n for (const item of this.items)\n addPairToJSMap.addPairToJSMap(ctx, map, item);\n return map;\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n for (const item of this.items) {\n if (!identity.isPair(item))\n throw new Error(`Map items must all be pairs; found ${JSON.stringify(item)} instead`);\n }\n if (!ctx.allNullValues && this.hasAllNullValues(false))\n ctx = Object.assign({}, ctx, { allNullValues: true });\n return stringifyCollection.stringifyCollection(this, ctx, {\n blockItemPrefix: '',\n flowChars: { start: '{', end: '}' },\n itemIndent: ctx.indent || '',\n onChompKeep,\n onComment\n });\n }\n}\n\nexports.YAMLMap = YAMLMap;\nexports.findPair = findPair;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\n\nconst map = {\n collection: 'map',\n default: true,\n nodeClass: YAMLMap.YAMLMap,\n tag: 'tag:yaml.org,2002:map',\n resolve(map, onError) {\n if (!identity.isMap(map))\n onError('Expected a mapping for this tag');\n return map;\n },\n createNode: (schema, obj, ctx) => YAMLMap.YAMLMap.from(schema, obj, ctx)\n};\n\nexports.map = map;\n","'use strict';\n\nvar createNode = require('../doc/createNode.js');\nvar stringifyCollection = require('../stringify/stringifyCollection.js');\nvar Collection = require('./Collection.js');\nvar identity = require('./identity.js');\nvar Scalar = require('./Scalar.js');\nvar toJS = require('./toJS.js');\n\nclass YAMLSeq extends Collection.Collection {\n static get tagName() {\n return 'tag:yaml.org,2002:seq';\n }\n constructor(schema) {\n super(identity.SEQ, schema);\n this.items = [];\n }\n add(value) {\n this.items.push(value);\n }\n /**\n * Removes a value from the collection.\n *\n * `key` must contain a representation of an integer for this to succeed.\n * It may be wrapped in a `Scalar`.\n *\n * @returns `true` if the item was found and removed.\n */\n delete(key) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n return false;\n const del = this.items.splice(idx, 1);\n return del.length > 0;\n }\n get(key, keepScalar) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n return undefined;\n const it = this.items[idx];\n return !keepScalar && identity.isScalar(it) ? it.value : it;\n }\n /**\n * Checks if the collection includes a value with the key `key`.\n *\n * `key` must contain a representation of an integer for this to succeed.\n * It may be wrapped in a `Scalar`.\n */\n has(key) {\n const idx = asItemIndex(key);\n return typeof idx === 'number' && idx < this.items.length;\n }\n /**\n * Sets a value in this collection. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n *\n * If `key` does not contain a representation of an integer, this will throw.\n * It may be wrapped in a `Scalar`.\n */\n set(key, value) {\n const idx = asItemIndex(key);\n if (typeof idx !== 'number')\n throw new Error(`Expected a valid index, not ${key}.`);\n const prev = this.items[idx];\n if (identity.isScalar(prev) && Scalar.isScalarValue(value))\n prev.value = value;\n else\n this.items[idx] = value;\n }\n toJSON(_, ctx) {\n const seq = [];\n if (ctx?.onCreate)\n ctx.onCreate(seq);\n let i = 0;\n for (const item of this.items)\n seq.push(toJS.toJS(item, String(i++), ctx));\n return seq;\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n return stringifyCollection.stringifyCollection(this, ctx, {\n blockItemPrefix: '- ',\n flowChars: { start: '[', end: ']' },\n itemIndent: (ctx.indent || '') + ' ',\n onChompKeep,\n onComment\n });\n }\n static from(schema, obj, ctx) {\n const { replacer } = ctx;\n const seq = new this(schema);\n if (obj && Symbol.iterator in Object(obj)) {\n let i = 0;\n for (let it of obj) {\n if (typeof replacer === 'function') {\n const key = obj instanceof Set ? it : String(i++);\n it = replacer.call(obj, key, it);\n }\n seq.items.push(createNode.createNode(it, undefined, ctx));\n }\n }\n return seq;\n }\n}\nfunction asItemIndex(key) {\n let idx = identity.isScalar(key) ? key.value : key;\n if (idx && typeof idx === 'string')\n idx = Number(idx);\n return typeof idx === 'number' && Number.isInteger(idx) && idx >= 0\n ? idx\n : null;\n}\n\nexports.YAMLSeq = YAMLSeq;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\n\nconst seq = {\n collection: 'seq',\n default: true,\n nodeClass: YAMLSeq.YAMLSeq,\n tag: 'tag:yaml.org,2002:seq',\n resolve(seq, onError) {\n if (!identity.isSeq(seq))\n onError('Expected a sequence for this tag');\n return seq;\n },\n createNode: (schema, obj, ctx) => YAMLSeq.YAMLSeq.from(schema, obj, ctx)\n};\n\nexports.seq = seq;\n","'use strict';\n\nvar stringifyString = require('../../stringify/stringifyString.js');\n\nconst string = {\n identify: value => typeof value === 'string',\n default: true,\n tag: 'tag:yaml.org,2002:str',\n resolve: str => str,\n stringify(item, ctx, onComment, onChompKeep) {\n ctx = Object.assign({ actualString: true }, ctx);\n return stringifyString.stringifyString(item, ctx, onComment, onChompKeep);\n }\n};\n\nexports.string = string;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nconst nullTag = {\n identify: value => value == null,\n createNode: () => new Scalar.Scalar(null),\n default: true,\n tag: 'tag:yaml.org,2002:null',\n test: /^(?:~|[Nn]ull|NULL)?$/,\n resolve: () => new Scalar.Scalar(null),\n stringify: ({ source }, ctx) => typeof source === 'string' && nullTag.test.test(source)\n ? source\n : ctx.options.nullStr\n};\n\nexports.nullTag = nullTag;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nconst boolTag = {\n identify: value => typeof value === 'boolean',\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,\n resolve: str => new Scalar.Scalar(str[0] === 't' || str[0] === 'T'),\n stringify({ source, value }, ctx) {\n if (source && boolTag.test.test(source)) {\n const sv = source[0] === 't' || source[0] === 'T';\n if (value === sv)\n return source;\n }\n return value ? ctx.options.trueStr : ctx.options.falseStr;\n }\n};\n\nexports.boolTag = boolTag;\n","'use strict';\n\nfunction stringifyNumber({ format, minFractionDigits, tag, value }) {\n if (typeof value === 'bigint')\n return String(value);\n const num = typeof value === 'number' ? value : Number(value);\n if (!isFinite(num))\n return isNaN(num) ? '.nan' : num < 0 ? '-.inf' : '.inf';\n let n = JSON.stringify(value);\n if (!format &&\n minFractionDigits &&\n (!tag || tag === 'tag:yaml.org,2002:float') &&\n /^\\d/.test(n)) {\n let i = n.indexOf('.');\n if (i < 0) {\n i = n.length;\n n += '.';\n }\n let d = minFractionDigits - (n.length - i - 1);\n while (d-- > 0)\n n += '0';\n }\n return n;\n}\n\nexports.stringifyNumber = stringifyNumber;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst floatNaN = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,\n resolve: str => str.slice(-3).toLowerCase() === 'nan'\n ? NaN\n : str[0] === '-'\n ? Number.NEGATIVE_INFINITY\n : Number.POSITIVE_INFINITY,\n stringify: stringifyNumber.stringifyNumber\n};\nconst floatExp = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'EXP',\n test: /^[-+]?(?:\\.[0-9]+|[0-9]+(?:\\.[0-9]*)?)[eE][-+]?[0-9]+$/,\n resolve: str => parseFloat(str),\n stringify(node) {\n const num = Number(node.value);\n return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);\n }\n};\nconst float = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^[-+]?(?:\\.[0-9]+|[0-9]+\\.[0-9]*)$/,\n resolve(str) {\n const node = new Scalar.Scalar(parseFloat(str));\n const dot = str.indexOf('.');\n if (dot !== -1 && str[str.length - 1] === '0')\n node.minFractionDigits = str.length - dot - 1;\n return node;\n },\n stringify: stringifyNumber.stringifyNumber\n};\n\nexports.float = float;\nexports.floatExp = floatExp;\nexports.floatNaN = floatNaN;\n","'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);\nconst intResolve = (str, offset, radix, { intAsBigInt }) => (intAsBigInt ? BigInt(str) : parseInt(str.substring(offset), radix));\nfunction intStringify(node, radix, prefix) {\n const { value } = node;\n if (intIdentify(value) && value >= 0)\n return prefix + value.toString(radix);\n return stringifyNumber.stringifyNumber(node);\n}\nconst intOct = {\n identify: value => intIdentify(value) && value >= 0,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'OCT',\n test: /^0o[0-7]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 8, opt),\n stringify: node => intStringify(node, 8, '0o')\n};\nconst int = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^[-+]?[0-9]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),\n stringify: stringifyNumber.stringifyNumber\n};\nconst intHex = {\n identify: value => intIdentify(value) && value >= 0,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'HEX',\n test: /^0x[0-9a-fA-F]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),\n stringify: node => intStringify(node, 16, '0x')\n};\n\nexports.int = int;\nexports.intHex = intHex;\nexports.intOct = intOct;\n","'use strict';\n\nvar map = require('../common/map.js');\nvar _null = require('../common/null.js');\nvar seq = require('../common/seq.js');\nvar string = require('../common/string.js');\nvar bool = require('./bool.js');\nvar float = require('./float.js');\nvar int = require('./int.js');\n\nconst schema = [\n map.map,\n seq.seq,\n string.string,\n _null.nullTag,\n bool.boolTag,\n int.intOct,\n int.int,\n int.intHex,\n float.floatNaN,\n float.floatExp,\n float.float\n];\n\nexports.schema = schema;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar map = require('../common/map.js');\nvar seq = require('../common/seq.js');\n\nfunction intIdentify(value) {\n return typeof value === 'bigint' || Number.isInteger(value);\n}\nconst stringifyJSON = ({ value }) => JSON.stringify(value);\nconst jsonScalars = [\n {\n identify: value => typeof value === 'string',\n default: true,\n tag: 'tag:yaml.org,2002:str',\n resolve: str => str,\n stringify: stringifyJSON\n },\n {\n identify: value => value == null,\n createNode: () => new Scalar.Scalar(null),\n default: true,\n tag: 'tag:yaml.org,2002:null',\n test: /^null$/,\n resolve: () => null,\n stringify: stringifyJSON\n },\n {\n identify: value => typeof value === 'boolean',\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^true$|^false$/,\n resolve: str => str === 'true',\n stringify: stringifyJSON\n },\n {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^-?(?:0|[1-9][0-9]*)$/,\n resolve: (str, _onError, { intAsBigInt }) => intAsBigInt ? BigInt(str) : parseInt(str, 10),\n stringify: ({ value }) => intIdentify(value) ? value.toString() : JSON.stringify(value)\n },\n {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^-?(?:0|[1-9][0-9]*)(?:\\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,\n resolve: str => parseFloat(str),\n stringify: stringifyJSON\n }\n];\nconst jsonError = {\n default: true,\n tag: '',\n test: /^/,\n resolve(str, onError) {\n onError(`Unresolved plain scalar ${JSON.stringify(str)}`);\n return str;\n }\n};\nconst schema = [map.map, seq.seq].concat(jsonScalars, jsonError);\n\nexports.schema = schema;\n","'use strict';\n\nvar node_buffer = require('buffer');\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyString = require('../../stringify/stringifyString.js');\n\nconst binary = {\n identify: value => value instanceof Uint8Array, // Buffer inherits from Uint8Array\n default: false,\n tag: 'tag:yaml.org,2002:binary',\n /**\n * Returns a Buffer in node and an Uint8Array in browsers\n *\n * To use the resulting buffer as an image, you'll want to do something like:\n *\n * const blob = new Blob([buffer], { type: 'image/jpeg' })\n * document.querySelector('#photo').src = URL.createObjectURL(blob)\n */\n resolve(src, onError) {\n if (typeof node_buffer.Buffer === 'function') {\n return node_buffer.Buffer.from(src, 'base64');\n }\n else if (typeof atob === 'function') {\n // On IE 11, atob() can't handle newlines\n const str = atob(src.replace(/[\\n\\r]/g, ''));\n const buffer = new Uint8Array(str.length);\n for (let i = 0; i < str.length; ++i)\n buffer[i] = str.charCodeAt(i);\n return buffer;\n }\n else {\n onError('This environment does not support reading binary tags; either Buffer or atob is required');\n return src;\n }\n },\n stringify({ comment, type, value }, ctx, onComment, onChompKeep) {\n if (!value)\n return '';\n const buf = value; // checked earlier by binary.identify()\n let str;\n if (typeof node_buffer.Buffer === 'function') {\n str =\n buf instanceof node_buffer.Buffer\n ? buf.toString('base64')\n : node_buffer.Buffer.from(buf.buffer).toString('base64');\n }\n else if (typeof btoa === 'function') {\n let s = '';\n for (let i = 0; i < buf.length; ++i)\n s += String.fromCharCode(buf[i]);\n str = btoa(s);\n }\n else {\n throw new Error('This environment does not support writing binary tags; either Buffer or btoa is required');\n }\n type ?? (type = Scalar.Scalar.BLOCK_LITERAL);\n if (type !== Scalar.Scalar.QUOTE_DOUBLE) {\n const lineWidth = Math.max(ctx.options.lineWidth - ctx.indent.length, ctx.options.minContentWidth);\n const n = Math.ceil(str.length / lineWidth);\n const lines = new Array(n);\n for (let i = 0, o = 0; i < n; ++i, o += lineWidth) {\n lines[i] = str.substr(o, lineWidth);\n }\n str = lines.join(type === Scalar.Scalar.BLOCK_LITERAL ? '\\n' : ' ');\n }\n return stringifyString.stringifyString({ comment, type, value: str }, ctx, onComment, onChompKeep);\n }\n};\n\nexports.binary = binary;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Pair = require('../../nodes/Pair.js');\nvar Scalar = require('../../nodes/Scalar.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\n\nfunction resolvePairs(seq, onError) {\n if (identity.isSeq(seq)) {\n for (let i = 0; i < seq.items.length; ++i) {\n let item = seq.items[i];\n if (identity.isPair(item))\n continue;\n else if (identity.isMap(item)) {\n if (item.items.length > 1)\n onError('Each pair must have its own sequence indicator');\n const pair = item.items[0] || new Pair.Pair(new Scalar.Scalar(null));\n if (item.commentBefore)\n pair.key.commentBefore = pair.key.commentBefore\n ? `${item.commentBefore}\\n${pair.key.commentBefore}`\n : item.commentBefore;\n if (item.comment) {\n const cn = pair.value ?? pair.key;\n cn.comment = cn.comment\n ? `${item.comment}\\n${cn.comment}`\n : item.comment;\n }\n item = pair;\n }\n seq.items[i] = identity.isPair(item) ? item : new Pair.Pair(item);\n }\n }\n else\n onError('Expected a sequence for this tag');\n return seq;\n}\nfunction createPairs(schema, iterable, ctx) {\n const { replacer } = ctx;\n const pairs = new YAMLSeq.YAMLSeq(schema);\n pairs.tag = 'tag:yaml.org,2002:pairs';\n let i = 0;\n if (iterable && Symbol.iterator in Object(iterable))\n for (let it of iterable) {\n if (typeof replacer === 'function')\n it = replacer.call(iterable, String(i++), it);\n let key, value;\n if (Array.isArray(it)) {\n if (it.length === 2) {\n key = it[0];\n value = it[1];\n }\n else\n throw new TypeError(`Expected [key, value] tuple: ${it}`);\n }\n else if (it && it instanceof Object) {\n const keys = Object.keys(it);\n if (keys.length === 1) {\n key = keys[0];\n value = it[key];\n }\n else {\n throw new TypeError(`Expected tuple with one key, not ${keys.length} keys`);\n }\n }\n else {\n key = it;\n }\n pairs.items.push(Pair.createPair(key, value, ctx));\n }\n return pairs;\n}\nconst pairs = {\n collection: 'seq',\n default: false,\n tag: 'tag:yaml.org,2002:pairs',\n resolve: resolvePairs,\n createNode: createPairs\n};\n\nexports.createPairs = createPairs;\nexports.pairs = pairs;\nexports.resolvePairs = resolvePairs;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar toJS = require('../../nodes/toJS.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\nvar YAMLSeq = require('../../nodes/YAMLSeq.js');\nvar pairs = require('./pairs.js');\n\nclass YAMLOMap extends YAMLSeq.YAMLSeq {\n constructor() {\n super();\n this.add = YAMLMap.YAMLMap.prototype.add.bind(this);\n this.delete = YAMLMap.YAMLMap.prototype.delete.bind(this);\n this.get = YAMLMap.YAMLMap.prototype.get.bind(this);\n this.has = YAMLMap.YAMLMap.prototype.has.bind(this);\n this.set = YAMLMap.YAMLMap.prototype.set.bind(this);\n this.tag = YAMLOMap.tag;\n }\n /**\n * If `ctx` is given, the return type is actually `Map<unknown, unknown>`,\n * but TypeScript won't allow widening the signature of a child method.\n */\n toJSON(_, ctx) {\n if (!ctx)\n return super.toJSON(_);\n const map = new Map();\n if (ctx?.onCreate)\n ctx.onCreate(map);\n for (const pair of this.items) {\n let key, value;\n if (identity.isPair(pair)) {\n key = toJS.toJS(pair.key, '', ctx);\n value = toJS.toJS(pair.value, key, ctx);\n }\n else {\n key = toJS.toJS(pair, '', ctx);\n }\n if (map.has(key))\n throw new Error('Ordered maps must not include duplicate keys');\n map.set(key, value);\n }\n return map;\n }\n static from(schema, iterable, ctx) {\n const pairs$1 = pairs.createPairs(schema, iterable, ctx);\n const omap = new this();\n omap.items = pairs$1.items;\n return omap;\n }\n}\nYAMLOMap.tag = 'tag:yaml.org,2002:omap';\nconst omap = {\n collection: 'seq',\n identify: value => value instanceof Map,\n nodeClass: YAMLOMap,\n default: false,\n tag: 'tag:yaml.org,2002:omap',\n resolve(seq, onError) {\n const pairs$1 = pairs.resolvePairs(seq, onError);\n const seenKeys = [];\n for (const { key } of pairs$1.items) {\n if (identity.isScalar(key)) {\n if (seenKeys.includes(key.value)) {\n onError(`Ordered maps must not include duplicate keys: ${key.value}`);\n }\n else {\n seenKeys.push(key.value);\n }\n }\n }\n return Object.assign(new YAMLOMap(), pairs$1);\n },\n createNode: (schema, iterable, ctx) => YAMLOMap.from(schema, iterable, ctx)\n};\n\nexports.YAMLOMap = YAMLOMap;\nexports.omap = omap;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\n\nfunction boolStringify({ value, source }, ctx) {\n const boolObj = value ? trueTag : falseTag;\n if (source && boolObj.test.test(source))\n return source;\n return value ? ctx.options.trueStr : ctx.options.falseStr;\n}\nconst trueTag = {\n identify: value => value === true,\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,\n resolve: () => new Scalar.Scalar(true),\n stringify: boolStringify\n};\nconst falseTag = {\n identify: value => value === false,\n default: true,\n tag: 'tag:yaml.org,2002:bool',\n test: /^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,\n resolve: () => new Scalar.Scalar(false),\n stringify: boolStringify\n};\n\nexports.falseTag = falseTag;\nexports.trueTag = trueTag;\n","'use strict';\n\nvar Scalar = require('../../nodes/Scalar.js');\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst floatNaN = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^(?:[-+]?\\.(?:inf|Inf|INF)|\\.nan|\\.NaN|\\.NAN)$/,\n resolve: (str) => str.slice(-3).toLowerCase() === 'nan'\n ? NaN\n : str[0] === '-'\n ? Number.NEGATIVE_INFINITY\n : Number.POSITIVE_INFINITY,\n stringify: stringifyNumber.stringifyNumber\n};\nconst floatExp = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'EXP',\n test: /^[-+]?(?:[0-9][0-9_]*)?(?:\\.[0-9_]*)?[eE][-+]?[0-9]+$/,\n resolve: (str) => parseFloat(str.replace(/_/g, '')),\n stringify(node) {\n const num = Number(node.value);\n return isFinite(num) ? num.toExponential() : stringifyNumber.stringifyNumber(node);\n }\n};\nconst float = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n test: /^[-+]?(?:[0-9][0-9_]*)?\\.[0-9_]*$/,\n resolve(str) {\n const node = new Scalar.Scalar(parseFloat(str.replace(/_/g, '')));\n const dot = str.indexOf('.');\n if (dot !== -1) {\n const f = str.substring(dot + 1).replace(/_/g, '');\n if (f[f.length - 1] === '0')\n node.minFractionDigits = f.length;\n }\n return node;\n },\n stringify: stringifyNumber.stringifyNumber\n};\n\nexports.float = float;\nexports.floatExp = floatExp;\nexports.floatNaN = floatNaN;\n","'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\nconst intIdentify = (value) => typeof value === 'bigint' || Number.isInteger(value);\nfunction intResolve(str, offset, radix, { intAsBigInt }) {\n const sign = str[0];\n if (sign === '-' || sign === '+')\n offset += 1;\n str = str.substring(offset).replace(/_/g, '');\n if (intAsBigInt) {\n switch (radix) {\n case 2:\n str = `0b${str}`;\n break;\n case 8:\n str = `0o${str}`;\n break;\n case 16:\n str = `0x${str}`;\n break;\n }\n const n = BigInt(str);\n return sign === '-' ? BigInt(-1) * n : n;\n }\n const n = parseInt(str, radix);\n return sign === '-' ? -1 * n : n;\n}\nfunction intStringify(node, radix, prefix) {\n const { value } = node;\n if (intIdentify(value)) {\n const str = value.toString(radix);\n return value < 0 ? '-' + prefix + str.substr(1) : prefix + str;\n }\n return stringifyNumber.stringifyNumber(node);\n}\nconst intBin = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'BIN',\n test: /^[-+]?0b[0-1_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 2, opt),\n stringify: node => intStringify(node, 2, '0b')\n};\nconst intOct = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'OCT',\n test: /^[-+]?0[0-7_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 1, 8, opt),\n stringify: node => intStringify(node, 8, '0')\n};\nconst int = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n test: /^[-+]?[0-9][0-9_]*$/,\n resolve: (str, _onError, opt) => intResolve(str, 0, 10, opt),\n stringify: stringifyNumber.stringifyNumber\n};\nconst intHex = {\n identify: intIdentify,\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'HEX',\n test: /^[-+]?0x[0-9a-fA-F_]+$/,\n resolve: (str, _onError, opt) => intResolve(str, 2, 16, opt),\n stringify: node => intStringify(node, 16, '0x')\n};\n\nexports.int = int;\nexports.intBin = intBin;\nexports.intHex = intHex;\nexports.intOct = intOct;\n","'use strict';\n\nvar identity = require('../../nodes/identity.js');\nvar Pair = require('../../nodes/Pair.js');\nvar YAMLMap = require('../../nodes/YAMLMap.js');\n\nclass YAMLSet extends YAMLMap.YAMLMap {\n constructor(schema) {\n super(schema);\n this.tag = YAMLSet.tag;\n }\n add(key) {\n let pair;\n if (identity.isPair(key))\n pair = key;\n else if (key &&\n typeof key === 'object' &&\n 'key' in key &&\n 'value' in key &&\n key.value === null)\n pair = new Pair.Pair(key.key, null);\n else\n pair = new Pair.Pair(key, null);\n const prev = YAMLMap.findPair(this.items, pair.key);\n if (!prev)\n this.items.push(pair);\n }\n /**\n * If `keepPair` is `true`, returns the Pair matching `key`.\n * Otherwise, returns the value of that Pair's key.\n */\n get(key, keepPair) {\n const pair = YAMLMap.findPair(this.items, key);\n return !keepPair && identity.isPair(pair)\n ? identity.isScalar(pair.key)\n ? pair.key.value\n : pair.key\n : pair;\n }\n set(key, value) {\n if (typeof value !== 'boolean')\n throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof value}`);\n const prev = YAMLMap.findPair(this.items, key);\n if (prev && !value) {\n this.items.splice(this.items.indexOf(prev), 1);\n }\n else if (!prev && value) {\n this.items.push(new Pair.Pair(key));\n }\n }\n toJSON(_, ctx) {\n return super.toJSON(_, ctx, Set);\n }\n toString(ctx, onComment, onChompKeep) {\n if (!ctx)\n return JSON.stringify(this);\n if (this.hasAllNullValues(true))\n return super.toString(Object.assign({}, ctx, { allNullValues: true }), onComment, onChompKeep);\n else\n throw new Error('Set items must all have null values');\n }\n static from(schema, iterable, ctx) {\n const { replacer } = ctx;\n const set = new this(schema);\n if (iterable && Symbol.iterator in Object(iterable))\n for (let value of iterable) {\n if (typeof replacer === 'function')\n value = replacer.call(iterable, value, value);\n set.items.push(Pair.createPair(value, null, ctx));\n }\n return set;\n }\n}\nYAMLSet.tag = 'tag:yaml.org,2002:set';\nconst set = {\n collection: 'map',\n identify: value => value instanceof Set,\n nodeClass: YAMLSet,\n default: false,\n tag: 'tag:yaml.org,2002:set',\n createNode: (schema, iterable, ctx) => YAMLSet.from(schema, iterable, ctx),\n resolve(map, onError) {\n if (identity.isMap(map)) {\n if (map.hasAllNullValues(true))\n return Object.assign(new YAMLSet(), map);\n else\n onError('Set items must all have null values');\n }\n else\n onError('Expected a mapping for this tag');\n return map;\n }\n};\n\nexports.YAMLSet = YAMLSet;\nexports.set = set;\n","'use strict';\n\nvar stringifyNumber = require('../../stringify/stringifyNumber.js');\n\n/** Internal types handle bigint as number, because TS can't figure it out. */\nfunction parseSexagesimal(str, asBigInt) {\n const sign = str[0];\n const parts = sign === '-' || sign === '+' ? str.substring(1) : str;\n const num = (n) => asBigInt ? BigInt(n) : Number(n);\n const res = parts\n .replace(/_/g, '')\n .split(':')\n .reduce((res, p) => res * num(60) + num(p), num(0));\n return (sign === '-' ? num(-1) * res : res);\n}\n/**\n * hhhh:mm:ss.sss\n *\n * Internal types handle bigint as number, because TS can't figure it out.\n */\nfunction stringifySexagesimal(node) {\n let { value } = node;\n let num = (n) => n;\n if (typeof value === 'bigint')\n num = n => BigInt(n);\n else if (isNaN(value) || !isFinite(value))\n return stringifyNumber.stringifyNumber(node);\n let sign = '';\n if (value < 0) {\n sign = '-';\n value *= num(-1);\n }\n const _60 = num(60);\n const parts = [value % _60]; // seconds, including ms\n if (value < 60) {\n parts.unshift(0); // at least one : is required\n }\n else {\n value = (value - parts[0]) / _60;\n parts.unshift(value % _60); // minutes\n if (value >= 60) {\n value = (value - parts[0]) / _60;\n parts.unshift(value); // hours\n }\n }\n return (sign +\n parts\n .map(n => String(n).padStart(2, '0'))\n .join(':')\n .replace(/000000\\d*$/, '') // % 60 may introduce error\n );\n}\nconst intTime = {\n identify: value => typeof value === 'bigint' || Number.isInteger(value),\n default: true,\n tag: 'tag:yaml.org,2002:int',\n format: 'TIME',\n test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,\n resolve: (str, _onError, { intAsBigInt }) => parseSexagesimal(str, intAsBigInt),\n stringify: stringifySexagesimal\n};\nconst floatTime = {\n identify: value => typeof value === 'number',\n default: true,\n tag: 'tag:yaml.org,2002:float',\n format: 'TIME',\n test: /^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\\.[0-9_]*$/,\n resolve: str => parseSexagesimal(str, false),\n stringify: stringifySexagesimal\n};\nconst timestamp = {\n identify: value => value instanceof Date,\n default: true,\n tag: 'tag:yaml.org,2002:timestamp',\n // If the time zone is omitted, the timestamp is assumed to be specified in UTC. The time part\n // may be omitted altogether, resulting in a date format. In such a case, the time part is\n // assumed to be 00:00:00Z (start of day, UTC).\n test: RegExp('^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})' + // YYYY-Mm-Dd\n '(?:' + // time is optional\n '(?:t|T|[ \\\\t]+)' + // t | T | whitespace\n '([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\\\.[0-9]+)?)' + // Hh:Mm:Ss(.ss)?\n '(?:[ \\\\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?' + // Z | +5 | -03:30\n ')?$'),\n resolve(str) {\n const match = str.match(timestamp.test);\n if (!match)\n throw new Error('!!timestamp expects a date, starting with yyyy-mm-dd');\n const [, year, month, day, hour, minute, second] = match.map(Number);\n const millisec = match[7] ? Number((match[7] + '00').substr(1, 3)) : 0;\n let date = Date.UTC(year, month - 1, day, hour || 0, minute || 0, second || 0, millisec);\n const tz = match[8];\n if (tz && tz !== 'Z') {\n let d = parseSexagesimal(tz, false);\n if (Math.abs(d) < 30)\n d *= 60;\n date -= 60000 * d;\n }\n return new Date(date);\n },\n stringify: ({ value }) => value?.toISOString().replace(/(T00:00:00)?\\.000Z$/, '') ?? ''\n};\n\nexports.floatTime = floatTime;\nexports.intTime = intTime;\nexports.timestamp = timestamp;\n","'use strict';\n\nvar map = require('../common/map.js');\nvar _null = require('../common/null.js');\nvar seq = require('../common/seq.js');\nvar string = require('../common/string.js');\nvar binary = require('./binary.js');\nvar bool = require('./bool.js');\nvar float = require('./float.js');\nvar int = require('./int.js');\nvar merge = require('./merge.js');\nvar omap = require('./omap.js');\nvar pairs = require('./pairs.js');\nvar set = require('./set.js');\nvar timestamp = require('./timestamp.js');\n\nconst schema = [\n map.map,\n seq.seq,\n string.string,\n _null.nullTag,\n bool.trueTag,\n bool.falseTag,\n int.intBin,\n int.intOct,\n int.int,\n int.intHex,\n float.floatNaN,\n float.floatExp,\n float.float,\n binary.binary,\n merge.merge,\n omap.omap,\n pairs.pairs,\n set.set,\n timestamp.intTime,\n timestamp.floatTime,\n timestamp.timestamp\n];\n\nexports.schema = schema;\n","'use strict';\n\nvar map = require('./common/map.js');\nvar _null = require('./common/null.js');\nvar seq = require('./common/seq.js');\nvar string = require('./common/string.js');\nvar bool = require('./core/bool.js');\nvar float = require('./core/float.js');\nvar int = require('./core/int.js');\nvar schema = require('./core/schema.js');\nvar schema$1 = require('./json/schema.js');\nvar binary = require('./yaml-1.1/binary.js');\nvar merge = require('./yaml-1.1/merge.js');\nvar omap = require('./yaml-1.1/omap.js');\nvar pairs = require('./yaml-1.1/pairs.js');\nvar schema$2 = require('./yaml-1.1/schema.js');\nvar set = require('./yaml-1.1/set.js');\nvar timestamp = require('./yaml-1.1/timestamp.js');\n\nconst schemas = new Map([\n ['core', schema.schema],\n ['failsafe', [map.map, seq.seq, string.string]],\n ['json', schema$1.schema],\n ['yaml11', schema$2.schema],\n ['yaml-1.1', schema$2.schema]\n]);\nconst tagsByName = {\n binary: binary.binary,\n bool: bool.boolTag,\n float: float.float,\n floatExp: float.floatExp,\n floatNaN: float.floatNaN,\n floatTime: timestamp.floatTime,\n int: int.int,\n intHex: int.intHex,\n intOct: int.intOct,\n intTime: timestamp.intTime,\n map: map.map,\n merge: merge.merge,\n null: _null.nullTag,\n omap: omap.omap,\n pairs: pairs.pairs,\n seq: seq.seq,\n set: set.set,\n timestamp: timestamp.timestamp\n};\nconst coreKnownTags = {\n 'tag:yaml.org,2002:binary': binary.binary,\n 'tag:yaml.org,2002:merge': merge.merge,\n 'tag:yaml.org,2002:omap': omap.omap,\n 'tag:yaml.org,2002:pairs': pairs.pairs,\n 'tag:yaml.org,2002:set': set.set,\n 'tag:yaml.org,2002:timestamp': timestamp.timestamp\n};\nfunction getTags(customTags, schemaName, addMergeTag) {\n const schemaTags = schemas.get(schemaName);\n if (schemaTags && !customTags) {\n return addMergeTag && !schemaTags.includes(merge.merge)\n ? schemaTags.concat(merge.merge)\n : schemaTags.slice();\n }\n let tags = schemaTags;\n if (!tags) {\n if (Array.isArray(customTags))\n tags = [];\n else {\n const keys = Array.from(schemas.keys())\n .filter(key => key !== 'yaml11')\n .map(key => JSON.stringify(key))\n .join(', ');\n throw new Error(`Unknown schema \"${schemaName}\"; use one of ${keys} or define customTags array`);\n }\n }\n if (Array.isArray(customTags)) {\n for (const tag of customTags)\n tags = tags.concat(tag);\n }\n else if (typeof customTags === 'function') {\n tags = customTags(tags.slice());\n }\n if (addMergeTag)\n tags = tags.concat(merge.merge);\n return tags.reduce((tags, tag) => {\n const tagObj = typeof tag === 'string' ? tagsByName[tag] : tag;\n if (!tagObj) {\n const tagName = JSON.stringify(tag);\n const keys = Object.keys(tagsByName)\n .map(key => JSON.stringify(key))\n .join(', ');\n throw new Error(`Unknown custom tag ${tagName}; use one of ${keys}`);\n }\n if (!tags.includes(tagObj))\n tags.push(tagObj);\n return tags;\n }, []);\n}\n\nexports.coreKnownTags = coreKnownTags;\nexports.getTags = getTags;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar map = require('./common/map.js');\nvar seq = require('./common/seq.js');\nvar string = require('./common/string.js');\nvar tags = require('./tags.js');\n\nconst sortMapEntriesByKey = (a, b) => a.key < b.key ? -1 : a.key > b.key ? 1 : 0;\nclass Schema {\n constructor({ compat, customTags, merge, resolveKnownTags, schema, sortMapEntries, toStringDefaults }) {\n this.compat = Array.isArray(compat)\n ? tags.getTags(compat, 'compat')\n : compat\n ? tags.getTags(null, compat)\n : null;\n this.name = (typeof schema === 'string' && schema) || 'core';\n this.knownTags = resolveKnownTags ? tags.coreKnownTags : {};\n this.tags = tags.getTags(customTags, this.name, merge);\n this.toStringOptions = toStringDefaults ?? null;\n Object.defineProperty(this, identity.MAP, { value: map.map });\n Object.defineProperty(this, identity.SCALAR, { value: string.string });\n Object.defineProperty(this, identity.SEQ, { value: seq.seq });\n // Used by createMap()\n this.sortMapEntries =\n typeof sortMapEntries === 'function'\n ? sortMapEntries\n : sortMapEntries === true\n ? sortMapEntriesByKey\n : null;\n }\n clone() {\n const copy = Object.create(Schema.prototype, Object.getOwnPropertyDescriptors(this));\n copy.tags = this.tags.slice();\n return copy;\n }\n}\n\nexports.Schema = Schema;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar stringify = require('./stringify.js');\nvar stringifyComment = require('./stringifyComment.js');\n\nfunction stringifyDocument(doc, options) {\n const lines = [];\n let hasDirectives = options.directives === true;\n if (options.directives !== false && doc.directives) {\n const dir = doc.directives.toString(doc);\n if (dir) {\n lines.push(dir);\n hasDirectives = true;\n }\n else if (doc.directives.docStart)\n hasDirectives = true;\n }\n if (hasDirectives)\n lines.push('---');\n const ctx = stringify.createStringifyContext(doc, options);\n const { commentString } = ctx.options;\n if (doc.commentBefore) {\n if (lines.length !== 1)\n lines.unshift('');\n const cs = commentString(doc.commentBefore);\n lines.unshift(stringifyComment.indentComment(cs, ''));\n }\n let chompKeep = false;\n let contentComment = null;\n if (doc.contents) {\n if (identity.isNode(doc.contents)) {\n if (doc.contents.spaceBefore && hasDirectives)\n lines.push('');\n if (doc.contents.commentBefore) {\n const cs = commentString(doc.contents.commentBefore);\n lines.push(stringifyComment.indentComment(cs, ''));\n }\n // top-level block scalars need to be indented if followed by a comment\n ctx.forceBlockIndent = !!doc.comment;\n contentComment = doc.contents.comment;\n }\n const onChompKeep = contentComment ? undefined : () => (chompKeep = true);\n let body = stringify.stringify(doc.contents, ctx, () => (contentComment = null), onChompKeep);\n if (contentComment)\n body += stringifyComment.lineComment(body, '', commentString(contentComment));\n if ((body[0] === '|' || body[0] === '>') &&\n lines[lines.length - 1] === '---') {\n // Top-level block scalars with a preceding doc marker ought to use the\n // same line for their header.\n lines[lines.length - 1] = `--- ${body}`;\n }\n else\n lines.push(body);\n }\n else {\n lines.push(stringify.stringify(doc.contents, ctx));\n }\n if (doc.directives?.docEnd) {\n if (doc.comment) {\n const cs = commentString(doc.comment);\n if (cs.includes('\\n')) {\n lines.push('...');\n lines.push(stringifyComment.indentComment(cs, ''));\n }\n else {\n lines.push(`... ${cs}`);\n }\n }\n else {\n lines.push('...');\n }\n }\n else {\n let dc = doc.comment;\n if (dc && chompKeep)\n dc = dc.replace(/^\\n+/, '');\n if (dc) {\n if ((!chompKeep || contentComment) && lines[lines.length - 1] !== '')\n lines.push('');\n lines.push(stringifyComment.indentComment(commentString(dc), ''));\n }\n }\n return lines.join('\\n') + '\\n';\n}\n\nexports.stringifyDocument = stringifyDocument;\n","'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar Collection = require('../nodes/Collection.js');\nvar identity = require('../nodes/identity.js');\nvar Pair = require('../nodes/Pair.js');\nvar toJS = require('../nodes/toJS.js');\nvar Schema = require('../schema/Schema.js');\nvar stringifyDocument = require('../stringify/stringifyDocument.js');\nvar anchors = require('./anchors.js');\nvar applyReviver = require('./applyReviver.js');\nvar createNode = require('./createNode.js');\nvar directives = require('./directives.js');\n\nclass Document {\n constructor(value, replacer, options) {\n /** A comment before this Document */\n this.commentBefore = null;\n /** A comment immediately after this Document */\n this.comment = null;\n /** Errors encountered during parsing. */\n this.errors = [];\n /** Warnings encountered during parsing. */\n this.warnings = [];\n Object.defineProperty(this, identity.NODE_TYPE, { value: identity.DOC });\n let _replacer = null;\n if (typeof replacer === 'function' || Array.isArray(replacer)) {\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n replacer = undefined;\n }\n const opt = Object.assign({\n intAsBigInt: false,\n keepSourceTokens: false,\n logLevel: 'warn',\n prettyErrors: true,\n strict: true,\n stringKeys: false,\n uniqueKeys: true,\n version: '1.2'\n }, options);\n this.options = opt;\n let { version } = opt;\n if (options?._directives) {\n this.directives = options._directives.atDocument();\n if (this.directives.yaml.explicit)\n version = this.directives.yaml.version;\n }\n else\n this.directives = new directives.Directives({ version });\n this.setSchema(version, options);\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents =\n value === undefined ? null : this.createNode(value, _replacer, options);\n }\n /**\n * Create a deep copy of this Document and its contents.\n *\n * Custom Node values that inherit from `Object` still refer to their original instances.\n */\n clone() {\n const copy = Object.create(Document.prototype, {\n [identity.NODE_TYPE]: { value: identity.DOC }\n });\n copy.commentBefore = this.commentBefore;\n copy.comment = this.comment;\n copy.errors = this.errors.slice();\n copy.warnings = this.warnings.slice();\n copy.options = Object.assign({}, this.options);\n if (this.directives)\n copy.directives = this.directives.clone();\n copy.schema = this.schema.clone();\n // @ts-expect-error We can't really know that this matches Contents.\n copy.contents = identity.isNode(this.contents)\n ? this.contents.clone(copy.schema)\n : this.contents;\n if (this.range)\n copy.range = this.range.slice();\n return copy;\n }\n /** Adds a value to the document. */\n add(value) {\n if (assertCollection(this.contents))\n this.contents.add(value);\n }\n /** Adds a value to the document. */\n addIn(path, value) {\n if (assertCollection(this.contents))\n this.contents.addIn(path, value);\n }\n /**\n * Create a new `Alias` node, ensuring that the target `node` has the required anchor.\n *\n * If `node` already has an anchor, `name` is ignored.\n * Otherwise, the `node.anchor` value will be set to `name`,\n * or if an anchor with that name is already present in the document,\n * `name` will be used as a prefix for a new unique anchor.\n * If `name` is undefined, the generated anchor will use 'a' as a prefix.\n */\n createAlias(node, name) {\n if (!node.anchor) {\n const prev = anchors.anchorNames(this);\n node.anchor =\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n !name || prev.has(name) ? anchors.findNewAnchor(name || 'a', prev) : name;\n }\n return new Alias.Alias(node.anchor);\n }\n createNode(value, replacer, options) {\n let _replacer = undefined;\n if (typeof replacer === 'function') {\n value = replacer.call({ '': value }, '', value);\n _replacer = replacer;\n }\n else if (Array.isArray(replacer)) {\n const keyToStr = (v) => typeof v === 'number' || v instanceof String || v instanceof Number;\n const asStr = replacer.filter(keyToStr).map(String);\n if (asStr.length > 0)\n replacer = replacer.concat(asStr);\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n replacer = undefined;\n }\n const { aliasDuplicateObjects, anchorPrefix, flow, keepUndefined, onTagObj, tag } = options ?? {};\n const { onAnchor, setAnchors, sourceObjects } = anchors.createNodeAnchors(this, \n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n anchorPrefix || 'a');\n const ctx = {\n aliasDuplicateObjects: aliasDuplicateObjects ?? true,\n keepUndefined: keepUndefined ?? false,\n onAnchor,\n onTagObj,\n replacer: _replacer,\n schema: this.schema,\n sourceObjects\n };\n const node = createNode.createNode(value, tag, ctx);\n if (flow && identity.isCollection(node))\n node.flow = true;\n setAnchors();\n return node;\n }\n /**\n * Convert a key and a value into a `Pair` using the current schema,\n * recursively wrapping all values as `Scalar` or `Collection` nodes.\n */\n createPair(key, value, options = {}) {\n const k = this.createNode(key, null, options);\n const v = this.createNode(value, null, options);\n return new Pair.Pair(k, v);\n }\n /**\n * Removes a value from the document.\n * @returns `true` if the item was found and removed.\n */\n delete(key) {\n return assertCollection(this.contents) ? this.contents.delete(key) : false;\n }\n /**\n * Removes a value from the document.\n * @returns `true` if the item was found and removed.\n */\n deleteIn(path) {\n if (Collection.isEmptyPath(path)) {\n if (this.contents == null)\n return false;\n // @ts-expect-error Presumed impossible if Strict extends false\n this.contents = null;\n return true;\n }\n return assertCollection(this.contents)\n ? this.contents.deleteIn(path)\n : false;\n }\n /**\n * Returns item at `key`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n get(key, keepScalar) {\n return identity.isCollection(this.contents)\n ? this.contents.get(key, keepScalar)\n : undefined;\n }\n /**\n * Returns item at `path`, or `undefined` if not found. By default unwraps\n * scalar values from their surrounding node; to disable set `keepScalar` to\n * `true` (collections are always returned intact).\n */\n getIn(path, keepScalar) {\n if (Collection.isEmptyPath(path))\n return !keepScalar && identity.isScalar(this.contents)\n ? this.contents.value\n : this.contents;\n return identity.isCollection(this.contents)\n ? this.contents.getIn(path, keepScalar)\n : undefined;\n }\n /**\n * Checks if the document includes a value with the key `key`.\n */\n has(key) {\n return identity.isCollection(this.contents) ? this.contents.has(key) : false;\n }\n /**\n * Checks if the document includes a value at `path`.\n */\n hasIn(path) {\n if (Collection.isEmptyPath(path))\n return this.contents !== undefined;\n return identity.isCollection(this.contents) ? this.contents.hasIn(path) : false;\n }\n /**\n * Sets a value in this document. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n set(key, value) {\n if (this.contents == null) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = Collection.collectionFromPath(this.schema, [key], value);\n }\n else if (assertCollection(this.contents)) {\n this.contents.set(key, value);\n }\n }\n /**\n * Sets a value in this document. For `!!set`, `value` needs to be a\n * boolean to add/remove the item from the set.\n */\n setIn(path, value) {\n if (Collection.isEmptyPath(path)) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = value;\n }\n else if (this.contents == null) {\n // @ts-expect-error We can't really know that this matches Contents.\n this.contents = Collection.collectionFromPath(this.schema, Array.from(path), value);\n }\n else if (assertCollection(this.contents)) {\n this.contents.setIn(path, value);\n }\n }\n /**\n * Change the YAML version and schema used by the document.\n * A `null` version disables support for directives, explicit tags, anchors, and aliases.\n * It also requires the `schema` option to be given as a `Schema` instance value.\n *\n * Overrides all previously set schema options.\n */\n setSchema(version, options = {}) {\n if (typeof version === 'number')\n version = String(version);\n let opt;\n switch (version) {\n case '1.1':\n if (this.directives)\n this.directives.yaml.version = '1.1';\n else\n this.directives = new directives.Directives({ version: '1.1' });\n opt = { resolveKnownTags: false, schema: 'yaml-1.1' };\n break;\n case '1.2':\n case 'next':\n if (this.directives)\n this.directives.yaml.version = version;\n else\n this.directives = new directives.Directives({ version });\n opt = { resolveKnownTags: true, schema: 'core' };\n break;\n case null:\n if (this.directives)\n delete this.directives;\n opt = null;\n break;\n default: {\n const sv = JSON.stringify(version);\n throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${sv}`);\n }\n }\n // Not using `instanceof Schema` to allow for duck typing\n if (options.schema instanceof Object)\n this.schema = options.schema;\n else if (opt)\n this.schema = new Schema.Schema(Object.assign(opt, options));\n else\n throw new Error(`With a null YAML version, the { schema: Schema } option is required`);\n }\n // json & jsonArg are only used from toJSON()\n toJS({ json, jsonArg, mapAsMap, maxAliasCount, onAnchor, reviver } = {}) {\n const ctx = {\n anchors: new Map(),\n doc: this,\n keep: !json,\n mapAsMap: mapAsMap === true,\n mapKeyWarned: false,\n maxAliasCount: typeof maxAliasCount === 'number' ? maxAliasCount : 100\n };\n const res = toJS.toJS(this.contents, jsonArg ?? '', ctx);\n if (typeof onAnchor === 'function')\n for (const { count, res } of ctx.anchors.values())\n onAnchor(res, count);\n return typeof reviver === 'function'\n ? applyReviver.applyReviver(reviver, { '': res }, '', res)\n : res;\n }\n /**\n * A JSON representation of the document `contents`.\n *\n * @param jsonArg Used by `JSON.stringify` to indicate the array index or\n * property name.\n */\n toJSON(jsonArg, onAnchor) {\n return this.toJS({ json: true, jsonArg, mapAsMap: false, onAnchor });\n }\n /** A YAML representation of the document. */\n toString(options = {}) {\n if (this.errors.length > 0)\n throw new Error('Document with errors cannot be stringified');\n if ('indent' in options &&\n (!Number.isInteger(options.indent) || Number(options.indent) <= 0)) {\n const s = JSON.stringify(options.indent);\n throw new Error(`\"indent\" option must be a positive integer, not ${s}`);\n }\n return stringifyDocument.stringifyDocument(this, options);\n }\n}\nfunction assertCollection(contents) {\n if (identity.isCollection(contents))\n return true;\n throw new Error('Expected a YAML collection as document contents');\n}\n\nexports.Document = Document;\n","'use strict';\n\nclass YAMLError extends Error {\n constructor(name, pos, code, message) {\n super();\n this.name = name;\n this.code = code;\n this.message = message;\n this.pos = pos;\n }\n}\nclass YAMLParseError extends YAMLError {\n constructor(pos, code, message) {\n super('YAMLParseError', pos, code, message);\n }\n}\nclass YAMLWarning extends YAMLError {\n constructor(pos, code, message) {\n super('YAMLWarning', pos, code, message);\n }\n}\nconst prettifyError = (src, lc) => (error) => {\n if (error.pos[0] === -1)\n return;\n error.linePos = error.pos.map(pos => lc.linePos(pos));\n const { line, col } = error.linePos[0];\n error.message += ` at line ${line}, column ${col}`;\n let ci = col - 1;\n let lineStr = src\n .substring(lc.lineStarts[line - 1], lc.lineStarts[line])\n .replace(/[\\n\\r]+$/, '');\n // Trim to max 80 chars, keeping col position near the middle\n if (ci >= 60 && lineStr.length > 80) {\n const trimStart = Math.min(ci - 39, lineStr.length - 79);\n lineStr = '…' + lineStr.substring(trimStart);\n ci -= trimStart - 1;\n }\n if (lineStr.length > 80)\n lineStr = lineStr.substring(0, 79) + '…';\n // Include previous line in context if pointing at line start\n if (line > 1 && /^ *$/.test(lineStr.substring(0, ci))) {\n // Regexp won't match if start is trimmed\n let prev = src.substring(lc.lineStarts[line - 2], lc.lineStarts[line - 1]);\n if (prev.length > 80)\n prev = prev.substring(0, 79) + '…\\n';\n lineStr = prev + lineStr;\n }\n if (/[^ ]/.test(lineStr)) {\n let count = 1;\n const end = error.linePos[1];\n if (end && end.line === line && end.col > col) {\n count = Math.max(1, Math.min(end.col - col, 80 - ci));\n }\n const pointer = ' '.repeat(ci) + '^'.repeat(count);\n error.message += `:\\n\\n${lineStr}\\n${pointer}\\n`;\n }\n};\n\nexports.YAMLError = YAMLError;\nexports.YAMLParseError = YAMLParseError;\nexports.YAMLWarning = YAMLWarning;\nexports.prettifyError = prettifyError;\n","'use strict';\n\nfunction resolveProps(tokens, { flow, indicator, next, offset, onError, parentIndent, startOnNewline }) {\n let spaceBefore = false;\n let atNewline = startOnNewline;\n let hasSpace = startOnNewline;\n let comment = '';\n let commentSep = '';\n let hasNewline = false;\n let reqSpace = false;\n let tab = null;\n let anchor = null;\n let tag = null;\n let newlineAfterProp = null;\n let comma = null;\n let found = null;\n let start = null;\n for (const token of tokens) {\n if (reqSpace) {\n if (token.type !== 'space' &&\n token.type !== 'newline' &&\n token.type !== 'comma')\n onError(token.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');\n reqSpace = false;\n }\n if (tab) {\n if (atNewline && token.type !== 'comment' && token.type !== 'newline') {\n onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');\n }\n tab = null;\n }\n switch (token.type) {\n case 'space':\n // At the doc level, tabs at line start may be parsed\n // as leading white space rather than indentation.\n // In a flow collection, only the parser handles indent.\n if (!flow &&\n (indicator !== 'doc-start' || next?.type !== 'flow-collection') &&\n token.source.includes('\\t')) {\n tab = token;\n }\n hasSpace = true;\n break;\n case 'comment': {\n if (!hasSpace)\n onError(token, 'MISSING_CHAR', 'Comments must be separated from other tokens by white space characters');\n const cb = token.source.substring(1) || ' ';\n if (!comment)\n comment = cb;\n else\n comment += commentSep + cb;\n commentSep = '';\n atNewline = false;\n break;\n }\n case 'newline':\n if (atNewline) {\n if (comment)\n comment += token.source;\n else if (!found || indicator !== 'seq-item-ind')\n spaceBefore = true;\n }\n else\n commentSep += token.source;\n atNewline = true;\n hasNewline = true;\n if (anchor || tag)\n newlineAfterProp = token;\n hasSpace = true;\n break;\n case 'anchor':\n if (anchor)\n onError(token, 'MULTIPLE_ANCHORS', 'A node can have at most one anchor');\n if (token.source.endsWith(':'))\n onError(token.offset + token.source.length - 1, 'BAD_ALIAS', 'Anchor ending in : is ambiguous', true);\n anchor = token;\n start ?? (start = token.offset);\n atNewline = false;\n hasSpace = false;\n reqSpace = true;\n break;\n case 'tag': {\n if (tag)\n onError(token, 'MULTIPLE_TAGS', 'A node can have at most one tag');\n tag = token;\n start ?? (start = token.offset);\n atNewline = false;\n hasSpace = false;\n reqSpace = true;\n break;\n }\n case indicator:\n // Could here handle preceding comments differently\n if (anchor || tag)\n onError(token, 'BAD_PROP_ORDER', `Anchors and tags must be after the ${token.source} indicator`);\n if (found)\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.source} in ${flow ?? 'collection'}`);\n found = token;\n atNewline =\n indicator === 'seq-item-ind' || indicator === 'explicit-key-ind';\n hasSpace = false;\n break;\n case 'comma':\n if (flow) {\n if (comma)\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected , in ${flow}`);\n comma = token;\n atNewline = false;\n hasSpace = false;\n break;\n }\n // else fallthrough\n default:\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${token.type} token`);\n atNewline = false;\n hasSpace = false;\n }\n }\n const last = tokens[tokens.length - 1];\n const end = last ? last.offset + last.source.length : offset;\n if (reqSpace &&\n next &&\n next.type !== 'space' &&\n next.type !== 'newline' &&\n next.type !== 'comma' &&\n (next.type !== 'scalar' || next.source !== '')) {\n onError(next.offset, 'MISSING_CHAR', 'Tags and anchors must be separated from the next token by white space');\n }\n if (tab &&\n ((atNewline && tab.indent <= parentIndent) ||\n next?.type === 'block-map' ||\n next?.type === 'block-seq'))\n onError(tab, 'TAB_AS_INDENT', 'Tabs are not allowed as indentation');\n return {\n comma,\n found,\n spaceBefore,\n comment,\n hasNewline,\n anchor,\n tag,\n newlineAfterProp,\n end,\n start: start ?? end\n };\n}\n\nexports.resolveProps = resolveProps;\n","'use strict';\n\nfunction containsNewline(key) {\n if (!key)\n return null;\n switch (key.type) {\n case 'alias':\n case 'scalar':\n case 'double-quoted-scalar':\n case 'single-quoted-scalar':\n if (key.source.includes('\\n'))\n return true;\n if (key.end)\n for (const st of key.end)\n if (st.type === 'newline')\n return true;\n return false;\n case 'flow-collection':\n for (const it of key.items) {\n for (const st of it.start)\n if (st.type === 'newline')\n return true;\n if (it.sep)\n for (const st of it.sep)\n if (st.type === 'newline')\n return true;\n if (containsNewline(it.key) || containsNewline(it.value))\n return true;\n }\n return false;\n default:\n return true;\n }\n}\n\nexports.containsNewline = containsNewline;\n","'use strict';\n\nvar utilContainsNewline = require('./util-contains-newline.js');\n\nfunction flowIndentCheck(indent, fc, onError) {\n if (fc?.type === 'flow-collection') {\n const end = fc.end[0];\n if (end.indent === indent &&\n (end.source === ']' || end.source === '}') &&\n utilContainsNewline.containsNewline(fc)) {\n const msg = 'Flow end indicator should be more indented than parent';\n onError(end, 'BAD_INDENT', msg, true);\n }\n }\n}\n\nexports.flowIndentCheck = flowIndentCheck;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\n\nfunction mapIncludes(ctx, items, search) {\n const { uniqueKeys } = ctx.options;\n if (uniqueKeys === false)\n return false;\n const isEqual = typeof uniqueKeys === 'function'\n ? uniqueKeys\n : (a, b) => a === b || (identity.isScalar(a) && identity.isScalar(b) && a.value === b.value);\n return items.some(pair => isEqual(pair.key, search));\n}\n\nexports.mapIncludes = mapIncludes;\n","'use strict';\n\nvar Pair = require('../nodes/Pair.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilContainsNewline = require('./util-contains-newline.js');\nvar utilFlowIndentCheck = require('./util-flow-indent-check.js');\nvar utilMapIncludes = require('./util-map-includes.js');\n\nconst startColMsg = 'All mapping items must start at the same column';\nfunction resolveBlockMap({ composeNode, composeEmptyNode }, ctx, bm, onError, tag) {\n const NodeClass = tag?.nodeClass ?? YAMLMap.YAMLMap;\n const map = new NodeClass(ctx.schema);\n if (ctx.atRoot)\n ctx.atRoot = false;\n let offset = bm.offset;\n let commentEnd = null;\n for (const collItem of bm.items) {\n const { start, key, sep, value } = collItem;\n // key properties\n const keyProps = resolveProps.resolveProps(start, {\n indicator: 'explicit-key-ind',\n next: key ?? sep?.[0],\n offset,\n onError,\n parentIndent: bm.indent,\n startOnNewline: true\n });\n const implicitKey = !keyProps.found;\n if (implicitKey) {\n if (key) {\n if (key.type === 'block-seq')\n onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'A block sequence may not be used as an implicit map key');\n else if ('indent' in key && key.indent !== bm.indent)\n onError(offset, 'BAD_INDENT', startColMsg);\n }\n if (!keyProps.anchor && !keyProps.tag && !sep) {\n commentEnd = keyProps.end;\n if (keyProps.comment) {\n if (map.comment)\n map.comment += '\\n' + keyProps.comment;\n else\n map.comment = keyProps.comment;\n }\n continue;\n }\n if (keyProps.newlineAfterProp || utilContainsNewline.containsNewline(key)) {\n onError(key ?? start[start.length - 1], 'MULTILINE_IMPLICIT_KEY', 'Implicit keys need to be on a single line');\n }\n }\n else if (keyProps.found?.indent !== bm.indent) {\n onError(offset, 'BAD_INDENT', startColMsg);\n }\n // key value\n ctx.atKey = true;\n const keyStart = keyProps.end;\n const keyNode = key\n ? composeNode(ctx, key, keyProps, onError)\n : composeEmptyNode(ctx, keyStart, start, null, keyProps, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bm.indent, key, onError);\n ctx.atKey = false;\n if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))\n onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');\n // value properties\n const valueProps = resolveProps.resolveProps(sep ?? [], {\n indicator: 'map-value-ind',\n next: value,\n offset: keyNode.range[2],\n onError,\n parentIndent: bm.indent,\n startOnNewline: !key || key.type === 'block-scalar'\n });\n offset = valueProps.end;\n if (valueProps.found) {\n if (implicitKey) {\n if (value?.type === 'block-map' && !valueProps.hasNewline)\n onError(offset, 'BLOCK_AS_IMPLICIT_KEY', 'Nested mappings are not allowed in compact mappings');\n if (ctx.options.strict &&\n keyProps.start < valueProps.found.offset - 1024)\n onError(keyNode.range, 'KEY_OVER_1024_CHARS', 'The : indicator must be at most 1024 chars after the start of an implicit block mapping key');\n }\n // value value\n const valueNode = value\n ? composeNode(ctx, value, valueProps, onError)\n : composeEmptyNode(ctx, offset, sep, null, valueProps, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bm.indent, value, onError);\n offset = valueNode.range[2];\n const pair = new Pair.Pair(keyNode, valueNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n map.items.push(pair);\n }\n else {\n // key with no value\n if (implicitKey)\n onError(keyNode.range, 'MISSING_CHAR', 'Implicit map keys need to be followed by map values');\n if (valueProps.comment) {\n if (keyNode.comment)\n keyNode.comment += '\\n' + valueProps.comment;\n else\n keyNode.comment = valueProps.comment;\n }\n const pair = new Pair.Pair(keyNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n map.items.push(pair);\n }\n }\n if (commentEnd && commentEnd < offset)\n onError(commentEnd, 'IMPOSSIBLE', 'Map comment with trailing content');\n map.range = [bm.offset, offset, commentEnd ?? offset];\n return map;\n}\n\nexports.resolveBlockMap = resolveBlockMap;\n","'use strict';\n\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilFlowIndentCheck = require('./util-flow-indent-check.js');\n\nfunction resolveBlockSeq({ composeNode, composeEmptyNode }, ctx, bs, onError, tag) {\n const NodeClass = tag?.nodeClass ?? YAMLSeq.YAMLSeq;\n const seq = new NodeClass(ctx.schema);\n if (ctx.atRoot)\n ctx.atRoot = false;\n if (ctx.atKey)\n ctx.atKey = false;\n let offset = bs.offset;\n let commentEnd = null;\n for (const { start, value } of bs.items) {\n const props = resolveProps.resolveProps(start, {\n indicator: 'seq-item-ind',\n next: value,\n offset,\n onError,\n parentIndent: bs.indent,\n startOnNewline: true\n });\n if (!props.found) {\n if (props.anchor || props.tag || value) {\n if (value && value.type === 'block-seq')\n onError(props.end, 'BAD_INDENT', 'All sequence items must start at the same column');\n else\n onError(offset, 'MISSING_CHAR', 'Sequence item without - indicator');\n }\n else {\n commentEnd = props.end;\n if (props.comment)\n seq.comment = props.comment;\n continue;\n }\n }\n const node = value\n ? composeNode(ctx, value, props, onError)\n : composeEmptyNode(ctx, props.end, start, null, props, onError);\n if (ctx.schema.compat)\n utilFlowIndentCheck.flowIndentCheck(bs.indent, value, onError);\n offset = node.range[2];\n seq.items.push(node);\n }\n seq.range = [bs.offset, offset, commentEnd ?? offset];\n return seq;\n}\n\nexports.resolveBlockSeq = resolveBlockSeq;\n","'use strict';\n\nfunction resolveEnd(end, offset, reqSpace, onError) {\n let comment = '';\n if (end) {\n let hasSpace = false;\n let sep = '';\n for (const token of end) {\n const { source, type } = token;\n switch (type) {\n case 'space':\n hasSpace = true;\n break;\n case 'comment': {\n if (reqSpace && !hasSpace)\n onError(token, 'MISSING_CHAR', 'Comments must be separated from other tokens by white space characters');\n const cb = source.substring(1) || ' ';\n if (!comment)\n comment = cb;\n else\n comment += sep + cb;\n sep = '';\n break;\n }\n case 'newline':\n if (comment)\n sep += source;\n hasSpace = true;\n break;\n default:\n onError(token, 'UNEXPECTED_TOKEN', `Unexpected ${type} at node end`);\n }\n offset += source.length;\n }\n }\n return { comment, offset };\n}\n\nexports.resolveEnd = resolveEnd;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Pair = require('../nodes/Pair.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveEnd = require('./resolve-end.js');\nvar resolveProps = require('./resolve-props.js');\nvar utilContainsNewline = require('./util-contains-newline.js');\nvar utilMapIncludes = require('./util-map-includes.js');\n\nconst blockMsg = 'Block collections are not allowed within flow collections';\nconst isBlock = (token) => token && (token.type === 'block-map' || token.type === 'block-seq');\nfunction resolveFlowCollection({ composeNode, composeEmptyNode }, ctx, fc, onError, tag) {\n const isMap = fc.start.source === '{';\n const fcName = isMap ? 'flow map' : 'flow sequence';\n const NodeClass = (tag?.nodeClass ?? (isMap ? YAMLMap.YAMLMap : YAMLSeq.YAMLSeq));\n const coll = new NodeClass(ctx.schema);\n coll.flow = true;\n const atRoot = ctx.atRoot;\n if (atRoot)\n ctx.atRoot = false;\n if (ctx.atKey)\n ctx.atKey = false;\n let offset = fc.offset + fc.start.source.length;\n for (let i = 0; i < fc.items.length; ++i) {\n const collItem = fc.items[i];\n const { start, key, sep, value } = collItem;\n const props = resolveProps.resolveProps(start, {\n flow: fcName,\n indicator: 'explicit-key-ind',\n next: key ?? sep?.[0],\n offset,\n onError,\n parentIndent: fc.indent,\n startOnNewline: false\n });\n if (!props.found) {\n if (!props.anchor && !props.tag && !sep && !value) {\n if (i === 0 && props.comma)\n onError(props.comma, 'UNEXPECTED_TOKEN', `Unexpected , in ${fcName}`);\n else if (i < fc.items.length - 1)\n onError(props.start, 'UNEXPECTED_TOKEN', `Unexpected empty item in ${fcName}`);\n if (props.comment) {\n if (coll.comment)\n coll.comment += '\\n' + props.comment;\n else\n coll.comment = props.comment;\n }\n offset = props.end;\n continue;\n }\n if (!isMap && ctx.options.strict && utilContainsNewline.containsNewline(key))\n onError(key, // checked by containsNewline()\n 'MULTILINE_IMPLICIT_KEY', 'Implicit keys of flow sequence pairs need to be on a single line');\n }\n if (i === 0) {\n if (props.comma)\n onError(props.comma, 'UNEXPECTED_TOKEN', `Unexpected , in ${fcName}`);\n }\n else {\n if (!props.comma)\n onError(props.start, 'MISSING_CHAR', `Missing , between ${fcName} items`);\n if (props.comment) {\n let prevItemComment = '';\n loop: for (const st of start) {\n switch (st.type) {\n case 'comma':\n case 'space':\n break;\n case 'comment':\n prevItemComment = st.source.substring(1);\n break loop;\n default:\n break loop;\n }\n }\n if (prevItemComment) {\n let prev = coll.items[coll.items.length - 1];\n if (identity.isPair(prev))\n prev = prev.value ?? prev.key;\n if (prev.comment)\n prev.comment += '\\n' + prevItemComment;\n else\n prev.comment = prevItemComment;\n props.comment = props.comment.substring(prevItemComment.length + 1);\n }\n }\n }\n if (!isMap && !sep && !props.found) {\n // item is a value in a seq\n // → key & sep are empty, start does not include ? or :\n const valueNode = value\n ? composeNode(ctx, value, props, onError)\n : composeEmptyNode(ctx, props.end, sep, null, props, onError);\n coll.items.push(valueNode);\n offset = valueNode.range[2];\n if (isBlock(value))\n onError(valueNode.range, 'BLOCK_IN_FLOW', blockMsg);\n }\n else {\n // item is a key+value pair\n // key value\n ctx.atKey = true;\n const keyStart = props.end;\n const keyNode = key\n ? composeNode(ctx, key, props, onError)\n : composeEmptyNode(ctx, keyStart, start, null, props, onError);\n if (isBlock(key))\n onError(keyNode.range, 'BLOCK_IN_FLOW', blockMsg);\n ctx.atKey = false;\n // value properties\n const valueProps = resolveProps.resolveProps(sep ?? [], {\n flow: fcName,\n indicator: 'map-value-ind',\n next: value,\n offset: keyNode.range[2],\n onError,\n parentIndent: fc.indent,\n startOnNewline: false\n });\n if (valueProps.found) {\n if (!isMap && !props.found && ctx.options.strict) {\n if (sep)\n for (const st of sep) {\n if (st === valueProps.found)\n break;\n if (st.type === 'newline') {\n onError(st, 'MULTILINE_IMPLICIT_KEY', 'Implicit keys of flow sequence pairs need to be on a single line');\n break;\n }\n }\n if (props.start < valueProps.found.offset - 1024)\n onError(valueProps.found, 'KEY_OVER_1024_CHARS', 'The : indicator must be at most 1024 chars after the start of an implicit flow sequence key');\n }\n }\n else if (value) {\n if ('source' in value && value.source && value.source[0] === ':')\n onError(value, 'MISSING_CHAR', `Missing space after : in ${fcName}`);\n else\n onError(valueProps.start, 'MISSING_CHAR', `Missing , or : between ${fcName} items`);\n }\n // value value\n const valueNode = value\n ? composeNode(ctx, value, valueProps, onError)\n : valueProps.found\n ? composeEmptyNode(ctx, valueProps.end, sep, null, valueProps, onError)\n : null;\n if (valueNode) {\n if (isBlock(value))\n onError(valueNode.range, 'BLOCK_IN_FLOW', blockMsg);\n }\n else if (valueProps.comment) {\n if (keyNode.comment)\n keyNode.comment += '\\n' + valueProps.comment;\n else\n keyNode.comment = valueProps.comment;\n }\n const pair = new Pair.Pair(keyNode, valueNode);\n if (ctx.options.keepSourceTokens)\n pair.srcToken = collItem;\n if (isMap) {\n const map = coll;\n if (utilMapIncludes.mapIncludes(ctx, map.items, keyNode))\n onError(keyStart, 'DUPLICATE_KEY', 'Map keys must be unique');\n map.items.push(pair);\n }\n else {\n const map = new YAMLMap.YAMLMap(ctx.schema);\n map.flow = true;\n map.items.push(pair);\n const endRange = (valueNode ?? keyNode).range;\n map.range = [keyNode.range[0], endRange[1], endRange[2]];\n coll.items.push(map);\n }\n offset = valueNode ? valueNode.range[2] : valueProps.end;\n }\n }\n const expectedEnd = isMap ? '}' : ']';\n const [ce, ...ee] = fc.end;\n let cePos = offset;\n if (ce && ce.source === expectedEnd)\n cePos = ce.offset + ce.source.length;\n else {\n const name = fcName[0].toUpperCase() + fcName.substring(1);\n const msg = atRoot\n ? `${name} must end with a ${expectedEnd}`\n : `${name} in block collection must be sufficiently indented and end with a ${expectedEnd}`;\n onError(offset, atRoot ? 'MISSING_CHAR' : 'BAD_INDENT', msg);\n if (ce && ce.source.length !== 1)\n ee.unshift(ce);\n }\n if (ee.length > 0) {\n const end = resolveEnd.resolveEnd(ee, cePos, ctx.options.strict, onError);\n if (end.comment) {\n if (coll.comment)\n coll.comment += '\\n' + end.comment;\n else\n coll.comment = end.comment;\n }\n coll.range = [fc.offset, cePos, end.offset];\n }\n else {\n coll.range = [fc.offset, cePos, cePos];\n }\n return coll;\n}\n\nexports.resolveFlowCollection = resolveFlowCollection;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar YAMLMap = require('../nodes/YAMLMap.js');\nvar YAMLSeq = require('../nodes/YAMLSeq.js');\nvar resolveBlockMap = require('./resolve-block-map.js');\nvar resolveBlockSeq = require('./resolve-block-seq.js');\nvar resolveFlowCollection = require('./resolve-flow-collection.js');\n\nfunction resolveCollection(CN, ctx, token, onError, tagName, tag) {\n const coll = token.type === 'block-map'\n ? resolveBlockMap.resolveBlockMap(CN, ctx, token, onError, tag)\n : token.type === 'block-seq'\n ? resolveBlockSeq.resolveBlockSeq(CN, ctx, token, onError, tag)\n : resolveFlowCollection.resolveFlowCollection(CN, ctx, token, onError, tag);\n const Coll = coll.constructor;\n // If we got a tagName matching the class, or the tag name is '!',\n // then use the tagName from the node class used to create it.\n if (tagName === '!' || tagName === Coll.tagName) {\n coll.tag = Coll.tagName;\n return coll;\n }\n if (tagName)\n coll.tag = tagName;\n return coll;\n}\nfunction composeCollection(CN, ctx, token, props, onError) {\n const tagToken = props.tag;\n const tagName = !tagToken\n ? null\n : ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg));\n if (token.type === 'block-seq') {\n const { anchor, newlineAfterProp: nl } = props;\n const lastProp = anchor && tagToken\n ? anchor.offset > tagToken.offset\n ? anchor\n : tagToken\n : (anchor ?? tagToken);\n if (lastProp && (!nl || nl.offset < lastProp.offset)) {\n const message = 'Missing newline after block sequence props';\n onError(lastProp, 'MISSING_CHAR', message);\n }\n }\n const expType = token.type === 'block-map'\n ? 'map'\n : token.type === 'block-seq'\n ? 'seq'\n : token.start.source === '{'\n ? 'map'\n : 'seq';\n // shortcut: check if it's a generic YAMLMap or YAMLSeq\n // before jumping into the custom tag logic.\n if (!tagToken ||\n !tagName ||\n tagName === '!' ||\n (tagName === YAMLMap.YAMLMap.tagName && expType === 'map') ||\n (tagName === YAMLSeq.YAMLSeq.tagName && expType === 'seq')) {\n return resolveCollection(CN, ctx, token, onError, tagName);\n }\n let tag = ctx.schema.tags.find(t => t.tag === tagName && t.collection === expType);\n if (!tag) {\n const kt = ctx.schema.knownTags[tagName];\n if (kt && kt.collection === expType) {\n ctx.schema.tags.push(Object.assign({}, kt, { default: false }));\n tag = kt;\n }\n else {\n if (kt) {\n onError(tagToken, 'BAD_COLLECTION_TYPE', `${kt.tag} used for ${expType} collection, but expects ${kt.collection ?? 'scalar'}`, true);\n }\n else {\n onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, true);\n }\n return resolveCollection(CN, ctx, token, onError, tagName);\n }\n }\n const coll = resolveCollection(CN, ctx, token, onError, tagName, tag);\n const res = tag.resolve?.(coll, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg), ctx.options) ?? coll;\n const node = identity.isNode(res)\n ? res\n : new Scalar.Scalar(res);\n node.range = coll.range;\n node.tag = tagName;\n if (tag?.format)\n node.format = tag.format;\n return node;\n}\n\nexports.composeCollection = composeCollection;\n","'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\n\nfunction resolveBlockScalar(ctx, scalar, onError) {\n const start = scalar.offset;\n const header = parseBlockScalarHeader(scalar, ctx.options.strict, onError);\n if (!header)\n return { value: '', type: null, comment: '', range: [start, start, start] };\n const type = header.mode === '>' ? Scalar.Scalar.BLOCK_FOLDED : Scalar.Scalar.BLOCK_LITERAL;\n const lines = scalar.source ? splitLines(scalar.source) : [];\n // determine the end of content & start of chomping\n let chompStart = lines.length;\n for (let i = lines.length - 1; i >= 0; --i) {\n const content = lines[i][1];\n if (content === '' || content === '\\r')\n chompStart = i;\n else\n break;\n }\n // shortcut for empty contents\n if (chompStart === 0) {\n const value = header.chomp === '+' && lines.length > 0\n ? '\\n'.repeat(Math.max(1, lines.length - 1))\n : '';\n let end = start + header.length;\n if (scalar.source)\n end += scalar.source.length;\n return { value, type, comment: header.comment, range: [start, end, end] };\n }\n // find the indentation level to trim from start\n let trimIndent = scalar.indent + header.indent;\n let offset = scalar.offset + header.length;\n let contentStart = 0;\n for (let i = 0; i < chompStart; ++i) {\n const [indent, content] = lines[i];\n if (content === '' || content === '\\r') {\n if (header.indent === 0 && indent.length > trimIndent)\n trimIndent = indent.length;\n }\n else {\n if (indent.length < trimIndent) {\n const message = 'Block scalars with more-indented leading empty lines must use an explicit indentation indicator';\n onError(offset + indent.length, 'MISSING_CHAR', message);\n }\n if (header.indent === 0)\n trimIndent = indent.length;\n contentStart = i;\n if (trimIndent === 0 && !ctx.atRoot) {\n const message = 'Block scalar values in collections must be indented';\n onError(offset, 'BAD_INDENT', message);\n }\n break;\n }\n offset += indent.length + content.length + 1;\n }\n // include trailing more-indented empty lines in content\n for (let i = lines.length - 1; i >= chompStart; --i) {\n if (lines[i][0].length > trimIndent)\n chompStart = i + 1;\n }\n let value = '';\n let sep = '';\n let prevMoreIndented = false;\n // leading whitespace is kept intact\n for (let i = 0; i < contentStart; ++i)\n value += lines[i][0].slice(trimIndent) + '\\n';\n for (let i = contentStart; i < chompStart; ++i) {\n let [indent, content] = lines[i];\n offset += indent.length + content.length + 1;\n const crlf = content[content.length - 1] === '\\r';\n if (crlf)\n content = content.slice(0, -1);\n /* istanbul ignore if already caught in lexer */\n if (content && indent.length < trimIndent) {\n const src = header.indent\n ? 'explicit indentation indicator'\n : 'first line';\n const message = `Block scalar lines must not be less indented than their ${src}`;\n onError(offset - content.length - (crlf ? 2 : 1), 'BAD_INDENT', message);\n indent = '';\n }\n if (type === Scalar.Scalar.BLOCK_LITERAL) {\n value += sep + indent.slice(trimIndent) + content;\n sep = '\\n';\n }\n else if (indent.length > trimIndent || content[0] === '\\t') {\n // more-indented content within a folded block\n if (sep === ' ')\n sep = '\\n';\n else if (!prevMoreIndented && sep === '\\n')\n sep = '\\n\\n';\n value += sep + indent.slice(trimIndent) + content;\n sep = '\\n';\n prevMoreIndented = true;\n }\n else if (content === '') {\n // empty line\n if (sep === '\\n')\n value += '\\n';\n else\n sep = '\\n';\n }\n else {\n value += sep + content;\n sep = ' ';\n prevMoreIndented = false;\n }\n }\n switch (header.chomp) {\n case '-':\n break;\n case '+':\n for (let i = chompStart; i < lines.length; ++i)\n value += '\\n' + lines[i][0].slice(trimIndent);\n if (value[value.length - 1] !== '\\n')\n value += '\\n';\n break;\n default:\n value += '\\n';\n }\n const end = start + header.length + scalar.source.length;\n return { value, type, comment: header.comment, range: [start, end, end] };\n}\nfunction parseBlockScalarHeader({ offset, props }, strict, onError) {\n /* istanbul ignore if should not happen */\n if (props[0].type !== 'block-scalar-header') {\n onError(props[0], 'IMPOSSIBLE', 'Block scalar header not found');\n return null;\n }\n const { source } = props[0];\n const mode = source[0];\n let indent = 0;\n let chomp = '';\n let error = -1;\n for (let i = 1; i < source.length; ++i) {\n const ch = source[i];\n if (!chomp && (ch === '-' || ch === '+'))\n chomp = ch;\n else {\n const n = Number(ch);\n if (!indent && n)\n indent = n;\n else if (error === -1)\n error = offset + i;\n }\n }\n if (error !== -1)\n onError(error, 'UNEXPECTED_TOKEN', `Block scalar header includes extra characters: ${source}`);\n let hasSpace = false;\n let comment = '';\n let length = source.length;\n for (let i = 1; i < props.length; ++i) {\n const token = props[i];\n switch (token.type) {\n case 'space':\n hasSpace = true;\n // fallthrough\n case 'newline':\n length += token.source.length;\n break;\n case 'comment':\n if (strict && !hasSpace) {\n const message = 'Comments must be separated from other tokens by white space characters';\n onError(token, 'MISSING_CHAR', message);\n }\n length += token.source.length;\n comment = token.source.substring(1);\n break;\n case 'error':\n onError(token, 'UNEXPECTED_TOKEN', token.message);\n length += token.source.length;\n break;\n /* istanbul ignore next should not happen */\n default: {\n const message = `Unexpected token in block scalar header: ${token.type}`;\n onError(token, 'UNEXPECTED_TOKEN', message);\n const ts = token.source;\n if (ts && typeof ts === 'string')\n length += ts.length;\n }\n }\n }\n return { mode, indent, chomp, comment, length };\n}\n/** @returns Array of lines split up as `[indent, content]` */\nfunction splitLines(source) {\n const split = source.split(/\\n( *)/);\n const first = split[0];\n const m = first.match(/^( *)/);\n const line0 = m?.[1]\n ? [m[1], first.slice(m[1].length)]\n : ['', first];\n const lines = [line0];\n for (let i = 1; i < split.length; i += 2)\n lines.push([split[i], split[i + 1]]);\n return lines;\n}\n\nexports.resolveBlockScalar = resolveBlockScalar;\n","'use strict';\n\nvar Scalar = require('../nodes/Scalar.js');\nvar resolveEnd = require('./resolve-end.js');\n\nfunction resolveFlowScalar(scalar, strict, onError) {\n const { offset, type, source, end } = scalar;\n let _type;\n let value;\n const _onError = (rel, code, msg) => onError(offset + rel, code, msg);\n switch (type) {\n case 'scalar':\n _type = Scalar.Scalar.PLAIN;\n value = plainValue(source, _onError);\n break;\n case 'single-quoted-scalar':\n _type = Scalar.Scalar.QUOTE_SINGLE;\n value = singleQuotedValue(source, _onError);\n break;\n case 'double-quoted-scalar':\n _type = Scalar.Scalar.QUOTE_DOUBLE;\n value = doubleQuotedValue(source, _onError);\n break;\n /* istanbul ignore next should not happen */\n default:\n onError(scalar, 'UNEXPECTED_TOKEN', `Expected a flow scalar value, but found: ${type}`);\n return {\n value: '',\n type: null,\n comment: '',\n range: [offset, offset + source.length, offset + source.length]\n };\n }\n const valueEnd = offset + source.length;\n const re = resolveEnd.resolveEnd(end, valueEnd, strict, onError);\n return {\n value,\n type: _type,\n comment: re.comment,\n range: [offset, valueEnd, re.offset]\n };\n}\nfunction plainValue(source, onError) {\n let badChar = '';\n switch (source[0]) {\n /* istanbul ignore next should not happen */\n case '\\t':\n badChar = 'a tab character';\n break;\n case ',':\n badChar = 'flow indicator character ,';\n break;\n case '%':\n badChar = 'directive indicator character %';\n break;\n case '|':\n case '>': {\n badChar = `block scalar indicator ${source[0]}`;\n break;\n }\n case '@':\n case '`': {\n badChar = `reserved character ${source[0]}`;\n break;\n }\n }\n if (badChar)\n onError(0, 'BAD_SCALAR_START', `Plain value cannot start with ${badChar}`);\n return foldLines(source);\n}\nfunction singleQuotedValue(source, onError) {\n if (source[source.length - 1] !== \"'\" || source.length === 1)\n onError(source.length, 'MISSING_CHAR', \"Missing closing 'quote\");\n return foldLines(source.slice(1, -1)).replace(/''/g, \"'\");\n}\nfunction foldLines(source) {\n /**\n * The negative lookbehind here and in the `re` RegExp is to\n * prevent causing a polynomial search time in certain cases.\n *\n * The try-catch is for Safari, which doesn't support this yet:\n * https://caniuse.com/js-regexp-lookbehind\n */\n let first, line;\n try {\n first = new RegExp('(.*?)(?<![ \\t])[ \\t]*\\r?\\n', 'sy');\n line = new RegExp('[ \\t]*(.*?)(?:(?<![ \\t])[ \\t]*)?\\r?\\n', 'sy');\n }\n catch {\n first = /(.*?)[ \\t]*\\r?\\n/sy;\n line = /[ \\t]*(.*?)[ \\t]*\\r?\\n/sy;\n }\n let match = first.exec(source);\n if (!match)\n return source;\n let res = match[1];\n let sep = ' ';\n let pos = first.lastIndex;\n line.lastIndex = pos;\n while ((match = line.exec(source))) {\n if (match[1] === '') {\n if (sep === '\\n')\n res += sep;\n else\n sep = '\\n';\n }\n else {\n res += sep + match[1];\n sep = ' ';\n }\n pos = line.lastIndex;\n }\n const last = /[ \\t]*(.*)/sy;\n last.lastIndex = pos;\n match = last.exec(source);\n return res + sep + (match?.[1] ?? '');\n}\nfunction doubleQuotedValue(source, onError) {\n let res = '';\n for (let i = 1; i < source.length - 1; ++i) {\n const ch = source[i];\n if (ch === '\\r' && source[i + 1] === '\\n')\n continue;\n if (ch === '\\n') {\n const { fold, offset } = foldNewline(source, i);\n res += fold;\n i = offset;\n }\n else if (ch === '\\\\') {\n let next = source[++i];\n const cc = escapeCodes[next];\n if (cc)\n res += cc;\n else if (next === '\\n') {\n // skip escaped newlines, but still trim the following line\n next = source[i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n }\n else if (next === '\\r' && source[i + 1] === '\\n') {\n // skip escaped CRLF newlines, but still trim the following line\n next = source[++i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n }\n else if (next === 'x' || next === 'u' || next === 'U') {\n const length = { x: 2, u: 4, U: 8 }[next];\n res += parseCharCode(source, i + 1, length, onError);\n i += length;\n }\n else {\n const raw = source.substr(i - 1, 2);\n onError(i - 1, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);\n res += raw;\n }\n }\n else if (ch === ' ' || ch === '\\t') {\n // trim trailing whitespace\n const wsStart = i;\n let next = source[i + 1];\n while (next === ' ' || next === '\\t')\n next = source[++i + 1];\n if (next !== '\\n' && !(next === '\\r' && source[i + 2] === '\\n'))\n res += i > wsStart ? source.slice(wsStart, i + 1) : ch;\n }\n else {\n res += ch;\n }\n }\n if (source[source.length - 1] !== '\"' || source.length === 1)\n onError(source.length, 'MISSING_CHAR', 'Missing closing \"quote');\n return res;\n}\n/**\n * Fold a single newline into a space, multiple newlines to N - 1 newlines.\n * Presumes `source[offset] === '\\n'`\n */\nfunction foldNewline(source, offset) {\n let fold = '';\n let ch = source[offset + 1];\n while (ch === ' ' || ch === '\\t' || ch === '\\n' || ch === '\\r') {\n if (ch === '\\r' && source[offset + 2] !== '\\n')\n break;\n if (ch === '\\n')\n fold += '\\n';\n offset += 1;\n ch = source[offset + 1];\n }\n if (!fold)\n fold = ' ';\n return { fold, offset };\n}\nconst escapeCodes = {\n '0': '\\0', // null character\n a: '\\x07', // bell character\n b: '\\b', // backspace\n e: '\\x1b', // escape character\n f: '\\f', // form feed\n n: '\\n', // line feed\n r: '\\r', // carriage return\n t: '\\t', // horizontal tab\n v: '\\v', // vertical tab\n N: '\\u0085', // Unicode next line\n _: '\\u00a0', // Unicode non-breaking space\n L: '\\u2028', // Unicode line separator\n P: '\\u2029', // Unicode paragraph separator\n ' ': ' ',\n '\"': '\"',\n '/': '/',\n '\\\\': '\\\\',\n '\\t': '\\t'\n};\nfunction parseCharCode(source, offset, length, onError) {\n const cc = source.substr(offset, length);\n const ok = cc.length === length && /^[0-9a-fA-F]+$/.test(cc);\n const code = ok ? parseInt(cc, 16) : NaN;\n if (isNaN(code)) {\n const raw = source.substr(offset - 2, length + 2);\n onError(offset - 2, 'BAD_DQ_ESCAPE', `Invalid escape sequence ${raw}`);\n return raw;\n }\n return String.fromCodePoint(code);\n}\n\nexports.resolveFlowScalar = resolveFlowScalar;\n","'use strict';\n\nvar identity = require('../nodes/identity.js');\nvar Scalar = require('../nodes/Scalar.js');\nvar resolveBlockScalar = require('./resolve-block-scalar.js');\nvar resolveFlowScalar = require('./resolve-flow-scalar.js');\n\nfunction composeScalar(ctx, token, tagToken, onError) {\n const { value, type, comment, range } = token.type === 'block-scalar'\n ? resolveBlockScalar.resolveBlockScalar(ctx, token, onError)\n : resolveFlowScalar.resolveFlowScalar(token, ctx.options.strict, onError);\n const tagName = tagToken\n ? ctx.directives.tagName(tagToken.source, msg => onError(tagToken, 'TAG_RESOLVE_FAILED', msg))\n : null;\n let tag;\n if (ctx.options.stringKeys && ctx.atKey) {\n tag = ctx.schema[identity.SCALAR];\n }\n else if (tagName)\n tag = findScalarTagByName(ctx.schema, value, tagName, tagToken, onError);\n else if (token.type === 'scalar')\n tag = findScalarTagByTest(ctx, value, token, onError);\n else\n tag = ctx.schema[identity.SCALAR];\n let scalar;\n try {\n const res = tag.resolve(value, msg => onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg), ctx.options);\n scalar = identity.isScalar(res) ? res : new Scalar.Scalar(res);\n }\n catch (error) {\n const msg = error instanceof Error ? error.message : String(error);\n onError(tagToken ?? token, 'TAG_RESOLVE_FAILED', msg);\n scalar = new Scalar.Scalar(value);\n }\n scalar.range = range;\n scalar.source = value;\n if (type)\n scalar.type = type;\n if (tagName)\n scalar.tag = tagName;\n if (tag.format)\n scalar.format = tag.format;\n if (comment)\n scalar.comment = comment;\n return scalar;\n}\nfunction findScalarTagByName(schema, value, tagName, tagToken, onError) {\n if (tagName === '!')\n return schema[identity.SCALAR]; // non-specific tag\n const matchWithTest = [];\n for (const tag of schema.tags) {\n if (!tag.collection && tag.tag === tagName) {\n if (tag.default && tag.test)\n matchWithTest.push(tag);\n else\n return tag;\n }\n }\n for (const tag of matchWithTest)\n if (tag.test?.test(value))\n return tag;\n const kt = schema.knownTags[tagName];\n if (kt && !kt.collection) {\n // Ensure that the known tag is available for stringifying,\n // but does not get used by default.\n schema.tags.push(Object.assign({}, kt, { default: false, test: undefined }));\n return kt;\n }\n onError(tagToken, 'TAG_RESOLVE_FAILED', `Unresolved tag: ${tagName}`, tagName !== 'tag:yaml.org,2002:str');\n return schema[identity.SCALAR];\n}\nfunction findScalarTagByTest({ atKey, directives, schema }, value, token, onError) {\n const tag = schema.tags.find(tag => (tag.default === true || (atKey && tag.default === 'key')) &&\n tag.test?.test(value)) || schema[identity.SCALAR];\n if (schema.compat) {\n const compat = schema.compat.find(tag => tag.default && tag.test?.test(value)) ??\n schema[identity.SCALAR];\n if (tag.tag !== compat.tag) {\n const ts = directives.tagString(tag.tag);\n const cs = directives.tagString(compat.tag);\n const msg = `Value may be parsed as either ${ts} or ${cs}`;\n onError(token, 'TAG_RESOLVE_FAILED', msg, true);\n }\n }\n return tag;\n}\n\nexports.composeScalar = composeScalar;\n","'use strict';\n\nfunction emptyScalarPosition(offset, before, pos) {\n if (before) {\n pos ?? (pos = before.length);\n for (let i = pos - 1; i >= 0; --i) {\n let st = before[i];\n switch (st.type) {\n case 'space':\n case 'comment':\n case 'newline':\n offset -= st.source.length;\n continue;\n }\n // Technically, an empty scalar is immediately after the last non-empty\n // node, but it's more useful to place it after any whitespace.\n st = before[++i];\n while (st?.type === 'space') {\n offset += st.source.length;\n st = before[++i];\n }\n break;\n }\n }\n return offset;\n}\n\nexports.emptyScalarPosition = emptyScalarPosition;\n","'use strict';\n\nvar Alias = require('../nodes/Alias.js');\nvar identity = require('../nodes/identity.js');\nvar composeCollection = require('./compose-collection.js');\nvar composeScalar = require('./compose-scalar.js');\nvar resolveEnd = require('./resolve-end.js');\nvar utilEmptyScalarPosition = require('./util-empty-scalar-position.js');\n\nconst CN = { composeNode, composeEmptyNode };\nfunction composeNode(ctx, token, props, onError) {\n const atKey = ctx.atKey;\n const { spaceBefore, comment, anchor, tag } = props;\n let node;\n let isSrcToken = true;\n switch (token.type) {\n case 'alias':\n node = composeAlias(ctx, token, onError);\n if (anchor || tag)\n onError(token, 'ALIAS_PROPS', 'An alias node must not specify any properties');\n break;\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n case 'block-scalar':\n node = composeScalar.composeScalar(ctx, token, tag, onError);\n if (anchor)\n node.anchor = anchor.source.substring(1);\n break;\n case 'block-map':\n case 'block-seq':\n case 'flow-collection':\n node = composeCollection.composeCollection(CN, ctx, token, props, onError);\n if (anchor)\n node.anchor = anchor.source.substring(1);\n break;\n default: {\n const message = token.type === 'error'\n ? token.message\n : `Unsupported token (type: ${token.type})`;\n onError(token, 'UNEXPECTED_TOKEN', message);\n node = composeEmptyNode(ctx, token.offset, undefined, null, props, onError);\n isSrcToken = false;\n }\n }\n if (anchor && node.anchor === '')\n onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');\n if (atKey &&\n ctx.options.stringKeys &&\n (!identity.isScalar(node) ||\n typeof node.value !== 'string' ||\n (node.tag && node.tag !== 'tag:yaml.org,2002:str'))) {\n const msg = 'With stringKeys, all keys must be strings';\n onError(tag ?? token, 'NON_STRING_KEY', msg);\n }\n if (spaceBefore)\n node.spaceBefore = true;\n if (comment) {\n if (token.type === 'scalar' && token.source === '')\n node.comment = comment;\n else\n node.commentBefore = comment;\n }\n // @ts-expect-error Type checking misses meaning of isSrcToken\n if (ctx.options.keepSourceTokens && isSrcToken)\n node.srcToken = token;\n return node;\n}\nfunction composeEmptyNode(ctx, offset, before, pos, { spaceBefore, comment, anchor, tag, end }, onError) {\n const token = {\n type: 'scalar',\n offset: utilEmptyScalarPosition.emptyScalarPosition(offset, before, pos),\n indent: -1,\n source: ''\n };\n const node = composeScalar.composeScalar(ctx, token, tag, onError);\n if (anchor) {\n node.anchor = anchor.source.substring(1);\n if (node.anchor === '')\n onError(anchor, 'BAD_ALIAS', 'Anchor cannot be an empty string');\n }\n if (spaceBefore)\n node.spaceBefore = true;\n if (comment) {\n node.comment = comment;\n node.range[2] = end;\n }\n return node;\n}\nfunction composeAlias({ options }, { offset, source, end }, onError) {\n const alias = new Alias.Alias(source.substring(1));\n if (alias.source === '')\n onError(offset, 'BAD_ALIAS', 'Alias cannot be an empty string');\n if (alias.source.endsWith(':'))\n onError(offset + source.length - 1, 'BAD_ALIAS', 'Alias ending in : is ambiguous', true);\n const valueEnd = offset + source.length;\n const re = resolveEnd.resolveEnd(end, valueEnd, options.strict, onError);\n alias.range = [offset, valueEnd, re.offset];\n if (re.comment)\n alias.comment = re.comment;\n return alias;\n}\n\nexports.composeEmptyNode = composeEmptyNode;\nexports.composeNode = composeNode;\n","'use strict';\n\nvar Document = require('../doc/Document.js');\nvar composeNode = require('./compose-node.js');\nvar resolveEnd = require('./resolve-end.js');\nvar resolveProps = require('./resolve-props.js');\n\nfunction composeDoc(options, directives, { offset, start, value, end }, onError) {\n const opts = Object.assign({ _directives: directives }, options);\n const doc = new Document.Document(undefined, opts);\n const ctx = {\n atKey: false,\n atRoot: true,\n directives: doc.directives,\n options: doc.options,\n schema: doc.schema\n };\n const props = resolveProps.resolveProps(start, {\n indicator: 'doc-start',\n next: value ?? end?.[0],\n offset,\n onError,\n parentIndent: 0,\n startOnNewline: true\n });\n if (props.found) {\n doc.directives.docStart = true;\n if (value &&\n (value.type === 'block-map' || value.type === 'block-seq') &&\n !props.hasNewline)\n onError(props.end, 'MISSING_CHAR', 'Block collection cannot start on same line with directives-end marker');\n }\n // @ts-expect-error If Contents is set, let's trust the user\n doc.contents = value\n ? composeNode.composeNode(ctx, value, props, onError)\n : composeNode.composeEmptyNode(ctx, props.end, start, null, props, onError);\n const contentEnd = doc.contents.range[2];\n const re = resolveEnd.resolveEnd(end, contentEnd, false, onError);\n if (re.comment)\n doc.comment = re.comment;\n doc.range = [offset, contentEnd, re.offset];\n return doc;\n}\n\nexports.composeDoc = composeDoc;\n","'use strict';\n\nvar node_process = require('process');\nvar directives = require('../doc/directives.js');\nvar Document = require('../doc/Document.js');\nvar errors = require('../errors.js');\nvar identity = require('../nodes/identity.js');\nvar composeDoc = require('./compose-doc.js');\nvar resolveEnd = require('./resolve-end.js');\n\nfunction getErrorPos(src) {\n if (typeof src === 'number')\n return [src, src + 1];\n if (Array.isArray(src))\n return src.length === 2 ? src : [src[0], src[1]];\n const { offset, source } = src;\n return [offset, offset + (typeof source === 'string' ? source.length : 1)];\n}\nfunction parsePrelude(prelude) {\n let comment = '';\n let atComment = false;\n let afterEmptyLine = false;\n for (let i = 0; i < prelude.length; ++i) {\n const source = prelude[i];\n switch (source[0]) {\n case '#':\n comment +=\n (comment === '' ? '' : afterEmptyLine ? '\\n\\n' : '\\n') +\n (source.substring(1) || ' ');\n atComment = true;\n afterEmptyLine = false;\n break;\n case '%':\n if (prelude[i + 1]?.[0] !== '#')\n i += 1;\n atComment = false;\n break;\n default:\n // This may be wrong after doc-end, but in that case it doesn't matter\n if (!atComment)\n afterEmptyLine = true;\n atComment = false;\n }\n }\n return { comment, afterEmptyLine };\n}\n/**\n * Compose a stream of CST nodes into a stream of YAML Documents.\n *\n * ```ts\n * import { Composer, Parser } from 'yaml'\n *\n * const src: string = ...\n * const tokens = new Parser().parse(src)\n * const docs = new Composer().compose(tokens)\n * ```\n */\nclass Composer {\n constructor(options = {}) {\n this.doc = null;\n this.atDirectives = false;\n this.prelude = [];\n this.errors = [];\n this.warnings = [];\n this.onError = (source, code, message, warning) => {\n const pos = getErrorPos(source);\n if (warning)\n this.warnings.push(new errors.YAMLWarning(pos, code, message));\n else\n this.errors.push(new errors.YAMLParseError(pos, code, message));\n };\n // eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing\n this.directives = new directives.Directives({ version: options.version || '1.2' });\n this.options = options;\n }\n decorate(doc, afterDoc) {\n const { comment, afterEmptyLine } = parsePrelude(this.prelude);\n //console.log({ dc: doc.comment, prelude, comment })\n if (comment) {\n const dc = doc.contents;\n if (afterDoc) {\n doc.comment = doc.comment ? `${doc.comment}\\n${comment}` : comment;\n }\n else if (afterEmptyLine || doc.directives.docStart || !dc) {\n doc.commentBefore = comment;\n }\n else if (identity.isCollection(dc) && !dc.flow && dc.items.length > 0) {\n let it = dc.items[0];\n if (identity.isPair(it))\n it = it.key;\n const cb = it.commentBefore;\n it.commentBefore = cb ? `${comment}\\n${cb}` : comment;\n }\n else {\n const cb = dc.commentBefore;\n dc.commentBefore = cb ? `${comment}\\n${cb}` : comment;\n }\n }\n if (afterDoc) {\n Array.prototype.push.apply(doc.errors, this.errors);\n Array.prototype.push.apply(doc.warnings, this.warnings);\n }\n else {\n doc.errors = this.errors;\n doc.warnings = this.warnings;\n }\n this.prelude = [];\n this.errors = [];\n this.warnings = [];\n }\n /**\n * Current stream status information.\n *\n * Mostly useful at the end of input for an empty stream.\n */\n streamInfo() {\n return {\n comment: parsePrelude(this.prelude).comment,\n directives: this.directives,\n errors: this.errors,\n warnings: this.warnings\n };\n }\n /**\n * Compose tokens into documents.\n *\n * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.\n * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.\n */\n *compose(tokens, forceDoc = false, endOffset = -1) {\n for (const token of tokens)\n yield* this.next(token);\n yield* this.end(forceDoc, endOffset);\n }\n /** Advance the composer by one CST token. */\n *next(token) {\n if (node_process.env.LOG_STREAM)\n console.dir(token, { depth: null });\n switch (token.type) {\n case 'directive':\n this.directives.add(token.source, (offset, message, warning) => {\n const pos = getErrorPos(token);\n pos[0] += offset;\n this.onError(pos, 'BAD_DIRECTIVE', message, warning);\n });\n this.prelude.push(token.source);\n this.atDirectives = true;\n break;\n case 'document': {\n const doc = composeDoc.composeDoc(this.options, this.directives, token, this.onError);\n if (this.atDirectives && !doc.directives.docStart)\n this.onError(token, 'MISSING_CHAR', 'Missing directives-end/doc-start indicator line');\n this.decorate(doc, false);\n if (this.doc)\n yield this.doc;\n this.doc = doc;\n this.atDirectives = false;\n break;\n }\n case 'byte-order-mark':\n case 'space':\n break;\n case 'comment':\n case 'newline':\n this.prelude.push(token.source);\n break;\n case 'error': {\n const msg = token.source\n ? `${token.message}: ${JSON.stringify(token.source)}`\n : token.message;\n const error = new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg);\n if (this.atDirectives || !this.doc)\n this.errors.push(error);\n else\n this.doc.errors.push(error);\n break;\n }\n case 'doc-end': {\n if (!this.doc) {\n const msg = 'Unexpected doc-end without preceding document';\n this.errors.push(new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', msg));\n break;\n }\n this.doc.directives.docEnd = true;\n const end = resolveEnd.resolveEnd(token.end, token.offset + token.source.length, this.doc.options.strict, this.onError);\n this.decorate(this.doc, true);\n if (end.comment) {\n const dc = this.doc.comment;\n this.doc.comment = dc ? `${dc}\\n${end.comment}` : end.comment;\n }\n this.doc.range[2] = end.offset;\n break;\n }\n default:\n this.errors.push(new errors.YAMLParseError(getErrorPos(token), 'UNEXPECTED_TOKEN', `Unsupported token ${token.type}`));\n }\n }\n /**\n * Call at end of input to yield any remaining document.\n *\n * @param forceDoc - If the stream contains no document, still emit a final document including any comments and directives that would be applied to a subsequent document.\n * @param endOffset - Should be set if `forceDoc` is also set, to set the document range end and to indicate errors correctly.\n */\n *end(forceDoc = false, endOffset = -1) {\n if (this.doc) {\n this.decorate(this.doc, true);\n yield this.doc;\n this.doc = null;\n }\n else if (forceDoc) {\n const opts = Object.assign({ _directives: this.directives }, this.options);\n const doc = new Document.Document(undefined, opts);\n if (this.atDirectives)\n this.onError(endOffset, 'MISSING_CHAR', 'Missing directives-end indicator line');\n doc.range = [0, endOffset, endOffset];\n this.decorate(doc, false);\n yield doc;\n }\n }\n}\n\nexports.Composer = Composer;\n","'use strict';\n\nvar resolveBlockScalar = require('../compose/resolve-block-scalar.js');\nvar resolveFlowScalar = require('../compose/resolve-flow-scalar.js');\nvar errors = require('../errors.js');\nvar stringifyString = require('../stringify/stringifyString.js');\n\nfunction resolveAsScalar(token, strict = true, onError) {\n if (token) {\n const _onError = (pos, code, message) => {\n const offset = typeof pos === 'number' ? pos : Array.isArray(pos) ? pos[0] : pos.offset;\n if (onError)\n onError(offset, code, message);\n else\n throw new errors.YAMLParseError([offset, offset + 1], code, message);\n };\n switch (token.type) {\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return resolveFlowScalar.resolveFlowScalar(token, strict, _onError);\n case 'block-scalar':\n return resolveBlockScalar.resolveBlockScalar({ options: { strict } }, token, _onError);\n }\n }\n return null;\n}\n/**\n * Create a new scalar token with `value`\n *\n * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,\n * as this function does not support any schema operations and won't check for such conflicts.\n *\n * @param value The string representation of the value, which will have its content properly indented.\n * @param context.end Comments and whitespace after the end of the value, or after the block scalar header. If undefined, a newline will be added.\n * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.\n * @param context.indent The indent level of the token.\n * @param context.inFlow Is this scalar within a flow collection? This may affect the resolved type of the token's value.\n * @param context.offset The offset position of the token.\n * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.\n */\nfunction createScalarToken(value, context) {\n const { implicitKey = false, indent, inFlow = false, offset = -1, type = 'PLAIN' } = context;\n const source = stringifyString.stringifyString({ type, value }, {\n implicitKey,\n indent: indent > 0 ? ' '.repeat(indent) : '',\n inFlow,\n options: { blockQuote: true, lineWidth: -1 }\n });\n const end = context.end ?? [\n { type: 'newline', offset: -1, indent, source: '\\n' }\n ];\n switch (source[0]) {\n case '|':\n case '>': {\n const he = source.indexOf('\\n');\n const head = source.substring(0, he);\n const body = source.substring(he + 1) + '\\n';\n const props = [\n { type: 'block-scalar-header', offset, indent, source: head }\n ];\n if (!addEndtoBlockProps(props, end))\n props.push({ type: 'newline', offset: -1, indent, source: '\\n' });\n return { type: 'block-scalar', offset, indent, props, source: body };\n }\n case '\"':\n return { type: 'double-quoted-scalar', offset, indent, source, end };\n case \"'\":\n return { type: 'single-quoted-scalar', offset, indent, source, end };\n default:\n return { type: 'scalar', offset, indent, source, end };\n }\n}\n/**\n * Set the value of `token` to the given string `value`, overwriting any previous contents and type that it may have.\n *\n * Best efforts are made to retain any comments previously associated with the `token`,\n * though all contents within a collection's `items` will be overwritten.\n *\n * Values that represent an actual string but may be parsed as a different type should use a `type` other than `'PLAIN'`,\n * as this function does not support any schema operations and won't check for such conflicts.\n *\n * @param token Any token. If it does not include an `indent` value, the value will be stringified as if it were an implicit key.\n * @param value The string representation of the value, which will have its content properly indented.\n * @param context.afterKey In most cases, values after a key should have an additional level of indentation.\n * @param context.implicitKey Being within an implicit key may affect the resolved type of the token's value.\n * @param context.inFlow Being within a flow collection may affect the resolved type of the token's value.\n * @param context.type The preferred type of the scalar token. If undefined, the previous type of the `token` will be used, defaulting to `'PLAIN'`.\n */\nfunction setScalarValue(token, value, context = {}) {\n let { afterKey = false, implicitKey = false, inFlow = false, type } = context;\n let indent = 'indent' in token ? token.indent : null;\n if (afterKey && typeof indent === 'number')\n indent += 2;\n if (!type)\n switch (token.type) {\n case 'single-quoted-scalar':\n type = 'QUOTE_SINGLE';\n break;\n case 'double-quoted-scalar':\n type = 'QUOTE_DOUBLE';\n break;\n case 'block-scalar': {\n const header = token.props[0];\n if (header.type !== 'block-scalar-header')\n throw new Error('Invalid block scalar header');\n type = header.source[0] === '>' ? 'BLOCK_FOLDED' : 'BLOCK_LITERAL';\n break;\n }\n default:\n type = 'PLAIN';\n }\n const source = stringifyString.stringifyString({ type, value }, {\n implicitKey: implicitKey || indent === null,\n indent: indent !== null && indent > 0 ? ' '.repeat(indent) : '',\n inFlow,\n options: { blockQuote: true, lineWidth: -1 }\n });\n switch (source[0]) {\n case '|':\n case '>':\n setBlockScalarValue(token, source);\n break;\n case '\"':\n setFlowScalarValue(token, source, 'double-quoted-scalar');\n break;\n case \"'\":\n setFlowScalarValue(token, source, 'single-quoted-scalar');\n break;\n default:\n setFlowScalarValue(token, source, 'scalar');\n }\n}\nfunction setBlockScalarValue(token, source) {\n const he = source.indexOf('\\n');\n const head = source.substring(0, he);\n const body = source.substring(he + 1) + '\\n';\n if (token.type === 'block-scalar') {\n const header = token.props[0];\n if (header.type !== 'block-scalar-header')\n throw new Error('Invalid block scalar header');\n header.source = head;\n token.source = body;\n }\n else {\n const { offset } = token;\n const indent = 'indent' in token ? token.indent : -1;\n const props = [\n { type: 'block-scalar-header', offset, indent, source: head }\n ];\n if (!addEndtoBlockProps(props, 'end' in token ? token.end : undefined))\n props.push({ type: 'newline', offset: -1, indent, source: '\\n' });\n for (const key of Object.keys(token))\n if (key !== 'type' && key !== 'offset')\n delete token[key];\n Object.assign(token, { type: 'block-scalar', indent, props, source: body });\n }\n}\n/** @returns `true` if last token is a newline */\nfunction addEndtoBlockProps(props, end) {\n if (end)\n for (const st of end)\n switch (st.type) {\n case 'space':\n case 'comment':\n props.push(st);\n break;\n case 'newline':\n props.push(st);\n return true;\n }\n return false;\n}\nfunction setFlowScalarValue(token, source, type) {\n switch (token.type) {\n case 'scalar':\n case 'double-quoted-scalar':\n case 'single-quoted-scalar':\n token.type = type;\n token.source = source;\n break;\n case 'block-scalar': {\n const end = token.props.slice(1);\n let oa = source.length;\n if (token.props[0].type === 'block-scalar-header')\n oa -= token.props[0].source.length;\n for (const tok of end)\n tok.offset += oa;\n delete token.props;\n Object.assign(token, { type, source, end });\n break;\n }\n case 'block-map':\n case 'block-seq': {\n const offset = token.offset + source.length;\n const nl = { type: 'newline', offset, indent: token.indent, source: '\\n' };\n delete token.items;\n Object.assign(token, { type, source, end: [nl] });\n break;\n }\n default: {\n const indent = 'indent' in token ? token.indent : -1;\n const end = 'end' in token && Array.isArray(token.end)\n ? token.end.filter(st => st.type === 'space' ||\n st.type === 'comment' ||\n st.type === 'newline')\n : [];\n for (const key of Object.keys(token))\n if (key !== 'type' && key !== 'offset')\n delete token[key];\n Object.assign(token, { type, indent, source, end });\n }\n }\n}\n\nexports.createScalarToken = createScalarToken;\nexports.resolveAsScalar = resolveAsScalar;\nexports.setScalarValue = setScalarValue;\n","'use strict';\n\n/**\n * Stringify a CST document, token, or collection item\n *\n * Fair warning: This applies no validation whatsoever, and\n * simply concatenates the sources in their logical order.\n */\nconst stringify = (cst) => 'type' in cst ? stringifyToken(cst) : stringifyItem(cst);\nfunction stringifyToken(token) {\n switch (token.type) {\n case 'block-scalar': {\n let res = '';\n for (const tok of token.props)\n res += stringifyToken(tok);\n return res + token.source;\n }\n case 'block-map':\n case 'block-seq': {\n let res = '';\n for (const item of token.items)\n res += stringifyItem(item);\n return res;\n }\n case 'flow-collection': {\n let res = token.start.source;\n for (const item of token.items)\n res += stringifyItem(item);\n for (const st of token.end)\n res += st.source;\n return res;\n }\n case 'document': {\n let res = stringifyItem(token);\n if (token.end)\n for (const st of token.end)\n res += st.source;\n return res;\n }\n default: {\n let res = token.source;\n if ('end' in token && token.end)\n for (const st of token.end)\n res += st.source;\n return res;\n }\n }\n}\nfunction stringifyItem({ start, key, sep, value }) {\n let res = '';\n for (const st of start)\n res += st.source;\n if (key)\n res += stringifyToken(key);\n if (sep)\n for (const st of sep)\n res += st.source;\n if (value)\n res += stringifyToken(value);\n return res;\n}\n\nexports.stringify = stringify;\n","'use strict';\n\nconst BREAK = Symbol('break visit');\nconst SKIP = Symbol('skip children');\nconst REMOVE = Symbol('remove item');\n/**\n * Apply a visitor to a CST document or item.\n *\n * Walks through the tree (depth-first) starting from the root, calling a\n * `visitor` function with two arguments when entering each item:\n * - `item`: The current item, which included the following members:\n * - `start: SourceToken[]` – Source tokens before the key or value,\n * possibly including its anchor or tag.\n * - `key?: Token | null` – Set for pair values. May then be `null`, if\n * the key before the `:` separator is empty.\n * - `sep?: SourceToken[]` – Source tokens between the key and the value,\n * which should include the `:` map value indicator if `value` is set.\n * - `value?: Token` – The value of a sequence item, or of a map pair.\n * - `path`: The steps from the root to the current node, as an array of\n * `['key' | 'value', number]` tuples.\n *\n * The return value of the visitor may be used to control the traversal:\n * - `undefined` (default): Do nothing and continue\n * - `visit.SKIP`: Do not visit the children of this token, continue with\n * next sibling\n * - `visit.BREAK`: Terminate traversal completely\n * - `visit.REMOVE`: Remove the current item, then continue with the next one\n * - `number`: Set the index of the next step. This is useful especially if\n * the index of the current token has changed.\n * - `function`: Define the next visitor for this item. After the original\n * visitor is called on item entry, next visitors are called after handling\n * a non-empty `key` and when exiting the item.\n */\nfunction visit(cst, visitor) {\n if ('type' in cst && cst.type === 'document')\n cst = { start: cst.start, value: cst.value };\n _visit(Object.freeze([]), cst, visitor);\n}\n// Without the `as symbol` casts, TS declares these in the `visit`\n// namespace using `var`, but then complains about that because\n// `unique symbol` must be `const`.\n/** Terminate visit traversal completely */\nvisit.BREAK = BREAK;\n/** Do not visit the children of the current item */\nvisit.SKIP = SKIP;\n/** Remove the current item */\nvisit.REMOVE = REMOVE;\n/** Find the item at `path` from `cst` as the root */\nvisit.itemAtPath = (cst, path) => {\n let item = cst;\n for (const [field, index] of path) {\n const tok = item?.[field];\n if (tok && 'items' in tok) {\n item = tok.items[index];\n }\n else\n return undefined;\n }\n return item;\n};\n/**\n * Get the immediate parent collection of the item at `path` from `cst` as the root.\n *\n * Throws an error if the collection is not found, which should never happen if the item itself exists.\n */\nvisit.parentCollection = (cst, path) => {\n const parent = visit.itemAtPath(cst, path.slice(0, -1));\n const field = path[path.length - 1][0];\n const coll = parent?.[field];\n if (coll && 'items' in coll)\n return coll;\n throw new Error('Parent collection not found');\n};\nfunction _visit(path, item, visitor) {\n let ctrl = visitor(item, path);\n if (typeof ctrl === 'symbol')\n return ctrl;\n for (const field of ['key', 'value']) {\n const token = item[field];\n if (token && 'items' in token) {\n for (let i = 0; i < token.items.length; ++i) {\n const ci = _visit(Object.freeze(path.concat([[field, i]])), token.items[i], visitor);\n if (typeof ci === 'number')\n i = ci - 1;\n else if (ci === BREAK)\n return BREAK;\n else if (ci === REMOVE) {\n token.items.splice(i, 1);\n i -= 1;\n }\n }\n if (typeof ctrl === 'function' && field === 'key')\n ctrl = ctrl(item, path);\n }\n }\n return typeof ctrl === 'function' ? ctrl(item, path) : ctrl;\n}\n\nexports.visit = visit;\n","'use strict';\n\nvar cstScalar = require('./cst-scalar.js');\nvar cstStringify = require('./cst-stringify.js');\nvar cstVisit = require('./cst-visit.js');\n\n/** The byte order mark */\nconst BOM = '\\u{FEFF}';\n/** Start of doc-mode */\nconst DOCUMENT = '\\x02'; // C0: Start of Text\n/** Unexpected end of flow-mode */\nconst FLOW_END = '\\x18'; // C0: Cancel\n/** Next token is a scalar value */\nconst SCALAR = '\\x1f'; // C0: Unit Separator\n/** @returns `true` if `token` is a flow or block collection */\nconst isCollection = (token) => !!token && 'items' in token;\n/** @returns `true` if `token` is a flow or block scalar; not an alias */\nconst isScalar = (token) => !!token &&\n (token.type === 'scalar' ||\n token.type === 'single-quoted-scalar' ||\n token.type === 'double-quoted-scalar' ||\n token.type === 'block-scalar');\n/* istanbul ignore next */\n/** Get a printable representation of a lexer token */\nfunction prettyToken(token) {\n switch (token) {\n case BOM:\n return '<BOM>';\n case DOCUMENT:\n return '<DOC>';\n case FLOW_END:\n return '<FLOW_END>';\n case SCALAR:\n return '<SCALAR>';\n default:\n return JSON.stringify(token);\n }\n}\n/** Identify the type of a lexer token. May return `null` for unknown tokens. */\nfunction tokenType(source) {\n switch (source) {\n case BOM:\n return 'byte-order-mark';\n case DOCUMENT:\n return 'doc-mode';\n case FLOW_END:\n return 'flow-error-end';\n case SCALAR:\n return 'scalar';\n case '---':\n return 'doc-start';\n case '...':\n return 'doc-end';\n case '':\n case '\\n':\n case '\\r\\n':\n return 'newline';\n case '-':\n return 'seq-item-ind';\n case '?':\n return 'explicit-key-ind';\n case ':':\n return 'map-value-ind';\n case '{':\n return 'flow-map-start';\n case '}':\n return 'flow-map-end';\n case '[':\n return 'flow-seq-start';\n case ']':\n return 'flow-seq-end';\n case ',':\n return 'comma';\n }\n switch (source[0]) {\n case ' ':\n case '\\t':\n return 'space';\n case '#':\n return 'comment';\n case '%':\n return 'directive-line';\n case '*':\n return 'alias';\n case '&':\n return 'anchor';\n case '!':\n return 'tag';\n case \"'\":\n return 'single-quoted-scalar';\n case '\"':\n return 'double-quoted-scalar';\n case '|':\n case '>':\n return 'block-scalar-header';\n }\n return null;\n}\n\nexports.createScalarToken = cstScalar.createScalarToken;\nexports.resolveAsScalar = cstScalar.resolveAsScalar;\nexports.setScalarValue = cstScalar.setScalarValue;\nexports.stringify = cstStringify.stringify;\nexports.visit = cstVisit.visit;\nexports.BOM = BOM;\nexports.DOCUMENT = DOCUMENT;\nexports.FLOW_END = FLOW_END;\nexports.SCALAR = SCALAR;\nexports.isCollection = isCollection;\nexports.isScalar = isScalar;\nexports.prettyToken = prettyToken;\nexports.tokenType = tokenType;\n","'use strict';\n\nvar cst = require('./cst.js');\n\n/*\nSTART -> stream\n\nstream\n directive -> line-end -> stream\n indent + line-end -> stream\n [else] -> line-start\n\nline-end\n comment -> line-end\n newline -> .\n input-end -> END\n\nline-start\n doc-start -> doc\n doc-end -> stream\n [else] -> indent -> block-start\n\nblock-start\n seq-item-start -> block-start\n explicit-key-start -> block-start\n map-value-start -> block-start\n [else] -> doc\n\ndoc\n line-end -> line-start\n spaces -> doc\n anchor -> doc\n tag -> doc\n flow-start -> flow -> doc\n flow-end -> error -> doc\n seq-item-start -> error -> doc\n explicit-key-start -> error -> doc\n map-value-start -> doc\n alias -> doc\n quote-start -> quoted-scalar -> doc\n block-scalar-header -> line-end -> block-scalar(min) -> line-start\n [else] -> plain-scalar(false, min) -> doc\n\nflow\n line-end -> flow\n spaces -> flow\n anchor -> flow\n tag -> flow\n flow-start -> flow -> flow\n flow-end -> .\n seq-item-start -> error -> flow\n explicit-key-start -> flow\n map-value-start -> flow\n alias -> flow\n quote-start -> quoted-scalar -> flow\n comma -> flow\n [else] -> plain-scalar(true, 0) -> flow\n\nquoted-scalar\n quote-end -> .\n [else] -> quoted-scalar\n\nblock-scalar(min)\n newline + peek(indent < min) -> .\n [else] -> block-scalar(min)\n\nplain-scalar(is-flow, min)\n scalar-end(is-flow) -> .\n peek(newline + (indent < min)) -> .\n [else] -> plain-scalar(min)\n*/\nfunction isEmpty(ch) {\n switch (ch) {\n case undefined:\n case ' ':\n case '\\n':\n case '\\r':\n case '\\t':\n return true;\n default:\n return false;\n }\n}\nconst hexDigits = new Set('0123456789ABCDEFabcdef');\nconst tagChars = new Set(\"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()\");\nconst flowIndicatorChars = new Set(',[]{}');\nconst invalidAnchorChars = new Set(' ,[]{}\\n\\r\\t');\nconst isNotAnchorChar = (ch) => !ch || invalidAnchorChars.has(ch);\n/**\n * Splits an input string into lexical tokens, i.e. smaller strings that are\n * easily identifiable by `tokens.tokenType()`.\n *\n * Lexing starts always in a \"stream\" context. Incomplete input may be buffered\n * until a complete token can be emitted.\n *\n * In addition to slices of the original input, the following control characters\n * may also be emitted:\n *\n * - `\\x02` (Start of Text): A document starts with the next token\n * - `\\x18` (Cancel): Unexpected end of flow-mode (indicates an error)\n * - `\\x1f` (Unit Separator): Next token is a scalar value\n * - `\\u{FEFF}` (Byte order mark): Emitted separately outside documents\n */\nclass Lexer {\n constructor() {\n /**\n * Flag indicating whether the end of the current buffer marks the end of\n * all input\n */\n this.atEnd = false;\n /**\n * Explicit indent set in block scalar header, as an offset from the current\n * minimum indent, so e.g. set to 1 from a header `|2+`. Set to -1 if not\n * explicitly set.\n */\n this.blockScalarIndent = -1;\n /**\n * Block scalars that include a + (keep) chomping indicator in their header\n * include trailing empty lines, which are otherwise excluded from the\n * scalar's contents.\n */\n this.blockScalarKeep = false;\n /** Current input */\n this.buffer = '';\n /**\n * Flag noting whether the map value indicator : can immediately follow this\n * node within a flow context.\n */\n this.flowKey = false;\n /** Count of surrounding flow collection levels. */\n this.flowLevel = 0;\n /**\n * Minimum level of indentation required for next lines to be parsed as a\n * part of the current scalar value.\n */\n this.indentNext = 0;\n /** Indentation level of the current line. */\n this.indentValue = 0;\n /** Position of the next \\n character. */\n this.lineEndPos = null;\n /** Stores the state of the lexer if reaching the end of incpomplete input */\n this.next = null;\n /** A pointer to `buffer`; the current position of the lexer. */\n this.pos = 0;\n }\n /**\n * Generate YAML tokens from the `source` string. If `incomplete`,\n * a part of the last line may be left as a buffer for the next call.\n *\n * @returns A generator of lexical tokens\n */\n *lex(source, incomplete = false) {\n if (source) {\n if (typeof source !== 'string')\n throw TypeError('source is not a string');\n this.buffer = this.buffer ? this.buffer + source : source;\n this.lineEndPos = null;\n }\n this.atEnd = !incomplete;\n let next = this.next ?? 'stream';\n while (next && (incomplete || this.hasChars(1)))\n next = yield* this.parseNext(next);\n }\n atLineEnd() {\n let i = this.pos;\n let ch = this.buffer[i];\n while (ch === ' ' || ch === '\\t')\n ch = this.buffer[++i];\n if (!ch || ch === '#' || ch === '\\n')\n return true;\n if (ch === '\\r')\n return this.buffer[i + 1] === '\\n';\n return false;\n }\n charAt(n) {\n return this.buffer[this.pos + n];\n }\n continueScalar(offset) {\n let ch = this.buffer[offset];\n if (this.indentNext > 0) {\n let indent = 0;\n while (ch === ' ')\n ch = this.buffer[++indent + offset];\n if (ch === '\\r') {\n const next = this.buffer[indent + offset + 1];\n if (next === '\\n' || (!next && !this.atEnd))\n return offset + indent + 1;\n }\n return ch === '\\n' || indent >= this.indentNext || (!ch && !this.atEnd)\n ? offset + indent\n : -1;\n }\n if (ch === '-' || ch === '.') {\n const dt = this.buffer.substr(offset, 3);\n if ((dt === '---' || dt === '...') && isEmpty(this.buffer[offset + 3]))\n return -1;\n }\n return offset;\n }\n getLine() {\n let end = this.lineEndPos;\n if (typeof end !== 'number' || (end !== -1 && end < this.pos)) {\n end = this.buffer.indexOf('\\n', this.pos);\n this.lineEndPos = end;\n }\n if (end === -1)\n return this.atEnd ? this.buffer.substring(this.pos) : null;\n if (this.buffer[end - 1] === '\\r')\n end -= 1;\n return this.buffer.substring(this.pos, end);\n }\n hasChars(n) {\n return this.pos + n <= this.buffer.length;\n }\n setNext(state) {\n this.buffer = this.buffer.substring(this.pos);\n this.pos = 0;\n this.lineEndPos = null;\n this.next = state;\n return null;\n }\n peek(n) {\n return this.buffer.substr(this.pos, n);\n }\n *parseNext(next) {\n switch (next) {\n case 'stream':\n return yield* this.parseStream();\n case 'line-start':\n return yield* this.parseLineStart();\n case 'block-start':\n return yield* this.parseBlockStart();\n case 'doc':\n return yield* this.parseDocument();\n case 'flow':\n return yield* this.parseFlowCollection();\n case 'quoted-scalar':\n return yield* this.parseQuotedScalar();\n case 'block-scalar':\n return yield* this.parseBlockScalar();\n case 'plain-scalar':\n return yield* this.parsePlainScalar();\n }\n }\n *parseStream() {\n let line = this.getLine();\n if (line === null)\n return this.setNext('stream');\n if (line[0] === cst.BOM) {\n yield* this.pushCount(1);\n line = line.substring(1);\n }\n if (line[0] === '%') {\n let dirEnd = line.length;\n let cs = line.indexOf('#');\n while (cs !== -1) {\n const ch = line[cs - 1];\n if (ch === ' ' || ch === '\\t') {\n dirEnd = cs - 1;\n break;\n }\n else {\n cs = line.indexOf('#', cs + 1);\n }\n }\n while (true) {\n const ch = line[dirEnd - 1];\n if (ch === ' ' || ch === '\\t')\n dirEnd -= 1;\n else\n break;\n }\n const n = (yield* this.pushCount(dirEnd)) + (yield* this.pushSpaces(true));\n yield* this.pushCount(line.length - n); // possible comment\n this.pushNewline();\n return 'stream';\n }\n if (this.atLineEnd()) {\n const sp = yield* this.pushSpaces(true);\n yield* this.pushCount(line.length - sp);\n yield* this.pushNewline();\n return 'stream';\n }\n yield cst.DOCUMENT;\n return yield* this.parseLineStart();\n }\n *parseLineStart() {\n const ch = this.charAt(0);\n if (!ch && !this.atEnd)\n return this.setNext('line-start');\n if (ch === '-' || ch === '.') {\n if (!this.atEnd && !this.hasChars(4))\n return this.setNext('line-start');\n const s = this.peek(3);\n if ((s === '---' || s === '...') && isEmpty(this.charAt(3))) {\n yield* this.pushCount(3);\n this.indentValue = 0;\n this.indentNext = 0;\n return s === '---' ? 'doc' : 'stream';\n }\n }\n this.indentValue = yield* this.pushSpaces(false);\n if (this.indentNext > this.indentValue && !isEmpty(this.charAt(1)))\n this.indentNext = this.indentValue;\n return yield* this.parseBlockStart();\n }\n *parseBlockStart() {\n const [ch0, ch1] = this.peek(2);\n if (!ch1 && !this.atEnd)\n return this.setNext('block-start');\n if ((ch0 === '-' || ch0 === '?' || ch0 === ':') && isEmpty(ch1)) {\n const n = (yield* this.pushCount(1)) + (yield* this.pushSpaces(true));\n this.indentNext = this.indentValue + 1;\n this.indentValue += n;\n return yield* this.parseBlockStart();\n }\n return 'doc';\n }\n *parseDocument() {\n yield* this.pushSpaces(true);\n const line = this.getLine();\n if (line === null)\n return this.setNext('doc');\n let n = yield* this.pushIndicators();\n switch (line[n]) {\n case '#':\n yield* this.pushCount(line.length - n);\n // fallthrough\n case undefined:\n yield* this.pushNewline();\n return yield* this.parseLineStart();\n case '{':\n case '[':\n yield* this.pushCount(1);\n this.flowKey = false;\n this.flowLevel = 1;\n return 'flow';\n case '}':\n case ']':\n // this is an error\n yield* this.pushCount(1);\n return 'doc';\n case '*':\n yield* this.pushUntil(isNotAnchorChar);\n return 'doc';\n case '\"':\n case \"'\":\n return yield* this.parseQuotedScalar();\n case '|':\n case '>':\n n += yield* this.parseBlockScalarHeader();\n n += yield* this.pushSpaces(true);\n yield* this.pushCount(line.length - n);\n yield* this.pushNewline();\n return yield* this.parseBlockScalar();\n default:\n return yield* this.parsePlainScalar();\n }\n }\n *parseFlowCollection() {\n let nl, sp;\n let indent = -1;\n do {\n nl = yield* this.pushNewline();\n if (nl > 0) {\n sp = yield* this.pushSpaces(false);\n this.indentValue = indent = sp;\n }\n else {\n sp = 0;\n }\n sp += yield* this.pushSpaces(true);\n } while (nl + sp > 0);\n const line = this.getLine();\n if (line === null)\n return this.setNext('flow');\n if ((indent !== -1 && indent < this.indentNext && line[0] !== '#') ||\n (indent === 0 &&\n (line.startsWith('---') || line.startsWith('...')) &&\n isEmpty(line[3]))) {\n // Allowing for the terminal ] or } at the same (rather than greater)\n // indent level as the initial [ or { is technically invalid, but\n // failing here would be surprising to users.\n const atFlowEndMarker = indent === this.indentNext - 1 &&\n this.flowLevel === 1 &&\n (line[0] === ']' || line[0] === '}');\n if (!atFlowEndMarker) {\n // this is an error\n this.flowLevel = 0;\n yield cst.FLOW_END;\n return yield* this.parseLineStart();\n }\n }\n let n = 0;\n while (line[n] === ',') {\n n += yield* this.pushCount(1);\n n += yield* this.pushSpaces(true);\n this.flowKey = false;\n }\n n += yield* this.pushIndicators();\n switch (line[n]) {\n case undefined:\n return 'flow';\n case '#':\n yield* this.pushCount(line.length - n);\n return 'flow';\n case '{':\n case '[':\n yield* this.pushCount(1);\n this.flowKey = false;\n this.flowLevel += 1;\n return 'flow';\n case '}':\n case ']':\n yield* this.pushCount(1);\n this.flowKey = true;\n this.flowLevel -= 1;\n return this.flowLevel ? 'flow' : 'doc';\n case '*':\n yield* this.pushUntil(isNotAnchorChar);\n return 'flow';\n case '\"':\n case \"'\":\n this.flowKey = true;\n return yield* this.parseQuotedScalar();\n case ':': {\n const next = this.charAt(1);\n if (this.flowKey || isEmpty(next) || next === ',') {\n this.flowKey = false;\n yield* this.pushCount(1);\n yield* this.pushSpaces(true);\n return 'flow';\n }\n }\n // fallthrough\n default:\n this.flowKey = false;\n return yield* this.parsePlainScalar();\n }\n }\n *parseQuotedScalar() {\n const quote = this.charAt(0);\n let end = this.buffer.indexOf(quote, this.pos + 1);\n if (quote === \"'\") {\n while (end !== -1 && this.buffer[end + 1] === \"'\")\n end = this.buffer.indexOf(\"'\", end + 2);\n }\n else {\n // double-quote\n while (end !== -1) {\n let n = 0;\n while (this.buffer[end - 1 - n] === '\\\\')\n n += 1;\n if (n % 2 === 0)\n break;\n end = this.buffer.indexOf('\"', end + 1);\n }\n }\n // Only looking for newlines within the quotes\n const qb = this.buffer.substring(0, end);\n let nl = qb.indexOf('\\n', this.pos);\n if (nl !== -1) {\n while (nl !== -1) {\n const cs = this.continueScalar(nl + 1);\n if (cs === -1)\n break;\n nl = qb.indexOf('\\n', cs);\n }\n if (nl !== -1) {\n // this is an error caused by an unexpected unindent\n end = nl - (qb[nl - 1] === '\\r' ? 2 : 1);\n }\n }\n if (end === -1) {\n if (!this.atEnd)\n return this.setNext('quoted-scalar');\n end = this.buffer.length;\n }\n yield* this.pushToIndex(end + 1, false);\n return this.flowLevel ? 'flow' : 'doc';\n }\n *parseBlockScalarHeader() {\n this.blockScalarIndent = -1;\n this.blockScalarKeep = false;\n let i = this.pos;\n while (true) {\n const ch = this.buffer[++i];\n if (ch === '+')\n this.blockScalarKeep = true;\n else if (ch > '0' && ch <= '9')\n this.blockScalarIndent = Number(ch) - 1;\n else if (ch !== '-')\n break;\n }\n return yield* this.pushUntil(ch => isEmpty(ch) || ch === '#');\n }\n *parseBlockScalar() {\n let nl = this.pos - 1; // may be -1 if this.pos === 0\n let indent = 0;\n let ch;\n loop: for (let i = this.pos; (ch = this.buffer[i]); ++i) {\n switch (ch) {\n case ' ':\n indent += 1;\n break;\n case '\\n':\n nl = i;\n indent = 0;\n break;\n case '\\r': {\n const next = this.buffer[i + 1];\n if (!next && !this.atEnd)\n return this.setNext('block-scalar');\n if (next === '\\n')\n break;\n } // fallthrough\n default:\n break loop;\n }\n }\n if (!ch && !this.atEnd)\n return this.setNext('block-scalar');\n if (indent >= this.indentNext) {\n if (this.blockScalarIndent === -1)\n this.indentNext = indent;\n else {\n this.indentNext =\n this.blockScalarIndent + (this.indentNext === 0 ? 1 : this.indentNext);\n }\n do {\n const cs = this.continueScalar(nl + 1);\n if (cs === -1)\n break;\n nl = this.buffer.indexOf('\\n', cs);\n } while (nl !== -1);\n if (nl === -1) {\n if (!this.atEnd)\n return this.setNext('block-scalar');\n nl = this.buffer.length;\n }\n }\n // Trailing insufficiently indented tabs are invalid.\n // To catch that during parsing, we include them in the block scalar value.\n let i = nl + 1;\n ch = this.buffer[i];\n while (ch === ' ')\n ch = this.buffer[++i];\n if (ch === '\\t') {\n while (ch === '\\t' || ch === ' ' || ch === '\\r' || ch === '\\n')\n ch = this.buffer[++i];\n nl = i - 1;\n }\n else if (!this.blockScalarKeep) {\n do {\n let i = nl - 1;\n let ch = this.buffer[i];\n if (ch === '\\r')\n ch = this.buffer[--i];\n const lastChar = i; // Drop the line if last char not more indented\n while (ch === ' ')\n ch = this.buffer[--i];\n if (ch === '\\n' && i >= this.pos && i + 1 + indent > lastChar)\n nl = i;\n else\n break;\n } while (true);\n }\n yield cst.SCALAR;\n yield* this.pushToIndex(nl + 1, true);\n return yield* this.parseLineStart();\n }\n *parsePlainScalar() {\n const inFlow = this.flowLevel > 0;\n let end = this.pos - 1;\n let i = this.pos - 1;\n let ch;\n while ((ch = this.buffer[++i])) {\n if (ch === ':') {\n const next = this.buffer[i + 1];\n if (isEmpty(next) || (inFlow && flowIndicatorChars.has(next)))\n break;\n end = i;\n }\n else if (isEmpty(ch)) {\n let next = this.buffer[i + 1];\n if (ch === '\\r') {\n if (next === '\\n') {\n i += 1;\n ch = '\\n';\n next = this.buffer[i + 1];\n }\n else\n end = i;\n }\n if (next === '#' || (inFlow && flowIndicatorChars.has(next)))\n break;\n if (ch === '\\n') {\n const cs = this.continueScalar(i + 1);\n if (cs === -1)\n break;\n i = Math.max(i, cs - 2); // to advance, but still account for ' #'\n }\n }\n else {\n if (inFlow && flowIndicatorChars.has(ch))\n break;\n end = i;\n }\n }\n if (!ch && !this.atEnd)\n return this.setNext('plain-scalar');\n yield cst.SCALAR;\n yield* this.pushToIndex(end + 1, true);\n return inFlow ? 'flow' : 'doc';\n }\n *pushCount(n) {\n if (n > 0) {\n yield this.buffer.substr(this.pos, n);\n this.pos += n;\n return n;\n }\n return 0;\n }\n *pushToIndex(i, allowEmpty) {\n const s = this.buffer.slice(this.pos, i);\n if (s) {\n yield s;\n this.pos += s.length;\n return s.length;\n }\n else if (allowEmpty)\n yield '';\n return 0;\n }\n *pushIndicators() {\n switch (this.charAt(0)) {\n case '!':\n return ((yield* this.pushTag()) +\n (yield* this.pushSpaces(true)) +\n (yield* this.pushIndicators()));\n case '&':\n return ((yield* this.pushUntil(isNotAnchorChar)) +\n (yield* this.pushSpaces(true)) +\n (yield* this.pushIndicators()));\n case '-': // this is an error\n case '?': // this is an error outside flow collections\n case ':': {\n const inFlow = this.flowLevel > 0;\n const ch1 = this.charAt(1);\n if (isEmpty(ch1) || (inFlow && flowIndicatorChars.has(ch1))) {\n if (!inFlow)\n this.indentNext = this.indentValue + 1;\n else if (this.flowKey)\n this.flowKey = false;\n return ((yield* this.pushCount(1)) +\n (yield* this.pushSpaces(true)) +\n (yield* this.pushIndicators()));\n }\n }\n }\n return 0;\n }\n *pushTag() {\n if (this.charAt(1) === '<') {\n let i = this.pos + 2;\n let ch = this.buffer[i];\n while (!isEmpty(ch) && ch !== '>')\n ch = this.buffer[++i];\n return yield* this.pushToIndex(ch === '>' ? i + 1 : i, false);\n }\n else {\n let i = this.pos + 1;\n let ch = this.buffer[i];\n while (ch) {\n if (tagChars.has(ch))\n ch = this.buffer[++i];\n else if (ch === '%' &&\n hexDigits.has(this.buffer[i + 1]) &&\n hexDigits.has(this.buffer[i + 2])) {\n ch = this.buffer[(i += 3)];\n }\n else\n break;\n }\n return yield* this.pushToIndex(i, false);\n }\n }\n *pushNewline() {\n const ch = this.buffer[this.pos];\n if (ch === '\\n')\n return yield* this.pushCount(1);\n else if (ch === '\\r' && this.charAt(1) === '\\n')\n return yield* this.pushCount(2);\n else\n return 0;\n }\n *pushSpaces(allowTabs) {\n let i = this.pos - 1;\n let ch;\n do {\n ch = this.buffer[++i];\n } while (ch === ' ' || (allowTabs && ch === '\\t'));\n const n = i - this.pos;\n if (n > 0) {\n yield this.buffer.substr(this.pos, n);\n this.pos = i;\n }\n return n;\n }\n *pushUntil(test) {\n let i = this.pos;\n let ch = this.buffer[i];\n while (!test(ch))\n ch = this.buffer[++i];\n return yield* this.pushToIndex(i, false);\n }\n}\n\nexports.Lexer = Lexer;\n","'use strict';\n\n/**\n * Tracks newlines during parsing in order to provide an efficient API for\n * determining the one-indexed `{ line, col }` position for any offset\n * within the input.\n */\nclass LineCounter {\n constructor() {\n this.lineStarts = [];\n /**\n * Should be called in ascending order. Otherwise, call\n * `lineCounter.lineStarts.sort()` before calling `linePos()`.\n */\n this.addNewLine = (offset) => this.lineStarts.push(offset);\n /**\n * Performs a binary search and returns the 1-indexed { line, col }\n * position of `offset`. If `line === 0`, `addNewLine` has never been\n * called or `offset` is before the first known newline.\n */\n this.linePos = (offset) => {\n let low = 0;\n let high = this.lineStarts.length;\n while (low < high) {\n const mid = (low + high) >> 1; // Math.floor((low + high) / 2)\n if (this.lineStarts[mid] < offset)\n low = mid + 1;\n else\n high = mid;\n }\n if (this.lineStarts[low] === offset)\n return { line: low + 1, col: 1 };\n if (low === 0)\n return { line: 0, col: offset };\n const start = this.lineStarts[low - 1];\n return { line: low, col: offset - start + 1 };\n };\n }\n}\n\nexports.LineCounter = LineCounter;\n","'use strict';\n\nvar node_process = require('process');\nvar cst = require('./cst.js');\nvar lexer = require('./lexer.js');\n\nfunction includesToken(list, type) {\n for (let i = 0; i < list.length; ++i)\n if (list[i].type === type)\n return true;\n return false;\n}\nfunction findNonEmptyIndex(list) {\n for (let i = 0; i < list.length; ++i) {\n switch (list[i].type) {\n case 'space':\n case 'comment':\n case 'newline':\n break;\n default:\n return i;\n }\n }\n return -1;\n}\nfunction isFlowToken(token) {\n switch (token?.type) {\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n case 'flow-collection':\n return true;\n default:\n return false;\n }\n}\nfunction getPrevProps(parent) {\n switch (parent.type) {\n case 'document':\n return parent.start;\n case 'block-map': {\n const it = parent.items[parent.items.length - 1];\n return it.sep ?? it.start;\n }\n case 'block-seq':\n return parent.items[parent.items.length - 1].start;\n /* istanbul ignore next should not happen */\n default:\n return [];\n }\n}\n/** Note: May modify input array */\nfunction getFirstKeyStartProps(prev) {\n if (prev.length === 0)\n return [];\n let i = prev.length;\n loop: while (--i >= 0) {\n switch (prev[i].type) {\n case 'doc-start':\n case 'explicit-key-ind':\n case 'map-value-ind':\n case 'seq-item-ind':\n case 'newline':\n break loop;\n }\n }\n while (prev[++i]?.type === 'space') {\n /* loop */\n }\n return prev.splice(i, prev.length);\n}\nfunction fixFlowSeqItems(fc) {\n if (fc.start.type === 'flow-seq-start') {\n for (const it of fc.items) {\n if (it.sep &&\n !it.value &&\n !includesToken(it.start, 'explicit-key-ind') &&\n !includesToken(it.sep, 'map-value-ind')) {\n if (it.key)\n it.value = it.key;\n delete it.key;\n if (isFlowToken(it.value)) {\n if (it.value.end)\n Array.prototype.push.apply(it.value.end, it.sep);\n else\n it.value.end = it.sep;\n }\n else\n Array.prototype.push.apply(it.start, it.sep);\n delete it.sep;\n }\n }\n }\n}\n/**\n * A YAML concrete syntax tree (CST) parser\n *\n * ```ts\n * const src: string = ...\n * for (const token of new Parser().parse(src)) {\n * // token: Token\n * }\n * ```\n *\n * To use the parser with a user-provided lexer:\n *\n * ```ts\n * function* parse(source: string, lexer: Lexer) {\n * const parser = new Parser()\n * for (const lexeme of lexer.lex(source))\n * yield* parser.next(lexeme)\n * yield* parser.end()\n * }\n *\n * const src: string = ...\n * const lexer = new Lexer()\n * for (const token of parse(src, lexer)) {\n * // token: Token\n * }\n * ```\n */\nclass Parser {\n /**\n * @param onNewLine - If defined, called separately with the start position of\n * each new line (in `parse()`, including the start of input).\n */\n constructor(onNewLine) {\n /** If true, space and sequence indicators count as indentation */\n this.atNewLine = true;\n /** If true, next token is a scalar value */\n this.atScalar = false;\n /** Current indentation level */\n this.indent = 0;\n /** Current offset since the start of parsing */\n this.offset = 0;\n /** On the same line with a block map key */\n this.onKeyLine = false;\n /** Top indicates the node that's currently being built */\n this.stack = [];\n /** The source of the current token, set in parse() */\n this.source = '';\n /** The type of the current token, set in parse() */\n this.type = '';\n // Must be defined after `next()`\n this.lexer = new lexer.Lexer();\n this.onNewLine = onNewLine;\n }\n /**\n * Parse `source` as a YAML stream.\n * If `incomplete`, a part of the last line may be left as a buffer for the next call.\n *\n * Errors are not thrown, but yielded as `{ type: 'error', message }` tokens.\n *\n * @returns A generator of tokens representing each directive, document, and other structure.\n */\n *parse(source, incomplete = false) {\n if (this.onNewLine && this.offset === 0)\n this.onNewLine(0);\n for (const lexeme of this.lexer.lex(source, incomplete))\n yield* this.next(lexeme);\n if (!incomplete)\n yield* this.end();\n }\n /**\n * Advance the parser by the `source` of one lexical token.\n */\n *next(source) {\n this.source = source;\n if (node_process.env.LOG_TOKENS)\n console.log('|', cst.prettyToken(source));\n if (this.atScalar) {\n this.atScalar = false;\n yield* this.step();\n this.offset += source.length;\n return;\n }\n const type = cst.tokenType(source);\n if (!type) {\n const message = `Not a YAML token: ${source}`;\n yield* this.pop({ type: 'error', offset: this.offset, message, source });\n this.offset += source.length;\n }\n else if (type === 'scalar') {\n this.atNewLine = false;\n this.atScalar = true;\n this.type = 'scalar';\n }\n else {\n this.type = type;\n yield* this.step();\n switch (type) {\n case 'newline':\n this.atNewLine = true;\n this.indent = 0;\n if (this.onNewLine)\n this.onNewLine(this.offset + source.length);\n break;\n case 'space':\n if (this.atNewLine && source[0] === ' ')\n this.indent += source.length;\n break;\n case 'explicit-key-ind':\n case 'map-value-ind':\n case 'seq-item-ind':\n if (this.atNewLine)\n this.indent += source.length;\n break;\n case 'doc-mode':\n case 'flow-error-end':\n return;\n default:\n this.atNewLine = false;\n }\n this.offset += source.length;\n }\n }\n /** Call at end of input to push out any remaining constructions */\n *end() {\n while (this.stack.length > 0)\n yield* this.pop();\n }\n get sourceToken() {\n const st = {\n type: this.type,\n offset: this.offset,\n indent: this.indent,\n source: this.source\n };\n return st;\n }\n *step() {\n const top = this.peek(1);\n if (this.type === 'doc-end' && (!top || top.type !== 'doc-end')) {\n while (this.stack.length > 0)\n yield* this.pop();\n this.stack.push({\n type: 'doc-end',\n offset: this.offset,\n source: this.source\n });\n return;\n }\n if (!top)\n return yield* this.stream();\n switch (top.type) {\n case 'document':\n return yield* this.document(top);\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return yield* this.scalar(top);\n case 'block-scalar':\n return yield* this.blockScalar(top);\n case 'block-map':\n return yield* this.blockMap(top);\n case 'block-seq':\n return yield* this.blockSequence(top);\n case 'flow-collection':\n return yield* this.flowCollection(top);\n case 'doc-end':\n return yield* this.documentEnd(top);\n }\n /* istanbul ignore next should not happen */\n yield* this.pop();\n }\n peek(n) {\n return this.stack[this.stack.length - n];\n }\n *pop(error) {\n const token = error ?? this.stack.pop();\n /* istanbul ignore if should not happen */\n if (!token) {\n const message = 'Tried to pop an empty stack';\n yield { type: 'error', offset: this.offset, source: '', message };\n }\n else if (this.stack.length === 0) {\n yield token;\n }\n else {\n const top = this.peek(1);\n if (token.type === 'block-scalar') {\n // Block scalars use their parent rather than header indent\n token.indent = 'indent' in top ? top.indent : 0;\n }\n else if (token.type === 'flow-collection' && top.type === 'document') {\n // Ignore all indent for top-level flow collections\n token.indent = 0;\n }\n if (token.type === 'flow-collection')\n fixFlowSeqItems(token);\n switch (top.type) {\n case 'document':\n top.value = token;\n break;\n case 'block-scalar':\n top.props.push(token); // error\n break;\n case 'block-map': {\n const it = top.items[top.items.length - 1];\n if (it.value) {\n top.items.push({ start: [], key: token, sep: [] });\n this.onKeyLine = true;\n return;\n }\n else if (it.sep) {\n it.value = token;\n }\n else {\n Object.assign(it, { key: token, sep: [] });\n this.onKeyLine = !it.explicitKey;\n return;\n }\n break;\n }\n case 'block-seq': {\n const it = top.items[top.items.length - 1];\n if (it.value)\n top.items.push({ start: [], value: token });\n else\n it.value = token;\n break;\n }\n case 'flow-collection': {\n const it = top.items[top.items.length - 1];\n if (!it || it.value)\n top.items.push({ start: [], key: token, sep: [] });\n else if (it.sep)\n it.value = token;\n else\n Object.assign(it, { key: token, sep: [] });\n return;\n }\n /* istanbul ignore next should not happen */\n default:\n yield* this.pop();\n yield* this.pop(token);\n }\n if ((top.type === 'document' ||\n top.type === 'block-map' ||\n top.type === 'block-seq') &&\n (token.type === 'block-map' || token.type === 'block-seq')) {\n const last = token.items[token.items.length - 1];\n if (last &&\n !last.sep &&\n !last.value &&\n last.start.length > 0 &&\n findNonEmptyIndex(last.start) === -1 &&\n (token.indent === 0 ||\n last.start.every(st => st.type !== 'comment' || st.indent < token.indent))) {\n if (top.type === 'document')\n top.end = last.start;\n else\n top.items.push({ start: last.start });\n token.items.splice(-1, 1);\n }\n }\n }\n }\n *stream() {\n switch (this.type) {\n case 'directive-line':\n yield { type: 'directive', offset: this.offset, source: this.source };\n return;\n case 'byte-order-mark':\n case 'space':\n case 'comment':\n case 'newline':\n yield this.sourceToken;\n return;\n case 'doc-mode':\n case 'doc-start': {\n const doc = {\n type: 'document',\n offset: this.offset,\n start: []\n };\n if (this.type === 'doc-start')\n doc.start.push(this.sourceToken);\n this.stack.push(doc);\n return;\n }\n }\n yield {\n type: 'error',\n offset: this.offset,\n message: `Unexpected ${this.type} token in YAML stream`,\n source: this.source\n };\n }\n *document(doc) {\n if (doc.value)\n return yield* this.lineEnd(doc);\n switch (this.type) {\n case 'doc-start': {\n if (findNonEmptyIndex(doc.start) !== -1) {\n yield* this.pop();\n yield* this.step();\n }\n else\n doc.start.push(this.sourceToken);\n return;\n }\n case 'anchor':\n case 'tag':\n case 'space':\n case 'comment':\n case 'newline':\n doc.start.push(this.sourceToken);\n return;\n }\n const bv = this.startBlockValue(doc);\n if (bv)\n this.stack.push(bv);\n else {\n yield {\n type: 'error',\n offset: this.offset,\n message: `Unexpected ${this.type} token in YAML document`,\n source: this.source\n };\n }\n }\n *scalar(scalar) {\n if (this.type === 'map-value-ind') {\n const prev = getPrevProps(this.peek(2));\n const start = getFirstKeyStartProps(prev);\n let sep;\n if (scalar.end) {\n sep = scalar.end;\n sep.push(this.sourceToken);\n delete scalar.end;\n }\n else\n sep = [this.sourceToken];\n const map = {\n type: 'block-map',\n offset: scalar.offset,\n indent: scalar.indent,\n items: [{ start, key: scalar, sep }]\n };\n this.onKeyLine = true;\n this.stack[this.stack.length - 1] = map;\n }\n else\n yield* this.lineEnd(scalar);\n }\n *blockScalar(scalar) {\n switch (this.type) {\n case 'space':\n case 'comment':\n case 'newline':\n scalar.props.push(this.sourceToken);\n return;\n case 'scalar':\n scalar.source = this.source;\n // block-scalar source includes trailing newline\n this.atNewLine = true;\n this.indent = 0;\n if (this.onNewLine) {\n let nl = this.source.indexOf('\\n') + 1;\n while (nl !== 0) {\n this.onNewLine(this.offset + nl);\n nl = this.source.indexOf('\\n', nl) + 1;\n }\n }\n yield* this.pop();\n break;\n /* istanbul ignore next should not happen */\n default:\n yield* this.pop();\n yield* this.step();\n }\n }\n *blockMap(map) {\n const it = map.items[map.items.length - 1];\n // it.sep is true-ish if pair already has key or : separator\n switch (this.type) {\n case 'newline':\n this.onKeyLine = false;\n if (it.value) {\n const end = 'end' in it.value ? it.value.end : undefined;\n const last = Array.isArray(end) ? end[end.length - 1] : undefined;\n if (last?.type === 'comment')\n end?.push(this.sourceToken);\n else\n map.items.push({ start: [this.sourceToken] });\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n it.start.push(this.sourceToken);\n }\n return;\n case 'space':\n case 'comment':\n if (it.value) {\n map.items.push({ start: [this.sourceToken] });\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n if (this.atIndentedComment(it.start, map.indent)) {\n const prev = map.items[map.items.length - 2];\n const end = prev?.value?.end;\n if (Array.isArray(end)) {\n Array.prototype.push.apply(end, it.start);\n end.push(this.sourceToken);\n map.items.pop();\n return;\n }\n }\n it.start.push(this.sourceToken);\n }\n return;\n }\n if (this.indent >= map.indent) {\n const atMapIndent = !this.onKeyLine && this.indent === map.indent;\n const atNextItem = atMapIndent &&\n (it.sep || it.explicitKey) &&\n this.type !== 'seq-item-ind';\n // For empty nodes, assign newline-separated not indented empty tokens to following node\n let start = [];\n if (atNextItem && it.sep && !it.value) {\n const nl = [];\n for (let i = 0; i < it.sep.length; ++i) {\n const st = it.sep[i];\n switch (st.type) {\n case 'newline':\n nl.push(i);\n break;\n case 'space':\n break;\n case 'comment':\n if (st.indent > map.indent)\n nl.length = 0;\n break;\n default:\n nl.length = 0;\n }\n }\n if (nl.length >= 2)\n start = it.sep.splice(nl[1]);\n }\n switch (this.type) {\n case 'anchor':\n case 'tag':\n if (atNextItem || it.value) {\n start.push(this.sourceToken);\n map.items.push({ start });\n this.onKeyLine = true;\n }\n else if (it.sep) {\n it.sep.push(this.sourceToken);\n }\n else {\n it.start.push(this.sourceToken);\n }\n return;\n case 'explicit-key-ind':\n if (!it.sep && !it.explicitKey) {\n it.start.push(this.sourceToken);\n it.explicitKey = true;\n }\n else if (atNextItem || it.value) {\n start.push(this.sourceToken);\n map.items.push({ start, explicitKey: true });\n }\n else {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [this.sourceToken], explicitKey: true }]\n });\n }\n this.onKeyLine = true;\n return;\n case 'map-value-ind':\n if (it.explicitKey) {\n if (!it.sep) {\n if (includesToken(it.start, 'newline')) {\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n }\n else {\n const start = getFirstKeyStartProps(it.start);\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n });\n }\n }\n else if (it.value) {\n map.items.push({ start: [], key: null, sep: [this.sourceToken] });\n }\n else if (includesToken(it.sep, 'map-value-ind')) {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n });\n }\n else if (isFlowToken(it.key) &&\n !includesToken(it.sep, 'newline')) {\n const start = getFirstKeyStartProps(it.start);\n const key = it.key;\n const sep = it.sep;\n sep.push(this.sourceToken);\n // @ts-expect-error type guard is wrong here\n delete it.key;\n // @ts-expect-error type guard is wrong here\n delete it.sep;\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key, sep }]\n });\n }\n else if (start.length > 0) {\n // Not actually at next item\n it.sep = it.sep.concat(start, this.sourceToken);\n }\n else {\n it.sep.push(this.sourceToken);\n }\n }\n else {\n if (!it.sep) {\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n }\n else if (it.value || atNextItem) {\n map.items.push({ start, key: null, sep: [this.sourceToken] });\n }\n else if (includesToken(it.sep, 'map-value-ind')) {\n this.stack.push({\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [], key: null, sep: [this.sourceToken] }]\n });\n }\n else {\n it.sep.push(this.sourceToken);\n }\n }\n this.onKeyLine = true;\n return;\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar': {\n const fs = this.flowScalar(this.type);\n if (atNextItem || it.value) {\n map.items.push({ start, key: fs, sep: [] });\n this.onKeyLine = true;\n }\n else if (it.sep) {\n this.stack.push(fs);\n }\n else {\n Object.assign(it, { key: fs, sep: [] });\n this.onKeyLine = true;\n }\n return;\n }\n default: {\n const bv = this.startBlockValue(map);\n if (bv) {\n if (bv.type === 'block-seq') {\n if (!it.explicitKey &&\n it.sep &&\n !includesToken(it.sep, 'newline')) {\n yield* this.pop({\n type: 'error',\n offset: this.offset,\n message: 'Unexpected block-seq-ind on same line with key',\n source: this.source\n });\n return;\n }\n }\n else if (atMapIndent) {\n map.items.push({ start });\n }\n this.stack.push(bv);\n return;\n }\n }\n }\n }\n yield* this.pop();\n yield* this.step();\n }\n *blockSequence(seq) {\n const it = seq.items[seq.items.length - 1];\n switch (this.type) {\n case 'newline':\n if (it.value) {\n const end = 'end' in it.value ? it.value.end : undefined;\n const last = Array.isArray(end) ? end[end.length - 1] : undefined;\n if (last?.type === 'comment')\n end?.push(this.sourceToken);\n else\n seq.items.push({ start: [this.sourceToken] });\n }\n else\n it.start.push(this.sourceToken);\n return;\n case 'space':\n case 'comment':\n if (it.value)\n seq.items.push({ start: [this.sourceToken] });\n else {\n if (this.atIndentedComment(it.start, seq.indent)) {\n const prev = seq.items[seq.items.length - 2];\n const end = prev?.value?.end;\n if (Array.isArray(end)) {\n Array.prototype.push.apply(end, it.start);\n end.push(this.sourceToken);\n seq.items.pop();\n return;\n }\n }\n it.start.push(this.sourceToken);\n }\n return;\n case 'anchor':\n case 'tag':\n if (it.value || this.indent <= seq.indent)\n break;\n it.start.push(this.sourceToken);\n return;\n case 'seq-item-ind':\n if (this.indent !== seq.indent)\n break;\n if (it.value || includesToken(it.start, 'seq-item-ind'))\n seq.items.push({ start: [this.sourceToken] });\n else\n it.start.push(this.sourceToken);\n return;\n }\n if (this.indent > seq.indent) {\n const bv = this.startBlockValue(seq);\n if (bv) {\n this.stack.push(bv);\n return;\n }\n }\n yield* this.pop();\n yield* this.step();\n }\n *flowCollection(fc) {\n const it = fc.items[fc.items.length - 1];\n if (this.type === 'flow-error-end') {\n let top;\n do {\n yield* this.pop();\n top = this.peek(1);\n } while (top && top.type === 'flow-collection');\n }\n else if (fc.end.length === 0) {\n switch (this.type) {\n case 'comma':\n case 'explicit-key-ind':\n if (!it || it.sep)\n fc.items.push({ start: [this.sourceToken] });\n else\n it.start.push(this.sourceToken);\n return;\n case 'map-value-ind':\n if (!it || it.value)\n fc.items.push({ start: [], key: null, sep: [this.sourceToken] });\n else if (it.sep)\n it.sep.push(this.sourceToken);\n else\n Object.assign(it, { key: null, sep: [this.sourceToken] });\n return;\n case 'space':\n case 'comment':\n case 'newline':\n case 'anchor':\n case 'tag':\n if (!it || it.value)\n fc.items.push({ start: [this.sourceToken] });\n else if (it.sep)\n it.sep.push(this.sourceToken);\n else\n it.start.push(this.sourceToken);\n return;\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar': {\n const fs = this.flowScalar(this.type);\n if (!it || it.value)\n fc.items.push({ start: [], key: fs, sep: [] });\n else if (it.sep)\n this.stack.push(fs);\n else\n Object.assign(it, { key: fs, sep: [] });\n return;\n }\n case 'flow-map-end':\n case 'flow-seq-end':\n fc.end.push(this.sourceToken);\n return;\n }\n const bv = this.startBlockValue(fc);\n /* istanbul ignore else should not happen */\n if (bv)\n this.stack.push(bv);\n else {\n yield* this.pop();\n yield* this.step();\n }\n }\n else {\n const parent = this.peek(2);\n if (parent.type === 'block-map' &&\n ((this.type === 'map-value-ind' && parent.indent === fc.indent) ||\n (this.type === 'newline' &&\n !parent.items[parent.items.length - 1].sep))) {\n yield* this.pop();\n yield* this.step();\n }\n else if (this.type === 'map-value-ind' &&\n parent.type !== 'flow-collection') {\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n fixFlowSeqItems(fc);\n const sep = fc.end.splice(1, fc.end.length);\n sep.push(this.sourceToken);\n const map = {\n type: 'block-map',\n offset: fc.offset,\n indent: fc.indent,\n items: [{ start, key: fc, sep }]\n };\n this.onKeyLine = true;\n this.stack[this.stack.length - 1] = map;\n }\n else {\n yield* this.lineEnd(fc);\n }\n }\n }\n flowScalar(type) {\n if (this.onNewLine) {\n let nl = this.source.indexOf('\\n') + 1;\n while (nl !== 0) {\n this.onNewLine(this.offset + nl);\n nl = this.source.indexOf('\\n', nl) + 1;\n }\n }\n return {\n type,\n offset: this.offset,\n indent: this.indent,\n source: this.source\n };\n }\n startBlockValue(parent) {\n switch (this.type) {\n case 'alias':\n case 'scalar':\n case 'single-quoted-scalar':\n case 'double-quoted-scalar':\n return this.flowScalar(this.type);\n case 'block-scalar-header':\n return {\n type: 'block-scalar',\n offset: this.offset,\n indent: this.indent,\n props: [this.sourceToken],\n source: ''\n };\n case 'flow-map-start':\n case 'flow-seq-start':\n return {\n type: 'flow-collection',\n offset: this.offset,\n indent: this.indent,\n start: this.sourceToken,\n items: [],\n end: []\n };\n case 'seq-item-ind':\n return {\n type: 'block-seq',\n offset: this.offset,\n indent: this.indent,\n items: [{ start: [this.sourceToken] }]\n };\n case 'explicit-key-ind': {\n this.onKeyLine = true;\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n start.push(this.sourceToken);\n return {\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, explicitKey: true }]\n };\n }\n case 'map-value-ind': {\n this.onKeyLine = true;\n const prev = getPrevProps(parent);\n const start = getFirstKeyStartProps(prev);\n return {\n type: 'block-map',\n offset: this.offset,\n indent: this.indent,\n items: [{ start, key: null, sep: [this.sourceToken] }]\n };\n }\n }\n return null;\n }\n atIndentedComment(start, indent) {\n if (this.type !== 'comment')\n return false;\n if (this.indent <= indent)\n return false;\n return start.every(st => st.type === 'newline' || st.type === 'space');\n }\n *documentEnd(docEnd) {\n if (this.type !== 'doc-mode') {\n if (docEnd.end)\n docEnd.end.push(this.sourceToken);\n else\n docEnd.end = [this.sourceToken];\n if (this.type === 'newline')\n yield* this.pop();\n }\n }\n *lineEnd(token) {\n switch (this.type) {\n case 'comma':\n case 'doc-start':\n case 'doc-end':\n case 'flow-seq-end':\n case 'flow-map-end':\n case 'map-value-ind':\n yield* this.pop();\n yield* this.step();\n break;\n case 'newline':\n this.onKeyLine = false;\n // fallthrough\n case 'space':\n case 'comment':\n default:\n // all other values are errors\n if (token.end)\n token.end.push(this.sourceToken);\n else\n token.end = [this.sourceToken];\n if (this.type === 'newline')\n yield* this.pop();\n }\n }\n}\n\nexports.Parser = Parser;\n","'use strict';\n\nvar composer = require('./compose/composer.js');\nvar Document = require('./doc/Document.js');\nvar errors = require('./errors.js');\nvar log = require('./log.js');\nvar identity = require('./nodes/identity.js');\nvar lineCounter = require('./parse/line-counter.js');\nvar parser = require('./parse/parser.js');\n\nfunction parseOptions(options) {\n const prettyErrors = options.prettyErrors !== false;\n const lineCounter$1 = options.lineCounter || (prettyErrors && new lineCounter.LineCounter()) || null;\n return { lineCounter: lineCounter$1, prettyErrors };\n}\n/**\n * Parse the input as a stream of YAML documents.\n *\n * Documents should be separated from each other by `...` or `---` marker lines.\n *\n * @returns If an empty `docs` array is returned, it will be of type\n * EmptyStream and contain additional stream information. In\n * TypeScript, you should use `'empty' in docs` as a type guard for it.\n */\nfunction parseAllDocuments(source, options = {}) {\n const { lineCounter, prettyErrors } = parseOptions(options);\n const parser$1 = new parser.Parser(lineCounter?.addNewLine);\n const composer$1 = new composer.Composer(options);\n const docs = Array.from(composer$1.compose(parser$1.parse(source)));\n if (prettyErrors && lineCounter)\n for (const doc of docs) {\n doc.errors.forEach(errors.prettifyError(source, lineCounter));\n doc.warnings.forEach(errors.prettifyError(source, lineCounter));\n }\n if (docs.length > 0)\n return docs;\n return Object.assign([], { empty: true }, composer$1.streamInfo());\n}\n/** Parse an input string into a single YAML.Document */\nfunction parseDocument(source, options = {}) {\n const { lineCounter, prettyErrors } = parseOptions(options);\n const parser$1 = new parser.Parser(lineCounter?.addNewLine);\n const composer$1 = new composer.Composer(options);\n // `doc` is always set by compose.end(true) at the very latest\n let doc = null;\n for (const _doc of composer$1.compose(parser$1.parse(source), true, source.length)) {\n if (!doc)\n doc = _doc;\n else if (doc.options.logLevel !== 'silent') {\n doc.errors.push(new errors.YAMLParseError(_doc.range.slice(0, 2), 'MULTIPLE_DOCS', 'Source contains multiple documents; please use YAML.parseAllDocuments()'));\n break;\n }\n }\n if (prettyErrors && lineCounter) {\n doc.errors.forEach(errors.prettifyError(source, lineCounter));\n doc.warnings.forEach(errors.prettifyError(source, lineCounter));\n }\n return doc;\n}\nfunction parse(src, reviver, options) {\n let _reviver = undefined;\n if (typeof reviver === 'function') {\n _reviver = reviver;\n }\n else if (options === undefined && reviver && typeof reviver === 'object') {\n options = reviver;\n }\n const doc = parseDocument(src, options);\n if (!doc)\n return null;\n doc.warnings.forEach(warning => log.warn(doc.options.logLevel, warning));\n if (doc.errors.length > 0) {\n if (doc.options.logLevel !== 'silent')\n throw doc.errors[0];\n else\n doc.errors = [];\n }\n return doc.toJS(Object.assign({ reviver: _reviver }, options));\n}\nfunction stringify(value, replacer, options) {\n let _replacer = null;\n if (typeof replacer === 'function' || Array.isArray(replacer)) {\n _replacer = replacer;\n }\n else if (options === undefined && replacer) {\n options = replacer;\n }\n if (typeof options === 'string')\n options = options.length;\n if (typeof options === 'number') {\n const indent = Math.round(options);\n options = indent < 1 ? undefined : indent > 8 ? { indent: 8 } : { indent };\n }\n if (value === undefined) {\n const { keepUndefined } = options ?? replacer ?? {};\n if (!keepUndefined)\n return undefined;\n }\n if (identity.isDocument(value) && !_replacer)\n return value.toString(options);\n return new Document.Document(value, _replacer, options).toString(options);\n}\n\nexports.parse = parse;\nexports.parseAllDocuments = parseAllDocuments;\nexports.parseDocument = parseDocument;\nexports.stringify = stringify;\n","'use strict';\n\nvar composer = require('./compose/composer.js');\nvar Document = require('./doc/Document.js');\nvar Schema = require('./schema/Schema.js');\nvar errors = require('./errors.js');\nvar Alias = require('./nodes/Alias.js');\nvar identity = require('./nodes/identity.js');\nvar Pair = require('./nodes/Pair.js');\nvar Scalar = require('./nodes/Scalar.js');\nvar YAMLMap = require('./nodes/YAMLMap.js');\nvar YAMLSeq = require('./nodes/YAMLSeq.js');\nvar cst = require('./parse/cst.js');\nvar lexer = require('./parse/lexer.js');\nvar lineCounter = require('./parse/line-counter.js');\nvar parser = require('./parse/parser.js');\nvar publicApi = require('./public-api.js');\nvar visit = require('./visit.js');\n\n\n\nexports.Composer = composer.Composer;\nexports.Document = Document.Document;\nexports.Schema = Schema.Schema;\nexports.YAMLError = errors.YAMLError;\nexports.YAMLParseError = errors.YAMLParseError;\nexports.YAMLWarning = errors.YAMLWarning;\nexports.Alias = Alias.Alias;\nexports.isAlias = identity.isAlias;\nexports.isCollection = identity.isCollection;\nexports.isDocument = identity.isDocument;\nexports.isMap = identity.isMap;\nexports.isNode = identity.isNode;\nexports.isPair = identity.isPair;\nexports.isScalar = identity.isScalar;\nexports.isSeq = identity.isSeq;\nexports.Pair = Pair.Pair;\nexports.Scalar = Scalar.Scalar;\nexports.YAMLMap = YAMLMap.YAMLMap;\nexports.YAMLSeq = YAMLSeq.YAMLSeq;\nexports.CST = cst;\nexports.Lexer = lexer.Lexer;\nexports.LineCounter = lineCounter.LineCounter;\nexports.Parser = parser.Parser;\nexports.parse = publicApi.parse;\nexports.parseAllDocuments = publicApi.parseAllDocuments;\nexports.parseDocument = publicApi.parseDocument;\nexports.stringify = publicApi.stringify;\nexports.visit = visit.visit;\nexports.visitAsync = visit.visitAsync;\n","import * as fs from 'node:fs/promises'\nimport * as os from 'node:os'\nimport * as path from 'node:path'\nimport { estimateTokenCount, sliceByTokens } from 'tokenx'\nimport { parse as yamlParse, stringify as yamlStringify } from 'yaml'\nimport { z } from 'zod'\n\nimport * as Completions from './Completions.js'\nimport type { FieldError } from './Errors.js'\nimport { IncurError, ParseError, ValidationError } from './Errors.js'\nimport * as Fetch from './Fetch.js'\nimport * as Filter from './Filter.js'\nimport * as Formatter from './Formatter.js'\nimport * as Help from './Help.js'\nimport {\n builtinCommands,\n type CommandMeta,\n findBuiltin,\n findBuiltinSubcommand,\n type Shell,\n shells,\n} from './internal/command.js'\nimport * as Command from './internal/command.js'\nimport { isRecord, suggest, toKebab } from './internal/helpers.js'\nimport { detectRunner } from './internal/pm.js'\nimport type { OneOf } from './internal/types.js'\nimport * as Mcp from './Mcp.js'\nimport type { Context as MiddlewareContext, Handler as MiddlewareHandler } from './middleware.js'\nimport * as Openapi from './Openapi.js'\nexport type { MiddlewareHandler }\nimport * as Parser from './Parser.js'\nimport type { Register } from './Register.js'\nimport * as Schema from './Schema.js'\nimport * as Skill from './Skill.js'\nimport * as SyncMcp from './SyncMcp.js'\nimport * as SyncSkills from './SyncSkills.js'\n\n/** A CLI application instance. Also used as a command group when mounted on a parent CLI. */\nexport type Cli<\n commands extends CommandsMap = {},\n vars extends z.ZodObject<any> | undefined = undefined,\n env extends z.ZodObject<any> | undefined = undefined,\n> = {\n /** Registers a root command or mounts a sub-CLI as a command group. */\n command: {\n /** Registers a command. Returns the CLI instance for chaining. */\n <\n const name extends string,\n const args extends z.ZodObject<any> | undefined = undefined,\n const cmdEnv extends z.ZodObject<any> | undefined = undefined,\n const options extends z.ZodObject<any> | undefined = undefined,\n const output extends z.ZodType | undefined = undefined,\n >(\n name: name,\n definition: CommandDefinition<args, cmdEnv, options, output, vars, env>,\n ): Cli<\n commands & { [key in name]: { args: InferOutput<args>; options: InferOutput<options> } },\n vars,\n env\n >\n /** Mounts a sub-CLI as a command group. */\n <const name extends string, const sub extends CommandsMap>(\n cli: Cli<sub, any, any> & { name: name },\n ): Cli<commands & { [key in keyof sub & string as `${name} ${key}`]: sub[key] }, vars, env>\n /** Mounts a root CLI as a single command. */\n <\n const name extends string,\n const args extends z.ZodObject<any> | undefined,\n const opts extends z.ZodObject<any> | undefined,\n >(\n cli: Root<args, opts> & { name: name },\n ): Cli<\n commands & { [key in name]: { args: InferOutput<args>; options: InferOutput<opts> } },\n vars,\n env\n >\n /** Mounts a fetch handler as a command, optionally with OpenAPI spec for typed subcommands. */\n <const name extends string>(\n name: name,\n definition: {\n basePath?: string | undefined\n description?: string | undefined\n fetch: FetchSource\n openapi?: Openapi.OpenAPISource | undefined\n openapiConfig?: Openapi.Config | undefined\n outputPolicy?: OutputPolicy | undefined\n },\n ): Cli<commands, vars, env>\n }\n /** A short description of the CLI. */\n description?: string | undefined\n /** The env schema, if declared. Use `typeof cli.env` with `middleware<vars, env>()` for typed middleware. */\n env: env\n /** The name of the CLI application. */\n name: string\n /** Handles an incoming HTTP request, resolves the matching command, and returns a JSON Response. */\n fetch(req: Request): Promise<Response>\n /** Parses argv, runs the matched command, and writes the output envelope to stdout. */\n serve(argv?: string[], options?: serve.Options): Promise<void>\n /** Registers middleware that runs around every command. */\n use(handler: MiddlewareHandler<vars, env>): Cli<commands, vars, env>\n /** The vars schema, if declared. Use `typeof cli.vars` with `middleware<vars, env>()` for typed middleware. */\n vars: vars\n}\n\n/** Root CLI — a single command with no subcommands. Carries phantom generics for mounting inference. */\nexport type Root<\n _args extends z.ZodObject<any> | undefined = undefined,\n _options extends z.ZodObject<any> | undefined = undefined,\n> = Omit<Cli, 'command'>\n\n/** Extracts the commands map from the registered type. */\nexport type Commands = Register extends { commands: infer commands extends CommandsMap }\n ? commands\n : {}\n\n/** Call to action. */\nexport type Cta<commands extends CommandsMap = Commands> =\n | ([keyof commands] extends [never] ? string : (keyof commands & string) | (string & {}))\n | ([keyof commands] extends [never]\n ? {\n /** Positional arguments appended as bare values. */\n args?: Record<string, unknown> | undefined\n /** The command name to run. */\n command: string\n /** A short description of what the command does. */\n description?: string | undefined\n /** Named options formatted as `--key value` flags. */\n options?: Record<string, unknown> | undefined\n }\n :\n | {\n [name in keyof commands & string]: {\n /** Positional arguments appended as bare values. */\n args?:\n | { [key in keyof commands[name]['args']]?: commands[name]['args'][key] | true }\n | undefined\n /** The command name to run. */\n command: name\n /** A short description of what the command does. */\n description?: string | undefined\n /** Named options formatted as `--key value` flags. */\n options?:\n | {\n [key in keyof commands[name]['options']]?:\n | commands[name]['options'][key]\n | true\n }\n | undefined\n }\n }[keyof commands & string]\n | {\n /** The command name to run. */\n command: string & {}\n /** A short description of what the command does. */\n description?: string | undefined\n })\n\n/** Creates a CLI with a root handler. Can still register subcommands which take precedence. */\nexport function create<\n const args extends z.ZodObject<any> | undefined = undefined,\n const env extends z.ZodObject<any> | undefined = undefined,\n const opts extends z.ZodObject<any> | undefined = undefined,\n const output extends z.ZodType | undefined = undefined,\n const vars extends z.ZodObject<any> | undefined = undefined,\n>(\n name: string,\n definition: create.Options<args, env, opts, output, vars> & { run: Function },\n): Cli<{ [key in typeof name]: { args: InferOutput<args>; options: InferOutput<opts> } }, vars, env>\n/** Creates a router CLI that registers subcommands. */\nexport function create<\n const args extends z.ZodObject<any> | undefined = undefined,\n const env extends z.ZodObject<any> | undefined = undefined,\n const opts extends z.ZodObject<any> | undefined = undefined,\n const output extends z.ZodType | undefined = undefined,\n const vars extends z.ZodObject<any> | undefined = undefined,\n>(name: string, definition?: create.Options<args, env, opts, output, vars>): Cli<{}, vars, env>\n/** Creates a CLI with a root handler from a single options object. Can still register subcommands. */\nexport function create<\n const args extends z.ZodObject<any> | undefined = undefined,\n const env extends z.ZodObject<any> | undefined = undefined,\n const opts extends z.ZodObject<any> | undefined = undefined,\n const output extends z.ZodType | undefined = undefined,\n const vars extends z.ZodObject<any> | undefined = undefined,\n>(\n definition: create.Options<args, env, opts, output, vars> & { name: string; run: Function },\n): Cli<\n {\n [key in (typeof definition)['name']]: { args: InferOutput<args>; options: InferOutput<opts> }\n },\n vars,\n env\n>\n/** Creates a router CLI from a single options object (e.g. package.json). */\nexport function create<\n const args extends z.ZodObject<any> | undefined = undefined,\n const env extends z.ZodObject<any> | undefined = undefined,\n const opts extends z.ZodObject<any> | undefined = undefined,\n const output extends z.ZodType | undefined = undefined,\n const vars extends z.ZodObject<any> | undefined = undefined,\n>(definition: create.Options<args, env, opts, output, vars> & { name: string }): Cli<{}, vars, env>\nexport function create(\n nameOrDefinition: string | (any & { name: string }),\n definition?: any,\n): Cli | Root {\n const name = typeof nameOrDefinition === 'string' ? nameOrDefinition : nameOrDefinition.name\n const def = typeof nameOrDefinition === 'string' ? (definition ?? {}) : nameOrDefinition\n const rootDef = 'run' in def ? (def as CommandDefinition<any, any, any>) : undefined\n const rootFetchSource =\n 'fetch' in def && def.fetch !== undefined ? (def.fetch as FetchSource) : undefined\n const rootFetch = rootFetchSource === undefined ? undefined : resolveFetch(rootFetchSource)\n const rootFetchBaseUrl = rootFetchSource === undefined ? undefined : fetchBaseUrl(rootFetchSource)\n\n const commands = new Map<string, CommandEntry>()\n const middlewares: MiddlewareHandler[] = []\n const pending: Promise<void>[] = []\n const mcpHandler = createMcpHttpHandler(name, def.version ?? '0.0.0')\n\n if (def.openapi && rootFetch) {\n pending.push(\n (async () => {\n const spec = await Openapi.resolve(def.openapi, { baseUrl: rootFetchBaseUrl })\n const generated = await Openapi.generateCommands(spec, rootFetch, {\n config: def.openapiConfig,\n })\n for (const [name, command] of generated) commands.set(name, command)\n })(),\n )\n }\n\n const cli: Cli = {\n name,\n description: def.description,\n env: def.env,\n vars: def.vars,\n\n command(nameOrCli: any, def?: any): any {\n if (typeof nameOrCli === 'string') {\n if (def && 'fetch' in def && isFetchSource(def.fetch)) {\n const fetch = resolveFetch(def.fetch)\n // OpenAPI + fetch → generate typed command group (async, resolved before serve)\n if (def.openapi) {\n pending.push(\n (async () => {\n const spec = await Openapi.resolve(def.openapi, {\n baseUrl: fetchBaseUrl(def.fetch),\n })\n const generated = await Openapi.generateCommands(spec, fetch, {\n basePath: def.basePath,\n config: def.openapiConfig,\n })\n commands.set(nameOrCli, {\n _group: true,\n description: def.description,\n commands: generated as Map<string, CommandEntry>,\n ...(def.outputPolicy ? { outputPolicy: def.outputPolicy } : undefined),\n } as InternalGroup)\n })(),\n )\n return cli\n }\n commands.set(nameOrCli, {\n _fetch: true,\n basePath: def.basePath,\n description: def.description,\n fetch,\n ...(def.outputPolicy ? { outputPolicy: def.outputPolicy } : undefined),\n } as InternalFetchGateway)\n return cli\n }\n commands.set(nameOrCli, def)\n if (def.aliases)\n for (const a of def.aliases) commands.set(a, { _alias: true, target: nameOrCli })\n return cli\n }\n const mountedRootDef = toRootDefinition.get(nameOrCli)\n if (mountedRootDef) {\n commands.set(nameOrCli.name, mountedRootDef)\n const rootAliases = toRootAliases.get(nameOrCli)\n if (rootAliases)\n for (const a of rootAliases) commands.set(a, { _alias: true, target: nameOrCli.name })\n return cli\n }\n const sub = nameOrCli as Cli\n const subCommands = toCommands.get(sub)!\n const subOutputPolicy = toOutputPolicy.get(sub)\n const subMiddlewares = toMiddlewares.get(sub)\n commands.set(sub.name, {\n _group: true,\n description: sub.description,\n commands: subCommands,\n ...(subOutputPolicy ? { outputPolicy: subOutputPolicy } : undefined),\n ...(subMiddlewares?.length ? { middlewares: subMiddlewares } : undefined),\n })\n return cli\n },\n\n async fetch(req: Request) {\n if (pending.length > 0) await Promise.all(pending)\n return fetchImpl(name, commands, req, {\n description: def.description,\n envSchema: def.env,\n mcpHandler,\n middlewares,\n name,\n rootCommand: rootDef,\n vars: def.vars,\n version: def.version,\n })\n },\n\n async serve(argv = process.argv.slice(2), serveOptions: serve.Options = {}) {\n if (pending.length > 0) await Promise.all(pending)\n return serveImpl(name, commands, argv, {\n ...serveOptions,\n aliases: def.aliases,\n config: def.config,\n description: def.description,\n envSchema: def.env,\n format: def.format,\n mcp: def.mcp,\n middlewares,\n outputPolicy: def.outputPolicy,\n renderer: def.renderer,\n rootCommand: rootDef,\n rootFetch,\n sync: def.sync,\n vars: def.vars,\n version: def.version,\n })\n },\n\n use(handler: MiddlewareHandler): any {\n middlewares.push(handler)\n return cli\n },\n }\n\n if (rootDef) toRootDefinition.set(cli as unknown as Root, rootDef)\n if (rootDef && def.aliases) toRootAliases.set(cli as unknown as Root, def.aliases)\n if (def.options) toRootOptions.set(cli, def.options)\n if (def.config !== undefined) toConfigEnabled.set(cli, true)\n if (def.outputPolicy) toOutputPolicy.set(cli, def.outputPolicy)\n toMiddlewares.set(cli, middlewares)\n toCommands.set(cli, commands)\n return cli\n}\n\nexport declare namespace create {\n /** Options for creating a CLI. Provide `run` for a leaf CLI, omit it for a router. */\n type Options<\n args extends z.ZodObject<any> | undefined = undefined,\n env extends z.ZodObject<any> | undefined = undefined,\n options extends z.ZodObject<any> | undefined = undefined,\n output extends z.ZodType | undefined = undefined,\n vars extends z.ZodObject<any> | undefined = undefined,\n > = {\n /** Map of option names to single-char aliases. */\n alias?: options extends z.ZodObject<any>\n ? Partial<Record<keyof z.output<options>, string>>\n : Record<string, string> | undefined\n /** Alternative binary names for this CLI (e.g. shorter aliases in package.json `bin`). Shell completions are registered for all names. */\n aliases?: string[] | undefined\n /** Zod schema for positional arguments. */\n args?: args | undefined\n /** Enable config-file defaults for command options. */\n config?:\n | {\n /** Global flag name for specifying a config file path (e.g. `'config'` → `--config <path>`). Omit to auto-load only, with no CLI flag. */\n flag?: string | undefined\n /** Ordered list of file paths to search. First existing file wins. Supports `~` for home dir. Defaults to `['<cli>.json']` relative to cwd. */\n files?: string[] | undefined\n /** Custom config loader. Receives the resolved file path (or `undefined` if no file was found). Returns the parsed config tree, or `undefined` for no defaults. When omitted, the framework reads and parses JSON. */\n loader?:\n | ((\n path: string | undefined,\n ) =>\n | Record<string, unknown>\n | undefined\n | Promise<Record<string, unknown> | undefined>)\n | undefined\n }\n | undefined\n /** A short description of what the CLI does. */\n description?: string | undefined\n /** Zod schema for environment variables. Keys are the variable names (e.g. `NPM_TOKEN`). */\n env?: env | undefined\n /** Usage examples for this command. */\n examples?: Example<args, options>[] | undefined\n /** A fetch handler or hosted fetch source to use as the root command. All argv tokens are interpreted as path segments and curl-style flags. */\n fetch?: FetchSource | undefined\n /** OpenAPI spec source used to generate typed root commands for the root fetch handler. */\n openapi?: Openapi.OpenAPISource | undefined\n /** Configuration for generated OpenAPI commands. */\n openapiConfig?: Openapi.Config | undefined\n /** Default output format. Overridden by `--format` or `--json`. */\n format?: Formatter.Format | undefined\n /** Zod schema for named options/flags. */\n options?: options | undefined\n /** Zod schema for the return value. */\n output?: output | undefined\n /**\n * Controls when output data is displayed. Inherited by child commands when set on a group or root CLI.\n *\n * - `'all'` — displays to both humans and agents.\n * - `'agent-only'` — suppresses data output in human/TTY mode while still returning it to agents.\n *\n * @default 'all'\n */\n outputPolicy?: OutputPolicy | undefined\n /**\n * Custom renderer for human/TTY output mode.\n * Called with the raw output data when no explicit `--format` flag was passed.\n * Return a string to display it, or `null` to fall back to the default TOON formatter.\n * Has no effect in agent/piped mode or when `--format` is set explicitly.\n */\n renderer?: ((data: unknown) => string | null) | undefined\n /** Alternative usage patterns shown in help output. */\n usage?: Usage<args, options>[] | undefined\n /** Zod schema for middleware variables. Keys define variable names, schemas define types and defaults. */\n vars?: vars | undefined\n /** The root command handler. When provided, creates a leaf CLI with no subcommands. */\n run?:\n | ((context: {\n /** Whether the consumer is an agent (stdout is not a TTY). */\n agent: boolean\n /** Positional arguments. */\n args: InferOutput<args>\n /** The binary name the user invoked (e.g. an alias). Falls back to `name` when not resolvable. */\n displayName: string\n /** Parsed environment variables. */\n env: InferOutput<env>\n /** Return an error result with optional CTAs. */\n error: (options: {\n code: string\n cta?: CtaBlock | undefined\n exitCode?: number | undefined\n message: string\n retryable?: boolean | undefined\n }) => never\n /** The resolved output format (e.g. `'toon'`, `'json'`, `'jsonl'`). */\n format: Formatter.Format\n /** Whether the user explicitly passed `--format` or `--json`. */\n formatExplicit: boolean\n /** The CLI name. */\n name: string\n /** Return a success result with optional metadata (e.g. CTAs). */\n ok: (data: InferReturn<output>, meta?: { cta?: CtaBlock | undefined }) => never\n options: InferOutput<options>\n /** Variables set by middleware. */\n var: InferVars<vars>\n }) =>\n | InferReturn<output>\n | Promise<InferReturn<output>>\n | AsyncGenerator<InferReturn<output>, unknown, unknown>)\n | undefined\n /** Options for the built-in `mcp add` command. */\n mcp?:\n | {\n /** Target specific agents by default (e.g. `['claude-code', 'cursor']`). */\n agents?: string[] | undefined\n /** Override the command agents will run to start the MCP server. Auto-detected if omitted. */\n command?: string | undefined\n }\n | undefined\n /** Options for the built-in `skills add` command. */\n sync?:\n | {\n /** Working directory for resolving `include` globs. Pass `import.meta.dirname` when running from a bin entry. Defaults to `process.cwd()`. */\n cwd?: string | undefined\n /** Default grouping depth for skill files. Overridden by `--depth`. Defaults to `1`. */\n depth?: number | undefined\n /** Glob patterns for directories containing SKILL.md files to include (e.g. `\"skills/*\"`, `\"my-skill\"`). */\n include?: string[] | undefined\n /** Example prompts shown after sync to help users get started. */\n suggestions?: string[] | undefined\n }\n | undefined\n /** The CLI version string. */\n version?: string | undefined\n }\n}\n\nexport declare namespace serve {\n /** Options for `serve()`, primarily used for testing. */\n type Options = {\n /** Override environment variable source. Defaults to `process.env`. */\n env?: Record<string, string | undefined> | undefined\n /** Override exit handler. Defaults to `process.exit`. */\n exit?: ((code: number) => void) | undefined\n /** Override stdout writer. Defaults to `process.stdout.write`. */\n stdout?: ((s: string) => void) | undefined\n }\n}\n\n/** @internal Shared serve implementation for both router and leaf CLIs. */\n// biome-ignore lint/correctness/noUnusedVariables: _\nasync function serveImpl(\n name: string,\n commands: Map<string, CommandEntry>,\n argv: string[],\n options: serveImpl.Options = {},\n) {\n const stdout = options.stdout ?? ((s: string) => process.stdout.write(s))\n const exit = options.exit ?? ((code: number) => process.exit(code))\n const human = process.stdout.isTTY === true\n const configEnabled = options.config !== undefined\n const configFlag = options.config?.flag\n const displayName = resolveDisplayName(name, options.aliases)\n\n function writeln(s: string) {\n stdout(s.endsWith('\\n') ? s : `${s}\\n`)\n }\n\n let builtinFlags: ReturnType<typeof extractBuiltinFlags>\n try {\n builtinFlags = extractBuiltinFlags(argv, { configFlag })\n } catch (error) {\n const message = error instanceof Error ? error.message : String(error)\n if (human) writeln(formatHumanError({ code: 'UNKNOWN', message }))\n else writeln(Formatter.format({ code: 'UNKNOWN', message }, 'toon'))\n exit(1)\n return\n }\n\n const {\n fullOutput,\n format: formatFlag,\n formatExplicit,\n filterOutput,\n tokenLimit,\n tokenOffset,\n tokenCount,\n llms,\n llmsFull,\n mcp: mcpFlag,\n help,\n version,\n schema,\n configPath,\n configDisabled,\n rest: filtered,\n } = builtinFlags\n\n // --mcp: start as MCP stdio server\n if (mcpFlag) {\n await Mcp.serve(name, options.version ?? '0.0.0', commands, {\n middlewares: options.middlewares,\n env: options.envSchema,\n vars: options.vars,\n version: options.version,\n })\n return\n }\n\n // COMPLETE: dynamic shell completions (called by shell hook at tab-press)\n const completeShell = process.env.COMPLETE as Shell | undefined\n if (completeShell) {\n // Remove separator `--` from argv\n const sepIdx = argv.indexOf('--')\n const words = sepIdx !== -1 ? argv.slice(sepIdx + 1) : argv\n if (words.length === 0) {\n // Registration mode: print shell hook script for primary name + aliases\n const names = [name, ...(options.aliases ?? [])]\n stdout(names.map((n) => Completions.register(completeShell, n)).join('\\n'))\n } else {\n const index = Number(process.env._COMPLETE_INDEX ?? words.length - 1)\n const candidates = Completions.complete(commands, options.rootCommand, words, index)\n // Add built-in commands (completions, mcp, skills) to completions\n const current = words[index] ?? ''\n const nonFlags = words.slice(0, index).filter((w) => !w.startsWith('-'))\n if (nonFlags.length <= 1) {\n for (const b of builtinCommands) {\n if (b.name.startsWith(current) && !candidates.some((c) => c.value === b.name))\n candidates.push({\n value: b.name,\n description: b.description,\n ...(b.subcommands ? { noSpace: true } : undefined),\n })\n }\n } else if (nonFlags.length === 2) {\n const parent = nonFlags[nonFlags.length - 1]!\n const builtin = findBuiltin(parent)\n if (builtin?.subcommands)\n for (const sub of builtin.subcommands)\n for (const value of [sub.name, ...(sub.aliases ?? [])])\n if (value.startsWith(current) && !candidates.some((c) => c.value === value))\n candidates.push({ value, description: sub.description })\n }\n const out = Completions.format(completeShell, candidates)\n if (out) stdout(out)\n }\n return\n }\n\n // Skills staleness check (skip for built-in commands)\n let skillsCta: FormattedCtaBlock | undefined\n if (!llms && !llmsFull && !schema && !help && !version) {\n const isSkillsAdd = builtinIdx(filtered, name, 'skills') !== -1\n const isMcpAdd = builtinIdx(filtered, name, 'mcp') !== -1\n if (!isSkillsAdd && !isMcpAdd) {\n const stored = SyncSkills.readHash(name)\n if (stored && SyncSkills.hasInstalledSkills(name, { cwd: options.sync?.cwd })) {\n const groups = new Map<string, string>()\n const entries = collectSkillCommands(commands, [], groups, options.rootCommand)\n if (Skill.hash(entries) !== stored) {\n const command =\n process.env.npm_config_user_agent || process.env.npm_execpath\n ? `${detectRunner()} ${SyncMcp.detectPackageSpecifier(name)} skills add`\n : `${displayName} skills add`\n skillsCta = {\n description: 'Skills are out of date:',\n commands: [{ command, description: 'sync outdated skills' }],\n }\n }\n }\n }\n }\n\n if (llms || llmsFull) {\n // Scope to a subtree if command tokens are provided\n let scopedCommands = commands\n const prefix: string[] = []\n let scopedDescription: string | undefined = options.description\n for (const token of filtered) {\n const rawEntry = scopedCommands.get(token)\n if (!rawEntry) break\n const entry = resolveAlias(scopedCommands, rawEntry)\n if (isGroup(entry)) {\n scopedCommands = entry.commands\n scopedDescription = entry.description\n prefix.push(token)\n } else {\n // Leaf command — scope to just this command\n scopedCommands = new Map([[token, entry]])\n break\n }\n }\n\n const scopedRoot = prefix.length === 0 ? options.rootCommand : undefined\n\n if (llmsFull) {\n if (!formatExplicit || formatFlag === 'md') {\n const groups = new Map<string, string>()\n const cmds = collectSkillCommands(scopedCommands, prefix, groups, scopedRoot)\n const scopedName = prefix.length > 0 ? `${name} ${prefix.join(' ')}` : name\n writeln(Skill.generate(scopedName, cmds, groups))\n return\n }\n writeln(Formatter.format(buildManifest(scopedCommands, prefix), formatFlag))\n return\n }\n\n if (!formatExplicit || formatFlag === 'md') {\n const groups = new Map<string, string>()\n const cmds = collectSkillCommands(scopedCommands, prefix, groups, scopedRoot)\n const scopedName = prefix.length > 0 ? `${name} ${prefix.join(' ')}` : name\n writeln(Skill.index(scopedName, cmds, scopedDescription))\n return\n }\n writeln(Formatter.format(buildIndexManifest(scopedCommands, prefix), formatFlag))\n return\n }\n\n // completions <shell>: print shell hook script to stdout\n const completionsIdx = builtinIdx(filtered, name, 'completions')\n if (completionsIdx !== -1) {\n const shell = filtered[completionsIdx + 1]\n if (help || !shell) {\n const b = findBuiltin('completions')!\n writeln(\n Help.formatCommand(`${name} completions`, {\n args: b.args,\n description: b.description,\n hideGlobalOptions: true,\n hint: b.hint?.(name),\n }),\n )\n return\n }\n if (!shells.includes(shell as any)) {\n writeln(\n formatHumanError({\n code: 'INVALID_SHELL',\n message: `Unknown shell '${shell}'. Supported: ${shells.join(', ')}`,\n }),\n )\n exit(1)\n return\n }\n const names = [name, ...(options.aliases ?? [])]\n writeln(names.map((n) => Completions.register(shell as Shell, n)).join('\\n'))\n return\n }\n\n // skills add: generate skill files and install via `<pm>x skills add` (only when sync is configured)\n const skillsIdx = builtinIdx(filtered, name, 'skills')\n if (skillsIdx !== -1) {\n const builtin = findBuiltin('skills')!\n const skillsSub = filtered[skillsIdx + 1]\n const sub = skillsSub ? findBuiltinSubcommand(builtin, skillsSub) : undefined\n if (skillsSub && !sub) {\n const candidates =\n builtin.subcommands?.flatMap((sub) => [sub.name, ...(sub.aliases ?? [])]) ?? []\n const suggestion = suggest(skillsSub, candidates)\n const didYouMean = suggestion ? ` Did you mean '${suggestion}'?` : ''\n const message = `'${skillsSub}' is not a command for '${name} skills'.${didYouMean}`\n const ctaCommands: FormattedCta[] = []\n if (suggestion) {\n const corrected = argv.map((t) => (t === skillsSub ? suggestion : t))\n ctaCommands.push({ command: `${name} ${corrected.join(' ')}` })\n }\n ctaCommands.push({\n command: `${name} skills --help`,\n description: 'see all available commands',\n })\n const cta: FormattedCtaBlock = {\n description: ctaCommands.length === 1 ? 'Suggested command:' : 'Suggested commands:',\n commands: ctaCommands,\n }\n if (human) {\n writeln(formatHumanError({ code: 'COMMAND_NOT_FOUND', message }))\n writeln(formatHumanCta(cta))\n } else writeln(Formatter.format({ code: 'COMMAND_NOT_FOUND', message, cta }, 'toon'))\n exit(1)\n return\n }\n if (!skillsSub) {\n writeln(formatBuiltinHelp(name, builtin))\n return\n }\n if (sub?.name === 'list') {\n if (help) {\n writeln(formatBuiltinSubcommandHelp(name, builtin, 'list'))\n return\n }\n try {\n const result = await SyncSkills.list(name, commands, {\n cwd: options.sync?.cwd,\n depth: options.sync?.depth ?? 1,\n description: options.description,\n include: options.sync?.include,\n rootCommand: options.rootCommand,\n })\n if (result.length === 0) {\n writeln('No skills found.')\n return\n }\n const lines: string[] = []\n const maxLen = Math.max(...result.map((s) => s.name.length))\n for (const s of result) {\n const icon = s.installed ? '✓' : '✗'\n const padding = s.description\n ? `${' '.repeat(maxLen - s.name.length)} ${s.description}`\n : ''\n lines.push(` ${icon} ${s.name}${padding}`)\n }\n const installedCount = result.filter((s) => s.installed).length\n lines.push('')\n lines.push(\n `${result.length} skill${result.length === 1 ? '' : 's'} (${installedCount} installed)`,\n )\n writeln(lines.join('\\n'))\n } catch (err) {\n writeln(\n Formatter.format(\n {\n code: 'LIST_SKILLS_FAILED',\n message: err instanceof Error ? err.message : String(err),\n },\n formatExplicit ? formatFlag : 'toon',\n ),\n )\n exit(1)\n }\n return\n }\n if (help) {\n writeln(formatBuiltinSubcommandHelp(name, builtin, 'add'))\n return\n }\n const rest = filtered.slice(skillsIdx + 2)\n const depthArg = rest.indexOf('--depth')\n const depthEq = rest.find((t) => t.startsWith('--depth='))\n const depth =\n depthArg !== -1\n ? Number(rest[depthArg + 1])\n : depthEq\n ? Number(depthEq.split('=')[1])\n : (options.sync?.depth ?? 1)\n const global = rest.includes('--no-global') ? false : undefined\n try {\n stdout('Syncing...')\n const result = await SyncSkills.sync(name, commands, {\n cwd: options.sync?.cwd,\n depth,\n description: options.description,\n global,\n include: options.sync?.include,\n rootCommand: options.rootCommand,\n })\n stdout('\\r\\x1b[K')\n const lines: string[] = []\n const skillLabel = (s: (typeof result.skills)[number]) => s.name\n const maxLen = Math.max(...result.skills.map((s) => skillLabel(s).length))\n for (const s of result.skills) {\n const label = skillLabel(s)\n const padding = s.description\n ? `${' '.repeat(maxLen - label.length)} ${s.description}`\n : ''\n lines.push(` ✓ ${label}${padding}`)\n }\n lines.push('')\n lines.push(`${result.skills.length} skill${result.skills.length === 1 ? '' : 's'} synced`)\n const suggestions = options.sync?.suggestions\n if (suggestions && suggestions.length > 0) {\n lines.push('')\n lines.push(`Your agent can now use ${name}. Try asking:`)\n for (const s of suggestions) lines.push(` \"${s}\"`)\n }\n lines.push('')\n lines.push(`Run \\`${name} --help\\` to see the full command reference.`)\n writeln(lines.join('\\n'))\n if (fullOutput || formatExplicit) {\n const output: Record<string, unknown> = { skills: result.paths }\n if (fullOutput && result.agents.length > 0) output.agents = result.agents\n writeln(Formatter.format(output, formatExplicit ? formatFlag : 'toon'))\n }\n } catch (err) {\n writeln(\n Formatter.format(\n { code: 'SYNC_SKILLS_FAILED', message: err instanceof Error ? err.message : String(err) },\n formatExplicit ? formatFlag : 'toon',\n ),\n )\n exit(1)\n }\n return\n }\n\n // mcp add: register CLI as MCP server via `npx add-mcp`\n const mcpIdx = builtinIdx(filtered, name, 'mcp')\n if (mcpIdx !== -1) {\n const mcpSub = filtered[mcpIdx + 1]\n if (mcpSub && mcpSub !== 'add') {\n const suggestion = suggest(mcpSub, ['add'])\n const didYouMean = suggestion ? ` Did you mean '${suggestion}'?` : ''\n const message = `'${mcpSub}' is not a command for '${name} mcp'.${didYouMean}`\n const ctaCommands: FormattedCta[] = []\n if (suggestion) {\n const corrected = argv.map((t) => (t === mcpSub ? suggestion : t))\n ctaCommands.push({ command: `${name} ${corrected.join(' ')}` })\n }\n ctaCommands.push({ command: `${name} mcp --help`, description: 'see all available commands' })\n const cta: FormattedCtaBlock = {\n description: ctaCommands.length === 1 ? 'Suggested command:' : 'Suggested commands:',\n commands: ctaCommands,\n }\n if (human) {\n writeln(formatHumanError({ code: 'COMMAND_NOT_FOUND', message }))\n writeln(formatHumanCta(cta))\n } else writeln(Formatter.format({ code: 'COMMAND_NOT_FOUND', message, cta }, 'toon'))\n exit(1)\n return\n }\n if (!mcpSub) {\n const b = findBuiltin('mcp')!\n writeln(formatBuiltinHelp(name, b))\n return\n }\n if (help) {\n const b = findBuiltin('mcp')!\n writeln(formatBuiltinSubcommandHelp(name, b, 'add'))\n return\n }\n const rest = filtered.slice(mcpIdx + 2)\n const global = rest.includes('--no-global') ? false : true\n\n // Parse --command / -c and --agent flags from argv\n let command = options.mcp?.command\n const agents: string[] = [...(options.mcp?.agents ?? [])]\n for (let i = 0; i < rest.length; i++) {\n if ((rest[i] === '--command' || rest[i] === '-c') && rest[i + 1]) command = rest[++i]!\n else if (rest[i] === '--agent' && rest[i + 1]) agents.push(rest[++i]!)\n }\n\n try {\n stdout('Registering MCP server...')\n const result = await SyncMcp.register(name, {\n command,\n global,\n agents,\n })\n stdout('\\r\\x1b[K')\n const lines: string[] = []\n lines.push(`✓ Registered ${name} as MCP server`)\n if (result.agents.length > 0) lines.push(` Agents: ${result.agents.join(', ')}`)\n lines.push('')\n lines.push(`Agents can now use ${name} tools.`)\n const suggestions = options.sync?.suggestions\n if (suggestions && suggestions.length > 0) {\n lines.push('')\n lines.push('Try asking:')\n for (const s of suggestions) lines.push(` \"${s}\"`)\n }\n writeln(lines.join('\\n'))\n if (fullOutput || formatExplicit)\n writeln(\n Formatter.format(\n { name, command: result.command, agents: result.agents },\n formatExplicit ? formatFlag : 'toon',\n ),\n )\n } catch (err) {\n writeln(\n Formatter.format(\n { code: 'MCP_ADD_FAILED', message: err instanceof Error ? err.message : String(err) },\n formatExplicit ? formatFlag : 'toon',\n ),\n )\n exit(1)\n }\n return\n }\n\n // --help takes precedence over --version\n if (version && !help && options.version) {\n writeln(options.version)\n return\n }\n\n if (filtered.length === 0) {\n if (\n options.rootCommand &&\n human &&\n options.rootCommand.args &&\n hasRequiredArgs(options.rootCommand.args)\n ) {\n // Root command with args but none provided (human mode) — show help\n const cmd = options.rootCommand\n writeln(\n Help.formatCommand(name, {\n alias: cmd.alias as Record<string, string> | undefined,\n aliases: options.aliases,\n configFlag,\n description: cmd.description ?? options.description,\n version: options.version,\n args: cmd.args,\n env: cmd.env,\n envSource: options.env,\n hint: cmd.hint,\n options: cmd.options,\n examples: formatExamples(cmd.examples),\n usage: cmd.usage,\n commands: commands.size > 0 ? collectHelpCommands(commands) : undefined,\n root: true,\n }),\n )\n return\n }\n if (options.rootCommand || options.rootFetch) {\n // Root command/fetch with no args — treat as root invocation\n } else {\n writeln(\n Help.formatRoot(name, {\n aliases: options.aliases,\n configFlag,\n description: options.description,\n version: options.version,\n commands: collectHelpCommands(commands),\n root: true,\n }),\n )\n return\n }\n }\n\n const resolved =\n filtered.length === 0 && options.rootCommand\n ? { command: options.rootCommand, path: name, rest: [] as string[] }\n : filtered.length === 0 && options.rootFetch\n ? {\n fetchGateway: {\n _fetch: true as const,\n fetch: options.rootFetch,\n description: options.description,\n },\n middlewares: [] as MiddlewareHandler[],\n path: name,\n rest: [] as string[],\n }\n : resolveCommand(commands, filtered)\n\n // --help on a fetch gateway → show fetch-specific help\n if (help && 'fetchGateway' in resolved) {\n const commandName = resolved.path === name ? name : `${name} ${resolved.path}`\n if (resolved.path === name && commands.size > 0)\n writeln(\n Help.formatRoot(name, {\n aliases: options.aliases,\n configFlag,\n description: options.description,\n version: options.version,\n commands: collectHelpCommands(commands),\n root: true,\n }),\n )\n else writeln(formatFetchHelp(commandName, resolved.fetchGateway.description))\n return\n }\n\n // --help after a command → show help for that command\n if (help) {\n if ('help' in resolved || 'error' in resolved) {\n // group or unknown → show root help for that path\n const helpName = 'help' in resolved ? `${name} ${resolved.path}` : name\n const helpDesc = 'help' in resolved ? resolved.description : options.description\n const helpCmds = 'help' in resolved ? resolved.commands : commands\n const isRoot = helpName === name\n // Root with both a handler and subcommands → show command help with subcommands\n if (isRoot && options.rootCommand && helpCmds.size > 0) {\n const cmd = options.rootCommand\n writeln(\n Help.formatCommand(name, {\n alias: cmd.alias as Record<string, string> | undefined,\n aliases: options.aliases,\n configFlag,\n description: cmd.description ?? options.description,\n version: options.version,\n args: cmd.args,\n env: cmd.env,\n envSource: options.env,\n hint: cmd.hint,\n options: cmd.options,\n examples: formatExamples(cmd.examples),\n usage: cmd.usage,\n commands: collectHelpCommands(helpCmds),\n root: true,\n }),\n )\n } else {\n writeln(\n Help.formatRoot(helpName, {\n aliases: isRoot ? options.aliases : undefined,\n configFlag,\n description: helpDesc,\n version: isRoot ? options.version : undefined,\n commands: collectHelpCommands(helpCmds),\n root: isRoot,\n }),\n )\n }\n } else if ('command' in resolved) {\n const cmd = resolved.command\n const isRootCmd = resolved.path === name\n const commandName = isRootCmd ? name : `${name} ${resolved.path}`\n const helpSubcommands =\n isRootCmd && options.rootCommand && commands.size > 0\n ? collectHelpCommands(commands)\n : undefined\n writeln(\n Help.formatCommand(commandName, {\n alias: cmd.alias as Record<string, string> | undefined,\n aliases: isRootCmd ? options.aliases : cmd.aliases,\n configFlag,\n description: cmd.description,\n version: isRootCmd ? options.version : undefined,\n args: cmd.args,\n env: cmd.env,\n envSource: options.env,\n hint: cmd.hint,\n options: cmd.options,\n examples: formatExamples(cmd.examples),\n usage: cmd.usage,\n commands: helpSubcommands,\n root: isRootCmd,\n }),\n )\n }\n return\n }\n\n // --schema: output JSON Schema for a command's args, env, options, output\n if (schema) {\n if ('help' in resolved) {\n writeln(\n Help.formatRoot(`${name} ${resolved.path}`, {\n configFlag,\n description: resolved.description,\n commands: collectHelpCommands(resolved.commands),\n }),\n )\n return\n }\n if ('error' in resolved) {\n const parent = resolved.path ? `${name} ${resolved.path}` : name\n const suggestion = suggest(resolved.error, resolved.commands.keys())\n const didYouMean = suggestion ? ` Did you mean '${suggestion}'?` : ''\n writeln(`Error: '${resolved.error}' is not a command for '${parent}'.${didYouMean}`)\n exit(1)\n return\n }\n if ('fetchGateway' in resolved) {\n writeln('--schema is not supported for fetch commands.')\n exit(1)\n return\n }\n const cmd = resolved.command\n const format = formatExplicit ? formatFlag : 'toon'\n const result: Record<string, unknown> = {}\n if (cmd.args) result.args = Schema.toJsonSchema(cmd.args)\n if (cmd.env) result.env = Schema.toJsonSchema(cmd.env)\n if (cmd.options) result.options = Schema.toJsonSchema(cmd.options)\n if (cmd.output) result.output = Schema.toJsonSchema(cmd.output)\n writeln(Formatter.format(result, format))\n return\n }\n\n if ('help' in resolved) {\n writeln(\n Help.formatRoot(`${name} ${resolved.path}`, {\n configFlag,\n description: resolved.description,\n commands: collectHelpCommands(resolved.commands),\n }),\n )\n return\n }\n\n const start = performance.now()\n\n // Resolve effective format: explicit --format/--json → command default → CLI default → toon\n const resolvedFormat = 'command' in resolved && (resolved as any).command.format\n const format = formatExplicit ? formatFlag : resolvedFormat || options.format || 'toon'\n\n // Fall back to root fetch/command when no subcommand matches,\n // but only if the token doesn't look like a typo of a known command.\n const rootFallbackBlocked =\n 'error' in resolved &&\n !resolved.path &&\n (() => {\n const candidates = [...resolved.commands.keys()]\n for (const b of builtinCommands) candidates.push(b.name)\n return suggest(resolved.error, candidates) !== undefined\n })()\n const effective =\n 'error' in resolved && options.rootFetch && !resolved.path && !rootFallbackBlocked\n ? {\n fetchGateway: {\n _fetch: true as const,\n fetch: options.rootFetch,\n description: options.description,\n },\n middlewares: [] as MiddlewareHandler[],\n path: name,\n rest: filtered,\n }\n : 'error' in resolved && options.rootCommand && !resolved.path && !rootFallbackBlocked\n ? { command: options.rootCommand, path: name, rest: filtered }\n : resolved\n\n // Resolve outputPolicy: command/group → CLI-level → default ('all')\n const effectiveOutputPolicy =\n ('outputPolicy' in resolved && resolved.outputPolicy) || options.outputPolicy\n const renderOutput = !(human && !formatExplicit && effectiveOutputPolicy === 'agent-only')\n\n const filterPaths = filterOutput ? Filter.parse(filterOutput) : undefined\n\n function truncate(s: string): {\n text: string\n truncated: boolean\n nextOffset?: number | undefined\n } {\n if (tokenLimit == null && tokenOffset == null) return { text: s, truncated: false }\n const total = estimateTokenCount(s)\n const offset = tokenOffset ?? 0\n const end = tokenLimit != null ? offset + tokenLimit : total\n if (offset === 0 && end >= total) return { text: s, truncated: false }\n const sliced = sliceByTokens(s, offset, end)\n const actualEnd = Math.min(end, total)\n const nextOffset = actualEnd < total ? actualEnd : undefined\n return {\n text: `${sliced}\\n[truncated: showing tokens ${offset}–${actualEnd} of ${total}]`,\n truncated: true,\n nextOffset,\n }\n }\n\n function write(output: Output) {\n if (filterPaths && output.ok && output.data != null)\n output = { ...output, data: Filter.apply(output.data, filterPaths) }\n if (skillsCta) {\n const existing = output.meta.cta\n output = {\n ...output,\n meta: {\n ...output.meta,\n cta: existing\n ? {\n description: existing.description,\n commands: [...existing.commands, ...skillsCta.commands],\n }\n : skillsCta,\n },\n }\n }\n if (tokenCount) {\n const base = output.ok ? output.data : output.error\n const formatted = base != null ? Formatter.format(base, format) : ''\n return writeln(String(estimateTokenCount(formatted)))\n }\n const cta = output.meta.cta\n // Human/TTY mode: write readable output directly, skip the structured envelope.\n if (human && !fullOutput) {\n if (output.ok && output.data != null && renderOutput) {\n // Give the CLI's custom renderer first crack; fall back to the default formatter.\n const custom =\n !formatExplicit && options.renderer != null\n ? options.renderer(output.data)\n : null\n const rendered = custom ?? Formatter.format(output.data, format)\n const t = truncate(rendered)\n writeln(t.text)\n } else if (!output.ok) writeln(formatHumanError(output.error))\n // Always show the call-to-action if present, regardless of output policy.\n if (cta) writeln(formatHumanCta(cta))\n return\n }\n if (fullOutput) {\n if (tokenLimit != null || tokenOffset != null) {\n // Truncate data separately so meta (including nextOffset) is always visible\n const dataFormatted =\n output.ok && output.data != null\n ? Formatter.format(output.data, format)\n : !output.ok\n ? Formatter.format(output.error, format)\n : ''\n const t = truncate(dataFormatted)\n if (t.truncated) {\n const envelope: Record<string, unknown> = output.ok\n ? { ok: true, data: t.text }\n : { ok: false, error: t.text }\n const meta: Record<string, unknown> = { ...output.meta }\n if (t.nextOffset != null) meta.nextOffset = t.nextOffset\n envelope.meta = meta\n return writeln(Formatter.format(envelope, format))\n }\n }\n return writeln(Formatter.format(output, format))\n }\n const base = output.ok ? output.data : output.error\n const formatted = Formatter.format(base, format)\n if (!cta) {\n if (formatted) writeln(truncate(formatted).text)\n return\n }\n const payload =\n typeof base === 'object' && base !== null ? { ...base, cta } : { data: base, cta }\n writeln(truncate(Formatter.format(payload, format)).text)\n }\n\n if ('error' in effective) {\n const helpCmd = effective.path ? `${name} ${effective.path} --help` : `${name} --help`\n const parent = effective.path ? `${name} ${effective.path}` : name\n const candidates = 'commands' in effective ? [...effective.commands.keys()] : []\n if (!effective.path) for (const b of builtinCommands) candidates.push(b.name)\n const suggestion = suggest(effective.error, candidates)\n const didYouMean = suggestion ? ` Did you mean '${suggestion}'?` : ''\n const message = `'${effective.error}' is not a command for '${parent}'.${didYouMean}`\n const ctaCommands: FormattedCta[] = []\n if (suggestion) {\n const corrected = argv.map((t) => (t === effective.error ? suggestion : t))\n ctaCommands.push({ command: `${name} ${corrected.join(' ')}` })\n }\n ctaCommands.push({ command: helpCmd, description: 'see all available commands' })\n const cta: FormattedCtaBlock = {\n description: ctaCommands.length === 1 ? 'Suggested command:' : 'Suggested commands:',\n commands: ctaCommands,\n }\n if (human && !fullOutput) {\n writeln(formatHumanError({ code: 'COMMAND_NOT_FOUND', message }))\n const mergedCta = skillsCta\n ? { ...cta, commands: [...cta.commands, ...skillsCta.commands] }\n : cta\n writeln(formatHumanCta(mergedCta))\n exit(1)\n return\n }\n write({\n ok: false,\n error: { code: 'COMMAND_NOT_FOUND', message },\n meta: {\n command: effective.error,\n cta,\n duration: `${Math.round(performance.now() - start)}ms`,\n },\n })\n exit(1)\n return\n }\n\n // Fetch gateway execution path\n if ('fetchGateway' in effective) {\n const { fetchGateway, path, rest: fetchRest } = effective\n const fetchMiddleware = [\n ...(options.middlewares ?? []),\n ...((effective as any).middlewares ?? []),\n ]\n\n const runFetch = async () => {\n const input = Fetch.parseArgv(fetchRest)\n if (fetchGateway.basePath) input.path = fetchGateway.basePath + input.path\n const request = Fetch.buildRequest(input)\n const response = await fetchGateway.fetch(request)\n\n // Streaming path — NDJSON responses pipe through handleStreaming\n if (Fetch.isStreamingResponse(response)) {\n const generator = Fetch.parseStreamingResponse(response)\n await handleStreaming(generator, {\n name,\n path,\n start,\n format,\n formatExplicit,\n human,\n renderOutput,\n fullOutput,\n truncate,\n write,\n writeln,\n exit,\n })\n return\n }\n\n const output = await Fetch.parseResponse(response)\n\n if (output.ok) {\n write({\n ok: true,\n data: output.data,\n meta: {\n command: path,\n duration: `${Math.round(performance.now() - start)}ms`,\n },\n })\n } else {\n write({\n ok: false,\n error: {\n code: `HTTP_${output.status}`,\n message:\n typeof output.data === 'object' && output.data !== null && 'message' in output.data\n ? String((output.data as any).message)\n : typeof output.data === 'string'\n ? output.data\n : `HTTP ${output.status}`,\n },\n meta: {\n command: path,\n duration: `${Math.round(performance.now() - start)}ms`,\n },\n })\n exit(1)\n }\n }\n\n try {\n const cliEnv = options.envSchema\n ? Parser.parseEnv(options.envSchema, options.env ?? process.env)\n : {}\n if (fetchMiddleware.length > 0) {\n const varsMap: Record<string, unknown> = options.vars ? options.vars.parse({}) : {}\n const errorFn = (opts: {\n code: string\n exitCode?: number | undefined\n message: string\n retryable?: boolean | undefined\n cta?: CtaBlock | undefined\n }): never => ({ [sentinel]: 'error', ...opts }) as never\n const mwCtx: MiddlewareContext = {\n agent: !human,\n command: path,\n displayName,\n env: cliEnv,\n error: errorFn,\n format,\n formatExplicit,\n name,\n set(key: string, value: unknown) {\n varsMap[key] = value\n },\n var: varsMap,\n version: options.version,\n }\n const handleMwSentinel = (result: unknown) => {\n if (!isSentinel(result) || result[sentinel] !== 'error') return\n const err = result as ErrorResult\n const cta = formatCtaBlock(displayName, err.cta)\n write({\n ok: false,\n error: {\n code: err.code,\n message: err.message,\n ...(err.retryable !== undefined ? { retryable: err.retryable } : undefined),\n },\n meta: {\n command: path,\n duration: `${Math.round(performance.now() - start)}ms`,\n ...(cta ? { cta } : undefined),\n },\n })\n exit(err.exitCode ?? 1)\n }\n const composed = fetchMiddleware.reduceRight(\n (next: () => Promise<void>, mw) => async () => {\n handleMwSentinel(await mw(mwCtx, next))\n },\n runFetch,\n )\n await composed()\n } else {\n await runFetch()\n }\n } catch (error) {\n write({\n ok: false,\n error: {\n code: error instanceof IncurError ? error.code : 'UNKNOWN',\n message: error instanceof Error ? error.message : String(error),\n },\n meta: { command: path, duration: `${Math.round(performance.now() - start)}ms` },\n })\n exit(error instanceof IncurError ? (error.exitCode ?? 1) : 1)\n }\n return\n }\n\n const { command, path, rest } = effective\n\n // Collect middleware: root CLI + groups traversed + per-command\n const allMiddleware = [\n ...(options.middlewares ?? []),\n ...('middlewares' in resolved\n ? (((resolved as any).middlewares as MiddlewareHandler[]) ?? [])\n : []),\n ...((command.middleware as MiddlewareHandler[] | undefined) ?? []),\n ]\n\n if (human)\n emitDeprecationWarnings(\n rest,\n command.options,\n command.alias as Record<string, string> | undefined,\n )\n\n let defaults: Record<string, unknown> | undefined\n if (configEnabled) {\n try {\n defaults = await loadCommandOptionDefaults(name, path, {\n configDisabled,\n configPath,\n files: options.config?.files,\n loader: options.config?.loader,\n })\n } catch (error) {\n write({\n ok: false,\n error: {\n code: error instanceof IncurError ? error.code : 'UNKNOWN',\n message: error instanceof Error ? error.message : String(error),\n },\n meta: { command: path, duration: `${Math.round(performance.now() - start)}ms` },\n })\n exit(error instanceof IncurError ? (error.exitCode ?? 1) : 1)\n return\n }\n }\n\n const result = await Command.execute(command, {\n agent: !human,\n argv: rest,\n defaults,\n displayName,\n env: options.envSchema,\n envSource: options.env,\n format,\n formatExplicit,\n inputOptions: {},\n middlewares: allMiddleware,\n name,\n path,\n vars: options.vars,\n version: options.version,\n })\n\n const duration = `${Math.round(performance.now() - start)}ms`\n\n // Streaming path — async generator\n if ('stream' in result) {\n await handleStreaming(result.stream, {\n name: displayName,\n path,\n start,\n format,\n formatExplicit,\n human,\n renderOutput,\n fullOutput,\n truncate,\n write,\n writeln,\n exit,\n })\n return\n }\n\n if (result.ok) {\n const cta = formatCtaBlock(displayName, result.cta as CtaBlock | undefined)\n write({\n ok: true,\n data: result.data,\n meta: {\n command: path,\n duration,\n ...(cta ? { cta } : undefined),\n },\n })\n } else {\n const cta = formatCtaBlock(displayName, result.cta as CtaBlock | undefined)\n\n if (human && !formatExplicit && result.error.fieldErrors) {\n writeln(\n formatHumanValidationError(\n displayName,\n path,\n command,\n new ValidationError({\n message: result.error.message,\n fieldErrors: result.error.fieldErrors,\n }),\n options.env,\n configFlag,\n ),\n )\n exit(1)\n return\n }\n\n write({\n ok: false,\n error: {\n code: result.error.code,\n message: result.error.message,\n ...(result.error.retryable !== undefined\n ? { retryable: result.error.retryable }\n : undefined),\n ...(result.error.fieldErrors ? { fieldErrors: result.error.fieldErrors } : undefined),\n },\n meta: {\n command: path,\n duration,\n ...(cta ? { cta } : undefined),\n },\n })\n exit(result.exitCode ?? 1)\n }\n}\n\n/** @internal Options for fetchImpl. */\ndeclare namespace fetchImpl {\n type Options = {\n /** CLI description. */\n description?: string | undefined\n /** CLI-level env schema. */\n envSchema?: z.ZodObject<any> | undefined\n /** Group-level middleware collected during command resolution. */\n groupMiddlewares?: MiddlewareHandler[] | undefined\n mcpHandler?:\n | ((\n req: Request,\n commands: Map<string, CommandEntry>,\n mcpOptions?: {\n middlewares?: MiddlewareHandler[] | undefined\n env?: z.ZodObject<any> | undefined\n vars?: z.ZodObject<any> | undefined\n },\n ) => Promise<Response>)\n | undefined\n middlewares?: MiddlewareHandler[] | undefined\n /** CLI name. */\n name?: string | undefined\n rootCommand?: CommandDefinition<any, any, any> | undefined\n vars?: z.ZodObject<any> | undefined\n /** CLI version string. */\n version?: string | undefined\n }\n}\n\n/** @internal Creates a lazy MCP HTTP handler scoped to a CLI instance. */\nfunction createMcpHttpHandler(name: string, version: string) {\n let transport: any\n\n return async (\n req: Request,\n commands: Map<string, CommandEntry>,\n mcpOptions?: {\n middlewares?: MiddlewareHandler[] | undefined\n env?: z.ZodObject<any> | undefined\n vars?: z.ZodObject<any> | undefined\n },\n ): Promise<Response> => {\n if (!transport) {\n const { McpServer, WebStandardStreamableHTTPServerTransport } =\n await import('@modelcontextprotocol/server')\n\n const server = new McpServer({ name, version })\n\n for (const tool of Mcp.collectTools(commands, [])) {\n const mergedShape: Record<string, any> = {\n ...tool.command.args?.shape,\n ...tool.command.options?.shape,\n }\n const hasInput = Object.keys(mergedShape).length > 0\n\n server.registerTool(\n tool.name,\n {\n ...(tool.description ? { description: tool.description } : undefined),\n ...(hasInput ? { inputSchema: z.object(mergedShape) } : undefined),\n },\n async (...callArgs: any[]) => {\n const params = hasInput ? (callArgs[0] as Record<string, unknown>) : {}\n return Mcp.callTool(tool, params, {\n name,\n version,\n middlewares: mcpOptions?.middlewares,\n env: mcpOptions?.env,\n vars: mcpOptions?.vars,\n })\n },\n )\n }\n\n transport = new WebStandardStreamableHTTPServerTransport({\n sessionIdGenerator: () => crypto.randomUUID(),\n enableJsonResponse: true,\n })\n await server.connect(transport)\n }\n return transport.handleRequest(req)\n }\n}\n\nfunction isOpenapiRoute(segments: string[]) {\n if (segments.length === 1)\n return (\n segments[0] === 'openapi.json' ||\n segments[0] === 'openapi.yml' ||\n segments[0] === 'openapi.yaml'\n )\n return segments[0] === '.well-known' && segments[1] === 'openapi.json' && segments.length === 2\n}\n\nfunction generatedOpenapi(\n name: string,\n commands: Map<string, CommandEntry>,\n options: fetchImpl.Options,\n) {\n const openapiCli = { name, description: options.description } as Cli\n toCommands.set(openapiCli, commands)\n if (options.rootCommand) toRootDefinition.set(openapiCli as unknown as Root, options.rootCommand)\n return Openapi.fromCli(openapiCli, {\n title: name,\n ...(options.version ? { version: options.version } : undefined),\n ...(options.description ? { description: options.description } : undefined),\n })\n}\n\n/** @internal Handles an HTTP request by resolving a command and returning a JSON Response. */\nasync function fetchImpl(\n name: string,\n commands: Map<string, CommandEntry>,\n req: Request,\n options: fetchImpl.Options = {},\n): Promise<Response> {\n const start = performance.now()\n\n const url = new URL(req.url)\n const segments = url.pathname.split('/').filter(Boolean)\n\n // OpenAPI discovery: route /openapi.json, /openapi.yml, /openapi.yaml, and /.well-known/openapi.json\n if (req.method === 'GET' && isOpenapiRoute(segments)) {\n const spec = generatedOpenapi(name, commands, options)\n const yaml = segments[0] === 'openapi.yml' || segments[0] === 'openapi.yaml'\n return new Response(yaml ? yamlStringify(spec) : JSON.stringify(spec), {\n status: 200,\n headers: {\n 'content-type': yaml ? 'application/yaml' : 'application/json',\n 'cache-control': 'public, max-age=300',\n },\n })\n }\n\n // MCP over HTTP: route /mcp to the MCP transport\n if (segments[0] === 'mcp' && segments.length === 1 && options.mcpHandler)\n return options.mcpHandler(req, commands, {\n middlewares: options.middlewares,\n env: options.envSchema,\n vars: options.vars,\n })\n\n // .well-known/skills/ — Agent Skills Discovery (RFC)\n if (\n segments[0] === '.well-known' &&\n segments[1] === 'skills' &&\n segments.length >= 3 &&\n req.method === 'GET'\n ) {\n const groups = new Map<string, string>()\n const cmds = collectSkillCommands(commands, [], groups, options.rootCommand)\n\n // GET /.well-known/skills/index.json\n if (segments[2] === 'index.json' && segments.length === 3) {\n const files = Skill.split(name, cmds, 1, groups)\n const skills = files.map((f) => {\n const fmMatch = f.content.match(/^---\\n([\\s\\S]*?)\\n---/)\n const meta = fmMatch ? (yamlParse(fmMatch[1]!) as Record<string, string>) : {}\n return {\n name: f.dir || name,\n description: meta.description ?? '',\n files: ['SKILL.md'],\n }\n })\n return new Response(JSON.stringify({ skills }), {\n status: 200,\n headers: { 'content-type': 'application/json', 'cache-control': 'public, max-age=300' },\n })\n }\n\n // GET /.well-known/skills/{skill-name}/SKILL.md\n if (segments.length === 4 && segments[3] === 'SKILL.md') {\n const skillName = segments[2]!\n const files = Skill.split(name, cmds, 1, groups)\n const file = files.find((f) => (f.dir || name) === skillName)\n if (file)\n return new Response(file.content, {\n status: 200,\n headers: { 'content-type': 'text/markdown', 'cache-control': 'public, max-age=300' },\n })\n return new Response('Not Found', { status: 404 })\n }\n\n return new Response('Not Found', { status: 404 })\n }\n\n // Parse options from search params (GET) or body (non-GET)\n let inputOptions: Record<string, unknown> = {}\n if (req.method === 'GET') for (const [key, value] of url.searchParams) inputOptions[key] = value\n else {\n try {\n const contentType = req.headers.get('content-type') ?? ''\n if (contentType.includes('application/json'))\n inputOptions = (await req.json()) as Record<string, unknown>\n } catch {}\n }\n\n function jsonResponse(body: unknown, status: number) {\n return new Response(JSON.stringify(body), {\n status,\n headers: { 'content-type': 'application/json' },\n })\n }\n\n // Resolve command from path segments\n if (segments.length === 0) {\n // Root path\n if (options.rootCommand)\n return executeCommand(name, options.rootCommand, [], inputOptions, start, options)\n return jsonResponse(\n {\n ok: false,\n error: { code: 'COMMAND_NOT_FOUND', message: 'No root command defined.' },\n meta: { command: '/', duration: `${Math.round(performance.now() - start)}ms` },\n },\n 404,\n )\n }\n\n const resolved = resolveCommand(commands, segments)\n\n if ('error' in resolved) {\n const parent = resolved.path ? `${name} ${resolved.path}` : name\n const suggestion = suggest(resolved.error, resolved.commands.keys())\n const didYouMean = suggestion ? ` Did you mean '${suggestion}'?` : ''\n return jsonResponse(\n {\n ok: false,\n error: {\n code: 'COMMAND_NOT_FOUND',\n message: `'${resolved.error}' is not a command for '${parent}'.${didYouMean}`,\n },\n meta: { command: resolved.error, duration: `${Math.round(performance.now() - start)}ms` },\n },\n 404,\n )\n }\n\n if ('help' in resolved)\n return jsonResponse(\n {\n ok: false,\n error: {\n code: 'COMMAND_NOT_FOUND',\n message: `'${resolved.path}' is a command group. Specify a subcommand.`,\n },\n meta: { command: resolved.path, duration: `${Math.round(performance.now() - start)}ms` },\n },\n 404,\n )\n\n if ('fetchGateway' in resolved) return resolved.fetchGateway.fetch(req)\n\n const { command, path, rest } = resolved\n const groupMiddlewares = 'middlewares' in resolved ? resolved.middlewares : []\n return executeCommand(path, command, rest, inputOptions, start, {\n ...options,\n groupMiddlewares,\n })\n}\n\n/** @internal Executes a resolved command for the fetch handler and returns a JSON Response. */\nasync function executeCommand(\n path: string,\n command: CommandDefinition<any, any, any>,\n rest: string[],\n inputOptions: Record<string, unknown>,\n start: number,\n options: fetchImpl.Options,\n): Promise<Response> {\n function jsonResponse(body: unknown, status: number) {\n return new Response(JSON.stringify(body), {\n status,\n headers: { 'content-type': 'application/json' },\n })\n }\n\n const allMiddleware = [\n ...(options.middlewares ?? []),\n ...((options.groupMiddlewares as MiddlewareHandler[] | undefined) ?? []),\n ...((command.middleware as MiddlewareHandler[] | undefined) ?? []),\n ]\n\n const result = await Command.execute(command, {\n agent: true,\n argv: rest,\n env: options.envSchema,\n format: 'json',\n formatExplicit: true,\n inputOptions,\n middlewares: allMiddleware,\n name: options.name ?? path,\n parseMode: 'split',\n path,\n vars: options.vars,\n version: options.version,\n })\n\n const duration = `${Math.round(performance.now() - start)}ms`\n\n // Streaming path — async generator → NDJSON response\n if ('stream' in result) {\n const stream = new ReadableStream({\n async start(controller) {\n const encoder = new TextEncoder()\n try {\n for await (const value of result.stream) {\n controller.enqueue(\n encoder.encode(JSON.stringify({ type: 'chunk', data: value }) + '\\n'),\n )\n }\n controller.enqueue(\n encoder.encode(\n JSON.stringify({\n type: 'done',\n ok: true,\n meta: { command: path },\n }) + '\\n',\n ),\n )\n } catch (error) {\n controller.enqueue(\n encoder.encode(\n JSON.stringify({\n type: 'error',\n ok: false,\n error: {\n code: 'UNKNOWN',\n message: error instanceof Error ? error.message : String(error),\n },\n }) + '\\n',\n ),\n )\n }\n controller.close()\n },\n })\n return new Response(stream, {\n status: 200,\n headers: { 'content-type': 'application/x-ndjson' },\n })\n }\n\n if (!result.ok) {\n const cta = formatCtaBlock(options.name ?? path, result.cta as CtaBlock | undefined)\n return jsonResponse(\n {\n ok: false,\n error: {\n code: result.error.code,\n message: result.error.message,\n ...(result.error.retryable !== undefined\n ? { retryable: result.error.retryable }\n : undefined),\n },\n meta: {\n command: path,\n duration,\n ...(cta ? { cta } : undefined),\n },\n },\n result.error.code === 'VALIDATION_ERROR' ? 400 : 500,\n )\n }\n\n const cta = formatCtaBlock(options.name ?? path, result.cta as CtaBlock | undefined)\n return jsonResponse(\n {\n ok: true,\n data: result.data,\n meta: {\n command: path,\n duration,\n ...(cta ? { cta } : undefined),\n },\n },\n 200,\n )\n}\n\n/** @internal Formats a validation error for TTY with usage hint. */\nfunction formatHumanValidationError(\n cli: string,\n path: string,\n command: CommandDefinition<any, any, any>,\n error: ValidationError,\n envSource?: Record<string, string | undefined>,\n configFlag?: string,\n): string {\n const lines: string[] = []\n for (const fe of error.fieldErrors) {\n const line = (() => {\n const target = formatValidationTarget(command, fe.path)\n if (fe.missing) return `Error: missing required ${target.kind} ${target.label}`\n if (target.kind === 'environment variable')\n return `Error: invalid value for environment variable ${target.label}: ${fe.message}`\n return `Error: invalid value for ${target.label}: ${fe.message}`\n })()\n lines.push(line)\n }\n lines.push('See below for usage.')\n lines.push('')\n lines.push(\n Help.formatCommand(path === cli ? cli : `${cli} ${path}`, {\n alias: command.alias as Record<string, string> | undefined,\n configFlag,\n description: command.description,\n args: command.args,\n env: command.env,\n envSource,\n hint: command.hint,\n options: command.options,\n examples: formatExamples(command.examples),\n usage: command.usage,\n }),\n )\n return lines.join('\\n')\n}\n\n/** @internal Formats a field path as an option flag, env name, or positional placeholder. */\nfunction formatValidationTarget(command: CommandDefinition<any, any, any>, path: string) {\n const [head, ...tail] = path.split('.')\n if (!head) return { kind: 'argument', label: 'input' } as const\n if (command.options?.shape[head]) {\n const suffix = tail.length > 0 ? `.${tail.join('.')}` : ''\n return { kind: 'option', label: `--${toKebab(head)}${suffix}` } as const\n }\n if (command.env?.shape[head]) {\n const suffix = tail.length > 0 ? `.${tail.join('.')}` : ''\n return { kind: 'environment variable', label: `${head}${suffix}` } as const\n }\n return { kind: 'argument', label: `<${path}>` } as const\n}\n\n/** @internal Resolves a command from the tree by walking tokens until a leaf is found. */\nfunction resolveCommand(\n commands: Map<string, CommandEntry>,\n tokens: string[],\n):\n | {\n command: CommandDefinition<any, any, any>\n middlewares: MiddlewareHandler[]\n outputPolicy?: OutputPolicy | undefined\n path: string\n rest: string[]\n }\n | {\n fetchGateway: InternalFetchGateway\n middlewares: MiddlewareHandler[]\n outputPolicy?: OutputPolicy | undefined\n path: string\n rest: string[]\n }\n | {\n help: true\n path: string\n description?: string | undefined\n commands: Map<string, CommandEntry>\n }\n | { error: string; path: string; commands: Map<string, CommandEntry>; rest: string[] } {\n const [first, ...rest] = tokens\n\n if (!first || !commands.has(first)) return { error: first ?? '(none)', path: '', commands, rest }\n\n let entry = resolveAlias(commands, commands.get(first)!)\n const path = [first]\n let remaining = rest\n let inheritedOutputPolicy: OutputPolicy | undefined\n const collectedMiddlewares: MiddlewareHandler[] = []\n\n // Fetch gateway — all remaining tokens go to the fetch handler\n if (isFetchGateway(entry)) {\n const outputPolicy = entry.outputPolicy ?? inheritedOutputPolicy\n return {\n fetchGateway: entry,\n middlewares: collectedMiddlewares,\n path: path.join(' '),\n rest: remaining,\n ...(outputPolicy ? { outputPolicy } : undefined),\n }\n }\n\n while (isGroup(entry)) {\n if (entry.outputPolicy) inheritedOutputPolicy = entry.outputPolicy\n if (entry.middlewares) collectedMiddlewares.push(...entry.middlewares)\n const next = remaining[0]\n if (!next)\n return {\n help: true,\n path: path.join(' '),\n description: entry.description,\n commands: entry.commands,\n }\n\n const rawChild = entry.commands.get(next)\n if (!rawChild) {\n return {\n error: next,\n path: path.join(' '),\n commands: entry.commands,\n rest: remaining.slice(1),\n }\n }\n let child = resolveAlias(entry.commands, rawChild)\n\n path.push(next)\n remaining = remaining.slice(1)\n entry = child\n\n if (isFetchGateway(entry)) {\n const outputPolicy = entry.outputPolicy ?? inheritedOutputPolicy\n return {\n fetchGateway: entry,\n middlewares: collectedMiddlewares,\n path: path.join(' '),\n rest: remaining,\n ...(outputPolicy ? { outputPolicy } : undefined),\n }\n }\n }\n\n const outputPolicy = entry.outputPolicy ?? inheritedOutputPolicy\n return {\n command: entry,\n middlewares: collectedMiddlewares,\n path: path.join(' '),\n rest: remaining,\n ...(outputPolicy ? { outputPolicy } : undefined),\n }\n}\n\n/** @internal Options for serveImpl, extending public serve.Options with internal metadata. */\ndeclare namespace serveImpl {\n type Options = serve.Options & {\n /** Alternative binary names for this CLI. */\n aliases?: string[] | undefined\n config?:\n | {\n flag?: string | undefined\n files?: string[] | undefined\n loader?:\n | ((\n path: string | undefined,\n ) =>\n | Record<string, unknown>\n | undefined\n | Promise<Record<string, unknown> | undefined>)\n | undefined\n }\n | undefined\n description?: string | undefined\n /** CLI-level env schema. Parsed before middleware runs. */\n envSchema?: z.ZodObject<any> | undefined\n /** CLI-level default output format. */\n format?: Formatter.Format | undefined\n /** Middleware handlers registered on the root CLI. */\n middlewares?: MiddlewareHandler[] | undefined\n /** CLI-level default output policy. */\n outputPolicy?: OutputPolicy | undefined\n /** Custom renderer for human/TTY output mode. Return null to fall back to default formatting. */\n renderer?: ((data: unknown) => string | null) | undefined\n mcp?:\n | {\n agents?: string[] | undefined\n command?: string | undefined\n }\n | undefined\n /** Root command handler, invoked when no subcommand matches. */\n rootCommand?: CommandDefinition<any, any, any> | undefined\n /** Root fetch handler, invoked when no subcommand matches and no rootCommand is set. */\n rootFetch?: FetchHandler | undefined\n sync?:\n | {\n cwd?: string | undefined\n depth?: number | undefined\n include?: string[] | undefined\n suggestions?: string[] | undefined\n }\n | undefined\n /** Zod schema for middleware variables. */\n vars?: z.ZodObject<any> | undefined\n version?: string | undefined\n }\n}\n\n/** @internal Extracts built-in flags (--full-output, --format, --json, --llms, --help, --version) from argv. */\nconst validFormats = new Set(['toon', 'json', 'yaml', 'md', 'jsonl'] as const)\n\nfunction extractBuiltinFlags(argv: string[], options: extractBuiltinFlags.Options = {}) {\n let fullOutput = false\n let llms = false\n let llmsFull = false\n let mcp = false\n let help = false\n let version = false\n let schema = false\n let format: Formatter.Format = 'toon'\n let formatExplicit = false\n let configPath: string | undefined\n let configDisabled = false\n let filterOutput: string | undefined\n let tokenLimit: number | undefined\n let tokenOffset: number | undefined\n let tokenCount = false\n const rest: string[] = []\n\n const cfgFlag = options.configFlag ? `--${options.configFlag}` : undefined\n const cfgFlagEq = options.configFlag ? `--${options.configFlag}=` : undefined\n const noCfgFlag = options.configFlag ? `--no-${options.configFlag}` : undefined\n\n for (let i = 0; i < argv.length; i++) {\n const token = argv[i]!\n if (token === '--full-output') fullOutput = true\n else if (token === '--llms') llms = true\n else if (token === '--llms-full') llmsFull = true\n else if (token === '--mcp') mcp = true\n else if (token === '--help' || token === '-h') help = true\n else if (token === '--version') version = true\n else if (token === '--schema') schema = true\n else if (token === '--json') {\n format = 'json'\n formatExplicit = true\n } else if (token === '--format' && argv[i + 1]) {\n if (!validFormats.has(argv[i + 1]! as any))\n throw new ParseError({\n message: `Invalid format: \"${argv[i + 1]}\". Expected one of: ${[...validFormats].join(', ')}`,\n })\n format = argv[i + 1] as Formatter.Format\n formatExplicit = true\n i++\n } else if (cfgFlag && token === cfgFlag) {\n const value = argv[i + 1]\n if (value === undefined)\n throw new ParseError({ message: `Missing value for flag: ${cfgFlag}` })\n configPath = value\n configDisabled = false\n i++\n } else if (cfgFlagEq && token.startsWith(cfgFlagEq)) {\n const value = token.slice(cfgFlagEq.length)\n if (value.length === 0)\n throw new ParseError({ message: `Missing value for flag: ${cfgFlag}` })\n configPath = value\n configDisabled = false\n } else if (noCfgFlag && token === noCfgFlag) {\n configPath = undefined\n configDisabled = true\n } else if (token === '--filter-output' && argv[i + 1]) {\n filterOutput = argv[i + 1]!\n i++\n } else if (token === '--token-limit' && argv[i + 1]) {\n const n = Number(argv[i + 1])\n if (!Number.isFinite(n) || argv[i + 1]!.trim() === '')\n throw new ParseError({ message: `Invalid value for --token-limit: \"${argv[i + 1]}\"` })\n tokenLimit = n\n i++\n } else if (token === '--token-offset' && argv[i + 1]) {\n const n = Number(argv[i + 1])\n if (!Number.isFinite(n) || argv[i + 1]!.trim() === '')\n throw new ParseError({ message: `Invalid value for --token-offset: \"${argv[i + 1]}\"` })\n tokenOffset = n\n i++\n } else if (token === '--token-count') tokenCount = true\n else rest.push(token)\n }\n\n return {\n fullOutput,\n format,\n formatExplicit,\n configPath,\n configDisabled,\n filterOutput,\n tokenLimit,\n tokenOffset,\n tokenCount,\n llms,\n llmsFull,\n mcp,\n help,\n version,\n schema,\n rest,\n }\n}\n\ndeclare namespace extractBuiltinFlags {\n type Options = {\n configFlag?: string | undefined\n }\n}\n\n/** @internal Loads config-backed option defaults for the active command. */\nasync function loadCommandOptionDefaults(\n cli: string,\n path: string,\n options: loadCommandOptionDefaults.Options = {},\n): Promise<Record<string, unknown> | undefined> {\n if (options.configDisabled) return undefined\n\n const { loader } = options\n\n // Resolve the target file path\n let targetPath: string | undefined\n if (options.configPath) {\n targetPath = resolveConfigPath(options.configPath)\n } else {\n const searchPaths = options.files ?? [`${cli}.json`]\n targetPath = await findFirstExisting(searchPaths)\n }\n\n // Load and parse the config\n let parsed: Record<string, unknown>\n if (loader) {\n const result = await loader(targetPath)\n if (result === undefined) return undefined\n if (!isRecord(result))\n throw new ParseError({ message: 'Config loader must return a plain object or undefined' })\n parsed = result\n } else {\n if (!targetPath) return undefined\n const result = await readJsonConfig(targetPath, !!options.configPath)\n if (!result) return undefined\n parsed = result\n }\n\n // Extract the command section from the config tree\n return extractCommandSection(parsed, cli, path)\n}\n\ndeclare namespace loadCommandOptionDefaults {\n type Options = {\n configDisabled?: boolean | undefined\n configPath?: string | undefined\n files?: string[] | undefined\n loader?:\n | ((\n path: string | undefined,\n ) => Record<string, unknown> | undefined | Promise<Record<string, unknown> | undefined>)\n | undefined\n }\n}\n\n/** @internal Resolves a config file path, expanding `~` to home dir. */\nfunction resolveConfigPath(filePath: string): string {\n if (filePath.startsWith('~/') || filePath === '~') {\n return path.join(os.homedir(), filePath.slice(1))\n }\n return path.resolve(process.cwd(), filePath)\n}\n\n/** @internal Returns the first readable file from a list of paths, or `undefined`. */\nasync function findFirstExisting(paths: string[]): Promise<string | undefined> {\n for (const p of paths) {\n const resolved = resolveConfigPath(p)\n try {\n await fs.access(resolved, fs.constants.R_OK)\n return resolved\n } catch {}\n }\n return undefined\n}\n\n/** @internal Reads and parses a JSON config file. */\nasync function readJsonConfig(\n targetPath: string,\n explicit: boolean,\n): Promise<Record<string, unknown> | undefined> {\n let raw: string\n try {\n raw = await fs.readFile(targetPath, 'utf8')\n } catch (error) {\n if ((error as NodeJS.ErrnoException).code === 'ENOENT') {\n if (explicit) throw new ParseError({ message: `Config file not found: ${targetPath}` })\n return undefined\n }\n throw error\n }\n\n let parsed: unknown\n try {\n parsed = JSON.parse(raw)\n } catch (error) {\n throw new ParseError({\n message: `Invalid JSON config file: ${targetPath}`,\n cause: error instanceof Error ? error : undefined,\n })\n }\n\n if (!isRecord(parsed))\n throw new ParseError({\n message: `Invalid config file: expected a top-level object in ${targetPath}`,\n })\n return parsed\n}\n\n/** @internal Walks the nested config tree to extract option defaults for a command path. */\nfunction extractCommandSection(\n parsed: Record<string, unknown>,\n cli: string,\n path: string,\n): Record<string, unknown> | undefined {\n const segments = path === cli ? [] : path.split(' ')\n let node: unknown = parsed\n for (const seg of segments) {\n if (!isRecord(node)) return undefined\n const commands = node.commands\n if (!isRecord(commands)) return undefined\n node = commands[seg]\n if (node === undefined) return undefined\n }\n if (!isRecord(node))\n throw new ParseError({\n message: `Invalid config section for '${path}': expected an object`,\n })\n\n const options = node.options\n if (options === undefined) return undefined\n if (!isRecord(options))\n throw new ParseError({\n message: `Invalid config 'options' for '${path}': expected an object`,\n })\n return Object.keys(options).length > 0 ? options : undefined\n}\n\n/** @internal Collects immediate child commands/groups for help output. */\nfunction collectHelpCommands(\n commands: Map<string, CommandEntry>,\n): { name: string; description?: string | undefined }[] {\n const result: { name: string; description?: string | undefined }[] = []\n for (const [name, entry] of commands) {\n if (isAlias(entry)) continue\n result.push({ name, description: entry.description })\n }\n return result.sort((a, b) => a.name.localeCompare(b.name))\n}\n\n/** @internal Finds the index of a builtin command token in the filtered argv. Returns -1 if not found. */\nfunction builtinIdx(filtered: string[], cliName: string, builtin: string): number {\n // e.g. `skills add` or `skill add`\n if (findBuiltin(filtered[0]!)?.name === builtin) return 0\n // e.g. `my-cli skills add`\n if (filtered[0] === cliName && findBuiltin(filtered[1]!)?.name === builtin) return 1\n // not a match\n return -1\n}\n\n/** @internal Formats group-level help for a built-in command (e.g. `cli skills`). */\nfunction formatBuiltinHelp(cli: string, builtin: (typeof builtinCommands)[number]): string {\n return Help.formatRoot(`${cli} ${builtin.name}`, {\n aliases: builtin.aliases,\n description: builtin.description,\n commands: builtin.subcommands?.map((s) => ({ name: s.name, description: s.description })),\n })\n}\n\n/** @internal Formats subcommand-level help for a built-in command (e.g. `cli skills add --help`). */\nfunction formatBuiltinSubcommandHelp(\n cli: string,\n builtin: (typeof builtinCommands)[number],\n subName: string,\n): string {\n const sub = findBuiltinSubcommand(builtin, subName)\n return Help.formatCommand(`${cli} ${builtin.name} ${subName}`, {\n alias: sub?.alias,\n aliases: sub?.aliases,\n description: sub?.description,\n hideGlobalOptions: true,\n options: sub?.options,\n })\n}\n\n/** @internal Formats help text for a fetch gateway command. */\nfunction formatFetchHelp(name: string, description?: string): string {\n const lines: string[] = []\n if (description) lines.push(`${name} — ${description}`)\n else lines.push(name)\n lines.push('')\n lines.push(`Usage: ${name} <path> [options]`)\n lines.push('')\n lines.push('Path segments are joined into the request URL path.')\n lines.push('')\n lines.push('Options:')\n lines.push(' -X, --method <METHOD> HTTP method (default: GET, POST if body present)')\n lines.push(' -H, --header \"Key: Val\" Set a request header (repeatable)')\n lines.push(' -d, --data <json> Request body (implies POST)')\n lines.push(' --body <json> Request body (implies POST)')\n lines.push(' --<key> <value> Query string parameter')\n return lines.join('\\n')\n}\n\n/** Shape of the commands map accumulated through `.command()` chains. */\nexport type CommandsMap = Record<\n string,\n { args: Record<string, unknown>; options: Record<string, unknown> }\n>\n\n/** @internal Entry stored in a command map — either a leaf definition, a group, or a fetch gateway. */\ntype CommandEntry =\n | CommandDefinition<any, any, any>\n | InternalGroup\n | InternalFetchGateway\n | InternalAlias\n\n/** Controls when output data is displayed. `'all'` displays to both humans and agents. `'agent-only'` suppresses data output in human/TTY mode. */\nexport type OutputPolicy = 'agent-only' | 'all'\n\n/** A standard Fetch API handler. */\nexport type FetchHandler = Fetch.Handler\n\n/** Fetch handler or hosted source used by fetch-backed commands. */\nexport type FetchSource = Fetch.Source\n\n/** @internal A command group's internal storage. */\ntype InternalGroup = {\n _group: true\n description?: string | undefined\n middlewares?: MiddlewareHandler[] | undefined\n outputPolicy?: OutputPolicy | undefined\n commands: Map<string, CommandEntry>\n}\n\n/** @internal A fetch gateway entry. */\ntype InternalFetchGateway = {\n _fetch: true\n basePath?: string | undefined\n description?: string | undefined\n fetch: FetchHandler\n outputPolicy?: OutputPolicy | undefined\n}\n\nfunction isFetchSource(value: unknown): value is FetchSource {\n if (typeof value === 'function') return true\n if (typeof value !== 'object' || value === null) return false\n\n const source = value as { fetch?: unknown; url?: unknown }\n return typeof source.fetch === 'function' && source.url instanceof URL\n}\n\nfunction resolveFetch(source: FetchSource): FetchHandler {\n if (typeof source === 'function') return source\n return source.fetch\n}\n\nfunction fetchBaseUrl(source: FetchSource) {\n return typeof source === 'function' ? undefined : source.url\n}\n\n/** @internal Type guard for command groups. */\nfunction isGroup(entry: CommandEntry): entry is InternalGroup {\n return '_group' in entry\n}\n\n/** @internal Type guard for fetch gateways. */\nfunction isFetchGateway(entry: CommandEntry): entry is InternalFetchGateway {\n return '_fetch' in entry\n}\n\n/** @internal An alias entry that points to another command by name. */\ntype InternalAlias = {\n _alias: true\n /** The canonical command name this alias resolves to. */\n target: string\n}\n\n/** @internal Type guard for alias entries. */\nfunction isAlias(entry: CommandEntry): entry is InternalAlias {\n return '_alias' in entry\n}\n\n/** @internal Follows an alias entry to its canonical target. Returns the entry unchanged if not an alias. */\nfunction resolveAlias(\n commands: Map<string, CommandEntry>,\n entry: CommandEntry,\n): Exclude<CommandEntry, InternalAlias> {\n if (isAlias(entry)) return commands.get(entry.target)! as Exclude<CommandEntry, InternalAlias>\n return entry\n}\n\n/** @internal Maps CLI instances to their command maps. */\nexport const toCommands = new WeakMap<Cli, Map<string, CommandEntry>>()\n\n/** @internal Maps CLI instances to their middleware arrays. */\nconst toMiddlewares = new WeakMap<Cli, MiddlewareHandler[]>()\n\n/** @internal Maps root CLI instances to their command definitions. */\nexport const toRootDefinition = new WeakMap<Root, CommandDefinition<any, any, any>>()\n\n/** @internal Maps CLI instances to their root options schema. */\nexport const toRootOptions = new WeakMap<Cli, z.ZodObject<any>>()\n\n/** @internal Maps CLI instances to whether config file loading is enabled. */\nexport const toConfigEnabled = new WeakMap<Cli, boolean>()\n\n/** @internal Maps CLI instances to their output policy. */\nconst toOutputPolicy = new WeakMap<Cli, OutputPolicy>()\n\n/** @internal Maps root CLI instances to their command aliases. */\nconst toRootAliases = new WeakMap<Root, string[]>()\n\n/** @internal Sentinel symbol for `ok()` and `error()` return values. */\nconst sentinel = Symbol.for('incur.sentinel')\n\n/** @internal A tagged ok result returned by the `ok` context helper. */\ntype OkResult = {\n [sentinel]: 'ok'\n data: unknown\n cta?: CtaBlock | undefined\n}\n\n/** @internal A tagged error result returned by the `error` context helper. */\ntype ErrorResult = {\n [sentinel]: 'error'\n code: string\n message: string\n retryable?: boolean | undefined\n exitCode?: number | undefined\n cta?: CtaBlock | undefined\n}\n\n/** @internal A CTA block with a description and list of suggested commands. */\ntype CtaBlock<commands extends CommandsMap = Commands> = {\n /** Commands to suggest. */\n commands: Cta<commands>[]\n /** Human-readable label. Defaults to `\"Suggested command:\"` or `\"Suggested commands:\"` based on count. */\n description?: string | undefined\n}\n\n/** @internal Formats an error for human-readable TTY output. */\nfunction formatHumanError(error: {\n code: string\n message: string\n fieldErrors?: FieldError[] | undefined\n}): string {\n const prefix =\n error.code === 'UNKNOWN' || error.code === 'COMMAND_NOT_FOUND'\n ? 'Error'\n : `Error (${error.code})`\n let out = `${prefix}: ${error.message}`\n if (error.fieldErrors) for (const fe of error.fieldErrors) out += `\\n ${fe.path}: ${fe.message}`\n return out\n}\n\n/** @internal Formats a CTA block for human-readable TTY output. */\nfunction formatHumanCta(cta: FormattedCtaBlock): string {\n const lines: string[] = ['', cta.description]\n const maxLen = Math.max(...cta.commands.map((c) => c.command.length))\n for (const c of cta.commands) {\n const desc = c.description ? ` ${''.padEnd(maxLen - c.command.length)}# ${c.description}` : ''\n lines.push(` ${c.command}${desc}`)\n }\n return lines.join('\\n')\n}\n\n/** @internal Type guard for sentinel results. */\nfunction hasRequiredArgs(args: z.ZodObject<z.ZodRawShape>): boolean {\n return Object.values(args.shape).some((field) => field._zod.optout !== 'optional')\n}\n\nfunction isSentinel(value: unknown): value is OkResult | ErrorResult {\n return typeof value === 'object' && value !== null && sentinel in value\n}\n\n/** @internal Handles streaming output from an async generator `run` handler. */\nasync function handleStreaming(\n generator: AsyncGenerator<unknown, unknown, unknown>,\n ctx: {\n name: string\n path: string\n start: number\n format: Formatter.Format\n formatExplicit: boolean\n human: boolean\n renderOutput: boolean\n fullOutput: boolean\n truncate: (s: string) => { text: string; truncated: boolean; nextOffset?: number | undefined }\n write: (output: Output) => void\n writeln: (s: string) => void\n exit: (code: number) => void\n },\n) {\n // Incremental: no explicit format (default toon), or explicit jsonl\n // Buffered: explicit json/yaml/toon/md\n const useJsonl = ctx.format === 'jsonl'\n const incremental = useJsonl || (!ctx.formatExplicit && ctx.format === 'toon')\n\n if (incremental) {\n // Incremental output: write each chunk as it arrives\n try {\n let returnValue: unknown\n while (true) {\n const { value, done } = await generator.next()\n if (done) {\n returnValue = value\n break\n }\n if (isSentinel(value)) {\n const tagged = value as any\n if (tagged[sentinel] === 'error') {\n if (useJsonl)\n ctx.writeln(\n JSON.stringify({\n type: 'error',\n ok: false,\n error: {\n code: tagged.code,\n message: tagged.message,\n ...(tagged.retryable !== undefined\n ? { retryable: tagged.retryable }\n : undefined),\n },\n }),\n )\n else ctx.writeln(formatHumanError({ code: tagged.code, message: tagged.message }))\n ctx.exit(tagged.exitCode ?? 1)\n return\n }\n }\n if (useJsonl) ctx.writeln(JSON.stringify({ type: 'chunk', data: value }))\n else if (ctx.renderOutput)\n ctx.writeln(ctx.truncate(Formatter.format(value, ctx.format)).text)\n }\n\n // Handle return value — error() or ok() sentinel\n if (isSentinel(returnValue) && returnValue[sentinel] === 'error') {\n const err = returnValue as ErrorResult\n if (useJsonl)\n ctx.writeln(\n JSON.stringify({\n type: 'error',\n ok: false,\n error: {\n code: err.code,\n message: err.message,\n ...(err.retryable !== undefined ? { retryable: err.retryable } : undefined),\n },\n }),\n )\n else ctx.writeln(formatHumanError({ code: err.code, message: err.message }))\n ctx.exit(err.exitCode ?? 1)\n return\n }\n\n const cta =\n isSentinel(returnValue) && returnValue[sentinel] === 'ok'\n ? formatCtaBlock(ctx.name, (returnValue as OkResult).cta)\n : undefined\n\n if (useJsonl)\n ctx.writeln(\n JSON.stringify({\n type: 'done',\n ok: true,\n meta: {\n command: ctx.path,\n duration: `${Math.round(performance.now() - ctx.start)}ms`,\n ...(cta ? { cta } : undefined),\n },\n }),\n )\n else if (cta) ctx.writeln(formatHumanCta(cta))\n } catch (error) {\n if (useJsonl)\n ctx.writeln(\n JSON.stringify({\n type: 'error',\n ok: false,\n error: {\n code: error instanceof IncurError ? error.code : 'UNKNOWN',\n message: error instanceof Error ? error.message : String(error),\n },\n }),\n )\n else\n ctx.writeln(\n formatHumanError({\n code: 'UNKNOWN',\n message: error instanceof Error ? error.message : String(error),\n }),\n )\n ctx.exit(error instanceof IncurError ? (error.exitCode ?? 1) : 1)\n }\n } else {\n // Buffered output: collect all chunks, write as single value\n const chunks: unknown[] = []\n try {\n let returnValue: unknown\n while (true) {\n const { value, done } = await generator.next()\n if (done) {\n returnValue = value\n break\n }\n if (isSentinel(value)) {\n const tagged = value as any\n if (tagged[sentinel] === 'error') {\n ctx.write({\n ok: false,\n error: {\n code: tagged.code,\n message: tagged.message,\n ...(tagged.retryable !== undefined ? { retryable: tagged.retryable } : undefined),\n },\n meta: {\n command: ctx.path,\n duration: `${Math.round(performance.now() - ctx.start)}ms`,\n },\n })\n ctx.exit(tagged.exitCode ?? 1)\n return\n }\n }\n chunks.push(value)\n }\n\n if (isSentinel(returnValue) && returnValue[sentinel] === 'error') {\n const err = returnValue as ErrorResult\n ctx.write({\n ok: false,\n error: {\n code: err.code,\n message: err.message,\n ...(err.retryable !== undefined ? { retryable: err.retryable } : undefined),\n },\n meta: {\n command: ctx.path,\n duration: `${Math.round(performance.now() - ctx.start)}ms`,\n },\n })\n ctx.exit(err.exitCode ?? 1)\n return\n }\n\n const cta =\n isSentinel(returnValue) && returnValue[sentinel] === 'ok'\n ? formatCtaBlock(ctx.name, (returnValue as OkResult).cta)\n : undefined\n\n ctx.write({\n ok: true,\n data: chunks,\n meta: {\n command: ctx.path,\n duration: `${Math.round(performance.now() - ctx.start)}ms`,\n ...(cta ? { cta } : undefined),\n },\n })\n } catch (error) {\n ctx.write({\n ok: false,\n error: {\n code: error instanceof IncurError ? error.code : 'UNKNOWN',\n message: error instanceof Error ? error.message : String(error),\n },\n meta: {\n command: ctx.path,\n duration: `${Math.round(performance.now() - ctx.start)}ms`,\n },\n })\n ctx.exit(error instanceof IncurError ? (error.exitCode ?? 1) : 1)\n }\n }\n}\n\n/** @internal Formats a CTA block into the output envelope shape. */\nfunction formatCtaBlock(name: string, block: CtaBlock | undefined): FormattedCtaBlock | undefined {\n if (!block || block.commands.length === 0) return undefined\n return {\n description:\n block.description ??\n (block.commands.length === 1 ? 'Suggested command:' : 'Suggested commands:'),\n commands: block.commands.map((c) => formatCta(name, c)),\n }\n}\n\n/** @internal Formats a CTA by prefixing the CLI name. Handles string and object forms. */\nfunction formatCta(name: string, cta: Cta): FormattedCta {\n if (typeof cta === 'string') return { command: `${name} ${cta}` }\n const prefix = cta.command === name || cta.command.startsWith(`${name} `) ? '' : `${name} `\n let cmd = `${prefix}${cta.command}`\n if (cta.args)\n for (const [key, value] of Object.entries(cta.args))\n cmd += value === true ? ` <${key}>` : ` ${value}`\n if (cta.options)\n for (const [key, value] of Object.entries(cta.options))\n cmd += value === true ? ` --${key} <${key}>` : ` --${key} ${value}`\n return { command: cmd, ...(cta.description ? { description: cta.description } : undefined) }\n}\n\n/** @internal Builds the `--llms` index manifest (name + description only) from the command tree. */\nfunction buildIndexManifest(commands: Map<string, CommandEntry>, prefix: string[] = []) {\n return {\n version: 'incur.v1',\n commands: collectIndexCommands(commands, prefix).sort((a, b) => a.name.localeCompare(b.name)),\n }\n}\n\n/** @internal Recursively collects leaf commands with name + description only. */\nfunction collectIndexCommands(\n commands: Map<string, CommandEntry>,\n prefix: string[],\n): { name: string; description?: string | undefined }[] {\n const result: { name: string; description?: string | undefined }[] = []\n for (const [name, entry] of commands) {\n if (isAlias(entry)) continue\n const path = [...prefix, name]\n if (isGroup(entry)) {\n result.push(...collectIndexCommands(entry.commands, path))\n } else {\n const cmd: (typeof result)[number] = { name: path.join(' ') }\n if (isFetchGateway(entry)) {\n if (entry.description) cmd.description = entry.description\n } else if (entry.description) cmd.description = entry.description\n result.push(cmd)\n }\n }\n return result\n}\n\n/** @internal Builds the `--llms` manifest from the command tree. */\nfunction buildManifest(commands: Map<string, CommandEntry>, prefix: string[] = []) {\n return {\n version: 'incur.v1',\n commands: collectCommands(commands, prefix).sort((a, b) => a.name.localeCompare(b.name)),\n }\n}\n\n/** @internal Recursively collects leaf commands with their full paths. */\nfunction collectCommands(\n commands: Map<string, CommandEntry>,\n prefix: string[],\n): {\n name: string\n description?: string | undefined\n schema?: Record<string, unknown> | undefined\n examples?: { command: string; description?: string | undefined }[] | undefined\n}[] {\n const result: ReturnType<typeof collectCommands> = []\n for (const [name, entry] of commands) {\n if (isAlias(entry)) continue\n const path = [...prefix, name]\n if (isFetchGateway(entry)) {\n const cmd: (typeof result)[number] = { name: path.join(' ') }\n if (entry.description) cmd.description = entry.description\n result.push(cmd)\n } else if (isGroup(entry)) {\n result.push(...collectCommands(entry.commands, path))\n } else {\n const cmd: (typeof result)[number] = { name: path.join(' ') }\n if (entry.description) cmd.description = entry.description\n\n const inputSchema = buildInputSchema(entry.args, entry.env, entry.options)\n const outputSchema = entry.output ? Schema.toJsonSchema(entry.output) : undefined\n if (inputSchema || outputSchema) {\n cmd.schema = {}\n if (inputSchema?.args) cmd.schema.args = inputSchema.args\n if (inputSchema?.env) cmd.schema.env = inputSchema.env\n if (inputSchema?.options) cmd.schema.options = inputSchema.options\n if (outputSchema) cmd.schema.output = outputSchema\n }\n\n const examples = formatExamples(entry.examples)\n if (examples) {\n const cmdName = path.join(' ')\n cmd.examples = examples.map((e) => ({\n ...e,\n command: e.command ? `${cmdName} ${e.command}` : cmdName,\n }))\n }\n result.push(cmd)\n }\n }\n return result\n}\n\n/** @internal Recursively collects leaf commands as `Skill.CommandInfo` for `--llms --format md`. */\nfunction collectSkillCommands(\n commands: Map<string, CommandEntry>,\n prefix: string[],\n groups: Map<string, string>,\n rootCommand?: CommandDefinition<any, any, any> | undefined,\n): Skill.CommandInfo[] {\n const result: Skill.CommandInfo[] = []\n if (rootCommand) {\n const cmd: Skill.CommandInfo = {}\n if (rootCommand.description) cmd.description = rootCommand.description\n if (rootCommand.args) cmd.args = rootCommand.args\n if (rootCommand.env) cmd.env = rootCommand.env\n if (rootCommand.hint) cmd.hint = rootCommand.hint\n if (rootCommand.options) cmd.options = rootCommand.options\n if (rootCommand.output) cmd.output = rootCommand.output\n const examples = formatExamples(rootCommand.examples)\n if (examples) cmd.examples = examples\n result.push(cmd)\n }\n for (const [name, entry] of commands) {\n if (isAlias(entry)) continue\n const path = [...prefix, name]\n if (isFetchGateway(entry)) {\n const cmd: Skill.CommandInfo = { name: path.join(' ') }\n if (entry.description) cmd.description = entry.description\n cmd.hint = 'Fetch gateway. Pass path segments and curl-style flags (-X, -H, -d, --key value).'\n result.push(cmd)\n } else if (isGroup(entry)) {\n if (entry.description) groups.set(path.join(' '), entry.description)\n result.push(...collectSkillCommands(entry.commands, path, groups))\n } else {\n const cmd: Skill.CommandInfo = { name: path.join(' ') }\n if (entry.description) cmd.description = entry.description\n if (entry.args) cmd.args = entry.args\n if (entry.env) cmd.env = entry.env\n if (entry.hint) cmd.hint = entry.hint\n if (entry.options) cmd.options = entry.options\n if (entry.output) cmd.output = entry.output\n const examples = formatExamples(entry.examples)\n if (examples) {\n const cmdName = path.join(' ')\n cmd.examples = examples.map((e) => ({\n ...e,\n command: e.command ? `${cmdName} ${e.command}` : cmdName,\n }))\n }\n result.push(cmd)\n }\n }\n return result.sort((a, b) => (a.name ?? '').localeCompare(b.name ?? ''))\n}\n\n/** @internal Formats examples into `{ command, description }` objects. `command` is the args/options suffix only. */\nexport function formatExamples(\n examples: Example<any, any>[] | undefined,\n): { command: string; description?: string }[] | undefined {\n if (!examples || examples.length === 0) return undefined\n return examples.map((ex) => {\n const parts: string[] = []\n if (ex.args) for (const value of Object.values(ex.args)) parts.push(String(value))\n if (ex.options)\n for (const [key, value] of Object.entries(ex.options)) parts.push(`--${key} ${value}`)\n const result: { command: string; description?: string } = { command: parts.join(' ') }\n if (ex.description) result.description = ex.description\n return result\n })\n}\n\n/** @internal Builds separate args, env, and options JSON Schemas. */\nfunction buildInputSchema(\n args: z.ZodObject<any> | undefined,\n env: z.ZodObject<any> | undefined,\n options: z.ZodObject<any> | undefined,\n):\n | {\n args?: Record<string, unknown> | undefined\n env?: Record<string, unknown> | undefined\n options?: Record<string, unknown> | undefined\n }\n | undefined {\n if (!args && !env && !options) return undefined\n const result: {\n args?: Record<string, unknown> | undefined\n env?: Record<string, unknown> | undefined\n options?: Record<string, unknown> | undefined\n } = {}\n if (args) result.args = Schema.toJsonSchema(args)\n if (env) result.env = Schema.toJsonSchema(env)\n if (options) result.options = Schema.toJsonSchema(options)\n return result\n}\n\n/** @internal A usage example for a command, typed against its args and options schemas. */\ntype Example<\n args extends z.ZodObject<any> | undefined,\n options extends z.ZodObject<any> | undefined,\n> = {\n /** Positional arguments for this example. */\n args?: args extends z.ZodObject<any> ? Partial<z.output<args>> | undefined : undefined\n /** A short description of what this example demonstrates. */\n description?: string | undefined\n /** Named options for this example. */\n options?: options extends z.ZodObject<any> ? Partial<z.output<options>> | undefined : undefined\n}\n\n/** @internal A usage pattern shown in help output. */\ntype Usage<\n args extends z.ZodObject<any> | undefined,\n options extends z.ZodObject<any> | undefined,\n> = {\n /** Positional arguments to include. Use `true` to show as `<name>`. */\n args?: args extends z.ZodObject<any>\n ? Partial<Record<keyof z.output<args>, true>> | undefined\n : undefined\n /** Named options to include. Use `true` to show as `--name <name>`. */\n options?: options extends z.ZodObject<any>\n ? Partial<Record<keyof z.output<options>, true>> | undefined\n : undefined\n /** Text prepended before the command (e.g. `\"cat file.txt |\"`). */\n prefix?: string | undefined\n /** Text appended after the command (e.g. `\"| head\"`). */\n suffix?: string | undefined\n}\n\n/** @internal Inferred output type of a Zod schema, or `{}` when the schema is not provided. */\ntype InferOutput<schema extends z.ZodObject<any> | undefined> =\n schema extends z.ZodObject<any> ? z.output<schema> : {}\n\n/** @internal Inferred return type for a command handler. */\ntype InferReturn<output extends z.ZodType | undefined> = output extends z.ZodType\n ? z.output<output>\n : unknown\n\n/** @internal Inferred vars type from a Zod schema, or `{}` when no schema is provided. */\ntype InferVars<vars extends z.ZodObject<any> | undefined> =\n vars extends z.ZodObject<any> ? z.output<vars> : {}\n\n/** @internal The output envelope written to stdout. */\ntype Output = OneOf<\n | {\n /** The command's return data. */\n data: unknown\n /** Request metadata. */\n meta: Output.Meta\n /** Whether the command succeeded. */\n ok: true\n }\n | {\n /** Error details. */\n error: {\n /** Machine-readable error code. */\n code: string\n /** Per-field validation errors. */\n fieldErrors?: FieldError[] | undefined\n /** Human-readable error message. */\n message: string\n /** Whether the operation can be retried. */\n retryable?: boolean | undefined\n }\n /** Request metadata. */\n meta: Output.Meta\n /** Whether the command succeeded. */\n ok: false\n }\n>\n\n/** @internal */\ndeclare namespace Output {\n /** Shared metadata included in every envelope. */\n type Meta = {\n /** The command that was invoked. */\n command: string\n /** Suggested next commands. */\n cta?: FormattedCtaBlock | undefined\n /** Wall-clock duration of the command. */\n duration: string\n /** Offset to pass as `--token-offset` to fetch the next page of truncated output. */\n nextOffset?: number | undefined\n }\n}\n\n/** @internal Defines a command's schema, handler, and metadata. */\ntype CommandDefinition<\n args extends z.ZodObject<any> | undefined = undefined,\n env extends z.ZodObject<any> | undefined = undefined,\n options extends z.ZodObject<any> | undefined = undefined,\n output extends z.ZodType | undefined = undefined,\n vars extends z.ZodObject<any> | undefined = undefined,\n cliEnv extends z.ZodObject<any> | undefined = undefined,\n> = CommandMeta<options> & {\n /** Alternative names for this command (e.g. `['extensions', 'ext']` for an `extension` command). */\n aliases?: string[] | undefined\n /** Zod schema for positional arguments. */\n args?: args | undefined\n /** Zod schema for environment variables. Keys are the variable names (e.g. `NPM_TOKEN`). */\n env?: env | undefined\n /** Usage examples for this command. */\n examples?: Example<args, options>[] | undefined\n /** Default output format. Overridden by `--format` or `--json`. */\n format?: Formatter.Format | undefined\n /** Plain text hint displayed after examples and before global options. */\n hint?: string | undefined\n /** Zod schema for the command's return value. */\n output?: output | undefined\n /**\n * Controls when output data is displayed. Inherited by child commands when set on a group.\n *\n * - `'all'` — displays to both humans and agents.\n * - `'agent-only'` — suppresses data output in human/TTY mode while still returning it to agents.\n *\n * @default 'all'\n */\n outputPolicy?: OutputPolicy | undefined\n /** Middleware that runs only for this command, after root and group middleware. */\n middleware?: MiddlewareHandler<vars, cliEnv>[] | undefined\n /** Alternative usage patterns shown in help output. */\n usage?: Usage<args, options>[] | undefined\n /** The command handler. Return a value for single-return, or use `async *run` to stream chunks. */\n run(context: {\n /** Whether the consumer is an agent (stdout is not a TTY). */\n agent: boolean\n /** Positional arguments. */\n args: InferOutput<args>\n /** The binary name the user invoked (e.g. an alias). Falls back to `name` when not resolvable. */\n displayName: string\n /** Parsed environment variables. */\n env: InferOutput<env>\n /** Return an error result with optional CTAs. */\n error: (options: {\n code: string\n cta?: CtaBlock | undefined\n exitCode?: number | undefined\n message: string\n retryable?: boolean | undefined\n }) => never\n /** The resolved output format (e.g. `'toon'`, `'json'`, `'jsonl'`). */\n format: Formatter.Format\n /** Whether the user explicitly passed `--format` or `--json`. */\n formatExplicit: boolean\n /** The CLI name. */\n name: string\n /** Return a success result with optional metadata (e.g. CTAs). */\n ok: (data: InferReturn<output>, meta?: { cta?: CtaBlock | undefined }) => never\n options: InferOutput<options>\n /** Variables set by middleware. */\n var: InferVars<vars>\n /** The CLI version string. */\n version: string | undefined\n }):\n | InferReturn<output>\n | Promise<InferReturn<output>>\n | AsyncGenerator<InferReturn<output>, unknown, unknown>\n}\n\n/** @internal A formatted CTA block as it appears in the output envelope. */\ntype FormattedCtaBlock = {\n /** Formatted command suggestions. */\n commands: FormattedCta[]\n /** Human-readable label for the CTA block. */\n description: string\n}\n\n/** @internal A formatted CTA as it appears in the output envelope. */\ntype FormattedCta = {\n /** The full command string with args and options folded in. */\n command: string\n /** A short description of what the command does. */\n description?: string | undefined\n}\n\n/** @internal Scans argv for deprecated flags and writes warnings to stderr. */\nfunction emitDeprecationWarnings(\n argv: string[],\n optionsSchema: z.ZodObject<any> | undefined,\n alias?: Record<string, string> | undefined,\n) {\n if (!optionsSchema) return\n const shape = optionsSchema.shape as Record<string, any>\n const deprecatedFlags = new Set<string>()\n const deprecatedShorts = new Map<string, string>()\n for (const key of Object.keys(shape)) {\n const meta = shape[key]?.meta?.()\n if (meta?.deprecated) {\n const kebab = key.replace(/[A-Z]/g, (c: string) => `-${c.toLowerCase()}`)\n deprecatedFlags.add(kebab)\n if (alias?.[key]) deprecatedShorts.set(alias[key]!, kebab)\n }\n }\n if (deprecatedFlags.size === 0) return\n for (const token of argv) {\n if (token.startsWith('--')) {\n const stripped = token.split('=')[0]!.slice(2)\n const raw =\n !deprecatedFlags.has(stripped) && stripped.startsWith('no-') ? stripped.slice(3) : stripped\n if (deprecatedFlags.has(raw)) process.stderr.write(`Warning: --${raw} is deprecated\\n`)\n } else if (token.startsWith('-') && token.length >= 2) {\n for (const ch of token.slice(1))\n if (deprecatedShorts.has(ch))\n process.stderr.write(`Warning: --${deprecatedShorts.get(ch)} is deprecated\\n`)\n }\n }\n}\n\n/** @internal Resolves the display name from `process.argv[1]` basename. Returns the basename if it matches `name` or one of the `aliases`, otherwise falls back to `name`. */\nfunction resolveDisplayName(name: string, aliases?: string[]): string {\n const bin = process.argv[1]\n if (!bin) return name\n const basename = path.basename(bin)\n if (basename === name) return name\n if (aliases?.includes(basename)) return basename\n return name\n}\n","//#region src/index.ts\nconst PATTERNS = {\n\twhitespace: /^\\s+$/,\n\tcjk: /[\\u4E00-\\u9FFF\\u3400-\\u4DBF\\u3000-\\u303F\\uFF00-\\uFFEF\\u30A0-\\u30FF\\u2E80-\\u2EFF\\u31C0-\\u31EF\\u3200-\\u32FF\\u3300-\\u33FF\\uAC00-\\uD7AF\\u1100-\\u11FF\\u3130-\\u318F\\uA960-\\uA97F\\uD7B0-\\uD7FF]/,\n\tnumeric: /^\\d+(?:[.,]\\d+)*$/,\n\tpunctuation: /[.,!?;(){}[\\]<>:/\\\\|@#$%^&*+=`~_-]/,\n\talphanumeric: /^[a-zA-Z0-9\\u00C0-\\u00D6\\u00D8-\\u00F6\\u00F8-\\u00FF]+$/\n};\nconst TOKEN_SPLIT_PATTERN = /* @__PURE__ */ new RegExp(`(\\\\s+|${PATTERNS.punctuation.source}+)`);\nconst DEFAULT_CHARS_PER_TOKEN = 6;\nconst SHORT_TOKEN_THRESHOLD = 3;\nconst DEFAULT_LANGUAGE_CONFIGS = [\n\t{\n\t\tpattern: /[äöüßẞ]/i,\n\t\taverageCharsPerToken: 3\n\t},\n\t{\n\t\tpattern: /[éèêëàâîïôûùüÿçœæáíóúñ]/i,\n\t\taverageCharsPerToken: 3\n\t},\n\t{\n\t\tpattern: /[ąćęłńóśźżěščřžýůúďťň]/i,\n\t\taverageCharsPerToken: 3.5\n\t}\n];\n/**\n* Checks if a text string is within a specified token limit\n*/\nfunction isWithinTokenLimit(text, tokenLimit, options) {\n\treturn estimateTokenCount(text, options) <= tokenLimit;\n}\n/** @deprecated Use `estimateTokenCount` instead */\nconst approximateTokenSize = estimateTokenCount;\n/**\n* Estimates the number of tokens in a text string using heuristic rules.\n*/\nfunction estimateTokenCount(text, options = {}) {\n\tif (!text) return 0;\n\tconst { defaultCharsPerToken = DEFAULT_CHARS_PER_TOKEN, languageConfigs = DEFAULT_LANGUAGE_CONFIGS } = options;\n\tconst segments = text.split(TOKEN_SPLIT_PATTERN).filter(Boolean);\n\tlet tokenCount = 0;\n\tfor (const segment of segments) tokenCount += estimateSegmentTokens(segment, languageConfigs, defaultCharsPerToken);\n\treturn tokenCount;\n}\n/**\n* Extracts a portion of text based on token positions, similar to Array.prototype.slice().\n*/\nfunction sliceByTokens(text, start = 0, end, options = {}) {\n\tif (!text) return \"\";\n\tconst { defaultCharsPerToken = DEFAULT_CHARS_PER_TOKEN, languageConfigs = DEFAULT_LANGUAGE_CONFIGS } = options;\n\tlet totalTokens = 0;\n\tif (start < 0 || end !== void 0 && end < 0) totalTokens = estimateTokenCount(text, options);\n\tconst normalizedStart = start < 0 ? Math.max(0, totalTokens + start) : Math.max(0, start);\n\tconst normalizedEnd = end === void 0 ? Infinity : end < 0 ? Math.max(0, totalTokens + end) : end;\n\tif (normalizedStart >= normalizedEnd) return \"\";\n\tconst segments = text.split(TOKEN_SPLIT_PATTERN).filter(Boolean);\n\tconst parts = [];\n\tlet currentTokenPos = 0;\n\tfor (const segment of segments) {\n\t\tif (currentTokenPos >= normalizedEnd) break;\n\t\tconst tokenCount = estimateSegmentTokens(segment, languageConfigs, defaultCharsPerToken);\n\t\tconst extracted = extractSegmentPart(segment, currentTokenPos, tokenCount, normalizedStart, normalizedEnd);\n\t\tif (extracted) parts.push(extracted);\n\t\tcurrentTokenPos += tokenCount;\n\t}\n\treturn parts.join(\"\");\n}\n/**\n* Splits text into chunks based on token count.\n*/\nfunction splitByTokens(text, tokensPerChunk, options = {}) {\n\tif (!text || tokensPerChunk <= 0) return [];\n\tconst { defaultCharsPerToken = DEFAULT_CHARS_PER_TOKEN, languageConfigs = DEFAULT_LANGUAGE_CONFIGS, overlap = 0 } = options;\n\tconst segments = text.split(TOKEN_SPLIT_PATTERN).filter(Boolean);\n\tconst chunks = [];\n\tlet currentChunk = [];\n\tlet currentTokenCount = 0;\n\tfor (const segment of segments) {\n\t\tconst tokenCount = estimateSegmentTokens(segment, languageConfigs, defaultCharsPerToken);\n\t\tcurrentChunk.push(segment);\n\t\tcurrentTokenCount += tokenCount;\n\t\tif (currentTokenCount >= tokensPerChunk) {\n\t\t\tchunks.push(currentChunk.join(\"\"));\n\t\t\tif (overlap > 0) {\n\t\t\t\tconst overlapSegments = [];\n\t\t\t\tlet overlapTokenCount = 0;\n\t\t\t\tfor (let i = currentChunk.length - 1; i >= 0 && overlapTokenCount < overlap; i--) {\n\t\t\t\t\tconst segmentValue = currentChunk[i];\n\t\t\t\t\tconst tokCount = estimateSegmentTokens(segmentValue, languageConfigs, defaultCharsPerToken);\n\t\t\t\t\toverlapSegments.unshift(segmentValue);\n\t\t\t\t\toverlapTokenCount += tokCount;\n\t\t\t\t}\n\t\t\t\tcurrentChunk = overlapSegments;\n\t\t\t\tcurrentTokenCount = overlapTokenCount;\n\t\t\t} else {\n\t\t\t\tcurrentChunk = [];\n\t\t\t\tcurrentTokenCount = 0;\n\t\t\t}\n\t\t}\n\t}\n\tif (currentChunk.length > 0) chunks.push(currentChunk.join(\"\"));\n\treturn chunks;\n}\nfunction estimateSegmentTokens(segment, languageConfigs, defaultCharsPerToken) {\n\tif (PATTERNS.whitespace.test(segment)) return 0;\n\tif (PATTERNS.cjk.test(segment)) return getCharacterCount(segment);\n\tif (PATTERNS.numeric.test(segment)) return 1;\n\tif (segment.length <= SHORT_TOKEN_THRESHOLD) return 1;\n\tif (PATTERNS.punctuation.test(segment)) return segment.length > 1 ? Math.ceil(segment.length / 2) : 1;\n\tif (PATTERNS.alphanumeric.test(segment)) {\n\t\tconst charsPerToken$1 = getLanguageSpecificCharsPerToken(segment, languageConfigs) ?? defaultCharsPerToken;\n\t\treturn Math.ceil(segment.length / charsPerToken$1);\n\t}\n\tconst charsPerToken = getLanguageSpecificCharsPerToken(segment, languageConfigs) ?? defaultCharsPerToken;\n\treturn Math.ceil(segment.length / charsPerToken);\n}\nfunction getLanguageSpecificCharsPerToken(segment, languageConfigs) {\n\tfor (const config of languageConfigs) if (config.pattern.test(segment)) return config.averageCharsPerToken;\n}\nfunction getCharacterCount(text) {\n\treturn Array.from(text).length;\n}\nfunction extractSegmentPart(segment, segmentTokenStart, segmentTokenCount, targetStart, targetEnd) {\n\tif (segmentTokenCount === 0) return segmentTokenStart >= targetStart && segmentTokenStart < targetEnd ? segment : \"\";\n\tconst segmentTokenEnd = segmentTokenStart + segmentTokenCount;\n\tif (segmentTokenStart >= targetEnd || segmentTokenEnd <= targetStart) return \"\";\n\tconst overlapStart = Math.max(0, targetStart - segmentTokenStart);\n\tconst overlapEnd = Math.min(segmentTokenCount, targetEnd - segmentTokenStart);\n\tif (overlapStart === 0 && overlapEnd === segmentTokenCount) return segment;\n\tconst charStart = Math.floor(overlapStart / segmentTokenCount * segment.length);\n\tconst charEnd = Math.ceil(overlapEnd / segmentTokenCount * segment.length);\n\treturn segment.slice(charStart, charEnd);\n}\n\n//#endregion\nexport { approximateTokenSize, estimateTokenCount, isWithinTokenLimit, sliceByTokens, splitByTokens };","import type { z } from 'zod'\n\nimport type { Shell } from './internal/command.js'\n\n/** A completion candidate with an optional description. */\nexport type Candidate = {\n /** Optional description shown alongside the candidate. */\n description?: string | undefined\n /** When true, the shell should not append a trailing space after this candidate. */\n noSpace?: boolean | undefined\n /** The completion value. */\n value: string\n}\n\n/** @internal Entry stored in a command map — either a leaf definition, a group, or an alias. */\ntype CommandEntry = {\n _alias?: true | undefined\n _group?: true | undefined\n alias?: Record<string, string | undefined> | undefined\n args?: z.ZodObject<any> | undefined\n commands?: Map<string, CommandEntry> | undefined\n description?: string | undefined\n options?: z.ZodObject<any> | undefined\n target?: string | undefined\n}\n\n/**\n * Generates a shell hook script that registers dynamic completions for the CLI.\n * The hook calls back into the binary with `COMPLETE=<shell>` at every tab press.\n */\nexport function register(shell: Shell, name: string): string {\n switch (shell) {\n case 'bash':\n return bashRegister(name)\n case 'zsh':\n return zshRegister(name)\n case 'fish':\n return fishRegister(name)\n case 'nushell':\n return nushellRegister(name)\n }\n}\n\n/**\n * Computes completion candidates for the given argv words and cursor index.\n * Walks the command tree to resolve the active command, then suggests\n * subcommands, options, or positional argument hints.\n */\nexport function complete(\n commands: Map<string, CommandEntry>,\n rootCommand: CommandEntry | undefined,\n argv: string[],\n index: number,\n): Candidate[] {\n const current = argv[index] ?? ''\n\n // Walk argv tokens up to (but not including) the cursor word to resolve the active scope\n let scope: { commands: Map<string, CommandEntry>; leaf?: CommandEntry | undefined } = {\n commands,\n leaf: rootCommand,\n }\n\n for (let i = 0; i < index; i++) {\n const token = argv[i]!\n if (token.startsWith('-')) continue\n let entry = scope.commands.get(token)\n if (!entry) continue\n // Follow alias to canonical entry\n if (entry._alias && entry.target) entry = scope.commands.get(entry.target)\n if (!entry) continue\n if (entry._group && entry.commands) {\n scope = { commands: entry.commands }\n } else {\n scope = { commands: new Map(), leaf: entry }\n break\n }\n }\n\n const candidates: Candidate[] = []\n\n // If cursor word starts with '-', suggest options from the active leaf command\n if (current.startsWith('-')) {\n const leaf = scope.leaf\n if (leaf?.options) {\n const shape = leaf.options.shape as Record<string, any>\n for (const key of Object.keys(shape)) {\n const kebab = key.replace(/[A-Z]/g, (c: string) => `-${c.toLowerCase()}`)\n const flag = `--${kebab}`\n if (flag.startsWith(current))\n candidates.push({ value: flag, description: descriptionOf(shape[key]) })\n }\n // Short aliases\n if (leaf.alias)\n for (const [name, short] of Object.entries(leaf.alias)) {\n const flag = `-${short}`\n if (flag.startsWith(current)) {\n const desc = descriptionOf(shape[name])\n candidates.push({ value: flag, description: desc })\n }\n }\n }\n return candidates\n }\n\n // Check if previous token is a non-boolean option expecting a value\n if (index > 0) {\n const prev = argv[index - 1]!\n const leaf = scope.leaf\n if (leaf?.options && prev.startsWith('-')) {\n const name = resolveOptionName(prev, leaf)\n if (name) {\n const values = possibleValues(name, leaf.options)\n if (values) {\n for (const v of values) if (v.startsWith(current)) candidates.push({ value: v })\n return candidates\n }\n if (!isBooleanOption(name, leaf.options)) return candidates\n }\n }\n }\n\n // Suggest subcommands (groups get noSpace so user can keep typing subcommand)\n for (const [name, entry] of scope.commands) {\n if (entry._alias) continue\n if (name.startsWith(current))\n candidates.push({\n value: name,\n description: entry.description,\n ...(entry._group ? { noSpace: true } : undefined),\n })\n }\n\n return candidates\n}\n\n/**\n * Formats completion candidates into shell-specific output.\n * - bash: `\\013`-separated values (noSpace candidates end with `\\001`)\n * - zsh: `value:description` newline-separated (`:` escaped in values)\n * - fish: `value\\tdescription` newline-separated\n * - nushell: JSON array of `{value, description}` records\n */\nexport function format(shell: Shell, candidates: Candidate[]): string {\n switch (shell) {\n case 'bash': {\n return candidates.map((c) => (c.noSpace ? `${c.value}\\x01` : c.value)).join('\\v')\n }\n case 'zsh': {\n return candidates\n .map((c) => {\n const escaped = c.value.replaceAll(':', '\\\\:')\n return c.description ? `${escaped}:${c.description}` : escaped\n })\n .join('\\n')\n }\n case 'fish': {\n return candidates\n .map((c) => (c.description ? `${c.value}\\t${c.description}` : c.value))\n .join('\\n')\n }\n case 'nushell': {\n const records = candidates.map((c) => {\n const record: { value: string; description?: string } = { value: c.value }\n if (c.description) record.description = c.description\n return record\n })\n return JSON.stringify(records)\n }\n }\n}\n\n/** @internal Resolves a flag token (e.g. `--foo-bar` or `-f`) to its camelCase option name. */\nfunction resolveOptionName(token: string, entry: CommandEntry): string | undefined {\n if (!entry.options) return undefined\n const known = new Set(Object.keys(entry.options.shape))\n const kebabToCamel = new Map<string, string>()\n for (const name of known) {\n const kebab = name.replace(/[A-Z]/g, (c: string) => `-${c.toLowerCase()}`)\n if (kebab !== name) kebabToCamel.set(kebab, name)\n }\n\n if (token.startsWith('--')) {\n const raw = token.slice(2)\n const name = kebabToCamel.get(raw) ?? raw\n return known.has(name) ? name : undefined\n }\n if (token.startsWith('-') && token.length === 2 && entry.alias) {\n const short = token.slice(1)\n for (const [name, alias] of Object.entries(entry.alias)) if (alias === short) return name\n }\n return undefined\n}\n\n/** @internal Checks if an option's inner type is boolean or count. */\nfunction isBooleanOption(name: string, schema: z.ZodObject<any>): boolean {\n const field = schema.shape[name]\n if (!field) return false\n if (typeof field.meta === 'function' && field.meta()?.count === true) return true\n return unwrap(field).constructor.name === 'ZodBoolean'\n}\n\n/** @internal Extracts possible values from enum schemas. */\nfunction possibleValues(name: string, schema: z.ZodObject<any>): string[] | undefined {\n const field = schema.shape[name]\n if (!field) return undefined\n const inner = unwrap(field)\n if (inner.constructor.name === 'ZodEnum') return Object.values((inner as any)._zod.def.entries)\n if (inner.constructor.name === 'ZodNativeEnum') return Object.keys((inner as any)._zod.def.values)\n return undefined\n}\n\n/** @internal Unwraps ZodDefault/ZodOptional to get the inner type. */\nfunction unwrap(schema: z.ZodType): z.ZodType {\n let s = schema as any\n while (s._zod?.def?.innerType) s = s._zod.def.innerType\n return s\n}\n\n/** @internal Extracts a description from a Zod schema's metadata. */\nfunction descriptionOf(schema: z.ZodType | undefined): string | undefined {\n if (!schema) return undefined\n return (schema as any).description\n}\n\n// ---------------------------------------------------------------------------\n// Shell registration scripts\n// ---------------------------------------------------------------------------\n\n/** @internal Sanitizes a CLI name into a valid shell identifier. */\nfunction ident(name: string): string {\n return name.replace(/[^a-zA-Z0-9_]/g, '_')\n}\n\nfunction bashRegister(name: string): string {\n const id = ident(name)\n return `_incur_complete_${id}() {\n local IFS=$'\\\\013'\n local _COMPLETE_INDEX=\\${COMP_CWORD}\n local _completions\n _completions=( $(\n export COMPLETE=\"bash\"\n export _COMPLETE_INDEX=\"$_COMPLETE_INDEX\"\n \"${name}\" -- \"\\${COMP_WORDS[@]}\"\n ) )\n if [[ $? != 0 ]]; then\n unset COMPREPLY\n return\n fi\n local _nospace=false\n COMPREPLY=()\n for _c in \"\\${_completions[@]}\"; do\n if [[ \"$_c\" == *$'\\\\001' ]]; then\n _nospace=true\n COMPREPLY+=(\"\\${_c%$'\\\\001'}\")\n else\n COMPREPLY+=(\"$_c\")\n fi\n done\n if [[ $_nospace == true ]]; then\n compopt -o nospace\n fi\n}\ncomplete -o default -o bashdefault -o nosort -F _incur_complete_${id} ${name}`\n}\n\nfunction zshRegister(name: string): string {\n const id = ident(name)\n return `#compdef ${name}\n_incur_complete_${id}() {\n local completions=(\"\\${(@f)$(\n export _COMPLETE_INDEX=$(( CURRENT - 1 ))\n export COMPLETE=\"zsh\"\n \"${name}\" -- \"\\${words[@]}\" 2>/dev/null\n )}\")\n if [[ -n $completions ]]; then\n _describe 'values' completions -S ''\n fi\n}\ncompdef _incur_complete_${id} ${name}`\n}\n\nfunction fishRegister(name: string): string {\n return `complete --keep-order --exclusive --command ${name} \\\\\n --arguments \"(COMPLETE=fish ${name} -- (commandline --current-process --tokenize --cut-at-cursor) (commandline --current-token))\"`\n}\n\nfunction nushellRegister(name: string): string {\n const id = ident(name)\n return `# External completer for ${name}\n# Add to $env.config.completions.external.completer or use in a dispatch completer.\nlet _incur_complete_${id} = {|spans|\n COMPLETE=nushell ${name} -- ...$spans | from json\n}`\n}\n","/** Base error with shortMessage, details from cause chain, and walk(). */\nexport class BaseError extends Error {\n override name = 'Incur.BaseError'\n /** The short, human-readable error message (without details). */\n shortMessage: string\n /** Details extracted from the cause's message, if any. */\n details: string | undefined\n\n constructor(shortMessage: string, options: BaseError.Options = {}) {\n const details = options.cause instanceof Error ? options.cause.message : undefined\n const message = details ? `${shortMessage}\\n\\nDetails: ${details}` : shortMessage\n super(message, options.cause ? { cause: options.cause } : undefined)\n this.shortMessage = shortMessage\n this.details = details\n }\n\n /**\n * Traverses the cause chain.\n * Without a callback, returns the deepest cause.\n * With a callback, returns the first cause where `fn` returns `true`.\n */\n walk(fn?: ((error: unknown) => boolean) | undefined): unknown {\n return walk(this, fn)\n }\n}\n\nexport declare namespace BaseError {\n /** Options for constructing a BaseError. */\n type Options = {\n /** The underlying cause of this error. */\n cause?: Error | undefined\n }\n}\n\n/** CLI error with code, hint, and retryable flag. */\nexport class IncurError extends BaseError {\n override name = 'Incur.IncurError'\n /** Machine-readable error code (e.g. `'NOT_AUTHENTICATED'`). */\n code: string\n /** Actionable hint for the user. */\n hint: string | undefined\n /** Whether the operation can be retried. */\n retryable: boolean\n /** Process exit code. When set, `serve()` uses this instead of `1`. */\n exitCode: number | undefined\n\n constructor(options: IncurError.Options) {\n super(options.message, options.cause ? { cause: options.cause } : undefined)\n this.code = options.code\n this.hint = options.hint\n this.retryable = options.retryable ?? false\n this.exitCode = options.exitCode\n }\n}\n\nexport declare namespace IncurError {\n /** Options for constructing a IncurError. */\n type Options = {\n /** Machine-readable error code. */\n code: string\n /** Human-readable error message. */\n message: string\n /** Actionable hint for the user. */\n hint?: string | undefined\n /** Whether the operation can be retried. Defaults to `false`. */\n retryable?: boolean | undefined\n /** Process exit code. When set, `serve()` uses this instead of `1`. */\n exitCode?: number | undefined\n /** The underlying cause. */\n cause?: Error | undefined\n }\n}\n\n/** A field-level validation error detail. */\nexport type FieldError = {\n /** The Zod issue code. */\n code?: string | undefined\n /** Whether the input was missing entirely. */\n missing?: boolean | undefined\n /** The field path that failed validation. */\n path: string\n /** The expected value or type. */\n expected: string\n /** The value that was received. */\n received: string\n /** Human-readable validation message. */\n message: string\n}\n\n/** Validation error with per-field error details. */\nexport class ValidationError extends BaseError {\n override name = 'Incur.ValidationError'\n /** Per-field validation errors. */\n fieldErrors: FieldError[]\n\n constructor(options: ValidationError.Options) {\n super(options.message, options.cause ? { cause: options.cause } : undefined)\n this.fieldErrors = options.fieldErrors ?? []\n }\n}\n\nexport declare namespace ValidationError {\n /** Options for constructing a ValidationError. */\n type Options = {\n /** Human-readable error message. */\n message: string\n /** Per-field validation errors. */\n fieldErrors?: FieldError[] | undefined\n /** The underlying cause. */\n cause?: Error | undefined\n }\n}\n\n/** Error thrown when argument parsing fails (unknown flags, missing values). */\nexport class ParseError extends BaseError {\n override name = 'Incur.ParseError'\n\n constructor(options: ParseError.Options) {\n super(options.message, options.cause ? { cause: options.cause } : undefined)\n }\n}\n\nexport declare namespace ParseError {\n /** Options for constructing a ParseError. */\n type Options = {\n /** Human-readable error message. */\n message: string\n /** The underlying cause. */\n cause?: Error | undefined\n }\n}\n\n/** Walks the cause chain, returning the deepest cause or the first matching cause. */\nfunction walk(error: unknown, fn?: ((error: unknown) => boolean) | undefined): unknown {\n if (fn) {\n // Find first matching cause (not self)\n let current = (error as any)?.cause\n while (current) {\n if (fn(current)) return current\n current = (current as any)?.cause\n }\n return undefined\n }\n // Return deepest cause\n let current = error\n while ((current as any)?.cause) current = (current as any).cause\n return current\n}\n","/** Structured input parsed from curl-style argv. */\nexport type FetchInput = {\n body: string | undefined\n headers: Headers\n method: string\n path: string\n query: URLSearchParams\n}\n\n/** Structured output from a fetch Response. */\nexport type FetchOutput = {\n data: unknown\n headers: Headers\n ok: boolean\n status: number\n}\n\n/** A standard Fetch API handler. */\nexport type Handler = (req: Request) => Response | Promise<Response>\n\n/** Fetch source accepted by fetch-backed CLI commands. */\nexport type Source = Handler | RequestSource\n\n/** Hosted request source created from a base URL. */\nexport type RequestSource = {\n /** Handles a forwarded request. */\n fetch: Handler\n /** Base URL used to resolve relative OpenAPI documents. */\n url: URL\n}\n\n/** Reserved flags consumed by the fetch gateway (not forwarded as query params). */\nconst reservedFlags = new Set(['method', 'body', 'data', 'header'])\nconst reservedShort: Record<string, string> = { X: 'method', d: 'data', H: 'header' }\n\n/** Creates a hosted fetch source from a base request URL and shared request options. */\nexport function fromRequest(url: string | URL, options: fromRequest.Options = {}): RequestSource {\n const base = new URL(url)\n const { headers: defaultHeaders, ...init } = options\n\n return {\n url: base,\n fetch(request) {\n const incoming = new URL(request.url)\n const target = new URL(base)\n target.pathname = joinPath(base.pathname, incoming.pathname)\n target.search = incoming.search\n\n const headers = new Headers(defaultHeaders)\n request.headers.forEach((value, key) => headers.set(key, value))\n\n return fetch(new Request(new Request(target, request), { ...init, headers }))\n },\n }\n}\n\nexport declare namespace fromRequest {\n /** Request options applied to every forwarded request. */\n type Options = Omit<RequestInit, 'body' | 'headers' | 'method'> & {\n /** Headers merged into every forwarded request. Per-request headers take precedence. */\n headers?: HeadersInit | undefined\n }\n}\n\nfunction joinPath(basePath: string, path: string) {\n const prefix = basePath.endsWith('/') ? basePath.slice(0, -1) : basePath\n const suffix = path.startsWith('/') ? path : `/${path}`\n return `${prefix}${suffix}` || '/'\n}\n\n/** Parses curl-style argv into a structured fetch input. */\nexport function parseArgv(argv: string[]): FetchInput {\n const segments: string[] = []\n const headers = new Headers()\n const query = new URLSearchParams()\n let method: string | undefined\n let body: string | undefined\n\n let i = 0\n while (i < argv.length) {\n const token = argv[i]!\n\n if (token.startsWith('--')) {\n const eqIdx = token.indexOf('=')\n if (eqIdx !== -1) {\n // --key=value\n const key = token.slice(2, eqIdx)\n const value = token.slice(eqIdx + 1)\n if (reservedFlags.has(key)) handleReserved(key, value)\n else query.set(key, value)\n i++\n } else {\n const key = token.slice(2)\n const value = argv[i + 1]\n if (value === undefined) throw new Error(`Missing value for --${key}`)\n if (reservedFlags.has(key)) handleReserved(key, value)\n else query.set(key, value)\n i += 2\n }\n } else if (token.startsWith('-') && token.length === 2) {\n const short = token[1]!\n const mapped = reservedShort[short]\n if (mapped) {\n const value = argv[i + 1]\n if (value === undefined) throw new Error(`Missing value for -${short}`)\n handleReserved(mapped, value)\n i += 2\n } else {\n // Unknown short flag — treat as single token, don't consume next\n i++\n }\n } else {\n segments.push(token)\n i++\n }\n }\n\n function handleReserved(key: string, value: string) {\n if (key === 'method') method = value.toUpperCase()\n else if (key === 'body' || key === 'data') body = value\n else if (key === 'header') {\n const colonIdx = value.indexOf(':')\n if (colonIdx !== -1) {\n const name = value.slice(0, colonIdx).trim()\n const val = value.slice(colonIdx + 1).trim()\n headers.set(name, val)\n }\n }\n }\n\n return {\n path: segments.length > 0 ? `/${segments.join('/')}` : '/',\n method: method ?? (body !== undefined ? 'POST' : 'GET'),\n headers,\n body,\n query,\n }\n}\n\n/** Constructs a standard Request from a FetchInput. */\nexport function buildRequest(input: FetchInput): Request {\n const url = new URL(input.path, 'http://localhost')\n input.query.forEach((value, key) => url.searchParams.set(key, value))\n\n const init: RequestInit = {\n method: input.method,\n headers: input.headers,\n }\n\n if (input.body !== undefined) {\n init.body = input.body\n if (!input.headers.has('content-type')) input.headers.set('content-type', 'application/json')\n }\n\n return new Request(url.toString(), init)\n}\n\n/** Returns true if the response body is a stream that should be consumed incrementally. */\nexport function isStreamingResponse(response: Response): boolean {\n return response.body !== null && response.headers.get('content-type') === 'application/x-ndjson'\n}\n\n/** Parses a streaming response body as an async generator of parsed NDJSON chunks. */\nexport async function* parseStreamingResponse(\n response: Response,\n): AsyncGenerator<unknown, void, unknown> {\n const reader = response.body!.getReader()\n const decoder = new TextDecoder()\n let buffer = ''\n\n while (true) {\n const { value, done } = await reader.read()\n if (done) break\n buffer += decoder.decode(value, { stream: true })\n\n let newlineIdx: number\n while ((newlineIdx = buffer.indexOf('\\n')) !== -1) {\n const line = buffer.slice(0, newlineIdx).trim()\n buffer = buffer.slice(newlineIdx + 1)\n if (line.length === 0) continue\n try {\n yield JSON.parse(line)\n } catch {\n yield line\n }\n }\n }\n\n // flush remaining buffer\n const remaining = buffer.trim()\n if (remaining.length > 0) {\n try {\n yield JSON.parse(remaining)\n } catch {\n yield remaining\n }\n }\n}\n\n/** Parses a fetch Response into structured output. */\nexport async function parseResponse(response: Response): Promise<FetchOutput> {\n const text = await response.text()\n let data: unknown\n try {\n data = JSON.parse(text)\n } catch {\n data = text\n }\n\n return {\n ok: response.ok,\n status: response.status,\n data,\n headers: response.headers,\n }\n}\n","/** A single segment in a filter path: either a string key or an array slice. */\nexport type Segment = { key: string } | { start: number; end: number }\n\n/** A filter path is an ordered list of segments to traverse. */\nexport type FilterPath = Segment[]\n\n/** Parses a filter expression string into structured filter paths. */\nexport function parse(expression: string): FilterPath[] {\n const paths: FilterPath[] = []\n const tokens: string[] = []\n let current = ''\n let depth = 0\n\n // Split on commas, but commas inside [...] are part of a slice\n for (let i = 0; i < expression.length; i++) {\n const ch = expression[i]!\n if (ch === '[') depth++\n else if (ch === ']') depth--\n\n if (ch === ',' && depth === 0) {\n tokens.push(current)\n current = ''\n } else current += ch\n }\n if (current) tokens.push(current)\n\n for (const token of tokens) {\n const path: FilterPath = []\n let remaining = token\n\n while (remaining.length > 0) {\n const bracketIdx = remaining.indexOf('[')\n\n if (bracketIdx === -1) {\n // No more slices — split remaining by dots\n for (const part of remaining.split('.')) if (part) path.push({ key: part })\n break\n }\n\n // Parse dot-separated keys before the bracket\n const before = remaining.slice(0, bracketIdx)\n for (const part of before.split('.')) if (part) path.push({ key: part })\n\n // Parse the slice [start,end]\n const closeBracket = remaining.indexOf(']', bracketIdx)\n const inner = remaining.slice(bracketIdx + 1, closeBracket)\n const [startStr, endStr] = inner.split(',')\n path.push({ start: Number(startStr), end: Number(endStr) })\n\n remaining = remaining.slice(closeBracket + 1)\n if (remaining.startsWith('.')) remaining = remaining.slice(1)\n }\n\n paths.push(path)\n }\n\n return paths\n}\n\n/** Applies parsed filter paths to a data value, returning a filtered copy. */\nexport function apply(data: unknown, paths: FilterPath[]): unknown {\n if (paths.length === 0) return data\n\n // Single key selecting a scalar → return the scalar directly\n if (paths.length === 1 && paths[0]!.length === 1 && 'key' in paths[0]![0]!) {\n const key = paths[0]![0]!.key\n if (Array.isArray(data)) return data.map((item) => apply(item, paths))\n if (typeof data === 'object' && data !== null) {\n const val = (data as Record<string, unknown>)[key]\n if (typeof val !== 'object' || val === null) return val\n return { [key]: val }\n }\n return undefined\n }\n\n if (Array.isArray(data)) return data.map((item) => apply(item, paths))\n\n const result: Record<string, unknown> = {}\n for (const path of paths) merge(result, data, path, 0)\n return result\n}\n\nfunction merge(\n target: Record<string, unknown>,\n data: unknown,\n segments: Segment[],\n index: number,\n): void {\n if (index >= segments.length || typeof data !== 'object' || data === null) return\n const segment = segments[index]!\n\n if ('key' in segment) {\n const val = (data as Record<string, unknown>)[segment.key]\n if (val === undefined) return\n\n if (index + 1 >= segments.length) {\n target[segment.key] = val\n return\n }\n\n const next = segments[index + 1]!\n if ('start' in next) {\n // Next segment is a slice\n if (!Array.isArray(val)) return\n const sliced = val.slice(next.start, next.end)\n if (index + 2 >= segments.length) {\n target[segment.key] = sliced\n return\n }\n target[segment.key] = sliced.map((item) => {\n const sub: Record<string, unknown> = {}\n merge(sub, item, segments, index + 2)\n return sub\n })\n return\n }\n\n // Next segment is a key — recurse into nested object\n if (typeof val !== 'object' || val === null) return\n if (!target[segment.key] || typeof target[segment.key] !== 'object') target[segment.key] = {}\n merge(target[segment.key] as Record<string, unknown>, val, segments, index + 1)\n return\n }\n\n // slice at root level — shouldn't happen in merge (merge starts from object keys)\n}\n","const NULL_LITERAL = \"null\";\nconst DELIMITERS = {\n\tcomma: \",\",\n\ttab: \"\t\",\n\tpipe: \"|\"\n};\nconst DEFAULT_DELIMITER = DELIMITERS.comma;\n//#endregion\n//#region src/shared/string-utils.ts\n/**\n* Escapes special characters in a string for encoding.\n*\n* @remarks\n* Handles backslashes, quotes, newlines, carriage returns, and tabs.\n* Other U+0000–U+001F control characters are emitted as `\\uXXXX`.\n*/\nfunction escapeString(value) {\n\treturn value.replace(/\\\\/g, `\\\\\\\\`).replace(/\"/g, `\\\\\"`).replace(/\\n/g, `\\\\n`).replace(/\\r/g, `\\\\r`).replace(/\\t/g, `\\\\t`).replace(/[\\u0000-\\u001F]/g, (c) => `\\\\u${c.charCodeAt(0).toString(16).padStart(4, \"0\")}`);\n}\n/**\n* Unescapes a string by processing escape sequences.\n*\n* @remarks\n* Handles `\\n`, `\\t`, `\\r`, `\\\\`, `\\\"`, and `\\uXXXX` escape sequences.\n* Lone surrogates in `\\uXXXX` are rejected.\n*/\nfunction unescapeString(value) {\n\tlet unescaped = \"\";\n\tlet i = 0;\n\twhile (i < value.length) {\n\t\tif (value[i] === \"\\\\\") {\n\t\t\tif (i + 1 >= value.length) throw new SyntaxError(\"Invalid escape sequence: backslash at end of string\");\n\t\t\tconst next = value[i + 1];\n\t\t\tif (next === \"n\") {\n\t\t\t\tunescaped += \"\\n\";\n\t\t\t\ti += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (next === \"t\") {\n\t\t\t\tunescaped += \"\t\";\n\t\t\t\ti += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (next === \"r\") {\n\t\t\t\tunescaped += \"\\r\";\n\t\t\t\ti += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (next === \"\\\\\") {\n\t\t\t\tunescaped += \"\\\\\";\n\t\t\t\ti += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (next === \"\\\"\") {\n\t\t\t\tunescaped += \"\\\"\";\n\t\t\t\ti += 2;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tif (next === \"u\") {\n\t\t\t\tif (i + 6 > value.length) throw new SyntaxError(`Invalid escape sequence: truncated \\\\u escape at \"${value.slice(i, i + 6)}\"`);\n\t\t\t\tconst hex = value.slice(i + 2, i + 6);\n\t\t\t\tif (!/^[0-9a-f]{4}$/i.test(hex)) throw new SyntaxError(`Invalid escape sequence: \\\\u must be followed by 4 hex digits, got \"${hex}\"`);\n\t\t\t\tconst codeUnit = Number.parseInt(hex, 16);\n\t\t\t\tif (codeUnit >= 55296 && codeUnit <= 57343) throw new SyntaxError(`Invalid escape sequence: \\\\u${hex} is a lone surrogate; supplementary code points MUST appear as literal UTF-8`);\n\t\t\t\tunescaped += String.fromCodePoint(codeUnit);\n\t\t\t\ti += 6;\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthrow new SyntaxError(`Invalid escape sequence: \\\\${next}`);\n\t\t}\n\t\tunescaped += value[i];\n\t\ti++;\n\t}\n\treturn unescaped;\n}\n/**\n* Finds the index of the closing double quote, accounting for escape sequences.\n*/\nfunction findClosingQuote(content, start) {\n\tlet i = start + 1;\n\twhile (i < content.length) {\n\t\tif (content[i] === \"\\\\\" && i + 1 < content.length) {\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (content[i] === \"\\\"\") return i;\n\t\ti++;\n\t}\n\treturn -1;\n}\n/**\n* Finds the index of a character outside of quoted sections.\n*/\nfunction findUnquotedChar(content, char, start = 0) {\n\tlet inQuotes = false;\n\tlet i = start;\n\twhile (i < content.length) {\n\t\tif (content[i] === \"\\\\\" && i + 1 < content.length && inQuotes) {\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (content[i] === \"\\\"\") {\n\t\t\tinQuotes = !inQuotes;\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (content[i] === char && !inQuotes) return i;\n\t\ti++;\n\t}\n\treturn -1;\n}\n//#endregion\n//#region src/decode/errors.ts\n/**\n* Error thrown by the TOON decoder when input cannot be parsed.\n*\n* Extends `SyntaxError` so existing `instanceof SyntaxError` checks keep working.\n* Adds structured location fields for programmatic consumers and richer CLI output.\n*/\nvar ToonDecodeError = class extends SyntaxError {\n\tconstructor(message, context) {\n\t\tconst prefix = context?.line !== void 0 ? `Line ${context.line}: ` : \"\";\n\t\tsuper(prefix + message, context?.cause !== void 0 ? { cause: context.cause } : void 0);\n\t\tthis.name = \"ToonDecodeError\";\n\t\tthis.line = context?.line;\n\t\tthis.source = context?.source;\n\t}\n};\n/**\n* Runs `fn` and re-throws any non-`ToonDecodeError` `Error` as a `ToonDecodeError`\n* with line context attached and the original error preserved as `cause`.\n*\n* Pure parser helpers (parser.ts, string-utils.ts) don't know which line they're\n* parsing; this wrapper is how the streaming decoder enriches their errors.\n*/\nfunction withLine(line, fn) {\n\ttry {\n\t\treturn fn();\n\t} catch (error) {\n\t\tif (error instanceof ToonDecodeError) throw error;\n\t\tif (error instanceof Error) throw new ToonDecodeError(error.message, {\n\t\t\tline: line.lineNumber,\n\t\t\tsource: line.raw,\n\t\t\tcause: error\n\t\t});\n\t\tthrow error;\n\t}\n}\n//#endregion\n//#region src/shared/literal-utils.ts\nconst NUMERIC_LITERAL_PATTERN = /^-?(?:0|[1-9]\\d*)(?:\\.\\d+)?(?:e[+-]?\\d+)?$/i;\nfunction isBooleanOrNullLiteral(token) {\n\treturn token === \"true\" || token === \"false\" || token === \"null\";\n}\n/**\n* Checks if a token represents a valid numeric literal.\n*\n* @remarks\n* Rejects numbers with leading zeros (except `\"0\"` itself or decimals like `\"0.5\"`).\n*/\nfunction isNumericLiteral(token) {\n\tif (!token) return false;\n\tif (!NUMERIC_LITERAL_PATTERN.test(token)) return false;\n\tconst numericValue = Number(token);\n\treturn !Number.isNaN(numericValue) && Number.isFinite(numericValue);\n}\n//#endregion\n//#region src/decode/parser.ts\nfunction parseArrayHeaderLine(content, defaultDelimiter, strict = false) {\n\tconst trimmedToken = content.trimStart();\n\tlet bracketStart = -1;\n\tif (trimmedToken.startsWith(\"\\\"\")) {\n\t\tconst closingQuoteIndex = findClosingQuote(trimmedToken, 0);\n\t\tif (closingQuoteIndex === -1) return;\n\t\tif (!trimmedToken.slice(closingQuoteIndex + 1).startsWith(\"[\")) return;\n\t\tconst keyEndIndex = content.length - trimmedToken.length + closingQuoteIndex + 1;\n\t\tbracketStart = content.indexOf(\"[\", keyEndIndex);\n\t} else bracketStart = content.indexOf(\"[\");\n\tif (bracketStart === -1) return;\n\tconst bracketEnd = content.indexOf(\"]\", bracketStart);\n\tif (bracketEnd === -1) return;\n\tlet colonIndex = bracketEnd + 1;\n\tlet braceEnd = colonIndex;\n\tconst braceStart = content.indexOf(\"{\", bracketEnd);\n\tif (braceStart !== -1 && braceStart < content.indexOf(\":\", bracketEnd)) {\n\t\tconst gapBeforeBrace = content.slice(bracketEnd + 1, braceStart);\n\t\tif (gapBeforeBrace !== \"\") {\n\t\t\tif (strict) {\n\t\t\t\tconst trimmedGap = gapBeforeBrace.trim();\n\t\t\t\tthrow new SyntaxError(trimmedGap === \"\" ? `Unexpected whitespace between bracket and fields segment` : `Unexpected content \"${trimmedGap}\" between bracket and fields segment`);\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\tconst foundBraceEnd = content.indexOf(\"}\", braceStart);\n\t\tif (foundBraceEnd !== -1) braceEnd = foundBraceEnd + 1;\n\t}\n\tcolonIndex = content.indexOf(\":\", Math.max(bracketEnd, braceEnd));\n\tif (colonIndex === -1) return;\n\tconst gapStart = Math.max(bracketEnd + 1, braceEnd);\n\tconst gapBeforeColon = content.slice(gapStart, colonIndex);\n\tif (gapBeforeColon !== \"\") {\n\t\tif (strict) {\n\t\t\tconst trimmedGap = gapBeforeColon.trim();\n\t\t\tthrow new SyntaxError(trimmedGap === \"\" ? `Unexpected whitespace between bracket segment and colon` : `Unexpected content \"${trimmedGap}\" between bracket segment and colon`);\n\t\t}\n\t\treturn;\n\t}\n\tlet key;\n\tif (bracketStart > 0) {\n\t\tconst rawKey = content.slice(0, bracketStart).trim();\n\t\tkey = rawKey.startsWith(\"\\\"\") ? parseStringLiteral(rawKey) : rawKey;\n\t}\n\tconst afterColon = content.slice(colonIndex + 1).trim();\n\tconst bracketContent = content.slice(bracketStart + 1, bracketEnd);\n\tlet parsedBracket;\n\ttry {\n\t\tparsedBracket = parseBracketSegment(bracketContent, defaultDelimiter);\n\t} catch (error) {\n\t\tif (strict) throw error;\n\t\treturn;\n\t}\n\tconst { length, delimiter } = parsedBracket;\n\tlet fields;\n\tif (braceStart !== -1 && braceStart < colonIndex) {\n\t\tconst foundBraceEnd = content.indexOf(\"}\", braceStart);\n\t\tif (foundBraceEnd !== -1 && foundBraceEnd < colonIndex) {\n\t\t\tconst fieldsContent = content.slice(braceStart + 1, foundBraceEnd);\n\t\t\tconst mismatchedDelimiter = findUnquotedMismatchedDelimiter(fieldsContent, delimiter);\n\t\t\tif (mismatchedDelimiter !== void 0) {\n\t\t\t\tif (strict) throw new SyntaxError(`Header delimiter mismatch: bracket declares \"${formatDelimiter(delimiter)}\" but fields segment contains unquoted \"${formatDelimiter(mismatchedDelimiter)}\"`);\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tfields = parseDelimitedValues(fieldsContent, delimiter).map((field) => parseStringLiteral(field.trim()));\n\t\t}\n\t}\n\treturn {\n\t\theader: {\n\t\t\tkey,\n\t\t\tlength,\n\t\t\tdelimiter,\n\t\t\tfields\n\t\t},\n\t\tinlineValues: afterColon || void 0\n\t};\n}\nconst BRACKET_LENGTH_PATTERN = /^(?:0|[1-9]\\d*)$/;\nfunction parseBracketSegment(seg, defaultDelimiter) {\n\tlet content = seg;\n\tlet delimiter = defaultDelimiter;\n\tif (content.endsWith(\"\t\")) {\n\t\tdelimiter = DELIMITERS.tab;\n\t\tcontent = content.slice(0, -1);\n\t} else if (content.endsWith(\"|\")) {\n\t\tdelimiter = DELIMITERS.pipe;\n\t\tcontent = content.slice(0, -1);\n\t}\n\tif (!BRACKET_LENGTH_PATTERN.test(content)) throw new SyntaxError(`Invalid array length: \"${seg}\" (expected non-negative integer with no leading zeros)`);\n\treturn {\n\t\tlength: Number.parseInt(content, 10),\n\t\tdelimiter\n\t};\n}\nconst DELIMITER_CANDIDATES = [\n\t\",\",\n\t\"\t\",\n\t\"|\"\n];\nfunction findUnquotedMismatchedDelimiter(content, activeDelimiter) {\n\tfor (const candidate of DELIMITER_CANDIDATES) {\n\t\tif (candidate === activeDelimiter) continue;\n\t\tif (findUnquotedChar(content, candidate) !== -1) return candidate;\n\t}\n}\nfunction formatDelimiter(delimiter) {\n\tif (delimiter === \"\t\") return \"\\\\t\";\n\treturn delimiter;\n}\n/**\n* Parses a delimited string into values, respecting quoted strings and escape sequences.\n*\n* @remarks\n* Uses a state machine that tracks:\n* - `inQuotes`: Whether we're inside a quoted string (to ignore delimiters)\n* - `valueBuffer`: Accumulates characters for the current value\n* - Escape sequences: Handled within quoted strings\n*/\nfunction parseDelimitedValues(input, delimiter) {\n\tconst values = [];\n\tlet valueBuffer = \"\";\n\tlet inQuotes = false;\n\tlet i = 0;\n\twhile (i < input.length) {\n\t\tconst char = input[i];\n\t\tif (char === \"\\\\\" && i + 1 < input.length && inQuotes) {\n\t\t\tvalueBuffer += char + input[i + 1];\n\t\t\ti += 2;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === \"\\\"\") {\n\t\t\tinQuotes = !inQuotes;\n\t\t\tvalueBuffer += char;\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tif (char === delimiter && !inQuotes) {\n\t\t\tvalues.push(valueBuffer.trim());\n\t\t\tvalueBuffer = \"\";\n\t\t\ti++;\n\t\t\tcontinue;\n\t\t}\n\t\tvalueBuffer += char;\n\t\ti++;\n\t}\n\tif (valueBuffer || values.length > 0) values.push(valueBuffer.trim());\n\treturn values;\n}\nfunction mapRowValuesToPrimitives(values) {\n\treturn values.map((v) => parsePrimitiveToken(v));\n}\nfunction parsePrimitiveToken(token) {\n\tconst trimmedToken = token.trim();\n\tif (!trimmedToken) return \"\";\n\tif (trimmedToken.startsWith(\"\\\"\")) return parseStringLiteral(trimmedToken);\n\tif (isBooleanOrNullLiteral(trimmedToken)) {\n\t\tif (trimmedToken === \"true\") return true;\n\t\tif (trimmedToken === \"false\") return false;\n\t\tif (trimmedToken === \"null\") return null;\n\t}\n\tif (isNumericLiteral(trimmedToken)) {\n\t\tconst parsedNumber = Number.parseFloat(trimmedToken);\n\t\treturn Object.is(parsedNumber, -0) ? 0 : parsedNumber;\n\t}\n\treturn trimmedToken;\n}\nfunction parseStringLiteral(token) {\n\tconst trimmedToken = token.trim();\n\tif (trimmedToken.startsWith(\"\\\"\")) {\n\t\tconst closingQuoteIndex = findClosingQuote(trimmedToken, 0);\n\t\tif (closingQuoteIndex === -1) throw new SyntaxError(\"Unterminated string: missing closing quote\");\n\t\tif (closingQuoteIndex !== trimmedToken.length - 1) throw new SyntaxError(\"Unexpected characters after closing quote\");\n\t\treturn unescapeString(trimmedToken.slice(1, closingQuoteIndex));\n\t}\n\treturn trimmedToken;\n}\nfunction parseUnquotedKey(content, start) {\n\tlet parsePosition = start;\n\twhile (parsePosition < content.length && content[parsePosition] !== \":\") parsePosition++;\n\tif (parsePosition >= content.length || content[parsePosition] !== \":\") throw new SyntaxError(\"Missing colon after key\");\n\tconst key = content.slice(start, parsePosition).trim();\n\tparsePosition++;\n\treturn {\n\t\tkey,\n\t\tend: parsePosition\n\t};\n}\nfunction parseQuotedKey(content, start) {\n\tconst closingQuoteIndex = findClosingQuote(content, start);\n\tif (closingQuoteIndex === -1) throw new SyntaxError(\"Unterminated quoted key\");\n\tconst key = unescapeString(content.slice(start + 1, closingQuoteIndex));\n\tlet parsePosition = closingQuoteIndex + 1;\n\tif (parsePosition >= content.length || content[parsePosition] !== \":\") throw new SyntaxError(\"Missing colon after key\");\n\tparsePosition++;\n\treturn {\n\t\tkey,\n\t\tend: parsePosition\n\t};\n}\nfunction parseKeyToken(content, start) {\n\tconst isQuoted = content[start] === \"\\\"\";\n\treturn {\n\t\t...isQuoted ? parseQuotedKey(content, start) : parseUnquotedKey(content, start),\n\t\tisQuoted\n\t};\n}\nfunction isArrayHeaderContent(content) {\n\treturn content.trim().startsWith(\"[\") && findUnquotedChar(content, \":\") !== -1;\n}\nfunction isKeyValueContent(content) {\n\treturn findUnquotedChar(content, \":\") !== -1;\n}\n//#endregion\n//#region src/decode/scanner.ts\nfunction createScanState() {\n\treturn {\n\t\tlineNumber: 0,\n\t\tblankLines: []\n\t};\n}\nfunction parseLineIncremental(raw, state, indentSize, strict) {\n\tstate.lineNumber++;\n\tconst lineNumber = state.lineNumber;\n\tlet indent = 0;\n\twhile (indent < raw.length && raw[indent] === \" \") indent++;\n\tconst content = raw.slice(indent);\n\tif (!content.trim()) {\n\t\tconst depth = computeDepthFromIndent(indent, indentSize);\n\t\tstate.blankLines.push({\n\t\t\tlineNumber,\n\t\t\tindent,\n\t\t\tdepth\n\t\t});\n\t\treturn;\n\t}\n\tconst depth = computeDepthFromIndent(indent, indentSize);\n\tif (strict) {\n\t\tlet whitespaceEndIndex = 0;\n\t\twhile (whitespaceEndIndex < raw.length && (raw[whitespaceEndIndex] === \" \" || raw[whitespaceEndIndex] === \"\t\")) whitespaceEndIndex++;\n\t\tif (raw.slice(0, whitespaceEndIndex).includes(\"\t\")) throw new ToonDecodeError(\"Tabs are not allowed in indentation in strict mode\", {\n\t\t\tline: lineNumber,\n\t\t\tsource: raw\n\t\t});\n\t\tif (indent > 0 && indent % indentSize !== 0) throw new ToonDecodeError(`Indentation must be exact multiple of ${indentSize}, but found ${indent} spaces`, {\n\t\t\tline: lineNumber,\n\t\t\tsource: raw\n\t\t});\n\t}\n\treturn {\n\t\traw,\n\t\tindent,\n\t\tcontent,\n\t\tdepth,\n\t\tlineNumber\n\t};\n}\nfunction* parseLinesSync(source, indentSize, strict, state) {\n\tfor (const raw of source) {\n\t\tconst parsedLine = parseLineIncremental(raw, state, indentSize, strict);\n\t\tif (parsedLine !== void 0) yield parsedLine;\n\t}\n}\nasync function* parseLinesAsync(source, indentSize, strict, state) {\n\tfor await (const raw of source) {\n\t\tconst parsedLine = parseLineIncremental(raw, state, indentSize, strict);\n\t\tif (parsedLine !== void 0) yield parsedLine;\n\t}\n}\nfunction computeDepthFromIndent(indentSpaces, indentSize) {\n\treturn Math.floor(indentSpaces / indentSize);\n}\n//#endregion\n//#region src/decode/validation.ts\n/**\n* Asserts that the actual count matches the expected count in strict mode.\n*/\nfunction assertExpectedCount(actual, expected, itemType, options, line) {\n\tif (options.strict && actual !== expected) throw new ToonDecodeError(`Expected ${expected} ${itemType}, but got ${actual}`, {\n\t\tline: line.lineNumber,\n\t\tsource: line.raw\n\t});\n}\n/**\n* Validates that there are no extra list items beyond the expected count.\n*/\nfunction validateNoExtraListItems(nextLine, itemDepth, expectedCount) {\n\tif (nextLine?.depth === itemDepth && nextLine.content.startsWith(\"- \")) throw new ToonDecodeError(`Expected ${expectedCount} list array items, but found more`, {\n\t\tline: nextLine.lineNumber,\n\t\tsource: nextLine.raw\n\t});\n}\n/**\n* Validates that there are no extra tabular rows beyond the expected count.\n*/\nfunction validateNoExtraTabularRows(nextLine, rowDepth, header) {\n\tif (nextLine?.depth === rowDepth && !nextLine.content.startsWith(\"- \") && isDataRow(nextLine.content, header.delimiter)) throw new ToonDecodeError(`Expected ${header.length} tabular rows, but found more`, {\n\t\tline: nextLine.lineNumber,\n\t\tsource: nextLine.raw\n\t});\n}\n/**\n* Validates that there are no blank lines within a specific line range in strict mode.\n*/\nfunction validateNoBlankLinesInRange(startLine, endLine, blankLines, strict, context) {\n\tif (!strict) return;\n\tconst firstBlank = blankLines.find((blank) => blank.lineNumber > startLine && blank.lineNumber < endLine);\n\tif (firstBlank) throw new ToonDecodeError(`Blank lines inside ${context} are not allowed in strict mode`, { line: firstBlank.lineNumber });\n}\n/**\n* Checks if a line is a data row (vs a key-value pair) in a tabular array.\n*/\nfunction isDataRow(content, delimiter) {\n\tconst colonPos = content.indexOf(\":\");\n\tconst delimiterPos = content.indexOf(delimiter);\n\tif (colonPos === -1) return true;\n\tif (delimiterPos !== -1 && delimiterPos < colonPos) return true;\n\treturn false;\n}\n//#endregion\n//#region src/decode/decoders.ts\nvar StreamingLineCursor = class {\n\tconstructor(generator, scanState) {\n\t\tthis.buffer = [];\n\t\tthis.done = false;\n\t\tthis.generator = generator;\n\t\tthis.scanState = scanState;\n\t}\n\tgetBlankLines() {\n\t\treturn this.scanState.blankLines;\n\t}\n\tasync peek() {\n\t\tif (this.buffer.length > 0) return this.buffer[0];\n\t\tif (this.done) return;\n\t\tconst result = await this.generator.next();\n\t\tif (result.done) {\n\t\t\tthis.done = true;\n\t\t\treturn;\n\t\t}\n\t\tthis.buffer.push(result.value);\n\t\treturn result.value;\n\t}\n\tasync next() {\n\t\tconst line = await this.peek();\n\t\tif (line !== void 0) {\n\t\t\tthis.buffer.shift();\n\t\t\tthis.lastLine = line;\n\t\t}\n\t\treturn line;\n\t}\n\tasync advance() {\n\t\tawait this.next();\n\t}\n\tcurrent() {\n\t\treturn this.lastLine;\n\t}\n\tasync atEnd() {\n\t\treturn await this.peek() === void 0;\n\t}\n\tpeekSync() {\n\t\tif (this.buffer.length > 0) return this.buffer[0];\n\t\tif (this.done) return;\n\t\tconst result = this.generator.next();\n\t\tif (result.done) {\n\t\t\tthis.done = true;\n\t\t\treturn;\n\t\t}\n\t\tthis.buffer.push(result.value);\n\t\treturn result.value;\n\t}\n\tnextSync() {\n\t\tconst line = this.peekSync();\n\t\tif (line !== void 0) {\n\t\t\tthis.buffer.shift();\n\t\t\tthis.lastLine = line;\n\t\t}\n\t\treturn line;\n\t}\n\tadvanceSync() {\n\t\tthis.nextSync();\n\t}\n\tatEndSync() {\n\t\treturn this.peekSync() === void 0;\n\t}\n};\nfunction* decodeStreamSync$1(source, options) {\n\tif (options?.expandPaths !== void 0) throw new Error(\"expandPaths is not supported in streaming decode\");\n\tconst resolvedOptions = {\n\t\tindent: options?.indent ?? 2,\n\t\tstrict: options?.strict ?? true\n\t};\n\tconst scanState = createScanState();\n\tconst cursor = new StreamingLineCursor(parseLinesSync(source, resolvedOptions.indent, resolvedOptions.strict, scanState), scanState);\n\tconst first = cursor.peekSync();\n\tif (!first) {\n\t\tyield { type: \"startObject\" };\n\t\tyield { type: \"endObject\" };\n\t\treturn;\n\t}\n\tif (first.content.trim() === \"[]\") {\n\t\tcursor.advanceSync();\n\t\tyield {\n\t\t\ttype: \"startArray\",\n\t\t\tlength: 0\n\t\t};\n\t\tyield { type: \"endArray\" };\n\t\treturn;\n\t}\n\tif (isArrayHeaderContent(first.content)) {\n\t\tconst headerInfo = withLine(first, () => parseArrayHeaderLine(first.content, DEFAULT_DELIMITER, resolvedOptions.strict));\n\t\tif (headerInfo) {\n\t\t\tcursor.advanceSync();\n\t\t\tyield* decodeArrayFromHeaderSync(headerInfo.header, headerInfo.inlineValues, cursor, 0, resolvedOptions, first);\n\t\t\treturn;\n\t\t}\n\t}\n\tcursor.advanceSync();\n\tif (!!cursor.atEndSync() && !isKeyValueLineSync(first)) {\n\t\tyield {\n\t\t\ttype: \"primitive\",\n\t\t\tvalue: withLine(first, () => parsePrimitiveToken(first.content.trim()))\n\t\t};\n\t\treturn;\n\t}\n\tif (!isKeyValueLineSync(first) && cursor.peekSync()?.depth === 0) throw new ToonDecodeError(\"Top-level document must start with a key-value or array-header line\", {\n\t\tline: first.lineNumber,\n\t\tsource: first.raw\n\t});\n\tconst rootSeenKeys = resolvedOptions.strict ? /* @__PURE__ */ new Set() : void 0;\n\tyield { type: \"startObject\" };\n\tyield* decodeKeyValueSync(first, cursor, 0, resolvedOptions, rootSeenKeys);\n\twhile (!cursor.atEndSync()) {\n\t\tconst line = cursor.peekSync();\n\t\tif (!line || line.depth !== 0) break;\n\t\tcursor.advanceSync();\n\t\tyield* decodeKeyValueSync(line, cursor, 0, resolvedOptions, rootSeenKeys);\n\t}\n\tyield { type: \"endObject\" };\n}\nfunction assertNoDuplicateKey(key, line, seenKeys) {\n\tif (!seenKeys) return;\n\tif (seenKeys.has(key)) throw new ToonDecodeError(`Duplicate sibling key \"${key}\"`, {\n\t\tline: line.lineNumber,\n\t\tsource: line.raw\n\t});\n\tseenKeys.add(key);\n}\nfunction* decodeKeyValueSync(line, cursor, baseDepth, options, seenKeys) {\n\tconst content = line.content;\n\tconst arrayHeader = withLine(line, () => parseArrayHeaderLine(content, DEFAULT_DELIMITER, options.strict));\n\tif (arrayHeader && arrayHeader.header.key !== void 0) {\n\t\tassertNoDuplicateKey(arrayHeader.header.key, line, seenKeys);\n\t\tyield {\n\t\t\ttype: \"key\",\n\t\t\tkey: arrayHeader.header.key\n\t\t};\n\t\tyield* decodeArrayFromHeaderSync(arrayHeader.header, arrayHeader.inlineValues, cursor, baseDepth, options, line);\n\t\treturn;\n\t}\n\tconst { key, isQuoted } = withLine(line, () => parseKeyToken(content, 0));\n\tconst colonIndex = content.indexOf(\":\", key.length);\n\tconst rest = colonIndex >= 0 ? content.slice(colonIndex + 1).trim() : \"\";\n\tassertNoDuplicateKey(key, line, seenKeys);\n\tyield isQuoted ? {\n\t\ttype: \"key\",\n\t\tkey,\n\t\twasQuoted: true\n\t} : {\n\t\ttype: \"key\",\n\t\tkey\n\t};\n\tif (!rest) {\n\t\tconst nextLine = cursor.peekSync();\n\t\tif (nextLine && nextLine.depth > baseDepth) {\n\t\t\tyield { type: \"startObject\" };\n\t\t\tyield* decodeObjectFieldsSync(cursor, baseDepth + 1, options);\n\t\t\tyield { type: \"endObject\" };\n\t\t\treturn;\n\t\t}\n\t\tyield { type: \"startObject\" };\n\t\tyield { type: \"endObject\" };\n\t\treturn;\n\t}\n\tif (rest === \"[]\") {\n\t\tyield {\n\t\t\ttype: \"startArray\",\n\t\t\tlength: 0\n\t\t};\n\t\tyield { type: \"endArray\" };\n\t\treturn;\n\t}\n\tyield {\n\t\ttype: \"primitive\",\n\t\tvalue: withLine(line, () => parsePrimitiveToken(rest))\n\t};\n}\nfunction* decodeObjectFieldsSync(cursor, baseDepth, options) {\n\tlet computedDepth;\n\tconst seenKeys = options.strict ? /* @__PURE__ */ new Set() : void 0;\n\twhile (!cursor.atEndSync()) {\n\t\tconst line = cursor.peekSync();\n\t\tif (!line || line.depth < baseDepth) break;\n\t\tif (computedDepth === void 0 && line.depth >= baseDepth) computedDepth = line.depth;\n\t\tif (line.depth === computedDepth) {\n\t\t\tcursor.advanceSync();\n\t\t\tyield* decodeKeyValueSync(line, cursor, computedDepth, options, seenKeys);\n\t\t} else break;\n\t}\n}\nfunction* decodeArrayFromHeaderSync(header, inlineValues, cursor, baseDepth, options, headerLine) {\n\tyield {\n\t\ttype: \"startArray\",\n\t\tlength: header.length\n\t};\n\tif (inlineValues) {\n\t\tyield* decodeInlinePrimitiveArraySync(header, inlineValues, options, headerLine);\n\t\tyield { type: \"endArray\" };\n\t\treturn;\n\t}\n\tif (header.fields && header.fields.length > 0) {\n\t\tyield* decodeTabularArraySync(header, cursor, baseDepth, options, headerLine);\n\t\tyield { type: \"endArray\" };\n\t\treturn;\n\t}\n\tyield* decodeListArraySync(header, cursor, baseDepth, options, headerLine);\n\tyield { type: \"endArray\" };\n}\nfunction* decodeInlinePrimitiveArraySync(header, inlineValues, options, headerLine) {\n\tif (!inlineValues.trim()) {\n\t\tassertExpectedCount(0, header.length, \"inline array items\", options, headerLine);\n\t\treturn;\n\t}\n\tconst values = withLine(headerLine, () => parseDelimitedValues(inlineValues, header.delimiter));\n\tconst primitives = withLine(headerLine, () => mapRowValuesToPrimitives(values));\n\tassertExpectedCount(primitives.length, header.length, \"inline array items\", options, headerLine);\n\tfor (const primitive of primitives) yield {\n\t\ttype: \"primitive\",\n\t\tvalue: primitive\n\t};\n}\nfunction* decodeTabularArraySync(header, cursor, baseDepth, options, headerLine) {\n\tconst rowDepth = baseDepth + 1;\n\tlet rowCount = 0;\n\tlet startLine;\n\tlet endLine;\n\tlet lastRowLine = headerLine;\n\twhile (!cursor.atEndSync() && rowCount < header.length) {\n\t\tconst line = cursor.peekSync();\n\t\tif (!line || line.depth < rowDepth) break;\n\t\tif (line.depth === rowDepth) {\n\t\t\tif (startLine === void 0) startLine = line.lineNumber;\n\t\t\tendLine = line.lineNumber;\n\t\t\tlastRowLine = line;\n\t\t\tcursor.advanceSync();\n\t\t\tconst values = withLine(line, () => parseDelimitedValues(line.content, header.delimiter));\n\t\t\tassertExpectedCount(values.length, header.fields.length, \"tabular row values\", options, line);\n\t\t\tconst primitives = withLine(line, () => mapRowValuesToPrimitives(values));\n\t\t\tyield* yieldObjectFromFields(header.fields, primitives);\n\t\t\trowCount++;\n\t\t} else break;\n\t}\n\tassertExpectedCount(rowCount, header.length, \"tabular rows\", options, lastRowLine);\n\tif (options.strict && startLine !== void 0 && endLine !== void 0) validateNoBlankLinesInRange(startLine, endLine, cursor.getBlankLines(), options.strict, \"tabular array\");\n\tif (options.strict) validateNoExtraTabularRows(cursor.peekSync(), rowDepth, header);\n}\nfunction* decodeListArraySync(header, cursor, baseDepth, options, headerLine) {\n\tconst itemDepth = baseDepth + 1;\n\tlet itemCount = 0;\n\tlet startLine;\n\tlet endLine;\n\tlet lastItemLine = headerLine;\n\twhile (!cursor.atEndSync() && itemCount < header.length) {\n\t\tconst line = cursor.peekSync();\n\t\tif (!line || line.depth < itemDepth) break;\n\t\tconst isListItem = line.content.startsWith(\"- \") || line.content === \"-\";\n\t\tif (line.depth === itemDepth && isListItem) {\n\t\t\tif (startLine === void 0) startLine = line.lineNumber;\n\t\t\tendLine = line.lineNumber;\n\t\t\tlastItemLine = line;\n\t\t\tyield* decodeListItemSync(cursor, itemDepth, options);\n\t\t\tconst currentLine = cursor.current();\n\t\t\tif (currentLine) {\n\t\t\t\tendLine = currentLine.lineNumber;\n\t\t\t\tlastItemLine = currentLine;\n\t\t\t}\n\t\t\titemCount++;\n\t\t} else break;\n\t}\n\tassertExpectedCount(itemCount, header.length, \"list array items\", options, lastItemLine);\n\tif (options.strict && startLine !== void 0 && endLine !== void 0) validateNoBlankLinesInRange(startLine, endLine, cursor.getBlankLines(), options.strict, \"list array\");\n\tif (options.strict) validateNoExtraListItems(cursor.peekSync(), itemDepth, header.length);\n}\nfunction* decodeListItemSync(cursor, baseDepth, options) {\n\tconst line = cursor.nextSync();\n\tif (!line) throw new ReferenceError(\"Expected list item\");\n\tlet afterHyphen;\n\tif (line.content === \"-\") {\n\t\tyield { type: \"startObject\" };\n\t\tyield { type: \"endObject\" };\n\t\treturn;\n\t} else if (line.content.startsWith(\"- \")) afterHyphen = line.content.slice(2);\n\telse throw new ToonDecodeError(`Expected list item to start with \"- \"`, {\n\t\tline: line.lineNumber,\n\t\tsource: line.raw\n\t});\n\tif (!afterHyphen.trim()) {\n\t\tyield { type: \"startObject\" };\n\t\tyield { type: \"endObject\" };\n\t\treturn;\n\t}\n\tif (afterHyphen.trim() === \"[]\") {\n\t\tyield {\n\t\t\ttype: \"startArray\",\n\t\t\tlength: 0\n\t\t};\n\t\tyield { type: \"endArray\" };\n\t\treturn;\n\t}\n\tconst itemLine = {\n\t\t...line,\n\t\tcontent: afterHyphen\n\t};\n\tif (isArrayHeaderContent(afterHyphen)) {\n\t\tconst arrayHeader = withLine(itemLine, () => parseArrayHeaderLine(afterHyphen, DEFAULT_DELIMITER, options.strict));\n\t\tif (arrayHeader) {\n\t\t\tyield* decodeArrayFromHeaderSync(arrayHeader.header, arrayHeader.inlineValues, cursor, baseDepth, options, itemLine);\n\t\t\treturn;\n\t\t}\n\t}\n\tconst headerInfo = withLine(itemLine, () => parseArrayHeaderLine(afterHyphen, DEFAULT_DELIMITER, options.strict));\n\tif (headerInfo && headerInfo.header.key !== void 0 && headerInfo.header.fields !== void 0) {\n\t\tconst header = headerInfo.header;\n\t\tconst seenKeys = options.strict ? new Set([header.key]) : void 0;\n\t\tyield { type: \"startObject\" };\n\t\tyield {\n\t\t\ttype: \"key\",\n\t\t\tkey: header.key\n\t\t};\n\t\tyield* decodeArrayFromHeaderSync(header, headerInfo.inlineValues, cursor, baseDepth + 1, options, itemLine);\n\t\tconst followDepth = baseDepth + 1;\n\t\twhile (!cursor.atEndSync()) {\n\t\t\tconst nextLine = cursor.peekSync();\n\t\t\tif (!nextLine || nextLine.depth < followDepth) break;\n\t\t\tif (nextLine.depth === followDepth && !nextLine.content.startsWith(\"- \")) {\n\t\t\t\tcursor.advanceSync();\n\t\t\t\tyield* decodeKeyValueSync(nextLine, cursor, followDepth, options, seenKeys);\n\t\t\t} else break;\n\t\t}\n\t\tyield { type: \"endObject\" };\n\t\treturn;\n\t}\n\tif (isKeyValueContent(afterHyphen)) {\n\t\tconst seenKeys = options.strict ? /* @__PURE__ */ new Set() : void 0;\n\t\tyield { type: \"startObject\" };\n\t\tyield* decodeKeyValueSync(itemLine, cursor, baseDepth + 1, options, seenKeys);\n\t\tconst followDepth = baseDepth + 1;\n\t\twhile (!cursor.atEndSync()) {\n\t\t\tconst nextLine = cursor.peekSync();\n\t\t\tif (!nextLine || nextLine.depth < followDepth) break;\n\t\t\tif (nextLine.depth === followDepth && !nextLine.content.startsWith(\"- \")) {\n\t\t\t\tcursor.advanceSync();\n\t\t\t\tyield* decodeKeyValueSync(nextLine, cursor, followDepth, options, seenKeys);\n\t\t\t} else break;\n\t\t}\n\t\tyield { type: \"endObject\" };\n\t\treturn;\n\t}\n\tyield {\n\t\ttype: \"primitive\",\n\t\tvalue: withLine(itemLine, () => parsePrimitiveToken(afterHyphen))\n\t};\n}\nfunction isKeyValueLineSync(line) {\n\tconst content = line.content;\n\tif (content.startsWith(\"\\\"\")) {\n\t\tconst closingQuoteIndex = findClosingQuote(content, 0);\n\t\tif (closingQuoteIndex === -1) return false;\n\t\treturn content.slice(closingQuoteIndex + 1).includes(\":\");\n\t} else return content.includes(\":\");\n}\nasync function* decodeStream$1(source, options) {\n\tif (options?.expandPaths !== void 0) throw new Error(\"expandPaths is not supported in streaming decode\");\n\tconst resolvedOptions = {\n\t\tindent: options?.indent ?? 2,\n\t\tstrict: options?.strict ?? true\n\t};\n\tconst scanState = createScanState();\n\tif (Symbol.asyncIterator in source) {\n\t\tconst cursor = new StreamingLineCursor(parseLinesAsync(source, resolvedOptions.indent, resolvedOptions.strict, scanState), scanState);\n\t\tconst first = await cursor.peek();\n\t\tif (!first) {\n\t\t\tyield { type: \"startObject\" };\n\t\t\tyield { type: \"endObject\" };\n\t\t\treturn;\n\t\t}\n\t\tif (first.content.trim() === \"[]\") {\n\t\t\tawait cursor.advance();\n\t\t\tyield {\n\t\t\t\ttype: \"startArray\",\n\t\t\t\tlength: 0\n\t\t\t};\n\t\t\tyield { type: \"endArray\" };\n\t\t\treturn;\n\t\t}\n\t\tif (isArrayHeaderContent(first.content)) {\n\t\t\tconst headerInfo = withLine(first, () => parseArrayHeaderLine(first.content, DEFAULT_DELIMITER, resolvedOptions.strict));\n\t\t\tif (headerInfo) {\n\t\t\t\tawait cursor.advance();\n\t\t\t\tyield* decodeArrayFromHeaderAsync(headerInfo.header, headerInfo.inlineValues, cursor, 0, resolvedOptions, first);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t\tawait cursor.advance();\n\t\tif (!!await cursor.atEnd() && !isKeyValueLineSync(first)) {\n\t\t\tyield {\n\t\t\t\ttype: \"primitive\",\n\t\t\t\tvalue: withLine(first, () => parsePrimitiveToken(first.content.trim()))\n\t\t\t};\n\t\t\treturn;\n\t\t}\n\t\tif (!isKeyValueLineSync(first) && (await cursor.peek())?.depth === 0) throw new ToonDecodeError(\"Top-level document must start with a key-value or array-header line\", {\n\t\t\tline: first.lineNumber,\n\t\t\tsource: first.raw\n\t\t});\n\t\tconst rootSeenKeys = resolvedOptions.strict ? /* @__PURE__ */ new Set() : void 0;\n\t\tyield { type: \"startObject\" };\n\t\tyield* decodeKeyValueAsync(first, cursor, 0, resolvedOptions, rootSeenKeys);\n\t\twhile (!await cursor.atEnd()) {\n\t\t\tconst line = await cursor.peek();\n\t\t\tif (!line || line.depth !== 0) break;\n\t\t\tawait cursor.advance();\n\t\t\tyield* decodeKeyValueAsync(line, cursor, 0, resolvedOptions, rootSeenKeys);\n\t\t}\n\t\tyield { type: \"endObject\" };\n\t} else yield* decodeStreamSync$1(source, options);\n}\nasync function* decodeKeyValueAsync(line, cursor, baseDepth, options, seenKeys) {\n\tconst content = line.content;\n\tconst arrayHeader = withLine(line, () => parseArrayHeaderLine(content, DEFAULT_DELIMITER, options.strict));\n\tif (arrayHeader && arrayHeader.header.key !== void 0) {\n\t\tassertNoDuplicateKey(arrayHeader.header.key, line, seenKeys);\n\t\tyield {\n\t\t\ttype: \"key\",\n\t\t\tkey: arrayHeader.header.key\n\t\t};\n\t\tyield* decodeArrayFromHeaderAsync(arrayHeader.header, arrayHeader.inlineValues, cursor, baseDepth, options, line);\n\t\treturn;\n\t}\n\tconst { key, isQuoted } = withLine(line, () => parseKeyToken(content, 0));\n\tconst colonIndex = content.indexOf(\":\", key.length);\n\tconst rest = colonIndex >= 0 ? content.slice(colonIndex + 1).trim() : \"\";\n\tassertNoDuplicateKey(key, line, seenKeys);\n\tyield isQuoted ? {\n\t\ttype: \"key\",\n\t\tkey,\n\t\twasQuoted: true\n\t} : {\n\t\ttype: \"key\",\n\t\tkey\n\t};\n\tif (!rest) {\n\t\tconst nextLine = await cursor.peek();\n\t\tif (nextLine && nextLine.depth > baseDepth) {\n\t\t\tyield { type: \"startObject\" };\n\t\t\tyield* decodeObjectFieldsAsync(cursor, baseDepth + 1, options);\n\t\t\tyield { type: \"endObject\" };\n\t\t\treturn;\n\t\t}\n\t\tyield { type: \"startObject\" };\n\t\tyield { type: \"endObject\" };\n\t\treturn;\n\t}\n\tif (rest === \"[]\") {\n\t\tyield {\n\t\t\ttype: \"startArray\",\n\t\t\tlength: 0\n\t\t};\n\t\tyield { type: \"endArray\" };\n\t\treturn;\n\t}\n\tyield {\n\t\ttype: \"primitive\",\n\t\tvalue: withLine(line, () => parsePrimitiveToken(rest))\n\t};\n}\nasync function* decodeObjectFieldsAsync(cursor, baseDepth, options) {\n\tlet computedDepth;\n\tconst seenKeys = options.strict ? /* @__PURE__ */ new Set() : void 0;\n\twhile (!await cursor.atEnd()) {\n\t\tconst line = await cursor.peek();\n\t\tif (!line || line.depth < baseDepth) break;\n\t\tif (computedDepth === void 0 && line.depth >= baseDepth) computedDepth = line.depth;\n\t\tif (line.depth === computedDepth) {\n\t\t\tawait cursor.advance();\n\t\t\tyield* decodeKeyValueAsync(line, cursor, computedDepth, options, seenKeys);\n\t\t} else break;\n\t}\n}\nasync function* decodeArrayFromHeaderAsync(header, inlineValues, cursor, baseDepth, options, headerLine) {\n\tyield {\n\t\ttype: \"startArray\",\n\t\tlength: header.length\n\t};\n\tif (inlineValues) {\n\t\tyield* decodeInlinePrimitiveArraySync(header, inlineValues, options, headerLine);\n\t\tyield { type: \"endArray\" };\n\t\treturn;\n\t}\n\tif (header.fields && header.fields.length > 0) {\n\t\tyield* decodeTabularArrayAsync(header, cursor, baseDepth, options, headerLine);\n\t\tyield { type: \"endArray\" };\n\t\treturn;\n\t}\n\tyield* decodeListArrayAsync(header, cursor, baseDepth, options, headerLine);\n\tyield { type: \"endArray\" };\n}\nasync function* decodeTabularArrayAsync(header, cursor, baseDepth, options, headerLine) {\n\tconst rowDepth = baseDepth + 1;\n\tlet rowCount = 0;\n\tlet startLine;\n\tlet endLine;\n\tlet lastRowLine = headerLine;\n\twhile (!await cursor.atEnd() && rowCount < header.length) {\n\t\tconst line = await cursor.peek();\n\t\tif (!line || line.depth < rowDepth) break;\n\t\tif (line.depth === rowDepth) {\n\t\t\tif (startLine === void 0) startLine = line.lineNumber;\n\t\t\tendLine = line.lineNumber;\n\t\t\tlastRowLine = line;\n\t\t\tawait cursor.advance();\n\t\t\tconst values = withLine(line, () => parseDelimitedValues(line.content, header.delimiter));\n\t\t\tassertExpectedCount(values.length, header.fields.length, \"tabular row values\", options, line);\n\t\t\tconst primitives = withLine(line, () => mapRowValuesToPrimitives(values));\n\t\t\tyield* yieldObjectFromFields(header.fields, primitives);\n\t\t\trowCount++;\n\t\t} else break;\n\t}\n\tassertExpectedCount(rowCount, header.length, \"tabular rows\", options, lastRowLine);\n\tif (options.strict && startLine !== void 0 && endLine !== void 0) validateNoBlankLinesInRange(startLine, endLine, cursor.getBlankLines(), options.strict, \"tabular array\");\n\tif (options.strict) validateNoExtraTabularRows(await cursor.peek(), rowDepth, header);\n}\nasync function* decodeListArrayAsync(header, cursor, baseDepth, options, headerLine) {\n\tconst itemDepth = baseDepth + 1;\n\tlet itemCount = 0;\n\tlet startLine;\n\tlet endLine;\n\tlet lastItemLine = headerLine;\n\twhile (!await cursor.atEnd() && itemCount < header.length) {\n\t\tconst line = await cursor.peek();\n\t\tif (!line || line.depth < itemDepth) break;\n\t\tconst isListItem = line.content.startsWith(\"- \") || line.content === \"-\";\n\t\tif (line.depth === itemDepth && isListItem) {\n\t\t\tif (startLine === void 0) startLine = line.lineNumber;\n\t\t\tendLine = line.lineNumber;\n\t\t\tlastItemLine = line;\n\t\t\tyield* decodeListItemAsync(cursor, itemDepth, options);\n\t\t\tconst currentLine = cursor.current();\n\t\t\tif (currentLine) {\n\t\t\t\tendLine = currentLine.lineNumber;\n\t\t\t\tlastItemLine = currentLine;\n\t\t\t}\n\t\t\titemCount++;\n\t\t} else break;\n\t}\n\tassertExpectedCount(itemCount, header.length, \"list array items\", options, lastItemLine);\n\tif (options.strict && startLine !== void 0 && endLine !== void 0) validateNoBlankLinesInRange(startLine, endLine, cursor.getBlankLines(), options.strict, \"list array\");\n\tif (options.strict) validateNoExtraListItems(await cursor.peek(), itemDepth, header.length);\n}\nasync function* decodeListItemAsync(cursor, baseDepth, options) {\n\tconst line = await cursor.next();\n\tif (!line) throw new ReferenceError(\"Expected list item\");\n\tlet afterHyphen;\n\tif (line.content === \"-\") {\n\t\tyield { type: \"startObject\" };\n\t\tyield { type: \"endObject\" };\n\t\treturn;\n\t} else if (line.content.startsWith(\"- \")) afterHyphen = line.content.slice(2);\n\telse throw new ToonDecodeError(`Expected list item to start with \"- \"`, {\n\t\tline: line.lineNumber,\n\t\tsource: line.raw\n\t});\n\tif (!afterHyphen.trim()) {\n\t\tyield { type: \"startObject\" };\n\t\tyield { type: \"endObject\" };\n\t\treturn;\n\t}\n\tif (afterHyphen.trim() === \"[]\") {\n\t\tyield {\n\t\t\ttype: \"startArray\",\n\t\t\tlength: 0\n\t\t};\n\t\tyield { type: \"endArray\" };\n\t\treturn;\n\t}\n\tconst itemLine = {\n\t\t...line,\n\t\tcontent: afterHyphen\n\t};\n\tif (isArrayHeaderContent(afterHyphen)) {\n\t\tconst arrayHeader = withLine(itemLine, () => parseArrayHeaderLine(afterHyphen, DEFAULT_DELIMITER, options.strict));\n\t\tif (arrayHeader) {\n\t\t\tyield* decodeArrayFromHeaderAsync(arrayHeader.header, arrayHeader.inlineValues, cursor, baseDepth, options, itemLine);\n\t\t\treturn;\n\t\t}\n\t}\n\tconst headerInfo = withLine(itemLine, () => parseArrayHeaderLine(afterHyphen, DEFAULT_DELIMITER, options.strict));\n\tif (headerInfo && headerInfo.header.key !== void 0 && headerInfo.header.fields !== void 0) {\n\t\tconst header = headerInfo.header;\n\t\tconst seenKeys = options.strict ? new Set([header.key]) : void 0;\n\t\tyield { type: \"startObject\" };\n\t\tyield {\n\t\t\ttype: \"key\",\n\t\t\tkey: header.key\n\t\t};\n\t\tyield* decodeArrayFromHeaderAsync(header, headerInfo.inlineValues, cursor, baseDepth + 1, options, itemLine);\n\t\tconst followDepth = baseDepth + 1;\n\t\twhile (!await cursor.atEnd()) {\n\t\t\tconst nextLine = await cursor.peek();\n\t\t\tif (!nextLine || nextLine.depth < followDepth) break;\n\t\t\tif (nextLine.depth === followDepth && !nextLine.content.startsWith(\"- \")) {\n\t\t\t\tawait cursor.advance();\n\t\t\t\tyield* decodeKeyValueAsync(nextLine, cursor, followDepth, options, seenKeys);\n\t\t\t} else break;\n\t\t}\n\t\tyield { type: \"endObject\" };\n\t\treturn;\n\t}\n\tif (isKeyValueContent(afterHyphen)) {\n\t\tconst seenKeys = options.strict ? /* @__PURE__ */ new Set() : void 0;\n\t\tyield { type: \"startObject\" };\n\t\tyield* decodeKeyValueAsync(itemLine, cursor, baseDepth + 1, options, seenKeys);\n\t\tconst followDepth = baseDepth + 1;\n\t\twhile (!await cursor.atEnd()) {\n\t\t\tconst nextLine = await cursor.peek();\n\t\t\tif (!nextLine || nextLine.depth < followDepth) break;\n\t\t\tif (nextLine.depth === followDepth && !nextLine.content.startsWith(\"- \")) {\n\t\t\t\tawait cursor.advance();\n\t\t\t\tyield* decodeKeyValueAsync(nextLine, cursor, followDepth, options, seenKeys);\n\t\t\t} else break;\n\t\t}\n\t\tyield { type: \"endObject\" };\n\t\treturn;\n\t}\n\tyield {\n\t\ttype: \"primitive\",\n\t\tvalue: withLine(itemLine, () => parsePrimitiveToken(afterHyphen))\n\t};\n}\nfunction* yieldObjectFromFields(fields, primitives) {\n\tyield { type: \"startObject\" };\n\tfor (let i = 0; i < fields.length; i++) {\n\t\tyield {\n\t\t\ttype: \"key\",\n\t\t\tkey: fields[i]\n\t\t};\n\t\tyield {\n\t\t\ttype: \"primitive\",\n\t\t\tvalue: primitives[i]\n\t\t};\n\t}\n\tyield { type: \"endObject\" };\n}\n//#endregion\n//#region src/encode/normalize.ts\nfunction normalizeValue(value) {\n\tif (value === null) return null;\n\tif (typeof value === \"object\" && value !== null && \"toJSON\" in value && typeof value.toJSON === \"function\") {\n\t\tconst next = value.toJSON();\n\t\tif (next !== value) return normalizeValue(next);\n\t}\n\tif (typeof value === \"string\" || typeof value === \"boolean\") return value;\n\tif (typeof value === \"number\") {\n\t\tif (Object.is(value, -0)) return 0;\n\t\tif (!Number.isFinite(value)) return null;\n\t\treturn value;\n\t}\n\tif (typeof value === \"bigint\") {\n\t\tif (value >= Number.MIN_SAFE_INTEGER && value <= Number.MAX_SAFE_INTEGER) return Number(value);\n\t\treturn value.toString();\n\t}\n\tif (value instanceof Date) return value.toISOString();\n\tif (Array.isArray(value)) return value.map(normalizeValue);\n\tif (value instanceof Set) return Array.from(value).map(normalizeValue);\n\tif (value instanceof Map) return Object.fromEntries(Array.from(value, ([k, v]) => [String(k), normalizeValue(v)]));\n\tif (isPlainObject(value)) {\n\t\tconst encodedValues = {};\n\t\tfor (const key in value) if (Object.hasOwn(value, key)) encodedValues[key] = normalizeValue(value[key]);\n\t\treturn encodedValues;\n\t}\n\treturn null;\n}\nfunction isJsonPrimitive(value) {\n\treturn value === null || typeof value === \"string\" || typeof value === \"number\" || typeof value === \"boolean\";\n}\nfunction isJsonArray(value) {\n\treturn Array.isArray(value);\n}\nfunction isJsonObject(value) {\n\treturn value !== null && typeof value === \"object\" && !Array.isArray(value);\n}\nfunction isEmptyObject(value) {\n\treturn Object.keys(value).length === 0;\n}\nfunction isPlainObject(value) {\n\tif (value === null || typeof value !== \"object\") return false;\n\tconst prototype = Object.getPrototypeOf(value);\n\treturn prototype === null || prototype === Object.prototype;\n}\nfunction isArrayOfPrimitives(value) {\n\treturn value.length === 0 || value.every((item) => isJsonPrimitive(item));\n}\nfunction isArrayOfArrays(value) {\n\treturn value.length === 0 || value.every((item) => isJsonArray(item));\n}\nfunction isArrayOfObjects(value) {\n\treturn value.length === 0 || value.every((item) => isJsonObject(item));\n}\n//#endregion\n//#region src/shared/validation.ts\nconst NUMERIC_LIKE_PATTERN = /^-?\\d+(?:\\.\\d+)?(?:e[+-]?\\d+)?$/i;\nconst LEADING_ZERO_PATTERN = /^0\\d+$/;\n/**\n* Checks if a key can be used without quotes.\n*\n* @remarks\n* Valid unquoted keys must start with a letter or underscore,\n* followed by letters, digits, underscores, or dots.\n*/\nfunction isValidUnquotedKey(key) {\n\treturn /^[A-Z_][\\w.]*$/i.test(key);\n}\n/**\n* Checks if a key segment is a valid identifier for safe folding/expansion.\n*\n* @remarks\n* Identifier segments are more restrictive than unquoted keys:\n* - Must start with a letter or underscore\n* - Followed only by letters, digits, or underscores (no dots)\n* - Used for safe key folding and path expansion\n*/\nfunction isIdentifierSegment(key) {\n\treturn /^[A-Z_]\\w*$/i.test(key);\n}\n/**\n* Determines if a string value can be safely encoded without quotes.\n*\n* @remarks\n* A string needs quoting if it:\n* - Is empty\n* - Has leading or trailing whitespace\n* - Could be confused with a literal (boolean, null, number)\n* - Contains structural characters (colons, brackets, braces)\n* - Contains quotes or backslashes (need escaping)\n* - Contains control characters (newlines, tabs, etc.)\n* - Contains the active delimiter\n* - Starts with a list marker (hyphen)\n*/\nfunction isSafeUnquoted(value, delimiter = DEFAULT_DELIMITER) {\n\tif (!value) return false;\n\tif (value !== value.trim()) return false;\n\tif (isBooleanOrNullLiteral(value) || isNumericLike(value)) return false;\n\tif (value.includes(\":\")) return false;\n\tif (value.includes(\"\\\"\") || value.includes(\"\\\\\")) return false;\n\tif (/[[\\]{}]/.test(value)) return false;\n\tif (/[\\u0000-\\u001F]/.test(value)) return false;\n\tif (value.includes(delimiter)) return false;\n\tif (value.startsWith(\"-\")) return false;\n\treturn true;\n}\n/**\n* Checks if a string looks like a number.\n*\n* @remarks\n* Match numbers like `42`, `-3.14`, `1e-6`, `05`, etc.\n*/\nfunction isNumericLike(value) {\n\treturn NUMERIC_LIKE_PATTERN.test(value) || LEADING_ZERO_PATTERN.test(value);\n}\n//#endregion\n//#region src/decode/expand.ts\n/**\n* Symbol used to mark object keys that were originally quoted in the TOON source.\n* Quoted dotted keys should not be expanded, even if they meet expansion criteria.\n*/\nconst QUOTED_KEY_MARKER = Symbol(\"quotedKey\");\n/**\n* Expands dotted keys into nested objects in safe mode.\n*\n* @remarks\n* This function recursively traverses a decoded TOON value and expands any keys\n* containing dots (`.`) into nested object structures, provided all segments\n* are valid identifiers.\n*\n* Expansion rules:\n* - Keys containing dots are split into segments\n* - All segments must pass `isIdentifierSegment` validation\n* - Non-eligible keys (with special characters) are left as literal dotted keys\n* - Deep merge: When multiple dotted keys expand to the same path, their values are merged if both are objects\n* - Conflict handling:\n* - `strict=true`: Throws TypeError on conflicts (non-object collision)\n* - `strict=false`: LWW (silent overwrite)\n*\n* @param value - The decoded value to expand\n* @param strict - Whether to throw errors on conflicts\n* @returns The expanded value with dotted keys reconstructed as nested objects\n* @throws TypeError if conflicts occur in strict mode\n*/\nfunction expandPathsSafe(value, strict) {\n\tif (Array.isArray(value)) return value.map((item) => expandPathsSafe(item, strict));\n\tif (isJsonObject(value)) {\n\t\tconst expandedObject = {};\n\t\tconst quotedKeys = value[QUOTED_KEY_MARKER];\n\t\tfor (const [key, keyValue] of Object.entries(value)) {\n\t\t\tconst isQuoted = quotedKeys?.has(key);\n\t\t\tif (key.includes(\".\") && !isQuoted) {\n\t\t\t\tconst segments = key.split(\".\");\n\t\t\t\tif (segments.every((seg) => isIdentifierSegment(seg))) {\n\t\t\t\t\tinsertPathSafe(expandedObject, segments, expandPathsSafe(keyValue, strict), strict);\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst expandedValue = expandPathsSafe(keyValue, strict);\n\t\t\tif (key in expandedObject) {\n\t\t\t\tconst conflictingValue = expandedObject[key];\n\t\t\t\tif (canMerge(conflictingValue, expandedValue)) mergeObjects(conflictingValue, expandedValue, strict);\n\t\t\t\telse {\n\t\t\t\t\tif (strict) throw new TypeError(`Path expansion conflict at key \"${key}\": cannot merge ${typeof conflictingValue} with ${typeof expandedValue}`);\n\t\t\t\t\texpandedObject[key] = expandedValue;\n\t\t\t\t}\n\t\t\t} else expandedObject[key] = expandedValue;\n\t\t}\n\t\treturn expandedObject;\n\t}\n\treturn value;\n}\n/**\n* Inserts a value at a nested path, creating intermediate objects as needed.\n*\n* @remarks\n* This function walks the segment path, creating nested objects as needed.\n* When an existing value is encountered:\n* - If both are objects: deep merge (continue insertion)\n* - If values differ: conflict\n* - strict=true: throw TypeError\n* - strict=false: overwrite with new value (LWW)\n*\n* @param target - The object to insert into\n* @param segments - Array of path segments (e.g., ['data', 'metadata', 'items'])\n* @param value - The value to insert at the end of the path\n* @param strict - Whether to throw on conflicts\n* @throws TypeError if a conflict occurs in strict mode\n*/\nfunction insertPathSafe(target, segments, value, strict) {\n\tlet currentNode = target;\n\tfor (let i = 0; i < segments.length - 1; i++) {\n\t\tconst currentSegment = segments[i];\n\t\tconst segmentValue = currentNode[currentSegment];\n\t\tif (segmentValue === void 0) {\n\t\t\tconst newObj = {};\n\t\t\tcurrentNode[currentSegment] = newObj;\n\t\t\tcurrentNode = newObj;\n\t\t} else if (isJsonObject(segmentValue)) currentNode = segmentValue;\n\t\telse {\n\t\t\tif (strict) throw new TypeError(`Path expansion conflict at segment \"${currentSegment}\": expected object but found ${typeof segmentValue}`);\n\t\t\tconst newObj = {};\n\t\t\tcurrentNode[currentSegment] = newObj;\n\t\t\tcurrentNode = newObj;\n\t\t}\n\t}\n\tconst lastSeg = segments[segments.length - 1];\n\tconst destinationValue = currentNode[lastSeg];\n\tif (destinationValue === void 0) currentNode[lastSeg] = value;\n\telse if (canMerge(destinationValue, value)) mergeObjects(destinationValue, value, strict);\n\telse {\n\t\tif (strict) throw new TypeError(`Path expansion conflict at key \"${lastSeg}\": cannot merge ${typeof destinationValue} with ${typeof value}`);\n\t\tcurrentNode[lastSeg] = value;\n\t}\n}\n/**\n* Deep merges properties from source into target.\n*\n* @remarks\n* For each key in source:\n* - If key doesn't exist in target: copy it\n* - If both values are objects: recursively merge\n* - Otherwise: conflict (strict throws, non-strict overwrites)\n*\n* @param target - The target object to merge into\n* @param source - The source object to merge from\n* @param strict - Whether to throw on conflicts\n* @throws TypeError if a conflict occurs in strict mode\n*/\nfunction mergeObjects(target, source, strict) {\n\tfor (const [key, sourceValue] of Object.entries(source)) {\n\t\tconst targetValue = target[key];\n\t\tif (targetValue === void 0) target[key] = sourceValue;\n\t\telse if (canMerge(targetValue, sourceValue)) mergeObjects(targetValue, sourceValue, strict);\n\t\telse {\n\t\t\tif (strict) throw new TypeError(`Path expansion conflict at key \"${key}\": cannot merge ${typeof targetValue} with ${typeof sourceValue}`);\n\t\t\ttarget[key] = sourceValue;\n\t\t}\n\t}\n}\nfunction canMerge(a, b) {\n\treturn isJsonObject(a) && isJsonObject(b);\n}\n//#endregion\n//#region src/decode/event-builder.ts\nfunction buildValueFromEvents(events) {\n\tconst state = {\n\t\tstack: [],\n\t\troot: void 0\n\t};\n\tfor (const event of events) applyEvent(state, event);\n\treturn finalizeState(state);\n}\nfunction applyEvent(state, event) {\n\tconst { stack } = state;\n\tswitch (event.type) {\n\t\tcase \"startObject\": {\n\t\t\tconst obj = {};\n\t\t\tconst quotedKeys = /* @__PURE__ */ new Set();\n\t\t\tif (stack.length === 0) stack.push({\n\t\t\t\ttype: \"object\",\n\t\t\t\tobj,\n\t\t\t\tquotedKeys\n\t\t\t});\n\t\t\telse {\n\t\t\t\tconst parent = stack[stack.length - 1];\n\t\t\t\tif (parent.type === \"object\") {\n\t\t\t\t\tif (parent.currentKey === void 0) throw new Error(\"Object startObject event without preceding key\");\n\t\t\t\t\tparent.obj[parent.currentKey] = obj;\n\t\t\t\t\tparent.currentKey = void 0;\n\t\t\t\t} else if (parent.type === \"array\") parent.arr.push(obj);\n\t\t\t\tstack.push({\n\t\t\t\t\ttype: \"object\",\n\t\t\t\t\tobj,\n\t\t\t\t\tquotedKeys\n\t\t\t\t});\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"endObject\": {\n\t\t\tif (stack.length === 0) throw new Error(\"Unexpected endObject event\");\n\t\t\tconst context = stack.pop();\n\t\t\tif (context.type !== \"object\") throw new Error(\"Mismatched endObject event\");\n\t\t\tif (context.quotedKeys.size > 0) Object.defineProperty(context.obj, QUOTED_KEY_MARKER, {\n\t\t\t\tvalue: context.quotedKeys,\n\t\t\t\tenumerable: false,\n\t\t\t\twritable: false,\n\t\t\t\tconfigurable: false\n\t\t\t});\n\t\t\tif (stack.length === 0) state.root = context.obj;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"startArray\": {\n\t\t\tconst arr = [];\n\t\t\tif (stack.length === 0) stack.push({\n\t\t\t\ttype: \"array\",\n\t\t\t\tarr\n\t\t\t});\n\t\t\telse {\n\t\t\t\tconst parent = stack[stack.length - 1];\n\t\t\t\tif (parent.type === \"object\") {\n\t\t\t\t\tif (parent.currentKey === void 0) throw new Error(\"Array startArray event without preceding key\");\n\t\t\t\t\tparent.obj[parent.currentKey] = arr;\n\t\t\t\t\tparent.currentKey = void 0;\n\t\t\t\t} else if (parent.type === \"array\") parent.arr.push(arr);\n\t\t\t\tstack.push({\n\t\t\t\t\ttype: \"array\",\n\t\t\t\t\tarr\n\t\t\t\t});\n\t\t\t}\n\t\t\tbreak;\n\t\t}\n\t\tcase \"endArray\": {\n\t\t\tif (stack.length === 0) throw new Error(\"Unexpected endArray event\");\n\t\t\tconst context = stack.pop();\n\t\t\tif (context.type !== \"array\") throw new Error(\"Mismatched endArray event\");\n\t\t\tif (stack.length === 0) state.root = context.arr;\n\t\t\tbreak;\n\t\t}\n\t\tcase \"key\": {\n\t\t\tif (stack.length === 0) throw new Error(\"Key event outside of object context\");\n\t\t\tconst parent = stack[stack.length - 1];\n\t\t\tif (parent.type !== \"object\") throw new Error(\"Key event in non-object context\");\n\t\t\tparent.currentKey = event.key;\n\t\t\tif (event.wasQuoted) parent.quotedKeys.add(event.key);\n\t\t\tbreak;\n\t\t}\n\t\tcase \"primitive\":\n\t\t\tif (stack.length === 0) state.root = event.value;\n\t\t\telse {\n\t\t\t\tconst parent = stack[stack.length - 1];\n\t\t\t\tif (parent.type === \"object\") {\n\t\t\t\t\tif (parent.currentKey === void 0) throw new Error(\"Primitive event without preceding key in object\");\n\t\t\t\t\tparent.obj[parent.currentKey] = event.value;\n\t\t\t\t\tparent.currentKey = void 0;\n\t\t\t\t} else if (parent.type === \"array\") parent.arr.push(event.value);\n\t\t\t}\n\t\t\tbreak;\n\t}\n}\nfunction finalizeState(state) {\n\tif (state.stack.length !== 0) throw new Error(\"Incomplete event stream: stack not empty at end\");\n\tif (state.root === void 0) throw new Error(\"No root value built from events\");\n\treturn state.root;\n}\n//#endregion\n//#region src/encode/folding.ts\n/**\n* Attempts to fold a single-key object chain into a dotted path.\n*\n* @remarks\n* Folding traverses nested objects with single keys, collapsing them into a dotted path.\n* It stops when:\n* - A non-single-key object is encountered\n* - An array is encountered (arrays are not \"single-key objects\")\n* - A primitive value is reached\n* - The flatten depth limit is reached\n* - Any segment fails safe mode validation\n*\n* Safe mode requirements:\n* - `options.keyFolding` must be `'safe'`\n* - Every segment must be a valid identifier (no dots, no special chars)\n* - The folded key must not collide with existing sibling keys\n* - No segment should require quoting\n*\n* @param key - The starting key to fold\n* @param value - The value associated with the key\n* @param siblings - Array of all sibling keys at this level (for collision detection)\n* @param options - Resolved encoding options\n* @returns A FoldResult if folding is possible, undefined otherwise\n*/\nfunction tryFoldKeyChain(key, value, siblings, options, rootLiteralKeys, pathPrefix, flattenDepth) {\n\tif (options.keyFolding !== \"safe\") return;\n\tif (!isJsonObject(value)) return;\n\tconst { segments, tail, leafValue } = collectSingleKeyChain(key, value, flattenDepth ?? options.flattenDepth);\n\tif (segments.length < 2) return;\n\tif (!segments.every((seg) => isIdentifierSegment(seg))) return;\n\tconst foldedKey = buildFoldedKey(segments);\n\tconst absolutePath = pathPrefix ? `${pathPrefix}.${foldedKey}` : foldedKey;\n\tif (siblings.includes(foldedKey)) return;\n\tif (rootLiteralKeys && rootLiteralKeys.has(absolutePath)) return;\n\treturn {\n\t\tfoldedKey,\n\t\tremainder: tail,\n\t\tleafValue,\n\t\tsegmentCount: segments.length\n\t};\n}\n/**\n* Collects a chain of single-key objects into segments.\n*\n* @remarks\n* Traverses nested objects, collecting keys until:\n* - A non-single-key object is found\n* - An array is encountered\n* - A primitive is reached\n* - An empty object is reached\n* - The depth limit is reached\n*\n* @param startKey - The initial key to start the chain\n* @param startValue - The value to traverse\n* @param maxDepth - Maximum number of segments to collect\n* @returns Object containing segments array, tail value, and leaf value\n*/\nfunction collectSingleKeyChain(startKey, startValue, maxDepth) {\n\tconst segments = [startKey];\n\tlet currentValue = startValue;\n\twhile (segments.length < maxDepth) {\n\t\tif (!isJsonObject(currentValue)) break;\n\t\tconst keys = Object.keys(currentValue);\n\t\tif (keys.length !== 1) break;\n\t\tconst nextKey = keys[0];\n\t\tconst nextValue = currentValue[nextKey];\n\t\tsegments.push(nextKey);\n\t\tcurrentValue = nextValue;\n\t}\n\tif (!isJsonObject(currentValue) || isEmptyObject(currentValue)) return {\n\t\tsegments,\n\t\ttail: void 0,\n\t\tleafValue: currentValue\n\t};\n\treturn {\n\t\tsegments,\n\t\ttail: currentValue,\n\t\tleafValue: currentValue\n\t};\n}\nfunction buildFoldedKey(segments) {\n\treturn segments.join(\".\");\n}\n//#endregion\n//#region src/encode/primitives.ts\nfunction encodePrimitive(value, delimiter) {\n\tif (value === null) return NULL_LITERAL;\n\tif (typeof value === \"boolean\") return String(value);\n\tif (typeof value === \"number\") return String(value);\n\treturn encodeStringLiteral(value, delimiter);\n}\nfunction encodeStringLiteral(value, delimiter = DEFAULT_DELIMITER) {\n\tif (isSafeUnquoted(value, delimiter)) return value;\n\treturn `\"${escapeString(value)}\"`;\n}\nfunction encodeKey(key) {\n\tif (isValidUnquotedKey(key)) return key;\n\treturn `\"${escapeString(key)}\"`;\n}\nfunction encodeAndJoinPrimitives(values, delimiter = DEFAULT_DELIMITER) {\n\treturn values.map((v) => encodePrimitive(v, delimiter)).join(delimiter);\n}\nfunction formatHeader(length, options) {\n\tconst key = options?.key;\n\tconst fields = options?.fields;\n\tconst delimiter = options?.delimiter ?? \",\";\n\tlet header = \"\";\n\tif (key != null) header += encodeKey(key);\n\theader += `[${length}${delimiter !== DEFAULT_DELIMITER ? delimiter : \"\"}]`;\n\tif (fields) {\n\t\tconst quotedFields = fields.map((f) => encodeKey(f));\n\t\theader += `{${quotedFields.join(delimiter)}}`;\n\t}\n\theader += \":\";\n\treturn header;\n}\n//#endregion\n//#region src/encode/encoders.ts\nfunction* encodeJsonValue(value, options, depth) {\n\tif (isJsonPrimitive(value)) {\n\t\tconst encodedPrimitive = encodePrimitive(value, options.delimiter);\n\t\tif (encodedPrimitive !== \"\") yield encodedPrimitive;\n\t\treturn;\n\t}\n\tif (isJsonArray(value)) yield* encodeArrayLines(void 0, value, depth, options);\n\telse if (isJsonObject(value)) yield* encodeObjectLines(value, depth, options);\n}\nfunction* encodeObjectLines(value, depth, options, rootLiteralKeys, pathPrefix, remainingDepth) {\n\tconst keys = Object.keys(value);\n\tif (depth === 0 && !rootLiteralKeys) rootLiteralKeys = new Set(keys.filter((k) => k.includes(\".\")));\n\tconst effectiveFlattenDepth = remainingDepth ?? options.flattenDepth;\n\tfor (const [key, val] of Object.entries(value)) yield* encodeKeyValuePairLines(key, val, depth, options, keys, rootLiteralKeys, pathPrefix, effectiveFlattenDepth);\n}\nfunction* encodeKeyValuePairLines(key, value, depth, options, siblings, rootLiteralKeys, pathPrefix, flattenDepth) {\n\tconst currentPath = pathPrefix ? `${pathPrefix}.${key}` : key;\n\tconst effectiveFlattenDepth = flattenDepth ?? options.flattenDepth;\n\tif (options.keyFolding === \"safe\" && siblings) {\n\t\tconst foldResult = tryFoldKeyChain(key, value, siblings, options, rootLiteralKeys, pathPrefix, effectiveFlattenDepth);\n\t\tif (foldResult) {\n\t\t\tconst { foldedKey, remainder, leafValue, segmentCount } = foldResult;\n\t\t\tconst encodedFoldedKey = encodeKey(foldedKey);\n\t\t\tif (remainder === void 0) {\n\t\t\t\tif (isJsonPrimitive(leafValue)) {\n\t\t\t\t\tyield indentedLine(depth, `${encodedFoldedKey}: ${encodePrimitive(leafValue, options.delimiter)}`, options.indent);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (isJsonArray(leafValue)) {\n\t\t\t\t\tyield* encodeArrayLines(foldedKey, leafValue, depth, options);\n\t\t\t\t\treturn;\n\t\t\t\t} else if (isJsonObject(leafValue) && isEmptyObject(leafValue)) {\n\t\t\t\t\tyield indentedLine(depth, `${encodedFoldedKey}:`, options.indent);\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (isJsonObject(remainder)) {\n\t\t\t\tyield indentedLine(depth, `${encodedFoldedKey}:`, options.indent);\n\t\t\t\tconst remainingDepth = effectiveFlattenDepth - segmentCount;\n\t\t\t\tconst foldedPath = pathPrefix ? `${pathPrefix}.${foldedKey}` : foldedKey;\n\t\t\t\tyield* encodeObjectLines(remainder, depth + 1, options, rootLiteralKeys, foldedPath, remainingDepth);\n\t\t\t\treturn;\n\t\t\t}\n\t\t}\n\t}\n\tconst encodedKey = encodeKey(key);\n\tif (isJsonPrimitive(value)) yield indentedLine(depth, `${encodedKey}: ${encodePrimitive(value, options.delimiter)}`, options.indent);\n\telse if (isJsonArray(value)) yield* encodeArrayLines(key, value, depth, options);\n\telse if (isJsonObject(value)) {\n\t\tyield indentedLine(depth, `${encodedKey}:`, options.indent);\n\t\tif (!isEmptyObject(value)) yield* encodeObjectLines(value, depth + 1, options, rootLiteralKeys, currentPath, effectiveFlattenDepth);\n\t}\n}\nfunction* encodeArrayLines(key, value, depth, options) {\n\tif (value.length === 0) {\n\t\tyield indentedLine(depth, key != null ? `${encodeKey(key)}: []` : \"[]\", options.indent);\n\t\treturn;\n\t}\n\tif (isArrayOfPrimitives(value)) {\n\t\tyield indentedLine(depth, encodeInlineArrayLine(value, options.delimiter, key), options.indent);\n\t\treturn;\n\t}\n\tif (isArrayOfArrays(value)) {\n\t\tif (value.every((arr) => isArrayOfPrimitives(arr))) {\n\t\t\tyield* encodeArrayOfArraysAsListItemsLines(key, value, depth, options);\n\t\t\treturn;\n\t\t}\n\t}\n\tif (isArrayOfObjects(value)) {\n\t\tconst header = extractTabularHeader(value);\n\t\tif (header) yield* encodeArrayOfObjectsAsTabularLines(key, value, header, depth, options);\n\t\telse yield* encodeMixedArrayAsListItemsLines(key, value, depth, options);\n\t\treturn;\n\t}\n\tyield* encodeMixedArrayAsListItemsLines(key, value, depth, options);\n}\nfunction* encodeArrayOfArraysAsListItemsLines(prefix, values, depth, options) {\n\tyield indentedLine(depth, formatHeader(values.length, {\n\t\tkey: prefix,\n\t\tdelimiter: options.delimiter\n\t}), options.indent);\n\tfor (const arr of values) if (isArrayOfPrimitives(arr)) {\n\t\tconst arrayLine = encodeInlineArrayLine(arr, options.delimiter);\n\t\tyield indentedListItem(depth + 1, arrayLine, options.indent);\n\t}\n}\nfunction encodeInlineArrayLine(values, delimiter, prefix) {\n\tconst header = formatHeader(values.length, {\n\t\tkey: prefix,\n\t\tdelimiter\n\t});\n\tconst joinedValue = encodeAndJoinPrimitives(values, delimiter);\n\tif (values.length === 0) return header;\n\treturn `${header} ${joinedValue}`;\n}\nfunction* encodeArrayOfObjectsAsTabularLines(prefix, rows, header, depth, options) {\n\tyield indentedLine(depth, formatHeader(rows.length, {\n\t\tkey: prefix,\n\t\tfields: header,\n\t\tdelimiter: options.delimiter\n\t}), options.indent);\n\tyield* writeTabularRowsLines(rows, header, depth + 1, options);\n}\nfunction extractTabularHeader(rows) {\n\tif (rows.length === 0) return;\n\tconst firstRow = rows[0];\n\tconst firstKeys = Object.keys(firstRow);\n\tif (firstKeys.length === 0) return;\n\tif (isTabularArray(rows, firstKeys)) return firstKeys;\n}\nfunction isTabularArray(rows, header) {\n\tfor (const row of rows) {\n\t\tif (Object.keys(row).length !== header.length) return false;\n\t\tfor (const key of header) {\n\t\t\tif (!(key in row)) return false;\n\t\t\tif (!isJsonPrimitive(row[key])) return false;\n\t\t}\n\t}\n\treturn true;\n}\nfunction* writeTabularRowsLines(rows, header, depth, options) {\n\tfor (const row of rows) yield indentedLine(depth, encodeAndJoinPrimitives(header.map((key) => row[key]), options.delimiter), options.indent);\n}\nfunction* encodeMixedArrayAsListItemsLines(prefix, items, depth, options) {\n\tyield indentedLine(depth, formatHeader(items.length, {\n\t\tkey: prefix,\n\t\tdelimiter: options.delimiter\n\t}), options.indent);\n\tfor (const item of items) yield* encodeListItemValueLines(item, depth + 1, options);\n}\nfunction* encodeObjectAsListItemLines(obj, depth, options) {\n\tif (isEmptyObject(obj)) {\n\t\tyield indentedLine(depth, \"-\", options.indent);\n\t\treturn;\n\t}\n\tconst entries = Object.entries(obj);\n\tconst [firstKey, firstValue] = entries[0];\n\tconst restEntries = entries.slice(1);\n\tif (isJsonArray(firstValue) && isArrayOfObjects(firstValue)) {\n\t\tconst header = extractTabularHeader(firstValue);\n\t\tif (header) {\n\t\t\tyield indentedListItem(depth, formatHeader(firstValue.length, {\n\t\t\t\tkey: firstKey,\n\t\t\t\tfields: header,\n\t\t\t\tdelimiter: options.delimiter\n\t\t\t}), options.indent);\n\t\t\tyield* writeTabularRowsLines(firstValue, header, depth + 2, options);\n\t\t\tif (restEntries.length > 0) yield* encodeObjectLines(Object.fromEntries(restEntries), depth + 1, options);\n\t\t\treturn;\n\t\t}\n\t}\n\tconst encodedKey = encodeKey(firstKey);\n\tif (isJsonPrimitive(firstValue)) yield indentedListItem(depth, `${encodedKey}: ${encodePrimitive(firstValue, options.delimiter)}`, options.indent);\n\telse if (isJsonArray(firstValue)) if (firstValue.length === 0) yield indentedListItem(depth, `${encodedKey}: []`, options.indent);\n\telse if (isArrayOfPrimitives(firstValue)) yield indentedListItem(depth, `${encodedKey}${encodeInlineArrayLine(firstValue, options.delimiter)}`, options.indent);\n\telse {\n\t\tyield indentedListItem(depth, `${encodedKey}${formatHeader(firstValue.length, { delimiter: options.delimiter })}`, options.indent);\n\t\tfor (const item of firstValue) yield* encodeListItemValueLines(item, depth + 2, options);\n\t}\n\telse if (isJsonObject(firstValue)) {\n\t\tyield indentedListItem(depth, `${encodedKey}:`, options.indent);\n\t\tif (!isEmptyObject(firstValue)) yield* encodeObjectLines(firstValue, depth + 2, options);\n\t}\n\tif (restEntries.length > 0) yield* encodeObjectLines(Object.fromEntries(restEntries), depth + 1, options);\n}\nfunction* encodeListItemValueLines(value, depth, options) {\n\tif (isJsonPrimitive(value)) yield indentedListItem(depth, encodePrimitive(value, options.delimiter), options.indent);\n\telse if (isJsonArray(value)) if (isArrayOfPrimitives(value)) yield indentedListItem(depth, encodeInlineArrayLine(value, options.delimiter), options.indent);\n\telse {\n\t\tyield indentedListItem(depth, formatHeader(value.length, { delimiter: options.delimiter }), options.indent);\n\t\tfor (const item of value) yield* encodeListItemValueLines(item, depth + 1, options);\n\t}\n\telse if (isJsonObject(value)) yield* encodeObjectAsListItemLines(value, depth, options);\n}\nfunction indentedLine(depth, content, indentSize) {\n\treturn \" \".repeat(indentSize * depth) + content;\n}\nfunction indentedListItem(depth, content, indentSize) {\n\treturn indentedLine(depth, \"- \" + content, indentSize);\n}\n//#endregion\n//#region src/encode/replacer.ts\n/**\n* Applies a replacer function to a `JsonValue` and all its descendants.\n*\n* The replacer is called for:\n* - The root value (with key='', path=[])\n* - Every object property (with the property name as key)\n* - Every array element (with the string index as key: '0', '1', etc.)\n*\n* @param root - The normalized `JsonValue` to transform\n* @param replacer - The replacer function to apply\n* @returns The transformed `JsonValue`\n*/\nfunction applyReplacer(root, replacer) {\n\tconst replacedRoot = replacer(\"\", root, []);\n\tif (replacedRoot === void 0) return transformChildren(root, replacer, []);\n\treturn transformChildren(normalizeValue(replacedRoot), replacer, []);\n}\n/**\n* Recursively transforms the children of a `JsonValue` using the replacer.\n*\n* @param value - The value whose children should be transformed\n* @param replacer - The replacer function to apply\n* @param path - Current path from root\n* @returns The value with transformed children\n*/\nfunction transformChildren(value, replacer, path) {\n\tif (isJsonObject(value)) return transformObject(value, replacer, path);\n\tif (isJsonArray(value)) return transformArray(value, replacer, path);\n\treturn value;\n}\n/**\n* Transforms an object by applying the replacer to each property.\n*\n* @param obj - The object to transform\n* @param replacer - The replacer function to apply\n* @param path - Current path from root\n* @returns A new object with transformed properties\n*/\nfunction transformObject(obj, replacer, path) {\n\tconst result = {};\n\tfor (const [key, value] of Object.entries(obj)) {\n\t\tconst childPath = [...path, key];\n\t\tconst replacedValue = replacer(key, value, childPath);\n\t\tif (replacedValue === void 0) continue;\n\t\tresult[key] = transformChildren(normalizeValue(replacedValue), replacer, childPath);\n\t}\n\treturn result;\n}\n/**\n* Transforms an array by applying the replacer to each element.\n*\n* @param arr - The array to transform\n* @param replacer - The replacer function to apply\n* @param path - Current path from root\n* @returns A new array with transformed elements\n*/\nfunction transformArray(arr, replacer, path) {\n\tconst result = [];\n\tfor (let i = 0; i < arr.length; i++) {\n\t\tconst value = arr[i];\n\t\tconst childPath = [...path, i];\n\t\tconst replacedValue = replacer(String(i), value, childPath);\n\t\tif (replacedValue === void 0) continue;\n\t\tconst normalizedValue = normalizeValue(replacedValue);\n\t\tresult.push(transformChildren(normalizedValue, replacer, childPath));\n\t}\n\treturn result;\n}\n//#endregion\n//#region src/index.ts\n/**\n* Encodes a JavaScript value into TOON format string.\n*\n* @param input - Any JavaScript value (objects, arrays, primitives)\n* @param options - Optional encoding configuration\n* @returns TOON formatted string\n*\n* @example\n* ```ts\n* encode({ name: 'Alice', age: 30 })\n* // name: Alice\n* // age: 30\n*\n* encode({ users: [{ id: 1 }, { id: 2 }] })\n* // users[2]{id}:\n* // 1\n* // 2\n*\n* encode({ tags: [] })\n* // tags: []\n*\n* encode(data, { indent: 4, keyFolding: 'safe' })\n* ```\n*/\nfunction encode(input, options) {\n\treturn Array.from(encodeLines(input, options)).join(\"\\n\");\n}\n/**\n* Decodes a TOON format string into a JavaScript value.\n*\n* @param input - TOON formatted string\n* @param options - Optional decoding configuration\n* @returns Parsed JavaScript value (object, array, or primitive)\n*\n* @example\n* ```ts\n* decode('name: Alice\\nage: 30')\n* // { name: 'Alice', age: 30 }\n*\n* decode('users[2]:\\n - id: 1\\n - id: 2')\n* // { users: [{ id: 1 }, { id: 2 }] }\n*\n* decode('tags: []')\n* // { tags: [] }\n*\n* decode(toonString, { strict: false, expandPaths: 'safe' })\n* ```\n*/\nfunction decode(input, options) {\n\treturn decodeFromLines(input.split(\"\\n\"), options);\n}\n/**\n* Encodes a JavaScript value into TOON format as a sequence of lines.\n*\n* This function yields TOON lines one at a time without building the full string,\n* making it suitable for streaming large outputs to files, HTTP responses, or process stdout.\n*\n* @param input - Any JavaScript value (objects, arrays, primitives)\n* @param options - Optional encoding configuration\n* @returns Iterable of TOON lines (without trailing newlines)\n*\n* @example\n* ```ts\n* // Stream to stdout\n* for (const line of encodeLines({ name: 'Alice', age: 30 })) {\n* console.log(line)\n* }\n*\n* // Collect to array\n* const lines = Array.from(encodeLines(data))\n*\n* // Equivalent to encode()\n* const toonString = Array.from(encodeLines(data, options)).join('\\n')\n* ```\n*/\nfunction encodeLines(input, options) {\n\tconst normalizedValue = normalizeValue(input);\n\tconst resolvedOptions = resolveOptions(options);\n\treturn encodeJsonValue(resolvedOptions.replacer ? applyReplacer(normalizedValue, resolvedOptions.replacer) : normalizedValue, resolvedOptions, 0);\n}\n/**\n* Decodes TOON format from pre-split lines into a JavaScript value.\n*\n* This is a convenience wrapper around the streaming decoder that builds\n* the full value in memory. Useful when you already have lines as an array\n* or iterable and want the standard decode behavior with path expansion support.\n*\n* @param lines - Iterable of TOON lines (without newlines)\n* @param options - Optional decoding configuration (supports expandPaths)\n* @returns Parsed JavaScript value (object, array, or primitive)\n*\n* @example\n* ```ts\n* const lines = ['name: Alice', 'age: 30']\n* decodeFromLines(lines)\n* // { name: 'Alice', age: 30 }\n* ```\n*/\nfunction decodeFromLines(lines, options) {\n\tconst resolvedOptions = resolveDecodeOptions(options);\n\tconst decodedValue = buildValueFromEvents(decodeStreamSync$1(lines, {\n\t\tindent: resolvedOptions.indent,\n\t\tstrict: resolvedOptions.strict\n\t}));\n\tif (resolvedOptions.expandPaths === \"safe\") return expandPathsSafe(decodedValue, resolvedOptions.strict);\n\treturn decodedValue;\n}\n/**\n* Synchronously decodes TOON lines into a stream of JSON events.\n*\n* This function yields structured events (startObject, endObject, startArray, endArray,\n* key, primitive) that represent the JSON data model without building the full value tree.\n* Useful for streaming processing, custom transformations, or memory-efficient parsing.\n*\n* @remarks\n* Path expansion (`expandPaths: 'safe'`) is not supported in streaming mode.\n*\n* @param lines - Iterable of TOON lines (without newlines)\n* @param options - Optional decoding configuration (expandPaths not supported)\n* @returns Iterable of JSON stream events\n*\n* @example\n* ```ts\n* const lines = ['name: Alice', 'age: 30']\n* for (const event of decodeStreamSync(lines)) {\n* console.log(event)\n* // { type: 'startObject' }\n* // { type: 'key', key: 'name' }\n* // { type: 'primitive', value: 'Alice' }\n* // ...\n* }\n* ```\n*/\nfunction decodeStreamSync(lines, options) {\n\treturn decodeStreamSync$1(lines, options);\n}\n/**\n* Asynchronously decodes TOON lines into a stream of JSON events.\n*\n* This function yields structured events (startObject, endObject, startArray, endArray,\n* key, primitive) that represent the JSON data model without building the full value tree.\n* Supports both sync and async iterables for maximum flexibility with file streams,\n* network responses, or other async sources.\n*\n* @remarks\n* Path expansion (`expandPaths: 'safe'`) is not supported in streaming mode.\n*\n* @param source - Async or sync iterable of TOON lines (without newlines)\n* @param options - Optional decoding configuration (expandPaths not supported)\n* @returns Async iterable of JSON stream events\n*\n* @example\n* ```ts\n* const fileStream = createReadStream('data.toon', 'utf-8')\n* const lines = splitLines(fileStream) // Async iterable of lines\n*\n* for await (const event of decodeStream(lines)) {\n* console.log(event)\n* // { type: 'startObject' }\n* // { type: 'key', key: 'name' }\n* // { type: 'primitive', value: 'Alice' }\n* // ...\n* }\n* ```\n*/\nfunction decodeStream(source, options) {\n\treturn decodeStream$1(source, options);\n}\nfunction resolveOptions(options) {\n\treturn {\n\t\tindent: options?.indent ?? 2,\n\t\tdelimiter: options?.delimiter ?? DEFAULT_DELIMITER,\n\t\tkeyFolding: options?.keyFolding ?? \"off\",\n\t\tflattenDepth: options?.flattenDepth ?? Number.POSITIVE_INFINITY,\n\t\treplacer: options?.replacer\n\t};\n}\nfunction resolveDecodeOptions(options) {\n\treturn {\n\t\tindent: options?.indent ?? 2,\n\t\tstrict: options?.strict ?? true,\n\t\texpandPaths: options?.expandPaths ?? \"off\"\n\t};\n}\n//#endregion\nexport { DEFAULT_DELIMITER, DELIMITERS, ToonDecodeError, decode, decodeFromLines, decodeStream, decodeStreamSync, encode, encodeLines };\n","import { encode } from '@toon-format/toon'\nimport { stringify as yamlStringify } from 'yaml'\n\n/** Supported output formats. */\nexport type Format = 'toon' | 'json' | 'yaml' | 'md' | 'jsonl'\n\n/** Serializes a value to the specified format. Defaults to TOON. */\nexport function format(value: unknown, fmt: Format = 'toon'): string {\n if (value == null) return ''\n if (fmt === 'json') {\n if (typeof value === 'string') {\n const trimmed = value.trim()\n if (trimmed.startsWith('{') || trimmed.startsWith('[')) {\n try {\n return JSON.stringify(JSON.parse(value), null, 2)\n } catch {}\n }\n }\n return JSON.stringify(value, null, 2)\n }\n if (fmt === 'yaml') return yamlStringify(value)\n if (fmt === 'md') return formatMarkdown(value)\n if (fmt === 'jsonl') {\n if (Array.isArray(value)) return value.map((v) => JSON.stringify(v)).join('\\n')\n return JSON.stringify(value)\n }\n // toon (default)\n if (isScalar(value)) return String(value)\n return encode(value as Record<string, unknown>)\n}\n\n/** Whether a value is a scalar (string, number, boolean, null, undefined). */\nfunction isScalar(value: unknown): boolean {\n return value === null || value === undefined || typeof value !== 'object'\n}\n\n/** Whether all values in an object are scalars. */\nfunction isFlat(obj: Record<string, unknown>): boolean {\n return Object.values(obj).every(isScalar)\n}\n\n/** Whether a value is an array of plain objects. */\nfunction isArrayOfObjects(value: unknown): value is Record<string, unknown>[] {\n return (\n Array.isArray(value) &&\n value.length > 0 &&\n value.every((v) => typeof v === 'object' && v !== null && !Array.isArray(v))\n )\n}\n\n/** Renders an aligned markdown table from headers and rows. */\nfunction table(headers: string[], rows: string[][]): string {\n const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => (r[i] ?? '').length)))\n const pad = (s: string, i: number) => s.padEnd(widths[i]!)\n const headerRow = `| ${headers.map(pad).join(' | ')} |`\n const sep = `|${widths.map((w) => '-'.repeat(w + 2)).join('|')}|`\n const body = rows.map((r) => `| ${headers.map((_, i) => pad(r[i] ?? '', i)).join(' | ')} |`)\n return `${headerRow}\\n${sep}\\n${body.join('\\n')}`\n}\n\n/** Renders a key-value table from a flat object. */\nfunction kvTable(obj: Record<string, unknown>): string {\n const entries = Object.entries(obj)\n return table(\n ['Key', 'Value'],\n entries.map(([k, v]) => [k, String(v)]),\n )\n}\n\n/** Renders a columnar table from an array of objects. */\nfunction columnarTable(items: Record<string, unknown>[]): string {\n const keys = [...new Set(items.flatMap(Object.keys))]\n return table(\n keys,\n items.map((item) => keys.map((k) => String(item[k] ?? ''))),\n )\n}\n\n/** Formats a value as Markdown, recursing into nested objects. */\nfunction formatMarkdown(value: unknown, path: string[] = []): string {\n if (isScalar(value)) {\n if (path.length === 0) return String(value)\n return `## ${path.join('.')}\\n\\n${String(value)}`\n }\n\n if (Array.isArray(value)) {\n if (isArrayOfObjects(value)) {\n const table = columnarTable(value)\n if (path.length === 0) return table\n return `## ${path.join('.')}\\n\\n${table}`\n }\n return formatMarkdown(String(value), path)\n }\n\n const obj = value as Record<string, unknown>\n const entries = Object.entries(obj)\n\n // Single flat object at root — no headings needed\n if (path.length === 0 && isFlat(obj)) return kvTable(obj)\n\n // Check if we need headings (mixed types or nested at root)\n const needsHeadings =\n path.length > 0 || entries.length > 1 || entries.some(([, v]) => !isScalar(v))\n\n if (needsHeadings) {\n const sections = entries.map(([key, val]) => {\n const childPath = [...path, key]\n if (isScalar(val)) return `## ${childPath.join('.')}\\n\\n${String(val)}`\n if (isArrayOfObjects(val)) return `## ${childPath.join('.')}\\n\\n${columnarTable(val)}`\n if (typeof val === 'object' && val !== null && !Array.isArray(val)) {\n const nested = val as Record<string, unknown>\n if (isFlat(nested)) return `## ${childPath.join('.')}\\n\\n${kvTable(nested)}`\n return formatMarkdown(nested, childPath)\n }\n return `## ${childPath.join('.')}\\n\\n${String(val)}`\n })\n return sections.join('\\n\\n')\n }\n\n return kvTable(obj)\n}\n","/** Checks whether a value is a plain object record. */\nexport function isRecord(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\n/** Converts a camelCase string to kebab-case. */\nexport function toKebab(value: string): string {\n return value.replace(/[A-Z]/g, (c) => `-${c.toLowerCase()}`)\n}\n\n/** Computes the Levenshtein edit distance between two strings. */\nexport function levenshtein(a: string, b: string): number {\n const m = a.length\n const n = b.length\n const dp: number[] = Array.from({ length: n + 1 }, (_, i) => i)\n for (let i = 1; i <= m; i++) {\n let prev = dp[0]!\n dp[0] = i\n for (let j = 1; j <= n; j++) {\n const tmp = dp[j]!\n dp[j] = a[i - 1] === b[j - 1] ? prev : 1 + Math.min(prev, dp[j]!, dp[j - 1]!)\n prev = tmp\n }\n }\n return dp[n]!\n}\n\n/** Suggests the closest command name from a set, returning it if within a reasonable edit distance. */\nexport function suggest(input: string, candidates: Iterable<string>): string | undefined {\n const threshold = input.length <= 4 ? 2 : Math.floor(input.length / 2)\n const lower = input.toLowerCase()\n const all = Array.isArray(candidates) ? candidates : [...candidates]\n\n let best: string | undefined\n let bestScore = Infinity\n\n for (const c of all) {\n const lc = c.toLowerCase()\n const dist = levenshtein(lower, lc)\n\n let score: number\n if (lc.startsWith(lower) && lc !== lower)\n // prefix match — best tier\n score = dist\n else if (lc.includes(lower))\n // contains match — middle tier\n score = 100 + dist\n else if (dist <= threshold)\n // fuzzy match — last tier\n score = 200 + dist\n else continue\n\n if (score < bestScore) {\n bestScore = score\n best = c\n }\n }\n return best\n}\n","import type { z } from 'zod'\n\nimport type { FieldError } from './Errors.js'\nimport { ParseError, ValidationError } from './Errors.js'\nimport { isRecord, toKebab } from './internal/helpers.js'\n\n/** Parses raw argv tokens against Zod schemas for args and options. */\nexport function parse<\n const args extends z.ZodObject<any> | undefined = undefined,\n const options extends z.ZodObject<any> | undefined = undefined,\n>(argv: string[], options: parse.Options<args, options> = {}): parse.ReturnType<args, options> {\n const { args: argsSchema, options: optionsSchema, alias, defaults } = options\n\n const optionNames = createOptionNames(optionsSchema, alias)\n\n // First pass: split argv into positional tokens and raw option values\n const positionals: string[] = []\n const rawArgvOptions: Record<string, unknown> = {}\n\n let i = 0\n while (i < argv.length) {\n const token = argv[i]!\n\n if (token.startsWith('--no-') && token.length > 5) {\n // --no-flag negation\n const name = normalizeOptionName(token.slice(5), optionNames)\n if (!name) throw new ParseError({ message: `Unknown flag: ${token}` })\n rawArgvOptions[name] = false\n i++\n } else if (token.startsWith('--')) {\n const eqIdx = token.indexOf('=')\n if (eqIdx !== -1) {\n // --flag=value\n const raw = token.slice(2, eqIdx)\n const name = normalizeOptionName(raw, optionNames)\n if (!name) throw new ParseError({ message: `Unknown flag: --${raw}` })\n setOption(rawArgvOptions, name, token.slice(eqIdx + 1), optionsSchema)\n i++\n } else {\n // --flag [value]\n const name = normalizeOptionName(token.slice(2), optionNames)\n if (!name) throw new ParseError({ message: `Unknown flag: ${token}` })\n if (isCountOption(name, optionsSchema)) {\n rawArgvOptions[name] = ((rawArgvOptions[name] as number) ?? 0) + 1\n i++\n } else if (isBooleanOption(name, optionsSchema)) {\n rawArgvOptions[name] = true\n i++\n } else {\n const value = argv[i + 1]\n if (value === undefined)\n throw new ParseError({ message: `Missing value for flag: ${token}` })\n setOption(rawArgvOptions, name, value, optionsSchema)\n i += 2\n }\n }\n } else if (token.startsWith('-') && !token.startsWith('--') && token.length >= 2) {\n // -f or -abc (stacked short aliases)\n const chars = token.slice(1)\n for (let j = 0; j < chars.length; j++) {\n const short = chars[j]!\n const name = optionNames.aliasToName.get(short)\n if (!name) throw new ParseError({ message: `Unknown flag: -${short}` })\n const isLast = j === chars.length - 1\n if (!isLast) {\n if (isCountOption(name, optionsSchema)) {\n rawArgvOptions[name] = ((rawArgvOptions[name] as number) ?? 0) + 1\n } else if (isBooleanOption(name, optionsSchema)) {\n rawArgvOptions[name] = true\n } else {\n throw new ParseError({\n message: `Non-boolean flag -${short} must be last in a stacked alias`,\n })\n }\n } else if (isCountOption(name, optionsSchema)) {\n rawArgvOptions[name] = ((rawArgvOptions[name] as number) ?? 0) + 1\n } else if (isBooleanOption(name, optionsSchema)) {\n rawArgvOptions[name] = true\n } else {\n const value = argv[i + 1]\n if (value === undefined)\n throw new ParseError({ message: `Missing value for flag: -${short}` })\n setOption(rawArgvOptions, name, value, optionsSchema)\n i++\n }\n }\n i++\n } else {\n positionals.push(token)\n i++\n }\n }\n\n // Assign positionals to args schema keys in order\n const rawArgs: Record<string, string> = {}\n if (argsSchema) {\n const keys = Object.keys(argsSchema.shape)\n for (let j = 0; j < keys.length; j++) {\n const key = keys[j]!\n if (positionals[j] !== undefined) {\n rawArgs[key] = positionals[j]!\n }\n }\n }\n\n // Validate args through zod\n const args = argsSchema ? zodParse(argsSchema, rawArgs) : {}\n\n const rawDefaults = normalizeOptionDefaults(defaults, optionsSchema, optionNames)\n\n // Coerce raw option values before zod validation\n if (optionsSchema) {\n for (const [name, value] of Object.entries(rawArgvOptions)) {\n rawArgvOptions[name] = coerce(value, name, optionsSchema)\n }\n }\n\n const mergedOptions = { ...rawDefaults, ...rawArgvOptions }\n\n // Validate options through zod\n const parsedOptions = optionsSchema ? zodParse(optionsSchema, mergedOptions) : {}\n\n return { args, options: parsedOptions } as parse.ReturnType<args, options>\n}\n\nexport declare namespace parse {\n /** Options for parsing. */\n type Options<\n args extends z.ZodObject<any> | undefined = undefined,\n options extends z.ZodObject<any> | undefined = undefined,\n > = {\n /** Zod schema for positional arguments. Keys define order. */\n args?: args\n /** Config-backed option defaults merged before argv parsing. */\n defaults?: options extends z.ZodObject<any> ? Partial<z.input<options>> | undefined : undefined\n /** Zod schema for named options/flags. */\n options?: options\n /** Map of option names to single-char aliases. */\n alias?: Record<string, string> | undefined\n }\n /** Parsed result with args and options. */\n type ReturnType<\n args extends z.ZodObject<any> | undefined = undefined,\n options extends z.ZodObject<any> | undefined = undefined,\n > = {\n /** Parsed positional arguments. */\n args: args extends z.ZodObject<any> ? z.output<args> : {}\n /** Parsed named options. */\n options: options extends z.ZodObject<any> ? z.output<options> : {}\n }\n}\n\ntype OptionNames = {\n aliasToName: Map<string, string>\n kebabToCamel: Map<string, string>\n knownOptions: Set<string>\n}\n\n/** Builds lookup tables for option names and short aliases. */\nfunction createOptionNames(\n schema: z.ZodObject<any> | undefined,\n alias: Record<string, string> | undefined,\n): OptionNames {\n const aliasToName = new Map<string, string>()\n if (alias) for (const [name, short] of Object.entries(alias)) aliasToName.set(short, name)\n\n const knownOptions = new Set(schema ? Object.keys(schema.shape) : [])\n const kebabToCamel = new Map<string, string>()\n for (const name of knownOptions) {\n const kebab = toKebab(name)\n if (kebab !== name) kebabToCamel.set(kebab, name)\n }\n\n return { aliasToName, kebabToCamel, knownOptions }\n}\n\n/** Normalizes a long option name, accepting kebab-case aliases for camelCase schema keys. */\nfunction normalizeOptionName(raw: string, options: OptionNames): string | undefined {\n const name = options.kebabToCamel.get(raw) ?? raw\n return options.knownOptions.has(name) ? name : undefined\n}\n\n/** Normalizes config-backed defaults and validates config structure/key names. */\nfunction normalizeOptionDefaults(\n defaults: unknown,\n schema: z.ZodObject<any> | undefined,\n optionNames: OptionNames,\n): Record<string, unknown> {\n if (defaults === undefined) return {}\n if (!isRecord(defaults))\n throw new ParseError({\n message: 'Invalid config section: expected an object of option defaults',\n })\n if (!schema) {\n const [first] = Object.keys(defaults)\n if (first) throw new ParseError({ message: `Unknown config option: ${first}` })\n return {}\n }\n\n const normalized: Record<string, unknown> = {}\n for (const [rawName, value] of Object.entries(defaults)) {\n const name = normalizeOptionName(rawName, optionNames)\n if (!name) throw new ParseError({ message: `Unknown config option: ${rawName}` })\n normalized[name] = value\n }\n return normalized\n}\n\n/** Unwraps ZodDefault/ZodOptional to get the inner type. */\nfunction unwrap(schema: z.ZodType): z.ZodType {\n let s = schema as any\n while (s.def?.innerType) s = s.def.innerType\n return s\n}\n\n/** Checks if an option's inner type is boolean. */\nfunction isBooleanOption(name: string, schema: z.ZodObject<any> | undefined): boolean {\n if (!schema) return false\n const field = schema.shape[name]\n if (!field) return false\n return unwrap(field).constructor.name === 'ZodBoolean'\n}\n\n/** Checks if an option is a count type (z.count()). */\nfunction isCountOption(name: string, schema: z.ZodObject<any> | undefined): boolean {\n if (!schema) return false\n const field = schema.shape[name]\n if (!field) return false\n return typeof field.meta === 'function' && field.meta()?.count === true\n}\n\n/** Checks if an option's inner type is an array. */\nfunction isArrayOption(name: string, schema: z.ZodObject<any> | undefined): boolean {\n if (!schema) return false\n const field = schema.shape[name]\n if (!field) return false\n return unwrap(field).constructor.name === 'ZodArray'\n}\n\n/** Sets an option value, collecting into arrays for array schemas. */\nfunction setOption(\n raw: Record<string, unknown>,\n name: string,\n value: string,\n schema: z.ZodObject<any> | undefined,\n) {\n if (isArrayOption(name, schema)) {\n const existing = raw[name]\n if (Array.isArray(existing)) {\n existing.push(value)\n } else {\n raw[name] = [value]\n }\n } else {\n raw[name] = value\n }\n}\n\n/** Wraps zod schema.parse(), converting ZodError to ValidationError. */\nfunction zodParse(schema: z.ZodObject<any>, data: Record<string, unknown>) {\n try {\n return schema.parse(data)\n } catch (err: any) {\n const issues: any[] = err?.issues ?? err?.error?.issues ?? []\n const fieldErrors: FieldError[] = issues.map((issue: any) => ({\n code: issue.code,\n missing: !hasPath(data, issue.path ?? []),\n path: (issue.path ?? []).join('.'),\n expected: issue.expected ?? '',\n received: issue.received ?? '',\n message: issue.message ?? '',\n }))\n throw new ValidationError({\n message: issues.map((i: any) => i.message).join('; ') || 'Validation failed',\n fieldErrors,\n cause: err instanceof Error ? err : undefined,\n })\n }\n}\n\n/** Checks whether the raw input contains the full issue path. */\nfunction hasPath(data: Record<string, unknown>, path: PropertyKey[]): boolean {\n if (path.length === 0) return true\n\n let current: unknown = data\n for (const part of path) {\n if (!isRecord(current) && !Array.isArray(current)) return false\n if (!(part in current)) return false\n current = (current as any)[part]\n }\n\n return true\n}\n\n/** Parses environment variables against a Zod schema. Falls back to `process.env` → `Deno.env` when no source is provided. */\nexport function parseEnv<const env extends z.ZodObject<any>>(\n schema: env,\n source: Record<string, string | undefined> = defaultEnvSource(),\n): z.output<env> {\n const raw: Record<string, unknown> = {}\n for (const [key, field] of Object.entries(schema.shape)) {\n const value = source[key]\n if (value !== undefined) raw[key] = coerceEnv(value, field as z.ZodType)\n }\n return zodParse(schema, raw) as z.output<env>\n}\n\n/** Coerces an env var string to the type expected by the schema field. */\nfunction coerceEnv(value: string, field: z.ZodType): unknown {\n const inner = unwrap(field)\n const typeName = inner.constructor.name\n if (typeName === 'ZodNumber') return Number(value)\n if (typeName === 'ZodBoolean') return value === 'true' || value === '1'\n return value\n}\n\n/** Coerces a raw string value to the type expected by the schema. */\nfunction coerce(value: unknown, name: string, schema: z.ZodObject<any>): unknown {\n const field = schema.shape[name]\n if (!field) return value\n const inner = unwrap(field)\n const typeName = inner.constructor.name\n\n if (typeName === 'ZodNumber' && typeof value === 'string') {\n return Number(value)\n }\n if (typeName === 'ZodBoolean' && typeof value === 'string') {\n return value === 'true'\n }\n return value\n}\n\n/** Returns the best available env source for the current runtime. */\nexport function defaultEnvSource(): Record<string, string | undefined> {\n if (typeof globalThis !== 'undefined') {\n const g = globalThis as any\n if (g.process?.env) return g.process.env\n if (g.Deno?.env) return new Proxy({}, { get: (_, key) => g.Deno.env.get(key) }) as any\n }\n return {}\n}\n","import { z } from 'zod'\n\nimport type { FieldError } from '../Errors.js'\nimport { IncurError, ValidationError } from '../Errors.js'\nimport type { Context as MiddlewareContext, Handler as MiddlewareHandler } from '../middleware.js'\nimport * as Parser from '../Parser.js'\n\n/** @internal Sentinel symbol for `ok()` and `error()` return values. */\nconst sentinel = Symbol.for('incur.sentinel')\n\n/** @internal CTA block for command output. */\nexport type CtaBlock = {\n commands: unknown[]\n description?: string | undefined\n}\n\n/** @internal A tagged ok result. */\ntype OkResult = {\n [sentinel]: 'ok'\n data: unknown\n cta?: CtaBlock | undefined\n}\n\n/** @internal A tagged error result. */\ntype ErrorResult = {\n [sentinel]: 'error'\n code: string\n message: string\n retryable?: boolean | undefined\n exitCode?: number | undefined\n cta?: CtaBlock | undefined\n}\n\n/** @internal Unified command execution used by CLI, HTTP, and MCP transports. */\nexport async function execute(command: any, options: execute.Options): Promise<execute.Result> {\n const {\n argv,\n inputOptions,\n agent,\n format,\n formatExplicit,\n name,\n path,\n version,\n envSource = process.env,\n env: envSchema,\n vars: varsSchema,\n middlewares = [],\n } = options\n const displayName = options.displayName ?? name\n const parseMode = options.parseMode ?? 'argv'\n\n const varsMap: Record<string, unknown> = varsSchema ? varsSchema.parse({}) : {}\n let result: execute.Result | undefined\n // For streaming with middleware: runCommand suspends on streamConsumed so middleware \"after\"\n // runs after the stream is consumed. The wrapped generator resolves it in its finally block.\n // resultReady signals that result has been set (for streams, before the chain finishes).\n let streamConsumed: Promise<void> | undefined\n let resolveStreamConsumed: (() => void) | undefined\n let resolveResultReady: (() => void) | undefined\n const resultReady = new Promise<void>((r) => {\n resolveResultReady = r\n })\n\n const runCommand = async () => {\n // Parse args and options\n let args: Record<string, unknown>\n let parsedOptions: Record<string, unknown>\n\n if (parseMode === 'argv') {\n // CLI mode: parse both args and options from argv tokens\n const parsed = Parser.parse(argv, {\n alias: command.alias as Record<string, string> | undefined,\n args: command.args,\n defaults: options.defaults,\n options: command.options,\n })\n args = parsed.args\n parsedOptions = parsed.options\n } else if (parseMode === 'split') {\n // HTTP mode: positional args from URL path segments, options from body/query\n const parsed = Parser.parse(argv, { args: command.args })\n args = parsed.args\n parsedOptions = command.options ? command.options.parse(inputOptions) : {}\n } else {\n // MCP mode: all params come from inputOptions, split into args vs options\n const split = splitParams(inputOptions, command)\n args = command.args ? command.args.parse(split.args) : {}\n parsedOptions = command.options ? command.options.parse(split.options) : {}\n }\n\n // Parse env\n const commandEnv = command.env ? Parser.parseEnv(command.env, envSource) : {}\n\n // Build sentinel helpers\n const okFn = (data: unknown, meta: { cta?: CtaBlock | undefined } = {}): never =>\n ({ [sentinel]: 'ok', data, cta: meta.cta }) as never\n const errorFn = (opts: {\n code: string\n cta?: CtaBlock | undefined\n exitCode?: number | undefined\n message: string\n retryable?: boolean | undefined\n }): never => ({ [sentinel]: 'error', ...opts }) as never\n\n const raw = command.run({\n agent,\n args,\n displayName,\n env: commandEnv,\n error: errorFn,\n format,\n formatExplicit,\n name,\n ok: okFn,\n options: parsedOptions,\n var: varsMap,\n version,\n })\n\n // Streaming: wrap the generator so middleware \"after\" runs after consumption.\n // When middleware is active, runCommand suspends until the stream is fully consumed,\n // keeping the middleware chain alive around the stream's lifetime.\n if (isAsyncGenerator(raw)) {\n if (middlewares.length > 0) {\n streamConsumed = new Promise<void>((r) => {\n resolveStreamConsumed = r\n })\n async function* wrapped() {\n try {\n yield* raw as AsyncGenerator<unknown, unknown, unknown>\n } finally {\n resolveStreamConsumed!()\n }\n }\n result = { stream: wrapped() }\n resolveResultReady!()\n await streamConsumed\n } else {\n result = { stream: raw }\n }\n return\n }\n\n const awaited = await raw\n\n if (isSentinel(awaited)) {\n if (awaited[sentinel] === 'ok') {\n const ok = awaited as OkResult\n result = { ok: true, data: ok.data, ...(ok.cta ? { cta: ok.cta } : undefined) }\n } else {\n const err = awaited as ErrorResult\n result = {\n ok: false,\n error: {\n code: err.code,\n message: err.message,\n ...(err.retryable !== undefined ? { retryable: err.retryable } : undefined),\n },\n ...(err.cta ? { cta: err.cta } : undefined),\n ...(err.exitCode !== undefined ? { exitCode: err.exitCode } : undefined),\n }\n }\n return\n }\n\n result = { ok: true, data: awaited }\n }\n\n try {\n // Parse CLI-level env\n const cliEnv = envSchema ? Parser.parseEnv(envSchema, envSource) : {}\n\n if (middlewares.length > 0) {\n const errorFn = (opts: {\n code: string\n cta?: CtaBlock | undefined\n exitCode?: number | undefined\n message: string\n retryable?: boolean | undefined\n }): never => {\n // Side-effect: set result directly (handles both `return c.error()` and bare `c.error()`)\n result = {\n ok: false,\n error: {\n code: opts.code,\n message: opts.message,\n ...(opts.retryable !== undefined ? { retryable: opts.retryable } : undefined),\n },\n ...(opts.cta ? { cta: opts.cta } : undefined),\n ...(opts.exitCode !== undefined ? { exitCode: opts.exitCode } : undefined),\n }\n return undefined as never\n }\n\n const mwCtx: MiddlewareContext = {\n agent,\n command: path,\n displayName,\n env: cliEnv,\n error: errorFn,\n format: format as any,\n formatExplicit,\n name,\n set(key: string, value: unknown) {\n varsMap[key] = value\n },\n var: varsMap,\n version,\n }\n\n const composed = middlewares.reduceRight(\n (next: () => Promise<void>, mw) => async () => {\n await mw(mwCtx, next)\n },\n runCommand,\n )\n // Start the chain and race against resultReady. For streams with middleware,\n // runCommand suspends on streamConsumed (keeping middleware \"after\" deferred)\n // but signals resultReady so we can return the stream immediately. The transport\n // consumes the stream, which resolves streamConsumed, letting middleware \"after\" run.\n const chainPromise = composed()\n await Promise.race([chainPromise, resultReady])\n if (streamConsumed) return result!\n await chainPromise\n } else {\n await runCommand()\n }\n } catch (error) {\n if (error instanceof ValidationError)\n return {\n ok: false,\n error: {\n code: 'VALIDATION_ERROR',\n message: error.message,\n fieldErrors: error.fieldErrors,\n },\n }\n return {\n ok: false,\n error: {\n code: error instanceof IncurError ? error.code : 'UNKNOWN',\n message: error instanceof Error ? error.message : String(error),\n ...(error instanceof IncurError ? { retryable: error.retryable } : undefined),\n },\n ...(error instanceof IncurError && error.exitCode !== undefined\n ? { exitCode: error.exitCode }\n : undefined),\n }\n }\n\n return result ?? { ok: true, data: undefined }\n}\n\n/** @internal Splits flat params into args vs options using schema shapes. */\nfunction splitParams(\n params: Record<string, unknown>,\n command: any,\n): { args: Record<string, unknown>; options: Record<string, unknown> } {\n const argKeys = new Set(command.args ? Object.keys(command.args.shape) : [])\n const a: Record<string, unknown> = {}\n const o: Record<string, unknown> = {}\n for (const [key, value] of Object.entries(params))\n if (argKeys.has(key)) a[key] = value\n else o[key] = value\n return { args: a, options: o }\n}\n\nexport declare namespace execute {\n /** Options for the unified execute function. */\n type Options = {\n /** Whether the consumer is an agent. */\n agent: boolean\n /** Raw positional tokens (already separated from flags). For HTTP/MCP, pass `[]`. */\n argv: string[]\n /** Default option values from config file. */\n defaults?: Record<string, unknown> | undefined\n /** The resolved binary name the user invoked (e.g. an alias). Falls back to `name`. */\n displayName?: string | undefined\n /** CLI-level env schema. */\n env?: z.ZodObject<any> | undefined\n /** Source for environment variables. Defaults to `process.env`. */\n envSource?: Record<string, string | undefined> | undefined\n /** The resolved output format. */\n format: string\n /** Whether the format was explicitly requested. */\n formatExplicit: boolean\n /** Raw parsed options (from query params, JSON body, or MCP params). For CLI, pass `{}`. */\n inputOptions: Record<string, unknown>\n /** Middleware handlers (root + group + command, already collected). */\n middlewares?: MiddlewareHandler[] | undefined\n /** The CLI name. */\n name: string\n /**\n * How to parse input:\n * - `'argv'` (default): parse both args and options from argv tokens (CLI mode)\n * - `'split'`: args from argv, options from inputOptions (HTTP mode)\n * - `'flat'`: all params from inputOptions, split by schema shapes (MCP mode)\n */\n parseMode?: 'argv' | 'split' | 'flat' | undefined\n /** The resolved command path. */\n path: string\n /** Vars schema for middleware variables. */\n vars?: z.ZodObject<any> | undefined\n /** CLI version string. */\n version: string | undefined\n }\n\n /** Result of executing a command. */\n type Result =\n | { ok: true; data: unknown; cta?: CtaBlock | undefined }\n | {\n ok: false\n error: {\n code: string\n message: string\n retryable?: boolean | undefined\n fieldErrors?: FieldError[] | undefined\n }\n cta?: CtaBlock | undefined\n exitCode?: number | undefined\n }\n | { stream: AsyncGenerator<unknown, unknown, unknown> }\n}\n\n/** @internal Type guard for sentinel results. */\nfunction isSentinel(value: unknown): value is OkResult | ErrorResult {\n return typeof value === 'object' && value !== null && sentinel in value\n}\n\n/** @internal Type guard for async generators. */\nfunction isAsyncGenerator(value: unknown): value is AsyncGenerator<unknown, unknown, unknown> {\n return (\n typeof value === 'object' &&\n value !== null &&\n Symbol.asyncIterator in value &&\n typeof (value as any).next === 'function'\n )\n}\n\n/** Common metadata shared by command definitions and built-in commands. */\nexport type CommandMeta<options extends z.ZodObject<any> | undefined = undefined> = {\n /** Map of option names to single-char aliases. */\n alias?: options extends z.ZodObject<any>\n ? Partial<Record<keyof z.output<options>, string>>\n : Record<string, string> | undefined\n /** A short description of what the command does. */\n description?: string | undefined\n /** Zod schema for named options/flags. */\n options?: options | undefined\n}\n\n/** @internal Metadata for a built-in subcommand. */\ntype BuiltinSubcommandMeta<options extends z.ZodObject<any> | undefined = undefined> =\n CommandMeta<options> & {\n /** Alternative names for this built-in subcommand. */\n aliases?: string[] | undefined\n }\n\n/** @internal Creates a builtin subcommand with typesafe alias inference. */\nfunction subcommand<const options extends z.ZodObject<any> | undefined = undefined>(\n def: BuiltinSubcommandMeta<options> & { name: string },\n) {\n return def\n}\n\n/** Supported shell names for completions. */\nexport const shells = ['bash', 'fish', 'nushell', 'zsh'] as const\n\n/** A supported shell name. */\nexport type Shell = (typeof shells)[number]\n\n/** Built-in command metadata shared by help, completions, and handler logic. */\nexport const builtinCommands = [\n {\n name: 'completions',\n description: 'Generate shell completion script',\n args: z.object({\n shell: z.enum(shells).describe('Shell to generate completions for'),\n }),\n hint(name) {\n const rows = [\n ['bash', `eval \"$(${name} completions bash)\"`, '# add to ~/.bashrc'],\n ['fish', `${name} completions fish | source`, '# add to ~/.config/fish/config.fish'],\n ['nushell', `see \\`${name} completions nushell\\``, '# add to config.nu'],\n ['zsh', `eval \"$(${name} completions zsh)\"`, '# add to ~/.zshrc'],\n ] as const\n const shellW = Math.max(...rows.map((r) => r[0].length))\n const cmdW = Math.max(...rows.map((r) => r[1].length))\n return (\n 'Setup:\\n' +\n rows\n .map(([s, cmd, comment]) => ` ${s.padEnd(shellW)} ${cmd.padEnd(cmdW)} ${comment}`)\n .join('\\n')\n )\n },\n },\n {\n name: 'mcp',\n description: 'Register as MCP server',\n subcommands: [\n subcommand({\n name: 'add',\n description: 'Register as MCP server',\n alias: { command: 'c' },\n options: z.object({\n agent: z\n .string()\n .optional()\n .describe('Target a specific agent (e.g. claude-code, cursor)'),\n command: z\n .string()\n .optional()\n .describe('Override the command agents will run (e.g. \"pnpm my-cli --mcp\")'),\n noGlobal: z.boolean().optional().describe('Install to project instead of globally'),\n }),\n }),\n ],\n },\n {\n name: 'skills',\n aliases: ['skill'],\n description: 'Sync skill files to agents',\n subcommands: [\n subcommand({\n name: 'add',\n description: 'Sync skill files to agents',\n options: z.object({\n depth: z.number().optional().describe('Grouping depth for skill files (default: 1)'),\n noGlobal: z.boolean().optional().describe('Install to project instead of globally'),\n }),\n }),\n subcommand({\n name: 'list',\n aliases: ['ls'],\n description: 'List skills',\n }),\n ],\n },\n] satisfies {\n name: string\n aliases?: string[] | undefined\n args?: z.ZodObject<any> | undefined\n description: string\n hint?: ((name: string) => string) | undefined\n subcommands?: (BuiltinSubcommandMeta<z.ZodObject<any>> & { name: string })[] | undefined\n}[]\n\n/** @internal Finds a builtin command by its name or alias. */\nexport function findBuiltin(token: string) {\n return builtinCommands.find((b) => b.name === token || b.aliases?.includes(token))\n}\n\n/** @internal Finds a builtin subcommand by its name or alias. */\nexport function findBuiltinSubcommand(builtin: (typeof builtinCommands)[number], token: string) {\n return builtin.subcommands?.find((sub) => sub.name === token || sub.aliases?.includes(token))\n}\n\n/** @internal Checks if a token matches a builtin command by name or alias. */\nexport function isBuiltin(token: string) {\n return builtinCommands.some((b) => b.name === token || b.aliases?.includes(token))\n}\n","import { z } from 'zod'\n\nimport { builtinCommands } from './internal/command.js'\nimport { toKebab } from './internal/helpers.js'\nimport { defaultEnvSource } from './Parser.js'\n\n/** Formats help text for a router CLI or command group. */\nexport function formatRoot(name: string, options: formatRoot.Options = {}): string {\n const { aliases, configFlag, description, version, commands = [], root = false } = options\n const lines: string[] = []\n\n // Header\n const title = version ? `${name}@${version}` : name\n lines.push(description ? `${title} \\u2014 ${description}` : title)\n lines.push('')\n\n // Synopsis\n lines.push(`Usage: ${name} <command>`)\n if (aliases?.length) lines.push(`Aliases: ${aliases.join(', ')}`)\n\n // Commands\n if (commands.length > 0) {\n lines.push('')\n lines.push('Commands:')\n const maxLen = Math.max(...commands.map((c) => c.name.length))\n for (const cmd of commands) {\n if (cmd.description) {\n const padding = ' '.repeat(maxLen - cmd.name.length)\n lines.push(` ${cmd.name}${padding} ${cmd.description}`)\n } else lines.push(` ${cmd.name}`)\n }\n }\n\n lines.push(...globalOptionsLines(root, configFlag))\n\n return lines.join('\\n')\n}\n\nexport declare namespace formatRoot {\n type Options = {\n /** Alternative binary names for this CLI. */\n aliases?: string[] | undefined\n /** Flag name for config file path (e.g. `'config'` renders `--config <path>`). */\n configFlag?: string | undefined\n /** Commands to list. */\n commands?: { name: string; description?: string | undefined }[] | undefined\n /** A short description of the CLI or group. */\n description?: string | undefined\n /** Show root-level built-in commands and flags. */\n root?: boolean | undefined\n /** CLI version string. */\n version?: string | undefined\n }\n}\n\nexport declare namespace formatCommand {\n type Options = {\n /** Map of option names to single-char aliases. */\n alias?: Partial<Record<string, string>> | undefined\n /** Alternative binary names for this CLI. */\n aliases?: string[] | undefined\n /** Zod schema for positional arguments. */\n args?: z.ZodObject<any> | undefined\n /** Flag name for config file path (e.g. `'config'` renders `--config <path>`). */\n configFlag?: string | undefined\n /** Subcommands to list (for CLIs with both a root handler and subcommands). */\n commands?: { name: string; description?: string | undefined }[] | undefined\n /** A short description of what the command does. */\n description?: string | undefined\n /** Zod schema for environment variables. */\n env?: z.ZodObject<any> | undefined\n /** Override environment variable source for \"set:\" display. Defaults to `process.env`. */\n envSource?: Record<string, string | undefined> | undefined\n /** Formatted usage examples. */\n examples?: { command: string; description?: string }[] | undefined\n /** Plain text hint displayed after examples and before global options. */\n hint?: string | undefined\n /** Hide global options section. */\n hideGlobalOptions?: boolean | undefined\n /** Zod schema for named options/flags. */\n options?: z.ZodObject<any> | undefined\n /** Show root-level built-in commands and flags. */\n root?: boolean | undefined\n /** Alternative usage patterns. */\n usage?:\n | {\n args?: Partial<Record<string, true>> | undefined\n options?: Partial<Record<string, true>> | undefined\n prefix?: string | undefined\n suffix?: string | undefined\n }[]\n | undefined\n /** CLI version string. */\n version?: string | undefined\n }\n}\n\n/** Formats help text for a leaf command. */\nexport function formatCommand(name: string, options: formatCommand.Options = {}): string {\n const {\n alias,\n aliases,\n configFlag,\n description,\n version,\n args,\n env,\n envSource,\n hint,\n root = false,\n options: opts,\n examples,\n } = options\n const lines: string[] = []\n\n // Header\n const title = version ? `${name}@${version}` : name\n lines.push(description ? `${title} \\u2014 ${description}` : title)\n lines.push('')\n\n // Synopsis\n const { usage } = options\n if (usage && usage.length > 0) {\n const usageLines = usage.map((u) => {\n const parts: string[] = []\n if (u.prefix) parts.push(u.prefix)\n parts.push(name)\n if (u.args) for (const key of Object.keys(u.args)) parts.push(`<${key}>`)\n if (u.options) for (const key of Object.keys(u.options)) parts.push(`--${key} <${key}>`)\n if (u.suffix) parts.push(u.suffix)\n return parts.join(' ')\n })\n const pad = ' '.repeat('Usage: '.length)\n lines.push(`Usage: ${usageLines[0]}`)\n for (const line of usageLines.slice(1)) lines.push(`${pad}${line}`)\n } else {\n const synopsis = buildSynopsis(name, args)\n const commandSuffix = options.commands && options.commands.length > 0 ? ' | <command>' : ''\n lines.push(`Usage: ${synopsis}${opts ? ' [options]' : ''}${commandSuffix}`)\n }\n if (aliases?.length) lines.push(`Aliases: ${aliases.join(', ')}`)\n\n // Arguments\n if (args) {\n const entries = argsEntries(args)\n if (entries.length > 0) {\n lines.push('')\n lines.push('Arguments:')\n const maxLen = Math.max(...entries.map((e) => e.name.length))\n for (const entry of entries)\n lines.push(` ${entry.name}${' '.repeat(maxLen - entry.name.length)} ${entry.description}`)\n }\n }\n\n // Options\n if (opts) {\n const entries = optionEntries(opts, alias)\n if (entries.length > 0) {\n lines.push('')\n lines.push('Options:')\n const maxLen = Math.max(...entries.map((e) => e.flag.length))\n for (const entry of entries) {\n const padding = ' '.repeat(maxLen - entry.flag.length)\n const prefix = entry.deprecated ? '[deprecated] ' : ''\n const desc =\n entry.defaultValue !== undefined\n ? `${prefix}${entry.description} (default: ${entry.defaultValue})`\n : `${prefix}${entry.description}`\n lines.push(` ${entry.flag}${padding} ${desc}`)\n }\n }\n }\n\n // Examples\n if (examples && examples.length > 0) {\n lines.push('')\n lines.push('Examples:')\n const maxLen = Math.max(\n ...examples.map((e) => (e.command ? `${name} ${e.command}` : name).length),\n )\n for (const ex of examples) {\n const cmd = ex.command ? `${name} ${ex.command}` : name\n if (ex.description)\n lines.push(` ${cmd}${' '.repeat(maxLen - cmd.length)} # ${ex.description}`)\n else lines.push(` ${cmd}`)\n }\n }\n\n // Hint\n if (hint) {\n lines.push('')\n lines.push(hint)\n }\n\n // Subcommands (for CLIs with both a root handler and subcommands)\n const { commands } = options\n if (commands && commands.length > 0) {\n lines.push('')\n lines.push('Commands:')\n const maxLen = Math.max(...commands.map((c) => c.name.length))\n for (const cmd of commands) {\n if (cmd.description) {\n const padding = ' '.repeat(maxLen - cmd.name.length)\n lines.push(` ${cmd.name}${padding} ${cmd.description}`)\n } else lines.push(` ${cmd.name}`)\n }\n }\n\n if (!options.hideGlobalOptions) lines.push(...globalOptionsLines(root, configFlag))\n\n // Environment Variables\n if (env) {\n const entries = envEntries(env)\n if (entries.length > 0) {\n lines.push('')\n lines.push('Environment Variables:')\n const maxLen = Math.max(...entries.map((e) => e.name.length))\n for (const entry of entries) {\n const padding = ' '.repeat(maxLen - entry.name.length)\n const parts: string[] = [entry.description]\n const source = envSource ?? defaultEnvSource()\n if (entry.name in source) parts.push(`set: ${redact(source[entry.name]!)}`)\n if (entry.defaultValue !== undefined) parts.push(`default: ${entry.defaultValue}`)\n const desc = parts.length > 1 ? `${parts[0]} (${parts.slice(1).join(', ')})` : parts[0]\n lines.push(` ${entry.name}${padding} ${desc}`)\n }\n }\n }\n\n return lines.join('\\n')\n}\n\n/** Builds the synopsis string with `<required>` and `[optional]` placeholders. */\nfunction buildSynopsis(name: string, args?: z.ZodObject<any>): string {\n if (!args) return name\n const parts = [name]\n for (const [key, schema] of Object.entries(args.shape)) {\n const type = resolveTypeName(schema)\n const label = type.includes('|') ? type : key\n parts.push((schema as z.ZodType)._zod.optout === 'optional' ? `[${label}]` : `<${label}>`)\n }\n return parts.join(' ')\n}\n\n/** Extracts arg entries from a Zod object schema. */\nfunction argsEntries(schema: z.ZodObject<any>) {\n const entries: { name: string; description: string }[] = []\n for (const [key, field] of Object.entries(schema.shape))\n entries.push({ name: key, description: (field as any).description ?? '' })\n return entries\n}\n\n/** Extracts env var entries from a Zod object schema. */\nfunction envEntries(schema: z.ZodObject<any>) {\n const entries: { name: string; description: string; defaultValue?: unknown }[] = []\n for (const [key, field] of Object.entries(schema.shape)) {\n const defaultValue = extractDefault(field)\n entries.push({ name: key, description: (field as any).description ?? '', defaultValue })\n }\n return entries\n}\n\n/** Extracts option entries from a Zod object schema. */\nfunction optionEntries(\n schema: z.ZodObject<any>,\n alias?: Partial<Record<string, string>> | undefined,\n) {\n const entries: {\n flag: string\n description: string\n defaultValue?: unknown\n deprecated?: boolean | undefined\n }[] = []\n for (const [key, field] of Object.entries(schema.shape)) {\n const type = resolveTypeName(field)\n const short = alias?.[key]\n const kebab = toKebab(key)\n const valueHint = type === 'boolean' ? '' : ` <${type}>`\n const flag = short ? `--${kebab}, -${short}${valueHint}` : `--${kebab}${valueHint}`\n let defaultValue = extractDefault(field)\n if (type === 'boolean' && defaultValue === false) defaultValue = undefined\n const deprecated = extractDeprecated(field)\n entries.push({ flag, description: (field as any).description ?? '', defaultValue, deprecated })\n }\n return entries\n}\n\n/** Resolves a human-readable type name from a Zod schema. */\nfunction resolveTypeName(schema: unknown): string {\n if (isCountSchema(schema)) return 'count'\n const unwrapped = unwrap(schema)\n if (unwrapped instanceof z.ZodString) return 'string'\n if (unwrapped instanceof z.ZodNumber) return 'number'\n if (unwrapped instanceof z.ZodBoolean) return 'boolean'\n if (unwrapped instanceof z.ZodArray) return 'array'\n if (unwrapped instanceof z.ZodEnum) {\n const values = Object.values((unwrapped as any)._zod.def.entries) as string[]\n return values.join('|')\n }\n if (unwrapped instanceof z.ZodUnion) {\n const options = (unwrapped as any)._zod?.def?.options as z.ZodType[] | undefined\n if (options?.every((o: z.ZodType) => o instanceof z.ZodLiteral)) {\n const values = options.map((o: z.ZodType) => String((o as any)._zod.def.values[0]))\n return values.join('|')\n }\n }\n return 'value'\n}\n\n/** Checks if a schema is a count type (`.meta({ count: true })`). */\nfunction isCountSchema(schema: unknown): boolean {\n const s = schema as any\n return typeof s?.meta === 'function' && s.meta()?.count === true\n}\n\n/** Unwraps optional/default/nullable wrappers to get the inner type. */\nfunction unwrap(schema: unknown): unknown {\n if (schema instanceof z.ZodOptional) return unwrap(schema.unwrap())\n if (schema instanceof z.ZodDefault) return unwrap(schema.removeDefault())\n if (schema instanceof z.ZodNullable) return unwrap(schema.unwrap())\n return schema\n}\n\n/** Extracts the default value from a Zod schema, if any. */\nfunction extractDefault(schema: unknown): unknown {\n if (schema instanceof z.ZodDefault) {\n const raw = schema._def.defaultValue\n const value = typeof raw === 'function' ? raw() : raw\n if (Array.isArray(value) && value.length === 0) return undefined\n return value\n }\n if (schema instanceof z.ZodOptional) return extractDefault(schema.unwrap())\n return undefined\n}\n\n/** Reads the `deprecated` flag from a Zod schema's `.meta()`. */\nfunction extractDeprecated(schema: unknown): boolean | undefined {\n const meta = (schema as any)?.meta?.()\n return meta?.deprecated === true ? true : undefined\n}\n\n/** Renders the built-in commands and global options block. Root-only items are hidden for subcommands. */\nfunction globalOptionsLines(root = false, configFlag?: string): string[] {\n const lines: string[] = []\n\n if (root) {\n const builtins = builtinCommands.flatMap((b) => {\n if (!b.subcommands) return [{ name: b.name, desc: b.description }]\n if (b.subcommands.length === 1)\n return [\n { name: `${b.name} ${b.subcommands[0]!.name}`, desc: b.subcommands[0]!.description },\n ]\n const names = b.subcommands.map((s) => s.name).join(', ')\n return [{ name: b.name, desc: `${b.description} (${names})` }]\n })\n const maxCmd = Math.max(...builtins.map((b) => b.name.length))\n lines.push(\n '',\n 'Integrations:',\n ...builtins.map((b) => ` ${b.name}${' '.repeat(maxCmd - b.name.length)} ${b.desc}`),\n )\n }\n\n const flags = [\n ...(configFlag\n ? [{ flag: `--${configFlag} <path>`, desc: 'Load JSON option defaults from a file' }]\n : []),\n {\n flag: '--filter-output <keys>',\n desc: 'Filter output by key paths (e.g. foo,bar.baz,a[0,3])',\n },\n { flag: '--format <toon|json|yaml|md|jsonl>', desc: 'Output format' },\n { flag: '--help', desc: 'Show help' },\n { flag: '--llms, --llms-full', desc: 'Print LLM-readable manifest' },\n ...(root ? [{ flag: '--mcp', desc: 'Start as MCP stdio server' }] : []),\n ...(configFlag\n ? [{ flag: `--no-${configFlag}`, desc: 'Disable JSON option defaults for this run' }]\n : []),\n { flag: '--schema', desc: 'Show JSON Schema for command' },\n { flag: '--token-count', desc: 'Print token count of output (instead of output)' },\n { flag: '--token-limit <n>', desc: 'Limit output to n tokens' },\n { flag: '--token-offset <n>', desc: 'Skip first n tokens of output' },\n { flag: '--full-output', desc: 'Show full output envelope' },\n ...(root ? [{ flag: '--version', desc: 'Show version' }] : []),\n ].sort((a, b) => a.flag.localeCompare(b.flag))\n const maxLen = Math.max(...flags.map((f) => f.flag.length))\n lines.push(\n '',\n 'Global Options:',\n ...flags.map((f) => ` ${f.flag}${' '.repeat(maxLen - f.flag.length)} ${f.desc}`),\n )\n\n return lines\n}\n\n/** Redacts a value, showing only the last 4 characters for long values. */\nfunction redact(value: string): string {\n if (value.length <= 4) return '****'\n return `****${value.slice(-4)}`\n}\n","/** Detects the package manager runner (`npx`, `pnpx`, `bunx`) from the current process environment. */\nexport function detectRunner(): string {\n const userAgent = process.env.npm_config_user_agent ?? ''\n const execPath = process.env.npm_execpath ?? ''\n if (userAgent.includes('pnpm') || execPath.includes('pnpm')) return 'pnpx'\n if (userAgent.includes('bun') || execPath.includes('bun')) return 'bunx'\n return 'npx'\n}\n","import { z } from 'zod'\n\n/**\n * Converts a Zod schema to a JSON Schema object. Strips the `$schema`\n * meta-property. Represents bigints and dates as `{ type: \"string\" }`\n * since JSON lacks native types for them.\n */\nexport function toJsonSchema(schema: z.ZodType): Record<string, unknown> {\n const result = z.toJSONSchema(schema, {\n unrepresentable: 'any',\n override: (ctx) => {\n const type = ctx.zodSchema._zod?.def?.type\n if (type === 'bigint' || type === 'date') ctx.jsonSchema.type = 'string'\n },\n }) as Record<string, unknown>\n delete result.$schema\n return result\n}\n","import { McpServer, StdioServerTransport } from '@modelcontextprotocol/server'\nimport type { Readable, Writable } from 'node:stream'\nimport { z } from 'zod'\n\nimport * as Command from './internal/command.js'\nimport type { Handler as MiddlewareHandler } from './middleware.js'\nimport * as Schema from './Schema.js'\n\n/** Starts a stdio MCP server that exposes commands as tools. */\nexport async function serve(\n name: string,\n version: string,\n commands: Map<string, any>,\n options: serve.Options = {},\n): Promise<void> {\n const server = new McpServer({ name, version })\n\n for (const tool of collectTools(commands, [])) {\n const mergedShape: Record<string, any> = {\n ...tool.command.args?.shape,\n ...tool.command.options?.shape,\n }\n const hasInput = Object.keys(mergedShape).length > 0\n\n server.registerTool(\n tool.name,\n {\n ...(tool.description ? { description: tool.description } : undefined),\n ...(hasInput ? { inputSchema: z.object(mergedShape) } : undefined),\n ...(tool.outputSchema ? { outputSchema: tool.outputSchema } : undefined),\n } as never,\n async (...callArgs: any[]) => {\n // registerTool passes (args, extra) when inputSchema is set, (extra) when not\n const params = hasInput ? (callArgs[0] as Record<string, unknown>) : {}\n const extra = hasInput ? callArgs[1] : callArgs[0]\n return callTool(tool, params, {\n extra,\n sendNotification: (n) => server.server.notification(n),\n name,\n version,\n middlewares: options.middlewares,\n env: options.env,\n vars: options.vars,\n })\n },\n )\n }\n\n const input = options.input ?? process.stdin\n const output = options.output ?? process.stdout\n const transport = new StdioServerTransport(input as any, output as any)\n await server.connect(transport)\n}\n\nexport declare namespace serve {\n /** Options for the MCP server. */\n type Options = {\n /** CLI-level env schema. */\n env?: z.ZodObject<any> | undefined\n /** Override input stream. Defaults to `process.stdin`. */\n input?: Readable | undefined\n /** Middleware handlers registered on the root CLI. */\n middlewares?: MiddlewareHandler[] | undefined\n /** Override output stream. Defaults to `process.stdout`. */\n output?: Writable | undefined\n /** Vars schema for middleware variables. */\n vars?: z.ZodObject<any> | undefined\n /** CLI version string. */\n version?: string | undefined\n }\n}\n\n/** @internal Executes a tool call and returns a CallToolResult. */\nexport async function callTool(\n tool: ToolEntry,\n params: Record<string, unknown>,\n options: {\n extra?: {\n mcpReq?: { _meta?: { progressToken?: string | number } }\n }\n sendNotification?: (n: ProgressNotification) => Promise<void>\n name?: string | undefined\n version?: string | undefined\n middlewares?: MiddlewareHandler[] | undefined\n env?: z.ZodObject<any> | undefined\n vars?: z.ZodObject<any> | undefined\n } = {},\n): Promise<{\n content: { type: 'text'; text: string }[]\n structuredContent?: Record<string, unknown>\n isError?: boolean\n}> {\n const allMiddleware = [\n ...(options.middlewares ?? []),\n ...((tool.middlewares as MiddlewareHandler[] | undefined) ?? []),\n ...((tool.command.middleware as MiddlewareHandler[] | undefined) ?? []),\n ]\n\n const result = await Command.execute(tool.command, {\n agent: true,\n argv: [],\n env: options.env,\n format: 'json',\n formatExplicit: true,\n inputOptions: params,\n middlewares: allMiddleware,\n name: options.name ?? tool.name,\n parseMode: 'flat',\n path: tool.name,\n vars: options.vars,\n version: options.version,\n })\n\n if ('stream' in result) {\n // Streaming: send progress notifications per chunk, then return buffered result\n const chunks: unknown[] = []\n const progressToken = options.extra?.mcpReq?._meta?.progressToken\n let i = 0\n try {\n for await (const chunk of result.stream) {\n chunks.push(chunk)\n if (progressToken !== undefined && options.sendNotification)\n await options.sendNotification({\n method: 'notifications/progress' as const,\n params: { progressToken, progress: ++i, message: JSON.stringify(chunk) },\n })\n }\n } catch (err) {\n return {\n content: [{ type: 'text', text: err instanceof Error ? err.message : String(err) }],\n isError: true,\n }\n }\n return { content: [{ type: 'text', text: JSON.stringify(chunks) }] }\n }\n\n if (!result.ok)\n return {\n content: [{ type: 'text', text: result.error.message ?? 'Command failed' }],\n isError: true,\n }\n\n const data = result.data ?? null\n return {\n content: [{ type: 'text', text: JSON.stringify(data) }],\n ...(data !== null && tool.outputSchema\n ? { structuredContent: data as Record<string, unknown> }\n : undefined),\n }\n}\n\n/** @internal A progress notification sent during streaming tool calls. */\ntype ProgressNotification = {\n method: 'notifications/progress'\n params: { progressToken: string | number; progress: number; message: string }\n}\n\n/** @internal A resolved tool entry from the command tree. */\nexport type ToolEntry = {\n name: string\n description?: string | undefined\n inputSchema: { type: 'object'; properties: Record<string, unknown>; required?: string[] }\n outputSchema?: Record<string, unknown> | undefined\n command: any\n middlewares?: MiddlewareHandler[] | undefined\n}\n\n/** @internal Recursively collects leaf commands as tool entries. */\nexport function collectTools(\n commands: Map<string, any>,\n prefix: string[],\n parentMiddlewares: MiddlewareHandler[] = [],\n): ToolEntry[] {\n const result: ToolEntry[] = []\n for (const [name, entry] of commands) {\n if ('_alias' in entry) continue\n const path = [...prefix, name]\n if ('_group' in entry && entry._group) {\n const groupMw = [\n ...parentMiddlewares,\n ...((entry.middlewares as MiddlewareHandler[] | undefined) ?? []),\n ]\n result.push(...collectTools(entry.commands, path, groupMw))\n } else {\n result.push({\n name: path.join('_'),\n description: entry.description,\n inputSchema: buildToolSchema(entry.args, entry.options),\n ...(entry.output\n ? { outputSchema: Schema.toJsonSchema(entry.output) as Record<string, unknown> }\n : undefined),\n command: entry,\n ...(parentMiddlewares.length > 0 ? { middlewares: parentMiddlewares } : undefined),\n })\n }\n }\n return result.sort((a, b) => a.name.localeCompare(b.name))\n}\n\n/** @internal Builds a merged JSON Schema from args and options Zod schemas. */\nfunction buildToolSchema(\n args: any | undefined,\n options: any | undefined,\n): { type: 'object'; properties: Record<string, unknown>; required?: string[] } {\n const properties: Record<string, unknown> = {}\n const required: string[] = []\n\n for (const schema of [args, options]) {\n if (!schema) continue\n const json = Schema.toJsonSchema(schema)\n Object.assign(properties, (json.properties as Record<string, unknown>) ?? {})\n required.push(...((json.required as string[]) ?? []))\n }\n\n if (required.length > 0) return { type: 'object', properties, required }\n return { type: 'object', properties }\n}\n","/**\n * Dereferences all local `$ref` pointers in a JSON object (e.g. `{\"$ref\": \"#/components/schemas/User\"}`),\n * replacing them inline with the resolved values. Only handles local (`#/...`) references.\n *\n * Handles circular references by caching a mutable placeholder before recursing.\n *\n * Minimal reimplementation of the dereferencing behavior from `@apidevtools/json-schema-ref-parser`\n * (https://github.com/APIDevTools/json-schema-ref-parser). Only supports in-memory, local-pointer\n * resolution — no file/URL resolution, no `$id` scoping.\n */\nexport function dereference<value>(root: value): value {\n const cache = new Map<string, unknown>()\n return walk(root, root, cache) as value\n}\n\nfunction walk(node: unknown, root: unknown, cache: Map<string, unknown>): unknown {\n if (Array.isArray(node)) return node.map((item) => walk(item, root, cache))\n\n if (typeof node !== 'object' || node === null) return node\n\n const obj = node as Record<string, unknown>\n\n // Resolve $ref pointer\n if (typeof obj.$ref === 'string' && obj.$ref.startsWith('#')) {\n const ref = obj.$ref\n if (cache.has(ref)) return cache.get(ref)\n\n const resolved = resolvePointer(root, ref)\n\n // Non-object targets (primitives, arrays) can't be circular — resolve directly\n if (typeof resolved !== 'object' || resolved === null || Array.isArray(resolved)) {\n const dereferenced = walk(resolved, root, cache)\n cache.set(ref, dereferenced)\n return dereferenced\n }\n\n // Use a mutable placeholder so circular refs resolve to the same object.\n // If the walked result is not a plain object (e.g. chained ref to primitive/array),\n // skip the placeholder and cache directly.\n const placeholder: Record<string, unknown> = {}\n cache.set(ref, placeholder)\n const dereferenced = walk(resolved, root, cache)\n if (typeof dereferenced !== 'object' || dereferenced === null || Array.isArray(dereferenced)) {\n cache.set(ref, dereferenced)\n return dereferenced\n }\n Object.assign(placeholder, dereferenced)\n return placeholder\n }\n\n const result: Record<string, unknown> = {}\n for (const key of Object.keys(obj)) result[key] = walk(obj[key], root, cache)\n return result\n}\n\n/** Resolves a JSON Pointer (e.g. `#/components/schemas/User`) against a root object. */\nfunction resolvePointer(root: unknown, pointer: string): unknown {\n // \"#\" or \"#/\" → root\n const fragment = pointer.slice(1)\n if (fragment === '' || fragment === '/') return root\n\n const parts = fragment\n .slice(1)\n .split('/')\n .map((p) => p.replace(/~1/g, '/').replace(/~0/g, '~'))\n\n let current: unknown = root\n for (const part of parts) {\n if (typeof current !== 'object' || current === null)\n throw new Error(`Cannot resolve $ref \"${pointer}\": path segment \"${part}\" not found`)\n current = (current as Record<string, unknown>)[part]\n if (current === undefined)\n throw new Error(`Cannot resolve $ref \"${pointer}\": \"${part}\" not found`)\n }\n return current\n}\n","import type {\n Document,\n OperationObject,\n ParameterObject,\n PathItemObject,\n} from '@scalar/openapi-types/3.2'\nimport { z } from 'zod'\n\nimport * as Cli from './Cli.js'\nimport * as Fetch from './Fetch.js'\nimport { dereference } from './internal/dereference.js'\nimport * as Schema from './Schema.js'\n\n/** A minimal OpenAPI 3.x spec shape. Accepts both hand-written specs and generated ones (e.g. from `@hono/zod-openapi`). */\nexport type OpenAPISpec = {\n components?:\n | {\n securitySchemes?: Record<string, SecurityScheme> | undefined\n }\n | undefined\n info?: Record<string, unknown> | undefined\n openapi?: string | undefined\n paths?: {} | undefined\n security?: readonly SecurityRequirement[] | undefined\n}\n\n/** OpenAPI document source accepted by fetch-backed CLI commands. */\nexport type OpenAPISource = OpenAPISpec | string | URL\n\n/** Strategy used to name commands generated from OpenAPI operations. */\nexport type Mode = 'namespace' | 'operation'\n\n/** Configuration for generating commands from an OpenAPI document. */\nexport type Config = {\n /** Command naming strategy. Defaults to `'operation'`. */\n mode?: Mode | undefined\n}\n\n/** Options for generating an OpenAPI document from an incur CLI. */\nexport type GenerateOptions = {\n /** API description. Defaults to the CLI description. */\n description?: string | undefined\n /** Server URLs to advertise in the generated document. */\n servers?: { url: string; description?: string | undefined }[] | undefined\n /** API title. Defaults to the CLI name. */\n title?: string | undefined\n /** API version. Defaults to `0.0.0`. */\n version?: string | undefined\n}\n\n/** HTTP methods generated for commands. */\ntype HttpMethod = 'delete' | 'get' | 'patch' | 'post'\n\n/** Generates an OpenAPI 3.2 document from an incur CLI's command tree. */\nexport function fromCli(cli: Cli.Cli, options: GenerateOptions = {}): Document {\n const commands = Cli.toCommands.get(cli)\n if (!commands) throw new Error('No commands registered on this CLI instance')\n\n const paths: NonNullable<Document['paths']> = {}\n const root = Cli.toRootDefinition.get(cli as unknown as Cli.Root)\n if (root) addCommand(paths, [], root)\n for (const [name, entry] of commands) addEntry(paths, splitCommandName(name), entry)\n\n return {\n openapi: '3.2.0',\n info: {\n title: options.title ?? cli.name,\n version: options.version ?? '0.0.0',\n ...((options.description ?? cli.description)\n ? { description: options.description ?? cli.description }\n : undefined),\n },\n ...(options.servers ? { servers: options.servers } : undefined),\n paths,\n }\n}\n\n/** Internal operation shape after casting. */\ntype Operation = {\n description?: string | undefined\n operationId?: string | undefined\n parameters?: readonly Parameter[] | undefined\n requestBody?: RequestBody | undefined\n responses?: Record<string, unknown> | undefined\n security?: readonly SecurityRequirement[] | undefined\n summary?: string | undefined\n}\n\ntype Parameter = {\n description?: string | undefined\n in: 'cookie' | 'header' | 'path' | 'query'\n name: string\n required?: boolean | undefined\n schema?: Record<string, unknown> | undefined\n}\n\ntype RequestBody = {\n content?: Record<string, { schema?: Record<string, unknown> | undefined }> | undefined\n required?: boolean | undefined\n}\n\ntype SecurityRequirement = Record<string, readonly string[]>\n\ntype SecurityScheme = {\n description?: string | undefined\n in?: 'cookie' | 'header' | 'query' | undefined\n name?: string | undefined\n scheme?: string | undefined\n type?: string | undefined\n}\n\ntype HeaderParameter = Parameter & {\n optionName: string\n}\n\n/** A fetch handler. */\ntype FetchHandler = (req: Request) => Response | Promise<Response>\n\n/** A generated command entry compatible with incur's internal CommandEntry. */\ntype GeneratedCommand = {\n args?: z.ZodObject<any> | undefined\n description?: string | undefined\n options?: z.ZodObject<any> | undefined\n run: (context: any) => any\n}\n\ntype GeneratedEntry = GeneratedCommand | GeneratedGroup\n\ntype GeneratedGroup = {\n _group: true\n description?: string | undefined\n commands: Map<string, GeneratedEntry>\n}\n\ntype CommandSegment = {\n description?: string | undefined\n name: string\n}\n\ntype OperationEntry = {\n method: string\n operation: Operation\n path: string\n}\n\nfunction addEntry(paths: NonNullable<Document['paths']>, segments: string[], entry: any) {\n if ('_alias' in entry) return\n if ('_fetch' in entry) return\n if ('_group' in entry) {\n for (const [name, child] of entry.commands)\n addEntry(paths, [...segments, ...splitCommandName(name)], child)\n return\n }\n addCommand(paths, segments, entry)\n}\n\nfunction splitCommandName(name: string) {\n return name.split(/\\s+/).filter(Boolean)\n}\n\nfunction addCommand(paths: NonNullable<Document['paths']>, segments: string[], command: any) {\n const argsSchema = command.args ? Schema.toJsonSchema(command.args) : undefined\n const optionsSchema = command.options ? Schema.toJsonSchema(command.options) : undefined\n const outputSchema = command.output ? Schema.toJsonSchema(command.output) : undefined\n const args = objectProperties(argsSchema)\n const requiredArgs = new Set(requiredProperties(argsSchema))\n const method = inferMethod(segments)\n const pathVariants = createPathVariants(segments, args, requiredArgs)\n\n for (const variant of pathVariants) {\n const parameters: ParameterObject[] = []\n for (const name of variant.args) {\n const schema = args[name] ?? { type: 'string' }\n parameters.push({ name, in: 'path', required: true, schema })\n }\n if (method === 'get' || method === 'delete')\n for (const [name, schema] of Object.entries(objectProperties(optionsSchema)))\n parameters.push({\n name,\n in: 'query',\n ...(requiredProperties(optionsSchema).includes(name) ? { required: true } : undefined),\n schema,\n })\n\n const operation: OperationObject = {\n operationId: operationId(segments, method, variant.args),\n ...(command.description ? { summary: command.description } : undefined),\n ...(parameters.length ? { parameters } : undefined),\n ...requestBody(method, optionsSchema),\n responses: responses(outputSchema),\n }\n\n const item = (paths[variant.path] ?? {}) as PathItemObject\n ;(item as any)[method] = operation\n paths[variant.path] = item\n }\n}\n\nfunction createPathVariants(\n segments: string[],\n args: Record<string, Record<string, unknown>>,\n requiredArgs: Set<string>,\n) {\n const names = Object.keys(args)\n const requiredCount = names.findIndex((name) => !requiredArgs.has(name))\n const baseCount = requiredCount === -1 ? names.length : requiredCount\n const variants: { args: string[]; path: `/${string}` }[] = []\n for (let count = baseCount; count <= names.length; count++) {\n const included = names.slice(0, count)\n const suffix = included.map((name) => `{${name}}`)\n variants.push({\n args: included,\n path: `/${[...segments, ...suffix].map(encodePathSegment).join('/')}`,\n })\n }\n if (variants.length === 0)\n variants.push({ args: [], path: `/${segments.map(encodePathSegment).join('/')}` })\n return variants\n}\n\nfunction inferMethod(segments: string[]): HttpMethod {\n const text = segments.map(splitCamelCase).join(' ').toLowerCase()\n if (/\\b(delete|remove|rm|destroy|clear)\\b/.test(text)) return 'delete'\n if (/\\b(update|edit|modify|set|enable|disable|rename|patch)\\b/.test(text)) return 'patch'\n if (/\\b(get|list|show|read|search|find|status|describe|info|health|check)\\b/.test(text))\n return 'get'\n return 'post'\n}\n\nfunction splitCamelCase(value: string) {\n return value.replace(/([a-z0-9])([A-Z])/g, '$1 $2')\n}\n\nfunction requestBody(method: HttpMethod, schema?: Record<string, unknown> | undefined) {\n if (!schema || method === 'get' || method === 'delete') return {}\n return {\n requestBody: {\n required: requiredProperties(schema).length > 0,\n content: { 'application/json': { schema } },\n },\n }\n}\n\nfunction responses(schema?: Record<string, unknown> | undefined) {\n return {\n '200': {\n description: 'Command completed successfully.',\n content: {\n 'application/json': {\n schema: {\n type: 'object',\n required: ['ok', 'data', 'meta'],\n properties: {\n ok: { const: true },\n data: schema ?? {},\n meta: metaSchema(),\n },\n },\n },\n },\n },\n '400': errorResponse('Validation error.'),\n '500': errorResponse('Command failed.'),\n }\n}\n\nfunction errorResponse(description: string) {\n return {\n description,\n content: {\n 'application/json': {\n schema: {\n type: 'object',\n required: ['ok', 'error', 'meta'],\n properties: {\n ok: { const: false },\n error: {\n type: 'object',\n required: ['code', 'message'],\n properties: {\n code: { type: 'string' },\n message: { type: 'string' },\n retryable: { type: 'boolean' },\n },\n },\n meta: metaSchema(),\n },\n },\n },\n },\n }\n}\n\nfunction metaSchema() {\n return {\n type: 'object',\n required: ['command', 'duration'],\n properties: {\n command: { type: 'string' },\n duration: { type: 'string' },\n },\n }\n}\n\nfunction objectProperties(schema: Record<string, unknown> | undefined) {\n return (schema?.properties ?? {}) as Record<string, Record<string, unknown>>\n}\n\nfunction requiredProperties(schema: Record<string, unknown> | undefined) {\n return (schema?.required ?? []) as string[]\n}\n\nfunction operationId(segments: string[], method: HttpMethod, args: string[]) {\n const raw = [...segments, ...(args.length ? [args.join(' ')] : [])].join(' ')\n const pascal = raw.replace(/(?:^|[\\s_-]+)(\\w)/g, (_, char: string) => char.toUpperCase())\n return `${method}${pascal}`\n}\n\nfunction encodePathSegment(segment: string) {\n if (segment.startsWith('{') && segment.endsWith('}')) return segment\n return encodeURIComponent(segment)\n}\n\n/** Resolves an OpenAPI document from a JSON object or JSON URL. */\nexport async function resolve(\n source: OpenAPISource,\n options: resolve.Options = {},\n): Promise<OpenAPISpec> {\n if (typeof source !== 'string' && !(source instanceof URL)) return source\n\n const response = await fetch(resolveUrl(source, options.baseUrl))\n if (!response.ok)\n throw new Error(`Failed to fetch OpenAPI spec from ${source}: ${response.status}`)\n return (await response.json()) as OpenAPISpec\n}\n\nexport declare namespace resolve {\n /** Options for resolving an OpenAPI document source. */\n type Options = {\n /** Base URL used to resolve relative OpenAPI document paths. */\n baseUrl?: string | URL | undefined\n }\n}\n\nfunction resolveUrl(source: string | URL, baseUrl: string | URL | undefined) {\n if (source instanceof URL) return source\n\n try {\n return new URL(source)\n } catch {\n if (baseUrl === undefined)\n throw new Error(`Relative OpenAPI spec URL requires a fetch URL base: ${source}`)\n const base = new URL(baseUrl)\n if (!base.pathname.endsWith('/')) base.pathname = `${base.pathname}/`\n return new URL(source, base)\n }\n}\n\n/** Generates incur command entries from an OpenAPI spec. Resolves all `$ref` pointers. */\nexport async function generateCommands(\n spec: OpenAPISpec,\n fetch: FetchHandler,\n options: generateCommands.Options = {},\n): Promise<Map<string, GeneratedEntry>> {\n const resolved = dereference(structuredClone(spec)) as OpenAPISpec\n const commands = new Map<string, GeneratedEntry>()\n const paths = (resolved.paths ?? {}) as Record<string, Record<string, unknown>>\n const operations = openapiOperations(paths)\n const namespaceInfo = getNamespaceInfo(operations)\n const { config } = options\n\n for (const { method, operation: op, path } of operations) {\n const segments = commandSegments({\n method,\n mode: config?.mode ?? 'operation',\n namespaceInfo,\n operation: op,\n path,\n })\n const httpMethod = method.toUpperCase()\n\n const pathParams = (op.parameters ?? []).filter((p) => p.in === 'path')\n const queryParams = (op.parameters ?? []).filter((p) => p.in === 'query')\n const headerParams = headerOptions([\n ...(op.parameters ?? []).filter((p) => p.in === 'header'),\n ...securityHeaderParams(resolved, op),\n ])\n\n const bodySchema = op.requestBody?.content?.['application/json']?.schema\n const bodyProps = (bodySchema?.properties ?? {}) as Record<string, Record<string, unknown>>\n const bodyRequired = new Set((bodySchema?.required as string[]) ?? [])\n\n // Build args Zod schema from path params\n let argsSchema: z.ZodObject<any> | undefined\n if (pathParams.length > 0) {\n const shape: Record<string, z.ZodType> = {}\n for (const p of pathParams) {\n let zodType = p.schema ? toZod(p.schema) : z.string()\n if (p.description) zodType = zodType.describe(p.description)\n // Path params need coercion from string argv\n shape[p.name] = coerceIfNeeded(zodType)\n }\n argsSchema = z.object(shape)\n }\n\n // Build options Zod schema from query params + body properties\n const optShape: Record<string, z.ZodType> = {}\n const usedOptionNames = new Set<string>()\n for (const p of queryParams) {\n let zodType = p.schema ? toZod(p.schema) : z.string()\n if (!p.required) zodType = zodType.optional()\n if (p.description) zodType = zodType.describe(p.description)\n optShape[p.name] = coerceIfNeeded(zodType)\n usedOptionNames.add(p.name)\n }\n for (const [key, schema] of Object.entries(bodyProps)) {\n let zodType = toZod(schema)\n if (!bodyRequired.has(key)) zodType = zodType.optional()\n optShape[key] = zodType\n usedOptionNames.add(key)\n }\n for (const p of headerParams) {\n const optionName = resolveHeaderOptionName(p.optionName, usedOptionNames)\n p.optionName = optionName\n let zodType = p.schema ? toZod(p.schema) : z.string()\n if (!p.required) zodType = zodType.optional()\n zodType = zodType.describe(p.description ?? `${p.name} header`)\n optShape[optionName] = coerceIfNeeded(zodType)\n usedOptionNames.add(optionName)\n }\n const optionsSchema = Object.keys(optShape).length > 0 ? z.object(optShape) : undefined\n\n setCommand(commands, segments, {\n description: op.summary ?? op.description,\n args: argsSchema,\n options: optionsSchema,\n run: createHandler({\n basePath: options.basePath,\n fetch,\n httpMethod,\n path,\n headerParams,\n pathParams,\n queryParams,\n bodyProps,\n }),\n })\n }\n\n return commands\n}\n\nexport declare namespace generateCommands {\n /** Options for generating incur commands from an OpenAPI spec. */\n type Options = {\n /** Base path prepended to generated request paths. */\n basePath?: string | undefined\n /** Configuration for generated OpenAPI commands. */\n config?: Config | undefined\n }\n}\n\nconst openapiMethods = new Set([\n 'delete',\n 'get',\n 'head',\n 'options',\n 'patch',\n 'post',\n 'put',\n 'trace',\n])\n\nfunction openapiOperations(paths: Record<string, Record<string, unknown>>) {\n const operations: OperationEntry[] = []\n for (const [path, methods] of Object.entries(paths))\n for (const [method, operation] of Object.entries(methods))\n if (openapiMethods.has(method))\n operations.push({ method, operation: operation as Operation, path })\n return operations\n}\n\nfunction securityHeaderParams(spec: OpenAPISpec, operation: Operation): Parameter[] {\n const schemes = spec.components?.securitySchemes ?? {}\n const requirements = operation.security ?? spec.security ?? []\n const headers: Parameter[] = []\n\n for (const requirement of requirements)\n for (const name of Object.keys(requirement)) {\n const scheme = schemes[name]\n const parameter = securityHeaderParam(name, scheme)\n if (parameter) headers.push(parameter)\n }\n\n return headers\n}\n\nfunction securityHeaderParam(\n name: string,\n scheme: SecurityScheme | undefined,\n): Parameter | undefined {\n if (!scheme) return undefined\n // `apiKey` is OpenAPI's generic name for a credential carried in a\n // header/query/cookie, not an incur- or Cadent-specific API key concept.\n if (scheme.type === 'apiKey' && scheme.in === 'header' && scheme.name)\n return {\n description: scheme.description ?? `${scheme.name} header`,\n in: 'header',\n name: scheme.name,\n required: false,\n schema: { type: 'string' },\n }\n\n if (scheme.type === 'http' && authorizationSchemes.has(scheme.scheme?.toLowerCase() ?? ''))\n return {\n description: scheme.description ?? `${name} authorization header`,\n in: 'header',\n name: 'authorization',\n required: false,\n schema: { type: 'string' },\n }\n\n return undefined\n}\n\nconst authorizationSchemes = new Set(['basic', 'bearer'])\n\nfunction headerOptions(parameters: Parameter[]): HeaderParameter[] {\n const seen = new Set<string>()\n const headers: HeaderParameter[] = []\n\n for (const parameter of parameters) {\n const normalized = parameter.name.toLowerCase()\n if (seen.has(normalized)) continue\n seen.add(normalized)\n headers.push({ ...parameter, optionName: normalized })\n }\n\n return headers\n}\n\nfunction resolveHeaderOptionName(optionName: string, used: Set<string>) {\n if (!used.has(optionName)) return optionName\n\n const prefix = `header-${optionName}`\n if (!used.has(prefix)) return prefix\n\n for (let index = 2; ; index++) {\n const candidate = `${prefix}-${index}`\n if (!used.has(candidate)) return candidate\n }\n}\n\nfunction getNamespaceInfo(operations: OperationEntry[]) {\n const pathOperations = new Map<string, number>()\n const parentPaths = new Set<string>()\n\n for (const { path } of operations) {\n pathOperations.set(path, (pathOperations.get(path) ?? 0) + 1)\n\n const segments = namespaceNames(path)\n for (let i = 1; i < segments.length; i++) parentPaths.add(`/${segments.slice(0, i).join('/')}`)\n }\n\n return { parentPaths, pathOperations }\n}\n\nfunction commandSegments(options: commandSegments.Options): CommandSegment[] {\n const { method, mode, namespaceInfo, operation, path } = options\n if (mode === 'operation')\n return [{ name: operation.operationId ?? `${method}_${path.replace(/[/{}]/g, '_')}` }]\n\n const segments = namespaceSegments(path, operation)\n const needsMethod =\n segments.length === 0 ||\n namespaceInfo.parentPaths.has(namespacePath(path)) ||\n (namespaceInfo.pathOperations.get(path) ?? 0) > 1\n const describedSegments = describeNamespaceLeaf(\n segments,\n operation.summary ?? operation.description,\n )\n return [\n ...(describedSegments.length > 0 ? describedSegments : [{ name: 'root' }]),\n ...(needsMethod ? [{ name: method }] : []),\n ]\n}\n\ndeclare namespace commandSegments {\n type Options = {\n method: string\n mode: Mode\n namespaceInfo: {\n parentPaths: Set<string>\n pathOperations: Map<string, number>\n }\n operation: Operation\n path: string\n }\n}\n\nfunction namespaceSegments(path: string, operation?: Operation | undefined): CommandSegment[] {\n return path\n .split('/')\n .map((segment) => namespaceSegment(segment, operation))\n .filter(isCommandSegment)\n}\n\nfunction namespaceNames(path: string) {\n return namespaceSegments(path).map((segment) => segment.name)\n}\n\nfunction namespacePath(path: string) {\n return `/${namespaceNames(path).join('/')}`\n}\n\nfunction namespaceSegment(\n segment: string,\n operation?: Operation | undefined,\n): CommandSegment | undefined {\n if (!segment) return undefined\n const name = segment.startsWith('{') && segment.endsWith('}') ? segment.slice(1, -1) : segment\n const description = operation?.parameters?.find(\n (parameter) => parameter.in === 'path' && parameter.name === name,\n )?.description\n return {\n ...(description ? { description } : undefined),\n name: name.replace(/[^\\w.-]+/g, '-'),\n }\n}\n\nfunction isCommandSegment(segment: CommandSegment | undefined): segment is CommandSegment {\n return segment !== undefined\n}\n\nfunction describeNamespaceLeaf(\n segments: CommandSegment[],\n description: string | undefined,\n): CommandSegment[] {\n if (!description || segments.length === 0) return segments\n return segments.map((segment, index) =>\n index === segments.length - 1 && !segment.description ? { ...segment, description } : segment,\n )\n}\n\nfunction setCommand(\n commands: Map<string, GeneratedEntry>,\n segments: CommandSegment[],\n command: GeneratedCommand,\n) {\n const [head, ...tail] = segments\n if (!head) return\n if (tail.length === 0) {\n commands.set(head.name, command)\n return\n }\n\n const group = getGroup(commands, head)\n setCommand(group.commands, tail, command)\n}\n\nfunction getGroup(commands: Map<string, GeneratedEntry>, segment: CommandSegment) {\n const existing = commands.get(segment.name)\n if (existing && '_group' in existing) {\n if (!existing.description && segment.description) existing.description = segment.description\n return existing\n }\n\n const group: GeneratedGroup = {\n _group: true,\n commands: new Map(),\n ...(segment.description ? { description: segment.description } : undefined),\n }\n commands.set(segment.name, group)\n return group\n}\n\nfunction createHandler(config: {\n basePath?: string | undefined\n bodyProps: Record<string, Record<string, unknown>>\n fetch: FetchHandler\n headerParams: HeaderParameter[]\n httpMethod: string\n path: string\n pathParams: Parameter[]\n queryParams: Parameter[]\n}) {\n return async (context: any) => {\n const { args = {}, options = {} } = context\n\n // Build URL path with interpolated path params\n let urlPath = (config.basePath ?? '') + config.path\n for (const p of config.pathParams) {\n const value = args[p.name]\n if (value !== undefined) urlPath = urlPath.replace(`{${p.name}}`, String(value))\n }\n\n // Build query string from query params\n const query = new URLSearchParams()\n for (const p of config.queryParams) {\n const value = options[p.name]\n if (value !== undefined) query.set(p.name, String(value))\n }\n\n // Build body from body properties\n let body: string | undefined\n const bodyKeys = Object.keys(config.bodyProps)\n if (bodyKeys.length > 0) {\n const bodyObj: Record<string, unknown> = {}\n for (const key of bodyKeys) if (options[key] !== undefined) bodyObj[key] = options[key]\n if (Object.keys(bodyObj).length > 0) body = JSON.stringify(bodyObj)\n }\n\n const input: Fetch.FetchInput = {\n path: urlPath,\n method: config.httpMethod,\n headers: new Headers(),\n body,\n query,\n }\n\n for (const p of config.headerParams) {\n const value = options[p.optionName]\n if (value !== undefined) input.headers.set(p.name, String(value))\n }\n\n if (body && !input.headers.has('content-type'))\n input.headers.set('content-type', 'application/json')\n\n const request = Fetch.buildRequest(input)\n const response = await config.fetch(request)\n const output = await Fetch.parseResponse(response)\n\n if (!output.ok)\n return context.error({\n code: `HTTP_${output.status}`,\n message:\n typeof output.data === 'object' && output.data !== null && 'message' in output.data\n ? String((output.data as any).message)\n : typeof output.data === 'string'\n ? output.data\n : `HTTP ${output.status}`,\n })\n\n return output.data\n }\n}\n\n/** Converts a JSON Schema object to a Zod schema. */\nfunction toZod(schema: Record<string, unknown>): z.ZodType {\n return z.fromJSONSchema(schema)\n}\n\n/** Wraps a Zod schema with coercion if the base type is number or boolean (argv is always strings). */\nfunction coerceIfNeeded(schema: z.ZodType): z.ZodType {\n const isOptional = schema instanceof z.ZodOptional\n const inner = isOptional ? schema.unwrap() : schema\n\n const coerced = (() => {\n // Direct number\n if (inner instanceof z.ZodNumber)\n return isOptional ? z.coerce.number().optional() : z.coerce.number()\n // Direct boolean\n if (inner instanceof z.ZodBoolean)\n return isOptional ? z.coerce.boolean().optional() : z.coerce.boolean()\n // Union containing number or boolean (e.g. type: [\"number\", \"null\"] from OpenAPI 3.1)\n if (inner instanceof z.ZodUnion) {\n const options = (inner as any)._zod?.def?.options as z.ZodType[] | undefined\n if (options?.some((o: z.ZodType) => o instanceof z.ZodNumber))\n return isOptional ? z.coerce.number().optional() : z.coerce.number()\n if (options?.some((o: z.ZodType) => o instanceof z.ZodBoolean))\n return isOptional ? z.coerce.boolean().optional() : z.coerce.boolean()\n }\n // No coercion needed\n return undefined\n })()\n\n if (!coerced) return schema\n const desc = (schema as any).description ?? (inner as any).description\n return desc ? coerced.describe(desc) : coerced\n}\n","import { createHash } from 'node:crypto'\nimport { stringify as yamlStringify } from 'yaml'\nimport type { z } from 'zod'\n\nimport * as Schema from './Schema.js'\n\n/** Information about a single command, passed to `generate()`. */\nexport type CommandInfo = {\n /** Command name (subcommand path). Omit for root commands. */\n name?: string | undefined\n description?: string | undefined\n args?: z.ZodObject<any> | undefined\n env?: z.ZodObject<any> | undefined\n hint?: string | undefined\n options?: z.ZodObject<any> | undefined\n output?: z.ZodType | undefined\n examples?: { command: string; description?: string }[] | undefined\n}\n\n/** A skill file entry with its directory name and content. */\nexport type File = {\n /** Directory name relative to output root (empty string for depth 0). */\n dir: string\n /** Markdown content. */\n content: string\n}\n\n/** Generates a compact Markdown command index for `--llms`. */\nexport function index(\n name: string,\n commands: CommandInfo[],\n description?: string | undefined,\n): string {\n const lines: string[] = [`# ${name}`]\n if (description) lines.push('', description)\n lines.push('')\n lines.push('| Command | Description |')\n lines.push('|---------|-------------|')\n for (const cmd of commands) {\n const signature = buildSignature(name, cmd)\n const desc = cmd.description ?? ''\n lines.push(`| \\`${signature}\\` | ${desc} |`)\n }\n lines.push(\n '',\n `Run \\`${name} --llms-full\\` for full manifest. Run \\`${name} <command> --schema\\` for argument details.`,\n )\n return lines.join('\\n')\n}\n\n/** @internal Builds a command signature with arg placeholders. */\nfunction buildSignature(cli: string, cmd: CommandInfo): string {\n const base = !cmd.name ? cli : `${cli} ${cmd.name}`\n if (!cmd.args) return base\n const shape = cmd.args.shape as Record<string, z.ZodType>\n const json = Schema.toJsonSchema(cmd.args)\n const required = new Set((json.required as string[] | undefined) ?? [])\n const argNames = Object.keys(shape).map((k) => (required.has(k) ? `<${k}>` : `[${k}]`))\n return `${base} ${argNames.join(' ')}`\n}\n\n/** Generates a Markdown skill file from a CLI name and collected command data. */\nexport function generate(\n name: string,\n commands: CommandInfo[],\n groups: Map<string, string> = new Map(),\n): string {\n const hasGroups = groups.size > 0\n if (!hasGroups) return commands.map((cmd) => renderCommandBody(name, cmd)).join('\\n\\n')\n\n const sections: string[] = [`# ${name}`]\n let lastGroup: string | undefined\n\n for (const cmd of commands) {\n const segment = !cmd.name ? '' : cmd.name.split(' ')[0]!\n if (segment !== lastGroup) {\n lastGroup = segment\n if (segment) {\n const desc = groups.get(segment)\n const heading = desc ? `## ${name} ${segment}\\n\\n${desc}` : `## ${name} ${segment}`\n sections.push(heading)\n }\n }\n sections.push(renderCommandBody(name, cmd, segment ? 3 : 2))\n }\n\n return sections.join('\\n\\n')\n}\n\n/** Splits commands into skill files grouped by depth. */\nexport function split(\n name: string,\n commands: CommandInfo[],\n depth: number,\n groups: Map<string, string> = new Map(),\n): File[] {\n if (depth === 0) return [{ dir: '', content: renderGroup(name, name, commands, groups, name) }]\n\n const buckets = new Map<string, CommandInfo[]>()\n for (const cmd of commands) {\n if (!cmd.name) {\n const key = slugify(name)\n const bucket = buckets.get(key) ?? []\n bucket.push(cmd)\n buckets.set(key, bucket)\n continue\n }\n const segments = cmd.name.split(' ')\n const key = segments.slice(0, depth).join('-')\n const bucket = buckets.get(key) ?? []\n bucket.push(cmd)\n buckets.set(key, bucket)\n }\n\n return [...buckets.entries()]\n .sort(([a], [b]) => a.localeCompare(b))\n .map(([dir, cmds]) => {\n const first = cmds[0]!\n const prefix = !first.name ? '' : first.name.split(' ').slice(0, depth).join(' ')\n const title = prefix ? `${name} ${prefix}` : name\n return { dir, content: renderGroup(name, title, cmds, groups, prefix || undefined) }\n })\n}\n\n/** @internal Renders a group-level frontmatter + command bodies. */\nfunction renderGroup(\n cli: string,\n title: string,\n cmds: CommandInfo[],\n groups: Map<string, string>,\n prefix?: string | undefined,\n): string {\n const groupDesc = prefix ? groups.get(prefix) : undefined\n const fallbackDesc = cmds.length === 1 && cmds[0]!.description ? cmds[0]!.description : undefined\n const desc = groupDesc ?? fallbackDesc\n const description = desc\n ? `${desc.replace(/\\.$/, '')}. Run \\`${title} --help\\` for usage details.`\n : `Run \\`${title} --help\\` for usage details.`\n\n const fm = yamlStringify(\n { name: slugify(title), description, requires_bin: cli, command: title },\n { lineWidth: 0 },\n ).trimEnd()\n const fmBlock = `---\\n${fm}\\n---`\n\n const body = cmds.map((cmd) => renderCommandBody(cli, cmd)).join('\\n\\n---\\n\\n')\n return `${fmBlock}\\n\\n${body}`\n}\n\n/** @internal Renders a command's heading and sections without frontmatter. */\nfunction renderCommandBody(cli: string, cmd: CommandInfo, level = 1): string {\n const fullName = !cmd.name ? cli : `${cli} ${cmd.name}`\n const sections: string[] = []\n const h = (n: number) => '#'.repeat(n)\n\n let heading = `${h(level)} ${fullName}`\n if (cmd.description) heading += `\\n\\n${cmd.description}`\n sections.push(heading)\n\n const sub = h(level + 1)\n\n // Arguments table\n if (cmd.args) {\n const shape = cmd.args.shape as Record<string, z.ZodType>\n const json = Schema.toJsonSchema(cmd.args)\n const required = new Set((json.required as string[] | undefined) ?? [])\n const properties = json.properties as Record<string, Record<string, unknown>> | undefined\n const rows = Object.entries(shape).map(([key, field]) => {\n const prop = properties?.[key]\n const type = resolveTypeName(prop)\n const req = required.has(key) ? 'yes' : 'no'\n const desc = field.description ?? ''\n return `| \\`${key}\\` | \\`${type}\\` | ${req} | ${desc} |`\n })\n sections.push(\n `${sub} Arguments\\n\\n| Name | Type | Required | Description |\\n|------|------|----------|-------------|\\n${rows.join('\\n')}`,\n )\n }\n\n // Environment Variables table\n if (cmd.env) {\n const shape = cmd.env.shape as Record<string, z.ZodType>\n const json = Schema.toJsonSchema(cmd.env)\n const required = new Set((json.required as string[] | undefined) ?? [])\n const properties = json.properties as Record<string, Record<string, unknown>> | undefined\n const rows = Object.entries(shape).map(([key, field]) => {\n const prop = properties?.[key]\n const type = resolveTypeName(prop)\n const def = prop?.default !== undefined ? String(prop.default) : ''\n const req = required.has(key) ? 'yes' : 'no'\n const desc = field.description ?? ''\n return `| \\`${key}\\` | \\`${type}\\` | ${req} | ${def ? `\\`${def}\\`` : ''} | ${desc} |`\n })\n sections.push(\n `${sub} Environment Variables\\n\\n| Name | Type | Required | Default | Description |\\n|------|------|----------|---------|-------------|\\n${rows.join('\\n')}`,\n )\n }\n\n // Options table\n if (cmd.options) {\n const shape = cmd.options.shape as Record<string, z.ZodType>\n const json = Schema.toJsonSchema(cmd.options)\n const properties = json.properties as Record<string, Record<string, unknown>> | undefined\n const rows = Object.entries(shape).map(([key, field]) => {\n const prop = properties?.[key]\n const type = resolveTypeName(prop)\n const def = prop?.default !== undefined ? String(prop.default) : ''\n const rawDesc = field.description ?? ''\n const desc = prop?.deprecated ? `**Deprecated.** ${rawDesc}` : rawDesc\n return `| \\`--${key}\\` | \\`${type}\\` | ${def ? `\\`${def}\\`` : ''} | ${desc} |`\n })\n sections.push(\n `${sub} Options\\n\\n| Flag | Type | Default | Description |\\n|------|------|---------|-------------|\\n${rows.join('\\n')}`,\n )\n }\n\n // Output table\n if (cmd.output) {\n const outputSchema = Schema.toJsonSchema(cmd.output)\n const table = schemaToTable(outputSchema)\n if (table) sections.push(`${sub} Output\\n\\n${table}`)\n else {\n const type = resolveTypeName(outputSchema)\n sections.push(`${sub} Output\\n\\nType: \\`${type}\\``)\n }\n }\n\n // Examples\n if (cmd.examples && cmd.examples.length > 0) {\n const lines = cmd.examples.map((ex) => {\n const comment = ex.description ? `# ${ex.description}\\n` : ''\n return `${comment}${cli} ${ex.command}`\n })\n sections.push(`${sub} Examples\\n\\n\\`\\`\\`sh\\n${lines.join('\\n\\n')}\\n\\`\\`\\``)\n }\n\n // Hint\n if (cmd.hint) sections.push(`> ${cmd.hint}`)\n\n return sections.join('\\n\\n')\n}\n\n/** Computes a deterministic hash of command structure for staleness detection. */\nexport function hash(commands: CommandInfo[]): string {\n const data = commands.map((cmd) => ({\n name: cmd.name,\n description: cmd.description,\n args: cmd.args ? Schema.toJsonSchema(cmd.args) : undefined,\n env: cmd.env ? Schema.toJsonSchema(cmd.env) : undefined,\n options: cmd.options ? Schema.toJsonSchema(cmd.options) : undefined,\n output: cmd.output ? Schema.toJsonSchema(cmd.output) : undefined,\n }))\n return createHash('sha256').update(JSON.stringify(data)).digest('hex').slice(0, 16)\n}\n\n/** @internal Renders a JSON Schema object as a Markdown table. Returns `undefined` for non-object schemas. */\nfunction schemaToTable(schema: Record<string, unknown>, prefix = ''): string | undefined {\n if (schema.type !== 'object') return undefined\n const properties = schema.properties as Record<string, Record<string, unknown>> | undefined\n if (!properties || Object.keys(properties).length === 0) return undefined\n const required = new Set((schema.required as string[] | undefined) ?? [])\n\n const rows: string[] = []\n for (const [key, prop] of Object.entries(properties)) {\n const name = prefix ? `${prefix}.${key}` : key\n const type = resolveTypeName(prop)\n const req = required.has(key) ? 'yes' : 'no'\n const desc = (prop.description as string) ?? ''\n rows.push(`| \\`${name}\\` | \\`${type}\\` | ${req} | ${desc} |`)\n\n // Expand nested objects inline\n if (prop.type === 'object' && prop.properties) {\n const nested = schemaToTable(prop, name)\n if (nested) {\n const lines = nested.split('\\n')\n rows.push(...lines.slice(2)) // skip header + separator\n }\n }\n\n // Expand array item objects inline\n if (prop.type === 'array' && prop.items) {\n const items = prop.items as Record<string, unknown>\n if (items.type === 'object' && items.properties) {\n const nested = schemaToTable(items, `${name}[]`)\n if (nested) {\n const lines = nested.split('\\n')\n rows.push(...lines.slice(2))\n }\n }\n }\n }\n\n return `| Field | Type | Required | Description |\\n|-------|------|----------|-------------|\\n${rows.join('\\n')}`\n}\n\n/** @internal Converts a string to a lowercase slug (e.g. `\"my-cli\"` → `\"my-cli\"`, `\"My Tool\"` → `\"my-tool\"`). */\nfunction slugify(s: string): string {\n return s\n .toLowerCase()\n .replace(/[^a-z0-9-]+/g, '-')\n .replace(/-{2,}/g, '-')\n .replace(/^-|-$/g, '')\n}\n\n/** @internal Resolves a simple type name from a JSON Schema property. */\nfunction resolveTypeName(prop: Record<string, unknown> | undefined): string {\n if (!prop) return 'unknown'\n const type = prop.type as string | undefined\n if (type) return type === 'integer' ? 'number' : type\n return 'unknown'\n}\n","import { execFile } from 'node:child_process'\nimport { existsSync, mkdirSync, readFileSync, writeFileSync } from 'node:fs'\nimport { homedir } from 'node:os'\nimport { dirname, join } from 'node:path'\n\nimport { detectRunner } from './internal/pm.js'\n\n/** Registers the CLI as an MCP server via `npx add-mcp` and direct config writes for unsupported agents. */\nexport async function register(\n name: string,\n options: register.Options = {},\n): Promise<register.Result> {\n const runner = detectRunner()\n const command = options.command ?? `${runner} ${detectPackageSpecifier(name)} --mcp`\n const targetAgents = options.agents ?? []\n const ampOnly = targetAgents.length === 1 && targetAgents[0] === 'amp'\n\n const agents: string[] = []\n\n // Run add-mcp for agents it supports (skip if only targeting Amp)\n if (!ampOnly) {\n const args = [command, '--name', name, '-y']\n if (options.global !== false) args.push('-g')\n for (const agent of targetAgents.filter((a) => a !== 'amp')) args.push('-a', agent)\n\n const [cmd, ...prefix] = runner.split(' ')\n const { stdout } = await exec(cmd!, [...prefix, 'add-mcp', ...args])\n\n // Extract agent names from add-mcp output (lines like \"│ ✓ Claude Code: ~/.claude.json │\")\n agents.push(\n ...stdout\n .split('\\n')\n .filter((l) => l.includes('✓') || l.includes('✔'))\n .map((l) =>\n l\n .replace(/[│┃|]/g, '')\n .replace(/.*[✓✔]\\s*/, '')\n .replace(/:.*/, '')\n .trim(),\n )\n .filter(Boolean),\n )\n }\n\n // Register with Amp directly (add-mcp doesn't support it)\n if (targetAgents.length === 0 || targetAgents.includes('amp')) {\n const registered = registerAmp(name, command)\n if (registered) agents.push('Amp')\n }\n\n return { command, agents }\n}\n\n/** @internal Registers an MCP server in Amp's settings.json. */\nfunction registerAmp(name: string, command: string): boolean {\n const configPath = join(homedir(), '.config', 'amp', 'settings.json')\n\n let config: Record<string, any> = {}\n if (existsSync(configPath)) {\n try {\n config = JSON.parse(readFileSync(configPath, 'utf-8'))\n } catch {\n return false\n }\n }\n\n const [cmd, ...args] = command.split(' ')\n if (!cmd) return false\n\n const servers: Record<string, any> = config['amp.mcpServers'] ?? {}\n servers[name] = { command: cmd, args }\n config['amp.mcpServers'] = servers\n\n const dir = dirname(configPath)\n if (!existsSync(dir)) mkdirSync(dir, { recursive: true })\n writeFileSync(configPath, JSON.stringify(config, null, 2) + '\\n')\n\n return true\n}\n\nexport declare namespace register {\n /** Options for registering an MCP server. */\n type Options = {\n /** Target specific agents (e.g. `'claude-code'`, `'cursor'`). */\n agents?: string[] | undefined\n /** Override the command agents will run. Defaults to `<runner> <name> --mcp`. */\n command?: string | undefined\n /** Install globally. Defaults to `true`. */\n global?: boolean | undefined\n }\n\n /** Result of a register operation. */\n type Result = {\n /** Agents the server was registered with. */\n agents: string[]\n /** The command registered. */\n command: string\n }\n}\n\n/** @internal Detects the package specifier used to run this CLI (handles dlx/npx URL and version installs). */\nexport function detectPackageSpecifier(name: string): string {\n const bin = process.argv[1]\n if (!bin) return name\n\n const match = bin.match(/^(.+)[/\\\\]node_modules[/\\\\]/)\n if (!match) return name\n\n try {\n const pkg = JSON.parse(readFileSync(join(match[1]!, 'package.json'), 'utf-8'))\n const deps = pkg.dependencies ?? {}\n const spec = deps[name]\n if (!spec || Object.keys(deps).length !== 1) return name\n\n if (/^https?:\\/\\//.test(spec) || spec.startsWith('file:')) return spec\n if (/^\\d/.test(spec)) return `${name}@${spec}`\n } catch {}\n\n return name\n}\n\n/** Promisified execFile with stderr in error message. */\nfunction exec(cmd: string, args: string[]): Promise<{ stdout: string; stderr: string }> {\n return new Promise((resolve, reject) => {\n execFile(cmd, args, (error, stdout, stderr) => {\n if (error) {\n const msg = stderr?.trim() || stdout?.trim() || error.message\n reject(new Error(msg))\n } else resolve({ stdout, stderr })\n })\n })\n}\n","import fsSync from 'node:fs'\nimport fs from 'node:fs/promises'\nimport os from 'node:os'\nimport path from 'node:path'\nimport { parse as yamlParse } from 'yaml'\n\nimport { formatExamples } from './Cli.js'\nimport * as Agents from './internal/agents.js'\nimport * as Skill from './Skill.js'\n\n/** Generates skill files from a command map and installs them natively. */\nexport async function sync(\n name: string,\n commands: Map<string, any>,\n options: sync.Options = {},\n): Promise<sync.Result> {\n const { depth = 1, description, global = true } = options\n const cwd = options.cwd ?? (global ? resolvePackageRoot() : process.cwd())\n\n const groups = new Map<string, string>()\n if (description) groups.set(name, description)\n const entries = collectEntries(commands, [], groups, options.rootCommand)\n const files = Skill.split(name, entries, depth, groups)\n\n const tmpDir = await fs.mkdtemp(path.join(os.tmpdir(), `incur-skills-${name}-`))\n try {\n const skills: sync.Skill[] = []\n for (const file of files) {\n const filePath = file.dir\n ? path.join(tmpDir, file.dir, 'SKILL.md')\n : path.join(tmpDir, 'SKILL.md')\n await fs.mkdir(path.dirname(filePath), { recursive: true })\n await fs.writeFile(filePath, `${file.content}\\n`)\n const meta = parseFrontmatter(file.content)\n skills.push({ name: meta.name ?? (file.dir || name), description: meta.description })\n }\n\n // Include additional SKILL.md files matched by glob patterns\n if (options.include) {\n for (const pattern of options.include) {\n const globPattern = pattern === '_root' ? 'SKILL.md' : path.join(pattern, 'SKILL.md')\n for await (const match of fs.glob(globPattern, { cwd })) {\n try {\n const content = await fs.readFile(path.resolve(cwd, match), 'utf8')\n const meta = parseFrontmatter(content)\n const skillName =\n pattern === '_root' ? (meta.name ?? name) : path.basename(path.dirname(match))\n const dest = path.join(tmpDir, skillName, 'SKILL.md')\n await fs.mkdir(path.dirname(dest), { recursive: true })\n await fs.writeFile(dest, content)\n if (!skills.some((s) => s.name === skillName))\n skills.push({ name: skillName, description: meta.description, external: true })\n } catch {}\n }\n }\n }\n\n const { paths, agents } = Agents.install(tmpDir, { global, cwd })\n\n // Remove stale skills from previous installs\n const currentNames = new Set(paths.map((p) => path.basename(p)))\n const prev = readMeta(name)\n if (prev?.skills) {\n for (const old of prev.skills) {\n if (currentNames.has(old)) continue\n Agents.remove(old, { global, cwd })\n }\n }\n\n // Write skills hash + names for staleness detection\n const hashEntries = collectEntries(commands, [], undefined, options.rootCommand)\n writeMeta(\n name,\n Skill.hash(hashEntries),\n [...currentNames],\n [...paths, ...agents.map((agent) => agent.path)],\n )\n\n return { skills: skills.sort((a, b) => a.name.localeCompare(b.name)), paths, agents }\n } finally {\n await fs.rm(tmpDir, { recursive: true, force: true })\n }\n}\n\nexport declare namespace sync {\n /** Options for syncing skills. */\n type Options = {\n /** Working directory for resolving `include` globs. Defaults to `process.cwd()`. */\n cwd?: string | undefined\n /** Grouping depth for skill files. Defaults to `1`. */\n depth?: number | undefined\n /** CLI description, used as the top-level group description. */\n description?: string | undefined\n /** Install globally (`~/.config/agents/skills/`) instead of project-local. Defaults to `true`. */\n global?: boolean | undefined\n /** Glob patterns for directories containing SKILL.md files to include (e.g. `\"skills/*\"`, `\"my-skill\"`). Skill name is the parent directory name. */\n include?: string[] | undefined\n /** Root command definition (when the CLI itself has a `run` handler). */\n rootCommand?:\n | {\n description?: string | undefined\n args?: any\n env?: any\n hint?: string | undefined\n options?: any\n output?: any\n examples?: any[] | undefined\n }\n | undefined\n }\n /** Result of a sync operation. */\n type Result = {\n /** Per-agent install details (non-universal agents only). */\n agents: import('./internal/agents.js').install.AgentInstall[]\n /** Canonical install paths. */\n paths: string[]\n /** Synced skills with metadata. */\n skills: Skill[]\n }\n /** A synced skill entry. */\n type Skill = {\n /** Description extracted from the skill frontmatter. */\n description?: string | undefined\n /** Whether this skill was included from a local file (not generated from commands). */\n external?: boolean | undefined\n /** Skill directory name. */\n name: string\n }\n}\n\n/** Lists skills derived from a CLI's command map with install status. */\nexport async function list(\n name: string,\n commands: Map<string, any>,\n options: list.Options = {},\n): Promise<list.Skill[]> {\n const { depth = 1, description } = options\n const cwd = options.cwd ?? process.cwd()\n\n const groups = new Map<string, string>()\n if (description) groups.set(name, description)\n const entries = collectEntries(commands, [], groups, options.rootCommand)\n const files = Skill.split(name, entries, depth, groups)\n\n const skills: list.Skill[] = []\n const installed = readInstalledSkills(name, { cwd })\n\n for (const file of files) {\n const meta = parseFrontmatter(file.content)\n const skillName = meta.name ?? (file.dir || name)\n skills.push({\n name: skillName,\n description: meta.description,\n installed: installed.has(skillName),\n })\n }\n\n // Include additional SKILL.md files matched by glob patterns\n if (options.include) {\n for (const pattern of options.include) {\n const globPattern = pattern === '_root' ? 'SKILL.md' : path.join(pattern, 'SKILL.md')\n for await (const match of fs.glob(globPattern, { cwd })) {\n try {\n const content = await fs.readFile(path.resolve(cwd, match), 'utf8')\n const meta = parseFrontmatter(content)\n const skillName =\n pattern === '_root' ? (meta.name ?? name) : path.basename(path.dirname(match))\n if (!skills.some((s) => s.name === skillName)) {\n skills.push({\n name: skillName,\n description: meta.description,\n installed: installed.has(skillName),\n })\n }\n } catch {}\n }\n }\n }\n\n return skills.sort((a, b) => a.name.localeCompare(b.name))\n}\n\n/** Returns whether any previously synced skills are still installed on disk. */\nexport function hasInstalledSkills(\n name: string,\n options: { cwd?: string | undefined } = {},\n): boolean {\n return readInstalledSkills(name, options).size > 0\n}\n\nexport declare namespace list {\n /** Options for listing skills. */\n type Options = {\n /** Working directory for resolving `include` globs. Defaults to `process.cwd()`. */\n cwd?: string | undefined\n /** Grouping depth for skill files. Defaults to `1`. */\n depth?: number | undefined\n /** CLI description, used as the top-level group description. */\n description?: string | undefined\n /** Glob patterns for directories containing SKILL.md files to include. */\n include?: string[] | undefined\n /** Root command definition (when the CLI itself is a command). */\n rootCommand?:\n | {\n description?: string | undefined\n args?: any\n env?: any\n hint?: string | undefined\n options?: any\n output?: any\n examples?: any[] | undefined\n }\n | undefined\n }\n /** A skill entry with install status. */\n type Skill = {\n /** Description extracted from the skill frontmatter. */\n description?: string | undefined\n /** Whether this skill is currently installed. */\n installed: boolean\n /** Skill name. */\n name: string\n }\n}\n\n/** Recursively collects leaf commands as `Skill.CommandInfo`. */\nfunction collectEntries(\n commands: Map<string, any>,\n prefix: string[],\n groups: Map<string, string> = new Map(),\n rootCommand?:\n | {\n description?: string | undefined\n args?: any\n env?: any\n hint?: string | undefined\n options?: any\n output?: any\n examples?: any[] | undefined\n }\n | undefined,\n): Skill.CommandInfo[] {\n const result: Skill.CommandInfo[] = []\n if (rootCommand) {\n const cmd: Skill.CommandInfo = {}\n if (rootCommand.description) cmd.description = rootCommand.description\n if (rootCommand.args) cmd.args = rootCommand.args\n if (rootCommand.env) cmd.env = rootCommand.env\n if (rootCommand.hint) cmd.hint = rootCommand.hint\n if (rootCommand.options) cmd.options = rootCommand.options\n if (rootCommand.output) cmd.output = rootCommand.output\n const examples = formatExamples(rootCommand.examples)\n if (examples) cmd.examples = examples\n result.push(cmd)\n }\n for (const [name, entry] of commands) {\n const entryPath = [...prefix, name]\n if ('_group' in entry && entry._group) {\n if (entry.description) groups.set(entryPath.join(' '), entry.description)\n result.push(...collectEntries(entry.commands, entryPath, groups))\n } else {\n const cmd: Skill.CommandInfo = { name: entryPath.join(' ') }\n if (entry.description) cmd.description = entry.description\n if (entry.args) cmd.args = entry.args\n if (entry.env) cmd.env = entry.env\n if (entry.hint) cmd.hint = entry.hint\n if (entry.options) cmd.options = entry.options\n if (entry.output) cmd.output = entry.output\n const examples = formatExamples(entry.examples)\n if (examples) {\n const cmdName = entryPath.join(' ')\n cmd.examples = examples.map((e) => ({\n ...e,\n command: e.command ? `${cmdName} ${e.command}` : cmdName,\n }))\n }\n result.push(cmd)\n }\n }\n return result.sort((a, b) => (a.name ?? '').localeCompare(b.name ?? ''))\n}\n\nfunction parseFrontmatter(content: string): {\n description?: string | undefined\n name?: string | undefined\n} {\n const match = content.match(/^---\\r?\\n([\\s\\S]*?)\\r?\\n---/)\n if (!match) return {}\n\n const meta = yamlParse(match[1]!)\n if (!meta || typeof meta !== 'object') return {}\n return meta as { description?: string | undefined; name?: string | undefined }\n}\n\n/** Resolves the package root from the executing bin script (`process.argv[1]`). Walks up from the bin's directory looking for `package.json`. Falls back to `process.cwd()`. */\nfunction resolvePackageRoot(): string {\n const bin = process.argv[1]\n if (!bin) return process.cwd()\n let dir = path.dirname(\n (() => {\n try {\n // resolve symlinks for normal bin scripts\n return fsSync.realpathSync(bin)\n } catch {\n // Bun compiled binaries use a virtual `/$bunfs/` path for argv[1]\n return process.execPath\n }\n })(),\n )\n const root = path.parse(dir).root\n while (dir !== root) {\n try {\n fsSync.accessSync(path.join(dir, 'package.json'))\n return dir\n } catch {}\n dir = path.dirname(dir)\n }\n return process.cwd()\n}\n\n/** Returns the hash file path for a CLI. */\nfunction hashPath(name: string): string {\n const dir = process.env.XDG_DATA_HOME || path.join(os.homedir(), '.local', 'share')\n return path.join(dir, 'incur', `${name}.json`)\n}\n\n/** @internal Writes the skills metadata for staleness detection and cleanup. */\nfunction writeMeta(name: string, hash: string, skills: string[], paths: string[]) {\n const file = hashPath(name)\n const dir = path.dirname(file)\n if (!fsSync.existsSync(dir)) fsSync.mkdirSync(dir, { recursive: true })\n fsSync.writeFileSync(\n file,\n JSON.stringify({ hash, skills, paths, at: new Date().toISOString() }) + '\\n',\n )\n}\n\n/** @internal Reads the stored metadata for a CLI. */\nfunction readMeta(\n name: string,\n): { hash: string; paths?: string[] | undefined; skills?: string[] | undefined } | undefined {\n try {\n return JSON.parse(fsSync.readFileSync(hashPath(name), 'utf-8'))\n } catch {\n return undefined\n }\n}\n\n/** Reads the names of previously synced skills that are still installed on disk. */\nfunction readInstalledSkills(\n name: string,\n options: { cwd?: string | undefined } = {},\n): Set<string> {\n const meta = readMeta(name)\n if (!meta?.skills?.length) return new Set()\n\n if (meta.paths?.length) {\n const installed = meta.paths\n .filter((skillPath) => isInstalledSkillPath(skillPath))\n .map((skillPath) => path.basename(skillPath))\n return new Set(installed)\n }\n\n const cwd = options.cwd ?? process.cwd()\n const bases = [path.join(os.homedir(), '.agents', 'skills'), path.join(cwd, '.agents', 'skills')]\n const installed = meta.skills.filter((skill) =>\n bases.some((base) => isInstalledSkillPath(path.join(base, skill))),\n )\n return new Set(installed)\n}\n\n/** Returns whether a skill directory currently contains a skill file. */\nfunction isInstalledSkillPath(skillPath: string): boolean {\n return fsSync.existsSync(path.join(skillPath, 'SKILL.md'))\n}\n\n/** Reads the stored skills hash for a CLI. Returns `undefined` if no hash exists. */\nexport function readHash(name: string): string | undefined {\n return readMeta(name)?.hash\n}\n","import * as fs from 'node:fs'\nimport * as os from 'node:os'\nimport * as path from 'node:path'\n\n/** Agent configuration for skill installation. */\nexport type Agent = {\n /** Display name. */\n name: string\n /** Absolute path to the global skills directory. */\n globalSkillsDir: string\n /** Project-relative skills directory path. */\n projectSkillsDir: string\n /** Whether this agent uses the canonical `.agents/skills` path. */\n universal: boolean\n /** Checks if the agent is installed on the system. */\n detect(): boolean\n}\n\nconst home = os.homedir()\nconst configHome = process.env.XDG_CONFIG_HOME || path.join(home, '.config')\nconst claudeHome = process.env.CLAUDE_CONFIG_DIR?.trim() || path.join(home, '.claude')\nconst codexHome = process.env.CODEX_HOME?.trim() || path.join(home, '.codex')\n\n/** All known agent definitions. */\nexport const all: Agent[] = [\n // Universal agents (project skillsDir = .agents/skills)\n {\n name: 'Amp',\n globalSkillsDir: path.join(configHome, 'agents', 'skills'),\n projectSkillsDir: '.agents/skills',\n universal: true,\n detect: () => fs.existsSync(path.join(configHome, 'amp')),\n },\n {\n name: 'Cline',\n globalSkillsDir: path.join(home, '.agents', 'skills'),\n projectSkillsDir: '.agents/skills',\n universal: true,\n detect: () => fs.existsSync(path.join(home, '.cline')),\n },\n {\n name: 'Codex',\n globalSkillsDir: path.join(codexHome, 'skills'),\n projectSkillsDir: '.agents/skills',\n universal: true,\n detect: () => fs.existsSync(codexHome),\n },\n {\n name: 'Cursor',\n globalSkillsDir: path.join(home, '.cursor', 'skills'),\n projectSkillsDir: '.agents/skills',\n universal: true,\n detect: () => fs.existsSync(path.join(home, '.cursor')),\n },\n {\n name: 'Gemini CLI',\n globalSkillsDir: path.join(home, '.gemini', 'skills'),\n projectSkillsDir: '.agents/skills',\n universal: true,\n detect: () => fs.existsSync(path.join(home, '.gemini')),\n },\n {\n name: 'GitHub Copilot',\n globalSkillsDir: path.join(home, '.copilot', 'skills'),\n projectSkillsDir: '.agents/skills',\n universal: true,\n detect: () => fs.existsSync(path.join(home, '.copilot')),\n },\n {\n name: 'Kimi CLI',\n globalSkillsDir: path.join(configHome, 'agents', 'skills'),\n projectSkillsDir: '.agents/skills',\n universal: true,\n detect: () => fs.existsSync(path.join(home, '.kimi')),\n },\n {\n name: 'OpenCode',\n globalSkillsDir: path.join(configHome, 'opencode', 'skills'),\n projectSkillsDir: '.agents/skills',\n universal: true,\n detect: () => fs.existsSync(path.join(configHome, 'opencode')),\n },\n\n // Non-universal agents (need symlink from their skills dir to canonical)\n {\n name: 'Claude Code',\n globalSkillsDir: path.join(claudeHome, 'skills'),\n projectSkillsDir: '.claude/skills',\n universal: false,\n detect: () => fs.existsSync(claudeHome),\n },\n {\n name: 'Windsurf',\n globalSkillsDir: path.join(home, '.codeium', 'windsurf', 'skills'),\n projectSkillsDir: '.windsurf/skills',\n universal: false,\n detect: () => fs.existsSync(path.join(home, '.codeium', 'windsurf')),\n },\n {\n name: 'Continue',\n globalSkillsDir: path.join(home, '.continue', 'skills'),\n projectSkillsDir: '.continue/skills',\n universal: false,\n detect: () => fs.existsSync(path.join(home, '.continue')),\n },\n {\n name: 'Roo',\n globalSkillsDir: path.join(home, '.roo', 'skills'),\n projectSkillsDir: '.roo/skills',\n universal: false,\n detect: () => fs.existsSync(path.join(home, '.roo')),\n },\n {\n name: 'Kilo',\n globalSkillsDir: path.join(home, '.kilocode', 'skills'),\n projectSkillsDir: '.kilocode/skills',\n universal: false,\n detect: () => fs.existsSync(path.join(home, '.kilocode')),\n },\n {\n name: 'Goose',\n globalSkillsDir: path.join(configHome, 'goose', 'skills'),\n projectSkillsDir: '.goose/skills',\n universal: false,\n detect: () => fs.existsSync(path.join(configHome, 'goose')),\n },\n {\n name: 'Augment',\n globalSkillsDir: path.join(home, '.augment', 'skills'),\n projectSkillsDir: '.augment/skills',\n universal: false,\n detect: () => fs.existsSync(path.join(home, '.augment')),\n },\n {\n name: 'Trae',\n globalSkillsDir: path.join(home, '.trae', 'skills'),\n projectSkillsDir: '.trae/skills',\n universal: false,\n detect: () => fs.existsSync(path.join(home, '.trae')),\n },\n {\n name: 'Junie',\n globalSkillsDir: path.join(home, '.junie', 'skills'),\n projectSkillsDir: '.junie/skills',\n universal: false,\n detect: () => fs.existsSync(path.join(home, '.junie')),\n },\n {\n name: 'Crush',\n globalSkillsDir: path.join(configHome, 'crush', 'skills'),\n projectSkillsDir: '.crush/skills',\n universal: false,\n detect: () => fs.existsSync(path.join(configHome, 'crush')),\n },\n {\n name: 'Kiro CLI',\n globalSkillsDir: path.join(home, '.kiro', 'skills'),\n projectSkillsDir: '.kiro/skills',\n universal: false,\n detect: () => fs.existsSync(path.join(home, '.kiro')),\n },\n {\n name: 'Qwen Code',\n globalSkillsDir: path.join(home, '.qwen', 'skills'),\n projectSkillsDir: '.qwen/skills',\n universal: false,\n detect: () => fs.existsSync(path.join(home, '.qwen')),\n },\n {\n name: 'OpenHands',\n globalSkillsDir: path.join(home, '.openhands', 'skills'),\n projectSkillsDir: '.openhands/skills',\n universal: false,\n detect: () => fs.existsSync(path.join(home, '.openhands')),\n },\n]\n\n/** Detects which agents are installed on the system. */\nexport function detect(): Agent[] {\n return all.filter((a) => a.detect())\n}\n\n/**\n * Installs skill directories to the canonical location and creates symlinks for\n * detected non-universal agents.\n *\n * @param sourceDir - Directory containing skill subdirectories (each with a `SKILL.md`).\n * @param options - Installation options.\n * @returns Installed canonical paths.\n */\nexport function install(sourceDir: string, options: install.Options = {}): install.Result {\n const isGlobal = options.global !== false\n const cwd = options.cwd || process.cwd()\n const base = isGlobal ? home : cwd\n const canonicalBase = path.join(base, '.agents', 'skills')\n const detected = options.agents ?? detect()\n\n const paths: string[] = []\n const agents: install.AgentInstall[] = []\n\n for (const skill of discoverSkills(sourceDir)) {\n const canonicalDir = path.join(canonicalBase, skill.name)\n\n // Copy to canonical location\n rmForce(canonicalDir)\n fs.mkdirSync(canonicalDir, { recursive: true })\n if (skill.root)\n fs.copyFileSync(path.join(skill.dir, 'SKILL.md'), path.join(canonicalDir, 'SKILL.md'))\n else fs.cpSync(skill.dir, canonicalDir, { recursive: true })\n paths.push(canonicalDir)\n\n // Create symlinks for non-universal agents\n for (const agent of detected) {\n if (agent.universal) continue\n const agentSkillsDir = isGlobal\n ? agent.globalSkillsDir\n : path.join(cwd, agent.projectSkillsDir)\n const agentDir = path.join(agentSkillsDir, skill.name)\n\n // Skip if agent dir resolves to canonical (no symlink needed)\n if (agentDir === canonicalDir) continue\n\n try {\n rmForce(agentDir)\n fs.mkdirSync(path.dirname(agentDir), { recursive: true })\n // Resolve through any existing symlinks in parent directories\n const realLinkDir = resolveParent(path.dirname(agentDir))\n const realTarget = resolveParent(canonicalDir)\n const rel = path.relative(realLinkDir, realTarget)\n fs.symlinkSync(rel, agentDir)\n agents.push({ agent: agent.name, path: agentDir, mode: 'symlink' })\n } catch {\n // Fallback to copy if symlink fails (e.g. Windows without permissions)\n try {\n fs.cpSync(canonicalDir, agentDir, { recursive: true })\n agents.push({ agent: agent.name, path: agentDir, mode: 'copy' })\n } catch {}\n }\n }\n }\n\n return { paths, agents }\n}\n\nexport declare namespace install {\n type Options = {\n /** Override detected agents. */\n agents?: Agent[] | undefined\n /** Working directory for project-local installs. */\n cwd?: string | undefined\n /** Install globally. Defaults to `true`. */\n global?: boolean | undefined\n }\n type Result = {\n /** Canonical install paths. */\n paths: string[]\n /** Per-agent install details (non-universal agents only). */\n agents: AgentInstall[]\n }\n type AgentInstall = {\n /** Agent display name. */\n agent: string\n /** Installed path. */\n path: string\n /** Whether it was symlinked or copied. */\n mode: 'symlink' | 'copy'\n }\n}\n\n/**\n * Removes a skill by name from the canonical location and all detected agent directories.\n */\nexport function remove(\n skillName: string,\n options: { global?: boolean | undefined; cwd?: string | undefined } = {},\n) {\n const isGlobal = options.global !== false\n const cwd = options.cwd || process.cwd()\n const base = isGlobal ? home : cwd\n const canonicalDir = path.join(base, '.agents', 'skills', skillName)\n rmForce(canonicalDir)\n\n for (const agent of detect()) {\n if (agent.universal) continue\n const agentSkillsDir = isGlobal ? agent.globalSkillsDir : path.join(cwd, agent.projectSkillsDir)\n const agentDir = path.join(agentSkillsDir, skillName)\n rmForce(agentDir)\n }\n}\n\n/** Recursively discovers skill directories (those containing a `SKILL.md`). */\nfunction discoverSkills(rootDir: string): { name: string; dir: string; root?: boolean }[] {\n const results: { name: string; dir: string; root?: boolean }[] = []\n\n function visit(dir: string) {\n let entries: fs.Dirent[]\n try {\n entries = fs.readdirSync(dir, { withFileTypes: true })\n } catch {\n return\n }\n for (const entry of entries) {\n if (!entry.isDirectory()) continue\n const subDir = path.join(dir, entry.name)\n const skillPath = path.join(subDir, 'SKILL.md')\n if (fs.existsSync(skillPath)) {\n const content = fs.readFileSync(skillPath, 'utf8')\n const nameMatch = content.match(/^name:\\s*(.+)$/m)\n results.push({ name: sanitizeName(nameMatch?.[1] ?? entry.name), dir: subDir })\n }\n visit(subDir)\n }\n }\n\n visit(rootDir)\n\n // Root-level SKILL.md (e.g. depth=0)\n const rootSkill = path.join(rootDir, 'SKILL.md')\n if (fs.existsSync(rootSkill)) {\n const content = fs.readFileSync(rootSkill, 'utf8')\n const nameMatch = content.match(/^name:\\s*(.+)$/m)\n const name = sanitizeName(nameMatch?.[1] ?? 'skill')\n if (!results.some((r) => r.name === name)) results.push({ name, dir: rootDir, root: true })\n }\n\n return results\n}\n\n/** Sanitizes a skill name for use as a directory name. */\nfunction sanitizeName(name: string): string {\n return name.trim().replace(/[/\\\\]/g, '-').replace(/\\.\\./g, '').slice(0, 255)\n}\n\n/** Removes a file, directory, or symlink (including broken symlinks). */\nfunction rmForce(target: string) {\n try {\n const stat = fs.lstatSync(target)\n if (stat.isSymbolicLink()) fs.unlinkSync(target)\n else fs.rmSync(target, { recursive: true, force: true })\n } catch {}\n}\n\n/** Resolves parent directories through symlinks. */\nfunction resolveParent(dir: string): string {\n try {\n return fs.realpathSync(dir)\n } catch {\n const parent = path.dirname(dir)\n if (parent === dir) return dir\n try {\n return path.join(fs.realpathSync(parent), path.relative(parent, dir))\n } catch {\n return dir\n }\n }\n}\n","{\n \"openapi\": \"3.1.0\",\n \"info\": {\n \"title\": \"Whop API\",\n \"description\": \"Hand-written V1 endpoints. Merged into the GraphqlRestProxy-generated schema at build time.\",\n \"version\": \"v1\"\n },\n \"servers\": [\n {\n \"url\": \"https://{defaultHost}\",\n \"variables\": {\n \"defaultHost\": {\n \"default\": \"api.whop.com/api/v1\"\n }\n }\n }\n ],\n \"paths\": {\n \"/accounts\": {\n \"get\": {\n \"summary\": \"List Accounts\",\n \"tags\": [\n \"Accounts\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"company:balance:read\"\n ]\n }\n ],\n \"description\": \"Lists accounts visible to the credential. User tokens return the user's business accounts; business account API keys return the requesting business account and its connected accounts.\",\n \"operationId\": \"list\",\n \"parameters\": [\n {\n \"name\": \"page\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 1\n },\n \"required\": false,\n \"description\": \"The page number to retrieve\"\n },\n {\n \"name\": \"per\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 10\n },\n \"required\": false,\n \"description\": \"The number of resources to return per page. There is a limit of 50 results per page.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"accounts listed\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"pagination\": {\n \"$ref\": \"#/components/schemas/Pagination\"\n },\n \"accounts\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/Account\"\n }\n }\n },\n \"required\": [\n \"pagination\",\n \"accounts\"\n ]\n }\n }\n }\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"403\": {\n \"description\": \"credential lacks the required balance-read scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n }\n }\n },\n \"post\": {\n \"summary\": \"Create Account\",\n \"tags\": [\n \"Accounts\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"company:create_child\"\n ]\n }\n ],\n \"description\": \"Creates an account. User tokens create business accounts; business account API keys create connected accounts.\",\n \"operationId\": \"create\",\n \"parameters\": [],\n \"responses\": {\n \"201\": {\n \"description\": \"account created\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Account\"\n }\n }\n }\n },\n \"400\": {\n \"description\": \"the request body is invalid\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"403\": {\n \"description\": \"credential lacks the required connected-account creation scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n }\n },\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"email\": {\n \"type\": \"string\",\n \"description\": \"The email address of the account owner. Required for business account API key requests.\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"description\": \"Arbitrary key/value metadata to store on the account.\"\n }\n }\n }\n }\n },\n \"required\": true\n }\n }\n },\n \"/accounts/{account_id}\": {\n \"get\": {\n \"summary\": \"Retrieve Account\",\n \"tags\": [\n \"Accounts\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"company:balance:read\"\n ]\n }\n ],\n \"description\": \"Retrieves a single account visible to the credential, including its crypto wallet.\",\n \"operationId\": \"get\",\n \"parameters\": [\n {\n \"name\": \"account_id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The ID of the account, which will look like biz_*************\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"account retrieved\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Account\"\n }\n }\n }\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"403\": {\n \"description\": \"credential lacks the required balance-read scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n },\n \"404\": {\n \"description\": \"no account with that ID is visible to the credential\",\n \"$ref\": \"#/components/responses/NotFound\"\n }\n }\n },\n \"patch\": {\n \"summary\": \"Update Account\",\n \"tags\": [\n \"Accounts\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"company:update\"\n ]\n }\n ],\n \"description\": \"Updates an account. User tokens can update business accounts; business account API keys can update connected accounts.\",\n \"operationId\": \"update\",\n \"parameters\": [\n {\n \"name\": \"account_id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The ID of the account, which will look like biz_*************\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"account updated\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Account\"\n }\n }\n }\n },\n \"400\": {\n \"description\": \"store page config is not an object\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"403\": {\n \"description\": \"credential lacks the required update scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n },\n \"404\": {\n \"description\": \"no account with that ID is visible to the credential\",\n \"$ref\": \"#/components/responses/NotFound\"\n }\n },\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"affiliate_application_required\": {\n \"type\": \"boolean\",\n \"description\": \"Whether prospective affiliates must submit an application before promoting this account.\"\n },\n \"affiliate_instructions\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Guidelines shown to affiliates promoting this account.\"\n },\n \"banner_image\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"additionalProperties\": true,\n \"description\": \"Attachment input for the account banner image.\"\n },\n \"business_type\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The high-level business category for the account.\"\n },\n \"country\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The country the account is located in.\"\n },\n \"description\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"A promotional description for the account.\"\n },\n \"featured_affiliate_product_id\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The ID of the product to feature for affiliates. Pass null to clear.\"\n },\n \"home_preferences\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"Preferences for the public business home page.\"\n },\n \"industry_group\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The industry group the account belongs to.\"\n },\n \"industry_type\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The specific industry vertical the account operates in.\"\n },\n \"invoice_prefix\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The prefix to use for account invoices.\"\n },\n \"logo\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"additionalProperties\": true,\n \"description\": \"Attachment input for the account logo.\"\n },\n \"onboarding_type\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The type of onboarding the account has completed.\"\n },\n \"opengraph_image\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"additionalProperties\": true,\n \"description\": \"Attachment input for the account Open Graph image.\"\n },\n \"opengraph_image_variant\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The account Open Graph image variant.\"\n },\n \"other_business_description\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The description of the business type when business_type is other.\"\n },\n \"other_industry_description\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The description of the industry type when industry_type is other.\"\n },\n \"require_2fa\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the account requires authorized users to have two-factor authentication enabled.\"\n },\n \"route\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The unique URL slug for the account.\"\n },\n \"send_customer_emails\": {\n \"type\": \"boolean\",\n \"description\": \"Whether Whop sends transactional emails to customers on behalf of this account.\"\n },\n \"show_joined_whops\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the account appears in joined whops on other accounts.\"\n },\n \"show_reviews_dtc\": {\n \"type\": \"boolean\",\n \"description\": \"Whether reviews are displayed on direct-to-consumer product pages.\"\n },\n \"show_user_directory\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the account shows users in the user directory.\"\n },\n \"social_links\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"additionalProperties\": true\n },\n \"description\": \"The full list of social links to display for the account.\"\n },\n \"store_page_config\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"additionalProperties\": true,\n \"description\": \"Store page display configuration for the account.\"\n },\n \"target_audience\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The target audience for this account.\"\n },\n \"title\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The display name of the account.\"\n },\n \"use_logo_as_opengraph_image_fallback\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the account uses its logo as the fallback Open Graph image.\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"description\": \"Arbitrary key/value metadata to store on the account.\"\n }\n }\n }\n }\n },\n \"required\": true\n }\n }\n },\n \"/accounts/me\": {\n \"get\": {\n \"summary\": \"Retrieve Requesting Account\",\n \"tags\": [\n \"Accounts\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"company:balance:read\"\n ]\n }\n ],\n \"description\": \"Retrieves the business account associated with the current business account API key.\",\n \"operationId\": \"me\",\n \"responses\": {\n \"200\": {\n \"description\": \"requesting account retrieved\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Account\"\n }\n }\n }\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"403\": {\n \"description\": \"credential lacks the required balance-read scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n }\n },\n \"parameters\": []\n }\n },\n \"/deposits\": {\n \"get\": {\n \"summary\": \"Retrieve Deposits\",\n \"tags\": [\n \"Deposits\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"payout:account:read\"\n ]\n }\n ],\n \"description\": \"Returns deposit transactions for a business account. Bank deposit transactions are nested under the bank field.\",\n \"operationId\": \"list\",\n \"parameters\": [\n {\n \"name\": \"account_id\",\n \"in\": \"query\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Business account ID (biz_*).\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"deposits retrieved\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"deposits\"\n ]\n },\n \"account_id\": {\n \"type\": \"string\"\n },\n \"bank\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"source_amount\": {\n \"type\": \"string\"\n },\n \"source_currency\": {\n \"type\": \"string\"\n },\n \"destination_amount\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"destination_currency\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"status\": {\n \"type\": \"string\"\n },\n \"created_at\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n }\n },\n \"required\": [\n \"id\",\n \"source_amount\",\n \"source_currency\",\n \"destination_amount\",\n \"destination_currency\",\n \"status\",\n \"created_at\"\n ]\n }\n }\n },\n \"required\": [\n \"object\",\n \"account_id\",\n \"bank\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"account ID is invalid\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"403\": {\n \"description\": \"credential lacks the payout account read scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n }\n }\n },\n \"post\": {\n \"summary\": \"Create Deposit\",\n \"tags\": [\n \"Deposits\"\n ],\n \"description\": \"Resolves a deposit destination and returns the on-chain addresses that can fund it. No authentication is required; any business can be resolved by its account ID.\",\n \"operationId\": \"create\",\n \"parameters\": [],\n \"responses\": {\n \"201\": {\n \"description\": \"deposit created\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"deposit\"\n ]\n },\n \"amount\": {\n \"type\": \"string\"\n },\n \"account_id\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Account ID of the destination owner. Null for raw wallet address destinations.\"\n },\n \"hosted_url\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"URL of the hosted deposit page. Only present for business destinations.\"\n },\n \"methods\": {\n \"type\": \"object\",\n \"properties\": {\n \"crypto\": {\n \"type\": \"object\",\n \"properties\": {\n \"wallet\": {\n \"type\": \"string\"\n },\n \"evm\": {\n \"type\": \"string\"\n },\n \"solana\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"wallet\",\n \"evm\",\n \"solana\"\n ]\n },\n \"bank\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"Bank deposit details. Only present when bank deposits are active for the destination account.\",\n \"properties\": {\n \"currencies\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"currency\": {\n \"type\": \"string\"\n },\n \"account_number\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"routing_number\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"deposit_bank_name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"deposit_beneficiary_name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"deposit_reference\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"rails\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n },\n \"description\": \"Active deposit rails for this currency, e.g. ach, wire, sepa.\"\n }\n },\n \"required\": [\n \"currency\",\n \"account_number\",\n \"routing_number\",\n \"deposit_bank_name\",\n \"deposit_beneficiary_name\",\n \"deposit_reference\",\n \"rails\"\n ]\n }\n }\n },\n \"required\": [\n \"currencies\"\n ]\n }\n },\n \"required\": [\n \"crypto\",\n \"bank\"\n ]\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": true\n }\n },\n \"required\": [\n \"object\",\n \"account_id\",\n \"hosted_url\",\n \"methods\",\n \"metadata\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"request is invalid\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n }\n },\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"amount\": {\n \"type\": \"number\",\n \"description\": \"Optional amount to deposit.\"\n },\n \"destination\": {\n \"oneOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"account_id\": {\n \"type\": \"string\"\n },\n \"address\": {\n \"type\": \"string\"\n },\n \"network\": {\n \"type\": \"string\"\n }\n }\n }\n ],\n \"description\": \"Destination account ID or wallet address. Object form is supported for compatibility.\"\n },\n \"network\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Optional destination network override.\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"description\": \"Arbitrary metadata echoed in the response.\"\n }\n },\n \"required\": [\n \"destination\"\n ]\n }\n }\n },\n \"required\": true\n }\n }\n },\n \"/financial-activity\": {\n \"get\": {\n \"summary\": \"List Financial Activity\",\n \"tags\": [\n \"Ledgers\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"company:balance:read\"\n ]\n }\n ],\n \"description\": \"Lists financial activity rows for a ledger account. Rows are derived from ledger lines and include typed resource and source objects that clients can use for presentation and navigation. The ledger's owner is passed as exactly one of account_id (a biz_ identifier) or user_id (a user_ identifier).\",\n \"operationId\": \"list\",\n \"parameters\": [\n {\n \"name\": \"account_id\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The owning account ID (a biz_ identifier). Provide this or user_id.\"\n },\n {\n \"name\": \"user_id\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The owning user ID (a user_ identifier). Provide this or account_id.\"\n },\n {\n \"name\": \"line_types\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"style\": \"form\",\n \"explode\": true,\n \"description\": \"Optional ledger line categories to include. Some categories (for example onchain_deposit, which covers inbound crypto deposits such as MoonPay onramps) are only returned when explicitly requested here.\"\n },\n {\n \"name\": \"currency\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Optional currency code filter, for example usd.\"\n },\n {\n \"name\": \"posted_after\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"description\": \"Only include rows posted after this ISO 8601 timestamp.\"\n },\n {\n \"name\": \"posted_before\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"description\": \"Only include rows posted before this ISO 8601 timestamp.\"\n },\n {\n \"name\": \"limit\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 20,\n \"maximum\": 100\n },\n \"description\": \"Maximum number of rows to return.\"\n },\n {\n \"name\": \"cursor\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Cursor returned by the previous page.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"activities listed for a user\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"data\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"ledger_activity\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"line_type\": {\n \"type\": \"string\"\n },\n \"amount\": {\n \"type\": \"string\",\n \"description\": \"Signed amount in the currency's smallest precision units.\"\n },\n \"currency\": {\n \"type\": \"object\",\n \"properties\": {\n \"code\": {\n \"type\": \"string\"\n },\n \"precision\": {\n \"type\": \"string\",\n \"description\": \"Precision factor for the currency, for example 100000000 for USD.\"\n }\n },\n \"required\": [\n \"code\",\n \"precision\"\n ]\n },\n \"posted_at\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"created_at\": {\n \"type\": \"string\",\n \"format\": \"date-time\",\n \"nullable\": true\n },\n \"resource\": {\n \"oneOf\": [\n {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"account\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"route\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"logo_url\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"title\",\n \"route\",\n \"logo_url\"\n ]\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"user\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"username\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"profile_picture_url\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"name\",\n \"username\",\n \"profile_picture_url\"\n ]\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"ledger_account\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"owner\": {\n \"oneOf\": [\n {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"account\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"title\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"route\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"logo_url\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"title\",\n \"route\",\n \"logo_url\"\n ]\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"user\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"username\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"profile_picture_url\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"name\",\n \"username\",\n \"profile_picture_url\"\n ]\n },\n {\n \"type\": \"null\"\n }\n ]\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"owner\"\n ]\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"payment_method\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"payment_method_type\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"gateway_type\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"card\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"properties\": {\n \"brand\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"last4\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"exp_month\": {\n \"type\": \"integer\",\n \"nullable\": true\n },\n \"exp_year\": {\n \"type\": \"integer\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"brand\",\n \"last4\",\n \"exp_month\",\n \"exp_year\"\n ]\n },\n \"bank\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"properties\": {\n \"bank_name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"account_name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"last4\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"account_type\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"bank_name\",\n \"account_name\",\n \"last4\",\n \"account_type\"\n ]\n },\n \"email_identifier\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"payment_method_type\",\n \"gateway_type\",\n \"card\",\n \"bank\",\n \"email_identifier\"\n ]\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"payout_method\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"nickname\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"institution_name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"account_reference\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"provider\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"destination_currency_code\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"nickname\",\n \"institution_name\",\n \"account_reference\",\n \"provider\",\n \"destination_currency_code\"\n ]\n },\n {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"card_transaction\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"merchant_name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"merchant_icon_url\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"merchant_category\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"status\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"usd_amount\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The processor-settled USD amount as a decimal string. The ledger's USDT leg is posted 1:1 from this value.\"\n },\n \"cashback_usd\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Cashback earned on this transaction as a USD decimal string. Zero for declined or ineligible transactions; null when cashback has not been computed yet.\"\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"merchant_name\",\n \"merchant_icon_url\",\n \"merchant_category\",\n \"status\",\n \"usd_amount\",\n \"cashback_usd\"\n ]\n },\n {\n \"type\": \"null\"\n }\n ]\n },\n \"source\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"additionalProperties\": true,\n \"properties\": {\n \"object\": {\n \"type\": \"string\"\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"status\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Withdrawal lifecycle status (withdrawal sources only; requires payout:withdrawal:read).\"\n },\n \"created_at\": {\n \"type\": \"string\",\n \"format\": \"date-time\",\n \"nullable\": true,\n \"description\": \"Withdrawal creation time as an ISO 8601 timestamp (withdrawal sources only; requires payout:withdrawal:read).\"\n },\n \"estimated_arrival\": {\n \"type\": \"string\",\n \"format\": \"date-time\",\n \"nullable\": true,\n \"description\": \"Estimated arrival as an ISO 8601 timestamp (withdrawal sources only; requires payout:withdrawal:read).\"\n },\n \"payer_name\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Name of the entity processing the payout (withdrawal sources only; requires payout:withdrawal:read).\"\n },\n \"payout_token_nickname\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Saved payout destination nickname (withdrawal sources only).\"\n },\n \"tx_hash\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"On-chain transaction hash (onchain_transaction and swap sources only).\"\n },\n \"sender_address\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Sender wallet address or onramp provider identifier (onchain_transaction sources only).\"\n },\n \"chain\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Chain the deposit landed on, for example plasma (onchain_transaction sources only).\"\n },\n \"from_amount\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Amount converted out of from_currency as a decimal string (swap sources only).\"\n },\n \"from_currency\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Lowercase currency code converted from (swap sources only).\"\n },\n \"to_amount\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Amount received in to_currency as a decimal string (swap sources only).\"\n },\n \"to_currency\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Lowercase currency code converted to (swap sources only).\"\n },\n \"payout_destination\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"Payout destination display info (withdrawal sources only).\",\n \"properties\": {\n \"payer_name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"icon_url\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n }\n }\n },\n \"required\": [\n \"object\",\n \"id\"\n ]\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"line_type\",\n \"amount\",\n \"currency\",\n \"posted_at\",\n \"created_at\",\n \"resource\",\n \"source\"\n ]\n }\n },\n \"page_info\": {\n \"type\": \"object\",\n \"properties\": {\n \"has_next_page\": {\n \"type\": \"boolean\"\n },\n \"end_cursor\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"has_previous_page\": {\n \"type\": \"boolean\"\n },\n \"start_cursor\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"has_next_page\",\n \"end_cursor\",\n \"has_previous_page\",\n \"start_cursor\"\n ]\n }\n },\n \"required\": [\n \"data\",\n \"page_info\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"neither account_id nor user_id provided\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"403\": {\n \"description\": \"credential lacks the required balance-read scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n },\n \"404\": {\n \"description\": \"no ledger for that owner is visible to the credential\",\n \"$ref\": \"#/components/responses/NotFound\"\n }\n }\n }\n },\n \"/payouts\": {\n \"get\": {\n \"summary\": \"List Payouts\",\n \"tags\": [\n \"Payouts\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"payout:withdrawal:read\"\n ]\n }\n ],\n \"description\": \"Lists payouts (withdrawal requests) for a ledger account, most recent first. The ledger's owner is passed as exactly one of account_id (a biz_ identifier) or user_id (a user_ identifier). The saved payout method on each payout additionally requires the payout:destination:read scope and is null without it.\",\n \"operationId\": \"list\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"account_id\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The owning account ID (a biz_ identifier). Provide this or user_id.\"\n },\n {\n \"name\": \"user_id\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The owning user ID (a user_ identifier). Provide this or account_id.\"\n },\n {\n \"name\": \"currency\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Optional currency code filter, for example usd.\"\n },\n {\n \"name\": \"first\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 20,\n \"maximum\": 100\n },\n \"description\": \"Number of payouts to return from the start of the window.\"\n },\n {\n \"name\": \"after\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Cursor to fetch the page after (from page_info.end_cursor).\"\n },\n {\n \"name\": \"last\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"integer\",\n \"maximum\": 100\n },\n \"description\": \"Number of payouts to return from the end of the window.\"\n },\n {\n \"name\": \"before\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Cursor to fetch the page before (from page_info.start_cursor).\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"payout method nulled without the destination-read scope\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"data\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"payout\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"status\": {\n \"type\": \"string\",\n \"enum\": [\n \"requested\",\n \"awaiting_payment\",\n \"in_transit\",\n \"completed\",\n \"failed\",\n \"canceled\",\n \"denied\"\n ]\n },\n \"amount\": {\n \"type\": \"number\",\n \"format\": \"float\",\n \"description\": \"The payout amount in whole currency units.\"\n },\n \"currency\": {\n \"type\": \"string\"\n },\n \"fee_amount\": {\n \"type\": \"number\",\n \"format\": \"float\",\n \"description\": \"The fee charged for the payout, in the payout currency.\"\n },\n \"speed\": {\n \"type\": \"string\",\n \"enum\": [\n \"standard\",\n \"instant\"\n ]\n },\n \"created_at\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"estimated_arrival\": {\n \"type\": \"string\",\n \"format\": \"date-time\",\n \"nullable\": true,\n \"description\": \"Estimated time the funds become available in the destination account.\"\n },\n \"payer_name\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Name of the entity processing the payout.\"\n },\n \"payout_token\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The saved payout method used. Requires payout:destination:read; null without it.\",\n \"properties\": {\n \"nickname\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"payout_destination\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"properties\": {\n \"payer_name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"icon_url\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"payer_name\",\n \"icon_url\"\n ]\n }\n },\n \"required\": [\n \"nickname\",\n \"payout_destination\"\n ]\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"status\",\n \"amount\",\n \"currency\",\n \"fee_amount\",\n \"speed\",\n \"created_at\",\n \"estimated_arrival\",\n \"payer_name\",\n \"payout_token\"\n ]\n }\n },\n \"page_info\": {\n \"type\": \"object\",\n \"properties\": {\n \"has_next_page\": {\n \"type\": \"boolean\"\n },\n \"end_cursor\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"has_previous_page\": {\n \"type\": \"boolean\"\n },\n \"start_cursor\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"has_next_page\",\n \"end_cursor\",\n \"has_previous_page\",\n \"start_cursor\"\n ]\n }\n },\n \"required\": [\n \"data\",\n \"page_info\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"neither account_id nor user_id provided\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"403\": {\n \"description\": \"credential lacks the withdrawal-read scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n },\n \"404\": {\n \"description\": \"no ledger for that owner is visible to the credential\",\n \"$ref\": \"#/components/responses/NotFound\"\n }\n }\n }\n },\n \"/plans/{id}/calculate_tax\": {\n \"post\": {\n \"summary\": \"Calculate Tax\",\n \"tags\": [\n \"Plans\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"plan:basic:read\"\n ]\n }\n ],\n \"description\": \"Calculates the tax owed on a plan based on the buyer's location.\",\n \"operationId\": \"calculate_tax\",\n \"parameters\": [\n {\n \"name\": \"id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The unique identifier of the plan, which will look like plan_*************.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"tax calculated\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"currency\": {\n \"type\": \"string\",\n \"description\": \"The three-letter ISO 4217 currency code of the amounts.\"\n },\n \"tax_behavior\": {\n \"type\": \"string\",\n \"enum\": [\n \"exclusive\",\n \"inclusive\"\n ],\n \"description\": \"Whether tax is added on top of the price (exclusive) or already included in it (inclusive).\"\n },\n \"subtotal\": {\n \"type\": \"integer\",\n \"description\": \"The plan price in the currency's smallest unit, for example cents. For exclusive tax this is the pre-tax amount; for inclusive tax it already contains the tax and equals the total.\"\n },\n \"tax_amount\": {\n \"type\": \"integer\",\n \"description\": \"The tax owed, in the currency's smallest unit. For exclusive tax it is added on top of the subtotal; for inclusive tax it is the portion already contained in the subtotal.\"\n },\n \"total\": {\n \"type\": \"integer\",\n \"description\": \"The total amount the buyer pays, in the currency's smallest unit.\"\n },\n \"status\": {\n \"type\": \"string\",\n \"enum\": [\n \"calculated\",\n \"not_calculated\"\n ],\n \"description\": \"Whether tax was successfully calculated. Returns not_calculated when tax could not be determined.\"\n }\n },\n \"required\": [\n \"currency\",\n \"tax_behavior\",\n \"subtotal\",\n \"tax_amount\",\n \"total\",\n \"status\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"request is invalid\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"403\": {\n \"description\": \"credential lacks the plan read scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n },\n \"404\": {\n \"description\": \"plan not found\",\n \"$ref\": \"#/components/responses/NotFound\"\n }\n },\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"address\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The buyer's billing address. Provide this or ip_address.\",\n \"properties\": {\n \"country\": {\n \"type\": \"string\",\n \"description\": \"The two-letter ISO 3166-1 country code, for example US, DE, or GB.\"\n },\n \"state\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The state, province, or region code, for example CA.\"\n },\n \"postal_code\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The postal or ZIP code.\"\n },\n \"city\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The city name.\"\n },\n \"line1\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The first line of the street address.\"\n },\n \"line2\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The second line of the street address.\"\n }\n },\n \"required\": [\n \"country\"\n ]\n },\n \"ip_address\": {\n \"type\": \"string\",\n \"description\": \"The buyer's IP address, used to resolve their location when no address is provided.\"\n },\n \"tax_ids\": {\n \"type\": \"array\",\n \"nullable\": true,\n \"maxItems\": 1,\n \"description\": \"The buyer's tax IDs, such as a VAT number, used to apply B2B reverse-charge exemptions.\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"description\": \"The tax ID type, for example eu_vat.\"\n },\n \"value\": {\n \"type\": \"string\",\n \"description\": \"The tax ID number, for example DE123456789.\"\n }\n }\n }\n }\n }\n }\n }\n },\n \"required\": true\n }\n }\n },\n \"/plans\": {\n \"get\": {\n \"summary\": \"List Plans\",\n \"tags\": [\n \"Plans\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"plan:basic:read\"\n ]\n }\n ],\n \"description\": \"Returns a paginated list of plans belonging to an account, with optional filtering by visibility, type, release method, and product.\",\n \"operationId\": \"list\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"account_id\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": true,\n \"description\": \"The unique identifier of the account to list plans for.\"\n },\n {\n \"name\": \"direction\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\",\n \"enum\": [\n \"asc\",\n \"desc\"\n ]\n },\n \"required\": false,\n \"description\": \"The sort direction for results. Defaults to descending.\"\n },\n {\n \"name\": \"order\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\",\n \"enum\": [\n \"id\",\n \"active_members_count\",\n \"created_at\",\n \"internal_notes\",\n \"expires_at\"\n ]\n },\n \"required\": false,\n \"description\": \"The field to sort results by. Defaults to created_at.\"\n },\n {\n \"name\": \"release_methods\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"required\": false,\n \"description\": \"Filter to only plans matching these release methods.\"\n },\n {\n \"name\": \"visibilities\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"required\": false,\n \"description\": \"Filter to only plans matching these visibility states.\"\n },\n {\n \"name\": \"plan_types\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"required\": false,\n \"description\": \"Filter to only plans matching these billing types.\"\n },\n {\n \"name\": \"product_ids\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"required\": false,\n \"description\": \"Filter to only plans belonging to these product identifiers.\"\n },\n {\n \"name\": \"created_before\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": false,\n \"description\": \"Only return plans created before this timestamp.\"\n },\n {\n \"name\": \"created_after\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": false,\n \"description\": \"Only return plans created after this timestamp.\"\n },\n {\n \"name\": \"first\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"integer\"\n },\n \"required\": false,\n \"description\": \"The number of plans to return (default and max 100).\"\n },\n {\n \"name\": \"after\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": false,\n \"description\": \"A cursor; returns plans after this position.\"\n },\n {\n \"name\": \"last\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"integer\"\n },\n \"required\": false,\n \"description\": \"The number of plans to return from the end of the range.\"\n },\n {\n \"name\": \"before\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": false,\n \"description\": \"A cursor; returns plans before this position.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"plans listed\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"data\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/PlanListItem\"\n }\n },\n \"page_info\": {\n \"type\": \"object\",\n \"properties\": {\n \"end_cursor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"start_cursor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"has_next_page\": {\n \"type\": \"boolean\"\n },\n \"has_previous_page\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"end_cursor\",\n \"start_cursor\",\n \"has_next_page\",\n \"has_previous_page\"\n ]\n }\n },\n \"required\": [\n \"data\",\n \"page_info\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"missing account_id\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n }\n }\n },\n \"post\": {\n \"summary\": \"Create Plan\",\n \"tags\": [\n \"Plans\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"plan:create\"\n ]\n }\n ],\n \"description\": \"Create a new pricing plan for a product. The plan defines the billing interval, price, and availability for customers.\",\n \"operationId\": \"create\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"plan created\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Plan\"\n }\n }\n }\n },\n \"400\": {\n \"description\": \"invalid parameters\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n }\n },\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"account_id\": {\n \"type\": \"string\",\n \"description\": \"The unique identifier of the account to create this plan for. Defaults to the caller's account.\"\n },\n \"product_id\": {\n \"type\": \"string\",\n \"description\": \"The unique identifier of the product to attach this plan to.\"\n },\n \"plan_type\": {\n \"type\": \"string\",\n \"description\": \"The billing type of the plan, such as one_time or renewal.\"\n },\n \"release_method\": {\n \"type\": \"string\",\n \"description\": \"The method used to sell this plan (e.g., buy_now, waitlist).\"\n },\n \"split_pay_required_payments\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"description\": \"The number of installment payments required before the subscription pauses.\"\n },\n \"adaptive_pricing_enabled\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ],\n \"description\": \"Whether this plan accepts local currency payments via adaptive pricing.\"\n },\n \"billing_period\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"description\": \"The number of days between recurring charges. For example, 30 for monthly or 365 for yearly.\"\n },\n \"checkout_styling\": {\n \"type\": [\n \"object\",\n \"null\"\n ],\n \"description\": \"Checkout styling overrides for this plan.\"\n },\n \"currency\": {\n \"type\": \"string\",\n \"description\": \"The three-letter ISO currency code for the plan's pricing. Defaults to USD.\"\n },\n \"custom_fields\": {\n \"type\": [\n \"array\",\n \"null\"\n ],\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"The ID of the custom field (if being updated).\"\n },\n \"field_type\": {\n \"type\": \"string\",\n \"enum\": [\n \"text\"\n ],\n \"description\": \"The type of the custom field.\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The name of the custom field.\"\n },\n \"order\": {\n \"type\": \"integer\",\n \"description\": \"The order of the field.\"\n },\n \"placeholder\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"An example response displayed in the input field.\"\n },\n \"required\": {\n \"type\": \"boolean\",\n \"description\": \"Whether or not the field is required.\"\n }\n }\n },\n \"description\": \"An array of custom field definitions to collect from customers at checkout. Omitting this field clears existing custom fields.\"\n },\n \"description\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"A text description of the plan displayed to customers on the product page.\"\n },\n \"expiration_days\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"description\": \"The number of days until the membership expires and access is revoked.\"\n },\n \"image\": {\n \"type\": [\n \"object\",\n \"null\"\n ],\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"direct_upload_id\": {\n \"type\": \"string\"\n }\n },\n \"description\": \"An image displayed on the product page to represent this plan.\"\n },\n \"initial_price\": {\n \"type\": [\n \"number\",\n \"null\"\n ],\n \"description\": \"The amount charged on the first purchase, in the plan's currency (e.g., 10.43 for $10.43).\"\n },\n \"internal_notes\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"Private notes visible only to the business owner. Not shown to customers.\"\n },\n \"legacy_payment_method_controls\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ],\n \"description\": \"Whether this plan uses legacy payment method controls.\"\n },\n \"metadata\": {\n \"type\": [\n \"object\",\n \"null\"\n ],\n \"description\": \"Custom key-value pairs to store on the plan. Included in webhook payloads for payment and membership events.\"\n },\n \"override_tax_type\": {\n \"type\": \"string\",\n \"description\": \"Override the default tax classification for this specific plan.\"\n },\n \"payment_method_configuration\": {\n \"type\": [\n \"object\",\n \"null\"\n ],\n \"description\": \"Explicit payment method configuration for the plan. When not provided, the account's defaults apply.\",\n \"properties\": {\n \"enabled\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"disabled\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"include_platform_defaults\": {\n \"type\": \"boolean\"\n }\n }\n },\n \"renewal_price\": {\n \"type\": [\n \"number\",\n \"null\"\n ],\n \"description\": \"The amount charged each billing period for recurring plans, in the plan's currency.\"\n },\n \"stock\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"description\": \"The maximum number of units available for purchase. Ignored when unlimited_stock is true.\"\n },\n \"three_ds_level\": {\n \"type\": \"string\",\n \"enum\": [\n \"mandate_challenge\",\n \"frictionless\"\n ],\n \"description\": \"The 3D Secure behavior for this plan. Send null to inherit the account default.\"\n },\n \"title\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"The display name of the plan shown to customers on the product page.\"\n },\n \"trial_period_days\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"description\": \"The number of free trial days before the first charge on a recurring plan.\"\n },\n \"unlimited_stock\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ],\n \"description\": \"Whether the plan has unlimited stock. When true, the stock field is ignored.\"\n },\n \"visibility\": {\n \"type\": \"string\",\n \"description\": \"Whether the plan is visible to customers or hidden from public view.\"\n }\n }\n }\n }\n },\n \"required\": true\n }\n }\n },\n \"/plans/{id}\": {\n \"get\": {\n \"summary\": \"Retrieve Plan\",\n \"tags\": [\n \"Plans\"\n ],\n \"security\": [\n {\n \"bearerAuth\": []\n }\n ],\n \"description\": \"Retrieves the details of an existing plan.\",\n \"operationId\": \"get\",\n \"responses\": {\n \"200\": {\n \"description\": \"plan retrieved\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Plan\"\n }\n }\n }\n },\n \"404\": {\n \"description\": \"no plan with that id\",\n \"$ref\": \"#/components/responses/NotFound\"\n }\n },\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The unique identifier of the plan, which will look like plan_*************.\"\n }\n ]\n },\n \"patch\": {\n \"summary\": \"Update Plan\",\n \"tags\": [\n \"Plans\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"plan:update\"\n ]\n }\n ],\n \"description\": \"Update a plan's pricing, billing interval, visibility, stock, and other settings.\",\n \"operationId\": \"update\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The unique identifier of the plan, which will look like plan_*************.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"plan updated\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Plan\"\n }\n }\n }\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n }\n },\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"offer_cancel_discount\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ],\n \"description\": \"Whether to offer a retention discount when a customer attempts to cancel.\"\n },\n \"strike_through_initial_price\": {\n \"type\": [\n \"number\",\n \"null\"\n ],\n \"description\": \"A comparison price displayed with a strikethrough for the initial price.\"\n },\n \"strike_through_renewal_price\": {\n \"type\": [\n \"number\",\n \"null\"\n ],\n \"description\": \"A comparison price displayed with a strikethrough for the renewal price.\"\n },\n \"adaptive_pricing_enabled\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ],\n \"description\": \"Whether this plan accepts local currency payments via adaptive pricing.\"\n },\n \"billing_period\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"description\": \"The number of days between recurring charges. For example, 30 for monthly or 365 for yearly.\"\n },\n \"checkout_styling\": {\n \"type\": [\n \"object\",\n \"null\"\n ],\n \"description\": \"Checkout styling overrides for this plan.\"\n },\n \"currency\": {\n \"type\": \"string\",\n \"description\": \"The three-letter ISO currency code for the plan's pricing. Defaults to USD.\"\n },\n \"custom_fields\": {\n \"type\": [\n \"array\",\n \"null\"\n ],\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"The ID of the custom field (if being updated).\"\n },\n \"field_type\": {\n \"type\": \"string\",\n \"enum\": [\n \"text\"\n ],\n \"description\": \"The type of the custom field.\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The name of the custom field.\"\n },\n \"order\": {\n \"type\": \"integer\",\n \"description\": \"The order of the field.\"\n },\n \"placeholder\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"An example response displayed in the input field.\"\n },\n \"required\": {\n \"type\": \"boolean\",\n \"description\": \"Whether or not the field is required.\"\n }\n }\n },\n \"description\": \"An array of custom field definitions to collect from customers at checkout. Omitting this field clears existing custom fields.\"\n },\n \"description\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"A text description of the plan displayed to customers on the product page.\"\n },\n \"expiration_days\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"description\": \"The number of days until the membership expires and access is revoked.\"\n },\n \"image\": {\n \"type\": [\n \"object\",\n \"null\"\n ],\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"direct_upload_id\": {\n \"type\": \"string\"\n }\n },\n \"description\": \"An image displayed on the product page to represent this plan.\"\n },\n \"initial_price\": {\n \"type\": [\n \"number\",\n \"null\"\n ],\n \"description\": \"The amount charged on the first purchase, in the plan's currency (e.g., 10.43 for $10.43).\"\n },\n \"internal_notes\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"Private notes visible only to the business owner. Not shown to customers.\"\n },\n \"legacy_payment_method_controls\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ],\n \"description\": \"Whether this plan uses legacy payment method controls.\"\n },\n \"metadata\": {\n \"type\": [\n \"object\",\n \"null\"\n ],\n \"description\": \"Custom key-value pairs to store on the plan. Included in webhook payloads for payment and membership events.\"\n },\n \"override_tax_type\": {\n \"type\": \"string\",\n \"description\": \"Override the default tax classification for this specific plan.\"\n },\n \"payment_method_configuration\": {\n \"type\": [\n \"object\",\n \"null\"\n ],\n \"description\": \"Explicit payment method configuration for the plan. When not provided, the account's defaults apply.\",\n \"properties\": {\n \"enabled\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"disabled\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"include_platform_defaults\": {\n \"type\": \"boolean\"\n }\n }\n },\n \"renewal_price\": {\n \"type\": [\n \"number\",\n \"null\"\n ],\n \"description\": \"The amount charged each billing period for recurring plans, in the plan's currency.\"\n },\n \"stock\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"description\": \"The maximum number of units available for purchase. Ignored when unlimited_stock is true.\"\n },\n \"three_ds_level\": {\n \"type\": \"string\",\n \"enum\": [\n \"mandate_challenge\",\n \"frictionless\"\n ],\n \"description\": \"The 3D Secure behavior for this plan. Send null to inherit the account default.\"\n },\n \"title\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"The display name of the plan shown to customers on the product page.\"\n },\n \"trial_period_days\": {\n \"type\": [\n \"integer\",\n \"null\"\n ],\n \"description\": \"The number of free trial days before the first charge on a recurring plan.\"\n },\n \"unlimited_stock\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ],\n \"description\": \"Whether the plan has unlimited stock. When true, the stock field is ignored.\"\n },\n \"visibility\": {\n \"type\": \"string\",\n \"description\": \"Whether the plan is visible to customers or hidden from public view.\"\n }\n }\n }\n }\n },\n \"required\": true\n }\n },\n \"delete\": {\n \"summary\": \"Delete Plan\",\n \"tags\": [\n \"Plans\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"plan:delete\"\n ]\n }\n ],\n \"description\": \"Permanently delete a plan from a product. Existing memberships on this plan will not be affected.\",\n \"operationId\": \"delete\",\n \"responses\": {\n \"200\": {\n \"description\": \"plan deleted\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"boolean\",\n \"description\": \"Always true on success.\"\n }\n }\n }\n },\n \"404\": {\n \"description\": \"no plan with that id\",\n \"$ref\": \"#/components/responses/NotFound\"\n }\n },\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The unique identifier of the plan, which will look like plan_*************.\"\n }\n ]\n }\n },\n \"/products\": {\n \"get\": {\n \"summary\": \"List Products\",\n \"tags\": [\n \"Products\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"product:basic:read\"\n ]\n }\n ],\n \"description\": \"Returns a paginated list of products belonging to a company.\",\n \"operationId\": \"list\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"company_id\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": true,\n \"description\": \"The unique identifier of the company to list products for.\"\n },\n {\n \"name\": \"visibilities\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"required\": false,\n \"description\": \"Filter to only products matching these visibility states.\"\n },\n {\n \"name\": \"access_pass_types\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"required\": false,\n \"description\": \"Filter to only products matching these types.\"\n },\n {\n \"name\": \"direction\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\",\n \"enum\": [\n \"asc\",\n \"desc\"\n ]\n },\n \"required\": false,\n \"description\": \"The sort direction for results. Defaults to descending.\"\n },\n {\n \"name\": \"order\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": false,\n \"description\": \"The field to sort results by. Defaults to created_at.\"\n },\n {\n \"name\": \"first\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"integer\"\n },\n \"required\": false,\n \"description\": \"The number of products to return (default and max 100).\"\n },\n {\n \"name\": \"after\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": false,\n \"description\": \"A cursor; returns products after this position.\"\n },\n {\n \"name\": \"last\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"integer\"\n },\n \"required\": false,\n \"description\": \"The number of products to return from the end of the range.\"\n },\n {\n \"name\": \"before\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": false,\n \"description\": \"A cursor; returns products before this position.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"products listed\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"data\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/ProductListItem\"\n }\n },\n \"page_info\": {\n \"type\": \"object\",\n \"properties\": {\n \"end_cursor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"start_cursor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"has_next_page\": {\n \"type\": \"boolean\"\n },\n \"has_previous_page\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"end_cursor\",\n \"start_cursor\",\n \"has_next_page\",\n \"has_previous_page\"\n ]\n }\n },\n \"required\": [\n \"data\",\n \"page_info\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"missing company_id\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n }\n }\n },\n \"post\": {\n \"summary\": \"Create Product\",\n \"tags\": [\n \"Products\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"product:create\"\n ]\n }\n ],\n \"description\": \"Creates a new product for a company.\",\n \"operationId\": \"create\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"product created\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Product\"\n }\n }\n }\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n }\n },\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"company_id\": {\n \"type\": \"string\",\n \"description\": \"The unique identifier of the company to create this product for.\"\n },\n \"title\": {\n \"type\": \"string\",\n \"description\": \"The display name of the product. Maximum 80 characters.\"\n },\n \"visibility\": {\n \"type\": \"string\",\n \"description\": \"Whether the product is visible to customers.\"\n },\n \"headline\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"A short marketing headline for the product page.\"\n },\n \"description\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"A written description displayed on the product page.\"\n },\n \"metadata\": {\n \"type\": [\n \"object\",\n \"null\"\n ],\n \"description\": \"Custom key-value pairs to store on the product.\"\n },\n \"route\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"The URL slug for the product's public link.\"\n },\n \"global_affiliate_percentage\": {\n \"type\": [\n \"number\",\n \"null\"\n ],\n \"description\": \"The commission rate affiliates earn.\"\n },\n \"global_affiliate_status\": {\n \"type\": \"string\",\n \"description\": \"The enrollment status in the global affiliate program.\"\n },\n \"member_affiliate_percentage\": {\n \"type\": [\n \"number\",\n \"null\"\n ],\n \"description\": \"The commission rate members earn.\"\n },\n \"member_affiliate_status\": {\n \"type\": \"string\",\n \"description\": \"The enrollment status in the member affiliate program.\"\n },\n \"custom_cta\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"The call-to-action button label.\"\n },\n \"custom_cta_url\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"A URL the call-to-action button links to.\"\n },\n \"custom_statement_descriptor\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"Custom bank statement descriptor. Must start with WHOP*.\"\n },\n \"product_tax_code_id\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"The unique identifier of the tax classification code.\"\n },\n \"redirect_purchase_url\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"A URL to redirect the customer to after purchase.\"\n },\n \"collect_shipping_address\": {\n \"type\": [\n \"boolean\",\n \"null\"\n ],\n \"description\": \"Whether to collect a shipping address at checkout.\"\n }\n },\n \"required\": [\n \"title\"\n ]\n }\n }\n },\n \"required\": true\n }\n }\n },\n \"/products/{id}\": {\n \"get\": {\n \"summary\": \"Retrieve Product\",\n \"tags\": [\n \"Products\"\n ],\n \"security\": [\n {\n \"bearerAuth\": []\n }\n ],\n \"description\": \"Retrieves the details of an existing product. This endpoint is publicly accessible.\",\n \"operationId\": \"get\",\n \"responses\": {\n \"200\": {\n \"description\": \"product retrieved without authentication\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Product\"\n }\n }\n }\n },\n \"404\": {\n \"description\": \"product not found\",\n \"$ref\": \"#/components/responses/NotFound\"\n }\n },\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The unique identifier of the product.\"\n }\n ]\n },\n \"patch\": {\n \"summary\": \"Update Product\",\n \"tags\": [\n \"Products\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"product:update\"\n ]\n }\n ],\n \"description\": \"Updates an existing product.\",\n \"operationId\": \"update\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The unique identifier of the product.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"product updated\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/Product\"\n }\n }\n }\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"404\": {\n \"description\": \"product not found\",\n \"$ref\": \"#/components/responses/NotFound\"\n }\n },\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"title\": {\n \"type\": \"string\",\n \"description\": \"The display name of the product.\"\n },\n \"visibility\": {\n \"type\": \"string\",\n \"description\": \"Whether the product is visible to customers.\"\n },\n \"headline\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"A short marketing headline for the product page.\"\n },\n \"description\": {\n \"type\": [\n \"string\",\n \"null\"\n ],\n \"description\": \"A written description displayed on the product page.\"\n },\n \"metadata\": {\n \"type\": [\n \"object\",\n \"null\"\n ],\n \"description\": \"Custom key-value pairs to store on the product.\"\n }\n }\n }\n }\n },\n \"required\": true\n }\n },\n \"delete\": {\n \"summary\": \"Delete Product\",\n \"tags\": [\n \"Products\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"product:delete\"\n ]\n }\n ],\n \"description\": \"Deletes a product. Only products with no memberships, entries, reviews, or invoices can be deleted.\",\n \"operationId\": \"delete\",\n \"responses\": {\n \"200\": {\n \"description\": \"product deleted\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"boolean\"\n }\n }\n }\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"404\": {\n \"description\": \"product not found\",\n \"$ref\": \"#/components/responses/NotFound\"\n }\n },\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The unique identifier of the product.\"\n }\n ]\n }\n },\n \"/stats/schema\": {\n \"get\": {\n \"summary\": \"Retrieve Stats Schema\",\n \"tags\": [\n \"Stats\"\n ],\n \"description\": \"Returns the full taxonomy of reporting categories, groupings, and line categories with descriptions. Use this to discover valid filter values for the time-series endpoint. No authentication required.\",\n \"operationId\": \"schema\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"resource_type\",\n \"in\": \"query\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\",\n \"enum\": [\n \"wallet\"\n ]\n },\n \"description\": \"The stats resource to describe. Currently only `wallet` is supported.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"stats schema retrieved\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"reporting_categories\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"line_categories\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\n \"name\",\n \"line_categories\"\n ]\n }\n },\n \"groupings\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"line_categories\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\n \"name\",\n \"line_categories\"\n ]\n }\n },\n \"line_categories\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"key\": {\n \"type\": \"string\"\n },\n \"description\": {\n \"type\": \"string\"\n },\n \"grouping\": {\n \"type\": \"string\"\n },\n \"reporting_categories\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\n \"key\",\n \"description\",\n \"grouping\",\n \"reporting_categories\"\n ]\n }\n }\n },\n \"required\": [\n \"reporting_categories\",\n \"groupings\",\n \"line_categories\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"resource_type is missing or invalid\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n }\n }\n }\n },\n \"/stats/time_series\": {\n \"get\": {\n \"summary\": \"List Time Series\",\n \"tags\": [\n \"Stats\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"company:balance:read\"\n ]\n }\n ],\n \"description\": \"Returns an aggregated financial time series from the ledger: total amount and line count per period, optionally filtered by reporting category, grouping, or line category. The wallet is resolved from the caller's auth context, or from `account_id` when given. External API keys are scoped to the `net_activity` reporting category.\",\n \"operationId\": \"time_series\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"resource_type\",\n \"in\": \"query\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\",\n \"enum\": [\n \"wallet\"\n ]\n },\n \"description\": \"The stats resource to query. Currently only `wallet` is supported.\"\n },\n {\n \"name\": \"from\",\n \"in\": \"query\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"description\": \"Start of the date range (ISO 8601, e.g. 2025-01-01).\"\n },\n {\n \"name\": \"to\",\n \"in\": \"query\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\",\n \"format\": \"date\"\n },\n \"description\": \"End of the date range (ISO 8601, e.g. 2025-12-31).\"\n },\n {\n \"name\": \"group_by\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\",\n \"enum\": [\n \"day\",\n \"week\",\n \"month\"\n ]\n },\n \"description\": \"Period size for each data point. Defaults to `month`.\"\n },\n {\n \"name\": \"account_id\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The business or user account ID whose wallet should be queried. Defaults to the authenticated account.\"\n },\n {\n \"name\": \"reporting_category\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Restricts the series to one reporting category. See the stats schema endpoint for valid values.\"\n },\n {\n \"name\": \"grouping\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"description\": \"Filters to one or more groupings. See the stats schema endpoint for valid values.\"\n },\n {\n \"name\": \"line_category\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"description\": \"Filters to one or more line categories. See the stats schema endpoint for valid values.\"\n },\n {\n \"name\": \"currency\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Filters to ledger lines denominated in this currency.\"\n },\n {\n \"name\": \"convert_currency\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Converts amounts into this currency.\"\n },\n {\n \"name\": \"timezone\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"IANA timezone used for period boundaries (e.g. America/New_York). Defaults to UTC.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"time series listed\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"data\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"period\": {\n \"type\": \"string\",\n \"description\": \"Start of the period (e.g. 2025-01-01 00:00:00).\"\n },\n \"currency\": {\n \"type\": \"string\",\n \"description\": \"Rows are split per currency.\"\n },\n \"amount\": {\n \"type\": \"string\",\n \"description\": \"Decimal amount serialized as a string.\"\n },\n \"line_count\": {\n \"type\": \"integer\"\n }\n },\n \"required\": [\n \"period\",\n \"currency\",\n \"amount\",\n \"line_count\"\n ]\n }\n },\n \"metadata\": {\n \"type\": \"object\",\n \"properties\": {\n \"from\": {\n \"type\": \"string\"\n },\n \"to\": {\n \"type\": \"string\"\n },\n \"group_by\": {\n \"type\": \"string\",\n \"enum\": [\n \"day\",\n \"week\",\n \"month\"\n ]\n },\n \"currency\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"convert_currency\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"timezone\": {\n \"type\": \"string\"\n },\n \"wallet_id\": {\n \"type\": \"string\"\n },\n \"account_id\": {\n \"type\": \"string\"\n },\n \"reporting_category\": {\n \"type\": \"string\"\n },\n \"base_reporting_scope\": {\n \"type\": \"string\"\n },\n \"grouping\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"line_category\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n }\n },\n \"required\": [\n \"from\",\n \"to\",\n \"group_by\",\n \"timezone\"\n ]\n }\n },\n \"required\": [\n \"data\",\n \"metadata\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"date range is missing or invalid\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"403\": {\n \"description\": \"credential lacks the required balance-read scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n }\n }\n }\n },\n \"/swaps/quote\": {\n \"post\": {\n \"summary\": \"Create Swap Quote\",\n \"tags\": [\n \"Swaps\"\n ],\n \"security\": [],\n \"description\": \"Returns a stateless swap price preview. No funds move and nothing is persisted.\",\n \"operationId\": \"quote\",\n \"parameters\": [],\n \"responses\": {\n \"200\": {\n \"description\": \"swap quote created\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"swap_quote\"\n ]\n },\n \"amount_in\": {\n \"type\": \"string\"\n },\n \"amount_out\": {\n \"type\": \"string\"\n },\n \"amount_out_min\": {\n \"type\": \"string\"\n },\n \"rate\": {\n \"type\": \"string\"\n },\n \"fee_bps\": {\n \"type\": \"integer\"\n },\n \"bridge_fee\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"estimated_duration_seconds\": {\n \"type\": \"integer\",\n \"nullable\": true\n },\n \"requires_token_approval\": {\n \"type\": \"boolean\",\n \"nullable\": true\n },\n \"from_address\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"to_address\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"from_token\": {\n \"type\": \"object\",\n \"additionalProperties\": true\n },\n \"to_token\": {\n \"type\": \"object\",\n \"additionalProperties\": true\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": true\n }\n },\n \"required\": [\n \"object\",\n \"amount_in\",\n \"amount_out\",\n \"rate\",\n \"fee_bps\",\n \"from_token\",\n \"to_token\",\n \"metadata\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"request is invalid\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n }\n },\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"amount\": {\n \"type\": \"string\",\n \"description\": \"Input token amount.\"\n },\n \"from_token\": {\n \"type\": \"string\",\n \"description\": \"Source token, by contract address or ticker symbol (e.g. \\\"USDT\\\").\"\n },\n \"to_token\": {\n \"type\": \"string\",\n \"description\": \"Destination token, by contract address or ticker symbol (e.g. \\\"XAUT\\\").\"\n },\n \"from_chain\": {\n \"oneOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"type\": \"integer\"\n }\n ],\n \"nullable\": true\n },\n \"to_chain\": {\n \"oneOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"type\": \"integer\"\n }\n ],\n \"nullable\": true\n },\n \"from_address\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"to_address\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"slippage_bps\": {\n \"type\": \"integer\",\n \"nullable\": true\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": true\n }\n },\n \"required\": [\n \"amount\",\n \"from_token\",\n \"to_token\"\n ]\n }\n }\n },\n \"required\": true\n }\n }\n },\n \"/swaps\": {\n \"post\": {\n \"summary\": \"Create Swap\",\n \"tags\": [\n \"Swaps\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"crypto_wallet:swap\"\n ]\n }\n ],\n \"description\": \"Executes a swap from the account's wallet. Runs asynchronously — poll GET /swaps/{id} for status.\",\n \"operationId\": \"create\",\n \"parameters\": [],\n \"responses\": {\n \"201\": {\n \"description\": \"swap created\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"swap\"\n ]\n },\n \"id\": {\n \"type\": \"string\",\n \"description\": \"Swap ID — poll GET /swaps/{id} for status.\"\n },\n \"account_id\": {\n \"type\": \"string\"\n },\n \"status\": {\n \"type\": \"string\"\n },\n \"to_chain\": {\n \"type\": \"string\"\n },\n \"amount_out_expected\": {\n \"type\": \"string\"\n },\n \"amount_out_min\": {\n \"type\": \"string\"\n },\n \"rate\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"account_id\",\n \"status\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"request is invalid\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"403\": {\n \"description\": \"credential lacks the crypto-wallet scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n }\n },\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"account_id\": {\n \"type\": \"string\",\n \"description\": \"Business or user account ID (biz_* / user_*).\"\n },\n \"amount\": {\n \"type\": \"string\",\n \"description\": \"Input token amount.\"\n },\n \"from_token\": {\n \"type\": \"string\",\n \"description\": \"Source token, by contract address or ticker symbol (e.g. \\\"USDT\\\").\"\n },\n \"to_token\": {\n \"type\": \"string\",\n \"description\": \"Destination token, by contract address or ticker symbol (e.g. \\\"XAUT\\\").\"\n },\n \"from_chain\": {\n \"oneOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"type\": \"integer\"\n }\n ],\n \"nullable\": true\n },\n \"to_chain\": {\n \"oneOf\": [\n {\n \"type\": \"string\"\n },\n {\n \"type\": \"integer\"\n }\n ],\n \"nullable\": true\n },\n \"slippage_bps\": {\n \"type\": \"integer\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"account_id\",\n \"amount\",\n \"from_token\",\n \"to_token\"\n ]\n }\n }\n },\n \"required\": true\n }\n },\n \"get\": {\n \"summary\": \"List Swaps\",\n \"tags\": [\n \"Swaps\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"crypto_wallet:swap\"\n ]\n }\n ],\n \"description\": \"Lists the account's swaps — currently its in-flight or most recent swap, so zero or one rows.\",\n \"operationId\": \"status\",\n \"parameters\": [\n {\n \"name\": \"account_id\",\n \"in\": \"query\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Business or user account ID (biz_* / user_*).\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"swaps listed\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"data\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"swap\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"account_id\": {\n \"type\": \"string\"\n },\n \"status\": {\n \"type\": \"string\"\n },\n \"tx_hashes\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"error\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"account_id\",\n \"status\",\n \"tx_hashes\"\n ]\n }\n }\n },\n \"required\": [\n \"data\"\n ]\n }\n }\n }\n },\n \"403\": {\n \"description\": \"credential lacks the crypto-wallet scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n }\n }\n }\n },\n \"/swaps/{id}\": {\n \"get\": {\n \"summary\": \"Retrieve Swap\",\n \"tags\": [\n \"Swaps\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"crypto_wallet:swap\"\n ]\n }\n ],\n \"description\": \"Returns the status of a specific swap, by the id returned from POST /swaps.\",\n \"operationId\": \"get\",\n \"parameters\": [\n {\n \"name\": \"id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Swap ID returned from POST /swaps.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"swap status retrieved\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"swap\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"account_id\": {\n \"type\": \"string\"\n },\n \"status\": {\n \"type\": \"string\"\n },\n \"tx_hashes\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\"\n }\n },\n \"error\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"account_id\",\n \"status\",\n \"tx_hashes\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"swap id is invalid\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"403\": {\n \"description\": \"credential lacks the crypto-wallet scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n },\n \"404\": {\n \"description\": \"swap does not exist\",\n \"$ref\": \"#/components/responses/NotFound\"\n }\n }\n }\n },\n \"/transfers\": {\n \"post\": {\n \"summary\": \"Create Transfer\",\n \"tags\": [\n \"Transfers\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"payout:transfer_funds\"\n ]\n },\n {\n \"bearerAuth\": [\n \"payout:withdraw_funds\"\n ]\n },\n {\n \"bearerAuth\": [\n \"airdrop_link:manage\"\n ]\n }\n ],\n \"description\": \"Moves funds out of an account. `type` selects the kind of movement (default `ledger`): `ledger` transfers credit between two ledger accounts and returns a Transfer; `wallet_send` sends USDT from the origin account's Ethereum wallet to a recipient; `claim_link` funds a shareable claim link anyone with the URL can redeem.\",\n \"operationId\": \"create\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n }\n ],\n \"responses\": {\n \"201\": {\n \"description\": \"money movement created\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"oneOf\": [\n {\n \"type\": \"object\",\n \"title\": \"Transfer\",\n \"description\": \"A transfer of credit between two ledger accounts.\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"amount\": {\n \"type\": \"number\"\n },\n \"currency\": {\n \"type\": \"string\"\n },\n \"created_at\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"fee_amount\": {\n \"type\": \"number\",\n \"nullable\": true\n },\n \"notes\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"nullable\": true\n },\n \"origin_ledger_account_id\": {\n \"type\": \"string\"\n },\n \"destination_ledger_account_id\": {\n \"type\": \"string\"\n },\n \"origin\": {\n \"oneOf\": [\n {\n \"type\": \"object\",\n \"title\": \"Company\",\n \"properties\": {\n \"typename\": {\n \"type\": \"string\",\n \"enum\": [\n \"Company\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"route\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"title\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"typename\",\n \"id\"\n ]\n },\n {\n \"type\": \"object\",\n \"title\": \"User\",\n \"properties\": {\n \"typename\": {\n \"type\": \"string\",\n \"enum\": [\n \"User\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"username\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"typename\",\n \"id\"\n ]\n }\n ],\n \"discriminator\": {\n \"propertyName\": \"typename\"\n }\n },\n \"destination\": {\n \"oneOf\": [\n {\n \"type\": \"object\",\n \"title\": \"Company\",\n \"properties\": {\n \"typename\": {\n \"type\": \"string\",\n \"enum\": [\n \"Company\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"route\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"title\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"typename\",\n \"id\"\n ]\n },\n {\n \"type\": \"object\",\n \"title\": \"User\",\n \"properties\": {\n \"typename\": {\n \"type\": \"string\",\n \"enum\": [\n \"User\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"username\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"typename\",\n \"id\"\n ]\n }\n ],\n \"discriminator\": {\n \"propertyName\": \"typename\"\n }\n }\n },\n \"required\": [\n \"id\",\n \"amount\",\n \"currency\",\n \"created_at\",\n \"origin_ledger_account_id\",\n \"destination_ledger_account_id\",\n \"origin\",\n \"destination\"\n ]\n },\n {\n \"type\": \"object\",\n \"title\": \"Send\",\n \"description\": \"Returned for a wallet_send: an onchain USDT send to a recipient.\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"send\"\n ]\n },\n \"tx_hash\": {\n \"type\": \"string\"\n },\n \"amount\": {\n \"type\": \"string\"\n },\n \"currency\": {\n \"type\": \"string\"\n },\n \"source\": {\n \"type\": \"object\",\n \"properties\": {\n \"account_id\": {\n \"type\": \"string\"\n },\n \"address\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"account_id\",\n \"address\"\n ]\n },\n \"destination\": {\n \"type\": \"object\",\n \"properties\": {\n \"account_id\": {\n \"type\": \"string\"\n },\n \"address\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"account_id\",\n \"address\"\n ]\n }\n },\n \"required\": [\n \"object\",\n \"tx_hash\",\n \"amount\",\n \"currency\",\n \"source\",\n \"destination\"\n ]\n },\n {\n \"type\": \"object\",\n \"title\": \"ClaimLink\",\n \"description\": \"Returned for a claim_link: a shareable URL anyone can open to claim the funds.\",\n \"properties\": {\n \"object\": {\n \"type\": \"string\",\n \"enum\": [\n \"claim_link\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"claim_url\": {\n \"type\": \"string\"\n },\n \"status\": {\n \"type\": \"string\"\n },\n \"amount\": {\n \"type\": \"string\"\n },\n \"currency\": {\n \"type\": \"string\"\n },\n \"redeemable_count\": {\n \"type\": \"integer\"\n },\n \"expires_at\": {\n \"type\": \"string\",\n \"format\": \"date-time\",\n \"nullable\": true\n },\n \"source\": {\n \"type\": \"object\",\n \"properties\": {\n \"account_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"account_id\"\n ]\n }\n },\n \"required\": [\n \"object\",\n \"id\",\n \"claim_url\",\n \"status\",\n \"amount\",\n \"currency\",\n \"redeemable_count\",\n \"expires_at\",\n \"source\"\n ]\n }\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"request is invalid\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"403\": {\n \"description\": \"credential lacks the required scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n }\n },\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"enum\": [\n \"ledger\",\n \"wallet_send\",\n \"claim_link\"\n ],\n \"description\": \"The kind of money movement. Defaults to ledger.\"\n },\n \"origin_id\": {\n \"type\": \"string\",\n \"description\": \"The account sending the funds. A user ID (user_xxx), company ID (biz_xxx), or ledger account ID (ldgr_xxx).\"\n },\n \"destination_id\": {\n \"type\": \"string\",\n \"description\": \"The recipient. Required for ledger and wallet_send (a user_/biz_/ldgr_ ID, or — for sends — an email). Omit for claim_link.\"\n },\n \"amount\": {\n \"type\": \"number\",\n \"description\": \"The amount to move, in the transfer currency. For example 25.00.\"\n },\n \"currency\": {\n \"type\": \"string\",\n \"description\": \"The currency, such as usd. Required for ledger transfers.\",\n \"example\": \"usd\"\n },\n \"idempotence_key\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Ledger transfers only. A unique key to prevent duplicate transfers.\"\n },\n \"notes\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Ledger transfers only. A short note describing the transfer.\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"nullable\": true,\n \"description\": \"Ledger transfers only. Custom key-value pairs attached to the transfer.\"\n },\n \"expires_at\": {\n \"type\": \"string\",\n \"format\": \"date-time\",\n \"nullable\": true,\n \"description\": \"claim_link only. Link expiry as an ISO 8601 timestamp. Defaults to 24 hours from creation.\"\n },\n \"redeemable_count\": {\n \"type\": \"integer\",\n \"description\": \"claim_link only. How many different users can claim the link. Defaults to 1.\"\n }\n },\n \"required\": [\n \"origin_id\",\n \"amount\"\n ]\n }\n }\n },\n \"required\": true\n }\n },\n \"get\": {\n \"summary\": \"List Transfers\",\n \"tags\": [\n \"Transfers\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"payout:transfer:read\"\n ]\n }\n ],\n \"description\": \"Lists ledger transfers for an account. You must specify an origin_id or a destination_id.\",\n \"operationId\": \"list\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"origin_id\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Filter to transfers sent from this account.\"\n },\n {\n \"name\": \"destination_id\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Filter to transfers received by this account.\"\n },\n {\n \"name\": \"order\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\",\n \"enum\": [\n \"created_at\",\n \"amount\"\n ]\n },\n \"description\": \"Sort column. Defaults to created_at.\"\n },\n {\n \"name\": \"direction\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\",\n \"enum\": [\n \"asc\",\n \"desc\"\n ]\n },\n \"description\": \"Sort direction. Defaults to desc.\"\n },\n {\n \"name\": \"created_before\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Only transfers created strictly before this ISO 8601 timestamp.\"\n },\n {\n \"name\": \"created_after\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Only transfers created strictly after this ISO 8601 timestamp.\"\n },\n {\n \"name\": \"first\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"integer\",\n \"default\": 50,\n \"maximum\": 50\n },\n \"description\": \"Number of transfers to return from the start of the window.\"\n },\n {\n \"name\": \"after\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Cursor to fetch the page after (from page_info.end_cursor).\"\n },\n {\n \"name\": \"last\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"integer\",\n \"maximum\": 50\n },\n \"description\": \"Number of transfers to return from the end of the window.\"\n },\n {\n \"name\": \"before\",\n \"in\": \"query\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"Cursor to fetch the page before (from page_info.start_cursor).\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"transfers listed\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"data\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"title\": \"TransferListItem\",\n \"description\": \"A transfer of credit between two ledger accounts.\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"amount\": {\n \"type\": \"number\"\n },\n \"currency\": {\n \"type\": \"string\"\n },\n \"created_at\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"fee_amount\": {\n \"type\": \"number\",\n \"nullable\": true\n },\n \"notes\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"nullable\": true\n },\n \"origin_ledger_account_id\": {\n \"type\": \"string\"\n },\n \"destination_ledger_account_id\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"id\",\n \"amount\",\n \"currency\",\n \"created_at\",\n \"origin_ledger_account_id\",\n \"destination_ledger_account_id\"\n ]\n }\n },\n \"page_info\": {\n \"type\": \"object\",\n \"properties\": {\n \"has_next_page\": {\n \"type\": \"boolean\"\n },\n \"has_previous_page\": {\n \"type\": \"boolean\"\n },\n \"start_cursor\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"end_cursor\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"has_next_page\",\n \"has_previous_page\",\n \"start_cursor\",\n \"end_cursor\"\n ]\n }\n },\n \"required\": [\n \"data\",\n \"page_info\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"neither origin_id nor destination_id given\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n }\n }\n }\n },\n \"/transfers/{id}\": {\n \"get\": {\n \"summary\": \"Retrieve Transfer\",\n \"tags\": [\n \"Transfers\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"payout:transfer:read\"\n ]\n }\n ],\n \"description\": \"Retrieves a ledger transfer by ID.\",\n \"operationId\": \"get\",\n \"responses\": {\n \"200\": {\n \"description\": \"transfer retrieved\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"title\": \"Transfer\",\n \"description\": \"A transfer of credit between two ledger accounts.\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"amount\": {\n \"type\": \"number\"\n },\n \"currency\": {\n \"type\": \"string\"\n },\n \"created_at\": {\n \"type\": \"string\",\n \"format\": \"date-time\"\n },\n \"fee_amount\": {\n \"type\": \"number\",\n \"nullable\": true\n },\n \"notes\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"metadata\": {\n \"type\": \"object\",\n \"additionalProperties\": true,\n \"nullable\": true\n },\n \"origin_ledger_account_id\": {\n \"type\": \"string\"\n },\n \"destination_ledger_account_id\": {\n \"type\": \"string\"\n },\n \"origin\": {\n \"oneOf\": [\n {\n \"type\": \"object\",\n \"title\": \"Company\",\n \"properties\": {\n \"typename\": {\n \"type\": \"string\",\n \"enum\": [\n \"Company\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"route\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"title\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"typename\",\n \"id\"\n ]\n },\n {\n \"type\": \"object\",\n \"title\": \"User\",\n \"properties\": {\n \"typename\": {\n \"type\": \"string\",\n \"enum\": [\n \"User\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"username\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"typename\",\n \"id\"\n ]\n }\n ],\n \"discriminator\": {\n \"propertyName\": \"typename\"\n }\n },\n \"destination\": {\n \"oneOf\": [\n {\n \"type\": \"object\",\n \"title\": \"Company\",\n \"properties\": {\n \"typename\": {\n \"type\": \"string\",\n \"enum\": [\n \"Company\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"route\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"title\": {\n \"type\": \"string\",\n \"nullable\": true\n }\n },\n \"required\": [\n \"typename\",\n \"id\"\n ]\n },\n {\n \"type\": \"object\",\n \"title\": \"User\",\n \"properties\": {\n \"typename\": {\n \"type\": \"string\",\n \"enum\": [\n \"User\"\n ]\n },\n \"id\": {\n \"type\": \"string\"\n },\n \"name\": {\n \"type\": \"string\",\n \"nullable\": true\n },\n \"username\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"typename\",\n \"id\"\n ]\n }\n ],\n \"discriminator\": {\n \"propertyName\": \"typename\"\n }\n }\n },\n \"required\": [\n \"id\",\n \"amount\",\n \"currency\",\n \"created_at\",\n \"origin_ledger_account_id\",\n \"destination_ledger_account_id\",\n \"origin\",\n \"destination\"\n ]\n }\n }\n }\n },\n \"404\": {\n \"description\": \"transfer not found\",\n \"$ref\": \"#/components/responses/NotFound\"\n }\n },\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The transfer ID.\"\n }\n ]\n }\n },\n \"/users\": {\n \"get\": {\n \"summary\": \"List Users\",\n \"tags\": [\n \"Users\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"dms:read\"\n ]\n }\n ],\n \"description\": \"Search for users by name or username, ranked by social proximity to the authenticated user. Returns the user's most recently followed users when no query is given.\",\n \"operationId\": \"list\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"query\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": false,\n \"description\": \"A search term to filter users by name or username.\"\n },\n {\n \"name\": \"first\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"integer\"\n },\n \"required\": false,\n \"description\": \"The number of users to return (max 50).\"\n },\n {\n \"name\": \"after\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": false,\n \"description\": \"A cursor; returns users after this position.\"\n },\n {\n \"name\": \"last\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"integer\"\n },\n \"required\": false,\n \"description\": \"The number of users to return from the end of the range.\"\n },\n {\n \"name\": \"before\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": false,\n \"description\": \"A cursor; returns users before this position.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"users listed\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"data\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/User\"\n }\n },\n \"page_info\": {\n \"type\": \"object\",\n \"properties\": {\n \"end_cursor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"start_cursor\": {\n \"type\": [\n \"string\",\n \"null\"\n ]\n },\n \"has_next_page\": {\n \"type\": \"boolean\"\n },\n \"has_previous_page\": {\n \"type\": \"boolean\"\n }\n },\n \"required\": [\n \"end_cursor\",\n \"start_cursor\",\n \"has_next_page\",\n \"has_previous_page\"\n ]\n }\n },\n \"required\": [\n \"data\",\n \"page_info\"\n ]\n }\n }\n }\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n }\n }\n }\n },\n \"/users/me\": {\n \"patch\": {\n \"summary\": \"Update Current User\",\n \"tags\": [\n \"Users\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"user:profile:update\"\n ]\n }\n ],\n \"description\": \"Updates the authenticated user's global profile, or their profile override for an account when account_id is given. Not available to API keys.\",\n \"operationId\": \"me\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"account_id\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": false,\n \"description\": \"When set, updates the authenticated user's profile override for this account instead of their global profile.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"current user updated\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/User\"\n }\n }\n }\n },\n \"400\": {\n \"description\": \"API keys cannot update a global profile\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n }\n },\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"bio\": {\n \"type\": \"string\"\n },\n \"username\": {\n \"type\": \"string\"\n },\n \"profile_picture\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"direct_upload_id\": {\n \"type\": \"string\"\n }\n }\n }\n }\n }\n }\n },\n \"required\": true\n }\n }\n },\n \"/users/{id}\": {\n \"get\": {\n \"summary\": \"Retrieve User\",\n \"tags\": [\n \"Users\"\n ],\n \"security\": [\n {\n \"bearerAuth\": []\n }\n ],\n \"description\": \"Retrieves a user's public profile by user_ tag, username, or 'me'.\",\n \"operationId\": \"get\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The ID of the user, which will look like user_*************, a username, or 'me'.\"\n },\n {\n \"name\": \"account_id\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": false,\n \"description\": \"When set, returns the user's account-specific profile overrides for this account.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"user retrieved\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/User\"\n }\n }\n }\n },\n \"404\": {\n \"description\": \"no user with that id\",\n \"$ref\": \"#/components/responses/NotFound\"\n }\n }\n },\n \"patch\": {\n \"summary\": \"Update User\",\n \"tags\": [\n \"Users\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"user:profile:update\"\n ]\n }\n ],\n \"description\": \"Updates a user. A user token updates their own global profile; an API key updates the user's account-specific profile override (account_id required).\",\n \"operationId\": \"update\",\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The ID of the user, which will look like user_*************, a username, or 'me'.\"\n },\n {\n \"name\": \"account_id\",\n \"in\": \"query\",\n \"schema\": {\n \"type\": \"string\"\n },\n \"required\": false,\n \"description\": \"The account whose profile override to update. Required for API key callers.\"\n }\n ],\n \"responses\": {\n \"200\": {\n \"description\": \"user updated\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/User\"\n }\n }\n }\n }\n },\n \"requestBody\": {\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"name\": {\n \"type\": \"string\"\n },\n \"bio\": {\n \"type\": \"string\"\n },\n \"username\": {\n \"type\": \"string\"\n },\n \"profile_picture\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\"\n },\n \"direct_upload_id\": {\n \"type\": \"string\"\n }\n }\n }\n }\n }\n }\n },\n \"required\": true\n }\n }\n },\n \"/users/{id}/access/{resource_id}\": {\n \"get\": {\n \"summary\": \"Check User Access\",\n \"tags\": [\n \"Users\"\n ],\n \"security\": [\n {\n \"bearerAuth\": []\n }\n ],\n \"description\": \"Checks whether a user has access to a company, product, or experience the caller can reach.\",\n \"operationId\": \"access\",\n \"responses\": {\n \"200\": {\n \"description\": \"access checked\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"has_access\": {\n \"type\": \"boolean\"\n },\n \"access_level\": {\n \"type\": \"string\",\n \"enum\": [\n \"no_access\",\n \"admin\",\n \"customer\"\n ]\n }\n },\n \"required\": [\n \"has_access\",\n \"access_level\"\n ]\n }\n }\n }\n }\n },\n \"parameters\": [\n {\n \"$ref\": \"#/components/parameters/ApiVersionDate\"\n },\n {\n \"name\": \"id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"The user_ tag or username to check access for.\"\n },\n {\n \"name\": \"resource_id\",\n \"in\": \"path\",\n \"required\": true,\n \"schema\": {\n \"type\": \"string\"\n },\n \"description\": \"A company (biz_), product (prod_), or experience (exp_) ID.\"\n }\n ]\n }\n },\n \"/wallets\": {\n \"get\": {\n \"summary\": \"List Wallets\",\n \"tags\": [\n \"Balances\"\n ],\n \"security\": [\n {\n \"bearerAuth\": [\n \"company:balance:read\"\n ]\n }\n ],\n \"description\": \"Lists every crypto wallet linked to the authenticated resource.\",\n \"operationId\": \"list\",\n \"responses\": {\n \"200\": {\n \"description\": \"wallets listed\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"type\": \"object\",\n \"properties\": {\n \"wallets\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"object\",\n \"properties\": {\n \"address\": {\n \"type\": \"string\"\n },\n \"network\": {\n \"type\": \"string\"\n },\n \"balance_usd\": {\n \"type\": \"string\"\n }\n },\n \"required\": [\n \"address\",\n \"network\",\n \"balance_usd\"\n ]\n }\n }\n },\n \"required\": [\n \"wallets\"\n ]\n }\n }\n }\n },\n \"400\": {\n \"description\": \"wallet lookup failed\",\n \"$ref\": \"#/components/responses/InvalidParameters\"\n },\n \"401\": {\n \"description\": \"missing or invalid authentication\",\n \"$ref\": \"#/components/responses/Unauthorized\"\n },\n \"403\": {\n \"description\": \"credential lacks the required balance-read scope\",\n \"$ref\": \"#/components/responses/Forbidden\"\n }\n },\n \"parameters\": []\n }\n }\n },\n \"components\": {\n \"securitySchemes\": {\n \"bearerAuth\": {\n \"type\": \"http\",\n \"scheme\": \"bearer\",\n \"bearerFormat\": \"auth-scheme\",\n \"description\": \"A company API key, company scoped JWT, app API key, or user OAuth token.\"\n }\n },\n \"schemas\": {\n \"AccountBalanceToken\": {\n \"type\": \"object\",\n \"properties\": {\n \"symbol\": {\n \"type\": \"string\",\n \"description\": \"The holding's display symbol, e.g. USDT, cbBTC, or EUR\"\n },\n \"name\": {\n \"type\": \"string\",\n \"description\": \"The holding's display name\"\n },\n \"balance\": {\n \"type\": \"string\",\n \"description\": \"The total amount held in native units, as a decimal string\"\n },\n \"value_usd\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The total USD value of the holding, or null when no exchange rate is available\"\n },\n \"price_usd\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The USD price per unit, or null when no exchange rate is available\"\n },\n \"icon_url\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The URL of the holding's icon, when available\"\n },\n \"breakdown\": {\n \"type\": \"object\",\n \"description\": \"The holding split into available, pending, and reserve amounts (native-unit decimal strings). On-chain crypto is entirely available; good_funds and fiat cash can have pending/reserve portions\"\n }\n },\n \"required\": [\n \"symbol\",\n \"name\",\n \"balance\",\n \"value_usd\",\n \"price_usd\",\n \"icon_url\",\n \"breakdown\"\n ]\n },\n \"Account\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"The ID of the account, which will look like biz_*************\"\n },\n \"email\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The email address of the account owner\"\n },\n \"title\": {\n \"type\": \"string\",\n \"description\": \"The display name of the account\"\n },\n \"description\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"A promotional description for the account\"\n },\n \"route\": {\n \"type\": \"string\",\n \"description\": \"The account's public route identifier\"\n },\n \"logo_url\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The URL of the account logo image\"\n },\n \"banner_image_url\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The URL of the account banner image\"\n },\n \"business_type\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The high-level business category for the account\"\n },\n \"country\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The country the account is located in\"\n },\n \"home_preferences\": {\n \"type\": \"array\",\n \"items\": {\n \"type\": \"string\",\n \"description\": \"Preferences for the public business home page\"\n }\n },\n \"industry_group\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The industry group the account belongs to\"\n },\n \"industry_type\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The specific industry vertical the account operates in\"\n },\n \"invoice_prefix\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The prefix used for account invoices\"\n },\n \"onboarding_type\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The type of onboarding the account has completed\"\n },\n \"opengraph_image_url\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The URL of the account Open Graph image\"\n },\n \"opengraph_image_variant\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The account Open Graph image variant\"\n },\n \"other_business_description\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The description of the business type when business_type is other\"\n },\n \"other_industry_description\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The description of the industry type when industry_type is other\"\n },\n \"require_2fa\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the account requires authorized users to have two-factor authentication enabled\"\n },\n \"target_audience\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The target audience for this account\"\n },\n \"send_customer_emails\": {\n \"type\": \"boolean\",\n \"description\": \"Whether Whop sends transactional emails to customers on behalf of this account\"\n },\n \"show_joined_whops\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the account appears in joined whops on other accounts\"\n },\n \"show_reviews_dtc\": {\n \"type\": \"boolean\",\n \"description\": \"Whether reviews are displayed on direct-to-consumer product pages\"\n },\n \"show_user_directory\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the account shows users in the user directory\"\n },\n \"store_page_config\": {\n \"type\": \"object\",\n \"description\": \"Store page display configuration for the account\"\n },\n \"parent_account_id\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The parent account ID for connected accounts\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"description\": \"Arbitrary key/value metadata supplied when the account was created\"\n },\n \"created_at\": {\n \"type\": \"string\",\n \"description\": \"When the account was created, as an ISO 8601 timestamp\"\n },\n \"use_logo_as_opengraph_image_fallback\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the account uses its logo as the fallback Open Graph image\"\n },\n \"total_usd\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Total USD value across all balances with a known exchange rate. Only computed on single-account reads (retrieve and me); null (with an empty balances array) on list responses, on writes, when the caller's token lacks the balance-read permission, and when the balance source is unavailable\"\n },\n \"balances\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/AccountBalanceToken\",\n \"description\": \"The account's holdings (crypto and fiat), each with its USD value. Empty when total_usd is null (not computed)\"\n }\n },\n \"wallet\": {\n \"$ref\": \"#/components/schemas/AccountWallet\",\n \"nullable\": true,\n \"description\": \"The account's primary crypto wallet, or null if none has been provisioned\"\n },\n \"social_links\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/AccountSocialLink\",\n \"description\": \"Social links displayed for the account\"\n }\n }\n },\n \"required\": [\n \"id\",\n \"email\",\n \"title\",\n \"description\",\n \"route\",\n \"logo_url\",\n \"banner_image_url\",\n \"business_type\",\n \"country\",\n \"home_preferences\",\n \"industry_group\",\n \"industry_type\",\n \"invoice_prefix\",\n \"onboarding_type\",\n \"opengraph_image_url\",\n \"opengraph_image_variant\",\n \"other_business_description\",\n \"other_industry_description\",\n \"require_2fa\",\n \"target_audience\",\n \"send_customer_emails\",\n \"show_joined_whops\",\n \"show_reviews_dtc\",\n \"show_user_directory\",\n \"store_page_config\",\n \"parent_account_id\",\n \"metadata\",\n \"created_at\",\n \"use_logo_as_opengraph_image_fallback\",\n \"total_usd\",\n \"balances\",\n \"wallet\",\n \"social_links\"\n ]\n },\n \"AccountSocialLink\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"The ID of the social link\"\n },\n \"website\": {\n \"type\": \"string\",\n \"description\": \"The social platform for this link\",\n \"enum\": [\n \"x\",\n \"instagram\",\n \"facebook\",\n \"tiktok\",\n \"youtube\",\n \"linkedin\",\n \"twitch\",\n \"website\",\n \"custom\"\n ]\n },\n \"url\": {\n \"type\": \"string\",\n \"description\": \"The social link URL\"\n },\n \"title\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The optional display title for the social link\"\n }\n },\n \"required\": [\n \"id\",\n \"website\",\n \"url\",\n \"title\"\n ]\n },\n \"AccountWallet\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"The ID of the wallet, which will look like wallet_*************\"\n },\n \"address\": {\n \"type\": \"string\",\n \"description\": \"The on-chain address of the wallet\"\n },\n \"network\": {\n \"type\": \"string\",\n \"description\": \"The blockchain network the wallet lives on\",\n \"enum\": [\n \"solana\",\n \"ethereum\",\n \"bitcoin\"\n ]\n }\n },\n \"required\": [\n \"id\",\n \"address\",\n \"network\"\n ]\n },\n \"PlanListItem\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"The ID of the plan, which will look like plan_*************\"\n },\n \"created_at\": {\n \"type\": \"string\",\n \"description\": \"When the plan was created, as an ISO 8601 timestamp\"\n },\n \"updated_at\": {\n \"type\": \"string\",\n \"description\": \"When the plan was last updated, as an ISO 8601 timestamp\"\n },\n \"visibility\": {\n \"type\": \"string\",\n \"description\": \"Whether the plan is visible to customers or hidden from public view\"\n },\n \"plan_type\": {\n \"type\": \"string\",\n \"description\": \"The billing model for this plan: 'renewal' for recurring subscriptions or 'one_time' for single payments\"\n },\n \"release_method\": {\n \"type\": \"string\",\n \"description\": \"The method used to sell this plan, e.g. 'buy_now' or 'waitlist'\"\n },\n \"currency\": {\n \"type\": \"string\",\n \"description\": \"The three-letter ISO currency code all prices on this plan are denominated in\"\n },\n \"account\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The account that sells this plan, an object with an id and title. Null for standalone invoice plans\"\n },\n \"product\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The product this plan belongs to, an object with an id and title. Null for standalone plans\"\n },\n \"invoice\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The invoice this plan was generated for, an object with an id. Null unless the plan was created for an invoice\"\n },\n \"billing_period\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The number of days between recurring charges. Null for one-time plans\"\n },\n \"title\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The display name of the plan shown to customers\"\n },\n \"description\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"A text description of the plan visible to customers\"\n },\n \"purchase_url\": {\n \"type\": \"string\",\n \"description\": \"The full URL where customers can purchase this plan directly\"\n },\n \"expiration_days\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The number of days until the membership expires, for expiration-based plans\"\n },\n \"initial_price\": {\n \"type\": \"number\",\n \"description\": \"The initial purchase price in the plan's currency\"\n },\n \"renewal_price\": {\n \"type\": \"number\",\n \"description\": \"The recurring price charged every billing period in the plan's currency\"\n },\n \"trial_period_days\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The number of free trial days before the first charge on a recurring plan\"\n },\n \"three_ds_level\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The 3D Secure behavior for this plan. Null means the plan inherits the account default\"\n },\n \"member_count\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The number of active memberships on this plan. Only visible to authorized team members\"\n },\n \"internal_notes\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Private notes visible only to authorized team members\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"Custom key-value pairs stored on the plan\"\n },\n \"stock\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The number of units available for purchase. Only visible to authorized team members\"\n },\n \"unlimited_stock\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the plan has unlimited stock\"\n },\n \"split_pay_required_payments\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The number of installment payments required before the subscription pauses\"\n },\n \"adaptive_pricing_enabled\": {\n \"type\": \"boolean\",\n \"description\": \"Whether this plan accepts local currency payments via adaptive pricing\"\n },\n \"payment_method_configuration\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The explicit payment method configuration for the plan, an object with enabled, disabled and include_platform_defaults. Null if the plan uses default settings\"\n }\n },\n \"required\": [\n \"id\",\n \"created_at\",\n \"updated_at\",\n \"visibility\",\n \"plan_type\",\n \"release_method\",\n \"currency\",\n \"account\",\n \"product\",\n \"invoice\",\n \"billing_period\",\n \"title\",\n \"description\",\n \"purchase_url\",\n \"expiration_days\",\n \"initial_price\",\n \"renewal_price\",\n \"trial_period_days\",\n \"three_ds_level\",\n \"member_count\",\n \"internal_notes\",\n \"metadata\",\n \"stock\",\n \"unlimited_stock\",\n \"split_pay_required_payments\",\n \"adaptive_pricing_enabled\",\n \"payment_method_configuration\"\n ]\n },\n \"Plan\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"The ID of the plan, which will look like plan_*************\"\n },\n \"created_at\": {\n \"type\": \"string\",\n \"description\": \"When the plan was created, as an ISO 8601 timestamp\"\n },\n \"updated_at\": {\n \"type\": \"string\",\n \"description\": \"When the plan was last updated, as an ISO 8601 timestamp\"\n },\n \"visibility\": {\n \"type\": \"string\",\n \"description\": \"Whether the plan is visible to customers or hidden from public view\",\n \"enum\": [\n \"visible\",\n \"hidden\",\n \"archived\",\n \"quick_link\"\n ]\n },\n \"plan_type\": {\n \"type\": \"string\",\n \"description\": \"The billing model for this plan: 'renewal' for recurring subscriptions or 'one_time' for single payments\",\n \"enum\": [\n \"renewal\",\n \"one_time\"\n ]\n },\n \"release_method\": {\n \"type\": \"string\",\n \"description\": \"The method used to sell this plan, e.g. 'buy_now' or 'waitlist'\",\n \"enum\": [\n \"buy_now\",\n \"waitlist\"\n ]\n },\n \"currency\": {\n \"type\": \"string\",\n \"description\": \"The three-letter ISO currency code all prices on this plan are denominated in\",\n \"enum\": [\n \"usd\",\n \"sgd\",\n \"inr\",\n \"aud\",\n \"brl\",\n \"cad\",\n \"dkk\",\n \"eur\",\n \"nok\",\n \"gbp\",\n \"sek\",\n \"chf\",\n \"hkd\",\n \"huf\",\n \"jpy\",\n \"mxn\",\n \"myr\",\n \"pln\",\n \"czk\",\n \"nzd\",\n \"aed\",\n \"eth\",\n \"ape\",\n \"cop\",\n \"ron\",\n \"thb\",\n \"bgn\",\n \"idr\",\n \"dop\",\n \"php\",\n \"try\",\n \"krw\",\n \"twd\",\n \"vnd\",\n \"pkr\",\n \"clp\",\n \"uyu\",\n \"ars\",\n \"zar\",\n \"dzd\",\n \"tnd\",\n \"mad\",\n \"kes\",\n \"kwd\",\n \"jod\",\n \"all\",\n \"xcd\",\n \"amd\",\n \"bsd\",\n \"bhd\",\n \"bob\",\n \"bam\",\n \"khr\",\n \"crc\",\n \"xof\",\n \"egp\",\n \"etb\",\n \"gmd\",\n \"ghs\",\n \"gtq\",\n \"gyd\",\n \"ils\",\n \"jmd\",\n \"mop\",\n \"mga\",\n \"mur\",\n \"mdl\",\n \"mnt\",\n \"nad\",\n \"ngn\",\n \"mkd\",\n \"omr\",\n \"pyg\",\n \"pen\",\n \"qar\",\n \"rwf\",\n \"sar\",\n \"rsd\",\n \"lkr\",\n \"tzs\",\n \"ttd\",\n \"uzs\",\n \"rub\",\n \"btc\",\n \"cny\",\n \"usdt\",\n \"kzt\",\n \"awg\",\n \"whop_usd\",\n \"xau\"\n ]\n },\n \"account\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The account that sells this plan, an object with an id and title. Null for standalone invoice plans\"\n },\n \"product\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The product this plan belongs to, an object with an id and title. Null for standalone plans\"\n },\n \"invoice\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The invoice this plan was generated for, an object with an id. Null unless the plan was created for an invoice\"\n },\n \"billing_period\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The number of days between recurring charges. Null for one-time plans\"\n },\n \"title\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The display name of the plan shown to customers\"\n },\n \"description\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"A text description of the plan visible to customers\"\n },\n \"purchase_url\": {\n \"type\": \"string\",\n \"description\": \"The full URL where customers can purchase this plan directly\"\n },\n \"expiration_days\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The number of days until the membership expires, for expiration-based plans\"\n },\n \"initial_price\": {\n \"type\": \"number\",\n \"description\": \"The initial purchase price in the plan's currency\"\n },\n \"renewal_price\": {\n \"type\": \"number\",\n \"description\": \"The recurring price charged every billing period in the plan's currency\"\n },\n \"trial_period_days\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The number of free trial days before the first charge on a recurring plan\"\n },\n \"three_ds_level\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The 3D Secure behavior for this plan. Null means the plan inherits the account default\",\n \"enum\": [\n \"mandate_challenge\",\n \"frictionless\"\n ]\n },\n \"member_count\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The number of active memberships on this plan. Only visible to authorized team members\"\n },\n \"internal_notes\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Private notes visible only to authorized team members\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"Custom key-value pairs stored on the plan\"\n },\n \"stock\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The number of units available for purchase. Only visible to authorized team members\"\n },\n \"unlimited_stock\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the plan has unlimited stock\"\n },\n \"split_pay_required_payments\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The number of installment payments required before the subscription pauses\"\n },\n \"adaptive_pricing_enabled\": {\n \"type\": \"boolean\",\n \"description\": \"Whether this plan accepts local currency payments via adaptive pricing\"\n },\n \"payment_method_configuration\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The explicit payment method configuration for the plan, an object with enabled, disabled and include_platform_defaults. Null if the plan uses default settings\"\n },\n \"tax_type\": {\n \"type\": \"string\",\n \"description\": \"How tax is handled for this plan: 'inclusive', 'exclusive', or 'unspecified'\"\n },\n \"collect_tax\": {\n \"type\": \"boolean\",\n \"description\": \"Whether tax is collected on purchases of this plan\"\n },\n \"custom_fields\": {\n \"type\": \"array\",\n \"description\": \"Custom input fields displayed on the checkout form, objects with id, field_type, name, order, placeholder and required\"\n }\n },\n \"required\": [\n \"id\",\n \"created_at\",\n \"updated_at\",\n \"visibility\",\n \"plan_type\",\n \"release_method\",\n \"currency\",\n \"account\",\n \"product\",\n \"invoice\",\n \"billing_period\",\n \"title\",\n \"description\",\n \"purchase_url\",\n \"expiration_days\",\n \"initial_price\",\n \"renewal_price\",\n \"trial_period_days\",\n \"three_ds_level\",\n \"member_count\",\n \"internal_notes\",\n \"metadata\",\n \"stock\",\n \"unlimited_stock\",\n \"split_pay_required_payments\",\n \"adaptive_pricing_enabled\",\n \"payment_method_configuration\",\n \"tax_type\",\n \"collect_tax\",\n \"custom_fields\"\n ]\n },\n \"ProductListItem\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"The ID of the product, which will look like prod_*************\"\n },\n \"created_at\": {\n \"type\": \"string\",\n \"description\": \"When the product was created, as an ISO 8601 timestamp\"\n },\n \"updated_at\": {\n \"type\": \"string\",\n \"description\": \"When the product was last updated, as an ISO 8601 timestamp\"\n },\n \"title\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The display name of the product shown to customers\"\n },\n \"visibility\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Whether the product is publicly visible, hidden, or archived\"\n },\n \"headline\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"A short marketing headline displayed on the product page\"\n },\n \"verified\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the product has been verified by Whop\"\n },\n \"member_count\": {\n \"type\": \"number\",\n \"description\": \"The number of active memberships on this product. Returns 0 if the company has disabled public member counts\"\n },\n \"route\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The URL slug for the product's public link\"\n },\n \"published_reviews_count\": {\n \"type\": \"number\",\n \"description\": \"The number of published customer reviews for this product\"\n },\n \"external_identifier\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"An external identifier stored on the product for your own reference\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"Custom key-value pairs stored on the product\"\n }\n },\n \"required\": [\n \"id\",\n \"created_at\",\n \"updated_at\",\n \"title\",\n \"visibility\",\n \"headline\",\n \"verified\",\n \"member_count\",\n \"route\",\n \"published_reviews_count\",\n \"external_identifier\",\n \"metadata\"\n ]\n },\n \"Product\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"The ID of the product, which will look like prod_*************\"\n },\n \"created_at\": {\n \"type\": \"string\",\n \"description\": \"When the product was created, as an ISO 8601 timestamp\"\n },\n \"updated_at\": {\n \"type\": \"string\",\n \"description\": \"When the product was last updated, as an ISO 8601 timestamp\"\n },\n \"title\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The display name of the product shown to customers\"\n },\n \"visibility\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Whether the product is publicly visible, hidden, or archived\"\n },\n \"headline\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"A short marketing headline displayed on the product page\"\n },\n \"verified\": {\n \"type\": \"boolean\",\n \"description\": \"Whether the product has been verified by Whop\"\n },\n \"member_count\": {\n \"type\": \"number\",\n \"description\": \"The number of active memberships on this product. Returns 0 if the company has disabled public member counts\"\n },\n \"route\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The URL slug for the product's public link\"\n },\n \"published_reviews_count\": {\n \"type\": \"number\",\n \"description\": \"The number of published customer reviews for this product\"\n },\n \"external_identifier\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"An external identifier stored on the product for your own reference\"\n },\n \"metadata\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"Custom key-value pairs stored on the product\"\n },\n \"description\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"A written description of the product displayed on the product page\"\n },\n \"custom_cta\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The call-to-action button label displayed on the product's purchase page\"\n },\n \"custom_cta_url\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"A URL that the call-to-action button links to instead of the default checkout flow\"\n },\n \"custom_statement_descriptor\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"A custom text label on the customer's bank statement for purchases of this product\"\n },\n \"global_affiliate_percentage\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The commission rate affiliates earn through the global affiliate program\"\n },\n \"global_affiliate_status\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The enrollment status of this product in the global affiliate program\"\n },\n \"member_affiliate_percentage\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"The commission rate members earn through the member affiliate program\"\n },\n \"member_affiliate_status\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The enrollment status of this product in the member affiliate program\"\n },\n \"gallery_images\": {\n \"type\": \"array\",\n \"description\": \"The gallery images for this product, each an object with id and url\"\n },\n \"product_tax_code\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The tax classification code for this product, an object with id, name and product_type. Null if no tax code is set\"\n },\n \"owner_user\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The user who owns the company selling this product, an object with id, name and username\"\n },\n \"company\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The company that sells this product, an object with id, route and title\"\n }\n },\n \"required\": [\n \"id\",\n \"created_at\",\n \"updated_at\",\n \"title\",\n \"visibility\",\n \"headline\",\n \"verified\",\n \"member_count\",\n \"route\",\n \"published_reviews_count\",\n \"external_identifier\",\n \"metadata\",\n \"description\",\n \"custom_cta\",\n \"custom_cta_url\",\n \"custom_statement_descriptor\",\n \"global_affiliate_percentage\",\n \"global_affiliate_status\",\n \"member_affiliate_percentage\",\n \"member_affiliate_status\",\n \"gallery_images\",\n \"product_tax_code\",\n \"owner_user\",\n \"company\"\n ]\n },\n \"User\": {\n \"type\": \"object\",\n \"properties\": {\n \"id\": {\n \"type\": \"string\",\n \"description\": \"The ID of the user, which will look like user_*************\"\n },\n \"username\": {\n \"type\": \"string\",\n \"description\": \"The user's unique username\"\n },\n \"name\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The user's display name\"\n },\n \"bio\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"The user's biography\"\n },\n \"created_at\": {\n \"type\": \"string\",\n \"description\": \"When the user was created, as an ISO 8601 timestamp\"\n },\n \"profile_picture\": {\n \"type\": \"object\",\n \"nullable\": true,\n \"description\": \"The user's profile picture, an object with a url\"\n },\n \"total_usd\": {\n \"type\": \"string\",\n \"nullable\": true,\n \"description\": \"Total USD value across all balances with a known exchange rate. Only computed on the self-view (GET /users/me) for callers with the balance-read scope; null (with an empty balances array) otherwise and when the balance source is unavailable\"\n },\n \"balances\": {\n \"type\": \"array\",\n \"items\": {\n \"$ref\": \"#/components/schemas/AccountBalanceToken\",\n \"description\": \"The user's holdings (crypto and fiat), each with its USD value. Empty when total_usd is null (not computed)\"\n }\n }\n },\n \"required\": [\n \"id\",\n \"username\",\n \"name\",\n \"bio\",\n \"created_at\",\n \"profile_picture\",\n \"total_usd\",\n \"balances\"\n ]\n },\n \"V1ErrorResponse\": {\n \"type\": \"object\",\n \"properties\": {\n \"error\": {\n \"type\": \"object\",\n \"properties\": {\n \"type\": {\n \"type\": \"string\",\n \"description\": \"Machine-readable error code.\"\n },\n \"message\": {\n \"type\": \"string\",\n \"description\": \"Human-readable error message.\"\n }\n },\n \"required\": [\n \"type\",\n \"message\"\n ]\n }\n },\n \"required\": [\n \"error\"\n ]\n },\n \"Pagination\": {\n \"type\": \"object\",\n \"properties\": {\n \"current_page\": {\n \"type\": \"number\",\n \"description\": \"Current page number\"\n },\n \"total_pages\": {\n \"type\": \"number\",\n \"description\": \"Total number of pages\"\n },\n \"next_page\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"Next page number\"\n },\n \"prev_page\": {\n \"type\": \"number\",\n \"nullable\": true,\n \"description\": \"Previous page number\"\n },\n \"total_count\": {\n \"type\": \"number\",\n \"description\": \"Total number of records\"\n }\n },\n \"additionalProperties\": false,\n \"required\": [\n \"current_page\",\n \"total_pages\",\n \"next_page\",\n \"prev_page\",\n \"total_count\"\n ]\n }\n },\n \"parameters\": {\n \"ApiVersionDate\": {\n \"name\": \"Api-Version-Date\",\n \"in\": \"header\",\n \"required\": false,\n \"schema\": {\n \"type\": \"string\",\n \"format\": \"date\",\n \"example\": \"2026-06-09\"\n },\n \"description\": \"Pins the request to a dated API version. When omitted, the request uses the original (2025-01-01) request/response shapes, so existing unversioned callers are never broken. Generated SDKs always send the latest version they were built against. An unrecognized value is rejected with a 400. The schemas documented here always describe the latest version.\"\n }\n },\n \"responses\": {\n \"NotFound\": {\n \"description\": \"Resource not found\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/V1ErrorResponse\"\n }\n }\n }\n },\n \"Forbidden\": {\n \"description\": \"Forbidden\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/V1ErrorResponse\"\n }\n }\n }\n },\n \"Unauthorized\": {\n \"description\": \"Unauthorized\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/V1ErrorResponse\"\n }\n }\n }\n },\n \"InvalidParameters\": {\n \"description\": \"Invalid Parameters\",\n \"content\": {\n \"application/json\": {\n \"schema\": {\n \"$ref\": \"#/components/schemas/V1ErrorResponse\"\n }\n }\n }\n }\n }\n }\n}\n","import { AuthenticationError, PermissionDeniedError, Whop } from \"@whop/sdk\";\nimport type { Identity } from \"./types\";\n\n/**\n * Whop API boundary for authentication.\n *\n * Validates a key by calling the requesting-account endpoint through the SDK.\n * The SDK adds the `Bearer ` prefix itself, so we pass the raw token. The SDK\n * throws typed errors we map to a discriminated result:\n * - `AuthenticationError` (401) → the key is invalid → reject login.\n * - `PermissionDeniedError` (403) → the key is valid but missing the\n * required scope → accept login with best-effort identity.\n */\n\nconst DEFAULT_BASE_URL = \"https://api.whop.com/api/v1\";\n\nexport function apiBaseUrl(env: NodeJS.ProcessEnv = process.env): string {\n\treturn env.WHOP_API_BASE_URL?.trim() || DEFAULT_BASE_URL;\n}\n\n/**\n * Base URL for the OAuth endpoints (`/oauth/authorize`, `/oauth/token`,\n * `/oauth/userinfo`), which live at the API host root rather than under\n * `/api/v1`. Tolerates a base URL with or without the `/api/v1` suffix and a\n * trailing slash.\n */\nexport function oauthBaseUrl(env: NodeJS.ProcessEnv = process.env): string {\n\treturn apiBaseUrl(env)\n\t\t.replace(/\\/+$/, \"\")\n\t\t.replace(/\\/api\\/v1$/, \"\");\n}\n\nexport type ValidateResult =\n\t| { status: \"valid\"; identity: Identity }\n\t| { status: \"underscoped\"; identity: Identity }\n\t| { status: \"invalid\" }\n\t| { status: \"error\"; message: string };\n\nexport async function validateApiKey(\n\tapiKey: string,\n\tbaseUrl: string = apiBaseUrl(),\n): Promise<ValidateResult> {\n\tconst whop = new Whop({ apiKey, baseURL: baseUrl });\n\ttry {\n\t\tconst account = await whop.accounts.me();\n\t\treturn {\n\t\t\tstatus: \"valid\",\n\t\t\tidentity: { id: account.id, title: account.title, route: account.route },\n\t\t};\n\t} catch (error) {\n\t\tif (error instanceof AuthenticationError) return { status: \"invalid\" };\n\t\tif (error instanceof PermissionDeniedError)\n\t\t\treturn { status: \"underscoped\", identity: {} };\n\t\treturn {\n\t\t\tstatus: \"error\",\n\t\t\tmessage: error instanceof Error ? error.message : String(error),\n\t\t};\n\t}\n}\n","import fs from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\nimport { z } from \"incur\";\nimport { Profile } from \"./types\";\n\n/**\n * Plaintext metadata store at `~/.config/whop/config.json`.\n *\n * Holds the profile list and the active profile — never secrets, which live in\n * the OS keychain (see `keyring.ts`). Reads are corruption-tolerant: a missing\n * or invalid file resolves to an empty config rather than throwing, so the CLI\n * is never bricked by a bad file. Valid profiles are kept even if another\n * profile entry is malformed.\n */\n\nexport const Config = z.object({\n\tversion: z.literal(1).default(1),\n\tactiveProfile: z.string().optional(),\n\tprofiles: z.array(Profile).default([]),\n});\nexport type Config = z.infer<typeof Config>;\n\n/** Resolves the config directory, honoring `WHOP_CONFIG_DIR` and `XDG_CONFIG_HOME` overrides. */\nexport function configDir(env: NodeJS.ProcessEnv = process.env): string {\n\tconst override = env.WHOP_CONFIG_DIR?.trim();\n\tif (override) return override;\n\tconst xdg = env.XDG_CONFIG_HOME?.trim();\n\tconst base = xdg ? xdg : path.join(os.homedir(), \".config\");\n\treturn path.join(base, \"whop\");\n}\n\nexport function configPath(env: NodeJS.ProcessEnv = process.env): string {\n\treturn path.join(configDir(env), \"config.json\");\n}\n\nexport function readConfig(env: NodeJS.ProcessEnv = process.env): Config {\n\tlet raw: string;\n\ttry {\n\t\traw = fs.readFileSync(configPath(env), \"utf8\");\n\t} catch {\n\t\treturn Config.parse({});\n\t}\n\tlet config: Config;\n\ttry {\n\t\tconfig = parseConfig(JSON.parse(raw));\n\t} catch {\n\t\treturn Config.parse({});\n\t}\n\n\treturn config;\n}\n\nfunction parseConfig(value: unknown): Config {\n\tconst parsed = Config.safeParse(value);\n\tif (parsed.success) return parsed.data;\n\tif (!value || typeof value !== \"object\" || Array.isArray(value)) {\n\t\treturn Config.parse({});\n\t}\n\n\tconst raw = value as { activeProfile?: unknown; profiles?: unknown };\n\tconst profiles: Profile[] = [];\n\tif (Array.isArray(raw.profiles)) {\n\t\tfor (const profile of raw.profiles) {\n\t\t\tconst parsed = Profile.safeParse(profile);\n\t\t\tif (parsed.success) profiles.push(parsed.data);\n\t\t}\n\t}\n\tconst activeProfile =\n\t\ttypeof raw.activeProfile === \"string\" &&\n\t\t\tprofiles.some((profile) => profile.name === raw.activeProfile)\n\t\t\t? raw.activeProfile\n\t\t\t: undefined;\n\n\treturn Config.parse({ activeProfile, profiles });\n}\n\nexport function writeConfig(\n\tconfig: Config,\n\tenv: NodeJS.ProcessEnv = process.env,\n): void {\n\tconst dir = configDir(env);\n\tfs.mkdirSync(dir, { recursive: true, mode: 0o700 });\n\tconst file = configPath(env);\n\tconst tmp = `${file}.${process.pid}.tmp`;\n\tfs.writeFileSync(tmp, `${JSON.stringify(config, null, 2)}\\n`, {\n\t\tmode: 0o600,\n\t});\n\tfs.renameSync(tmp, file);\n\ttry {\n\t\tfs.chmodSync(file, 0o600);\n\t} catch {\n\t\t// best effort — chmod is a no-op on some platforms (e.g. Windows)\n\t}\n}\n","import { z } from \"incur\";\n\n/**\n * Shared schemas and types for authentication.\n *\n * `AuthMethod` is an enum so adding new methods doesn't change the command\n * surface or storage layout.\n */\n\nexport const AuthMethod = z.enum([\"api_key\", \"oauth\"]);\nexport type AuthMethod = z.infer<typeof AuthMethod>;\n\n/** The authenticated identity resolved from the API. Fields vary by method:\n * - api_key: id/title/route are the company (biz_xxx)\n * - oauth: id/title are the user, email is the user's email address */\nexport const Identity = z.object({\n\tid: z.string().optional().describe(\"Company or user id\"),\n\ttitle: z.string().optional().describe(\"Company display name or user name\"),\n\troute: z.string().optional().describe(\"The company's public route\"),\n\temail: z.string().optional().describe(\"User email address (oauth only)\"),\n});\nexport type Identity = z.infer<typeof Identity>;\n\n/** Non-secret, per-profile metadata persisted in the plaintext config file.\n * All secrets live only in the OS keychain:\n * - api_key: the raw API key\n * - oauth: a JSON blob with the refresh token plus the cached access token and\n * its expiry (see `OAuthSecret` in profiles.ts) */\nexport const Profile = z.object({\n\tname: z.string().describe(\"The local profile name\"),\n\tmethod: AuthMethod,\n\t// company identity (api_key)\n\tcompanyId: z.string().optional(),\n\tcompanyTitle: z.string().optional(),\n\tcompanyRoute: z.string().optional(),\n\t// user identity (oauth)\n\tuserId: z.string().optional(),\n\tuserEmail: z.string().optional(),\n\tcreatedAt: z\n\t\t.string()\n\t\t.describe(\"ISO timestamp of when the profile was first created\"),\n});\nexport type Profile = z.infer<typeof Profile>;\n","import { Entry } from \"@napi-rs/keyring\";\n\n/**\n * OS-native keychain wrapper (macOS Keychain, Windows Credential Manager,\n * libsecret on Linux) via `@napi-rs/keyring`.\n *\n * One credential per profile: service `whop-cli`, account = profile name.\n * `getSecret` returns `null` (rather than throwing) when the entry is missing or\n * the keychain is locked, so callers can treat \"no secret\" as a normal state.\n */\n\nconst SERVICE = \"whop-cli\";\n\nfunction entry(profileName: string): Entry {\n\treturn new Entry(SERVICE, profileName);\n}\n\nexport function setSecret(profileName: string, secret: string): void {\n\tentry(profileName).setPassword(secret);\n}\n\nexport function getSecret(profileName: string): string | null {\n\ttry {\n\t\treturn entry(profileName).getPassword();\n\t} catch {\n\t\treturn null;\n\t}\n}\n\nexport function deleteSecret(profileName: string): void {\n\ttry {\n\t\tentry(profileName).deletePassword();\n\t} catch {\n\t\t// nothing to delete (or keychain unavailable) — treat as already gone\n\t}\n}\n","import { createHash, randomBytes } from \"node:crypto\";\nimport { execFile } from \"node:child_process\";\nimport { oauthBaseUrl } from \"./client\";\nimport { startCallbackServer } from \"./callback-server\";\nimport { deriveProfileName, listProfiles, upsertProfile } from \"./profiles\";\nimport { printInfo, startSpinner } from \"./prompts\";\nimport type { Identity } from \"./types\";\n\n/** The registered public OAuth client for the Whop CLI. */\nexport const CLI_CLIENT_ID = \"app_IoPWUwtO8c2gGA\";\n\n/** Fixed local callback port — must match the redirect_uri registered on the OAuth app. */\nexport const CLI_REDIRECT_URI = \"http://localhost:13337/callback\";\n\nimport { WHOP_SCOPES, type WhopScope } from \"./scopes\";\n\nexport { WHOP_SCOPES, type WhopScope };\n\n/** Scopes requested by the CLI during OAuth login. */\nexport const CLI_SCOPES: WhopScope[] = [...WHOP_SCOPES];\n\n\n// --- PKCE ---\n\nexport function generatePKCE(): { verifier: string; challenge: string } {\n\tconst verifier = randomBytes(32).toString(\"base64url\");\n\tconst challenge = createHash(\"sha256\").update(verifier).digest(\"base64url\");\n\treturn { verifier, challenge };\n}\n\nexport function generateState(): string {\n\treturn randomBytes(16).toString(\"base64url\");\n}\n\nexport function generateNonce(): string {\n\treturn randomBytes(16).toString(\"base64url\");\n}\n\n// --- Browser opening ---\n\nexport function openBrowser(url: string): void {\n\t// Launching is best-effort — the URL is also printed as a manual fallback —\n\t// so pass a no-op callback to swallow ENOENT/spawn errors instead of leaving\n\t// them unhandled.\n\tconst ignore = (): void => {};\n\tif (process.platform === \"darwin\") {\n\t\texecFile(\"open\", [url], ignore);\n\t} else if (process.platform === \"win32\") {\n\t\texecFile(\"cmd.exe\", [\"/c\", \"start\", \"\", url], ignore);\n\t} else {\n\t\texecFile(\"xdg-open\", [url], ignore);\n\t}\n}\n\n// --- Token exchange ---\n\nexport interface OAuthTokens {\n\taccessToken: string;\n\trefreshToken: string;\n\texpiresIn: number;\n}\n\nasync function requestToken(\n\tparams: Record<string, string>,\n): Promise<OAuthTokens> {\n\tconst res = await fetch(`${oauthBaseUrl()}/oauth/token`, {\n\t\tmethod: \"POST\",\n\t\theaders: { \"Content-Type\": \"application/x-www-form-urlencoded\" },\n\t\tbody: new URLSearchParams(params).toString(),\n\t});\n\n\tif (!res.ok) {\n\t\tconst body = await res.text();\n\t\tthrow new Error(`OAuth token request failed (${res.status}): ${body}`);\n\t}\n\n\tconst json = (await res.json()) as {\n\t\taccess_token: string;\n\t\trefresh_token: string;\n\t\texpires_in: number;\n\t};\n\n\treturn {\n\t\taccessToken: json.access_token,\n\t\trefreshToken: json.refresh_token,\n\t\texpiresIn: json.expires_in,\n\t};\n}\n\nexport function exchangeCode(\n\tcode: string,\n\tverifier: string,\n): Promise<OAuthTokens> {\n\treturn requestToken({\n\t\tgrant_type: \"authorization_code\",\n\t\tclient_id: CLI_CLIENT_ID,\n\t\tcode,\n\t\tredirect_uri: CLI_REDIRECT_URI,\n\t\tcode_verifier: verifier,\n\t});\n}\n\nexport function refreshAccessToken(refreshToken: string): Promise<OAuthTokens> {\n\treturn requestToken({\n\t\tgrant_type: \"refresh_token\",\n\t\tclient_id: CLI_CLIENT_ID,\n\t\trefresh_token: refreshToken,\n\t});\n}\n\n// --- Authorization URL ---\n\nexport function buildAuthUrl(\n\tchallenge: string,\n\tstate: string,\n\tnonce: string,\n): string {\n\tconst base = oauthBaseUrl();\n\tconst params = new URLSearchParams({\n\t\tclient_id: CLI_CLIENT_ID,\n\t\tresponse_type: \"code\",\n\t\tredirect_uri: CLI_REDIRECT_URI,\n\t\tcode_challenge: challenge,\n\t\tcode_challenge_method: \"S256\",\n\t\tscope: CLI_SCOPES.join(\" \"),\n\t\tstate,\n\t\tnonce,\n\t});\n\treturn `${base}/oauth/authorize?${params.toString()}`;\n}\n\n// --- Full OAuth login flow ---\n\nexport class OAuthError extends Error {\n\tconstructor(\n\t\tpublic readonly code: string,\n\t\tmessage: string,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"OAuthError\";\n\t}\n}\n\nexport interface OAuthLoginResult {\n\tprofileName: string;\n\tidentity: Identity;\n\texisted: boolean;\n}\n\nexport async function performOAuthLogin(input: {\n\tprofile?: string | undefined;\n}): Promise<OAuthLoginResult> {\n\tconst { verifier, challenge } = generatePKCE();\n\tconst state = generateState();\n\tconst nonce = generateNonce();\n\tconst authUrl = buildAuthUrl(challenge, state, nonce);\n\n\tconst s = startSpinner(\"Opening browser…\");\n\topenBrowser(authUrl);\n\ts.stop(\"Waiting for authorization in your browser…\");\n\tprintInfo(`If your browser didn't open, visit:\\n${authUrl}`);\n\n\tlet code: string;\n\ttry {\n\t\tcode = await startCallbackServer(state);\n\t} catch (err) {\n\t\tthrow new OAuthError(\n\t\t\t\"OAUTH_CALLBACK_FAILED\",\n\t\t\terr instanceof Error ? err.message : \"OAuth callback failed.\",\n\t\t);\n\t}\n\n\tconst s2 = startSpinner(\"Exchanging authorization code…\");\n\tlet tokens: OAuthTokens;\n\ttry {\n\t\ttokens = await exchangeCode(code, verifier);\n\t\ts2.stop(\"Authorized.\");\n\t} catch (err) {\n\t\ts2.stop(\"Token exchange failed.\");\n\t\tthrow new OAuthError(\n\t\t\t\"TOKEN_EXCHANGE_FAILED\",\n\t\t\terr instanceof Error ? err.message : \"Token exchange failed.\",\n\t\t);\n\t}\n\n\tconst base = oauthBaseUrl();\n\tlet identity: Identity = {};\n\ttry {\n\t\tconst res = await fetch(`${base}/oauth/userinfo`, {\n\t\t\theaders: { Authorization: `Bearer ${tokens.accessToken}` },\n\t\t});\n\t\tif (res.ok) {\n\t\t\tconst info = (await res.json()) as {\n\t\t\t\tsub?: string;\n\t\t\t\tname?: string;\n\t\t\t\temail?: string;\n\t\t\t};\n\t\t\tidentity = { id: info.sub, title: info.name, email: info.email };\n\t\t}\n\t} catch {\n\t\t// Non-fatal — profile name falls back to \"default\"\n\t}\n\n\tconst name = input.profile ?? deriveProfileName(identity);\n\tconst existed = listProfiles().some((p) => p.name === name);\n\tconst tokenExpiresAt = new Date(\n\t\tDate.now() + tokens.expiresIn * 1000,\n\t).toISOString();\n\n\tconst profile = upsertProfile({\n\t\tname,\n\t\tmethod: \"oauth\",\n\t\tsecret: tokens.refreshToken,\n\t\tidentity,\n\t\taccessToken: tokens.accessToken,\n\t\ttokenExpiresAt,\n\t});\n\n\treturn {\n\t\tprofileName: profile.name,\n\t\tidentity,\n\t\texisted,\n\t};\n}\n","import { createServer, type Server } from \"node:http\";\nimport { errorHtml, successHtml } from \"./callback-html\";\n\nconst CALLBACK_PORT = 13337;\n\n// The redirect_uri uses the \"localhost\" hostname, which resolves to 127.0.0.1\n// (IPv4) on some hosts and ::1 (IPv6) on others. Bind both loopback families so\n// the browser's redirect connects regardless of how it resolves localhost.\nconst LOOPBACK_HOSTS = [\"127.0.0.1\", \"::1\"] as const;\n\n/**\n * Starts a temporary HTTP server on the loopback callback port, waits for the\n * OAuth redirect to `/callback` carrying the expected `state`, responds with a\n * close-tab page, and resolves with the authorization code. Rejects if the\n * callback contains an error, the port is unavailable on every loopback family,\n * or it times out after 5 minutes.\n */\nexport function startCallbackServer(expectedState: string): Promise<string> {\n\treturn new Promise((resolve, reject) => {\n\t\tconst servers: Server[] = [];\n\t\tlet settled = false;\n\t\tlet bindFailures = 0;\n\n\t\tconst settle = (run: () => void): void => {\n\t\t\tif (settled) return;\n\t\t\tsettled = true;\n\t\t\tclearTimeout(timeout);\n\t\t\tfor (const server of servers) {\n\t\t\t\tserver.close();\n\t\t\t\tserver.closeAllConnections();\n\t\t\t}\n\t\t\trun();\n\t\t};\n\n\t\tconst timeout = setTimeout(\n\t\t\t() =>\n\t\t\t\tsettle(() =>\n\t\t\t\t\treject(new Error(\"Timed out waiting for OAuth callback (5 min).\")),\n\t\t\t\t),\n\t\t\t5 * 60 * 1000,\n\t\t);\n\n\t\tfor (const host of LOOPBACK_HOSTS) {\n\t\t\tconst server = createServer((req, res) => {\n\t\t\t\tconst url = new URL(req.url ?? \"/\", \"http://localhost\");\n\n\t\t\t\t// Ignore anything that isn't our callback (favicon, probes, prefetch)\n\t\t\t\t// so a stray request can't consume or abort the pending login.\n\t\t\t\tif (url.pathname !== \"/callback\") {\n\t\t\t\t\tres.writeHead(404, { \"Content-Type\": \"text/plain; charset=utf-8\" });\n\t\t\t\t\tres.end(\"Not found\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// Bind the response to this login: a missing/mismatched state is a\n\t\t\t\t// forged or cross-flow request — reject the request, not the login.\n\t\t\t\tif (url.searchParams.get(\"state\") !== expectedState) {\n\t\t\t\t\tres.writeHead(400, { \"Content-Type\": \"text/plain; charset=utf-8\" });\n\t\t\t\t\tres.end(\"Invalid OAuth state\");\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst code = url.searchParams.get(\"code\");\n\t\t\t\tconst error = url.searchParams.get(\"error\");\n\n\t\t\t\tres.writeHead(200, { \"Content-Type\": \"text/html; charset=utf-8\" });\n\t\t\t\t// Settle only after the page has flushed — otherwise tearing the\n\t\t\t\t// socket down can reset the connection before the browser renders it.\n\t\t\t\tres.end(code ? successHtml : errorHtml(error), () => {\n\t\t\t\t\tsettle(() => {\n\t\t\t\t\t\tif (code) resolve(code);\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\treject(new Error(`OAuth error: ${error ?? \"no code returned\"}`));\n\t\t\t\t\t});\n\t\t\t\t});\n\t\t\t});\n\n\t\t\tserver.on(\"error\", (err: NodeJS.ErrnoException) => {\n\t\t\t\t// Tolerate a loopback family that isn't available (e.g. IPv6\n\t\t\t\t// disabled); only fail if every family failed to bind.\n\t\t\t\tbindFailures += 1;\n\t\t\t\tif (bindFailures === LOOPBACK_HOSTS.length) settle(() => reject(err));\n\t\t\t});\n\n\t\t\tserver.listen(CALLBACK_PORT, host);\n\t\t\tservers.push(server);\n\t\t}\n\t});\n}\n","const LOGO_SVG = `<svg width=\"64\" height=\"64\" viewBox=\"0 0 32 32\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M27.1309 8.31348C28.6407 8.31348 30.1822 9.43651 31 10.5625H30.9864L19.1729 22.375C17.4239 24.124 14.5605 24.124 12.8116 22.375L11.6817 21.2441L22.3614 10.5625C22.3761 10.5433 22.7583 10.1702 22.7715 10.1572C23.8 9.17896 25.1594 8.31355 27.1309 8.31348ZM16.4356 8.31348C17.9454 8.31348 19.4869 9.43651 20.3047 10.5625L10.6534 20.2148L6.34087 15.9023L11.6797 10.5625C11.6967 10.5404 12.0648 10.1688 12.0762 10.1572C13.1047 9.17893 14.464 8.3135 16.4356 8.31348ZM5.76958 8.31348C7.27863 8.31352 8.82085 9.43653 9.63872 10.5625L5.31939 14.8818L1.00005 10.5625C0.994867 10.5507 1.40013 10.1668 1.41021 10.1572C2.43874 9.17892 3.79797 8.31348 5.76958 8.31348Z\" fill=\"#FA4616\" fill-rule=\"evenodd\" clip-rule=\"evenodd\"/>\n</svg>`;\n\nconst BASE_STYLES = `\n *, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }\n body {\n font-family: -apple-system, BlinkMacSystemFont, \"Inter\", \"Segoe UI\", sans-serif;\n min-height: 100vh;\n display: flex;\n align-items: center;\n justify-content: center;\n background: #fcfcfc;\n color: #202020;\n }\n .card {\n background: #ffffff;\n border: 1px solid #e8e8e8;\n border-radius: 16px;\n padding: 48px 40px;\n width: 100%;\n max-width: 360px;\n text-align: center;\n box-shadow: 0 1px 2px rgba(0,0,0,0.04), 0 4px 12px rgba(0,0,0,0.04);\n }\n .logo { margin-bottom: 24px; }\n h1 {\n font-size: 17px;\n font-weight: 600;\n letter-spacing: -0.02em;\n margin-bottom: 6px;\n }\n p { font-size: 13px; color: #646464; line-height: 1.5; }\n @media (prefers-color-scheme: dark) {\n body { background: #111111; color: #eeeeee; }\n .card { background: #191919; border-color: #2a2a2a; box-shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 12px rgba(0,0,0,0.2); }\n p { color: #b4b4b4; }\n }`;\n\nexport const successHtml = `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <title>Logged in to Whop</title>\n <style>${BASE_STYLES}\n </style>\n</head>\n<body>\n <div class=\"card\">\n <div class=\"logo\">${LOGO_SVG}</div>\n <h1>Logged in to Whop</h1>\n <p>You can return to your terminal.</p>\n </div>\n</body>\n</html>`;\n\nexport function errorHtml(error: string | null): string {\n\tconst message = error\n\t\t? `<code>${error.replace(/</g, \"<\").replace(/>/g, \">\")}</code>`\n\t\t: \"An unknown error occurred.\";\n\treturn `<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\">\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n <title>Login failed</title>\n <style>${BASE_STYLES}\n code { font-size: 12px; color: #e54d2e; background: #feebe7; padding: 2px 6px; border-radius: 4px; font-family: ui-monospace, monospace; }\n @media (prefers-color-scheme: dark) {\n code { background: #391714; color: #f5a898; }\n }\n </style>\n</head>\n<body>\n <div class=\"card\">\n <div class=\"logo\">${LOGO_SVG}</div>\n <h1>Login failed</h1>\n <p>${message}</p>\n </div>\n</body>\n</html>`;\n}\n","import { isCancel, log, password, select, spinner } from \"@clack/prompts\";\nimport type { AuthMethod, Profile } from \"./types\";\n\n/**\n * Interactive prompts (TTY only) built on `@clack/prompts`.\n *\n * On Ctrl-C / cancel, clack returns a cancel symbol; we throw\n * `PromptCancelledError` so the command runner can convert it into a clean\n * error result with exit code 130.\n */\n\nexport class PromptCancelledError extends Error {\n\tconstructor() {\n\t\tsuper(\"Prompt cancelled\");\n\t\tthis.name = \"PromptCancelledError\";\n\t}\n}\n\nfunction ensure<T>(value: T | symbol): T {\n\tif (isCancel(value)) throw new PromptCancelledError();\n\treturn value;\n}\n\nexport async function chooseAuthMethod(): Promise<AuthMethod> {\n\tconst method = await select<AuthMethod>({\n\t\tmessage: \"How do you want to authenticate?\",\n\t\toptions: [\n\t\t\t{\n\t\t\t\tvalue: \"oauth\",\n\t\t\t\tlabel: \"Log in with Whop\",\n\t\t\t\thint: \"Opens your browser to authorize\",\n\t\t\t},\n\t\t\t{\n\t\t\t\tvalue: \"api_key\",\n\t\t\t\tlabel: \"API key\",\n\t\t\t\thint: \"Paste a Whop company API key\",\n\t\t\t},\n\t\t],\n\t\tinitialValue: \"oauth\",\n\t});\n\treturn ensure(method);\n}\n\nexport async function promptApiKey(): Promise<string> {\n\tconst key = await password({\n\t\tmessage: \"Paste your Whop API key:\",\n\t\tvalidate: (value) =>\n\t\t\tvalue && value.trim().length > 0 ? undefined : \"An API key is required\",\n\t});\n\treturn ensure(key).trim();\n}\n\nexport async function selectProfile(profiles: Profile[]): Promise<string> {\n\tconst name = await select<string>({\n\t\tmessage: \"Select a profile to switch to:\",\n\t\toptions: profiles.map((profile) => ({\n\t\t\tvalue: profile.name,\n\t\t\tlabel: profile.name,\n\t\t\thint:\n\t\t\t\tprofile.companyTitle ??\n\t\t\t\tprofile.userEmail ??\n\t\t\t\tprofile.companyId ??\n\t\t\t\tprofile.userId,\n\t\t})),\n\t});\n\treturn ensure(name);\n}\n\n/** Starts a clack spinner and returns it so the caller can `.stop(message)`. */\nexport function startSpinner(message: string): ReturnType<typeof spinner> {\n\tconst s = spinner();\n\ts.start(message);\n\treturn s;\n}\n\n/** Prints an informational line (e.g. a manual fallback URL or hint). */\nexport function printInfo(message: string): void {\n\tlog.info(message);\n}\n","/** All user-grantable OAuth scopes supported by the Whop API. */\nexport const WHOP_SCOPES = [\n\t\"access_pass:basic:read\",\n\t\"access_pass:create\",\n\t\"access_pass:delete\",\n\t\"access_pass:stats:read\",\n\t\"access_pass:update\",\n\t\"affiliate:basic:read\",\n\t\"affiliate:create\",\n\t\"affiliate:update\",\n\t\"ai_chat:create\",\n\t\"ai_chat:delete\",\n\t\"ai_chat:read\",\n\t\"ai_chat:update\",\n\t\"ai_prompt:create\",\n\t\"bounty:create\",\n\t\"chat:message:create\",\n\t\"chat:moderate\",\n\t\"chat:read\",\n\t\"checkout_configuration:basic:read\",\n\t\"checkout_configuration:create\",\n\t\"checkout_configuration:delete\",\n\t\"company:authorized_user:email:read\",\n\t\"company:authorized_user:read\",\n\t\"company:balance:export\",\n\t\"company:balance:read\",\n\t\"company:basic:read\",\n\t\"company:create\",\n\t\"company:delete\",\n\t\"company:log:read\",\n\t\"company:manage_checkout\",\n\t\"company:update\",\n\t\"company_token_transaction:create\",\n\t\"company_token_transaction:read\",\n\t\"course_analytics:read\",\n\t\"course_lesson_interaction:read\",\n\t\"courses:read\",\n\t\"courses:update\",\n\t\"custom_emoji:update\",\n\t\"developer:basic:read\",\n\t\"developer:manage_builds\",\n\t\"dms:channel:manage\",\n\t\"dms:message:manage\",\n\t\"dms:read\",\n\t\"email\",\n\t\"event:create\",\n\t\"experience:attach\",\n\t\"experience:create\",\n\t\"experience:delete\",\n\t\"experience:detach\",\n\t\"experience:hidden_experience:read\",\n\t\"experience:update\",\n\t\"forum:moderate\",\n\t\"forum:post:create\",\n\t\"forum:read\",\n\t\"identity:read\",\n\t\"identity:write\",\n\t\"invoice:basic:read\",\n\t\"invoice:create\",\n\t\"invoice:update\",\n\t\"lead:basic:read\",\n\t\"lead:manage\",\n\t\"livestream:chat:read\",\n\t\"livestream:chat:write\",\n\t\"livestream:create\",\n\t\"livestream:delete\",\n\t\"livestream:manage_recording\",\n\t\"livestream:moderate\",\n\t\"member:basic:read\",\n\t\"member:email:read\",\n\t\"member:journey:read\",\n\t\"member:manage\",\n\t\"member:moderate\",\n\t\"member:payment_methods:manage\",\n\t\"member:payment_methods:read\",\n\t\"member:phone:read\",\n\t\"member:stats:read\",\n\t\"membership:cancel\",\n\t\"membership:update\",\n\t\"notification:create\",\n\t\"openid\",\n\t\"payment:basic:read\",\n\t\"payment:charge\",\n\t\"payment:dispute\",\n\t\"payment:dispute:read\",\n\t\"payment:dispute_alert:read\",\n\t\"payment:manage\",\n\t\"payment:resolution_center\",\n\t\"payment:resolution_center_case:read\",\n\t\"payment:setup_intent:read\",\n\t\"payout:account:read\",\n\t\"payout:account:update\",\n\t\"payout:create_destination\",\n\t\"payout:delete_destination\",\n\t\"payout:destination:read\",\n\t\"payout:transfer:export\",\n\t\"payout:transfer:read\",\n\t\"payout:update_destination\",\n\t\"payout:withdraw_funds\",\n\t\"payout:withdrawal:read\",\n\t\"plan:basic:export\",\n\t\"plan:basic:read\",\n\t\"plan:create\",\n\t\"plan:delete\",\n\t\"plan:stats:export\",\n\t\"plan:stats:read\",\n\t\"plan:update\",\n\t\"plan:waitlist:export\",\n\t\"plan:waitlist:manage\",\n\t\"plan:waitlist:read\",\n\t\"profile\",\n\t\"promo_code:basic:export\",\n\t\"promo_code:basic:read\",\n\t\"promo_code:create\",\n\t\"promo_code:delete\",\n\t\"promo_code:update\",\n\t\"shipment:basic:read\",\n\t\"shipment:create\",\n\t\"social_link:update\",\n\t\"stats:read\",\n\t\"support_chat:create\",\n\t\"support_chat:message:create\",\n\t\"support_chat:read\",\n\t\"tracking_link:basic:export\",\n\t\"tracking_link:basic:read\",\n\t\"tracking_link:create\",\n\t\"tracking_link:delete\",\n\t\"tracking_link:stats:export\",\n\t\"tracking_link:stats:read\",\n\t\"tracking_link:update\",\n\t\"user:balance:read\",\n\t\"user:profile:update\",\n] as const;\n\nexport type WhopScope = (typeof WHOP_SCOPES)[number];\n","import { readConfig, writeConfig } from \"./config\";\nimport { deleteSecret, getSecret, setSecret } from \"./keyring\";\nimport { refreshAccessToken } from \"./oauth\";\nimport type { AuthMethod, Identity, Profile } from \"./types\";\n\n/** 60-second buffer — refresh before the token actually expires. */\nconst EXPIRY_BUFFER_MS = 60_000;\n\n/**\n * The OAuth secret stored in the keychain: the long-lived refresh token plus a\n * cached short-lived access token and its expiry. Kept together as one keychain\n * entry so the access token never lands in the plaintext config file, and so a\n * rotated refresh token is written atomically with the access token it pairs\n * with (the backend invalidates the old refresh token on rotation).\n */\ninterface OAuthSecret {\n\trefreshToken: string;\n\taccessToken?: string;\n\ttokenExpiresAt?: string;\n}\n\n/** Parses the stored keychain secret, tolerating the legacy plain refresh-token string. */\nfunction parseOAuthSecret(raw: string): OAuthSecret {\n\ttry {\n\t\tconst parsed = JSON.parse(raw) as unknown;\n\t\tif (\n\t\t\tparsed != null &&\n\t\t\ttypeof parsed === \"object\" &&\n\t\t\ttypeof (parsed as OAuthSecret).refreshToken === \"string\"\n\t\t) {\n\t\t\treturn parsed as OAuthSecret;\n\t\t}\n\t} catch {\n\t\t// Not JSON — fall through to the legacy plain refresh-token form.\n\t}\n\treturn { refreshToken: raw };\n}\n\n/**\n * Returns a valid Bearer token for the given profile, handling both auth\n * methods transparently:\n * - api_key: returns the raw API key from the keychain.\n * - oauth: returns the cached access token if still valid, otherwise uses the\n * stored refresh token to obtain a new one and persists it to the keychain.\n */\nexport async function getValidAccessToken(\n\tprofile: Profile,\n): Promise<string | null> {\n\tif (profile.method === \"api_key\") {\n\t\treturn getSecret(profile.name);\n\t}\n\n\tconst raw = getSecret(profile.name);\n\tif (!raw) return null;\n\tconst secret = parseOAuthSecret(raw);\n\n\tif (secret.accessToken && secret.tokenExpiresAt) {\n\t\tconst expiresAt = new Date(secret.tokenExpiresAt).getTime();\n\t\tif (Date.now() < expiresAt - EXPIRY_BUFFER_MS) {\n\t\t\treturn secret.accessToken;\n\t\t}\n\t}\n\n\tlet refreshed: Awaited<ReturnType<typeof refreshAccessToken>>;\n\ttry {\n\t\trefreshed = await refreshAccessToken(secret.refreshToken);\n\t} catch {\n\t\t// Refresh token expired/revoked, or a transient network failure. Surface\n\t\t// it as \"no usable credential\" (null) so the caller returns the clean\n\t\t// \"Run `whop login` again\" 401 instead of crashing with a raw stack trace.\n\t\treturn null;\n\t}\n\tconst tokenExpiresAt = new Date(\n\t\tDate.now() + refreshed.expiresIn * 1000,\n\t).toISOString();\n\n\tsetSecret(\n\t\tprofile.name,\n\t\tJSON.stringify({\n\t\t\trefreshToken: refreshed.refreshToken,\n\t\t\taccessToken: refreshed.accessToken,\n\t\t\ttokenExpiresAt,\n\t\t} satisfies OAuthSecret),\n\t);\n\n\treturn refreshed.accessToken;\n}\n\n/**\n * Profile orchestration — the only module that writes both the config file and\n * the keychain, keeping them consistent.\n */\n\nexport function listProfiles(env: NodeJS.ProcessEnv = process.env): Profile[] {\n\treturn readConfig(env).profiles;\n}\n\nexport function getActiveProfile(\n\tenv: NodeJS.ProcessEnv = process.env,\n): Profile | null {\n\tconst config = readConfig(env);\n\tif (!config.activeProfile) return null;\n\treturn (\n\t\tconfig.profiles.find((profile) => profile.name === config.activeProfile) ??\n\t\tnull\n\t);\n}\n\nfunction slugify(value: string): string {\n\treturn value\n\t\t.toLowerCase()\n\t\t.replace(/[^a-z0-9]+/g, \"-\")\n\t\t.replace(/^-+|-+$/g, \"\")\n\t\t.slice(0, 32);\n}\n\n/** Picks a default profile name from the identity, slugified: email local-part → route → title → id → fallback. */\nexport function deriveProfileName(\n\tidentity: Identity,\n\tfallback = \"default\",\n): string {\n\tif (identity.email) return slugify(identity.email.split(\"@\")[0]) || fallback;\n\tif (identity.route) return slugify(identity.route) || fallback;\n\tif (identity.title) return slugify(identity.title) || fallback;\n\tif (identity.id) return identity.id;\n\treturn fallback;\n}\n\n/** Adds or replaces a profile (dedupe by name), stores its secret, and makes it active. */\nexport function upsertProfile(\n\tinput: {\n\t\tname: string;\n\t\tmethod: AuthMethod;\n\t\tsecret: string;\n\t\tidentity: Identity;\n\t\t/** OAuth only: cached access token */\n\t\taccessToken?: string;\n\t\t/** OAuth only: ISO expiry timestamp for accessToken */\n\t\ttokenExpiresAt?: string;\n\t},\n\tenv: NodeJS.ProcessEnv = process.env,\n): Profile {\n\tconst config = readConfig(env);\n\tconst existing = config.profiles.find(\n\t\t(profile) => profile.name === input.name,\n\t);\n\tconst isOauth = input.method === \"oauth\";\n\tconst profile: Profile = {\n\t\tname: input.name,\n\t\tmethod: input.method,\n\t\t// Company identity (api_key only): the authenticated company.\n\t\tcompanyId: isOauth ? undefined : input.identity.id,\n\t\t// Display label for both methods — a company name or a user name.\n\t\tcompanyTitle: input.identity.title,\n\t\tcompanyRoute: isOauth ? undefined : input.identity.route,\n\t\t// User identity (oauth only): the authenticated user.\n\t\tuserId: isOauth ? input.identity.id : undefined,\n\t\tuserEmail: isOauth ? input.identity.email : undefined,\n\t\tcreatedAt: existing?.createdAt ?? new Date().toISOString(),\n\t};\n\tconfig.profiles = [\n\t\t...config.profiles.filter((p) => p.name !== input.name),\n\t\tprofile,\n\t];\n\tconfig.activeProfile = input.name;\n\twriteConfig(config, env);\n\t// oauth secrets are stored as a JSON blob (refresh + cached access token);\n\t// api_key stores the raw key. The access token never touches the config file.\n\tconst secret =\n\t\tinput.method === \"oauth\"\n\t\t\t? JSON.stringify({\n\t\t\t\t\trefreshToken: input.secret,\n\t\t\t\t\taccessToken: input.accessToken,\n\t\t\t\t\ttokenExpiresAt: input.tokenExpiresAt,\n\t\t\t\t} satisfies OAuthSecret)\n\t\t\t: input.secret;\n\tsetSecret(input.name, secret);\n\treturn profile;\n}\n\n/** Removes a profile and its secret; if it was active, the first remaining profile becomes active. */\nexport function removeProfile(\n\tname: string,\n\tenv: NodeJS.ProcessEnv = process.env,\n): { removed: boolean; newActive: string | null } {\n\tconst config = readConfig(env);\n\tconst existed = config.profiles.some((profile) => profile.name === name);\n\tconfig.profiles = config.profiles.filter((profile) => profile.name !== name);\n\tif (config.activeProfile === name) {\n\t\tconfig.activeProfile = config.profiles[0]?.name;\n\t}\n\twriteConfig(config, env);\n\tdeleteSecret(name);\n\treturn { removed: existed, newActive: config.activeProfile ?? null };\n}\n\n/** Makes a profile active. Returns null if no such profile exists. */\nexport function switchProfile(\n\tname: string,\n\tenv: NodeJS.ProcessEnv = process.env,\n): Profile | null {\n\tconst config = readConfig(env);\n\tconst profile = config.profiles.find((p) => p.name === name);\n\tif (!profile) return null;\n\tconfig.activeProfile = name;\n\twriteConfig(config, env);\n\treturn profile;\n}\n","import nativeSpec from \"./native-spec.json\" with { type: \"json\" };\nimport { apiBaseUrl } from \"../auth/client\";\nimport { getActiveProfile, getValidAccessToken } from \"../auth/profiles\";\n\nconst HTTP_METHODS = new Set([\"get\", \"put\", \"post\", \"delete\", \"options\", \"head\", \"patch\", \"trace\"]);\n\nexport { nativeSpec };\n\n/**\n * Returns a filtered copy of the spec containing only paths whose operations\n * carry the given tag. Passed to incur's `{ fetch, openapi }` command to\n * auto-generate typed subcommands for one command group at a time.\n */\nexport function filterSpecByTag(\n\tspec: Record<string, unknown>,\n\ttag: string,\n): Record<string, unknown> {\n\tconst paths: Record<string, Record<string, unknown>> = {};\n\tfor (const [path, methods] of Object.entries(\n\t\tspec.paths as Record<string, Record<string, unknown>>,\n\t)) {\n\t\tconst filtered: Record<string, unknown> = {};\n\t\tconst nonOpEntries: [string, unknown][] = [];\n\t\tfor (const [method, op] of Object.entries(methods)) {\n\t\t\tif (!HTTP_METHODS.has(method)) { nonOpEntries.push([method, op]); continue; }\n\t\t\tconst tags = (op as Record<string, unknown>).tags;\n\t\t\tif (Array.isArray(tags) && tags.includes(tag)) filtered[method] = op;\n\t\t}\n\t\tif (Object.keys(filtered).length > 0) {\n\t\t\tfor (const [k, v] of nonOpEntries) filtered[k] = v;\n\t\t\tpaths[path] = filtered;\n\t\t}\n\t}\n\treturn { ...spec, paths };\n}\n\n/**\n * Returns a fetch handler that proxies requests to the Whop API, injecting\n * the active profile's API key as a Bearer token. Passed to incur's\n * `{ fetch, openapi }` command to auto-generate typed subcommands from the spec.\n */\nexport function createWhopFetch(): (request: Request) => Promise<Response> {\n\treturn async (request: Request): Promise<Response> => {\n\t\tconst profile = getActiveProfile();\n\t\tif (!profile) {\n\t\t\treturn Response.json(\n\t\t\t\t{ error: \"Not logged in. Run `whop login` first.\" },\n\t\t\t\t{ status: 401 },\n\t\t\t);\n\t\t}\n\n\t\tconst apiKey = await getValidAccessToken(profile);\n\t\tif (!apiKey) {\n\t\t\treturn Response.json(\n\t\t\t\t{ error: \"Stored credential not found. Run `whop login` again.\" },\n\t\t\t\t{ status: 401 },\n\t\t\t);\n\t\t}\n\n\t\tconst incomingUrl = new URL(request.url);\n\t\tconst base = apiBaseUrl().replace(/\\/$/, \"\");\n\t\tconst target = `${base}${incomingUrl.pathname}${incomingUrl.search}`;\n\n\t\tconst headers = new Headers(request.headers);\n\t\theaders.set(\"Authorization\", `Bearer ${apiKey}`);\n\t\theaders.set(\"Content-Type\", \"application/json\");\n\n\t\tconst body = request.body ? await request.text() : undefined;\n\n\t\treturn fetch(target, {\n\t\t\tmethod: request.method,\n\t\t\theaders,\n\t\t\tbody,\n\t\t});\n\t};\n}\n","[\n [\n \"accounts\",\n \"Accounts\"\n ],\n [\n \"users\",\n \"Users\"\n ],\n [\n \"products\",\n \"Products\"\n ],\n [\n \"stats\",\n \"Stats\"\n ],\n [\n \"balances\",\n \"Balances\"\n ],\n [\n \"ledgers\",\n \"Ledgers\"\n ],\n [\n \"payouts\",\n \"Payouts\"\n ],\n [\n \"transfers\",\n \"Transfers\"\n ],\n [\n \"deposits\",\n \"Deposits\"\n ],\n [\n \"swaps\",\n \"Swaps\"\n ],\n [\n \"plans\",\n \"Plans\"\n ]\n]\n","{\n\t\"name\": \"@whop/cli\",\n\t\"version\": \"0.0.3\",\n\t\"description\": \"The Whop CLI — build and manage Whop apps from your terminal. Human and agent friendly.\",\n\t\"keywords\": [\n\t\t\"agent\",\n\t\t\"apps\",\n\t\t\"cli\",\n\t\t\"developer\",\n\t\t\"whop\"\n\t],\n\t\"homepage\": \"https://whop.com/developers/\",\n\t\"bugs\": \"https://github.com/whopio/whop-sdk-ts/issues\",\n\t\"license\": \"MIT\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"https://github.com/whopio/whop-sdk-ts\",\n\t\t\"directory\": \"packages/cli\"\n\t},\n\t\"bin\": {\n\t\t\"whop\": \"./dist/index.js\"\n\t},\n\t\"files\": [\n\t\t\"dist\"\n\t],\n\t\"type\": \"module\",\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"scripts\": {\n\t\t\"build\": \"tsx scripts/sync-spec.ts && pnpm run clean && tsup\",\n\t\t\"clean\": \"rm -rf dist\",\n\t\t\"dev\": \"tsx scripts/sync-spec.ts && tsx src/index.ts\",\n\t\t\"start\": \"node dist/index.js\",\n\t\t\"check-types\": \"tsx scripts/sync-spec.ts && tsc --noEmit\",\n\t\t\"lint\": \"oxlint .\",\n\t\t\"lint:fix\": \"oxlint --fix --fix-suggestions && oxfmt\",\n\t\t\"ci:lint\": \"oxlint -f github .\",\n\t\t\"format\": \"oxfmt\",\n\t\t\"sync-spec\": \"tsx scripts/sync-spec.ts\",\n\t\t\"test\": \"tsx --test scripts/*.test.ts\"\n\t},\n\t\"dependencies\": {\n\t\t\"@clack/prompts\": \"^1.5.1\",\n\t\t\"@napi-rs/keyring\": \"^1.3.0\",\n\t\t\"@whop/sdk\": \"^0.0.40\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@types/node\": \"25.3.5\",\n\t\t\"incur\": \"whopio/incur#ea62f88\",\n\t\t\"tsup\": \"8.5.0\",\n\t\t\"tsx\": \"4.19.4\",\n\t\t\"typescript\": \"5.9.3\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=22\"\n\t},\n\t\"packageManager\": \"pnpm@10.23.0\"\n}\n","const BOLD = '\\x1b[1m'\nconst RESET = '\\x1b[0m'\nconst DIM = '\\x1b[2m'\n\nconst MAX_CELL_WIDTH = 40\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction isObjectArray(value: unknown): value is Record<string, unknown>[] {\n return Array.isArray(value) && value.length > 0 && value.every(isPlainObject)\n}\n\n/** Converts a cell value to a display string, truncating at MAX_CELL_WIDTH characters. */\nfunction formatCell(value: unknown): string {\n if (value == null) return ''\n const text = String(value)\n return text.length > MAX_CELL_WIDTH ? text.slice(0, MAX_CELL_WIDTH - 1) + '…' : text\n}\n\n/** Total printable width of one row: sum of column widths plus two-space separators between them. */\nfunction totalRowWidth(colWidths: number[]): number {\n const columnTotal = colWidths.reduce((sum, colWidth) => sum + colWidth, 0)\n return columnTotal + (colWidths.length - 1) * 2\n}\n\n/**\n * Renders an array of plain objects as an aligned terminal grid.\n * Drops columns from the right when the row would exceed the terminal width.\n */\nfunction renderRows(rows: Record<string, unknown>[]): string {\n // Only include keys that are scalar across every row — a column where some rows\n // have an object and others have null would render as \"[object Object]\".\n const isScalar = (value: unknown) => typeof value !== 'object' || value === null\n const scalarKeys = Object.keys(rows[0]!).filter((key) =>\n rows.every((row) => isScalar(row[key])),\n )\n\n if (scalarKeys.length === 0) return '(no displayable columns)'\n\n // Column width = max of the header label and the widest cell value across all rows.\n const allWidths = scalarKeys.map((key) =>\n Math.max(key.length, ...rows.map((row) => formatCell(row[key]).length)),\n )\n\n // Drop the rightmost columns until the row fits within the terminal width.\n const termWidth = process.stdout.columns ?? 80\n let numVisible = allWidths.length\n while (numVisible > 1 && totalRowWidth(allWidths.slice(0, numVisible)) > termWidth) {\n numVisible--\n }\n\n const visibleKeys = scalarKeys.slice(0, numVisible)\n const visibleWidths = allWidths.slice(0, numVisible)\n\n const header = visibleKeys\n .map((key, i) => BOLD + key.toUpperCase().padEnd(visibleWidths[i]!) + RESET)\n .join(' ')\n\n const separator = DIM + visibleWidths.map((w) => '─'.repeat(w)).join('──') + RESET\n\n const body = rows.map((row) =>\n visibleKeys\n .map((key, i) => {\n const value = row[key]\n const formatted = formatCell(value)\n // Right-align numbers, left-align everything else.\n return typeof value === 'number'\n ? formatted.padStart(visibleWidths[i]!)\n : formatted.padEnd(visibleWidths[i]!)\n })\n .join(' '),\n )\n\n const hiddenCount = scalarKeys.length - numVisible\n const overflowHint =\n hiddenCount > 0\n ? `\\n${DIM}& ${hiddenCount} more columns — use --format json to see all${RESET}`\n : ''\n\n return [header, separator, ...body].join('\\n') + overflowHint\n}\n\n/**\n * Human-mode renderer passed to incur as `renderer`.\n * Handles top-level arrays and single-array wrapped responses (e.g. `{ accounts: [...], pagination: {...} }`).\n * Returns null for anything that can't be meaningfully rendered as a grid, falling back to incur's TOON formatter.\n */\nexport function render(data: unknown): string | null {\n if (isObjectArray(data)) return renderRows(data)\n\n if (isPlainObject(data)) {\n const arrayFields = Object.values(data).filter(isObjectArray)\n // Only render when there's exactly one array field — avoids guessing which to show.\n if (arrayFields.length === 1) {\n return renderRows(arrayFields[0] as Record<string, unknown>[])\n }\n }\n\n return null\n}\n","import { Cli, z } from \"incur\";\nimport { validateApiKey, apiBaseUrl } from \"./client\";\nimport { readConfig } from \"./config\";\nimport { getSecret } from \"./keyring\";\nimport { OAuthError, performOAuthLogin } from \"./oauth\";\nimport {\n\tderiveProfileName,\n\tgetActiveProfile,\n\tgetValidAccessToken,\n\tlistProfiles,\n\tremoveProfile,\n\tswitchProfile,\n\tupsertProfile,\n} from \"./profiles\";\nimport {\n\tchooseAuthMethod,\n\tPromptCancelledError,\n\tpromptApiKey,\n\tselectProfile,\n\tstartSpinner,\n} from \"./prompts\";\nimport { AuthMethod, Identity, Profile } from \"./types\";\n\n/**\n * Auth commands: `whop auth login | logout | switch | status | list`.\n *\n * The login/logout business logic is context-free (`performLogin`,\n * `removeProfile`) and the incur run handlers are thin adapters. `loginAdapter`\n * and `logoutAdapter` are shared so the top-level `whop login` / `whop logout`\n * (registered in `index.ts`) behave identically without duplicating logic —\n * incur aliases can't cross from a group into a top-level command.\n */\n\n// --- CTA / error shapes accepted by the run context (kept minimal & structural) ---\ntype CtaCommand =\n\t| string\n\t| {\n\t\t\tcommand: string;\n\t\t\tdescription?: string | undefined;\n\t\t\toptions?: Record<string, unknown> | undefined;\n\t\t\targs?: Record<string, unknown> | undefined;\n\t };\ntype CtaInput = { description?: string | undefined; commands: CtaCommand[] };\ntype ErrorInput = {\n\tcode: string;\n\tmessage: string;\n\tcta?: CtaInput | undefined;\n\texitCode?: number | undefined;\n\tretryable?: boolean | undefined;\n};\n\n// --- Shared schemas ---\nexport const loginOptions = z.object({\n\tapiKey: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"API key for non-interactive login (skips the prompt)\"),\n\tprofile: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Name for this profile (defaults to the company route)\"),\n});\n\nexport const loginEnv = z.object({\n\tWHOP_API_KEY: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"API key for non-interactive login\"),\n\tWHOP_API_BASE_URL: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Override the Whop API base URL\"),\n\tWHOP_CONFIG_DIR: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Override the CLI config directory\"),\n});\n\nexport const loginOutput = z.object({\n\tprofile: z.string().describe(\"The profile name\"),\n\tactive: z.boolean().describe(\"Whether this profile is now the active one\"),\n\tmethod: AuthMethod.describe(\"The authentication method\"),\n\tidentity: Identity.describe(\"The authenticated company identity\"),\n});\nexport type LoginOutput = z.infer<typeof loginOutput>;\n\nexport const logoutOptions = z.object({\n\tprofile: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Profile to remove (defaults to the active profile)\"),\n});\nexport const logoutOutput = z.object({\n\tremoved: z.string().describe(\"The removed profile name\"),\n\tnewActive: z\n\t\t.string()\n\t\t.nullable()\n\t\t.describe(\"The profile that is now active, if any\"),\n});\nexport type LogoutOutput = z.infer<typeof logoutOutput>;\n\nconst statusOutput = z.object({\n\tloggedIn: z\n\t\t.boolean()\n\t\t.describe(\"Whether the active profile has a usable stored credential\"),\n\tprofile: z.string().nullable(),\n\tmethod: AuthMethod.nullable(),\n\tidentity: Identity.nullable(),\n\thasSecret: z\n\t\t.boolean()\n\t\t.describe(\"Whether a secret was found in the OS keychain for this profile\"),\n});\n\nconst listOutput = z.object({\n\tactive: z.string().nullable(),\n\tprofiles: z.array(Profile),\n});\n\nconst switchArgs = z.object({\n\tname: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Profile to switch to (interactive picker if omitted)\"),\n});\nconst switchOutput = z.object({\n\tactive: z.string().describe(\"The newly active profile\"),\n});\n\nexport const loginExamples = [\n\t{ description: \"Interactive login\" },\n\t{\n\t\toptions: { apiKey: \"whop_xxx\" },\n\t\tdescription: \"Non-interactive login (CI / agents)\",\n\t},\n\t{\n\t\toptions: { apiKey: \"whop_xxx\", profile: \"prod\" },\n\t\tdescription: \"Log in and name the profile\",\n\t},\n];\nexport const loginHint =\n\t\"Agents / CI: pass --api-key or set WHOP_API_KEY to skip the prompt.\";\n\n// --- Context-free login flows ---\ntype LoginResult =\n\t| { ok: true; output: LoginOutput; existed: boolean; underscoped: boolean }\n\t| { ok: false; code: string; message: string };\n\nasync function performLogin(input: {\n\tagent: boolean;\n\tapiKey?: string | undefined;\n\tprofile?: string | undefined;\n}): Promise<LoginResult> {\n\tlet method: AuthMethod = \"api_key\";\n\tif (!input.agent && !input.apiKey) method = await chooseAuthMethod();\n\n\t// Route to the OAuth browser flow.\n\tif (method === \"oauth\") {\n\t\ttry {\n\t\t\tconst { profileName, identity, existed } = await performOAuthLogin({\n\t\t\t\tprofile: input.profile,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\texisted,\n\t\t\t\tunderscoped: false,\n\t\t\t\toutput: {\n\t\t\t\t\tprofile: profileName,\n\t\t\t\t\tactive: true,\n\t\t\t\t\tmethod: \"oauth\",\n\t\t\t\t\tidentity,\n\t\t\t\t},\n\t\t\t};\n\t\t} catch (err) {\n\t\t\tif (err instanceof OAuthError) {\n\t\t\t\treturn { ok: false, code: err.code, message: err.message };\n\t\t\t}\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\t// Resolve the API key: flag/env > interactive prompt > error in agent mode.\n\tlet apiKey = input.apiKey;\n\tif (!apiKey) {\n\t\tif (input.agent) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tcode: \"API_KEY_REQUIRED\",\n\t\t\t\tmessage: \"No API key provided and not running interactively.\",\n\t\t\t};\n\t\t}\n\t\tapiKey = await promptApiKey();\n\t}\n\t// Normalize: the SDK adds the `Bearer ` prefix itself, so strip one if pasted.\n\tconst key = apiKey.replace(/^Bearer\\s+/i, \"\").trim();\n\n\t// 3. Validate against the API.\n\tlet result: Awaited<ReturnType<typeof validateApiKey>>;\n\tif (input.agent) {\n\t\tresult = await validateApiKey(key, apiBaseUrl());\n\t} else {\n\t\tconst s = startSpinner(\"Validating API key…\");\n\t\tresult = await validateApiKey(key, apiBaseUrl());\n\t\tconst okay = result.status === \"valid\" || result.status === \"underscoped\";\n\t\ts.stop(okay ? \"API key validated.\" : \"API key check failed.\");\n\t}\n\tif (result.status === \"invalid\") {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tcode: \"INVALID_API_KEY\",\n\t\t\tmessage: \"That API key was rejected (401 Unauthorized).\",\n\t\t};\n\t}\n\tif (result.status === \"error\") {\n\t\treturn { ok: false, code: \"VALIDATION_FAILED\", message: result.message };\n\t}\n\n\t// 4. Persist (secret → keychain, metadata → config) and activate.\n\tconst identity = result.identity;\n\tconst name = input.profile ?? deriveProfileName(identity);\n\tconst existed = listProfiles().some((profile) => profile.name === name);\n\tconst profile = upsertProfile({ name, method, secret: key, identity });\n\n\treturn {\n\t\tok: true,\n\t\texisted,\n\t\tunderscoped: result.status === \"underscoped\",\n\t\toutput: { profile: profile.name, active: true, method, identity },\n\t};\n}\n\n// --- Shared adapters (used by the group command and the top-level alias) ---\ntype LoginAdapterCtx = {\n\tagent: boolean;\n\toptions: { apiKey?: string | undefined; profile?: string | undefined };\n\tenv: { WHOP_API_KEY?: string | undefined };\n\tok: (data: LoginOutput, meta?: { cta?: CtaInput | undefined }) => never;\n\terror: (options: ErrorInput) => never;\n};\n\nexport async function loginAdapter(c: LoginAdapterCtx): Promise<never> {\n\tlet result: LoginResult;\n\ttry {\n\t\tresult = await performLogin({\n\t\t\tagent: c.agent,\n\t\t\tapiKey: c.options.apiKey ?? c.env.WHOP_API_KEY,\n\t\t\tprofile: c.options.profile,\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof PromptCancelledError) {\n\t\t\treturn c.error({\n\t\t\t\tcode: \"CANCELLED\",\n\t\t\t\tmessage: \"Login cancelled.\",\n\t\t\t\texitCode: 130,\n\t\t\t});\n\t\t}\n\t\tthrow error;\n\t}\n\n\tif (!result.ok) {\n\t\treturn c.error({\n\t\t\tcode: result.code,\n\t\t\tmessage: result.message,\n\t\t\tretryable: result.code !== \"INVALID_API_KEY\",\n\t\t\tcta:\n\t\t\t\tresult.code === \"API_KEY_REQUIRED\"\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tdescription: \"Provide a key non-interactively:\",\n\t\t\t\t\t\t\tcommands: [\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\tcommand: \"auth login\",\n\t\t\t\t\t\t\t\t\toptions: { apiKey: true },\n\t\t\t\t\t\t\t\t\tdescription: \"Pass --api-key <key>\",\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t}\n\t\t\t\t\t: undefined,\n\t\t});\n\t}\n\n\treturn c.ok(result.output, {\n\t\tcta: {\n\t\t\tdescription: result.existed\n\t\t\t\t? \"Updated and switched to this profile:\"\n\t\t\t\t: \"You're logged in:\",\n\t\t\tcommands: [\n\t\t\t\t{ command: \"auth status\", description: \"Show the active identity\" },\n\t\t\t\t{ command: \"auth list\", description: \"List all profiles\" },\n\t\t\t],\n\t\t},\n\t});\n}\n\ntype LogoutAdapterCtx = {\n\toptions: { profile?: string | undefined };\n\tok: (data: LogoutOutput, meta?: { cta?: CtaInput | undefined }) => never;\n\terror: (options: ErrorInput) => never;\n};\n\nexport function logoutAdapter(c: LogoutAdapterCtx): never {\n\tconst target = c.options.profile ?? getActiveProfile()?.name;\n\tif (!target) {\n\t\treturn c.error({\n\t\t\tcode: \"NO_ACTIVE_PROFILE\",\n\t\t\tmessage: \"No active profile to log out from.\",\n\t\t\tretryable: false,\n\t\t\tcta: {\n\t\t\t\tdescription: \"Log in first:\",\n\t\t\t\tcommands: [{ command: \"auth login\", description: \"Log in to Whop\" }],\n\t\t\t},\n\t\t});\n\t}\n\tconst { removed, newActive } = removeProfile(target);\n\tif (!removed) {\n\t\treturn c.error({\n\t\t\tcode: \"PROFILE_NOT_FOUND\",\n\t\t\tmessage: `No profile named \"${target}\".`,\n\t\t\tretryable: false,\n\t\t});\n\t}\n\treturn c.ok(\n\t\t{ removed: target, newActive },\n\t\tnewActive\n\t\t\t? {\n\t\t\t\t\tcta: {\n\t\t\t\t\t\tdescription: `Now using \"${newActive}\".`,\n\t\t\t\t\t\tcommands: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcommand: \"auth status\",\n\t\t\t\t\t\t\t\tdescription: \"Show the active identity\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: undefined,\n\t);\n}\n\n// --- The `auth` command group ---\nexport function buildAuthGroup() {\n\tconst auth = Cli.create(\"auth\", {\n\t\tdescription: \"Manage Whop authentication\",\n\t});\n\n\tauth.command(\"login\", {\n\t\tdescription: \"Log in to Whop\",\n\t\taliases: [\"add\"],\n\t\toptions: loginOptions,\n\t\tenv: loginEnv,\n\t\toutput: loginOutput,\n\t\texamples: loginExamples,\n\t\thint: loginHint,\n\t\trun: (c) => loginAdapter(c),\n\t});\n\n\tauth.command(\"logout\", {\n\t\tdescription: \"Log out — remove a saved profile\",\n\t\taliases: [\"remove\", \"rm\"],\n\t\toptions: logoutOptions,\n\t\toutput: logoutOutput,\n\t\trun: (c) => logoutAdapter(c),\n\t});\n\n\tauth.command(\"switch\", {\n\t\tdescription: \"Switch the active profile\",\n\t\targs: switchArgs,\n\t\toutput: switchOutput,\n\t\trun: async (c) => {\n\t\t\tconst profiles = listProfiles();\n\t\t\tif (profiles.length === 0) {\n\t\t\t\treturn c.error({\n\t\t\t\t\tcode: \"NO_PROFILES\",\n\t\t\t\t\tmessage: \"No profiles yet — log in first.\",\n\t\t\t\t\tretryable: true,\n\t\t\t\t\tcta: {\n\t\t\t\t\t\tdescription: \"To authenticate:\",\n\t\t\t\t\t\tcommands: [\n\t\t\t\t\t\t\t{ command: \"auth login\", description: \"Log in to Whop\" },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet name = c.args.name;\n\t\t\tif (!name) {\n\t\t\t\tif (c.agent) {\n\t\t\t\t\treturn c.error({\n\t\t\t\t\t\tcode: \"PROFILE_REQUIRED\",\n\t\t\t\t\t\tmessage: `Specify a profile name. Available: ${profiles.map((p) => p.name).join(\", \")}.`,\n\t\t\t\t\t\tretryable: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tname = await selectProfile(profiles);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof PromptCancelledError) {\n\t\t\t\t\t\treturn c.error({\n\t\t\t\t\t\t\tcode: \"CANCELLED\",\n\t\t\t\t\t\t\tmessage: \"Switch cancelled.\",\n\t\t\t\t\t\t\texitCode: 130,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst profile = switchProfile(name);\n\t\t\tif (!profile) {\n\t\t\t\treturn c.error({\n\t\t\t\t\tcode: \"PROFILE_NOT_FOUND\",\n\t\t\t\t\tmessage: `No profile named \"${name}\". Available: ${profiles.map((p) => p.name).join(\", \")}.`,\n\t\t\t\t\tretryable: true,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn c.ok(\n\t\t\t\t{ active: profile.name },\n\t\t\t\t{\n\t\t\t\t\tcta: {\n\t\t\t\t\t\tcommands: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcommand: \"auth status\",\n\t\t\t\t\t\t\t\tdescription: \"Show the active identity\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\t\t},\n\t});\n\n\tauth.command(\"status\", {\n\t\tdescription: \"Show the active identity (whoami)\",\n\t\taliases: [\"whoami\"],\n\t\toutput: statusOutput,\n\t\trun: async (c) => {\n\t\t\tconst profile = getActiveProfile();\n\t\t\tif (!profile) {\n\t\t\t\treturn c.ok(\n\t\t\t\t\t{\n\t\t\t\t\t\tloggedIn: false,\n\t\t\t\t\t\tprofile: null,\n\t\t\t\t\t\tmethod: null,\n\t\t\t\t\t\tidentity: null,\n\t\t\t\t\t\thasSecret: false,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcta: {\n\t\t\t\t\t\t\tdescription: \"To authenticate:\",\n\t\t\t\t\t\t\tcommands: [\n\t\t\t\t\t\t\t\t{ command: \"auth login\", description: \"Log in to Whop\" },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst hasSecret = getSecret(profile.name) !== null;\n\t\t\t// \"Logged in\" means we can actually obtain a Bearer token. For oauth\n\t\t\t// this may refresh the access token; a revoked/expired refresh token\n\t\t\t// resolves to null instead of throwing, so the reported state is honest.\n\t\t\tlet loggedIn = hasSecret;\n\t\t\tif (hasSecret) {\n\t\t\t\ttry {\n\t\t\t\t\tloggedIn = (await getValidAccessToken(profile)) !== null;\n\t\t\t\t} catch {\n\t\t\t\t\tloggedIn = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn c.ok(\n\t\t\t\t{\n\t\t\t\t\tloggedIn,\n\t\t\t\t\tprofile: profile.name,\n\t\t\t\t\tmethod: profile.method,\n\t\t\t\t\tidentity:\n\t\t\t\t\t\tprofile.method === \"oauth\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tid: profile.userId,\n\t\t\t\t\t\t\t\t\ttitle: profile.companyTitle,\n\t\t\t\t\t\t\t\t\temail: profile.userEmail,\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: {\n\t\t\t\t\t\t\t\t\tid: profile.companyId,\n\t\t\t\t\t\t\t\t\ttitle: profile.companyTitle,\n\t\t\t\t\t\t\t\t\troute: profile.companyRoute,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\thasSecret,\n\t\t\t\t},\n\t\t\t\tloggedIn\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tcta: {\n\t\t\t\t\t\t\t\tdescription: hasSecret\n\t\t\t\t\t\t\t\t\t? \"Your session is no longer valid — log in again:\"\n\t\t\t\t\t\t\t\t\t: \"The stored secret is missing — log in again:\",\n\t\t\t\t\t\t\t\tcommands: [\n\t\t\t\t\t\t\t\t\t{ command: \"auth login\", description: \"Log in to Whop\" },\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t);\n\t\t},\n\t});\n\n\tauth.command(\"list\", {\n\t\tdescription: \"List saved authentication profiles\",\n\t\taliases: [\"ls\"],\n\t\toutput: listOutput,\n\t\trun: () => {\n\t\t\tconst { activeProfile, profiles } = readConfig();\n\t\t\tconst active =\n\t\t\t\tprofiles.find((p) => p.name === activeProfile)?.name ?? null;\n\t\t\treturn { active, profiles };\n\t\t},\n\t});\n\n\treturn auth;\n}\n","import { Cli } from \"incur\";\nimport { nativeSpec, filterSpecByTag, createWhopFetch } from \"./api\";\nimport groups from \"./api/groups.json\" with { type: \"json\" };\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport { render } from \"./lib/renderer\";\nimport {\n\tbuildAuthGroup,\n\tloginAdapter,\n\tloginEnv,\n\tloginExamples,\n\tloginHint,\n\tloginOptions,\n\tloginOutput,\n\tlogoutAdapter,\n\tlogoutOptions,\n\tlogoutOutput,\n} from \"./auth/commands\";\n\n/**\n * The public Whop CLI.\n *\n * Built with incur (https://www.npmjs.com/package/incur), so every command is\n * both human-friendly (readable help and output) and agent-friendly out of the\n * box: typed `args`/`options`/`output` schemas, a `--llms` manifest,\n * `--format json|toon|yaml|md|jsonl`, `--schema`, plus `whop skills add` and\n * `whop mcp add` for agent discovery.\n */\nconst cli = Cli.create(\"whop\", {\n\tversion: pkg.version,\n\tdescription: \"Build and manage Whop apps from your terminal.\",\n\trenderer: render,\n\tsync: {\n\t\tsuggestions: [\n\t\t\t\"log in to Whop\",\n\t\t\t\"switch Whop accounts\",\n\t\t\t\"show who I'm logged in as\",\n\t\t],\n\t},\n});\n\n// Helper: returns a spec slice for a single tag group.\nconst spec = (tag: string) => filterSpecByTag(nativeSpec as Record<string, unknown>, tag);\nconst fetch = createWhopFetch();\n\n// `whop auth login | logout | switch | status | list`\ncli.command(buildAuthGroup());\n\n// API command groups — derived from api-structure.json + api-v1-native.yml via `pnpm sync-spec`\nfor (const [name, tag] of groups) {\n\tcli.command(name, { fetch, openapi: spec(tag) });\n}\n\n// Top-level conveniences. incur aliases can't cross into a group, so these are\n// real commands that reuse the same adapters as `whop auth login|logout`.\ncli.command(\"login\", {\n\tdescription: \"Log in to Whop (alias for `auth login`)\",\n\toptions: loginOptions,\n\tenv: loginEnv,\n\toutput: loginOutput,\n\texamples: loginExamples,\n\thint: loginHint,\n\trun: (c) => loginAdapter(c),\n});\n\ncli.command(\"logout\", {\n\tdescription: \"Log out (alias for `auth logout`)\",\n\toptions: logoutOptions,\n\toutput: logoutOutput,\n\trun: (c) => logoutAdapter(c),\n});\n\nexport default cli;\n","import cli from \"./cli\";\n\ncli.serve();\n\nexport default cli;\n"],"mappings":";;;;;;;;;;;;;AAAA;AAAA;AAAA;AAEA,QAAM,QAAQ,OAAO,IAAI,YAAY;AACrC,QAAM,MAAM,OAAO,IAAI,eAAe;AACtC,QAAM,MAAM,OAAO,IAAI,UAAU;AACjC,QAAM,OAAO,OAAO,IAAI,WAAW;AACnC,QAAM,SAAS,OAAO,IAAI,aAAa;AACvC,QAAM,MAAM,OAAO,IAAI,UAAU;AACjC,QAAM,YAAY,OAAO,IAAI,gBAAgB;AAC7C,QAAMA,WAAU,CAAC,SAAS,CAAC,CAAC,QAAQ,OAAO,SAAS,YAAY,KAAK,SAAS,MAAM;AACpF,QAAM,aAAa,CAAC,SAAS,CAAC,CAAC,QAAQ,OAAO,SAAS,YAAY,KAAK,SAAS,MAAM;AACvF,QAAM,QAAQ,CAAC,SAAS,CAAC,CAAC,QAAQ,OAAO,SAAS,YAAY,KAAK,SAAS,MAAM;AAClF,QAAM,SAAS,CAAC,SAAS,CAAC,CAAC,QAAQ,OAAO,SAAS,YAAY,KAAK,SAAS,MAAM;AACnF,QAAMC,YAAW,CAAC,SAAS,CAAC,CAAC,QAAQ,OAAO,SAAS,YAAY,KAAK,SAAS,MA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AC;AAED,SAAO;AACR;;;ACveA,IAAM,MAAM,YAAI,OAAO,QAAQ;AAAA,EAC9B,SAAS,gBAAI;AAAA,EACb,aAAa;AAAA,EACb,UAAU;AAAA,EACV,MAAM;AAAA,IACL,aAAa;AAAA,MACZ;AAAA,MACA;AAAA,MACA;AAAA,IACD;AAAA,EACD;AACD,CAAC;AAGD,IAAM,OAAO,CAAC,QAAgB,gBAAgB,qBAAuC,GAAG;AACxF,IAAMC,SAAQ,gBAAgB;AAG9B,IAAI,QAAQ,eAAe,CAAC;AAG5B,WAAW,CAAC,MAAM,GAAG,KAAK,gBAAQ;AACjC,MAAI,QAAQ,MAAM,EAAE,OAAAA,QAAO,SAAS,KAAK,GAAG,EAAE,CAAC;AAChD;AAIA,IAAI,QAAQ,SAAS;AAAA,EACpB,aAAa;AAAA,EACb,SAAS;AAAA,EACT,KAAK;AAAA,EACL,QAAQ;AAAA,EACR,UAAU;AAAA,EACV,MAAM;AAAA,EACN,KAAK,CAAC,MAAM,aAAa,CAAC;AAC3B,CAAC;AAED,IAAI,QAAQ,UAAU;AAAA,EACrB,aAAa;AAAA,EACb,SAAS;AAAA,EACT,QAAQ;AAAA,EACR,KAAK,CAAC,MAAM,cAAc,CAAC;AAC5B,CAAC;AAED,IAAO,cAAQ;;;ACrEf,YAAI,MAAM;AAEV,IAAO,gBAAQ;","names":["isAlias","isScalar","path","res","res","anchors","node","path","split","i","end","merge","value","log","merge","stringify","comment","str","map","seq","format","require_schema","pairs","omap","require_bool","require_float","require_int","n","set","res","require_schema","merge","merge","tags","merge","path","res","value","end","split","tag","path","index","isScalar","i","ch","list","start","fs","log","lineCounter","parse","fs","os","path","import_yaml","index","entry","current","path","index","path","format","yamlStringify","isArrayOfObjects","path","table","all","parse","isBooleanOption","unwrap","path","format","path","parse","split","entry","unwrap","entry","path","walk","dereferenced","cli","entry","spec","fetch","path","index","import_yaml","cli","key","bucket","yamlStringify","resolveTypeName","table","register","configPath","spec","resolve","import_yaml","fs","os","path","entry","fs","path","os","entry","yamlParse","hash","installed","spec","name","cli","def","fetch","format","configPath","index","command","entry","sub","result","rest","register","base","formatted","path","sentinel","isSentinel","McpServer","yamlStringify","yamlParse","cta","outputPolicy","basename","fs","os","path","path","os","fs","parsed","createHash","execFile","resolve","createHash","execFile","slugify","profile","spec","path","isPlainObject","isScalar","identity","existed","profile","fetch"]}
|
|
1
|
+
{"version":3,"sources":["../src/api/groups.json","../src/auth/commands.ts","../src/commerce/products.ts","../src/commerce/client.ts","../src/commerce/crud.ts","../src/commerce/output.ts","../src/commerce/plans.ts","../src/commerce/billing.ts","../src/commerce/checkout.ts","../src/journey/quickstart.ts","../src/lib/colors.ts","../src/commands.ts","../package.json","../src/lib/renderer.ts","../src/cli.ts","../src/api/api-structure.json","../src/api/tag-descriptions.json","../src/lib/grouped-help.ts","../src/lib/colorize-output.ts","../src/index.ts"],"sourcesContent":["[\n [\n \"accounts\",\n \"Accounts\"\n ],\n [\n \"users\",\n \"Users\"\n ],\n [\n \"stats\",\n \"Stats\"\n ],\n [\n \"ledgers\",\n \"Ledgers\"\n ],\n [\n \"payouts\",\n \"Payouts\"\n ],\n [\n \"cards\",\n \"Cards\"\n ],\n [\n \"transfers\",\n \"Transfers\"\n ],\n [\n \"deposits\",\n \"Deposits\"\n ],\n [\n \"swaps\",\n \"Swaps\"\n ],\n [\n \"verifications\",\n \"Verifications\"\n ],\n [\n \"products\",\n \"Products\"\n ],\n [\n \"plans\",\n \"Plans\"\n ],\n [\n \"checkout-configurations\",\n \"Checkout Configurations\"\n ],\n [\n \"referrals\",\n \"Referrals\"\n ],\n [\n \"ads\",\n \"Ads\"\n ],\n [\n \"ad-campaigns\",\n \"Ad Campaigns\"\n ],\n [\n \"ad-groups\",\n \"Ad Groups\"\n ],\n [\n \"audiences\",\n \"Audiences\"\n ],\n [\n \"social-accounts\",\n \"Social Accounts\"\n ]\n]\n","import { Cli, z } from \"incur\";\nimport { validateApiKey, apiBaseUrl } from \"./client\";\nimport { readConfig } from \"./config\";\nimport { getSecret } from \"./keyring\";\nimport { OAuthError, performOAuthLogin } from \"./oauth\";\nimport {\n\tderiveProfileName,\n\tgetActiveProfile,\n\tgetValidAccessToken,\n\tlistProfiles,\n\tremoveProfile,\n\tswitchProfile,\n\tupsertProfile,\n} from \"./profiles\";\nimport {\n\tchooseAuthMethod,\n\tPromptCancelledError,\n\tpromptApiKey,\n\tselectProfile,\n\tstartSpinner,\n} from \"./prompts\";\nimport { AuthMethod, Identity, Profile } from \"./types\";\n\n/**\n * Auth commands: `whop auth login | logout | switch | status | list`.\n *\n * The login/logout business logic is context-free (`performLogin`,\n * `removeProfile`) and the incur run handlers are thin adapters. `loginAdapter`\n * and `logoutAdapter` are shared so the top-level `whop login` / `whop logout`\n * (registered in `index.ts`) behave identically without duplicating logic —\n * incur aliases can't cross from a group into a top-level command.\n */\n\n// --- CTA / error shapes accepted by the run context (kept minimal & structural) ---\ntype CtaCommand =\n\t| string\n\t| {\n\t\t\tcommand: string;\n\t\t\tdescription?: string | undefined;\n\t\t\toptions?: Record<string, unknown> | undefined;\n\t\t\targs?: Record<string, unknown> | undefined;\n\t };\ntype CtaInput = { description?: string | undefined; commands: CtaCommand[] };\ntype ErrorInput = {\n\tcode: string;\n\tmessage: string;\n\tcta?: CtaInput | undefined;\n\texitCode?: number | undefined;\n\tretryable?: boolean | undefined;\n};\n\n// --- Shared schemas ---\nexport const loginOptions = z.object({\n\tapiKey: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"API key for non-interactive login (skips the prompt)\"),\n\tprofile: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Name for this profile (defaults to the account route)\"),\n\tcompanyId: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\n\t\t\t\"Business account to act on behalf of (biz_xxx) — for OAuth users who manage more than one\",\n\t\t),\n});\n\nexport const loginEnv = z.object({\n\tWHOP_API_KEY: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"API key for non-interactive login\"),\n\tWHOP_API_BASE_URL: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Override the Whop API base URL\"),\n\tWHOP_CONFIG_DIR: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Override the CLI config directory\"),\n});\n\nexport const loginOutput = z.object({\n\tprofile: z.string().describe(\"The profile name\"),\n\tactive: z.boolean().describe(\"Whether this profile is now the active one\"),\n\tmethod: AuthMethod.describe(\"The authentication method\"),\n\tidentity: Identity.describe(\"The authenticated account or user identity\"),\n});\nexport type LoginOutput = z.infer<typeof loginOutput>;\n\nexport const logoutOptions = z.object({\n\tprofile: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Profile to remove (defaults to the active profile)\"),\n});\nexport const logoutOutput = z.object({\n\tremoved: z.string().describe(\"The removed profile name\"),\n\tnewActive: z\n\t\t.string()\n\t\t.nullable()\n\t\t.describe(\"The profile that is now active, if any\"),\n});\nexport type LogoutOutput = z.infer<typeof logoutOutput>;\n\nconst statusOutput = z.object({\n\tloggedIn: z\n\t\t.boolean()\n\t\t.describe(\"Whether the active profile has a usable stored credential\"),\n\tprofile: z.string().nullable(),\n\tmethod: AuthMethod.nullable(),\n\tidentity: Identity.nullable().describe(\n\t\t\"The logged-in user (OAuth) or the account (API key)\",\n\t),\n\taccount: Identity.nullable().describe(\n\t\t\"The account auto-filled for scoped commands (account_id/company_id)\",\n\t),\n\thasSecret: z\n\t\t.boolean()\n\t\t.describe(\"Whether a secret was found in the OS keychain for this profile\"),\n});\n\nconst listOutput = z.object({\n\tactive: z.string().nullable(),\n\tprofiles: z.array(Profile),\n});\n\nconst switchArgs = z.object({\n\tname: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Profile to switch to (interactive picker if omitted)\"),\n});\nconst switchOutput = z.object({\n\tactive: z.string().describe(\"The newly active profile\"),\n});\n\nexport const loginExamples = [\n\t{ description: \"Interactive login\" },\n\t{\n\t\toptions: { apiKey: \"whop_xxx\" },\n\t\tdescription: \"Non-interactive login (CI / agents)\",\n\t},\n\t{\n\t\toptions: { apiKey: \"whop_xxx\", profile: \"prod\" },\n\t\tdescription: \"Log in and name the profile\",\n\t},\n];\nexport const loginHint =\n\t\"Agents / CI: pass --api-key or set WHOP_API_KEY to skip the prompt.\";\n\n// --- Context-free login flows ---\ntype LoginResult =\n\t| { ok: true; output: LoginOutput; existed: boolean; underscoped: boolean }\n\t| { ok: false; code: string; message: string };\n\nexport async function performLogin(input: {\n\tagent: boolean;\n\tapiKey?: string | undefined;\n\tprofile?: string | undefined;\n\tcompanyId?: string | undefined;\n}): Promise<LoginResult> {\n\tlet method: AuthMethod = \"api_key\";\n\tif (!input.agent && !input.apiKey) method = await chooseAuthMethod();\n\n\t// Route to the OAuth browser flow.\n\tif (method === \"oauth\") {\n\t\ttry {\n\t\t\tconst { profileName, identity, existed } = await performOAuthLogin({\n\t\t\t\tprofile: input.profile,\n\t\t\t\tagent: input.agent,\n\t\t\t\tcompanyId: input.companyId,\n\t\t\t});\n\t\t\treturn {\n\t\t\t\tok: true,\n\t\t\t\texisted,\n\t\t\t\tunderscoped: false,\n\t\t\t\toutput: {\n\t\t\t\t\tprofile: profileName,\n\t\t\t\t\tactive: true,\n\t\t\t\t\tmethod: \"oauth\",\n\t\t\t\t\tidentity,\n\t\t\t\t},\n\t\t\t};\n\t\t} catch (err) {\n\t\t\tif (err instanceof OAuthError) {\n\t\t\t\treturn { ok: false, code: err.code, message: err.message };\n\t\t\t}\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\t// Resolve the API key: flag/env > interactive prompt > error in agent mode.\n\tlet apiKey = input.apiKey;\n\tif (!apiKey) {\n\t\tif (input.agent) {\n\t\t\treturn {\n\t\t\t\tok: false,\n\t\t\t\tcode: \"API_KEY_REQUIRED\",\n\t\t\t\tmessage: \"No API key provided and not running interactively.\",\n\t\t\t};\n\t\t}\n\t\tapiKey = await promptApiKey();\n\t}\n\t// Normalize: the SDK adds the `Bearer ` prefix itself, so strip one if pasted.\n\tconst key = apiKey.replace(/^Bearer\\s+/i, \"\").trim();\n\n\t// 3. Validate against the API.\n\tlet result: Awaited<ReturnType<typeof validateApiKey>>;\n\tif (input.agent) {\n\t\tresult = await validateApiKey(key, apiBaseUrl());\n\t} else {\n\t\tconst s = startSpinner(\"Validating API key…\");\n\t\tresult = await validateApiKey(key, apiBaseUrl());\n\t\tconst okay = result.status === \"valid\" || result.status === \"underscoped\";\n\t\ts.stop(okay ? \"API key validated.\" : \"API key check failed.\");\n\t}\n\tif (result.status === \"invalid\") {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tcode: \"INVALID_API_KEY\",\n\t\t\tmessage: \"That API key was rejected (401 Unauthorized).\",\n\t\t};\n\t}\n\tif (result.status === \"error\") {\n\t\treturn { ok: false, code: \"VALIDATION_FAILED\", message: result.message };\n\t}\n\n\t// 4. Persist (secret → keychain, metadata → config) and activate.\n\tconst identity = result.identity;\n\tconst name = input.profile ?? deriveProfileName(identity);\n\tconst existed = listProfiles().some((profile) => profile.name === name);\n\tconst profile = upsertProfile({ name, method, secret: key, identity });\n\n\treturn {\n\t\tok: true,\n\t\texisted,\n\t\tunderscoped: result.status === \"underscoped\",\n\t\toutput: { profile: profile.name, active: true, method, identity },\n\t};\n}\n\n// --- Shared adapters (used by the group command and the top-level alias) ---\ntype LoginAdapterCtx = {\n\tagent: boolean;\n\toptions: {\n\t\tapiKey?: string | undefined;\n\t\tprofile?: string | undefined;\n\t\tcompanyId?: string | undefined;\n\t};\n\tenv: { WHOP_API_KEY?: string | undefined };\n\tok: (data: LoginOutput, meta?: { cta?: CtaInput | undefined }) => never;\n\terror: (options: ErrorInput) => never;\n};\n\nexport async function loginAdapter(c: LoginAdapterCtx): Promise<never> {\n\tlet result: LoginResult;\n\ttry {\n\t\tresult = await performLogin({\n\t\t\tagent: c.agent,\n\t\t\tapiKey: c.options.apiKey ?? c.env.WHOP_API_KEY,\n\t\t\tprofile: c.options.profile,\n\t\t\tcompanyId: c.options.companyId,\n\t\t});\n\t} catch (error) {\n\t\tif (error instanceof PromptCancelledError) {\n\t\t\treturn c.error({\n\t\t\t\tcode: \"CANCELLED\",\n\t\t\t\tmessage: \"Login cancelled.\",\n\t\t\t\texitCode: 130,\n\t\t\t});\n\t\t}\n\t\tthrow error;\n\t}\n\n\tif (!result.ok) {\n\t\tlet cta: CtaInput | undefined;\n\t\tif (result.code === \"API_KEY_REQUIRED\") {\n\t\t\tcta = {\n\t\t\t\tdescription: \"Provide a key non-interactively:\",\n\t\t\t\tcommands: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcommand: \"auth login\",\n\t\t\t\t\t\toptions: { apiKey: true },\n\t\t\t\t\t\tdescription: \"Pass --api-key <key>\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t} else if (\n\t\t\tresult.code === \"MULTIPLE_COMPANIES\" ||\n\t\t\tresult.code === \"COMPANY_NOT_FOUND\"\n\t\t) {\n\t\t\tcta = {\n\t\t\t\tdescription: \"Choose which business account to use:\",\n\t\t\t\tcommands: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcommand: \"auth login\",\n\t\t\t\t\t\toptions: { companyId: true },\n\t\t\t\t\t\tdescription: \"Pass --company-id biz_xxx\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t};\n\t\t}\n\t\treturn c.error({\n\t\t\tcode: result.code,\n\t\t\tmessage: result.message,\n\t\t\tretryable: result.code !== \"INVALID_API_KEY\",\n\t\t\tcta,\n\t\t});\n\t}\n\n\t// First-run vs returning user: check whether they have any products yet.\n\t// Probe whenever we have an account so a returning\n\t// user with zero products still gets the \"start selling\" path. Use the\n\t// resolved account id (not the user id, which is what identity holds for\n\t// OAuth). On failure just fall back to the generic CTA — don't block login.\n\tlet firstRun = !result.existed;\n\tconst companyId = getActiveProfile()?.companyId ?? \"\";\n\tif (companyId) {\n\t\ttry {\n\t\t\tconst { createWhopFetch } = await import(\"../api/index.js\");\n\t\t\tconst fetch = createWhopFetch();\n\t\t\tconst res = await fetch(\n\t\t\t\tnew Request(\n\t\t\t\t\t`https://api.whop.com/products?company_id=${companyId}&first=1`,\n\t\t\t\t),\n\t\t\t);\n\t\t\tif (res.ok) {\n\t\t\t\tconst data = (await res.json()) as { data?: unknown[] };\n\t\t\t\tfirstRun = (data.data?.length ?? 0) === 0;\n\t\t\t}\n\t\t} catch {\n\t\t\t// Non-fatal — use generic CTA\n\t\t}\n\t}\n\n\t// No business account resolved (e.g. OAuth account with no business yet). Don't send\n\t// them to `quickstart` — it requires a biz_ id and would exit NO_COMPANY.\n\t// Mirror quickstart's guidance: create a business account, then re-authenticate.\n\tif (!companyId) {\n\t\treturn c.ok(result.output, {\n\t\t\tcta: {\n\t\t\t\tdescription:\n\t\t\t\t\t\"You're logged in, but no business account is linked to this account yet. Create a business account on Whop, then log in again:\",\n\t\t\t\tcommands: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcommand: \"auth login\",\n\t\t\t\t\t\tdescription: \"Re-authenticate once you have a business account\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t});\n\t}\n\n\treturn c.ok(result.output, {\n\t\tcta: firstRun\n\t\t\t? {\n\t\t\t\t\tdescription: \"You're logged in. Start selling in one command:\",\n\t\t\t\t\tcommands: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"quickstart\",\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\"Create your product, set a price, get a checkout link\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t}\n\t\t\t: {\n\t\t\t\t\tdescription: result.existed\n\t\t\t\t\t\t? \"Updated and switched to this profile:\"\n\t\t\t\t\t\t: \"Welcome back:\",\n\t\t\t\t\tcommands: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"quickstart\",\n\t\t\t\t\t\t\tdescription: \"See your status and what's next\",\n\t\t\t\t\t\t},\n\t\t\t\t\t\t{ command: \"auth status\", description: \"Show the active identity\" },\n\t\t\t\t\t],\n\t\t\t\t},\n\t});\n}\n\ntype LogoutAdapterCtx = {\n\toptions: { profile?: string | undefined };\n\tok: (data: LogoutOutput, meta?: { cta?: CtaInput | undefined }) => never;\n\terror: (options: ErrorInput) => never;\n};\n\nexport function logoutAdapter(c: LogoutAdapterCtx): never {\n\tconst target = c.options.profile ?? getActiveProfile()?.name;\n\tif (!target) {\n\t\treturn c.error({\n\t\t\tcode: \"NO_ACTIVE_PROFILE\",\n\t\t\tmessage: \"No active profile to log out from.\",\n\t\t\tretryable: false,\n\t\t\tcta: {\n\t\t\t\tdescription: \"Log in first:\",\n\t\t\t\tcommands: [{ command: \"auth login\", description: \"Log in to Whop\" }],\n\t\t\t},\n\t\t});\n\t}\n\tconst { removed, newActive } = removeProfile(target);\n\tif (!removed) {\n\t\treturn c.error({\n\t\t\tcode: \"PROFILE_NOT_FOUND\",\n\t\t\tmessage: `No profile named \"${target}\".`,\n\t\t\tretryable: false,\n\t\t});\n\t}\n\treturn c.ok(\n\t\t{ removed: target, newActive },\n\t\tnewActive\n\t\t\t? {\n\t\t\t\t\tcta: {\n\t\t\t\t\t\tdescription: `Now using \"${newActive}\".`,\n\t\t\t\t\t\tcommands: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcommand: \"auth status\",\n\t\t\t\t\t\t\t\tdescription: \"Show the active identity\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t}\n\t\t\t: undefined,\n\t);\n}\n\n// --- The `auth` command group ---\nexport function buildAuthGroup() {\n\tconst auth = Cli.create(\"auth\", {\n\t\tdescription: \"Manage Whop authentication\",\n\t});\n\n\tauth.command(\"login\", {\n\t\tdescription: \"Log in to Whop\",\n\t\taliases: [\"add\"],\n\t\toptions: loginOptions,\n\t\tenv: loginEnv,\n\t\toutput: loginOutput,\n\t\texamples: loginExamples,\n\t\thint: loginHint,\n\t\trun: (c) => loginAdapter(c),\n\t});\n\n\tauth.command(\"logout\", {\n\t\tdescription: \"Log out — remove a saved profile\",\n\t\taliases: [\"remove\", \"rm\"],\n\t\toptions: logoutOptions,\n\t\toutput: logoutOutput,\n\t\trun: (c) => logoutAdapter(c),\n\t});\n\n\tauth.command(\"switch\", {\n\t\tdescription: \"Switch the active profile\",\n\t\targs: switchArgs,\n\t\toutput: switchOutput,\n\t\trun: async (c) => {\n\t\t\tconst profiles = listProfiles();\n\t\t\tif (profiles.length === 0) {\n\t\t\t\treturn c.error({\n\t\t\t\t\tcode: \"NO_PROFILES\",\n\t\t\t\t\tmessage: \"No profiles yet — log in first.\",\n\t\t\t\t\tretryable: true,\n\t\t\t\t\tcta: {\n\t\t\t\t\t\tdescription: \"To authenticate:\",\n\t\t\t\t\t\tcommands: [\n\t\t\t\t\t\t\t{ command: \"auth login\", description: \"Log in to Whop\" },\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tlet name = c.args.name;\n\t\t\tif (!name) {\n\t\t\t\tif (c.agent) {\n\t\t\t\t\treturn c.error({\n\t\t\t\t\t\tcode: \"PROFILE_REQUIRED\",\n\t\t\t\t\t\tmessage: `Specify a profile name. Available: ${profiles.map((p) => p.name).join(\", \")}.`,\n\t\t\t\t\t\tretryable: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\tname = await selectProfile(profiles);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (error instanceof PromptCancelledError) {\n\t\t\t\t\t\treturn c.error({\n\t\t\t\t\t\t\tcode: \"CANCELLED\",\n\t\t\t\t\t\t\tmessage: \"Switch cancelled.\",\n\t\t\t\t\t\t\texitCode: 130,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst profile = switchProfile(name);\n\t\t\tif (!profile) {\n\t\t\t\treturn c.error({\n\t\t\t\t\tcode: \"PROFILE_NOT_FOUND\",\n\t\t\t\t\tmessage: `No profile named \"${name}\". Available: ${profiles.map((p) => p.name).join(\", \")}.`,\n\t\t\t\t\tretryable: true,\n\t\t\t\t});\n\t\t\t}\n\t\t\treturn c.ok(\n\t\t\t\t{ active: profile.name },\n\t\t\t\t{\n\t\t\t\t\tcta: {\n\t\t\t\t\t\tcommands: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tcommand: \"auth status\",\n\t\t\t\t\t\t\t\tdescription: \"Show the active identity\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t);\n\t\t},\n\t});\n\n\tauth.command(\"status\", {\n\t\tdescription: \"Show the active identity (whoami)\",\n\t\taliases: [\"whoami\"],\n\t\toutput: statusOutput,\n\t\trun: async (c) => {\n\t\t\tconst profile = getActiveProfile();\n\t\t\tif (!profile) {\n\t\t\t\treturn c.ok(\n\t\t\t\t\t{\n\t\t\t\t\t\tloggedIn: false,\n\t\t\t\t\t\tprofile: null,\n\t\t\t\t\t\tmethod: null,\n\t\t\t\t\t\tidentity: null,\n\t\t\t\t\t\taccount: null,\n\t\t\t\t\t\thasSecret: false,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tcta: {\n\t\t\t\t\t\t\tdescription: \"To authenticate:\",\n\t\t\t\t\t\t\tcommands: [\n\t\t\t\t\t\t\t\t{ command: \"auth login\", description: \"Log in to Whop\" },\n\t\t\t\t\t\t\t],\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t\tconst hasSecret = getSecret(profile.name) !== null;\n\t\t\t// \"Logged in\" means we can actually obtain a Bearer token. For oauth\n\t\t\t// this may refresh the access token; a revoked/expired refresh token\n\t\t\t// resolves to null instead of throwing, so the reported state is honest.\n\t\t\tlet loggedIn = hasSecret;\n\t\t\tif (hasSecret) {\n\t\t\t\ttry {\n\t\t\t\t\tloggedIn = (await getValidAccessToken(profile)) !== null;\n\t\t\t\t} catch {\n\t\t\t\t\tloggedIn = false;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst account =\n\t\t\t\tprofile.accountId || profile.accountTitle || profile.accountRoute\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tid: profile.accountId,\n\t\t\t\t\t\t\ttitle: profile.accountTitle,\n\t\t\t\t\t\t\troute: profile.accountRoute,\n\t\t\t\t\t\t}\n\t\t\t\t\t: null;\n\t\t\treturn c.ok(\n\t\t\t\t{\n\t\t\t\t\tloggedIn,\n\t\t\t\t\tprofile: profile.name,\n\t\t\t\t\tmethod: profile.method,\n\t\t\t\t\tidentity:\n\t\t\t\t\t\tprofile.method === \"oauth\"\n\t\t\t\t\t\t\t? { id: profile.userId, email: profile.userEmail }\n\t\t\t\t\t\t\t: account,\n\t\t\t\t\taccount,\n\t\t\t\t\thasSecret,\n\t\t\t\t},\n\t\t\t\tloggedIn\n\t\t\t\t\t? undefined\n\t\t\t\t\t: {\n\t\t\t\t\t\t\tcta: {\n\t\t\t\t\t\t\t\tdescription: hasSecret\n\t\t\t\t\t\t\t\t\t? \"Your session is no longer valid — log in again:\"\n\t\t\t\t\t\t\t\t\t: \"The stored secret is missing — log in again:\",\n\t\t\t\t\t\t\t\tcommands: [\n\t\t\t\t\t\t\t\t\t{ command: \"auth login\", description: \"Log in to Whop\" },\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t);\n\t\t},\n\t});\n\n\tauth.command(\"list\", {\n\t\tdescription: \"List saved authentication profiles\",\n\t\taliases: [\"ls\"],\n\t\toutput: listOutput,\n\t\trun: () => {\n\t\t\tconst { activeProfile, profiles } = readConfig();\n\t\t\tconst active =\n\t\t\t\tprofiles.find((p) => p.name === activeProfile)?.name ?? null;\n\t\t\treturn { active, profiles };\n\t\t},\n\t});\n\n\treturn auth;\n}\n","import { Cli, z } from \"incur\";\nimport { text, isCancel } from \"@clack/prompts\";\nimport { makeWhopRequest } from \"./client.js\";\nimport {\n\tbuildBody,\n\tregisterItemCommands,\n\tregisterListCommand,\n} from \"./crud.js\";\nimport { printCreateSuccess } from \"./output.js\";\n\nconst ProductSchema = z.object({\n\tid: z.string(),\n\ttitle: z.string(),\n\tvisibility: z.string().optional(),\n\troute: z.string().optional(),\n\theadline: z.string().nullable().optional(),\n\tdescription: z.string().nullable().optional(),\n\tmember_count: z.number().optional(),\n\tcreated_at: z.number().optional(),\n});\n\nconst createOptions = z.object({\n\ttitle: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Product display name (max 80 characters)\"),\n\tcompany_id: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\n\t\t\t\"Business account to create under (defaults to your active account)\",\n\t\t),\n\tvisibility: z\n\t\t.enum([\"visible\", \"hidden\", \"archived\"])\n\t\t.optional()\n\t\t.describe(\"Who can see this product\"),\n\theadline: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Short tagline shown on the store page\"),\n\tdescription: z.string().optional().describe(\"Full description\"),\n\troute: z.string().optional().describe(\"Custom URL slug (e.g. my-course)\"),\n\tredirect_purchase_url: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\"Redirect buyers here after purchase\"),\n});\n\nexport function buildProductsGroup() {\n\tconst products = Cli.create(\"products\", {\n\t\tdescription: \"Products — what you're selling on Whop\",\n\t});\n\n\tproducts.command(\"create\", {\n\t\tdescription: \"Create a product\",\n\t\thint: \"A product is the top-level container for what you sell. Add a pricing plan next.\",\n\t\toptions: createOptions,\n\t\toutput: ProductSchema,\n\t\toutputPolicy: \"agent-only\",\n\t\texamples: [\n\t\t\t{\n\t\t\t\toptions: { title: \"My Online Course\" },\n\t\t\t\tdescription: \"Create a product\",\n\t\t\t},\n\t\t\t{\n\t\t\t\toptions: { title: \"My Course\", visibility: \"hidden\" },\n\t\t\t\tdescription: \"Create a hidden product\",\n\t\t\t},\n\t\t],\n\t\trun: async (c) => {\n\t\t\tlet title = c.options.title;\n\t\t\tif (!title) {\n\t\t\t\tif (c.agent) {\n\t\t\t\t\treturn c.error({\n\t\t\t\t\t\tcode: \"TITLE_REQUIRED\",\n\t\t\t\t\t\tmessage: \"Pass --title to set the product name.\",\n\t\t\t\t\t\tretryable: true,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tconst t = await text({\n\t\t\t\t\tmessage: \"What are you selling?\",\n\t\t\t\t\tplaceholder:\n\t\t\t\t\t\t\"e.g. My Online Course, Trading Community, Fitness Program\",\n\t\t\t\t});\n\t\t\t\tif (isCancel(t))\n\t\t\t\t\treturn c.error({\n\t\t\t\t\t\tcode: \"CANCELLED\",\n\t\t\t\t\t\tmessage: \"Cancelled.\",\n\t\t\t\t\t\texitCode: 130,\n\t\t\t\t\t});\n\t\t\t\ttitle = t as string;\n\t\t\t}\n\n\t\t\tconst body = { ...buildBody(c.options), title };\n\n\t\t\tlet product: z.infer<typeof ProductSchema>;\n\t\t\ttry {\n\t\t\t\tproduct = await makeWhopRequest<z.infer<typeof ProductSchema>>(\n\t\t\t\t\t\"POST\",\n\t\t\t\t\t\"/products\",\n\t\t\t\t\tbody,\n\t\t\t\t);\n\t\t\t} catch (err) {\n\t\t\t\treturn c.error({\n\t\t\t\t\tcode: \"API_ERROR\",\n\t\t\t\t\tmessage:\n\t\t\t\t\t\terr instanceof Error ? err.message : \"Failed to create product\",\n\t\t\t\t\tretryable: true,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tprintCreateSuccess(c, {\n\t\t\t\ttitle: `Product \"${product.title}\" created`,\n\t\t\t\tid: product.id,\n\t\t\t\tnext: {\n\t\t\t\t\tcommand: `plans create --product_id ${product.id}`,\n\t\t\t\t\thint: \"Add pricing — required before you can take a checkout\",\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn c.ok(product, {\n\t\t\t\tcta: {\n\t\t\t\t\tdescription: \"Add pricing to your product:\",\n\t\t\t\t\tcommands: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"plans create\",\n\t\t\t\t\t\t\toptions: { product_id: product.id },\n\t\t\t\t\t\t\tdescription: \"Create a pricing plan (required before checkout)\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n\n\tregisterListCommand(products, {\n\t\tpath: \"/products\",\n\t\tdescription: \"List products\",\n\t});\n\n\tregisterItemCommands(products, {\n\t\tpath: \"/products\",\n\t\tnoun: \"product\",\n\t\tidLabel: \"Product ID (prod_xxx)\",\n\t\tschema: ProductSchema,\n\t\tupdateOptions: createOptions.partial(),\n\t});\n\n\treturn products;\n}\n","import { createWhopFetch } from \"../api/index.js\";\n\nconst PLACEHOLDER = \"https://api.whop.com\";\nconst whopFetch = createWhopFetch();\n\n/**\n * Thin wrapper around the API fetch proxy for hand-written commands. The proxy\n * strips the host and uses apiBaseUrl() internally, auto-fills the active\n * account, and normalizes errors to a top-level `message` — so we only need the\n * pathname (a query string in `path` is fine) and can surface `message` directly.\n */\nexport async function makeWhopRequest<T>(\n\tmethod: \"GET\" | \"POST\" | \"PATCH\" | \"DELETE\",\n\tpath: string,\n\tbody?: Record<string, unknown>,\n): Promise<T> {\n\tconst init: RequestInit = { method };\n\tif (body !== undefined) init.body = JSON.stringify(body);\n\tconst res = await whopFetch(new Request(`${PLACEHOLDER}${path}`, init));\n\n\tif (!res.ok) {\n\t\tconst payload = (await res.json().catch(() => null)) as {\n\t\t\tmessage?: string;\n\t\t} | null;\n\t\tthrow new Error(payload?.message ?? res.statusText);\n\t}\n\n\t// DELETE (and other 204s) can return an empty body, which `res.json()` would\n\t// reject — treat an empty body as a successful, content-less response.\n\tconst text = await res.text();\n\treturn (text ? JSON.parse(text) : { success: true }) as T;\n}\n","import { Cli, z } from \"incur\";\nimport { makeWhopRequest } from \"./client.js\";\n\n/** Copies defined option values into a request body, dropping `undefined`. */\nexport function buildBody(options: Record<string, unknown>): Record<string, unknown> {\n\tconst body: Record<string, unknown> = {};\n\tfor (const [key, value] of Object.entries(options)) {\n\t\tif (value !== undefined) body[key] = value;\n\t}\n\treturn body;\n}\n\ninterface ItemCommandConfig {\n\t/** Collection path, e.g. \"/products\". */\n\tpath: string;\n\t/** Singular resource noun for descriptions, e.g. \"product\". */\n\tnoun: string;\n\t/** Help text for the id argument, e.g. \"Product ID (prod_xxx)\". */\n\tidLabel: string;\n\t/** Output schema for get/update. */\n\tschema: z.ZodType;\n\t/** Options for `update`. Omit to skip the update command (e.g. checkout configs). */\n\tupdateOptions?: z.ZodObject<z.ZodRawShape>;\n\t/**\n\t * Normalizes the request body before `update` sends it (e.g. mapping friendly\n\t * enum values to the shape the API expects). Must match whatever the\n\t * hand-written `create` does so the same flags behave identically on both.\n\t */\n\ttransformBody?: (body: Record<string, unknown>) => Record<string, unknown>;\n}\n\n/**\n * Registers a `list` command. The active account is auto-filled by the fetch\n * proxy, so the only per-resource difference is the path and an optional filter.\n */\nexport function registerListCommand(\n\tgroup: ReturnType<typeof Cli.create>,\n\tconfig: {\n\t\tpath: string;\n\t\tdescription: string;\n\t\tfilter?: { option: string; param: string; describe: string };\n\t},\n): void {\n\tconst shape: Record<string, z.ZodType> = {\n\t\tfirst: z.coerce.number().optional().describe(\"Number of results\"),\n\t\tafter: z.string().optional().describe(\"Pagination cursor\"),\n\t};\n\tif (config.filter) {\n\t\tshape[config.filter.option] = z.string().optional().describe(config.filter.describe);\n\t}\n\tgroup.command(\"list\", {\n\t\tdescription: config.description,\n\t\toptions: z.object(shape),\n\t\trun: (c) => {\n\t\t\tconst options = c.options as Record<string, string | number | undefined>;\n\t\t\tconst params = new URLSearchParams();\n\t\t\tif (config.filter && options[config.filter.option]) {\n\t\t\t\tparams.set(config.filter.param, String(options[config.filter.option]));\n\t\t\t}\n\t\t\tif (options.first) params.set(\"first\", String(options.first));\n\t\t\tif (options.after) params.set(\"after\", String(options.after));\n\t\t\tconst qs = params.toString() ? `?${params}` : \"\";\n\t\t\treturn makeWhopRequest(\"GET\", `${config.path}${qs}`);\n\t\t},\n\t});\n}\n\n/**\n * Registers the by-id item commands (`get`, `update`, `delete`) that are\n * identical across commerce resources. `create` carries resource-specific logic\n * (CTAs, scope) and stays hand-written.\n */\nexport function registerItemCommands(\n\tgroup: ReturnType<typeof Cli.create>,\n\tconfig: ItemCommandConfig,\n): void {\n\tconst { path, noun, idLabel, schema, updateOptions, transformBody } = config;\n\tconst idArg = z.object({ id: z.string().describe(idLabel) });\n\n\tgroup.command(\"get\", {\n\t\tdescription: `Get a ${noun} by ID`,\n\t\targs: idArg,\n\t\toutput: schema,\n\t\trun: (c) => makeWhopRequest(`GET`, `${path}/${c.args.id}`),\n\t});\n\n\tif (updateOptions) {\n\t\tgroup.command(\"update\", {\n\t\t\tdescription: `Update a ${noun}`,\n\t\t\targs: idArg,\n\t\t\toptions: updateOptions,\n\t\t\toutput: schema,\n\t\t\trun: (c) => {\n\t\t\t\tconst body = buildBody(c.options);\n\t\t\t\treturn makeWhopRequest(\"PATCH\", `${path}/${c.args.id}`, transformBody ? transformBody(body) : body);\n\t\t\t},\n\t\t});\n\t}\n\n\tgroup.command(\"delete\", {\n\t\tdescription: `Delete a ${noun}`,\n\t\targs: idArg,\n\t\trun: (c) => makeWhopRequest(\"DELETE\", `${path}/${c.args.id}`),\n\t});\n}\n","import chalk from \"chalk\";\n\ninterface NextCommand {\n\tcommand: string;\n\thint?: string;\n}\n\n/**\n * Prints a clean, colored success summary for a `create` command — the human\n * counterpart to the structured envelope agents receive. Pairs with\n * `outputPolicy: \"agent-only\"` so humans see only this (with the checkout link\n * emphasized) and never the raw object dump.\n *\n * No-op in agent mode or when an explicit --format was requested.\n */\nexport function printCreateSuccess(\n\tc: { agent: boolean; formatExplicit: boolean },\n\topts: { title: string; id?: string; checkoutUrl?: string | null; next?: NextCommand },\n): void {\n\tif (c.agent || c.formatExplicit) return;\n\n\tconst lines: string[] = [\"\", chalk.green.bold(`✓ ${opts.title}`)];\n\tif (opts.id) lines.push(` ${chalk.dim(opts.id)}`);\n\n\tif (opts.checkoutUrl) {\n\t\tlines.push(\"\", chalk.bold(\"🎉 You can sell now. Share your checkout link:\"));\n\t\tlines.push(` ${chalk.cyan.underline(opts.checkoutUrl)}`);\n\t}\n\n\tif (opts.next) {\n\t\tlines.push(\"\", `${chalk.bold(\"Next\")} ${chalk.cyan.bold(`whop ${opts.next.command}`)}`);\n\t\tif (opts.next.hint) lines.push(` ${chalk.dim(`→ ${opts.next.hint}`)}`);\n\t}\n\n\tlines.push(\"\");\n\tconsole.log(lines.join(\"\\n\"));\n}\n","import { Cli, z } from \"incur\";\nimport { select, isCancel, spinner } from \"@clack/prompts\";\nimport { makeWhopRequest } from \"./client.js\";\nimport { getActiveProfile } from \"../auth/profiles.js\";\nimport { buildBody, registerItemCommands, registerListCommand } from \"./crud.js\";\nimport { BILLING_PERIOD_DAYS } from \"./billing.js\";\nimport { printCreateSuccess } from \"./output.js\";\n\nconst PlanSchema = z.object({\n\tid: z.string(),\n\ttitle: z.string().nullable().optional(),\n\tplan_type: z.string().optional(),\n\tbilling_period: z.string().nullable().optional(),\n\tinitial_price: z.number().nullable().optional(),\n\trenewal_price: z.number().nullable().optional(),\n\tcurrency: z.string().optional(),\n\tpurchase_url: z.string().nullable().optional(),\n\tvisibility: z.string().optional(),\n\tcreated_at: z.number().optional(),\n});\n\nconst createOptions = z.object({\n\tproduct_id: z.string().optional().describe(\"Product this plan belongs to (prod_xxx)\"),\n\ttitle: z.string().optional().describe(\"Display name for this plan\"),\n\tplan_type: z\n\t\t.enum([\"one_time\", \"renewal\", \"free\"])\n\t\t.optional()\n\t\t.describe(\"Billing model — one_time, renewal, or free\"),\n\tbilling_period: z\n\t\t.enum([\"daily\", \"weekly\", \"monthly\", \"quarterly\", \"annually\", \"every_two_years\"])\n\t\t.optional()\n\t\t.describe(\"How often to charge (for renewal plans)\"),\n\tinitial_price: z.coerce\n\t\t.number()\n\t\t.optional()\n\t\t.describe(\"Price in the plan's currency (e.g. 9.99 for $9.99)\"),\n\trenewal_price: z.coerce\n\t\t.number()\n\t\t.optional()\n\t\t.describe(\"Recurring price for renewal plans (defaults to initial_price)\"),\n\tcurrency: z.string().optional().describe(\"3-letter currency code (default: USD)\"),\n\ttrial_period_days: z.coerce.number().optional().describe(\"Free trial length in days\"),\n\tvisibility: z\n\t\t.enum([\"visible\", \"hidden\", \"archived\"])\n\t\t.optional()\n\t\t.describe(\"Who can see this plan\"),\n});\n\n// Maps friendly plan options to the shape the API expects. Shared by `create`\n// and `update` so the same flags behave identically on both.\nfunction normalizePlanBody(body: Record<string, unknown>): Record<string, unknown> {\n\tif (typeof body.billing_period === \"string\") {\n\t\tbody.billing_period = BILLING_PERIOD_DAYS[body.billing_period];\n\t}\n\tif (body.plan_type === \"renewal\" && body.renewal_price == null && body.initial_price != null) {\n\t\tbody.renewal_price = body.initial_price;\n\t}\n\treturn body;\n}\n\ninterface ProductListItem {\n\tid: string;\n\ttitle: string;\n}\n\ninterface ListResponse {\n\tdata: ProductListItem[];\n}\n\nasync function resolveProductId(\n\tprovidedId: string | undefined,\n\tisAgent: boolean,\n): Promise<\n\t| { ok: true; productId: string; autoResolved: boolean }\n\t| { ok: false; code: string; message: string; candidates?: ProductListItem[] }\n> {\n\tif (providedId) return { ok: true, productId: providedId, autoResolved: false };\n\n\t// Fetch products to auto-resolve a single one, or prompt/error on many.\n\tconst profile = getActiveProfile();\n\tconst params = new URLSearchParams({ first: \"100\" });\n\tif (profile?.companyId) params.set(\"company_id\", profile.companyId);\n\n\tlet data: ProductListItem[];\n\ttry {\n\t\tconst res = await makeWhopRequest<ListResponse>(\"GET\", `/products?${params}`);\n\t\tdata = res.data ?? [];\n\t} catch {\n\t\treturn { ok: false, code: \"API_ERROR\", message: \"Failed to fetch products\" };\n\t}\n\n\tif (data.length === 0) {\n\t\treturn {\n\t\t\tok: false,\n\t\t\tcode: \"NO_PRODUCTS\",\n\t\t\tmessage: \"No products found. Create one first.\",\n\t\t};\n\t}\n\n\tif (data.length === 1) {\n\t\treturn { ok: true, productId: data[0].id, autoResolved: true };\n\t}\n\n\t// Multiple products\n\tif (isAgent) {\n\t\treturn { ok: false, code: \"PRODUCT_REQUIRED\", message: \"Multiple products found. Pass --product_id.\", candidates: data };\n\t}\n\n\t// Interactive picker in TTY\n\tconst chosen = await select<string>({\n\t\tmessage: \"Which product is this plan for?\",\n\t\toptions: data.map((p) => ({ value: p.id, label: p.title, hint: p.id })),\n\t});\n\tif (isCancel(chosen)) return { ok: false, code: \"CANCELLED\", message: \"Cancelled.\" };\n\treturn { ok: true, productId: chosen, autoResolved: false };\n}\n\nexport function buildPlansGroup() {\n\tconst plans = Cli.create(\"plans\", {\n\t\tdescription: \"Plans — pricing for your products\",\n\t});\n\n\tplans.command(\"create\", {\n\t\tdescription: \"Create a pricing plan\",\n\t\thint: \"A plan sets the price and billing interval. After creating a plan, your checkout link is ready to share.\",\n\t\toptions: createOptions,\n\t\toutput: PlanSchema,\n\t\toutputPolicy: \"agent-only\",\n\t\texamples: [\n\t\t\t{\n\t\t\t\toptions: { product_id: \"prod_xxx\", initial_price: 9.99, plan_type: \"one_time\" },\n\t\t\t\tdescription: \"One-time payment of $9.99\",\n\t\t\t},\n\t\t\t{\n\t\t\t\toptions: {\n\t\t\t\t\tproduct_id: \"prod_xxx\",\n\t\t\t\t\tinitial_price: 19.99,\n\t\t\t\t\tplan_type: \"renewal\",\n\t\t\t\t\tbilling_period: \"monthly\",\n\t\t\t\t},\n\t\t\t\tdescription: \"Monthly subscription at $19.99\",\n\t\t\t},\n\t\t],\n\t\trun: async (c) => {\n\t\t\tconst s = c.agent ? null : spinner();\n\t\t\tif (s) s.start(\"Resolving product…\");\n\n\t\t\tconst resolved = await resolveProductId(c.options.product_id, c.agent);\n\n\t\t\tif (s) s.stop(\"\");\n\n\t\t\tif (!resolved.ok) {\n\t\t\t\treturn c.error({\n\t\t\t\t\tcode: resolved.code,\n\t\t\t\t\tmessage: resolved.message,\n\t\t\t\t\tretryable: resolved.code !== \"CANCELLED\",\n\t\t\t\t\tcta:\n\t\t\t\t\t\tresolved.code === \"NO_PRODUCTS\"\n\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\tdescription: \"Create a product first:\",\n\t\t\t\t\t\t\t\t\tcommands: [{ command: \"products create\", description: \"Create a product\" }],\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t: resolved.candidates\n\t\t\t\t\t\t\t\t? {\n\t\t\t\t\t\t\t\t\t\tdescription: \"Available products:\",\n\t\t\t\t\t\t\t\t\t\tcommands: resolved.candidates.map((p) => ({\n\t\t\t\t\t\t\t\t\t\t\tcommand: \"plans create\",\n\t\t\t\t\t\t\t\t\t\t\toptions: { product_id: p.id },\n\t\t\t\t\t\t\t\t\t\t\tdescription: p.title,\n\t\t\t\t\t\t\t\t\t\t})),\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tif (resolved.autoResolved && !c.agent) {\n\t\t\t\tconsole.error(\n\t\t\t\t\t`Note: using product ${resolved.productId} — pass --product_id to override`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst body = normalizePlanBody({\n\t\t\t\t...buildBody(c.options),\n\t\t\t\tproduct_id: resolved.productId,\n\t\t\t});\n\n\t\t\tlet plan: z.infer<typeof PlanSchema>;\n\t\t\ttry {\n\t\t\t\tplan = await makeWhopRequest<z.infer<typeof PlanSchema>>(\"POST\", \"/plans\", body);\n\t\t\t} catch (err) {\n\t\t\t\treturn c.error({\n\t\t\t\t\tcode: \"API_ERROR\",\n\t\t\t\t\tmessage: err instanceof Error ? err.message : \"Failed to create plan\",\n\t\t\t\t\tretryable: true,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst purchaseUrl = plan.purchase_url;\n\t\t\tconst ctaDescription = purchaseUrl\n\t\t\t\t? `🎉 You can sell now. Share your checkout link: ${purchaseUrl}`\n\t\t\t\t: \"Plan created.\";\n\n\t\t\tprintCreateSuccess(c, {\n\t\t\t\ttitle: purchaseUrl ? \"Plan created — you can sell now\" : \"Plan created\",\n\t\t\t\tid: plan.id,\n\t\t\t\tcheckoutUrl: purchaseUrl,\n\t\t\t\tnext: {\n\t\t\t\t\tcommand: \"checkout-configurations create\",\n\t\t\t\t\thint: \"Optional: customize the checkout page (currency, redirect, payment mode)\",\n\t\t\t\t},\n\t\t\t});\n\n\t\t\treturn c.ok(plan, {\n\t\t\t\tcta: {\n\t\t\t\t\tdescription: ctaDescription,\n\t\t\t\t\tcommands: [\n\t\t\t\t\t\t{ command: \"quickstart\", description: \"See your setup status and what's next\" },\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tcommand: \"checkout-configurations create\",\n\t\t\t\t\t\t\toptions: { plan_id: plan.id },\n\t\t\t\t\t\t\tdescription: \"Optional: customize the checkout page\",\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n\n\tregisterListCommand(plans, {\n\t\tpath: \"/plans\",\n\t\tdescription: \"List plans\",\n\t\tfilter: { option: \"product_id\", param: \"product_ids\", describe: \"Filter by product\" },\n\t});\n\n\tregisterItemCommands(plans, {\n\t\tpath: \"/plans\",\n\t\tnoun: \"plan\",\n\t\tidLabel: \"Plan ID (plan_xxx)\",\n\t\tschema: PlanSchema,\n\t\tupdateOptions: createOptions.omit({ product_id: true }).partial(),\n\t\ttransformBody: normalizePlanBody,\n\t});\n\n\treturn plans;\n}\n","/**\n * Friendly billing-interval names → days, the unit the API expects for a plan's\n * `billing_period` (e.g. 30 for monthly, 365 for annual). The CLI exposes the\n * names for readability and converts before sending.\n */\nexport const BILLING_PERIOD_DAYS: Record<string, number> = {\n\tdaily: 1,\n\tweekly: 7,\n\tmonthly: 30,\n\tquarterly: 90,\n\tannually: 365,\n\tevery_two_years: 730,\n};\n","import { Cli, z } from \"incur\";\nimport { makeWhopRequest } from \"./client.js\";\nimport { buildBody, registerItemCommands, registerListCommand } from \"./crud.js\";\nimport { printCreateSuccess } from \"./output.js\";\n\nconst CheckoutConfigSchema = z.object({\n\tid: z.string(),\n\tmode: z.enum([\"payment\", \"setup\"]).optional(),\n\tcurrency: z.string().nullable().optional(),\n\tpurchase_url: z.string().nullable().optional(),\n\tredirect_url: z.string().nullable().optional(),\n\tcompany_id: z.string().optional(),\n\tcreated_at: z.number().optional(),\n});\n\nconst createOptions = z.object({\n\tplan_id: z.string().optional().describe(\"Plan to attach this checkout to (plan_xxx)\"),\n\tmode: z\n\t\t.enum([\"payment\", \"setup\"])\n\t\t.optional()\n\t\t.describe(\"payment = charge immediately; setup = save payment method only\"),\n\tcurrency: z.string().optional().describe(\"3-letter currency code override\"),\n\tredirect_url: z.string().optional().describe(\"URL to redirect after successful checkout\"),\n\taffiliate_code: z.string().optional().describe(\"Affiliate code to apply\"),\n});\n\nexport function buildCheckoutGroup() {\n\tconst checkout = Cli.create(\"checkout-configurations\", {\n\t\tdescription: \"Checkout configurations — customize your checkout page\",\n\t});\n\n\tcheckout.command(\"create\", {\n\t\tdescription: \"Create a checkout configuration\",\n\t\thint: \"Customize the currency, redirect URL, and payment mode for a plan's checkout page.\",\n\t\toptions: createOptions,\n\t\toutput: CheckoutConfigSchema,\n\t\toutputPolicy: \"agent-only\",\n\t\texamples: [\n\t\t\t{\n\t\t\t\toptions: { plan_id: \"plan_xxx\" },\n\t\t\t\tdescription: \"Basic checkout configuration for a plan\",\n\t\t\t},\n\t\t\t{\n\t\t\t\toptions: { plan_id: \"plan_xxx\", redirect_url: \"https://mysite.com/thank-you\" },\n\t\t\t\tdescription: \"Redirect buyers to a custom thank-you page\",\n\t\t\t},\n\t\t],\n\t\trun: async (c) => {\n\t\t\tconst body = buildBody(c.options);\n\n\t\t\tlet config: z.infer<typeof CheckoutConfigSchema>;\n\t\t\ttry {\n\t\t\t\tconfig = await makeWhopRequest<z.infer<typeof CheckoutConfigSchema>>(\n\t\t\t\t\t\"POST\",\n\t\t\t\t\t\"/checkout_configurations\",\n\t\t\t\t\tbody,\n\t\t\t\t);\n\t\t\t} catch (err) {\n\t\t\t\treturn c.error({\n\t\t\t\t\tcode: \"API_ERROR\",\n\t\t\t\t\tmessage: err instanceof Error ? err.message : \"Failed to create checkout configuration\",\n\t\t\t\t\tretryable: true,\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst purchaseUrl = config.purchase_url;\n\t\t\tprintCreateSuccess(c, {\n\t\t\t\ttitle: \"Checkout configured\",\n\t\t\t\tid: config.id,\n\t\t\t\tcheckoutUrl: purchaseUrl,\n\t\t\t\tnext: { command: \"quickstart\", hint: \"See your full setup status\" },\n\t\t\t});\n\t\t\treturn c.ok(config, {\n\t\t\t\tcta: {\n\t\t\t\t\tdescription: purchaseUrl\n\t\t\t\t\t\t? `Checkout configured. Share your link: ${purchaseUrl}`\n\t\t\t\t\t\t: \"Checkout configured.\",\n\t\t\t\t\tcommands: [\n\t\t\t\t\t\t{ command: \"quickstart\", description: \"See your full setup status\" },\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t});\n\t\t},\n\t});\n\n\tregisterListCommand(checkout, {\n\t\tpath: \"/checkout_configurations\",\n\t\tdescription: \"List checkout configurations\",\n\t\tfilter: { option: \"plan_id\", param: \"plan_id\", describe: \"Filter by plan\" },\n\t});\n\n\tregisterItemCommands(checkout, {\n\t\tpath: \"/checkout_configurations\",\n\t\tnoun: \"checkout configuration\",\n\t\tidLabel: \"Checkout configuration ID\",\n\t\tschema: CheckoutConfigSchema,\n\t});\n\n\treturn checkout;\n}\n","import { z } from \"incur\";\nimport chalk from \"chalk\";\nimport { text, select, isCancel } from \"@clack/prompts\";\nimport { makeWhopRequest } from \"../commerce/client.js\";\nimport { resolveActiveCompanyId } from \"../api/index.js\";\nimport { BILLING_PERIOD_DAYS } from \"../commerce/billing.js\";\nimport { getActiveProfile } from \"../auth/profiles.js\";\nimport { c } from \"../lib/colors.js\";\n\ninterface ListItem {\n\tid: string;\n\ttitle?: string | null;\n\tpurchase_url?: string | null;\n}\ninterface ListResponse {\n\tdata: ListItem[];\n}\n\nconst StepSchema = z.object({\n\tid: z.string(),\n\tlabel: z.string(),\n\tcomplete: z.boolean(),\n\tcount: z.number().optional(),\n\tfirstId: z.string().optional(),\n\tfirstTitle: z.string().optional(),\n});\n\nconst NextStepSchema = z.object({\n\tcommand: z.string(),\n\toptions: z.record(z.string(), z.string()).optional(),\n\tdescription: z.string(),\n\thint: z.string().optional(),\n});\n\nexport const quickstartOptions = z.object({\n\ttitle: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\n\t\t\t\"Product name — providing this (or --price/--billing_period) makes quickstart create your product\",\n\t\t),\n\tprice: z.coerce\n\t\t.number()\n\t\t.optional()\n\t\t.describe(\"Price in the plan's currency (e.g. 9.99 for $9.99, 0 = free)\"),\n\tbilling_period: z\n\t\t.enum([\n\t\t\t\"monthly\",\n\t\t\t\"annually\",\n\t\t\t\"quarterly\",\n\t\t\t\"weekly\",\n\t\t\t\"daily\",\n\t\t\t\"every_two_years\",\n\t\t\t\"one_time\",\n\t\t])\n\t\t.optional()\n\t\t.describe(\"Billing interval — use 'one_time' for a single payment\"),\n\tcompany_id: z\n\t\t.string()\n\t\t.optional()\n\t\t.describe(\n\t\t\t\"Business account to act on behalf of (biz_xxx); defaults to your active account\",\n\t\t),\n});\n\nexport const quickstartOutput = z.object({\n\taccount: z.string().nullable().describe(\"Authenticated account name\"),\n\tready: z\n\t\t.boolean()\n\t\t.describe(\"Whether you can take a sale now (a product with a plan exists)\"),\n\tcheckoutUrl: z\n\t\t.string()\n\t\t.nullable()\n\t\t.describe(\n\t\t\t\"The live checkout link to share — the journey's payoff, present once a plan exists\",\n\t\t),\n\tcreated: z\n\t\t.object({ productId: z.string().optional(), planId: z.string().optional() })\n\t\t.nullable()\n\t\t.describe(\n\t\t\t\"What this run created, if anything — null for a read-only status check\",\n\t\t),\n\tsteps: z.array(StepSchema).describe(\"The path to your first sale\"),\n\tnextStep: NextStepSchema.nullable().describe(\n\t\t\"The single command to run next, pre-filled — null when nothing is required\",\n\t),\n});\n\ntype Step = z.infer<typeof StepSchema>;\ntype NextStep = z.infer<typeof NextStepSchema>;\n\ntype CtaCommand = {\n\tcommand: string;\n\tdescription?: string;\n\toptions?: Record<string, string>;\n};\n\ntype RunCtx = {\n\tagent: boolean;\n\tformatExplicit: boolean;\n\toptions: z.infer<typeof quickstartOptions>;\n\tsetupAgents?: () => Promise<void>;\n\tok: (data: z.infer<typeof quickstartOutput>) => never;\n\terror: (opts: {\n\t\tcode: string;\n\t\tmessage: string;\n\t\tretryable?: boolean;\n\t\texitCode?: number;\n\t\tcta?: { description?: string; commands: CtaCommand[] };\n\t}) => never;\n};\n\ntype ErrorEnvelope = Parameters<RunCtx[\"error\"]>[0];\n\n// incur's `c.error` is a sentinel that only takes effect when returned from the\n// command `run`. Nested helpers can't force the caller to return, so they throw\n// this instead; runCreate's caller catches it and returns `c.error(envelope)`,\n// preserving code/retryable/cta (which a plain thrown Error would lose).\nclass QuickstartError extends Error {\n\tconstructor(readonly envelope: ErrorEnvelope) {\n\t\tsuper(envelope.message);\n\t}\n}\n\nexport async function runQuickstart(c: RunCtx): Promise<never> {\n\tconst profile = getActiveProfile();\n\t// Mirror the auth middleware: a saved profile OR a WHOP_API_KEY env var (the\n\t// agent / CI path) is enough — don't reject env-key auth the gate let through.\n\tif (!profile && !process.env.WHOP_API_KEY) {\n\t\treturn c.error({\n\t\t\tcode: \"NOT_AUTHENTICATED\",\n\t\t\tmessage: \"Not logged in.\",\n\t\t\tcta: {\n\t\t\t\tcommands: [{ command: \"auth login\", description: \"Log in to Whop\" }],\n\t\t\t},\n\t\t});\n\t}\n\n\tif (!c.agent && !c.formatExplicit && c.setupAgents) {\n\t\ttry {\n\t\t\tawait c.setupAgents();\n\t\t} catch (err) {\n\t\t\tconst message =\n\t\t\t\terr instanceof Error ? err.message : \"Couldn't set up Whop for agents.\";\n\t\t\tconsole.log(`\\n${chalk.yellow(\"!\")} Agent setup skipped: ${message}`);\n\t\t\tconsole.log(\n\t\t\t\tchalk.dim(\n\t\t\t\t\t\" You can retry later with `whop skills add` and `whop mcp add`.\",\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tconst companyId =\n\t\tc.options.company_id ?? (await resolveActiveCompanyId()) ?? \"\";\n\tconst accountName =\n\t\tprofile?.accountTitle ??\n\t\tprofile?.accountRoute ??\n\t\tprofile?.name ??\n\t\t\"your account\";\n\n\tif (!companyId) {\n\t\treturn c.error({\n\t\t\tcode: \"NO_COMPANY\",\n\t\t\tmessage:\n\t\t\t\t\"No business account is linked to this login. Create a business account on Whop, then log in again.\",\n\t\t\tretryable: false,\n\t\t\tcta: {\n\t\t\t\tdescription: \"Create a business account, then re-authenticate:\",\n\t\t\t\tcommands: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcommand: \"auth login\",\n\t\t\t\t\t\tdescription: \"Log in and pick a business account\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t});\n\t}\n\n\tconst [productsRes, plansRes, checkoutRes] = await Promise.allSettled([\n\t\tmakeWhopRequest<ListResponse>(\n\t\t\t\"GET\",\n\t\t\t`/products?company_id=${companyId}&first=100`,\n\t\t),\n\t\tmakeWhopRequest<ListResponse>(\n\t\t\t\"GET\",\n\t\t\t`/plans?account_id=${companyId}&first=100`,\n\t\t),\n\t\tmakeWhopRequest<ListResponse>(\n\t\t\t\"GET\",\n\t\t\t`/checkout_configurations?company_id=${companyId}&first=100`,\n\t\t),\n\t]);\n\n\t// Don't let a failed products/plans lookup masquerade as \"nothing exists\" —\n\t// that would show empty steps or, worse, prompt a duplicate create. Surface\n\t// the real error instead. A failed checkout lookup is non-critical.\n\tconst critical = [productsRes, plansRes].find((r) => r.status === \"rejected\");\n\tif (critical && critical.status === \"rejected\") {\n\t\tconst reason = critical.reason;\n\t\treturn c.error({\n\t\t\tcode: \"STATUS_CHECK_FAILED\",\n\t\t\tmessage: `Couldn't load your current setup: ${reason instanceof Error ? reason.message : \"API error\"}`,\n\t\t\tretryable: true,\n\t\t});\n\t}\n\n\tconst products =\n\t\tproductsRes.status === \"fulfilled\" ? (productsRes.value.data ?? []) : [];\n\tconst plans =\n\t\tplansRes.status === \"fulfilled\" ? (plansRes.value.data ?? []) : [];\n\tconst checkouts =\n\t\tcheckoutRes.status === \"fulfilled\" ? (checkoutRes.value.data ?? []) : [];\n\n\tconst ready = products.length > 0 && plans.length > 0;\n\tconst hasCreationFlags =\n\t\tc.options.title !== undefined ||\n\t\tc.options.price !== undefined ||\n\t\tc.options.billing_period !== undefined;\n\n\t// Mutate-gate: explicit creation flags always create (the user asked for it,\n\t// even on an already-set-up account). Without flags we only auto-guide a\n\t// create when something is missing AND we're interactive — so a ready account\n\t// in agent mode or with `--format`/`--json` stays a pure read-only status check.\n\tconst canMutateInteractively = !c.agent && !c.formatExplicit;\n\tconst shouldCreate = hasCreationFlags || (!ready && canMutateInteractively);\n\n\tif (shouldCreate) {\n\t\ttry {\n\t\t\treturn await runCreate(c, { companyId, accountName, products });\n\t\t} catch (err) {\n\t\t\tif (err instanceof QuickstartError) return c.error(err.envelope);\n\t\t\tthrow err;\n\t\t}\n\t}\n\n\tconst steps = buildSteps(products, plans);\n\tconst checkoutUrl = plans.find((p) => p.purchase_url)?.purchase_url ?? null;\n\tconst nextStep = resolveNextStep(products, plans, checkouts.length > 0);\n\n\tif (!c.agent && !c.formatExplicit) {\n\t\tprintSummary(accountName, steps, ready, checkoutUrl, nextStep);\n\t}\n\n\treturn c.ok({\n\t\taccount: accountName,\n\t\tready,\n\t\tcheckoutUrl,\n\t\tcreated: null,\n\t\tsteps,\n\t\tnextStep,\n\t});\n}\n\n/** Returns the provided value, errors in agent mode, or prompts interactively. */\nasync function resolveOrPrompt<T>(\n\tc: RunCtx,\n\tprovided: T | undefined,\n\tmissing: { code: string; message: string; example: string },\n\tprompt: () => Promise<T | symbol>,\n): Promise<T> {\n\tif (provided !== undefined) return provided;\n\tif (c.agent) {\n\t\tthrow new QuickstartError({\n\t\t\tcode: missing.code,\n\t\t\tmessage: `${missing.message} Example: ${missing.example}`,\n\t\t\tretryable: true,\n\t\t});\n\t}\n\tconst value = await prompt();\n\tif (isCancel(value))\n\t\tthrow new QuickstartError({\n\t\t\tcode: \"CANCELLED\",\n\t\t\tmessage: \"Setup cancelled.\",\n\t\t\texitCode: 130,\n\t\t});\n\treturn value as T;\n}\n\nconst FULL_EXAMPLE =\n\t'whop quickstart --title \"My Course\" --price 9.99 --billing_period monthly';\n\nasync function runCreate(\n\tc: RunCtx,\n\tstate: { companyId: string; accountName: string; products: ListItem[] },\n): Promise<never> {\n\tif (!c.agent) {\n\t\tconsole.log(`\\n${chalk.bold(\"Let's get you set up to sell.\")}\\n`);\n\t}\n\n\t// Create a new product when none exist or when an explicit --title is given\n\t// (the user named a product, so honor that intent even if they already have\n\t// others). Otherwise attach the new plan to an existing one.\n\t//\n\t// Gather every input up front, before any POST, so a partial invocation (e.g.\n\t// an agent passes --title but omits --price) fails cleanly without leaving an\n\t// orphaned product behind — and so a cancelled TTY prompt creates nothing.\n\tconst needsNewProduct =\n\t\tstate.products.length === 0 || c.options.title !== undefined;\n\tconst newTitle = needsNewProduct\n\t\t? await resolveOrPrompt(\n\t\t\t\tc,\n\t\t\t\tc.options.title,\n\t\t\t\t{\n\t\t\t\t\tcode: \"TITLE_REQUIRED\",\n\t\t\t\t\tmessage: \"Pass --title to name your product.\",\n\t\t\t\t\texample: FULL_EXAMPLE,\n\t\t\t\t},\n\t\t\t\t() =>\n\t\t\t\t\ttext({\n\t\t\t\t\t\tmessage: \"What are you selling?\",\n\t\t\t\t\t\tplaceholder: \"My Online Course\",\n\t\t\t\t\t}),\n\t\t\t)\n\t\t: undefined;\n\tconst existing = needsNewProduct\n\t\t? undefined\n\t\t: await resolveExistingProduct(c, state.products);\n\n\tconst price = await resolveOrPrompt(\n\t\tc,\n\t\tc.options.price,\n\t\t{\n\t\t\tcode: \"PRICE_REQUIRED\",\n\t\t\tmessage: \"Pass --price in dollars (9.99 = $9.99, 0 = free).\",\n\t\t\texample: FULL_EXAMPLE,\n\t\t},\n\t\tasync () => {\n\t\t\tconst p = await text({\n\t\t\t\tmessage: \"Price in dollars (9.99 = $9.99, 0 = free):\",\n\t\t\t\tplaceholder: \"9.99\",\n\t\t\t\tvalidate: (v) => (isNaN(Number(v)) ? \"Enter a number\" : undefined),\n\t\t\t});\n\t\t\treturn isCancel(p) ? p : Number(p);\n\t\t},\n\t);\n\n\tconst billingPeriod = await resolveOrPrompt(\n\t\tc,\n\t\tc.options.billing_period,\n\t\t{\n\t\t\tcode: \"BILLING_PERIOD_REQUIRED\",\n\t\t\tmessage: \"Pass --billing_period (one_time, monthly, annually, …).\",\n\t\t\texample: FULL_EXAMPLE,\n\t\t},\n\t\t() =>\n\t\t\tselect({\n\t\t\t\tmessage: \"How should customers be charged?\",\n\t\t\t\toptions: [\n\t\t\t\t\t{ value: \"one_time\", label: \"One-time payment\" },\n\t\t\t\t\t{ value: \"monthly\", label: \"Monthly subscription\" },\n\t\t\t\t\t{ value: \"annually\", label: \"Annual subscription\" },\n\t\t\t\t\t{ value: \"quarterly\", label: \"Quarterly\" },\n\t\t\t\t],\n\t\t\t}) as Promise<NonNullable<typeof c.options.billing_period> | symbol>,\n\t);\n\n\tlet productId: string;\n\tlet productTitle: string;\n\tlet productCreated = false;\n\tif (existing) {\n\t\tproductId = existing.id;\n\t\tproductTitle = existing.title ?? existing.id;\n\t} else {\n\t\tlet product: { id: string; title: string };\n\t\ttry {\n\t\t\tproduct = await makeWhopRequest<{ id: string; title: string }>(\n\t\t\t\t\"POST\",\n\t\t\t\t\"/products\",\n\t\t\t\t{\n\t\t\t\t\ttitle: newTitle,\n\t\t\t\t\tcompany_id: state.companyId,\n\t\t\t\t},\n\t\t\t);\n\t\t} catch (err) {\n\t\t\treturn c.error({\n\t\t\t\tcode: \"API_ERROR\",\n\t\t\t\tmessage: `Failed to create product: ${err instanceof Error ? err.message : \"unknown error\"}`,\n\t\t\t\tretryable: true,\n\t\t\t});\n\t\t}\n\t\tproductId = product.id;\n\t\tproductTitle = product.title;\n\t\tproductCreated = true;\n\t}\n\n\tconst isRenewal = billingPeriod !== \"one_time\";\n\tconst planBody: Record<string, unknown> = {\n\t\tproduct_id: productId,\n\t\taccount_id: state.companyId,\n\t\tinitial_price: price,\n\t\tplan_type: isRenewal ? \"renewal\" : \"one_time\",\n\t};\n\tif (isRenewal) {\n\t\tplanBody.billing_period = BILLING_PERIOD_DAYS[billingPeriod];\n\t\tplanBody.renewal_price = price;\n\t}\n\n\tlet plan: { id: string; purchase_url?: string | null };\n\ttry {\n\t\tplan = await makeWhopRequest<{ id: string; purchase_url?: string | null }>(\n\t\t\t\"POST\",\n\t\t\t\"/plans\",\n\t\t\tplanBody,\n\t\t);\n\t} catch (err) {\n\t\t// Product is ready but the plan failed — hand back a recovery command with\n\t\t// the product id already filled in. Only claim the product \"was created\"\n\t\t// when we actually created it this run (vs reused an existing one).\n\t\tconst detail = err instanceof Error ? err.message : \"unknown error\";\n\t\treturn c.error({\n\t\t\tcode: \"PLAN_FAILED\",\n\t\t\tmessage: productCreated\n\t\t\t\t? `Your product \"${productTitle}\" (${productId}) was created, but the plan failed: ${detail}`\n\t\t\t\t: `Couldn't add a plan to \"${productTitle}\" (${productId}): ${detail}`,\n\t\t\tretryable: false,\n\t\t\tcta: {\n\t\t\t\tdescription: \"Finish by adding a plan to your product:\",\n\t\t\t\tcommands: [\n\t\t\t\t\t{\n\t\t\t\t\t\tcommand: \"plans create\",\n\t\t\t\t\t\toptions: { product_id: productId },\n\t\t\t\t\t\tdescription: \"Add a pricing plan\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t});\n\t}\n\n\tconst checkoutUrl = plan.purchase_url ?? null;\n\tconst steps: Step[] = [\n\t\t{ id: \"auth\", label: \"Log in\", complete: true },\n\t\t{\n\t\t\tid: \"products\",\n\t\t\tlabel: \"Create a product\",\n\t\t\tcomplete: true,\n\t\t\tcount: 1,\n\t\t\tfirstId: productId,\n\t\t\tfirstTitle: productTitle,\n\t\t},\n\t\t{\n\t\t\tid: \"plans\",\n\t\t\tlabel: \"Add a pricing plan\",\n\t\t\tcomplete: true,\n\t\t\tcount: 1,\n\t\t\tfirstId: plan.id,\n\t\t},\n\t];\n\tconst nextStep = resolveNextStep(\n\t\t[{ id: productId }],\n\t\t[{ id: plan.id }],\n\t\tfalse,\n\t);\n\n\tif (!c.agent && !c.formatExplicit) {\n\t\tprintSummary(\n\t\t\tstate.accountName,\n\t\t\tsteps,\n\t\t\ttrue,\n\t\t\tcheckoutUrl,\n\t\t\tnextStep,\n\t\t\tproductTitle,\n\t\t);\n\t}\n\n\treturn c.ok({\n\t\taccount: state.accountName,\n\t\tready: true,\n\t\tcheckoutUrl,\n\t\tcreated: { productId, planId: plan.id },\n\t\tsteps,\n\t\tnextStep,\n\t});\n}\n\nasync function resolveExistingProduct(\n\tc: RunCtx,\n\tproducts: ListItem[],\n): Promise<ListItem> {\n\tif (products.length === 1) return products[0];\n\tif (c.agent) {\n\t\tthrow new QuickstartError({\n\t\t\tcode: \"PRODUCT_REQUIRED\",\n\t\t\tmessage: `You have ${products.length} products — add the plan to a specific one with plans create --product_id.`,\n\t\t\tretryable: true,\n\t\t\tcta: {\n\t\t\t\tdescription: \"Pick a product:\",\n\t\t\t\tcommands: products.map((p) => ({\n\t\t\t\t\tcommand: \"plans create\",\n\t\t\t\t\toptions: { product_id: p.id },\n\t\t\t\t\tdescription: p.title ?? p.id,\n\t\t\t\t})),\n\t\t\t},\n\t\t});\n\t}\n\tconst chosen = await select<string>({\n\t\tmessage: \"Which product is this plan for?\",\n\t\toptions: products.map((p) => ({\n\t\t\tvalue: p.id,\n\t\t\tlabel: p.title ?? p.id,\n\t\t\thint: p.id,\n\t\t})),\n\t});\n\tif (isCancel(chosen))\n\t\tthrow new QuickstartError({\n\t\t\tcode: \"CANCELLED\",\n\t\t\tmessage: \"Setup cancelled.\",\n\t\t\texitCode: 130,\n\t\t});\n\tconst match = products.find((p) => p.id === chosen);\n\tif (!match) {\n\t\tthrow new QuickstartError({\n\t\t\tcode: \"PRODUCT_NOT_FOUND\",\n\t\t\tmessage: `Selected product \"${chosen}\" is no longer available.`,\n\t\t\tretryable: true,\n\t\t});\n\t}\n\treturn match;\n}\n\nfunction buildSteps(products: ListItem[], plans: ListItem[]): Step[] {\n\treturn [\n\t\t{ id: \"auth\", label: \"Log in\", complete: true },\n\t\t{\n\t\t\tid: \"products\",\n\t\t\tlabel: \"Create a product\",\n\t\t\tcomplete: products.length > 0,\n\t\t\tcount: products.length,\n\t\t\tfirstId: products[0]?.id,\n\t\t\tfirstTitle: products[0]?.title ?? undefined,\n\t\t},\n\t\t{\n\t\t\tid: \"plans\",\n\t\t\tlabel: \"Add a pricing plan\",\n\t\t\tcomplete: plans.length > 0,\n\t\t\tcount: plans.length,\n\t\t\tfirstId: plans[0]?.id,\n\t\t},\n\t];\n}\n\nfunction resolveNextStep(\n\tproducts: Array<{ id: string }>,\n\tplans: Array<{ id: string }>,\n\thasCheckoutConfig: boolean,\n): NextStep | null {\n\tif (products.length === 0 || plans.length === 0) {\n\t\treturn {\n\t\t\tcommand: \"quickstart\",\n\t\t\tdescription:\n\t\t\t\t\"Create your product and pricing — ends with a checkout link\",\n\t\t\thint: \"Walks you through name, price, and billing. Pass --title/--price/--billing_period to skip the prompts.\",\n\t\t};\n\t}\n\tif (!hasCheckoutConfig) {\n\t\treturn {\n\t\t\tcommand: \"checkout-configurations create\",\n\t\t\toptions: plans[0]?.id ? { plan_id: plans[0].id } : undefined,\n\t\t\tdescription: \"Optional: customize your checkout page\",\n\t\t\thint: \"Your checkout link already works — this only tweaks currency, redirect, and payment mode\",\n\t\t};\n\t}\n\treturn null;\n}\n\nfunction printSummary(\n\taccount: string | null,\n\tsteps: Step[],\n\tready: boolean,\n\tcheckoutUrl: string | null,\n\tnextStep: NextStep | null,\n\tcreatedLabel?: string,\n): void {\n\tconst heading = createdLabel\n\t\t? `You're set up to sell \"${createdLabel}\"`\n\t\t: `Setup for \"${account ?? \"your account\"}\"`;\n\tconsole.log(`\\n${chalk.bold(heading)}\\n`);\n\n\tlet pendingMarked = false;\n\tfor (const step of steps) {\n\t\tif (step.complete) {\n\t\t\tlet label = step.label;\n\t\t\tif (step.count !== undefined) {\n\t\t\t\tlabel += chalk.dim(` (${step.count})`);\n\t\t\t\tif (step.firstTitle) label += chalk.dim(` — \"${step.firstTitle}\"`);\n\t\t\t}\n\t\t\tconsole.log(` ${c.success(\"✓\")} ${label}`);\n\t\t} else if (!pendingMarked) {\n\t\t\tpendingMarked = true;\n\t\t\tconsole.log(` ${chalk.cyan(\"●\")} ${chalk.bold(step.label)}`);\n\t\t} else {\n\t\t\tconsole.log(` ${chalk.dim(\"○\")} ${chalk.dim(step.label)}`);\n\t\t}\n\t}\n\n\tif (ready && checkoutUrl) {\n\t\tconsole.log(\n\t\t\t`\\n${chalk.green.bold(\"🎉 You're ready to sell.\")} Share your checkout link:`,\n\t\t);\n\t\tconsole.log(` ${chalk.cyan.underline(checkoutUrl)}`);\n\t}\n\n\tif (nextStep) {\n\t\tconst opts = nextStep.options\n\t\t\t? \" \" +\n\t\t\t\tObject.entries(nextStep.options)\n\t\t\t\t\t.map(([k, v]) => `--${k} ${v}`)\n\t\t\t\t\t.join(\" \")\n\t\t\t: \"\";\n\t\tconst label = ready ? \"Optional next\" : chalk.bold(\"Next step\");\n\t\tconsole.log(\n\t\t\t`\\n${label} ${chalk.cyan.bold(`whop ${nextStep.command}${opts}`)}`,\n\t\t);\n\t\tif (nextStep.hint) console.log(` ${chalk.dim(`→ ${nextStep.hint}`)}`);\n\t} else if (ready) {\n\t\tconsole.log(`\\n${c.success(\"✓ Your store is fully set up.\")}`);\n\t}\n\tconsole.log(\"\");\n}\n","import chalk from \"chalk\";\n\nexport const c = {\n heading: chalk.bold,\n command: chalk.bold,\n description: chalk.dim,\n flag: chalk.yellow,\n tableHeader: chalk.bold,\n separator: chalk.dim,\n number: chalk.dim,\n muted: chalk.dim,\n id: chalk.cyan,\n link: chalk.cyan.underline,\n success: chalk.green,\n error: chalk.red.bold,\n};\n","import groups from \"./api/groups.json\" with { type: \"json\" };\nimport {\n\tbuildAuthGroup,\n\tloginAdapter,\n\tloginEnv,\n\tloginExamples,\n\tloginHint,\n\tloginOptions,\n\tloginOutput,\n\tlogoutAdapter,\n\tlogoutOptions,\n\tlogoutOutput,\n} from \"./auth/commands\";\nimport {\n\tbuildCheckoutGroup,\n\tbuildPlansGroup,\n\tbuildProductsGroup,\n} from \"./commerce/index\";\nimport {\n\tquickstartOptions,\n\tquickstartOutput,\n\trunQuickstart,\n} from \"./journey/quickstart\";\n\ntype CliRegistration = {\n\tcommand: (...args: any[]) => unknown;\n\tserve: (\n\t\targv: string[],\n\t\toptions?: {\n\t\t\texit?: (code: number) => void;\n\t\t\tstdout?: (chunk: string) => void;\n\t\t},\n\t) => Promise<void>;\n};\n\ntype HandwrittenGroup = {\n\tname: string;\n\tdescription: string;\n\tsection: \"get-started\" | \"commerce\" | \"auth\";\n\tregister: (cli: CliRegistration) => unknown;\n};\n\nexport const HANDWRITTEN_GROUPS = [\n\t{\n\t\tname: \"quickstart\",\n\t\tdescription: \"Start here — check status and create your first product + checkout link\",\n\t\tsection: \"get-started\",\n\t\tregister: (cli: CliRegistration) =>\n\t\t\tcli.command(\"quickstart\", {\n\t\t\t\tdescription: \"Start selling — check your status and create what's missing\",\n\t\t\t\thint: \"In a terminal it guides you to your first sale. Agents: a read-only status check unless you pass --title/--price/--billing_period.\",\n\t\t\t\toptions: quickstartOptions,\n\t\t\t\toutput: quickstartOutput,\n\t\t\t\texamples: [\n\t\t\t\t\t{ description: \"Check status / get guided to your first sale\" },\n\t\t\t\t\t{\n\t\t\t\t\t\toptions: {\n\t\t\t\t\t\t\ttitle: \"My Course\",\n\t\t\t\t\t\t\tprice: 9.99,\n\t\t\t\t\t\t\tbilling_period: \"monthly\" as const,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdescription: \"Create a $9.99/mo product non-interactively\",\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\toutputPolicy: \"agent-only\",\n\t\t\t\trun: (c: Parameters<typeof runQuickstart>[0]) =>\n\t\t\t\t\trunQuickstart({ ...c, setupAgents: () => setupAgents(cli) }),\n\t\t\t}),\n\t},\n\t{\n\t\tname: \"products\",\n\t\tdescription: \"What you're selling\",\n\t\tsection: \"commerce\",\n\t\tregister: (cli: CliRegistration) => cli.command(buildProductsGroup()),\n\t},\n\t{\n\t\tname: \"plans\",\n\t\tdescription: \"Pricing for your products\",\n\t\tsection: \"commerce\",\n\t\tregister: (cli: CliRegistration) => cli.command(buildPlansGroup()),\n\t},\n\t{\n\t\tname: \"checkout-configurations\",\n\t\tdescription: \"Optional / advanced: customize the checkout page\",\n\t\tsection: \"commerce\",\n\t\tregister: (cli: CliRegistration) => cli.command(buildCheckoutGroup()),\n\t},\n\t{\n\t\tname: \"auth\",\n\t\tdescription: \"Manage authentication\",\n\t\tsection: \"auth\",\n\t\tregister: (cli: CliRegistration) => cli.command(buildAuthGroup()),\n\t},\n\t{\n\t\tname: \"login\",\n\t\tdescription: \"Sign in to Whop\",\n\t\tsection: \"auth\",\n\t\tregister: (cli: CliRegistration) =>\n\t\t\tcli.command(\"login\", {\n\t\t\t\tdescription: \"Log in to Whop (alias for `auth login`)\",\n\t\t\t\toptions: loginOptions,\n\t\t\t\tenv: loginEnv,\n\t\t\t\toutput: loginOutput,\n\t\t\t\texamples: loginExamples,\n\t\t\t\thint: loginHint,\n\t\t\t\trun: (c: Parameters<typeof loginAdapter>[0]) => loginAdapter(c),\n\t\t\t}),\n\t},\n\t{\n\t\tname: \"logout\",\n\t\tdescription: \"Sign out\",\n\t\tsection: \"auth\",\n\t\tregister: (cli: CliRegistration) =>\n\t\t\tcli.command(\"logout\", {\n\t\t\t\tdescription: \"Log out (alias for `auth logout`)\",\n\t\t\t\toptions: logoutOptions,\n\t\t\t\toutput: logoutOutput,\n\t\t\t\trun: (c: Parameters<typeof logoutAdapter>[0]) => logoutAdapter(c),\n\t\t\t}),\n\t},\n] satisfies HandwrittenGroup[];\n\nexport const HANDWRITTEN_GROUP_NAMES = new Set(\n\tHANDWRITTEN_GROUPS.map(({ name }) => name),\n);\n\nexport const API_GROUPS = groups\n\t.map(([name, tag]) => ({ name, tag }))\n\t.filter(({ name }) => !HANDWRITTEN_GROUP_NAMES.has(name));\n\nexport const COMMAND_GROUPS = [...API_GROUPS, ...HANDWRITTEN_GROUPS] as const;\n\nexport function registerHandwrittenGroups(cli: CliRegistration) {\n\tfor (const group of HANDWRITTEN_GROUPS) group.register(cli);\n}\n\nasync function setupAgents(cli: CliRegistration) {\n\tfor (const argv of [\n\t\t[\"skills\", \"add\"],\n\t\t[\"mcp\", \"add\"],\n\t]) {\n\t\tlet exitCode = 0;\n\t\tawait cli.serve(argv, {\n\t\t\texit: (code) => {\n\t\t\t\texitCode = code;\n\t\t\t},\n\t\t\tstdout: (chunk) => process.stdout.write(chunk),\n\t\t});\n\t\tif (exitCode !== 0) throw new Error(`whop ${argv.join(\" \")} failed.`);\n\t}\n}\n","{\n\t\"name\": \"@whop/cli\",\n\t\"version\": \"0.0.5\",\n\t\"description\": \"The Whop CLI — build and manage Whop apps from your terminal. Human and agent friendly.\",\n\t\"keywords\": [\n\t\t\"agent\",\n\t\t\"apps\",\n\t\t\"cli\",\n\t\t\"developer\",\n\t\t\"whop\"\n\t],\n\t\"homepage\": \"https://whop.com/developers/\",\n\t\"bugs\": \"https://github.com/whopio/whop-sdk-ts/issues\",\n\t\"license\": \"MIT\",\n\t\"repository\": {\n\t\t\"type\": \"git\",\n\t\t\"url\": \"git+https://github.com/whopio/whop-sdk-ts.git\",\n\t\t\"directory\": \"packages/cli\"\n\t},\n\t\"bin\": {\n\t\t\"whop\": \"dist/index.js\",\n\t\t\"whop-cli\": \"dist/index.js\"\n\t},\n\t\"files\": [\n\t\t\"dist\"\n\t],\n\t\"type\": \"module\",\n\t\"publishConfig\": {\n\t\t\"access\": \"public\"\n\t},\n\t\"scripts\": {\n\t\t\"build\": \"tsx scripts/sync-spec.ts && pnpm run clean && tsup\",\n\t\t\"clean\": \"rm -rf dist\",\n\t\t\"dev\": \"tsx scripts/sync-spec.ts && tsx src/index.ts\",\n\t\t\"start\": \"node dist/index.js\",\n\t\t\"check-types\": \"tsx scripts/sync-spec.ts && tsc --noEmit\",\n\t\t\"lint\": \"oxlint .\",\n\t\t\"lint:fix\": \"oxlint --fix --fix-suggestions && oxfmt\",\n\t\t\"ci:lint\": \"oxlint -f github .\",\n\t\t\"format\": \"oxfmt\",\n\t\t\"sync-spec\": \"tsx scripts/sync-spec.ts\",\n\t\t\"test\": \"tsx --test scripts/*.test.ts\"\n\t},\n\t\"dependencies\": {\n\t\t\"@clack/prompts\": \"^1.5.1\",\n\t\t\"@napi-rs/keyring\": \"^1.3.0\",\n\t\t\"@whop/sdk\": \"^0.0.40\",\n\t\t\"chalk\": \"5.4.1\"\n\t},\n\t\"devDependencies\": {\n\t\t\"@types/node\": \"25.3.5\",\n\t\t\"incur\": \"github:whopio/incur#ea62f88\",\n\t\t\"tsup\": \"8.5.0\",\n\t\t\"tsx\": \"4.19.4\",\n\t\t\"typescript\": \"5.9.3\"\n\t},\n\t\"engines\": {\n\t\t\"node\": \">=22\"\n\t},\n\t\"packageManager\": \"pnpm@10.23.0\"\n}\n","import { c } from \"./colors\";\n\nconst MAX_CELL_WIDTH = 40\n\nfunction isPlainObject(value: unknown): value is Record<string, unknown> {\n return typeof value === 'object' && value !== null && !Array.isArray(value)\n}\n\nfunction isObjectArray(value: unknown): value is Record<string, unknown>[] {\n return Array.isArray(value) && value.length > 0 && value.every(isPlainObject)\n}\n\nconst WHOP_TAG = /^[a-z]+_[A-Za-z0-9]+$/\n\n/** Plain truncated string — used for column width calculation (no ANSI codes). */\nfunction cellText(value: unknown): string {\n if (value == null) return ''\n const text = String(value)\n return text.length > MAX_CELL_WIDTH ? text.slice(0, MAX_CELL_WIDTH - 1) + '…' : text\n}\n\n/** Colored display string — used for rendering. */\nfunction formatCell(value: unknown): string {\n const text = cellText(value)\n if (typeof value === 'boolean') return value ? c.success(text) : c.error(text)\n if (typeof value === 'string' && WHOP_TAG.test(value)) return c.id(text)\n return text\n}\n\n/** Total printable width of one row: sum of column widths plus two-space separators between them. */\nfunction totalRowWidth(colWidths: number[]): number {\n const columnTotal = colWidths.reduce((sum, colWidth) => sum + colWidth, 0)\n return columnTotal + (colWidths.length - 1) * 2\n}\n\n/**\n * Renders an array of plain objects as an aligned terminal grid.\n * Drops columns from the right when the row would exceed the terminal width.\n */\nfunction renderRows(rows: Record<string, unknown>[]): string {\n // Only include keys that are scalar across every row — a column where some rows\n // have an object and others have null would render as \"[object Object]\".\n const isScalar = (value: unknown) => typeof value !== 'object' || value === null\n const scalarKeys = Object.keys(rows[0]!).filter((key) =>\n rows.every((row) => isScalar(row[key])),\n )\n\n if (scalarKeys.length === 0) return '(no displayable columns)'\n\n // Column width = max of the header label and the widest cell value across all rows.\n const allWidths = scalarKeys.map((key) =>\n Math.max(key.length, ...rows.map((row) => cellText(row[key]).length)),\n )\n\n // Drop the rightmost columns until the row fits within the terminal width.\n const termWidth = process.stdout.columns ?? 80\n let numVisible = allWidths.length\n while (numVisible > 1 && totalRowWidth(allWidths.slice(0, numVisible)) > termWidth) {\n numVisible--\n }\n\n const visibleKeys = scalarKeys.slice(0, numVisible)\n const visibleWidths = allWidths.slice(0, numVisible)\n\n const header = visibleKeys\n .map((key, i) => c.tableHeader(key.toUpperCase().padEnd(visibleWidths[i]!)))\n .join(' ')\n\n const separator = c.separator(visibleWidths.map((w) => '─'.repeat(w)).join('──'))\n\n const body = rows.map((row) =>\n visibleKeys\n .map((key, i) => {\n const value = row[key]\n const formatted = formatCell(value)\n const width = visibleWidths[i]!\n const pad = width - cellText(value).length\n // Right-align numbers, left-align everything else.\n return typeof value === 'number'\n ? c.number(' '.repeat(pad) + formatted)\n : formatted + ' '.repeat(pad)\n })\n .join(' '),\n )\n\n const hiddenCount = scalarKeys.length - numVisible\n const overflowHint =\n hiddenCount > 0\n ? `\\n${c.muted(`& ${hiddenCount} more columns — use --format json to see all`)}`\n : ''\n\n return [header, separator, ...body].join('\\n') + overflowHint\n}\n\n/**\n * Human-mode renderer passed to incur as `renderer`.\n * Handles top-level arrays and single-array wrapped responses (e.g. `{ accounts: [...], pagination: {...} }`).\n * Returns null for anything that can't be meaningfully rendered as a grid, falling back to incur's TOON formatter.\n */\nexport function render(data: unknown): string | null {\n if (isObjectArray(data)) return renderRows(data)\n\n if (isPlainObject(data)) {\n const arrayFields = Object.values(data).filter(isObjectArray)\n // Only render when there's exactly one array field — avoids guessing which to show.\n if (arrayFields.length === 1) {\n return renderRows(arrayFields[0] as Record<string, unknown>[])\n }\n }\n\n return null\n}\n","import { Cli } from \"incur\";\nimport { nativeSpec, filterSpecByTag, createWhopFetch } from \"./api\";\nimport { API_GROUPS, registerHandwrittenGroups } from \"./commands\";\nimport pkg from \"../package.json\" with { type: \"json\" };\nimport { render } from \"./lib/renderer\";\nimport { performLogin } from \"./auth/commands\";\nimport { getActiveProfile } from \"./auth/profiles\";\nimport { PromptCancelledError } from \"./auth/prompts\";\n\nconst cli = Cli.create(\"whop\", {\n\tversion: pkg.version,\n\tdescription: \"Build and manage Whop apps from your terminal.\",\n\trenderer: render,\n\tsync: {\n\t\tsuggestions: [\n\t\t\t\"start selling on Whop\",\n\t\t\t\"show my Whop business accounts\",\n\t\t\t\"create a Whop product and pricing plan\",\n\t\t],\n\t},\n\tmcp: {\n\t\tagents: [\"claude-desktop\"],\n\t},\n});\n\nconst spec = (tag: string) =>\n\tfilterSpecByTag(nativeSpec as Record<string, unknown>, tag);\nconst fetch = createWhopFetch();\n\nconst isAuthExempt = (cmd: string) =>\n\t!cmd ||\n\tcmd === \"login\" ||\n\tcmd === \"logout\" ||\n\tcmd === \"completions\" ||\n\tcmd.startsWith(\"auth\") ||\n\tcmd.startsWith(\"mcp\");\n\ncli.use(async (c, next) => {\n\tif (isAuthExempt(c.command)) return next();\n\tif (getActiveProfile()) return next();\n\tif (process.env.WHOP_API_KEY) return next();\n\n\tif (c.agent) {\n\t\treturn c.error({\n\t\t\tcode: \"NOT_AUTHENTICATED\",\n\t\t\tmessage: \"Not logged in. Set WHOP_API_KEY or run `whop login` first.\",\n\t\t\tcta: {\n\t\t\t\tcommands: [{ command: \"auth login\", description: \"Log in to Whop\" }],\n\t\t\t},\n\t\t});\n\t}\n\n\tlet result;\n\ttry {\n\t\tresult = await performLogin({ agent: false });\n\t} catch (err) {\n\t\tif (err instanceof PromptCancelledError) {\n\t\t\treturn c.error({\n\t\t\t\tcode: \"CANCELLED\",\n\t\t\t\tmessage: \"Login cancelled.\",\n\t\t\t\texitCode: 130,\n\t\t\t});\n\t\t}\n\t\tthrow err;\n\t}\n\n\tif (!result.ok) {\n\t\treturn c.error({\n\t\t\tcode: result.code,\n\t\t\tmessage: result.message,\n\t\t\tcta: {\n\t\t\t\tcommands: [{ command: \"auth login\", description: \"Log in to Whop\" }],\n\t\t\t},\n\t\t});\n\t}\n\n\treturn next();\n});\n\nregisterHandwrittenGroups(cli);\n\nfor (const { name, tag } of API_GROUPS) {\n\tcli.command(name, { fetch, openapi: spec(tag) });\n}\n\nexport default cli;\n","[\n {\n \"group\": \"Core Resources\",\n \"tags\": [\n \"Accounts\",\n \"Users\",\n \"Webhooks\",\n \"Stats\"\n ]\n },\n {\n \"group\": \"Money\",\n \"tags\": [\n \"Ledgers\",\n \"Payouts\",\n \"Cards\",\n \"Transfers\",\n \"Deposits\",\n \"Swaps\",\n \"Payout Methods\",\n \"Verifications\"\n ]\n },\n {\n \"group\": \"Commerce\",\n \"tags\": [\n \"Products\",\n \"Plans\",\n \"Checkout Configurations\",\n \"Referrals\"\n ]\n },\n {\n \"group\": \"Ads\",\n \"tags\": [\n \"Ads\",\n \"Ad Campaigns\",\n \"Ad Groups\",\n \"Audiences\"\n ]\n },\n {\n \"group\": \"Identity\",\n \"tags\": [\n \"Social Accounts\"\n ]\n }\n]\n","{\n \"Accounts\": \"Your Whop account\",\n \"Users\": \"Users on your platform\",\n \"Stats\": \"Platform-wide statistics\",\n \"Ledgers\": \"Transaction history\",\n \"Payouts\": \"Withdraw earnings\",\n \"Cards\": \"Issued virtual cards\",\n \"Transfers\": \"Move funds between accounts\",\n \"Deposits\": \"Add funds to your balance\",\n \"Swaps\": \"Convert between currencies\",\n \"Verifications\": \"Identity verification status\",\n \"Products\": \"Description of what you sell\",\n \"Plans\": \"Description of your pricing\",\n \"Checkout Configurations\": \"What your checkout page looks like\",\n \"Referrals\": \"Referral programs\",\n \"Ads\": \"Ad creatives\",\n \"Ad Campaigns\": \"Top-level campaign organization\",\n \"Ad Groups\": \"Sets of related ads\",\n \"Audiences\": \"Who sees your ads\",\n \"Social Accounts\": \"Linked social profiles\"\n}\n","import apiStructure from \"../api/api-structure.json\" with { type: \"json\" };\nimport tagDescriptions from \"../api/tag-descriptions.json\" with { type: \"json\" };\nimport { API_GROUPS, HANDWRITTEN_GROUPS } from \"../commands\";\nimport { c } from \"./colors\";\n\nconst descriptions: Record<string, string> = tagDescriptions;\nconst toCliName = (tag: string) => tag.toLowerCase().replace(/\\s+/g, \"-\");\n\nconst SECTION_LABELS = {\n\t\"get-started\": \"Get Started\",\n\tcommerce: \"Commerce\",\n\tauth: \"Auth\",\n} as const;\n\nconst INTEGRATIONS = [\n\t{ name: \"completions\", desc: \"Generate shell completion script\" },\n\t{ name: \"mcp add\", desc: \"Register as MCP server\" },\n\t{ name: \"skills\", desc: \"Sync skill files to agents (add, list)\" },\n];\n\nconst GLOBAL_FLAGS = [\n\t{\n\t\tflag: \"--filter-output <keys>\",\n\t\tdesc: \"Filter output by key paths (e.g. foo,bar.baz,a[0,3])\",\n\t},\n\t{ flag: \"--format <toon|json|yaml|md|jsonl>\", desc: \"Output format\" },\n\t{ flag: \"--full-output\", desc: \"Show full output envelope\" },\n\t{ flag: \"--help\", desc: \"Show help\" },\n\t{ flag: \"--llms, --llms-full\", desc: \"Print LLM-readable manifest\" },\n\t{ flag: \"--mcp\", desc: \"Start as MCP stdio server\" },\n\t{ flag: \"--schema\", desc: \"Show JSON Schema for command\" },\n\t{\n\t\tflag: \"--token-count\",\n\t\tdesc: \"Print token count of output (instead of output)\",\n\t},\n\t{ flag: \"--token-limit <n>\", desc: \"Limit output to n tokens\" },\n\t{ flag: \"--token-offset <n>\", desc: \"Skip first n tokens of output\" },\n\t{ flag: \"--version\", desc: \"Show version\" },\n];\n\ntype HelpCommand = {\n\tname: string;\n\tdescription: string;\n};\n\ntype HelpSection = {\n\tlabel: string;\n\tcommands: HelpCommand[];\n};\n\nconst handwrittenSection = (\n\tsection: (typeof HANDWRITTEN_GROUPS)[number][\"section\"],\n): HelpSection => ({\n\tlabel: SECTION_LABELS[section],\n\tcommands: HANDWRITTEN_GROUPS.filter((group) => group.section === section).map(\n\t\t({ name, description }) => ({ name, description }),\n\t),\n});\n\nexport function buildGroupedHelp(version: string, description: string): string {\n\tconst lines: string[] = [];\n\n\tconst presentCommands = new Set(API_GROUPS.map(({ name }) => name));\n\n\tconst apiSections = apiStructure\n\t\t.map(({ group, tags }) => ({\n\t\t\tlabel: group,\n\t\t\tcommands: (tags as string[])\n\t\t\t\t.filter((tag) => presentCommands.has(toCliName(tag)))\n\t\t\t\t.map((tag) => ({\n\t\t\t\t\tname: toCliName(tag),\n\t\t\t\t\tdescription: descriptions[tag] ?? \"\",\n\t\t\t\t})),\n\t\t}))\n\t\t.filter((section) => section.commands.length > 0);\n\n\tconst extraCommerce = apiSections\n\t\t.filter((section) => section.label.toLowerCase() === \"commerce\")\n\t\t.flatMap((section) => section.commands);\n\tconst commerceSection = handwrittenSection(\"commerce\");\n\tcommerceSection.commands = [...commerceSection.commands, ...extraCommerce];\n\n\tconst filteredApiSections = apiSections.filter(\n\t\t(section) => section.label.toLowerCase() !== \"commerce\",\n\t);\n\tconst allSections = [\n\t\thandwrittenSection(\"get-started\"),\n\t\tcommerceSection,\n\t\t...filteredApiSections,\n\t\thandwrittenSection(\"auth\"),\n\t].filter((section) => section.commands.length > 0);\n\tconst maxCmdLen = Math.max(\n\t\t...allSections.flatMap((section) =>\n\t\t\tsection.commands.map((command) => command.name.length),\n\t\t),\n\t);\n\n\tlines.push(`whop@${version} — ${description}`);\n\tlines.push(\"\");\n\tlines.push(\"Usage: whop <command>\");\n\n\tfor (const section of allSections) {\n\t\tlines.push(\"\");\n\t\tlines.push(c.heading(section.label.toUpperCase()));\n\t\tfor (const cmd of section.commands) {\n\t\t\tconst pad = \" \".repeat(maxCmdLen - cmd.name.length);\n\t\t\tlines.push(\n\t\t\t\t` ${c.command(cmd.name)}${pad} ${c.description(cmd.description)}`,\n\t\t\t);\n\t\t}\n\t}\n\n\tconst maxIntLen = Math.max(...INTEGRATIONS.map((i) => i.name.length));\n\tlines.push(\"\");\n\tlines.push(\"Integrations:\");\n\tfor (const i of INTEGRATIONS) {\n\t\tlines.push(\n\t\t\t` ${c.command(i.name)}${\" \".repeat(maxIntLen - i.name.length)} ${c.description(i.desc)}`,\n\t\t);\n\t}\n\n\tconst maxFlagLen = Math.max(...GLOBAL_FLAGS.map((f) => f.flag.length));\n\tlines.push(\"\");\n\tlines.push(\"Global Options:\");\n\tfor (const f of GLOBAL_FLAGS) {\n\t\tlines.push(\n\t\t\t` ${c.flag(f.flag)}${\" \".repeat(maxFlagLen - f.flag.length)} ${c.description(f.desc)}`,\n\t\t);\n\t}\n\n\treturn lines.join(\"\\n\");\n}\n","import { c } from \"./colors\";\n\n/**\n * Themes incur's built-in help / error / CTA text so the whole CLI looks\n * consistent with our hand-rendered surfaces (root help, quickstart, tables).\n *\n * incur exposes a `renderer` hook only for command *data*, not for help or\n * errors, so we post-process the text it writes to stdout instead. This runs\n * only in human TTY mode (see `shouldColorize`) — structured output\n * (`--json`, `--format`, piped/agent) is passed through untouched, so machine\n * consumers never see ANSI codes.\n */\n\nconst SECTION_HEADERS = new Set([\n\t\"Usage\",\n\t\"Arguments\",\n\t\"Options\",\n\t\"Examples\",\n\t\"Environment Variables\",\n\t\"Global Options\",\n\t\"Integrations\",\n\t\"Commands\",\n\t\"Aliases\",\n]);\n\nconst FORMAT_FLAGS = [\"--json\", \"--format\", \"--full-output\", \"--schema\", \"--llms\", \"--llms-full\", \"--mcp\", \"--token-count\", \"--token-limit\", \"--token-offset\"];\n\n/** Color only when writing for a human: a TTY, with no structured-output flag. */\nexport function shouldColorize(argv: string[]): boolean {\n\tif (!process.stdout.isTTY) return false;\n\treturn !argv.some((a) => FORMAT_FLAGS.includes(a) || a.startsWith(\"--format=\"));\n}\n\n/** Highlights a flag token and any `<placeholder>` inside an option/flag row. */\nfunction paintFlag(flag: string): string {\n\treturn flag.replace(/(<[^>]+>)/g, (m) => c.muted(m)).replace(/(--[\\w-]+|-[\\w])/g, (m) => c.flag(m));\n}\n\n/** An indented command line (` whop products create # desc`) — in help examples or a CTA. */\nconst COMMAND_ROW = /^(\\s+)(whop\\s+\\S.*?)(\\s{2,}#\\s.*)?$/;\n\n/** Underlines any URL so links (checkout pages, dashboards) stand out. */\nfunction highlightUrls(text: string): string {\n\treturn text.replace(/https?:\\/\\/[^\\s)]+/g, (m) => c.link(m));\n}\n\nfunction colorizeLine(\n\tline: string,\n\tsection: string | null,\n\tnextLine: string | undefined,\n): { line: string; section: string | null } {\n\t// Error header, e.g. \"Error: msg\" or \"Error (HTTP_403): msg\".\n\tconst errMatch = line.match(/^(Error(?: \\([^)]+\\))?:)(.*)$/);\n\tif (errMatch) return { line: c.error(errMatch[1]) + highlightUrls(errMatch[2]), section };\n\tif (line.startsWith(\"Run `\")) return { line: c.heading(line), section };\n\n\t// Section header, e.g. \"Options:\" or \"Usage: whop products create\".\n\tconst header = line.match(/^([A-Z][A-Za-z ]+):(.*)$/);\n\tif (header && SECTION_HEADERS.has(header[1])) {\n\t\tconst rest = header[2].replace(/(whop[\\w\\s-]*)/g, (m) => c.command(m));\n\t\treturn { line: c.heading(`${header[1]}:`) + rest, section: header[1] };\n\t}\n\n\t// A `whop …` command line anywhere (help examples and CTAs alike).\n\tconst cmd = line.match(COMMAND_ROW);\n\tif (cmd) {\n\t\treturn { line: `${cmd[1]}${c.command(cmd[2])}${cmd[3] ? c.description(cmd[3]) : \"\"}`, section };\n\t}\n\n\t// A header-like line (\"Suggested command:\", a CTA description) immediately\n\t// followed by a command — bold it for emphasis.\n\tif (line.trim().endsWith(\":\") && nextLine !== undefined && COMMAND_ROW.test(nextLine)) {\n\t\treturn { line: c.heading(line), section };\n\t}\n\n\tif (line.trim() === \"\") return { line, section: null };\n\n\t// Rows inside a known section.\n\tif (section === \"Options\" || section === \"Global Options\" || section === \"Environment Variables\") {\n\t\tconst m = line.match(/^(\\s+)(\\S.*?)(\\s{2,})(.*)$/);\n\t\tif (m) return { line: `${m[1]}${paintFlag(m[2])}${m[3]}${c.description(m[4])}`, section };\n\t}\n\tif (section === \"Commands\" || section === \"Integrations\" || section === \"Aliases\") {\n\t\tconst m = line.match(/^(\\s+)(\\S+)(\\s{2,})(.*)$/);\n\t\tif (m) return { line: `${m[1]}${c.command(m[2])}${m[3]}${c.description(m[4])}`, section };\n\t}\n\tif (section === \"Arguments\") {\n\t\tconst m = line.match(/^(\\s+)(\\S+)(\\s{2,})(.*)$/);\n\t\tif (m) return { line: `${m[1]}${c.id(m[2])}${m[3]}${c.description(m[4])}`, section };\n\t}\n\n\t// Plain text (messages, CTA descriptions): make any link stand out.\n\treturn { line: highlightUrls(line), section };\n}\n\n/** Themes a chunk of incur help/error/CTA text. Safe to call per write. */\nexport function colorizeOutput(text: string): string {\n\tlet section: string | null = null;\n\tconst lines = text.split(\"\\n\");\n\treturn lines\n\t\t.map((line, i) => {\n\t\t\tconst result = colorizeLine(line, section, lines[i + 1]);\n\t\t\tsection = result.section;\n\t\t\treturn result.line;\n\t\t})\n\t\t.join(\"\\n\");\n}\n","import cli from \"./cli\";\nimport { getActiveProfile } from \"./auth/profiles\";\nimport { buildGroupedHelp } from \"./lib/grouped-help\";\nimport { colorizeOutput, shouldColorize } from \"./lib/colorize-output\";\nimport pkg from \"../package.json\" with { type: \"json\" };\n\nconst argv = process.argv.slice(2);\n\nasync function serve(argv: string[]) {\n\tif (shouldColorize(argv)) {\n\t\tawait cli.serve(argv, {\n\t\t\tstdout: (s) => process.stdout.write(colorizeOutput(s)),\n\t\t});\n\t} else {\n\t\tawait cli.serve(argv);\n\t}\n}\n\nif (argv.length === 0 && !getActiveProfile() && !process.env.WHOP_API_KEY) {\n\tawait serve([\"quickstart\"]);\n} else if (argv.length === 0 || (argv.length === 1 && argv[0] === \"--help\")) {\n\tprocess.stdout.write(\n\t\tbuildGroupedHelp(\n\t\t\tpkg.version,\n\t\t\tcli.description ?? \"Build and manage Whop apps from your terminal.\",\n\t\t) + \"\\n\",\n\t);\n\tprocess.exit(0);\n} else {\n\tawait serve(argv);\n}\n\nexport default cli;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA,EACE;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAAA,EACF;AAAA,EACA;AAAA,IACE;AAAA,IACA;AAA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IAAI;AACZ;;;ACpGA,IAAM,OAAO,QAAQ,KAAK,MAAM,CAAC;AAEjC,eAAe,MAAMC,OAAgB;AACpC,MAAI,eAAeA,KAAI,GAAG;AACzB,UAAM,YAAI,MAAMA,OAAM;AAAA,MACrB,QAAQ,CAAC,MAAM,QAAQ,OAAO,MAAM,eAAe,CAAC,CAAC;AAAA,IACtD,CAAC;AAAA,EACF,OAAO;AACN,UAAM,YAAI,MAAMA,KAAI;AAAA,EACrB;AACD;AAEA,IAAI,KAAK,WAAW,KAAK,CAAC,iBAAiB,KAAK,CAAC,QAAQ,IAAI,cAAc;AAC1E,QAAM,MAAM,CAAC,YAAY,CAAC;AAC3B,WAAW,KAAK,WAAW,KAAM,KAAK,WAAW,KAAK,KAAK,CAAC,MAAM,UAAW;AAC5E,UAAQ,OAAO;AAAA,IACd;AAAA,MACC,gBAAI;AAAA,MACJ,YAAI,eAAe;AAAA,IACpB,IAAI;AAAA,EACL;AACA,UAAQ,KAAK,CAAC;AACf,OAAO;AACN,QAAM,MAAM,IAAI;AACjB;AAEA,IAAO,gBAAQ;","names":["identity","existed","profile","c","createWhopFetch","fetch","text","c","c","c","isCancel","createOptions","isCancel","c","createOptions","c","chalk","text","select","isCancel","chalk","c","chalk","isCancel","text","select","cli","c","argv","text","c","argv","text","argv"]}
|