@abarcenas/ai-workflow-template 1.1.0 → 1.13.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.
Files changed (76) hide show
  1. package/.agents/instructions/learned-knowledge.instructions.md +46 -0
  2. package/{.github → .agents}/instructions/memory-bank.instructions.md +14 -0
  3. package/{.github → .agents}/instructions/task-implementation.instructions.md +8 -0
  4. package/.agents/skills/architecture-blueprint-generator/SKILL.md +378 -0
  5. package/.agents/skills/cavecrew/SKILL.md +82 -0
  6. package/.agents/skills/caveman/SKILL.md +74 -0
  7. package/.agents/skills/caveman-commit/SKILL.md +65 -0
  8. package/.agents/skills/caveman-compress/README.md +163 -0
  9. package/.agents/skills/caveman-compress/SECURITY.md +31 -0
  10. package/.agents/skills/caveman-compress/SKILL.md +111 -0
  11. package/.agents/skills/caveman-compress/scripts/__init__.py +9 -0
  12. package/.agents/skills/caveman-compress/scripts/__main__.py +3 -0
  13. package/.agents/skills/caveman-compress/scripts/benchmark.py +78 -0
  14. package/.agents/skills/caveman-compress/scripts/cli.py +85 -0
  15. package/.agents/skills/caveman-compress/scripts/compress.py +254 -0
  16. package/.agents/skills/caveman-compress/scripts/detect.py +121 -0
  17. package/.agents/skills/caveman-compress/scripts/validate.py +213 -0
  18. package/.agents/skills/caveman-help/SKILL.md +59 -0
  19. package/.agents/skills/caveman-review/SKILL.md +55 -0
  20. package/.agents/skills/caveman-stats/SKILL.md +10 -0
  21. package/.agents/skills/compress/SKILL.md +111 -0
  22. package/.agents/skills/compress/scripts/__init__.py +9 -0
  23. package/.agents/skills/compress/scripts/__main__.py +3 -0
  24. package/.agents/skills/compress/scripts/benchmark.py +78 -0
  25. package/.agents/skills/compress/scripts/cli.py +85 -0
  26. package/.agents/skills/compress/scripts/compress.py +254 -0
  27. package/.agents/skills/compress/scripts/detect.py +121 -0
  28. package/.agents/skills/compress/scripts/validate.py +213 -0
  29. package/{.github/agents/implementation-plan.agent.md → .agents/skills/create-implementation-plan/SKILL.md} +17 -52
  30. package/.agents/skills/create-specification/SKILL.md +127 -0
  31. package/AGENTS.md +149 -0
  32. package/README.md +197 -60
  33. package/opencode.mcp.example.json +54 -0
  34. package/package.json +13 -5
  35. package/scripts/mcp/playwright-mcp-launcher.js +46 -0
  36. package/scripts/sync.js +54 -11
  37. package/.github/agents/plan.agent.md +0 -135
  38. package/.github/agents/research-spike.agent.md +0 -204
  39. package/.github/prompts/copilot-instructions-blueprint-generator.prompt.md +0 -317
  40. /package/{.github → .agents}/instructions/agent-safety.instructions.md +0 -0
  41. /package/{.github → .agents}/instructions/agent-skill.instructions.md +0 -0
  42. /package/{.github → .agents}/instructions/agent.instructions.md +0 -0
  43. /package/{.github → .agents}/instructions/ai-prompt-engineering-safety.instructions.md +0 -0
  44. /package/{.github → .agents}/instructions/angular.instructions.md +0 -0
  45. /package/{.github → .agents}/instructions/context7.instructions.md +0 -0
  46. /package/{.github → .agents}/instructions/go.instructions.md +0 -0
  47. /package/{.github → .agents}/instructions/html-to-css-guide.instructions.md +0 -0
  48. /package/{.github → .agents}/instructions/instructions.instructions.md +0 -0
  49. /package/{.github → .agents}/instructions/markdown.instructions.md +0 -0
  50. /package/{.github → .agents}/instructions/nodejs-vitest.instructions.md +0 -0
  51. /package/{.github → .agents}/instructions/playwright-typescript.instructions.md +0 -0
  52. /package/{.github → .agents}/instructions/prompt.instructions.md +0 -0
  53. /package/{.github → .agents}/instructions/security-owasp.instructions.md +0 -0
  54. /package/{.github → .agents}/instructions/shell.instructions.md +0 -0
  55. /package/{.github → .agents}/instructions/typescript.instructions.md +0 -0
  56. /package/{.github → .agents}/prompts/documentation-writer.prompt.md +0 -0
  57. /package/{.github → .agents}/prompts/editconfig.prompt.md +0 -0
  58. /package/{.github → .agents}/prompts/playwright-explore.prompt.md +0 -0
  59. /package/{.github → .agents}/prompts/playwright-generate-test.prompt.md +0 -0
  60. /package/{.github → .agents}/skills/agent-governance/SKILL.md +0 -0
  61. /package/{.github → .agents}/skills/boost-prompt/SKILL.md +0 -0
  62. /package/{.github → .agents}/skills/chrome-devtools/SKILL.md +0 -0
  63. /package/{.github → .agents}/skills/context-map/SKILL.md +0 -0
  64. /package/{.github → .agents}/skills/conventional-commit/SKILL.md +0 -0
  65. /package/{.github → .agents}/skills/create-readme/SKILL.md +0 -0
  66. /package/{.github → .agents}/skills/editorconfig/SKILL.md +0 -0
  67. /package/{.github → .agents}/skills/gh-cli/SKILL.md +0 -0
  68. /package/{.github → .agents}/skills/git-commit/SKILL.md +0 -0
  69. /package/{.github → .agents}/skills/github-issues/SKILL.md +0 -0
  70. /package/{.github → .agents}/skills/github-issues/references/templates.md +0 -0
  71. /package/{.github → .agents}/skills/microsoft-docs/SKILL.md +0 -0
  72. /package/{.github → .agents}/skills/playwright-explore-website/SKILL.md +0 -0
  73. /package/{.github → .agents}/skills/playwright-generate-test/SKILL.md +0 -0
  74. /package/{.github → .agents}/skills/polygot-test-agent/SKILL.md +0 -0
  75. /package/{.github → .agents}/skills/polygot-test-agent/unit-test-genearation.prompt.md +0 -0
  76. /package/{.github → .agents}/skills/prompt-builder/SKILL.md +0 -0
