opencastle 1.1.0 → 1.2.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 +23 -6
- package/bin/cli.mjs +6 -0
- package/dist/cli/adapters/codex.d.ts +19 -6
- package/dist/cli/adapters/codex.d.ts.map +1 -1
- package/dist/cli/adapters/codex.js +24 -7
- package/dist/cli/adapters/codex.js.map +1 -1
- package/dist/cli/adapters/single-file-base.d.ts +7 -0
- package/dist/cli/adapters/single-file-base.d.ts.map +1 -1
- package/dist/cli/adapters/single-file-base.js +59 -22
- package/dist/cli/adapters/single-file-base.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 +99 -26
- package/dist/cli/baseline.js.map +1 -1
- package/dist/cli/codex-target.test.d.ts +2 -0
- package/dist/cli/codex-target.test.d.ts.map +1 -0
- package/dist/cli/codex-target.test.js +154 -0
- package/dist/cli/codex-target.test.js.map +1 -0
- 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 +4 -1
- package/dist/cli/doctor.js.map +1 -1
- package/dist/cli/init.d.ts.map +1 -1
- package/dist/cli/init.js +5 -4
- package/dist/cli/init.js.map +1 -1
- package/dist/cli/init.test.js +58 -34
- 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 +2 -0
- 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 +7 -3
- package/dist/cli/mcp-audit.js.map +1 -1
- package/dist/cli/mcp-file.d.ts +37 -0
- package/dist/cli/mcp-file.d.ts.map +1 -0
- package/dist/cli/mcp-file.js +291 -0
- package/dist/cli/mcp-file.js.map +1 -0
- package/dist/cli/mcp-file.test.d.ts +2 -0
- package/dist/cli/mcp-file.test.d.ts.map +1 -0
- package/dist/cli/mcp-file.test.js +121 -0
- package/dist/cli/mcp-file.test.js.map +1 -0
- package/dist/cli/mcp.d.ts +15 -0
- package/dist/cli/mcp.d.ts.map +1 -1
- package/dist/cli/mcp.js +123 -56
- 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/remove.d.ts.map +1 -1
- package/dist/cli/remove.js +23 -4
- package/dist/cli/remove.js.map +1 -1
- 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 +13 -3
- package/dist/cli/sync-check.js.map +1 -1
- package/dist/cli/sync-check.test.js +2 -2
- package/dist/cli/sync-check.test.js.map +1 -1
- package/dist/cli/team-commands.test.js +2 -2
- package/dist/cli/team-commands.test.js.map +1 -1
- package/dist/cli/types.d.ts +5 -2
- package/dist/cli/types.d.ts.map +1 -1
- package/dist/cli/types.js +3 -0
- package/dist/cli/types.js.map +1 -1
- package/dist/cli/unreadable-report.d.ts +7 -0
- package/dist/cli/unreadable-report.d.ts.map +1 -1
- package/dist/cli/unreadable-report.js +14 -0
- package/dist/cli/unreadable-report.js.map +1 -1
- package/dist/cli/update.d.ts.map +1 -1
- package/dist/cli/update.js +73 -5
- package/dist/cli/update.js.map +1 -1
- 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/package.json +3 -1
- package/src/cli/adapters/codex.ts +25 -7
- package/src/cli/adapters/single-file-base.ts +69 -26
- package/src/cli/agent-plugin.test.ts +267 -0
- package/src/cli/agent-plugin.ts +469 -0
- package/src/cli/baseline.ts +99 -26
- package/src/cli/codex-target.test.ts +178 -0
- 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.ts +5 -2
- package/src/cli/fixtures/lessons-template-1.0.md +70 -0
- package/src/cli/init.test.ts +59 -34
- package/src/cli/init.ts +5 -4
- 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 +2 -0
- package/src/cli/mcp-audit.ts +7 -3
- package/src/cli/mcp-file.test.ts +138 -0
- package/src/cli/mcp-file.ts +302 -0
- package/src/cli/mcp.ts +130 -60
- 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/remove.ts +20 -4
- package/src/cli/secret-scan.ts +154 -0
- package/src/cli/sync-check.test.ts +2 -2
- package/src/cli/sync-check.ts +13 -3
- package/src/cli/team-commands.test.ts +2 -2
- package/src/cli/types.ts +5 -2
- package/src/cli/unreadable-report.ts +14 -0
- package/src/cli/update.ts +81 -5
- 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/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,70 @@
|
|
|
1
|
+
````markdown
|
|
2
|
+
# Lessons Learned
|
|
3
|
+
|
|
4
|
+
Structured log of tool/command pitfalls, workarounds, and correct approaches discovered through agent execution. **Every agent** must read this file before starting work and must add entries when they discover a new pitfall through trial-and-error.
|
|
5
|
+
|
|
6
|
+
> **This file is the collective memory of the agent team.** It prevents repeating the same mistakes across sessions.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## How to Use This File
|
|
11
|
+
|
|
12
|
+
### Before starting work
|
|
13
|
+
|
|
14
|
+
1. Read the **entire file** (or at minimum, the sections relevant to your task)
|
|
15
|
+
2. Apply any relevant lessons to your approach **before** attempting commands or tool calls
|
|
16
|
+
|
|
17
|
+
### When to add a new entry
|
|
18
|
+
|
|
19
|
+
Add a lesson when **any** of these occur:
|
|
20
|
+
- A command, tool call, or API call fails and you had to retry with a different approach
|
|
21
|
+
- You discover a parameter, syntax, or configuration quirk not documented elsewhere
|
|
22
|
+
- A workaround is needed for a third-party tool, MCP server, or platform limitation
|
|
23
|
+
- An approach that seems obvious turns out to be wrong
|
|
24
|
+
|
|
25
|
+
### Entry format
|
|
26
|
+
|
|
27
|
+
```markdown
|
|
28
|
+
### LES-XXX: Short descriptive title
|
|
29
|
+
|
|
30
|
+
| Field | Value |
|
|
31
|
+
|-------|-------|
|
|
32
|
+
| **Category** | `task-management` / `mcp-tools` / `codebase-tool` / `terminal` / `framework` / `cms` / `database` / `git` / `deployment` / `browser-testing` / `general` |
|
|
33
|
+
| **Added** | YYYY-MM-DD |
|
|
34
|
+
| **Severity** | `high` (blocks work) / `medium` (wastes 5+ min) / `low` (minor annoyance) |
|
|
35
|
+
|
|
36
|
+
**Problem:** What went wrong and what error or unexpected behavior was observed.
|
|
37
|
+
|
|
38
|
+
**Wrong approach:** The obvious/intuitive approach that fails.
|
|
39
|
+
|
|
40
|
+
**Correct approach:** The working solution.
|
|
41
|
+
|
|
42
|
+
**Why:** Root cause explanation (if known).
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Lessons
|
|
48
|
+
|
|
49
|
+
<!-- Lessons are appended here by agents during sessions.
|
|
50
|
+
Start numbering from LES-001. -->
|
|
51
|
+
|
|
52
|
+
---
|
|
53
|
+
|
|
54
|
+
## Index by Category
|
|
55
|
+
|
|
56
|
+
| Category | Lessons |
|
|
57
|
+
|----------|---------|
|
|
58
|
+
| `task-management` | — |
|
|
59
|
+
| `mcp-tools` | — |
|
|
60
|
+
| `codebase-tool` | — |
|
|
61
|
+
| `terminal` | — |
|
|
62
|
+
| `framework` | — |
|
|
63
|
+
| `cms` | — |
|
|
64
|
+
| `database` | — |
|
|
65
|
+
| `git` | — |
|
|
66
|
+
| `deployment` | — |
|
|
67
|
+
| `browser-testing` | — |
|
|
68
|
+
| `general` | — |
|
|
69
|
+
|
|
70
|
+
````
|
package/src/cli/init.test.ts
CHANGED
|
@@ -15,10 +15,11 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
18
|
-
import { mkdtemp, readFile, readdir, rm, unlink, writeFile } from 'node:fs/promises'
|
|
18
|
+
import { mkdtemp, readFile, readdir, rename, rm, unlink, writeFile } from 'node:fs/promises'
|
|
19
19
|
import { join, resolve } from 'node:path'
|
|
20
20
|
import { tmpdir } from 'node:os'
|
|
21
21
|
import { existsSync } from 'node:fs'
|
|
22
|
+
import { parse as parseToml } from 'smol-toml'
|
|
22
23
|
import type { StackConfig, RepoInfo } from './types.js'
|
|
23
24
|
import { updateGitignore } from './gitignore.js'
|
|
24
25
|
import {
|
|
@@ -448,12 +449,12 @@ describe('VS Code adapter install', () => {
|
|
|
448
449
|
const skills = await readdir(skillsDir)
|
|
449
450
|
|
|
450
451
|
// Selected plugin skills should be present
|
|
451
|
-
expect(skills).toContain('sanity')
|
|
452
|
-
expect(skills).toContain('linear')
|
|
452
|
+
expect(skills).toContain('sanity-cms')
|
|
453
|
+
expect(skills).toContain('linear-task-management')
|
|
453
454
|
// Unselected plugin skills should NOT be present
|
|
454
|
-
expect(skills).not.toContain('supabase')
|
|
455
|
-
expect(skills).not.toContain('slack')
|
|
456
|
-
expect(skills).not.toContain('vercel')
|
|
455
|
+
expect(skills).not.toContain('supabase-database')
|
|
456
|
+
expect(skills).not.toContain('slack-notifications')
|
|
457
|
+
expect(skills).not.toContain('vercel-deployment')
|
|
457
458
|
|
|
458
459
|
// Core skills (non-plugin) should always be present
|
|
459
460
|
expect(skills).toContain('accessibility-standards')
|
|
@@ -469,9 +470,9 @@ describe('VS Code adapter install', () => {
|
|
|
469
470
|
// Plugin-linked skill directories should be absent if tool not selected
|
|
470
471
|
// (The core skills directory names don't match plugin IDs — they're separate)
|
|
471
472
|
// But plugin SKILL.md dirs should not exist
|
|
472
|
-
expect(skills).not.toContain('sanity')
|
|
473
|
-
expect(skills).not.toContain('linear')
|
|
474
|
-
expect(skills).not.toContain('supabase')
|
|
473
|
+
expect(skills).not.toContain('sanity-cms')
|
|
474
|
+
expect(skills).not.toContain('linear-task-management')
|
|
475
|
+
expect(skills).not.toContain('supabase-database')
|
|
475
476
|
})
|
|
476
477
|
|
|
477
478
|
it('injects plugin tools into agent frontmatter', async () => {
|
|
@@ -671,12 +672,12 @@ describe('Cursor adapter install', () => {
|
|
|
671
672
|
expect(skills).toContain('testing-workflow.mdc')
|
|
672
673
|
|
|
673
674
|
// Selected plugin skills as .mdc
|
|
674
|
-
expect(skills).toContain('sanity.mdc')
|
|
675
|
-
expect(skills).toContain('linear.mdc')
|
|
675
|
+
expect(skills).toContain('sanity-cms.mdc')
|
|
676
|
+
expect(skills).toContain('linear-task-management.mdc')
|
|
676
677
|
|
|
677
678
|
// Unselected plugin skills should not be present
|
|
678
|
-
expect(skills).not.toContain('supabase.mdc')
|
|
679
|
-
expect(skills).not.toContain('slack.mdc')
|
|
679
|
+
expect(skills).not.toContain('supabase-database.mdc')
|
|
680
|
+
expect(skills).not.toContain('slack-notifications.mdc')
|
|
680
681
|
})
|
|
681
682
|
|
|
682
683
|
it('generates Cursor MCP config with mcpServers format', async () => {
|
|
@@ -734,6 +735,19 @@ describe('Claude Code adapter install', () => {
|
|
|
734
735
|
await rm(tempDir, { recursive: true, force: true })
|
|
735
736
|
})
|
|
736
737
|
|
|
738
|
+
it('moves an integration skill from its old directory and leaves no empty folder behind', async () => {
|
|
739
|
+
const adapter = await IDE_ADAPTERS['claude-code']()
|
|
740
|
+
await adapter.install(PKG_ROOT, tempDir, STACK_SANITY_LINEAR, EMPTY_REPO_INFO)
|
|
741
|
+
// As releases before integration skills took their own names left it.
|
|
742
|
+
const skills = join(tempDir, '.claude', 'skills')
|
|
743
|
+
await rename(join(skills, 'sanity-cms'), join(skills, 'sanity'))
|
|
744
|
+
const result = await adapter.update(PKG_ROOT, tempDir, STACK_SANITY_LINEAR, EMPTY_REPO_INFO)
|
|
745
|
+
const entries = await readdir(skills)
|
|
746
|
+
expect(entries).toContain('sanity-cms')
|
|
747
|
+
expect(entries).not.toContain('sanity')
|
|
748
|
+
expect(result.deleted).toContain('.claude/skills/sanity/SKILL.md')
|
|
749
|
+
})
|
|
750
|
+
|
|
737
751
|
it('creates CLAUDE.md with embedded instructions', async () => {
|
|
738
752
|
const adapter = await IDE_ADAPTERS['claude-code']()
|
|
739
753
|
await adapter.install(PKG_ROOT, tempDir, STACK_EMPTY, EMPTY_REPO_INFO)
|
|
@@ -777,10 +791,10 @@ describe('Claude Code adapter install', () => {
|
|
|
777
791
|
const content = await readFile(join(tempDir, 'CLAUDE.md'), 'utf8')
|
|
778
792
|
expect(content).toContain('## Available Skills')
|
|
779
793
|
expect(content).toContain('**self-improvement**')
|
|
780
|
-
expect(content).toContain('**sanity**')
|
|
781
|
-
expect(content).toContain('**linear**')
|
|
794
|
+
expect(content).toContain('**sanity-cms**')
|
|
795
|
+
expect(content).toContain('**linear-task-management**')
|
|
782
796
|
// Unselected plugin skills should NOT appear in skill index
|
|
783
|
-
expect(content).not.
|
|
797
|
+
expect(content).not.toContain('**supabase-database**')
|
|
784
798
|
})
|
|
785
799
|
|
|
786
800
|
it('strips frontmatter from agent files in .claude/agents/', async () => {
|
|
@@ -809,9 +823,9 @@ describe('Claude Code adapter install', () => {
|
|
|
809
823
|
|
|
810
824
|
// Skills are subdirectories (Anthropic's Claude Code Skills format)
|
|
811
825
|
expect(entries).toContain('self-improvement')
|
|
812
|
-
expect(entries).toContain('sanity')
|
|
813
|
-
expect(entries).toContain('linear')
|
|
814
|
-
expect(entries).not.toContain('supabase')
|
|
826
|
+
expect(entries).toContain('sanity-cms')
|
|
827
|
+
expect(entries).toContain('linear-task-management')
|
|
828
|
+
expect(entries).not.toContain('supabase-database')
|
|
815
829
|
|
|
816
830
|
// SKILL.md exists inside each skill subdirectory
|
|
817
831
|
const skillContent = await readFile(
|
|
@@ -1079,29 +1093,40 @@ describe('Codex adapter install', () => {
|
|
|
1079
1093
|
expect(content).toContain('.codex/')
|
|
1080
1094
|
})
|
|
1081
1095
|
|
|
1082
|
-
it('
|
|
1096
|
+
it('puts agents in .codex/ and skills where Codex reads them, .agents/skills/', async () => {
|
|
1083
1097
|
const adapter = await IDE_ADAPTERS['codex']()
|
|
1084
1098
|
await adapter.install(PKG_ROOT, tmpDir, STACK_SANITY_LINEAR)
|
|
1085
1099
|
expect(existsSync(join(tmpDir, '.codex', 'agents'))).toBe(true)
|
|
1086
|
-
expect(existsSync(join(tmpDir, '.
|
|
1100
|
+
expect(existsSync(join(tmpDir, '.agents', 'skills', 'testing-workflow', 'SKILL.md'))).toBe(true)
|
|
1101
|
+
// Codex has never read this; nothing should be written there.
|
|
1102
|
+
expect(existsSync(join(tmpDir, '.codex', 'skills'))).toBe(false)
|
|
1103
|
+
const root = await readFile(join(tmpDir, 'AGENTS.md'), 'utf8')
|
|
1104
|
+
expect(root).toContain('`.agents/skills/testing-workflow/SKILL.md`')
|
|
1087
1105
|
})
|
|
1088
1106
|
|
|
1089
|
-
it('
|
|
1107
|
+
it('writes MCP servers as [mcp_servers] tables in .codex/config.toml', async () => {
|
|
1090
1108
|
const adapter = await IDE_ADAPTERS['codex']()
|
|
1091
1109
|
await adapter.install(PKG_ROOT, tmpDir, STACK_SANITY_LINEAR)
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
const
|
|
1095
|
-
expect(
|
|
1110
|
+
expect(existsSync(join(tmpDir, '.codex', 'mcp.json'))).toBe(false)
|
|
1111
|
+
const text = await readFile(join(tmpDir, '.codex', 'config.toml'), 'utf8')
|
|
1112
|
+
const config = parseToml(text) as { mcp_servers: Record<string, Record<string, unknown>> }
|
|
1113
|
+
expect(Object.keys(config.mcp_servers).length).toBeGreaterThan(0)
|
|
1114
|
+
for (const entry of Object.values(config.mcp_servers)) {
|
|
1115
|
+
// Codex expands no variables, so none may be written as text.
|
|
1116
|
+
expect(JSON.stringify(entry)).not.toMatch(/\$\{[A-Z_]+\}/)
|
|
1117
|
+
expect('url' in entry || 'command' in entry).toBe(true)
|
|
1118
|
+
}
|
|
1096
1119
|
})
|
|
1097
1120
|
|
|
1098
|
-
it('getManagedPaths includes AGENTS.md
|
|
1121
|
+
it('getManagedPaths includes AGENTS.md, the .codex dirs and .agents/skills/', async () => {
|
|
1099
1122
|
const adapter = await IDE_ADAPTERS['codex']()
|
|
1100
1123
|
const paths = adapter.getManagedPaths()
|
|
1101
1124
|
expect(paths.merged).toContain('AGENTS.md')
|
|
1102
1125
|
expect(paths.framework).not.toContain('AGENTS.md')
|
|
1103
|
-
expect(paths.framework.
|
|
1104
|
-
expect(paths.
|
|
1126
|
+
expect(paths.framework).toContain('.codex/agents/')
|
|
1127
|
+
expect(paths.framework).toContain('.agents/skills/')
|
|
1128
|
+
expect(paths.framework).not.toContain('.codex/skills/')
|
|
1129
|
+
expect(paths.customizable).toContain('.codex/config.toml')
|
|
1105
1130
|
})
|
|
1106
1131
|
})
|
|
1107
1132
|
|
|
@@ -1320,11 +1345,11 @@ describe('full stack configuration', () => {
|
|
|
1320
1345
|
|
|
1321
1346
|
// All 5 plugin skills should be installed
|
|
1322
1347
|
const skills = await readdir(join(tempDir, '.github', 'skills'))
|
|
1323
|
-
expect(skills).toContain('sanity')
|
|
1324
|
-
expect(skills).toContain('supabase')
|
|
1325
|
-
expect(skills).toContain('vercel')
|
|
1326
|
-
expect(skills).toContain('linear')
|
|
1327
|
-
expect(skills).toContain('slack')
|
|
1348
|
+
expect(skills).toContain('sanity-cms')
|
|
1349
|
+
expect(skills).toContain('supabase-database')
|
|
1350
|
+
expect(skills).toContain('vercel-deployment')
|
|
1351
|
+
expect(skills).toContain('linear-task-management')
|
|
1352
|
+
expect(skills).toContain('slack-notifications')
|
|
1328
1353
|
|
|
1329
1354
|
// MCP config should have all 5 servers
|
|
1330
1355
|
const mcpConfig = await readJson<Record<string, unknown>>(
|
package/src/cli/init.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { readManifest, writeManifest, createManifest } from './manifest.js'
|
|
|
6
6
|
import { removeDirIfExists, copyDir, getOrchestratorRoot } from './copy.js'
|
|
7
7
|
import { updateGitignore } from './gitignore.js'
|
|
8
8
|
import { getCustomizationsTransform } from './stack-config.js'
|
|
9
|
-
import { getMcpConfigRelPath, stripManagedMcpServers } from './mcp.js'
|
|
9
|
+
import { getMcpConfigRelPath, stripManagedMcpServers, retireLegacyMcpConfig } from './mcp.js'
|
|
10
10
|
import { getPluginsBySubCategory } from '../orchestrator/plugins/index.js'
|
|
11
11
|
import type { PluginConfig } from '../orchestrator/plugins/types.js'
|
|
12
12
|
import { detectRepoInfo, mergeStackIntoRepoInfo, formatRepoInfo, buildDetectedToolsSet, detectCurrentIde, detectAssistantConfigs } from './detect.js'
|
|
@@ -16,7 +16,7 @@ import type { CliContext, CopyResults, IdeAdapter, IdeChoice, TechTool, TeamTool
|
|
|
16
16
|
import { bootstrapCustomizations } from './bootstrap.js'
|
|
17
17
|
import { stripManagedBlock, stripManagedBlockFromFile } from './managed-block.js'
|
|
18
18
|
import { resolveManagedPaths, declaredManagedPaths, ownerOf, removeOwnedFiles } from './managed-paths.js'
|
|
19
|
-
import { noteUnreadable } from './unreadable-report.js'
|
|
19
|
+
import { noteUnreadable, whyLeftAlone } from './unreadable-report.js'
|
|
20
20
|
import { resolveSources, materialize, hasErrors, formatIssues, requiredEnvVars } from './layers.js'
|
|
21
21
|
import { buildLock, writeLock, priorTeam } from './lock.js'
|
|
22
22
|
import { parseVersion, compareVersions } from './version-range.js'
|
|
@@ -409,6 +409,7 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
409
409
|
for (const id of dropped) {
|
|
410
410
|
if ((ides as string[]).includes(id)) continue
|
|
411
411
|
await stripManagedMcpServers(projectRoot, id as IdeChoice)
|
|
412
|
+
await retireLegacyMcpConfig(projectRoot, id as IdeChoice)
|
|
412
413
|
}
|
|
413
414
|
|
|
414
415
|
// Co-owned files are not ours to delete — take back only the block, and
|
|
@@ -659,7 +660,7 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
659
660
|
const name = isAbsolute(abs) ? relative(projectRoot, abs) : abs
|
|
660
661
|
console.log(
|
|
661
662
|
` ${c.yellow('!')} Left ${name} alone — ` +
|
|
662
|
-
(why
|
|
663
|
+
whyLeftAlone(name, why),
|
|
663
664
|
)
|
|
664
665
|
// `--force` is not decoration. A plain `sync` short-circuits when nothing
|
|
665
666
|
// has drifted, and the MCP config is a customizable path the drift checker
|
|
@@ -670,7 +671,7 @@ export default async function init({ pkgRoot, args }: CliContext): Promise<void>
|
|
|
670
671
|
// servers" for every entry, and the list now also carries generated rule and
|
|
671
672
|
// skill files, so a skipped `.cursor/rules/x.mdc` was explained in terms of a
|
|
672
673
|
// feature that has nothing to do with it.
|
|
673
|
-
const isMcp = /(^|[/\\])(\.mcp\.json|mcp\.json|opencode\.json)$/.test(name)
|
|
674
|
+
const isMcp = /(^|[/\\])(\.mcp\.json|mcp\.json|mcp_config\.json|opencode\.json|config\.toml)$/.test(name)
|
|
674
675
|
console.log(
|
|
675
676
|
` ${c.dim(
|
|
676
677
|
isMcp
|
package/src/cli/layers.test.ts
CHANGED
|
@@ -192,7 +192,7 @@ describe('resolving layers', () => {
|
|
|
192
192
|
expect(messages).toContain('"@acme/missing", which is not installed')
|
|
193
193
|
expect(messages).toContain('version belongs in package.json')
|
|
194
194
|
expect(messages).toContain('an absolute path')
|
|
195
|
-
expect(messages).toContain('"plain", which is
|
|
195
|
+
expect(messages).toContain('"plain", which is neither an OpenCastle baseline nor an Agent Plugin')
|
|
196
196
|
expect(hasErrors(r)).toBe(true)
|
|
197
197
|
})
|
|
198
198
|
|
|
@@ -340,7 +340,7 @@ describe('the merged source and the lock', () => {
|
|
|
340
340
|
const stack: StackConfig = { ides: ['claude-code'], techTools: ['sentry'], teamTools: [] }
|
|
341
341
|
const src = materialize(resolveSources({ pkgRoot, projectRoot: project, stack }), pkgRoot)
|
|
342
342
|
try {
|
|
343
|
-
expect(readdirSync(join(src.root, 'skills', 'sentry'))).toEqual(['SKILL.md'])
|
|
343
|
+
expect(readdirSync(join(src.root, 'skills', 'sentry-monitoring'))).toEqual(['SKILL.md'])
|
|
344
344
|
} finally {
|
|
345
345
|
src.dispose()
|
|
346
346
|
}
|
package/src/cli/layers.ts
CHANGED
|
@@ -20,6 +20,7 @@ import { packageLaunch, isPinned } from './mcp-audit.js'
|
|
|
20
20
|
import { disallowedBy, hostDisallowedBy, findInlineSecret, emptyPolicy, globMatch, hostOfUrl, hostAllowedBy, type EffectivePolicy } from './policy.js'
|
|
21
21
|
import { LOCAL_DIRS } from './gitignore.js'
|
|
22
22
|
import { satisfies, parseVersion, compareVersions } from './version-range.js'
|
|
23
|
+
import { EXTENSION_NAMESPACE, isAgentPlugin, readAgentPlugin, teamServerFor } from './agent-plugin.js'
|
|
23
24
|
import {
|
|
24
25
|
CONTENT_KINDS,
|
|
25
26
|
TEAM_CONFIG_REL,
|
|
@@ -61,6 +62,14 @@ export interface Layer {
|
|
|
61
62
|
configFile?: string
|
|
62
63
|
/** A digest of the layer's content, so a baseline that changed without a version bump still shows. */
|
|
63
64
|
integrity?: string
|
|
65
|
+
/**
|
|
66
|
+
* For a baseline that is an Agent Plugin: the `dev.opencastle/` directory
|
|
67
|
+
* holding everything but skills — instructions, agents, prompts, workflows
|
|
68
|
+
* and `config.json`. Skills stay in the plugin's own `skills/`.
|
|
69
|
+
*/
|
|
70
|
+
extensionRoot?: string
|
|
71
|
+
/** Servers that came from a plugin's `mcp.json`, and the file to name for each. */
|
|
72
|
+
serverWhere?: Record<string, string>
|
|
64
73
|
}
|
|
65
74
|
|
|
66
75
|
export interface ContentItem {
|
|
@@ -259,7 +268,7 @@ function scanLayer(layer: Layer, projectRoot: string | null): { items: ContentIt
|
|
|
259
268
|
})
|
|
260
269
|
}
|
|
261
270
|
for (const kind of CONTENT_KINDS) {
|
|
262
|
-
const dir = join(layer.root, dirs[kind])
|
|
271
|
+
const dir = join(kind !== 'skills' && layer.extensionRoot ? layer.extensionRoot : layer.root, dirs[kind])
|
|
263
272
|
for (const entry of listDir(dir, within, skipped)) {
|
|
264
273
|
if (kind === 'skills') {
|
|
265
274
|
if (!entry.isDir) continue
|
|
@@ -351,6 +360,18 @@ function findPackageDir(name: string, fromDir: string): string | null {
|
|
|
351
360
|
}
|
|
352
361
|
}
|
|
353
362
|
|
|
363
|
+
/** Where a package is found under `node_modules`, before any link is followed. */
|
|
364
|
+
function packageLink(name: string, fromDir: string): string | null {
|
|
365
|
+
let dir = fromDir
|
|
366
|
+
for (;;) {
|
|
367
|
+
const candidate = join(dir, 'node_modules', ...name.split('/'))
|
|
368
|
+
if (existsSync(join(candidate, 'package.json'))) return candidate
|
|
369
|
+
const parent = dirname(dir)
|
|
370
|
+
if (parent === dir) return null
|
|
371
|
+
dir = parent
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
354
375
|
function readLayerConfig(root: string, where: string): { config: TeamConfig; issues: TeamIssue[] } {
|
|
355
376
|
const file = join(root, LAYER_CONFIG_FILE)
|
|
356
377
|
if (!existsSync(file)) return { config: {}, issues: [] }
|
|
@@ -396,9 +417,13 @@ function loadExtends(
|
|
|
396
417
|
let id: string
|
|
397
418
|
let version: string | undefined
|
|
398
419
|
let configWhere: string
|
|
420
|
+
// Where the layer is as the project sees it — `node_modules/@acme/x`, not
|
|
421
|
+
// the store path a link resolves to — for paths written into its configs.
|
|
422
|
+
let seenAt: string
|
|
399
423
|
|
|
400
424
|
if (spec.startsWith('./') || spec.startsWith('../')) {
|
|
401
425
|
root = resolve(fromDir, spec)
|
|
426
|
+
seenAt = root
|
|
402
427
|
if (!existsSync(root) || !statSync(root).isDirectory()) {
|
|
403
428
|
fail(`extends "${spec}", which is not a directory (looked in ${display(ctx.projectRoot, root)})`)
|
|
404
429
|
return
|
|
@@ -456,14 +481,19 @@ function loadExtends(
|
|
|
456
481
|
return
|
|
457
482
|
}
|
|
458
483
|
const decl = pkg.opencastle as { baseline?: unknown } | undefined
|
|
459
|
-
|
|
484
|
+
const declared = decl && typeof decl === 'object' && 'baseline' in decl && typeof decl.baseline === 'string'
|
|
485
|
+
// Any Agent Plugin published to npm can be extended as it is: its skills
|
|
486
|
+
// and portable servers are what a baseline's are.
|
|
487
|
+
if (!declared && !isAgentPlugin(pkgDir)) {
|
|
460
488
|
fail(
|
|
461
|
-
`extends "${spec}", which is
|
|
462
|
-
`a baseline declares itself in its package.json: "opencastle": { "baseline": "." } (opencastle baseline init creates one)`,
|
|
489
|
+
`extends "${spec}", which is neither an OpenCastle baseline nor an Agent Plugin`,
|
|
490
|
+
`a baseline declares itself in its package.json: "opencastle": { "baseline": "." } (opencastle baseline init creates one); an Agent Plugin has a plugin.json at its root`,
|
|
463
491
|
)
|
|
464
492
|
return
|
|
465
493
|
}
|
|
466
|
-
root = resolve(pkgDir, decl.baseline)
|
|
494
|
+
root = declared ? resolve(pkgDir, (decl as { baseline: string }).baseline) : pkgDir
|
|
495
|
+
const linked = packageLink(spec, fromDir)
|
|
496
|
+
seenAt = linked ? resolve(linked, relative(pkgDir, root)) : root
|
|
467
497
|
if (relative(pkgDir, root).startsWith('..') || !existsSync(root)) {
|
|
468
498
|
fail(`extends "${spec}", whose "opencastle.baseline" points outside the package or at nothing`)
|
|
469
499
|
return
|
|
@@ -489,6 +519,16 @@ function loadExtends(
|
|
|
489
519
|
if (ctx.seen.has(real)) return
|
|
490
520
|
ctx.seen.add(real)
|
|
491
521
|
|
|
522
|
+
if (isAgentPlugin(root)) {
|
|
523
|
+
const plugin = loadPluginLayer(root, seenAt, id, declaredIn, ctx)
|
|
524
|
+
if (!plugin) return
|
|
525
|
+
for (const inner of plugin.config.extends ?? []) {
|
|
526
|
+
loadExtends(inner, plugin.extensionRoot, plugin.configFile, [...chain, real], ctx)
|
|
527
|
+
}
|
|
528
|
+
ctx.layers.push({ id, kind: 'baseline', root, version: version ?? plugin.version, integrity: layerIntegrity(root), ...plugin })
|
|
529
|
+
return
|
|
530
|
+
}
|
|
531
|
+
|
|
492
532
|
const { config, issues } = readLayerConfig(root, configWhere)
|
|
493
533
|
ctx.issues.push(...issues)
|
|
494
534
|
for (const inner of config.extends ?? []) {
|
|
@@ -497,6 +537,71 @@ function loadExtends(
|
|
|
497
537
|
ctx.layers.push({ id, kind: 'baseline', root, version, config, configFile: configWhere, integrity: layerIntegrity(root) })
|
|
498
538
|
}
|
|
499
539
|
|
|
540
|
+
/**
|
|
541
|
+
* A baseline that is an Agent Plugin: its skills in `skills/`, its portable
|
|
542
|
+
* servers in `mcp.json`, and OpenCastle's own content and config in
|
|
543
|
+
* `dev.opencastle/`. Returns null, having said why, for one a conformant
|
|
544
|
+
* client would refuse.
|
|
545
|
+
*
|
|
546
|
+
* A server or skill a client would skip is reported, not fatal, as the
|
|
547
|
+
* standard has it: one bad component does not stop the rest from loading.
|
|
548
|
+
*/
|
|
549
|
+
function loadPluginLayer(
|
|
550
|
+
root: string,
|
|
551
|
+
seenAt: string,
|
|
552
|
+
id: string,
|
|
553
|
+
declaredIn: string,
|
|
554
|
+
ctx: ExtendsContext,
|
|
555
|
+
): { config: TeamConfig; configFile: string; extensionRoot: string; serverWhere: Record<string, string>; version?: string } | null {
|
|
556
|
+
const report = readAgentPlugin(root)
|
|
557
|
+
if (!report.manifest) {
|
|
558
|
+
ctx.issues.push({
|
|
559
|
+
level: 'error',
|
|
560
|
+
where: declaredIn,
|
|
561
|
+
message: `extends ${id}, which is not a valid Agent Plugin: ${report.errors[0] ?? 'its plugin.json cannot be read'}`,
|
|
562
|
+
fix: `run opencastle plugin check on it`,
|
|
563
|
+
})
|
|
564
|
+
return null
|
|
565
|
+
}
|
|
566
|
+
// `skills/x/SKILL.md: name … must match` — the file, then what is wrong with it.
|
|
567
|
+
for (const e of report.errors) {
|
|
568
|
+
const at = e.indexOf(': ')
|
|
569
|
+
ctx.issues.push({ level: 'warning', where: `${id}/${e.slice(0, at)}`, message: e.slice(at + 2) })
|
|
570
|
+
}
|
|
571
|
+
const extensionRoot = join(root, EXTENSION_NAMESPACE)
|
|
572
|
+
const configFile = `${id}/${EXTENSION_NAMESPACE}/${LAYER_CONFIG_FILE}`
|
|
573
|
+
const { config, issues } = readLayerConfig(extensionRoot, configFile)
|
|
574
|
+
ctx.issues.push(...issues)
|
|
575
|
+
const servers: Record<string, TeamMcpServer> = { ...(config.mcpServers ?? {}) }
|
|
576
|
+
const serverWhere: Record<string, string> = {}
|
|
577
|
+
const pluginPath = posix(relative(ctx.projectRoot, seenAt))
|
|
578
|
+
for (const [key, portable] of Object.entries(report.servers)) {
|
|
579
|
+
if (key in servers) {
|
|
580
|
+
ctx.issues.push({
|
|
581
|
+
level: 'error',
|
|
582
|
+
where: `${id}/mcp.json`,
|
|
583
|
+
message: `defines MCP server "${key}", which ${configFile} defines too`,
|
|
584
|
+
fix: 'keep one: mcp.json for a server every assistant can start as it is, config.json for one that needs ${NAME} variables',
|
|
585
|
+
})
|
|
586
|
+
continue
|
|
587
|
+
}
|
|
588
|
+
const { server, skipped } = teamServerFor(portable, pluginPath)
|
|
589
|
+
if (!server) {
|
|
590
|
+
ctx.issues.push({ level: 'warning', where: `${id}/mcp.json`, message: `MCP server "${key}" ${skipped}` })
|
|
591
|
+
continue
|
|
592
|
+
}
|
|
593
|
+
servers[key] = server
|
|
594
|
+
serverWhere[key] = `${id}/mcp.json`
|
|
595
|
+
}
|
|
596
|
+
return {
|
|
597
|
+
config: { ...config, ...(Object.keys(servers).length > 0 && { mcpServers: servers }) },
|
|
598
|
+
configFile,
|
|
599
|
+
extensionRoot,
|
|
600
|
+
serverWhere,
|
|
601
|
+
version: report.manifest.version,
|
|
602
|
+
}
|
|
603
|
+
}
|
|
604
|
+
|
|
500
605
|
/** `${VAR}`, `${env:VAR}` and `{env:VAR}` all mean the same variable. */
|
|
501
606
|
export function normaliseRefs(value: string): string {
|
|
502
607
|
return value.replace(/\$\{env:([A-Za-z_][A-Za-z0-9_]*)\}/g, '${$1}').replace(/(?<!\$)\{env:([A-Za-z_][A-Za-z0-9_]*)\}/g, '${$1}')
|
|
@@ -563,31 +668,55 @@ export function resolveSources(opts: ResolveOptions): ResolvedSources {
|
|
|
563
668
|
items.set(key(item), item)
|
|
564
669
|
remember(key(item), item)
|
|
565
670
|
}
|
|
566
|
-
// Integration skills:
|
|
671
|
+
// Integration skills: each integration is an Agent Plugin, and its skill sits
|
|
672
|
+
// where the standard puts one — `skills/<name>/SKILL.md`, named as its
|
|
673
|
+
// directory is. They used to be compiled under the integration's id
|
|
674
|
+
// (`skills/supabase/`) while their frontmatter said `supabase-database`, and
|
|
675
|
+
// an assistant that follows the Agent Skills spec skips a skill whose name
|
|
676
|
+
// does not match its directory.
|
|
567
677
|
const pluginsRoot = getPluginsRoot(pkgRoot)
|
|
568
678
|
const includedPlugins = stack ? getIncludedPluginIds(stack) : null
|
|
569
679
|
for (const entry of listDir(pluginsRoot)) {
|
|
570
680
|
if (!entry.isDir) continue
|
|
571
|
-
const
|
|
681
|
+
const name = PLUGINS[entry.name]?.skillName
|
|
682
|
+
if (!name) continue
|
|
683
|
+
const skill = join(pluginsRoot, entry.name, 'skills', name, 'SKILL.md')
|
|
572
684
|
if (!existsSync(skill)) continue
|
|
573
685
|
if (includedPlugins && !includedPlugins.has(entry.name)) {
|
|
574
|
-
stackOut.add(`skills/${
|
|
686
|
+
stackOut.add(`skills/${name}`)
|
|
575
687
|
continue
|
|
576
688
|
}
|
|
577
|
-
const k = `skills/${
|
|
689
|
+
const k = `skills/${name}`
|
|
578
690
|
const prev = items.get(k)
|
|
579
|
-
const item: ContentItem = { kind: 'skills', name
|
|
691
|
+
const item: ContentItem = { kind: 'skills', name, layer: 'opencastle', path: skill, plugin: entry.name, ...(prev && { overrides: prev.layer }) }
|
|
580
692
|
items.set(k, item)
|
|
581
693
|
remember(k, item)
|
|
582
694
|
}
|
|
695
|
+
// `skills/supabase`, as a layer wrote it before integration skills took their
|
|
696
|
+
// own names, still means the integration's skill.
|
|
697
|
+
const integrationSkill = (ref: string): string | null => {
|
|
698
|
+
const m = /^skills\/(.+)$/.exec(ref)
|
|
699
|
+
const name = m ? PLUGINS[m[1]]?.skillName : undefined
|
|
700
|
+
return name && name !== m![1] ? `skills/${name}` : null
|
|
701
|
+
}
|
|
583
702
|
|
|
584
703
|
const excluded: ResolvedSources['excluded'] = []
|
|
585
704
|
for (const layer of layers) {
|
|
586
705
|
if (layer.kind === 'core') continue
|
|
587
706
|
const where = layer.configFile ?? layer.id
|
|
588
|
-
for (const
|
|
707
|
+
for (const written of layer.config.exclude ?? []) {
|
|
589
708
|
// Servers are excluded where servers are merged, below.
|
|
590
|
-
if (
|
|
709
|
+
if (written.startsWith('mcpServers/')) continue
|
|
710
|
+
const renamed = items.has(written) ? null : integrationSkill(written)
|
|
711
|
+
if (renamed) {
|
|
712
|
+
issues.push({
|
|
713
|
+
level: 'warning',
|
|
714
|
+
where,
|
|
715
|
+
message: `excludes ${written}; integration skills are named for what they teach now — this means ${renamed}`,
|
|
716
|
+
fix: `write "${renamed}"`,
|
|
717
|
+
})
|
|
718
|
+
}
|
|
719
|
+
const ref = renamed ?? written
|
|
591
720
|
const prev = items.get(ref)
|
|
592
721
|
if (prev) {
|
|
593
722
|
items.delete(ref)
|
|
@@ -735,7 +864,8 @@ export function resolveSources(opts: ResolveOptions): ResolvedSources {
|
|
|
735
864
|
excluded.push({ ref, by: layer.id, from: 'mcp' })
|
|
736
865
|
}
|
|
737
866
|
for (const [k, raw] of Object.entries(layer.config.mcpServers ?? {})) {
|
|
738
|
-
const
|
|
867
|
+
const serverWhere = layer.serverWhere?.[k] ?? where
|
|
868
|
+
const shape = checkServerShape(k, raw, serverWhere)
|
|
739
869
|
if (shape.length > 0) {
|
|
740
870
|
issues.push(...shape)
|
|
741
871
|
continue
|
|
@@ -749,7 +879,7 @@ export function resolveSources(opts: ResolveOptions): ResolvedSources {
|
|
|
749
879
|
headers: Object.fromEntries(Object.entries(raw.headers).map(([n, val]) => [n, normaliseRefs(val)])),
|
|
750
880
|
}),
|
|
751
881
|
}
|
|
752
|
-
servers.set(k, { key: k, from: layer.id, server, where })
|
|
882
|
+
servers.set(k, { key: k, from: layer.id, server, where: serverWhere })
|
|
753
883
|
excludedServers.delete(k)
|
|
754
884
|
}
|
|
755
885
|
}
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
*/
|
|
12
12
|
import { mkdtempSync, mkdirSync, writeFileSync, readFileSync, readdirSync, existsSync, rmSync } from 'node:fs'
|
|
13
13
|
import { tmpdir } from 'node:os'
|
|
14
|
-
import { join, resolve } from 'node:path'
|
|
14
|
+
import { basename, join, resolve } from 'node:path'
|
|
15
15
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest'
|
|
16
16
|
|
|
17
17
|
vi.mock('./prompt.js', async () => {
|
|
@@ -265,6 +265,13 @@ describe('sync never edits what the user wrote in .opencastle/', () => {
|
|
|
265
265
|
const init = (await import('./init.js')).default
|
|
266
266
|
await init({ pkgRoot, args: ['--yes'] })
|
|
267
267
|
|
|
268
|
+
// A lesson an agent recorded is the team's writing too.
|
|
269
|
+
mkdirSync(join(dir, '.opencastle', 'lessons'), { recursive: true })
|
|
270
|
+
writeFileSync(
|
|
271
|
+
join(dir, '.opencastle', 'lessons', 'LES-001-quote-variables.md'),
|
|
272
|
+
'---\nid: "LES-001"\ntitle: "Quote variables"\ncategory: "terminal"\nseverity: "low"\nadded: "2026-01-01"\n---\n\n**Problem:** spaces.\n',
|
|
273
|
+
)
|
|
274
|
+
|
|
268
275
|
// Sentinel every file, and remember the exact bytes.
|
|
269
276
|
const before = new Map<string, string>()
|
|
270
277
|
const walk = (d: string): string[] =>
|
|
@@ -273,6 +280,9 @@ describe('sync never edits what the user wrote in .opencastle/', () => {
|
|
|
273
280
|
)
|
|
274
281
|
for (const f of walk(join(dir, '.opencastle'))) {
|
|
275
282
|
if (!f.endsWith('.md')) continue
|
|
283
|
+
// The lessons index is compiled from `lessons/` — it says so on its
|
|
284
|
+
// first line, and `sync` rewrites it, as it rewrites the lock.
|
|
285
|
+
if (basename(f) === 'LESSONS-LEARNED.md') continue
|
|
276
286
|
const text = `${readFileSync(f, 'utf8')}\n<!-- SENTINEL -->\n`
|
|
277
287
|
writeFileSync(f, text)
|
|
278
288
|
before.set(f, text)
|