openclacky 0.7.3 → 0.7.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 (33) hide show
  1. checksums.yaml +4 -4
  2. data/.clacky/skills/commit/SKILL.md +252 -74
  3. data/CHANGELOG.md +12 -0
  4. data/bin/openclacky +2 -0
  5. data/lib/clacky/agent/message_compressor_helper.rb +1 -1
  6. data/lib/clacky/agent/system_prompt_builder.rb +9 -8
  7. data/lib/clacky/agent/tool_executor.rb +4 -13
  8. data/lib/clacky/agent.rb +28 -7
  9. data/lib/clacky/cli.rb +22 -5
  10. data/lib/clacky/default_skills/new/SKILL.md +61 -30
  11. data/lib/clacky/default_skills/new/scripts/create_rails_project.sh +176 -0
  12. data/lib/clacky/default_skills/new/scripts/rails_env_checker.sh +389 -0
  13. data/lib/clacky/default_skills/skill-add/SKILL.md +251 -34
  14. data/lib/clacky/default_skills/skill-add/scripts/install_from_github.rb +189 -0
  15. data/lib/clacky/tools/invoke_skill.rb +5 -1
  16. data/lib/clacky/tools/safe_shell.rb +2 -2
  17. data/lib/clacky/tools/shell.rb +48 -20
  18. data/lib/clacky/ui2/components/input_area.rb +27 -9
  19. data/lib/clacky/ui2/components/modal_component.rb +4 -1
  20. data/lib/clacky/ui2/components/welcome_banner.rb +33 -10
  21. data/lib/clacky/ui2/layout_manager.rb +107 -26
  22. data/lib/clacky/ui2/line_editor.rb +6 -5
  23. data/lib/clacky/ui2/screen_buffer.rb +0 -15
  24. data/lib/clacky/ui2/terminal_detector.rb +119 -0
  25. data/lib/clacky/ui2/theme_manager.rb +18 -0
  26. data/lib/clacky/ui2/themes/base_theme.rb +22 -1
  27. data/lib/clacky/ui2/themes/hacker_theme.rb +22 -18
  28. data/lib/clacky/ui2/themes/minimal_theme.rb +19 -15
  29. data/lib/clacky/ui2/ui_controller.rb +66 -15
  30. data/lib/clacky/ui2.rb +1 -0
  31. data/lib/clacky/utils/limit_stack.rb +5 -0
  32. data/lib/clacky/version.rb +1 -1
  33. metadata +5 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7412866b05ae167fe6425d335db66e045a5e46ee02f20c25df41ff025c34d504
4
- data.tar.gz: af3fb00041f896a6b9a8e98d7cb94be58ad49333e111cd6929233cedce684a80
3
+ metadata.gz: d4cbc9f7d1de1e64b78bd09ac59e9d911d101ab4e5e4bc6a2e869810311fffbc
4
+ data.tar.gz: 26de964a5a19c4eacf6a2fecff08dd6fe0dcdcc5baacb435fd53ed30095860cb
5
5
  SHA512:
6
- metadata.gz: 97b3549db52c0f6f8f2b1b5f54f703b45e1aa8619a26909db5bd394bb8dd371972ddce81f61ed2a6047a7105a31be5eeb5e34a7fd1619e57107b363ce805de54
7
- data.tar.gz: 231fe7e3e095fde2e295dc10d151f231532f44f541c3b623bc9e0efcee054f7a5e32ea58b6734ee6cc0f7e4b137b88d269c1a8a31ac3d6ebcd5c72ee21cd2438
6
+ metadata.gz: fdefc255c000713dc69b8062ce8a1e249fbbfe219716dcae1bc16c2ad32a5672080216172f63b4648f30680f9b4295e8cd3a717d0f7d05fc17f93922cc35227e
7
+ data.tar.gz: e650a5ef793d1c435ab23436f407bfff1a76def00a6047c0d6e75fbc13e41dcc5bc3b5ec538b6eef39a928d4dc5339c1c5b3f69da242b12b2fe8d4c59e51e381
@@ -9,14 +9,14 @@ user-invocable: true
9
9
 
10
10
  This skill helps users create well-structured, semantic git commits by analyzing changes and suggesting appropriate commit messages.
