contextos-agents 1.5.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/.agents/AGENTS.md +421 -0
- package/.agents/adapters/aider/export.js +137 -0
- package/.agents/adapters/claude/export.js +55 -0
- package/.agents/adapters/copilot/export.js +107 -0
- package/.agents/adapters/cursor/export.js +210 -0
- package/.agents/adapters/gemini/export.js +115 -0
- package/.agents/adapters/shared.js +119 -0
- package/.agents/adapters/zed/export.js +111 -0
- package/.agents/core/profiles/backend.yaml +47 -0
- package/.agents/core/profiles/enterprise.yaml +46 -0
- package/.agents/core/profiles/frontend.yaml +46 -0
- package/.agents/core/profiles/hackathon.yaml +45 -0
- package/.agents/core/profiles/mvp.yaml +43 -0
- package/.agents/core/profiles/startup.yaml +48 -0
- package/.agents/core/skills/adapters/EXAMPLES.md +19 -0
- package/.agents/core/skills/adapters/SKILL.md +105 -0
- package/.agents/core/skills/adapters/TROUBLESHOOTING.md +7 -0
- package/.agents/core/skills/adapters/VALIDATION.json +12 -0
- package/.agents/core/skills/adapters/skill.yaml +10 -0
- package/.agents/core/skills/architecture-diagrams/SKILL.md +108 -0
- package/.agents/core/skills/architecture-diagrams/VALIDATION.json +12 -0
- package/.agents/core/skills/architecture-diagrams/skill.yaml +8 -0
- package/.agents/core/skills/brutalist-design/SKILL.md +150 -0
- package/.agents/core/skills/brutalist-design/VALIDATION.json +12 -0
- package/.agents/core/skills/brutalist-design/skill.yaml +8 -0
- package/.agents/core/skills/context-manager/EXAMPLES.md +19 -0
- package/.agents/core/skills/context-manager/SKILL.md +126 -0
- package/.agents/core/skills/context-manager/TROUBLESHOOTING.md +7 -0
- package/.agents/core/skills/context-manager/VALIDATION.json +12 -0
- package/.agents/core/skills/context-manager/skill.yaml +10 -0
- package/.agents/core/skills/context-os/EXAMPLES.md +21 -0
- package/.agents/core/skills/context-os/SKILL.md +169 -0
- package/.agents/core/skills/context-os/TROUBLESHOOTING.md +7 -0
- package/.agents/core/skills/context-os/VALIDATION.json +12 -0
- package/.agents/core/skills/context-os/packs.yaml +59 -0
- package/.agents/core/skills/context-os/references/context-rules.md +68 -0
- package/.agents/core/skills/context-os/references/pipeline.md +119 -0
- package/.agents/core/skills/context-os/references/project-graph.md +103 -0
- package/.agents/core/skills/context-os/rules.yaml +135 -0
- package/.agents/core/skills/context-os/skill.yaml +10 -0
- package/.agents/core/skills/database/EXAMPLES.md +74 -0
- package/.agents/core/skills/database/SKILL.md +101 -0
- package/.agents/core/skills/database/TROUBLESHOOTING.md +18 -0
- package/.agents/core/skills/database/VALIDATION.json +11 -0
- package/.agents/core/skills/database/skill.yaml +25 -0
- package/.agents/core/skills/ddd/EXAMPLES.md +42 -0
- package/.agents/core/skills/ddd/SKILL.md +247 -0
- package/.agents/core/skills/ddd/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ddd/VALIDATION.json +12 -0
- package/.agents/core/skills/ddd/ddd.md +178 -0
- package/.agents/core/skills/ddd/skill.yaml +10 -0
- package/.agents/core/skills/decisions/EXAMPLES.md +35 -0
- package/.agents/core/skills/decisions/SKILL.md +90 -0
- package/.agents/core/skills/decisions/TROUBLESHOOTING.md +13 -0
- package/.agents/core/skills/decisions/VALIDATION.json +12 -0
- package/.agents/core/skills/decisions/skill.yaml +10 -0
- package/.agents/core/skills/docker/EXAMPLES.md +56 -0
- package/.agents/core/skills/docker/SKILL.md +63 -0
- package/.agents/core/skills/docker/TROUBLESHOOTING.md +18 -0
- package/.agents/core/skills/docker/VALIDATION.json +11 -0
- package/.agents/core/skills/docker/skill.yaml +23 -0
- package/.agents/core/skills/engineering-workflow/EXAMPLES.md +57 -0
- package/.agents/core/skills/engineering-workflow/SKILL.md +343 -0
- package/.agents/core/skills/engineering-workflow/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/engineering-workflow/VALIDATION.json +12 -0
- package/.agents/core/skills/engineering-workflow/skill.yaml +13 -0
- package/.agents/core/skills/fastapi/EXAMPLES.md +36 -0
- package/.agents/core/skills/fastapi/SKILL.md +148 -0
- package/.agents/core/skills/fastapi/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/fastapi/VALIDATION.json +12 -0
- package/.agents/core/skills/fastapi/fastapi.md +112 -0
- package/.agents/core/skills/fastapi/skill.yaml +10 -0
- package/.agents/core/skills/gemini-precision/SKILL.md +169 -0
- package/.agents/core/skills/gemini-precision/VALIDATION.json +12 -0
- package/.agents/core/skills/gemini-precision/skill.yaml +9 -0
- package/.agents/core/skills/generators/EXAMPLES.md +19 -0
- package/.agents/core/skills/generators/SKILL.md +112 -0
- package/.agents/core/skills/generators/TROUBLESHOOTING.md +7 -0
- package/.agents/core/skills/generators/VALIDATION.json +12 -0
- package/.agents/core/skills/generators/skill.yaml +10 -0
- package/.agents/core/skills/generators/templates/API.md +77 -0
- package/.agents/core/skills/generators/templates/ARCHITECTURE.md +70 -0
- package/.agents/core/skills/generators/templates/DATABASE.md +42 -0
- package/.agents/core/skills/generators/templates/DECISION.md +46 -0
- package/.agents/core/skills/generators/templates/PRD.md +67 -0
- package/.agents/core/skills/generators/templates/PROJECT_GRAPH.md +56 -0
- package/.agents/core/skills/generators/templates/ROADMAP.md +51 -0
- package/.agents/core/skills/generators/templates/TASKS.md +43 -0
- package/.agents/core/skills/generators/templates/UI.md +73 -0
- package/.agents/core/skills/graphify/EXAMPLES.md +73 -0
- package/.agents/core/skills/graphify/SKILL.md +130 -0
- package/.agents/core/skills/graphify/VALIDATION.json +12 -0
- package/.agents/core/skills/graphify/skill.yaml +13 -0
- package/.agents/core/skills/gstack-roles/EXAMPLES.md +23 -0
- package/.agents/core/skills/gstack-roles/SKILL.md +152 -0
- package/.agents/core/skills/gstack-roles/TROUBLESHOOTING.md +13 -0
- package/.agents/core/skills/gstack-roles/VALIDATION.json +12 -0
- package/.agents/core/skills/gstack-roles/skill.yaml +12 -0
- package/.agents/core/skills/impeccable-design/EXAMPLES.md +26 -0
- package/.agents/core/skills/impeccable-design/SKILL.md +201 -0
- package/.agents/core/skills/impeccable-design/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/impeccable-design/VALIDATION.json +12 -0
- package/.agents/core/skills/impeccable-design/skill.yaml +14 -0
- package/.agents/core/skills/interview-me/SKILL.md +97 -0
- package/.agents/core/skills/interview-me/VALIDATION.json +12 -0
- package/.agents/core/skills/interview-me/skill.yaml +8 -0
- package/.agents/core/skills/microservices/EXAMPLES.md +38 -0
- package/.agents/core/skills/microservices/SKILL.md +164 -0
- package/.agents/core/skills/microservices/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/microservices/VALIDATION.json +12 -0
- package/.agents/core/skills/microservices/microservices.md +119 -0
- package/.agents/core/skills/microservices/skill.yaml +10 -0
- package/.agents/core/skills/minimalist-design/SKILL.md +113 -0
- package/.agents/core/skills/minimalist-design/VALIDATION.json +12 -0
- package/.agents/core/skills/minimalist-design/skill.yaml +8 -0
- package/.agents/core/skills/nestjs/EXAMPLES.md +40 -0
- package/.agents/core/skills/nestjs/SKILL.md +139 -0
- package/.agents/core/skills/nestjs/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/nestjs/VALIDATION.json +12 -0
- package/.agents/core/skills/nestjs/nestjs.md +103 -0
- package/.agents/core/skills/nestjs/skill.yaml +10 -0
- package/.agents/core/skills/nextjs/EXAMPLES.md +40 -0
- package/.agents/core/skills/nextjs/SKILL.md +163 -0
- package/.agents/core/skills/nextjs/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/nextjs/VALIDATION.json +12 -0
- package/.agents/core/skills/nextjs/nextjs.md +67 -0
- package/.agents/core/skills/nextjs/skill.yaml +10 -0
- package/.agents/core/skills/node/EXAMPLES.md +80 -0
- package/.agents/core/skills/node/SKILL.md +128 -0
- package/.agents/core/skills/node/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/node/VALIDATION.json +12 -0
- package/.agents/core/skills/node/node.md +87 -0
- package/.agents/core/skills/node/skill.yaml +10 -0
- package/.agents/core/skills/performance/EXAMPLES.md +30 -0
- package/.agents/core/skills/performance/SKILL.md +75 -0
- package/.agents/core/skills/performance/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/performance/VALIDATION.json +12 -0
- package/.agents/core/skills/performance/performance.md +52 -0
- package/.agents/core/skills/performance/skill.yaml +10 -0
- package/.agents/core/skills/ponytail-mindset/EXAMPLES.md +45 -0
- package/.agents/core/skills/ponytail-mindset/SKILL.md +193 -0
- package/.agents/core/skills/ponytail-mindset/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ponytail-mindset/VALIDATION.json +12 -0
- package/.agents/core/skills/ponytail-mindset/skill.yaml +14 -0
- package/.agents/core/skills/react/EXAMPLES.md +79 -0
- package/.agents/core/skills/react/SKILL.md +132 -0
- package/.agents/core/skills/react/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/react/VALIDATION.json +12 -0
- package/.agents/core/skills/react/react.md +93 -0
- package/.agents/core/skills/react/skill.yaml +10 -0
- package/.agents/core/skills/react-best-practices/SKILL.md +155 -0
- package/.agents/core/skills/react-best-practices/VALIDATION.json +12 -0
- package/.agents/core/skills/react-best-practices/skill.yaml +10 -0
- package/.agents/core/skills/redesign-audit/SKILL.md +117 -0
- package/.agents/core/skills/redesign-audit/VALIDATION.json +12 -0
- package/.agents/core/skills/redesign-audit/skill.yaml +8 -0
- package/.agents/core/skills/security/EXAMPLES.md +64 -0
- package/.agents/core/skills/security/SKILL.md +158 -0
- package/.agents/core/skills/security/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/security/VALIDATION.json +12 -0
- package/.agents/core/skills/security/security.md +106 -0
- package/.agents/core/skills/security/skill.yaml +10 -0
- package/.agents/core/skills/soft-design/SKILL.md +108 -0
- package/.agents/core/skills/soft-design/VALIDATION.json +12 -0
- package/.agents/core/skills/soft-design/skill.yaml +8 -0
- package/.agents/core/skills/state-management/EXAMPLES.md +56 -0
- package/.agents/core/skills/state-management/SKILL.md +48 -0
- package/.agents/core/skills/state-management/TROUBLESHOOTING.md +18 -0
- package/.agents/core/skills/state-management/VALIDATION.json +11 -0
- package/.agents/core/skills/state-management/skill.yaml +22 -0
- package/.agents/core/skills/subagent-orchestrator/SKILL.md +100 -0
- package/.agents/core/skills/subagent-orchestrator/VALIDATION.json +12 -0
- package/.agents/core/skills/subagent-orchestrator/skill.yaml +8 -0
- package/.agents/core/skills/system-design/EXAMPLES.md +75 -0
- package/.agents/core/skills/system-design/SKILL.md +419 -0
- package/.agents/core/skills/system-design/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/system-design/VALIDATION.json +12 -0
- package/.agents/core/skills/system-design/skill.yaml +13 -0
- package/.agents/core/skills/system-design/system-design.md +112 -0
- package/.agents/core/skills/testing/EXAMPLES.md +71 -0
- package/.agents/core/skills/testing/SKILL.md +70 -0
- package/.agents/core/skills/testing/TROUBLESHOOTING.md +18 -0
- package/.agents/core/skills/testing/VALIDATION.json +11 -0
- package/.agents/core/skills/testing/skill.yaml +26 -0
- package/.agents/core/skills/typescript/EXAMPLES.md +64 -0
- package/.agents/core/skills/typescript/SKILL.md +112 -0
- package/.agents/core/skills/typescript/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/typescript/VALIDATION.json +12 -0
- package/.agents/core/skills/typescript/skill.yaml +10 -0
- package/.agents/core/skills/typescript/typescript.md +71 -0
- package/.agents/core/skills/ui-design/EXAMPLES.md +21 -0
- package/.agents/core/skills/ui-design/SKILL.md +124 -0
- package/.agents/core/skills/ui-design/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ui-design/VALIDATION.json +12 -0
- package/.agents/core/skills/ui-design/skill.yaml +10 -0
- package/.agents/core/skills/ui-design/ui.md +88 -0
- package/.agents/core/skills/ui-ux-pro/EXAMPLES.md +62 -0
- package/.agents/core/skills/ui-ux-pro/SKILL.md +375 -0
- package/.agents/core/skills/ui-ux-pro/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ui-ux-pro/VALIDATION.json +12 -0
- package/.agents/core/skills/ui-ux-pro/skill.yaml +13 -0
- package/.agents/core/skills/ux-design/EXAMPLES.md +36 -0
- package/.agents/core/skills/ux-design/SKILL.md +116 -0
- package/.agents/core/skills/ux-design/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/ux-design/VALIDATION.json +12 -0
- package/.agents/core/skills/ux-design/skill.yaml +10 -0
- package/.agents/core/skills/ux-design/ux.md +80 -0
- package/.agents/core/skills/vercel-optimize/SKILL.md +83 -0
- package/.agents/core/skills/vercel-optimize/VALIDATION.json +12 -0
- package/.agents/core/skills/vercel-optimize/skill.yaml +10 -0
- package/.agents/core/skills/web-accessibility/EXAMPLES.md +39 -0
- package/.agents/core/skills/web-accessibility/SKILL.md +170 -0
- package/.agents/core/skills/web-accessibility/TROUBLESHOOTING.md +19 -0
- package/.agents/core/skills/web-accessibility/VALIDATION.json +12 -0
- package/.agents/core/skills/web-accessibility/accessibility.md +63 -0
- package/.agents/core/skills/web-accessibility/skill.yaml +10 -0
- package/.agents/ctx.js +370 -0
- package/.agents/generated/claude/skills/adapters/SKILL.md +126 -0
- package/.agents/generated/claude/skills/architecture-diagrams/SKILL.md +101 -0
- package/.agents/generated/claude/skills/brutalist-design/SKILL.md +145 -0
- package/.agents/generated/claude/skills/context-manager/SKILL.md +147 -0
- package/.agents/generated/claude/skills/context-os/SKILL.md +191 -0
- package/.agents/generated/claude/skills/database/SKILL.md +191 -0
- package/.agents/generated/claude/skills/ddd/SKILL.md +305 -0
- package/.agents/generated/claude/skills/decisions/SKILL.md +134 -0
- package/.agents/generated/claude/skills/docker/SKILL.md +135 -0
- package/.agents/generated/claude/skills/engineering-workflow/SKILL.md +414 -0
- package/.agents/generated/claude/skills/fastapi/SKILL.md +200 -0
- package/.agents/generated/claude/skills/gemini-precision/SKILL.md +161 -0
- package/.agents/generated/claude/skills/generators/SKILL.md +133 -0
- package/.agents/generated/claude/skills/graphify/SKILL.md +198 -0
- package/.agents/generated/claude/skills/gstack-roles/SKILL.md +184 -0
- package/.agents/generated/claude/skills/impeccable-design/SKILL.md +241 -0
- package/.agents/generated/claude/skills/interview-me/SKILL.md +90 -0
- package/.agents/generated/claude/skills/microservices/SKILL.md +218 -0
- package/.agents/generated/claude/skills/minimalist-design/SKILL.md +108 -0
- package/.agents/generated/claude/skills/nestjs/SKILL.md +195 -0
- package/.agents/generated/claude/skills/nextjs/SKILL.md +219 -0
- package/.agents/generated/claude/skills/node/SKILL.md +224 -0
- package/.agents/generated/claude/skills/performance/SKILL.md +121 -0
- package/.agents/generated/claude/skills/ponytail-mindset/SKILL.md +252 -0
- package/.agents/generated/claude/skills/react/SKILL.md +227 -0
- package/.agents/generated/claude/skills/react-best-practices/SKILL.md +146 -0
- package/.agents/generated/claude/skills/redesign-audit/SKILL.md +112 -0
- package/.agents/generated/claude/skills/security/SKILL.md +237 -0
- package/.agents/generated/claude/skills/soft-design/SKILL.md +103 -0
- package/.agents/generated/claude/skills/state-management/SKILL.md +120 -0
- package/.agents/generated/claude/skills/subagent-orchestrator/SKILL.md +93 -0
- package/.agents/generated/claude/skills/system-design/SKILL.md +507 -0
- package/.agents/generated/claude/skills/testing/SKILL.md +157 -0
- package/.agents/generated/claude/skills/typescript/SKILL.md +192 -0
- package/.agents/generated/claude/skills/ui-design/SKILL.md +161 -0
- package/.agents/generated/claude/skills/ui-ux-pro/SKILL.md +451 -0
- package/.agents/generated/claude/skills/ux-design/SKILL.md +168 -0
- package/.agents/generated/claude/skills/vercel-optimize/SKILL.md +76 -0
- package/.agents/generated/claude/skills/web-accessibility/SKILL.md +225 -0
- package/.agents/generated/gemini/skills/adapters/SKILL.md +135 -0
- package/.agents/generated/gemini/skills/architecture-diagrams/SKILL.md +107 -0
- package/.agents/generated/gemini/skills/brutalist-design/SKILL.md +151 -0
- package/.agents/generated/gemini/skills/context-manager/SKILL.md +156 -0
- package/.agents/generated/gemini/skills/context-os/SKILL.md +200 -0
- package/.agents/generated/gemini/skills/database/SKILL.md +200 -0
- package/.agents/generated/gemini/skills/ddd/SKILL.md +314 -0
- package/.agents/generated/gemini/skills/decisions/SKILL.md +143 -0
- package/.agents/generated/gemini/skills/docker/SKILL.md +144 -0
- package/.agents/generated/gemini/skills/engineering-workflow/SKILL.md +423 -0
- package/.agents/generated/gemini/skills/fastapi/SKILL.md +209 -0
- package/.agents/generated/gemini/skills/gemini-precision/SKILL.md +167 -0
- package/.agents/generated/gemini/skills/generators/SKILL.md +142 -0
- package/.agents/generated/gemini/skills/graphify/SKILL.md +205 -0
- package/.agents/generated/gemini/skills/gstack-roles/SKILL.md +193 -0
- package/.agents/generated/gemini/skills/impeccable-design/SKILL.md +250 -0
- package/.agents/generated/gemini/skills/interview-me/SKILL.md +96 -0
- package/.agents/generated/gemini/skills/microservices/SKILL.md +227 -0
- package/.agents/generated/gemini/skills/minimalist-design/SKILL.md +114 -0
- package/.agents/generated/gemini/skills/nestjs/SKILL.md +204 -0
- package/.agents/generated/gemini/skills/nextjs/SKILL.md +298 -0
- package/.agents/generated/gemini/skills/node/SKILL.md +323 -0
- package/.agents/generated/gemini/skills/performance/SKILL.md +185 -0
- package/.agents/generated/gemini/skills/ponytail-mindset/SKILL.md +261 -0
- package/.agents/generated/gemini/skills/react/SKILL.md +332 -0
- package/.agents/generated/gemini/skills/react-best-practices/SKILL.md +152 -0
- package/.agents/generated/gemini/skills/redesign-audit/SKILL.md +118 -0
- package/.agents/generated/gemini/skills/security/SKILL.md +355 -0
- package/.agents/generated/gemini/skills/soft-design/SKILL.md +109 -0
- package/.agents/generated/gemini/skills/state-management/SKILL.md +129 -0
- package/.agents/generated/gemini/skills/subagent-orchestrator/SKILL.md +99 -0
- package/.agents/generated/gemini/skills/system-design/SKILL.md +631 -0
- package/.agents/generated/gemini/skills/testing/SKILL.md +166 -0
- package/.agents/generated/gemini/skills/typescript/SKILL.md +275 -0
- package/.agents/generated/gemini/skills/ui-design/SKILL.md +170 -0
- package/.agents/generated/gemini/skills/ui-ux-pro/SKILL.md +460 -0
- package/.agents/generated/gemini/skills/ux-design/SKILL.md +177 -0
- package/.agents/generated/gemini/skills/vercel-optimize/SKILL.md +82 -0
- package/.agents/generated/gemini/skills/web-accessibility/SKILL.md +300 -0
- package/.agents/mcp/runtime.py +454 -0
- package/.agents/mcp/server.mjs +189373 -0
- package/.agents/plugins.js +574 -0
- package/.agents/profiles.js +267 -0
- package/.agents/resolver.js +336 -0
- package/.agents/skills-index.json +200 -0
- package/.agents/skills.json +6 -0
- package/.agents/validate.js +500 -0
- package/LICENSE +21 -0
- package/README.md +415 -0
- package/benchmarks/gemini-issues.js +533 -0
- package/bin/index.js +458 -0
- package/package.json +70 -0
- package/registry.json +53 -0
- package/registry.schema.json +32 -0
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { AGENTS_MD_PATH, collectSkillDirectories, extractYamlField, stripFrontmatter, readMeaningfulMarkdown } = require('../shared.js');
|
|
4
|
+
|
|
5
|
+
// GitHub Copilot reads from .github/copilot-instructions.md
|
|
6
|
+
const OUTPUT_FILE = path.join(process.cwd(), '.github', 'copilot-instructions.md');
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* GitHub Copilot adapter — export.js
|
|
10
|
+
*
|
|
11
|
+
* Copilot reads `.github/copilot-instructions.md` as a plain Markdown file.
|
|
12
|
+
* We compile AGENTS.md + all skills into one document with clear section
|
|
13
|
+
* headings so Copilot can reference them contextually.
|
|
14
|
+
*
|
|
15
|
+
* Format spec: https://docs.github.com/en/copilot/customizing-copilot/adding-repository-instructions
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
function buildSkillSection(skillDir) {
|
|
19
|
+
const skillName = path.basename(skillDir);
|
|
20
|
+
const skillMdPath = path.join(skillDir, 'SKILL.md');
|
|
21
|
+
const yamlPath = path.join(skillDir, 'skill.yaml');
|
|
22
|
+
|
|
23
|
+
let title = skillName;
|
|
24
|
+
let description = '';
|
|
25
|
+
if (fs.existsSync(yamlPath)) {
|
|
26
|
+
const yaml = fs.readFileSync(yamlPath, 'utf8');
|
|
27
|
+
title = extractYamlField(yaml, 'name') || skillName;
|
|
28
|
+
description = extractYamlField(yaml, 'description') || '';
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (!fs.existsSync(skillMdPath)) return null;
|
|
32
|
+
|
|
33
|
+
const raw = fs.readFileSync(skillMdPath, 'utf8');
|
|
34
|
+
const body = stripFrontmatter(raw);
|
|
35
|
+
|
|
36
|
+
if (!description) {
|
|
37
|
+
const firstLine = body.split(/\r?\n/).map(l => l.trim()).find(l => l && !l.startsWith('#'));
|
|
38
|
+
description = firstLine || '';
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const descLine = description ? `> ${description.replace(/\r?\n+/g, ' ').trim()}\n` : '';
|
|
42
|
+
const skillRef = `*Source: \`.agents/skills/${skillName}/SKILL.md\` (Read on demand)*\n`;
|
|
43
|
+
return `\n### ${title}\n${descLine}${skillRef}`;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function run() {
|
|
47
|
+
console.log('Starting GitHub Copilot adapter export...');
|
|
48
|
+
|
|
49
|
+
const lines = [];
|
|
50
|
+
|
|
51
|
+
// ── Header ───────────────────────────────────────────────────────────────────
|
|
52
|
+
lines.push(
|
|
53
|
+
`# GitHub Copilot Instructions — ContextOS\n`,
|
|
54
|
+
`<!-- Auto-generated by: node .agents/ctx.js export copilot -->\n`,
|
|
55
|
+
`<!-- Source: .agents/core/skills/ · Do not edit manually. -->\n\n`
|
|
56
|
+
);
|
|
57
|
+
|
|
58
|
+
// ── Project rules & Step 0 ───────────────────────────────────────────────────
|
|
59
|
+
lines.push(`## Project Rules\n\n`);
|
|
60
|
+
lines.push(`### Step 0 — Identify Before Acting\n\n`);
|
|
61
|
+
lines.push(`Before writing a single line of code or plan, state:\n`);
|
|
62
|
+
lines.push(`\`\`\`\n1. WHAT DOMAIN? → Frontend / Backend / Architecture / Full-Stack / DevOps\n2. WHAT PHASE? → Define / Plan / Build / Verify / Review / Ship\n3. WHAT ROLE? → Declare specialist role for this phase\n\`\`\`\n\n`);
|
|
63
|
+
lines.push(`### Non-Negotiable Rules\n\n`);
|
|
64
|
+
lines.push(`- **Zero-Assumption Investigation**: Never guess file paths or signatures. Inspect before modifying.\n`);
|
|
65
|
+
lines.push(`- **Zero-Placeholder Production Code**: Never emit lazy stubs, \`// TODO\`, or partial code.\n`);
|
|
66
|
+
lines.push(`- **Mandatory Proof-of-Work Verification**: Always run tests and validators before claiming completion.\n`);
|
|
67
|
+
lines.push(`- **Surgical Blast Radius**: Modify only files strictly within scope.\n\n`);
|
|
68
|
+
lines.push(`---\n`);
|
|
69
|
+
|
|
70
|
+
// ── Skills ───────────────────────────────────────────────────────────────────
|
|
71
|
+
lines.push(`\n## Skills Library\n\n`);
|
|
72
|
+
lines.push(`ContextOS uses on-demand progressive disclosure. Read the relevant \`SKILL.md\` file only when your task matches the trigger.\n\n`);
|
|
73
|
+
lines.push(`### Skill Routing Table\n\n`);
|
|
74
|
+
lines.push(`| Trigger / Domain | Skill | Path |\n`);
|
|
75
|
+
lines.push(`| --- | --- | --- |\n`);
|
|
76
|
+
|
|
77
|
+
const skills = collectSkillDirectories();
|
|
78
|
+
for (const skill of skills) {
|
|
79
|
+
const skillName = path.basename(skill);
|
|
80
|
+
const yamlPath = path.join(skill, 'skill.yaml');
|
|
81
|
+
let tags = skillName;
|
|
82
|
+
if (fs.existsSync(yamlPath)) {
|
|
83
|
+
const yaml = fs.readFileSync(yamlPath, 'utf8');
|
|
84
|
+
const rawTags = extractYamlField(yaml, 'tags');
|
|
85
|
+
if (rawTags) tags = rawTags.replace(/[\[\]]/g, '');
|
|
86
|
+
}
|
|
87
|
+
const relPath = `.agents/core/skills/${skillName}/SKILL.md`;
|
|
88
|
+
lines.push(`| \`${tags}\` | **${skillName}** | \`${relPath}\` |\n`);
|
|
89
|
+
}
|
|
90
|
+
lines.push(`\n---\n`);
|
|
91
|
+
|
|
92
|
+
let count = 0;
|
|
93
|
+
for (const skill of skills) {
|
|
94
|
+
const section = buildSkillSection(skill);
|
|
95
|
+
if (section) {
|
|
96
|
+
lines.push(section);
|
|
97
|
+
count++;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// ── Write ────────────────────────────────────────────────────────────────────
|
|
102
|
+
fs.mkdirSync(path.dirname(OUTPUT_FILE), { recursive: true });
|
|
103
|
+
fs.writeFileSync(OUTPUT_FILE, lines.join(''));
|
|
104
|
+
console.log(`Generated .github/copilot-instructions.md (${count} skills) → ${OUTPUT_FILE}`);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
module.exports = { run };
|
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { AGENTS_MD_PATH, collectSkillDirectories, extractYamlField, stripFrontmatter, readMeaningfulMarkdown } = require('../shared.js');
|
|
4
|
+
|
|
5
|
+
// Output paths
|
|
6
|
+
const OUTPUT_FILE = path.join(process.cwd(), '.cursorrules');
|
|
7
|
+
const CURSOR_RULES_DIR = path.join(process.cwd(), '.cursor', 'rules');
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Cursor adapter — export.js
|
|
11
|
+
*
|
|
12
|
+
* Generates:
|
|
13
|
+
* 1. Modern modular Cursor rules in `.cursor/rules/<skill>.mdc` with glob filters
|
|
14
|
+
* 2. Flat `.cursorrules` at project root for backwards compatibility
|
|
15
|
+
*
|
|
16
|
+
* Format spec: https://docs.cursor.com/context/rules-for-ai
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
function getSkillGlobsAndFlags(skillName) {
|
|
20
|
+
const ALWAYS_APPLY_SKILLS = ['engineering-workflow', 'gstack-roles', 'ponytail-mindset'];
|
|
21
|
+
if (ALWAYS_APPLY_SKILLS.includes(skillName)) {
|
|
22
|
+
return { globs: '', alwaysApply: true };
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const FRONTEND_SKILLS = [
|
|
26
|
+
'react', 'nextjs', 'typescript', 'ui-ux-pro', 'impeccable-design',
|
|
27
|
+
'ui-design', 'ux-design', 'web-accessibility', 'brutalist-design',
|
|
28
|
+
'minimalist-design', 'soft-design', 'redesign-audit', 'react-best-practices',
|
|
29
|
+
];
|
|
30
|
+
if (FRONTEND_SKILLS.includes(skillName)) {
|
|
31
|
+
return { globs: '**/*.{ts,tsx,js,jsx,css,scss,html}', alwaysApply: false };
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const BACKEND_SKILLS = ['system-design', 'node', 'nestjs', 'microservices', 'ddd'];
|
|
35
|
+
if (BACKEND_SKILLS.includes(skillName)) {
|
|
36
|
+
return { globs: '**/*.{ts,js,json,prisma,sql}', alwaysApply: false };
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
if (skillName === 'database') {
|
|
40
|
+
return { globs: '**/*.{prisma,sql,sqlite,db,drizzle.config.*}', alwaysApply: false };
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (skillName === 'docker') {
|
|
44
|
+
return { globs: '**/Dockerfile*,**/docker-compose*.{yml,yaml}', alwaysApply: false };
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
if (skillName === 'testing') {
|
|
48
|
+
return { globs: '**/*.{test,spec}.{ts,js,tsx,jsx},vitest.config.*,jest.config.*', alwaysApply: false };
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (skillName === 'state-management') {
|
|
52
|
+
return { globs: '**/*{store,state,slice,reducer,atom}*.{ts,js,tsx,jsx}', alwaysApply: false };
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (skillName === 'performance' || skillName === 'vercel-optimize') {
|
|
56
|
+
return { globs: '**/*.{ts,tsx,js,jsx,json}', alwaysApply: false };
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
if (skillName === 'fastapi') {
|
|
60
|
+
return { globs: '**/*.{py,requirements.txt,Pipfile,pyproject.toml}', alwaysApply: false };
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return { globs: '', alwaysApply: false };
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
function buildSkillSection(skillDir) {
|
|
67
|
+
const skillName = path.basename(skillDir);
|
|
68
|
+
const skillMdPath = path.join(skillDir, 'SKILL.md');
|
|
69
|
+
const yamlPath = path.join(skillDir, 'skill.yaml');
|
|
70
|
+
|
|
71
|
+
let title = skillName;
|
|
72
|
+
let description = '';
|
|
73
|
+
if (fs.existsSync(yamlPath)) {
|
|
74
|
+
const yaml = fs.readFileSync(yamlPath, 'utf8');
|
|
75
|
+
title = extractYamlField(yaml, 'name') || skillName;
|
|
76
|
+
description = extractYamlField(yaml, 'description') || '';
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if (!fs.existsSync(skillMdPath)) {
|
|
80
|
+
return null;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const raw = fs.readFileSync(skillMdPath, 'utf8');
|
|
84
|
+
const body = stripFrontmatter(raw);
|
|
85
|
+
|
|
86
|
+
if (!description) {
|
|
87
|
+
const firstLine = body.split(/\r?\n/).map(l => l.trim()).find(l => l && !l.startsWith('#'));
|
|
88
|
+
description = firstLine || '';
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const descLine = description ? `> ${description.replace(/\r?\n+/g, ' ').trim()}\n` : '';
|
|
92
|
+
return `\n## Skill: ${title}\n${descLine}*Rule file: \`.cursor/rules/${skillName}.mdc\` (load on demand)*\n`;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function generateCursorMdc(skillDir) {
|
|
96
|
+
const skillName = path.basename(skillDir);
|
|
97
|
+
const skillMdPath = path.join(skillDir, 'SKILL.md');
|
|
98
|
+
const yamlPath = path.join(skillDir, 'skill.yaml');
|
|
99
|
+
|
|
100
|
+
if (!fs.existsSync(skillMdPath)) return null;
|
|
101
|
+
|
|
102
|
+
let title = skillName;
|
|
103
|
+
let description = `ContextOS rules for ${skillName}`;
|
|
104
|
+
if (fs.existsSync(yamlPath)) {
|
|
105
|
+
const yaml = fs.readFileSync(yamlPath, 'utf8');
|
|
106
|
+
title = extractYamlField(yaml, 'name') || skillName;
|
|
107
|
+
const desc = extractYamlField(yaml, 'description');
|
|
108
|
+
if (desc) description = desc;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
let raw = fs.readFileSync(skillMdPath, 'utf8');
|
|
112
|
+
const examples = readMeaningfulMarkdown(path.join(skillDir, 'EXAMPLES.md'));
|
|
113
|
+
if (examples) raw += '\n\n' + examples;
|
|
114
|
+
|
|
115
|
+
const troubleshooting = readMeaningfulMarkdown(path.join(skillDir, 'TROUBLESHOOTING.md'));
|
|
116
|
+
if (troubleshooting) raw += '\n\n' + troubleshooting;
|
|
117
|
+
|
|
118
|
+
const body = stripFrontmatter(raw);
|
|
119
|
+
const { globs, alwaysApply } = getSkillGlobsAndFlags(skillName);
|
|
120
|
+
|
|
121
|
+
const cleanDescription = description.replace(/\r?\n+/g, ' ').replace(/"/g, "'").trim();
|
|
122
|
+
const mdcContent = `---
|
|
123
|
+
description: "${cleanDescription}"
|
|
124
|
+
globs: ${globs ? `"${globs}"` : '""'}
|
|
125
|
+
alwaysApply: ${alwaysApply}
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
# Skill: ${title}
|
|
129
|
+
|
|
130
|
+
${body}
|
|
131
|
+
`;
|
|
132
|
+
|
|
133
|
+
return { skillName, mdcContent };
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
function run() {
|
|
137
|
+
console.log('Starting Cursor adapter export...');
|
|
138
|
+
|
|
139
|
+
const sections = [];
|
|
140
|
+
|
|
141
|
+
// ── Header ──────────────────────────────────────────────────────────────────
|
|
142
|
+
sections.push(
|
|
143
|
+
`# ContextOS — AI Rules for Cursor\n` +
|
|
144
|
+
`# Auto-generated by: node .agents/ctx.js export cursor\n` +
|
|
145
|
+
`# Source: .agents/core/skills/ · Do not edit manually.\n\n` +
|
|
146
|
+
`> **Core law: Do not read everything. Read only what the current task requires.**\n\n` +
|
|
147
|
+
`Detailed rules are modularized in \`.cursor/rules/*.mdc\` with file-glob activation.\n` +
|
|
148
|
+
`Core orchestration is handled by \`.cursor/rules/00-project-rules.mdc\`.\n`
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
// Prepare .cursor/rules directory
|
|
152
|
+
fs.mkdirSync(CURSOR_RULES_DIR, { recursive: true });
|
|
153
|
+
|
|
154
|
+
let count = 0;
|
|
155
|
+
let mdcCount = 0;
|
|
156
|
+
|
|
157
|
+
// Write 00-project-rules.mdc
|
|
158
|
+
if (fs.existsSync(AGENTS_MD_PATH)) {
|
|
159
|
+
const agentsMd = fs.readFileSync(AGENTS_MD_PATH, 'utf8');
|
|
160
|
+
const projectMdc = `---
|
|
161
|
+
description: "ContextOS core project rules and role orchestration"
|
|
162
|
+
globs: ""
|
|
163
|
+
alwaysApply: true
|
|
164
|
+
---
|
|
165
|
+
|
|
166
|
+
# ContextOS — Project Operating System Rules
|
|
167
|
+
|
|
168
|
+
${agentsMd}
|
|
169
|
+
`;
|
|
170
|
+
fs.writeFileSync(path.join(CURSOR_RULES_DIR, '00-project-rules.mdc'), projectMdc);
|
|
171
|
+
mdcCount++;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ── Skills Index ─────────────────────────────────────────────────────────────
|
|
175
|
+
sections.push('\n---\n\n# Skills Index (Loaded On-Demand)\n\n' +
|
|
176
|
+
'The following specialist skills are configured as `.cursor/rules/<skill>.mdc`:\n');
|
|
177
|
+
const skills = collectSkillDirectories();
|
|
178
|
+
const activeMdcFiles = new Set(['00-project-rules.mdc']);
|
|
179
|
+
|
|
180
|
+
for (const skill of skills) {
|
|
181
|
+
const section = buildSkillSection(skill);
|
|
182
|
+
if (section) {
|
|
183
|
+
sections.push(section);
|
|
184
|
+
count++;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
const mdc = generateCursorMdc(skill);
|
|
188
|
+
if (mdc) {
|
|
189
|
+
const mdcFileName = `${mdc.skillName}.mdc`;
|
|
190
|
+
activeMdcFiles.add(mdcFileName);
|
|
191
|
+
fs.writeFileSync(path.join(CURSOR_RULES_DIR, mdcFileName), mdc.mdcContent);
|
|
192
|
+
mdcCount++;
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
// Clean up stale .mdc rules from uninstalled skills/plugins
|
|
197
|
+
if (fs.existsSync(CURSOR_RULES_DIR)) {
|
|
198
|
+
for (const file of fs.readdirSync(CURSOR_RULES_DIR)) {
|
|
199
|
+
if (file.endsWith('.mdc') && !activeMdcFiles.has(file)) {
|
|
200
|
+
fs.unlinkSync(path.join(CURSOR_RULES_DIR, file));
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
fs.writeFileSync(OUTPUT_FILE, sections.join('\n'));
|
|
206
|
+
console.log(`Generated .cursorrules (${count} skills) → ${OUTPUT_FILE}`);
|
|
207
|
+
console.log(`Generated .cursor/rules/*.mdc (${mdcCount} rules) → ${CURSOR_RULES_DIR}`);
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
module.exports = { run };
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { collectSkillDirectories, resetDirectory, readMeaningfulMarkdown, extractYamlField } = require('../shared.js');
|
|
4
|
+
|
|
5
|
+
const GENERATED_SKILLS_PATH = path.join(__dirname, '..', '..', 'generated', 'gemini', 'skills');
|
|
6
|
+
|
|
7
|
+
function generateGeminiSkill(skillDir) {
|
|
8
|
+
const skillName = path.basename(skillDir);
|
|
9
|
+
const yamlPath = path.join(skillDir, 'skill.yaml');
|
|
10
|
+
const existingSkillMdPath = path.join(skillDir, 'SKILL.md');
|
|
11
|
+
const outputDir = path.join(GENERATED_SKILLS_PATH, skillName);
|
|
12
|
+
|
|
13
|
+
if (!fs.existsSync(existingSkillMdPath) && !fs.existsSync(yamlPath)) {
|
|
14
|
+
console.log(`Skipping ${skillName} (no skill.yaml or SKILL.md)`);
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
let name = skillName;
|
|
19
|
+
let description = null;
|
|
20
|
+
|
|
21
|
+
if (fs.existsSync(yamlPath)) {
|
|
22
|
+
const yamlText = fs.readFileSync(yamlPath, 'utf8');
|
|
23
|
+
name = extractYamlField(yamlText, 'name') || skillName;
|
|
24
|
+
description = extractYamlField(yamlText, 'description');
|
|
25
|
+
if (!description) {
|
|
26
|
+
const descRegex = new RegExp(`^description:\\s*>\\s*\\n\\s*([^\\n]+)`, 'm');
|
|
27
|
+
const descMatch = yamlText.match(descRegex);
|
|
28
|
+
if (descMatch) description = descMatch[1].trim();
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
description = description || `ContextOS skill for ${name}`;
|
|
32
|
+
|
|
33
|
+
// Find all .md files in the skill directory deterministically
|
|
34
|
+
const files = fs.readdirSync(skillDir).sort((a, b) => a.localeCompare(b, 'en', { sensitivity: 'base' }));
|
|
35
|
+
const mdFiles = files.filter(f => f.endsWith('.md'));
|
|
36
|
+
|
|
37
|
+
// Primary skill content first: SKILL.md is canonical; fallback to <skillName>.md
|
|
38
|
+
const primaryMd = mdFiles.includes('SKILL.md')
|
|
39
|
+
? 'SKILL.md'
|
|
40
|
+
: (mdFiles.find(f => f === `${skillName}.md`) || mdFiles[0]);
|
|
41
|
+
|
|
42
|
+
let mergedContent = '';
|
|
43
|
+
if (primaryMd) {
|
|
44
|
+
let primaryText = fs.readFileSync(path.join(skillDir, primaryMd), 'utf8');
|
|
45
|
+
// Strip existing frontmatter from source so we don't double-nest
|
|
46
|
+
primaryText = primaryText.replace(/^---[\s\S]*?---\r?\n/, '');
|
|
47
|
+
mergedContent += primaryText;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// Partition supplemental markdown files for deterministic, logical ordering:
|
|
51
|
+
// 1. Specific topic / reference docs (e.g. accessibility.md), sorted alphabetically
|
|
52
|
+
// 2. EXAMPLES.md
|
|
53
|
+
// 3. TROUBLESHOOTING.md
|
|
54
|
+
const otherTopicFiles = mdFiles.filter(f => f !== primaryMd && f !== 'EXAMPLES.md' && f !== 'TROUBLESHOOTING.md');
|
|
55
|
+
const orderedExtras = [...otherTopicFiles];
|
|
56
|
+
if (mdFiles.includes('EXAMPLES.md') && primaryMd !== 'EXAMPLES.md') orderedExtras.push('EXAMPLES.md');
|
|
57
|
+
if (mdFiles.includes('TROUBLESHOOTING.md') && primaryMd !== 'TROUBLESHOOTING.md') orderedExtras.push('TROUBLESHOOTING.md');
|
|
58
|
+
|
|
59
|
+
for (const mdFile of orderedExtras) {
|
|
60
|
+
// Avoid re-appending content that was already inlined via Source comments in SKILL.md
|
|
61
|
+
if (mergedContent.includes(`<!-- Source: ${mdFile} -->`)) continue;
|
|
62
|
+
const extraContent = readMeaningfulMarkdown(path.join(skillDir, mdFile));
|
|
63
|
+
if (extraContent) {
|
|
64
|
+
mergedContent += `\n\n<!-- Source: ${mdFile} -->\n\n` + extraContent;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Construct Gemini SKILL.md format (normalizing line endings to \n)
|
|
69
|
+
const outputContent = `---
|
|
70
|
+
name: ${name}
|
|
71
|
+
description: >
|
|
72
|
+
${description}
|
|
73
|
+
---
|
|
74
|
+
${mergedContent.trimStart()}
|
|
75
|
+
`.replace(/\r\n/g, '\n');
|
|
76
|
+
|
|
77
|
+
fs.mkdirSync(outputDir, { recursive: true });
|
|
78
|
+
fs.writeFileSync(path.join(outputDir, 'SKILL.md'), outputContent);
|
|
79
|
+
|
|
80
|
+
console.log(`Generated SKILL.md for ${skillName}`);
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
const ANTIGRAVITY_SKILLS_PATH = path.join(__dirname, '..', '..', 'skills');
|
|
84
|
+
|
|
85
|
+
function copyFolderRecursiveSync(source, target) {
|
|
86
|
+
if (!fs.existsSync(target)) fs.mkdirSync(target, { recursive: true });
|
|
87
|
+
const files = fs.readdirSync(source).sort((a, b) => a.localeCompare(b, 'en', { sensitivity: 'base' }));
|
|
88
|
+
for (const file of files) {
|
|
89
|
+
const curSource = path.join(source, file);
|
|
90
|
+
const curTarget = path.join(target, file);
|
|
91
|
+
if (fs.statSync(curSource).isDirectory()) {
|
|
92
|
+
copyFolderRecursiveSync(curSource, curTarget);
|
|
93
|
+
} else {
|
|
94
|
+
fs.copyFileSync(curSource, curTarget);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
function run() {
|
|
100
|
+
console.log('Starting Gemini adapter export...');
|
|
101
|
+
resetDirectory(GENERATED_SKILLS_PATH);
|
|
102
|
+
|
|
103
|
+
const skills = collectSkillDirectories();
|
|
104
|
+
for (const skill of skills) {
|
|
105
|
+
generateGeminiSkill(skill);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
// Also sync to .agents/skills for Antigravity IDE native discovery
|
|
109
|
+
resetDirectory(ANTIGRAVITY_SKILLS_PATH);
|
|
110
|
+
copyFolderRecursiveSync(GENERATED_SKILLS_PATH, ANTIGRAVITY_SKILLS_PATH);
|
|
111
|
+
|
|
112
|
+
console.log('Export complete. Skills are in generated/gemini/skills and .agents/skills');
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
module.exports = { run };
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
|
|
6
|
+
const AGENTS_DIR = path.join(__dirname, '..');
|
|
7
|
+
const CORE_SKILLS_PATH = path.join(AGENTS_DIR, 'core', 'skills');
|
|
8
|
+
const AGENTS_MD_PATH = path.join(AGENTS_DIR, 'AGENTS.md');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Return every skill available to an installed ContextOS instance.
|
|
12
|
+
* Plugins intentionally live outside `core/skills`, so adapters must use this
|
|
13
|
+
* helper rather than enumerate the core directory themselves.
|
|
14
|
+
*/
|
|
15
|
+
function collectSkillDirectories(overrideProfile = null) {
|
|
16
|
+
const plugins = require(path.join(AGENTS_DIR, 'plugins.js'));
|
|
17
|
+
let dirs = plugins.collectAllSkillDirs()
|
|
18
|
+
.filter(dir => fs.existsSync(dir) && fs.statSync(dir).isDirectory())
|
|
19
|
+
.sort((a, b) => path.basename(a).localeCompare(path.basename(b)));
|
|
20
|
+
|
|
21
|
+
let profile = overrideProfile;
|
|
22
|
+
if (!profile) {
|
|
23
|
+
try {
|
|
24
|
+
const profilesEngine = require(path.join(AGENTS_DIR, 'profiles.js'));
|
|
25
|
+
profile = profilesEngine.getActiveProfile();
|
|
26
|
+
} catch {
|
|
27
|
+
profile = null;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
if (profile && Array.isArray(profile.exclude_skills) && profile.exclude_skills.length > 0) {
|
|
32
|
+
dirs = dirs.filter(dir => {
|
|
33
|
+
const skillName = path.basename(dir);
|
|
34
|
+
return !profile.exclude_skills.includes(skillName);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return dirs;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function resetDirectory(directory) {
|
|
42
|
+
fs.rmSync(directory, { recursive: true, force: true, maxRetries: 5, retryDelay: 100 });
|
|
43
|
+
fs.mkdirSync(directory, { recursive: true });
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
function stripFrontmatter(content) {
|
|
47
|
+
return content.replace(/^---[\s\S]*?---\r?\n/, '').trimStart();
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function extractYamlField(yamlText, field) {
|
|
51
|
+
const lines = yamlText.split(/\r?\n/);
|
|
52
|
+
for (let i = 0; i < lines.length; i++) {
|
|
53
|
+
const line = lines[i];
|
|
54
|
+
const match = line.match(new RegExp(`^${field}:\\s*(.*)$`));
|
|
55
|
+
if (match) {
|
|
56
|
+
let rest = match[1].trim();
|
|
57
|
+
if (rest === '>' || rest === '|' || rest === '>-' || rest === '|-' || rest === '') {
|
|
58
|
+
const blockLines = [];
|
|
59
|
+
let j = i + 1;
|
|
60
|
+
while (j < lines.length) {
|
|
61
|
+
const nextLine = lines[j];
|
|
62
|
+
if (nextLine.trim() === '') {
|
|
63
|
+
blockLines.push('');
|
|
64
|
+
j++;
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
if (/^(\s{2,}|\t)/.test(nextLine)) {
|
|
68
|
+
blockLines.push(nextLine.trim());
|
|
69
|
+
j++;
|
|
70
|
+
} else {
|
|
71
|
+
break;
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
if (blockLines.length > 0) {
|
|
75
|
+
const sep = rest.startsWith('|') ? '\n' : ' ';
|
|
76
|
+
return blockLines.filter(Boolean).join(sep).trim();
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
// Strip surrounding quotes if present
|
|
80
|
+
if ((rest.startsWith('"') && rest.endsWith('"')) || (rest.startsWith("'") && rest.endsWith("'"))) {
|
|
81
|
+
rest = rest.slice(1, -1);
|
|
82
|
+
}
|
|
83
|
+
return rest || null;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* Reads a markdown file only if it exists and contains meaningful content
|
|
91
|
+
* (filters out generic placeholder stubs).
|
|
92
|
+
*/
|
|
93
|
+
function readMeaningfulMarkdown(filePath) {
|
|
94
|
+
if (!fs.existsSync(filePath)) return null;
|
|
95
|
+
const content = fs.readFileSync(filePath, 'utf8').trim();
|
|
96
|
+
if (!content) return null;
|
|
97
|
+
if (
|
|
98
|
+
content.length < 150 &&
|
|
99
|
+
(
|
|
100
|
+
content.includes('Add detailed code examples') ||
|
|
101
|
+
content.includes('Add common errors, anti-patterns')
|
|
102
|
+
)
|
|
103
|
+
) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return content;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
module.exports = {
|
|
110
|
+
AGENTS_DIR,
|
|
111
|
+
AGENTS_MD_PATH,
|
|
112
|
+
CORE_SKILLS_PATH,
|
|
113
|
+
collectSkillDirectories,
|
|
114
|
+
extractYamlField,
|
|
115
|
+
readMeaningfulMarkdown,
|
|
116
|
+
resetDirectory,
|
|
117
|
+
stripFrontmatter,
|
|
118
|
+
};
|
|
119
|
+
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
const fs = require('fs');
|
|
2
|
+
const path = require('path');
|
|
3
|
+
const { AGENTS_MD_PATH, collectSkillDirectories, extractYamlField, stripFrontmatter, readMeaningfulMarkdown } = require('../shared.js');
|
|
4
|
+
|
|
5
|
+
// Output destinations for Zed
|
|
6
|
+
const ZED_DIR = path.join(process.cwd(), '.zed');
|
|
7
|
+
const RULES_FILE = path.join(ZED_DIR, 'rules.md');
|
|
8
|
+
const PROMPTS_DIR = path.join(ZED_DIR, 'prompts');
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Zed IDE adapter — export.js
|
|
12
|
+
*
|
|
13
|
+
* Generates:
|
|
14
|
+
* 1. `.zed/rules.md` — Project assistant instructions loaded into Zed's context
|
|
15
|
+
* 2. `.zed/prompts/*.md` — Modular slash-command prompts for Zed Assistant
|
|
16
|
+
*
|
|
17
|
+
* Format spec: https://zed.dev/docs/assistant
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
function buildSkillSection(skillDir) {
|
|
21
|
+
const skillName = path.basename(skillDir);
|
|
22
|
+
const skillMdPath = path.join(skillDir, 'SKILL.md');
|
|
23
|
+
const yamlPath = path.join(skillDir, 'skill.yaml');
|
|
24
|
+
|
|
25
|
+
let title = skillName;
|
|
26
|
+
let description = '';
|
|
27
|
+
if (fs.existsSync(yamlPath)) {
|
|
28
|
+
const yaml = fs.readFileSync(yamlPath, 'utf8');
|
|
29
|
+
title = extractYamlField(yaml, 'name') || skillName;
|
|
30
|
+
description = extractYamlField(yaml, 'description') || '';
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
if (!fs.existsSync(skillMdPath)) return null;
|
|
34
|
+
|
|
35
|
+
const raw = fs.readFileSync(skillMdPath, 'utf8');
|
|
36
|
+
const body = stripFrontmatter(raw);
|
|
37
|
+
|
|
38
|
+
if (!description) {
|
|
39
|
+
const firstLine = body.split(/\r?\n/).map(l => l.trim()).find(l => l && !l.startsWith('#'));
|
|
40
|
+
description = firstLine || '';
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const descLine = description ? `> ${description.replace(/\r?\n+/g, ' ').trim()}\n` : '';
|
|
44
|
+
const promptRef = `*Prompt template: \`.zed/prompts/${skillName}.md\` (Use via /${skillName})*\n`;
|
|
45
|
+
return {
|
|
46
|
+
skillName,
|
|
47
|
+
title,
|
|
48
|
+
section: `\n### Skill: ${title}\n${descLine}${promptRef}`,
|
|
49
|
+
prompt: `# ContextOS — ${title}\n\n${descLine}\n${body}\n`,
|
|
50
|
+
};
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
function run() {
|
|
54
|
+
console.log('Starting Zed IDE adapter export...');
|
|
55
|
+
|
|
56
|
+
fs.mkdirSync(ZED_DIR, { recursive: true });
|
|
57
|
+
fs.mkdirSync(PROMPTS_DIR, { recursive: true });
|
|
58
|
+
|
|
59
|
+
const lines = [];
|
|
60
|
+
|
|
61
|
+
// ── Header ───────────────────────────────────────────────────────────────────
|
|
62
|
+
lines.push(
|
|
63
|
+
`# ContextOS — AI Rules for Zed Assistant\n`,
|
|
64
|
+
`<!-- Auto-generated by: node .agents/ctx.js export zed -->\n`,
|
|
65
|
+
`<!-- Source: .agents/core/skills/ · Do not edit manually. -->\n\n`
|
|
66
|
+
);
|
|
67
|
+
|
|
68
|
+
// ── Project Rules ────────────────────────────────────────────────────────────
|
|
69
|
+
if (fs.existsSync(AGENTS_MD_PATH)) {
|
|
70
|
+
const agentsMd = fs.readFileSync(AGENTS_MD_PATH, 'utf8');
|
|
71
|
+
lines.push(`## Project Rules (AGENTS.md)\n\n${agentsMd}\n\n---\n`);
|
|
72
|
+
|
|
73
|
+
// Also write a master prompt in .zed/prompts/contextos.md
|
|
74
|
+
fs.writeFileSync(path.join(PROMPTS_DIR, 'contextos.md'), `# ContextOS Master Prompt\n\n${agentsMd}\n`);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
// ── Skills ───────────────────────────────────────────────────────────────────
|
|
78
|
+
lines.push(`\n## Skills Library\n`);
|
|
79
|
+
lines.push(`The following specialist skills guide architecture and implementation:\n`);
|
|
80
|
+
|
|
81
|
+
const skills = collectSkillDirectories();
|
|
82
|
+
const activePromptFiles = new Set(['contextos.md']);
|
|
83
|
+
let count = 0;
|
|
84
|
+
|
|
85
|
+
for (const skill of skills) {
|
|
86
|
+
const skillData = buildSkillSection(skill);
|
|
87
|
+
if (skillData) {
|
|
88
|
+
lines.push(skillData.section);
|
|
89
|
+
const promptFileName = `${skillData.skillName}.md`;
|
|
90
|
+
activePromptFiles.add(promptFileName);
|
|
91
|
+
fs.writeFileSync(path.join(PROMPTS_DIR, promptFileName), skillData.prompt);
|
|
92
|
+
count++;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Clean up stale prompts from uninstalled skills/plugins
|
|
97
|
+
if (fs.existsSync(PROMPTS_DIR)) {
|
|
98
|
+
for (const file of fs.readdirSync(PROMPTS_DIR)) {
|
|
99
|
+
if (file.endsWith('.md') && !activePromptFiles.has(file)) {
|
|
100
|
+
fs.unlinkSync(path.join(PROMPTS_DIR, file));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// Write master .zed/rules.md
|
|
106
|
+
fs.writeFileSync(RULES_FILE, lines.join(''));
|
|
107
|
+
console.log(`Generated .zed/rules.md (${count} skills) → ${RULES_FILE}`);
|
|
108
|
+
console.log(`Generated .zed/prompts/*.md (${count} prompts) → ${PROMPTS_DIR}`);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
module.exports = { run };
|