{"_id":"@aient/sourcemaps","_rev":"7-e5df0fc0ca0f98616b29bec1e6cafef5","name":"@aient/sourcemaps","dist-tags":{"latest":"0.3.4"},"versions":{"0.1.1":{"name":"@aient/sourcemaps","version":"0.1.1","_id":"@aient/sourcemaps@0.1.1","maintainers":[{"name":"haf","email":"henrik@haf.se"}],"bin":{"aient-sourcemaps":"dist/cli.mjs"},"dist":{"shasum":"c695fc058eef295a610758dd11eaf66b77339293","tarball":"https://registry.npmjs.org/@aient/sourcemaps/-/sourcemaps-0.1.1.tgz","fileCount":2,"integrity":"sha512-PdJ2TUtwecHCqtbJ4hSXGQ6vJw8Un63+y9bTwuSNHS9NRi03L0PaclHV5q155lSHeCr5fEMdwc7fWB39iXpNMA==","signatures":[{"sig":"MEQCIBjXnItTjiIl9wxFnHWZ88p6ZwrmfmUuIllOOrfcFzj/AiBNVsw2UJ3/2YtK28S17ksbV2I0x/S3VytWuEQbzyV+qQ==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":11740},"type":"module","_from":"file:aient-sourcemaps-0.1.1.tgz","scripts":{"lint":"true","test":"vitest run","build":"esbuild src/cli.ts --bundle --platform=node --format=esm --outfile=dist/cli.mjs --packages=external","lint:fix":"true","test:watch":"vitest","type-check":"tsc --noEmit"},"_npmUser":{"name":"haf","email":"henrik@haf.se"},"_resolved":"/private/var/folders/ln/9kcrdg0x1_s2w5m05flp9v280000gn/T/bd27b7a22c2f6a49b71f82d030af61ff/aient-sourcemaps-0.1.1.tgz","_integrity":"sha512-PdJ2TUtwecHCqtbJ4hSXGQ6vJw8Un63+y9bTwuSNHS9NRi03L0PaclHV5q155lSHeCr5fEMdwc7fWB39iXpNMA==","_npmVersion":"11.8.0","description":"Aient source map upload CLI","directories":{},"_nodeVersion":"24.13.1","dependencies":{"citty":"^0.2.1","picocolors":"^1.1.1"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.16","esbuild":"^0.27.1","typescript":"^5.9.3","@types/node":"^25.0.1","typescript-config":"1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sourcemaps_0.1.1_1775246688352_0.8578233017053967","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@aient/sourcemaps","version":"0.1.2","_id":"@aient/sourcemaps@0.1.2","maintainers":[{"name":"haf","email":"henrik@haf.se"}],"bin":{"aient-sourcemaps":"dist/cli.mjs"},"dist":{"shasum":"0b9b54c1c2c5b218d20e68c617c9edb82061a9fc","tarball":"https://registry.npmjs.org/@aient/sourcemaps/-/sourcemaps-0.1.2.tgz","fileCount":3,"integrity":"sha512-58a0QtCEuKwBoqcG6PliCKZjMMN8OcGcW1tyw4wVDafGhOIhOCOTHx0VpR5a4SIeWWuj7r5S/GV4+tUDDeZyoQ==","signatures":[{"sig":"MEUCIQDkUzB8CkGOACi3XC//HcOTeqlR6VyA5KnxXugO0FhXRAIgW2mhc6XlSXXKBkPLlZ71lEah0NsAwp64JV8D1Ob9sYg=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":39290},"type":"module","_from":"file:aient-sourcemaps-0.1.2.tgz","private":false,"scripts":{"lint":"true","test":"vitest run","build":"esbuild src/cli.ts --bundle --platform=node --format=esm --outfile=dist/cli.mjs --packages=external","lint:fix":"true","unit-test":"vitest run","test:watch":"vitest","type-check":"tsc --noEmit"},"_npmUser":{"name":"haf","email":"henrik@haf.se"},"_resolved":"/private/var/folders/ln/9kcrdg0x1_s2w5m05flp9v280000gn/T/c4be64d4417787b80e2ebe2cf076a71d/aient-sourcemaps-0.1.2.tgz","_integrity":"sha512-58a0QtCEuKwBoqcG6PliCKZjMMN8OcGcW1tyw4wVDafGhOIhOCOTHx0VpR5a4SIeWWuj7r5S/GV4+tUDDeZyoQ==","_npmVersion":"11.8.0","description":"Aient source map upload CLI","directories":{},"_nodeVersion":"24.13.1","dependencies":{"citty":"^0.2.1","picocolors":"^1.1.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.16","esbuild":"^0.27.1","typescript":"^5.9.3","@types/node":"^25.0.1","typescript-config":"1.0.0"},"_npmOperationalInternal":{"tmp":"tmp/sourcemaps_0.1.2_1779795328780_0.32919650018337765","host":"s3://npm-registry-packages-npm-production"}},"0.3.0":{"name":"@aient/sourcemaps","version":"0.3.0","_id":"@aient/sourcemaps@0.3.0","maintainers":[{"name":"haf","email":"henrik@haf.se"}],"bin":{"aient-sourcemaps":"dist/cli.mjs"},"dist":{"shasum":"16bca92c1a5ddcd0bd2b0210cb3b3bcace2f519d","tarball":"https://registry.npmjs.org/@aient/sourcemaps/-/sourcemaps-0.3.0.tgz","fileCount":3,"integrity":"sha512-bl03U2Fm/2/9KcoXwXb11RnzVwm/VPolUEh0bHBzZ7RTWa5+nbupDVyySheHV1v3yZfAk36ilRJ90f+JvHV+VA==","signatures":[{"sig":"MEYCIQD4jyUd3lZ0lZWIo7wCV0IWTu5PYtP3A4q8MSLtm2NgbwIhAOCvsdvfRfWS9gvgrOYC3YHZTKc3yGcpbZhJPhcaUjoO","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":74948},"type":"module","gitHead":"58b151e550436af3a63c85565b840f4758acec2b","private":false,"scripts":{"lint":"true","test":"vitest run","build":"esbuild src/cli.ts --bundle --platform=node --format=esm --outfile=dist/cli.mjs --packages=external","lint:fix":"true","unit-test":"vitest run","test:watch":"vitest","type-check":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:da944e39-0573-44ce-b221-6ff77af6367b"}},"_npmVersion":"11.17.0","description":"Aient source map upload CLI","directories":{},"_nodeVersion":"24.19.0","dependencies":{"citty":"^0.2.1","picocolors":"^1.1.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.16","esbuild":"^0.27.1","typescript":"^5.9.3","@types/node":"^25.0.1","typescript-config":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/sourcemaps_0.3.0_1787641290334_0.6868290539615678","host":"s3://npm-registry-packages-npm-production"}},"0.3.1":{"name":"@aient/sourcemaps","version":"0.3.1","_id":"@aient/sourcemaps@0.3.1","maintainers":[{"name":"haf","email":"henrik@haf.se"}],"bin":{"aient-sourcemaps":"dist/cli.mjs"},"dist":{"shasum":"6493deaa9369cd17fddd6f0a49dae851e70278c6","tarball":"https://registry.npmjs.org/@aient/sourcemaps/-/sourcemaps-0.3.1.tgz","fileCount":3,"integrity":"sha512-Tk9l42+sifH5m00fT5+bm1z+o/N5hRmIOy70BPialJfu5/rQi0lsAm9EBA/yJwkj8DGfcu75QJSbu7nFXUxKCw==","signatures":[{"sig":"MEYCIQDCs/ltexcgZF+0NmRjrc4e8A8qGZA2F40BCuq09EgFVwIhAOMpnTxxMmeKS71KVYAq9q+KmFtFNPxGi1Qqeckho7mF","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":77218},"type":"module","gitHead":"eb7dab91d3f45ccd611ecb86c91e085b29628af5","private":false,"scripts":{"lint":"true","test":"vitest run","build":"esbuild src/cli.ts --bundle --platform=node --format=esm --outfile=dist/cli.mjs --packages=external","lint:fix":"true","unit-test":"vitest run","test:watch":"vitest","type-check":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:da944e39-0573-44ce-b221-6ff77af6367b"}},"_npmVersion":"11.17.0","description":"Aient source map upload CLI","directories":{},"_nodeVersion":"24.19.0","dependencies":{"citty":"^0.2.1","picocolors":"^1.1.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.16","esbuild":"^0.27.1","typescript":"^5.9.3","@types/node":"^25.0.1","typescript-config":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/sourcemaps_0.3.1_1787659809058_0.042198991006984654","host":"s3://npm-registry-packages-npm-production"}},"0.3.2":{"name":"@aient/sourcemaps","version":"0.3.2","_id":"@aient/sourcemaps@0.3.2","maintainers":[{"name":"haf","email":"henrik@haf.se"}],"bin":{"aient-sourcemaps":"dist/cli.mjs"},"dist":{"shasum":"04abe89cfdbc5b67788059802ca4da52d97e6926","tarball":"https://registry.npmjs.org/@aient/sourcemaps/-/sourcemaps-0.3.2.tgz","fileCount":3,"integrity":"sha512-Kj7a1vrsAISHOjPCKbEVcnyP5tsgEmrIpioa4ot5MNwEU6d8F0ya4CkbCL1mLexHGMfs4wYBqmzDV34AUvCj2g==","signatures":[{"sig":"MEUCIQCRqXK1WHF2aunTJouT4nZZr6Tk5ASPSHPqds+Fe2kTCQIgKPURxicTYBb7We5mSl+DG8FA7FvEE/qqIU8M+4Jobt8=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":77012},"type":"module","gitHead":"1567b0b3e7904f4c3187d05bda379c8fb4f8d031","private":false,"scripts":{"lint":"true","test":"vitest run","build":"esbuild src/cli.ts --bundle --platform=node --format=esm --outfile=dist/cli.mjs --packages=external","lint:fix":"true","unit-test":"vitest run","test:watch":"vitest","type-check":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:da944e39-0573-44ce-b221-6ff77af6367b"}},"_npmVersion":"11.17.0","description":"Aient source map upload CLI","directories":{},"_nodeVersion":"24.19.0","dependencies":{"citty":"^0.2.1","picocolors":"^1.1.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.16","esbuild":"^0.27.1","typescript":"^5.9.3","@types/node":"^25.0.1","typescript-config":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/sourcemaps_0.3.2_1787691745941_0.8443822611739955","host":"s3://npm-registry-packages-npm-production"}},"0.3.3":{"name":"@aient/sourcemaps","version":"0.3.3","_id":"@aient/sourcemaps@0.3.3","maintainers":[{"name":"haf","email":"henrik@haf.se"}],"bin":{"aient-sourcemaps":"dist/cli.mjs"},"dist":{"shasum":"6017de90bf8c948ed1a1604ad4f40c18db1143c2","tarball":"https://registry.npmjs.org/@aient/sourcemaps/-/sourcemaps-0.3.3.tgz","fileCount":3,"integrity":"sha512-uJo6dRVv4C1m8Zd/6uE+fJIjQPmbdFQG614gROc5JUcT5cUnwuvTVJmaTvHO62qdQz46XCwBedyLPAPYmtB9uQ==","signatures":[{"sig":"MEQCIF5J/d4YV+ETZ+wIN7bjFmEqko60+5MxvkHReZXku80GAiB/q8jMmLnjkXa1H7Gb3UTEdWtvxn9EADAF+Lf2WOrcPA==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":77317},"type":"module","gitHead":"14ddf3e0ed077b5108f42bdfce620ae12944e7f3","private":false,"scripts":{"lint":"true","test":"vitest run","build":"esbuild src/cli.ts --bundle --platform=node --format=esm --outfile=dist/cli.mjs --packages=external","lint:fix":"true","unit-test":"vitest run","test:watch":"vitest","type-check":"tsc --noEmit"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:da944e39-0573-44ce-b221-6ff77af6367b"}},"_npmVersion":"11.17.0","description":"Aient source map upload CLI","directories":{},"_nodeVersion":"24.19.0","dependencies":{"citty":"^0.2.1","picocolors":"^1.1.1"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"vitest":"^4.0.16","esbuild":"^0.27.1","typescript":"^5.9.3","@types/node":"^25.0.1","typescript-config":"workspace:*"},"_npmOperationalInternal":{"tmp":"tmp/sourcemaps_0.3.3_1787700009833_0.6596799943081111","host":"s3://npm-registry-packages-npm-production"}},"0.3.4":{"name":"@aient/sourcemaps","version":"0.3.4","description":"Aient source map upload CLI","private":false,"publishConfig":{"access":"public"},"type":"module","bin":{"aient-sourcemaps":"dist/cli.mjs"},"scripts":{"build":"esbuild src/cli.ts --bundle --platform=node --format=esm --outfile=dist/cli.mjs --packages=external","test":"vitest run","unit-test":"vitest run","test:watch":"vitest","lint":"true","lint:fix":"true","type-check":"tsc --noEmit"},"dependencies":{"citty":"^0.2.1","picocolors":"^1.1.1"},"devDependencies":{"@types/node":"^25.0.1","esbuild":"^0.27.1","typescript":"^5.9.3","typescript-config":"workspace:*","vitest":"^4.0.16"},"gitHead":"807aab342ec7bfe99d33608ecd8685fc90081c51","_id":"@aient/sourcemaps@0.3.4","_nodeVersion":"24.20.0","_npmVersion":"11.19.0","dist":{"integrity":"sha512-tEMcpXSd6bRT7Hl2g/av5b5p9LFXxVyYfxtjqJB7iOLX7ld5H3yYVOGFaSK7bSdVuq63A2MTrjmL45bAUAib+Q==","shasum":"ed14b4c21fdf761bdd6b5b7e091c72166b5db59b","tarball":"https://registry.npmjs.org/@aient/sourcemaps/-/sourcemaps-0.3.4.tgz","fileCount":3,"unpackedSize":82014,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCICQQL2rwV2X9NvklKEqtdyOfjawmhlWhbeZ08pvzE09IAiEA7fl1r5XZxm98KhpvZJU/fIN0ZGwcegAP6xvfsgYCJI4="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:da944e39-0573-44ce-b221-6ff77af6367b"}},"directories":{},"maintainers":[{"name":"haf","email":"henrik@haf.se"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/sourcemaps_0.3.4_1787868177087_0.7149157480610056"},"_hasShrinkwrap":false}},"time":{"created":"2026-04-03T20:04:48.241Z","modified":"2026-08-27T22:02:57.395Z","0.1.1":"2026-04-03T20:04:48.502Z","0.1.2":"2026-05-26T11:35:28.953Z","0.3.0":"2026-08-25T07:01:30.486Z","0.3.1":"2026-08-25T12:10:09.196Z","0.3.2":"2026-08-25T21:02:26.067Z","0.3.3":"2026-08-25T23:20:09.950Z","0.3.4":"2026-08-27T22:02:57.213Z"},"description":"Aient source map upload CLI","maintainers":[{"name":"haf","email":"henrik@haf.se"}],"readme":"# @aient/sourcemaps\n\n## Typed native debug artifacts\n\nVersion `0.3.4` adds verified Apple dSYM upload to the existing fail-closed\nnative artifact command. Dart AOT upload and the existing `upload` source-map\ncommand are unchanged.\n\nInstall the CLI as an exact, lockfile-pinned development dependency in the\napplication repository:\n\n```sh\npnpm add -D --save-exact @aient/sourcemaps@0.3.4\n```\n\n```sh\naient-sourcemaps upload-debug \\\n  --manifest build/aient-debug-artifacts.json \\\n  --distribution build/app-release.aab\n```\n\nFor an iOS release, invoke the same installed binary against the manifest and\nIPA produced by that exact build:\n\n```sh\npnpm exec aient-sourcemaps upload-debug \\\n  --manifest build/aient-debug-artifacts.json \\\n  --distribution build/Runner.ipa\n```\n\n`upload-debug` reads only strict `schema_version: 1` snake_case manifests. It\nrequires top-level `service`, exact lowercase 40-character `commit_sha`,\n`release_id`, `app_version`, `build_number`, `variant`, `distribution`, and\n`artifacts`. Each item is either `dart_aot_dwarf` or `apple_dsym`. An Apple item\nmust select one thin, regular Mach-O DWARF member, use platform `ios`, include an\n`arm64` or `x86_64` architecture, and carry its canonical Mach-O UUID as\n`debug_id`; archives, universal objects, symlinks, and identity disagreement fail\nbefore any network call. Unknown keys, empty or duplicate artifact identities,\nunsafe paths, and byte/hash drift also fail closed. `--distribution` must select\nthe exact AAB or IPA described by the manifest, preventing a rebuilt\ndistributable from reusing stale symbols.\n\nSet the upload-scoped `AIENT_API_KEY` and optionally `AIENT_API_URL`; never use a\npublishable OTLP ingest key. Debug uploads accept credentials only from the\nenvironment; `--api-url` and `--dry-run` remain supported. Dry-run verifies every\nlocal byte and makes no network calls. Successful output contains release\nidentity, object basename, artifact kind, counts, and hash prefixes. Failure\noutput preserves the original error and stack without redaction or truncation\nso CI retains complete diagnostic evidence. CI callers are responsible for\nkeeping credentials out of exception values and protecting their logs.\n\nThe summary distinguishes artifacts accepted and committed to private storage\nfrom artifacts for which the server returned explicit `enqueued` processing\nevidence. `--wait` is rejected until Aient exposes a real processing-status\nreceipt. Any per-item failure exits non-zero.\n\nCommand-line uploader for Aient source maps.\n\nUse this package from CI after building a production frontend bundle. It scans a\nbuild output directory for source maps, resolves the runtime bundle paths Aient\nwill see in minified stack frames, uploads the source map files, and commits\nthem against a service name and git commit SHA.\n\n```bash\npnpm dlx @aient/sourcemaps upload .next/static \\\n  --service web \\\n  --commit \"$GITHUB_SHA\" \\\n  --bundle-prefix /_next/static \\\n  --fail-on-empty\n```\n\n`@aient/sourcemaps` is a CLI package. Its internal TypeScript modules are not a\npublic library API.\n\n## Requirements\n\n- A production build that emits source maps.\n- An Aient source map upload API key in CI. Use `AIENT_API_KEY`; do not ship this\n  key to browser code.\n- A runtime service name that matches telemetry `service.name`.\n- A commit SHA that matches telemetry `deployment.commit_sha`.\n- Runtime stack frame URLs that can be matched by the derived bundle path,\n  usually with `--bundle-prefix`.\n\n## Install\n\nRun directly:\n\n```bash\npnpm dlx @aient/sourcemaps upload <directory> --service <service>\n```\n\nOr add it to a project:\n\n```bash\npnpm add -D @aient/sourcemaps\npnpm exec aient-sourcemaps upload <directory> --service <service>\n```\n\n## Command\n\n```bash\naient-sourcemaps upload <directory> --service <service> [options]\n```\n\n`<directory>` is the build output directory to scan.\n\n### Options\n\n| Option | Env var | Required | Default | Description |\n| --- | --- | --- | --- | --- |\n| `<directory>` | - | Yes | - | Build output directory containing source map files. |\n| `--service`, `-s` | - | Yes | - | Runtime service name. Must match telemetry `service.name`. |\n| `--api-key`, `-k` | `AIENT_API_KEY` | Yes | - | Aient source map upload key. |\n| `--commit`, `-c` | `COMMIT_SHA`, `GITHUB_SHA`, `VERCEL_GIT_COMMIT_SHA`, `CI_COMMIT_SHA` | Yes | auto-detected | Git commit SHA. Must match telemetry `deployment.commit_sha`. |\n| `--pattern` | - | No | `**/*.js.map` | Source map file pattern. |\n| `--bundle-prefix` | - | No | none | URL/path prefix prepended to each derived runtime bundle path. |\n| `--api-url` | `AIENT_API_URL` | No | `https://aient.ai` | Aient API origin. |\n| `--dry-run` | - | No | `false` | List matched files without calling the API or uploading. |\n| `--concurrency` | `AIENT_SOURCEMAPS_CONCURRENCY` | No | `6` | Maximum concurrent file uploads. Must be a positive integer. |\n| `--fail-on-empty` | - | No | `false` | Exit non-zero when no source maps are found. |\n\nExplicit flags win over environment variables.\n\nThe CLI accepts the kebab-case flags shown above. Its generated help may display\ncamelCase names such as `--bundlePrefix`; those aliases work too.\n\n## Matching Contract\n\nAient resolves a minified frame only when all of these values line up:\n\n| Value | Must match |\n| --- | --- |\n| `--service` | The telemetry resource attribute `service.name`. |\n| `--commit` | The telemetry deployment attribute `deployment.commit_sha`. |\n| Derived bundle path | The minified stack frame filename/path seen at runtime. |\n\nFor Next.js static assets, the build directory is often `.next/static`, while\nruntime frame URLs contain `/_next/static/...`. Use `--bundle-prefix\n/_next/static` so uploaded bundle paths match runtime frames.\n\n```mermaid\nflowchart LR\n  build[\"CI production build\"] --> scan[\"aient-sourcemaps scans maps\"]\n  scan --> paths[\"derive runtime bundle paths\"]\n  paths --> upload[\"upload source maps\"]\n  upload --> resolve[\"Aient resolves production stack frames\"]\n```\n\n## Bundle Path Derivation\n\nFor each matching source map file, the uploader derives one or more `bundlePath`\nvalues:\n\n1. It scans local `.js` and `.css` bundles under `<directory>` for\n   `sourceMappingURL` comments.\n2. If a bundle points at a known local map, that bundle path is used.\n3. If multiple runtime bundles point at one physical map, the uploader creates\n   one upload candidate per runtime bundle.\n4. If no runtime bundle references the map, the uploader falls back to stripping\n   the `.map` suffix. For example, `chunks/main.js.map` becomes\n   `chunks/main.js`.\n5. If `--bundle-prefix` is set, it is prepended to the derived bundle path. For\n   example, `chunks/main.js` becomes `/_next/static/chunks/main.js`.\n\nRemote, inline, missing, and out-of-directory `sourceMappingURL` targets are\nignored. Query strings and fragments on local `sourceMappingURL` values are\nignored before matching.\n\nThe scanner skips tiny empty Next.js/Turbopack map stubs whose JSON explicitly\ncontains `sources: []` and no `sections`, because they cannot improve stack\ntrace resolution.\n\n## Pattern Support\n\nThe pattern matcher is intentionally small. Supported shapes are:\n\n- `**/*.js.map`: recursive suffix match.\n- `*.js.map`: flat suffix match.\n- `**/*.map`: recursive match for all map files, including CSS maps.\n- `exact-file-name.map`: exact filename match.\n\nUse `--pattern \"**/*.map\"` if you want to include non-JavaScript maps.\n\n## Upload Flow\n\nFor a normal upload run:\n\n1. Discover source maps and derive bundle paths.\n2. Resolve `--service` through `GET /api/sourcemaps/service-config?name=...`.\n3. Preflight uploads through `POST /api/sourcemaps/create-upload/bulk`.\n4. Hash each source map with SHA-256 before upload.\n5. Skip artifacts that Aient reports as already committed with the same hash.\n6. Upload changed files to presigned object-storage URLs with `PUT`.\n7. Commit uploaded artifacts through `POST /api/sourcemaps/commit/bulk`.\n8. Print a summary and exit non-zero if any upload failed.\n\nBulk create and commit requests are chunked at 100 items. If the bulk\ncreate-upload endpoint is unavailable on an older Aient deployment, the CLI\nfalls back to single-file create/upload/commit endpoints. It does not fall back\nafter files have already been uploaded and bulk commit fails, because that could\nduplicate side effects.\n\nAPI requests to Aient retry transient failures with delays of 500 ms, 2 seconds,\nand 5 seconds. Retryable HTTP statuses are `408`, `429`, `502`, `503`, and\n`504`. Presigned object-storage `PUT` requests are not retried by the CLI.\n\n## CI Examples\n\n### GitHub Actions\n\n```yaml\nname: Upload source maps\n\non:\n  push:\n    branches: [main]\n\njobs:\n  sourcemaps:\n    runs-on: ubuntu-latest\n    steps:\n      - uses: actions/checkout@v4\n      - uses: pnpm/action-setup@v4\n      - uses: actions/setup-node@v4\n        with:\n          node-version: 22\n          cache: pnpm\n      - run: pnpm install --frozen-lockfile\n      - run: pnpm build\n      - run: |\n          pnpm dlx @aient/sourcemaps upload .next/static \\\n            --service web \\\n            --commit \"$GITHUB_SHA\" \\\n            --bundle-prefix /_next/static \\\n            --fail-on-empty\n        env:\n          AIENT_API_KEY: ${{ secrets.AIENT_SOURCEMAPS_API_KEY }}\n```\n\n### Vercel\n\n```bash\npnpm dlx @aient/sourcemaps upload .next/static \\\n  --service web \\\n  --commit \"$VERCEL_GIT_COMMIT_SHA\" \\\n  --bundle-prefix /_next/static \\\n  --fail-on-empty\n```\n\n### Generic Vite or SPA Build\n\n```bash\npnpm dlx @aient/sourcemaps upload dist \\\n  --service web \\\n  --commit \"$COMMIT_SHA\" \\\n  --pattern \"**/*.js.map\" \\\n  --fail-on-empty\n```\n\nIf runtime stack frames include a public asset prefix, add it:\n\n```bash\npnpm dlx @aient/sourcemaps upload dist/assets \\\n  --service web \\\n  --commit \"$COMMIT_SHA\" \\\n  --bundle-prefix /assets\n```\n\n## Exit Behavior\n\nThe CLI exits non-zero when:\n\n- `--api-key` is missing and `AIENT_API_KEY` is unset.\n- `--commit` is missing and no supported commit environment variable or local\n  git SHA can be detected.\n- `--concurrency` or `AIENT_SOURCEMAPS_CONCURRENCY` is not a positive integer.\n- `--fail-on-empty` is set and no source maps are found.\n- One or more source map uploads fail.\n- Service-config lookup or a required API call fails.\n\n`--dry-run` never calls the Aient API and never uploads files.\n\n## Troubleshooting\n\n### No Source Map Files Found\n\nCheck that the production build emits source maps and that `<directory>` points\nat the directory containing them. For Next.js static browser maps this is\nusually `.next/static`.\n\nUse:\n\n```bash\npnpm dlx @aient/sourcemaps upload .next/static \\\n  --service web \\\n  --dry-run\n```\n\n### Uploaded But Frames Are Still Minified\n\nVerify all matching fields:\n\n- `--service` equals telemetry `service.name`.\n- `--commit` equals telemetry `deployment.commit_sha`.\n- `--bundle-prefix` makes uploaded bundle paths match production stack frame\n  paths.\n- The deployed code was built from the same commit whose source maps were\n  uploaded.\n\n### Missing API Key\n\nSet `AIENT_API_KEY` in CI secrets or pass `--api-key`. The key is a server-side\nupload credential and must not be exposed to browser bundles, public logs, or\nclient-side environment variables.\n\n### Rate Limits Or Temporary API Failures\n\nLower concurrency:\n\n```bash\nAIENT_SOURCEMAPS_CONCURRENCY=2 pnpm dlx @aient/sourcemaps upload .next/static \\\n  --service web \\\n  --commit \"$COMMIT_SHA\" \\\n  --bundle-prefix /_next/static\n```\n\n## Maintainer Notes\n\nThe package build emits `dist/cli.mjs` from `src/cli.ts`. Before publishing or\nchanging behavior, run:\n\n```bash\npnpm --filter @aient/sourcemaps test\npnpm --filter @aient/sourcemaps type-check\npnpm --filter @aient/sourcemaps build\n```\n","readmeFilename":"README.md"}