11
11
 
12
- ## ⚠️ CRITICAL REQUIREMENT: SINGLE-LINE COMMITS ONLY
12
+ ## CRITICAL REQUIREMENT: SINGLE-LINE COMMITS ONLY
13
13
 
14
14
  **ALL commit messages created by this skill MUST be single-line only.**
15
15
 
16
- - DO: `git commit -m "feat: add user authentication"`
17
- - DON'T: Multi-line commits with body text
18
- - DON'T: Multiple `-m` flags
19
- - DON'T: Commit messages with `\n` or additional paragraphs
16
+ - DO: `git commit -m "feat: add user authentication"`
17
+ - DON'T: Multi-line commits with body text
18
+ - DON'T: Multiple `-m` flags
19
+ - DON'T: Commit messages with `\n` or additional paragraphs
20
20
 
21
21
  Keep commits concise and focused. If more detail is needed, suggest adding it separately in PR descriptions or documentation.
22
22
 
@@ -24,6 +24,19 @@ Keep commits concise and focused. If more detail is needed, suggest adding it se
24
24
 
25
25
  This skill automates the process of reviewing git changes and creating meaningful, conventional commits following the semantic commit format (feat/fix/chore/test).
26
26
 
27
+ ## Core Philosophy
28
+
29
+ **THINK IN PURPOSES, NOT FILES**
30
+
31
+ This skill prioritizes understanding the OVERALL GOAL of changes before deciding how to commit them. The default approach is to:
32
+ 1. Understand what the developer is trying to achieve
33
+ 2. Group all related changes into meaningful, purpose-driven commits
34
+ 3. Prefer fewer, cohesive commits over many fragmented ones
35
+
36
+ DO NOT commit file-by-file. DO NOT separate tests from implementation. DO NOT fragment features across multiple commits.
37
+
38
+ Instead, ask: "What story do these changes tell?" and commit accordingly.
39
+
27
40
  ## Usage
28
41
 
29
42
  To use this skill, simply say:
@@ -46,20 +59,124 @@ git status
46
59
  git diff --stat
47
60
  ```
48
61
 
49
- ### 2. Review Changes in Detail
62
+ ### 2. HOLISTIC ANALYSIS - Understand the Overall Purpose
63
+
64
+ CRITICAL: Before diving into file-by-file analysis, step back and ask:
65
+
66
+ - What is the developer trying to achieve overall? (e.g., "Add authentication feature", "Fix login bugs", "Refactor database layer")
67
+ - Is there a common theme or goal across these changes?
68
+ - Can multiple changes be explained by a single higher-level purpose?
69
+
70
+ Think strategically, not tactically:
71
+ - BAD: "Changed auth.rb, changed user.rb, changed session.rb" -> 3 separate commits
72
+ - GOOD: "These are all part of implementing user authentication" -> 1 commit
73
+
74
+ Review ALL changes together first:
75
+ ```bash
76
+ # Get overview of all changes
77
+ git diff --stat
78
+ git diff
79
+ ```
50
80
 
51
- For each changed file, analyze:
81
+ Look for patterns:
82
+ - Do multiple files serve the same feature?
83
+ - Are there related bug fixes across files?
84
+ - Is there a refactoring that touches multiple files?
85
+ - Are tests accompanying their implementation?
86
+
87
+ ### 3. Review Changes in Detail
88
+
89
+ Now examine each file to understand specifics:
52
90
  - The nature of changes (new feature, bug fix, refactoring, tests, documentation)
53
- - Scope of changes (which component/module)
54
- - Impact level (minor tweak vs major change)
91
+ - How it connects to the overall purpose identified in step 2
92
+ - Whether it's part of the main change or a separate concern
55
93
 
56
94
  ```bash
57
95
  git diff <file>
