@comfanion/workflow 3.4.0 → 3.5.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/bin/cli.js CHANGED
@@ -18,7 +18,7 @@ const program = new Command();
18
18
  program
19
19
  .name('create-opencode-workflow')
20
20
  .description('Initialize OpenCode Workflow system for AI-assisted development')
21
- .version('3.0.0');
21
+ .version('3.5.1');
22
22
 
23
23
  program
24
24
  .command('init')
@@ -29,7 +29,7 @@ program
29
29
  .option('--stub', 'Use STUB methodology')
30
30
  .option('--full', 'Create full repo structure')
31
31
  .action(async (options) => {
32
- console.log(chalk.blue.bold('\nšŸš€ OpenCode Workflow v3.0\n'));
32
+ console.log(chalk.blue.bold('\nšŸš€ OpenCode Workflow v3.5\n'));
33
33
 
34
34
  let config = {
35
35
  user_name: 'Developer',
@@ -108,6 +108,7 @@ program
108
108
  const targetDir = path.join(process.cwd(), '.opencode');
109
109
 
110
110
  // Check if already exists
111
+ let existingConfig = null;
111
112
  if (await fs.pathExists(targetDir)) {
112
113
  spinner.warn(chalk.yellow('.opencode/ already exists'));
113
114
  const { overwrite } = await inquirer.prompt([{
@@ -121,12 +122,24 @@ program
121
122
  console.log(chalk.yellow('\nAborted. Use `update` command to update existing installation.\n'));
122
123
  process.exit(0);
123
124
  }
125
+
126
+ // Create backup and remove old directory
127
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
128
+ const backupDir = path.join(process.cwd(), `.opencode.backup-${timestamp}`);
129
+
130
+ spinner.start('Creating backup...');
131
+ await fs.copy(targetDir, backupDir);
132
+
133
+ spinner.text = 'Removing old .opencode/...';
134
+ await fs.remove(targetDir);
135
+
136
+ console.log(chalk.yellow(`\nšŸ“¦ Backup created: ${chalk.cyan(`.opencode.backup-${timestamp}/`)}`));
124
137
  }
125
138
 
126
139
  spinner.start('Copying OpenCode Workflow files...');
127
140
 
128
- // Copy .opencode structure
129
- await fs.copy(OPENCODE_SRC, targetDir, { overwrite: true });
141
+ // Copy .opencode structure (fresh, no old files)
142
+ await fs.copy(OPENCODE_SRC, targetDir);
130
143
 
131
144
  // Update config.yaml with user values
132
145
  spinner.text = 'Configuring...';
@@ -273,7 +286,8 @@ program
273
286
  program
274
287
  .command('update')
275
288
  .description('Update .opencode/ to latest version (preserves config.yaml)')
276
- .action(async () => {
289
+ .option('--no-backup', 'Skip creating backup')
290
+ .action(async (options) => {
277
291
  const spinner = ora('Updating OpenCode Workflow...').start();
278
292
 
279
293
  try {
@@ -285,18 +299,39 @@ program
285
299
  }
286
300
 
287
301
  const configPath = path.join(targetDir, 'config.yaml');
302
+ const timestamp = new Date().toISOString().replace(/[:.]/g, '-').slice(0, 19);
303
+ const backupDir = path.join(process.cwd(), `.opencode.backup-${timestamp}`);
288
304
 
289
- // Backup config
305
+ // Backup config.yaml content
306
+ spinner.text = 'Reading config.yaml...';
290
307
  const configBackup = await fs.readFile(configPath, 'utf8');
291
308
 
309
+ // Create full backup (unless --no-backup)
310
+ if (options.backup !== false) {
311
+ spinner.text = 'Creating backup...';
312
+ await fs.copy(targetDir, backupDir);
313
+ }
314
+
315
+ // Remove old .opencode directory completely
316
+ spinner.text = 'Removing old files...';
317
+ await fs.remove(targetDir);
318
+
292
319
  // Copy new files
293
- await fs.copy(OPENCODE_SRC, targetDir, { overwrite: true });
320
+ spinner.text = 'Installing new version...';
321
+ await fs.copy(OPENCODE_SRC, targetDir);
294
322
 
295
- // Restore config
323
+ // Restore user's config.yaml
324
+ spinner.text = 'Restoring config.yaml...';
296
325
  await fs.writeFile(configPath, configBackup);
297
326
 
298
327
  spinner.succeed(chalk.green('OpenCode Workflow updated!'));
299
- console.log(chalk.yellow('\nāœ… Your config.yaml was preserved.\n'));
328
+
329
+ if (options.backup !== false) {
330
+ console.log(chalk.yellow(`\nšŸ“¦ Backup created: ${chalk.cyan(`.opencode.backup-${timestamp}/`)}`));
331
+ console.log(chalk.gray(' You can delete it after verifying the update works.\n'));
332
+ }
333
+
334
+ console.log(chalk.green('āœ… Your config.yaml was preserved.\n'));
300
335
 
301
336
  } catch (error) {
302
337
  spinner.fail(chalk.red('Failed to update'));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@comfanion/workflow",
3
- "version": "3.4.0",
3
+ "version": "3.5.1",
4
4
  "description": "Initialize OpenCode Workflow system for AI-assisted development",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": "3.0.0",
3
- "buildDate": "2026-01-23T16:19:12.609Z",
3
+ "buildDate": "2026-01-23T16:26:53.487Z",
4
4
  "files": [
5
5
  "config.yaml",
6
6
  "FLOW.yaml",
@@ -6,7 +6,7 @@
6
6
  # PROJECT CONFIGURATION
7
7
  # =============================================================================
8
8
  project_name: "ai-wf"
9
- version: "3.4.0"
9
+ version: "3.5.1"
10
10
 
11
11
  # =============================================================================
12
12
  # USER CONFIGURATION