musubi-cli 0.0.0-stage → 0.2.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/LICENSE +21 -0
- package/README.ja.md +137 -0
- package/README.md +127 -2
- package/dist/add.js +75 -0
- package/dist/check.js +123 -0
- package/dist/cli.js +58 -0
- package/dist/definition.js +17 -0
- package/dist/fingerprint.js +16 -0
- package/dist/graph.js +263 -0
- package/dist/json.js +131 -0
- package/dist/report.js +26 -0
- package/dist/rules.js +154 -0
- package/dist/semver.js +42 -0
- package/dist/skills.js +180 -0
- package/package.json +42 -4
- package/schema/2026-11-19/check.schema.json +68 -0
- package/schema/2026-11-19/musubi.schema.json +77 -0
- package/schema/2026-11-20/check.schema.json +68 -0
- package/schema/2026-11-20/musubi.schema.json +81 -0
- package/spec/musubi.ja.md +261 -0
- package/spec/musubi.md +245 -0
package/dist/skills.js
ADDED
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, statSync } from "node:fs";
|
|
2
|
+
import { isAbsolute, join, relative, resolve } from "node:path";
|
|
3
|
+
import { definitionVersions, optionalVersions } from "./definition.js";
|
|
4
|
+
import { INTEGRITY } from "./fingerprint.js";
|
|
5
|
+
import { isObject, JsonError, parseLocated, pointer } from "./json.js";
|
|
6
|
+
import { readRules } from "./rules.js";
|
|
7
|
+
import { parseRange, parseVersion } from "./semver.js";
|
|
8
|
+
// The folders the agents read skills from, in the project and in the home folder.
|
|
9
|
+
const FOLDERS = [".claude/skills", ".agents/skills", ".github/skills", ".gemini/skills"];
|
|
10
|
+
export function defaultRoots(cwd, home) {
|
|
11
|
+
return [cwd, home].flatMap((base) => FOLDERS.map((folder) => resolve(base, folder)));
|
|
12
|
+
}
|
|
13
|
+
// Every folder directly under a root that holds a SKILL.md is a skill, named by its folder.
|
|
14
|
+
// When two roots hold the same name, the first root wins, as it does for the agents.
|
|
15
|
+
export function discover(roots, report) {
|
|
16
|
+
const skills = new Map();
|
|
17
|
+
const seen = new Set();
|
|
18
|
+
for (const root of roots.map((r) => resolve(r))) {
|
|
19
|
+
if (seen.has(root) || !existsSync(root) || !statSync(root).isDirectory())
|
|
20
|
+
continue;
|
|
21
|
+
seen.add(root);
|
|
22
|
+
for (const name of readdirSync(root).sort()) {
|
|
23
|
+
const dir = join(root, name);
|
|
24
|
+
if (!existsSync(join(dir, "SKILL.md")))
|
|
25
|
+
continue;
|
|
26
|
+
const first = skills.get(name);
|
|
27
|
+
if (first) {
|
|
28
|
+
report.warn(`${report.where(dir)} is shadowed by ${report.where(first.dir)}, which has the same name`);
|
|
29
|
+
continue;
|
|
30
|
+
}
|
|
31
|
+
skills.set(name, { name, dir });
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return skills;
|
|
35
|
+
}
|
|
36
|
+
const TOP = new Set(["$schema", "musubi", "provides", "follows"]);
|
|
37
|
+
const PROVIDED = new Set(["version", "file", "check"]);
|
|
38
|
+
const FOLLOWED = new Set(["version", "integrity", "examples"]);
|
|
39
|
+
const REF = /^[a-z0-9]+(?:-[a-z0-9]+)*\/[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
40
|
+
// A path written in musubi.json must name a file inside the skill's own folder.
|
|
41
|
+
function inside(skill, path) {
|
|
42
|
+
if (typeof path !== "string" || path === "" || isAbsolute(path))
|
|
43
|
+
return null;
|
|
44
|
+
const full = resolve(skill.dir, path);
|
|
45
|
+
const rel = relative(skill.dir, full);
|
|
46
|
+
return rel.startsWith("..") || isAbsolute(rel) ? null : rel.split("\\").join("/");
|
|
47
|
+
}
|
|
48
|
+
// Reads a skill's musubi.json and reports every mistake in it at its line.
|
|
49
|
+
export function readDeclaration(skill, report) {
|
|
50
|
+
const path = join(skill.dir, "musubi.json");
|
|
51
|
+
if (!existsSync(path))
|
|
52
|
+
return null;
|
|
53
|
+
const text = readFileSync(path, "utf8");
|
|
54
|
+
const declaration = { skill, path, text, provides: new Map(), follows: [] };
|
|
55
|
+
let located;
|
|
56
|
+
try {
|
|
57
|
+
located = parseLocated(text);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
report.problem(path, error instanceof JsonError ? error.line : 1, `not valid JSON: ${error.message}`);
|
|
61
|
+
return declaration;
|
|
62
|
+
}
|
|
63
|
+
const { value, lines } = located;
|
|
64
|
+
const at = (...keys) => lines.get(pointer(...keys)) ?? 1;
|
|
65
|
+
if (!isObject(value)) {
|
|
66
|
+
report.problem(path, 1, "musubi.json holds one JSON object");
|
|
67
|
+
return declaration;
|
|
68
|
+
}
|
|
69
|
+
for (const key of Object.keys(value))
|
|
70
|
+
if (!TOP.has(key))
|
|
71
|
+
report.problem(path, at(key), `unknown field "${key}"`);
|
|
72
|
+
if (typeof value.musubi !== "string" || !definitionVersions.includes(value.musubi)) {
|
|
73
|
+
const named = typeof value.musubi === "string" ? ` "${value.musubi}" is not one of them` : "";
|
|
74
|
+
report.problem(path, at("musubi"), `"musubi" must name a definition version (${definitionVersions.join(", ")});${named}`);
|
|
75
|
+
}
|
|
76
|
+
if (value.provides !== undefined) {
|
|
77
|
+
if (!isObject(value.provides))
|
|
78
|
+
report.problem(path, at("provides"), '"provides" must map content names to entries');
|
|
79
|
+
else {
|
|
80
|
+
for (const [name, entry] of Object.entries(value.provides)) {
|
|
81
|
+
const line = at("provides", name);
|
|
82
|
+
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(name))
|
|
83
|
+
report.problem(path, line, `the content name "${name}" must be lowercase words joined by "-"`);
|
|
84
|
+
if (!isObject(entry)) {
|
|
85
|
+
report.problem(path, line, `"${name}" must be an object with "version" and "file"`);
|
|
86
|
+
continue;
|
|
87
|
+
}
|
|
88
|
+
for (const key of Object.keys(entry))
|
|
89
|
+
if (!PROVIDED.has(key))
|
|
90
|
+
report.problem(path, at("provides", name, key), `unknown field "${key}" in "${name}"`);
|
|
91
|
+
const version = typeof entry.version === "string" ? parseVersion(entry.version) : null;
|
|
92
|
+
const versionLine = lines.get(pointer("provides", name, "version")) ?? line;
|
|
93
|
+
if (!version)
|
|
94
|
+
report.problem(path, versionLine, `the version of "${name}" must be MAJOR.MINOR.PATCH, such as 1.0.0`);
|
|
95
|
+
const file = inside(skill, entry.file);
|
|
96
|
+
if (!file)
|
|
97
|
+
report.problem(path, at("provides", name, "file"), `the file of "${name}" must be a path inside the skill folder`);
|
|
98
|
+
else if (!existsSync(join(skill.dir, file)))
|
|
99
|
+
report.problem(path, at("provides", name, "file"), `the file "${file}" of "${name}" does not exist`);
|
|
100
|
+
let check = null;
|
|
101
|
+
let rules = null;
|
|
102
|
+
if (entry.check !== undefined) {
|
|
103
|
+
const checkLine = at("provides", name, "check");
|
|
104
|
+
check = inside(skill, entry.check);
|
|
105
|
+
if (!check)
|
|
106
|
+
report.problem(path, checkLine, `the check of "${name}" must be a path inside the skill folder`);
|
|
107
|
+
else if (!check.endsWith(".json")) {
|
|
108
|
+
report.problem(path, checkLine, `the check of "${name}" must be a JSON rules file; musubi never runs provider code`);
|
|
109
|
+
check = null;
|
|
110
|
+
}
|
|
111
|
+
else if (!existsSync(join(skill.dir, check))) {
|
|
112
|
+
report.problem(path, checkLine, `the check "${check}" of "${name}" does not exist`);
|
|
113
|
+
check = null;
|
|
114
|
+
}
|
|
115
|
+
else
|
|
116
|
+
rules = readRules(join(skill.dir, check), report);
|
|
117
|
+
}
|
|
118
|
+
declaration.provides.set(name, { name, version, file: file && existsSync(join(skill.dir, file)) ? file : null, check, rules, line, versionLine });
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
if (value.follows !== undefined) {
|
|
123
|
+
if (!isObject(value.follows))
|
|
124
|
+
report.problem(path, at("follows"), '"follows" must map "skill/content" names to entries');
|
|
125
|
+
else {
|
|
126
|
+
for (const [ref, entry] of Object.entries(value.follows)) {
|
|
127
|
+
const line = at("follows", ref);
|
|
128
|
+
if (!REF.test(ref)) {
|
|
129
|
+
report.problem(path, line, `"${ref}" must name a content as "<skill>/<content>"`);
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (!isObject(entry)) {
|
|
133
|
+
report.problem(path, line, `"${ref}" must be an object with "version" and "integrity"`);
|
|
134
|
+
continue;
|
|
135
|
+
}
|
|
136
|
+
const knowsOptional = typeof value.musubi === "string" && optionalVersions.has(value.musubi);
|
|
137
|
+
for (const key of Object.keys(entry)) {
|
|
138
|
+
if (!FOLLOWED.has(key) && !(key === "optional" && knowsOptional))
|
|
139
|
+
report.problem(path, at("follows", ref, key), `unknown field "${key}" in "${ref}"`);
|
|
140
|
+
}
|
|
141
|
+
if (knowsOptional && entry.optional !== undefined && typeof entry.optional !== "boolean") {
|
|
142
|
+
report.problem(path, at("follows", ref, "optional"), `"optional" of "${ref}" must be true or false`);
|
|
143
|
+
}
|
|
144
|
+
const versionLine = lines.get(pointer("follows", ref, "version")) ?? line;
|
|
145
|
+
const range = typeof entry.version === "string" ? parseRange(entry.version) : null;
|
|
146
|
+
if (!range)
|
|
147
|
+
report.problem(path, versionLine, `the version range of "${ref}" must be ^X.Y.Z, ~X.Y.Z, or X.Y.Z`);
|
|
148
|
+
const integrityLine = lines.get(pointer("follows", ref, "integrity")) ?? line;
|
|
149
|
+
const integrity = typeof entry.integrity === "string" && INTEGRITY.test(entry.integrity) ? entry.integrity : null;
|
|
150
|
+
if (!integrity)
|
|
151
|
+
report.problem(path, integrityLine, `the fingerprint of "${ref}" must be sha256-<base64>; run musubi add to write it`);
|
|
152
|
+
const examples = [];
|
|
153
|
+
if (entry.examples !== undefined) {
|
|
154
|
+
if (!Array.isArray(entry.examples))
|
|
155
|
+
report.problem(path, at("follows", ref, "examples"), `"examples" of "${ref}" must be a list of paths`);
|
|
156
|
+
else {
|
|
157
|
+
entry.examples.forEach((example, index) => {
|
|
158
|
+
const exampleLine = lines.get(`${pointer("follows", ref, "examples")}/${index}`) ?? line;
|
|
159
|
+
const file = inside(skill, example);
|
|
160
|
+
if (!file)
|
|
161
|
+
report.problem(path, exampleLine, `the example "${String(example)}" must be a path inside the skill folder`);
|
|
162
|
+
else if (!existsSync(join(skill.dir, file)))
|
|
163
|
+
report.problem(path, exampleLine, `the example "${file}" does not exist`);
|
|
164
|
+
else
|
|
165
|
+
examples.push(file);
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
const [skillName, content] = ref.split("/");
|
|
170
|
+
const optional = knowsOptional && entry.optional === true;
|
|
171
|
+
declaration.follows.push({ ref, skill: skillName, content, range, integrity, examples, optional, line, versionLine, integrityLine });
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return declaration;
|
|
176
|
+
}
|
|
177
|
+
// The files a fingerprint covers, in the order the definition fixes.
|
|
178
|
+
export function fingerprintFiles(provided) {
|
|
179
|
+
return ["SKILL.md", provided.file ?? "", ...(provided.check ? [provided.check] : [])];
|
|
180
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,44 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "musubi-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Binds the content one agent skill provides to the skills that follow it, and checks them again when that content changes",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"agent-skills",
|
|
7
|
+
"skills",
|
|
8
|
+
"SKILL.md",
|
|
9
|
+
"dependencies"
|
|
10
|
+
],
|
|
11
|
+
"license": "MIT",
|
|
12
|
+
"repository": {
|
|
13
|
+
"type": "git",
|
|
14
|
+
"url": "git+https://github.com/cardene777/musubi.git"
|
|
15
|
+
},
|
|
16
|
+
"type": "module",
|
|
17
|
+
"bin": {
|
|
18
|
+
"musubi": "dist/cli.js"
|
|
19
|
+
},
|
|
20
|
+
"files": [
|
|
21
|
+
"dist",
|
|
22
|
+
"schema",
|
|
23
|
+
"spec",
|
|
24
|
+
"README.md",
|
|
25
|
+
"README.ja.md",
|
|
26
|
+
"LICENSE"
|
|
27
|
+
],
|
|
28
|
+
"engines": {
|
|
29
|
+
"node": ">=22.18"
|
|
30
|
+
},
|
|
31
|
+
"scripts": {
|
|
32
|
+
"build": "tsc -p tsconfig.build.json",
|
|
33
|
+
"test": "node --test --test-reporter=tap tests/*.test.ts",
|
|
34
|
+
"prepack": "tsc -p tsconfig.build.json",
|
|
35
|
+
"site": "node site/build.ts && node site/serve.ts",
|
|
36
|
+
"site:build": "node site/build.ts",
|
|
37
|
+
"site:publish": "node site/publish.ts"
|
|
38
|
+
},
|
|
39
|
+
"devDependencies": {
|
|
40
|
+
"@types/node": "^24.0.0",
|
|
41
|
+
"ajv": "^8.17.1",
|
|
42
|
+
"typescript": "^5.9.2"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "check.schema.json",
|
|
4
|
+
"title": "musubi check rules",
|
|
5
|
+
"description": "The rules a provider skill's check holds. musubi check reads them and never runs provider code.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["musubi", "rules"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": { "type": "string" },
|
|
11
|
+
"musubi": { "const": "2026-11-19" },
|
|
12
|
+
"rules": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"minItems": 1,
|
|
15
|
+
"items": {
|
|
16
|
+
"oneOf": [
|
|
17
|
+
{
|
|
18
|
+
"type": "object",
|
|
19
|
+
"additionalProperties": false,
|
|
20
|
+
"required": ["kind", "headings"],
|
|
21
|
+
"properties": {
|
|
22
|
+
"kind": { "const": "headings" },
|
|
23
|
+
"headings": {
|
|
24
|
+
"type": "array",
|
|
25
|
+
"minItems": 1,
|
|
26
|
+
"description": "Heading lines that must appear, in this order. Other headings may come between them.",
|
|
27
|
+
"items": { "type": "string", "minLength": 1 }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "object",
|
|
33
|
+
"additionalProperties": false,
|
|
34
|
+
"required": ["kind", "text"],
|
|
35
|
+
"properties": {
|
|
36
|
+
"kind": { "const": "forbid" },
|
|
37
|
+
"text": {
|
|
38
|
+
"type": "array",
|
|
39
|
+
"minItems": 1,
|
|
40
|
+
"description": "Text that must not remain outside code blocks.",
|
|
41
|
+
"items": { "type": "string", "minLength": 1 }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "object",
|
|
47
|
+
"additionalProperties": false,
|
|
48
|
+
"required": ["kind", "heading", "columns"],
|
|
49
|
+
"properties": {
|
|
50
|
+
"kind": { "const": "table-columns" },
|
|
51
|
+
"heading": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"minLength": 1,
|
|
54
|
+
"description": "The heading line whose first table is checked."
|
|
55
|
+
},
|
|
56
|
+
"columns": {
|
|
57
|
+
"type": "array",
|
|
58
|
+
"minItems": 1,
|
|
59
|
+
"description": "Columns the table must have. It may have more.",
|
|
60
|
+
"items": { "type": "string", "minLength": 1 }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "musubi.schema.json",
|
|
4
|
+
"title": "musubi.json",
|
|
5
|
+
"description": "The musubi declaration next to a skill's SKILL.md: the content the skill provides and the content it follows.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["musubi"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "Where editors find this schema."
|
|
13
|
+
},
|
|
14
|
+
"musubi": {
|
|
15
|
+
"const": "2026-11-19",
|
|
16
|
+
"description": "The date of the musubi definition this file follows."
|
|
17
|
+
},
|
|
18
|
+
"provides": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"description": "Content this skill provides, by name.",
|
|
21
|
+
"propertyNames": { "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
|
|
22
|
+
"additionalProperties": { "$ref": "#/$defs/provided" }
|
|
23
|
+
},
|
|
24
|
+
"follows": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"description": "Content this skill follows, by <skill>/<content>.",
|
|
27
|
+
"propertyNames": { "pattern": "^[a-z0-9]+(-[a-z0-9]+)*/[a-z0-9]+(-[a-z0-9]+)*$" },
|
|
28
|
+
"additionalProperties": { "$ref": "#/$defs/followed" }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"$defs": {
|
|
32
|
+
"provided": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"additionalProperties": false,
|
|
35
|
+
"required": ["version", "file"],
|
|
36
|
+
"properties": {
|
|
37
|
+
"version": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"description": "MAJOR.MINOR.PATCH. Raise MAJOR when a following skill can break.",
|
|
40
|
+
"pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
|
|
41
|
+
},
|
|
42
|
+
"file": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1,
|
|
45
|
+
"description": "The content file, relative to the skill folder."
|
|
46
|
+
},
|
|
47
|
+
"check": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"pattern": "\\.json$",
|
|
50
|
+
"description": "A JSON rules file, relative to the skill folder, that musubi check applies to the examples of following skills."
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"followed": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"additionalProperties": false,
|
|
57
|
+
"required": ["version", "integrity"],
|
|
58
|
+
"properties": {
|
|
59
|
+
"version": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"description": "The versions this skill accepts: ^X.Y.Z, ~X.Y.Z, or X.Y.Z.",
|
|
62
|
+
"pattern": "^[\\^~]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
|
|
63
|
+
},
|
|
64
|
+
"integrity": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "The fingerprint of the content at the last check.",
|
|
67
|
+
"pattern": "^sha256-[A-Za-z0-9+/]{43}=$"
|
|
68
|
+
},
|
|
69
|
+
"examples": {
|
|
70
|
+
"type": "array",
|
|
71
|
+
"description": "Files of this skill that the provider's check is applied to.",
|
|
72
|
+
"items": { "type": "string", "minLength": 1 }
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "check.schema.json",
|
|
4
|
+
"title": "musubi check rules",
|
|
5
|
+
"description": "The rules a provider skill's check holds. musubi check reads them and never runs provider code.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["musubi", "rules"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": { "type": "string" },
|
|
11
|
+
"musubi": { "const": "2026-11-20" },
|
|
12
|
+
"rules": {
|
|
13
|
+
"type": "array",
|
|
14
|
+
"minItems": 1,
|
|
15
|
+
"items": {
|
|
16
|
+
"oneOf": [
|
|
17
|
+
{
|
|
18
|
+
"type": "object",
|
|
19
|
+
"additionalProperties": false,
|
|
20
|
+
"required": ["kind", "headings"],
|
|
21
|
+
"properties": {
|
|
22
|
+
"kind": { "const": "headings" },
|
|
23
|
+
"headings": {
|
|
24
|
+
"type": "array",
|
|
25
|
+
"minItems": 1,
|
|
26
|
+
"description": "Heading lines that must appear, in this order. Other headings may come between them.",
|
|
27
|
+
"items": { "type": "string", "minLength": 1 }
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"type": "object",
|
|
33
|
+
"additionalProperties": false,
|
|
34
|
+
"required": ["kind", "text"],
|
|
35
|
+
"properties": {
|
|
36
|
+
"kind": { "const": "forbid" },
|
|
37
|
+
"text": {
|
|
38
|
+
"type": "array",
|
|
39
|
+
"minItems": 1,
|
|
40
|
+
"description": "Text that must not remain outside code blocks.",
|
|
41
|
+
"items": { "type": "string", "minLength": 1 }
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
"type": "object",
|
|
47
|
+
"additionalProperties": false,
|
|
48
|
+
"required": ["kind", "heading", "columns"],
|
|
49
|
+
"properties": {
|
|
50
|
+
"kind": { "const": "table-columns" },
|
|
51
|
+
"heading": {
|
|
52
|
+
"type": "string",
|
|
53
|
+
"minLength": 1,
|
|
54
|
+
"description": "The heading line whose first table is checked."
|
|
55
|
+
},
|
|
56
|
+
"columns": {
|
|
57
|
+
"type": "array",
|
|
58
|
+
"minItems": 1,
|
|
59
|
+
"description": "Columns the table must have. It may have more.",
|
|
60
|
+
"items": { "type": "string", "minLength": 1 }
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "musubi.schema.json",
|
|
4
|
+
"title": "musubi.json",
|
|
5
|
+
"description": "The musubi declaration next to a skill's SKILL.md: the content the skill provides and the content it follows.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"additionalProperties": false,
|
|
8
|
+
"required": ["musubi"],
|
|
9
|
+
"properties": {
|
|
10
|
+
"$schema": {
|
|
11
|
+
"type": "string",
|
|
12
|
+
"description": "Where editors find this schema."
|
|
13
|
+
},
|
|
14
|
+
"musubi": {
|
|
15
|
+
"const": "2026-11-20",
|
|
16
|
+
"description": "The date of the musubi definition this file follows."
|
|
17
|
+
},
|
|
18
|
+
"provides": {
|
|
19
|
+
"type": "object",
|
|
20
|
+
"description": "Content this skill provides, by name.",
|
|
21
|
+
"propertyNames": { "pattern": "^[a-z0-9]+(-[a-z0-9]+)*$" },
|
|
22
|
+
"additionalProperties": { "$ref": "#/$defs/provided" }
|
|
23
|
+
},
|
|
24
|
+
"follows": {
|
|
25
|
+
"type": "object",
|
|
26
|
+
"description": "Content this skill follows, by <skill>/<content>.",
|
|
27
|
+
"propertyNames": { "pattern": "^[a-z0-9]+(-[a-z0-9]+)*/[a-z0-9]+(-[a-z0-9]+)*$" },
|
|
28
|
+
"additionalProperties": { "$ref": "#/$defs/followed" }
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"$defs": {
|
|
32
|
+
"provided": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"additionalProperties": false,
|
|
35
|
+
"required": ["version", "file"],
|
|
36
|
+
"properties": {
|
|
37
|
+
"version": {
|
|
38
|
+
"type": "string",
|
|
39
|
+
"description": "MAJOR.MINOR.PATCH. Raise MAJOR when a following skill can break.",
|
|
40
|
+
"pattern": "^(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
|
|
41
|
+
},
|
|
42
|
+
"file": {
|
|
43
|
+
"type": "string",
|
|
44
|
+
"minLength": 1,
|
|
45
|
+
"description": "The content file, relative to the skill folder."
|
|
46
|
+
},
|
|
47
|
+
"check": {
|
|
48
|
+
"type": "string",
|
|
49
|
+
"pattern": "\\.json$",
|
|
50
|
+
"description": "A JSON rules file, relative to the skill folder, that musubi check applies to the examples of following skills."
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
},
|
|
54
|
+
"followed": {
|
|
55
|
+
"type": "object",
|
|
56
|
+
"additionalProperties": false,
|
|
57
|
+
"required": ["version", "integrity"],
|
|
58
|
+
"properties": {
|
|
59
|
+
"version": {
|
|
60
|
+
"type": "string",
|
|
61
|
+
"description": "The versions this skill accepts: ^X.Y.Z, ~X.Y.Z, or X.Y.Z.",
|
|
62
|
+
"pattern": "^[\\^~]?(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)\\.(0|[1-9][0-9]*)$"
|
|
63
|
+
},
|
|
64
|
+
"integrity": {
|
|
65
|
+
"type": "string",
|
|
66
|
+
"description": "The fingerprint of the content at the last check.",
|
|
67
|
+
"pattern": "^sha256-[A-Za-z0-9+/]{43}=$"
|
|
68
|
+
},
|
|
69
|
+
"examples": {
|
|
70
|
+
"type": "array",
|
|
71
|
+
"description": "Files of this skill that the provider's check is applied to.",
|
|
72
|
+
"items": { "type": "string", "minLength": 1 }
|
|
73
|
+
},
|
|
74
|
+
"optional": {
|
|
75
|
+
"type": "boolean",
|
|
76
|
+
"description": "true when this skill also runs without the provider: it reads the content only when the provider is installed, and musubi check skips the follow when it is not."
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|