wogiflow 2.2.0 → 2.3.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.
@@ -1,176 +0,0 @@
1
- ---
2
- alwaysApply: true
3
- description: "Security patterns for file operations, JSON parsing, and path handling"
4
- ---
5
-
6
- # Security Patterns
7
-
8
- Critical security patterns for this project.
9
-
10
- ## 1. File Read Safety
11
-
12
- Always wrap `fs.readFileSync()` in try-catch, even after `fileExists()` check.
13
-
14
- **Reason**: Race conditions, permission changes, symlink issues can still cause failures.
15
-
16
- ```javascript
17
- // Good
18
- try {
19
- const content = fs.readFileSync(path, 'utf-8');
20
- } catch (err) {
21
- // Handle gracefully
22
- }
23
-
24
- // Bad - can still throw even if file existed
25
- if (fs.existsSync(path)) {
26
- const content = fs.readFileSync(path, 'utf-8');
27
- }
28
- ```
29
-
30
- ## 2. JSON Parsing Safety
31
-
32
- Use `safeJsonParse()` from flow-utils.js instead of raw `JSON.parse()`.
33
-
34
- - Check for `__proto__`, `constructor`, `prototype` injection
35
- - Validate parsed structure has expected fields before use
36
- - Located in: `scripts/flow-utils.js`
37
-
38
- ```javascript
39
- // Good
40
- const config = safeJsonParse(filePath, {});
41
-
42
- // Bad - vulnerable to prototype pollution
43
- const config = JSON.parse(fs.readFileSync(filePath));
44
- ```
45
-
46
- ## 3. Template Substitution Safety
47
-
48
- When implementing template substitution:
49
- - Block access to `__proto__`, `constructor`, `prototype` keys
50
- - Use `Object.prototype.hasOwnProperty.call()` for property access
51
- - Example: See `applyTemplate()` in flow-prompt-composer.js
52
-
53
- ## 4. Path Safety
54
-
55
- - Validate patterns before `path.join()` with user/config data
56
- - Use `isPathWithinProject()` for defense-in-depth
57
- - Glob-to-regex: Use `[^/]*` not `.*` to prevent path separator matching
58
-
59
- ```javascript
60
- // Good
61
- if (!isPathWithinProject(targetPath)) {
62
- throw new Error('Path outside project');
63
- }
64
-
65
- // Bad - allows path traversal
66
- const fullPath = path.join(baseDir, userInput);
67
- ```
68
-
69
- ## 5. Module Dependencies
70
-
71
- - Check for circular dependencies when refactoring shared functions
72
- - Node.js handles circular deps but can cause undefined exports during load
73
-
74
- ## 6. Claude Code Permission Patterns (2.1.7+)
75
-
76
- When configuring permission rules in Claude Code, avoid overly permissive wildcards.
77
-
78
- **Vulnerability fixed in 2.1.7**: Wildcard permission rules could match compound commands containing shell operators (`;`, `&&`, `||`, `|`).
79
-
80
- **Destructive git commands** must NOT be auto-allowed. WogiFlow's `generateSettings()` scopes these to safe variants:
81
-
82
- ```javascript
83
- // DANGEROUS - auto-allows destructive operations
84
- "allow": "Bash(git reset *)" // matches git reset --hard
85
- "allow": "Bash(git restore *)" // matches git restore . (discard all)
86
- "allow": "Bash(git clean *)" // matches git clean -f
87
-
88
- // SAFE - only non-destructive variants auto-allowed
89
- "allow": "Bash(git reset HEAD *)" // unstage files only
90
- "allow": "Bash(git reset --soft *)" // soft reset, preserves changes
91
- "allow": "Bash(git restore --staged *)" // unstage files only
92
- // git reset --hard, git restore ., git clean -f require manual approval
93
- ```
94
-
95
- **Best practices:**
96
- - Scope destructive commands to safe variants instead of blanket wildcards
97
- - `git reset --hard`, `git restore .`, `git clean -f` should always require user approval
98
- - Prefer semantic permission prompts over literal command matching
99
- - Never allow broad patterns like `rm *` or `git *`
100
- - Review permission rules after Claude Code updates
101
-
102
- ## 7. Windows Path Safety
103
-
104
- On Windows, be aware of path-related issues:
105
-
106
- - Temp directory paths may contain characters like `\t` or `\n` that could be misinterpreted as escape sequences
107
- - Use raw strings or proper escaping when constructing paths
108
- - Cloud sync tools (OneDrive, Dropbox) and antivirus may touch file timestamps without changing content
109
-
110
- ```javascript
111
- // Good - use path.join() which handles platform differences
112
- const tempPath = path.join(os.tmpdir(), 'myfile.txt');
113
-
114
- // Bad - manual concatenation can break on Windows
115
- const tempPath = os.tmpdir() + '/myfile.txt';
116
- ```
117
-
118
- ## 8. Shell Command Parameter Validation
119
-
120
- When executing shell commands with dynamic parameters, always validate inputs.
121
-
122
- **Risk**: Command injection via unvalidated parameters passed to execSync/spawn.
123
-
124
- ```javascript
125
- // DANGEROUS - lang parameter not validated
126
- execSync(`sg --pattern "${pattern}" --lang ${lang} --json "${path}"`);
127
-
128
- // SAFER - validate against whitelist
129
- const ALLOWED_LANGUAGES = new Set(['typescript', 'javascript', 'python', 'go']);
130
- if (!ALLOWED_LANGUAGES.has(lang)) {
131
- throw new Error(`Unsupported language: ${lang}`);
132
- }
133
-
134
- // BEST - use execFile with array arguments (no shell interpretation)
135
- const { execFileSync } = require('child_process');
136
- execFileSync('sg', ['--pattern', pattern, '--lang', lang, '--json', path]);
137
- ```
138
-
139
- **Best practices:**
140
- - Validate all dynamic parameters against allowlists
141
- - Prefer `execFile`/`execFileSync` with array arguments over `exec`/`execSync` with template strings
142
- - When using template strings, escape all user-controlled values
143
- - Never interpolate user input directly into shell commands
144
-
145
- ## 9. Temp Directory Isolation (Claude Code 2.1.23+)
146
-
147
- On shared systems (CI servers, multi-user machines), use per-user temp directories to prevent permission conflicts.
148
-
149
- **Fixed in Claude Code 2.1.23**: Per-user temp directory isolation prevents permission conflicts.
150
-
151
- ```javascript
152
- // Good - per-user isolation
153
- const userId = process.getuid?.() ?? process.env.USER ?? process.env.USERNAME ?? 'default';
154
- const tempDir = path.join(os.tmpdir(), `myapp-${userId}`);
155
-
156
- // Bad - global temp path on shared systems
157
- const tempDir = path.join(os.tmpdir(), 'myapp');
158
- ```
159
-
160
- **Best practices:**
161
- - Use UID on Unix systems (`process.getuid()`)
162
- - Fall back to username environment variables on Windows
163
- - Always provide a 'default' fallback for edge cases
164
- - This pattern is used in `flow-worktree.js` for worktree isolation
165
-
166
- ## 10. Search/Grep Timeout Handling (Claude Code 2.1.23+)
167
-
168
- **Fixed in Claude Code 2.1.23**: Ripgrep search timeouts now report errors instead of silently returning empty results.
169
-
170
- **Impact on WogiFlow:** Component detection, auto-context loading, and pattern matching rely on search operations. Before 2.1.23, search timeouts could cause false negatives.
171
-
172
- **Best practices:**
173
- - Handle empty search results gracefully - they may indicate timeout
174
- - Add retry logic for search-dependent operations
175
- - Log warnings when searches return unexpectedly empty
176
- - Consider fallback strategies (glob-based search if grep fails)
@@ -1,11 +0,0 @@
1
- # Figma Analyzer Learnings
2
-
3
- Learnings captured from using the Figma Analyzer skill.
4
-
5
- ---
6
-
7
- ## Patterns Learned
8
-
9
- <!-- Learnings will be captured automatically during skill usage -->
10
-
11
- ---
@@ -1,24 +0,0 @@
1
- # Architecture
2
-
3
- ## Pattern
4
-
5
- <!-- Detected during onboarding -->
6
- <!-- Examples: MVC, Clean Architecture, DDD, Microservices, Monolith -->
7
-
8
- ## Structure
9
-
10
- <!-- Project structure overview -->
11
- <!-- Key directories and their purposes -->
12
-
13
- ## Key Decisions
14
-
15
- <!-- Architecture decisions made for this project -->
16
- <!-- Trade-offs and rationale -->
17
-
18
- ## Dependencies
19
-
20
- <!-- Major dependencies and their purposes -->
21
-
22
- ---
23
-
24
- *This file is auto-populated during `flow onboard`. Update manually as architecture evolves.*
@@ -1,33 +0,0 @@
1
- # Tech Stack
2
-
3
- ## Framework
4
-
5
- <!-- Primary framework (e.g., Next.js, NestJS, FastAPI) -->
6
-
7
- ## Language
8
-
9
- <!-- Primary language (e.g., TypeScript, Python, Go) -->
10
-
11
- ## Database
12
-
13
- <!-- Database system if applicable (e.g., PostgreSQL, MongoDB) -->
14
-
15
- ## Package Manager
16
-
17
- <!-- npm, yarn, pnpm, pip, etc. -->
18
-
19
- ## Build Tools
20
-
21
- <!-- Build and bundling tools (e.g., Vite, Webpack, esbuild) -->
22
-
23
- ## Testing
24
-
25
- <!-- Test frameworks (e.g., Jest, Vitest, pytest) -->
26
-
27
- ## Other Tools
28
-
29
- <!-- Linters, formatters, CI/CD tools -->
30
-
31
- ---
32
-
33
- *This file is auto-populated during `flow onboard`. Update manually as stack evolves.*
@@ -1,36 +0,0 @@
1
- # Testing
2
-
3
- ## Test Framework
4
-
5
- <!-- Primary test framework (e.g., Jest, Vitest, pytest) -->
6
-
7
- ## Test Commands
8
-
9
- ```bash
10
- # Run all tests
11
- npm test
12
-
13
- # Run tests in watch mode
14
- npm run test:watch
15
-
16
- # Run specific test file
17
- npm test -- path/to/test.ts
18
- ```
19
-
20
- ## Test Structure
21
-
22
- <!-- Where tests are located -->
23
- <!-- Naming conventions -->
24
-
25
- ## Coverage
26
-
27
- <!-- Coverage requirements if any -->
28
- <!-- Coverage commands -->
29
-
30
- ## E2E Testing
31
-
32
- <!-- E2E framework if used (e.g., Playwright, Cypress) -->
33
-
34
- ---
35
-
36
- *This file is auto-populated during `flow onboard`. Update manually as testing strategy evolves.*