@fifine/aim-studio 0.0.2 → 0.0.4

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 (104) hide show
  1. package/README.md +65 -99
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +123 -101
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/configurators/workflow.d.ts.map +1 -1
  6. package/dist/configurators/workflow.js +91 -65
  7. package/dist/configurators/workflow.js.map +1 -1
  8. package/dist/constants/paths.d.ts +5 -5
  9. package/dist/constants/paths.d.ts.map +1 -1
  10. package/dist/constants/paths.js +5 -5
  11. package/dist/constants/paths.js.map +1 -1
  12. package/dist/templates/aim/index.d.ts +1 -0
  13. package/dist/templates/aim/index.d.ts.map +1 -1
  14. package/dist/templates/aim/index.js +2 -0
  15. package/dist/templates/aim/index.js.map +1 -1
  16. package/dist/templates/aim/scripts/common/developer.py +2 -1
  17. package/dist/templates/aim/scripts/common/paths.py +3 -2
  18. package/dist/templates/aim/scripts/export.py +718 -0
  19. package/dist/templates/aim/workflow.md +12 -13
  20. package/dist/templates/claude/commands/aim/export.md +258 -108
  21. package/dist/templates/claude/commands/aim/finish-work.md +23 -0
  22. package/dist/templates/claude/commands/aim/onboard.md +10 -8
  23. package/dist/templates/claude/commands/aim/start.md +104 -37
  24. package/dist/templates/claude/commands/aim/story.md +275 -67
  25. package/dist/templates/claude/hooks/inject-subagent-context.py +6 -10
  26. package/dist/templates/claude/hooks/session-start.py +134 -24
  27. package/dist/templates/markdown/index.d.ts +5 -0
  28. package/dist/templates/markdown/index.d.ts.map +1 -1
  29. package/dist/templates/markdown/index.js +6 -0
  30. package/dist/templates/markdown/index.js.map +1 -1
  31. package/dist/templates/markdown/spec/cli/directory-structure.md.txt +71 -0
  32. package/dist/templates/markdown/spec/cli/error-handling.md.txt +91 -0
  33. package/dist/templates/markdown/spec/cli/index.md.txt +37 -0
  34. package/dist/templates/markdown/spec/cli/options-flags.md.txt +71 -0
  35. package/dist/templates/markdown/spec/cli/output-formatting.md.txt +93 -0
  36. package/dist/utils/project-detector.d.ts +1 -1
  37. package/dist/utils/project-detector.d.ts.map +1 -1
  38. package/dist/utils/project-detector.js +20 -0
  39. package/dist/utils/project-detector.js.map +1 -1
  40. package/package.json +1 -1
  41. package/dist/templates/claude/commands/trellis/before-backend-dev.md +0 -13
  42. package/dist/templates/claude/commands/trellis/before-frontend-dev.md +0 -13
  43. package/dist/templates/claude/commands/trellis/break-loop.md +0 -125
  44. package/dist/templates/claude/commands/trellis/check-backend.md +0 -13
  45. package/dist/templates/claude/commands/trellis/check-cross-layer.md +0 -153
  46. package/dist/templates/claude/commands/trellis/check-frontend.md +0 -13
  47. package/dist/templates/claude/commands/trellis/create-command.md +0 -154
  48. package/dist/templates/claude/commands/trellis/finish-work.md +0 -129
  49. package/dist/templates/claude/commands/trellis/integrate-skill.md +0 -219
  50. package/dist/templates/claude/commands/trellis/onboard.md +0 -358
  51. package/dist/templates/claude/commands/trellis/parallel.md +0 -193
  52. package/dist/templates/claude/commands/trellis/record-session.md +0 -62
  53. package/dist/templates/claude/commands/trellis/start.md +0 -280
  54. package/dist/templates/claude/commands/trellis/update-spec.md +0 -285
  55. package/dist/templates/trellis/gitignore.txt +0 -29
  56. package/dist/templates/trellis/index.d.ts +0 -49
  57. package/dist/templates/trellis/index.d.ts.map +0 -1
  58. package/dist/templates/trellis/index.js +0 -92
  59. package/dist/templates/trellis/index.js.map +0 -1
  60. package/dist/templates/trellis/scripts/__init__.py +0 -5
  61. package/dist/templates/trellis/scripts/add_session.py +0 -392
  62. package/dist/templates/trellis/scripts/common/__init__.py +0 -80
  63. package/dist/templates/trellis/scripts/common/cli_adapter.py +0 -435
  64. package/dist/templates/trellis/scripts/common/developer.py +0 -190
  65. package/dist/templates/trellis/scripts/common/git_context.py +0 -383
  66. package/dist/templates/trellis/scripts/common/paths.py +0 -347
  67. package/dist/templates/trellis/scripts/common/phase.py +0 -253
  68. package/dist/templates/trellis/scripts/common/registry.py +0 -366
  69. package/dist/templates/trellis/scripts/common/task_queue.py +0 -255
  70. package/dist/templates/trellis/scripts/common/task_utils.py +0 -178
  71. package/dist/templates/trellis/scripts/common/worktree.py +0 -219
  72. package/dist/templates/trellis/scripts/create_bootstrap.py +0 -290
  73. package/dist/templates/trellis/scripts/get_context.py +0 -16
  74. package/dist/templates/trellis/scripts/get_developer.py +0 -26
  75. package/dist/templates/trellis/scripts/init_developer.py +0 -51
  76. package/dist/templates/trellis/scripts/multi_agent/__init__.py +0 -5
  77. package/dist/templates/trellis/scripts/multi_agent/cleanup.py +0 -403
  78. package/dist/templates/trellis/scripts/multi_agent/create_pr.py +0 -329
  79. package/dist/templates/trellis/scripts/multi_agent/plan.py +0 -233
  80. package/dist/templates/trellis/scripts/multi_agent/start.py +0 -461
  81. package/dist/templates/trellis/scripts/multi_agent/status.py +0 -817
  82. package/dist/templates/trellis/scripts/task.py +0 -1056
  83. package/dist/templates/trellis/scripts-shell-archive/add-session.sh +0 -384
  84. package/dist/templates/trellis/scripts-shell-archive/common/developer.sh +0 -129
  85. package/dist/templates/trellis/scripts-shell-archive/common/git-context.sh +0 -263
  86. package/dist/templates/trellis/scripts-shell-archive/common/paths.sh +0 -208
  87. package/dist/templates/trellis/scripts-shell-archive/common/phase.sh +0 -150
  88. package/dist/templates/trellis/scripts-shell-archive/common/registry.sh +0 -247
  89. package/dist/templates/trellis/scripts-shell-archive/common/task-queue.sh +0 -142
  90. package/dist/templates/trellis/scripts-shell-archive/common/task-utils.sh +0 -151
  91. package/dist/templates/trellis/scripts-shell-archive/common/worktree.sh +0 -128
  92. package/dist/templates/trellis/scripts-shell-archive/create-bootstrap.sh +0 -299
  93. package/dist/templates/trellis/scripts-shell-archive/get-context.sh +0 -7
  94. package/dist/templates/trellis/scripts-shell-archive/get-developer.sh +0 -15
  95. package/dist/templates/trellis/scripts-shell-archive/init-developer.sh +0 -34
  96. package/dist/templates/trellis/scripts-shell-archive/multi-agent/cleanup.sh +0 -396
  97. package/dist/templates/trellis/scripts-shell-archive/multi-agent/create-pr.sh +0 -241
  98. package/dist/templates/trellis/scripts-shell-archive/multi-agent/plan.sh +0 -207
  99. package/dist/templates/trellis/scripts-shell-archive/multi-agent/start.sh +0 -317
  100. package/dist/templates/trellis/scripts-shell-archive/multi-agent/status.sh +0 -828
  101. package/dist/templates/trellis/scripts-shell-archive/task.sh +0 -1204
  102. package/dist/templates/trellis/tasks/.gitkeep +0 -0
  103. package/dist/templates/trellis/workflow.md +0 -416
  104. package/dist/templates/trellis/worktree.yaml +0 -47
