@silverassist/agents-toolkit 2.2.0 → 2.4.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@silverassist/agents-toolkit",
3
- "version": "2.2.0",
3
+ "version": "2.4.0",
4
4
  "description": "Reusable AI agent prompts for development workflows with Jira integration — supports GitHub Copilot, Claude Code, and Codex",
5
5
  "author": "Santiago Ramirez",
6
6
  "license": "PolyForm-Noncommercial-1.0.0",
package/src/index.js CHANGED
@@ -3,43 +3,79 @@
3
3
  * @module @silverassist/agents-toolkit
4
4
  */
5
5
 
6
- export const VERSION = "2.2.0";
6
+ export const VERSION = "2.4.0";
7
7
 
8
8
  export const PROMPTS = {
9
9
  workflow: [
10
+ "analyze-github-issue",
10
11
  "analyze-ticket",
12
+ "create-github-pr",
11
13
  "create-plan",
12
- "work-ticket",
13
- "prepare-pr",
14
14
  "create-pr",
15
+ "finalize-github-pr",
15
16
  "finalize-pr",
17
+ "prepare-pr",
18
+ "prepare-release",
19
+ "work-github-issue",
20
+ "work-ticket",
21
+ ],
22
+ utility: [
23
+ "add-tests",
24
+ "audit-ai-seo",
25
+ "fix-issues",
26
+ "new-wp-component",
27
+ "new-wp-plugin",
28
+ "quality-check",
29
+ "review-code",
16
30
  ],
17
- utility: ["review-code", "fix-issues", "add-tests"],
18
31
  };
19
32
 
20
33
  export const PARTIALS = [
21
- "validations",
34
+ "documentation",
22
35
  "git-operations",
36
+ "github-integration",
23
37
  "jira-integration",
24
- "documentation",
25
38
  "pr-template",
39
+ "validations",
26
40
  ];
27
41
 
28
42
  export const INSTRUCTIONS = [
29
- "typescript",
43
+ "css-styling",
44
+ "documentation-language",
45
+ "github-workflow",
46
+ "php-standards",
30
47
  "react-components",
31
48
  "server-actions",
49
+ "testing-standards",
32
50
  "tests",
33
- "css-styling",
51
+ "typescript",
52
+ "wordpress-plugin-architecture",
34
53
  ];
35
54
 
36
55
  export const SKILLS = [
56
+ "ai-seo-optimization",
37
57
  "component-architecture",
58
+ "create-component",
38
59
  "domain-driven-design",
60
+ "plugin-creation",
61
+ "quality-checks",
62
+ "release-management",
63
+ "testing",
39
64
  "testing-patterns",
40
- "ai-seo-optimization",
41
65
  ];
42
66
 
67
+ export const HOOKS = ["validate-tsx", "lint-format"];
68
+
69
+ // Skills follow the `npx skills` standard: a single canonical copy lives in
70
+ // .agents/skills/ and each agent's skills directory symlinks to it.
71
+ export const SKILLS_LAYOUT = {
72
+ canonicalDir: ".agents/skills",
73
+ agentDirs: {
74
+ claude: ".claude/skills",
75
+ copilot: ".github/skills",
76
+ },
77
+ };
78
+
43
79
  // Claude Code equivalents