58
96
  ```
59
97
 
60
- ### 3. Generate Commit Messages
98
+ ### 4. INTELLIGENT GROUPING - Merge Similar Changes
99
+
100
+ CRITICAL PRINCIPLE: Prefer fewer, meaningful commits over many small commits
101
+
102
+ **Grouping Strategy:**
103
+
104
+ 1. **Same Feature/Purpose = One Commit**
105
+ - All files contributing to the same feature should be in ONE commit
106
+ - Tests for a feature belong with the feature implementation
107
+ - Related configuration changes belong with the feature
108
+
109
+ 2. **Ask: "Would I explain these separately in a code review?"**
110
+ - If you'd say "I added X, Y, and Z as part of feature F" -> ONE commit
111
+ - If you'd say "I added X, and separately I fixed Y" -> TWO commits
61
112
 
62
- Based on the analysis, generate commit messages following the conventional commit format:
113
+ 3. **Look for these grouping opportunities:**
114
+ - Feature + Tests: Always together
115
+ - Implementation across multiple files: One commit if same feature
116
+ - Bug fix + Test: Together if addressing same issue
117
+ - Refactoring across modules: One commit if same refactoring goal
118
+ - Documentation + Code: Together if documenting the same change
119
+ - Configuration + Code: Together if config is required for the code
120
+
121
+ 4. **Only split when:**
122
+ - Changes serve genuinely different purposes
123
+ - Mixing would make the commit unclear or too broad
124
+ - One change is risky and should be isolated
125
+ - Different semantic types that shouldn't mix (feat vs fix vs chore)
126
+
127
+ **Examples of Good Grouping:**
128
+
129
+ GOOD - Merged into ONE commit:
130
+ ```
131
+ Commit: feat: add user authentication
132
+ - lib/auth/authenticator.rb (new authentication logic)
133
+ - lib/user.rb (user model updates)
134
+ - lib/session.rb (session management)
135
+ - spec/auth/authenticator_spec.rb (tests)
136
+ - spec/user_spec.rb (updated tests)
137
+ - config/routes.rb (auth routes)
138
+ ```
139
+
140
+ GOOD - Different purposes, TWO commits:
141
+ ```
142
+ Commit 1: feat: add user authentication
143
+ - lib/auth/authenticator.rb
144
+ - spec/auth/authenticator_spec.rb
145
+
146
+ Commit 2: fix: resolve database timeout issue
147
+ - lib/database/connection.rb
148
+ - spec/database/connection_spec.rb
149
+ ```
150
+
151
+ BAD - Over-splitting, should be ONE commit:
152
+ ```
153
+ Commit 1: feat: add authentication logic
154
+ - lib/auth/authenticator.rb
155
+
156
+ Commit 2: feat: update user model for authentication
157
+ - lib/user.rb
158
+
159
+ Commit 3: test: add authentication tests
160
+ - spec/auth/authenticator_spec.rb
161
+
162
+ Commit 4: chore: add authentication routes
163
+ - config/routes.rb
164
+ ```
165
+
166
+ **Decision Tree:**
167
+ ```
168
+ Are changes related to the same goal/feature/purpose?
169
+ |-- YES -> Combine into ONE commit
170
+ | +-- Even if they touch different files/modules
171
+ +-- NO -> Keep as separate commits
172
+ +-- Ask: Are they different semantic types (feat/fix/chore)?
173
+ |-- YES -> Definitely separate
174
+ +-- NO -> Consider if they could still be combined
175
+ ```
176
+
177
+ ### 5. Generate Commit Messages
178
+
179
+ Based on the holistic analysis, generate commit messages following the conventional commit format:
63
180
 
64
181
  **Format**: `<type>: <description>`
65
182
 
@@ -67,8 +184,8 @@ Based on the analysis, generate commit messages following the conventional commi
67
184
  - `feat`: New features or functionality
68
185
  - `fix`: Bug fixes
69
186
  - `chore`: Routine tasks, maintenance, dependencies
70
- - `test`: Adding or modifying tests
71
- - `docs`: Documentation changes
187
+ - `test`: Adding or modifying tests (only if standalone)
188
+ - `docs`: Documentation changes (only if standalone)
72
189
  - `refactor`: Code refactoring without changing functionality
73
190
  - `style`: Code style changes (formatting, whitespace)
74
191
  - `perf`: Performance improvements
@@ -79,46 +196,53 @@ Based on the analysis, generate commit messages following the conventional commi
79
196
  - Use imperative mood ("add feature" not "added feature")
80
197
  - Don't end with a period
81
198
  - Be specific but brief
82
- - One logical change per commit
199
+ - **One logical PURPOSE per commit** (not one file per commit)
200
+ - Describe the overall goal, not implementation details
83
201
  - If more detail is needed, suggest adding it in PR description or commit body separately, but the initial commit MUST be single-line
84
202
 
85
203
  **Examples**:
86
- - `feat: add user authentication`
87
- - `fix: resolve memory leak in parser`
88
- - `chore: update dependencies`
89
- - `test: add unit tests for validator`
90
- - `docs: update README installation steps`
91
-
92
- ### 4. Group Changes
204
+ - `feat: add user authentication` (not "add authenticator.rb, user.rb, session.rb")
205
+ - `fix: resolve login timeout issues` (not "fix auth.rb timeout")
206
+ - `chore: update dependencies` (not separate commits for each gem)
207
+ - `refactor: simplify database connection logic` (not one commit per file)
208
+ - `docs: update API documentation` (only if pure documentation change)
93
209
 
94
- Organize changes into logical commits:
95
- - Group related changes together
96
- - Separate features, fixes, and chores
97
- - Keep commits atomic and focused
98
- - Suggest the order of commits
99
-
100
- ### 5. Present Suggestions
210
+ ### 6. Present Suggestions
101
211
 
102
212
  Show the user:
103
- - List of proposed commits
213
+ - **The overall purpose/goal you identified**
214
+ - List of proposed commits (prefer fewer, consolidated commits)
104
215
  - Files included in each commit
105
216
  - Commit message for each group
106
- - Brief explanation of the grouping logic
217
+ - **Brief explanation of WHY changes were grouped this way**
107
218
 
108
219
  Format:
109
220
  ```
