@elizaos/skills 2.0.0-alpha.10
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 +126 -0
- package/dist/formatter.d.ts +44 -0
- package/dist/formatter.d.ts.map +1 -0
- package/dist/formatter.js +182 -0
- package/dist/frontmatter.d.ts +39 -0
- package/dist/frontmatter.d.ts.map +1 -0
- package/dist/frontmatter.js +105 -0
- package/dist/index.d.ts +29 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +31 -0
- package/dist/loader.d.ts +33 -0
- package/dist/loader.d.ts.map +1 -0
- package/dist/loader.js +362 -0
- package/dist/resolver.d.ts +18 -0
- package/dist/resolver.d.ts.map +1 -0
- package/dist/resolver.js +90 -0
- package/dist/types.d.ts +201 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +57 -0
- package/skills/1password/SKILL.md +70 -0
- package/skills/1password/references/cli-examples.md +29 -0
- package/skills/1password/references/get-started.md +17 -0
- package/skills/apple-notes/SKILL.md +77 -0
- package/skills/apple-reminders/SKILL.md +96 -0
- package/skills/bear-notes/SKILL.md +107 -0
- package/skills/bird/SKILL.md +224 -0
- package/skills/blogwatcher/SKILL.md +69 -0
- package/skills/blucli/SKILL.md +47 -0
- package/skills/bluebubbles/SKILL.md +131 -0
- package/skills/camsnap/SKILL.md +45 -0
- package/skills/canvas/SKILL.md +203 -0
- package/skills/clawhub/SKILL.md +77 -0
- package/skills/coding-agent/SKILL.md +284 -0
- package/skills/discord/SKILL.md +578 -0
- package/skills/eightctl/SKILL.md +50 -0
- package/skills/food-order/SKILL.md +48 -0
- package/skills/gemini/SKILL.md +43 -0
- package/skills/gifgrep/SKILL.md +79 -0
- package/skills/github/SKILL.md +77 -0
- package/skills/gog/SKILL.md +116 -0
- package/skills/goplaces/SKILL.md +52 -0
- package/skills/healthcheck/SKILL.md +245 -0
- package/skills/himalaya/SKILL.md +257 -0
- package/skills/himalaya/references/configuration.md +184 -0
- package/skills/himalaya/references/message-composition.md +199 -0
- package/skills/imsg/SKILL.md +74 -0
- package/skills/local-places/SERVER_README.md +101 -0
- package/skills/local-places/SKILL.md +102 -0
- package/skills/local-places/pyproject.toml +21 -0
- package/skills/local-places/src/local_places/__init__.py +2 -0
- package/skills/local-places/src/local_places/google_places.py +314 -0
- package/skills/local-places/src/local_places/main.py +65 -0
- package/skills/local-places/src/local_places/schemas.py +107 -0
- package/skills/mcporter/SKILL.md +61 -0
- package/skills/model-usage/SKILL.md +69 -0
- package/skills/model-usage/references/codexbar-cli.md +33 -0
- package/skills/model-usage/scripts/model_usage.py +310 -0
- package/skills/nano-banana-pro/SKILL.md +58 -0
- package/skills/nano-banana-pro/scripts/generate_image.py +184 -0
- package/skills/nano-pdf/SKILL.md +38 -0
- package/skills/notion/SKILL.md +172 -0
- package/skills/obsidian/SKILL.md +81 -0
- package/skills/openai-image-gen/SKILL.md +89 -0
- package/skills/openai-image-gen/scripts/gen.py +240 -0
- package/skills/openai-whisper/SKILL.md +38 -0
- package/skills/openai-whisper-api/SKILL.md +52 -0
- package/skills/openai-whisper-api/scripts/transcribe.sh +85 -0
- package/skills/openhue/SKILL.md +51 -0
- package/skills/oracle/SKILL.md +125 -0
- package/skills/ordercli/SKILL.md +78 -0
- package/skills/peekaboo/SKILL.md +190 -0
- package/skills/sag/SKILL.md +87 -0
- package/skills/security-ask-questions-if-underspecified/.claude-plugin/plugin.json +10 -0
- package/skills/security-ask-questions-if-underspecified/README.md +24 -0
- package/skills/security-ask-questions-if-underspecified/SKILL.md +85 -0
- package/skills/security-ask-questions-if-underspecified/skills/ask-questions-if-underspecified/SKILL.md +85 -0
- package/skills/security-audit-context-building/.claude-plugin/plugin.json +10 -0
- package/skills/security-audit-context-building/README.md +58 -0
- package/skills/security-audit-context-building/SKILL.md +297 -0
- package/skills/security-audit-context-building/commands/audit-context.md +21 -0
- package/skills/security-audit-context-building/skills/audit-context-building/SKILL.md +297 -0
- package/skills/security-audit-context-building/skills/audit-context-building/resources/COMPLETENESS_CHECKLIST.md +47 -0
- package/skills/security-audit-context-building/skills/audit-context-building/resources/FUNCTION_MICRO_ANALYSIS_EXAMPLE.md +355 -0
- package/skills/security-audit-context-building/skills/audit-context-building/resources/OUTPUT_REQUIREMENTS.md +71 -0
- package/skills/security-building-secure-contracts/.claude-plugin/plugin.json +10 -0
- package/skills/security-building-secure-contracts/README.md +241 -0
- package/skills/security-building-secure-contracts/SKILL.md +67 -0
- package/skills/security-building-secure-contracts/skills/algorand-vulnerability-scanner/SKILL.md +284 -0
- package/skills/security-building-secure-contracts/skills/algorand-vulnerability-scanner/resources/VULNERABILITY_PATTERNS.md +405 -0
- package/skills/security-building-secure-contracts/skills/audit-prep-assistant/SKILL.md +409 -0
- package/skills/security-building-secure-contracts/skills/cairo-vulnerability-scanner/SKILL.md +329 -0
- package/skills/security-building-secure-contracts/skills/cairo-vulnerability-scanner/resources/VULNERABILITY_PATTERNS.md +722 -0
- package/skills/security-building-secure-contracts/skills/code-maturity-assessor/SKILL.md +218 -0
- package/skills/security-building-secure-contracts/skills/code-maturity-assessor/resources/ASSESSMENT_CRITERIA.md +355 -0
- package/skills/security-building-secure-contracts/skills/code-maturity-assessor/resources/EXAMPLE_REPORT.md +248 -0
- package/skills/security-building-secure-contracts/skills/code-maturity-assessor/resources/REPORT_FORMAT.md +33 -0
- package/skills/security-building-secure-contracts/skills/cosmos-vulnerability-scanner/SKILL.md +334 -0
- package/skills/security-building-secure-contracts/skills/cosmos-vulnerability-scanner/resources/VULNERABILITY_PATTERNS.md +740 -0
- package/skills/security-building-secure-contracts/skills/guidelines-advisor/SKILL.md +252 -0
- package/skills/security-building-secure-contracts/skills/guidelines-advisor/resources/ASSESSMENT_AREAS.md +329 -0
- package/skills/security-building-secure-contracts/skills/guidelines-advisor/resources/DELIVERABLES.md +118 -0
- package/skills/security-building-secure-contracts/skills/guidelines-advisor/resources/EXAMPLE_REPORT.md +298 -0
- package/skills/security-building-secure-contracts/skills/secure-workflow-guide/SKILL.md +161 -0
- package/skills/security-building-secure-contracts/skills/secure-workflow-guide/resources/EXAMPLE_REPORT.md +279 -0
- package/skills/security-building-secure-contracts/skills/secure-workflow-guide/resources/WORKFLOW_STEPS.md +132 -0
- package/skills/security-building-secure-contracts/skills/solana-vulnerability-scanner/SKILL.md +389 -0
- package/skills/security-building-secure-contracts/skills/solana-vulnerability-scanner/resources/VULNERABILITY_PATTERNS.md +669 -0
- package/skills/security-building-secure-contracts/skills/substrate-vulnerability-scanner/SKILL.md +298 -0
- package/skills/security-building-secure-contracts/skills/substrate-vulnerability-scanner/resources/VULNERABILITY_PATTERNS.md +791 -0
- package/skills/security-building-secure-contracts/skills/token-integration-analyzer/SKILL.md +362 -0
- package/skills/security-building-secure-contracts/skills/token-integration-analyzer/resources/ASSESSMENT_CATEGORIES.md +571 -0
- package/skills/security-building-secure-contracts/skills/token-integration-analyzer/resources/REPORT_TEMPLATES.md +141 -0
- package/skills/security-building-secure-contracts/skills/ton-vulnerability-scanner/SKILL.md +388 -0
- package/skills/security-building-secure-contracts/skills/ton-vulnerability-scanner/resources/VULNERABILITY_PATTERNS.md +595 -0
- package/skills/security-differential-review/.claude-plugin/plugin.json +10 -0
- package/skills/security-differential-review/README.md +109 -0
- package/skills/security-differential-review/SKILL.md +220 -0
- package/skills/security-differential-review/commands/diff-review.md +21 -0
- package/skills/security-differential-review/skills/differential-review/SKILL.md +220 -0
- package/skills/security-differential-review/skills/differential-review/adversarial.md +203 -0
- package/skills/security-differential-review/skills/differential-review/methodology.md +234 -0
- package/skills/security-differential-review/skills/differential-review/patterns.md +300 -0
- package/skills/security-differential-review/skills/differential-review/reporting.md +369 -0
- package/skills/security-entry-point-analyzer/.claude-plugin/plugin.json +10 -0
- package/skills/security-entry-point-analyzer/README.md +74 -0
- package/skills/security-entry-point-analyzer/SKILL.md +251 -0
- package/skills/security-entry-point-analyzer/commands/entry-points.md +18 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/SKILL.md +251 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/cosmwasm.md +182 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/move-aptos.md +107 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/move-sui.md +87 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/solana.md +155 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/solidity.md +135 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/ton.md +185 -0
- package/skills/security-entry-point-analyzer/skills/entry-point-analyzer/references/vyper.md +141 -0
- package/skills/security-fix-review/.claude-plugin/plugin.json +13 -0
- package/skills/security-fix-review/README.md +118 -0
- package/skills/security-fix-review/SKILL.md +264 -0
- package/skills/security-fix-review/commands/fix-review.md +24 -0
- package/skills/security-fix-review/skills/fix-review/SKILL.md +264 -0
- package/skills/security-fix-review/skills/fix-review/references/bug-detection.md +408 -0
- package/skills/security-fix-review/skills/fix-review/references/finding-matching.md +298 -0
- package/skills/security-fix-review/skills/fix-review/references/report-parsing.md +398 -0
- package/skills/security-insecure-defaults/.claude-plugin/plugin.json +10 -0
- package/skills/security-insecure-defaults/README.md +45 -0
- package/skills/security-insecure-defaults/SKILL.md +117 -0
- package/skills/security-insecure-defaults/skills/insecure-defaults/SKILL.md +117 -0
- package/skills/security-insecure-defaults/skills/insecure-defaults/references/examples.md +409 -0
- package/skills/security-modern-python/.claude-plugin/plugin.json +10 -0
- package/skills/security-modern-python/README.md +58 -0
- package/skills/security-modern-python/SKILL.md +333 -0
- package/skills/security-modern-python/hooks/hooks.json +16 -0
- package/skills/security-modern-python/hooks/intercept-legacy-python.bats +388 -0
- package/skills/security-modern-python/hooks/intercept-legacy-python.sh +109 -0
- package/skills/security-modern-python/hooks/test_helper.bash +75 -0
- package/skills/security-modern-python/skills/modern-python/SKILL.md +333 -0
- package/skills/security-modern-python/skills/modern-python/references/dependabot.md +43 -0
- package/skills/security-modern-python/skills/modern-python/references/migration-checklist.md +141 -0
- package/skills/security-modern-python/skills/modern-python/references/pep723-scripts.md +259 -0
- package/skills/security-modern-python/skills/modern-python/references/prek.md +211 -0
- package/skills/security-modern-python/skills/modern-python/references/pyproject.md +254 -0
- package/skills/security-modern-python/skills/modern-python/references/ruff-config.md +240 -0
- package/skills/security-modern-python/skills/modern-python/references/security-setup.md +255 -0
- package/skills/security-modern-python/skills/modern-python/references/testing.md +284 -0
- package/skills/security-modern-python/skills/modern-python/references/uv-commands.md +200 -0
- package/skills/security-modern-python/skills/modern-python/templates/dependabot.yml +36 -0
- package/skills/security-modern-python/skills/modern-python/templates/pre-commit-config.yaml +66 -0
- package/skills/security-property-based-testing/.claude-plugin/plugin.json +9 -0
- package/skills/security-property-based-testing/README.md +47 -0
- package/skills/security-property-based-testing/SKILL.md +109 -0
- package/skills/security-property-based-testing/skills/property-based-testing/README.md +88 -0
- package/skills/security-property-based-testing/skills/property-based-testing/SKILL.md +109 -0
- package/skills/security-property-based-testing/skills/property-based-testing/references/design.md +191 -0
- package/skills/security-property-based-testing/skills/property-based-testing/references/generating.md +200 -0
- package/skills/security-property-based-testing/skills/property-based-testing/references/libraries.md +130 -0
- package/skills/security-property-based-testing/skills/property-based-testing/references/refactoring.md +181 -0
- package/skills/security-property-based-testing/skills/property-based-testing/references/reviewing.md +209 -0
- package/skills/security-property-based-testing/skills/property-based-testing/references/strategies.md +124 -0
- package/skills/semgrep-rule-creator/.claude-plugin/plugin.json +8 -0
- package/skills/semgrep-rule-creator/README.md +43 -0
- package/skills/semgrep-rule-creator/SKILL.md +168 -0
- package/skills/semgrep-rule-creator/commands/semgrep-rule.md +26 -0
- package/skills/semgrep-rule-creator/skills/semgrep-rule-creator/SKILL.md +168 -0
- package/skills/semgrep-rule-creator/skills/semgrep-rule-creator/references/quick-reference.md +203 -0
- package/skills/semgrep-rule-creator/skills/semgrep-rule-creator/references/workflow.md +240 -0
- package/skills/session-logs/SKILL.md +115 -0
- package/skills/sharp-edges/.claude-plugin/plugin.json +10 -0
- package/skills/sharp-edges/README.md +48 -0
- package/skills/sharp-edges/SKILL.md +292 -0
- package/skills/sharp-edges/skills/sharp-edges/SKILL.md +292 -0
- package/skills/sharp-edges/skills/sharp-edges/references/auth-patterns.md +252 -0
- package/skills/sharp-edges/skills/sharp-edges/references/case-studies.md +274 -0
- package/skills/sharp-edges/skills/sharp-edges/references/config-patterns.md +333 -0
- package/skills/sharp-edges/skills/sharp-edges/references/crypto-apis.md +190 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-c.md +205 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-csharp.md +285 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-go.md +270 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-java.md +263 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-javascript.md +269 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-kotlin.md +265 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-php.md +245 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-python.md +274 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-ruby.md +273 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-rust.md +272 -0
- package/skills/sharp-edges/skills/sharp-edges/references/lang-swift.md +287 -0
- package/skills/sharp-edges/skills/sharp-edges/references/language-specific.md +588 -0
- package/skills/sherpa-onnx-tts/SKILL.md +103 -0
- package/skills/sherpa-onnx-tts/bin/sherpa-onnx-tts +178 -0
- package/skills/skill-creator/SKILL.md +370 -0
- package/skills/skill-creator/license.txt +202 -0
- package/skills/skill-creator/scripts/init_skill.py +378 -0
- package/skills/skill-creator/scripts/package_skill.py +111 -0
- package/skills/skill-creator/scripts/quick_validate.py +101 -0
- package/skills/slack/SKILL.md +144 -0
- package/skills/songsee/SKILL.md +49 -0
- package/skills/sonoscli/SKILL.md +46 -0
- package/skills/spec-to-code-compliance/.claude-plugin/plugin.json +10 -0
- package/skills/spec-to-code-compliance/README.md +67 -0
- package/skills/spec-to-code-compliance/SKILL.md +349 -0
- package/skills/spec-to-code-compliance/commands/spec-compliance.md +22 -0
- package/skills/spec-to-code-compliance/skills/spec-to-code-compliance/SKILL.md +349 -0
- package/skills/spec-to-code-compliance/skills/spec-to-code-compliance/resources/COMPLETENESS_CHECKLIST.md +69 -0
- package/skills/spec-to-code-compliance/skills/spec-to-code-compliance/resources/IR_EXAMPLES.md +417 -0
- package/skills/spec-to-code-compliance/skills/spec-to-code-compliance/resources/OUTPUT_REQUIREMENTS.md +105 -0
- package/skills/spotify-player/SKILL.md +64 -0
- package/skills/static-analysis/.claude-plugin/plugin.json +8 -0
- package/skills/static-analysis/README.md +59 -0
- package/skills/static-analysis/SKILL.md +91 -0
- package/skills/static-analysis/skills/codeql/SKILL.md +315 -0
- package/skills/static-analysis/skills/sarif-parsing/SKILL.md +479 -0
- package/skills/static-analysis/skills/sarif-parsing/resources/jq-queries.md +162 -0
- package/skills/static-analysis/skills/sarif-parsing/resources/sarif_helpers.py +331 -0
- package/skills/static-analysis/skills/semgrep/SKILL.md +337 -0
- package/skills/summarize/SKILL.md +87 -0
- package/skills/testing-handbook-skills/.claude-plugin/plugin.json +8 -0
- package/skills/testing-handbook-skills/README.md +241 -0
- package/skills/testing-handbook-skills/SKILL.md +104 -0
- package/skills/testing-handbook-skills/scripts/pyproject.toml +8 -0
- package/skills/testing-handbook-skills/scripts/validate-skills.py +657 -0
- package/skills/testing-handbook-skills/skills/address-sanitizer/SKILL.md +341 -0
- package/skills/testing-handbook-skills/skills/aflpp/SKILL.md +640 -0
- package/skills/testing-handbook-skills/skills/atheris/SKILL.md +515 -0
- package/skills/testing-handbook-skills/skills/cargo-fuzz/SKILL.md +454 -0
- package/skills/testing-handbook-skills/skills/codeql/SKILL.md +549 -0
- package/skills/testing-handbook-skills/skills/constant-time-testing/SKILL.md +507 -0
- package/skills/testing-handbook-skills/skills/coverage-analysis/SKILL.md +607 -0
- package/skills/testing-handbook-skills/skills/fuzzing-dictionary/SKILL.md +297 -0
- package/skills/testing-handbook-skills/skills/fuzzing-obstacles/SKILL.md +426 -0
- package/skills/testing-handbook-skills/skills/harness-writing/SKILL.md +614 -0
- package/skills/testing-handbook-skills/skills/libafl/SKILL.md +625 -0
- package/skills/testing-handbook-skills/skills/libfuzzer/SKILL.md +795 -0
- package/skills/testing-handbook-skills/skills/ossfuzz/SKILL.md +426 -0
- package/skills/testing-handbook-skills/skills/ruzzy/SKILL.md +443 -0
- package/skills/testing-handbook-skills/skills/semgrep/SKILL.md +601 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/SKILL.md +372 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/agent-prompt.md +280 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/discovery.md +452 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/templates/domain-skill.md +504 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/templates/fuzzer-skill.md +454 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/templates/technique-skill.md +527 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/templates/tool-skill.md +366 -0
- package/skills/testing-handbook-skills/skills/testing-handbook-generator/testing.md +482 -0
- package/skills/testing-handbook-skills/skills/wycheproof/SKILL.md +533 -0
- package/skills/things-mac/SKILL.md +86 -0
- package/skills/tmux/SKILL.md +135 -0
- package/skills/tmux/scripts/find-sessions.sh +112 -0
- package/skills/tmux/scripts/wait-for-text.sh +83 -0
- package/skills/trello/SKILL.md +95 -0
- package/skills/variant-analysis/.claude-plugin/plugin.json +8 -0
- package/skills/variant-analysis/README.md +41 -0
- package/skills/variant-analysis/SKILL.md +142 -0
- package/skills/variant-analysis/commands/variants.md +23 -0
- package/skills/variant-analysis/skills/variant-analysis/METHODOLOGY.md +327 -0
- package/skills/variant-analysis/skills/variant-analysis/SKILL.md +142 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/codeql/cpp.ql +119 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/codeql/go.ql +69 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/codeql/java.ql +71 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/codeql/javascript.ql +63 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/codeql/python.ql +80 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/semgrep/cpp.yaml +98 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/semgrep/go.yaml +63 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/semgrep/java.yaml +61 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/semgrep/javascript.yaml +60 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/semgrep/python.yaml +72 -0
- package/skills/variant-analysis/skills/variant-analysis/resources/variant-report-template.md +75 -0
- package/skills/video-frames/SKILL.md +46 -0
- package/skills/video-frames/scripts/frame.sh +81 -0
- package/skills/voice-call/SKILL.md +45 -0
- package/skills/wacli/SKILL.md +72 -0
- package/skills/weather/SKILL.md +54 -0
package/dist/loader.js
ADDED
|
@@ -0,0 +1,362 @@
|
|
|
1
|
+
import { existsSync, readdirSync, readFileSync, realpathSync, statSync, } from "node:fs";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { basename, dirname, isAbsolute, join, resolve, sep } from "node:path";
|
|
4
|
+
import { parseFrontmatter, resolveSkillInvocationPolicy, resolveSkillMetadata, } from "./frontmatter.js";
|
|
5
|
+
import { getSkillsDir } from "./resolver.js";
|
|
6
|
+
/** Maximum skill name length per Agent Skills spec */
|
|
7
|
+
const MAX_NAME_LENGTH = 64;
|
|
8
|
+
/** Maximum description length per Agent Skills spec */
|
|
9
|
+
const MAX_DESCRIPTION_LENGTH = 1024;
|
|
10
|
+
/** Default config directory name */
|
|
11
|
+
const CONFIG_DIR_NAME = ".elizaos";
|
|
12
|
+
/** Default agent directory for user skills */
|
|
13
|
+
const DEFAULT_AGENT_DIR = join(homedir(), CONFIG_DIR_NAME);
|
|
14
|
+
/**
|
|
15
|
+
* Validate skill name per Agent Skills spec.
|
|
16
|
+
* Returns array of validation error messages (empty if valid).
|
|
17
|
+
*
|
|
18
|
+
* @param name - The skill name to validate
|
|
19
|
+
* @param parentDirName - The parent directory name (should match)
|
|
20
|
+
* @returns Array of validation error messages
|
|
21
|
+
*/
|
|
22
|
+
function validateName(name, parentDirName) {
|
|
23
|
+
const errors = [];
|
|
24
|
+
if (name !== parentDirName) {
|
|
25
|
+
errors.push(`name "${name}" does not match parent directory "${parentDirName}"`);
|
|
26
|
+
}
|
|
27
|
+
if (name.length > MAX_NAME_LENGTH) {
|
|
28
|
+
errors.push(`name exceeds ${MAX_NAME_LENGTH} characters (${name.length})`);
|
|
29
|
+
}
|
|
30
|
+
if (!/^[a-z0-9-]+$/.test(name)) {
|
|
31
|
+
errors.push(`name contains invalid characters (must be lowercase a-z, 0-9, hyphens only)`);
|
|
32
|
+
}
|
|
33
|
+
if (name.startsWith("-") || name.endsWith("-")) {
|
|
34
|
+
errors.push(`name must not start or end with a hyphen`);
|
|
35
|
+
}
|
|
36
|
+
if (name.includes("--")) {
|
|
37
|
+
errors.push(`name must not contain consecutive hyphens`);
|
|
38
|
+
}
|
|
39
|
+
return errors;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Validate description per Agent Skills spec.
|
|
43
|
+
*
|
|
44
|
+
* @param description - The skill description to validate
|
|
45
|
+
* @returns Array of validation error messages
|
|
46
|
+
*/
|
|
47
|
+
function validateDescription(description) {
|
|
48
|
+
const errors = [];
|
|
49
|
+
if (!description || description.trim() === "") {
|
|
50
|
+
errors.push("description is required");
|
|
51
|
+
}
|
|
52
|
+
else if (description.length > MAX_DESCRIPTION_LENGTH) {
|
|
53
|
+
errors.push(`description exceeds ${MAX_DESCRIPTION_LENGTH} characters (${description.length})`);
|
|
54
|
+
}
|
|
55
|
+
return errors;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Load a single skill from a SKILL.md file
|
|
59
|
+
*
|
|
60
|
+
* @param filePath - Absolute path to the SKILL.md file
|
|
61
|
+
* @param source - Source identifier for this skill
|
|
62
|
+
* @returns Loaded skill and diagnostics
|
|
63
|
+
*/
|
|
64
|
+
function loadSkillFromFile(filePath, source) {
|
|
65
|
+
const diagnostics = [];
|
|
66
|
+
const rawContent = readFileSync(filePath, "utf-8");
|
|
67
|
+
const { frontmatter } = parseFrontmatter(rawContent);
|
|
68
|
+
const skillDir = dirname(filePath);
|
|
69
|
+
const parentDirName = basename(skillDir);
|
|
70
|
+
// Validate description
|
|
71
|
+
const descErrors = validateDescription(frontmatter.description);
|
|
72
|
+
for (const error of descErrors) {
|
|
73
|
+
diagnostics.push({ type: "warning", message: error, path: filePath });
|
|
74
|
+
}
|
|
75
|
+
// Use name from frontmatter, or fall back to parent directory name
|
|
76
|
+
const name = frontmatter.name || parentDirName;
|
|
77
|
+
// Validate name
|
|
78
|
+
const nameErrors = validateName(name, parentDirName);
|
|
79
|
+
for (const error of nameErrors) {
|
|
80
|
+
diagnostics.push({ type: "warning", message: error, path: filePath });
|
|
81
|
+
}
|
|
82
|
+
// Don't load the skill if description is completely missing
|
|
83
|
+
if (!frontmatter.description || frontmatter.description.trim() === "") {
|
|
84
|
+
return { skill: null, diagnostics };
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
skill: {
|
|
88
|
+
name,
|
|
89
|
+
description: frontmatter.description,
|
|
90
|
+
filePath,
|
|
91
|
+
baseDir: skillDir,
|
|
92
|
+
source,
|
|
93
|
+
disableModelInvocation: frontmatter["disable-model-invocation"] === true,
|
|
94
|
+
},
|
|
95
|
+
diagnostics,
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Internal recursive skill loader
|
|
100
|
+
*
|
|
101
|
+
* @param dir - Directory to scan
|
|
102
|
+
* @param source - Source identifier
|
|
103
|
+
* @param includeRootFiles - Whether to include .md files at root level
|
|
104
|
+
* @returns Loaded skills and diagnostics
|
|
105
|
+
*/
|
|
106
|
+
function loadSkillsFromDirInternal(dir, source, includeRootFiles) {
|
|
107
|
+
const skills = [];
|
|
108
|
+
const diagnostics = [];
|
|
109
|
+
if (!existsSync(dir)) {
|
|
110
|
+
return { skills, diagnostics };
|
|
111
|
+
}
|
|
112
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
113
|
+
for (const entry of entries) {
|
|
114
|
+
// Skip hidden files and directories
|
|
115
|
+
if (entry.name.startsWith(".")) {
|
|
116
|
+
continue;
|
|
117
|
+
}
|
|
118
|
+
// Skip node_modules to avoid scanning dependencies
|
|
119
|
+
if (entry.name === "node_modules") {
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
const fullPath = join(dir, entry.name);
|
|
123
|
+
// For symlinks, check if they point to a directory and follow them
|
|
124
|
+
let isDirectory = entry.isDirectory();
|
|
125
|
+
let isFile = entry.isFile();
|
|
126
|
+
if (entry.isSymbolicLink()) {
|
|
127
|
+
const stats = statSync(fullPath);
|
|
128
|
+
isDirectory = stats.isDirectory();
|
|
129
|
+
isFile = stats.isFile();
|
|
130
|
+
}
|
|
131
|
+
if (isDirectory) {
|
|
132
|
+
const subResult = loadSkillsFromDirInternal(fullPath, source, false);
|
|
133
|
+
skills.push(...subResult.skills);
|
|
134
|
+
diagnostics.push(...subResult.diagnostics);
|
|
135
|
+
continue;
|
|
136
|
+
}
|
|
137
|
+
if (!isFile) {
|
|
138
|
+
continue;
|
|
139
|
+
}
|
|
140
|
+
const isRootMd = includeRootFiles && entry.name.endsWith(".md");
|
|
141
|
+
const isSkillMd = !includeRootFiles && entry.name === "SKILL.md";
|
|
142
|
+
if (!isRootMd && !isSkillMd) {
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
const result = loadSkillFromFile(fullPath, source);
|
|
146
|
+
if (result.skill) {
|
|
147
|
+
skills.push(result.skill);
|
|
148
|
+
}
|
|
149
|
+
diagnostics.push(...result.diagnostics);
|
|
150
|
+
}
|
|
151
|
+
return { skills, diagnostics };
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Load skills from a single directory.
|
|
155
|
+
*
|
|
156
|
+
* Discovery rules:
|
|
157
|
+
* - Direct .md children in the root
|
|
158
|
+
* - Recursive SKILL.md under subdirectories
|
|
159
|
+
*
|
|
160
|
+
* @param options - Loading options
|
|
161
|
+
* @returns Loaded skills and diagnostics
|
|
162
|
+
*/
|
|
163
|
+
export function loadSkillsFromDir(options) {
|
|
164
|
+
const { dir, source } = options;
|
|
165
|
+
return loadSkillsFromDirInternal(dir, source, true);
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Normalize a path, expanding ~ to home directory
|
|
169
|
+
*
|
|
170
|
+
* @param input - Path that may contain ~
|
|
171
|
+
* @returns Normalized absolute path
|
|
172
|
+
*/
|
|
173
|
+
function normalizePath(input) {
|
|
174
|
+
const trimmed = input.trim();
|
|
175
|
+
if (trimmed === "~")
|
|
176
|
+
return homedir();
|
|
177
|
+
if (trimmed.startsWith("~/"))
|
|
178
|
+
return join(homedir(), trimmed.slice(2));
|
|
179
|
+
if (trimmed.startsWith("~"))
|
|
180
|
+
return join(homedir(), trimmed.slice(1));
|
|
181
|
+
return trimmed;
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Resolve a skill path relative to cwd
|
|
185
|
+
*
|
|
186
|
+
* @param p - Path to resolve
|
|
187
|
+
* @param cwd - Current working directory
|
|
188
|
+
* @returns Absolute path
|
|
189
|
+
*/
|
|
190
|
+
function resolveSkillPath(p, cwd) {
|
|
191
|
+
const normalized = normalizePath(p);
|
|
192
|
+
return isAbsolute(normalized) ? normalized : resolve(cwd, normalized);
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Check if a target path is under a root path
|
|
196
|
+
*
|
|
197
|
+
* @param target - Path to check
|
|
198
|
+
* @param root - Root path
|
|
199
|
+
* @returns True if target is under root
|
|
200
|
+
*/
|
|
201
|
+
function isUnderPath(target, root) {
|
|
202
|
+
const normalizedRoot = resolve(root);
|
|
203
|
+
if (target === normalizedRoot) {
|
|
204
|
+
return true;
|
|
205
|
+
}
|
|
206
|
+
const prefix = normalizedRoot.endsWith(sep)
|
|
207
|
+
? normalizedRoot
|
|
208
|
+
: `${normalizedRoot}${sep}`;
|
|
209
|
+
return target.startsWith(prefix);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Load skills from all configured locations.
|
|
213
|
+
*
|
|
214
|
+
* Sources are loaded in precedence order (later sources override earlier):
|
|
215
|
+
* 1. Bundled skills (from this package)
|
|
216
|
+
* 2. User/managed skills (~/.elizaos/skills)
|
|
217
|
+
* 3. Project skills (<cwd>/.elizaos/skills)
|
|
218
|
+
* 4. Explicit skill paths
|
|
219
|
+
*
|
|
220
|
+
* @param options - Loading options
|
|
221
|
+
* @returns Loaded skills and diagnostics
|
|
222
|
+
*/
|
|
223
|
+
export function loadSkills(options = {}) {
|
|
224
|
+
const { cwd = process.cwd(), agentDir, skillPaths = [], includeDefaults = true, bundledSkillsDir, managedSkillsDir, } = options;
|
|
225
|
+
// Resolve directories
|
|
226
|
+
const resolvedAgentDir = agentDir ?? DEFAULT_AGENT_DIR;
|
|
227
|
+
const resolvedBundledDir = bundledSkillsDir ?? getSkillsDir();
|
|
228
|
+
const resolvedManagedDir = managedSkillsDir ?? join(resolvedAgentDir, "skills");
|
|
229
|
+
const projectSkillsDir = resolve(cwd, CONFIG_DIR_NAME, "skills");
|
|
230
|
+
const userSkillsDir = join(resolvedAgentDir, "skills");
|
|
231
|
+
const skillMap = new Map();
|
|
232
|
+
const realPathSet = new Set();
|
|
233
|
+
const allDiagnostics = [];
|
|
234
|
+
const collisionDiagnostics = [];
|
|
235
|
+
function addSkills(result) {
|
|
236
|
+
allDiagnostics.push(...result.diagnostics);
|
|
237
|
+
for (const skill of result.skills) {
|
|
238
|
+
// Skip skills without file paths (inline skills) - they can't be deduplicated
|
|
239
|
+
if (!skill.filePath) {
|
|
240
|
+
const existing = skillMap.get(skill.name);
|
|
241
|
+
if (!existing) {
|
|
242
|
+
skillMap.set(skill.name, skill);
|
|
243
|
+
}
|
|
244
|
+
continue;
|
|
245
|
+
}
|
|
246
|
+
// Resolve symlinks to detect duplicate files
|
|
247
|
+
let realPath;
|
|
248
|
+
try {
|
|
249
|
+
realPath = realpathSync(skill.filePath);
|
|
250
|
+
}
|
|
251
|
+
catch {
|
|
252
|
+
realPath = skill.filePath;
|
|
253
|
+
}
|
|
254
|
+
// Skip silently if we've already loaded this exact file (via symlink)
|
|
255
|
+
if (realPathSet.has(realPath)) {
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
const existing = skillMap.get(skill.name);
|
|
259
|
+
if (existing) {
|
|
260
|
+
collisionDiagnostics.push({
|
|
261
|
+
type: "collision",
|
|
262
|
+
message: `name "${skill.name}" collision`,
|
|
263
|
+
path: skill.filePath,
|
|
264
|
+
collision: {
|
|
265
|
+
resourceType: "skill",
|
|
266
|
+
name: skill.name,
|
|
267
|
+
winnerPath: existing.filePath ?? "(inline)",
|
|
268
|
+
loserPath: skill.filePath,
|
|
269
|
+
},
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
else {
|
|
273
|
+
skillMap.set(skill.name, skill);
|
|
274
|
+
realPathSet.add(realPath);
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (includeDefaults) {
|
|
279
|
+
// Load in precedence order: bundled < managed < project
|
|
280
|
+
if (resolvedBundledDir) {
|
|
281
|
+
addSkills(loadSkillsFromDirInternal(resolvedBundledDir, "bundled", true));
|
|
282
|
+
}
|
|
283
|
+
addSkills(loadSkillsFromDirInternal(resolvedManagedDir, "managed", true));
|
|
284
|
+
addSkills(loadSkillsFromDirInternal(projectSkillsDir, "project", true));
|
|
285
|
+
}
|
|
286
|
+
// Determine source for explicit paths
|
|
287
|
+
const getSource = (resolvedPath) => {
|
|
288
|
+
if (!includeDefaults) {
|
|
289
|
+
if (isUnderPath(resolvedPath, userSkillsDir))
|
|
290
|
+
return "user";
|
|
291
|
+
if (isUnderPath(resolvedPath, projectSkillsDir))
|
|
292
|
+
return "project";
|
|
293
|
+
}
|
|
294
|
+
return "path";
|
|
295
|
+
};
|
|
296
|
+
// Load explicit skill paths
|
|
297
|
+
for (const rawPath of skillPaths) {
|
|
298
|
+
const resolvedPath = resolveSkillPath(rawPath, cwd);
|
|
299
|
+
if (!existsSync(resolvedPath)) {
|
|
300
|
+
allDiagnostics.push({
|
|
301
|
+
type: "warning",
|
|
302
|
+
message: "skill path does not exist",
|
|
303
|
+
path: resolvedPath,
|
|
304
|
+
});
|
|
305
|
+
continue;
|
|
306
|
+
}
|
|
307
|
+
const stats = statSync(resolvedPath);
|
|
308
|
+
const source = getSource(resolvedPath);
|
|
309
|
+
if (stats.isDirectory()) {
|
|
310
|
+
addSkills(loadSkillsFromDirInternal(resolvedPath, source, true));
|
|
311
|
+
}
|
|
312
|
+
else if (stats.isFile() && resolvedPath.endsWith(".md")) {
|
|
313
|
+
const result = loadSkillFromFile(resolvedPath, source);
|
|
314
|
+
if (result.skill) {
|
|
315
|
+
addSkills({ skills: [result.skill], diagnostics: result.diagnostics });
|
|
316
|
+
}
|
|
317
|
+
else {
|
|
318
|
+
allDiagnostics.push(...result.diagnostics);
|
|
319
|
+
}
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
allDiagnostics.push({
|
|
323
|
+
type: "warning",
|
|
324
|
+
message: "skill path is not a markdown file",
|
|
325
|
+
path: resolvedPath,
|
|
326
|
+
});
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
return {
|
|
330
|
+
skills: Array.from(skillMap.values()),
|
|
331
|
+
diagnostics: [...allDiagnostics, ...collisionDiagnostics],
|
|
332
|
+
};
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* Load skill entries with full metadata parsing
|
|
336
|
+
*
|
|
337
|
+
* @param options - Loading options
|
|
338
|
+
* @returns Skill entries with parsed metadata
|
|
339
|
+
*/
|
|
340
|
+
export function loadSkillEntries(options = {}) {
|
|
341
|
+
const { skills } = loadSkills(options);
|
|
342
|
+
return skills.map((skill) => {
|
|
343
|
+
let frontmatter = {};
|
|
344
|
+
// Only parse frontmatter for file-based skills
|
|
345
|
+
if (skill.filePath) {
|
|
346
|
+
try {
|
|
347
|
+
const raw = readFileSync(skill.filePath, "utf-8");
|
|
348
|
+
const parsed = parseFrontmatter(raw);
|
|
349
|
+
frontmatter = parsed.frontmatter;
|
|
350
|
+
}
|
|
351
|
+
catch {
|
|
352
|
+
// Use empty frontmatter if parsing fails
|
|
353
|
+
}
|
|
354
|
+
}
|
|
355
|
+
return {
|
|
356
|
+
skill,
|
|
357
|
+
frontmatter,
|
|
358
|
+
metadata: resolveSkillMetadata(frontmatter),
|
|
359
|
+
invocation: resolveSkillInvocationPolicy(frontmatter),
|
|
360
|
+
};
|
|
361
|
+
});
|
|
362
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the absolute path to the bundled skills directory.
|
|
3
|
+
*
|
|
4
|
+
* Resolution order:
|
|
5
|
+
* 1. ELIZAOS_BUNDLED_SKILLS_DIR environment variable
|
|
6
|
+
* 2. Sibling `skills/` next to the executable (for compiled binaries)
|
|
7
|
+
* 3. Package's own `skills/` directory (relative to this module)
|
|
8
|
+
*
|
|
9
|
+
* @returns Absolute path to the skills directory
|
|
10
|
+
* @throws Error if skills directory cannot be found
|
|
11
|
+
*/
|
|
12
|
+
export declare function getSkillsDir(): string;
|
|
13
|
+
/**
|
|
14
|
+
* Clear the cached skills directory path.
|
|
15
|
+
* Useful for testing or when the directory may have changed.
|
|
16
|
+
*/
|
|
17
|
+
export declare function clearSkillsDirCache(): void;
|
|
18
|
+
//# sourceMappingURL=resolver.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolver.d.ts","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAwCA;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,IAAI,MAAM,CA6CrC;AAED;;;GAGG;AACH,wBAAgB,mBAAmB,IAAI,IAAI,CAE1C"}
|
package/dist/resolver.js
ADDED
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { existsSync, readdirSync } from "node:fs";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { fileURLToPath } from "node:url";
|
|
4
|
+
/**
|
|
5
|
+
* Cached skills directory path
|
|
6
|
+
*/
|
|
7
|
+
let cachedSkillsDir;
|
|
8
|
+
/**
|
|
9
|
+
* Check if a directory looks like a skills directory
|
|
10
|
+
* (contains subdirectories with SKILL.md files or .md files directly)
|
|
11
|
+
*
|
|
12
|
+
* @param dir - Directory to check
|
|
13
|
+
* @returns True if directory appears to contain skills
|
|
14
|
+
*/
|
|
15
|
+
function looksLikeSkillsDir(dir) {
|
|
16
|
+
if (!existsSync(dir)) {
|
|
17
|
+
return false;
|
|
18
|
+
}
|
|
19
|
+
const entries = readdirSync(dir, { withFileTypes: true });
|
|
20
|
+
for (const entry of entries) {
|
|
21
|
+
if (entry.name.startsWith(".")) {
|
|
22
|
+
continue;
|
|
23
|
+
}
|
|
24
|
+
const fullPath = join(dir, entry.name);
|
|
25
|
+
if (entry.isFile() && entry.name.endsWith(".md")) {
|
|
26
|
+
return true;
|
|
27
|
+
}
|
|
28
|
+
if (entry.isDirectory()) {
|
|
29
|
+
if (existsSync(join(fullPath, "SKILL.md"))) {
|
|
30
|
+
return true;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
return false;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Get the absolute path to the bundled skills directory.
|
|
38
|
+
*
|
|
39
|
+
* Resolution order:
|
|
40
|
+
* 1. ELIZAOS_BUNDLED_SKILLS_DIR environment variable
|
|
41
|
+
* 2. Sibling `skills/` next to the executable (for compiled binaries)
|
|
42
|
+
* 3. Package's own `skills/` directory (relative to this module)
|
|
43
|
+
*
|
|
44
|
+
* @returns Absolute path to the skills directory
|
|
45
|
+
* @throws Error if skills directory cannot be found
|
|
46
|
+
*/
|
|
47
|
+
export function getSkillsDir() {
|
|
48
|
+
// Return cached value if available
|
|
49
|
+
if (cachedSkillsDir !== undefined) {
|
|
50
|
+
return cachedSkillsDir;
|
|
51
|
+
}
|
|
52
|
+
// Check environment variable override
|
|
53
|
+
const override = process.env.ELIZAOS_BUNDLED_SKILLS_DIR?.trim();
|
|
54
|
+
if (override && existsSync(override)) {
|
|
55
|
+
cachedSkillsDir = override;
|
|
56
|
+
return cachedSkillsDir;
|
|
57
|
+
}
|
|
58
|
+
// For compiled binaries: check sibling skills/ next to executable
|
|
59
|
+
const execDir = dirname(process.execPath);
|
|
60
|
+
const siblingSkills = join(execDir, "skills");
|
|
61
|
+
if (looksLikeSkillsDir(siblingSkills)) {
|
|
62
|
+
cachedSkillsDir = siblingSkills;
|
|
63
|
+
return cachedSkillsDir;
|
|
64
|
+
}
|
|
65
|
+
// Resolve relative to this module (packages/skills/dist/resolver.js -> packages/skills/skills)
|
|
66
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
67
|
+
const __dirname = dirname(__filename);
|
|
68
|
+
// In development: packages/skills/src/resolver.ts -> packages/skills/skills
|
|
69
|
+
// In production: packages/skills/dist/resolver.js -> packages/skills/skills
|
|
70
|
+
const packageRoot = dirname(__dirname); // Go up from src/ or dist/
|
|
71
|
+
const packageSkills = join(packageRoot, "skills");
|
|
72
|
+
if (looksLikeSkillsDir(packageSkills)) {
|
|
73
|
+
cachedSkillsDir = packageSkills;
|
|
74
|
+
return cachedSkillsDir;
|
|
75
|
+
}
|
|
76
|
+
// Also check one more level up in case we're in a nested dist structure
|
|
77
|
+
const parentPackageSkills = join(dirname(packageRoot), "skills");
|
|
78
|
+
if (looksLikeSkillsDir(parentPackageSkills)) {
|
|
79
|
+
cachedSkillsDir = parentPackageSkills;
|
|
80
|
+
return cachedSkillsDir;
|
|
81
|
+
}
|
|
82
|
+
throw new Error("Could not find bundled skills directory. Set ELIZAOS_BUNDLED_SKILLS_DIR environment variable or ensure skills/ directory exists in package.");
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Clear the cached skills directory path.
|
|
86
|
+
* Useful for testing or when the directory may have changed.
|
|
87
|
+
*/
|
|
88
|
+
export function clearSkillsDirCache() {
|
|
89
|
+
cachedSkillsDir = undefined;
|
|
90
|
+
}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill frontmatter parsed from SKILL.md YAML header
|
|
3
|
+
*/
|
|
4
|
+
export interface SkillFrontmatter {
|
|
5
|
+
/** Skill name (should match parent directory name) */
|
|
6
|
+
name?: string;
|
|
7
|
+
/** Human-readable description of what the skill does */
|
|
8
|
+
description?: string;
|
|
9
|
+
/** If true, skill won't be included in model prompts (command-only) */
|
|
10
|
+
"disable-model-invocation"?: boolean;
|
|
11
|
+
/** Required operating systems (e.g., ["macos", "linux"]) */
|
|
12
|
+
"required-os"?: string[];
|
|
13
|
+
/** Required binaries that must be available in PATH */
|
|
14
|
+
"required-bins"?: string[];
|
|
15
|
+
/** Required environment variables */
|
|
16
|
+
"required-env"?: string[];
|
|
17
|
+
/** Primary environment for the skill (e.g., "node", "python") */
|
|
18
|
+
"primary-env"?: string;
|
|
19
|
+
/** Command dispatch mode */
|
|
20
|
+
"command-dispatch"?: string;
|
|
21
|
+
/** Command dispatch mode (underscore variant) */
|
|
22
|
+
command_dispatch?: string;
|
|
23
|
+
/** Tool name for command dispatch */
|
|
24
|
+
"command-tool"?: string;
|
|
25
|
+
/** Tool name for command dispatch (underscore variant) */
|
|
26
|
+
command_tool?: string;
|
|
27
|
+
/** Argument mode for command dispatch */
|
|
28
|
+
"command-arg-mode"?: string;
|
|
29
|
+
/** Whether skill can be invoked by users via commands */
|
|
30
|
+
"user-invocable"?: boolean;
|
|
31
|
+
/** Additional arbitrary metadata */
|
|
32
|
+
[key: string]: unknown;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Loaded skill with parsed metadata.
|
|
36
|
+
*
|
|
37
|
+
* Core fields (filePath, baseDir, source, disableModelInvocation) are for file-based skills.
|
|
38
|
+
* Optional runtime fields (instructions, actions, providers, tools, etc.) support inline definitions.
|
|
39
|
+
*/
|
|
40
|
+
export interface Skill {
|
|
41
|
+
/** Skill name (from frontmatter or directory name) */
|
|
42
|
+
name: string;
|
|
43
|
+
/** Human-readable description */
|
|
44
|
+
description: string;
|
|
45
|
+
/** Absolute path to the SKILL.md file (optional for inline skills) */
|
|
46
|
+
filePath?: string;
|
|
47
|
+
/** Absolute path to the skill's base directory (optional for inline skills) */
|
|
48
|
+
baseDir?: string;
|
|
49
|
+
/** Source identifier (e.g., "bundled", "workspace", "managed", "inline") */
|
|
50
|
+
source?: string;
|
|
51
|
+
/** If true, skill won't be included in model prompts */
|
|
52
|
+
disableModelInvocation?: boolean;
|
|
53
|
+
/** Unique slug identifier for the skill */
|
|
54
|
+
slug?: string;
|
|
55
|
+
/** Skill version */
|
|
56
|
+
version?: string;
|
|
57
|
+
/** Skill instructions/content */
|
|
58
|
+
instructions?: string;
|
|
59
|
+
/** System prompt for the skill */
|
|
60
|
+
systemPrompt?: string;
|
|
61
|
+
/** Example usages */
|
|
62
|
+
examples?: string[];
|
|
63
|
+
/** Whether the skill is enabled */
|
|
64
|
+
enabled?: boolean;
|
|
65
|
+
/** Actions the skill provides */
|
|
66
|
+
actions?: SkillActionDefinition[];
|
|
67
|
+
/** Providers the skill provides */
|
|
68
|
+
providers?: SkillProviderDefinition[];
|
|
69
|
+
/** Tools available to the skill */
|
|
70
|
+
tools?: SkillToolDefinition[];
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Skill action definition for inline skills
|
|
74
|
+
*/
|
|
75
|
+
export interface SkillActionDefinition {
|
|
76
|
+
name: string;
|
|
77
|
+
description: string;
|
|
78
|
+
handler: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Skill provider definition for inline skills
|
|
82
|
+
*/
|
|
83
|
+
export interface SkillProviderDefinition {
|
|
84
|
+
name: string;
|
|
85
|
+
description: string;
|
|
86
|
+
get: string;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Skill tool definition for inline skills (generic, specific implementations can extend)
|
|
90
|
+
*/
|
|
91
|
+
export interface SkillToolDefinition {
|
|
92
|
+
name: string;
|
|
93
|
+
description?: string;
|
|
94
|
+
[key: string]: unknown;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Diagnostic information from skill loading
|
|
98
|
+
*/
|
|
99
|
+
export interface SkillDiagnostic {
|
|
100
|
+
/** Diagnostic type */
|
|
101
|
+
type: "warning" | "error" | "collision";
|
|
102
|
+
/** Human-readable message */
|
|
103
|
+
message: string;
|
|
104
|
+
/** Path to the file that generated this diagnostic */
|
|
105
|
+
path: string;
|
|
106
|
+
/** Collision details (only for type="collision") */
|
|
107
|
+
collision?: {
|
|
108
|
+
resourceType: "skill";
|
|
109
|
+
name: string;
|
|
110
|
+
winnerPath: string;
|
|
111
|
+
loserPath: string;
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Result from loading skills from a directory
|
|
116
|
+
*/
|
|
117
|
+
export interface LoadSkillsResult {
|
|
118
|
+
/** Successfully loaded skills */
|
|
119
|
+
skills: Skill[];
|
|
120
|
+
/** Diagnostics from loading process */
|
|
121
|
+
diagnostics: SkillDiagnostic[];
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Options for loadSkillsFromDir
|
|
125
|
+
*/
|
|
126
|
+
export interface LoadSkillsFromDirOptions {
|
|
127
|
+
/** Directory to scan for skills */
|
|
128
|
+
dir: string;
|
|
129
|
+
/** Source identifier for these skills */
|
|
130
|
+
source: string;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* Options for loadSkills (multi-directory loading)
|
|
134
|
+
*/
|
|
135
|
+
export interface LoadSkillsOptions {
|
|
136
|
+
/** Working directory for project-local skills. Default: process.cwd() */
|
|
137
|
+
cwd?: string;
|
|
138
|
+
/** Agent config directory for global skills */
|
|
139
|
+
agentDir?: string;
|
|
140
|
+
/** Explicit skill paths (files or directories) */
|
|
141
|
+
skillPaths?: string[];
|
|
142
|
+
/** Include default skills directories. Default: true */
|
|
143
|
+
includeDefaults?: boolean;
|
|
144
|
+
/** Path to bundled skills directory. Default: package's skills/ */
|
|
145
|
+
bundledSkillsDir?: string;
|
|
146
|
+
/** Path to managed skills directory. Default: ~/.elizaos/skills */
|
|
147
|
+
managedSkillsDir?: string;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Parsed skill entry with frontmatter and metadata
|
|
151
|
+
*/
|
|
152
|
+
export interface SkillEntry {
|
|
153
|
+
/** The loaded skill */
|
|
154
|
+
skill: Skill;
|
|
155
|
+
/** Raw parsed frontmatter */
|
|
156
|
+
frontmatter: SkillFrontmatter;
|
|
157
|
+
/** Resolved Otto-specific metadata */
|
|
158
|
+
metadata: SkillMetadata;
|
|
159
|
+
/** Invocation policy */
|
|
160
|
+
invocation: SkillInvocationPolicy;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Otto-specific skill metadata
|
|
164
|
+
*/
|
|
165
|
+
export interface SkillMetadata {
|
|
166
|
+
/** Primary environment (node, python, etc.) */
|
|
167
|
+
primaryEnv?: string;
|
|
168
|
+
/** Required operating systems */
|
|
169
|
+
requiredOs?: string[];
|
|
170
|
+
/** Required binaries */
|
|
171
|
+
requiredBins?: string[];
|
|
172
|
+
/** Required environment variables */
|
|
173
|
+
requiredEnv?: string[];
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Skill invocation policy
|
|
177
|
+
*/
|
|
178
|
+
export interface SkillInvocationPolicy {
|
|
179
|
+
/** If true, skill won't be included in model prompts */
|
|
180
|
+
disableModelInvocation?: boolean;
|
|
181
|
+
/** If false, skill cannot be invoked via user commands */
|
|
182
|
+
userInvocable?: boolean;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Skill command specification for chat commands
|
|
186
|
+
*/
|
|
187
|
+
export interface SkillCommandSpec {
|
|
188
|
+
/** Command name (sanitized, unique) */
|
|
189
|
+
name: string;
|
|
190
|
+
/** Original skill name */
|
|
191
|
+
skillName: string;
|
|
192
|
+
/** Command description */
|
|
193
|
+
description: string;
|
|
194
|
+
/** Optional dispatch configuration */
|
|
195
|
+
dispatch?: {
|
|
196
|
+
kind: "tool";
|
|
197
|
+
toolName: string;
|
|
198
|
+
argMode: "raw";
|
|
199
|
+
};
|
|
200
|
+
}
|
|
201
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"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"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|