@@ -65,6 +65,49 @@ def run_script(script_path: Path) -> str:
65
65
  return "No context available"
66
66
 
67
67
 
68
+ def detect_project_type(project_dir: Path) -> str:
69
+ """Detect project type based on directory structure."""
70
+
71
+ # Check for bin/ directory (CLI tool)
72
+ if (project_dir / "bin").is_dir():
73
+ return "cli"
74
+
75
+ # Check for story project (has spec/story/)
76
+ if (project_dir / ".aim-studio" / "spec" / "story").is_dir():
77
+ return "story"
78
+
79
+ # Check for frontend indicators
80
+ frontend_indicators = [
81
+ "package.json",
82
+ "vite.config.ts",
83
+ "vite.config.js",
84
+ "next.config.js",
85
+ "next.config.ts",
86
+ "nuxt.config.ts",
87
+ ]
88
+ has_frontend = any((project_dir / f).exists() for f in frontend_indicators)
89
+
90
+ # Check for backend indicators
91
+ backend_indicators = [
92
+ "requirements.txt",
93
+ "pyproject.toml",
94
+ "go.mod",
95
+ "Cargo.toml",
96
+ "pom.xml",
97
+ "composer.json",
98
+ ]
99
+ has_backend = any((project_dir / f).exists() for f in backend_indicators)
100
+
101
+ if has_frontend and has_backend:
102
+ return "fullstack"
103
+ elif has_frontend:
104
+ return "frontend"
105
+ elif has_backend:
106
+ return "backend"
107
+
108
+ return "unknown"
109
+
110
+
68
111
  def main():