110
- Commit 1: feat: add login endpoint
111
- - lib/api/auth.rb
112
- - spec/api/auth_spec.rb
113
-
114
- Commit 2: fix: resolve timeout in database connection
221
+ Overall goal: Implementing user authentication system
222
+
223
+ Proposed commits:
224
+
225
+ Commit 1: feat: add user authentication
226
+ - lib/api/auth.rb (authentication logic)
227
+ - lib/user.rb (user model updates)
228
+ - lib/session.rb (session management)
229
+ - spec/api/auth_spec.rb (tests)
230
+ - spec/user_spec.rb (updated user tests)
231
+ - config/routes.rb (auth routes)
232
+
233
+ Reason: All these files work together to implement the authentication
234
+ feature. Tests and configuration belong with the implementation.
235
+
236
+ Commit 2: fix: resolve database timeout issue
115
237
  - lib/database/connection.rb
238
+ - spec/database/connection_spec.rb
239
+
240
+ Reason: Separate bug fix unrelated to authentication.
116
241
 
117
- Commit 3: chore: update rubocop configuration
118
- - .rubocop.yml
242
+ Total: 2 commits (not 6+ small commits)
119
243
  ```
120
244
 
121
- ### 6. Get User Confirmation
245
+ ### 7. Get User Confirmation
122
246
 
123
247
  Ask the user:
124
248
  - Review the proposed commits
@@ -126,7 +250,7 @@ Ask the user:
126
250
  - Allow modifications if needed
127
251
  - Get explicit approval before committing
128
252
 
129
- ### 7. Execute Commits
253
+ ### 8. Execute Commits
130
254
 
131
255
  For each approved commit:
132
256
  ```bash
@@ -148,7 +272,7 @@ Provide feedback after each commit:
148
272
  - Show commit hash
149
273
  - Display summary
150
274
 
151
- ### 8. Final Summary
275
+ ### 9. Final Summary
152
276
 
153
277
  After all commits:
154
278
  - Show total number of commits created
@@ -174,8 +298,8 @@ git add <file>
174
298
  git commit -m "type: single line description"
175
299
 
176
300
  # NEVER use multi-line format like:
177
- # git commit -m "title" -m "body" DON'T DO THIS
178
- # git commit -m "title\n\nbody" DON'T DO THIS
301
+ # git commit -m "title" -m "body" -- DON'T DO THIS
302
+ # git commit -m "title\n\nbody" -- DON'T DO THIS
179
303
 
180
304
  # View commit history
