@cloudbase/cli 2.10.0-beta.0 → 2.10.1-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/ccr +2 -0
- package/bin/cloudbase +2 -0
- package/bin/cloudbase-mcp +2 -0
- package/bin/tcb +2 -0
- package/dist/standalone/cli.js +230877 -158160
- package/package.json +15 -132
- package/.augment-guidelines +0 -119
- package/.claude/settings.local.json +0 -6
- package/.clinerules/cloudbase-rules.mdc +0 -119
- package/.cursor/rules/cloudbase-rules.mdc +0 -119
- package/.editorconfig +0 -10
- package/.eslintignore +0 -8
- package/.eslintrc +0 -35
- package/.mcp.json +0 -11
- package/.prettierignore +0 -1
- package/.prettierrc.js +0 -29
- package/.vscode/launch.json +0 -26
- package/.yarnrc.yml +0 -1
- package/CLAUDE.md +0 -119
- package/LICENSE +0 -6
- package/bin/ccr.js +0 -3
- package/bin/cloudbase.js +0 -7
- package/bin/tcb.js +0 -339
- package/changelog.md +0 -6
- package/cloudbase-cli-2.7.8.tgz +0 -0
- package/cloudbaserc.json +0 -13
- package/jest.config.js +0 -17
- package/lib/auth/index.js +0 -18
- package/lib/auth/login.js +0 -111
- package/lib/auth/logout.js +0 -20
- package/lib/commands/account/index.js +0 -18
- package/lib/commands/account/login.js +0 -252
- package/lib/commands/account/logout.js +0 -56
- package/lib/commands/ai/index.js +0 -200
- package/lib/commands/cloudfunction/base.js +0 -369
- package/lib/commands/cloudfunction/index.js +0 -17
- package/lib/commands/cloudrun/base.js +0 -1040
- package/lib/commands/cloudrun/cloudrun-run-ui/index.html +0 -193
- package/lib/commands/cloudrun/index.js +0 -17
- package/lib/commands/common.js +0 -225
- package/lib/commands/config/delete.js +0 -72
- package/lib/commands/config/get.js +0 -69
- package/lib/commands/config/index.js +0 -21
- package/lib/commands/config/interface.js +0 -25
- package/lib/commands/config/list.js +0 -72
- package/lib/commands/config/set.js +0 -89
- package/lib/commands/constants.js +0 -11
- package/lib/commands/db/base.js +0 -396
- package/lib/commands/db/index.js +0 -17
- package/lib/commands/env/base.js +0 -129
- package/lib/commands/env/domain.js +0 -222
- package/lib/commands/env/index.js +0 -19
- package/lib/commands/env/login.js +0 -271
- package/lib/commands/framework/index.js +0 -196
- package/lib/commands/fun/base.js +0 -434
- package/lib/commands/fun/index.js +0 -17
- package/lib/commands/functions/alias/getRoute.js +0 -99
- package/lib/commands/functions/alias/index.js +0 -18
- package/lib/commands/functions/alias/setRoute.js +0 -101
- package/lib/commands/functions/code-download.js +0 -123
- package/lib/commands/functions/code-update.js +0 -96
- package/lib/commands/functions/concurrency/delete.js +0 -71
- package/lib/commands/functions/concurrency/index.js +0 -19
- package/lib/commands/functions/concurrency/list.js +0 -82
- package/lib/commands/functions/concurrency/set.js +0 -73
- package/lib/commands/functions/config-update.js +0 -103
- package/lib/commands/functions/copy.js +0 -82
- package/lib/commands/functions/delete.js +0 -102
- package/lib/commands/functions/deploy.js +0 -331
- package/lib/commands/functions/detail.js +0 -166
- package/lib/commands/functions/index.js +0 -33
- package/lib/commands/functions/invoke.js +0 -140
- package/lib/commands/functions/layer/bind.js +0 -191
- package/lib/commands/functions/layer/common.js +0 -13
- package/lib/commands/functions/layer/create.js +0 -88
- package/lib/commands/functions/layer/delete.js +0 -92
- package/lib/commands/functions/layer/download.js +0 -112
- package/lib/commands/functions/layer/index.js +0 -23
- package/lib/commands/functions/layer/list.js +0 -105
- package/lib/commands/functions/layer/sort.js +0 -98
- package/lib/commands/functions/list.js +0 -92
- package/lib/commands/functions/log.js +0 -156
- package/lib/commands/functions/run.js +0 -245
- package/lib/commands/functions/trigger-create.js +0 -99
- package/lib/commands/functions/trigger-delete.js +0 -121
- package/lib/commands/functions/version/index.js +0 -18
- package/lib/commands/functions/version/list.js +0 -97
- package/lib/commands/functions/version/publish.js +0 -71
- package/lib/commands/gateway/create.js +0 -125
- package/lib/commands/gateway/delete.js +0 -111
- package/lib/commands/gateway/domain.js +0 -202
- package/lib/commands/gateway/index.js +0 -21
- package/lib/commands/gateway/list.js +0 -107
- package/lib/commands/gateway/switch.js +0 -144
- package/lib/commands/helpers/index.js +0 -19
- package/lib/commands/helpers/init.js +0 -395
- package/lib/commands/helpers/new.js +0 -130
- package/lib/commands/helpers/open.js +0 -90
- package/lib/commands/hosting/hosting.js +0 -378
- package/lib/commands/hosting/index.js +0 -17
- package/lib/commands/index.js +0 -38
- package/lib/commands/lowcode/app.js +0 -415
- package/lib/commands/lowcode/comps.js +0 -373
- package/lib/commands/lowcode/index.js +0 -18
- package/lib/commands/lowcode/utils.js +0 -83
- package/lib/commands/pull/index.js +0 -17
- package/lib/commands/pull/pull.js +0 -107
- package/lib/commands/run/delete.js +0 -102
- package/lib/commands/run/image/common.js +0 -13
- package/lib/commands/run/image/delete.js +0 -91
- package/lib/commands/run/image/download.js +0 -86
- package/lib/commands/run/image/index.js +0 -21
- package/lib/commands/run/image/list.js +0 -104
- package/lib/commands/run/image/upload.js +0 -114
- package/lib/commands/run/index.js +0 -21
- package/lib/commands/run/list.js +0 -104
- package/lib/commands/run/service/config.js +0 -113
- package/lib/commands/run/service/deploy.js +0 -155
- package/lib/commands/run/service/index.js +0 -20
- package/lib/commands/run/service/list.js +0 -116
- package/lib/commands/run/service/update.js +0 -141
- package/lib/commands/run/standalonegateway/common.js +0 -13
- package/lib/commands/run/standalonegateway/create.js +0 -106
- package/lib/commands/run/standalonegateway/destroy.js +0 -82
- package/lib/commands/run/standalonegateway/index.js +0 -21
- package/lib/commands/run/standalonegateway/list.js +0 -78
- package/lib/commands/run/standalonegateway/package.js +0 -87
- package/lib/commands/run/standalonegateway/turn.js +0 -87
- package/lib/commands/run/version/common.js +0 -13
- package/lib/commands/run/version/create.js +0 -329
- package/lib/commands/run/version/delete.js +0 -90
- package/lib/commands/run/version/index.js +0 -21
- package/lib/commands/run/version/list.js +0 -109
- package/lib/commands/run/version/modify.js +0 -142
- package/lib/commands/run/version/update.js +0 -353
- package/lib/commands/runf/base.js +0 -453
- package/lib/commands/runf/index.js +0 -17
- package/lib/commands/self-update.js +0 -134
- package/lib/commands/smart.js +0 -124
- package/lib/commands/storage/index.js +0 -17
- package/lib/commands/storage/storage.js +0 -515
- package/lib/commands/third/index.js +0 -17
- package/lib/commands/third/thirdAttach.js +0 -78
- package/lib/commands/utils.js +0 -197
- package/lib/completion/index.js +0 -15
- package/lib/constant.js +0 -142
- package/lib/db/index.js +0 -85
- package/lib/decorators/captureError.js +0 -30
- package/lib/decorators/constants.js +0 -15
- package/lib/decorators/deprecate.js +0 -18
- package/lib/decorators/guard.js +0 -35
- package/lib/decorators/index.js +0 -25
- package/lib/decorators/injectParams.js +0 -58
- package/lib/decorators/params/common.js +0 -16
- package/lib/decorators/params/index.js +0 -34
- package/lib/env/domain.js +0 -42
- package/lib/env/index.js +0 -80
- package/lib/env/login.js +0 -78
- package/lib/error.js +0 -17
- package/lib/function/alias.js +0 -54
- package/lib/function/base.js +0 -266
- package/lib/function/code.js +0 -28
- package/lib/function/concurrency.js +0 -70
- package/lib/function/create.js +0 -72
- package/lib/function/delete.js +0 -53
- package/lib/function/index.js +0 -27
- package/lib/function/layer/attach.js +0 -63
- package/lib/function/layer/create.js +0 -63
- package/lib/function/layer/delete.js +0 -24
- package/lib/function/layer/download.js +0 -37
- package/lib/function/layer/index.js +0 -23
- package/lib/function/layer/list.js +0 -36
- package/lib/function/layer/sort.js +0 -25
- package/lib/function/trigger.js +0 -106
- package/lib/function/update.js +0 -41
- package/lib/function/version.js +0 -52
- package/lib/function/vpc.js +0 -35
- package/lib/gateway/index.js +0 -136
- package/lib/help.js +0 -44
- package/lib/hosting.js +0 -244
- package/lib/i18n/index.js +0 -73
- package/lib/index.js +0 -13
- package/lib/logger.js +0 -19
- package/lib/run/delete.js +0 -22
- package/lib/run/image/build.js +0 -37
- package/lib/run/image/delete.js +0 -22
- package/lib/run/image/index.js +0 -20
- package/lib/run/image/info.js +0 -29
- package/lib/run/image/list.js +0 -30
- package/lib/run/index.js +0 -23
- package/lib/run/list.js +0 -39
- package/lib/run/repo.js +0 -31
- package/lib/run/service/common.js +0 -271
- package/lib/run/service/config.js +0 -70
- package/lib/run/service/deployPackage.js +0 -83
- package/lib/run/service/index.js +0 -22
- package/lib/run/service/list.js +0 -31
- package/lib/run/service/showLogs.js +0 -117
- package/lib/run/service/update.js +0 -84
- package/lib/run/standalonegateway/create.js +0 -32
- package/lib/run/standalonegateway/destroy.js +0 -28
- package/lib/run/standalonegateway/index.js +0 -21
- package/lib/run/standalonegateway/list.js +0 -48
- package/lib/run/standalonegateway/package/index.js +0 -17
- package/lib/run/standalonegateway/package/list.js +0 -32
- package/lib/run/standalonegateway/turn/index.js +0 -18
- package/lib/run/standalonegateway/turn/off.js +0 -28
- package/lib/run/standalonegateway/turn/on.js +0 -28
- package/lib/run/version/create.js +0 -50
- package/lib/run/version/delete.js +0 -23
- package/lib/run/version/index.js +0 -22
- package/lib/run/version/list.js +0 -24
- package/lib/run/version/modify.js +0 -24
- package/lib/run/version/repo.js +0 -33
- package/lib/run/version/update.js +0 -39
- package/lib/storage.js +0 -125
- package/lib/third/index.js +0 -25
- package/lib/types.js +0 -12
- package/lib/utils/ai/banner.js +0 -102
- package/lib/utils/ai/claudeWindows.js +0 -64
- package/lib/utils/ai/config.js +0 -290
- package/lib/utils/ai/const.js +0 -178
- package/lib/utils/ai/ensureFiles.js +0 -27
- package/lib/utils/ai/env.js +0 -37
- package/lib/utils/ai/envLocalManager.js +0 -145
- package/lib/utils/ai/nodeVersion.js +0 -19
- package/lib/utils/ai/router.js +0 -1306
- package/lib/utils/ai/setup.js +0 -707
- package/lib/utils/auth.js +0 -28
- package/lib/utils/checkTcbrEnv.js +0 -76
- package/lib/utils/cli-table.js +0 -19
- package/lib/utils/commonParamsCheck.js +0 -49
- package/lib/utils/config.js +0 -59
- package/lib/utils/debug-logger.js +0 -31
- package/lib/utils/dts.js +0 -154
- package/lib/utils/env.js +0 -222
- package/lib/utils/fs/del.js +0 -11
- package/lib/utils/fs/index.js +0 -94
- package/lib/utils/function-packer.js +0 -87
- package/lib/utils/index.js +0 -38
- package/lib/utils/log.js +0 -85
- package/lib/utils/mcp-config-modifier.js +0 -235
- package/lib/utils/net/cloud-api-request.js +0 -64
- package/lib/utils/net/credential.js +0 -61
- package/lib/utils/net/http-request.js +0 -108
- package/lib/utils/net/index.js +0 -21
- package/lib/utils/net/manager-service.js +0 -51
- package/lib/utils/net/proxy.js +0 -9
- package/lib/utils/notice.js +0 -37
- package/lib/utils/output/highlight.js +0 -11
- package/lib/utils/output/index.js +0 -19
- package/lib/utils/output/link.js +0 -16
- package/lib/utils/output/loading.js +0 -68
- package/lib/utils/parallel.js +0 -65
- package/lib/utils/platform/index.js +0 -19
- package/lib/utils/platform/mac.js +0 -37
- package/lib/utils/platform/os.js +0 -59
- package/lib/utils/platform/port.js +0 -26
- package/lib/utils/progress-bar.js +0 -44
- package/lib/utils/prompt/index.js +0 -17
- package/lib/utils/prompt/select.js +0 -54
- package/lib/utils/report.js +0 -78
- package/lib/utils/reporter/agree.js +0 -31
- package/lib/utils/reporter/download.js +0 -37
- package/lib/utils/reporter/index.js +0 -19
- package/lib/utils/reporter/usage.js +0 -32
- package/lib/utils/store/auth.js +0 -59
- package/lib/utils/store/common.js +0 -8
- package/lib/utils/store/config.js +0 -49
- package/lib/utils/store/db.js +0 -84
- package/lib/utils/store/index.js +0 -21
- package/lib/utils/store/usage.js +0 -9
- package/lib/utils/tcbrApi/callTcbrApi.js +0 -39
- package/lib/utils/tcbrApi/index.js +0 -17
- package/lib/utils/template-manager.js +0 -458
- package/lib/utils/template.js +0 -131
- package/lib/utils/tools/common.js +0 -74
- package/lib/utils/tools/encoding.js +0 -13
- package/lib/utils/tools/index.js +0 -20
- package/lib/utils/tools/object.js +0 -28
- package/lib/utils/tools/time.js +0 -49
- package/lib/utils/tools/uid.js +0 -25
- package/lib/utils/url.js +0 -19
- package/lib/utils/validator.js +0 -72
- package/locales/README.md +0 -160
- package/locales/i18next-scanner.config.js +0 -206
- package/locales/index.js +0 -5
- package/locales/langs/en.json +0 -1235
- package/locales/langs/zh.json +0 -1235
- package/locales/mapping.json +0 -1235
- package/patches/@musistudio+claude-code-router+1.0.36.patch +0 -40
- package/post-install.js +0 -63
- package/rules/cloudbase-platform.mdc +0 -44
- package/rules/database.mdc +0 -25
- package/rules/miniprogram-development.mdc +0 -61
- package/rules/ui-design.mdc +0 -24
- package/rules/web-development.mdc +0 -44
- package/rules/workflows.mdc +0 -30
- package/runtime/nodejs/bootstrap.js +0 -255
- package/runtime/nodejs/runtime.js +0 -183
- package/specs/ai-cli-bootstrap/QWEN.md +0 -196
- package/specs/ai-cli-bootstrap/design.md +0 -185
- package/specs/ai-cli-bootstrap/requirements.md +0 -51
- package/specs/ai-cli-bootstrap/tasks.md +0 -70
- package/specs/ai-cli-bootstrap/technical-docs.md +0 -421
- package/specs/cli-install-upgrade/design.md +0 -207
- package/specs/cli-install-upgrade/requirements.md +0 -315
- package/specs/cli-install-upgrade/tasks.md +0 -120
- package/specs/codebuddy-integration/design.md +0 -152
- package/specs/codebuddy-integration/requirements.md +0 -85
- package/specs/codebuddy-integration/tasks.md +0 -159
- package/specs/mcp-global-bin/design.md +0 -57
- package/specs/mcp-global-bin/requirements.md +0 -43
- package/specs/mcp-global-bin/tasks.md +0 -54
- package/specs/ssl-fix/design.md +0 -93
- package/specs/ssl-fix/requirements.md +0 -47
- package/specs/ssl-fix/tasks.md +0 -65
- package/specs/tcb-pull-cnb-support/design.md +0 -137
- package/specs/tcb-pull-cnb-support/requirements.md +0 -56
- package/specs/tcb-pull-cnb-support/tasks.md +0 -101
- package/specs/tcb-pull-mcp-integration/design.md +0 -153
- package/specs/tcb-pull-mcp-integration/implementation-summary.md +0 -127
- package/specs/tcb-pull-mcp-integration/requirements.md +0 -68
- package/specs/tcb-pull-mcp-integration/tasks.md +0 -125
- package/specs/template-pull-command/design.md +0 -135
- package/specs/template-pull-command/implementation-summary.md +0 -160
- package/specs/template-pull-command/requirements.md +0 -73
- package/specs/template-pull-command/tasks.md +0 -101
- package/templates/html/loginFail.html +0 -90
- package/templates/html/loginSuccess.html +0 -86
- package/templates/server/node/_gitignore +0 -54
- package/templates/server/node/cloudbaserc.json +0 -10
- package/templates/server/node/index.js +0 -6
- package/templates/server/node/package.json +0 -9
- package/test-mcp-integration.js +0 -68
- package/tsconfig.json +0 -20
- package/tsconfig.test.json +0 -13
- package/types/auth/index.d.ts +0 -2
- package/types/auth/login.d.ts +0 -25
- package/types/auth/logout.d.ts +0 -1
- package/types/commands/account/index.d.ts +0 -2
- package/types/commands/account/login.d.ts +0 -15
- package/types/commands/account/logout.d.ts +0 -12
- package/types/commands/ai/index.d.ts +0 -23
- package/types/commands/cloudfunction/base.d.ts +0 -43
- package/types/commands/cloudfunction/index.d.ts +0 -1
- package/types/commands/cloudrun/base.d.ts +0 -160
- package/types/commands/cloudrun/index.d.ts +0 -1
- package/types/commands/common.d.ts +0 -38
- package/types/commands/config/delete.d.ts +0 -13
- package/types/commands/config/get.d.ts +0 -13
- package/types/commands/config/index.d.ts +0 -5
- package/types/commands/config/interface.d.ts +0 -17
- package/types/commands/config/list.d.ts +0 -13
- package/types/commands/config/set.d.ts +0 -13
- package/types/commands/constants.d.ts +0 -8
- package/types/commands/db/base.d.ts +0 -44
- package/types/commands/db/index.d.ts +0 -1
- package/types/commands/env/base.d.ts +0 -27
- package/types/commands/env/domain.d.ts +0 -53
- package/types/commands/env/index.d.ts +0 -3
- package/types/commands/env/login.d.ts +0 -47
- package/types/commands/framework/index.d.ts +0 -42
- package/types/commands/fun/base.d.ts +0 -43
- package/types/commands/fun/index.d.ts +0 -1
- package/types/commands/functions/alias/getRoute.d.ts +0 -13
- package/types/commands/functions/alias/index.d.ts +0 -2
- package/types/commands/functions/alias/setRoute.d.ts +0 -13
- package/types/commands/functions/code-download.d.ts +0 -18
- package/types/commands/functions/code-update.d.ts +0 -18
- package/types/commands/functions/concurrency/delete.d.ts +0 -13
- package/types/commands/functions/concurrency/index.d.ts +0 -3
- package/types/commands/functions/concurrency/list.d.ts +0 -13
- package/types/commands/functions/concurrency/set.d.ts +0 -13
- package/types/commands/functions/config-update.d.ts +0 -19
- package/types/commands/functions/copy.d.ts +0 -15
- package/types/commands/functions/delete.d.ts +0 -14
- package/types/commands/functions/deploy.d.ts +0 -22
- package/types/commands/functions/detail.d.ts +0 -16
- package/types/commands/functions/index.d.ts +0 -17
- package/types/commands/functions/invoke.d.ts +0 -15
- package/types/commands/functions/layer/bind.d.ts +0 -35
- package/types/commands/functions/layer/common.d.ts +0 -8
- package/types/commands/functions/layer/create.d.ts +0 -18
- package/types/commands/functions/layer/delete.d.ts +0 -18
- package/types/commands/functions/layer/download.d.ts +0 -18
- package/types/commands/functions/layer/index.d.ts +0 -7
- package/types/commands/functions/layer/list.d.ts +0 -19
- package/types/commands/functions/layer/sort.d.ts +0 -18
- package/types/commands/functions/list.d.ts +0 -14
- package/types/commands/functions/log.d.ts +0 -15
- package/types/commands/functions/run.d.ts +0 -17
- package/types/commands/functions/trigger-create.d.ts +0 -18
- package/types/commands/functions/trigger-delete.d.ts +0 -18
- package/types/commands/functions/version/index.d.ts +0 -2
- package/types/commands/functions/version/list.d.ts +0 -13
- package/types/commands/functions/version/publish.d.ts +0 -13
- package/types/commands/gateway/create.d.ts +0 -14
- package/types/commands/gateway/delete.d.ts +0 -14
- package/types/commands/gateway/domain.d.ts +0 -47
- package/types/commands/gateway/index.d.ts +0 -5
- package/types/commands/gateway/list.d.ts +0 -15
- package/types/commands/gateway/switch.d.ts +0 -31
- package/types/commands/helpers/index.d.ts +0 -3
- package/types/commands/helpers/init.d.ts +0 -22
- package/types/commands/helpers/new.d.ts +0 -17
- package/types/commands/helpers/open.d.ts +0 -11
- package/types/commands/hosting/hosting.d.ts +0 -66
- package/types/commands/hosting/index.d.ts +0 -1
- package/types/commands/index.d.ts +0 -22
- package/types/commands/lowcode/app.d.ts +0 -81
- package/types/commands/lowcode/comps.d.ts +0 -77
- package/types/commands/lowcode/index.d.ts +0 -2
- package/types/commands/lowcode/utils.d.ts +0 -9
- package/types/commands/pull/index.d.ts +0 -1
- package/types/commands/pull/pull.d.ts +0 -16
- package/types/commands/run/delete.d.ts +0 -13
- package/types/commands/run/image/common.d.ts +0 -8
- package/types/commands/run/image/delete.d.ts +0 -17
- package/types/commands/run/image/download.d.ts +0 -17
- package/types/commands/run/image/index.d.ts +0 -5
- package/types/commands/run/image/list.d.ts +0 -17
- package/types/commands/run/image/upload.d.ts +0 -17
- package/types/commands/run/index.d.ts +0 -5
- package/types/commands/run/list.d.ts +0 -13
- package/types/commands/run/service/config.d.ts +0 -14
- package/types/commands/run/service/deploy.d.ts +0 -13
- package/types/commands/run/service/index.d.ts +0 -4
- package/types/commands/run/service/list.d.ts +0 -13
- package/types/commands/run/service/update.d.ts +0 -13
- package/types/commands/run/standalonegateway/common.d.ts +0 -8
- package/types/commands/run/standalonegateway/create.d.ts +0 -17
- package/types/commands/run/standalonegateway/destroy.d.ts +0 -17
- package/types/commands/run/standalonegateway/index.d.ts +0 -5
- package/types/commands/run/standalonegateway/list.d.ts +0 -17
- package/types/commands/run/standalonegateway/package.d.ts +0 -17
- package/types/commands/run/standalonegateway/turn.d.ts +0 -17
- package/types/commands/run/version/common.d.ts +0 -8
- package/types/commands/run/version/create.d.ts +0 -17
- package/types/commands/run/version/delete.d.ts +0 -17
- package/types/commands/run/version/index.d.ts +0 -5
- package/types/commands/run/version/list.d.ts +0 -17
- package/types/commands/run/version/modify.d.ts +0 -17
- package/types/commands/run/version/update.d.ts +0 -17
- package/types/commands/runf/base.d.ts +0 -43
- package/types/commands/runf/index.d.ts +0 -1
- package/types/commands/self-update.d.ts +0 -24
- package/types/commands/smart.d.ts +0 -1
- package/types/commands/storage/index.d.ts +0 -1
- package/types/commands/storage/storage.d.ts +0 -106
- package/types/commands/third/index.d.ts +0 -1
- package/types/commands/third/thirdAttach.d.ts +0 -15
- package/types/commands/utils.d.ts +0 -28
- package/types/completion/index.d.ts +0 -4
- package/types/constant.d.ts +0 -71
- package/types/db/index.d.ts +0 -24
- package/types/decorators/captureError.d.ts +0 -1
- package/types/decorators/constants.d.ts +0 -11
- package/types/decorators/deprecate.d.ts +0 -4
- package/types/decorators/guard.d.ts +0 -5
- package/types/decorators/index.d.ts +0 -7
- package/types/decorators/injectParams.d.ts +0 -1
- package/types/decorators/params/common.d.ts +0 -4
- package/types/decorators/params/index.d.ts +0 -8
- package/types/env/domain.d.ts +0 -11
- package/types/env/index.d.ts +0 -12
- package/types/env/login.d.ts +0 -16
- package/types/error.d.ts +0 -20
- package/types/function/alias.d.ts +0 -3
- package/types/function/base.d.ts +0 -32
- package/types/function/code.d.ts +0 -8
- package/types/function/concurrency.d.ts +0 -4
- package/types/function/create.d.ts +0 -3
- package/types/function/delete.d.ts +0 -8
- package/types/function/index.d.ts +0 -11
- package/types/function/layer/attach.d.ts +0 -9
- package/types/function/layer/create.d.ts +0 -8
- package/types/function/layer/delete.d.ts +0 -5
- package/types/function/layer/download.d.ts +0 -7
- package/types/function/layer/index.d.ts +0 -7
- package/types/function/layer/list.d.ts +0 -10
- package/types/function/layer/sort.d.ts +0 -10
- package/types/function/trigger.d.ts +0 -5
- package/types/function/update.d.ts +0 -2
- package/types/function/version.d.ts +0 -3
- package/types/function/vpc.d.ts +0 -2
- package/types/gateway/index.d.ts +0 -18
- package/types/help.d.ts +0 -1
- package/types/hosting.d.ts +0 -35
- package/types/i18n/index.d.ts +0 -3
- package/types/index.d.ts +0 -4
- package/types/logger.d.ts +0 -3
- package/types/run/delete.d.ts +0 -2
- package/types/run/image/build.d.ts +0 -10
- package/types/run/image/delete.d.ts +0 -2
- package/types/run/image/index.d.ts +0 -4
- package/types/run/image/info.d.ts +0 -1
- package/types/run/image/list.d.ts +0 -3
- package/types/run/index.d.ts +0 -7
- package/types/run/list.d.ts +0 -2
- package/types/run/repo.d.ts +0 -5
- package/types/run/service/common.d.ts +0 -42
- package/types/run/service/config.d.ts +0 -23
- package/types/run/service/deployPackage.d.ts +0 -11
- package/types/run/service/index.d.ts +0 -6
- package/types/run/service/list.d.ts +0 -2
- package/types/run/service/showLogs.d.ts +0 -2
- package/types/run/service/update.d.ts +0 -3
- package/types/run/standalonegateway/create.d.ts +0 -2
- package/types/run/standalonegateway/destroy.d.ts +0 -2
- package/types/run/standalonegateway/index.d.ts +0 -5
- package/types/run/standalonegateway/list.d.ts +0 -2
- package/types/run/standalonegateway/package/index.d.ts +0 -1
- package/types/run/standalonegateway/package/list.d.ts +0 -2
- package/types/run/standalonegateway/turn/index.d.ts +0 -2
- package/types/run/standalonegateway/turn/off.d.ts +0 -2
- package/types/run/standalonegateway/turn/on.d.ts +0 -2
- package/types/run/version/create.d.ts +0 -10
- package/types/run/version/delete.d.ts +0 -2
- package/types/run/version/index.d.ts +0 -6
- package/types/run/version/list.d.ts +0 -2
- package/types/run/version/modify.d.ts +0 -2
- package/types/run/version/repo.d.ts +0 -10
- package/types/run/version/update.d.ts +0 -6
- package/types/storage.d.ts +0 -34
- package/types/third/index.d.ts +0 -1
- package/types/types.d.ts +0 -590
- package/types/utils/ai/banner.d.ts +0 -2
- package/types/utils/ai/claudeWindows.d.ts +0 -2
- package/types/utils/ai/config.d.ts +0 -89
- package/types/utils/ai/const.d.ts +0 -401
- package/types/utils/ai/ensureFiles.d.ts +0 -1
- package/types/utils/ai/env.d.ts +0 -2
- package/types/utils/ai/envLocalManager.d.ts +0 -23
- package/types/utils/ai/nodeVersion.d.ts +0 -2
- package/types/utils/ai/router.d.ts +0 -55
- package/types/utils/ai/setup.d.ts +0 -26
- package/types/utils/auth.d.ts +0 -3
- package/types/utils/checkTcbrEnv.d.ts +0 -3
- package/types/utils/cli-table.d.ts +0 -2
- package/types/utils/commonParamsCheck.d.ts +0 -3
- package/types/utils/config.d.ts +0 -27
- package/types/utils/debug-logger.d.ts +0 -1
- package/types/utils/dts.d.ts +0 -6
- package/types/utils/env.d.ts +0 -5
- package/types/utils/fs/del.d.ts +0 -1
- package/types/utils/fs/index.d.ts +0 -7
- package/types/utils/function-packer.d.ts +0 -18
- package/types/utils/index.d.ts +0 -22
- package/types/utils/log.d.ts +0 -22
- package/types/utils/mcp-config-modifier.d.ts +0 -7
- package/types/utils/net/cloud-api-request.d.ts +0 -9
- package/types/utils/net/credential.d.ts +0 -5
- package/types/utils/net/http-request.d.ts +0 -8
- package/types/utils/net/index.d.ts +0 -5
- package/types/utils/net/manager-service.d.ts +0 -4
- package/types/utils/net/proxy.d.ts +0 -1
- package/types/utils/notice.d.ts +0 -1
- package/types/utils/output/highlight.d.ts +0 -1
- package/types/utils/output/index.d.ts +0 -3
- package/types/utils/output/link.d.ts +0 -1
- package/types/utils/output/loading.d.ts +0 -18
- package/types/utils/parallel.d.ts +0 -11
- package/types/utils/platform/index.d.ts +0 -3
- package/types/utils/platform/mac.d.ts +0 -2
- package/types/utils/platform/os.d.ts +0 -2
- package/types/utils/platform/port.d.ts +0 -1
- package/types/utils/progress-bar.d.ts +0 -1
- package/types/utils/prompt/index.d.ts +0 -1
- package/types/utils/prompt/select.d.ts +0 -4
- package/types/utils/report.d.ts +0 -16
- package/types/utils/reporter/agree.d.ts +0 -1
- package/types/utils/reporter/download.d.ts +0 -1
- package/types/utils/reporter/index.d.ts +0 -3
- package/types/utils/reporter/usage.d.ts +0 -1
- package/types/utils/store/auth.d.ts +0 -8
- package/types/utils/store/common.d.ts +0 -2
- package/types/utils/store/config.d.ts +0 -8
- package/types/utils/store/db.d.ts +0 -17
- package/types/utils/store/index.d.ts +0 -5
- package/types/utils/store/usage.d.ts +0 -2
- package/types/utils/tcbrApi/callTcbrApi.d.ts +0 -1
- package/types/utils/tcbrApi/index.d.ts +0 -1
- package/types/utils/template-manager.d.ts +0 -27
- package/types/utils/template.d.ts +0 -8
- package/types/utils/tools/common.d.ts +0 -1
- package/types/utils/tools/encoding.d.ts +0 -1
- package/types/utils/tools/index.d.ts +0 -4
- package/types/utils/tools/object.d.ts +0 -1
- package/types/utils/tools/time.d.ts +0 -2
- package/types/utils/tools/uid.d.ts +0 -2
- package/types/utils/url.d.ts +0 -18
- package/types/utils/validator.d.ts +0 -9
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
# 需求文档
|
|
2
|
-
|
|
3
|
-
## 介绍
|
|
4
|
-
|
|
5
|
-
为 `tcb pull` 命令增加 cnb.cool 仓库的支持,使开发者能够直接从 cnb.cool 平台拉取项目模板。
|
|
6
|
-
|
|
7
|
-
## 需求
|
|
8
|
-
|
|
9
|
-
### 需求 1 - 支持 cnb.cool URL 解析
|
|
10
|
-
|
|
11
|
-
**用户故事:** 作为开发者,我希望能够通过 `tcb pull https://cnb.cool/username/repo` 直接拉取 cnb.cool 上的项目模板。
|
|
12
|
-
|
|
13
|
-
#### 验收标准
|
|
14
|
-
|
|
15
|
-
1. When 用户输入 `tcb pull https://cnb.cool/username/repo`,the tcb pull 命令 shall 识别出这是一个 cnb.cool URL 并进行相应处理。
|
|
16
|
-
2. When 用户输入 `tcb pull https://cnb.cool/username/repo/tree/branch/path`,the tcb pull 命令 shall 支持拉取 cnb.cool 仓库的指定分支和子目录。
|
|
17
|
-
3. When 用户输入无效的 cnb.cool URL,the tcb pull 命令 shall 显示清晰的错误提示信息。
|
|
18
|
-
|
|
19
|
-
### 需求 2 - cnb.cool 仓库拉取功能
|
|
20
|
-
|
|
21
|
-
**用户故事:** 作为开发者,我希望 `tcb pull` 命令能够成功拉取 cnb.cool 上的项目模板到本地。
|
|
22
|
-
|
|
23
|
-
#### 验收标准
|
|
24
|
-
|
|
25
|
-
1. When 用户执行 `tcb pull https://cnb.cool/username/repo`,the 系统 shall 成功下载并解压 cnb.cool 上的仓库内容。
|
|
26
|
-
2. When 用户指定输出目录时,the 系统 shall 将模板内容保存到指定的目录中。
|
|
27
|
-
3. When 拉取过程中发生错误,the 系统 shall 显示详细的错误信息并提供可能的解决方案。
|
|
28
|
-
|
|
29
|
-
### 需求 3 - 命令帮助更新
|
|
30
|
-
|
|
31
|
-
**用户故事:** 作为开发者,我希望在 `tcb pull` 命令的帮助信息中看到 cnb.cool 的使用说明。
|
|
32
|
-
|
|
33
|
-
#### 验收标准
|
|
34
|
-
|
|
35
|
-
1. When 用户执行 `tcb pull --help`,the 帮助信息 shall 包含 cnb.cool 的支持说明和示例。
|
|
36
|
-
2. When 用户执行 `tcb pull list`,the 模板列表 shall 包含 cnb.cool 的支持格式说明。
|
|
37
|
-
|
|
38
|
-
## 示例
|
|
39
|
-
|
|
40
|
-
```bash
|
|
41
|
-
# 拉取 cnb.cool 上的项目
|
|
42
|
-
tcb pull https://cnb.cool/tencent/cloud/cloudbase/CloudBase-AI-ToolKit
|
|
43
|
-
|
|
44
|
-
# 拉取指定分支和子目录
|
|
45
|
-
tcb pull https://cnb.cool/shuishenhuole/learning/tree/main/examples
|
|
46
|
-
|
|
47
|
-
# 指定输出目录
|
|
48
|
-
tcb pull https://cnb.cool/username/repo --output ./my-project
|
|
49
|
-
```
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
# 实施计划
|
|
2
|
-
|
|
3
|
-
## 已完成任务
|
|
4
|
-
|
|
5
|
-
- [x] 1. 更新 GitUrlInfo 接口以支持 cnb 平台
|
|
6
|
-
- 在 `GitUrlInfo` 接口中添加 `'cnb'` 平台类型
|
|
7
|
-
- 确保类型定义的完整性
|
|
8
|
-
|
|
9
|
-
- [x] 2. 实现 cnb.cool URL 识别逻辑
|
|
10
|
-
- 修改 `isGitUrl()` 方法识别 cnb.cool URLs
|
|
11
|
-
- 添加对 `cnb.cool` 域名的支持
|
|
12
|
-
|
|
13
|
-
- [x] 3. 实现 cnb.cool URL 解析逻辑
|
|
14
|
-
- 修改 `parseGitUrl()` 方法解析 cnb.cool URLs
|
|
15
|
-
- 支持基础 URL 和带分支/子目录的 URL
|
|
16
|
-
- 处理 SSH URL 中的 cnb.cool 支持
|
|
17
|
-
|
|
18
|
-
- [x] 4. 实现 cnb.cool Git URL 构建
|
|
19
|
-
- 修改 `buildGitUrl()` 方法支持 cnb 平台
|
|
20
|
-
- 构建标准的 Git URL 格式
|
|
21
|
-
|
|
22
|
-
- [x] 5. 更新命令帮助信息
|
|
23
|
-
- 更新 `tcb pull` 命令的帮助描述
|
|
24
|
-
- 添加 cnb.cool 的使用示例
|
|
25
|
-
- 更新 `tcb pull list` 的输出信息
|
|
26
|
-
|
|
27
|
-
- [x] 6. 编写单元测试
|
|
28
|
-
- 创建 `template-manager-cnb.test.ts` 测试文件
|
|
29
|
-
- 覆盖 URL 解析、验证和构建的测试用例
|
|
30
|
-
- 确保测试覆盖率达到要求
|
|
31
|
-
|
|
32
|
-
- [x] 7. 验证功能完整性
|
|
33
|
-
- 运行测试验证功能正确性
|
|
34
|
-
- 检查代码编译无错误
|
|
35
|
-
- 验证帮助信息显示正确
|
|
36
|
-
|
|
37
|
-
## 验收标准
|
|
38
|
-
|
|
39
|
-
### 功能验收标准
|
|
40
|
-
1. **URL 解析功能**
|
|
41
|
-
- [x] 能够正确解析 `https://cnb.cool/user/repo` 格式
|
|
42
|
-
- [x] 能够正确解析 `https://cnb.cool/user/repo/tree/branch/path` 格式
|
|
43
|
-
- [x] 能够正确处理 HTTP 和 HTTPS 协议
|
|
44
|
-
|
|
45
|
-
2. **Git 仓库支持**
|
|
46
|
-
- [x] 能够构建正确的 cnb.cool Git URL
|
|
47
|
-
- [x] 能够复用现有的 Git 下载逻辑
|
|
48
|
-
- [x] 支持分支和子目录拉取
|
|
49
|
-
|
|
50
|
-
3. **用户界面**
|
|
51
|
-
- [x] 命令帮助信息包含 cnb.cool 支持说明
|
|
52
|
-
- [x] `tcb pull list` 显示 cnb.cool 支持格式
|
|
53
|
-
- [x] 提供清晰的使用示例
|
|
54
|
-
|
|
55
|
-
4. **测试覆盖**
|
|
56
|
-
- [x] URL 解析测试通过
|
|
57
|
-
- [x] URL 验证测试通过
|
|
58
|
-
- [x] Git URL 构建测试通过
|
|
59
|
-
- [x] 集成测试通过
|
|
60
|
-
|
|
61
|
-
### 性能验收标准
|
|
62
|
-
- [x] 代码编译无错误
|
|
63
|
-
- [x] 测试执行时间在合理范围内
|
|
64
|
-
- [x] 不影响现有功能的性能
|
|
65
|
-
|
|
66
|
-
### 兼容性验收标准
|
|
67
|
-
- [x] 不破坏现有的 GitHub/Gitee 支持
|
|
68
|
-
- [x] 保持向后兼容性
|
|
69
|
-
- [x] API 接口保持不变
|
|
70
|
-
|
|
71
|
-
## 技术债务和风险
|
|
72
|
-
|
|
73
|
-
### 已识别的技术债务
|
|
74
|
-
1. **测试覆盖率**:当前测试主要集中在 URL 解析,缺少实际 Git 克隆的集成测试
|
|
75
|
-
2. **错误处理**:cnb.cool 特有的错误场景可能需要更细致的处理
|
|
76
|
-
|
|
77
|
-
### 风险评估
|
|
78
|
-
1. **低风险**:URL 解析逻辑相对简单,测试覆盖充分
|
|
79
|
-
2. **中风险**:实际 cnb.cool 仓库的网络访问可能有未知问题
|
|
80
|
-
3. **低风险**:复用现有 Git 逻辑,减少了新代码的复杂性
|
|
81
|
-
|
|
82
|
-
## 后续优化建议
|
|
83
|
-
|
|
84
|
-
1. **集成测试增强**
|
|
85
|
-
- 添加实际 cnb.cool 仓库的拉取测试
|
|
86
|
-
- 模拟网络错误场景的测试
|
|
87
|
-
|
|
88
|
-
2. **用户体验优化**
|
|
89
|
-
- 添加 cnb.cool 特有的错误提示
|
|
90
|
-
- 支持更多的 URL 格式变体
|
|
91
|
-
|
|
92
|
-
3. **监控和运维**
|
|
93
|
-
- 添加 cnb.cool 拉取的性能监控
|
|
94
|
-
- 记录错误日志用于问题排查
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
# 技术方案设计
|
|
2
|
-
|
|
3
|
-
## 架构概述
|
|
4
|
-
|
|
5
|
-
本方案通过在 `TemplateManager` 中集成 MCP 配置修改功能,使 `tcb pull` 命令在下载模板后能够自动修改 MCP 配置文件,将 npx 命令替换为 `cloudbase-mcp` 命令,从而与 `tcb ai` 命令保持一致的行为。
|
|
6
|
-
|
|
7
|
-
## 技术栈
|
|
8
|
-
|
|
9
|
-
- Node.js CLI 工具
|
|
10
|
-
- `fs-extra`: 文件系统操作
|
|
11
|
-
- `simple-git`: Git 操作
|
|
12
|
-
- 现有的 MCP 配置修改逻辑
|
|
13
|
-
|
|
14
|
-
## 技术选型
|
|
15
|
-
|
|
16
|
-
### 1. 代码复用策略
|
|
17
|
-
- 将 `tcb ai` 命令中的 MCP 配置修改逻辑提取到独立的工具类中
|
|
18
|
-
- 在 `TemplateManager` 中调用这些工具类
|
|
19
|
-
- 避免代码重复,保持逻辑一致性
|
|
20
|
-
|
|
21
|
-
### 2. 集成点设计
|
|
22
|
-
- 在 `TemplateManager.pullTemplate` 方法的最后阶段添加 MCP 配置修改
|
|
23
|
-
- 在 `copyFromTempToTarget` 方法完成后执行 MCP 配置修改
|
|
24
|
-
- 确保不影响现有的模板下载流程
|
|
25
|
-
|
|
26
|
-
### 3. 错误处理策略
|
|
27
|
-
- MCP 配置修改失败不应影响模板下载的成功完成
|
|
28
|
-
- 提供详细的日志记录,便于问题排查
|
|
29
|
-
- 支持用户选择跳过 MCP 配置修改
|
|
30
|
-
|
|
31
|
-
## 核心组件设计
|
|
32
|
-
|
|
33
|
-
### 1. MCPConfigModifier 工具类
|
|
34
|
-
```typescript
|
|
35
|
-
export class MCPConfigModifier {
|
|
36
|
-
// 修改指定目录下的所有 MCP 配置文件
|
|
37
|
-
async modifyMCPConfigs(extractDir: string, log: Logger): Promise<void>
|
|
38
|
-
|
|
39
|
-
// 修改单个 JSON 配置文件
|
|
40
|
-
private async modifyMCPJsonFile(filePath: string, log: Logger): Promise<void>
|
|
41
|
-
|
|
42
|
-
// 修改单个 TOML 配置文件
|
|
43
|
-
private async modifyMCPTomlFile(filePath: string, log: Logger): Promise<void>
|
|
44
|
-
}
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### 2. TemplateManager 增强
|
|
48
|
-
```typescript
|
|
49
|
-
export class TemplateManager {
|
|
50
|
-
private mcpConfigModifier: MCPConfigModifier
|
|
51
|
-
|
|
52
|
-
constructor() {
|
|
53
|
-
this.mcpConfigModifier = new MCPConfigModifier()
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
// 在模板复制完成后调用 MCP 配置修改
|
|
57
|
-
private async copyFromTempToTarget(tempDir: string, targetPath: string, force: boolean, log: Logger): Promise<void> {
|
|
58
|
-
// ... 现有的复制逻辑 ...
|
|
59
|
-
|
|
60
|
-
// 新增:修改 MCP 配置文件
|
|
61
|
-
try {
|
|
62
|
-
await this.mcpConfigModifier.modifyMCPConfigs(targetPath, log)
|
|
63
|
-
} catch (error) {
|
|
64
|
-
log.warn(`⚠️ MCP 配置修改失败: ${error.message}`)
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## 数据流设计
|
|
71
|
-
|
|
72
|
-
```mermaid
|
|
73
|
-
graph TD
|
|
74
|
-
A[tcb pull 命令] --> B[TemplateManager.pullTemplate]
|
|
75
|
-
B --> C[下载模板到临时目录]
|
|
76
|
-
C --> D[复制到目标目录]
|
|
77
|
-
D --> E[MCPConfigModifier.modifyMCPConfigs]
|
|
78
|
-
E --> F[遍历 IDE 配置文件]
|
|
79
|
-
F --> G{文件类型判断}
|
|
80
|
-
G -->|JSON| H[modifyMCPJsonFile]
|
|
81
|
-
G -->|TOML| I[modifyMCPTomlFile]
|
|
82
|
-
H --> J[替换 npx 命令]
|
|
83
|
-
I --> J
|
|
84
|
-
J --> K[保存修改后的配置]
|
|
85
|
-
K --> L[完成]
|
|
86
|
-
```
|
|
87
|
-
|
|
88
|
-
## 配置文件映射
|
|
89
|
-
|
|
90
|
-
复用 `tcb ai` 命令中已定义的 IDE 配置文件映射:
|
|
91
|
-
|
|
92
|
-
```typescript
|
|
93
|
-
const IDE_FILE_MAPPINGS: Record<string, IdeFileDescriptor[]> = {
|
|
94
|
-
cursor: [
|
|
95
|
-
{ path: '.cursor/rules/cloudbase-rules.mdc' },
|
|
96
|
-
{ path: '.cursor/mcp.json', isMcpConfig: true }
|
|
97
|
-
],
|
|
98
|
-
'claude-code': [
|
|
99
|
-
{ path: 'CLAUDE.md' },
|
|
100
|
-
{ path: '.mcp.json', isMcpConfig: true }
|
|
101
|
-
],
|
|
102
|
-
// ... 其他 IDE 配置
|
|
103
|
-
}
|
|
104
|
-
```
|
|
105
|
-
|
|
106
|
-
## 测试策略
|
|
107
|
-
|
|
108
|
-
### 1. 单元测试
|
|
109
|
-
- 测试 `MCPConfigModifier` 类的各个方法
|
|
110
|
-
- 测试不同格式配置文件的修改逻辑
|
|
111
|
-
- 测试错误处理机制
|
|
112
|
-
|
|
113
|
-
### 2. 集成测试
|
|
114
|
-
- 测试 `tcb pull` 命令的完整流程
|
|
115
|
-
- 测试内置模板和 Git 仓库的 MCP 配置修改
|
|
116
|
-
- 测试与现有功能的兼容性
|
|
117
|
-
|
|
118
|
-
### 3. 端到端测试
|
|
119
|
-
- 测试完整的模板下载和配置修改流程
|
|
120
|
-
- 测试不同 IDE 配置文件的生成和修改
|
|
121
|
-
- 测试错误场景的处理
|
|
122
|
-
|
|
123
|
-
## 安全性考虑
|
|
124
|
-
|
|
125
|
-
- 确保 MCP 配置修改不影响模板下载的安全性
|
|
126
|
-
- 验证修改后的配置文件格式正确性
|
|
127
|
-
- 防止路径遍历攻击
|
|
128
|
-
|
|
129
|
-
## 性能考虑
|
|
130
|
-
|
|
131
|
-
- MCP 配置修改在模板复制完成后异步执行
|
|
132
|
-
- 避免重复读取和解析配置文件
|
|
133
|
-
- 优化文件遍历和修改逻辑
|
|
134
|
-
|
|
135
|
-
## 实施计划
|
|
136
|
-
|
|
137
|
-
```mermaid
|
|
138
|
-
graph TD
|
|
139
|
-
A[提取 MCP 配置修改逻辑] --> B[创建 MCPConfigModifier 类]
|
|
140
|
-
B --> C[修改 TemplateManager 集成]
|
|
141
|
-
C --> D[测试验证]
|
|
142
|
-
D --> E[文档更新]
|
|
143
|
-
```
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
@@ -1,127 +0,0 @@
|
|
|
1
|
-
# 实现总结
|
|
2
|
-
|
|
3
|
-
## 已完成功能
|
|
4
|
-
|
|
5
|
-
### 1. MCP 配置修改器 ✅
|
|
6
|
-
|
|
7
|
-
- **功能**: 创建了独立的 `MCPConfigModifier` 工具类
|
|
8
|
-
- **位置**: `src/utils/mcp-config-modifier.ts`
|
|
9
|
-
- **能力**:
|
|
10
|
-
- 自动检测并修改所有 IDE 的 MCP 配置文件
|
|
11
|
-
- 支持 JSON 和 TOML 两种格式
|
|
12
|
-
- 将 `npx npm-global-exec@latest @cloudbase/cloudbase-mcp@latest` 替换为 `cloudbase-mcp`
|
|
13
|
-
- 递归处理嵌套配置
|
|
14
|
-
- 完整的错误处理和日志记录
|
|
15
|
-
|
|
16
|
-
### 2. TemplateManager 集成 ✅
|
|
17
|
-
|
|
18
|
-
- **功能**: 在 `TemplateManager` 中集成了 MCP 配置修改功能
|
|
19
|
-
- **位置**: `src/utils/template-manager.ts`
|
|
20
|
-
- **集成点**: 在 `copyFromTempToTarget` 方法完成后自动调用
|
|
21
|
-
- **特性**:
|
|
22
|
-
- 不影响现有的模板下载流程
|
|
23
|
-
- 错误处理确保 MCP 配置修改失败不影响模板下载
|
|
24
|
-
- 支持所有内置模板和 Git 仓库下载
|
|
25
|
-
|
|
26
|
-
### 3. 测试覆盖 ✅
|
|
27
|
-
|
|
28
|
-
- **单元测试**: `test/utils/mcp-config-modifier.test.ts`
|
|
29
|
-
- 测试 JSON 配置文件修改
|
|
30
|
-
- 测试 TOML 配置文件修改
|
|
31
|
-
- 测试嵌套配置处理
|
|
32
|
-
- 测试错误处理机制
|
|
33
|
-
- 测试边界情况
|
|
34
|
-
|
|
35
|
-
- **集成测试**: `test/utils/template-manager-mcp.test.ts`
|
|
36
|
-
- 测试模板复制后的 MCP 配置修改
|
|
37
|
-
- 测试不同文件格式的处理
|
|
38
|
-
- 测试与现有功能的兼容性
|
|
39
|
-
- 测试错误场景的处理
|
|
40
|
-
|
|
41
|
-
### 4. 支持的 IDE 配置 ✅
|
|
42
|
-
|
|
43
|
-
- **Cursor**: `.cursor/mcp.json`
|
|
44
|
-
- **VSCode**: `.vscode/mcp.json`
|
|
45
|
-
- **Claude Code**: `.mcp.json`
|
|
46
|
-
- **OpenAI Codex**: `.codex/config.toml`
|
|
47
|
-
- **OpenCode**: `.opencode.json`
|
|
48
|
-
- **CodeBuddy**: `.rules/cloudbase-rules.md`
|
|
49
|
-
- **Qwen Code**: `.qwen/settings.json`
|
|
50
|
-
- **百度 Comate**: `.comate/mcp.json`
|
|
51
|
-
- **RooCode**: `.roo/mcp.json`
|
|
52
|
-
- **Aider**: `mcp.json`
|
|
53
|
-
- 以及其他主流 AI 编辑器
|
|
54
|
-
|
|
55
|
-
## 技术实现
|
|
56
|
-
|
|
57
|
-
### 1. 代码复用策略
|
|
58
|
-
|
|
59
|
-
- 从 `tcb ai` 命令中提取了 MCP 配置修改逻辑
|
|
60
|
-
- 创建了独立的工具类,避免代码重复
|
|
61
|
-
- 保持了与原始实现完全一致的逻辑
|
|
62
|
-
|
|
63
|
-
### 2. 集成设计
|
|
64
|
-
|
|
65
|
-
- 在 `TemplateManager` 的合适时机调用 MCP 配置修改
|
|
66
|
-
- 使用依赖注入模式,便于测试和维护
|
|
67
|
-
- 错误处理确保核心功能不受影响
|
|
68
|
-
|
|
69
|
-
### 3. 配置修改逻辑
|
|
70
|
-
|
|
71
|
-
- **JSON 文件**: 要求同时包含 `npm-global-exec@latest` 和 `@cloudbase/cloudbase-mcp@latest`
|
|
72
|
-
- **TOML 文件**: 只要求包含 `@cloudbase/cloudbase-mcp@latest`
|
|
73
|
-
- 自动添加 `INTEGRATION_IDE: "CloudBaseCLI"` 环境变量
|
|
74
|
-
|
|
75
|
-
## 使用效果
|
|
76
|
-
|
|
77
|
-
### 1. 用户体验提升
|
|
78
|
-
|
|
79
|
-
- 用户使用 `tcb pull` 下载模板后,MCP 配置自动优化
|
|
80
|
-
- 无需手动安装额外的 MCP 包
|
|
81
|
-
- 配置成功率显著提高
|
|
82
|
-
|
|
83
|
-
### 2. 功能一致性
|
|
84
|
-
|
|
85
|
-
- `tcb pull` 和 `tcb ai` 命令在 MCP 配置修改方面完全一致
|
|
86
|
-
- 用户无需学习不同的配置方式
|
|
87
|
-
- 维护成本降低
|
|
88
|
-
|
|
89
|
-
### 3. 向后兼容性
|
|
90
|
-
|
|
91
|
-
- 现有功能完全不受影响
|
|
92
|
-
- 新增功能为可选,不会破坏现有流程
|
|
93
|
-
- 错误处理确保稳定性
|
|
94
|
-
|
|
95
|
-
## 测试验证
|
|
96
|
-
|
|
97
|
-
### 1. 自动化测试
|
|
98
|
-
|
|
99
|
-
- 所有测试用例通过 ✅
|
|
100
|
-
- 覆盖了主要功能点和边界情况
|
|
101
|
-
- 测试覆盖率良好
|
|
102
|
-
|
|
103
|
-
### 2. 手动验证
|
|
104
|
-
|
|
105
|
-
- 创建了测试配置文件进行功能验证
|
|
106
|
-
- JSON 和 TOML 格式修改都正常工作
|
|
107
|
-
- 嵌套配置处理正确
|
|
108
|
-
|
|
109
|
-
## 总结
|
|
110
|
-
|
|
111
|
-
成功实现了在 `tcb pull` 命令中集成 MCP 配置修改功能,使该命令与 `tcb ai` 命令保持一致的行为。主要成果包括:
|
|
112
|
-
|
|
113
|
-
1. **功能完整性**: 支持所有主流 IDE 的 MCP 配置文件
|
|
114
|
-
2. **技术质量**: 代码结构清晰,测试覆盖完整
|
|
115
|
-
3. **用户体验**: 自动化配置修改,提高成功率
|
|
116
|
-
4. **维护性**: 代码复用,逻辑一致,易于维护
|
|
117
|
-
|
|
118
|
-
该功能现在已经可以投入使用,用户在使用 `tcb pull` 命令下载模板时将自动获得优化后的 MCP 配置。
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
# 需求文档
|
|
2
|
-
|
|
3
|
-
## 介绍
|
|
4
|
-
|
|
5
|
-
当前 `tcb ai` 命令在下载模板时会自动修改 MCP 配置文件,将 `npx npm-global-exec@latest @cloudbase/cloudbase-mcp@latest` 命令替换为 `cloudbase-mcp`,但 `tcb pull` 命令没有实现这个功能。这导致用户使用 `tcb pull` 下载的模板中的 MCP 配置仍然使用 npx 命令,需要额外安装依赖,降低了配置成功率。
|
|
6
|
-
|
|
7
|
-
## 需求
|
|
8
|
-
|
|
9
|
-
### 需求 1 - tcb pull 命令集成 MCP 配置修改
|
|
10
|
-
|
|
11
|
-
**用户故事:** 作为开发者,我希望使用 `tcb pull` 命令下载模板后,系统能够自动修改 MCP 配置文件,将 npx 命令替换为 CLI 提供的全局命令,避免额外的依赖安装。
|
|
12
|
-
|
|
13
|
-
#### 验收标准
|
|
14
|
-
|
|
15
|
-
1. When 使用 `tcb pull` 命令下载模板完成后,the 系统 shall 自动检测并修改所有 MCP 配置文件
|
|
16
|
-
2. When 发现 `.cursor/mcp.json` 等配置文件时,the 系统 shall 将 `npx npm-global-exec@latest @cloudbase/cloudbase-mcp@latest` 替换为 `cloudbase-mcp`
|
|
17
|
-
3. When 修改完成后,the 系统 shall 验证配置文件的正确性
|
|
18
|
-
4. When 用户使用 `tcb pull` 下载的模板时,the MCP 功能 shall 无需额外安装即可正常工作
|
|
19
|
-
|
|
20
|
-
### 需求 2 - 保持与 tcb ai 命令的一致性
|
|
21
|
-
|
|
22
|
-
**用户故事:** 作为开发者,我希望 `tcb pull` 和 `tcb ai` 命令在模板下载和 MCP 配置修改方面保持一致的行为,避免混淆。
|
|
23
|
-
|
|
24
|
-
#### 验收标准
|
|
25
|
-
|
|
26
|
-
1. When 使用 `tcb pull` 下载模板时,the MCP 配置修改逻辑 shall 与 `tcb ai` 命令完全一致
|
|
27
|
-
2. When 支持相同的 IDE 配置文件格式时,the 系统 shall 使用相同的修改规则
|
|
28
|
-
3. When 处理 JSON 和 TOML 格式时,the 系统 shall 使用相同的转换逻辑
|
|
29
|
-
4. When 出现错误时,the 系统 shall 提供相同的错误处理和日志记录
|
|
30
|
-
|
|
31
|
-
### 需求 3 - 支持所有内置模板和 Git 仓库
|
|
32
|
-
|
|
33
|
-
**用户故事:** 作为开发者,我希望无论从内置模板还是 Git 仓库下载内容,`tcb pull` 命令都能正确处理 MCP 配置。
|
|
34
|
-
|
|
35
|
-
#### 验收标准
|
|
36
|
-
|
|
37
|
-
1. When 下载内置模板(miniprogram、react、vue、uniapp、rules)时,the 系统 shall 自动修改 MCP 配置
|
|
38
|
-
2. When 从 Git 仓库下载模板时,the 系统 shall 自动修改 MCP 配置
|
|
39
|
-
3. When 从 Git 子目录下载内容时,the 系统 shall 自动修改 MCP 配置
|
|
40
|
-
4. When 支持多种 IDE 配置时,the 系统 shall 处理所有相关的配置文件
|
|
41
|
-
|
|
42
|
-
### 需求 4 - 向后兼容性
|
|
43
|
-
|
|
44
|
-
**用户故事:** 作为开发者,我希望新功能不会影响现有的 `tcb pull` 命令功能,保持向后兼容。
|
|
45
|
-
|
|
46
|
-
#### 验收标准
|
|
47
|
-
|
|
48
|
-
1. When 现有 `tcb pull` 命令功能使用时,the 系统 shall 保持原有行为不变
|
|
49
|
-
2. When 新增 MCP 配置修改功能时,the 系统 shall 不影响模板下载的核心流程
|
|
50
|
-
3. When 出现 MCP 配置修改失败时,the 系统 shall 不影响模板下载的成功完成
|
|
51
|
-
4. When 用户可以选择跳过 MCP 配置修改时,the 系统 shall 提供相应的选项
|
|
52
|
-
|
|
53
|
-
## 技术约束
|
|
54
|
-
|
|
55
|
-
- 必须复用 `tcb ai` 命令中已有的 MCP 配置修改逻辑
|
|
56
|
-
- 必须支持 JSON 和 TOML 两种配置文件格式
|
|
57
|
-
- 必须支持所有已定义的 IDE 配置文件映射
|
|
58
|
-
- 必须保持与现有代码架构的一致性
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
# 实施计划
|
|
2
|
-
|
|
3
|
-
## 阶段一:代码重构和提取
|
|
4
|
-
|
|
5
|
-
- [x] 1. 提取 MCP 配置修改逻辑
|
|
6
|
-
- 从 `src/utils/ai/router.ts` 中提取 `modifyMCPConfigs` 相关方法
|
|
7
|
-
- 创建独立的 `MCPConfigModifier` 工具类
|
|
8
|
-
- 提取 IDE 配置文件映射常量
|
|
9
|
-
- 提取配置文件格式推断逻辑
|
|
10
|
-
- _需求: 需求 1, 需求 2
|
|
11
|
-
|
|
12
|
-
- [x] 2. 创建 MCPConfigModifier 类
|
|
13
|
-
- 实现 `modifyMCPConfigs` 主方法
|
|
14
|
-
- 实现 `modifyMCPJsonFile` 方法
|
|
15
|
-
- 实现 `modifyMCPTomlFile` 方法
|
|
16
|
-
- 实现 `objectToToml` 辅助方法
|
|
17
|
-
- 添加完整的错误处理和日志记录
|
|
18
|
-
- _需求: 需求 1, 需求 2
|
|
19
|
-
|
|
20
|
-
- [x] 3. 提取共享常量和类型
|
|
21
|
-
- 将 `IDE_FILE_MAPPINGS` 常量移动到共享位置
|
|
22
|
-
- 将 `IdeFileDescriptor` 接口移动到共享位置
|
|
23
|
-
- 将 `inferConfigFormat` 函数移动到共享位置
|
|
24
|
-
- 确保类型定义的一致性
|
|
25
|
-
- _需求: 需求 2
|
|
26
|
-
|
|
27
|
-
## 阶段二:TemplateManager 集成
|
|
28
|
-
|
|
29
|
-
- [x] 4. 修改 TemplateManager 类
|
|
30
|
-
- 在 `TemplateManager` 构造函数中初始化 `MCPConfigModifier`
|
|
31
|
-
- 在 `copyFromTempToTarget` 方法完成后调用 MCP 配置修改
|
|
32
|
-
- 添加错误处理,确保 MCP 配置修改失败不影响模板下载
|
|
33
|
-
- 添加相应的日志记录
|
|
34
|
-
- _需求: 需求 1, 需求 4
|
|
35
|
-
|
|
36
|
-
- [x] 5. 集成点优化
|
|
37
|
-
- 确保 MCP 配置修改在正确的时机执行
|
|
38
|
-
- 优化执行顺序,避免重复文件操作
|
|
39
|
-
- 添加性能监控和日志记录
|
|
40
|
-
- 支持可选的 MCP 配置修改跳过
|
|
41
|
-
- _需求: 需求 1, 需求 4
|
|
42
|
-
|
|
43
|
-
## 阶段三:测试和验证
|
|
44
|
-
|
|
45
|
-
- [x] 6. 单元测试编写
|
|
46
|
-
- 为 `MCPConfigModifier` 类编写单元测试
|
|
47
|
-
- 测试 JSON 配置文件修改逻辑
|
|
48
|
-
- 测试 TOML 配置文件修改逻辑
|
|
49
|
-
- 测试错误处理机制
|
|
50
|
-
- 测试边界情况
|
|
51
|
-
- _需求: 需求 1, 需求 2
|
|
52
|
-
|
|
53
|
-
- [x] 7. 集成测试编写
|
|
54
|
-
- 测试 `tcb pull` 命令的完整流程
|
|
55
|
-
- 测试内置模板的 MCP 配置修改
|
|
56
|
-
- 测试 Git 仓库的 MCP 配置修改
|
|
57
|
-
- 测试 Git 子目录的 MCP 配置修改
|
|
58
|
-
- 测试与现有功能的兼容性
|
|
59
|
-
- _需求: 需求 1, 需求 3
|
|
60
|
-
|
|
61
|
-
- [x] 8. 端到端测试
|
|
62
|
-
- 测试完整的模板下载和配置修改流程
|
|
63
|
-
- 测试不同 IDE 配置文件的生成和修改
|
|
64
|
-
- 测试错误场景的处理和恢复
|
|
65
|
-
- 测试性能影响和资源使用
|
|
66
|
-
- _需求: 需求 1, 需求 2, 需求 3
|
|
67
|
-
|
|
68
|
-
## 阶段四:文档和优化
|
|
69
|
-
|
|
70
|
-
- [ ] 9. 文档更新
|
|
71
|
-
- 更新 `docs/template-pull.md` 文档
|
|
72
|
-
- 添加 MCP 配置修改功能的说明
|
|
73
|
-
- 更新命令使用示例
|
|
74
|
-
- 添加故障排除指南
|
|
75
|
-
- _需求: 需求 1, 需求 2
|
|
76
|
-
|
|
77
|
-
- [ ] 10. 代码优化
|
|
78
|
-
- 优化文件遍历和修改逻辑
|
|
79
|
-
- 减少重复的文件系统操作
|
|
80
|
-
- 优化内存使用和性能
|
|
81
|
-
- 添加配置选项和开关
|
|
82
|
-
- _需求: 需求 4
|
|
83
|
-
|
|
84
|
-
## 阶段五:发布和部署
|
|
85
|
-
|
|
86
|
-
- [ ] 11. 代码审查
|
|
87
|
-
- 确保代码质量和一致性
|
|
88
|
-
- 验证与现有架构的兼容性
|
|
89
|
-
- 检查安全性和性能影响
|
|
90
|
-
- 确保测试覆盖率
|
|
91
|
-
- _需求: 所有需求
|
|
92
|
-
|
|
93
|
-
- [ ] 12. 发布准备
|
|
94
|
-
- 更新版本号和变更日志
|
|
95
|
-
- 准备发布说明
|
|
96
|
-
- 验证所有功能正常工作
|
|
97
|
-
- 准备回滚计划
|
|
98
|
-
- _需求: 所有需求
|
|
99
|
-
|
|
100
|
-
## 验收标准检查
|
|
101
|
-
|
|
102
|
-
### 需求 1 - tcb pull 命令集成 MCP 配置修改
|
|
103
|
-
- [x] When 使用 `tcb pull` 命令下载模板完成后,the 系统 shall 自动检测并修改所有 MCP 配置文件
|
|
104
|
-
- [x] When 发现 `.cursor/mcp.json` 等配置文件时,the 系统 shall 将 `npx npm-global-exec@latest @cloudbase/cloudbase-mcp@latest` 替换为 `cloudbase-mcp`
|
|
105
|
-
- [x] When 修改完成后,the 系统 shall 验证配置文件的正确性
|
|
106
|
-
- [x] When 用户使用 `tcb pull` 下载的模板时,the MCP 功能 shall 无需额外安装即可正常工作
|
|
107
|
-
|
|
108
|
-
### 需求 2 - 保持与 tcb ai 命令的一致性
|
|
109
|
-
- [x] When 使用 `tcb pull` 下载模板时,the MCP 配置修改逻辑 shall 与 `tcb ai` 命令完全一致
|
|
110
|
-
- [x] When 支持相同的 IDE 配置文件格式时,the 系统 shall 使用相同的修改规则
|
|
111
|
-
- [x] When 处理 JSON 和 TOML 格式时,the 系统 shall 使用相同的转换逻辑
|
|
112
|
-
- [x] When 出现错误时,the 系统 shall 提供相同的错误处理和日志记录
|
|
113
|
-
|
|
114
|
-
### 需求 3 - 支持所有内置模板和 Git 仓库
|
|
115
|
-
- [x] When 下载内置模板(miniprogram、react、vue、uniapp、rules)时,the 系统 shall 自动修改 MCP 配置
|
|
116
|
-
- [x] When 从 Git 仓库下载模板时,the 系统 shall 自动修改 MCP 配置
|
|
117
|
-
- [x] When 从 Git 子目录下载内容时,the 系统 shall 自动修改 MCP 配置
|
|
118
|
-
- [x] When 支持多种 IDE 配置时,the 系统 shall 处理所有相关的配置文件
|
|
119
|
-
|
|
120
|
-
### 需求 4 - 向后兼容性
|
|
121
|
-
- [x] When 现有 `tcb pull` 命令功能使用时,the 系统 shall 保持原有行为不变
|
|
122
|
-
- [x] When 新增 MCP 配置修改功能时,the 系统 shall 不影响模板下载的核心流程
|
|
123
|
-
- [x] When 出现 MCP 配置修改失败时,the 系统 shall 不影响模板下载的成功完成
|
|
124
|
-
- [x] When 用户可以选择跳过 MCP 配置修改时,the 系统 shall 提供相应的选项
|
|
125
|
-
|