feat: add migrate subcommand#2679
Conversation
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
Changelog
Activity
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a new migrate command to convert configuration files to a new format, including dry-run functionality and backup creation. The configuration loading logic has been refactored by extracting GetCustomConfigFiles and GetPathsFromToolsFolder, and the ConvertToolsFile function is now public. Review feedback indicates that the LoadAndMergeToolsFiles function requires a check for empty input to prevent panics, the migrate command's error handling for file operations should be refactored for clarity using errors.Join, and a security vulnerability exists where the migrate command hardcodes file permissions to 0644, potentially exposing sensitive data by not preserving original, more restrictive permissions. Additionally, a resolved TODO comment should be removed, and a typo in the ConvertToolsFile comment needs correction.
ca07bcd to
e74af36
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
The pull request introduces a new migrate command to convert configuration files to a v2 format, featuring dry-run capabilities, file backup, and error recovery. This involved refactoring the configuration loading logic by extracting file path retrieval into a new GetCustomConfigFiles function and making ConvertToolsFile public. The serve command was updated to utilize this new configuration loading mechanism, and the file watching logic in the root command was adjusted to align with the refactored path retrieval. Review feedback suggests improving the migration command's error handling to collect all errors when processing multiple files, rather than stopping on the first error, and to use opts.IOStreams.Out for dry-run output to ensure consistent I/O and testability.
9cb8fc6 to
1a187a9
Compare
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new migrate subcommand to facilitate the migration of configuration files to the new flat format. The implementation includes creating backup files, handling dry-run mode, and robust error handling. The changes also involve refactoring the configuration loading logic in cmd/internal/options.go and cmd/internal/tools_file.go for better modularity and reusability, which is a good improvement. The comment regarding the file restore logic has been kept to improve its robustness on different operating systems.
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a new migrate subcommand to assist with configuration file format migration. The implementation is well-structured, with good error handling and comprehensive tests. A significant part of this PR is the refactoring of configuration loading logic in cmd/internal/options.go, which extracts file path resolution into a new reusable function GetCustomConfigFiles. This is a good improvement that reduces code duplication and supports the new migrate command. I have one suggestion to improve an error message that became less specific due to the refactoring, aligning with the goal of providing more informative user feedback.
Add a `migrate` subcommand to help migrate all configuration files to flat format. This PR also updates the `LoadConfig()` function in `options.go` by extracting the custom config path logic into a new function. This removes duplication and makes the logic reusable for the migrate subcommand. 12171f7
🤖 I have created a release *beep* *boop* --- ## [0.30.0](v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([#2679](#2679)) ([12171f7](12171f7)) * **cli:** Add serve subcommand ([#2550](#2550)) ([1e2c7c7](1e2c7c7)) * **skill:** One skill per toolset ([#2733](#2733)) ([5b85c65](5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([#2625](#2625)) ([e350fc7](e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([#2718](#2718)) ([70ed8a0](70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([#2740](#2740)) ([10af468](10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([#2772](#2772)) ([50b4457](50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([#2469](#2469)) ([b1333cd](b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([#2707](#2707)) ([58bc772](58bc772)) * **skills:** Improve flag validation and silence unit test output ([#2759](#2759)) ([f3da6aa](f3da6aa)) * **test:** Address flaky healthcare integration test run ([#2742](#2742)) ([9590821](9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([#2763](#2763)) ([1528d7c](1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
🤖 I have created a release *beep* *boop* --- ## [0.30.0](v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([#2679](#2679)) ([12171f7](12171f7)) * **cli:** Add serve subcommand ([#2550](#2550)) ([1e2c7c7](1e2c7c7)) * **skill:** One skill per toolset ([#2733](#2733)) ([5b85c65](5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([#2625](#2625)) ([e350fc7](e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([#2718](#2718)) ([70ed8a0](70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([#2740](#2740)) ([10af468](10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([#2772](#2772)) ([50b4457](50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([#2469](#2469)) ([b1333cd](b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([#2707](#2707)) ([58bc772](58bc772)) * **skills:** Improve flag validation and silence unit test output ([#2759](#2759)) ([f3da6aa](f3da6aa)) * **test:** Address flaky healthcare integration test run ([#2742](#2742)) ([9590821](9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([#2763](#2763)) ([1528d7c](1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
Add a `migrate` subcommand to help migrate all configuration files to flat format. This PR also updates the `LoadConfig()` function in `options.go` by extracting the custom config path logic into a new function. This removes duplication and makes the logic reusable for the migrate subcommand. 12171f7
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com> 5ef1c0d
Add a `migrate` subcommand to help migrate all configuration files to flat format. This PR also updates the `LoadConfig()` function in `options.go` by extracting the custom config path logic into a new function. This removes duplication and makes the logic reusable for the migrate subcommand.
🤖 I have created a release *beep* *boop* --- ## [0.30.0](googleapis/mcp-toolbox@v0.29.0...v0.30.0) (2026-03-20) ### Features * **cli:** Add migrate subcommand ([googleapis#2679](googleapis#2679)) ([12171f7](googleapis@12171f7)) * **cli:** Add serve subcommand ([googleapis#2550](googleapis#2550)) ([1e2c7c7](googleapis@1e2c7c7)) * **skill:** One skill per toolset ([googleapis#2733](googleapis#2733)) ([5b85c65](googleapis@5b85c65)) * **source/oracledb:** Add Oracle DB for MCP tools and configurations, updated tools and documentation ([googleapis#2625](googleapis#2625)) ([e350fc7](googleapis@e350fc7)) * **tools/looker:** Support git_branch tools for looker. ([googleapis#2718](googleapis#2718)) ([70ed8a0](googleapis@70ed8a0)) * **tools/dataplex-search-entries:** Add `scope` support to search_entries tool ([googleapis#2740](googleapis#2740)) ([10af468](googleapis@10af468)) ### Bug Fixes * **cloudloggingadmin:** Increase log injesting time and add auth test ([googleapis#2772](googleapis#2772)) ([50b4457](googleapis@50b4457)) * **oracle:** Normalize encoded proxy usernames in go-ora DSN ([googleapis#2469](googleapis#2469)) ([b1333cd](googleapis@b1333cd)) * **postgres:** Update execute-sql tool to avoid multi-statements parameter ([googleapis#2707](googleapis#2707)) ([58bc772](googleapis@58bc772)) * **skills:** Improve flag validation and silence unit test output ([googleapis#2759](googleapis#2759)) ([f3da6aa](googleapis@f3da6aa)) * **test:** Address flaky healthcare integration test run ([googleapis#2742](googleapis#2742)) ([9590821](googleapis@9590821)) ### Reverts * **ci:** Implement conditional sharding logic in integration tests ([googleapis#2763](googleapis#2763)) ([1528d7c](googleapis@1528d7c)) --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). --------- Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> Co-authored-by: Yuan Teoh <45984206+Yuan325@users.noreply.github.com>
Add a
migratesubcommand to help migrate all configuration files to flat format.This PR also updates the
LoadConfig()function inoptions.goby extracting the custom config path logic into a new function. This removes duplication and makes the logic reusable for the migrate subcommand.