181
305
  git log --oneline -n 5
@@ -183,41 +307,77 @@ git log --oneline -n 5
183
307
 
184
308
  ## Workflow Example
185
309
 
310
+ BAD Example (Over-splitting):
186
311
  ```
187
312
  User: /commit
188
313
 
189
- AI:
190
- 1. Analyzing git status...
314
+ AI (WRONG APPROACH):
315
+ Found 5 modified files
316
+
317
+ Proposed commits:
318
+ Commit 1: feat: add user model
319
+ - lib/user.rb
320
+ Commit 2: test: add user tests
321
+ - spec/user_spec.rb
322
+ Commit 3: fix: fix auth validation
323
+ - lib/auth.rb
324
+ Commit 4: test: add auth tests
325
+ - spec/auth_spec.rb
326
+ Commit 5: chore: update dependencies
327
+ - Gemfile
328
+
329
+ Problem: Too fragmented! Tests separated from code.
330
+ ```
331
+
332
+ GOOD Example (Holistic grouping):
333
+ ```
334
+ User: /commit
335
+
336
+ AI (CORRECT APPROACH):
337
+ 1. Analyzing all changes...
191
338
  Found 5 modified files
192
339
 
193
- 2. Reviewing changes...
340
+ 2. Identifying overall purpose...
341
+ Main goal: Implementing user registration feature
342
+ Secondary: Fixing existing auth bug
343
+ Maintenance: Dependency updates
344
+
345
+ 3. Holistic analysis:
194
346
  - lib/user.rb: New user registration feature
195
- - lib/auth.rb: Fix password validation bug
196
- - spec/user_spec.rb: Tests for user registration
197
- - spec/auth_spec.rb: Tests for auth fix
198
- - Gemfile: Updated dependencies
347
+ - spec/user_spec.rb: Tests for user registration (same feature)
348
+ - lib/auth.rb: Fix password validation bug (separate concern)
349
+ - spec/auth_spec.rb: Tests for auth fix (same bug fix)
350
+ - Gemfile: Updated dependencies (separate maintenance)
199
351
 
200
- 3. Proposed commits:
352
+ 4. Proposed commits (grouped by purpose):
201
353
 
202
354
  Commit 1: feat: add user registration
203
- - lib/user.rb
204
- - spec/user_spec.rb
355
+ - lib/user.rb (implementation)
356
+ - spec/user_spec.rb (tests)
357
+
358
+ Reason: Feature and its tests belong together
205
359
 
206
360
  Commit 2: fix: correct password validation logic
207
- - lib/auth.rb
208
- - spec/auth_spec.rb
361
+ - lib/auth.rb (bug fix)
362
+ - spec/auth_spec.rb (tests)
363
+
364
+ Reason: Fix and its tests belong together
209
365
 
210
366
  Commit 3: chore: update gem dependencies
211
367
  - Gemfile
368
+
369
+ Reason: Unrelated maintenance task
212
370
 
213
- Do you want to proceed with these commits? (yes/no)
371
+ Total: 3 meaningful commits instead of 5 fragmented ones
372
+
373
+ Do you want to proceed? (yes/no)
214
374
 
215
375
  User: yes
216
376
 
217
377
  AI:
218
- Commit 1 created (a1b2c3d): feat: add user registration
219
- Commit 2 created (e4f5g6h): fix: correct password validation logic
220
- Commit 3 created (i7j8k9l): chore: update gem dependencies
378
+ Commit 1 created (a1b2c3d): feat: add user registration
379
+ Commit 2 created (e4f5g6h): fix: correct password validation logic
380
+ Commit 3 created (i7j8k9l): chore: update gem dependencies
221
381
 
222
382
  Summary: 3 commits created successfully!
223
383
  Next steps: Review with 'git log' or push with 'git push'
@@ -233,22 +393,40 @@ Next steps: Review with 'git log' or push with 'git push'
233
393
  - Focus on "what" and "why", not "how"
234
394
  - Maximum 72 characters for the single line
235
395
 
236
- ### Commit Organization
237
- - One logical change per commit
238
- - Keep features separate from fixes
239
- - Don't mix refactoring with new features
240
- - Test files go with their related code changes
241
-
242
- ### When to Split Commits
243
- - Multiple unrelated features
244
- - Features and bug fixes mixed
245
- - Code changes and config changes
246
- - Different modules/components affected
247
-
248
- ### When to Combine Changes
249
- - Related test and implementation
250
- - Multiple files for same feature
251
- - Complementary changes for same fix
396
+ ### Commit Organization - THINK PURPOSE, NOT FILES
397
+
398
+ **GOLDEN RULE: One logical PURPOSE per commit, not one FILE per commit**
399
+
400
+ ### When to COMBINE Changes (Default Approach)
401
+ - **Feature implementation + its tests** (ALWAYS together)
402
+ - **Multiple files serving the same feature** (one commit)
403
+ - **Bug fix + its test** (ALWAYS together)
404
+ - **Code + required configuration** (together if config enables the code)
405
+ - **Refactoring across multiple files** (one commit if same refactoring goal)
406
+ - **Documentation + code it documents** (together if part of same change)
407
+ - **Related files in same module/feature** (one commit)
408
+
409
+ ### When to SPLIT Commits (Exception Cases)
410
+ - **Truly different purposes**: e.g., "add feature X" vs "fix bug Y"
411
+ - **Different semantic types**: feat vs fix vs chore (usually)
412
+ - **Risky changes**: isolate if one change is experimental
413
+ - **Independent concerns**: changes that could be deployed separately
414
+ - **Too broad scope**: if one commit does too many unrelated things
415
+
416
+ ### Anti-Patterns to Avoid
417
+ - NEVER split implementation and tests into separate commits
418
+ - NEVER create one commit per file unless files are truly independent
419
+ - NEVER split configuration from the code that requires it
420
+ - NEVER fragment a feature into multiple commits just because it touches multiple files
421
+
422
+ ### Decision Framework
423
+ ```
424
+ For each set of changes, ask:
425
+ 1. "What was I trying to accomplish?" (identify the purpose)
426
+ 2. "Do these files work together toward that purpose?" (YES -> combine)
427
+ 3. "Would splitting these make the history harder to understand?" (YES -> combine)
428
+ 4. "Could these changes be deployed independently?" (NO -> combine)
429
+ ```
252
430
 
253
431
  ## Error Handling
254
432
 
data/CHANGELOG.md CHANGED
@@ -7,6 +7,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [0.7.3] - 2026-02-26
11
+
12
+ ### Fixed
13
+ - Modal component validation result handling after form submission
14
+ - Modal height calculation for dynamic field count in form mode
15
+
16
+ ### Improved
17
+ - Provider ordering prioritizes well-tested providers (OpenRouter, Minimax) first
18
+ - Updated Minimax to use new base URL (api.minimaxi.com) and M2.5 as default
19
+ - Updated model versions: Claude Sonnet 4.6, OpenRouter Sonnet 4-6, Haiku 4.5
20
+ - Minimax model list now includes M2.1 and M2.5 (removed deprecated Text-01)
21
+
10
22
  ## [0.7.2] - 2026-02-26
11
23
 
12
24
  ### Added
data/bin/openclacky CHANGED
@@ -1,6 +1,8 @@
1
1
  #!/usr/bin/env ruby
2
2
  # frozen_string_literal: true
3
3
 
4
+ $LOAD_PATH.unshift File.expand_path("../lib", __dir__)
5
+
4
6
  require "clacky"
5
7
 
6
8
  Clacky::CLI.start(ARGV)
@@ -7,7 +7,7 @@ module Clacky
7
7
  module MessageCompressorHelper
8
8
  # Compression thresholds
9
9
  COMPRESSION_THRESHOLD = 150_000 # Trigger compression when exceeding this (in tokens)
10
- MESSAGE_COUNT_THRESHOLD = 150 # Trigger compression when exceeding this (in message count)
10
+ MESSAGE_COUNT_THRESHOLD = 200 # Trigger compression when exceeding this (in message count)
11
11
  MAX_RECENT_MESSAGES = 20 # Keep this many recent message pairs intact
12
12
  TARGET_COMPRESSED_TOKENS = 10_000 # Target size after compression
13
13
  IDLE_COMPRESSION_THRESHOLD = 20_000 # Minimum messages needed for idle compression
@@ -24,14 +24,15 @@ module Clacky
24
24
  - After creating the TODO list, START EXECUTING each task immediately
25
25
  - Don't stop after planning - continue to work on the tasks!
26
26
  2. Always read existing code before making changes (use file_reader/glob/grep or invoke code-explorer skill)
27
- 3. Ask clarifying questions if requirements are unclear
28
- 4. Break down complex tasks into manageable steps
29
- 5. **USE TOOLS to create/modify files** - don't just return code
30
- 6. Write code that is secure, efficient, and easy to understand
31
- 7. Test your changes using the shell tool when appropriate
32
- 8. **IMPORTANT**: After completing each step, mark the TODO as completed and continue to the next one
33
- 9. Keep working until ALL TODOs are completed or you need user input
34
- 10. Provide brief explanations after completing actions
27
+ 3. **Use glob tool to search for files** - it respects .gitignore, filters binary files, and sorts by modification time
28
+ 4. Ask clarifying questions if requirements are unclear
29
+ 5. Break down complex tasks into manageable steps
30
+ 6. **USE TOOLS to create/modify files** - don't just return code
31
+ 7. Write code that is secure, efficient, and easy to understand
32
+ 8. Test your changes using the shell tool when appropriate
33
+ 9. **IMPORTANT**: After completing each step, mark the TODO as completed and continue to the next one
34
+ 10. Keep working until ALL TODOs are completed or you need user input
35
+ 11. Provide brief explanations after completing actions
35
36
 
36
37
  IMPORTANT: You should frequently refer to the existing codebase. For unclear instructions,
37
38
  prioritize understanding the codebase first before answering or taking action.
@@ -98,22 +98,12 @@ module Clacky
98
98
  preview_error = show_write_preview(args)
99
99
  when "edit"
100
100
  preview_error = show_edit_preview(args)
101
- when "shell", "safe_shell"
102
- show_shell_preview(args)
103
- else
104
- # For other tools, show formatted arguments
105
- tool = @tool_registry.get(call[:name]) rescue nil
106
- if tool
107
- formatted = tool.format_call(args) rescue "#{call[:name]}(...)"
108
- @ui&.show_tool_args(formatted)
109
- else
110
- @ui&.show_tool_args(call[:arguments])
111
- end
101
+ # Shell and other tools don't need special preview
102
+ # They will be shown via show_tool_call in the main flow
112
103
  end
113
104
 
114
105
  preview_error
115
106
  rescue JSON::ParserError
116
- @ui&.show_tool_args(call[:arguments])
117
107
  nil
118
108
  end
119
109
  end
@@ -256,7 +246,8 @@ module Clacky
256
246
  /go\s+(build|test)/,
257
247
  /make\s+(test|build)/,
258
248
  /pytest/,
259
- /jest/
249
+ /jest/,
250
+ /sleep\s+\d+/ # sleep command with duration
260
251
  ]
261
252
 
262
253
  slow_patterns.any? { |pattern| command.match?(pattern) }
data/lib/clacky/agent.rb CHANGED
@@ -458,16 +458,37 @@ module Clacky
458
458
  args[:skip_safety_check] = true
459
459
  end
460
460
 
461
- # Show progress for potentially slow tools (no prefix newline)
462
- if potentially_slow_tool?(call[:name], args)
461
+ # Automatic progress display after 2 seconds for any tool execution
462
+ progress_shown = false
463
+ progress_timer = nil
464
+ output_buffer = nil
465
+
466
+ if @ui
463
467
  progress_message = build_tool_progress_message(call[:name], args)
464
- @ui&.show_progress(progress_message, prefix_newline: false)
468
+
469
+ # For shell commands, create shared output buffer
470
+ if call[:name] == "shell" || call[:name] == "safe_shell"
471
+ output_buffer = { content: "", timestamp: Time.now }
472
+ args[:output_buffer] = output_buffer
473
+ end
474
+
475
+ progress_timer = Thread.new do
476
+ sleep 2
477
+ @ui.show_progress(progress_message, prefix_newline: false, output_buffer: output_buffer)
478
+ progress_shown = true
479
+ end
465
480
  end
466
481
 
467
- result = tool.execute(**args)
468
-
469
- # Clear progress if shown
470
- @ui&.clear_progress if potentially_slow_tool?(call[:name], args)
482
+ begin
483
+ result = tool.execute(**args)
484
+ ensure
485
+ # Cancel timer and clear progress if shown
486
+ if progress_timer
487
+ progress_timer.kill
488
+ progress_timer.join
489
+ end
490
+ @ui&.clear_progress if progress_shown
491
+ end
471
492
 
472
493
  # Track modified files for Time Machine snapshots
473
494
  track_modified_files(call[:name], args)
data/lib/clacky/cli.rb CHANGED
@@ -2,6 +2,7 @@
2
2
 
3
3
  require "thor"
4
4
  require "tty-prompt"
5
+ require "fileutils"
5
6
  require_relative "ui2"
6
7
  require_relative "json_ui_controller"
7
8
 
@@ -224,7 +225,17 @@ module Clacky
224
225
  def validate_working_directory(path)
225
226
  working_dir = path || Dir.pwd
226
227
 
227
- # Expand path to absolute path
228
+ # If no path specified and currently in home directory, use ~/clacky_workspace
229
+ if path.nil? && File.expand_path(working_dir) == File.expand_path(Dir.home)
230
+ working_dir = File.expand_path("~/clacky_workspace")
231
+
232
+ # Create directory if it doesn't exist
233
+ unless Dir.exist?(working_dir)
234
+ FileUtils.mkdir_p(working_dir)
235
+ end
236
+ end
237
+
238
+ # Always expand to absolute path
228
239
  working_dir = File.expand_path(working_dir)
229
240
 
230
241
  # Validate directory exists
@@ -424,6 +435,12 @@ module Clacky
424
435
 
425
436
  # Run agent with UI2 split-screen interface
426
437
  def run_agent_with_ui2(agent, working_dir, agent_config, session_manager = nil, client = nil, is_session_load: false)
438
+ # Detect terminal background BEFORE starting UI2 to avoid output interference
439
+ is_dark_bg = UI2::TerminalDetector.detect_dark_background
440
+
441
+ # Pass detected background mode to theme manager (singleton)
442
+ UI2::ThemeManager.instance.set_background_mode(is_dark_bg)
443
+
427
444
  # Validate theme
428
445
  theme_name = options[:theme] || "hacker"
429
446
  available_themes = UI2::ThemeManager.available_themes.map(&:to_s)
@@ -535,7 +552,7 @@ module Clacky
535
552
 
536
553
  # Cancel idle timer if running (new input means user is active)
537
554
  if idle_timer_thread&.alive?
538
- ui_controller.log("Idle timer killed, start new 1", level: :debug)
555
+ # ui_controller.log("Idle timer killed, start new 1", level: :debug)
539
556
  idle_timer_thread.kill
540
557
  idle_timer_thread = nil
541
558
  end
@@ -544,17 +561,17 @@ module Clacky
544
561
  start_idle_timer = lambda do
545
562
  # Cancel any existing idle timer first
546
563
  if idle_timer_thread&.alive?
547
- ui_controller.log("Idle timer killed, start new 2", level: :debug)
564
+ # ui_controller.log("Idle timer killed, start new 2", level: :debug)
548
565
  idle_timer_thread.kill
549
566
  idle_timer_thread = nil
550
567
  end
551
568
 
552
569
  # Start idle timer - trigger compression after 180 seconds of inactivity
553
570
  idle_timer_thread = Thread.new do
554
- ui_controller.log("Idle timer started, will trigger compression in 180 seconds", level: :debug)
571
+ # ui_controller.log("Idle timer started, will trigger compression in 180 seconds", level: :debug)
555
572
  # Sleep outside of rescue block - if interrupted here, let it propagate and exit
556
573
  sleep 180
557
- ui_controller.log("Idle timer sleep completed, starting compression", level: :debug)
574
+ # ui_controller.log("Idle timer sleep completed, starting compression", level: :debug)
558
575
 
559
576
  # After sleep completes, switch to current_task_thread for compression
560
577
  # (so it can be interrupted by Ctrl+C)