@sylphx/flow 1.8.2 → 2.1.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.
Files changed (37) hide show
  1. package/CHANGELOG.md +159 -0
  2. package/UPGRADE.md +151 -0
  3. package/package.json +11 -6
  4. package/src/commands/flow/execute-v2.ts +372 -0
  5. package/src/commands/flow/execute.ts +1 -18
  6. package/src/commands/flow/types.ts +3 -2
  7. package/src/commands/flow-command.ts +32 -69
  8. package/src/commands/flow-orchestrator.ts +18 -55
  9. package/src/commands/run-command.ts +12 -6
  10. package/src/commands/settings-command.ts +536 -0
  11. package/src/config/ai-config.ts +2 -69
  12. package/src/config/targets.ts +0 -11
  13. package/src/core/attach-manager.ts +495 -0
  14. package/src/core/backup-manager.ts +308 -0
  15. package/src/core/cleanup-handler.ts +166 -0
  16. package/src/core/flow-executor.ts +323 -0
  17. package/src/core/git-stash-manager.ts +133 -0
  18. package/src/core/installers/file-installer.ts +0 -57
  19. package/src/core/installers/mcp-installer.ts +0 -33
  20. package/src/core/project-manager.ts +274 -0
  21. package/src/core/secrets-manager.ts +229 -0
  22. package/src/core/session-manager.ts +268 -0
  23. package/src/core/template-loader.ts +189 -0
  24. package/src/core/upgrade-manager.ts +79 -47
  25. package/src/index.ts +15 -29
  26. package/src/services/auto-upgrade.ts +248 -0
  27. package/src/services/first-run-setup.ts +220 -0
  28. package/src/services/global-config.ts +337 -0
  29. package/src/services/target-installer.ts +254 -0
  30. package/src/targets/claude-code.ts +5 -7
  31. package/src/targets/opencode.ts +6 -26
  32. package/src/utils/__tests__/package-manager-detector.test.ts +163 -0
  33. package/src/utils/agent-enhancer.ts +40 -22
  34. package/src/utils/errors.ts +9 -0
  35. package/src/utils/package-manager-detector.ts +139 -0
  36. package/src/utils/prompt-helpers.ts +48 -0
  37. package/src/utils/target-selection.ts +169 -0
package/CHANGELOG.md CHANGED
@@ -1,5 +1,164 @@
1
1
  # @sylphx/flow
2
2
 
