@jspg-ai/coding-bb 0.0.3-beta.19 → 0.0.3-beta.20

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.
@@ -5,7 +5,7 @@
5
5
  *
6
6
  * 将AI 编码规范与工作流套件安装到目标项目中。
7
7
  * 支持工具:Claude Code (.claude/rules/)、Qoder (.qoder/rules/)、opencode (.opencode/rules/)、
8
- * WorkBuddy (.workbuddy/rules/)、TraeWork/TraeCode 中国版 (.trae-cn/rules/)
8
+ * WorkBuddy (.workbuddy/rules/)、TraeWork/TraeCode 中国版 (.trae/rules/,用户级 hook 在 ~/.trae-cn)
9
9
  *
10
10
  * 使用方式:
11
11
  * npm install -g @jspg-ai/coding-bb # 首次使用
@@ -1,20 +1,22 @@
1
1
  /**
2
2
  * TraeWork / TraeCode 适配器(中国版)
3
3
  *
4
- * 字节 TraeWork 桌面工作台与 TraeCode IDE 的中国版共用项目级配置目录
5
- * `.trae-cn/`(与国际版 `.trae/` 区分),故一个适配器同时覆盖两者。
6
- * 我司及团队主要使用中国版,beta.19 起不再支持国际版目录分发。
4
+ * 中国版 TraeCode IDE 与 TraeWork 的项目级配置目录为 `.trae/`
5
+ * (官方文档 docs.trae.cn:项目规则 `.trae/rules/`、项目命令 `.trae/commands`),
6
+ * `.trae-cn/` 仅是中国版**用户级**目录(~/.trae-cn/hooks.json、user_rules、commands),
7
+ * 与国际版共用项目级 `.trae/` 命名。cbb 仅支持中国版(我司均用中国版)。
7
8
  *
8
9
  * 与 Claude Code / Qoder 的映射差异:
9
- * - rules:`.trae-cn/rules/*.md`(扁平文件、支持子目录,最多 3 层),frontmatter 用
10
+ * - rules:`.trae/rules/*.md`(扁平文件、支持子目录,最多 3 层),frontmatter 用
10
11
  * `alwaysApply: true`(Qoder 的 `trigger: always_on` 需改写,见 ruleRewrites)
11
- * - skills:`.trae-cn/skills/<name>/SKILL.md`,结构与 Claude 同构
12
- * - commands:`.trae-cn/commands/`,支持目录嵌套(最多 3 层),与 Claude 同风格
13
- * - hooks:`~/.trae-cn/hooks.json`,格式与 Claude 相近但需顶层 `version: 1`
12
+ * - skills:`.trae/skills/<name>/SKILL.md`,结构与 Claude 同构
13
+ * - commands:命令名 = 文件名,无 Claude 式"目录:命令"命名空间(实测嵌套目录 +
14
+ * `name: "OPSX: Apply"` 不出现在斜杠列表),故与 opencode 同款扁平化为
15
+ * `.trae/commands/opsx-<name>.md`(/opsx-propose),frontmatter name 同步 kebab 化
16
+ * - hooks:`~/.trae-cn/hooks.json`(用户级),格式与 Claude 相近但需顶层 `version: 1`
14
17
  * (由 settingsManager 的 hookDialect 处理),事件名/输出字段一致
15
18
  *
16
- * 注意:不设 legacyDirs —— 项目级 `.trae/` 可能是用户自建的国际版配置,
17
- * cbb 不做目录删除;仅 .gitignore 遗留行在卸载时清理。
19
+ * 注意:不设 legacyDirs —— `.trae/` 本就是正确的项目级目录,无需清理。
18
20
  */
19
21
 
20
22
  const path = require('path');
