autoworkflow 2.2.0 → 2.2.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/.claude/settings.local.json +2 -1
- package/bin/cli.js +39 -8
- package/package.json +2 -2
package/bin/cli.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
-
import { existsSync, cpSync, mkdirSync, chmodSync } from 'fs';
|
|
3
|
+
import { existsSync, cpSync, mkdirSync, chmodSync, renameSync } from 'fs';
|
|
4
4
|
import { dirname, join } from 'path';
|
|
5
5
|
import { fileURLToPath } from 'url';
|
|
6
6
|
|
|
@@ -17,6 +17,7 @@ const colors = {
|
|
|
17
17
|
red: (text) => `\x1b[31m${text}\x1b[0m`,
|
|
18
18
|
cyan: (text) => `\x1b[36m${text}\x1b[0m`,
|
|
19
19
|
bold: (text) => `\x1b[1m${text}\x1b[0m`,
|
|
20
|
+
dim: (text) => `\x1b[2m${text}\x1b[0m`,
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
function printHelp() {
|
|
@@ -31,14 +32,44 @@ Commands:
|
|
|
31
32
|
init --minimal Required files only
|
|
32
33
|
help Show this help message
|
|
33
34
|
|
|
35
|
+
Options:
|
|
36
|
+
--no-backup Overwrite existing files without backup
|
|
37
|
+
|
|
34
38
|
Examples:
|
|
35
39
|
npx autoworkflow init
|
|
36
40
|
npx autoworkflow init --all
|
|
37
41
|
`);
|
|
38
42
|
}
|
|
39
43
|
|
|
40
|
-
function
|
|
44
|
+
function backupFile(dest, name) {
|
|
45
|
+
if (existsSync(dest)) {
|
|
46
|
+
const backupPath = `${dest}.backup`;
|
|
47
|
+
// If backup already exists, add timestamp
|
|
48
|
+
const finalBackupPath = existsSync(backupPath)
|
|
49
|
+
? `${dest}.backup.${Date.now()}`
|
|
50
|
+
: backupPath;
|
|
51
|
+
try {
|
|
52
|
+
renameSync(dest, finalBackupPath);
|
|
53
|
+
console.log(` ${colors.yellow('↪')} ${name} ${colors.dim(`→ backed up to ${finalBackupPath.split('/').pop()}`)}`);
|
|
54
|
+
return true;
|
|
55
|
+
} catch (err) {
|
|
56
|
+
console.log(` ${colors.red('✗')} Failed to backup ${name}: ${err.message}`);
|
|
57
|
+
return false;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return true; // No backup needed
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
function copyFile(src, dest, name, options = {}) {
|
|
64
|
+
const noBackup = args.includes('--no-backup');
|
|
65
|
+
|
|
41
66
|
if (existsSync(src)) {
|
|
67
|
+
// Backup existing file/folder if it exists
|
|
68
|
+
if (!noBackup && existsSync(dest)) {
|
|
69
|
+
const backed = backupFile(dest, name);
|
|
70
|
+
if (!backed) return false;
|
|
71
|
+
}
|
|
72
|
+
|
|
42
73
|
try {
|
|
43
74
|
cpSync(src, dest, { recursive: true });
|
|
44
75
|
console.log(` ${colors.green('✓')} ${name}`);
|
|
@@ -57,14 +88,14 @@ function init(options = {}) {
|
|
|
57
88
|
const cwd = process.cwd();
|
|
58
89
|
const all = options.all || args.includes('--all');
|
|
59
90
|
const minimal = options.minimal || args.includes('--minimal');
|
|
91
|
+
const noBackup = args.includes('--no-backup');
|
|
60
92
|
|
|
61
93
|
console.log(`\n${colors.bold('AutoWorkflow Setup')}\n`);
|
|
62
|
-
console.log(`Installing to: ${colors.cyan(cwd)}
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
console.log(`${colors.yellow('⚠')}
|
|
67
|
-
console.log(` Use --force to overwrite (not implemented yet)\n`);
|
|
94
|
+
console.log(`Installing to: ${colors.cyan(cwd)}`);
|
|
95
|
+
if (!noBackup) {
|
|
96
|
+
console.log(`${colors.dim('Existing files will be backed up with .backup suffix')}\n`);
|
|
97
|
+
} else {
|
|
98
|
+
console.log(`${colors.yellow('⚠')} ${colors.dim('--no-backup: Existing files will be overwritten')}\n`);
|
|
68
99
|
}
|
|
69
100
|
|
|
70
101
|
// Required files
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "autoworkflow",
|
|
3
|
-
"version": "2.2.
|
|
3
|
+
"version": "2.2.2",
|
|
4
4
|
"description": "System prompt layer that controls Claude Code's workflow with triggers, loops, and gates",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
7
|
-
"autoworkflow": "
|
|
7
|
+
"autoworkflow": "bin/cli.js"
|
|
8
8
|
},
|
|
9
9
|
"keywords": [
|
|
10
10
|
"claude",
|