3
+ ## 2.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 09608be: Auto-installation and auto-upgrade features
8
+
9
+ **New Features:**
10
+
11
+ - **Auto-detection**: Automatically detects installed AI CLIs (Claude Code, OpenCode, Cursor)
12
+ - **Auto-installation**: If no AI CLI is detected, prompts user to select and installs it automatically
13
+ - **Auto-upgrade**: Before each Flow execution, automatically checks and upgrades Flow and target CLI to latest versions
14
+ - **Zero-friction setup**: New users can install Flow and start using it immediately without manual setup
15
+
16
+ **Implementation:**
17
+
18
+ - Created `TargetInstaller` service for detecting and installing AI CLI tools
19
+ - Created `AutoUpgrade` service for automatic version checking and upgrading
20
+ - Integrated both services into execution flow (`execute-v2.ts`)
21
+ - Smart package manager detection (npm, bun, pnpm, yarn)
22
+
23
+ **User Experience:**
24
+
25
+ Flow 2.0 now delivers on the promise of "One CLI to rule them all":
26
+
27
+ 1. **First run**: User installs Flow → Flow detects no AI CLI → Prompts to select one → Installs it automatically
28
+ 2. **Every run**: Flow checks for updates → Upgrades Flow and AI CLI to latest → Runs user's task
29
+
30
+ Example flow:
31
+
32
+ ```
33
+ $ npm install -g @sylphx/flow
34
+ $ sylphx-flow "build my app"
35
+
36
+ 🔍 Detecting installed AI CLIs...
37
+ ⚠️ No AI CLI detected
38
+
39
+ ? No AI CLI detected. Which would you like to use?
40
+ ❯ Claude Code
41
+ OpenCode
42
+ Cursor
43
+
44
+ ✓ Claude Code installed successfully
45
+
46
+ 🔄 Checking for updates...
47
+ ✓ Flow is up to date
48
+ ✓ Claude Code is up to date
49
+
50
+ 🚀 Starting Flow session...
51
+ ```
52
+
53
+ **Philosophy:**
54
+
55
+ This implements Flow's core principle of "Transcendent Simplicity" - users don't need to know which AI CLI to use or how to install/upgrade it. Flow handles everything automatically.
56
+
57
+ ### Patch Changes
58
+
59
+ - cc065f2: Code cleanup and refactoring
60
+
61
+ **Removed:**
62
+
63
+ - All legacy config migration code (~70 lines)
64
+ - OpenCode old directory cleanup logic (~16 lines)
65
+ - Deprecated FileInstaller and MCPInstaller classes (~60 lines)
66
+ - Unused deprecated exports (ALL_TARGETS, IMPLEMENTED_TARGETS)
67
+
68
+ **Refactored:**
69
+
70
+ - Migrated from class-based installers to functional API
71
+ - opencode.ts: Direct function calls instead of class wrappers
72
+ - claude-code.ts: Direct function calls instead of class wrappers
73
+
74
+ **Improved:**
75
+
76
+ - Removed ~179 lines of dead code
77
+ - Cleaner functional API
78
+ - Better code organization and modularity
79
+ - Comprehensive JSDoc documentation
80
+ - Consistent error handling patterns
81
+
82
+ **Result:**
83
+
84
+ - Zero technical debt
85
+ - Zero deprecated code
86
+ - Modern, maintainable codebase
87
+
88
+ - edb043c: Fix target selection logic to properly distinguish between three cases
89
+
90
+ **Fixed:**
91
+
92
+ - Target selection now correctly handles three distinct scenarios:
93
+ 1. User explicitly set "ask-every-time" → always prompt
94
+ 2. User has no setting (undefined/null) → allow auto-detect
95
+ 3. User has specific target → use that target
96
+
97
+ **Improved:**
98
+
99
+ - Better code clarity with explicit case handling
100
+ - More predictable behavior for different user preferences
101
+ - Enhanced logic comments for maintainability
102
+
103
+ ## 2.0.0
104
+
105
+ ### Major Changes
106
+
107
+ - aaadcaa: Settings-based configuration and improved user experience
108
+
109
+ **New Features:**
110
+
111
+ - **Settings management**: Configure agents, rules, and output styles via `sylphx-flow settings`
112
+ - Select which agents are enabled
113
+ - Set default agent to use
114
+ - Enable/disable specific rules (core, code-standards, workspace)
115
+ - Enable/disable output styles (silent)
116
+ - **Settings-driven execution**: Flow respects your settings and only loads enabled components
117
+ - **Config files**: All settings stored in `~/.sylphx-flow/` (settings.json, flow-config.json, provider-config.json, mcp-config.json)
118
+ - **Git skip-worktree integration**: Flow automatically hides `.claude/` and `.opencode/` changes from git
119
+ - Uses `git update-index --skip-worktree` to hide Flow's temporary modifications
120
+ - Prevents LLM from seeing or committing Flow's settings changes
121
+ - Automatically restores git tracking after execution
122
+ - Works seamlessly with version-controlled settings
123
+
124
+ **Breaking Changes:**
125
+
126
+ - Removed `--quick` flag - no longer needed
127
+ - Removed first-run setup wizard - configs are created automatically with sensible defaults
128
+ - Agent loading now respects enabled rules and output styles from settings
129
+
130
+ **Improvements:**
131
+
132
+ - Config files are automatically initialized on first use with default values
133
+ - Provider selection happens inline when needed (if set to "ask-every-time")
134
+ - Fixed Ctrl+C handling to ensure settings are restored immediately
135
+ - Simplified CLI options - only `--merge` flag for attach strategy
136
+ - Default agent can be set in settings (falls back to 'coder' if not set)
137
+
138
+ **Ctrl+C Fix:**
139
+ When users press Ctrl+C during interactive prompts, the application now:
140
+
141
+ - Catches the cancellation gracefully
142
+ - Runs cleanup (restores backed-up settings)
143
+ - Shows a friendly cancellation message
144
+ - Exits cleanly
145
+
146
+ Previously, pressing Ctrl+C would exit immediately without restoring settings, requiring recovery on the next run.
147
+
148
+ ### Minor Changes
149
+
150
+ - 9fa65d4: Add automatic upgrade detection with smart package manager support
151
+
152
+ - Auto-detect updates on startup with non-intrusive notifications
153
+ - Enhanced `upgrade` command with `--auto` flag for automatic installation
154
+ - Smart package manager detection (npm, bun, pnpm, yarn)
155
+ - Version checking against npm registry for both Flow and target platforms
156
+ - Package-manager-specific upgrade commands in notifications
157
+ - New UPGRADE.md documentation with package manager support
158
+ - Silent background checks that don't block execution
159
+ - Support for both interactive and automatic upgrade flows
160
+ - Comprehensive test coverage for package manager detection
161
+
3
162
  ## 1.8.2
