@hagicode/skillsbase 0.1.0-dev.20260406025440.0.0.local → 0.1.1
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 +91 -53
- package/README.zh-CN.md +116 -0
- package/dist/cli.mjs +1 -1
- package/package.json +7 -4
package/README.md
CHANGED
|
@@ -1,78 +1,116 @@
|
|
|
1
|
-
# skillsbase
|
|
1
|
+
# @hagicode/skillsbase
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
重点是:本仓库只放 CLI 代码与模板,不提交受管 `skills/` 内容。
|
|
5
|
-
当前源码使用 `TypeScript + Vite 8`。
|
|
3
|
+
[中文文档](./README.zh-CN.md)
|
|
6
4
|
|
|
7
|
-
|
|
5
|
+
[](https://www.npmjs.com/package/@hagicode/skillsbase)
|
|
6
|
+
[](https://www.npmjs.com/package/@hagicode/skillsbase)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
|
|
9
|
+
`skillsbase` is a standalone Node.js CLI for bootstrapping and maintaining managed skills repositories.
|
|
10
|
+
It ships the CLI and templates only. The generated `skills/` content belongs in the target repository, not in this package repository.
|
|
11
|
+
|
|
12
|
+
## Install
|
|
13
|
+
|
|
14
|
+
Requirements:
|
|
15
|
+
|
|
16
|
+
- Node.js `>= 22.12.0`
|
|
17
|
+
- npm `>= 10.9.2`
|
|
18
|
+
|
|
19
|
+
Install globally:
|
|
8
20
|
|
|
9
21
|
```bash
|
|
10
|
-
|
|
11
|
-
node ./bin/skillsbase.mjs sync
|
|
12
|
-
node ./bin/skillsbase.mjs sync --check
|
|
13
|
-
node ./bin/skillsbase.mjs add <skill-name>
|
|
14
|
-
node ./bin/skillsbase.mjs github_action --kind all
|
|
22
|
+
npm install --global @hagicode/skillsbase
|
|
15
23
|
```
|
|
16
24
|
|
|
17
|
-
|
|
25
|
+
Then run:
|
|
18
26
|
|
|
19
27
|
```bash
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
28
|
+
skillsbase --help
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Quick Start
|
|
32
|
+
|
|
33
|
+
Initialize a managed repository:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
skillsbase init --repo /path/to/target-repo
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
Sync managed skills from `sources.yaml`:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
skillsbase sync --repo /path/to/target-repo
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Add one skill and sync immediately:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
skillsbase add documentation-writer --repo /path/to/target-repo
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
Generate managed GitHub Actions assets:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
skillsbase github_action --repo /path/to/target-repo --kind all
|
|
25
55
|
```
|
|
26
56
|
|
|
27
|
-
|
|
57
|
+
## Commands
|
|
28
58
|
|
|
29
|
-
|
|
59
|
+
| Command | Purpose | Example |
|
|
60
|
+
| --- | --- | --- |
|
|
61
|
+
| `init` | Create the managed repository baseline. | `skillsbase init --repo ./my-skills-repo` |
|
|
62
|
+
| `sync` | Reconcile managed skills from `sources.yaml`. | `skillsbase sync --repo ./my-skills-repo` |
|
|
63
|
+
| `sync --check` | Validate drift without writing files. | `skillsbase sync --check --repo ./my-skills-repo` |
|
|
64
|
+
| `add <skill-name>` | Add a skill to a source block, then run sync. | `skillsbase add documentation-writer --repo ./my-skills-repo` |
|
|
65
|
+
| `github_action` | Generate managed GitHub Actions workflow or action files. | `skillsbase github_action --repo ./my-skills-repo --kind workflow` |
|
|
30
66
|
|
|
31
|
-
|
|
32
|
-
- `push` 到 `main` 时发布 `dev` dist-tag
|
|
33
|
-
- GitHub Release `published` 且非 draft / prerelease 时发布 `latest`
|
|
34
|
-
- 发布前会执行:
|
|
35
|
-
- `npm test`
|
|
36
|
-
- `npm run pack:check`
|
|
37
|
-
- 当前包名:`@hagicode/skillsbase`
|
|
67
|
+
Global options:
|
|
38
68
|
|
|
39
|
-
|
|
69
|
+
- `--repo <path>`: target repository path, defaults to the current directory
|
|
70
|
+
- `--help`, `-h`: show help
|
|
71
|
+
- `--version`, `-v`: show version
|
|
40
72
|
|
|
41
|
-
## Managed
|
|
73
|
+
## Managed Repository Contract
|
|
42
74
|
|
|
43
|
-
|
|
44
|
-
清单单一真相源,声明来源根目录、命名规则、包含列表与非交互默认值。
|
|
45
|
-
- `skills/<name>/SKILL.md`
|
|
46
|
-
受管输出。内容来自当前仓库内临时 `npx skills add` 安装结果,再转换为最终形态。
|
|
47
|
-
- `skills/<name>/.skill-source.json`
|
|
48
|
-
来源、转换、目标路径与安装元数据。
|
|
49
|
-
- `.github/workflows/skills-sync.yml`
|
|
50
|
-
受管 workflow,执行 `npm test` 与 `skillsbase sync --check`。
|
|
51
|
-
- `.github/actions/skillsbase-sync/action.yml`
|
|
52
|
-
可复用 composite action。
|
|
75
|
+
`skillsbase` manages files in the target repository, including:
|
|
53
76
|
|
|
54
|
-
|
|
77
|
+
- `sources.yaml`: the single source of truth for source roots, naming rules, include lists, and defaults
|
|
78
|
+
- `skills/<name>/SKILL.md`: managed skill output converted from installed source content
|
|
79
|
+
- `skills/<name>/.skill-source.json`: source, conversion, target-path, and install metadata
|
|
80
|
+
- `docs/maintainer-workflow.md`: maintainer guidance generated from the bundled templates
|
|
81
|
+
- `.github/workflows/skills-sync.yml`: reusable workflow for validation and sync checks
|
|
82
|
+
- `.github/actions/skillsbase-sync/action.yml`: reusable composite action
|
|
55
83
|
|
|
56
84
|
## Non-Interactive Defaults
|
|
57
85
|
|
|
58
|
-
-
|
|
59
|
-
- `init`
|
|
86
|
+
- The target repository defaults to the current working directory.
|
|
87
|
+
- `init` defaults the source roots to:
|
|
60
88
|
- first-party: `$HOME/.agents/skills`
|
|
61
89
|
- system: `$HOME/.codex/skills/.system`
|
|
62
|
-
- `add`
|
|
63
|
-
- `github_action`
|
|
64
|
-
-
|
|
90
|
+
- `add` writes to the first declared source block unless `--source <key>` is provided.
|
|
91
|
+
- `github_action` defaults to `--kind workflow`.
|
|
92
|
+
- When the CLI does not have enough context to write safely, it fails with diagnostics instead of prompting interactively.
|
|
65
93
|
|
|
66
|
-
##
|
|
94
|
+
## Development
|
|
67
95
|
|
|
68
|
-
|
|
69
|
-
- `sync --check` 不修改最终仓库状态;若发现漂移则返回非零退出码。
|
|
70
|
-
- `sync --allow-missing-sources` 可在来源根目录暂缺时跳过该来源。
|
|
71
|
-
- `github_action` 仅覆盖带 `Managed by skillsbase CLI` 标记的文件;冲突文件需显式 `--force`。
|
|
96
|
+
Common commands for working on this package:
|
|
72
97
|
|
|
73
|
-
|
|
98
|
+
```bash
|
|
99
|
+
npm run build
|
|
100
|
+
npm run cli -- --help
|
|
101
|
+
npm test
|
|
102
|
+
npm run smoke
|
|
103
|
+
npm run pack:check
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
The published entry point is `bin/skillsbase.mjs`. In development, `npm run cli -- <args>` runs the TypeScript entry directly.
|
|
107
|
+
|
|
108
|
+
## Publishing Notes
|
|
109
|
+
|
|
110
|
+
The GitHub Actions workflow supports two npm authentication modes:
|
|
111
|
+
|
|
112
|
+
- Preferred: npm trusted publishing via GitHub Actions OIDC
|
|
113
|
+
- Fallback: `NPM_TOKEN` repository secret mapped to `NODE_AUTH_TOKEN`
|
|
74
114
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
- `npm run smoke`
|
|
78
|
-
在临时目录创建一个示例 managed repo,验证 `init -> sync -> sync --check -> github_action`。
|
|
115
|
+
Before relying on trusted publishing, make sure the npm package settings for `@hagicode/skillsbase` trust the `HagiCode-org/skillsbase` repository.
|
|
116
|
+
The npm docs currently require Node.js `>= 22.14.0` and npm `>= 11.5.1` for trusted publishing.
|
package/README.zh-CN.md
ADDED
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
# @hagicode/skillsbase
|
|
2
|
+
|
|
3
|
+
[English README](./README.md)
|
|
4
|
+
|
|
5
|
+
[](https://www.npmjs.com/package/@hagicode/skillsbase)
|
|
6
|
+
[](https://www.npmjs.com/package/@hagicode/skillsbase)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
|
|
9
|
+
`skillsbase` 是一个独立的 Node.js CLI,用于初始化并维护受管 skills 仓库。
|
|
10
|
+
本仓库只提供 CLI 与模板,不提交目标仓库中的 `skills/` 产物。
|
|
11
|
+
|
|
12
|
+
## 安装
|
|
13
|
+
|
|
14
|
+
要求:
|
|
15
|
+
|
|
16
|
+
- Node.js `>= 22.12.0`
|
|
17
|
+
- npm `>= 10.9.2`
|
|
18
|
+
|
|
19
|
+
全局安装:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npm install --global @hagicode/skillsbase
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
安装后可直接执行:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
skillsbase --help
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## 快速开始
|
|
32
|
+
|
|
33
|
+
初始化受管仓库:
|
|
34
|
+
|
|
35
|
+
```bash
|
|
36
|
+
skillsbase init --repo /path/to/target-repo
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
按 `sources.yaml` 同步技能:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
skillsbase sync --repo /path/to/target-repo
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
添加单个技能并立即同步:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
skillsbase add documentation-writer --repo /path/to/target-repo
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
生成受管 GitHub Actions 资产:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
skillsbase github_action --repo /path/to/target-repo --kind all
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 命令
|
|
58
|
+
|
|
59
|
+
| 命令 | 用途 | 示例 |
|
|
60
|
+
| --- | --- | --- |
|
|
61
|
+
| `init` | 创建受管仓库基础结构 | `skillsbase init --repo ./my-skills-repo` |
|
|
62
|
+
| `sync` | 按 `sources.yaml` 对账并同步技能 | `skillsbase sync --repo ./my-skills-repo` |
|
|
63
|
+
| `sync --check` | 只校验漂移,不写文件 | `skillsbase sync --check --repo ./my-skills-repo` |
|
|
64
|
+
| `add <skill-name>` | 将技能写入 source block 后执行同步 | `skillsbase add documentation-writer --repo ./my-skills-repo` |
|
|
65
|
+
| `github_action` | 生成受管 GitHub Actions 工作流或 action 文件 | `skillsbase github_action --repo ./my-skills-repo --kind workflow` |
|
|
66
|
+
|
|
67
|
+
全局选项:
|
|
68
|
+
|
|
69
|
+
- `--repo <path>`:目标仓库路径,默认当前目录
|
|
70
|
+
- `--help`、`-h`:显示帮助
|
|
71
|
+
- `--version`、`-v`:显示版本
|
|
72
|
+
|
|
73
|
+
## 受管仓库约定
|
|
74
|
+
|
|
75
|
+
`skillsbase` 会在目标仓库中管理以下文件:
|
|
76
|
+
|
|
77
|
+
- `sources.yaml`:来源根目录、命名规则、包含列表与默认值的单一真相源
|
|
78
|
+
- `skills/<name>/SKILL.md`:由安装源内容转换得到的受管技能输出
|
|
79
|
+
- `skills/<name>/.skill-source.json`:来源、转换、目标路径与安装元数据
|
|
80
|
+
- `docs/maintainer-workflow.md`:由模板生成的维护说明
|
|
81
|
+
- `.github/workflows/skills-sync.yml`:用于校验与同步检查的工作流
|
|
82
|
+
- `.github/actions/skillsbase-sync/action.yml`:可复用 composite action
|
|
83
|
+
|
|
84
|
+
## 非交互默认行为
|
|
85
|
+
|
|
86
|
+
- 目标仓库默认是当前工作目录。
|
|
87
|
+
- `init` 默认来源根目录为:
|
|
88
|
+
- first-party:`$HOME/.agents/skills`
|
|
89
|
+
- system:`$HOME/.codex/skills/.system`
|
|
90
|
+
- `add` 默认写入第一个已声明的 source block;如需指定,传 `--source <key>`。
|
|
91
|
+
- `github_action` 默认使用 `--kind workflow`。
|
|
92
|
+
- 若上下文不足以安全写入,CLI 会直接失败并输出诊断,不会进入交互提问。
|
|
93
|
+
|
|
94
|
+
## 开发
|
|
95
|
+
|
|
96
|
+
常用命令:
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
npm run build
|
|
100
|
+
npm run cli -- --help
|
|
101
|
+
npm test
|
|
102
|
+
npm run smoke
|
|
103
|
+
npm run pack:check
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
发布入口为 `bin/skillsbase.mjs`。开发期可用 `npm run cli -- <args>` 直接运行 TypeScript 入口。
|
|
107
|
+
|
|
108
|
+
## 发布说明
|
|
109
|
+
|
|
110
|
+
GitHub Actions 发布流支持两种 npm 认证模式:
|
|
111
|
+
|
|
112
|
+
- 推荐:GitHub Actions OIDC 的 npm trusted publishing
|
|
113
|
+
- 兜底:仓库 `NPM_TOKEN` secret,经 `NODE_AUTH_TOKEN` 注入
|
|
114
|
+
|
|
115
|
+
若使用 trusted publishing,需先在 npm 的 `@hagicode/skillsbase` 包设置中,将 `HagiCode-org/skillsbase` 配置为 trusted publisher。
|
|
116
|
+
npm 官方当前要求 Node.js `>= 22.14.0` 且 npm `>= 11.5.1`。
|
package/dist/cli.mjs
CHANGED
|
@@ -258,7 +258,7 @@ async function loadManifest(repoPath) {
|
|
|
258
258
|
const sourceStartMatch = /^ - key:\s*(.+)$/.exec(line);
|
|
259
259
|
if (sourceStartMatch) {
|
|
260
260
|
currentSource = {
|
|
261
|
-
key: parseScalar(sourceStartMatch[1]),
|
|
261
|
+
key: String(parseScalar(sourceStartMatch[1])),
|
|
262
262
|
include: []
|
|
263
263
|
};
|
|
264
264
|
manifest.sources.push(currentSource);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hagicode/skillsbase",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Managed skills repository CLI",
|
|
5
5
|
"homepage": "https://github.com/HagiCode-org/skillsbase#readme",
|
|
6
6
|
"bugs": {
|
|
@@ -19,17 +19,20 @@
|
|
|
19
19
|
"bin",
|
|
20
20
|
"dist",
|
|
21
21
|
"templates",
|
|
22
|
-
"README.md"
|
|
22
|
+
"README.md",
|
|
23
|
+
"README.zh-CN.md"
|
|
23
24
|
],
|
|
24
25
|
"scripts": {
|
|
25
26
|
"build": "vite build",
|
|
26
27
|
"clean": "rm -rf dist",
|
|
27
28
|
"cli": "node --import tsx ./src/cli-entry.ts",
|
|
28
29
|
"pack:check": "node ./scripts/verify-package.mjs",
|
|
29
|
-
"publish:
|
|
30
|
+
"publish:resolve-dev-version": "node ./scripts/resolve-dev-version.mjs",
|
|
31
|
+
"publish:verify-readiness": "node ./scripts/verify-publish-readiness.mjs",
|
|
30
32
|
"publish:verify-release": "node ./scripts/verify-release-version.mjs",
|
|
31
33
|
"test": "node --import tsx --test ./tests/*.test.ts",
|
|
32
|
-
"smoke": "node --import tsx ./scripts/smoke.mjs"
|
|
34
|
+
"smoke": "node --import tsx ./scripts/smoke.mjs",
|
|
35
|
+
"typecheck": "tsc --noEmit -p tsconfig.json"
|
|
33
36
|
},
|
|
34
37
|
"engines": {
|
|
35
38
|
"node": ">=22.12.0",
|