Conversation
Add support for parsing Bun's bun.lock (JSONC format) lockfiles. This includes: - BunProjectType registration in Types.hs - BunLock.hs with JSONC parser that handles trailing commas - Dependency graph builder with workspace support - Dev/production dependency labeling Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Comprehensive test suite for Bun lockfile parsing and graph building: - Parsing tests for simple, workspace, and devdeps lockfiles - JSONC trailing comma support tests - Graph building tests for direct/transitive dependencies - Environment labeling tests (dev vs production) - Workspace package filtering tests Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Wire up Bun lockfile support in the Node.js strategy: - Add Bun constructor to NodeProject ADT - Add bun.lock detection in identifyProjectType - Add Bun dispatch in getDeps - Add BunProjectType to discovery filter Detection order: Yarn -> NPM -> Pnpm -> Bun -> fallback NPM Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
|
I know I need to get the formatter passing and such, happy to draft this if yall want because I doubt I will have time within the next week |
|
Yeah, if you could draft it that'd be good - I started to review. I'll put out what comments I have made already. |
| packageToDep :: BunPackage -> Bool -> Dependency | ||
| packageToDep pkg isDev = | ||
| let (name, version) = parseResolution pkg.resolution | ||
| env = if isDev then EnvDevelopment else EnvProduction |
There was a problem hiding this comment.
You can just pass EnvDevelopment or EnvProduction from the caller. The boolean is needlessly obscure IMO.
|
|
||
| -- | Convert JSONC to valid JSON (copy from BunLock.hs for testing) | ||
| -- JSONC allows: // comments and trailing commas | ||
| stripJsoncComments :: Text -> Text |
There was a problem hiding this comment.
Don't repeat this. This should be tested as part of the end-to-end parsing tests, right?
| -- 2. Trailing commas before } or ] | ||
| -- | ||
| -- This function strips both to produce valid JSON | ||
| stripJsoncComments :: Text -> Text |
There was a problem hiding this comment.
This really ought to be done with Megaparsec. I've put up a sample here.
The main thing is that it's kind of hard to follow these pieces. The Megaparsec impls like in the rest of our code base are more declarative. Also, megaparsec can handle the comment stuff for free.
Summary
Add support for Bun package manager's lockfile (
bun.lock) in the Node.js strategy.What's Included
bun.lockfiles (JSON with Comments format, default since Bun v1.2)//commentsFormat Support
Supports
bun.lock(text/JSONC) which became the default in Bun v1.2 (December 2024). Binarybun.lockbis not supported as it's deprecated.Testing
test/Bun/BunLockSpec.hsCommits
Add Bun lockfile tactic implementation- Core parser and graph builderAdd Bun lockfile tactic tests- Test suite with fixturesIntegrate Bun tactic into Node.js strategy- Wire up discovery and dispatch