@hagicode/skillsbase 0.1.0-dev.11.1.4f10d19 → 0.1.0-dev.2.1.a322037
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/LICENSE +21 -0
- package/README.md +7 -0
- package/README.zh-CN.md +2 -0
- package/dist/cli.mjs +7 -1
- package/package.json +2 -1
- package/templates/actions/skillsbase-manage/action.yml +96 -0
- package/templates/docs/maintainer-workflow.md +14 -2
- package/templates/workflows/skills-manage.yml +54 -0
- package/templates/workflows/skills-sync.yml +3 -18
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 HagiCode
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/@hagicode/skillsbase)
|
|
6
6
|
[](https://www.npmjs.com/package/@hagicode/skillsbase)
|
|
7
|
+
[](./LICENSE)
|
|
7
8
|
[](https://nodejs.org/)
|
|
8
9
|
|
|
9
10
|
`skillsbase` is a standalone Node.js CLI for bootstrapping and maintaining managed skills repositories.
|
|
@@ -122,4 +123,10 @@ The GitHub Actions workflow supports two npm authentication modes:
|
|
|
122
123
|
- Fallback: `NPM_TOKEN` repository secret mapped to `NODE_AUTH_TOKEN`
|
|
123
124
|
|
|
124
125
|
Before relying on trusted publishing, make sure the npm package settings for `@hagicode/skillsbase` trust the `HagiCode-org/skillsbase` repository.
|
|
126
|
+
Use workflow filename `npm-publish.yml` in npm trusted publisher settings, not the full `.github/workflows/...` path.
|
|
127
|
+
If the package has not been published before, that is still acceptable as long as the `hagicode` scope already exists and the publishing identity can create `@hagicode/skillsbase`.
|
|
125
128
|
The npm docs currently require Node.js `>= 22.14.0` and npm `>= 11.5.1` for trusted publishing.
|
|
129
|
+
|
|
130
|
+
## License
|
|
131
|
+
|
|
132
|
+
MIT. See [LICENSE](./LICENSE).
|
package/README.zh-CN.md
CHANGED
|
@@ -122,4 +122,6 @@ GitHub Actions 发布流支持两种 npm 认证模式:
|
|
|
122
122
|
- 兜底:仓库 `NPM_TOKEN` secret,经 `NODE_AUTH_TOKEN` 注入
|
|
123
123
|
|
|
124
124
|
若使用 trusted publishing,需先在 npm 的 `@hagicode/skillsbase` 包设置中,将 `HagiCode-org/skillsbase` 配置为 trusted publisher。
|
|
125
|
+
在 npm trusted publisher 设置里填写的 workflow filename 应为 `npm-publish.yml`,不要填完整的 `.github/workflows/...` 路径。
|
|
126
|
+
如果这个包还没有首发,只要 npm 上已经存在 `hagicode` scope,且当前发布身份有权创建 `@hagicode/skillsbase`,也仍然可以正常发布。
|
|
125
127
|
npm 官方当前要求 Node.js `>= 22.14.0` 且 npm `>= 11.5.1`。
|
package/dist/cli.mjs
CHANGED
|
@@ -822,10 +822,16 @@ async function writeGithubActions(repoPath, options = {}) {
|
|
|
822
822
|
if (kind === "workflow" || kind === "all") targets.push({
|
|
823
823
|
relativePath: path.join(".github", "workflows", "skills-sync.yml"),
|
|
824
824
|
template: path.join("workflows", "skills-sync.yml")
|
|
825
|
+
}, {
|
|
826
|
+
relativePath: path.join(".github", "workflows", "skills-manage.yml"),
|
|
827
|
+
template: path.join("workflows", "skills-manage.yml")
|
|
825
828
|
});
|
|
826
|
-
if (kind === "action" || kind === "all") targets.push({
|
|
829
|
+
if (kind === "workflow" || kind === "action" || kind === "all") targets.push({
|
|
827
830
|
relativePath: path.join(".github", "actions", "skillsbase-sync", "action.yml"),
|
|
828
831
|
template: path.join("actions", "skillsbase-sync", "action.yml")
|
|
832
|
+
}, {
|
|
833
|
+
relativePath: path.join(".github", "actions", "skillsbase-manage", "action.yml"),
|
|
834
|
+
template: path.join("actions", "skillsbase-manage", "action.yml")
|
|
829
835
|
});
|
|
830
836
|
if (targets.length === 0) throw new CliError(`Unsupported github_action kind: ${kind}`, { details: ["Supported values: workflow, action, all."] });
|
|
831
837
|
const items = [];
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hagicode/skillsbase",
|
|
3
|
-
"version": "0.1.0-dev.
|
|
3
|
+
"version": "0.1.0-dev.2.1.a322037",
|
|
4
4
|
"description": "Managed skills repository CLI",
|
|
5
|
+
"license": "MIT",
|
|
5
6
|
"homepage": "https://github.com/HagiCode-org/skillsbase#readme",
|
|
6
7
|
"bugs": {
|
|
7
8
|
"url": "https://github.com/HagiCode-org/skillsbase/issues"
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
# Managed by skillsbase CLI.
|
|
2
|
+
|
|
3
|
+
name: skillsbase-manage
|
|
4
|
+
description: Run a managed add, remove, or sync operation for a skillsbase repository
|
|
5
|
+
|
|
6
|
+
inputs:
|
|
7
|
+
node-version:
|
|
8
|
+
description: Node.js version used for maintenance
|
|
9
|
+
required: false
|
|
10
|
+
default: "{{NODE_VERSION}}"
|
|
11
|
+
operation:
|
|
12
|
+
description: Maintenance operation to run (`add`, `remove`, or `sync`)
|
|
13
|
+
required: true
|
|
14
|
+
skill-name:
|
|
15
|
+
description: Skill name for `add` or `remove`
|
|
16
|
+
required: false
|
|
17
|
+
default: ""
|
|
18
|
+
source:
|
|
19
|
+
description: Optional source key for `add` or `remove`
|
|
20
|
+
required: false
|
|
21
|
+
default: ""
|
|
22
|
+
allow-missing-sources:
|
|
23
|
+
description: Skip missing local roots during the operation
|
|
24
|
+
required: false
|
|
25
|
+
default: "false"
|
|
26
|
+
run-tests:
|
|
27
|
+
description: Whether to run npm test after the maintenance command
|
|
28
|
+
required: false
|
|
29
|
+
default: "true"
|
|
30
|
+
|
|
31
|
+
runs:
|
|
32
|
+
using: composite
|
|
33
|
+
steps:
|
|
34
|
+
- name: Setup Node.js
|
|
35
|
+
uses: actions/setup-node@v4
|
|
36
|
+
with:
|
|
37
|
+
node-version: ${{ inputs.node-version }}
|
|
38
|
+
cache: npm
|
|
39
|
+
|
|
40
|
+
- name: Install dependencies
|
|
41
|
+
shell: bash
|
|
42
|
+
run: npm ci
|
|
43
|
+
|
|
44
|
+
- name: Upgrade npm
|
|
45
|
+
shell: bash
|
|
46
|
+
run: npm install --global npm@10.9.2
|
|
47
|
+
|
|
48
|
+
- name: Install skillsbase
|
|
49
|
+
shell: bash
|
|
50
|
+
run: npm install --global @hagicode/skillsbase
|
|
51
|
+
|
|
52
|
+
- name: Run maintenance command
|
|
53
|
+
shell: bash
|
|
54
|
+
env:
|
|
55
|
+
OPERATION: ${{ inputs.operation }}
|
|
56
|
+
SKILL_NAME: ${{ inputs.skill-name }}
|
|
57
|
+
SOURCE: ${{ inputs.source }}
|
|
58
|
+
ALLOW_MISSING_SOURCES: ${{ inputs.allow-missing-sources }}
|
|
59
|
+
run: |
|
|
60
|
+
set -euo pipefail
|
|
61
|
+
|
|
62
|
+
base_args=(--repo .)
|
|
63
|
+
if [[ "${ALLOW_MISSING_SOURCES}" == "true" ]]; then
|
|
64
|
+
base_args+=(--allow-missing-sources)
|
|
65
|
+
fi
|
|
66
|
+
|
|
67
|
+
case "${OPERATION}" in
|
|
68
|
+
add|remove)
|
|
69
|
+
if [[ -z "${SKILL_NAME}" ]]; then
|
|
70
|
+
echo "::error::skill-name is required when operation=${OPERATION}."
|
|
71
|
+
exit 1
|
|
72
|
+
fi
|
|
73
|
+
|
|
74
|
+
command=(skillsbase "${OPERATION}" "${SKILL_NAME}" "${base_args[@]}")
|
|
75
|
+
if [[ -n "${SOURCE}" ]]; then
|
|
76
|
+
command+=(--source "${SOURCE}")
|
|
77
|
+
fi
|
|
78
|
+
;;
|
|
79
|
+
sync)
|
|
80
|
+
command=(skillsbase sync "${base_args[@]}")
|
|
81
|
+
;;
|
|
82
|
+
*)
|
|
83
|
+
echo "::error::Unsupported operation: ${OPERATION}."
|
|
84
|
+
exit 1
|
|
85
|
+
;;
|
|
86
|
+
esac
|
|
87
|
+
|
|
88
|
+
printf 'Running:'
|
|
89
|
+
printf ' %q' "${command[@]}"
|
|
90
|
+
printf '\n'
|
|
91
|
+
"${command[@]}"
|
|
92
|
+
|
|
93
|
+
- name: Run tests
|
|
94
|
+
if: ${{ inputs.run-tests == 'true' }}
|
|
95
|
+
shell: bash
|
|
96
|
+
run: npm test
|
|
@@ -2,15 +2,26 @@
|
|
|
2
2
|
|
|
3
3
|
# Maintainer Workflow
|
|
4
4
|
|
|
5
|
-
The maintainer flow is `init -> add -> sync -> github_action`.
|
|
5
|
+
The maintainer flow is `init -> add/remove -> sync -> github_action`.
|
|
6
6
|
|
|
7
7
|
## Lifecycle
|
|
8
8
|
|
|
9
9
|
1. `skillsbase init`
|
|
10
|
-
2. `skillsbase add <skill-name>`
|
|
10
|
+
2. `skillsbase add <skill-name>` or `skillsbase remove <skill-name>`
|
|
11
11
|
3. `skillsbase sync`
|
|
12
12
|
4. `skillsbase github_action --kind all`
|
|
13
13
|
|
|
14
|
+
## GitHub Maintenance Path
|
|
15
|
+
|
|
16
|
+
Use `.github/workflows/skills-manage.yml` only for explicit non-interactive maintenance from GitHub UI.
|
|
17
|
+
|
|
18
|
+
- `operation` chooses `add`, `remove`, or `sync`
|
|
19
|
+
- `skill-name` is required for `add` and `remove`
|
|
20
|
+
- `source` is optional and maps to `--source`
|
|
21
|
+
- `allow-missing-sources` maps to `--allow-missing-sources`
|
|
22
|
+
- `run-tests` controls the post-operation `npm test`
|
|
23
|
+
- The workflow does not commit, push, or open pull requests
|
|
24
|
+
|
|
14
25
|
## Notes
|
|
15
26
|
|
|
16
27
|
- `sources.yaml` is the single source of truth.
|
|
@@ -18,3 +29,4 @@ The maintainer flow is `init -> add -> sync -> github_action`.
|
|
|
18
29
|
- `.skill-source.json` records source and conversion metadata.
|
|
19
30
|
- `skillsbase sync --check` validates drift without writing files.
|
|
20
31
|
- If a source root is unavailable, use `skillsbase sync --allow-missing-sources` to skip it.
|
|
32
|
+
- Local CLI commands remain the primary maintainer path.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Managed by skillsbase CLI.
|
|
2
|
+
|
|
3
|
+
name: Skills Manage
|
|
4
|
+
|
|
5
|
+
on:
|
|
6
|
+
workflow_dispatch:
|
|
7
|
+
inputs:
|
|
8
|
+
operation:
|
|
9
|
+
description: Operation to run (`add`, `remove`, or `sync`)
|
|
10
|
+
required: true
|
|
11
|
+
type: choice
|
|
12
|
+
default: sync
|
|
13
|
+
options:
|
|
14
|
+
- add
|
|
15
|
+
- remove
|
|
16
|
+
- sync
|
|
17
|
+
skill-name:
|
|
18
|
+
description: Skill name for `add` or `remove`
|
|
19
|
+
required: false
|
|
20
|
+
type: string
|
|
21
|
+
source:
|
|
22
|
+
description: Optional source key for `add` or `remove`
|
|
23
|
+
required: false
|
|
24
|
+
type: string
|
|
25
|
+
allow-missing-sources:
|
|
26
|
+
description: Skip missing local roots during the operation
|
|
27
|
+
required: false
|
|
28
|
+
type: boolean
|
|
29
|
+
default: false
|
|
30
|
+
run-tests:
|
|
31
|
+
description: Run `npm test` after the maintenance command
|
|
32
|
+
required: false
|
|
33
|
+
type: boolean
|
|
34
|
+
default: true
|
|
35
|
+
|
|
36
|
+
permissions:
|
|
37
|
+
contents: read
|
|
38
|
+
|
|
39
|
+
jobs:
|
|
40
|
+
manage:
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
steps:
|
|
43
|
+
- name: Checkout repository
|
|
44
|
+
uses: actions/checkout@v4
|
|
45
|
+
|
|
46
|
+
- name: Run skillsbase maintenance
|
|
47
|
+
uses: ./.github/actions/skillsbase-manage
|
|
48
|
+
with:
|
|
49
|
+
node-version: {{NODE_VERSION}}
|
|
50
|
+
operation: ${{ inputs.operation }}
|
|
51
|
+
skill-name: ${{ inputs.skill-name }}
|
|
52
|
+
source: ${{ inputs.source }}
|
|
53
|
+
allow-missing-sources: ${{ inputs.allow-missing-sources }}
|
|
54
|
+
run-tests: ${{ inputs.run-tests }}
|
|
@@ -23,23 +23,8 @@ jobs:
|
|
|
23
23
|
- name: Checkout repository
|
|
24
24
|
uses: actions/checkout@v4
|
|
25
25
|
|
|
26
|
-
- name:
|
|
27
|
-
uses: actions/
|
|
26
|
+
- name: Run skillsbase validation
|
|
27
|
+
uses: ./.github/actions/skillsbase-sync
|
|
28
28
|
with:
|
|
29
29
|
node-version: {{NODE_VERSION}}
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
- name: Install dependencies
|
|
33
|
-
run: npm ci
|
|
34
|
-
|
|
35
|
-
- name: Upgrade npm
|
|
36
|
-
run: npm install --global npm@10.9.2
|
|
37
|
-
|
|
38
|
-
- name: Install skillsbase
|
|
39
|
-
run: npm install --global @hagicode/skillsbase
|
|
40
|
-
|
|
41
|
-
- name: Run tests
|
|
42
|
-
run: npm test
|
|
43
|
-
|
|
44
|
-
- name: Validate managed repository state
|
|
45
|
-
run: skillsbase sync --check --repo .
|
|
30
|
+
run-tests: "true"
|