transskill 0.1.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/README.md +187 -0
- package/README.zh.md +190 -0
- package/dist/core/errors.d.ts +8 -0
- package/dist/core/errors.d.ts.map +1 -0
- package/dist/core/errors.js +12 -0
- package/dist/core/errors.js.map +1 -0
- package/dist/core/types.d.ts +105 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +2 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +249 -0
- package/dist/index.js.map +1 -0
- package/dist/mapper/default.mapper.d.ts +18 -0
- package/dist/mapper/default.mapper.d.ts.map +1 -0
- package/dist/mapper/default.mapper.js +107 -0
- package/dist/mapper/default.mapper.js.map +1 -0
- package/dist/mapper/index.d.ts +3 -0
- package/dist/mapper/index.d.ts.map +1 -0
- package/dist/mapper/index.js +2 -0
- package/dist/mapper/index.js.map +1 -0
- package/dist/mapper/mapper.interface.d.ts +25 -0
- package/dist/mapper/mapper.interface.d.ts.map +1 -0
- package/dist/mapper/mapper.interface.js +2 -0
- package/dist/mapper/mapper.interface.js.map +1 -0
- package/dist/parser/cursor-rules.parser.d.ts +16 -0
- package/dist/parser/cursor-rules.parser.d.ts.map +1 -0
- package/dist/parser/cursor-rules.parser.js +38 -0
- package/dist/parser/cursor-rules.parser.js.map +1 -0
- package/dist/parser/index.d.ts +6 -0
- package/dist/parser/index.d.ts.map +1 -0
- package/dist/parser/index.js +5 -0
- package/dist/parser/index.js.map +1 -0
- package/dist/parser/mdc.parser.d.ts +17 -0
- package/dist/parser/mdc.parser.d.ts.map +1 -0
- package/dist/parser/mdc.parser.js +62 -0
- package/dist/parser/mdc.parser.js.map +1 -0
- package/dist/parser/parser-registry.d.ts +25 -0
- package/dist/parser/parser-registry.d.ts.map +1 -0
- package/dist/parser/parser-registry.js +44 -0
- package/dist/parser/parser-registry.js.map +1 -0
- package/dist/parser/parser.interface.d.ts +16 -0
- package/dist/parser/parser.interface.d.ts.map +1 -0
- package/dist/parser/parser.interface.js +2 -0
- package/dist/parser/parser.interface.js.map +1 -0
- package/dist/parser/skill-md.parser.d.ts +17 -0
- package/dist/parser/skill-md.parser.d.ts.map +1 -0
- package/dist/parser/skill-md.parser.js +117 -0
- package/dist/parser/skill-md.parser.js.map +1 -0
- package/dist/renderer/cursor-rules.renderer.d.ts +17 -0
- package/dist/renderer/cursor-rules.renderer.d.ts.map +1 -0
- package/dist/renderer/cursor-rules.renderer.js +61 -0
- package/dist/renderer/cursor-rules.renderer.js.map +1 -0
- package/dist/renderer/index.d.ts +6 -0
- package/dist/renderer/index.d.ts.map +1 -0
- package/dist/renderer/index.js +5 -0
- package/dist/renderer/index.js.map +1 -0
- package/dist/renderer/mdc.renderer.d.ts +15 -0
- package/dist/renderer/mdc.renderer.d.ts.map +1 -0
- package/dist/renderer/mdc.renderer.js +52 -0
- package/dist/renderer/mdc.renderer.js.map +1 -0
- package/dist/renderer/renderer-registry.d.ts +6 -0
- package/dist/renderer/renderer-registry.d.ts.map +1 -0
- package/dist/renderer/renderer-registry.js +16 -0
- package/dist/renderer/renderer-registry.js.map +1 -0
- package/dist/renderer/renderer.interface.d.ts +15 -0
- package/dist/renderer/renderer.interface.d.ts.map +1 -0
- package/dist/renderer/renderer.interface.js +2 -0
- package/dist/renderer/renderer.interface.js.map +1 -0
- package/dist/renderer/skill-md.renderer.d.ts +15 -0
- package/dist/renderer/skill-md.renderer.d.ts.map +1 -0
- package/dist/renderer/skill-md.renderer.js +76 -0
- package/dist/renderer/skill-md.renderer.js.map +1 -0
- package/dist/resolver/github.resolver.d.ts +11 -0
- package/dist/resolver/github.resolver.d.ts.map +1 -0
- package/dist/resolver/github.resolver.js +89 -0
- package/dist/resolver/github.resolver.js.map +1 -0
- package/dist/resolver/index.d.ts +5 -0
- package/dist/resolver/index.d.ts.map +1 -0
- package/dist/resolver/index.js +4 -0
- package/dist/resolver/index.js.map +1 -0
- package/dist/resolver/local.resolver.d.ts +11 -0
- package/dist/resolver/local.resolver.d.ts.map +1 -0
- package/dist/resolver/local.resolver.js +55 -0
- package/dist/resolver/local.resolver.js.map +1 -0
- package/dist/resolver/resolver-registry.d.ts +14 -0
- package/dist/resolver/resolver-registry.d.ts.map +1 -0
- package/dist/resolver/resolver-registry.js +31 -0
- package/dist/resolver/resolver-registry.js.map +1 -0
- package/dist/resolver/resolver.interface.d.ts +12 -0
- package/dist/resolver/resolver.interface.d.ts.map +1 -0
- package/dist/resolver/resolver.interface.js +2 -0
- package/dist/resolver/resolver.interface.js.map +1 -0
- package/dist/utils/file-utils.d.ts +9 -0
- package/dist/utils/file-utils.d.ts.map +1 -0
- package/dist/utils/file-utils.js +37 -0
- package/dist/utils/file-utils.js.map +1 -0
- package/dist/utils/format-detector.d.ts +11 -0
- package/dist/utils/format-detector.d.ts.map +1 -0
- package/dist/utils/format-detector.js +42 -0
- package/dist/utils/format-detector.js.map +1 -0
- package/dist/utils/logger.d.ts +7 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +20 -0
- package/dist/utils/logger.js.map +1 -0
- package/package.json +49 -0
package/README.md
ADDED
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
# TransSkill
|
|
2
|
+
|
|
3
|
+
> **Write once, run on any agent.**
|
|
4
|
+
|
|
5
|
+
TransSkill is a CLI tool that converts AI agent skill files between different platforms.
|
|
6
|
+
Stop manually rewriting skills for every agent — convert with one command.
|
|
7
|
+
|
|
8
|
+
[](README.zh.md)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## The Problem
|
|
13
|
+
|
|
14
|
+
Every AI coding agent has its own skill format.
|
|
15
|
+
Claude Code uses SKILL.md, Cursor uses .cursorrules,
|
|
16
|
+
OpenClaw uses AGENTS.md, and MCP servers use JSON Schema.
|
|
17
|
+
A skill written for one platform is useless on another without manual rewriting.
|
|
18
|
+
|
|
19
|
+
## The Solution
|
|
20
|
+
|
|
21
|
+
```
|
|
22
|
+
$ transskill convert .cursorrules --to skill.md
|
|
23
|
+
$ transskill convert gh:user/weather-skill --to .cursorrules
|
|
24
|
+
$ transskill convert ./my-skill/ --to .mdc --glob "**/*.ts"
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
One command. Any platform.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install -g transskill
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Or run directly:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npx transskill convert .cursorrules --to skill.md
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## Quick Start
|
|
44
|
+
|
|
45
|
+
```bash
|
|
46
|
+
# SKILL.md → .cursorrules
|
|
47
|
+
transskill convert my-skill.skill.md --to .cursorrules
|
|
48
|
+
|
|
49
|
+
# .cursorrules → SKILL.md
|
|
50
|
+
transskill convert .cursorrules --to skill.md
|
|
51
|
+
|
|
52
|
+
# .cursorrules → .mdc (Cursor 2.3+ with file scoping)
|
|
53
|
+
transskill convert .cursorrules --to .mdc --glob "src/**/*.ts"
|
|
54
|
+
|
|
55
|
+
# Full skill directory → Cursor rules
|
|
56
|
+
transskill convert ./weather-skill/ --to .cursorrules
|
|
57
|
+
|
|
58
|
+
# GitHub repo → Claude Code skill (direct install)
|
|
59
|
+
transskill convert gh:user/weather-skill --to skill.md \
|
|
60
|
+
--install-to ~/.claude/skills/
|
|
61
|
+
|
|
62
|
+
# Preview without writing
|
|
63
|
+
transskill convert .cursorrules --to skill.md --dry-run
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Input Sources
|
|
67
|
+
|
|
68
|
+
| Format | Example | Description |
|
|
69
|
+
|--------|---------|-------------|
|
|
70
|
+
| Local file | `./rules.cursorrules` | Single skill file |
|
|
71
|
+
| Local directory | `./weather-skill/` | Full skill directory with scripts and assets |
|
|
72
|
+
| GitHub repo | `gh:user/repo` | Shallow clone + convert |
|
|
73
|
+
| GitHub subpath | `gh:user/repo/path` | Clone specific subdirectory |
|
|
74
|
+
| GitHub URL | `https://github.com/user/repo` | Full URL support |
|
|
75
|
+
|
|
76
|
+
## Supported Formats
|
|
77
|
+
|
|
78
|
+
| Format | Platforms | Input | Output |
|
|
79
|
+
|--------|-----------|:-----:|:------:|
|
|
80
|
+
| SKILL.md | Claude Code, Codex CLI, OpenClaw, Cursor | ✅ | ✅ |
|
|
81
|
+
| .cursorrules | Cursor IDE | ✅ | ✅ |
|
|
82
|
+
| .mdc | Cursor 2.3+ | ✅ | ✅ |
|
|
83
|
+
| MCP JSON | Any MCP-compatible client | ✅ | — |
|
|
84
|
+
| SOUL.md | OpenClaw | ✅ | — |
|
|
85
|
+
|
|
86
|
+
## Commands
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
# Convert a skill to another format
|
|
90
|
+
transskill convert <input> --to <format> [options]
|
|
91
|
+
|
|
92
|
+
# List all supported formats
|
|
93
|
+
transskill list-formats
|
|
94
|
+
|
|
95
|
+
# Validate a skill file or directory
|
|
96
|
+
transskill validate <input>
|
|
97
|
+
|
|
98
|
+
# See all options
|
|
99
|
+
transskill --help
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### Options for `convert`
|
|
103
|
+
|
|
104
|
+
| Flag | Description |
|
|
105
|
+
|------|-------------|
|
|
106
|
+
| `-t, --to <format>` | Target format (required) |
|
|
107
|
+
| `-o, --output <path>` | Output directory (default: current dir) |
|
|
108
|
+
| `--install-to <path>` | Install directly to agent config dir |
|
|
109
|
+
| `--glob <pattern>` | File glob pattern (for .mdc output) |
|
|
110
|
+
| `--always-apply` | Always apply rule (for .mdc output) |
|
|
111
|
+
| `--dry-run` | Preview without writing files |
|
|
112
|
+
| `-v, --verbose` | Detailed conversion report |
|
|
113
|
+
|
|
114
|
+
## How It Works
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
Input (file/dir/GitHub)
|
|
118
|
+
│
|
|
119
|
+
▼
|
|
120
|
+
InputResolver ──► Parser ──► Mapper ──► Renderer ──► Output
|
|
121
|
+
(Local/GitHub) (read) (map) (write)
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
TransSkill uses a pipeline architecture:
|
|
125
|
+
|
|
126
|
+
1. **InputResolver** — resolves your input (local path or GitHub URL) to a local file path
|
|
127
|
+
2. **Parser** — reads platform-specific format and converts to a universal intermediate representation
|
|
128
|
+
3. **Mapper** — maps fields between platforms, reporting what's preserved and what's lost
|
|
129
|
+
4. **Renderer** — writes the result in the target platform's format
|
|
130
|
+
|
|
131
|
+
## Examples
|
|
132
|
+
|
|
133
|
+
### Convert a local file
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
$ cat .cursorrules
|
|
137
|
+
# My TypeScript Rules
|
|
138
|
+
Always use strict mode
|
|
139
|
+
Prefer named exports
|
|
140
|
+
|
|
141
|
+
$ transskill convert .cursorrules --to skill.md -o typescript-rule.md
|
|
142
|
+
✅ Conversion complete
|
|
143
|
+
output: ./typescript-rule.md
|
|
144
|
+
```
|
|
145
|
+
|
|
146
|
+
### Convert from GitHub to Cursor rules
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
$ transskill convert gh:anthropics/skills/weather --to .cursorrules \
|
|
150
|
+
--install-to .cursor/rules/
|
|
151
|
+
|
|
152
|
+
⬇️ Cloning: gh:anthropics/skills
|
|
153
|
+
✅ Installed: .cursor/rules/weather.cursorrules
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
### Directory conversion with loss report
|
|
157
|
+
|
|
158
|
+
```bash
|
|
159
|
+
$ transskill convert ./weather-skill/ --to .cursorrules
|
|
160
|
+
✅ Directory conversion complete
|
|
161
|
+
weather-skill/SKILL.md → weather-skill.cursorrules
|
|
162
|
+
weather-skill/scripts/ → ./scripts/ (copied)
|
|
163
|
+
weather-skill/references/ → ./references/ (copied)
|
|
164
|
+
⚠️ SKILL.md scripts reference will not work in .cursorrules
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Project Status
|
|
168
|
+
|
|
169
|
+
**Active development.** See [tasks.md](specs/tasks.md) for current progress.
|
|
170
|
+
|
|
171
|
+
| Phase | Status |
|
|
172
|
+
|-------|--------|
|
|
173
|
+
| Phase 0: Project scaffold | ✅ Complete |
|
|
174
|
+
| Phase 1: InputResolver + types | ✅ Complete |
|
|
175
|
+
| Phase 2: Parser layer | ✅ Complete |
|
|
176
|
+
| Phase 3: Mapper + Renderer | ⬜ Pending |
|
|
177
|
+
| Phase 4: CLI pipeline | ⬜ Pending |
|
|
178
|
+
| Phase 5: Tests | ⬜ Pending |
|
|
179
|
+
| Phase 6: CI + publish | ⬜ Pending |
|
|
180
|
+
|
|
181
|
+
## Contributing
|
|
182
|
+
|
|
183
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for how to add a new format.
|
|
184
|
+
|
|
185
|
+
## License
|
|
186
|
+
|
|
187
|
+
MIT
|
package/README.zh.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# TransSkill
|
|
2
|
+
|
|
3
|
+
> **一次编写,全平台运行。**
|
|
4
|
+
|
|
5
|
+
TransSkill 是一个跨 AI Agent 平台的技能格式转换工具。
|
|
6
|
+
无需为每个 Agent 手动重写技能——一条命令搞定。
|
|
7
|
+
|
|
8
|
+
[](README.md)
|
|
9
|
+
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## 问题
|
|
13
|
+
|
|
14
|
+
每种 AI 编码 Agent 都有自己的技能格式:
|
|
15
|
+
- Claude Code 用 SKILL.md
|
|
16
|
+
- Cursor 用 .cursorrules
|
|
17
|
+
- OpenClaw 用 AGENTS.md
|
|
18
|
+
- MCP Server 用 JSON Schema
|
|
19
|
+
|
|
20
|
+
为一个平台写的技能,在另一个平台上无法直接使用。
|
|
21
|
+
|
|
22
|
+
## 解决方案
|
|
23
|
+
|
|
24
|
+
```
|
|
25
|
+
$ transskill convert .cursorrules --to skill.md
|
|
26
|
+
$ transskill convert gh:user/weather-skill --to .cursorrules
|
|
27
|
+
$ transskill convert ./my-skill/ --to .mdc --glob "**/*.ts"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
一条命令,全平台通用。
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## 安装
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install -g transskill
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
或者直接运行:
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
npx transskill convert .cursorrules --to skill.md
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## 快速上手
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# SKILL.md → .cursorrules
|
|
50
|
+
transskill convert my-skill.skill.md --to .cursorrules
|
|
51
|
+
|
|
52
|
+
# .cursorrules → SKILL.md
|
|
53
|
+
transskill convert .cursorrules --to skill.md
|
|
54
|
+
|
|
55
|
+
# .cursorrules → .mdc(带文件范围限定)
|
|
56
|
+
transskill convert .cursorrules --to .mdc --glob "src/**/*.ts"
|
|
57
|
+
|
|
58
|
+
# 完整 skill 目录 → Cursor 规则
|
|
59
|
+
transskill convert ./weather-skill/ --to .cursorrules
|
|
60
|
+
|
|
61
|
+
# GitHub 仓库 → 直接安装到 Claude Code
|
|
62
|
+
transskill convert gh:user/weather-skill --to skill.md \
|
|
63
|
+
--install-to ~/.claude/skills/
|
|
64
|
+
|
|
65
|
+
# 预览效果(不实际写入文件)
|
|
66
|
+
transskill convert .cursorrules --to skill.md --dry-run
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
## 输入源
|
|
70
|
+
|
|
71
|
+
| 格式 | 示例 | 说明 |
|
|
72
|
+
|------|------|------|
|
|
73
|
+
| 本地文件 | `./rules.cursorrules` | 单文件转换 |
|
|
74
|
+
| 本地目录 | `./weather-skill/` | 完整 skill 目录(含脚本和资源) |
|
|
75
|
+
| GitHub 仓库 | `gh:user/repo` | 自动 clone + 转换 |
|
|
76
|
+
| GitHub 子路径 | `gh:user/repo/path` | 仓库内特定子目录 |
|
|
77
|
+
| GitHub URL | `https://github.com/user/repo` | 完整 URL 支持 |
|
|
78
|
+
|
|
79
|
+
## 支持格式
|
|
80
|
+
|
|
81
|
+
| 格式 | 平台 | 输入 | 输出 |
|
|
82
|
+
|------|------|:---:|:----:|
|
|
83
|
+
| SKILL.md | Claude Code, Codex CLI, OpenClaw, Cursor | ✅ | ✅ |
|
|
84
|
+
| .cursorrules | Cursor IDE | ✅ | ✅ |
|
|
85
|
+
| .mdc | Cursor 2.3+ | ✅ | ✅ |
|
|
86
|
+
| MCP JSON | 任何 MCP 兼容客户端 | ✅ | — |
|
|
87
|
+
| SOUL.md | OpenClaw | ✅ | — |
|
|
88
|
+
|
|
89
|
+
## 命令
|
|
90
|
+
|
|
91
|
+
```bash
|
|
92
|
+
# 转换技能格式
|
|
93
|
+
transskill convert <input> --to <format> [options]
|
|
94
|
+
|
|
95
|
+
# 列出所有支持的格式
|
|
96
|
+
transskill list-formats
|
|
97
|
+
|
|
98
|
+
# 验证技能文件或目录格式
|
|
99
|
+
transskill validate <input>
|
|
100
|
+
|
|
101
|
+
# 查看所有选项
|
|
102
|
+
transskill --help
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### convert 选项
|
|
106
|
+
|
|
107
|
+
| 参数 | 说明 |
|
|
108
|
+
|------|------|
|
|
109
|
+
| `-t, --to <format>` | 目标格式(必填) |
|
|
110
|
+
| `-o, --output <path>` | 输出目录(默认当前目录) |
|
|
111
|
+
| `--install-to <path>` | 直接安装到 Agent 配置目录 |
|
|
112
|
+
| `--glob <pattern>` | 文件匹配模式(.mdc 输出时使用) |
|
|
113
|
+
| `--always-apply` | 总是加载该规则(.mdc 输出时使用) |
|
|
114
|
+
| `--dry-run` | 预览模式,不写入文件 |
|
|
115
|
+
| `-v, --verbose` | 显示详细转换报告 |
|
|
116
|
+
|
|
117
|
+
## 工作原理
|
|
118
|
+
|
|
119
|
+
```
|
|
120
|
+
输入 (文件/目录/GitHub)
|
|
121
|
+
│
|
|
122
|
+
▼
|
|
123
|
+
InputResolver ──► Parser ──► Mapper ──► Renderer ──► 输出
|
|
124
|
+
(本地/GitHub) (读取) (映射) (写入)
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
TransSkill 采用管道架构:
|
|
128
|
+
|
|
129
|
+
1. **InputResolver** — 将输入(本地路径或 GitHub URL)解析为本地文件路径
|
|
130
|
+
2. **Parser** — 读取平台特有格式,转换为通用中间表示
|
|
131
|
+
3. **Mapper** — 在平台间映射字段,报告保留和丢失的信息
|
|
132
|
+
4. **Renderer** — 以目标平台格式输出结果
|
|
133
|
+
|
|
134
|
+
## 示例
|
|
135
|
+
|
|
136
|
+
### 转换本地文件
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
$ cat .cursorrules
|
|
140
|
+
# My TypeScript Rules
|
|
141
|
+
Always use strict mode
|
|
142
|
+
Prefer named exports
|
|
143
|
+
|
|
144
|
+
$ transskill convert .cursorrules --to skill.md -o typescript-rule.md
|
|
145
|
+
✅ 转换完成
|
|
146
|
+
输出: ./typescript-rule.md
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### 从 GitHub 转换到 Cursor 规则
|
|
150
|
+
|
|
151
|
+
```bash
|
|
152
|
+
$ transskill convert gh:anthropics/skills/weather --to .cursorrules \
|
|
153
|
+
--install-to .cursor/rules/
|
|
154
|
+
|
|
155
|
+
⬇️ 正在克隆: gh:anthropics/skills
|
|
156
|
+
✅ 已安装: .cursor/rules/weather.cursorrules
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### 目录转换(含映射损失报告)
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
$ transskill convert ./weather-skill/ --to .cursorrules
|
|
163
|
+
✅ 目录转换完成
|
|
164
|
+
weather-skill/SKILL.md → weather-skill.cursorrules
|
|
165
|
+
weather-skill/scripts/ → ./scripts/(已复制)
|
|
166
|
+
weather-skill/references/ → ./references/(已复制)
|
|
167
|
+
⚠️ SKILL.md 中的脚本引用在 .cursorrules 中无法使用
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
## 项目进度
|
|
171
|
+
|
|
172
|
+
**活跃开发中。** 详见 [tasks.md](specs/tasks.md)。
|
|
173
|
+
|
|
174
|
+
| 阶段 | 状态 |
|
|
175
|
+
|------|------|
|
|
176
|
+
| Phase 0: 项目脚手架 | ✅ 已完成 |
|
|
177
|
+
| Phase 1: InputResolver + 类型定义 | ✅ 已完成 |
|
|
178
|
+
| Phase 2: Parser 层 | ✅ 已完成 |
|
|
179
|
+
| Phase 3: Mapper + Renderer | ⬜ 待完成 |
|
|
180
|
+
| Phase 4: CLI 完整管道 | ⬜ 待完成 |
|
|
181
|
+
| Phase 5: 测试覆盖 | ⬜ 待完成 |
|
|
182
|
+
| Phase 6: CI + 发布 | ⬜ 待完成 |
|
|
183
|
+
|
|
184
|
+
## 贡献指南
|
|
185
|
+
|
|
186
|
+
详见 [CONTRIBUTING.md](CONTRIBUTING.md)。
|
|
187
|
+
|
|
188
|
+
## 许可证
|
|
189
|
+
|
|
190
|
+
MIT
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/** Custom error types for TransSkill */
|
|
2
|
+
export type ErrorCode = 'UNSUPPORTED_INPUT' | 'INPUT_RESOLVE_FAILED' | 'UNSUPPORTED_OUTPUT_FORMAT' | 'INVALID_FRONTMATTER' | 'INVALID_JSON' | 'FILE_NOT_FOUND' | 'DIR_NOT_FOUND' | 'NO_SKILL_FOUND' | 'GIT_CLONE_FAILED' | 'GIT_CLEANUP_FAILED' | 'EMPTY_INSTRUCTIONS' | 'CONVERSION_WARNING' | 'UNKNOWN_ERROR';
|
|
3
|
+
export declare class TransSkillError extends Error {
|
|
4
|
+
readonly code: ErrorCode;
|
|
5
|
+
readonly details?: Record<string, unknown>;
|
|
6
|
+
constructor(message: string, code: ErrorCode, details?: Record<string, unknown>);
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAExC,MAAM,MAAM,SAAS,GACjB,mBAAmB,GACnB,sBAAsB,GACtB,2BAA2B,GAC3B,qBAAqB,GACrB,cAAc,GACd,gBAAgB,GAChB,eAAe,GACf,gBAAgB,GAChB,kBAAkB,GAClB,oBAAoB,GACpB,oBAAoB,GACpB,oBAAoB,GACpB,eAAe,CAAC;AAEpB,qBAAa,eAAgB,SAAQ,KAAK;IACxC,SAAgB,IAAI,EAAE,SAAS,CAAC;IAChC,SAAgB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;gBAEtC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;CAMhF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/** Custom error types for TransSkill */
|
|
2
|
+
export class TransSkillError extends Error {
|
|
3
|
+
code;
|
|
4
|
+
details;
|
|
5
|
+
constructor(message, code, details) {
|
|
6
|
+
super(message);
|
|
7
|
+
this.name = 'TransSkillError';
|
|
8
|
+
this.code = code;
|
|
9
|
+
this.details = details;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/core/errors.ts"],"names":[],"mappings":"AAAA,wCAAwC;AAiBxC,MAAM,OAAO,eAAgB,SAAQ,KAAK;IACxB,IAAI,CAAY;IAChB,OAAO,CAA2B;IAElD,YAAY,OAAe,EAAE,IAAe,EAAE,OAAiC;QAC7E,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;QACjB,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC;IACzB,CAAC;CACF"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
/** Supported agent skill formats */
|
|
2
|
+
export type FormatType = 'skill.md' | '.cursorrules' | '.mdc' | 'mcp.json' | 'soul.md' | 'agents.md' | 'windsurfrules';
|
|
3
|
+
/** User's original input source */
|
|
4
|
+
export type InputSource = {
|
|
5
|
+
kind: 'local-file';
|
|
6
|
+
path: string;
|
|
7
|
+
} | {
|
|
8
|
+
kind: 'local-directory';
|
|
9
|
+
path: string;
|
|
10
|
+
} | {
|
|
11
|
+
kind: 'github';
|
|
12
|
+
repo: string;
|
|
13
|
+
ref?: string;
|
|
14
|
+
subpath?: string;
|
|
15
|
+
} | {
|
|
16
|
+
kind: 'github-url';
|
|
17
|
+
url: string;
|
|
18
|
+
};
|
|
19
|
+
/** Resolved input ready for processing */
|
|
20
|
+
export interface ResolvedInput {
|
|
21
|
+
localPath: string;
|
|
22
|
+
source: InputSource;
|
|
23
|
+
type: 'file' | 'directory';
|
|
24
|
+
isRemote: boolean;
|
|
25
|
+
cleanup?: () => Promise<void>;
|
|
26
|
+
}
|
|
27
|
+
/** A complete skill directory structure */
|
|
28
|
+
export interface SkillDirectory {
|
|
29
|
+
name: string;
|
|
30
|
+
rootPath: string;
|
|
31
|
+
skillFile: string;
|
|
32
|
+
scriptsDir?: string;
|
|
33
|
+
referencesDir?: string;
|
|
34
|
+
assetsDir?: string;
|
|
35
|
+
extraFiles: string[];
|
|
36
|
+
}
|
|
37
|
+
/** Platform-agnostic intermediate skill representation */
|
|
38
|
+
export interface IntermediateSkill {
|
|
39
|
+
name: string;
|
|
40
|
+
description: string;
|
|
41
|
+
instructions: string;
|
|
42
|
+
metadata: {
|
|
43
|
+
sourceFormat: FormatType;
|
|
44
|
+
author?: string;
|
|
45
|
+
version?: string;
|
|
46
|
+
tags?: string[];
|
|
47
|
+
rawFrontmatter?: Record<string, unknown>;
|
|
48
|
+
attachedFiles?: AttachedFile[];
|
|
49
|
+
warnings?: string[];
|
|
50
|
+
};
|
|
51
|
+
platformSpecific: {
|
|
52
|
+
cursor?: CursorSpecific;
|
|
53
|
+
claude?: ClaudeSpecific;
|
|
54
|
+
openclaw?: OpenClawSpecific;
|
|
55
|
+
mcp?: MCPSpecific;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/** File attached to a skill directory */
|
|
59
|
+
export interface AttachedFile {
|
|
60
|
+
relativePath: string;
|
|
61
|
+
absolutePath: string;
|
|
62
|
+
type: 'script' | 'reference' | 'asset' | 'unknown';
|
|
63
|
+
}
|
|
64
|
+
/** Cursor-specific configuration */
|
|
65
|
+
export interface CursorSpecific {
|
|
66
|
+
globs?: string[];
|
|
67
|
+
alwaysApply?: boolean;
|
|
68
|
+
}
|
|
69
|
+
/** Claude Code-specific configuration */
|
|
70
|
+
export interface ClaudeSpecific {
|
|
71
|
+
disableModelInvocation?: boolean;
|
|
72
|
+
manualOnly?: boolean;
|
|
73
|
+
}
|
|
74
|
+
/** OpenClaw-specific configuration */
|
|
75
|
+
export interface OpenClawSpecific {
|
|
76
|
+
runtime?: 'subagent' | 'main';
|
|
77
|
+
mountPath?: string;
|
|
78
|
+
}
|
|
79
|
+
/** MCP-specific configuration */
|
|
80
|
+
export interface MCPSpecific {
|
|
81
|
+
tools?: MCPTool[];
|
|
82
|
+
command?: string;
|
|
83
|
+
args?: string[];
|
|
84
|
+
}
|
|
85
|
+
export interface MCPTool {
|
|
86
|
+
name: string;
|
|
87
|
+
description: string;
|
|
88
|
+
inputSchema: Record<string, unknown>;
|
|
89
|
+
}
|
|
90
|
+
/** Conversion report */
|
|
91
|
+
export interface ConversionReport {
|
|
92
|
+
sourceFormat: FormatType;
|
|
93
|
+
targetFormat: FormatType;
|
|
94
|
+
warnings: string[];
|
|
95
|
+
preserved: string[];
|
|
96
|
+
lost: string[];
|
|
97
|
+
}
|
|
98
|
+
/** Directory conversion result */
|
|
99
|
+
export interface DirectoryConversionResult {
|
|
100
|
+
skillName: string;
|
|
101
|
+
mainOutput: string;
|
|
102
|
+
copiedFiles: string[];
|
|
103
|
+
skippedFiles: string[];
|
|
104
|
+
}
|
|
105
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/core/types.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|