package/README.md CHANGED
@@ -1,111 +1,248 @@
1
- # AI Workflow Template
1
+ # 🤖 AI Workflow Template
2
2
 
3
- Publishable AI workflow starter pack for GitHub Copilot. This package distributes the `.github/` experience, auto-bumps versions through Husky, and publishes to npm on merges to `main`.
3
+ **Publishable AI workflow starter pack for GitHub Copilot** - Auto-syncing, version-managed, npm-distributed agent configuration suite.
4
4
 
5
- ## What This Package Does
5
+ ---
6
6
 
7
- This repository is designed to be installed as an npm package instead of cloned as a one-off template. When a consuming project installs it, the package can copy its `.github/` folder into the consumer project and keep that folder in sync over time.
7
+ ## ✨ What This Package Does
8
8
 
9
- ### Included capabilities
9
+ This isn't a one-off template to clone—it's a **live npm package** that distributes AI workflow configurations to consumer projects. When installed, it automatically syncs its intelligent agent setup into your project and keeps everything updated over time.
10
10
 
11
- - Copilot instructions and workspace guidance in `.github/co-pilot.instructions.md`
12
- - Reusable skills in `.github/skills/`
13
- - Prompt templates in `.github/prompts/`
14
- - Custom agents in `.github/agents/`
15
- - Language and framework instructions in `.github/instructions/`
16
- - Version auto-bumping via Husky pre-commit hook
17
- - npm publishing workflow on merge to `main`
11
+ ### 🎯 Included Capabilities
18
12
 
