fasti 1.0.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.
- checksums.yaml +7 -0
- data/.mcp.json +19 -0
- data/.rspec +3 -0
- data/.rubocop.yml +82 -0
- data/.rubocop_todo.yml +89 -0
- data/.serena/project.yml +68 -0
- data/.simplecov +31 -0
- data/.yardopts +9 -0
- data/AGENTS.md +60 -0
- data/CHANGELOG.md +25 -0
- data/CLAUDE.md +1 -0
- data/LICENSE.txt +21 -0
- data/README.md +416 -0
- data/RELEASING.md +202 -0
- data/Rakefile +34 -0
- data/TODO.md +11 -0
- data/benchmark/holiday_cache_benchmark.rb +111 -0
- data/benchmark/memory_benchmark.rb +86 -0
- data/docs/agents/git-pr.md +298 -0
- data/docs/agents/languages.md +388 -0
- data/docs/agents/rubocop.md +55 -0
- data/docs/plans/positional-arguments.md +303 -0
- data/docs/plans/structured-config.md +232 -0
- data/examples/config.rb +80 -0
- data/exe/fasti +6 -0
- data/lib/fasti/calendar.rb +292 -0
- data/lib/fasti/calendar_transition.rb +266 -0
- data/lib/fasti/cli.rb +550 -0
- data/lib/fasti/config/schema.rb +36 -0
- data/lib/fasti/config/types.rb +66 -0
- data/lib/fasti/config.rb +125 -0
- data/lib/fasti/error.rb +6 -0
- data/lib/fasti/formatter.rb +234 -0
- data/lib/fasti/style_parser.rb +211 -0
- data/lib/fasti/version.rb +6 -0
- data/lib/fasti.rb +21 -0
- data/mise.toml +5 -0
- data/sig/fasti.rbs +4 -0
- metadata +181 -0
@@ -0,0 +1,388 @@
|
|
1
|
+
# Language Guidelines for AI Agents
|
2
|
+
|
3
|
+
> **Note**: This document contains examples in multiple languages (Japanese, English) to demonstrate proper language usage patterns. This is intentional for educational purposes, even though project documentation is normally written in English only.
|
4
|
+
|
5
|
+
This document defines language usage conventions for different contexts within the project.
|
6
|
+
|
7
|
+
## Overview
|
8
|
+
|
9
|
+
The project follows a multilingual approach that balances international accessibility with localized communication effectiveness.
|
10
|
+
|
11
|
+
## Communication Languages
|
12
|
+
|
13
|
+
### AI/Maintainer Chat Communication
|
14
|
+
|
15
|
+
**Rule**: Use the user's preferred language for chat interactions.
|
16
|
+
|
17
|
+
- **When user writes in Japanese**: Respond in Japanese
|
18
|
+
- **When user writes in English**: Respond in English
|
19
|
+
- **When user writes in other languages**: Match their language when possible
|
20
|
+
- **Default fallback**: English for unsupported languages
|
21
|
+
|
22
|
+
**Examples**:
|
23
|
+
```
|
24
|
+
User: "このバグを修正してください"
|
25
|
+
AI: "バグを修正します。まず問題を確認させてください。"
|
26
|
+
|
27
|
+
User: "Fix this bug please"
|
28
|
+
AI: "I'll fix the bug. Let me first identify the issue."
|
29
|
+
```
|
30
|
+
|
31
|
+
**Rationale**: Effective communication in the user's native language improves understanding and reduces miscommunication.
|
32
|
+
|
33
|
+
### Pseudocode and Technical Discussion
|
34
|
+
|
35
|
+
**Rule**: Comments within pseudocode blocks may use the user's language, while the pseudocode structure remains universal.
|
36
|
+
|
37
|
+
**Example**:
|
38
|
+
```ruby
|
39
|
+
# ユーザー認証をチェック
|
40
|
+
def authenticate_user(credentials)
|
41
|
+
# パスワードをハッシュ化して比較
|
42
|
+
if hash_password(credentials.password) == stored_hash
|
43
|
+
# 認証成功
|
44
|
+
return create_session(credentials.user)
|
45
|
+
end
|
46
|
+
|
47
|
+
# 認証失敗
|
48
|
+
raise AuthenticationError
|
49
|
+
end
|
50
|
+
```
|
51
|
+
|
52
|
+
## Code and Documentation Languages
|
53
|
+
|
54
|
+
### Source Code
|
55
|
+
|
56
|
+
**Rule**: All source code MUST be written in English.
|
57
|
+
|
58
|
+
**Applies to**:
|
59
|
+
- Variable names, method names, class names
|
60
|
+
- Function parameters and return values
|
61
|
+
- Inline code comments
|
62
|
+
- Code documentation strings
|
63
|
+
|
64
|
+
**Examples**:
|
65
|
+
```ruby
|
66
|
+
# ✅ Correct
|
67
|
+
def calculate_performance_score(metrics)
|
68
|
+
# Calculate weighted average of performance metrics
|
69
|
+
total_weight = metrics.sum(&:weight)
|
70
|
+
return 0 if total_weight.zero?
|
71
|
+
|
72
|
+
metrics.sum { |metric| metric.value * metric.weight } / total_weight
|
73
|
+
end
|
74
|
+
|
75
|
+
# ❌ Incorrect
|
76
|
+
def パフォーマンス計算(メトリクス)
|
77
|
+
# 重み付き平均を計算
|
78
|
+
合計重み = メトリクス.sum(&:weight)
|
79
|
+
return 0 if 合計重み.zero?
|
80
|
+
|
81
|
+
# ... rest of method
|
82
|
+
end
|
83
|
+
```
|
84
|
+
|
85
|
+
### Documentation
|
86
|
+
|
87
|
+
**Rule**: All documentation MUST be written in English.
|
88
|
+
|
89
|
+
**Applies to**:
|
90
|
+
- README files
|
91
|
+
- YARD documentation comments
|
92
|
+
- API documentation
|
93
|
+
- Code comments explaining complex logic
|
94
|
+
- Markdown files in `docs/` directory
|
95
|
+
|
96
|
+
**Examples**:
|
97
|
+
```ruby
|
98
|
+
# ✅ Correct YARD documentation
|
99
|
+
# Calculates the optimal cache size based on available memory
|
100
|
+
# and expected usage patterns.
|
101
|
+
#
|
102
|
+
# @param available_memory [Integer] Available memory in bytes
|
103
|
+
# @param usage_pattern [Symbol] Expected usage pattern (:light, :moderate, :heavy)
|
104
|
+
# @return [Integer] Recommended cache size in bytes
|
105
|
+
# @raise [ArgumentError] if available_memory is negative
|
106
|
+
def calculate_cache_size(available_memory, usage_pattern)
|
107
|
+
# Implementation...
|
108
|
+
end
|
109
|
+
```
|
110
|
+
|
111
|
+
### Issues and Pull Requests
|
112
|
+
|
113
|
+
**Rule**: Prefer English for titles and descriptions to maximize visibility and collaboration.
|
114
|
+
|
115
|
+
**GitHub Issues**:
|
116
|
+
- **Title**: English preferred
|
117
|
+
- **Description**: English preferred, but user's language acceptable
|
118
|
+
- **Technical details**: English strongly preferred
|
119
|
+
|
120
|
+
**Pull Requests**:
|
121
|
+
- **Title**: English required (follows commit message conventions)
|
122
|
+
- **Description**: English preferred
|
123
|
+
- **Code review comments**: English preferred
|
124
|
+
|
125
|
+
**Examples**:
|
126
|
+
```
|
127
|
+
✅ Preferred
|
128
|
+
Title: Fix performance regression in cache invalidation
|
129
|
+
Description: Resolves issue where cache invalidation was O(n²)...
|
130
|
+
|
131
|
+
✅ Acceptable
|
132
|
+
Title: Fix performance regression in cache invalidation
|
133
|
+
Description: キャッシュ無効化のパフォーマンス問題を修正しました。
|
134
|
+
O(n²)のアルゴリズムをO(n)に改善しています。
|
135
|
+
|
136
|
+
❌ Avoid
|
137
|
+
Title: キャッシュの性能問題を修正
|
138
|
+
Description: [Japanese description]
|
139
|
+
```
|
140
|
+
|
141
|
+
## File and Directory Names
|
142
|
+
|
143
|
+
**Rule**: All file and directory names MUST use English.
|
144
|
+
|
145
|
+
**Applies to**:
|
146
|
+
- Source files: `performance_optimizer.rb`
|
147
|
+
- Test files: `performance_optimizer_spec.rb`
|
148
|
+
- Documentation: `installation_guide.md`
|
149
|
+
- Directories: `lib/`, `spec/`, `docs/`
|
150
|
+
|
151
|
+
**Naming Conventions**:
|
152
|
+
- Use `snake_case` for Ruby files
|
153
|
+
- Use `kebab-case` for markdown files and directories when appropriate
|
154
|
+
- Use descriptive, clear English terms
|
155
|
+
|
156
|
+
## Rationale
|
157
|
+
|
158
|
+
### Why English for Code and Documentation?
|
159
|
+
|
160
|
+
1. **International Collaboration**: English serves as the lingua franca of programming
|
161
|
+
2. **Tool Compatibility**: Most development tools, libraries, and frameworks expect English
|
162
|
+
3. **Maintainability**: Future maintainers from any background can understand the code
|
163
|
+
4. **Professional Standards**: Industry standard practice for open source projects
|
164
|
+
5. **Search and Discovery**: English keywords improve searchability
|
165
|
+
|
166
|
+
### Why User's Language for Communication?
|
167
|
+
|
168
|
+
1. **Clarity**: Complex technical concepts are often better explained in native language
|
169
|
+
2. **Efficiency**: Reduces translation overhead and potential misunderstandings
|
170
|
+
3. **Comfort**: Users feel more comfortable expressing nuanced requirements
|
171
|
+
4. **Cultural Context**: Some concepts don't translate well and need cultural context
|
172
|
+
|
173
|
+
## Implementation Guidelines for AI Agents
|
174
|
+
|
175
|
+
### Language Detection
|
176
|
+
|
177
|
+
Detect user's preferred language from:
|
178
|
+
1. First message language
|
179
|
+
2. Explicit language requests
|
180
|
+
3. Previous interaction history
|
181
|
+
4. Default to English if uncertain
|
182
|
+
|
183
|
+
### Context Switching
|
184
|
+
|
185
|
+
When switching between communication and code:
|
186
|
+
```
|
187
|
+
User: "パフォーマンスを改善したい"
|
188
|
+
AI: "パフォーマンス改善を行います。以下のコードを修正します:"
|
189
|
+
|
190
|
+
```ruby
|
191
|
+
def optimize_performance(data)
|
192
|
+
# Implement performance optimization
|
193
|
+
cached_results = Cache.new
|
194
|
+
# ... English comments and code
|
195
|
+
end
|
196
|
+
```
|
197
|
+
|
198
|
+
AI: "このようにキャッシュを追加してパフォーマンスを向上させました。"
|
199
|
+
```
|
200
|
+
|
201
|
+
### Documentation Generation
|
202
|
+
|
203
|
+
When generating documentation:
|
204
|
+
- Always use English regardless of communication language
|
205
|
+
- Translate technical concepts accurately
|
206
|
+
- Maintain professional technical writing standards
|
207
|
+
- Use objective, factual language without unnecessary embellishment
|
208
|
+
- Avoid competitive comparisons with other products/libraries
|
209
|
+
- Never use aggressive or dismissive language about alternatives
|
210
|
+
- Focus on functionality and benefits rather than superiority claims
|
211
|
+
|
212
|
+
### Chat Communication Style
|
213
|
+
|
214
|
+
When communicating with users in chat:
|
215
|
+
- Use professional, measured language
|
216
|
+
- Avoid excessive enthusiasm or superlatives
|
217
|
+
- Be helpful without being overly effusive
|
218
|
+
- Focus on accuracy and usefulness rather than excitement
|
219
|
+
- Acknowledge completion without dramatic celebration
|
220
|
+
|
221
|
+
## Examples by Context
|
222
|
+
|
223
|
+
### Commit Messages
|
224
|
+
```bash
|
225
|
+
# ✅ Always English
|
226
|
+
git commit -m ":zap: Optimize database query performance
|
227
|
+
|
228
|
+
Reduce N+1 queries by implementing eager loading.
|
229
|
+
- 5x performance improvement
|
230
|
+
- Maintains data consistency
|
231
|
+
|
232
|
+
:robot: Generated with [Agent Name](http://agent.url)
|
233
|
+
Co-Authored-By: Agent Name <agent@email>"
|
234
|
+
```
|
235
|
+
|
236
|
+
**Note**: Replace `[Agent Name]`, `http://agent.url`, and `<agent@email>` with your specific AI agent information.
|
237
|
+
|
238
|
+
### Code Reviews
|
239
|
+
```
|
240
|
+
# ✅ English preferred for broader team understanding
|
241
|
+
"This implementation could benefit from memoization to avoid
|
242
|
+
recalculating expensive operations."
|
243
|
+
|
244
|
+
# ✅ Acceptable if team is primarily Japanese
|
245
|
+
"このメソッドは重い計算を繰り返しているので、メモ化を検討してください。"
|
246
|
+
```
|
247
|
+
|
248
|
+
### Chat Interactions
|
249
|
+
```
|
250
|
+
User: "テストが失敗しているようです"
|
251
|
+
AI: "テストの失敗を確認します。エラーログを見てみましょう。"
|
252
|
+
|
253
|
+
# When writing test code:
|
254
|
+
describe "performance optimization" do
|
255
|
+
it "reduces query time by 50%" do
|
256
|
+
# Test implementation in English
|
257
|
+
end
|
258
|
+
end
|
259
|
+
```
|
260
|
+
|
261
|
+
## Documentation Style Guidelines
|
262
|
+
|
263
|
+
### Avoid Excessive Language
|
264
|
+
|
265
|
+
```markdown
|
266
|
+
❌ Overly dramatic
|
267
|
+
"This amazing, revolutionary feature completely transforms your workflow!"
|
268
|
+
|
269
|
+
✅ Factual and clear
|
270
|
+
"This feature streamlines the authentication process by caching validated tokens."
|
271
|
+
|
272
|
+
❌ Unnecessary superlatives
|
273
|
+
"The world's most powerful, incredibly fast, absolutely best terminal styling library"
|
274
|
+
|
275
|
+
✅ Descriptive without embellishment
|
276
|
+
"A terminal styling library with performance optimization and composable style objects"
|
277
|
+
```
|
278
|
+
|
279
|
+
### Avoid Competitive Comparisons
|
280
|
+
|
281
|
+
```markdown
|
282
|
+
❌ Direct competition attacks
|
283
|
+
"Unlike slow Library X, our solution is blazing fast"
|
284
|
+
"Library Y is outdated and problematic, use this instead"
|
285
|
+
|
286
|
+
✅ Focus on own features
|
287
|
+
"Optimized for performance with 7-18x speed improvements"
|
288
|
+
"Designed with modern Ruby practices and immutable objects"
|
289
|
+
|
290
|
+
❌ Dismissive language
|
291
|
+
"Other libraries fail to provide..."
|
292
|
+
"The broken approach used by..."
|
293
|
+
|
294
|
+
✅ Neutral positioning
|
295
|
+
"This library provides..."
|
296
|
+
"Alternative approach that..."
|
297
|
+
```
|
298
|
+
|
299
|
+
### Maintain Professional Tone
|
300
|
+
|
301
|
+
```markdown
|
302
|
+
❌ Aggressive language
|
303
|
+
"Destroys performance bottlenecks"
|
304
|
+
"Kills the competition"
|
305
|
+
"Obliterates technical debt"
|
306
|
+
|
307
|
+
✅ Professional descriptions
|
308
|
+
"Addresses performance bottlenecks"
|
309
|
+
"Provides competitive performance"
|
310
|
+
"Reduces technical debt"
|
311
|
+
|
312
|
+
❌ Emotional appeals
|
313
|
+
"You'll absolutely love this feature!"
|
314
|
+
"Frustrating bugs are now history!"
|
315
|
+
|
316
|
+
✅ Factual benefits
|
317
|
+
"This feature improves developer experience"
|
318
|
+
"Resolves common integration issues"
|
319
|
+
```
|
320
|
+
|
321
|
+
### Chat Communication Examples
|
322
|
+
|
323
|
+
```
|
324
|
+
❌ Overly enthusiastic
|
325
|
+
"Perfect! Amazing! That's absolutely fantastic!"
|
326
|
+
"This is going to be incredible!"
|
327
|
+
"Wow, that's the best solution ever!"
|
328
|
+
|
329
|
+
✅ Professional acknowledgment
|
330
|
+
"Completed. The changes have been applied."
|
331
|
+
"Good point. I've implemented that approach."
|
332
|
+
"That's been resolved. The tests are now passing."
|
333
|
+
|
334
|
+
❌ Excessive superlatives
|
335
|
+
"This incredibly powerful feature will revolutionize your workflow!"
|
336
|
+
"The absolutely perfect solution for your needs!"
|
337
|
+
|
338
|
+
✅ Measured descriptions
|
339
|
+
"This feature should improve your workflow efficiency."
|
340
|
+
"This approach addresses the requirements you mentioned."
|
341
|
+
|
342
|
+
❌ Dramatic language
|
343
|
+
"I'll completely transform this code!"
|
344
|
+
"Let me totally rebuild this system!"
|
345
|
+
|
346
|
+
✅ Factual descriptions
|
347
|
+
"I'll refactor this code to improve maintainability."
|
348
|
+
"Let me restructure this for better organization."
|
349
|
+
```
|
350
|
+
|
351
|
+
## Common Mistakes to Avoid
|
352
|
+
|
353
|
+
### Mixed Language Code
|
354
|
+
```ruby
|
355
|
+
# ❌ Never mix languages in code
|
356
|
+
def calculate_速度(distance, 時間)
|
357
|
+
return distance / 時間
|
358
|
+
end
|
359
|
+
|
360
|
+
# ✅ Always use English
|
361
|
+
def calculate_speed(distance, time)
|
362
|
+
return distance / time
|
363
|
+
end
|
364
|
+
```
|
365
|
+
|
366
|
+
### Inconsistent Documentation Language
|
367
|
+
```ruby
|
368
|
+
# ❌ Inconsistent
|
369
|
+
# ユーザーのスコアを計算する
|
370
|
+
# @param user [User] The user object
|
371
|
+
def calculate_user_score(user)
|
372
|
+
|
373
|
+
# ✅ Consistent English
|
374
|
+
# Calculates the user's performance score
|
375
|
+
# @param user [User] The user object
|
376
|
+
def calculate_user_score(user)
|
377
|
+
```
|
378
|
+
|
379
|
+
### Poor Translation of Technical Terms
|
380
|
+
```
|
381
|
+
# ❌ Direct translation loses meaning
|
382
|
+
"I will implement the 'hand procedure' for error handling"
|
383
|
+
|
384
|
+
# ✅ Keep technical terms or provide context
|
385
|
+
"I will implement exception handling (例外処理) for error cases"
|
386
|
+
```
|
387
|
+
|
388
|
+
This language guideline ensures clear, professional, and accessible code while maintaining effective communication with users in their preferred language.
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# RuboCop Fix Workflow for AI Agents
|
2
|
+
|
3
|
+
This guide outlines a safe, repeatable process to fix RuboCop offenses while preserving behavior and keeping PRs focused.
|
4
|
+
|
5
|
+
## Goals
|
6
|
+
- Keep changes minimal and behavior‑preserving; prefer small, focused PRs.
|
7
|
+
- Use safe autocorrect first; apply unsafe corrections only when reviewed and covered by tests.
|
8
|
+
- Centralize rule changes in `.rubocop.yml`; never hand‑edit `.rubocop_todo.yml`.
|
9
|
+
|
10
|
+
## Quick Commands
|
11
|
+
- Full lint: `rake rubocop`
|
12
|
+
- File/dir lint: `rubocop path/to/file.rb`
|
13
|
+
- Safe autocorrect: `rubocop -a`
|
14
|
+
- Targeted unsafe: `rubocop -A --only Cop/Name`
|
15
|
+
- Run tests: `rake spec`
|
16
|
+
- Regenerate TODO: `docquet regenerate-todo`
|
17
|
+
- Temporarily enable a TODO‑disabled cop: comment out its block in `.rubocop_todo.yml`
|
18
|
+
|
19
|
+
## Workflow
|
20
|
+
1) Reproduce locally
|
21
|
+
- Run `rake rubocop` and note failing cops/files.
|
22
|
+
|
23
|
+
2) Safe autocorrect first
|
24
|
+
- Run `rubocop -a` on specific files or directories to reduce blast radius.
|
25
|
+
- Re‑run `rake rubocop` and `rake spec` to verify no behavior changes.
|
26
|
+
|
27
|
+
3) Target specific cops (if still failing)
|
28
|
+
- For stylistic issues, fix manually or run `rubocop -A --only Cop/Name` on the smallest scope.
|
29
|
+
- For logic‑sensitive cops (e.g., Performance, Lint), prefer manual fixes with tests.
|
30
|
+
|
31
|
+
3a) If the cop is disabled in `.rubocop_todo.yml`
|
32
|
+
- Open `.rubocop_todo.yml`, locate the `Cop/Name` entry, and temporarily comment out (or remove locally) that entire block. RuboCop respects TODO disables even with `--only`, so this is required to surface offenses.
|
33
|
+
- Run `rubocop --only Cop/Name` (optionally `-A`) on a narrow path and fix findings.
|
34
|
+
- Validate with `rake rubocop` and `rake spec`.
|
35
|
+
- Refresh the TODO: run `docquet regenerate-todo` to update/remove the entry based on remaining offenses. Commit code changes and the regenerated `.rubocop_todo.yml` together in the same commit/PR.
|
36
|
+
|
37
|
+
4) Update configuration (rare)
|
38
|
+
- If a rule conflicts with project style, adjust `.rubocop.yml` with rationale in the PR body.
|
39
|
+
- Do not edit `.rubocop_todo.yml` manually. After large cleanups, run `docquet regenerate-todo` and commit only that file.
|
40
|
+
|
41
|
+
5) No inline disables
|
42
|
+
- Do not use comment-based disables (`# rubocop:disable ...`). This project forbids inline disables.
|
43
|
+
- If a finding cannot be safely fixed, pause and ask the maintainer for guidance. Options may include refining the rule in `.rubocop.yml` or adjusting the approach.
|
44
|
+
|
45
|
+
6) Validate and commit
|
46
|
+
- Ensure `rake` (tests + lint) is green.
|
47
|
+
- Commit messages must start with a GitHub `:emoji:` and use imperative mood.
|
48
|
+
Examples:
|
49
|
+
- `:lipstick: RuboCop: safe autocorrect in lib/fasti/cli.rb`
|
50
|
+
- `:rotating_light: RuboCop: fix Lint/UnusedMethodArgument`
|
51
|
+
|
52
|
+
## PR Guidance
|
53
|
+
- Keep changes small and single‑purpose (e.g., "fix Style/StringLiterals in lib/fasti").
|
54
|
+
- Include before/after snippets if unsafe autocorrect or refactor was applied.
|
55
|
+
- Link any rule changes to rationale and project conventions.
|