opencastle 1.1.1 → 1.3.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/README.md +26 -9
- package/bin/cli.mjs +6 -0
- package/dist/cli/adapters/antigravity.d.ts +0 -1
- package/dist/cli/adapters/antigravity.d.ts.map +1 -1
- package/dist/cli/adapters/antigravity.js +2 -1
- package/dist/cli/adapters/antigravity.js.map +1 -1
- package/dist/cli/adapters/claude-code.d.ts +0 -1
- package/dist/cli/adapters/claude-code.d.ts.map +1 -1
- package/dist/cli/adapters/claude-code.js +0 -1
- package/dist/cli/adapters/claude-code.js.map +1 -1
- package/dist/cli/adapters/cursor.d.ts.map +1 -1
- package/dist/cli/adapters/cursor.js +8 -1
- package/dist/cli/adapters/cursor.js.map +1 -1
- package/dist/cli/adapters/opencode.d.ts +12 -5
- package/dist/cli/adapters/opencode.d.ts.map +1 -1
- package/dist/cli/adapters/opencode.js +17 -5
- package/dist/cli/adapters/opencode.js.map +1 -1
- package/dist/cli/adapters/rules-dir-base.d.ts +12 -1
- package/dist/cli/adapters/rules-dir-base.d.ts.map +1 -1
- package/dist/cli/adapters/rules-dir-base.js +43 -57
- package/dist/cli/adapters/rules-dir-base.js.map +1 -1
- package/dist/cli/adapters/rules-dir-base.test.js +27 -18
- package/dist/cli/adapters/rules-dir-base.test.js.map +1 -1
- package/dist/cli/adapters/single-file-base.d.ts +11 -0
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +44 -14
- package/dist/cli/adapters/single-file-base.js.map +1 -1
- package/dist/cli/adapters/vscode.d.ts +2 -1
- package/dist/cli/adapters/vscode.d.ts.map +1 -1
- package/dist/cli/adapters/vscode.js +2 -1
- package/dist/cli/adapters/vscode.js.map +1 -1
- package/dist/cli/adapters/windsurf.d.ts.map +1 -1
- package/dist/cli/adapters/windsurf.js +11 -1
- package/dist/cli/adapters/windsurf.js.map +1 -1
- package/dist/cli/agent-plugin.d.ts +119 -0
- package/dist/cli/agent-plugin.d.ts.map +1 -0
- package/dist/cli/agent-plugin.js +449 -0
- package/dist/cli/agent-plugin.js.map +1 -0
- package/dist/cli/agent-plugin.test.d.ts +2 -0
- package/dist/cli/agent-plugin.test.d.ts.map +1 -0
- package/dist/cli/agent-plugin.test.js +227 -0
- package/dist/cli/agent-plugin.test.js.map +1 -0
- package/dist/cli/baseline.d.ts.map +1 -1
- package/dist/cli/baseline.js +114 -34
- package/dist/cli/baseline.js.map +1 -1
- package/dist/cli/ci.d.ts.map +1 -1
- package/dist/cli/ci.js +18 -4
- package/dist/cli/ci.js.map +1 -1
- package/dist/cli/codex-target.test.js +14 -1
- package/dist/cli/codex-target.test.js.map +1 -1
- package/dist/cli/convoy/gates.d.ts +2 -20
- package/dist/cli/convoy/gates.d.ts.map +1 -1
- package/dist/cli/convoy/gates.js +3 -111
- package/dist/cli/convoy/gates.js.map +1 -1
- package/dist/cli/copy.d.ts +0 -8
- package/dist/cli/copy.d.ts.map +1 -1
- package/dist/cli/copy.js +0 -21
- package/dist/cli/copy.js.map +1 -1
- package/dist/cli/dispatcher.test.js +2 -2
- package/dist/cli/dispatcher.test.js.map +1 -1
- package/dist/cli/docs-accuracy.test.js +2 -0
- package/dist/cli/docs-accuracy.test.js.map +1 -1
- package/dist/cli/doctor.d.ts.map +1 -1
- package/dist/cli/doctor.js +2 -0
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/doctor.test.js +2 -2
- package/dist/cli/doctor.test.js.map +1 -1
- package/dist/cli/explain.d.ts +5 -0
- package/dist/cli/explain.d.ts.map +1 -1
- package/dist/cli/explain.js +38 -2
- package/dist/cli/explain.js.map +1 -1
- package/dist/cli/init.test.js +78 -42
- package/dist/cli/init.test.js.map +1 -1
- package/dist/cli/layers.d.ts +8 -0
- package/dist/cli/layers.d.ts.map +1 -1
- package/dist/cli/layers.js +130 -13
- package/dist/cli/layers.js.map +1 -1
- package/dist/cli/layers.test.js +2 -2
- package/dist/cli/layers.test.js.map +1 -1
- package/dist/cli/legacy-install.test.js +8 -1
- package/dist/cli/legacy-install.test.js.map +1 -1
- package/dist/cli/lesson-command.test.d.ts +2 -0
- package/dist/cli/lesson-command.test.d.ts.map +1 -0
- package/dist/cli/lesson-command.test.js +100 -0
- package/dist/cli/lesson-command.test.js.map +1 -0
- package/dist/cli/lesson.d.ts +0 -9
- package/dist/cli/lesson.d.ts.map +1 -1
- package/dist/cli/lesson.js +212 -276
- package/dist/cli/lesson.js.map +1 -1
- package/dist/cli/lessons.d.ts +134 -0
- package/dist/cli/lessons.d.ts.map +1 -0
- package/dist/cli/lessons.js +493 -0
- package/dist/cli/lessons.js.map +1 -0
- package/dist/cli/lessons.test.d.ts +2 -0
- package/dist/cli/lessons.test.d.ts.map +1 -0
- package/dist/cli/lessons.test.js +214 -0
- package/dist/cli/lessons.test.js.map +1 -0
- package/dist/cli/managed-paths.d.ts.map +1 -1
- package/dist/cli/managed-paths.js +3 -1
- package/dist/cli/managed-paths.js.map +1 -1
- package/dist/cli/mcp-audit.d.ts.map +1 -1
- package/dist/cli/mcp-audit.js +2 -0
- package/dist/cli/mcp-audit.js.map +1 -1
- package/dist/cli/mcp-upgrade.test.js +24 -1
- package/dist/cli/mcp-upgrade.test.js.map +1 -1
- package/dist/cli/mcp.d.ts.map +1 -1
- package/dist/cli/mcp.js +22 -3
- package/dist/cli/mcp.js.map +1 -1
- package/dist/cli/pack-plugins.d.ts +8 -0
- package/dist/cli/pack-plugins.d.ts.map +1 -0
- package/dist/cli/pack-plugins.js +70 -0
- package/dist/cli/pack-plugins.js.map +1 -0
- package/dist/cli/plugin-command.test.d.ts +2 -0
- package/dist/cli/plugin-command.test.d.ts.map +1 -0
- package/dist/cli/plugin-command.test.js +114 -0
- package/dist/cli/plugin-command.test.js.map +1 -0
- package/dist/cli/plugin.d.ts +30 -0
- package/dist/cli/plugin.d.ts.map +1 -0
- package/dist/cli/plugin.js +291 -0
- package/dist/cli/plugin.js.map +1 -0
- package/dist/cli/promote-command.test.d.ts +2 -0
- package/dist/cli/promote-command.test.d.ts.map +1 -0
- package/dist/cli/promote-command.test.js +151 -0
- package/dist/cli/promote-command.test.js.map +1 -0
- package/dist/cli/promote.d.ts +12 -0
- package/dist/cli/promote.d.ts.map +1 -0
- package/dist/cli/promote.js +364 -0
- package/dist/cli/promote.js.map +1 -0
- package/dist/cli/secret-scan.d.ts +21 -0
- package/dist/cli/secret-scan.d.ts.map +1 -0
- package/dist/cli/secret-scan.js +114 -0
- package/dist/cli/secret-scan.js.map +1 -0
- package/dist/cli/sync-check.d.ts.map +1 -1
- package/dist/cli/sync-check.js +9 -0
- package/dist/cli/sync-check.js.map +1 -1
- package/dist/cli/sync-check.test.js +5 -4
- package/dist/cli/sync-check.test.js.map +1 -1
- package/dist/cli/team-commands.test.js +14 -2
- package/dist/cli/team-commands.test.js.map +1 -1
- package/dist/cli/team-sources.test.js +10 -0
- package/dist/cli/team-sources.test.js.map +1 -1
- package/dist/cli/types.d.ts +1 -1
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +18 -0
- package/dist/cli/update.js.map +1 -1
- package/dist/cli/windsurf-target.test.d.ts +2 -0
- package/dist/cli/windsurf-target.test.d.ts.map +1 -0
- package/dist/cli/windsurf-target.test.js +62 -0
- package/dist/cli/windsurf-target.test.js.map +1 -0
- package/dist/orchestrator/plugins/agent-plugins.test.d.ts +2 -0
- package/dist/orchestrator/plugins/agent-plugins.test.d.ts.map +1 -0
- package/dist/orchestrator/plugins/agent-plugins.test.js +32 -0
- package/dist/orchestrator/plugins/agent-plugins.test.js.map +1 -0
- package/dist/orchestrator/plugins/registry.test.d.ts +2 -0
- package/dist/orchestrator/plugins/registry.test.d.ts.map +1 -0
- package/dist/orchestrator/plugins/registry.test.js +37 -0
- package/dist/orchestrator/plugins/registry.test.js.map +1 -0
- package/package.json +2 -1
- package/src/cli/adapters/antigravity.ts +2 -1
- package/src/cli/adapters/claude-code.ts +0 -1
- package/src/cli/adapters/cursor.ts +8 -1
- package/src/cli/adapters/opencode.ts +18 -6
- package/src/cli/adapters/rules-dir-base.test.ts +28 -18
- package/src/cli/adapters/rules-dir-base.ts +51 -90
- package/src/cli/adapters/single-file-base.ts +53 -14
- package/src/cli/adapters/vscode.ts +2 -1
- package/src/cli/adapters/windsurf.ts +11 -1
- package/src/cli/agent-plugin.test.ts +267 -0
- package/src/cli/agent-plugin.ts +469 -0
- package/src/cli/baseline.ts +115 -32
- package/src/cli/ci.ts +19 -4
- package/src/cli/codex-target.test.ts +15 -1
- package/src/cli/convoy/gates.ts +9 -142
- package/src/cli/copy.ts +0 -25
- package/src/cli/dispatcher.test.ts +2 -2
- package/src/cli/docs-accuracy.test.ts +2 -0
- package/src/cli/doctor.test.ts +2 -2
- package/src/cli/doctor.ts +2 -0
- package/src/cli/explain.ts +36 -2
- package/src/cli/fixtures/lessons-template-1.0.md +70 -0
- package/src/cli/init.test.ts +82 -42
- package/src/cli/layers.test.ts +2 -2
- package/src/cli/layers.ts +144 -14
- package/src/cli/legacy-install.test.ts +11 -1
- package/src/cli/lesson-command.test.ts +117 -0
- package/src/cli/lesson.ts +215 -266
- package/src/cli/lessons.test.ts +254 -0
- package/src/cli/lessons.ts +540 -0
- package/src/cli/managed-paths.ts +3 -1
- package/src/cli/mcp-audit.ts +2 -0
- package/src/cli/mcp-upgrade.test.ts +26 -1
- package/src/cli/mcp.ts +22 -3
- package/src/cli/pack-plugins.ts +70 -0
- package/src/cli/plugin-command.test.ts +125 -0
- package/src/cli/plugin.ts +309 -0
- package/src/cli/promote-command.test.ts +170 -0
- package/src/cli/promote.ts +371 -0
- package/src/cli/secret-scan.ts +154 -0
- package/src/cli/sync-check.test.ts +5 -4
- package/src/cli/sync-check.ts +9 -0
- package/src/cli/team-commands.test.ts +18 -2
- package/src/cli/team-sources.test.ts +11 -0
- package/src/cli/types.ts +1 -1
- package/src/cli/update.ts +20 -0
- package/src/cli/windsurf-target.test.ts +70 -0
- package/src/dashboard/node_modules/.vite/deps/_metadata.json +6 -6
- package/src/orchestrator/agents/researcher.agent.md +1 -1
- package/src/orchestrator/customizations/LESSONS-LEARNED.md +10 -66
- package/src/orchestrator/customizations/README.md +2 -1
- package/src/orchestrator/customizations/logs/README.md +1 -1
- package/src/orchestrator/plugins/agent-plugins.test.ts +34 -0
- package/src/orchestrator/plugins/astro/mcp.json +9 -0
- package/src/orchestrator/plugins/astro/plugin.json +21 -0
- package/src/orchestrator/plugins/chrome-devtools/mcp.json +13 -0
- package/src/orchestrator/plugins/chrome-devtools/plugin.json +21 -0
- package/src/orchestrator/plugins/cloudflare/mcp.json +9 -0
- package/src/orchestrator/plugins/cloudflare/plugin.json +21 -0
- package/src/orchestrator/plugins/contentful/mcp.json +13 -0
- package/src/orchestrator/plugins/contentful/plugin.json +21 -0
- package/src/orchestrator/plugins/convex/mcp.json +15 -0
- package/src/orchestrator/plugins/convex/plugin.json +21 -0
- package/src/orchestrator/plugins/coolify/mcp.json +13 -0
- package/src/orchestrator/plugins/coolify/plugin.json +25 -0
- package/src/orchestrator/plugins/cypress/plugin.json +21 -0
- package/src/orchestrator/plugins/drizzle/plugin.json +21 -0
- package/src/orchestrator/plugins/expo/mcp.json +9 -0
- package/src/orchestrator/plugins/expo/plugin.json +21 -0
- package/src/orchestrator/plugins/figma/mcp.json +9 -0
- package/src/orchestrator/plugins/figma/plugin.json +21 -0
- package/src/orchestrator/plugins/hetzner/plugin.json +24 -0
- package/src/orchestrator/plugins/jira/mcp.json +9 -0
- package/src/orchestrator/plugins/jira/plugin.json +21 -0
- package/src/orchestrator/plugins/linear/mcp.json +9 -0
- package/src/orchestrator/plugins/linear/plugin.json +21 -0
- package/src/orchestrator/plugins/netlify/mcp.json +13 -0
- package/src/orchestrator/plugins/netlify/plugin.json +21 -0
- package/src/orchestrator/plugins/nextjs/mcp.json +13 -0
- package/src/orchestrator/plugins/nextjs/plugin.json +21 -0
- package/src/orchestrator/plugins/notion/mcp.json +9 -0
- package/src/orchestrator/plugins/notion/plugin.json +21 -0
- package/src/orchestrator/plugins/nx/mcp.json +14 -0
- package/src/orchestrator/plugins/nx/plugin.json +21 -0
- package/src/orchestrator/plugins/playwright/mcp.json +13 -0
- package/src/orchestrator/plugins/playwright/plugin.json +21 -0
- package/src/orchestrator/plugins/prisma/mcp.json +14 -0
- package/src/orchestrator/plugins/prisma/plugin.json +21 -0
- package/src/orchestrator/plugins/registry.test.ts +42 -0
- package/src/orchestrator/plugins/resend/mcp.json +13 -0
- package/src/orchestrator/plugins/resend/plugin.json +24 -0
- package/src/orchestrator/plugins/sanity/mcp.json +9 -0
- package/src/orchestrator/plugins/sanity/plugin.json +21 -0
- package/src/orchestrator/plugins/sentry/mcp.json +12 -0
- package/src/orchestrator/plugins/sentry/plugin.json +24 -0
- package/src/orchestrator/plugins/slack/mcp.json +13 -0
- package/src/orchestrator/plugins/slack/plugin.json +24 -0
- package/src/orchestrator/plugins/strapi/mcp.json +13 -0
- package/src/orchestrator/plugins/strapi/plugin.json +21 -0
- package/src/orchestrator/plugins/stripe/mcp.json +9 -0
- package/src/orchestrator/plugins/stripe/plugin.json +21 -0
- package/src/orchestrator/plugins/supabase/mcp.json +9 -0
- package/src/orchestrator/plugins/supabase/plugin.json +21 -0
- package/src/orchestrator/plugins/teams/plugin.json +24 -0
- package/src/orchestrator/plugins/trello/mcp.json +13 -0
- package/src/orchestrator/plugins/trello/plugin.json +25 -0
- package/src/orchestrator/plugins/turborepo/plugin.json +21 -0
- package/src/orchestrator/plugins/vercel/mcp.json +9 -0
- package/src/orchestrator/plugins/vercel/plugin.json +21 -0
- package/src/orchestrator/plugins/vitest/plugin.json +21 -0
- package/src/orchestrator/skill-config-links.test.ts +2 -1
- package/src/orchestrator/skills/agent-hooks/HOOKS-REFERENCE.md +1 -1
- package/src/orchestrator/skills/agent-hooks/SKILL.md +1 -1
- package/src/orchestrator/skills/decomposition/SKILL.md +1 -1
- package/src/orchestrator/skills/memory-merger/SKILL.md +17 -21
- package/src/orchestrator/skills/self-improvement/LESSON-CATEGORIES.md +44 -23
- package/src/orchestrator/skills/self-improvement/SKILL.md +30 -15
- /package/src/orchestrator/plugins/astro/{SKILL.md → skills/astro-framework/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/chrome-devtools/{SKILL.md → skills/browser-testing/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/cloudflare/{SKILL.md → skills/cloudflare-platform/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/contentful/{SKILL.md → skills/contentful-cms/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/convex/{SKILL.md → skills/convex-database/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/coolify/{SKILL.md → skills/coolify-deployment/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/cypress/{SKILL.md → skills/cypress-testing/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/drizzle/{SKILL.md → skills/drizzle-orm/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/expo/{SKILL.md → skills/expo-development/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/figma/{SKILL.md → skills/figma-design/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/hetzner/{SKILL.md → skills/hetzner-cloud/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/jira/{SKILL.md → skills/jira-management/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/linear/{SKILL.md → skills/linear-task-management/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/netlify/{SKILL.md → skills/netlify-deployment/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/nextjs/{SKILL.md → skills/nextjs-framework/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/notion/{SKILL.md → skills/notion-knowledge-management/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/nx/{SKILL.md → skills/nx-workspace/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/playwright/{SKILL.md → skills/playwright-testing/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/prisma/{SKILL.md → skills/prisma-database/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/resend/{SKILL.md → skills/resend-email/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/sanity/{SKILL.md → skills/sanity-cms/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/sentry/{SKILL.md → skills/sentry-monitoring/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/slack/{SKILL.md → skills/slack-notifications/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/strapi/{SKILL.md → skills/strapi-cms/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/stripe/{SKILL.md → skills/stripe-payments/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/supabase/{SKILL.md → skills/supabase-database/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/teams/{SKILL.md → skills/teams-notifications/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/trello/{SKILL.md → skills/trello-task-management/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/turborepo/{SKILL.md → skills/turborepo-monorepo/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/vercel/{SKILL.md → skills/vercel-deployment/SKILL.md} +0 -0
- /package/src/orchestrator/plugins/vitest/{SKILL.md → skills/vitest-testing/SKILL.md} +0 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Plugins 1.0, as a conformant client reads one — and as a team's
|
|
3
|
+
* baseline, compiled into every assistant.
|
|
4
|
+
*
|
|
5
|
+
* The spec's own examples are used where it gives them, so a reading that
|
|
6
|
+
* drifts from the published text fails here first.
|
|
7
|
+
*/
|
|
8
|
+
import { mkdtempSync, mkdirSync, writeFileSync, rmSync, readFileSync } from 'node:fs'
|
|
9
|
+
import { tmpdir } from 'node:os'
|
|
10
|
+
import { join, resolve, dirname } from 'node:path'
|
|
11
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
12
|
+
import {
|
|
13
|
+
checkSkill,
|
|
14
|
+
claudeMcpFor,
|
|
15
|
+
isAgentPlugin,
|
|
16
|
+
mcpSchemaUrl,
|
|
17
|
+
pluginNameFrom,
|
|
18
|
+
pluginSchemaUrl,
|
|
19
|
+
readAgentPlugin,
|
|
20
|
+
serverProblem,
|
|
21
|
+
teamServerFor,
|
|
22
|
+
} from './agent-plugin.js'
|
|
23
|
+
import { resolveSources, materialize, hasErrors } from './layers.js'
|
|
24
|
+
import type { StackConfig } from './types.js'
|
|
25
|
+
|
|
26
|
+
const pkgRoot = resolve(import.meta.dirname, '..', '..')
|
|
27
|
+
const noTools: StackConfig = { ides: ['claude-code'], techTools: [], teamTools: [] }
|
|
28
|
+
|
|
29
|
+
function write(root: string, files: Record<string, string>): void {
|
|
30
|
+
for (const [rel, text] of Object.entries(files)) {
|
|
31
|
+
const abs = join(root, rel)
|
|
32
|
+
mkdirSync(dirname(abs), { recursive: true })
|
|
33
|
+
writeFileSync(abs, text)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
const skill = (name: string, description = `${name} does a thing. Use when it matters.`): string =>
|
|
38
|
+
`---\nname: ${name}\ndescription: "${description}"\n---\n\n# ${name}\n`
|
|
39
|
+
|
|
40
|
+
const manifest = (extra: Record<string, unknown> = {}): string =>
|
|
41
|
+
JSON.stringify({ $schema: pluginSchemaUrl(), name: 'acme.standard', version: '1.2.0', ...extra })
|
|
42
|
+
|
|
43
|
+
const mcp = (servers: Record<string, unknown>): string => JSON.stringify({ $schema: mcpSchemaUrl(), mcpServers: servers })
|
|
44
|
+
|
|
45
|
+
describe('reading a plugin', () => {
|
|
46
|
+
let dir: string
|
|
47
|
+
beforeEach(() => {
|
|
48
|
+
dir = mkdtempSync(join(tmpdir(), 'oc-ap-'))
|
|
49
|
+
})
|
|
50
|
+
afterEach(() => rmSync(dir, { recursive: true, force: true }))
|
|
51
|
+
|
|
52
|
+
it('loads the spec’s layout: manifest, skills and servers', () => {
|
|
53
|
+
write(dir, {
|
|
54
|
+
'plugin.json': manifest(),
|
|
55
|
+
'skills/summarize/SKILL.md': skill('summarize'),
|
|
56
|
+
'skills/summarize/references/checklist.md': '- one\n',
|
|
57
|
+
'skills/notes.txt': 'not a skill',
|
|
58
|
+
'mcp.json': mcp({
|
|
59
|
+
'local-validator': { type: 'stdio', command: './bin/validator', args: ['--data', '${PLUGIN_DATA}/validator'], env: { CONFIG: '${PLUGIN_ROOT}/config.json' }, cwd: '${PLUGIN_ROOT}' },
|
|
60
|
+
'deployment-api': { type: 'streamable-http', url: 'https://deploy.example.com/mcp', headers: { 'X-Tenant': 'public-tenant' } },
|
|
61
|
+
'legacy-events': { type: 'sse', url: 'https://legacy.example.com/sse' },
|
|
62
|
+
}),
|
|
63
|
+
})
|
|
64
|
+
const r = readAgentPlugin(dir)
|
|
65
|
+
expect(r.errors).toEqual([])
|
|
66
|
+
expect(r.warnings).toEqual([])
|
|
67
|
+
expect(r.version).toBe('1.0.0')
|
|
68
|
+
expect(r.skills).toEqual(['summarize'])
|
|
69
|
+
expect(Object.keys(r.servers)).toEqual(['local-validator', 'deployment-api', 'legacy-events'])
|
|
70
|
+
expect(isAgentPlugin(dir)).toBe(true)
|
|
71
|
+
})
|
|
72
|
+
|
|
73
|
+
it('refuses a manifest a client must reject, and names the field', () => {
|
|
74
|
+
for (const [bad, said] of [
|
|
75
|
+
[{ name: 'My-Plugin' }, '"name" must be'],
|
|
76
|
+
[{ name: 'has--double' }, '"name" must be'],
|
|
77
|
+
[{ version: 2 }, '"version" must be a string'],
|
|
78
|
+
[{ author: { name: 'A', team: 'B' } }, '"author" may hold only'],
|
|
79
|
+
[{ keywords: 'x' }, '"keywords" must be a list'],
|
|
80
|
+
] as const) {
|
|
81
|
+
write(dir, { 'plugin.json': manifest(bad) })
|
|
82
|
+
const r = readAgentPlugin(dir)
|
|
83
|
+
expect(r.manifest).toBeUndefined()
|
|
84
|
+
expect(r.errors.join('\n')).toContain(said)
|
|
85
|
+
}
|
|
86
|
+
write(dir, { 'plugin.json': JSON.stringify({ $schema: 'https://example.com/x.json', name: 'a' }) })
|
|
87
|
+
expect(readAgentPlugin(dir).errors[0]).toContain('"$schema" must be')
|
|
88
|
+
expect(isAgentPlugin(dir)).toBe(false)
|
|
89
|
+
})
|
|
90
|
+
|
|
91
|
+
it('reports and ignores an unknown field, as a client must', () => {
|
|
92
|
+
write(dir, { 'plugin.json': manifest({ logo: 'x.png', commands: [] }) })
|
|
93
|
+
const r = readAgentPlugin(dir)
|
|
94
|
+
expect(r.errors).toEqual([])
|
|
95
|
+
expect(r.manifest?.name).toBe('acme.standard')
|
|
96
|
+
expect(r.warnings.join('\n')).toMatch(/"logo" is not an Agent Plugins field[\s\S]*"commands"/)
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
it('accepts the 1.1.0 draft, which changes only the number', () => {
|
|
100
|
+
write(dir, {
|
|
101
|
+
'plugin.json': JSON.stringify({ $schema: pluginSchemaUrl('1.1.0'), name: 'a' }),
|
|
102
|
+
'mcp.json': JSON.stringify({ $schema: mcpSchemaUrl('1.0.0'), mcpServers: {} }),
|
|
103
|
+
})
|
|
104
|
+
const r = readAgentPlugin(dir)
|
|
105
|
+
expect(r.version).toBe('1.1.0')
|
|
106
|
+
expect(r.errors).toEqual(['mcp.json: targets Agent Plugins 1.0.0 while plugin.json targets 1.1.0, so no server loads'])
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
it('skips one bad server and keeps the rest', () => {
|
|
110
|
+
write(dir, {
|
|
111
|
+
'plugin.json': manifest(),
|
|
112
|
+
'mcp.json': mcp({ bad: { type: 'stdio', command: 'npx -y thing' }, good: { type: 'stdio', command: 'npx', args: ['-y', 'thing@1.0.0'] } }),
|
|
113
|
+
})
|
|
114
|
+
const r = readAgentPlugin(dir)
|
|
115
|
+
expect(Object.keys(r.servers)).toEqual(['good'])
|
|
116
|
+
expect(r.errors[0]).toContain('command must be one executable')
|
|
117
|
+
})
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
describe('a server entry', () => {
|
|
121
|
+
it.each([
|
|
122
|
+
[{ type: 'stdio', command: '../bin/server' }, 'must start with ./'],
|
|
123
|
+
[{ type: 'stdio', command: 'node', cwd: 'data' }, 'cwd must start with'],
|
|
124
|
+
[{ type: 'stdio', command: 'node', env: { PLUGIN_ROOT: '/x' } }, 'cannot set PLUGIN_ROOT'],
|
|
125
|
+
[{ type: 'stdio', command: '${PLUGIN_ROOT}/bin/x' }, 'command is not expanded'],
|
|
126
|
+
[{ type: 'streamable-http', url: 'http://api.example.com/mcp' }, 'needs https'],
|
|
127
|
+
[{ type: 'streamable-http', url: 'https://user:pw@api.example.com/mcp' }, 'user or password'],
|
|
128
|
+
[{ type: 'streamable-http', url: 'https://api.example.com/mcp#x' }, 'fragment'],
|
|
129
|
+
[{ type: 'streamable-http', url: 'https://a.example.com', headers: { 'X-A': '1', 'x-a': '2' } }, 'given twice'],
|
|
130
|
+
[{ type: 'streamable-http', url: 'https://a.example.com', command: 'x' }, 'cannot have'],
|
|
131
|
+
[{ type: 'websocket', url: 'wss://a' }, 'type must be'],
|
|
132
|
+
])('refuses %j', (raw, said) => {
|
|
133
|
+
expect(serverProblem('s', raw)).toContain(said)
|
|
134
|
+
})
|
|
135
|
+
|
|
136
|
+
it('lets a loopback server use plain http', () => {
|
|
137
|
+
expect(serverProblem('s', { type: 'streamable-http', url: 'http://127.0.0.1:3845/mcp' })).toBeNull()
|
|
138
|
+
expect(serverProblem('s', { type: 'streamable-http', url: 'http://localhost:3845/mcp' })).toBeNull()
|
|
139
|
+
})
|
|
140
|
+
})
|
|
141
|
+
|
|
142
|
+
describe('a skill, against the Agent Skills spec', () => {
|
|
143
|
+
let dir: string
|
|
144
|
+
beforeEach(() => {
|
|
145
|
+
dir = mkdtempSync(join(tmpdir(), 'oc-skill-'))
|
|
146
|
+
})
|
|
147
|
+
afterEach(() => rmSync(dir, { recursive: true, force: true }))
|
|
148
|
+
|
|
149
|
+
it('must be named as its directory', () => {
|
|
150
|
+
write(dir, { 'deploy/SKILL.md': skill('deploy-runbook') })
|
|
151
|
+
expect(checkSkill(join(dir, 'deploy')).errors[0]).toContain('must match its directory, deploy/')
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
it('needs a description of at most 1024 characters', () => {
|
|
155
|
+
write(dir, { 'a/SKILL.md': skill('a', 'x'.repeat(1025)), 'b/SKILL.md': '---\nname: b\n---\n' })
|
|
156
|
+
expect(checkSkill(join(dir, 'a')).errors[0]).toContain('1025 characters')
|
|
157
|
+
expect(checkSkill(join(dir, 'b')).errors[0]).toContain('has no description')
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
it('names fields the spec does not define, and lets assistant ones pass', () => {
|
|
161
|
+
write(dir, { 'a/SKILL.md': '---\nname: a\ndescription: "Does a. Use when a."\nuser-invocable: true\napplyTo: "**"\n---\n' })
|
|
162
|
+
const r = checkSkill(join(dir, 'a'))
|
|
163
|
+
expect(r.errors).toEqual([])
|
|
164
|
+
expect(r.warnings).toEqual(['skills/a/SKILL.md: applyTo is not an Agent Skills field; other assistants ignore it'])
|
|
165
|
+
})
|
|
166
|
+
})
|
|
167
|
+
|
|
168
|
+
describe('Claude Code’s copies', () => {
|
|
169
|
+
it('resolves ./ and the plugin variables in Claude Code’s spelling', () => {
|
|
170
|
+
expect(
|
|
171
|
+
claudeMcpFor({
|
|
172
|
+
local: { type: 'stdio', command: './bin/server', args: ['${PLUGIN_ROOT}/a', '${PLUGIN_DATA}/b'] },
|
|
173
|
+
remote: { type: 'streamable-http', url: 'https://x.example.com/mcp' },
|
|
174
|
+
old: { type: 'sse', url: 'https://y.example.com/sse' },
|
|
175
|
+
}),
|
|
176
|
+
).toEqual({
|
|
177
|
+
mcpServers: {
|
|
178
|
+
local: { command: '${CLAUDE_PLUGIN_ROOT}/bin/server', args: ['${CLAUDE_PLUGIN_ROOT}/a', '${CLAUDE_PLUGIN_DATA}/b'] },
|
|
179
|
+
remote: { type: 'http', url: 'https://x.example.com/mcp' },
|
|
180
|
+
old: { type: 'sse', url: 'https://y.example.com/sse' },
|
|
181
|
+
},
|
|
182
|
+
})
|
|
183
|
+
})
|
|
184
|
+
})
|
|
185
|
+
|
|
186
|
+
describe('naming', () => {
|
|
187
|
+
it('makes a plugin name from a package name', () => {
|
|
188
|
+
expect(pluginNameFrom('@acme/ai-standard')).toBe('acme.ai-standard')
|
|
189
|
+
expect(pluginNameFrom('My Plugin!')).toBe('my-plugin')
|
|
190
|
+
})
|
|
191
|
+
})
|
|
192
|
+
|
|
193
|
+
describe('a plugin as a team’s baseline', () => {
|
|
194
|
+
let project: string
|
|
195
|
+
beforeEach(() => {
|
|
196
|
+
project = mkdtempSync(join(tmpdir(), 'oc-ap-layer-'))
|
|
197
|
+
})
|
|
198
|
+
afterEach(() => rmSync(project, { recursive: true, force: true }))
|
|
199
|
+
|
|
200
|
+
const plugin = (root: string, files: Record<string, string> = {}): void =>
|
|
201
|
+
write(join(project, root), {
|
|
202
|
+
'plugin.json': manifest(),
|
|
203
|
+
'skills/secure-coding/SKILL.md': skill('secure-coding'),
|
|
204
|
+
'mcp.json': mcp({
|
|
205
|
+
docs: { type: 'streamable-http', url: 'https://docs.acme.example/mcp' },
|
|
206
|
+
lint: { type: 'stdio', command: './bin/lint', args: ['--config', '${PLUGIN_ROOT}/lint.json'] },
|
|
207
|
+
cache: { type: 'stdio', command: 'node', args: ['${PLUGIN_DATA}/x.js'] },
|
|
208
|
+
}),
|
|
209
|
+
'dev.opencastle/instructions/standards.md': '# Standards\n\nBe kind.\n',
|
|
210
|
+
'dev.opencastle/config.json': JSON.stringify({ policy: { contextBudget: 9000 } }),
|
|
211
|
+
...files,
|
|
212
|
+
})
|
|
213
|
+
|
|
214
|
+
it('compiles its skills, its portable servers and its OpenCastle layer', () => {
|
|
215
|
+
plugin('standard')
|
|
216
|
+
write(project, { '.opencastle/config.json': JSON.stringify({ extends: ['../standard'] }) })
|
|
217
|
+
const r = resolveSources({ pkgRoot, projectRoot: project, stack: noTools })
|
|
218
|
+
expect(hasErrors(r)).toBe(false)
|
|
219
|
+
expect(r.items.get('skills/secure-coding')?.layer).toBe('standard')
|
|
220
|
+
expect(r.items.get('instructions/standards')?.layer).toBe('standard')
|
|
221
|
+
expect(r.policy.contextBudget).toEqual({ tokens: 9000, by: 'standard' })
|
|
222
|
+
expect(r.servers.get('docs')).toMatchObject({ server: { type: 'http', url: 'https://docs.acme.example/mcp' }, where: 'standard/mcp.json' })
|
|
223
|
+
expect(r.servers.get('lint')?.server).toEqual({ type: 'stdio', command: './standard/bin/lint', args: ['--config', './standard/lint.json'] })
|
|
224
|
+
expect(r.servers.has('cache')).toBe(false)
|
|
225
|
+
expect(r.issues.map((i) => i.message).join('\n')).toContain('MCP server "cache" uses ${PLUGIN_DATA}')
|
|
226
|
+
const src = materialize(r, pkgRoot)
|
|
227
|
+
try {
|
|
228
|
+
expect(readFileSync(join(src.root, 'skills', 'secure-coding', 'SKILL.md'), 'utf8')).toContain('secure-coding')
|
|
229
|
+
} finally {
|
|
230
|
+
src.dispose()
|
|
231
|
+
}
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
it('extends one published to npm as it is, with no OpenCastle declaration', () => {
|
|
235
|
+
plugin('node_modules/@acme/standard', { 'package.json': JSON.stringify({ name: '@acme/standard', version: '1.2.0' }) })
|
|
236
|
+
write(project, { '.opencastle/config.json': JSON.stringify({ extends: ['@acme/standard'] }) })
|
|
237
|
+
const r = resolveSources({ pkgRoot, projectRoot: project, stack: noTools })
|
|
238
|
+
expect(hasErrors(r)).toBe(false)
|
|
239
|
+
expect(r.layers.find((l) => l.id === '@acme/standard')?.version).toBe('1.2.0')
|
|
240
|
+
expect(r.servers.get('lint')?.server).toMatchObject({ command: './node_modules/@acme/standard/bin/lint' })
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
it('refuses a server defined in both mcp.json and config.json', () => {
|
|
244
|
+
plugin('standard', {
|
|
245
|
+
'dev.opencastle/config.json': JSON.stringify({ mcpServers: { docs: { url: 'https://docs.acme.example/mcp' } } }),
|
|
246
|
+
})
|
|
247
|
+
write(project, { '.opencastle/config.json': JSON.stringify({ extends: ['../standard'] }) })
|
|
248
|
+
const r = resolveSources({ pkgRoot, projectRoot: project, stack: noTools })
|
|
249
|
+
expect(r.issues.find((i) => i.level === 'error')?.message).toBe('defines MCP server "docs", which standard/dev.opencastle/config.json defines too')
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
it('refuses one a conformant client would reject', () => {
|
|
253
|
+
write(join(project, 'broken'), { 'plugin.json': JSON.stringify({ $schema: pluginSchemaUrl(), name: 'Bad Name' }) })
|
|
254
|
+
write(project, { '.opencastle/config.json': JSON.stringify({ extends: ['../broken'] }) })
|
|
255
|
+
const r = resolveSources({ pkgRoot, projectRoot: project, stack: noTools })
|
|
256
|
+
expect(hasErrors(r)).toBe(true)
|
|
257
|
+
expect(r.issues[0].message).toContain('which is not a valid Agent Plugin: plugin.json: "name" must be')
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
it('compiles a portable server the way a team server is compiled', () => {
|
|
261
|
+
expect(teamServerFor({ type: 'stdio', command: 'npx', args: ['-y', 'x@1.0.0'] }, 'node_modules/x')).toEqual({
|
|
262
|
+
server: { type: 'stdio', command: 'npx', args: ['-y', 'x@1.0.0'] },
|
|
263
|
+
})
|
|
264
|
+
expect(teamServerFor({ type: 'sse', url: 'https://a.example.com/sse' }, 'x').skipped).toContain('legacy SSE')
|
|
265
|
+
expect(teamServerFor({ type: 'stdio', command: 'node', cwd: './data' }, 'x').skipped).toContain('runs in ./data')
|
|
266
|
+
})
|
|
267
|
+
})
|