@fifine/aim-studio 0.0.4 → 0.0.8

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 (89) hide show
  1. package/README.md +59 -41
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +3 -5
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/commands/update.d.ts.map +1 -1
  6. package/dist/commands/update.js +42 -8
  7. package/dist/commands/update.js.map +1 -1
  8. package/dist/configurators/workflow.d.ts.map +1 -1
  9. package/dist/configurators/workflow.js +4 -104
  10. package/dist/configurators/workflow.js.map +1 -1
  11. package/dist/templates/aim/scripts/export.py +2 -2
  12. package/dist/templates/claude/commands/aim/legitimize.md +268 -0
  13. package/dist/templates/claude/commands/aim/start.md +92 -179
  14. package/dist/templates/claude/commands/aim/story.md +60 -10
  15. package/dist/templates/markdown/index.d.ts +1 -0
  16. package/dist/templates/markdown/index.d.ts.map +1 -1
  17. package/dist/templates/markdown/index.js +1 -0
  18. package/dist/templates/markdown/index.js.map +1 -1
  19. package/dist/templates/markdown/spec/story/style-guide.md.txt +96 -0
  20. package/package.json +1 -1
  21. package/dist/migrations/manifests/0.3.0-rc.2.json +0 -9
  22. package/dist/templates/aim/scripts/multi_agent/__init__.py +0 -5
  23. package/dist/templates/aim/scripts/multi_agent/cleanup.py +0 -403
  24. package/dist/templates/aim/scripts/multi_agent/create_pr.py +0 -329
  25. package/dist/templates/aim/scripts/multi_agent/plan.py +0 -233
  26. package/dist/templates/aim/scripts/multi_agent/start.py +0 -461
  27. package/dist/templates/aim/scripts/multi_agent/status.py +0 -817
  28. package/dist/templates/aim/scripts-shell-archive/add-session.sh +0 -384
  29. package/dist/templates/aim/scripts-shell-archive/common/developer.sh +0 -129
  30. package/dist/templates/aim/scripts-shell-archive/common/git-context.sh +0 -263
  31. package/dist/templates/aim/scripts-shell-archive/common/paths.sh +0 -208
  32. package/dist/templates/aim/scripts-shell-archive/common/phase.sh +0 -150
  33. package/dist/templates/aim/scripts-shell-archive/common/registry.sh +0 -247
  34. package/dist/templates/aim/scripts-shell-archive/common/task-queue.sh +0 -142
  35. package/dist/templates/aim/scripts-shell-archive/common/task-utils.sh +0 -151
  36. package/dist/templates/aim/scripts-shell-archive/common/worktree.sh +0 -128
  37. package/dist/templates/aim/scripts-shell-archive/create-bootstrap.sh +0 -299
  38. package/dist/templates/aim/scripts-shell-archive/get-context.sh +0 -7
  39. package/dist/templates/aim/scripts-shell-archive/get-developer.sh +0 -15
  40. package/dist/templates/aim/scripts-shell-archive/init-developer.sh +0 -34
  41. package/dist/templates/aim/scripts-shell-archive/multi-agent/cleanup.sh +0 -396
  42. package/dist/templates/aim/scripts-shell-archive/multi-agent/create-pr.sh +0 -241
  43. package/dist/templates/aim/scripts-shell-archive/multi-agent/plan.sh +0 -207
  44. package/dist/templates/aim/scripts-shell-archive/multi-agent/start.sh +0 -317
  45. package/dist/templates/aim/scripts-shell-archive/multi-agent/status.sh +0 -828
  46. package/dist/templates/aim/scripts-shell-archive/task.sh +0 -1204
  47. package/dist/templates/claude/agents/check.md +0 -122
  48. package/dist/templates/claude/agents/debug.md +0 -106
  49. package/dist/templates/claude/agents/dispatch.md +0 -230
  50. package/dist/templates/claude/agents/implement.md +0 -96
  51. package/dist/templates/claude/agents/plan.md +0 -396
  52. package/dist/templates/claude/agents/research.md +0 -120
  53. package/dist/templates/claude/commands/aim/before-backend-dev.md +0 -13
  54. package/dist/templates/claude/commands/aim/before-frontend-dev.md +0 -13
  55. package/dist/templates/claude/commands/aim/break-loop.md +0 -153
  56. package/dist/templates/claude/commands/aim/check-backend.md +0 -13
  57. package/dist/templates/claude/commands/aim/check-cross-layer.md +0 -153
  58. package/dist/templates/claude/commands/aim/check-frontend.md +0 -13
  59. package/dist/templates/claude/commands/aim/create-command.md +0 -154
  60. package/dist/templates/claude/commands/aim/integrate-skill.md +0 -219
  61. package/dist/templates/claude/commands/aim/parallel.md +0 -217
  62. package/dist/templates/claude/commands/aim/update-spec.md +0 -285
  63. package/dist/templates/claude/hooks/ralph-loop.py +0 -388
  64. package/dist/templates/markdown/spec/backend/database-guidelines.md.txt +0 -51
  65. package/dist/templates/markdown/spec/backend/directory-structure.md.txt +0 -54
  66. package/dist/templates/markdown/spec/backend/error-handling.md.txt +0 -51
  67. package/dist/templates/markdown/spec/backend/index.md +0 -40
  68. package/dist/templates/markdown/spec/backend/index.md.txt +0 -38
  69. package/dist/templates/markdown/spec/backend/logging-guidelines.md.txt +0 -51
  70. package/dist/templates/markdown/spec/backend/quality-guidelines.md.txt +0 -51
  71. package/dist/templates/markdown/spec/backend/script-conventions.md +0 -467
  72. package/dist/templates/markdown/spec/cli/directory-structure.md.txt +0 -71
  73. package/dist/templates/markdown/spec/cli/error-handling.md.txt +0 -91
  74. package/dist/templates/markdown/spec/cli/index.md.txt +0 -37
  75. package/dist/templates/markdown/spec/cli/options-flags.md.txt +0 -71
  76. package/dist/templates/markdown/spec/cli/output-formatting.md.txt +0 -93
  77. package/dist/templates/markdown/spec/frontend/component-guidelines.md.txt +0 -59
  78. package/dist/templates/markdown/spec/frontend/directory-structure.md.txt +0 -54
  79. package/dist/templates/markdown/spec/frontend/hook-guidelines.md.txt +0 -51
  80. package/dist/templates/markdown/spec/frontend/index.md.txt +0 -39
  81. package/dist/templates/markdown/spec/frontend/quality-guidelines.md.txt +0 -51
  82. package/dist/templates/markdown/spec/frontend/state-management.md.txt +0 -51
  83. package/dist/templates/markdown/spec/frontend/type-safety.md.txt +0 -51
  84. package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md +0 -118
  85. package/dist/templates/markdown/spec/guides/code-reuse-thinking-guide.md.txt +0 -92
  86. package/dist/templates/markdown/spec/guides/cross-layer-thinking-guide.md.txt +0 -94
  87. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md +0 -394
  88. package/dist/templates/markdown/spec/guides/cross-platform-thinking-guide.md.txt +0 -319
  89. package/dist/templates/markdown/spec/guides/index.md.txt +0 -89
