Title: Dotted flags sharing a prefix overwrite each other (`--a.b=1 --a.c=2` yields `{ a: { c: 2 } }`) · Issue #19 · bombshell-dev/args · GitHub
Open Graph Title: Dotted flags sharing a prefix overwrite each other (`--a.b=1 --a.c=2` yields `{ a: { c: 2 } }`) · Issue #19 · bombshell-dev/args
X Title: Dotted flags sharing a prefix overwrite each other (`--a.b=1 --a.c=2` yields `{ a: { c: 2 } }`) · Issue #19 · bombshell-dev/args
Description: <1kB CLI flag parser. Contribute to bombshell-dev/args development by creating an account on GitHub.
Open Graph Description: <1kB CLI flag parser. Contribute to bombshell-dev/args development by creating an account on GitHub.
X Description: <1kB CLI flag parser. Contribute to bombshell-dev/args development by creating an account on GitHub.
Opengraph URL: https://github.com/bombshell-dev/args
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Dotted flags sharing a prefix overwrite each other (`--a.b=1 --a.c=2` yields `{ a: { c: 2 } }`)","articleBody":"### Package\n\n@bomb.sh/args\n\n### Package Version\n\nv0.3.1 (also on main `3bc34eb`)\n\n### Node.js Version\n\nv26.13.0\n\n### Operating System\n\nLinux\n\n### Describe the bug\n\nWhen multiple dotted flags share a path prefix, each subsequent flag overwrites the parent object instead of merging into it. In `set()` (`src/index.ts`), every intermediate path segment creates a fresh `const tmp = {}` and assigns `set(obj, k, tmp)` without checking whether `obj[k]` is already an object.\n\n### To Reproduce\n\nReproduction link: https://gist.github.com/trackoor/bd7f8e655e9f13ce293117d288558f53\n\n```js\n// repro.mjs (npm i @bomb.sh/args@0.3.1 && node repro.mjs)\nimport { parse } from \"@bomb.sh/args\";\n\nconsole.log(parse([\"--a.b=1\", \"--a.c=2\"]));\n// Actual: { _: [], a: { c: 2 } }\n\nconsole.log(parse([\"--a.b.c=1\", \"--a.b.d=2\", \"--a.e=3\"]));\n// Actual: { _: [], a: { e: 3 } }\n```\n\n### Expected behavior\n\nSibling nested keys under the same prefix should be preserved (matching Deno's `std/cli` `parseArgs`):\n\n```js\n// parse([\"--a.b=1\", \"--a.c=2\"])\n{ _: [], a: { b: 1, c: 2 } }\n\n// parse([\"--a.b.c=1\", \"--a.b.d=2\", \"--a.e=3\"])\n{ _: [], a: { b: { c: 1, d: 2 }, e: 3 } }\n```\n\n### Additional Information\n\nFound with a differential-testing tool; the report was drafted with AI assistance and reviewed and edited by me.\n\n### AI assistance disclosure\n\n- [x] This bug report was drafted with the assistance of an AI tool.\n\nCredit: https://ucsbplse.github.io/\n","author":{"url":"https://github.com/trackoor","@type":"Person","name":"trackoor"},"datePublished":"2026-11-14T05:12:33Z","url":"https://github.com/bombshell-dev/args/issues/19"}
| react-profiling | 0 |
| react-import-map | react,react-dom,react-dom/client,react-dom/profiling,react-is,react-reconciler,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@d5750093facf |
| route-pattern | /:user_id/:repository/issues/:id(.:format) |
| route-controller | issues |
| route-action | show |
| fetch-nonce | v2:2905fd5a-b415-d0b0-e3fe-df8acd1ebff4 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | EB42:3D2677:28FE24A:35AD3AD:6AF9ABE2 |
| html-safe-nonce | 690e196653fea2139993c3fe0ee367b34ae44e18ba62f9ed4742c3d7ccbe9a4b |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJFQjQyOjNEMjY3NzoyOEZFMjRBOjM1QUQzQUQ6NkFGOUFCRTIiLCJ2aXNpdG9yX2lkIjoiNDExNjAzMTE1OTU1NTYzNDkwIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | b152380a41dc088edce93c61b591bebba9c5a89e9df0331b44f03d729fe7dced |
| hovercard-subject-tag | repository:597500300 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/bombshell-dev/args/issues/19 |
| twitter:image | https://opengraph.githubassets.com/1492d16648c9ff42ab83026b790176a2c5243c08035b72b35eecb937d68656ec/bombshell-dev/args |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/1492d16648c9ff42ab83026b790176a2c5243c08035b72b35eecb937d68656ec/bombshell-dev/args |
| og:image:alt | <1kB CLI flag parser. Contribute to bombshell-dev/args development by creating an account on GitHub. |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 612d3e6ffd693e7ea8d9fcf452370995872baef31d825b1fedef704cd3d24ac7 |
| turbo-cache-control | no-cache |
| go-import | github.com/bombshell-dev/args git https://github.com/bombshell-dev/args.git |
| octolytics-dimension-user_id | 169915079 |
| octolytics-dimension-user_login | bombshell-dev |
| octolytics-dimension-repository_id | 597500300 |
| octolytics-dimension-repository_nwo | bombshell-dev/args |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 597500300 |
| octolytics-dimension-repository_network_root_nwo | bombshell-dev/args |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 072e34035c13c31543fba9f025cbbbda4210dae4 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width