4
163
 
5
164
  ### Patch Changes
package/UPGRADE.md ADDED
@@ -0,0 +1,151 @@
1
+ # Upgrade Guide
2
+
3
+ Flow 2.0 includes **automatic upgrade before every session** with smart package manager detection. No more manual version management—Flow keeps itself and your AI CLI tools up to date.
4
+
5
+ ## Auto-Upgrade on Every Execution
6
+
7
+ **Before each Flow session**, Flow automatically:
8
+
9
+ 1. **Checks for Flow updates**: Compares installed version with npm registry
10
+ 2. **Checks for AI CLI updates**: Verifies Claude Code, OpenCode, or Cursor versions
11
+ 3. **Upgrades automatically**: Installs latest versions if available
12
+ 4. **Detects package manager**: Uses npm, bun, pnpm, or yarn based on your environment
13
+
14
+ Example output:
15
+ ```
16
+ 🔄 Checking for updates...
17
+ ✓ Flow 2.0.0 → 2.1.0 (latest)
18
+ ✓ Claude Code 1.5.0 → 1.6.0 (latest)
19
+ 📦 Installing updates...
20
+ ✓ All tools upgraded
21
+
22
+ 🚀 Starting Flow session...
23
+ ```
24
+
25
+ This happens automatically. No flags needed, no configuration required.
26
+
27
+ ## Manual Upgrade Check
28
+
29
+ Check for available updates without installing:
30
+
31
+ ```bash
32
+ sylphx-flow upgrade --check
33
+ ```
34
+
35
+ ## Upgrade Commands
36
+
37
+ ### Upgrade Sylphx Flow
38
+
39
+ Upgrade to the latest version:
40
+
41
+ ```bash
42
+ # Interactive upgrade (manual installation required)
43
+ sylphx-flow upgrade
44
+
45
+ # Automatic installation via npm
46
+ sylphx-flow upgrade --auto
47
+ ```
48
+
49
+ ### Upgrade Target Platform
50
+
51
+ Upgrade Claude Code or other target platforms:
52
+
53
+ ```bash
54
+ # Interactive upgrade
55
+ sylphx-flow upgrade --target
56
+
57
+ # Automatic installation via npm
58
+ sylphx-flow upgrade --target --auto
59
+ ```
60
+
61
+ ### Combined Upgrade
62
+
63
+ Upgrade both Sylphx Flow and target platform:
64
+
65
+ ```bash
66
+ sylphx-flow upgrade --target --auto
67
+ ```
68
+
69
+ ## Options
70
+
71
+ - `--check` - Only check for updates, don't install
72
+ - `--auto` - Automatically install updates via npm (no manual steps)
73
+ - `--target` - Include target platform (Claude Code/OpenCode) upgrade
74
+ - `--verbose` - Show detailed installation output
75
+
76
+ ## Package Manager Detection
77
+
78
+ Sylphx Flow automatically detects which package manager you're using:
79
+
80
+ 1. **From Environment** (`npm_config_user_agent`): Most reliable when running as npm script
81
+ 2. **From Lock Files**: Checks for `bun.lock`, `pnpm-lock.yaml`, `yarn.lock`, or `package-lock.json`
82
+ 3. **Default**: Falls back to `npm` if no detection method works
83
+
84
+ **Priority Order**: bun > pnpm > yarn > npm
85
+
86
+ ### Supported Package Managers
87
+
88
+ | Package Manager | Global Install Command |
89
+ |----------------|------------------------|
90
+ | npm | `npm install -g @sylphx/flow@latest` |
91
+ | bun | `bun install -g @sylphx/flow@latest` |
92
+ | pnpm | `pnpm install -g @sylphx/flow@latest` |
93
+ | yarn | `yarn global add @sylphx/flow@latest` |
94
+
95
+ ## How It Works
96
+
97
+ 1. **Version Detection**: Checks npm registry for latest published versions
98
+ 2. **Comparison**: Compares installed version with latest available
99
+ 3. **Package Manager Detection**: Automatically detects npm/bun/pnpm/yarn
100
+ 4. **Notification**: Shows update availability with package-manager-specific command
101
+ 5. **Installation**:
102
+ - Without `--auto`: Shows manual install command for your package manager
103
+ - With `--auto`: Runs the appropriate install command automatically
104
+
105
+ ## Philosophy: Always Latest
106
+
107
+ Flow 2.0 embraces the principle of **always running the latest stable versions**. This ensures:
108
+
109
+ - Latest features and improvements
110
+ - Security patches applied immediately
111
+ - Compatibility with newest AI models
112
+ - Bug fixes without manual intervention
113
+
114
+ Auto-upgrade cannot be disabled—it's core to Flow's philosophy of zero-friction excellence.
115
+
116
+ ## Troubleshooting
117
+
118
+ ### Auto-Install Fails
119
+
120
+ If `--auto` installation fails, the error message will show the exact command to run manually. The command is tailored to your package manager:
121
+
122
+ ```bash
123
+ # Example for bun users
124
+ bun install -g @sylphx/flow@latest
125
+
126
+ # Example for npm users
127
+ npm install -g @sylphx/flow@latest
128
+ ```
129
+
130
+ ### Version Mismatch
131
+
132
+ If you see version mismatches after upgrade, try:
133
+
134
+ ```bash
135
+ # Re-sync components with latest templates
136
+ sylphx-flow --sync
137
+ ```
138
+
139
+ ### Offline Mode
140
+
141
+ Update checks require internet connection. If offline, checks will fail silently and won't block execution.
142
+
143
+ ## Version Compatibility
144
+
145
+ Sylphx Flow follows semantic versioning:
146
+
147
+ - **Patch** (1.8.x): Bug fixes, safe to upgrade
148
+ - **Minor** (1.x.0): New features, backward compatible
149
+ - **Major** (x.0.0): Breaking changes, check migration guide
150
+
151
+ Always check CHANGELOG.md for breaking changes before upgrading major versions.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sylphx/flow",
3
- "version": "1.8.2",
4
- "description": "AI-powered development workflow automation with autonomous loop mode and smart configuration",
3
+ "version": "2.1.0",
4
+ "description": "One CLI to rule them all. Unified orchestration layer for Claude Code, OpenCode, Cursor and all AI development tools. Auto-detection, auto-installation, auto-upgrade.",
5
5
  "type": "module",
6
6
  "bin": {
7
7
  "sylphx-flow": "./src/index.ts"
@@ -43,18 +43,23 @@
43
43
  "README.md",
44
44
  "CHANGELOG.md",
45
45
  "LOOP_MODE.md",
46
+ "UPGRADE.md",
46
47
  "package.json"
47
48
  ],
48
49
  "keywords": [
49
50
  "ai",
50
51
  "automation",
51
52
  "workflow",
52
- "claude",
53
+ "claude-code",
53
54
  "opencode",
55
+ "cursor",
54
56
  "cli",
55
- "autonomous",
56
- "loop-mode",
57
- "developer-tools"
57
+ "orchestration",
58
+ "unified",
59
+ "meta-layer",
60
+ "developer-tools",
61
+ "auto-install",
62
+ "auto-upgrade"
58
63
  ],
59
64
  "repository": {
60
65
  "type": "git",