@mindfoldhq/trellis 0.1.1 → 0.1.3
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.
- package/dist/{templates/agents/bodies → .claude/agents}/check.md +7 -0
- package/dist/{templates/agents/bodies → .claude/agents}/debug.md +7 -0
- package/dist/{templates/agents/bodies → .claude/agents}/dispatch.md +11 -8
- package/dist/{templates/agents/bodies → .claude/agents}/implement.md +7 -0
- package/dist/.claude/agents/plan.md +396 -0
- package/dist/{templates/agents/bodies → .claude/agents}/research.md +7 -0
- package/dist/{templates/commands/common/check-cross-layer.txt → .claude/commands/check-cross-layer.md} +29 -29
- package/dist/{templates → .claude}/hooks/inject-subagent-context.py +63 -0
- package/dist/.cursor/commands/before-backend-dev.md +13 -0
- package/dist/.cursor/commands/before-frontend-dev.md +13 -0
- package/dist/.cursor/commands/break-loop.md +107 -0
- package/dist/.cursor/commands/check-backend.md +13 -0
- package/dist/.cursor/commands/check-cross-layer.md +153 -0
- package/dist/.cursor/commands/check-frontend.md +13 -0
- package/dist/.cursor/commands/create-command.md +154 -0
- package/dist/.cursor/commands/finish-work.md +129 -0
- package/dist/.cursor/commands/integrate-skill.md +219 -0
- package/dist/.cursor/commands/onboard-developer.md +355 -0
- package/dist/.cursor/commands/record-agent-flow.md +62 -0
- package/dist/.trellis/scripts/common/phase.sh +150 -0
- package/dist/{templates/scripts/feature.sh.txt → .trellis/scripts/feature.sh} +8 -3
- package/dist/{templates/scripts/multi-agent/cleanup.sh.txt → .trellis/scripts/multi-agent/cleanup.sh} +107 -18
- package/dist/.trellis/scripts/multi-agent/create-pr.sh +241 -0
- package/dist/.trellis/scripts/multi-agent/plan.sh +232 -0
- package/dist/{templates/scripts/multi-agent/start.sh.txt → .trellis/scripts/multi-agent/start.sh} +21 -0
- package/dist/{templates/scripts/multi-agent/status.sh.txt → .trellis/scripts/multi-agent/status.sh} +282 -10
- package/dist/.trellis/structure/backend/database-guidelines.md +51 -0
- package/dist/.trellis/structure/backend/directory-structure.md +209 -0
- package/dist/.trellis/structure/backend/error-handling.md +278 -0
- package/dist/.trellis/structure/backend/index.md +38 -0
- package/dist/.trellis/structure/backend/logging-guidelines.md +266 -0
- package/dist/.trellis/structure/backend/quality-guidelines.md +313 -0
- package/dist/.trellis/structure/frontend/component-guidelines.md +59 -0
- package/dist/.trellis/structure/frontend/directory-structure.md +54 -0
- package/dist/.trellis/structure/frontend/hook-guidelines.md +51 -0
- package/dist/.trellis/structure/frontend/index.md +39 -0
- package/dist/.trellis/structure/frontend/quality-guidelines.md +51 -0
- package/dist/.trellis/structure/frontend/state-management.md +51 -0
- package/dist/.trellis/structure/frontend/type-safety.md +51 -0
- package/dist/.trellis/structure/guides/code-reuse-thinking-guide.md +92 -0
- package/dist/.trellis/structure/guides/cross-layer-thinking-guide.md +94 -0
- package/dist/.trellis/structure/guides/index.md +79 -0
- package/dist/{templates/scripts/worktree.yaml.txt → .trellis/worktree.yaml} +1 -1
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +5 -16
- package/dist/commands/init.js.map +1 -1
- package/dist/configurators/claude.d.ts +17 -17
- package/dist/configurators/claude.d.ts.map +1 -1
- package/dist/configurators/claude.js +29 -59
- package/dist/configurators/claude.js.map +1 -1
- package/dist/configurators/cursor.d.ts +3 -3
- package/dist/configurators/cursor.d.ts.map +1 -1
- package/dist/configurators/cursor.js +11 -15
- package/dist/configurators/cursor.js.map +1 -1
- package/dist/configurators/opencode.d.ts +11 -10
- package/dist/configurators/opencode.d.ts.map +1 -1
- package/dist/configurators/opencode.js +14 -33
- package/dist/configurators/opencode.js.map +1 -1
- package/dist/configurators/workflow.d.ts +7 -0
- package/dist/configurators/workflow.d.ts.map +1 -1
- package/dist/configurators/workflow.js +30 -99
- package/dist/configurators/workflow.js.map +1 -1
- package/dist/templates/extract.d.ts +73 -8
- package/dist/templates/extract.d.ts.map +1 -1
- package/dist/templates/extract.js +149 -10
- package/dist/templates/extract.js.map +1 -1
- package/dist/templates/markdown/gitignore.txt +6 -1
- package/dist/templates/markdown/index.d.ts +5 -1
- package/dist/templates/markdown/index.d.ts.map +1 -1
- package/dist/templates/markdown/index.js +54 -26
- package/dist/templates/markdown/index.js.map +1 -1
- package/dist/templates/markdown/structure/backend/directory-structure.md.txt +6 -6
- package/dist/templates/markdown/structure/backend/error-handling.md.txt +8 -8
- package/dist/templates/markdown/structure/backend/index.md.txt +5 -5
- package/dist/templates/markdown/structure/backend/logging-guidelines.md.txt +8 -8
- package/dist/templates/markdown/structure/frontend/index.md.txt +6 -6
- package/dist/templates/markdown/structure/guides/cross-layer-thinking-guide.md.txt +5 -5
- package/dist/templates/markdown/structure/guides/index.md.txt +7 -7
- package/dist/templates/markdown/worktree.yaml.txt +58 -0
- package/package.json +1 -1
- package/dist/configurators/templates.d.ts +0 -40
- package/dist/configurators/templates.d.ts.map +0 -1
- package/dist/configurators/templates.js +0 -67
- package/dist/configurators/templates.js.map +0 -1
- package/dist/templates/agents/index.d.ts +0 -42
- package/dist/templates/agents/index.d.ts.map +0 -1
- package/dist/templates/agents/index.js +0 -148
- package/dist/templates/agents/index.js.map +0 -1
- package/dist/templates/agents/metadata.d.ts +0 -48
- package/dist/templates/agents/metadata.d.ts.map +0 -1
- package/dist/templates/agents/metadata.js +0 -101
- package/dist/templates/agents/metadata.js.map +0 -1
- package/dist/templates/commands/index.d.ts +0 -48
- package/dist/templates/commands/index.d.ts.map +0 -1
- package/dist/templates/commands/index.js +0 -167
- package/dist/templates/commands/index.js.map +0 -1
- package/dist/templates/commands/opencode/start.md.txt +0 -127
- package/dist/templates/hooks/index.d.ts +0 -33
- package/dist/templates/hooks/index.d.ts.map +0 -1
- package/dist/templates/hooks/index.js +0 -53
- package/dist/templates/hooks/index.js.map +0 -1
- package/dist/templates/scripts/index.d.ts +0 -36
- package/dist/templates/scripts/index.d.ts.map +0 -1
- package/dist/templates/scripts/index.js +0 -41
- package/dist/templates/scripts/index.js.map +0 -1
- /package/dist/{templates/commands/common/before-backend-dev.txt → .claude/commands/before-backend-dev.md} +0 -0
- /package/dist/{templates/commands/common/before-frontend-dev.txt → .claude/commands/before-frontend-dev.md} +0 -0
- /package/dist/{templates/commands/common/break-loop.txt → .claude/commands/break-loop.md} +0 -0
- /package/dist/{templates/commands/common/check-backend.txt → .claude/commands/check-backend.md} +0 -0
- /package/dist/{templates/commands/common/check-frontend.txt → .claude/commands/check-frontend.md} +0 -0
- /package/dist/{templates/commands/common/create-command.txt → .claude/commands/create-command.md} +0 -0
- /package/dist/{templates/commands/common/finish-work.txt → .claude/commands/finish-work.md} +0 -0
- /package/dist/{templates/commands/common/integrate-skill.txt → .claude/commands/integrate-skill.md} +0 -0
- /package/dist/{templates/commands/common/onboard-developer.txt → .claude/commands/onboard-developer.md} +0 -0
- /package/dist/{templates/commands/claude/parallel.md.txt → .claude/commands/parallel.md} +0 -0
- /package/dist/{templates/commands/common/record-agent-flow.txt → .claude/commands/record-agent-flow.md} +0 -0
- /package/dist/{templates/commands/claude/start.md.txt → .claude/commands/start.md} +0 -0
- /package/dist/{templates/hooks → .claude}/settings.json +0 -0
- /package/dist/{templates/commands/cursor/start.md.txt → .cursor/commands/start.md} +0 -0
- /package/dist/{templates/markdown/agent-traces-index.md.txt → .trellis/agent-traces/index.md} +0 -0
- /package/dist/{templates/scripts/add-session.sh.txt → .trellis/scripts/add-session.sh} +0 -0
- /package/dist/{templates/scripts/common/developer.sh.txt → .trellis/scripts/common/developer.sh} +0 -0
- /package/dist/{templates/scripts/common/git-context.sh.txt → .trellis/scripts/common/git-context.sh} +0 -0
- /package/dist/{templates/scripts/common/paths.sh.txt → .trellis/scripts/common/paths.sh} +0 -0
- /package/dist/{templates/scripts/common/worktree.sh.txt → .trellis/scripts/common/worktree.sh} +0 -0
- /package/dist/{templates/scripts/create-bootstrap.sh.txt → .trellis/scripts/create-bootstrap.sh} +0 -0
- /package/dist/{templates/scripts/get-context.sh.txt → .trellis/scripts/get-context.sh} +0 -0
- /package/dist/{templates/scripts/get-developer.sh.txt → .trellis/scripts/get-developer.sh} +0 -0
- /package/dist/{templates/scripts/init-developer.sh.txt → .trellis/scripts/init-developer.sh} +0 -0
- /package/dist/{templates/markdown/workflow.md.txt → .trellis/workflow.md} +0 -0
- /package/dist/templates/markdown/{agents.md.txt → agents.md} +0 -0
- /package/dist/templates/markdown/{init-agent.md.txt → init-agent.md} +0 -0
|
@@ -0,0 +1,266 @@
|
|
|
1
|
+
# Logging Guidelines
|
|
2
|
+
|
|
3
|
+
> How console output and logging is done in this CLI project.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
This CLI project uses **chalk** for colored console output. Since this is a user-facing CLI tool, we use `console.log()` and `console.error()` directly rather than a structured logging library. Output follows consistent color conventions to help users quickly understand the nature of each message.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Color Conventions
|
|
14
|
+
|
|
15
|
+
| Color | Chalk Method | Usage | Example |
|
|
16
|
+
|-------|--------------|-------|---------|
|
|
17
|
+
| **Cyan** | `chalk.cyan()` | Headers, banners, section titles | `"Next steps:"` |
|
|
18
|
+
| **Blue** | `chalk.blue()` | Action in progress, step indicators | `"Creating workflow structure..."` |
|
|
19
|
+
| **Green** | `chalk.green()` | Success messages | `"Trellis initialized successfully!"` |
|
|
20
|
+
| **Yellow** | `chalk.yellow()` | Warnings, coming soon, skipped items | `"Coming soon: update command"` |
|
|
21
|
+
| **Red** | `chalk.red()` | Errors | `"Error:"` prefix |
|
|
22
|
+
| **Gray** | `chalk.gray()` | Secondary info, hints, paths | Descriptions, file paths |
|
|
23
|
+
| **White** | `chalk.white()` | Highlighted inline text | Commands to run |
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Message Patterns
|
|
28
|
+
|
|
29
|
+
### Section Headers (Cyan)
|
|
30
|
+
|
|
31
|
+
```typescript
|
|
32
|
+
console.log(chalk.cyan("Next steps:"));
|
|
33
|
+
console.log(chalk.cyan("Generated structure files:"));
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
### Progress Steps (Blue with Emoji)
|
|
37
|
+
|
|
38
|
+
```typescript
|
|
39
|
+
console.log(chalk.blue("📁 Creating workflow structure..."));
|
|
40
|
+
console.log(chalk.blue("📝 Configuring Cursor commands..."));
|
|
41
|
+
console.log(chalk.blue("🤖 Configuring Multi-Agent Pipeline..."));
|
|
42
|
+
console.log(chalk.blue("📄 Created init-agent.md"));
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
### Sub-steps (Gray with Indentation)
|
|
46
|
+
|
|
47
|
+
```typescript
|
|
48
|
+
console.log(chalk.gray(" - Creating agent configurations..."));
|
|
49
|
+
console.log(chalk.gray(" - Creating hook configurations..."));
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Success (Green with Emoji)
|
|
53
|
+
|
|
54
|
+
```typescript
|
|
55
|
+
console.log(chalk.green("\n✅ Trellis initialized successfully!\n"));
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### Warnings (Yellow with Emoji)
|
|
59
|
+
|
|
60
|
+
```typescript
|
|
61
|
+
console.log(chalk.yellow("Coming soon: update command"));
|
|
62
|
+
console.log(chalk.yellow("No tools selected. At least one tool is required."));
|
|
63
|
+
console.log(chalk.yellow(`⚠️ Failed to initialize developer: ${message}`));
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Errors (Red)
|
|
67
|
+
|
|
68
|
+
```typescript
|
|
69
|
+
console.error(
|
|
70
|
+
chalk.red("Error:"),
|
|
71
|
+
error instanceof Error ? error.message : error,
|
|
72
|
+
);
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
### Informational (Mixed Colors)
|
|
76
|
+
|
|
77
|
+
```typescript
|
|
78
|
+
// Key-value pairs
|
|
79
|
+
console.log(chalk.blue("👤 Developer:"), chalk.gray(developerName));
|
|
80
|
+
console.log(chalk.blue("🔍 Project type:"), chalk.gray(projectDescription));
|
|
81
|
+
|
|
82
|
+
// Instructions with highlighted commands
|
|
83
|
+
console.log(
|
|
84
|
+
chalk.gray(`${stepNum}. Use `) +
|
|
85
|
+
chalk.white("/start") +
|
|
86
|
+
chalk.gray(" command in your AI tool to begin a session"),
|
|
87
|
+
);
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Output Structure
|
|
93
|
+
|
|
94
|
+
### Banner and Introduction
|
|
95
|
+
|
|
96
|
+
```typescript
|
|
97
|
+
// ASCII art banner (cyan)
|
|
98
|
+
const banner = figlet.textSync("Trellis", { font: "Rebel" });
|
|
99
|
+
console.log(chalk.cyan(`\n${banner.trimEnd()}`));
|
|
100
|
+
|
|
101
|
+
// Tagline (gray)
|
|
102
|
+
console.log(chalk.gray("\n AI-assisted development workflow framework\n"));
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
### Progress Output
|
|
106
|
+
|
|
107
|
+
```typescript
|
|
108
|
+
// Mode indicator
|
|
109
|
+
console.log(chalk.gray("Mode: Force overwrite existing files\n"));
|
|
110
|
+
|
|
111
|
+
// Detection results
|
|
112
|
+
console.log(chalk.blue("👤 Developer:"), chalk.gray(developerName));
|
|
113
|
+
console.log(chalk.blue("🔍 Project type:"), chalk.gray(description));
|
|
114
|
+
|
|
115
|
+
// Configuration summary
|
|
116
|
+
console.log(chalk.gray(`\nConfiguring: ${tools.join(", ")}`));
|
|
117
|
+
console.log(chalk.gray(`Project type: ${typeDescription}\n`));
|
|
118
|
+
|
|
119
|
+
// Step progress
|
|
120
|
+
console.log(chalk.blue("📁 Creating workflow structure..."));
|
|
121
|
+
console.log(chalk.blue("📝 Configuring Cursor commands..."));
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Completion Summary
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
// Success message
|
|
128
|
+
console.log(chalk.green("\n✅ Trellis initialized successfully!\n"));
|
|
129
|
+
|
|
130
|
+
// Next steps
|
|
131
|
+
console.log(chalk.cyan("Next steps:"));
|
|
132
|
+
console.log(
|
|
133
|
+
chalk.gray(`1. Use `) +
|
|
134
|
+
chalk.white("/start") +
|
|
135
|
+
chalk.gray(" command in your AI tool"),
|
|
136
|
+
);
|
|
137
|
+
|
|
138
|
+
// Generated files
|
|
139
|
+
console.log(chalk.cyan("Generated structure files:"));
|
|
140
|
+
console.log(chalk.gray(` ${PATHS.STRUCTURE}/guides/ - Thinking guides`));
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Emoji Usage
|
|
146
|
+
|
|
147
|
+
| Emoji | Usage |
|
|
148
|
+
|-------|-------|
|
|
149
|
+
| 📁 | Directory/folder operations |
|
|
150
|
+
| 📝 | Configuration/file writing |
|
|
151
|
+
| 📄 | Single file creation |
|
|
152
|
+
| 🤖 | AI/agent related |
|
|
153
|
+
| 👤 | User/developer related |
|
|
154
|
+
| 🔍 | Detection/analysis |
|
|
155
|
+
| ✅ | Success completion |
|
|
156
|
+
| ⚠️ | Warnings |
|
|
157
|
+
|
|
158
|
+
---
|
|
159
|
+
|
|
160
|
+
## Indentation
|
|
161
|
+
|
|
162
|
+
Use indentation to show hierarchy:
|
|
163
|
+
|
|
164
|
+
```typescript
|
|
165
|
+
// Top level (no indent)
|
|
166
|
+
console.log(chalk.blue("🤖 Configuring Multi-Agent Pipeline..."));
|
|
167
|
+
|
|
168
|
+
// Sub-level (3 spaces + dash)
|
|
169
|
+
console.log(chalk.gray(" - Creating agent configurations..."));
|
|
170
|
+
console.log(chalk.gray(" - Creating hook configurations..."));
|
|
171
|
+
|
|
172
|
+
// File listings (2 spaces)
|
|
173
|
+
console.log(chalk.gray(` ${PATHS.STRUCTURE}/guides/ - Thinking guides`));
|
|
174
|
+
console.log(chalk.gray(` ${PATHS.STRUCTURE}/frontend/ - Frontend guidelines`));
|
|
175
|
+
```
|
|
176
|
+
|
|
177
|
+
---
|
|
178
|
+
|
|
179
|
+
## DO / DON'T
|
|
180
|
+
|
|
181
|
+
### DO
|
|
182
|
+
|
|
183
|
+
- Use `chalk` for all colored output
|
|
184
|
+
- Follow the color convention consistently
|
|
185
|
+
- Use emojis for visual scanning (sparingly)
|
|
186
|
+
- Use indentation to show hierarchy
|
|
187
|
+
- Add blank lines between sections for readability
|
|
188
|
+
- Use `console.error()` for errors
|
|
189
|
+
|
|
190
|
+
### DON'T
|
|
191
|
+
|
|
192
|
+
- Don't use raw ANSI escape codes
|
|
193
|
+
- Don't mix color meanings (e.g., red for non-error)
|
|
194
|
+
- Don't overuse emojis
|
|
195
|
+
- Don't log sensitive information (paths with usernames excepted for context)
|
|
196
|
+
- Don't use `console.log()` for errors (use `console.error()`)
|
|
197
|
+
- Don't output debug information in production
|
|
198
|
+
|
|
199
|
+
---
|
|
200
|
+
|
|
201
|
+
## Examples
|
|
202
|
+
|
|
203
|
+
### Complete Init Output Flow
|
|
204
|
+
|
|
205
|
+
```typescript
|
|
206
|
+
// 1. Banner
|
|
207
|
+
console.log(chalk.cyan(`\n${banner.trimEnd()}`));
|
|
208
|
+
console.log(chalk.gray("\n AI-assisted development workflow framework\n"));
|
|
209
|
+
|
|
210
|
+
// 2. Mode (if special mode)
|
|
211
|
+
if (options.force) {
|
|
212
|
+
console.log(chalk.gray("Mode: Force overwrite existing files\n"));
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// 3. Detection results
|
|
216
|
+
console.log(chalk.blue("👤 Developer:"), chalk.gray(developerName));
|
|
217
|
+
console.log(chalk.blue("🔍 Project type:"), chalk.gray(typeDescription));
|
|
218
|
+
|
|
219
|
+
// 4. Configuration summary
|
|
220
|
+
console.log(chalk.gray(`\nConfiguring: ${tools.join(", ")}\n`));
|
|
221
|
+
|
|
222
|
+
// 5. Progress steps
|
|
223
|
+
console.log(chalk.blue("📁 Creating workflow structure..."));
|
|
224
|
+
console.log(chalk.blue("📝 Configuring Cursor commands..."));
|
|
225
|
+
console.log(chalk.blue("🤖 Configuring Multi-Agent Pipeline..."));
|
|
226
|
+
console.log(chalk.gray(" - Creating agent configurations..."));
|
|
227
|
+
|
|
228
|
+
// 6. Success
|
|
229
|
+
console.log(chalk.green("\n✅ Trellis initialized successfully!\n"));
|
|
230
|
+
|
|
231
|
+
// 7. Next steps
|
|
232
|
+
console.log(chalk.cyan("Next steps:"));
|
|
233
|
+
console.log(
|
|
234
|
+
chalk.gray("1. Use ") +
|
|
235
|
+
chalk.white("/start") +
|
|
236
|
+
chalk.gray(" command to begin"),
|
|
237
|
+
);
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
### Error Output
|
|
241
|
+
|
|
242
|
+
```typescript
|
|
243
|
+
try {
|
|
244
|
+
await init(options);
|
|
245
|
+
} catch (error) {
|
|
246
|
+
console.error(
|
|
247
|
+
chalk.red("Error:"),
|
|
248
|
+
error instanceof Error ? error.message : error,
|
|
249
|
+
);
|
|
250
|
+
process.exit(1);
|
|
251
|
+
}
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
### Warning Output
|
|
255
|
+
|
|
256
|
+
```typescript
|
|
257
|
+
// Non-critical warning
|
|
258
|
+
console.log(
|
|
259
|
+
chalk.yellow(
|
|
260
|
+
`⚠️ Failed to initialize developer: ${message}`,
|
|
261
|
+
),
|
|
262
|
+
);
|
|
263
|
+
|
|
264
|
+
// Coming soon feature
|
|
265
|
+
console.log(chalk.yellow("Coming soon: update command"));
|
|
266
|
+
```
|
|
@@ -0,0 +1,313 @@
|
|
|
1
|
+
# Quality Guidelines
|
|
2
|
+
|
|
3
|
+
> Code quality standards for backend/CLI development.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
This project enforces strict TypeScript and ESLint rules to maintain code quality. The configuration prioritizes type safety, explicit declarations, and modern JavaScript patterns.
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## TypeScript Configuration
|
|
14
|
+
|
|
15
|
+
### Strict Mode
|
|
16
|
+
|
|
17
|
+
The project uses `strict: true` in `tsconfig.json`:
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
{
|
|
21
|
+
"compilerOptions": {
|
|
22
|
+
"strict": true,
|
|
23
|
+
"target": "ES2022",
|
|
24
|
+
"module": "NodeNext",
|
|
25
|
+
"moduleResolution": "NodeNext"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This enables:
|
|
31
|
+
- `strictNullChecks` - Null and undefined must be explicitly handled
|
|
32
|
+
- `strictFunctionTypes` - Function parameter types are checked strictly
|
|
33
|
+
- `strictPropertyInitialization` - Class properties must be initialized
|
|
34
|
+
- `noImplicitAny` - All types must be explicit
|
|
35
|
+
- `noImplicitThis` - `this` must have explicit type
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## ESLint Rules
|
|
40
|
+
|
|
41
|
+
### Forbidden Patterns
|
|
42
|
+
|
|
43
|
+
| Rule | Setting | Reason |
|
|
44
|
+
|------|---------|--------|
|
|
45
|
+
| `@typescript-eslint/no-explicit-any` | `error` | Forces proper typing |
|
|
46
|
+
| `@typescript-eslint/no-non-null-assertion` | `error` | Prevents runtime null errors |
|
|
47
|
+
| `no-var` | `error` | Use `const` or `let` instead |
|
|
48
|
+
|
|
49
|
+
### Required Patterns
|
|
50
|
+
|
|
51
|
+
| Rule | Setting | Description |
|
|
52
|
+
|------|---------|-------------|
|
|
53
|
+
| `@typescript-eslint/explicit-function-return-type` | `error` | All functions must declare return type |
|
|
54
|
+
| `@typescript-eslint/prefer-nullish-coalescing` | `error` | Use `??` instead of `\|\|` for defaults |
|
|
55
|
+
| `@typescript-eslint/prefer-optional-chain` | `error` | Use `?.` for optional access |
|
|
56
|
+
| `prefer-const` | `error` | Use `const` when variable is not reassigned |
|
|
57
|
+
|
|
58
|
+
### Exceptions
|
|
59
|
+
|
|
60
|
+
```javascript
|
|
61
|
+
// eslint.config.js
|
|
62
|
+
rules: {
|
|
63
|
+
"@typescript-eslint/explicit-function-return-type": [
|
|
64
|
+
"error",
|
|
65
|
+
{
|
|
66
|
+
allowExpressions: true, // Arrow functions in callbacks OK
|
|
67
|
+
allowTypedFunctionExpressions: true, // Typed function expressions OK
|
|
68
|
+
},
|
|
69
|
+
],
|
|
70
|
+
"@typescript-eslint/no-unused-vars": [
|
|
71
|
+
"error",
|
|
72
|
+
{
|
|
73
|
+
argsIgnorePattern: "^_", // Prefix unused params with _
|
|
74
|
+
varsIgnorePattern: "^_", // Prefix unused vars with _
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
}
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Code Patterns
|
|
83
|
+
|
|
84
|
+
### Return Type Declarations
|
|
85
|
+
|
|
86
|
+
All functions must have explicit return types:
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
// Good: Explicit return type
|
|
90
|
+
function detectProjectType(cwd: string): ProjectType {
|
|
91
|
+
// ...
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
async function init(options: InitOptions): Promise<void> {
|
|
95
|
+
// ...
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
// Bad: Missing return type (ESLint error)
|
|
99
|
+
function detectProjectType(cwd: string) {
|
|
100
|
+
// ...
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Nullish Coalescing
|
|
105
|
+
|
|
106
|
+
Use `??` for default values, not `||`:
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
// Good: Nullish coalescing
|
|
110
|
+
const name = options.name ?? "default";
|
|
111
|
+
const allDeps = { ...pkg.dependencies, ...pkg.devDependencies };
|
|
112
|
+
const depNames = Object.keys(allDeps ?? {});
|
|
113
|
+
|
|
114
|
+
// Bad: Logical OR (treats empty string, 0 as falsy)
|
|
115
|
+
const name = options.name || "default";
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### Optional Chaining
|
|
119
|
+
|
|
120
|
+
Use `?.` for optional property access:
|
|
121
|
+
|
|
122
|
+
```typescript
|
|
123
|
+
// Good: Optional chaining
|
|
124
|
+
const version = config?.version;
|
|
125
|
+
const deps = pkg?.dependencies?.["react"];
|
|
126
|
+
|
|
127
|
+
// Bad: Manual checks
|
|
128
|
+
const version = config && config.version;
|
|
129
|
+
```
|
|
130
|
+
|
|
131
|
+
### Const Declarations
|
|
132
|
+
|
|
133
|
+
Use `const` by default, `let` only when reassignment is needed:
|
|
134
|
+
|
|
135
|
+
```typescript
|
|
136
|
+
// Good: const for non-reassigned
|
|
137
|
+
const cwd = process.cwd();
|
|
138
|
+
const options: InitOptions = { force: true };
|
|
139
|
+
|
|
140
|
+
// Good: let for reassigned
|
|
141
|
+
let developerName = options.user;
|
|
142
|
+
if (!developerName) {
|
|
143
|
+
developerName = detectFromGit();
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
// Bad: let for non-reassigned
|
|
147
|
+
let cwd = process.cwd(); // ESLint error: prefer-const
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
### Unused Variables
|
|
151
|
+
|
|
152
|
+
Prefix unused parameters with underscore:
|
|
153
|
+
|
|
154
|
+
```typescript
|
|
155
|
+
// Good: Prefixed with underscore
|
|
156
|
+
function handler(_req: Request, res: Response): void {
|
|
157
|
+
res.send("OK");
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
// Bad: Unused without prefix (ESLint error)
|
|
161
|
+
function handler(req: Request, res: Response): void {
|
|
162
|
+
res.send("OK");
|
|
163
|
+
}
|
|
164
|
+
```
|
|
165
|
+
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
## Interface and Type Patterns
|
|
169
|
+
|
|
170
|
+
### Interface Definitions
|
|
171
|
+
|
|
172
|
+
Define interfaces for structured data:
|
|
173
|
+
|
|
174
|
+
```typescript
|
|
175
|
+
// Good: Interface for options
|
|
176
|
+
interface InitOptions {
|
|
177
|
+
cursor?: boolean;
|
|
178
|
+
claude?: boolean;
|
|
179
|
+
yes?: boolean;
|
|
180
|
+
user?: string;
|
|
181
|
+
force?: boolean;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Good: Interface for return types
|
|
185
|
+
interface WriteOptions {
|
|
186
|
+
mode: WriteMode;
|
|
187
|
+
}
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Type Aliases
|
|
191
|
+
|
|
192
|
+
Use type aliases for unions and computed types:
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
// Good: Type alias for union
|
|
196
|
+
export type AITool = "claude-code" | "cursor" | "opencode";
|
|
197
|
+
export type WriteMode = "ask" | "force" | "skip" | "append";
|
|
198
|
+
export type ProjectType = "frontend" | "backend" | "fullstack" | "unknown";
|
|
199
|
+
|
|
200
|
+
// Good: Type alias with const assertion
|
|
201
|
+
export const DIR_NAMES = {
|
|
202
|
+
WORKFLOW: ".trellis",
|
|
203
|
+
PROGRESS: "agent-traces",
|
|
204
|
+
} as const;
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
### Export Patterns
|
|
208
|
+
|
|
209
|
+
Export types explicitly:
|
|
210
|
+
|
|
211
|
+
```typescript
|
|
212
|
+
// Good: Explicit type export
|
|
213
|
+
export type { WriteMode, WriteOptions };
|
|
214
|
+
export { writeFile, ensureDir };
|
|
215
|
+
|
|
216
|
+
// Good: Combined export
|
|
217
|
+
export type WriteMode = "ask" | "force" | "skip" | "append";
|
|
218
|
+
export function writeFile(path: string, content: string): Promise<boolean> {
|
|
219
|
+
// ...
|
|
220
|
+
}
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
---
|
|
224
|
+
|
|
225
|
+
## Forbidden Patterns
|
|
226
|
+
|
|
227
|
+
### Never Use `any`
|
|
228
|
+
|
|
229
|
+
```typescript
|
|
230
|
+
// Bad: Explicit any
|
|
231
|
+
function process(data: any): void { }
|
|
232
|
+
|
|
233
|
+
// Good: Proper typing
|
|
234
|
+
function process(data: Record<string, unknown>): void { }
|
|
235
|
+
function process<T>(data: T): void { }
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
### Never Use Non-Null Assertion
|
|
239
|
+
|
|
240
|
+
```typescript
|
|
241
|
+
// Bad: Non-null assertion
|
|
242
|
+
const name = user!.name;
|
|
243
|
+
|
|
244
|
+
// Good: Proper null check
|
|
245
|
+
const name = user?.name ?? "default";
|
|
246
|
+
if (user) {
|
|
247
|
+
const name = user.name;
|
|
248
|
+
}
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### Never Use `var`
|
|
252
|
+
|
|
253
|
+
```typescript
|
|
254
|
+
// Bad: var declaration
|
|
255
|
+
var count = 0;
|
|
256
|
+
|
|
257
|
+
// Good: const or let
|
|
258
|
+
const count = 0;
|
|
259
|
+
let mutableCount = 0;
|
|
260
|
+
```
|
|
261
|
+
|
|
262
|
+
---
|
|
263
|
+
|
|
264
|
+
## Quality Checklist
|
|
265
|
+
|
|
266
|
+
Before committing, ensure:
|
|
267
|
+
|
|
268
|
+
- [ ] `pnpm lint` passes with no errors
|
|
269
|
+
- [ ] `pnpm typecheck` passes with no errors
|
|
270
|
+
- [ ] All functions have explicit return types
|
|
271
|
+
- [ ] No `any` types in code
|
|
272
|
+
- [ ] No non-null assertions (`!`)
|
|
273
|
+
- [ ] Using `??` instead of `||` for defaults
|
|
274
|
+
- [ ] Using `?.` for optional property access
|
|
275
|
+
- [ ] Using `const` by default, `let` only when needed
|
|
276
|
+
- [ ] Unused variables prefixed with `_`
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Running Quality Checks
|
|
281
|
+
|
|
282
|
+
```bash
|
|
283
|
+
# Run ESLint
|
|
284
|
+
pnpm lint
|
|
285
|
+
|
|
286
|
+
# Run TypeScript type checking
|
|
287
|
+
pnpm typecheck
|
|
288
|
+
|
|
289
|
+
# Run both
|
|
290
|
+
pnpm lint && pnpm typecheck
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
---
|
|
294
|
+
|
|
295
|
+
## DO / DON'T
|
|
296
|
+
|
|
297
|
+
### DO
|
|
298
|
+
|
|
299
|
+
- Declare explicit return types on all functions
|
|
300
|
+
- Use `const` by default
|
|
301
|
+
- Use `??` for default values
|
|
302
|
+
- Use `?.` for optional access
|
|
303
|
+
- Define interfaces for structured data
|
|
304
|
+
- Prefix unused parameters with `_`
|
|
305
|
+
|
|
306
|
+
### DON'T
|
|
307
|
+
|
|
308
|
+
- Don't use `any` type
|
|
309
|
+
- Don't use non-null assertion (`!`)
|
|
310
|
+
- Don't use `var`
|
|
311
|
+
- Don't use `||` for default values (use `??`)
|
|
312
|
+
- Don't leave implicit return types
|
|
313
|
+
- Don't ignore ESLint or TypeScript errors
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# Component Guidelines
|
|
2
|
+
|
|
3
|
+
> How components are built in this project.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
<!--
|
|
10
|
+
Document your project's component conventions here.
|
|
11
|
+
|
|
12
|
+
Questions to answer:
|
|
13
|
+
- What component patterns do you use?
|
|
14
|
+
- How are props defined?
|
|
15
|
+
- How do you handle composition?
|
|
16
|
+
- What accessibility standards apply?
|
|
17
|
+
-->
|
|
18
|
+
|
|
19
|
+
(To be filled by the team)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Component Structure
|
|
24
|
+
|
|
25
|
+
<!-- Standard structure of a component file -->
|
|
26
|
+
|
|
27
|
+
(To be filled by the team)
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Props Conventions
|
|
32
|
+
|
|
33
|
+
<!-- How props should be defined and typed -->
|
|
34
|
+
|
|
35
|
+
(To be filled by the team)
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Styling Patterns
|
|
40
|
+
|
|
41
|
+
<!-- How styles are applied (CSS modules, styled-components, Tailwind, etc.) -->
|
|
42
|
+
|
|
43
|
+
(To be filled by the team)
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Accessibility
|
|
48
|
+
|
|
49
|
+
<!-- A11y requirements and patterns -->
|
|
50
|
+
|
|
51
|
+
(To be filled by the team)
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
## Common Mistakes
|
|
56
|
+
|
|
57
|
+
<!-- Component-related mistakes your team has made -->
|
|
58
|
+
|
|
59
|
+
(To be filled by the team)
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Directory Structure
|
|
2
|
+
|
|
3
|
+
> How frontend code is organized in this project.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Overview
|
|
8
|
+
|
|
9
|
+
<!--
|
|
10
|
+
Document your project's frontend directory structure here.
|
|
11
|
+
|
|
12
|
+
Questions to answer:
|
|
13
|
+
- Where do components live?
|
|
14
|
+
- How are features/modules organized?
|
|
15
|
+
- Where are shared utilities?
|
|
16
|
+
- How are assets organized?
|
|
17
|
+
-->
|
|
18
|
+
|
|
19
|
+
(To be filled by the team)
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## Directory Layout
|
|
24
|
+
|
|
25
|
+
```
|
|
26
|
+
<!-- Replace with your actual structure -->
|
|
27
|
+
src/
|
|
28
|
+
├── ...
|
|
29
|
+
└── ...
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Module Organization
|
|
35
|
+
|
|
36
|
+
<!-- How should new features be organized? -->
|
|
37
|
+
|
|
38
|
+
(To be filled by the team)
|
|
39
|
+
|
|
40
|
+
---
|
|
41
|
+
|
|
42
|
+
## Naming Conventions
|
|
43
|
+
|
|
44
|
+
<!-- File and folder naming rules -->
|
|
45
|
+
|
|
46
|
+
(To be filled by the team)
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Examples
|
|
51
|
+
|
|
52
|
+
<!-- Link to well-organized modules as examples -->
|
|
53
|
+
|
|
54
|
+
(To be filled by the team)
|