@sylphx/flow 1.4.5 → 1.4.7

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.
@@ -0,0 +1,88 @@
1
+ ---
2
+ name: polish
3
+ description: Polish project presentation - docs, README, packaging, metadata
4
+ agent: writer
5
+ ---
6
+
7
+ # Polish Project
8
+
9
+ Make project professional, welcoming, and well-documented.
10
+
11
+ ## Scope
12
+
13
+ **README:**
14
+ - Clear project description (what, why, how)
15
+ - Installation instructions (tested)
16
+ - Quick start example (copy-paste ready)
17
+ - Key features (3-5 bullet points)
18
+ - API overview
19
+ - Links to full docs
20
+ - Badges (build status, coverage, version, license)
21
+ - Contributing guidelines link
22
+ - License
23
+
24
+ **Documentation:**
25
+ - API reference (all public functions)
26
+ - Usage examples (common scenarios)
27
+ - Tutorials (step-by-step guides)
28
+ - Architecture overview
29
+ - Troubleshooting guide
30
+ - FAQ
31
+ - Migration guides (if applicable)
32
+
33
+ **Code Comments:**
34
+ - JSDoc for public APIs
35
+ - Complex logic explained (WHY not WHAT)
36
+ - Non-obvious decisions documented
37
+ - Examples in comments where helpful
38
+
39
+ **Packaging (package.json):**
40
+ - Accurate description
41
+ - Relevant keywords (10-15)
42
+ - Repository URL
43
+ - Homepage URL
44
+ - Bug tracker URL
45
+ - Author info
46
+ - License
47
+ - Engines specified
48
+ - Files field (only ship necessary)
49
+
50
+ **GitHub Metadata:**
51
+ - Topics/tags (10-20 relevant tags)
52
+ - Description (concise, searchable)
53
+ - Website URL
54
+ - Social preview image (if applicable)
55
+
56
+ **Changelog:**
57
+ - Update CHANGELOG.md
58
+ - Clear version history
59
+ - Breaking changes highlighted
60
+ - Migration instructions
61
+
62
+ **Contributing:**
63
+ - CONTRIBUTING.md
64
+ - Code of conduct
65
+ - Development setup
66
+ - Testing guidelines
67
+ - PR process
68
+
69
+ ## Execution
70
+
71
+ 1. **Audit** what exists vs what's missing
72
+ 2. **Update** outdated content
73
+ 3. **Create** missing documentation
74
+ 4. **Test** all code examples
75
+ 5. **Verify** all links work
76
+ 6. **Ensure** consistency across docs
77
+
78
+ ## Quality Checks
79
+
80
+ - [ ] README explains project in <5 min read
81
+ - [ ] New user can get started in <10 min
82
+ - [ ] All examples tested and work
83
+ - [ ] No broken links
84
+ - [ ] Search-friendly keywords
85
+ - [ ] Professional presentation
86
+ - [ ] Beginner-friendly
87
+
88
+ Report: What was added/updated, coverage improved.
@@ -0,0 +1,182 @@
1
+ ---
2
+ name: quality
3
+ description: Improve test coverage, fix tests, optimize performance, reduce bundle size
4
+ agent: coder
5
+ ---
6
+
7
+ # Quality Assurance
8
+
9
+ Maximize quality metrics: tests, coverage, performance, bundle size.
10
+
11
+ ## Scope
12
+
13
+ **Testing:**
14
+ - Fix failing tests
15
+ - Add missing tests (.test.ts for all modules)
16
+ - Improve coverage (critical paths 100%, business logic 80%+)
17
+ - Test edge cases
18
+ - Test error paths
19
+ - Integration tests
20
+ - E2E tests (if applicable)
21
+
22
+ **Benchmarking:**
23
+ - Add benchmarks (.bench.ts for critical functions)
24
+ - Measure performance
25
+ - Identify regressions
26
+ - Optimize slow operations
27
+
28
+ **Performance:**
29
+ - Profile hot paths
30
+ - Optimize algorithms (reduce complexity)
31
+ - Fix memory leaks
32
+ - Reduce allocations
33
+ - Cache expensive operations
34
+ - Lazy load where possible
35
+
36
+ **Bundle Size:**
37
+ - Analyze bundle composition
38
+ - Remove unused dependencies
39
+ - Tree-shake effectively
40
+ - Code split strategically
41
+ - Compress assets
42
+ - Use dynamic imports
43
+
44
+ **Code Quality:**
45
+ - Fix lint errors/warnings
46
+ - Improve type safety (no `any`)
47
+ - Reduce complexity
48
+ - Improve maintainability
49
+ - Follow code standards
50
+
51
+ **Security:**
52
+ - Fix vulnerabilities
53
+ - Update dependencies
54
+ - Validate inputs
55
+ - Sanitize outputs
56
+ - Secure defaults
57
+
58
+ ## Execution
59
+
60
+ ### 1. Test Coverage
61
+
62
+ ```bash
63
+ # Run tests with coverage
64
+ npm run test:coverage
65
+
66
+ # Identify gaps
67
+ # Add tests for uncovered code
68
+ # Focus on critical paths first
69
+ ```
70
+
71
+ **Priority:**
72
+ - Critical business logic (100%)
73
+ - Error handling (100%)
74
+ - Edge cases (90%)
75
+ - Happy paths (100%)
76
+ - Integration points (80%)
77
+
78
+ ### 2. Benchmarking
79
+
80
+ ```bash
81
+ # Run benchmarks
82
+ npm run bench
83
+
84
+ # Compare against baseline
85
+ # Identify regressions
86
+ # Optimize bottlenecks
87
+ ```
88
+
89
+ **Add benchmarks for:**
90
+ - Algorithm complexity (O(n) vs O(n²))
91
+ - Database queries
92
+ - API calls
93
+ - Data processing
94
+ - Rendering (if UI)
95
+
96
+ ### 3. Performance Profiling
97
+
98
+ ```bash
99
+ # Profile application
100
+ node --inspect ...
101
+ # Or use Clinic.js, 0x, etc.
102
+
103
+ # Identify bottlenecks
104
+ # Optimize hot paths
105
+ # Measure improvements
106
+ ```
107
+
108
+ **Check:**
109
+ - CPU usage
110
+ - Memory usage
111
+ - I/O operations
112
+ - Network calls
113
+ - Rendering time
114
+
115
+ ### 4. Bundle Analysis
116
+
117
+ ```bash
118
+ # Analyze bundle
119
+ npm run build -- --analyze
120
+
121
+ # Check size
122
+ ls -lh dist/
123
+
124
+ # Identify large dependencies
125
+ # Remove unnecessary code
126
+ ```
127
+
128
+ **Optimize:**
129
+ - Remove unused dependencies
130
+ - Use smaller alternatives
131
+ - Dynamic imports for large modules
132
+ - Tree-shake effectively
133
+ - Minify properly
134
+
135
+ ### 5. Quality Metrics
136
+
137
+ **Track:**
138
+ - Test coverage: `npm run test:coverage`
139
+ - Bundle size: `ls -lh dist/`
140
+ - Performance: `npm run bench`
141
+ - Security: `npm audit`
142
+ - Type coverage: TypeScript strict mode
143
+ - Lint score: `npm run lint`
144
+
145
+ ## Targets
146
+
147
+ **Tests:**
148
+ - Coverage: ≥80% (business logic ≥90%)
149
+ - All critical paths: 100%
150
+ - Build time: <30s
151
+ - Test time: <10s
152
+
153
+ **Performance:**
154
+ - Page load: <3s
155
+ - API response: <200ms
156
+ - Time to interactive: <5s
157
+ - Bundle size: <100KB (gzipped)
158
+
159
+ **Quality:**
160
+ - Zero lint errors
161
+ - Zero `any` types (unless justified)
162
+ - Zero security vulnerabilities (high/critical)
163
+ - Complexity score: <10 per function
164
+
165
+ ## Commit Strategy
166
+
167
+ Atomic commits per improvement:
168
+ - `test(auth): add tests for token validation`
169
+ - `perf(db): optimize user query with batch loading`
170
+ - `build: reduce bundle size by 40% with code splitting`
171
+
172
+ ## Exit Criteria
173
+
174
+ - [ ] All tests pass
175
+ - [ ] Coverage meets targets
176
+ - [ ] Benchmarks added for critical functions
177
+ - [ ] Performance optimized
178
+ - [ ] Bundle size reduced
179
+ - [ ] No security vulnerabilities
180
+ - [ ] Quality metrics improved
181
+
182
+ Report: Coverage %, bundle size reduction, performance gains, benchmarks added.
@@ -0,0 +1,104 @@
1
+ ---
2
+ name: release
3
+ description: Publish new version and monitor release process
4
+ agent: coder
5
+ ---
6
+
7
+ # Release & Publish
8
+
9
+ Prepare, publish, and monitor package release.
10
+
11
+ ## Pre-Release Checks
12
+
13
+ **Quality Gates:**
14
+ - [ ] All tests pass
15
+ - [ ] No lint errors
16
+ - [ ] Build successful
17
+ - [ ] No security vulnerabilities
18
+ - [ ] Dependencies up to date
19
+ - [ ] CHANGELOG updated
20
+ - [ ] README accurate
21
+ - [ ] Breaking changes documented
22
+
23
+ **Version Decision:**
24
+ - Breaking changes → `major`
25
+ - New features → `minor` (default)
26
+ - Bug fixes → `patch`
27
+
28
+ ## Release Process
29
+
30
+ ### For TypeScript/JavaScript Projects
31
+
32
+ 1. **Create Changeset:**
33
+ ```bash
34
+ bunx changeset
35
+ ```
36
+ - Select package
37
+ - Choose version bump type
38
+ - Write clear summary
39
+
40
+ 2. **Version Bump:**
41
+ ```bash
42
+ bunx changeset version
43
+ ```
44
+ - Updates package.json
45
+ - Updates CHANGELOG.md
46
+ - Consumes changeset
47
+
48
+ 3. **Commit & Push:**
49
+ ```bash
50
+ git add -A
51
+ git commit -m "chore(release): <package>@<version>"
52
+ git push
53
+ ```
54
+
55
+ 4. **Monitor CI:**
56
+ ```bash
57
+ gh run list --workflow=release --limit 5
58
+ gh run watch <run-id>
59
+ ```
60
+
61
+ 5. **Verify Publication:**
62
+ ```bash
63
+ npm view <package>@<version>
64
+ ```
65
+
66
+ ### For Other Projects
67
+
68
+ 1. Update version in manifest (package.json, setup.py, etc.)
69
+ 2. Update CHANGELOG
70
+ 3. Create git tag
71
+ 4. Push tag to trigger release
72
+ 5. Monitor CI/CD
73
+
74
+ ## Post-Release
75
+
76
+ - [ ] Verify package published
77
+ - [ ] Test installation: `npm install <package>@latest`
78
+ - [ ] Create GitHub release with notes
79
+ - [ ] Announce (if public package)
80
+ - [ ] Close related issues/PRs
81
+
82
+ ## Troubleshooting
83
+
84
+ **CI fails on install:**
85
+ - Update lockfile locally: `bun install`
86
+ - Commit and push
87
+
88
+ **Tests fail in CI:**
89
+ - Run tests locally: `npm test`
90
+ - Fix issues, commit, push
91
+
92
+ **Build fails:**
93
+ - Check build locally: `npm run build`
94
+ - Fix errors, commit, push
95
+
96
+ ## Exit Criteria
97
+
98
+ - [ ] Package published successfully
99
+ - [ ] CI workflow completed
100
+ - [ ] GitHub release created
101
+ - [ ] Version verified on registry
102
+ - [ ] Installation tested
103
+
104
+ Report: Version number, publish time, registry URL.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sylphx/flow",
3
- "version": "1.4.5",
3
+ "version": "1.4.7",
4
4
  "description": "AI-powered development workflow automation with autonomous loop mode and smart configuration",