19
- ## Install
13
+ - ⚙️ **27+ Specialized AI Skills** - Reusable, task-based workflows (`.agents/skills/`)
14
+ - 🧠 **Smart Agent Frameworks** - Plan Mode, Implementation Plans, Research Spikes (`.agents/agents/`)
15
+ - 📝 **Framework Instructions** - Technology-specific guidance (`.agents/instructions/`)
16
+ - 💬 **Prompt Templates** - Ready-to-use prompt blueprints (`.agents/prompts/`)
17
+ - 🏃‍♂️ **Caveman Mode** - Ultra-compressed communication for token efficiency
18
+ - 🧪 **Playwright Testing** - Automated testing with MCP integration
19
+ - 📦 **Version Auto-Bumping** - Husky-managed semantic versioning
20
+ - 🚀 **Auto-Publishing** - npm publish on merge to `main`
20
21
 
21
- Install the package in the project that should receive the shared Copilot configuration.
22
+ ---
23
+
24
+ ## 🚀 Install
25
+
26
+ Install directly into the project that needs AI workflow configuration:
22
27
 
23
28
  ```bash
24
- npm install ai-workflow-template
29
+ npm install @abarcenas/ai-workflow-template
25
30
  ```
26
31
 
27
- If you publish under a scoped name, use that name instead.
32
+ The package runs `postinstall` automatically to sync configurations.
28
33
 
29
- ## Sync Behavior
34
+ ---
30
35
 
31
- The package runs `scripts/sync.js` during `postinstall`.
36
+ ## 🔄 Sync Behavior
32
37
 
33
- - New `.github` files are copied into the consumer project
34
- - Files that have not been edited locally are refreshed from the package
35
- - Files that were modified locally are skipped by default
38
+ The sync script runs automatically but offers flexible control:
36
39
 
37
- ### Manual sync
38
-
39
- Use the sync script directly when you want to refresh the consumer project on demand.
40
+ ### 🔧 Manual Sync Options
40
41
 
41
42
  ```bash
43
+ # Preview changes without applying
44
+ npm run sync -- --dry-run
45
+
46
+ # Force overwrite local changes
47
+ npm run sync -- --force
48
+
49
+ # Normal sync
42
50
  npm run sync
43
51
  ```
44
52
 
45
- Force overwrite of tracked files when you want the package version to win.
53
+ **Smart Sync Rules:**
54
+ - ✅ New files are copied automatically
55
+ - ✅ Unmodified files are refreshed from the package
56
+ - ✅ Locally edited files are preserved (skipped by default)
57
+ - ✅ GitHub Actions workflows are excluded from consumer sync (`.github/workflows/`)
58
+
59
+ ---
60
+
61
+ ## 📚 Core Structure
62
+
63
+ Post-install, your project receives this organized structure:
64
+
65
+ ```
66
+ .agents/
67
+ ├── 📖 instructions/ # 17 instruction sets (frameworks, workflows, security)
68
+ ├── 🛠️ skills/ # 27+ specialized AI skills with tools
69
+ ├── 🤖 agents/ # 3 agent workflow patterns
70
+ ├── 💬 prompts/ # Reusable prompt templates
71
+ └── 📦 compress/ # Token optimization tools
72
+
73
+ .github/
74
+ └── workflows/ # CI/CD automation (excluded from sync)
75
+
76
+ docs/
77
+ └── playwright-mcp-configuration.md # Testing integration guide
78
+
79
+ AGENTS.md # Master instruction file with agent guidance
80
+
81
+ ## 🎯 Multi-Agent Orchestrator
82
+
83
+ The project includes a **multi-agent orchestrator** that dynamically builds and runs development pipelines using specialized sub-agents.
84
+
85
+ ### Agents
86
+
87
+ | Agent | File | Role |
88
+ |---|---|---|
89
+ | **Orchestrator** | `.opencode/agents/orchestrator.agent.md` | Master — analyzes requests, builds pipelines, delegates |
90
+ | Researcher | `.opencode/agents/researcher.agent.md` | Technical investigation, library evaluation |
91
+ | Architect | `.opencode/agents/architect.agent.md` | System design, component architecture |
92
+ | Implementer | `.opencode/agents/implementer.agent.md` | Translates designs into implementation plans |
93
+ | Designer | `.opencode/agents/designer.agent.md` | UI/UX, styling, responsive design |
94
+ | Coder | `.opencode/agents/coder.agent.md` | Production code implementation |
95
+ | Unit Tester | `.opencode/agents/unit-tester.agent.md` | Unit and integration tests |
96
+ | E2E Tester | `.opencode/agents/e2e-tester.agent.md` | Playwright browser tests |
97
+ | Reviewer | `.opencode/agents/reviewer.agent.md` | Code review, security audit |
98
+ | Deployer | `.opencode/agents/deployer.agent.md` | CI/CD, deployment scripts |
99
+ | Tracker | `.opencode/agents/tracker.agent.md` | Documentation recorder |
100
+
101
+ ### How to Use
102
+
103
+ Invoke the orchestrator with `@orchestrator` followed by your task:
46
104
 
47
105
  ```bash