@@ -23,12 +25,16 @@ const os = require('os');
23
25
  module.exports = {
24
26
  name: 'trae',
25
27
  displayName: 'TraeWork(TraeCode·中国版)',
26
- rulesDir: '.trae-cn/rules',
27
- skillsDir: '.trae-cn/skills',
28
- commandsDir: '.trae-cn/commands/opsx',
28
+ rulesDir: '.trae/rules',
29
+ skillsDir: '.trae/skills',
30
+ commandsDir: '.trae/commands',
31
+ // 命令扁平化(同 opencode):中国版命令名 = 文件名,不支持 "目录:命令" 命名空间
32
+ commandPrefix: 'opsx-',
33
+ contentRewrites: [['/opsx:', '/opsx-'], ['/cbb:', '/cbb-']],
34
+ commandNameKebab: true,
29
35
  // 规则 frontmatter 改写:Qoder 风格 → Trae 风格
30
36
  ruleRewrites: [['trigger: always_on', 'alwaysApply: true']],
31
- // 用户级 hooks 配置(Trae 中国版用 hooks.json,目录为 ~/.trae-cn/)
37
+ // 用户级 hooks 配置(中国版目录为 ~/.trae-cn/,项目级才是 .trae/)
32
38
  settingsFile: path.join(os.homedir(), '.trae-cn', 'hooks.json'),
33
39
  settingsFileIsUserLevel: true,
34
40
  hookEvents: ['UserPromptSubmit'],
@@ -22,10 +22,10 @@ const GITIGNORE_RULES = [
22
22
  // .codebuddy:beta.15 及以前写入的旧目录,不再新增(add: null),但卸载/清理时仍移除其行
23
23
  { add: null, accept: ['.codebuddy', '.codebuddy/'] },
24
24
  { add: '.workbuddy', accept: ['.workbuddy', '.workbuddy/'] },
25
- // .trae:beta.18 及以前(国际版)写入的旧目录,不再新增(add: null,目录可能为用户自建、不清理),
26
- // 但卸载时仍移除其 gitignore 行
27
- { add: null, accept: ['.trae', '.trae/'] },
28
- { add: '.trae-cn', accept: ['.trae-cn', '.trae-cn/'] },
25
+ // .trae-cn:beta.19 误把中国版项目级目录当成 .trae-cn(实为用户级目录),beta.20 起不再新增,
26
+ // 但卸载/清理时仍移除其 gitignore 行
27
+ { add: null, accept: ['.trae-cn', '.trae-cn/'] },
28
+ { add: '.trae', accept: ['.trae', '.trae/'] },
29
29
  ];
30
30
 
31
31
  /** 将 .gitignore 文本拆为行数组。 */
@@ -20,7 +20,7 @@
20
20
  | `.codespace/` | 各关联应用的基准代码(每个应用一个子目录) | `cbb setup` 与 worktree 流程自动 clone / fetch;**勿手动编辑**;已 gitignore,不提交 |
21
21
  | `.worktrees/` | 需求隔离开发区(每个需求一个 `worktree-<需求名>/` 目录) | worktree 命令自动创建 / 清理;不提交(首次执行 worktree 流程时自动加入 .gitignore) |
22
22
  | `openspec/` | OpenSpec 工作流配置(`config.yaml` + `schemas/`) | 由 cbb 安装;变更产物(`openspec/changes/` 等)worktree 模式在**需求工作树内**生成随需求分支提交,轻量模式直接在空间根生成提交 main |
23
- | `.claude/` `.qoder/` `.opencode/` `.workbuddy/` `.trae-cn/` | AI 工具适配目录:编码规范规则、OpenSpec 命令、worktree 管理技能(skill 形态) | 由 cbb 按 setup 时选择的工具安装;已 gitignore,不提交,勿手动改 |
23
+ | `.claude/` `.qoder/` `.opencode/` `.workbuddy/` `.trae/` | AI 工具适配目录:编码规范规则、OpenSpec 命令、worktree 管理技能(skill 形态) | 由 cbb 按 setup 时选择的工具安装;已 gitignore,不提交,勿手动改 |
24
24
  | `.cbb/` | cbb 安装清单与状态(`.managed-by-cbb`、`.last-tools`) | 由 cbb 管理;**勿手动编辑** |
25
25
 
26
26
  ## 典型流程
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jspg-ai/coding-bb",
3
- "version": "0.0.3-beta.19",
3
+ "version": "0.0.3-beta.20",
4
4
  "description": "整合业界热门且高价值的工具、框架与技能,为 AI CODING AGENT 提供统一的行为准则与工作流,辅助开发者将需求高效落地为符合规范的代码",
5
5
  "main": "cbb/lib/install/init.js",
6
6
  "bin": {