autoworkflow 2.1.0 → 2.2.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.
@@ -3,7 +3,8 @@
3
3
  "allow": [
4
4
  "Bash(git push)",
5
5
  "Bash(npm publish:*)",
6
- "Bash(npm version:*)"
6
+ "Bash(npm version:*)",
7
+ "Bash(node bin/cli.js:*)"
7
8
  ]
8
9
  }
9
10
  }
package/README.md CHANGED
@@ -8,19 +8,23 @@ A system prompt architecture that controls Claude Code's behavior through trigge
8
8
 
9
9
  ## Installation
10
10
 
11
- ### Via npm (Recommended)
11
+ ### One Command Setup (Recommended)
12
12
 
13
13
  ```bash
14
- npm install autoworkflow
14
+ npx autoworkflow init
15
15
  ```
16
16
 
17
- Then ask Claude to set it up:
17
+ This copies all workflow files to your project. Options:
18
+ - `npx autoworkflow init` - Required + recommended files
19
+ - `npx autoworkflow init --all` - Include .vscode and config templates
20
+ - `npx autoworkflow init --minimal` - Required files only
18
21
 
19
- ```
20
- /init
21
- ```
22
+ ### Or Install as Dependency
22
23
 
23
- Claude will copy all necessary files from `node_modules/autoworkflow/` to your project root.
24
+ ```bash
25
+ npm install autoworkflow
26
+ npx autoworkflow init
27
+ ```
24
28
 
25
29
  **Or copy manually:**
26
30
 
