@agentxm/registry-protocol 0.28.4-bootstrap.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 +110 -0
- package/README.md +13 -0
- package/dist/src/unstable/content/agent-skills-standard.d.ts +17 -0
- package/dist/src/unstable/content/agent-skills-standard.js +24 -0
- package/dist/src/unstable/content/frontmatter.d.ts +52 -0
- package/dist/src/unstable/content/frontmatter.js +115 -0
- package/dist/src/unstable/content/index.d.ts +11 -0
- package/dist/src/unstable/content/index.js +11 -0
- package/dist/src/unstable/content/skill-content.d.ts +43 -0
- package/dist/src/unstable/content/skill-content.js +184 -0
- package/dist/src/unstable/content/skill-types.d.ts +22 -0
- package/dist/src/unstable/content/skill-types.js +9 -0
- package/dist/src/unstable/content/subagent-content.d.ts +58 -0
- package/dist/src/unstable/content/subagent-content.js +101 -0
- package/dist/src/unstable/knowledge/index.d.ts +8 -0
- package/dist/src/unstable/knowledge/index.js +8 -0
- package/dist/src/unstable/knowledge/knowledge-search.d.ts +32 -0
- package/dist/src/unstable/knowledge/knowledge-search.js +147 -0
- package/dist/src/unstable/knowledge/okf.d.ts +86 -0
- package/dist/src/unstable/knowledge/okf.js +1090 -0
- package/dist/src/unstable/lint/catalog/hook/decision-portability.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/hook/decision-portability.js +40 -0
- package/dist/src/unstable/lint/catalog/hook/entrypoint-exists.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/hook/entrypoint-exists.js +39 -0
- package/dist/src/unstable/lint/catalog/hook/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/hook/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/hook/matcher-raw-portability.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/hook/matcher-raw-portability.js +51 -0
- package/dist/src/unstable/lint/catalog/hook.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/hook.js +17 -0
- package/dist/src/unstable/lint/catalog/knowledge/diagnostics.d.ts +128 -0
- package/dist/src/unstable/lint/catalog/knowledge/diagnostics.js +78 -0
- package/dist/src/unstable/lint/catalog/knowledge/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/knowledge/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/knowledge.d.ts +5 -0
- package/dist/src/unstable/lint/catalog/knowledge.js +11 -0
- package/dist/src/unstable/lint/catalog/mcp-server/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/mcp-server/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/mcp-server.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/mcp-server.js +6 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-keys-recognized.d.ts +28 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-keys-recognized.js +38 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-present.d.ts +17 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-present.js +24 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-schema-valid.d.ts +25 -0
- package/dist/src/unstable/lint/catalog/pack/manifest-schema-valid.js +33 -0
- package/dist/src/unstable/lint/catalog/pack-accessor/contexts.d.ts +51 -0
- package/dist/src/unstable/lint/catalog/pack-accessor/contexts.js +45 -0
- package/dist/src/unstable/lint/catalog/pack-accessor/vft.d.ts +60 -0
- package/dist/src/unstable/lint/catalog/pack-accessor/vft.js +85 -0
- package/dist/src/unstable/lint/catalog/pack.d.ts +37 -0
- package/dist/src/unstable/lint/catalog/pack.js +47 -0
- package/dist/src/unstable/lint/catalog/rule/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/rule/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/rule.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/rule.js +6 -0
- package/dist/src/unstable/lint/catalog/shared/envelope-rules.d.ts +93 -0
- package/dist/src/unstable/lint/catalog/shared/envelope-rules.js +89 -0
- package/dist/src/unstable/lint/catalog/shared/manifest-json.d.ts +18 -0
- package/dist/src/unstable/lint/catalog/shared/manifest-json.js +28 -0
- package/dist/src/unstable/lint/catalog/shared/manifest-present.d.ts +25 -0
- package/dist/src/unstable/lint/catalog/shared/manifest-present.js +37 -0
- package/dist/src/unstable/lint/catalog/shared/recommended-packs-rules.d.ts +70 -0
- package/dist/src/unstable/lint/catalog/shared/recommended-packs-rules.js +139 -0
- package/dist/src/unstable/lint/catalog/shared/schema-rule.d.ts +58 -0
- package/dist/src/unstable/lint/catalog/shared/schema-rule.js +103 -0
- package/dist/src/unstable/lint/catalog/skill/frontmatter-parseable.d.ts +31 -0
- package/dist/src/unstable/lint/catalog/skill/frontmatter-parseable.js +148 -0
- package/dist/src/unstable/lint/catalog/skill/frontmatter-standard-valid.d.ts +13 -0
- package/dist/src/unstable/lint/catalog/skill/frontmatter-standard-valid.js +61 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-keys-recognized.d.ts +26 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-keys-recognized.js +41 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-present.d.ts +23 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-present.js +32 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-schema-valid.d.ts +21 -0
- package/dist/src/unstable/lint/catalog/skill/manifest-schema-valid.js +36 -0
- package/dist/src/unstable/lint/catalog/skill/recommended-packs-valid.d.ts +8 -0
- package/dist/src/unstable/lint/catalog/skill/recommended-packs-valid.js +12 -0
- package/dist/src/unstable/lint/catalog/skill/skill-md-present.d.ts +17 -0
- package/dist/src/unstable/lint/catalog/skill/skill-md-present.js +37 -0
- package/dist/src/unstable/lint/catalog/skill/standalone-declaration-valid.d.ts +8 -0
- package/dist/src/unstable/lint/catalog/skill/standalone-declaration-valid.js +12 -0
- package/dist/src/unstable/lint/catalog/skill-accessor/contexts.d.ts +61 -0
- package/dist/src/unstable/lint/catalog/skill-accessor/contexts.js +55 -0
- package/dist/src/unstable/lint/catalog/skill-accessor/vft.d.ts +77 -0
- package/dist/src/unstable/lint/catalog/skill-accessor/vft.js +135 -0
- package/dist/src/unstable/lint/catalog/skill.d.ts +44 -0
- package/dist/src/unstable/lint/catalog/skill.js +64 -0
- package/dist/src/unstable/lint/catalog/subagent/envelope.d.ts +6 -0
- package/dist/src/unstable/lint/catalog/subagent/envelope.js +15 -0
- package/dist/src/unstable/lint/catalog/subagent.d.ts +4 -0
- package/dist/src/unstable/lint/catalog/subagent.js +6 -0
- package/dist/src/unstable/lint/compose-path.d.ts +28 -0
- package/dist/src/unstable/lint/compose-path.js +64 -0
- package/dist/src/unstable/lint/config.d.ts +103 -0
- package/dist/src/unstable/lint/config.js +140 -0
- package/dist/src/unstable/lint/context.d.ts +246 -0
- package/dist/src/unstable/lint/context.js +21 -0
- package/dist/src/unstable/lint/describe-document.d.ts +31 -0
- package/dist/src/unstable/lint/describe-document.js +50 -0
- package/dist/src/unstable/lint/evaluate.d.ts +47 -0
- package/dist/src/unstable/lint/evaluate.js +82 -0
- package/dist/src/unstable/lint/issues-to-findings.d.ts +35 -0
- package/dist/src/unstable/lint/issues-to-findings.js +149 -0
- package/dist/src/unstable/lint/publish.d.ts +49 -0
- package/dist/src/unstable/lint/publish.js +86 -0
- package/dist/src/unstable/lint/rule.d.ts +98 -0
- package/dist/src/unstable/lint/rule.js +18 -0
- package/dist/src/unstable/publish/archive-guardrails.d.ts +39 -0
- package/dist/src/unstable/publish/archive-guardrails.js +250 -0
- package/dist/src/unstable/publish/filtered-package-validation.d.ts +24 -0
- package/dist/src/unstable/publish/filtered-package-validation.js +117 -0
- package/dist/src/unstable/publish/index.d.ts +12 -0
- package/dist/src/unstable/publish/index.js +12 -0
- package/dist/src/unstable/publish/ingest-limits.d.ts +25 -0
- package/dist/src/unstable/publish/ingest-limits.js +41 -0
- package/dist/src/unstable/publish/input-normalization.d.ts +40 -0
- package/dist/src/unstable/publish/input-normalization.js +125 -0
- package/dist/src/unstable/publish/manifest-policy.d.ts +611 -0
- package/dist/src/unstable/publish/manifest-policy.js +196 -0
- package/dist/src/unstable/publish/test-zip-helpers.d.ts +13 -0
- package/dist/src/unstable/publish/test-zip-helpers.js +117 -0
- package/dist/src/unstable/publish/visibility.d.ts +161 -0
- package/dist/src/unstable/publish/visibility.js +124 -0
- package/dist/src/unstable/registry/discover-schema.d.ts +68 -0
- package/dist/src/unstable/registry/discover-schema.js +35 -0
- package/dist/src/unstable/registry/index.d.ts +9 -0
- package/dist/src/unstable/registry/index.js +9 -0
- package/dist/src/unstable/registry/publication-set.d.ts +303 -0
- package/dist/src/unstable/registry/publication-set.js +507 -0
- package/dist/src/unstable/registry/release-age-policy.d.ts +57 -0
- package/dist/src/unstable/registry/release-age-policy.js +117 -0
- package/dist/src/unstable/registry/schema.d.ts +220 -0
- package/dist/src/unstable/registry/schema.js +114 -0
- package/dist/src/unstable/suggested-action.d.ts +19 -0
- package/dist/src/unstable/suggested-action.js +42 -0
- package/package.json +214 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1, MIT Future License
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-MIT
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2025-2026 AgentXM, Inc.
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A Competing Use
|
|
33
|
+
means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Grant of Future License
|
|
88
|
+
|
|
89
|
+
We hereby irrevocably grant you an additional license to use the Software under
|
|
90
|
+
the MIT license that is effective on the second anniversary of the date we make
|
|
91
|
+
the Software available. On or after that date, you may use the Software under
|
|
92
|
+
the MIT license, in which case the following will apply:
|
|
93
|
+
|
|
94
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
95
|
+
this software and associated documentation files (the "Software"), to deal in
|
|
96
|
+
the Software without restriction, including without limitation the rights to
|
|
97
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
|
|
98
|
+
of the Software, and to permit persons to whom the Software is furnished to do
|
|
99
|
+
so, subject to the following conditions:
|
|
100
|
+
|
|
101
|
+
The above copyright notice and this permission notice shall be included in all
|
|
102
|
+
copies or substantial portions of the Software.
|
|
103
|
+
|
|
104
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
105
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
106
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
107
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
108
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
109
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
110
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
# @agentxm/registry-protocol
|
|
2
|
+
|
|
3
|
+
The AgentXM Registry wire contracts and the contract-level publication
|
|
4
|
+
validation rules that the AXM client and the Registry implementation must
|
|
5
|
+
interpret identically: request and response schemas, publication and
|
|
6
|
+
deprecation views, suggested-action error vocabulary, extension content
|
|
7
|
+
parsing, and publish lint rules.
|
|
8
|
+
|
|
9
|
+
Every export lives under an explicit `./unstable/*` subpath: the surface is
|
|
10
|
+
unsupported and may change in any release. Ordinary users should use the
|
|
11
|
+
[`axm` CLI](https://axm.sh) instead.
|
|
12
|
+
|
|
13
|
+
FSL-1.1-MIT © 2025-2026 AgentXM, Inc.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Skills conformance pin.
|
|
3
|
+
*
|
|
4
|
+
* AXM validates and materializes agent-facing skill directories against this
|
|
5
|
+
* exact upstream revision. Bumping the revision requires reviewing both the
|
|
6
|
+
* specification and `skills-ref` behavior, then updating conformance tests.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
export declare const AGENT_SKILLS_STANDARD_REVISION = "217be548739f21d6008915c29aefe320ea1a90af";
|
|
11
|
+
export declare const AGENT_SKILLS_SPECIFICATION_URL = "https://github.com/agentskills/agentskills/blob/217be548739f21d6008915c29aefe320ea1a90af/docs/specification.mdx";
|
|
12
|
+
export declare const AGENT_SKILLS_REFERENCE_VALIDATOR_URL = "https://github.com/agentskills/agentskills/tree/217be548739f21d6008915c29aefe320ea1a90af/skills-ref";
|
|
13
|
+
export declare const AGENT_SKILLS_FRONTMATTER_FIELDS: readonly ["name", "description", "license", "compatibility", "metadata", "allowed-tools"];
|
|
14
|
+
export declare const AGENT_SKILLS_NAME_MAX_LENGTH = 64;
|
|
15
|
+
export declare const AGENT_SKILLS_DESCRIPTION_MAX_LENGTH = 1024;
|
|
16
|
+
export declare const AGENT_SKILLS_COMPATIBILITY_MAX_LENGTH = 500;
|
|
17
|
+
//# sourceMappingURL=agent-skills-standard.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Skills conformance pin.
|
|
3
|
+
*
|
|
4
|
+
* AXM validates and materializes agent-facing skill directories against this
|
|
5
|
+
* exact upstream revision. Bumping the revision requires reviewing both the
|
|
6
|
+
* specification and `skills-ref` behavior, then updating conformance tests.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
export const AGENT_SKILLS_STANDARD_REVISION = "217be548739f21d6008915c29aefe320ea1a90af";
|
|
11
|
+
export const AGENT_SKILLS_SPECIFICATION_URL = `https://github.com/agentskills/agentskills/blob/${AGENT_SKILLS_STANDARD_REVISION}/docs/specification.mdx`;
|
|
12
|
+
export const AGENT_SKILLS_REFERENCE_VALIDATOR_URL = `https://github.com/agentskills/agentskills/tree/${AGENT_SKILLS_STANDARD_REVISION}/skills-ref`;
|
|
13
|
+
export const AGENT_SKILLS_FRONTMATTER_FIELDS = [
|
|
14
|
+
"name",
|
|
15
|
+
"description",
|
|
16
|
+
"license",
|
|
17
|
+
"compatibility",
|
|
18
|
+
"metadata",
|
|
19
|
+
"allowed-tools",
|
|
20
|
+
];
|
|
21
|
+
export const AGENT_SKILLS_NAME_MAX_LENGTH = 64;
|
|
22
|
+
export const AGENT_SKILLS_DESCRIPTION_MAX_LENGTH = 1024;
|
|
23
|
+
export const AGENT_SKILLS_COMPATIBILITY_MAX_LENGTH = 500;
|
|
24
|
+
//# sourceMappingURL=agent-skills-standard.js.map
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic YAML frontmatter parser.
|
|
3
|
+
*
|
|
4
|
+
* Parses content that may begin with a YAML frontmatter block delimited
|
|
5
|
+
* by `---`. Returns the parsed frontmatter as `unknown` so each consumer
|
|
6
|
+
* can apply its own Schema validation.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
import * as Effect from "effect/Effect";
|
|
11
|
+
/**
|
|
12
|
+
* Result of parsing frontmatter from content.
|
|
13
|
+
*
|
|
14
|
+
* @experimental This API is unstable and may change without notice.
|
|
15
|
+
*/
|
|
16
|
+
export interface FrontmatterResult {
|
|
17
|
+
/** Parsed YAML frontmatter, or undefined if no frontmatter block was found. */
|
|
18
|
+
readonly frontmatter: unknown;
|
|
19
|
+
/** Content body after the frontmatter block, or full content if no frontmatter. */
|
|
20
|
+
readonly body: string;
|
|
21
|
+
}
|
|
22
|
+
declare const FrontmatterParseFailure_base: new <A extends Record<string, any> = {}>(args: import("effect/Types").VoidIfEmpty<{ readonly [P in keyof A as P extends "_tag" ? never : P]: A[P]; }>) => import("effect/Cause").YieldableError & {
|
|
23
|
+
readonly _tag: "FrontmatterParseFailure";
|
|
24
|
+
} & Readonly<A>;
|
|
25
|
+
/** Bounded, document-relative failure from parsing a YAML frontmatter block. */
|
|
26
|
+
export declare class FrontmatterParseFailure extends FrontmatterParseFailure_base<{
|
|
27
|
+
readonly reason: string;
|
|
28
|
+
readonly line?: number;
|
|
29
|
+
readonly column?: number;
|
|
30
|
+
}> {
|
|
31
|
+
}
|
|
32
|
+
export declare const FRONTMATTER_PARSE_FALLBACK_REASON = "YAML frontmatter could not be parsed";
|
|
33
|
+
/** Normalize a foreign YAML failure without retaining its raw cause or parser code. */
|
|
34
|
+
export declare const normalizeFrontmatterParseFailure: (error: unknown, documentLineOffset: number) => FrontmatterParseFailure;
|
|
35
|
+
/**
|
|
36
|
+
* Parse frontmatter from content synchronously.
|
|
37
|
+
*
|
|
38
|
+
* Throws on malformed YAML. Use `parseFrontmatterEffect` for full error channel.
|
|
39
|
+
*
|
|
40
|
+
* @experimental This API is unstable and may change without notice.
|
|
41
|
+
*/
|
|
42
|
+
export declare const parseFrontmatterSync: (content: string) => FrontmatterResult;
|
|
43
|
+
/**
|
|
44
|
+
* Parse frontmatter from content as an Effect.
|
|
45
|
+
*
|
|
46
|
+
* Returns `FrontmatterParseFailure` in the error channel for malformed YAML.
|
|
47
|
+
*
|
|
48
|
+
* @experimental This API is unstable and may change without notice.
|
|
49
|
+
*/
|
|
50
|
+
export declare const parseFrontmatterEffect: (content: string) => Effect.Effect<FrontmatterResult, FrontmatterParseFailure>;
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=frontmatter.d.ts.map
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic YAML frontmatter parser.
|
|
3
|
+
*
|
|
4
|
+
* Parses content that may begin with a YAML frontmatter block delimited
|
|
5
|
+
* by `---`. Returns the parsed frontmatter as `unknown` so each consumer
|
|
6
|
+
* can apply its own Schema validation.
|
|
7
|
+
*
|
|
8
|
+
* @experimental This API is unstable and may change without notice.
|
|
9
|
+
*/
|
|
10
|
+
import * as Data from "effect/Data";
|
|
11
|
+
import * as Effect from "effect/Effect";
|
|
12
|
+
import YAML, { YAMLParseError } from "yaml";
|
|
13
|
+
/** Bounded, document-relative failure from parsing a YAML frontmatter block. */
|
|
14
|
+
export class FrontmatterParseFailure extends Data.TaggedError("FrontmatterParseFailure") {
|
|
15
|
+
}
|
|
16
|
+
const FRONTMATTER_DELIMITER = "---";
|
|
17
|
+
export const FRONTMATTER_PARSE_FALLBACK_REASON = "YAML frontmatter could not be parsed";
|
|
18
|
+
const FRONTMATTER_PARSE_REASON_MAX_CODE_POINTS = 256;
|
|
19
|
+
const boundedReason = (reason) => {
|
|
20
|
+
const codePoints = Array.from(reason);
|
|
21
|
+
if (codePoints.length <= FRONTMATTER_PARSE_REASON_MAX_CODE_POINTS)
|
|
22
|
+
return reason;
|
|
23
|
+
return `${codePoints.slice(0, FRONTMATTER_PARSE_REASON_MAX_CODE_POINTS - 1).join("")}…`;
|
|
24
|
+
};
|
|
25
|
+
const parserReason = (error) => {
|
|
26
|
+
const firstLine = error.message.split(/\r?\n/, 1)[0]?.trim() ?? "";
|
|
27
|
+
const withoutLocation = firstLine
|
|
28
|
+
.replace(/\s+at line \d+, column \d+:?$/, "")
|
|
29
|
+
.replace(/^Missing closing ["']quote$/, "Missing closing quote")
|
|
30
|
+
.trim();
|
|
31
|
+
return boundedReason(withoutLocation || FRONTMATTER_PARSE_FALLBACK_REASON);
|
|
32
|
+
};
|
|
33
|
+
/** Normalize a foreign YAML failure without retaining its raw cause or parser code. */
|
|
34
|
+
export const normalizeFrontmatterParseFailure = (error, documentLineOffset) => {
|
|
35
|
+
if (!(error instanceof YAMLParseError)) {
|
|
36
|
+
return new FrontmatterParseFailure({ reason: FRONTMATTER_PARSE_FALLBACK_REASON });
|
|
37
|
+
}
|
|
38
|
+
const position = error.linePos?.[0];
|
|
39
|
+
if (position === undefined || !Number.isSafeInteger(position.line) || position.line < 1) {
|
|
40
|
+
return new FrontmatterParseFailure({ reason: parserReason(error) });
|
|
41
|
+
}
|
|
42
|
+
const line = position.line + documentLineOffset;
|
|
43
|
+
const column = Number.isSafeInteger(position.col) && position.col > 0 ? position.col : undefined;
|
|
44
|
+
return new FrontmatterParseFailure({
|
|
45
|
+
reason: parserReason(error),
|
|
46
|
+
line,
|
|
47
|
+
...(column === undefined ? {} : { column }),
|
|
48
|
+
});
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Find the frontmatter boundaries in content.
|
|
52
|
+
* Returns [endOfOpening, startOfClosing] indices, or undefined if no frontmatter.
|
|
53
|
+
*/
|
|
54
|
+
const findFrontmatterBoundaries = (content) => {
|
|
55
|
+
if (!content.startsWith(FRONTMATTER_DELIMITER)) {
|
|
56
|
+
return undefined;
|
|
57
|
+
}
|
|
58
|
+
const afterOpening = content.indexOf("\n");
|
|
59
|
+
if (afterOpening === -1) {
|
|
60
|
+
return undefined;
|
|
61
|
+
}
|
|
62
|
+
const closingIndex = content.indexOf(`\n${FRONTMATTER_DELIMITER}`, afterOpening);
|
|
63
|
+
if (closingIndex === -1) {
|
|
64
|
+
return undefined;
|
|
65
|
+
}
|
|
66
|
+
const closingEnd = closingIndex + 1 + FRONTMATTER_DELIMITER.length;
|
|
67
|
+
const bodyStart = content.startsWith("\r\n", closingEnd)
|
|
68
|
+
? closingEnd + 2
|
|
69
|
+
: content[closingEnd] === "\n"
|
|
70
|
+
? closingEnd + 1
|
|
71
|
+
: closingEnd;
|
|
72
|
+
return {
|
|
73
|
+
yamlStart: afterOpening + 1,
|
|
74
|
+
bodyStart,
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
/**
|
|
78
|
+
* Parse frontmatter from content synchronously.
|
|
79
|
+
*
|
|
80
|
+
* Throws on malformed YAML. Use `parseFrontmatterEffect` for full error channel.
|
|
81
|
+
*
|
|
82
|
+
* @experimental This API is unstable and may change without notice.
|
|
83
|
+
*/
|
|
84
|
+
export const parseFrontmatterSync = (content) => {
|
|
85
|
+
const boundaries = findFrontmatterBoundaries(content);
|
|
86
|
+
if (boundaries === undefined) {
|
|
87
|
+
return { frontmatter: undefined, body: content };
|
|
88
|
+
}
|
|
89
|
+
const yamlContent = content.slice(boundaries.yamlStart, boundaries.bodyStart).split("---")[0];
|
|
90
|
+
const frontmatter = (() => {
|
|
91
|
+
try {
|
|
92
|
+
return YAML.parse(yamlContent ?? "");
|
|
93
|
+
}
|
|
94
|
+
catch (error) {
|
|
95
|
+
const documentLineOffset = content.slice(0, boundaries.yamlStart).split("\n").length - 1;
|
|
96
|
+
throw normalizeFrontmatterParseFailure(error, documentLineOffset);
|
|
97
|
+
}
|
|
98
|
+
})();
|
|
99
|
+
const body = content.slice(boundaries.bodyStart);
|
|
100
|
+
return { frontmatter: frontmatter ?? undefined, body };
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Parse frontmatter from content as an Effect.
|
|
104
|
+
*
|
|
105
|
+
* Returns `FrontmatterParseFailure` in the error channel for malformed YAML.
|
|
106
|
+
*
|
|
107
|
+
* @experimental This API is unstable and may change without notice.
|
|
108
|
+
*/
|
|
109
|
+
export const parseFrontmatterEffect = (content) => Effect.try({
|
|
110
|
+
try: () => parseFrontmatterSync(content),
|
|
111
|
+
catch: (error) => error instanceof FrontmatterParseFailure
|
|
112
|
+
? error
|
|
113
|
+
: new FrontmatterParseFailure({ reason: FRONTMATTER_PARSE_FALLBACK_REASON }),
|
|
114
|
+
});
|
|
115
|
+
//# sourceMappingURL=frontmatter.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Area barrel for the package public surface.
|
|
3
|
+
*
|
|
4
|
+
* @experimental This API is unstable and may change without notice.
|
|
5
|
+
*/
|
|
6
|
+
export { AGENT_SKILLS_COMPATIBILITY_MAX_LENGTH, AGENT_SKILLS_DESCRIPTION_MAX_LENGTH, AGENT_SKILLS_FRONTMATTER_FIELDS, AGENT_SKILLS_NAME_MAX_LENGTH, AGENT_SKILLS_REFERENCE_VALIDATOR_URL, AGENT_SKILLS_SPECIFICATION_URL, AGENT_SKILLS_STANDARD_REVISION, } from "./agent-skills-standard.js";
|
|
7
|
+
export { FrontmatterParseFailure, type FrontmatterResult, parseFrontmatterEffect, parseFrontmatterSync, } from "./frontmatter.js";
|
|
8
|
+
export { type SkillFrontmatter, SkillFrontmatterSchema, type SkillFrontmatterValidation, parseSkillMd, validateSkillFrontmatter, } from "./skill-content.js";
|
|
9
|
+
export { type Skill } from "./skill-types.js";
|
|
10
|
+
export { type SubagentAgentOverrides, type SubagentContentResult, parseSubagentMd, } from "./subagent-content.js";
|
|
11
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Area barrel for the package public surface.
|
|
3
|
+
*
|
|
4
|
+
* @experimental This API is unstable and may change without notice.
|
|
5
|
+
*/
|
|
6
|
+
export { AGENT_SKILLS_COMPATIBILITY_MAX_LENGTH, AGENT_SKILLS_DESCRIPTION_MAX_LENGTH, AGENT_SKILLS_FRONTMATTER_FIELDS, AGENT_SKILLS_NAME_MAX_LENGTH, AGENT_SKILLS_REFERENCE_VALIDATOR_URL, AGENT_SKILLS_SPECIFICATION_URL, AGENT_SKILLS_STANDARD_REVISION, } from "./agent-skills-standard.js";
|
|
7
|
+
export { FrontmatterParseFailure, parseFrontmatterEffect, parseFrontmatterSync, } from "./frontmatter.js";
|
|
8
|
+
export { SkillFrontmatterSchema, parseSkillMd, validateSkillFrontmatter, } from "./skill-content.js";
|
|
9
|
+
export {} from "./skill-types.js";
|
|
10
|
+
export { parseSubagentMd, } from "./subagent-content.js";
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill content file module for SKILL.md parsing and frontmatter schemas.
|
|
3
|
+
*
|
|
4
|
+
* Defines the frontmatter schema for SKILL.md files and a parser that
|
|
5
|
+
* combines the shared frontmatter utility with skill-specific validation.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This API is unstable and may change without notice.
|
|
8
|
+
*/
|
|
9
|
+
import * as Option from "effect/Option";
|
|
10
|
+
import * as Schema from "effect/Schema";
|
|
11
|
+
import type { Skill } from "./skill-types.js";
|
|
12
|
+
/**
|
|
13
|
+
* Schema for SKILL.md frontmatter fields.
|
|
14
|
+
*
|
|
15
|
+
* @experimental This API is unstable and may change without notice.
|
|
16
|
+
*/
|
|
17
|
+
export declare const SkillFrontmatterSchema: Schema.Struct<{
|
|
18
|
+
readonly name: Schema.String;
|
|
19
|
+
readonly description: Schema.String;
|
|
20
|
+
readonly license: Schema.optionalKey<Schema.String>;
|
|
21
|
+
readonly compatibility: Schema.optionalKey<Schema.String>;
|
|
22
|
+
readonly metadata: Schema.optionalKey<Schema.$Record<Schema.String, Schema.String>>;
|
|
23
|
+
readonly "allowed-tools": Schema.optionalKey<Schema.String>;
|
|
24
|
+
}>;
|
|
25
|
+
export type SkillFrontmatter = Schema.Schema.Type<typeof SkillFrontmatterSchema>;
|
|
26
|
+
export type SkillFrontmatterValidation = {
|
|
27
|
+
readonly valid: true;
|
|
28
|
+
readonly frontmatter: SkillFrontmatter;
|
|
29
|
+
} | {
|
|
30
|
+
readonly valid: false;
|
|
31
|
+
readonly errors: ReadonlyArray<string>;
|
|
32
|
+
};
|
|
33
|
+
/** Validate parsed YAML against the pinned Agent Skills metadata contract. */
|
|
34
|
+
export declare const validateSkillFrontmatter: (input: unknown, expectedDirectoryName?: string) => SkillFrontmatterValidation;
|
|
35
|
+
/**
|
|
36
|
+
* Parse a SKILL.md file's content and extract skill metadata from frontmatter.
|
|
37
|
+
*
|
|
38
|
+
* Returns `Option.some(Skill)` when the file has valid YAML frontmatter with
|
|
39
|
+
* non-empty `name` and `description` fields. Returns `Option.none()` for any
|
|
40
|
+
* invalid input: missing frontmatter, invalid YAML, or missing/empty required fields.
|
|
41
|
+
*/
|
|
42
|
+
export declare const parseSkillMd: (content: string, expectedDirectoryName?: string) => Option.Option<Skill>;
|
|
43
|
+
//# sourceMappingURL=skill-content.d.ts.map
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill content file module for SKILL.md parsing and frontmatter schemas.
|
|
3
|
+
*
|
|
4
|
+
* Defines the frontmatter schema for SKILL.md files and a parser that
|
|
5
|
+
* combines the shared frontmatter utility with skill-specific validation.
|
|
6
|
+
*
|
|
7
|
+
* @experimental This API is unstable and may change without notice.
|
|
8
|
+
*/
|
|
9
|
+
import * as Option from "effect/Option";
|
|
10
|
+
import * as Schema from "effect/Schema";
|
|
11
|
+
import { parseFrontmatterSync } from "./frontmatter.js";
|
|
12
|
+
import { AGENT_SKILLS_COMPATIBILITY_MAX_LENGTH, AGENT_SKILLS_DESCRIPTION_MAX_LENGTH, AGENT_SKILLS_FRONTMATTER_FIELDS, AGENT_SKILLS_NAME_MAX_LENGTH, } from "./agent-skills-standard.js";
|
|
13
|
+
const NonEmptyTrimmedStringSchema = Schema.String.pipe(Schema.check(Schema.makeFilter((input) => input.trim().length > 0 ? undefined : "Expected a non-empty string")));
|
|
14
|
+
const BoundedNonEmptyStringSchema = (maximumLength) => NonEmptyTrimmedStringSchema.pipe(Schema.check(Schema.makeFilter((input) => [...input].length <= maximumLength
|
|
15
|
+
? undefined
|
|
16
|
+
: `Expected at most ${maximumLength} characters`)));
|
|
17
|
+
const SkillNameSchema = BoundedNonEmptyStringSchema(AGENT_SKILLS_NAME_MAX_LENGTH).pipe(Schema.check(Schema.makeFilter((input) => {
|
|
18
|
+
const normalized = input.trim().normalize("NFKC");
|
|
19
|
+
if (normalized !== normalized.toLowerCase())
|
|
20
|
+
return "Skill name must be lowercase";
|
|
21
|
+
if (normalized.startsWith("-") || normalized.endsWith("-")) {
|
|
22
|
+
return "Skill name cannot start or end with a hyphen";
|
|
23
|
+
}
|
|
24
|
+
if (normalized.includes("--"))
|
|
25
|
+
return "Skill name cannot contain consecutive hyphens";
|
|
26
|
+
return [...normalized].every((character) => /[\p{L}\p{N}-]/u.test(character))
|
|
27
|
+
? undefined
|
|
28
|
+
: "Skill name may contain only Unicode letters, numbers, and hyphens";
|
|
29
|
+
})));
|
|
30
|
+
const AllowedToolsSchema = NonEmptyTrimmedStringSchema.pipe(Schema.check(Schema.makeFilter((input) => /^\S+(?: \S+)*$/u.test(input) ? undefined : "Allowed tools must be a space-delimited string")));
|
|
31
|
+
/**
|
|
32
|
+
* Schema for SKILL.md frontmatter fields.
|
|
33
|
+
*
|
|
34
|
+
* @experimental This API is unstable and may change without notice.
|
|
35
|
+
*/
|
|
36
|
+
export const SkillFrontmatterSchema = Schema.Struct({
|
|
37
|
+
name: SkillNameSchema.pipe(Schema.annotateKey({ messageMissingKey: "skill name is required in SKILL.md frontmatter" })),
|
|
38
|
+
description: BoundedNonEmptyStringSchema(AGENT_SKILLS_DESCRIPTION_MAX_LENGTH).pipe(Schema.annotateKey({
|
|
39
|
+
messageMissingKey: "skill description is required in SKILL.md frontmatter",
|
|
40
|
+
})),
|
|
41
|
+
license: Schema.optionalKey(Schema.String),
|
|
42
|
+
compatibility: Schema.optionalKey(BoundedNonEmptyStringSchema(AGENT_SKILLS_COMPATIBILITY_MAX_LENGTH)),
|
|
43
|
+
metadata: Schema.optionalKey(Schema.Record(Schema.String, Schema.String)),
|
|
44
|
+
"allowed-tools": Schema.optionalKey(AllowedToolsSchema),
|
|
45
|
+
}).annotate({
|
|
46
|
+
identifier: "SkillFrontmatter",
|
|
47
|
+
title: "Skill Frontmatter",
|
|
48
|
+
description: "Agent Skills standard metadata at the top of a SKILL.md file.",
|
|
49
|
+
});
|
|
50
|
+
const isRecord = (value) => value !== null && typeof value === "object" && !Array.isArray(value);
|
|
51
|
+
const allowedFrontmatterFields = new Set(AGENT_SKILLS_FRONTMATTER_FIELDS);
|
|
52
|
+
/** Validate parsed YAML against the pinned Agent Skills metadata contract. */
|
|
53
|
+
export const validateSkillFrontmatter = (input, expectedDirectoryName) => {
|
|
54
|
+
if (!isRecord(input)) {
|
|
55
|
+
return { valid: false, errors: ["SKILL.md frontmatter must be a YAML mapping"] };
|
|
56
|
+
}
|
|
57
|
+
const errors = [];
|
|
58
|
+
const unexpected = Object.keys(input)
|
|
59
|
+
.filter((key) => !allowedFrontmatterFields.has(key))
|
|
60
|
+
.sort();
|
|
61
|
+
if (unexpected.length > 0) {
|
|
62
|
+
errors.push(`Unexpected frontmatter fields: ${unexpected.join(", ")}`);
|
|
63
|
+
}
|
|
64
|
+
const nameValue = input["name"];
|
|
65
|
+
let normalizedName;
|
|
66
|
+
if (typeof nameValue !== "string" || nameValue.trim().length === 0) {
|
|
67
|
+
errors.push("Field 'name' must be a non-empty string");
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
normalizedName = nameValue.trim().normalize("NFKC");
|
|
71
|
+
if ([...normalizedName].length > AGENT_SKILLS_NAME_MAX_LENGTH) {
|
|
72
|
+
errors.push(`Skill name exceeds ${AGENT_SKILLS_NAME_MAX_LENGTH} character limit`);
|
|
73
|
+
}
|
|
74
|
+
if (normalizedName !== normalizedName.toLowerCase()) {
|
|
75
|
+
errors.push("Skill name must be lowercase");
|
|
76
|
+
}
|
|
77
|
+
if (normalizedName.startsWith("-") || normalizedName.endsWith("-")) {
|
|
78
|
+
errors.push("Skill name cannot start or end with a hyphen");
|
|
79
|
+
}
|
|
80
|
+
if (normalizedName.includes("--")) {
|
|
81
|
+
errors.push("Skill name cannot contain consecutive hyphens");
|
|
82
|
+
}
|
|
83
|
+
if (![...normalizedName].every((character) => /[\p{L}\p{N}-]/u.test(character))) {
|
|
84
|
+
errors.push("Skill name may contain only Unicode letters, numbers, and hyphens");
|
|
85
|
+
}
|
|
86
|
+
if (expectedDirectoryName !== undefined &&
|
|
87
|
+
expectedDirectoryName.normalize("NFKC") !== normalizedName) {
|
|
88
|
+
errors.push(`Directory name '${expectedDirectoryName}' must match skill name '${normalizedName}'`);
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
const descriptionValue = input["description"];
|
|
92
|
+
if (typeof descriptionValue !== "string" || descriptionValue.trim().length === 0) {
|
|
93
|
+
errors.push("Field 'description' must be a non-empty string");
|
|
94
|
+
}
|
|
95
|
+
else if ([...descriptionValue].length > AGENT_SKILLS_DESCRIPTION_MAX_LENGTH) {
|
|
96
|
+
errors.push(`Description exceeds ${AGENT_SKILLS_DESCRIPTION_MAX_LENGTH} character limit`);
|
|
97
|
+
}
|
|
98
|
+
const licenseValue = input["license"];
|
|
99
|
+
if (licenseValue !== undefined && typeof licenseValue !== "string") {
|
|
100
|
+
errors.push("Field 'license' must be a string");
|
|
101
|
+
}
|
|
102
|
+
const compatibilityValue = input["compatibility"];
|
|
103
|
+
if (compatibilityValue !== undefined) {
|
|
104
|
+
if (typeof compatibilityValue !== "string" || compatibilityValue.trim().length === 0) {
|
|
105
|
+
errors.push("Field 'compatibility' must be a non-empty string");
|
|
106
|
+
}
|
|
107
|
+
else if ([...compatibilityValue].length > AGENT_SKILLS_COMPATIBILITY_MAX_LENGTH) {
|
|
108
|
+
errors.push(`Compatibility exceeds ${AGENT_SKILLS_COMPATIBILITY_MAX_LENGTH} character limit`);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
const metadataValue = input["metadata"];
|
|
112
|
+
const metadata = {};
|
|
113
|
+
if (metadataValue !== undefined) {
|
|
114
|
+
if (!isRecord(metadataValue)) {
|
|
115
|
+
errors.push("Field 'metadata' must be a mapping from strings to strings");
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
for (const [key, value] of Object.entries(metadataValue)) {
|
|
119
|
+
if (typeof value !== "string") {
|
|
120
|
+
errors.push(`Metadata value for '${key}' must be a string`);
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
metadata[key] = value;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
const allowedToolsValue = input["allowed-tools"];
|
|
129
|
+
if (allowedToolsValue !== undefined) {
|
|
130
|
+
if (typeof allowedToolsValue !== "string" || !/^\S+(?: \S+)*$/u.test(allowedToolsValue)) {
|
|
131
|
+
errors.push("Field 'allowed-tools' must be a non-empty space-delimited string");
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
if (errors.length > 0 || normalizedName === undefined || typeof descriptionValue !== "string") {
|
|
135
|
+
return { valid: false, errors };
|
|
136
|
+
}
|
|
137
|
+
return {
|
|
138
|
+
valid: true,
|
|
139
|
+
frontmatter: {
|
|
140
|
+
name: normalizedName,
|
|
141
|
+
description: descriptionValue,
|
|
142
|
+
...(licenseValue !== undefined && typeof licenseValue === "string"
|
|
143
|
+
? { license: licenseValue }
|
|
144
|
+
: {}),
|
|
145
|
+
...(compatibilityValue !== undefined && typeof compatibilityValue === "string"
|
|
146
|
+
? { compatibility: compatibilityValue }
|
|
147
|
+
: {}),
|
|
148
|
+
...(metadataValue !== undefined ? { metadata } : {}),
|
|
149
|
+
...(allowedToolsValue !== undefined && typeof allowedToolsValue === "string"
|
|
150
|
+
? { "allowed-tools": allowedToolsValue }
|
|
151
|
+
: {}),
|
|
152
|
+
},
|
|
153
|
+
};
|
|
154
|
+
};
|
|
155
|
+
/**
|
|
156
|
+
* Parse a SKILL.md file's content and extract skill metadata from frontmatter.
|
|
157
|
+
*
|
|
158
|
+
* Returns `Option.some(Skill)` when the file has valid YAML frontmatter with
|
|
159
|
+
* non-empty `name` and `description` fields. Returns `Option.none()` for any
|
|
160
|
+
* invalid input: missing frontmatter, invalid YAML, or missing/empty required fields.
|
|
161
|
+
*/
|
|
162
|
+
export const parseSkillMd = (content, expectedDirectoryName) => {
|
|
163
|
+
try {
|
|
164
|
+
const parsed = parseFrontmatterSync(content);
|
|
165
|
+
if (parsed.frontmatter === undefined) {
|
|
166
|
+
return Option.none();
|
|
167
|
+
}
|
|
168
|
+
const validation = validateSkillFrontmatter(parsed.frontmatter, expectedDirectoryName);
|
|
169
|
+
if (!validation.valid) {
|
|
170
|
+
return Option.none();
|
|
171
|
+
}
|
|
172
|
+
const frontmatter = validation.frontmatter;
|
|
173
|
+
return Option.some({
|
|
174
|
+
name: frontmatter.name,
|
|
175
|
+
description: frontmatter.description,
|
|
176
|
+
metadata: frontmatter.metadata === undefined ? Option.none() : Option.some(frontmatter.metadata),
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
catch {
|
|
180
|
+
// Invalid YAML or other parsing errors — silently skip
|
|
181
|
+
return Option.none();
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
//# sourceMappingURL=skill-content.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core domain types for skills management.
|
|
3
|
+
*
|
|
4
|
+
* @experimental This API is unstable and may change without notice.
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
import * as Option from "effect/Option";
|
|
8
|
+
import * as Record from "effect/Record";
|
|
9
|
+
/**
|
|
10
|
+
* Represents a discovered skill.
|
|
11
|
+
*
|
|
12
|
+
* @experimental This API is unstable and may change without notice.
|
|
13
|
+
*/
|
|
14
|
+
export interface Skill {
|
|
15
|
+
/** Unique name of the skill */
|
|
16
|
+
readonly name: string;
|
|
17
|
+
/** Description of the skill */
|
|
18
|
+
readonly description: string;
|
|
19
|
+
/** Optional metadata from SKILL.md frontmatter */
|
|
20
|
+
readonly metadata: Option.Option<Record.ReadonlyRecord<string, string>>;
|
|
21
|
+
}
|
|
22
|
+
//# sourceMappingURL=skill-types.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core domain types for skills management.
|
|
3
|
+
*
|
|
4
|
+
* @experimental This API is unstable and may change without notice.
|
|
5
|
+
* @packageDocumentation
|
|
6
|
+
*/
|
|
7
|
+
import * as Option from "effect/Option";
|
|
8
|
+
import * as Record from "effect/Record";
|
|
9
|
+
//# sourceMappingURL=skill-types.js.map
|