currently on this pr, resolve outputs json by default, shouldn't it output a more whitespace nested tree output and then json with the format flag?
Good call. Let me look at the current implementation.
Let me check the resolve package's data structures.
Agreed. Let me read the docs and then implement this.
Now I have the full picture. Let me check if any other commands use a format flag for consistency.
Good, every other command uses -f, --format with "text" as default. Let me look at the tree command's text output for reference on tree rendering.
Now I have everything I need. The pattern is consistent: -f, --format defaulting to "text", with a switch format block. The tree rendering uses ├──, └──, │ prefixes.
Let me implement the changes.
Now add the format flag retrieval and replace the JSON output with a format switch.
Now replace the JSON encoding block with a format switch.
Let me verify the file looks right.
The diagnostic errors cleared. The file looks good. Now update the Long description to reflect the new default.
Now update the tests. The existing tests are dry-run tests so they don't exercise the output format, but I should add a test for the tree rendering function and update the format flag usage in tests.
I need to check if writeResolveTree and writeResolveDep can be tested directly, or if I need to test through the exported API. Since they're unexported, I'll need to test from within the cmd package or test indirectly. The test file is in cmd_test (external test package). Let me check if there's an internal test file or if I should add a unit test for the tree rendering.
There are internal test files. I'll add a unit test for the tree rendering directly.
Now let me run the tests.
All passing. Now update the docs.
Now update the multi-ecosystem and jq examples to use -f json.
Now update the examples section to use -f json where jq is involved.
Already updated by the earlier replace_all. Now handle the snapshot and Go examples.
Now run the full test suite.
All tests pass. Let me verify the final state of both files.
Everything looks good. Here's a summary of the changes:
cmd/resolve.go - Default output is now a tree, JSON via -f json:
-f, --format flag (default "text") matching every other command in the codebase├──/└── tree with name@version on each line, headed by manager (ecosystem)-f jsoncmd/resolve_internal_test.go (new) - Four tests for the tree renderer:
docs/resolve.md - Updated throughout:
-f json-f, --format added to flags section-f jsoncommit this and push
Pushed. The resolve command now defaults to tree output like:
npm (npm) ├── express@4.18.2 │ ├── accepts@1.3.8 │ └── body-parser@1.20.1 └── lodash@4.17.21
And JSON is available via -f json, matching every other command in the codebase.