package/bin/cli.js ADDED
@@ -0,0 +1,144 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { existsSync, cpSync, mkdirSync, chmodSync } from 'fs';
4
+ import { dirname, join } from 'path';
5
+ import { fileURLToPath } from 'url';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = dirname(__filename);
9
+ const packageRoot = join(__dirname, '..');
10
+
11
+ const args = process.argv.slice(2);
12
+ const command = args[0];
13
+
14
+ const colors = {
15
+ green: (text) => `\x1b[32m${text}\x1b[0m`,
16
+ yellow: (text) => `\x1b[33m${text}\x1b[0m`,
17
+ red: (text) => `\x1b[31m${text}\x1b[0m`,
18
+ cyan: (text) => `\x1b[36m${text}\x1b[0m`,
19
+ bold: (text) => `\x1b[1m${text}\x1b[0m`,
20
+ };
21
+
22
+ function printHelp() {
23
+ console.log(`
24
+ ${colors.bold('AutoWorkflow CLI')}
25
+
26
+ Usage: npx autoworkflow <command> [options]
27
+
28
+ Commands:
29
+ init Set up AutoWorkflow in current directory
30
+ init --all Include optional files (.vscode, configs)
31
+ init --minimal Required files only
32
+ help Show this help message
33
+
34
+ Examples:
35
+ npx autoworkflow init
36
+ npx autoworkflow init --all
37
+ `);
38
+ }
39
+
40
+ function copyFile(src, dest, name) {
41
+ if (existsSync(src)) {
42
+ try {
43
+ cpSync(src, dest, { recursive: true });
44
+ console.log(` ${colors.green('✓')} ${name}`);
45
+ return true;
46
+ } catch (err) {
47
+ console.log(` ${colors.red('✗')} ${name}: ${err.message}`);
48
+ return false;
49
+ }
50
+ } else {
51
+ console.log(` ${colors.yellow('⚠')} ${name}: not found in package`);
52
+ return false;
53
+ }
54
+ }
55
+
56
+ function init(options = {}) {
57
+ const cwd = process.cwd();
58
+ const all = options.all || args.includes('--all');
59
+ const minimal = options.minimal || args.includes('--minimal');
60
+
61
+ console.log(`\n${colors.bold('AutoWorkflow Setup')}\n`);
62
+ console.log(`Installing to: ${colors.cyan(cwd)}\n`);
63
+
64
+ // Check if already initialized
65
+ if (existsSync(join(cwd, 'CLAUDE.md'))) {
66
+ console.log(`${colors.yellow('⚠')} CLAUDE.md already exists.`);
67
+ console.log(` Use --force to overwrite (not implemented yet)\n`);
68
+ }
69
+
70
+ // Required files
71
+ console.log(colors.bold('Required files:'));
72
+ copyFile(join(packageRoot, 'CLAUDE.md'), join(cwd, 'CLAUDE.md'), 'CLAUDE.md');
73
+ copyFile(join(packageRoot, 'system'), join(cwd, 'system'), 'system/');
74
+ copyFile(join(packageRoot, 'instructions'), join(cwd, 'instructions'), 'instructions/');
75
+ copyFile(join(packageRoot, '.claude'), join(cwd, '.claude'), '.claude/');
76
+
77
+ if (!minimal) {
78
+ // Recommended files
79
+ console.log(`\n${colors.bold('Recommended files:')}`);
80
+ copyFile(join(packageRoot, 'scripts'), join(cwd, 'scripts'), 'scripts/');
81
+ copyFile(join(packageRoot, 'hooks'), join(cwd, 'hooks'), 'hooks/');
82
+ }
83
+
84
+ if (all) {
85
+ // Optional files
86
+ console.log(`\n${colors.bold('Optional files:')}`);
87
+ copyFile(join(packageRoot, '.vscode'), join(cwd, '.vscode'), '.vscode/');
88
+ copyFile(join(packageRoot, '.prettierrc'), join(cwd, '.prettierrc'), '.prettierrc');
89
+
90
+ // Copy example configs with proper names
91
+ if (existsSync(join(packageRoot, 'eslint.config.example.js'))) {
92
+ copyFile(join(packageRoot, 'eslint.config.example.js'), join(cwd, 'eslint.config.js'), 'eslint.config.js');
93
+ }
94
+ if (existsSync(join(packageRoot, 'tsconfig.example.json'))) {
95
+ copyFile(join(packageRoot, 'tsconfig.example.json'), join(cwd, 'tsconfig.json'), 'tsconfig.json');
96
+ }
97
+ }
98
+
99
+ // Setup git hooks if hooks were copied
100
+ if (!minimal && existsSync(join(cwd, 'hooks')) && existsSync(join(cwd, '.git'))) {
101
+ console.log(`\n${colors.bold('Git hooks:')}`);
102
+ const hooksDir = join(cwd, '.git', 'hooks');
103
+ mkdirSync(hooksDir, { recursive: true });
104
+
105
+ const hooksCopied = copyFile(join(cwd, 'hooks', 'pre-commit'), join(hooksDir, 'pre-commit'), 'pre-commit');
106
+ copyFile(join(cwd, 'hooks', 'commit-msg'), join(hooksDir, 'commit-msg'), 'commit-msg');
107
+
108
+ // Make hooks executable (Unix only)
109
+ if (hooksCopied && process.platform !== 'win32') {
110
+ try {
111
+ chmodSync(join(hooksDir, 'pre-commit'), 0o755);
112
+ chmodSync(join(hooksDir, 'commit-msg'), 0o755);
113
+ } catch (e) {
114
+ // Ignore chmod errors
115
+ }
116
+ }
117
+ }
118
+
119
+ console.log(`\n${colors.green('✓')} ${colors.bold('AutoWorkflow initialized!')}\n`);
120
+
121
+ console.log(`${colors.bold('Next steps:')}`);
122
+ console.log(` 1. Edit ${colors.cyan('instructions/AI_RULES.md')} with your coding standards`);
123
+ console.log(` 2. Open VS Code with Claude Code extension`);
124
+ console.log(` 3. Claude will auto-generate ${colors.cyan('BLUEPRINT.md')} on first task\n`);
125
+
126
+ console.log(`Or run ${colors.cyan('/audit project')} in Claude Code to scan your codebase now.\n`);
127
+ }
128
+
129
+ // Main
130
+ switch (command) {
131
+ case 'init':
132
+ init();
133
+ break;
134
+ case 'help':
135
+ case '--help':
136
+ case '-h':
137
+ case undefined:
138
+ printHelp();
139
+ break;
140
+ default:
141
+ console.log(`${colors.red('Unknown command:')} ${command}`);
142
+ printHelp();
143
+ process.exit(1);
144
+ }
package/package.json CHANGED
@@ -1,8 +1,11 @@
1
1
  {
2
2
  "name": "autoworkflow",
3
- "version": "2.1.0",
3
+ "version": "2.2.0",
4
4
  "description": "System prompt layer that controls Claude Code's workflow with triggers, loops, and gates",
5
5
  "type": "module",
6
+ "bin": {
7
+ "autoworkflow": "./bin/cli.js"
8
+ },
6
9
  "keywords": [
7
10
  "claude",
8
11
  "claude-code",
@@ -17,6 +20,7 @@
17
20
  "url": ""
18
21
  },
19
22
  "files": [
23
+ "bin/",
20
24
  "CLAUDE.md",
21
25
  "system/",
22
26
  "instructions/",