Pair every guidance page with Markdown and enable shared document references
PROMPT Docker CI and deployment / verify-and-deploy (push) Successful in 16m58s
PROMPT Docker CI and deployment / verify-and-deploy (push) Successful in 16m58s
This commit is contained in:
@@ -7,7 +7,7 @@ test('human and agent documents share a complete linked resource registry',()=>{
|
||||
for(const doc of skillDocuments)assert.ok(skillResources.some(r=>r.id===doc.id&&r.human&&r.href.endsWith('.md')));
|
||||
});
|
||||
|
||||
test('each registered skill resolves its own entry, documents and API resources without leaking another skill',()=>{
|
||||
test('original collections retain their authored documents and API resources',()=>{
|
||||
for(const card of skillCatalog){
|
||||
const skill=getSkill(card.id)!;assert.ok(skill);assert.equal(skill.id,card.id);
|
||||
assert.equal(new Set(skill.resources.map(r=>r.id)).size,skill.resources.length);
|
||||
@@ -23,6 +23,37 @@ test('each registered skill resolves its own entry, documents and API resources
|
||||
assert.equal(shadow.resources.filter(r=>r.kind==='image').length,2);
|
||||
assert.equal(shadow.resources.find(r=>r.id==='upload-api')?.href,'/api/upload');
|
||||
assert.equal(shadow.resources.find(r=>r.id==='media-api')?.template,true);
|
||||
assert.ok(!skillDocumentMarkdown('shadow-puppet','index')!.includes('/skills/street-people/'));
|
||||
assert.ok(!documentMarkdown('index')!.includes('/skills/shadow-puppet/'));
|
||||
});
|
||||
|
||||
test('every guidance page has a matching Markdown URL and all document links resolve globally',async()=>{
|
||||
const {guidanceDocuments,getGuidance,guidanceMarkdown,guidanceIndexMarkdown,humanDocumentUrl,markdownDocumentUrl,guidanceBacklinks}=await import('../src/content/skills/guidance');
|
||||
assert.equal(new Set(guidanceDocuments.map(d=>d.path)).size,guidanceDocuments.length);
|
||||
for(const doc of guidanceDocuments){
|
||||
for(const r of doc.resources)if(r.documentPath)assert.ok(getGuidance(r.documentPath),r.documentPath);
|
||||
const text=guidanceMarkdown(doc.path)!;
|
||||
assert.ok(text.startsWith('# '+doc.title));
|
||||
assert.equal(markdownDocumentUrl(doc.path),humanDocumentUrl(doc.path)+'/index.md');
|
||||
assert.ok(text.includes(humanDocumentUrl(doc.path)));
|
||||
for(const block of doc.blocks){
|
||||
if(block.text)assert.ok(text.includes(block.text));
|
||||
for(const id of block.refs||[]){const r=doc.resources.find(r=>r.id===id);assert.ok(r,doc.path+': '+id);if(r.documentPath){assert.ok(getGuidance(r.documentPath));assert.ok(text.includes(markdownDocumentUrl(r.documentPath)));}}
|
||||
}
|
||||
assert.ok(guidanceIndexMarkdown().includes(markdownDocumentUrl(doc.path)));
|
||||
}
|
||||
assert.ok(guidanceIndexMarkdown(true).includes('/skills/index.md'));
|
||||
assert.equal(getGuidance('__proto__'),undefined);assert.equal(guidanceMarkdown('missing'),null);
|
||||
const shared=guidanceBacklinks('image-delivery').map(d=>d.path);
|
||||
assert.ok(shared.includes('street-people/checks'));assert.ok(shared.includes('shadow-puppet/delivery'));
|
||||
assert.ok(guidanceMarkdown('image-delivery')!.includes('/skills/street-people/checks/index.md'));
|
||||
assert.ok(guidanceMarkdown('image-delivery')!.includes('/skills/shadow-puppet/delivery/index.md'));
|
||||
});
|
||||
|
||||
test('Markdown counterpart responses support GET and HEAD and reject writes or missing documents',async()=>{
|
||||
const {sendMarkdown}=await import('../src/lib/markdown-response');
|
||||
const {guidanceMarkdown}=await import('../src/content/skills/guidance');
|
||||
for(const [method,text,expected] of [['GET',guidanceMarkdown('shadow-puppet/prompt'),200],['HEAD',guidanceMarkdown('shadow-puppet/prompt'),200],['POST',guidanceMarkdown('shadow-puppet/prompt'),405],['GET',guidanceMarkdown('missing'),404]] as const){
|
||||
const result={code:0,body:null as string|null,headers:{} as Record<string,string>,setHeader(k:string,v:string){this.headers[k]=v;return this},status(code:number){this.code=code;return this},send(body:string){this.body=body;return this},end(){return this}};
|
||||
sendMarkdown({method} as import('next').NextApiRequest,result as unknown as import('next').NextApiResponse,text);
|
||||
assert.equal(result.code,expected);if(method==='GET'&&expected===200){assert.match(result.headers['Content-Type'],/text\/markdown/);assert.ok(result.body?.startsWith('# '));}else assert.equal(result.body,null);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user