69
112
  if should_skip_injection():
70
113
  sys.exit(0)
@@ -73,58 +116,125 @@ def main():
73
116
  trellis_dir = project_dir / ".aim-studio"
74
117
  claude_dir = project_dir / ".claude"
75
118
 
119
+ # Detect project type
120
+ project_type = detect_project_type(project_dir)
121
+
76
122
  output = StringIO()
77
123
 
78
- output.write("""<session-context>
79
- You are starting a new session in a Trellis-managed project.
80
- Read and follow all instructions below carefully.
81
- </session-context>
124
+ # 根据项目类型显示不同的欢迎信息
125
+ welcome_messages = {
126
+ "cli": "AIM Studio CLI 项目",
127
+ "frontend": "AIM Studio 前端项目",
128
+ "backend": "AIM Studio 后端项目",
129
+ "fullstack": "AIM Studio 全栈项目",
130
+ "story": "AIM Studio 漫剧创作项目",
131
+ "unknown": "AIM Studio 项目",
132
+ }
133
+
134
+ output.write(f"""<session-context>
135
+ 您正在启动一个 {welcome_messages.get(project_type, 'AIM Studio')} 会话。
136
+ 请仔细阅读以下说明并遵循执行。
137
+
138
+ 项目类型: {project_type}
82
139
 
83
140
  """)
84
141
 
142
+ # Get current context
85
143
  output.write("<current-state>\n")
86
144
  context_script = trellis_dir / "scripts" / "get_context.py"
87
145
  output.write(run_script(context_script))
88
146
  output.write("\n</current-state>\n\n")
89
147
 
148
+ # Workflow
90
149
  output.write("<workflow>\n")
91
- workflow_content = read_file(trellis_dir / "workflow.md", "No workflow.md found")
150
+ workflow_content = read_file(trellis_dir / "workflow.md", "未找到 workflow.md")
92
151
  output.write(workflow_content)
93
152
  output.write("\n</workflow>\n\n")
94
153
 
154
+ # Guidelines - 根据项目类型注入相应的规范
95
155
  output.write("<guidelines>\n")
96
156
 
97
- output.write("## Frontend\n")
98
- frontend_index = read_file(
99
- trellis_dir / "spec" / "frontend" / "index.md", "Not configured"
100
- )
101
- output.write(frontend_index)
102
- output.write("\n\n")
103
-
104
- output.write("## Backend\n")
105
- backend_index = read_file(
106
- trellis_dir / "spec" / "backend" / "index.md", "Not configured"
107
- )
108
- output.write(backend_index)
109
- output.write("\n\n")
157
+ # CLI 项目
158
+ if project_type == "cli":
159
+ output.write("## CLI 开发规范\n")
160
+ cli_index = read_file(
161
+ trellis_dir / "spec" / "cli" / "index.md", "未配置 CLI 规范"
162
+ )
163
+ output.write(cli_index)
164
+ output.write("\n\n")
165
+
166
+ # Frontend 项目
167
+ if project_type in ("frontend", "fullstack"):
168
+ output.write("## 前端开发规范\n")
169
+ frontend_index = read_file(
170
+ trellis_dir / "spec" / "frontend" / "index.md", "未配置前端规范"
171
+ )
172
+ output.write(frontend_index)
173
+ output.write("\n\n")
174
+
175
+ # Backend 项目
176
+ if project_type in ("backend", "fullstack", "cli"):
177
+ output.write("## 后端开发规范\n")
178
+ backend_index = read_file(
179
+ trellis_dir / "spec" / "backend" / "index.md", "未配置后端规范"
180
+ )
181
+ output.write(backend_index)
182
+ output.write("\n\n")
183
+
184
+ # Story 项目
185
+ if project_type == "story":
186
+ output.write("## 漫剧创作规范\n")
187
+ story_index = read_file(
188
+ trellis_dir / "spec" / "story" / "index.md", "未配置漫剧规范"
189
+ )
190
+ output.write(story_index)
191
+ output.write("\n\n")
110
192
 
111
- output.write("## Guides\n")
193
+ # Guides - 始终提供
194
+ output.write("## 开发指南\n")
112
195
  guides_index = read_file(
113
- trellis_dir / "spec" / "guides" / "index.md", "Not configured"
196
+ trellis_dir / "spec" / "guides" / "index.md", "未配置开发指南"
114
197
  )
115
198
  output.write(guides_index)
116
199
 
117
200
  output.write("\n</guidelines>\n\n")
118
201
 
202
+ # 读取命令文件 - 必须使用 commands/aim/ 目录(新结构)
203
+ def read_command_file(filename: str) -> str:
204
+ """读取 commands/aim/ 目录下的命令文件"""
205
+ aim_path = claude_dir / "commands" / "aim" / filename
206
+ if aim_path.exists():
207
+ return read_file(aim_path, "")
208
+ return f"未找到命令文件: {filename}"
209
+
210
+ # 根据项目类型选择不同的 start 指令
211
+ if project_type == "story":
212
+ start_md = read_command_file("story.md")
213
+ else:
214
+ start_md = read_command_file("start.md")
215
+
119
216
  output.write("<instructions>\n")
120
- start_md = read_file(
121
- claude_dir / "commands" / "trellis" / "start.md", "No start.md found"
122
- )
123
217
  output.write(start_md)
124
218
  output.write("\n</instructions>\n\n")
125
219
 
220
+ # 项目类型特定的提示
221
+ type_hints = {
222
+ "cli": "注意:这是一个 CLI 工具项目,请参考 spec/cli/ 目录下的规范。",
223
+ "frontend": "注意:这是一个前端项目,请参考 spec/frontend/ 目录下的规范。",
224
+ "backend": "注意:这是一个后端项目,请参考 spec/backend/ 目录下的规范。",
225
+ "fullstack": "注意:这是一个全栈项目,请同时参考 spec/frontend/ 和 spec/backend/ 目录下的规范。",
226
+ "story": "注意:这是一个漫剧创作项目,请使用 /aim:story 命令开始创作。漫剧命令不适用于其他类型的项目。",
227
+ "unknown": "注意:项目类型未知,请根据实际情况选择合适的工作流程。",
228
+ }
229
+
230
+ output.write(f"""<project-type-hint>
231
+ {type_hints.get(project_type, '')}
232
+ </project-type-hint>
233
+
234
+ """)
235
+
126
236
  output.write("""<ready>
127
- Context loaded. Wait for user's first message, then follow <instructions> to handle their request.
237
+ 上下文已加载。请等待用户的第一个消息,然后按照 <instructions> 中的说明处理用户请求。
128
238
  </ready>""")
129
239
 
130
240
  result = {
@@ -29,4 +29,9 @@ export declare const storyIndexContent: string;
29
29
  export declare const storyCharacterContent: string;
30
30
  export declare const storyWorldContent: string;
31
31
  export declare const storyScriptContent: string;
32
+ export declare const cliIndexContent: string;
33
+ export declare const cliDirectoryStructureContent: string;
34
+ export declare const cliOptionsFlagsContent: string;
35
+ export declare const cliOutputFormattingContent: string;
36
+ export declare const cliErrorHandlingContent: string;
32
37
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/templates/markdown/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAqBH,eAAO,MAAM,eAAe,EAAE,MAAuC,CAAC;AAGtE,eAAO,MAAM,qBAAqB,EAAE,MACK,CAAC;AAG1C,eAAO,MAAM,yBAAyB,QAAwB,CAAC;AAG/D,eAAO,MAAM,wBAAwB,EAAE,MACH,CAAC;AAQrC,eAAO,MAAM,mBAAmB,EAAE,MAEjC,CAAC;AACF,eA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AE9C,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,+BAA+B,EAAE,MAE7C,CAAC;AACF,eAAO,MAAM,+BAA+B,EAAE,MAE7C,CAAC;AACF,eAAO,MAAM,2BAA2B,EAAE,MAEzC,CAAC;AAGF,eAAO,MAAM,oBAAoB,EAAE,MAElC,CAAC;AACF,eAAO,MAAM,iCAAiC,EAAE,MAE/C,CAAC;AACF,eAAO,MAAM,yBAAyB,EAAE,MAEvC,CAAC;AACF,eAAO,MAAM,6BAA6B,EAAE,MAE3C,CAAC;AACF,eAAO,MAAM,kCAAkC,EAAE,MAEhD,CAAC;AACF,eAAO,MAAM,gCAAgC,EAAE,MAE9C,CAAC;AACF,eAAO,MAAM,8BAA8B,EAAE,MAE5C,CAAC;AAGF,eAAO,MAAM,kBAAkB,EAAE,MAEhC,CAAC;AACF,eAAO,MAAM,oCAAoC,EAAE,MAElD,CAAC;AACF,eAAO,MAAM,mCAAmC,EAAE,MAEjD,CAAC;AACF,eAAO,MAAM,uCAAuC,EAAE,MACiB,CAAC;AAGxE,eAAO,MAAM,iBAAiB,EAAE,MAE/B,CAAC;AACF,eAAO,MAAM,qBAAqB,EAAE,MAEnC,CAAC;AACF,eAAO,MAAM,iBAAiB,EAAE,MAE/B,CAAC;AACF,eAAO,MAAM,kBAAkB,EAAE,MAEhC,CAAC;AAGF,eAAO,MAAM,eAAe,EAAE,MAE7B,CAAC;AACF,eAAO,MAAM,4BAA4B,EAAE,MAE1C,CAAC;AACF,eAAO,MAAM,sBAAsB,EAAE,MAEpC,CAAC;AACF,eAAO,MAAM,0BAA0B,EAAE,MAExC,CAAC;AACF,eAAO,MAAM,uBAAuB,EAAE,MAErC,CAAC"}
@@ -55,4 +55,10 @@ export const storyIndexContent = readLocalTemplate("spec/story/index.md.txt");
55
55
  export const storyCharacterContent = readLocalTemplate("spec/story/character.md.txt");
56
56
  export const storyWorldContent = readLocalTemplate("spec/story/world.md.txt");
57
57
  export const storyScriptContent = readLocalTemplate("spec/story/script.md.txt");
58
+ // CLI tool structure
59
+ export const cliIndexContent = readLocalTemplate("spec/cli/index.md.txt");
60
+ export const cliDirectoryStructureContent = readLocalTemplate("spec/cli/directory-structure.md.txt");
61
+ export const cliOptionsFlagsContent = readLocalTemplate("spec/cli/options-flags.md.txt");
62
+ export const cliOutputFormattingContent = readLocalTemplate("spec/cli/output-formatting.md.txt");
63
+ export const cliErrorHandlingContent = readLocalTemplate("spec/cli/error-handling.md.txt");
58
64
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/templates/markdown/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC;;GAEG;AACH,SAAS,iBAAiB,CAAC,QAAgB;IACzC,MAAM,QAAQ,GAAG,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC3C,OAAO,YAAY,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;AACzC,CAAC;AAED,gFAAgF;AAChF,8BAA8B;AAC9B,gFAAgF;AAEhF,MAAM,CAAC,MAAM,eAAe,GAAW,iBAAiB,CAAC,WAAW,CAAC,CAAC;AAEtE,oDAAoD;AACpD,MAAM,CAAC,MAAM,qBAAqB,GAChC,iBAAiB,CAAC,oBAAoB,CAAC,CAAC;AAE1C,gCAAgC;AAChC,MAAM,CAAC,MAAM,yBAAyB,GAAG,qBAAqB,CAAC;AAE/D,2DAA2D;AAC3D,MAAM,CAAC,MAAM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MAAM,CAAC,MAAM,kBAAkB,GAAW,iBAAiB,CACzD,0BAA0B,CAC3B,CAAC;AACF,MAAM,CAAC,MAAM,oCAAoC,GAAW,iBAAiB,CAC3E,+CAA+C,CAChD,CAAC;AACF,MAAM,CAAC,MAAM,mCAAmC,GAAW,iBAAiB,CAC1E,8CAA8C,CAC/C,CAAC;AACF,MAAM,CAAC,MAAM,uCAAuC,GAClD,iBAAiB,CAAC,kDAAkD,CAAC,CAAC;AAExE,kBAAkB;AAClB,MAAM,CAAC,MAAM,iBAAiB,GAAW,iBAAiB,CACxD,yBAAyB,CAC1B,CAAC;AACF,MAAM,CAAC,MAAM,qBAAqB,GAAW,iBAAiB,CAC5D,6BAA6B,CAC9B,CAAC;AACF,MAAM,CAAC,MAAM,iBAAiB,GAAW,iBAAiB,CACxD,yBAAyB,CAC1B,CAAC;AACF,MAAM,CAAC,MAAM,kBAAkB,GAAW,iBAAiB,CACzD,0BAA0B,CAC3B,CAAC;AAEF,qBAAqB;AACrB,MAAM,CAAC,MAAM,eAAe,GAAW,iBAAiB,CACtD,uBAAuB,CACxB,CAAC;AACF,MAAM,CAAC,MAAM,4BAA4B,GAAW,iBAAiB,CACnE,qCAAqC,CACtC,CAAC;AACF,MAAM,CAAC,MAAM,sBAAsB,GAAW,iBAAiB,CAC7D,+BAA+B,CAChC,CAAC;AACF,MAAM,CAAC,MAAM,0BAA0B,GAAW,iBAAiB,CACjE,mCAAmC,CACpC,CAAC;AACF,MAAM,CAAC,MAAM,uBAAuB,GAAW,iBAAiB,CAC9D,gCAAgC,CACjC,CAAC"}
@@ -0,0 +1,71 @@
1
+ # CLI Directory Structure
2
+
3
+ > How the CLI tool is organized.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ Describe your CLI project's directory structure and organization.
10
+
11
+ ---
12
+
13
+ ## Entry Point
14
+
15
+ | File | Purpose |
16
+ |------|---------|
17
+ | `bin/aim.js` | Main CLI entry point |
18
+ | `src/cli/` | CLI argument parsing |
19
+ | `src/commands/` | Command implementations |
20
+
21
+ ---
22
+
23
+ ## Example Structure
24
+
25
+ ```
26
+ .
27
+ ├── bin/
28
+ │ └── aim.js # CLI entry point
29
+ ├── src/
30
+ │ ├── cli/ # Command-line parsing
31
+ │ │ └── index.ts
32
+ │ ├── commands/ # Command implementations
33
+ │ │ ├── init.ts
34
+ │ │ └── update.ts
35
+ │ ├── utils/ # Utility functions
36
+ │ └── types/ # TypeScript types
37
+ ├── package.json
38
+ └── tsconfig.json
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Patterns
44
+
45
+ Describe common patterns used in your project:
46
+
47
+ ### Command Organization
48
+
49
+ ```typescript
50
+ // Example: how commands are registered
51
+ export const commands = [init, update];
52
+ ```
53
+
54
+ ### Module Boundaries
55
+
56
+ - `src/cli/` - Pure CLI concerns (parsing, help text)
57
+ - `src/commands/` - Business logic
58
+ - `src/utils/` - Shared utilities
59
+
60
+ ---
61
+
62
+ ## Anti-Patterns
63
+
64
+ - ❌ Mixing business logic in CLI entry point
65
+ - ❌ No separation between commands
66
+
67
+ ---
68
+
69
+ ## Add Your Examples
70
+
71
+ Replace these with real examples from your codebase.
@@ -0,0 +1,91 @@
1
+ # CLI Error Handling
2
+
3
+ > How errors are handled and reported.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ Document your CLI's error handling patterns, exit codes, and error messages.
10
+
11
+ ---
12
+
13
+ ## Exit Codes
14
+
15
+ | Code | Meaning |
16
+ |------|---------|
17
+ | `0` | Success |
18
+ | `1` | General error |
19
+ | `2` | Misuse of command |
20
+ | `3` | Internal error |
21
+
22
+ ---
23
+
24
+ ## Error Categories
25
+
26
+ | Category | Exit Code | Example |
27
+ |----------|-----------|---------|
28
+ | Validation | `2` | Missing required argument |
29
+ | Not Found | `2` | File/directory not found |
30
+ | Permission | `2` | Cannot write to directory |
31
+ | Internal | `3` | Unexpected exception |
32
+
33
+ ---
34
+
35
+ ## Error Message Format
36
+
37
+ ```
38
+ ❌ Error: <short description>
39
+ <detailed explanation (optional)>
40
+ <suggestion/fix (optional)>
41
+ ```
42
+
43
+ ### Example
44
+
45
+ ```
46
+ ❌ Error: Template not found
47
+ Template "react" does not exist
48
+ Run "aim template list" to see available templates
49
+ ```
50
+
51
+ ---
52
+
53
+ ## Patterns
54
+
55
+ ### Throwing Errors
56
+
57
+ ```typescript
58
+ import { error as consoleError, exit } from 'node:process';
59
+
60
+ function validateArgs(args: string[]) {
61
+ if (!args.length) {
62
+ consoleError('Error: Missing required argument');
63
+ exit(2);
64
+ }
65
+ }
66
+ ```
67
+
68
+ ### Try-Catch with Exit
69
+
70
+ ```typescript
71
+ try {
72
+ await doSomething();
73
+ } catch (err) {
74
+ consoleError(`Error: ${err.message}`);
75
+ exit(1);
76
+ }
77
+ ```
78
+
79
+ ---
80
+
81
+ ## Anti-Patterns
82
+
83
+ - ❌ Silent failures
84
+ - ❌ Stack traces exposed to users
85
+ - ❌ No error suggestions
86
+
87
+ ---
88
+
89
+ ## Add Your Examples
90
+
91
+ Replace with your actual error handling patterns.
@@ -0,0 +1,37 @@
1
+ # CLI Tool Development Guidelines
2
+
3
+ > Best practices for CLI tool development in this project.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ This directory contains guidelines for CLI tool development. Fill in each file with your project's specific conventions.
10
+
11
+ ---
12
+
13
+ ## Guidelines Index
14
+
15
+ | Guide | Description | Status |
16
+ |-------|-------------|--------|
17
+ | [Directory Structure](./directory-structure.md) | Command organization, module layout | TODO |
18
+ | [Options & Flags](./options-flags.md) | Global options, flags, environment variables | TODO |
19
+ | [Output Formatting](./output-formatting.md) | Output formats, colors, user feedback | TODO |
20
+ | [Error Handling](./error-handling.md) | Error codes, messages, exit statuses | TODO |
21
+
22
+ ---
23
+
24
+ ## How to Fill These Guidelines
25
+
26
+ For each guideline file:
27
+
28
+ 1. Document your project's **actual conventions** (not ideals)
29
+ 2. Include **code examples** from your codebase
30
+ 3. List **forbidden patterns** and why
31
+ 4. Add **common mistakes** your team has made
32
+
33
+ The goal is to help AI assistants and new team members understand how YOUR project works.
34
+
35
+ ---
36
+
37
+ **Language**: All documentation should be written in **English**.
@@ -0,0 +1,71 @@
1
+ # CLI Options & Flags
2
+
3
+ > How command-line options and flags are defined.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ Document your CLI's options, flags, and environment variables.
10
+
11
+ ---
12
+
13
+ ## Global Options
14
+
15
+ | Option | Alias | Description | Default |
16
+ |--------|-------|-------------|---------|
17
+ | `--help` | `-h` | Show help | - |
18
+ | `--version` | `-v` | Show version | - |
19
+ | `--verbose` | - | Enable verbose output | `false` |
20
+
21
+ ---
22
+
23
+ ## Environment Variables
24
+
25
+ | Variable | Description | Default |
26
+ |----------|-------------|---------|
27
+ | `AIM_HOME` | AIM Studio home directory | `~/.aim-studio` |
28
+ | `AIM_CONFIG` | Config file path | `~/.aim-studio/config.json` |
29
+
30
+ ---
31
+
32
+ ## Command-Specific Options
33
+
34
+ ### init Command
35
+
36
+ ```bash
37
+ aim init -u username --template react
38
+ ```
39
+
40
+ | Option | Alias | Description |
41
+ |--------|-------|-------------|
42
+ | `--user` | `-u` | Developer username |
43
+ | `--template` | - | Template to use |
44
+ | `--force` | - | Overwrite existing files |
45
+
46
+ ---
47
+
48
+ ## Patterns
49
+
50
+ ### Option Definition
51
+
52
+ ```typescript
53
+ // Example: using commander.js
54
+ program
55
+ .option('-u, --user <name>', 'Developer username')
56
+ .option('-t, --template <template>', 'Template name')
57
+ .option('-f, --force', 'Overwrite existing files');
58
+ ```
59
+
60
+ ---
61
+
62
+ ## Anti-Patterns
63
+
64
+ - ❌ Too many required options
65
+ - ❌ Inconsistent option names (`--user` vs `--username`)
66
+
67
+ ---
68
+
69
+ ## Add Your Examples
70
+
71
+ Replace with your actual option definitions.
@@ -0,0 +1,93 @@
1
+ # CLI Output Formatting
2
+
3
+ > How the CLI formats and presents output to users.
4
+
5
+ ---
6
+
7
+ ## Overview
8
+
9
+ Document your CLI's output conventions including colors, formatting, and user feedback.
10
+
11
+ ---
12
+
13
+ ## Output Types
14
+
15
+ | Type | Use Case |
16
+ |------|----------|
17
+ | `console.log` | Normal output, confirmations |
18
+ | `console.error` | Errors, warnings |
19
+ | `chalk` | Colored output for emphasis |
20
+
21
+ ---
22
+
23
+ ## Color Conventions
24
+
25
+ | Color | Usage |
26
+ |-------|-------|
27
+ | `cyan` | Primary information, headers |
28
+ | `green` | Success messages, confirmations |
29
+ | `yellow` | Warnings |
30
+ | `red` | Errors |
31
+ | `gray` | Secondary information |
32
+
33
+ ---
34
+
35
+ ## Example Output
36
+
37
+ ### Success
38
+
39
+ ```
40
+ ✅ Project initialized successfully!
41
+ ```
42
+
43
+ ### Error
44
+
45
+ ```
46
+ ❌ Error: Directory already exists
47
+ Use --force to overwrite
48
+ ```
49
+
50
+ ### Progress
51
+
52
+ ```
53
+ 📦 Downloading template...
54
+ 345.2 KB / 345.2 KB
55
+ ```
56
+
57
+ ---
58
+
59
+ ## Patterns
60
+
61
+ ### Using Chalk
62
+
63
+ ```typescript
64
+ import chalk from 'chalk';
65
+
66
+ console.log(chalk.green('✓ ') + 'Success message');
67
+ console.log(chalk.red('✗ ') + 'Error message');
68
+ console.log(chalk.cyan('ℹ ') + 'Info message');
69
+ ```
70
+
71
+ ### Progress Indicators
72
+
73
+ ```typescript
74
+ // Using ora for spinners
75
+ import ora from 'ora';
76
+
77
+ const spinner = ora('Loading...').start();
78
+ spinner.succeed('Done!');
79
+ ```
80
+
81
+ ---
82
+
83
+ ## Anti-Patterns
84
+
85
+ - ❌ No error messages
86
+ - ❌ Inconsistent colors
87
+ - ❌ Too much output (noise)
88
+
89
+ ---
90
+
91
+ ## Add Your Examples
92
+
93
+ Replace with your actual output patterns.
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * Project type detected by analyzing project files
3
3
  */
4
- export type ProjectType = "frontend" | "backend" | "fullstack" | "story" | "unknown";
4
+ export type ProjectType = "frontend" | "backend" | "fullstack" | "story" | "cli" | "unknown";
5
5
  /**
6
6
  * Detect project type by analyzing project files
7
7
  *
@@ -1 +1 @@
1
- {"version":3,"file":"project-detector.d.ts","sourceRoot":"","sources":["../../src/utils/project-detector.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,UAAU,GAAG,SAAS,GAAG,WAAW,GAAG,OAAO,GAAG,SAAS,CAAC;AAiKrF;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAqB1D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAanE"}
1
+ {"version":3,"file":"project-detector.d.ts","sourceRoot":"","sources":["../../src/utils/project-detector.ts"],"names":[],"mappings":"AAGA;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,UAAU,GACV,SAAS,GACT,WAAW,GACX,OAAO,GACP,KAAK,GACL,SAAS,CAAC;AA6Kd;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CA8B1D;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,WAAW,GAAG,MAAM,CAenE"}
@@ -97,6 +97,17 @@ const BACKEND_DEPS = [
97
97
  "flask",
98
98
  "django",
99
99
  ];
100
+ /**
101
+ * Files that indicate a CLI tool project (not frontend/backend)
102
+ */
103
+ const CLI_INDICATORS = [
104
+ // Node.js CLI tools
105
+ "bin/aim.js",
106
+ "bin/trellis.js",
107
+ "bin/cli.js",
108
+ // Python CLI tools (click, typer, argparse)
109
+ "pyproject.toml", // Check for CLI tools in dependencies
110
+ ];
100
111
  /**
101
112
  * Check if a file exists in the project directory
102
113
  */
@@ -150,6 +161,9 @@ function checkPackageJson(cwd) {
150
161
  * @returns Detected project type
151
162
  */
152
163
  export function detectProjectType(cwd) {
164
+ // Check for CLI tool indicators first (has bin/ directory)
165
+ const hasCliFiles = CLI_INDICATORS.some((f) => fileExists(cwd, f));
166
+ const hasBinDir = fs.existsSync(path.join(cwd, "bin"));
153
167
  // Check for file indicators
154
168
  const hasFrontendFiles = FRONTEND_INDICATORS.some((f) => fileExists(cwd, f));
155
169
  const hasBackendFiles = BACKEND_INDICATORS.some((f) => fileExists(cwd, f));
@@ -157,6 +171,10 @@ export function detectProjectType(cwd) {
157
171
  const { hasFrontend: hasFrontendDeps, hasBackend: hasBackendDeps } = checkPackageJson(cwd);
158
172
  const isFrontend = hasFrontendFiles || hasFrontendDeps;
159
173
  const isBackend = hasBackendFiles || hasBackendDeps;
174
+ // CLI tool detection: has bin/ directory but no frontend/backend indicators
175
+ if ((hasCliFiles || hasBinDir) && !isFrontend && !isBackend) {
176
+ return "cli";
177
+ }
160
178
  if (isFrontend && isBackend) {
161
179
  return "fullstack";
162
180
  }
@@ -181,6 +199,8 @@ export function getProjectTypeDescription(type) {
181
199
  return "Fullstack project (frontend + backend)";
182
200
  case "story":
183
201
  return "Story project (Comic/Novel creation)";
202
+ case "cli":
203
+ return "CLI tool project (command-line interface)";
184
204
  case "unknown":
185
205
  return "Unknown project type (defaults to fullstack)";
186
206
  }