5
5
  "type": "module",
6
6
  "bin": {
@@ -168,11 +168,6 @@ export async function installComponents(
168
168
  if (target.setupAgents && options.agents !== false) {
169
169
  const agentSpinner = quiet ? null : ora({ text: 'Installing agents', color: 'cyan' }).start();
170
170
  try {
171
- // DEBUG: Log force flag
172
- if (!quiet && options.clear) {
173
- console.log(`[DEBUG] Installing agents with force=${options.clear}`);
174
- }
175
-
176
171
  const agentResult = await target.setupAgents(process.cwd(), { ...options, quiet: true, force: options.clear });
177
172
  result.installed.agents = agentResult.count;
178
173
 
@@ -252,11 +247,6 @@ export async function installComponents(
252
247
  color: 'cyan',
253
248
  }).start();
254
249
  try {
255
- // DEBUG: Log force flag
256
- if (!quiet && options.clear) {
257
- console.log(`[DEBUG] Installing slash commands with force=${options.clear}`);
258
- }
259
-
260
250
  const commandsResult = await target.setupSlashCommands(process.cwd(), { ...options, quiet: true, force: options.clear });
261
251
  result.installed.slashCommands = commandsResult.count;
262
252
 
@@ -124,36 +124,9 @@ export async function installToDirectory(
124
124
  let content = fs.readFileSync(sourcePath, 'utf8');
125
125
  content = await transform(content, file);
126
126
 
127
- // DEBUG: Log installation details (always show in force mode)
128
- if (options.force) {
129
- console.log(
130
- `[DEBUG] Installing ${file} - force=${options.force}, exists=${!!localInfo}, path=${targetPath}`
131
- );
132
- }
133
-
134
127
  // Force mode: always overwrite without checking
135
128
  if (options.force) {
136
- const contentPreview = content.substring(0, 100).replace(/\n/g, ' ');
137
- console.log(`[DEBUG] Writing content (first 100 chars): ${contentPreview}...`);
138
-
139
129
  fs.writeFileSync(targetPath, content, 'utf8');
140
-
141
- // DEBUG: Verify write and read back
142
- const written = fs.existsSync(targetPath);
143
- if (!written) {
144
- console.warn(`[DEBUG] ⚠ Failed to write: ${targetPath}`);
145
- } else {
146
- const readBack = fs.readFileSync(targetPath, 'utf8');
147
- const readBackPreview = readBack.substring(0, 100).replace(/\n/g, ' ');
148
- console.log(`[DEBUG] Read back (first 100 chars): ${readBackPreview}...`);
149
-
150
- if (readBack !== content) {
151
- console.warn(`[DEBUG] ⚠ Content mismatch! Written ${content.length} bytes, read ${readBack.length} bytes`);
152
- } else {
153
- console.log(`[DEBUG] ✓ Verified write: ${targetPath}`);
154
- }
155
- }
156
-
157
130
  results.push({
158
131
  file,
159
132
  status: localInfo ? 'updated' : 'added',
@@ -388,25 +388,12 @@ export async function executeSyncDelete(
388
388
  // Delete Flow templates
389
389
  for (const file of flowFiles) {
390
390
  try {
391
- const existsBefore = fs.existsSync(file);
392
- if (!existsBefore) {
393
- console.log(chalk.dim(` ⊘ Already deleted: ${path.basename(file)}`));
394
- continue;
395
- }
396
-
397
391
  await fs.promises.unlink(file);
398
-
399
- // Verify deletion
400
- const existsAfter = fs.existsSync(file);
401
- if (existsAfter) {
402
- console.warn(chalk.yellow(` ⚠ File still exists after deletion: ${path.basename(file)}`));
403
- } else {
404
- console.log(chalk.dim(` ✓ Deleted: ${path.basename(file)}`));
405
- templatesDeleted++;
406
- }
392
+ console.log(chalk.dim(` ✓ Deleted: ${path.basename(file)}`));
393
+ templatesDeleted++;
407
394
  } catch (error) {
408
395
  if ((error as NodeJS.ErrnoException).code !== 'ENOENT') {
409
- console.warn(chalk.yellow(` ⚠ Failed to delete: ${path.basename(file)} - ${error}`));
396
+ console.warn(chalk.yellow(` ⚠ Failed to delete: ${path.basename(file)}`));
410
397
  }
411
398
  }
412
399
  }
@@ -1,23 +0,0 @@
1
- ---
2
- description: Create a git commit with meaningful message
3
- ---
4
-
5
- # Create Git Commit
6
-
7
- ## Context
8
-
9
- - Current git status: !`git status`
10
- - Current git diff (staged and unstaged changes): !`git diff HEAD`
11
- - Current branch: !`git branch --show-current`
12
- - Recent commits: !`git log --oneline -10`
13
-
14
- ## Your Task
15
-
16
- Based on the above changes, create a single git commit with a meaningful commit message that:
17
-
18
- 1. Follows conventional commits format: `type(scope): description`
19
- 2. Accurately describes what changed and why
20
- 3. Includes any breaking changes or important notes
21
- 4. Uses present tense ("add" not "added")
22
-
23
- After creating the commit, show the commit message for review.
@@ -1,112 +0,0 @@
1
- ---
2
- description: Display current context window usage and token breakdown
3
- ---
4
-
5
- # Context Window Usage
6
-
7
- Display detailed information about the current context window usage, including token counts for different components.
8
-
9
- ## Your Task
10
-
11
- Analyze and display the context window usage with the following sections:
12
-
13
- ### 1. Model Information
14
- Show the current model being used and its token limits.
15
-
16
- ### 2. Visual Token Usage Bar
17
- Create a visual bar chart (10 blocks wide) showing token usage breakdown using these Unicode characters:
18
- - ⛁ (filled) - Used tokens
19
- - ⛀ (half-filled) - Partially used blocks
20
- - ⛶ (empty) - Reserved/System tokens
21
- - ⛝ (light) - Free space/buffer
22
-
23
- ### 3. Token Breakdown
24
-
25
- Calculate and display tokens for each category:
26
-
27
- #### System Prompt
28
- - Count tokens in the system prompt
29
- - Show: `⛁ System prompt: X.Xk tokens (X.X%)`
30
-
31
- #### System Tools
32
- - Count tokens for all built-in tool definitions (filesystem, shell, search, interaction tools)
33
- - Show: `⛁ System tools: X.Xk tokens (X.X%)`
34
-
35
- #### MCP Tools
36
- - Count tokens for all MCP tool definitions
37
- - List each MCP tool with its token count
38
- - Show: `⛁ MCP tools: X.Xk tokens (X.X%)`
39
-
40
- #### Custom Agents
41
- - Count tokens for custom agent definitions (if any)
42
- - List each agent with token count
43
- - Show: `⛁ Custom agents: X tokens (X.X%)`
44
-
45
- #### Messages
46
- - Count tokens in all messages in the current session
47
- - Show: `⛁ Messages: X tokens (X.X%)`
48
-
49
- #### Free Space
50
- - Calculate remaining available tokens
51
- - Show: `⛶ Free space: XXXk (XX.X%)`
52
-
53
- #### Autocompact Buffer
54
- - Calculate reserved buffer space (typically 22.5% of total)
55
- - Show: `⛝ Autocompact buffer: XX.Xk tokens (XX.X%)`
56
-
57
- ### 4. Detailed Listings
58
-
59
- Show expandable sections with details:
60
-
61
- ```
62
- MCP tools · /mcp
63
- └ mcp__tool_name (server-name): XXX tokens
64
- └ ...
65
-
66
- Custom agents · /agents
67
- └ agent-name (Project): XX tokens
68
- └ ...
69
-
70
- SlashCommand Tool · X commands
71
- └ Total: XXX tokens
72
- ```
73
-
74
- ## Display Format
75
-
76
- Use this exact format for the output:
77
-
78
- ```
79
- Context Usage
80
- ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛁ ⛀ ⛁ ⛁ model-name · XXk/XXXk tokens (XX%)
81
- ⛀ ⛀ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶
82
- ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System prompt: X.Xk tokens (X.X%)
83
- ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ System tools: XX.Xk tokens (X.X%)
84
- ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ MCP tools: X.Xk tokens (X.X%)
85
- ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Custom agents: XX tokens (X.X%)
86
- ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛁ Messages: XXX tokens (X.X%)
87
- ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛶ ⛝ ⛝ ⛝ ⛶ Free space: XXXk (XX.X%)
88
- ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ Autocompact buffer: XX.Xk tokens (XX.X%)
89
- ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝ ⛝
90
-
91
- MCP tools · /mcp
92
- └ tool_name (server-name): XXX tokens
93
- └ ...
94
-
95
- Custom agents · /agents
96
- └ agent-name (Project): XX tokens
97
- └ ...
98
-
99
- SlashCommand Tool · X commands
100
- └ Total: XXX tokens
101
- ```
102
-
103
- ## Implementation Notes
104
-
105
- 1. Use the `countTokens()` utility from `src/utils/token-counter.ts` with the current session model name
106
- 2. Get current session from app store to access model name and messages
107
- 3. Get system prompt from `src/core/ai-sdk.ts` (SYSTEM_PROMPT constant)
108
- 4. Get tool definitions from `src/tools/registry.ts` (getAISDKTools())
109
- 5. Calculate percentages based on the model's max token limit (e.g., 200k for Claude Sonnet 4.5)
110
- 6. Round token counts appropriately (show decimals for k, no decimals for raw numbers)
111
- 7. Ensure the bar chart accurately represents the proportions
112
- 8. Use proper indentation and alignment for readability
@@ -1,35 +0,0 @@
1
- ---
2
- description: Explain code in detail
3
- ---
4
-
5
- # Explain Code
6
-
7
- ## Context
8
-
9
- $ARGUMENTS
10
-
11
- ## Your Task
12
-
13
- Provide a comprehensive explanation of the code above (or at the specified location) that includes:
14
-
15
- 1. **Overview**
16
- - What does this code do?
17
- - What problem does it solve?
18
-
19
- 2. **How It Works**
20
- - Step-by-step breakdown of the logic
21
- - Key algorithms or patterns used
22
- - Important design decisions
23
-
24
- 3. **Components**
25
- - Main functions/classes/modules
26
- - Their roles and responsibilities
27
- - How they interact
28
-
29
- 4. **Important Details**
30
- - Edge cases handled
31
- - Performance considerations
32
- - Security implications
33
- - Dependencies and requirements
34
-
35
- Use clear language and provide examples where helpful.
@@ -1,39 +0,0 @@
1
- ---
2
- description: Review code for quality, security, and best practices
3
- ---
4
-
5
- # Code Review
6
-
7
- ## Context
8
-
9
- $ARGUMENTS
10
-
11
- ## Your Task
12
-
13
- Review the code above (or at the specified location) and provide feedback on:
14
-
15
- 1. **Code Quality**
16
- - Readability and maintainability
17
- - Code organization and structure
18
- - Naming conventions
19
- - Comments and documentation
20
-
21
- 2. **Security**
22
- - Potential vulnerabilities
23
- - Input validation
24
- - Authentication/authorization issues
25
- - Data exposure risks
26
-
27
- 3. **Performance**
28
- - Algorithmic efficiency
29
- - Resource usage
30
- - Potential bottlenecks
31
- - Scalability concerns
32
-
33
- 4. **Best Practices**
34
- - Language-specific idioms
35
- - Design patterns
36
- - Error handling
37
- - Testing coverage
38
-
39
- Provide specific, actionable suggestions for improvement.