SuperAPI AI 工具集

init-vscode

通用与其它

查看项目

更新于 10-16 04:59

技能介绍

用途:为项目(含大型 monorepo)初始化或更新 VSCode 工作区配置,提供开箱即用的扩展推荐与编辑器设置,并治理扩展推荐的生命周期与替代迁移。

主要能力:

  1. 处理 .vscode/extensions.json:合并 recommendations 与 unwantedRecommendations(去重),保留用户其他字段;按 reference/extension-replacement-migrations.md 执行已登记替代迁移,例如 Gruntfuggly.todo-tree -> FanaticPythoner.better-todo-tree,命中时从 recommendations 移除旧 ID、加入新 ID 并将旧 ID 写入 unwantedRecommendations;未知扩展不凭猜测删除。
  2. 处理 .vscode/settings.json:深度合并嵌套对象(如 files.exclude、files.watcherExclude、search.exclude),数组去重合并,简单值默认用户优先。策略键强制收敛:files.eol 必须为 "\n";vue.server.includeLanguages 必须为 ["vue"](移除 markdown);search.indexing.maxFileSize 为 1048576;typescript.disableAutomaticTypeAcquisition 为 true;补齐 typescript.tsserver.watchOptions 与 tsdk;typescript.tsserver.maxTsServerMemory 缺失或低于 4096 补 4096,高风险可到 8192;explorer.fileNesting.patterns 迁移旧 CLAUDE.md 根节点为 AGENTS.md,不让新旧根节点并存。
  3. 三层性能排除需同步维护:files.exclude、files.watcherExclude、search.exclude 覆盖 node_modules、.git、dist、build、.next、.nuxt、.output、.vite、.turbo、coverage、.cache、logs、*.map 等目录。
  4. JSONC 与 Prettier 兼容:extensions.json 保留注释并按 JSONC 解析,写入后须用 JSONC parser 验证;判断活动配置须用 JSONC-aware 解析,不得用正则或删注释再 JSON.parse。若 JSONC 文件进入 Prettier 链路,需追加精确 override(parser: jsonc、trailingComma: none),不要把 **/*.json 全设为 jsonc。
  5. 可选插件配置:可询问用户是否添加 git-graph 分支筛选、cursor 的 .cursorignore 文件关联、i18n-ally 国际化路径等配置。

使用方式:在项目根目录操作,确保 .vscode/ 存在(mkdir -p .vscode);读取 templates/extensions.json 与 templates/settings.json 后按上述合并规则写入;验证可用 pnpm exec prettier --parser jsonc --trailing-comma none --check .vscode/extensions.json(settings.json 同理)。

适用场景:前端项目与大型 pnpm/turbo monorepo 的编辑器环境统一、性能优化与扩展迁移。

限制:默认不删除用户无关配置;未经授权不改 User Settings、User keybindings 或全局扩展安装/禁用/卸载状态;unwantedRecommendations 不等于卸载或禁用;不得生成长期指向 VS Code 私有内部目录(resources/app/node_modules*、@vscode/ripgrep*)的绝对路径;静态配置与 CLI 通过不等于 runtime 通过,涉及 UI/运行时须完成 Reload Window 等 GUI 人工验收;文件不存在、模板细节、官方支持范围与收费信息暂未提供。