@buaa_smat/hometrans 26.0.6 → 26.0.7

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/README.md CHANGED
@@ -20,6 +20,7 @@
20
20
  [![DevEco Code](https://img.shields.io/badge/DevEco_Code-supported-blueviolet.svg)](#选择本地editor)
21
21
  [![Codex](https://img.shields.io/badge/Codex-supported-blueviolet.svg)](#选择本地editor)
22
22
  [![CodeBuddy](https://img.shields.io/badge/CodeBuddy-supported-blueviolet.svg)](#选择本地editor)
23
+ [![GitHub Copilot](https://img.shields.io/badge/GitHub_Copilot-supported-blueviolet.svg)](#选择本地editor)
23
24
  [![Trae](https://img.shields.io/badge/Trae-supported-blueviolet.svg)](#选择本地editor)
24
25
  [![Trae CN](https://img.shields.io/badge/Trae_CN-supported-blueviolet.svg)](#选择本地editor)
25
26
  [![Qoder](https://img.shields.io/badge/Qoder-supported-blueviolet.svg)](#选择本地editor)
@@ -84,6 +85,8 @@ npm install -g @buaa_smat/hometrans
84
85
  > 若一个 editor 都不选择,`ht init` 不会中断:仍会执行后续全部配置流程,并把 skills / agents / commands 原样拷贝到共享目录 `~/.agents/skills`、`~/.agents/agents` 与 `~/.agents/commands`(`ht uninstall` 也会清理这些目录)。
85
86
  >
86
87
  > Codex 与 AtomCode 没有命令目录,`/hometrans` 会安装为名为 `hometrans` 的 skill(Codex 中用 `$hometrans` 调用)。
88
+ >
89
+ > GitHub Copilot 的 commands 会安装为 skill(`~/.copilot/skills/<命令名>/SKILL.md`),保留原有字段,仅补充必需的 `name`;skills / agents 原样安装到 `~/.copilot/skills` 与 `~/.copilot/agents`。
87
90
 
88
91
  #### 配置鸿蒙SDK
89
92
  ![set_sdk.png](https://raw.gitcode.com/SMAT/HomeTrans/raw/main/resource/set_sdk.png)
@@ -400,11 +403,11 @@ devecocli plugin uninstall hometrans [--agent <name>] [--project <project_dir>]
400
403
 
401
404
  **支持的智能体**
402
405
 
403
- `opencode`、`trae`、`trae-cn`、`deveco`、`cursor`、`codebuddy`、`qoder`、`qoder-cn`、`claude-code`、`codex`、`atomcode`
406
+ `opencode`、`trae`、`trae-cn`、`deveco`、`cursor`、`codebuddy`、`github-copilot`、`qoder`、`qoder-cn`、`claude-code`、`codex`、`atomcode`
404
407
 
405
408
  **参数说明**
406
409
 
407
410
  | 参数 | 说明 |
408
411
  |------|------|
409
- | `--agent <name>` | 目标智能体,取上述 10 个规范名;不指定时处理本机已安装的全部受支持智能体 |
410
- | `--project <project_dir>` | 工程级安装,内容写入 `<project_dir>/<智能体工程目录>/{skills,agents,commands}`<br>目录名默认为 `.<agent>`(claude-code 为 `.claude`;由 DevEco CLI 调用时以 CLI 解析出的工程级 skills 目录为准)<br>不指定时为全局安装,写入各智能体的用户级目录 |
412
+ | `--agent <name>` | 目标智能体,取上述规范名;不指定时处理本机已安装的全部受支持智能体 |
413
+ | `--project <project_dir>` | 工程级安装,内容写入 `<project_dir>/<智能体工程目录>/{skills,agents,commands}`<br>目录名默认为 `.<agent>`(claude-code 为 `.claude`,github-copilot 为 `.github`;由 DevEco CLI 调用时以 CLI 解析出的工程级 skills 目录为准)<br>不指定时为全局安装,写入各智能体的用户级目录 |
@@ -78,6 +78,19 @@
78
78
  "disable-model-invocation"
79
79
  ]
80
80
  },
81
+ {
82
+ "name": "github-copilot",
83
+ "displayName": "GitHub Copilot",
84
+ "markerDir": "~/.copilot",
85
+ "rootEnvVar": "COPILOT_HOME",
86
+ "skillsDir": "~/.copilot/skills",
87
+ "agentsDir": "~/.copilot/agents",
88
+ "commandsDir": null,
89
+ "agentFormat": "passthrough",
90
+ "verbatim": true,
91
+ "commandsAsSkills": true,
92
+ "commandKeepKeys": []
93
+ },
81
94
  {
82
95
  "name": "trae-cn",
83
96
  "displayName": "Trae CN",
@@ -198,6 +198,10 @@ export async function buildCommandContent(platform, fileName, rootRaw, platforms
198
198
  };
199
199
  }
200
200
  export async function buildCommandSkill(platform, fileName, rootRaw, platformsRoot) {
201
+ if (platform.verbatim) {
202
+ const t = commandToSkillMd(platform, fileName, rootRaw);
203
+ return { ...t, notes: [...t.notes] };
204
+ }
201
205
  const c = await composeDoc(platform, 'command', fileName, rootRaw, platformsRoot);
202
206
  const t = commandToSkillMd(platform, fileName, c.legacyRaw);
203
207
  return { ...t, notes: [...sourceNotes(c), ...t.notes] };
@@ -45,7 +45,6 @@ export function sharedAgentsTarget() {
45
45
  * replaces it.
46
46
  */
47
47
  export const OBSOLETE_EDITOR_NAMES = new Set([
48
- 'GitHub Copilot',
49
48
  'TraeCode',
50
49
  'Trae CLI',
51
50
  ]);
@@ -64,6 +63,7 @@ export const EDITOR_NAME_ALIASES = {
64
63
  AtomCode: 'atomcode',
65
64
  Trae: 'trae',
66
65
  'Trae CN': 'trae-cn',
66
+ 'GitHub Copilot': 'github-copilot',
67
67
  };
68
68
  /** Strip a UTF-8 BOM (PowerShell 5.1 / legacy Notepad writes one). */
69
69
  export function stripBom(raw) {
@@ -227,6 +227,7 @@ function loadTable() {
227
227
  skillDescriptionLimit: limit,
228
228
  commandKeepKeys: optionalStringArray(rec, 'commandKeepKeys', i),
229
229
  commandsAsSkills: optionalBool(rec, 'commandsAsSkills', i, false),
230
+ verbatim: optionalBool(rec, 'verbatim', i, false),
230
231
  legacyDirs: optionalLegacyDirs(rec, i),
231
232
  };
232
233
  return record;
@@ -325,6 +326,7 @@ export function platformForEditor(editor) {
325
326
  skillDescriptionLimit: rec.skillDescriptionLimit ?? null,
326
327
  commandKeepKeys: [...rec.commandKeepKeys],
327
328
  commandsAsSkills: rec.commandsAsSkills === true,
329
+ verbatim: rec.verbatim === true,
328
330
  legacyDirs: (rec.legacyDirs ?? []).map((legacy) => {
329
331
  const out = {};
330
332
  for (const key of LEGACY_DIR_KEYS) {
@@ -18,7 +18,9 @@ const SKILL_STANDARD_KEYS = new Set([
18
18
  'allowed-tools',
19
19
  'argument-hint',
20
20
  ]);
21
- export function transformSkillMd(_platform, raw) {
21
+ export function transformSkillMd(platform, raw) {
22
+ if (platform.verbatim)
23
+ return { content: raw, rawCopy: true, notes: [] };
22
24
  const { fm, body, hasFrontmatter } = parseFrontmatter(raw);
23
25
  if (!hasFrontmatter)
24
26
  return { content: raw, rawCopy: true, notes: [] };
@@ -101,6 +103,8 @@ function droppedModeNote(mode, platform) {
101
103
  export function transformAgentMd(platform, fileName, raw) {
102
104
  if (platform.agentFormat === 'none')
103
105
  return null;
106
+ if (platform.verbatim)
107
+ return { fileName, content: raw, rawCopy: true, notes: [] };
104
108
  if (platform.agentFormat === 'passthrough') {
105
109
  // OpenCode family: mode / permission are native — copy as-is.
106
110
  return { fileName, content: raw, rawCopy: true, notes: [] };
@@ -247,7 +251,7 @@ export function transformAgentMd(platform, fileName, raw) {
247
251
  * Claude Code maps `subtask: true` to `context: fork`. Body templates are kept.
248
252
  */
249
253
  export function transformCommandMd(platform, raw) {
250
- if (platform.commandsDir === null) {
254
+ if (platform.verbatim || platform.commandsDir === null) {
251
255
  return { content: raw, rawCopy: true, notes: [] };
252
256
  }
253
257
  const { fm, body, hasFrontmatter } = parseFrontmatter(raw);
@@ -284,8 +288,38 @@ export function transformCommandMd(platform, raw) {
284
288
  * DSH / AtomCode have no file-based commands).
285
289
  */
286
290
  export function commandToSkillMd(platform, fileName, raw) {
287
- const { fm, body } = parseFrontmatter(raw);
288
291
  const skillName = fileName.replace(/\.md$/, '');
292
+ if (platform.verbatim) {
293
+ // Commands are relocated into skills/ with their fields untouched; only the
294
+ // SKILL.md-required `name` field is added when it is missing.
295
+ const { fm, hasFrontmatter } = parseFrontmatter(raw);
296
+ if (!hasFrontmatter) {
297
+ return {
298
+ skillName,
299
+ content: `---\nname: ${skillName}\n---\n\n${raw}`,
300
+ openaiYaml: null,
301
+ notes: ['installed command as a skill (frontmatter added: name)'],
302
+ };
303
+ }
304
+ if (asString(fm.name)) {
305
+ return {
306
+ skillName,
307
+ content: raw,
308
+ openaiYaml: null,
309
+ notes: ['installed command as a skill (fields kept as-is)'],
310
+ };
311
+ }
312
+ const m = /^---(?:\r?\n)/.exec(raw);
313
+ return {
314
+ skillName,
315
+ content: m
316
+ ? raw.slice(0, m[0].length) + `name: ${skillName}\n` + raw.slice(m[0].length)
317
+ : `---\nname: ${skillName}\n---\n\n${raw}`,
318
+ openaiYaml: null,
319
+ notes: ['installed command as a skill (fields kept; name added)'],
320
+ };
321
+ }
322
+ const { fm, body } = parseFrontmatter(raw);
289
323
  const notes = [];
290
324
  const out = { name: skillName };
291
325
  const description = asString(fm.description);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buaa_smat/hometrans",
3
- "version": "26.0.6",
3
+ "version": "26.0.7",
4
4
  "description": "HomeTrans (Android-to-HarmonyOS) skill + agent installer. Run `ht init` to distribute conversion skills and subagents into AI editors.",
5
5
  "license": "MIT",
6
6
  "repository": {