ai-workflow-init 6.2.3 → 6.3.1
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/.claude/commands/sync-workflow.md +71 -699
- package/.claude/settings.local.json +0 -29
- package/AGENTS.md +60 -94
- package/README.md +14 -9
- package/cli.js +54 -47
- package/docs/sync-workflow/common.md +131 -0
- package/docs/sync-workflow/cursor.md +135 -0
- package/docs/sync-workflow/factory-droid.md +234 -0
- package/docs/sync-workflow/github-copilot.md +137 -0
- package/docs/sync-workflow/opencode.md +227 -0
- package/package.json +1 -1
|
@@ -25,15 +25,6 @@
|
|
|
25
25
|
}
|
|
26
26
|
],
|
|
27
27
|
"PostToolUse": [
|
|
28
|
-
{
|
|
29
|
-
"matcher": "Write",
|
|
30
|
-
"hooks": [
|
|
31
|
-
{
|
|
32
|
-
"type": "prompt",
|
|
33
|
-
"prompt": "If the file path contains 'docs/ai/planning/feature-' and ends with '.md', validate this planning document has all required sections: 1. Goal & Acceptance Criteria, 2. Risks & Assumptions, 3. Definition of Done, 4. Implementation Plan (with Summary and Phases), 5. Follow-ups. Return JSON: {\"valid\": true/false, \"missing\": [list of missing sections], \"message\": \"brief validation result\"}. If file path doesn't match, return {\"valid\": true, \"message\": \"skipped - not a planning doc\"}"
|
|
34
|
-
}
|
|
35
|
-
]
|
|
36
|
-
},
|
|
37
28
|
{
|
|
38
29
|
"matcher": "Edit",
|
|
39
30
|
"hooks": [
|
|
@@ -44,26 +35,6 @@
|
|
|
44
35
|
]
|
|
45
36
|
}
|
|
46
37
|
],
|
|
47
|
-
"PreToolUse": [
|
|
48
|
-
{
|
|
49
|
-
"matcher": "Bash",
|
|
50
|
-
"hooks": [
|
|
51
|
-
{
|
|
52
|
-
"type": "prompt",
|
|
53
|
-
"prompt": "GIT SAFETY CHECK: If command contains 'git ' (git commands like git add, git commit, git push, git pull, git checkout, git branch, git merge, git rebase, git reset, git stash, etc.): Check the ORIGINAL USER PROMPT - did the user EXPLICITLY request git operations? Keywords indicating user wants git: 'commit', 'push', 'git', 'version control', 'save changes', 'create branch'. If user did NOT explicitly request git operations, BLOCK with message 'Git operations require explicit user request. Ask user first.' Return JSON: {\"allow\": true/false, \"reason\": \"explanation\"}. If command does not contain git, return {\"allow\": true, \"reason\": \"not a git command\"}"
|
|
54
|
-
}
|
|
55
|
-
]
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
"matcher": "Write|Edit",
|
|
59
|
-
"hooks": [
|
|
60
|
-
{
|
|
61
|
-
"type": "prompt",
|
|
62
|
-
"prompt": "SECURITY CHECK: If file path matches any sensitive pattern: '.env', '.env.*', 'credentials', 'secrets', 'api_key', 'apikey', 'password', 'private_key', 'token', '.pem', '.key', 'auth.json', 'config/prod': WARN user with message '⚠️ SENSITIVE FILE: [filename] - Are you sure you want to modify this file?'. Return JSON: {\"isSensitive\": true/false, \"warning\": \"message if sensitive\", \"allow\": true}. Always allow but warn for sensitive files."
|
|
63
|
-
}
|
|
64
|
-
]
|
|
65
|
-
}
|
|
66
|
-
],
|
|
67
38
|
"Stop": [
|
|
68
39
|
{
|
|
69
40
|
"matcher": "",
|
package/AGENTS.md
CHANGED
|
@@ -2,123 +2,89 @@
|
|
|
2
2
|
|
|
3
3
|
## Core Coding Philosophy
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
-
|
|
10
|
-
|
|
11
|
-
-
|
|
12
|
-
-
|
|
13
|
-
-
|
|
5
|
+
### 1. Simplicity First (with Strategic Exceptions)
|
|
6
|
+
- **Default: Keep it simple**
|
|
7
|
+
- Choose simplest solution that meets requirements
|
|
8
|
+
- Avoid over-engineering and unnecessary abstractions
|
|
9
|
+
- Don't build for hypothetical futures
|
|
10
|
+
|
|
11
|
+
- **Think ahead ONLY for:**
|
|
12
|
+
- **Security**: Input validation, authentication, authorization
|
|
13
|
+
- **Performance**: Scalability bottlenecks, query optimization
|
|
14
|
+
- All other cases → Choose simplicity
|
|
15
|
+
|
|
16
|
+
- **Examples:**
|
|
17
|
+
- ✅ Use array methods instead of custom loops
|
|
18
|
+
- ✅ Add input validation for user data (security)
|
|
19
|
+
- ✅ Consider pagination for large datasets (performance)
|
|
20
|
+
- ❌ Don't create abstractions for one-time operations
|
|
14
21
|
|
|
15
22
|
### 2. Deep Understanding
|
|
16
|
-
|
|
17
|
-
- Understand requirements fully before planning or coding
|
|
18
|
-
- If unclear about requirement, flow, edge cases, or expected behavior → Ask the user
|
|
23
|
+
- If unclear about requirements, edge cases, or expected behavior → **Ask first**
|
|
19
24
|
- Never assume or guess - clarification prevents wasted effort
|
|
20
|
-
-
|
|
25
|
+
- Key questions:
|
|
21
26
|
- "What should happen when X occurs?"
|
|
22
|
-
- "How should the system behave if Y fails?"
|
|
23
27
|
- "Is this the expected flow: A → B → C?"
|
|
24
28
|
|
|
25
|
-
### 3. Multiple Options
|
|
26
|
-
|
|
27
|
-
- Provide 2-5 solution options for each problem when appropriate
|
|
28
|
-
- Present trade-offs clearly: pros/cons, complexity, performance, maintainability
|
|
29
|
+
### 3. Multiple Options When Appropriate
|
|
30
|
+
- Present 2-3 solution options with clear trade-offs
|
|
29
31
|
- Format: "Option 1: [approach] - Pros: [...] Cons: [...]"
|
|
30
|
-
- Let user choose based on their
|
|
31
|
-
- Not every problem has one "best" solution
|
|
32
|
-
|
|
33
|
-
### 4. Think Ahead
|
|
34
|
-
|
|
35
|
-
- While keeping solutions simple, consider future implications:
|
|
36
|
-
- How will this scale with more data/users?
|
|
37
|
-
- What if requirements change slightly?
|
|
38
|
-
- Are there security vulnerabilities?
|
|
39
|
-
- What are performance bottlenecks?
|
|
40
|
-
- Balance: Simple now + adaptable for reasonable future needs
|
|
41
|
-
- Do not build for hypothetical futures, but be aware of likely changes
|
|
42
|
-
|
|
43
|
-
**Philosophy in practice:**
|
|
44
|
-
|
|
45
|
-
- Simplicity: Use built-in array methods instead of custom loop logic
|
|
46
|
-
- Deep Understanding: "Should this API return 404 or 400 for invalid IDs?"
|
|
47
|
-
- Multiple Options: "We can use: 1) localStorage (simple), 2) IndexedDB (scalable), or 3) Backend API (persistent)"
|
|
48
|
-
- Think Ahead: "This works for 100 items, but consider pagination for 10,000+"
|
|
32
|
+
- Let user choose based on their priorities
|
|
49
33
|
|
|
50
34
|
---
|
|
51
35
|
|
|
52
|
-
##
|
|
53
|
-
|
|
54
|
-
### Workflow Alignment
|
|
36
|
+
## Workflow Guidelines
|
|
55
37
|
|
|
56
|
-
|
|
57
|
-
-
|
|
58
|
-
-
|
|
59
|
-
-
|
|
38
|
+
**Tooling:**
|
|
39
|
+
- Prefer semantic search; grep for exact matches only
|
|
40
|
+
- Run independent operations in parallel
|
|
41
|
+
- Search for files matching patterns when exploring codebase
|
|
42
|
+
- Search content for patterns when looking for specific code
|
|
60
43
|
|
|
61
|
-
|
|
44
|
+
**Communication:**
|
|
45
|
+
- Use Markdown minimally; backticks for `files/functions/classes`
|
|
46
|
+
- Mirror user's language; code/comments in English
|
|
47
|
+
- Status updates before/after key actions
|
|
62
48
|
|
|
63
|
-
|
|
49
|
+
**Code Presentation:**
|
|
50
|
+
- Existing code: `startLine:endLine:filepath`
|
|
51
|
+
- New code: fenced blocks with language tag
|
|
64
52
|
|
|
65
|
-
|
|
66
|
-
-
|
|
67
|
-
-
|
|
53
|
+
**TODO Management:**
|
|
54
|
+
- Create todos for medium/large tasks (≤14 words, verb-led)
|
|
55
|
+
- Keep ONE `in_progress` item only
|
|
56
|
+
- Update immediately; mark completed when done
|
|
68
57
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
- Coding conventions: `docs/ai/project/CODE_CONVENTIONS.md`
|
|
72
|
-
- Architecture guide: `docs/ai/project/PROJECT_STRUCTURE.md`
|
|
73
|
-
- Language templates: `docs/ai/project/template-convention/`
|
|
74
|
-
|
|
75
|
-
## Tooling Strategy
|
|
76
|
-
|
|
77
|
-
- Prefer semantic search across codebase; use grep only for exact matches
|
|
78
|
-
- Default to parallel execution for independent operations
|
|
79
|
-
- Quality tools: ESLint, TypeScript, Prettier (auto-format/auto-fix when possible)
|
|
80
|
-
|
|
81
|
-
## Communication
|
|
82
|
-
|
|
83
|
-
- Use Markdown only when necessary; backticks for `files/dirs/functions/classes`
|
|
84
|
-
- Status updates before/after important actions
|
|
85
|
-
- Mirror user's chat language; code/comments always in English
|
|
86
|
-
|
|
87
|
-
## Code Presentation
|
|
58
|
+
---
|
|
88
59
|
|
|
89
|
-
|
|
90
|
-
- New code: fenced blocks with language tag, no line numbers
|
|
60
|
+
## Skill Reporting (MANDATORY)
|
|
91
61
|
|
|
92
|
-
|
|
62
|
+
**CRITICAL REQUIREMENT - ALWAYS follow this:**
|
|
93
63
|
|
|
94
|
-
|
|
95
|
-
- Keep only ONE `in_progress` item
|
|
96
|
-
- Update immediately after progress; mark completed upon finish
|
|
64
|
+
At the START of EVERY response, BEFORE any other content, report skills:
|
|
97
65
|
|
|
98
|
-
|
|
66
|
+
```
|
|
67
|
+
📚 Skills: skill-name-1, skill-name-2
|
|
68
|
+
```
|
|
99
69
|
|
|
100
|
-
|
|
101
|
-
-
|
|
102
|
-
-
|
|
70
|
+
**Rules:**
|
|
71
|
+
- If skills were activated → List them
|
|
72
|
+
- If NO skills activated → Write: `📚 Skills: none`
|
|
73
|
+
- This line MUST appear in EVERY response, no exceptions
|
|
74
|
+
- Place BEFORE greeting, explanation, or any other content
|
|
103
75
|
|
|
104
|
-
|
|
76
|
+
**Example responses:**
|
|
105
77
|
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
- `/modify-plan` - Modify plan after implementation
|
|
109
|
-
- `/code-review` - Validate against standards
|
|
110
|
-
- `/generate-standards` - Update CODE_CONVENTIONS.md
|
|
111
|
-
- `/writing-test` - Generate tests from acceptance criteria
|
|
112
|
-
- `/init-chat` - Load project rules (AGENTS.md)
|
|
78
|
+
```
|
|
79
|
+
📚 Skills: frontend-design-fundamentals, frontend-design-theme-factory
|
|
113
80
|
|
|
114
|
-
|
|
81
|
+
I'll help you create a modern login page...
|
|
82
|
+
```
|
|
115
83
|
|
|
116
|
-
|
|
84
|
+
```
|
|
85
|
+
📚 Skills: none
|
|
117
86
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
- Type checking passes (if applicable)
|
|
121
|
-
- Build succeeds (if applicable)
|
|
122
|
-
- Checkbox updated in planning doc: `[x]`
|
|
87
|
+
Sure, I can help you fix that bug...
|
|
88
|
+
```
|
|
123
89
|
|
|
124
|
-
|
|
90
|
+
Skills are defined in the project's skills directory.
|
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A standardized AI workflow system for modern AI coding assistants. Initialize st
|
|
|
4
4
|
|
|
5
5
|
## Features
|
|
6
6
|
|
|
7
|
-
- **Multi-Platform Support**: Works with Cursor, GitHub Copilot, Claude Code, and
|
|
7
|
+
- **Multi-Platform Support**: Works with Cursor, GitHub Copilot, Claude Code, OpenCode, and Factory Droid
|
|
8
8
|
- **Structured Workflows**: Plan → Implement → Test → Review methodology
|
|
9
9
|
- **14 Pre-built Commands**: Create plans, execute tasks, run tests, code reviews, and more
|
|
10
10
|
- **7 Reusable Skills**: Design fundamentals, accessibility, theme generation, quality checks
|
|
@@ -36,6 +36,7 @@ Choose from:
|
|
|
36
36
|
- **GitHub Copilot** → `.github/prompts/` and `.github/copilot-instructions.md`
|
|
37
37
|
- **Claude Code** → `.claude/commands/`, `.claude/skills/`, `.claude/themes/`
|
|
38
38
|
- **OpenCode** → `.opencode/command/`, `.opencode/skill/`, `.opencode/agent/`
|
|
39
|
+
- **Factory Droid** → `.factory/commands/`, `.factory/skills/`, `.factory/droids/`
|
|
39
40
|
|
|
40
41
|
### Install Specific Tool
|
|
41
42
|
|
|
@@ -49,6 +50,9 @@ npx ai-workflow-init --tool cursor
|
|
|
49
50
|
# Install only OpenCode
|
|
50
51
|
npx ai-workflow-init --tool opencode
|
|
51
52
|
|
|
53
|
+
# Install only Factory Droid
|
|
54
|
+
npx ai-workflow-init --tool factory
|
|
55
|
+
|
|
52
56
|
# Install only GitHub Copilot
|
|
53
57
|
npx ai-workflow-init --tool copilot
|
|
54
58
|
```
|
|
@@ -372,6 +376,7 @@ AGENTS.md # Universal AI instructions
|
|
|
372
376
|
| **GitHub Copilot** | `.github/prompts/*.prompt.md` | - | `.github/copilot-instructions.md` |
|
|
373
377
|
| **Claude Code** | `.claude/commands/*.md` | `.claude/skills/*/SKILL.md` | `.claude/CLAUDE.md`, `.claude/themes/` |
|
|
374
378
|
| **OpenCode** | `.opencode/command/*.md` | `.opencode/skill/*/SKILL.md` | `.opencode/agent/`, `opencode.json` |
|
|
379
|
+
| **Factory Droid** | `.factory/commands/*.md` | `.factory/skills/*/SKILL.md` | `.factory/droids/*.md` |
|
|
375
380
|
|
|
376
381
|
---
|
|
377
382
|
|
|
@@ -393,13 +398,13 @@ Skills provide specialized knowledge that AI agents can load on-demand:
|
|
|
393
398
|
|
|
394
399
|
## Platform Compatibility
|
|
395
400
|
|
|
396
|
-
| Feature | Cursor | Copilot | Claude | OpenCode |
|
|
397
|
-
|
|
398
|
-
| Commands | ✅ | ✅ | ✅ | ✅ |
|
|
399
|
-
| Skills | ✅ | ❌ | ✅ | ✅ |
|
|
400
|
-
| Custom Agents | ❌ | ❌ | ❌ | ✅ |
|
|
401
|
-
| AGENTS.md | ✅ | ✅ | ✅ | ✅ |
|
|
402
|
-
| Path-specific rules | ✅ | ✅ | ❌ | ❌ |
|
|
401
|
+
| Feature | Cursor | Copilot | Claude | OpenCode | Factory Droid |
|
|
402
|
+
|---------|--------|---------|--------|----------|---------------|
|
|
403
|
+
| Commands | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
404
|
+
| Skills | ✅ | ❌ | ✅ | ✅ | ✅ |
|
|
405
|
+
| Custom Agents | ❌ | ❌ | ❌ | ✅ | ✅ (Droids) |
|
|
406
|
+
| AGENTS.md | ✅ | ✅ | ✅ | ✅ | ✅ |
|
|
407
|
+
| Path-specific rules | ✅ | ✅ | ❌ | ❌ | ❌ |
|
|
403
408
|
|
|
404
409
|
---
|
|
405
410
|
|
|
@@ -436,7 +441,7 @@ Skills provide specialized knowledge that AI agents can load on-demand:
|
|
|
436
441
|
|
|
437
442
|
## Contributing
|
|
438
443
|
|
|
439
|
-
This project maintains workflows for
|
|
444
|
+
This project maintains workflows for 5 AI coding tools. When adding commands:
|
|
440
445
|
|
|
441
446
|
1. Add to `.claude/commands/` (source of truth)
|
|
442
447
|
2. Run `/sync-workflow` to propagate to other tools
|
package/cli.js
CHANGED
|
@@ -220,6 +220,12 @@ const AI_TOOLS = [
|
|
|
220
220
|
description: "Terminal-based AI coding agent",
|
|
221
221
|
folders: [".opencode/command", ".opencode/skill", ".opencode/agent"],
|
|
222
222
|
},
|
|
223
|
+
{
|
|
224
|
+
id: "factory",
|
|
225
|
+
name: "Factory Droid",
|
|
226
|
+
description: "Factory AI coding assistant",
|
|
227
|
+
folders: [".factory/commands", ".factory/skills", ".factory/droids"],
|
|
228
|
+
},
|
|
223
229
|
];
|
|
224
230
|
|
|
225
231
|
// Interactive multi-select using arrow keys
|
|
@@ -384,17 +390,13 @@ function installClaudeCode() {
|
|
|
384
390
|
}
|
|
385
391
|
run(`npx degit ${REPO}/.claude/commands .claude/commands --force`);
|
|
386
392
|
|
|
387
|
-
// Download CLAUDE.md (context memory) -
|
|
393
|
+
// Download CLAUDE.md (context memory) - always overwrite to get latest
|
|
388
394
|
step("🚚 Downloading Claude Code context memory (.claude/CLAUDE.md)...");
|
|
389
395
|
const claudeMdPath = ".claude/CLAUDE.md";
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
run(`curl -fsSL ${RAW_BASE}/.claude/CLAUDE.md -o ${claudeMdPath}`);
|
|
395
|
-
} catch (_) {
|
|
396
|
-
run(`wget -qO ${claudeMdPath} ${RAW_BASE}/.claude/CLAUDE.md`);
|
|
397
|
-
}
|
|
396
|
+
try {
|
|
397
|
+
run(`curl -fsSL ${RAW_BASE}/.claude/CLAUDE.md -o ${claudeMdPath}`);
|
|
398
|
+
} catch (_) {
|
|
399
|
+
run(`wget -qO ${claudeMdPath} ${RAW_BASE}/.claude/CLAUDE.md`);
|
|
398
400
|
}
|
|
399
401
|
|
|
400
402
|
// Create settings.json with hooks (project-level, shareable with team)
|
|
@@ -417,15 +419,6 @@ function installClaudeCode() {
|
|
|
417
419
|
}
|
|
418
420
|
],
|
|
419
421
|
PostToolUse: [
|
|
420
|
-
{
|
|
421
|
-
matcher: "Write",
|
|
422
|
-
hooks: [
|
|
423
|
-
{
|
|
424
|
-
type: "prompt",
|
|
425
|
-
prompt: "If the file path contains 'docs/ai/planning/feature-' and ends with '.md', validate this planning document has all required sections: 1. Goal & Acceptance Criteria, 2. Risks & Assumptions, 3. Definition of Done, 4. Implementation Plan (with Summary and Phases), 5. Follow-ups. Return JSON: {\"valid\": true/false, \"missing\": [list of missing sections], \"message\": \"brief validation result\"}. If file path doesn't match, return {\"valid\": true, \"message\": \"skipped - not a planning doc\"}"
|
|
426
|
-
}
|
|
427
|
-
]
|
|
428
|
-
},
|
|
429
422
|
{
|
|
430
423
|
matcher: "Edit",
|
|
431
424
|
hooks: [
|
|
@@ -436,35 +429,6 @@ function installClaudeCode() {
|
|
|
436
429
|
]
|
|
437
430
|
}
|
|
438
431
|
],
|
|
439
|
-
PreToolUse: [
|
|
440
|
-
{
|
|
441
|
-
matcher: "Edit",
|
|
442
|
-
hooks: [
|
|
443
|
-
{
|
|
444
|
-
type: "prompt",
|
|
445
|
-
prompt: "If the file path contains 'docs/ai/planning/feature-' and ends with '.md': Check if the agent is starting a new phase. If yes, verify all tasks in the previous phase are marked [x]. Return JSON: {\"canProceed\": true/false, \"message\": \"reason\"}. If file path doesn't match, return {\"canProceed\": true, \"message\": \"skipped - not a planning doc\"}"
|
|
446
|
-
}
|
|
447
|
-
]
|
|
448
|
-
},
|
|
449
|
-
{
|
|
450
|
-
matcher: "Bash",
|
|
451
|
-
hooks: [
|
|
452
|
-
{
|
|
453
|
-
type: "prompt",
|
|
454
|
-
prompt: "GIT SAFETY CHECK: If command contains 'git ' (git commands like git add, git commit, git push, git pull, git checkout, git branch, git merge, git rebase, git reset, git stash, etc.): Check the ORIGINAL USER PROMPT - did the user EXPLICITLY request git operations? Keywords indicating user wants git: 'commit', 'push', 'git', 'version control', 'save changes', 'create branch'. If user did NOT explicitly request git operations, BLOCK with message 'Git operations require explicit user request. Ask user first.' Return JSON: {\"allow\": true/false, \"reason\": \"explanation\"}. If command does not contain git, return {\"allow\": true, \"reason\": \"not a git command\"}"
|
|
455
|
-
}
|
|
456
|
-
]
|
|
457
|
-
},
|
|
458
|
-
{
|
|
459
|
-
matcher: "Write|Edit",
|
|
460
|
-
hooks: [
|
|
461
|
-
{
|
|
462
|
-
type: "prompt",
|
|
463
|
-
prompt: "SECURITY CHECK: If file path matches any sensitive pattern: '.env', '.env.*', 'credentials', 'secrets', 'api_key', 'apikey', 'password', 'private_key', 'token', '.pem', '.key', 'auth.json', 'config/prod': WARN user with message '⚠️ SENSITIVE FILE: [filename] - Are you sure you want to modify this file?'. Return JSON: {\"isSensitive\": true/false, \"warning\": \"message if sensitive\", \"allow\": true}. Always allow but warn for sensitive files."
|
|
464
|
-
}
|
|
465
|
-
]
|
|
466
|
-
}
|
|
467
|
-
],
|
|
468
432
|
Stop: [
|
|
469
433
|
{
|
|
470
434
|
matcher: "",
|
|
@@ -565,6 +529,45 @@ function installOpenCode() {
|
|
|
565
529
|
}
|
|
566
530
|
}
|
|
567
531
|
|
|
532
|
+
// Install Factory Droid
|
|
533
|
+
function installFactoryDroid() {
|
|
534
|
+
step("🚚 Downloading Factory Droid commands (.factory/commands)...");
|
|
535
|
+
if (!existsSync(".factory/commands")) {
|
|
536
|
+
mkdirSync(".factory/commands", { recursive: true });
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// Check if source exists, if not create from Claude commands
|
|
540
|
+
try {
|
|
541
|
+
run(`npx degit ${REPO}/.factory/commands .factory/commands --force`);
|
|
542
|
+
} catch (e) {
|
|
543
|
+
console.log(`${colors.yellow}⚠️ Factory Droid commands not found in repo, will be synced from Claude Code${colors.reset}`);
|
|
544
|
+
}
|
|
545
|
+
|
|
546
|
+
step("🚚 Downloading Factory Droid skills (.factory/skills)...");
|
|
547
|
+
if (!existsSync(".factory/skills")) {
|
|
548
|
+
mkdirSync(".factory/skills", { recursive: true });
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
// Check if source exists, if not create from Claude skills
|
|
552
|
+
try {
|
|
553
|
+
run(`npx degit ${REPO}/.factory/skills .factory/skills --force`);
|
|
554
|
+
} catch (e) {
|
|
555
|
+
console.log(`${colors.yellow}⚠️ Factory Droid skills not found in repo, will be synced from Claude Code${colors.reset}`);
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
step("🚚 Downloading Factory Droid droids (.factory/droids)...");
|
|
559
|
+
if (!existsSync(".factory/droids")) {
|
|
560
|
+
mkdirSync(".factory/droids", { recursive: true });
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
// Check if source exists
|
|
564
|
+
try {
|
|
565
|
+
run(`npx degit ${REPO}/.factory/droids .factory/droids --force`);
|
|
566
|
+
} catch (e) {
|
|
567
|
+
console.log(`${colors.yellow}⚠️ Factory Droid droids not found in repo, using built-in droids${colors.reset}`);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
|
|
568
571
|
async function main() {
|
|
569
572
|
console.log(`
|
|
570
573
|
${colors.cyan}╔═══════════════════════════════════════════════════════════╗
|
|
@@ -633,6 +636,10 @@ ${colors.cyan}╔═════════════════════
|
|
|
633
636
|
installOpenCode();
|
|
634
637
|
}
|
|
635
638
|
|
|
639
|
+
if (toolIds.includes("factory")) {
|
|
640
|
+
installFactoryDroid();
|
|
641
|
+
}
|
|
642
|
+
|
|
636
643
|
// Download AGENTS.md (luôn ghi đè)
|
|
637
644
|
step("🚚 Downloading AGENTS.md...");
|
|
638
645
|
try {
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
# Common Analysis for Workflow Sync
|
|
2
|
+
|
|
3
|
+
This file contains shared logic for analyzing source files and detecting existing targets.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Step 1: Fetch Latest Documentation (Optional)
|
|
8
|
+
|
|
9
|
+
**CRITICAL: Fetch latest docs before syncing to ensure format compliance.**
|
|
10
|
+
|
|
11
|
+
Only fetch documentation for the selected platforms. Use WebSearch or WebFetch.
|
|
12
|
+
|
|
13
|
+
**Error handling:**
|
|
14
|
+
- Web search fails: Use cached knowledge + warn user docs may be outdated
|
|
15
|
+
- URL fetch fails: Try alternative URLs or search queries
|
|
16
|
+
- Format changed significantly: Alert user, show differences
|
|
17
|
+
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
## Step 2: Analyze Source (Claude Code)
|
|
21
|
+
|
|
22
|
+
### 2a: Analyze Commands
|
|
23
|
+
|
|
24
|
+
**Tools:**
|
|
25
|
+
- Glob(pattern=".claude/commands/*.md")
|
|
26
|
+
- Read(file_path=...) for each command
|
|
27
|
+
|
|
28
|
+
**For each Claude command, extract:**
|
|
29
|
+
- Frontmatter: name, description
|
|
30
|
+
- Goal section
|
|
31
|
+
- Step-by-step instructions
|
|
32
|
+
- Tool references (AskUserQuestion, Read, Write, Edit, Task, etc.)
|
|
33
|
+
- Skill references (`.claude/skills/...`)
|
|
34
|
+
- Notes and guidelines
|
|
35
|
+
|
|
36
|
+
### 2b: Analyze Skills
|
|
37
|
+
|
|
38
|
+
**Tools:**
|
|
39
|
+
- Glob(pattern=".claude/skills/**/SKILL.md")
|
|
40
|
+
- Read(file_path=...) for each skill
|
|
41
|
+
|
|
42
|
+
**For each Claude skill, extract:**
|
|
43
|
+
- Skill name and category (from path)
|
|
44
|
+
- SKILL.md content
|
|
45
|
+
- Triggers and usage conditions
|
|
46
|
+
- Instructions and guidelines
|
|
47
|
+
|
|
48
|
+
### 2c: Analyze Base Instructions
|
|
49
|
+
|
|
50
|
+
**Tools:**
|
|
51
|
+
- Read(file_path=".claude/CLAUDE.md")
|
|
52
|
+
- Read(file_path="AGENTS.md")
|
|
53
|
+
|
|
54
|
+
**Build inventory:**
|
|
55
|
+
```
|
|
56
|
+
| Type | Name | Description | Location |
|
|
57
|
+
|---------|-------------------|--------------------------------------|-----------------------|
|
|
58
|
+
| Command | create-plan | Generates feature planning doc | .claude/commands/ |
|
|
59
|
+
| Command | execute-plan | Implements tasks from planning doc | .claude/commands/ |
|
|
60
|
+
| Skill | figma-extraction | Extract design from Figma | .claude/skills/design/|
|
|
61
|
+
| Skill | quality-code-check| Linting and type checking | .claude/skills/arch/ |
|
|
62
|
+
| Rules | CLAUDE.md | Base instructions | .claude/ |
|
|
63
|
+
| Rules | AGENTS.md | Agent instructions | root |
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Step 3: Detect Existing Target Files
|
|
69
|
+
|
|
70
|
+
**Tools (run for selected platforms only):**
|
|
71
|
+
|
|
72
|
+
### Cursor:
|
|
73
|
+
- Glob(pattern=".cursor/commands/*.md")
|
|
74
|
+
- Glob(pattern=".cursor/rules/*.md")
|
|
75
|
+
|
|
76
|
+
### GitHub Copilot:
|
|
77
|
+
- Glob(pattern=".github/prompts/*.prompt.md")
|
|
78
|
+
- Read(file_path=".github/copilot-instructions.md")
|
|
79
|
+
|
|
80
|
+
### OpenCode:
|
|
81
|
+
- Glob(pattern=".opencode/command/*.md")
|
|
82
|
+
- Glob(pattern=".opencode/skill/*/SKILL.md")
|
|
83
|
+
- Glob(pattern=".opencode/agent/*.md")
|
|
84
|
+
|
|
85
|
+
### Factory Droid:
|
|
86
|
+
- Glob(pattern=".factory/commands/*.md")
|
|
87
|
+
- Glob(pattern=".factory/skills/*/SKILL.md")
|
|
88
|
+
- Glob(pattern=".factory/droids/*.md")
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Step 4: Classify Files
|
|
93
|
+
|
|
94
|
+
**Compare and classify:**
|
|
95
|
+
- **MISSING**: Source exists but not in target
|
|
96
|
+
- **OUTDATED**: Target exists but content differs significantly
|
|
97
|
+
- **CURRENT**: Target matches source (skip)
|
|
98
|
+
|
|
99
|
+
**Output classification example:**
|
|
100
|
+
```
|
|
101
|
+
[Platform Name]:
|
|
102
|
+
- create-plan: OUTDATED (source modified)
|
|
103
|
+
- execute-plan: CURRENT (skip)
|
|
104
|
+
- sync-workflow: MISSING (new)
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
---
|
|
108
|
+
|
|
109
|
+
## Tool Reference Conversion (Universal)
|
|
110
|
+
|
|
111
|
+
| Claude Code | Generic Instruction |
|
|
112
|
+
|-------------|---------------------|
|
|
113
|
+
| `AskUserQuestion(...)` | Ask user for input |
|
|
114
|
+
| `Task(subagent_type='Explore')` | Search codebase |
|
|
115
|
+
| `Task(subagent_type='General')` | General analysis |
|
|
116
|
+
| `Read(file_path=...)` | Read file |
|
|
117
|
+
| `Write(file_path=...)` | Write file |
|
|
118
|
+
| `Edit(file_path=...)` | Edit file |
|
|
119
|
+
| `Glob(pattern=...)` | Find files matching pattern |
|
|
120
|
+
| `Grep(pattern=...)` | Search content for pattern |
|
|
121
|
+
| `Bash(command=...)` | Run terminal command |
|
|
122
|
+
| `WebFetch(url=...)` | Fetch URL content |
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Error Handling
|
|
127
|
+
|
|
128
|
+
- Directory doesn't exist: Create it first with `mkdir -p`
|
|
129
|
+
- File write fails: Retry once, then notify user
|
|
130
|
+
- Conversion uncertain: Add TODO comment in output file
|
|
131
|
+
- Skill name validation fails: Adjust name to meet requirements
|