Publish Agent Skills discovery metadata
This commit is contained in:
1 parent
8799cee0ca
commit
3d7254aaf0
7 files changed
+193
-4
No files matched your search
@@ -0,0 +1,31 @@
|
||||
'use strict';
|
||||
|
||||
const assert = require('node:assert/strict');
|
||||
const crypto = require('node:crypto');
|
||||
const fs = require('node:fs');
|
||||
const os = require('node:os');
|
||||
const path = require('node:path');
|
||||
const { execFileSync } = require('node:child_process');
|
||||
const test = require('node:test');
|
||||
|
||||
test('builds a valid discovery index matching the published skill', () => {
|
||||
const root = path.resolve(__dirname, '..');
|
||||
const output = fs.mkdtempSync(path.join(os.tmpdir(), 'crypstie-discovery-'));
|
||||
|
||||
try {
|
||||
execFileSync(process.execPath, [path.join(root, 'scripts', 'build-skill-discovery.js'), output]);
|
||||
const skill = fs.readFileSync(path.join(output, 'crypstie', 'SKILL.md'));
|
||||
const index = JSON.parse(fs.readFileSync(path.join(output, 'index.json'), 'utf8'));
|
||||
const expectedDigest = crypto.createHash('sha256').update(skill).digest('hex');
|
||||
|
||||
assert.equal(index.$schema, 'https://schemas.agentskills.io/discovery/0.2.0/schema.json');
|
||||
assert.equal(index.skills.length, 1);
|
||||
assert.equal(index.skills[0].name, 'crypstie');
|
||||
assert.equal(index.skills[0].type, 'skill-md');
|
||||
assert.equal(index.skills[0].url, '/.well-known/agent-skills/crypstie/SKILL.md');
|
||||
assert.equal(index.skills[0].digest, `sha256:${expectedDigest}`);
|
||||
assert.match(fs.readFileSync(path.join(output, 'llms.txt'), 'utf8'), /crypstie on npm/);
|
||||
} finally {
|
||||
fs.rmSync(output, { recursive: true, force: true });
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user