@@ -1,319 +0,0 @@
1
- # Cross-Platform Thinking Guide
2
-
3
- > **Purpose**: Catch platform-specific assumptions before they become bugs.
4
-
5
- ---
6
-
7
- ## Why This Matters
8
-
9
- **Most cross-platform bugs come from implicit assumptions**:
10
-
11
- - Assumed shebang works → breaks on Windows
12
- - Assumed `/` path separator → breaks on Windows
13
- - Assumed `\n` line endings → inconsistent behavior
14
- - Assumed command availability → `grep` vs `findstr`
15
-
16
- ---
17
-
18
- ## Platform Differences Checklist
19
-
20
- ### 1. Script Execution
21
-
22
- | Assumption | macOS/Linux | Windows |
23
- |------------|-------------|---------|
24
- | Shebang (`#!/usr/bin/env python3`) | ✅ Works | ❌ Ignored |
25
- | Direct execution (`./script.py`) | ✅ Works | ❌ Fails |
26
- | `python3` command | ✅ Always available | ⚠️ May need `python` |
27
- | `python` command | ⚠️ May be Python 2 | ✅ Usually Python 3 |
28
-
29
- **Rule 1**: Always use explicit `python3` in documentation, help text, and error messages.
30
-
31
- ```python
32
- # BAD - Assumes shebang works
33
- print("Usage: ./script.py <args>")
34
- print("Run: script.py <args>")
35
-
36
- # GOOD - Explicit interpreter
37
- print("Usage: python3 script.py <args>")
38
- print("Run: python3 ./script.py <args>")
39
- ```
40
-
41
- **Rule 2**: When calling Python from TypeScript/Node.js, detect the available command:
42
-
43
- ```typescript
44
- function getPythonCommand(): string {
45
- try {
46
- execSync("python3 --version", { stdio: "pipe" });
47
- return "python3";
48
- } catch {
49
- try {
50
- execSync("python --version", { stdio: "pipe" });
51
- return "python";
52
- } catch {
53
- return "python3"; // Default, will fail with clear error
54
- }
55
- }
56
- }
57
- ```
58
-
59
- **Rule 3**: When calling Python from Python, use `sys.executable`:
60
-
61
- ```python
62
- import sys
63
- import subprocess
64
-
65
- # BAD - Hardcoded command
66
- subprocess.run(["python3", "other_script.py"])
67
-
68
- # GOOD - Use current interpreter
69
- subprocess.run([sys.executable, "other_script.py"])
70
- ```
71
-
72
- ### 2. Path Handling
73
-
74
- | Assumption | macOS/Linux | Windows |
75
- |------------|-------------|---------|
76
- | `/` separator | ✅ Works | ⚠️ Sometimes works |
77
- | `\` separator | ❌ Escape char | ✅ Native |
78
- | `pathlib.Path` | ✅ Works | ✅ Works |
79
-
80
- **Rule**: Use `pathlib.Path` for all path operations.
81
-
82
- ```python
83
- # BAD - String concatenation
84
- path = base + "/" + filename
85
-
86
- # GOOD - pathlib
87
- from pathlib import Path
88
- path = Path(base) / filename
89
- ```
90
-
91
- ### 3. Line Endings
92
-
93
- | Format | macOS/Linux | Windows | Git |
94
- |--------|-------------|---------|-----|
95
- | `\n` (LF) | ✅ Native | ⚠️ Some tools | ✅ Normalized |
96
- | `\r\n` (CRLF) | ⚠️ Extra char | ✅ Native | Converted |
97
-
98
- **Rule**: Use `.gitattributes` to enforce consistent line endings.
99
-
100
- ```gitattributes
101
- * text=auto eol=lf
102
- *.sh text eol=lf
103
- *.py text eol=lf
104
- ```
105
-
106
- ### 4. Environment Variables
107
-
108
- | Variable | macOS/Linux | Windows |
109
- |----------|-------------|---------|
110
- | `HOME` | ✅ Set | ❌ Use `USERPROFILE` |
111
- | `PATH` separator | `:` | `;` |
112
- | Case sensitivity | ✅ Case-sensitive | ❌ Case-insensitive |
113
-
114
- **Rule**: Use `pathlib.Path.home()` instead of environment variables.
115
-
116
- ```python
117
- # BAD
118
- home = os.environ.get("HOME")
119
-
120
- # GOOD
121
- home = Path.home()
122
- ```
123
-
124
- ### 5. Command Availability
125
-
126
- | Command | macOS/Linux | Windows |
127
- |---------|-------------|---------|
128
- | `grep` | ✅ Built-in | ❌ Not available |
129
- | `find` | ✅ Built-in | ⚠️ Different syntax |
130
- | `cat` | ✅ Built-in | ❌ Use `type` |
131
- | `tail -f` | ✅ Built-in | ❌ Not available |
132
-
133
- **Rule**: Use Python standard library instead of shell commands when possible.
134
-
135
- ```python
136
- # BAD - tail -f is not available on Windows
137
- subprocess.run(["tail", "-f", log_file])
138
-
139
- # GOOD - Cross-platform implementation
140
- def tail_follow(file_path: Path) -> None:
141
- """Follow a file like 'tail -f', cross-platform compatible."""
142
- with open(file_path, "r", encoding="utf-8", errors="replace") as f:
143
- f.seek(0, 2) # Go to end
144
- while True:
145
- line = f.readline()
146
- if line:
147
- print(line, end="", flush=True)
148
- else:
149
- time.sleep(0.1)
150
- ```
151
-
152
- ### 6. File Encoding
153
-
154
- | Default Encoding | macOS/Linux | Windows |
155
- |------------------|-------------|---------|
156
- | Terminal | UTF-8 | Often CP1252 or GBK |
157
- | File I/O | UTF-8 | System locale |
158
- | Git output | UTF-8 | May vary |
159
-
160
- **Rule**: Always explicitly specify `encoding="utf-8"` and use `errors="replace"`.
161
-
162
- ```python
163
- # BAD - Relies on system default
164
- with open(file, "r") as f:
165
- content = f.read()
166
-
167
- result = subprocess.run(cmd, capture_output=True, text=True)
168
-
169
- # GOOD - Explicit encoding with error handling
170
- with open(file, "r", encoding="utf-8", errors="replace") as f:
171
- content = f.read()
172
-
173
- result = subprocess.run(
174
- cmd,
175
- capture_output=True,
176
- text=True,
177
- encoding="utf-8",
178
- errors="replace"
179
- )
180
- ```
181
-
182
- **Git commands**: Force UTF-8 output encoding:
183
-
184
- ```python
185
- # Force git to output UTF-8
186
- git_args = ["git", "-c", "i18n.logOutputEncoding=UTF-8"] + args
187
- result = subprocess.run(
188
- git_args,
189
- capture_output=True,
190
- text=True,
191
- encoding="utf-8",
192
- errors="replace"
193
- )
194
- ```
195
-
196
- ---
197
-
198
- ## Change Propagation Checklist
199
-
200
- When making platform-related changes, check **all these locations**:
201
-
202
- ### Documentation & Help Text
203
- - [ ] Docstrings at top of Python files
204
- - [ ] `--help` output / argparse descriptions
205
- - [ ] Usage examples in README
206
- - [ ] Error messages that suggest commands
207
- - [ ] Markdown documentation (`.md` files)
208
-
209
- ### Code Locations
210
- - [ ] `src/templates/` - Template files for new projects
211
- - [ ] `.aim-studio/scripts/` - Project's own scripts (if self-hosting)
212
- - [ ] `dist/` - Built output (rebuild after changes)
213
-
214
- ### Search Pattern
215
- ```bash
216
- # Find all places that might need updating
217
- grep -r "python [a-z]" --include="*.py" --include="*.md"
218
- grep -r "\./" --include="*.py" --include="*.md" | grep -v python3
219
- ```
220
-
221
- ---
222
-
223
- ## Pre-Commit Checklist
224
-
225
- Before committing cross-platform code:
226
-
227
- - [ ] All Python invocations use `python3` explicitly (docs) or `sys.executable` (code)
228
- - [ ] All paths use `pathlib.Path`
229
- - [ ] No hardcoded path separators (`/` or `\`)
230
- - [ ] No platform-specific commands without fallbacks (e.g., `tail -f`)
231
- - [ ] All file I/O specifies `encoding="utf-8"` and `errors="replace"`
232
- - [ ] All subprocess calls specify `encoding="utf-8"` and `errors="replace"`
233
- - [ ] Git commands use `-c i18n.logOutputEncoding=UTF-8`
234
- - [ ] External tool API formats verified from documentation
235
- - [ ] Documentation matches code behavior
236
- - [ ] Ran search to find all affected locations
237
-
238
- ### 7. External Tool API Contracts
239
-
240
- When integrating with external tools (Claude Code, Cursor, etc.), their API contracts are **implicit assumptions**.
241
-
242
- **Rule**: Verify API formats from official documentation, don't guess.
243
-
244
- ```python
245
- # BAD - Guessed format
246
- output = {"continue": True, "message": "..."}
247
-
248
- # GOOD - Verified format from documentation
249
- output = {
250
- "hookSpecificOutput": {
251
- "hookEventName": "SessionStart",
252
- "additionalContext": "..."
253
- }
254
- }
255
- ```
256
-
257
- > **Warning**: Different hook types may have different output formats.
258
- > Always check the specific documentation for each hook event.
259
-
260
- ---
261
-
262
- ## Common Mistakes
263
-
264
- ### 1. "It works on my Mac"
265
-
266
- ```python
267
- # Developer's Mac
268
- subprocess.run(["./script.py"]) # Works!
269
-
270
- # User's Windows
271
- subprocess.run(["./script.py"]) # FileNotFoundError
272
- ```
273
-
274
- ### 2. "The shebang should handle it"
275
-
276
- ```python
277
- #!/usr/bin/env python3
278
- # This line is IGNORED on Windows
279
- ```
280
-
281
- ### 3. "I updated the template"
282
-
283
- ```
284
- src/templates/script.py ← Updated
285
- .aim-studio/scripts/script.py ← Forgot to sync!
286
- ```
287
-
288
- ### 4. "Python 3 is always python3"
289
-
290
- ```bash
291
- # Developer's Mac/Linux
292
- python3 script.py # Works!
293
-
294
- # User's Windows (Python from python.org)
295
- python3 script.py # 'python3' is not recognized
296
- python script.py # Works!
297
- ```
298
-
299
- ### 5. "UTF-8 is the default everywhere"
300
-
301
- ```python
302
- # Developer's Mac (UTF-8 default)
303
- subprocess.run(cmd, capture_output=True, text=True) # Works!
304
-
305
- # User's Windows (GBK/CP1252 default)
306
- subprocess.run(cmd, capture_output=True, text=True) # Garbled Chinese/Unicode
307
-
308
- ---
309
-
310
- ## Recovery: When You Find a Platform Bug
311
-
312
- 1. **Fix the immediate issue**
313
- 2. **Search for similar patterns** (grep the codebase)
314
- 3. **Update this guide** with the new pattern
315
- 4. **Add to pre-commit checklist** if recurring
316
-
317
- ---
318
-
319
- **Core Principle**: If it's not explicit, it's an assumption. And assumptions break.
@@ -1,89 +0,0 @@
1
- # Thinking Guides
2
-
3
- > **Purpose**: Expand your thinking to catch things you might not have considered.
4
-
5
- ---
6
-
7
- ## Why Thinking Guides?
8
-
9
- **Most bugs and tech debt come from "didn't think of that"**, not from lack of skill:
10
-
11
- - Didn't think about what happens at layer boundaries → cross-layer bugs
12
- - Didn't think about code patterns repeating → duplicated code everywhere
13
- - Didn't think about edge cases → runtime errors
14
- - Didn't think about future maintainers → unreadable code
15
-
16
- These guides help you **ask the right questions before coding**.
17
-
18
- ---
19
-
20
- ## Available Guides
21
-
22
- | Guide | Purpose | When to Use |
23
- |-------|---------|-------------|
24
- | [Code Reuse Thinking Guide](./code-reuse-thinking-guide.md) | Identify patterns and reduce duplication | When you notice repeated patterns |
25
- | [Cross-Layer Thinking Guide](./cross-layer-thinking-guide.md) | Think through data flow across layers | Features spanning multiple layers |
26
- | [Cross-Platform Thinking Guide](./cross-platform-thinking-guide.md) | Catch platform-specific assumptions | Scripts, paths, commands |
27
-
28
- ---
29
-
30
- ## Quick Reference: Thinking Triggers
31
-
32
- ### When to Think About Cross-Layer Issues
33
-
34
- - [ ] Feature touches 3+ layers (API, Service, Component, Database)
35
- - [ ] Data format changes between layers
36
- - [ ] Multiple consumers need the same data
37
- - [ ] You're not sure where to put some logic
38
-
39
- → Read [Cross-Layer Thinking Guide](./cross-layer-thinking-guide.md)
40
-
41
- ### When to Think About Code Reuse
42
-
43
- - [ ] You're writing similar code to something that exists
44
- - [ ] You see the same pattern repeated 3+ times
45
- - [ ] You're adding a new field to multiple places
46
- - [ ] **You're modifying any constant or config**
47
- - [ ] **You're creating a new utility/helper function** ← Search first!
48
-
49
- → Read [Code Reuse Thinking Guide](./code-reuse-thinking-guide.md)
50
-
51
- ### When to Think About Cross-Platform Issues
52
-
53
- - [ ] Writing scripts that users will run directly
54
- - [ ] Adding usage examples or help text
55
- - [ ] Working with file paths or commands
56
- - [ ] **Migrating from shell scripts to Python**
57
-
58
- → Read [Cross-Platform Thinking Guide](./cross-platform-thinking-guide.md)
59
-
60
- ---
61
-
62
- ## Pre-Modification Rule (CRITICAL)
63
-
64
- > **Before changing ANY value, ALWAYS search first!**
65
-
66
- ```bash
67
- # Search for the value you're about to change
68
- grep -r "value_to_change" .
69
- ```
70
-
71
- This single habit prevents most "forgot to update X" bugs.
72
-
73
- ---
74
-
75
- ## How to Use This Directory
76
-
77
- 1. **Before coding**: Skim the relevant thinking guide
78
- 2. **During coding**: If something feels repetitive or complex, check the guides
79
- 3. **After bugs**: Add new insights to the relevant guide (learn from mistakes)
80
-
81
- ---
82
-
83
- ## Contributing
84
-
85
- Found a new "didn't think of that" moment? Add it to the relevant guide.
86
-
87
- ---
88
-
89
- **Core Principle**: 30 minutes of thinking saves 3 hours of debugging.