48
- npm run sync -- --force
106
+ # Full automated pipeline (auto-bootstraps architecture on first run)
107
+ @orchestrator Add a user login feature with email verification
49
108
  ```
50
109
 
51
- Preview the sync without writing files.
110
+ ```bash
111
+ # Quick execution without step-by-step confirmation
112
+ @orchestrator full pipeline: refactor authentication to use JWT
113
+ ```
52
114
 
53
115
  ```bash
54
- npm run sync -- --dry-run
116
+ # Specific scope — only the relevant agents run
117
+ @orchestrator fix the pagination bug in the search results component
55
118
  ```
56
119
 
57
- ## Versioning
120
+ #### What Happens When You Run the Orchestrator
121
+
122
+ 1. **Step 0** — On first run only: auto-detects your project's tech stack, architecture patterns, and layer structure (via the architecture-blueprint-generator skill). Subsequent runs skip this.
123
+ 2. **Steps 1-2** — Analyzes your request and builds a pipeline of the relevant sub-agents.
124
+ 3. **Steps 3-4** — Executes each agent sequentially; you can confirm or skip each step (or enable auto-confirm for hands-off execution).
125
+ 4. **Step 5** — Tracker agent documents everything to `docs/tracker-log.md`.
126
+ 5. **Steps 6-7** — Presents results and persists new knowledge so the system gets smarter over time.
58
127
 
59
- Husky runs a pre-commit hook that bumps the package version automatically.
128
+ #### First-Run Behavior
60
129
 
61
- - Normal commits increment the minor version and reset patch to `0`
62
- - If the major version changes, the script resets the version to `<major>.0.0`
130
+ The very first time you use `@orchestrator` in a project, it automatically runs the architecture-blueprint-generator skill to:
131
+ - Detect your tech stack (frameworks, databases, infrastructure)
132
+ - Identify architectural patterns (Clean Architecture, MVC, etc.)
133
+ - Map layer structure and dependency rules
134
+ - Write the context to `docs/.architecture-context.md` and `.agents/instructions/learned-knowledge.instructions.md`
63
135
 
64
- Example:
136
+ All subsequent runs skip this — agents get architecture context pre-filled.
65
137
 
66
- ```text
67
- 1.2.0 -> 1.3.0
68
- 2.0.0 -> 2.1.0 on the next commit
138
+ #### MCP Tooling
139
+
140
+ Some agents require MCP servers configured in `opencode.mcp.json` (copy from `opencode.mcp.example.json`):
141
+
142
+ | Agent | Required MCP | Purpose |
143
+ |---|---|---|
144
+ | Researcher | ddg-search, Context7 | Web search + documentation queries |
145
+ | E2E Tester | Playwright | Browser automation |
146
+ | Reviewer | GitHub | PR and issue management |
147
+ | Deployer | GitHub | Releases, Actions |
69
148
  ```
70
149
 
71
- ## Publish Flow
150
+ **Main Instructions:** `AGENTS.md` - Central guidance for using all features.
72
151
 
73
- GitHub Actions publishes the package to npm when changes are merged into `main`.
152
+ ---
74
153
 
75
- ### Required secret
154
+ ## 🎨 Featured Skills
76
155
 
77
- Add `NPM_TOKEN` in GitHub repository settings:
156
+ ### Workflow Automation
157
+ - 🏗️ `architecture-blueprint-generator` - Project analysis & documentation
158
+ - 📋 `create-implementation-plan` - Structured task planning
159
+ - ✍️ `create-readme` - Automated README generation
160
+ - 🎯 `context-map` - File relevance mapping
78
161
 
79
- 1. Open your repository on GitHub
80
- 2. Go to Settings
81
- 3. Open Secrets and variables, then Actions
82
- 4. Add a new repository secret named `NPM_TOKEN`
83
- 5. Paste an npm automation token
162
+ ### Development Tools
163
+ - 🎭 `playwright-explore-website` / `playwright-generate-test` - Browser automation
164
+ - 🐙 `github-issues` / `gh-cli` - GitHub integration
165
+ - 🧪 `polygot-test-agent` - Multi-language test generation
166
+ - 📚 `microsoft-docs` - Microsoft documentation queries
84
167
 
85
- ## Local Development
168
+ ### Token & Efficiency Tools
169
+ - 🗣️ `caveman` - Ultra-compressed communication modes
170
+ - 📉 `caveman-compress` / `compress` - Memory file compression
171
+ - 📝 `caveman-commit` - Optimized commit messages
172
+ - 👥 `cavecrew` - Multi-agent coordination
173
+ - 📊 `caveman-stats` - Token usage tracking
86
174
 
87
- Install dependencies once to activate Husky hooks.
175
+ ### Quality & Safety
176
+ - 🛡️ `agent-governance` - AI safety controls
177
+ - 🔒 `security-owasp` - OWASP security guidelines
178
+ - 🤝 `conventional-commit` / `git-commit` - Git best practices
88
179
 
89
- ```bash
90
- npm install
91
- ```
180
+ ---
181
+
182
+ ## 📦 Versioning
183
+
184
+ Husky automatically bumps versions on every commit:
185
+
186
+ - **Minor** version increments by default: `1.2.0 → 1.3.0`
187
+ - **Patch** resets to 0 on each bump
188
+ - **Major** changes reset to `<major>.0.0`
189
+
190
+ No manual version management required!
191
+
192
+ ---
193
+
194
+ ## 🚀 Publish Flow
195
+
196
+ GitHub Actions automatically publishes to npm when merging to `main`.
197
+
198
+ ### 🔑 Required Setup
92
199
 
93
- Recommended checks:
200
+ Add `NPM_TOKEN` to GitHub repository secrets:
201
+
202
+ 1. Repository → Settings → Secrets and variables → Actions
203
+ 2. New repository secret → Name: `NPM_TOKEN`
204
+ 3. Paste npm automation token
205
+
206
+ **Note:** Publish workflow files (`.github/workflows/`) are excluded from consumer sync to prevent conflicts.
207
+
208
+ ---
209
+
210
+ ## 💻 Local Development
94
211
 
95
212
  ```bash