44
80
  export const CLAUDE_COMMANDS = [
45
81
  "analyze-ticket",
@@ -56,4 +92,5 @@ export const CLAUDE_COMMANDS = [
56
92
  export const CLAUDE_FILES = {
57
93
  instructions: "CLAUDE.md",
58
94
  commandsDir: ".claude/commands",
95
+ skillsDir: ".claude/skills",
59
96
  };
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": 1,
3
+ "hooks": {
4
+ "PostToolUse": [
5
+ {
6
+ "type": "command",
7
+ "command": "scripts/lint-format.sh",
8
+ "timeout": 30
9
+ }
10
+ ]
11
+ }
12
+ }
@@ -0,0 +1,64 @@
1
+ #!/usr/bin/env bash
2
+ # lint-format.sh — PostToolUse hook for VS Code Copilot
3
+ # Runs eslint --fix and prettier --write on files modified by the agent.
4
+ # This ensures agent-generated code follows project formatting standards.
5
+ # Exit 0 = pass (always), diagnostics printed to stderr.
6
+
7
+ set -uo pipefail
8
+
9
+ FILE="${COPILOT_FILE:-}"
10
+
11
+ if [[ -z "$FILE" ]]; then
12
+ exit 0
13
+ fi
14
+
15
+ # Only process TypeScript, JavaScript, and CSS files
16
+ case "$FILE" in
17
+ *.ts|*.tsx|*.js|*.jsx|*.css) ;;
18
+ *) exit 0 ;;
19
+ esac
20
+
21
+ # Resolve to absolute path to prevent infinite loop in directory walk
22
+ if [[ "$FILE" != /* ]]; then
23
+ FILE="$(cd "$(dirname "$FILE")" && pwd)/$(basename "$FILE")"
24
+ fi
25
+
26
+ # File must exist
27
+ if [[ ! -f "$FILE" ]]; then
28
+ exit 0
29
+ fi
30
+
31
+ # Find project root (look for package.json)
32
+ DIR="$(dirname "$FILE")"
33
+ PROJECT_ROOT=""
34
+ while [[ "$DIR" != "/" ]]; do
35
+ if [[ -f "$DIR/package.json" ]]; then
36
+ PROJECT_ROOT="$DIR"
37
+ break
38
+ fi
39
+ DIR="$(dirname "$DIR")"
40
+ done
41
+
42
+ if [[ -z "$PROJECT_ROOT" ]]; then
43
+ exit 0
44
+ fi
45
+
46
+ # Resolve tool paths
47
+ ESLINT="$PROJECT_ROOT/node_modules/.bin/eslint"
48
+ PRETTIER="$PROJECT_ROOT/node_modules/.bin/prettier"
49
+
50
+ # Run ESLint --fix (only on TS/JS files)
51
+ case "$FILE" in
52
+ *.ts|*.tsx|*.js|*.jsx)
53
+ if [[ -x "$ESLINT" ]]; then
54
+ "$ESLINT" --fix "$FILE" || true
55
+ fi
56
+ ;;
57
+ esac
58
+
59
+ # Run Prettier --write
60
+ if [[ -x "$PRETTIER" ]]; then
61
+ "$PRETTIER" --write "$FILE" || true
62
+ fi
63
+
64
+ exit 0
@@ -0,0 +1,77 @@
1
+ #!/usr/bin/env bash
2
+ # validate-tsx.sh — PostToolUse hook for VS Code Copilot
3
+ # Validates that TSX component files follow project conventions.
4
+ # Exit 0 = pass, Exit 1 = fail (shown as warning to Copilot).
5
+
6
+ set -euo pipefail
7
+
8
+ # Only run when a .tsx file was modified
9
+ FILE="${COPILOT_FILE:-}"
10
+
11
+ if [[ -z "$FILE" ]]; then
12
+ exit 0
13
+ fi
14
+
15
+ if [[ "$FILE" != *.tsx ]]; then
16
+ exit 0
17
+ fi
18
+
19
+ # Only validate files inside components/ directories
20
+ if [[ "$FILE" != *"/components/"* ]]; then
21
+ exit 0
22
+ fi
23
+
24
+ ERRORS=()
25
+
26
+ # --- Rule 1: Component must be inside a folder with index.tsx ---
27
+ BASENAME=$(basename "$FILE")
28
+ DIRNAME=$(basename "$(dirname "$FILE")")
29
+
30
+ if [[ "$BASENAME" != "index.tsx" && "$DIRNAME" != "__tests__" ]]; then
31
+ ERRORS+=("Component files must be named index.tsx inside a kebab-case folder (found: $BASENAME)")
32
+ fi
33
+
34
+ # --- Rule 2: Parent folder must be kebab-case ---
35
+ if [[ "$BASENAME" == "index.tsx" ]]; then
36
+ if [[ ! "$DIRNAME" =~ ^[a-z][a-z0-9]*(-[a-z0-9]+)*$ ]]; then
37
+ ERRORS+=("Component folder must be kebab-case (found: $DIRNAME)")
38
+ fi
39
+ fi
40
+
41
+ # --- Rule 3: Must have a default export function (PascalCase) ---
42
+ if [[ "$BASENAME" == "index.tsx" ]] && [[ -f "$FILE" ]]; then
43
+ if ! grep -qE "^export default function [A-Z]" "$FILE"; then
44
+ ERRORS+=("Component must use 'export default function PascalName' pattern")
45
+ fi
46
+ fi
47
+
48
+ # --- Rule 4: Props interface should exist for non-trivial components ---
49
+ if [[ "$BASENAME" == "index.tsx" ]] && [[ -f "$FILE" ]]; then
50
+ # Check if there are props being destructured
51
+ if grep -qE "^export default function [A-Z][a-zA-Z]+\(" "$FILE"; then
52
+ # If it has props (not empty parens), check for interface
53
+ if grep -qE "^export default function [A-Z][a-zA-Z]+\(\{" "$FILE"; then
54
+ if ! grep -qE "^(export )?(interface|type) [A-Z][a-zA-Z]+Props" "$FILE"; then
55
+ ERRORS+=("Components with props should define a Props interface (e.g., interface ComponentNameProps)")
56
+ fi
57
+ fi
58
+ fi
59
+ fi
60
+
61
+ # --- Rule 5: No relative imports (must use @/ prefix) ---
62
+ if [[ -f "$FILE" ]]; then
63
+ if grep -qE "^import .+ from ['\"]\.\.?/" "$FILE" || grep -qE "^import ['\"]\.\.?/" "$FILE"; then
64
+ ERRORS+=("Relative imports found. Use absolute imports with @/ prefix instead of ./ or ../")
65
+ fi
66
+ fi
67
+
68
+ # --- Report ---
69
+ if [[ ${#ERRORS[@]} -gt 0 ]]; then
70
+ echo "⚠️ TSX validation issues in: $FILE"
71
+ for err in "${ERRORS[@]}"; do
72
+ echo " • $err"
73
+ done
74
+ exit 1
75
+ fi
76
+
77
+ exit 0
@@ -0,0 +1,12 @@
1
+ {
2
+ "version": 1,
3
+ "hooks": {
4
+ "PostToolUse": [
5
+ {
6
+ "type": "command",
7
+ "command": "scripts/validate-tsx.sh",
8
+ "timeout": 30
9
+ }
10
+ ]
11
+ }
12
+ }
@@ -0,0 +1,147 @@
1
+ ---
2
+ agent: agent
3
+ description: Create a pull request for the current branch linked to a GitHub issue
4
+ ---
5
+
6
+ # Create GitHub Pull Request
7
+
8
+ Create a pull request for the current branch linked to GitHub issue **#{issue-number}**.
9
+
10
+ ## Prerequisites
11
+ - Run `prepare-pr` first to ensure code is ready
12
+ - GitHub MCP connection or `gh` CLI required
13
+ - Reference: `.github/prompts/_partials/pr-template.md`
14
+ - Reference: `.github/prompts/_partials/git-operations.md`
15
+ - Reference: `.github/prompts/_partials/github-integration.md`
16
+
17
+ ## Steps
18
+
19
+ ### 1. Verify Current State
20
+
21
+ ```bash
22
+ git branch --show-current
23
+ git status
24
+ ```
25
+
26
+ Verify:
27
+ - Branch follows convention: `feature/{issue-number}-*` or `bugfix/{issue-number}-*`
28
+ - All changes are committed
29
+ - Not on protected branch
30
+
31
+ ### 2. Review Changes
32
+
33
+ ```bash
34
+ BASE_BRANCH=$(node -e "try{const c=require('./.agents-toolkit.json');console.log(c.pr?.targetBranch||c.git?.defaultBranch||'main')}catch{console.log('main')}")
35
+ git diff "$BASE_BRANCH" --name-only
36
+ ```
37
+
38
+ - Reuse `BASE_BRANCH` in all subsequent steps
39
+ - Summarize the changes made
40
+ - Identify breaking changes or migrations
41
+
42
+ ### 3. Read GitHub Issue
43
+
44
+ Fetch issue **#{issue-number}** details:
45
+ - Get title for PR title
46
+ - Extract acceptance criteria
47
+ - Get any context from comments
48
+
49
+ ```bash
50
+ gh issue view {issue-number} | cat
51
+ ```
52
+
53
+ ### 4. Run Final Validations
54
+
55
+ ```bash
56
+ npm run lint --if-present
57
+ npm run type-check --if-present
58
+ if [ -f tsconfig.json ]; then npx tsc --noEmit; fi
59
+ npm run test --if-present
60
+ npm run build --if-present
61
+ ```
62
+
63
+ Fix any issues before proceeding.
64
+
65
+ ### 5. Push Branch
66
+
67
+ ```bash
68
+ git push -u origin $(git branch --show-current)
69
+ ```
70
+
71
+ ### 6. Create Pull Request
72
+
73
+ #### PR Title
74
+ ```
75
+ {Issue title}
76
+ ```
77
+
78
+ #### PR Description
79
+
80
+ Use this template:
81
+
82
+ ```markdown
83
+ ## Summary
84
+ Brief description of what this PR accomplishes.
85
+
86
+ ## Related Issue
87
+ Closes #{issue-number}
88
+
89
+ ## Changes Made
90
+ - Change 1: Description
91
+ - Change 2: Description
92
+ - Change 3: Description
93
+
94
+ ## Type of Change
95
+ - [ ] 🐛 Bug fix
96
+ - [ ] ✨ New feature
97
+ - [ ] 💥 Breaking change
98
+ - [ ] 📝 Documentation
99
+ - [ ] 🔧 Refactoring
100
+
101
+ ## Testing
102
+ - [ ] Unit tests added/updated
103
+ - [ ] Manual testing performed
104
+ - Describe test cases here
105
+
106
+ ## Screenshots
107
+ (If UI changes, add before/after screenshots)
108
+
109
+ ## Checklist
110
+ - [ ] Code follows project style guidelines
111
+ - [ ] Self-review completed
112
+ - [ ] Documentation updated
113
+ - [ ] Tests pass locally
114
+ ```
115
+
116
+ #### Create via CLI
117
+
118
+ ```bash
119
+ gh pr create \
120
+ --title "{Issue title}" \
121
+ --body "$(cat <<'EOF'
122
+ ## Summary
123
+ ...
124
+
125
+ Closes #{issue-number}
126
+ EOF
127
+ )" \
128
+ --base "$BASE_BRANCH" | cat
129
+ ```
130
+
131
+ #### PR Settings
132
+ - **Source**: Current branch
133
+ - **Target**: `<base-branch>` resolved from `.agents-toolkit.json` (fallback: `main`)
134
+ - **Reviewers**: Based on changed files
135
+
136
+ ### 7. Comment on GitHub Issue
137
+
138
+ Add a comment linking to the PR:
139
+
140
+ ```bash
141
+ gh issue comment {issue-number} --body "## Pull Request Created
142
+
143
+ PR: <pr-url>
144
+ Branch: \`$(git branch --show-current)\`
145
+
146
+ Work in progress. Review requested." | cat
147
+ ```
@@ -0,0 +1,129 @@
1
+ ---
2
+ agent: agent
3
+ description: Finalize a pull request after approval and prepare for merge
4
+ ---
5
+
6
+ # Finalize GitHub Pull Request
7
+
8
+ Finalize PR for GitHub issue **#{issue-number}** after approval and prepare for merge.
9
+
10
+ ## Prerequisites
11
+ - PR has been approved
12
+ - GitHub MCP connection or `gh` CLI required
13
+ - Reference: `.github/prompts/_partials/git-operations.md`
14
+ - Reference: `.github/prompts/_partials/validations.md`
15
+ - Reference: `.github/prompts/_partials/github-integration.md`
16
+
17
+ ## Steps
18
+
19
+ ### 1. Verify PR Status
20
+
21
+ ```bash
22
+ gh pr view --json state,reviewDecision,statusCheckRollup | cat
23
+ ```
24
+
25
+ Check:
26
+ - All required approvals in place
27
+ - CI/CD pipeline passed
28
+ - No unresolved review comments
29
+
30
+ ### 2. Address Review Comments
31
+
32
+ If there are unresolved comments:
33
+
34
+ ```bash
35
+ gh pr view --json reviews,comments | cat
36
+ ```
37
+
38
+ - List each unresolved comment
39
+ - Address feedback
40
+ - Push additional commits if needed
41
+ - Request re-review if changes are significant:
42
+
43
+ ```bash
44
+ gh pr review --request-changes --body "..." | cat
45
+ # or after fixing:
46
+ gh pr review --approve | cat
47
+ ```
48
+
49
+ ### 3. Sync with Base Branch
50
+
51
+ ```bash
52
+ BASE_BRANCH=$(node -e "try{const c=require('./.agents-toolkit.json');console.log(c.pr?.targetBranch||c.git?.defaultBranch||'main')}catch{console.log('main')}")
53
+ git fetch origin
54
+ git rebase "origin/${BASE_BRANCH}"
55
+ ```
56
+
57
+ If conflicts:
58
+ 1. Resolve each conflict
59
+ 2. Stage resolved files: `git add <file>`
60
+ 3. Continue rebase: `git rebase --continue`
61
+
62
+ Push updated branch:
63
+ ```bash
64
+ git push --force-with-lease
65
+ ```
66
+
67
+ ### 4. Final Validations
68
+
69
+ Run complete validation suite:
70
+ ```bash
71
+ npm run lint --if-present
72
+ npm run type-check --if-present
73
+ if [ -f tsconfig.json ]; then npx tsc --noEmit; fi
74
+ npm run test --if-present
75
+ npm run build --if-present
76
+ ```
77
+
78
+ Verify:
79
+ - No regressions after rebase
80
+ - All tests still pass
81
+ - No new warnings
82
+
83
+ ### 5. Merge Pull Request
84
+
85
+ **Recommended merge strategy**: Squash merge
86
+
87
+ ```bash
88
+ gh pr merge --squash --delete-branch | cat
89
+ ```
90
+
91
+ **Final commit message format**:
92
+ ```
93
+ {Issue title} (#{pr-number})
94
+
95
+ - Key change 1
96
+ - Key change 2
97
+ - Key change 3
98
+ ```
99
+
100
+ ### 6. Post-Merge Tasks
101
+
102
+ After merge is complete:
103
+
104
+ ```bash
105
+ # Return to base branch and sync
106
+ git checkout "$BASE_BRANCH"
107
+ git pull origin "$BASE_BRANCH"
108
+
109
+ # Delete local branch (force if squash-merged)
110
+ git branch -D <branch-name>
111
+
112
+ # Clean up stale references
113
+ git remote prune origin
114
+ ```
115
+
116
+ ### 7. Close GitHub Issue
117
+
118
+ The issue closes automatically if the PR description contains `Closes #{issue-number}`.
119
+ If not, close manually:
120
+
121
+ ```bash
122
+ gh issue close {issue-number} --comment "Completed in PR #<pr-number>." | cat
123
+ ```
124
+
125
+ ### 8. Clean Up
126
+
127
+ - [ ] Delete temporary planning docs from `docs/` (if applicable)
128
+ - [ ] Ensure final documentation is complete
129
+ - [ ] Verify commit history is clean
@@ -93,4 +93,4 @@ Report:
93
93
 
94
94
  - Begin implementation following the plan
95
95
  - Use `prepare-pr` when ready for review
96
- - Use `create-pr` to submit pull request
96
+ - Use `create-github-pr` to submit pull request
@@ -8,18 +8,39 @@ Skills are markdown files with YAML frontmatter that provide domain-specific gui
8
8
 
9
9
  ## Structure
10
10
 
11
- Each skill lives in its own folder with a `SKILL.md` file:
11
+ Each skill lives in its own folder with a `SKILL.md` file. Following the
12
+ [`npx skills`](https://github.com/vercel-labs/skills) standard, the real files
13
+ are installed **once** into a canonical `.agents/skills/` store, and each agent's
14
+ skills directory contains symlinks to it (single source of truth):
12
15
 
13
16
  ```
14
- .github/skills/
17
+ .agents/skills/ # canonical store (real files)
18
+ ├── ai-seo-optimization/
19
+ │ └── SKILL.md
15
20
  ├── component-architecture/
16
21
  │ └── SKILL.md
22
+ ├── create-component/
23
+ │ └── SKILL.md
17
24
  ├── domain-driven-design/
18
25
  │ └── SKILL.md
26
+ ├── plugin-creation/
27
+ │ └── SKILL.md
28
+ ├── quality-checks/
29
+ │ └── SKILL.md
30
+ ├── release-management/
31
+ │ └── SKILL.md
32
+ ├── testing/
33
+ │ └── SKILL.md
19
34
  └── testing-patterns/
20
35
  └── SKILL.md
36
+
37
+ .github/skills/ → symlinks to ../../.agents/skills/* (Copilot, Codex)
38
+ .claude/skills/ → symlinks to ../../.agents/skills/* (Claude Code, read natively)
21
39
  ```
22
40
 
41
+ Use `--copy` at install time to materialize real copies instead of symlinks
42
+ (symlinks also fall back to copies automatically on systems that don't support them).
43
+
23
44
  ## Frontmatter Format
24
45
 
25
46
  ```yaml
@@ -47,7 +68,8 @@ Skills are automatically picked up by agents when relevant to your question. You
47
68
 
48
69
  ## Creating Custom Skills
49
70
 
50
- 1. Create a folder: `.github/skills/your-skill-name/`
71
+ 1. Create a folder: `.agents/skills/your-skill-name/` (canonical store)
51
72
  2. Create `SKILL.md` with frontmatter
73
+ 3. Run `npx @silverassist/agents-toolkit install --skills-only` to symlink it into `.github/skills/` and `.claude/skills/`
52
74
  3. Document patterns, examples, and conventions
53
75
  4. Include ✅ CORRECT and ❌ INCORRECT examples