ai-workflow-init 6.2.3 → 6.3.2

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/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 OpenCode
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 4 AI coding tools. When adding commands:
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) - only if not exists
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
- if (existsSync(claudeMdPath)) {
391
- skip(`Skipping (already exists): ${claudeMdPath}`);
392
- } else {
393
- try {
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
@@ -0,0 +1,135 @@
1
+ # Cursor Sync Guide
2
+
3
+ Sync Claude Code workflows to Cursor format.
4
+
5
+ ---
6
+
7
+ ## Prerequisites
8
+
9
+ - Source: `.claude/commands/*.md`, `.claude/skills/**/SKILL.md`
10
+ - Target: `.cursor/commands/*.md`, `.cursor/rules/`
11
+
12
+ ---
13
+
14
+ ## Step 1: Fetch Cursor Documentation
15
+
16
+ **Search queries (try in order until successful):**
17
+ 1. `"cursor.com" rules for ai custom commands documentation`
18
+ 2. `site:docs.cursor.com rules commands`
19
+ 3. `cursor ai editor custom rules commands format`
20
+
21
+ **Key documentation URLs:**
22
+ - `https://docs.cursor.com/context/rules-for-ai`
23
+ - `https://docs.cursor.com/context/rules`
24
+ - `https://docs.cursor.com/chat/custom-modes`
25
+
26
+ **Extract and note:**
27
+ - Command file location: `.cursor/commands/` or `.cursor/rules/`
28
+ - File format: frontmatter structure, markdown body
29
+ - Supported frontmatter fields (name, description, etc.)
30
+ - Any special syntax or features (variables, context references)
31
+ - AGENTS.md support and location
32
+
33
+ ---
34
+
35
+ ## Step 2: Conversion Rules
36
+
37
+ ### Commands (`.cursor/commands/*.md`)
38
+
39
+ **Frontmatter:**
40
+ - Keep `name` and `description`
41
+ - Adjust other fields per Cursor docs
42
+
43
+ **Tool references conversion:**
44
+ | Claude Code | Cursor |
45
+ |-------------|--------|
46
+ | `AskUserQuestion(...)` | Ask user |
47
+ | `Task(subagent_type='Explore')` | Workspace search |
48
+ | `Read(file_path=...)` | Read file |
49
+ | `Write(file_path=...)` | Write file |
50
+ | `Edit(file_path=...)` | Edit file |
51
+ | `Glob(pattern=...)` | Find files |
52
+ | `Grep(pattern=...)` | Search content |
53
+ | `Bash(command=...)` | Run command |
54
+
55
+ **Skill references:**
56
+ - Convert `.claude/skills/...` → `.cursor/rules/...` or inline
57
+
58
+ **Keep:** Goal, Steps, Notes sections structure
59
+
60
+ ### Skills → Rules (`.cursor/rules/`)
61
+
62
+ Convert Claude skills to Cursor rules format.
63
+
64
+ ---
65
+
66
+ ## Step 3: Templates
67
+
68
+ ### Command Template
69
+
70
+ ```markdown
71
+ ---
72
+ name: {command-name}
73
+ description: {description}
74
+ ---
75
+
76
+ ## Goal
77
+
78
+ {goal from Claude command}
79
+
80
+ ## Workflow Alignment
81
+
82
+ {workflow section}
83
+
84
+ ## Step 1: {step name}
85
+
86
+ {converted step content - replace Claude-specific tool syntax}
87
+
88
+ ...
89
+
90
+ ## Notes
91
+
92
+ {notes section}
93
+ ```
94
+
95
+ ### Rule Template (for skills)
96
+
97
+ ```markdown
98
+ ---
99
+ name: {skill-name}
100
+ description: {description}
101
+ ---
102
+
103
+ {skill instructions converted to Cursor rule format}
104
+ ```
105
+
106
+ ---
107
+
108
+ ## Step 4: Write Files
109
+
110
+ **Tools:**
111
+ - `mkdir -p .cursor/commands`
112
+ - `mkdir -p .cursor/rules`
113
+ - Write(file_path=".cursor/commands/{name}.md")
114
+ - Write(file_path=".cursor/rules/{name}.md")
115
+
116
+ **Also sync base instructions:**
117
+ - Copy `.claude/CLAUDE.md` → `.cursor/CLAUDE.md`
118
+
119
+ ---
120
+
121
+ ## Step 5: Output Classification
122
+
123
+ ```
124
+ Cursor (.cursor/commands/):
125
+ - create-plan.md: [STATUS]
126
+ - execute-plan.md: [STATUS]
127
+ - sync-workflow.md: [STATUS]
128
+
129
+ Cursor (.cursor/rules/):
130
+ - frontend-design-fundamentals.md: [STATUS]
131
+ - quality-code-check.md: [STATUS]
132
+
133
+ Cursor Base Instructions:
134
+ - .cursor/CLAUDE.md: [STATUS]
135
+ ```