213
+ # Install dependencies & activate Husky hooks
214
+ npm install
215
+
216
+ # Verify sync behavior (dry run)
96
217
  npm run sync -- --dry-run
218
+
219
+ # Test package creation
97
220
  npm pack --json
221
+
222
+ # Run Playwright tests
223
+ npm test
98
224
  ```
99
225
 
100
- ## Updating the Shared Template
226
+ ---
227
+
228
+ ## 🔄 Updating the Shared Template
229
+
230
+ 1. ✏️ Edit files in `.agents/`, `docs/`, or `scripts/`
231
+ 2. 🎯 Test changes locally
232
+ 3. 💾 Commit (triggers auto-version bump)
233
+ 4. 🚀 Merge to `main` (triggers npm publish)
234
+ 5. ♻️ Consumers run `npm install` to get updates
235
+
236
+ ---
237
+
238
+ ## 🔔 Important Notes
101
239
 
102
- 1. Edit the files in `.github/` that should be distributed to consumer projects
103
- 2. Commit your changes
104
- 3. Merge to `main` to publish the updated package
105
- 4. Consumers can run `npm install` again to pull the latest distributed files
240
+ - ⚙️ Uses `INIT_CWD` to install against consuming project (not package dir)
241
+ - 💾 Local changes are always preserved unless `--force` is used
242
+ - 📖 `AGENTS.md` is the main instruction file agents should read
243
+ - 🎯 Package assumes public npm registry
244
+ - 🎭 Playwright MCP integration documented in `docs/` folder
106
245
 
107
- ## Notes
246
+ ---
108
247
 
109
- - The sync script uses `INIT_CWD` so installation runs against the consuming project, not the package directory
110
- - Local changes in a consuming repo are preserved unless you explicitly use `--force`
111
- - The publish workflow assumes the package is public on npm
248
+ **Happy coding with AI-powered workflows!** 🤖✨
@@ -0,0 +1,54 @@
1
+ {
2
+ "$schema": "https://opencode.ai/config.json",
3
+ "mcp": {
4
+ "ddg-search": {
5
+ "type": "local",
6
+ "command": ["npx", "-y", "ddg-mcp-search"],
7
+ "enabled": true
8
+ },
9
+ "github": {
10
+ "type": "local",
11
+ "command": "npx",
12
+ "args": ["-y", "@modelcontextprotocol/server-github"],
13
+ "env": {
14
+ "GITHUB_PERSONAL_ACCESS_TOKEN": "$GITHUB_PERSONAL_ACCESS_TOKEN"
15
+ },
16
+ "enabled": true
17
+ },
18
+ "context7": {
19
+ "type": "remote",
20
+ "url": "https://mcp.context7.com/mcp",
21
+ "headers": {
22
+ "CONTEXT7_API_KEY": "YOUR_API_KEY"
23
+ },
24
+ "enabled": true
25
+ },
26
+ "playwright": {
27
+ "type": "local",
28
+ "command": "node",
29
+ "args": ["scripts/mcp/playwright-mcp-launcher.js"],
30
+ "env": {
31
+ "HEADLESS": "$HEADLESS",
32
+ "SLOW_MO": "$SLOW_MO",
33
+ "VIEWPORT": "$VIEWPORT"
34
+ },
35
+ "enabled": true
36
+ },
37
+ "example-server": {
38
+ "type": "local",
39
+ "command": ["npx", "-y", "your-mcp-package"],
40
+ "enabled": false
41
+ },
42
+ "example-remote": {
43
+ "type": "remote",
44
+ "url": "https://your-mcp-server.com/mcp",
45
+ "enabled": false
46
+ }
47
+ },
48
+ "permission": {
49
+ "ddg-search_*": "allow",
50
+ "github_*": "allow",
51
+ "mcp-everything_*": "allow",
52
+ "playwright_*": "allow"
53
+ }
54
+ }
package/package.json CHANGED
@@ -1,10 +1,14 @@
1
1
  {
2
2
  "name": "@abarcenas/ai-workflow-template",
3
- "version": "1.1.0",
3
+ "version": "1.13.0",
4
4
  "description": "A comprehensive template repository for AI-assisted development workflows using GitHub Copilot. This template provides a structured approach to leveraging AI assistance through pre-configured skills, prompts, agents, and coding standards.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1",
7
+ "test": "playwright test",
8
+ "test:headed": "playwright test --headed",
9
+ "test:ui": "playwright test --ui",
10
+ "test:debug": "playwright test --debug",
11
+ "test:report": "playwright show-report",
8
12
  "prepare": "husky",
9
13
  "sync": "node ./scripts/sync.js",
10
14
  "postinstall": "node ./scripts/sync.js"
@@ -22,11 +26,15 @@
22
26
  },
23
27
  "homepage": "https://github.com/abarcenas29/ai-workflow-template#readme",
24
28
  "files": [
25
- ".github/",
26
- "scripts/"
29
+ ".agents/",
30
+ ".github/workflows/",
31
+ "scripts/",
32
+ "AGENTS.md",
33
+ "opencode.mcp.example.json"
27
34
  ],
28
- "dependencies": {},
29
35
  "devDependencies": {
36
+ "@playwright/test": "^1.59.1",
37
+ "dotenv": "^17.4.2",
30
38
  "husky": "^9.0.0"
31
39
  }
32
40
  }
@@ -0,0 +1,46 @@
1
+ #!/usr/bin/env node
2
+
3
+ /**
4
+ * Playwright MCP Launcher
5
+ * This script launches the Playwright MCP server with the correct configuration
6
+ * based on environment variables and project settings.
7
+ */
8
+
9
+ const { spawn } = require('child_process');
10
+ const path = require('path');
11
+
12
+ // Get environment variables
13
+ const headless = process.env.HEADLESS === 'true';
14
+ const slowMo = process.env.SLOW_MO ? parseInt(process.env.SLOW_MO) : 0;
15
+
16
+ // Build command arguments
17
+ const args = ['@playwright/mcp@latest'];
18
+
19
+ // Add headless flag if needed
20
+ if (headless) {
21
+ args.push('--headless');
22
+ }
23
+
24
+ // Add viewport size if specified
25
+ if (process.env.VIEWPORT) {
26
+ args.push('--viewport', process.env.VIEWPORT);
27
+ }
28
+
29
+ // Launch the MCP server
30
+ const child = spawn('npx', args, {
31
+ stdio: 'inherit',
32
+ shell: true
33
+ });
34
+
35
+ // Handle process signals
36
+ process.on('SIGINT', () => {
37
+ child.kill('SIGINT');
38
+ });
39
+
40
+ process.on('SIGTERM', () => {
41
+ child.kill('SIGTERM');
42
+ });
43
+
44
+ child.on('exit', (code) => {
45
+ process.exit(code || 0);
46
+ });
package/scripts/sync.js CHANGED
@@ -5,10 +5,11 @@ import { fileURLToPath } from 'url'
5
5
 
6
6
  const __dirname = dirname(fileURLToPath(import.meta.url))
7
7
  const packageRoot = resolve(__dirname, '..')
8
- const sourceGithubDir = resolve(packageRoot, '.github')
8
+ const sourceAgentsDir = resolve(packageRoot, '.agents')
9
9
  const consumerRoot = process.env.INIT_CWD ? resolve(process.env.INIT_CWD) : process.cwd()
10
- const targetGithubDir = resolve(consumerRoot, '.github')
11
- const manifestPath = resolve(consumerRoot, '.github-sync-manifest.json')
10
+ const targetAgentsDir = resolve(consumerRoot, '.agents')
11
+ const manifestPath = resolve(consumerRoot, '.agents-sync-manifest.json')
12
+ const excludedRelativePaths = new Set([])
12
13
  const args = new Set(process.argv.slice(2))
13
14
  const forceOverwrite = args.has('--force')
14
15
  const dryRun = args.has('--dry-run')
@@ -75,27 +76,36 @@ function syncFile(sourceFile, targetFile) {
75
76
  copyFileSync(sourceFile, targetFile)
76
77
  }
77
78
 
78
- if (!existsSync(sourceGithubDir)) {
79
- console.warn('[ai-workflow-template] No .github directory found to sync.')
79
+ const rootFiles = ['AGENTS.md', 'opencode.mcp.example.json']
80
+
81
+ if (!existsSync(sourceAgentsDir)) {
82
+ console.warn('[ai-workflow-template] No .agents directory found to sync.')
80
83
  process.exit(0)
81
84
  }
82
85
 
83
86
  const manifest = readManifest()
84
- const sourceFiles = collectFiles(sourceGithubDir)
87
+ const sourceFiles = collectFiles(sourceAgentsDir)
85
88
  let copied = 0
86
89
  let skipped = 0
87
90
  let added = 0
88
91
 
92
+ /* ── Sync .agents/ directory ────────────────────────────────── */
93
+
89
94
  for (const sourceFile of sourceFiles) {
90
- const relativePath = relative(sourceGithubDir, sourceFile)
91
- const targetFile = resolve(targetGithubDir, relativePath)
95
+ const relativePath = relative(sourceAgentsDir, sourceFile)
96
+ if (excludedRelativePaths.has(relativePath)) {
97
+ continue
98
+ }
99
+
100
+ const targetFile = resolve(targetAgentsDir, relativePath)
92
101
  const sourceHash = hashFile(sourceFile)
93
102
  const existingHash = existsSync(targetFile) ? hashFile(targetFile) : null
94
- const recordedHash = manifest.files[relativePath] ?? null
103
+ const trackedKey = relativePath
104
+ const recordedHash = manifest.files[trackedKey] ?? null
95
105
 
96
106
  if (!existsSync(targetFile)) {
97
107
  syncFile(sourceFile, targetFile)
98
- manifest.files[relativePath] = sourceHash
108
+ manifest.files[trackedKey] = sourceHash
99
109
  copied += 1
100
110
  added += 1
101
111
  continue
@@ -105,7 +115,7 @@ for (const sourceFile of sourceFiles) {
105
115
 
106
116
  if (forceOverwrite || isUntouched) {
107
117
  syncFile(sourceFile, targetFile)
108
- manifest.files[relativePath] = sourceHash
118
+ manifest.files[trackedKey] = sourceHash
109
119
  copied += 1
110
120
  continue
111
121
  }
@@ -114,6 +124,39 @@ for (const sourceFile of sourceFiles) {
114
124
  console.warn(`[ai-workflow-template] Skipped locally modified file: ${relativePath}`)
115
125
  }
116
126
 
127
+ for (const rootFile of rootFiles) {
128
+ const sourceFile = resolve(packageRoot, rootFile)
129
+ if (!existsSync(sourceFile)) {
130
+ continue
131
+ }
132
+
133
+ const targetFile = resolve(consumerRoot, rootFile)
134
+ const sourceHash = hashFile(sourceFile)
135
+ const existingHash = existsSync(targetFile) ? hashFile(targetFile) : null
136
+ const trackedKey = `__root__/${rootFile}`
137
+ const recordedHash = manifest.files[trackedKey] ?? null
138
+
139
+ if (!existsSync(targetFile)) {
140
+ syncFile(sourceFile, targetFile)
141
+ manifest.files[trackedKey] = sourceHash
142
+ copied += 1
143
+ added += 1
144
+ continue
145
+ }
146
+
147
+ const isUntouched = recordedHash !== null && existingHash === recordedHash
148
+
149
+ if (forceOverwrite || isUntouched) {
150
+ syncFile(sourceFile, targetFile)
151
+ manifest.files[trackedKey] = sourceHash
152
+ copied += 1
153
+ continue
154
+ }
155
+
156
+ skipped += 1
157
+ console.warn(`[ai-workflow-template] Skipped locally modified root file: ${rootFile}`)
158
+ }
159
+
117
160
  if (!dryRun) {
118
161
  writeManifest(manifest)
119
162
  }