Skip to content

Commit eb2c1b8

Browse files
authored
Merge branch 'main' into mwbrooks-config-experiments-type
2 parents c500bde + 857a59a commit eb2c1b8

41 files changed

Lines changed: 1215 additions & 1116 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.circleci/config.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ jobs:
113113
default: "dev-build"
114114
docker: # run the steps with Docker
115115
# CircleCI Go images available at: https://hub.docker.com/r/circleci/golang/
116-
- image: cimg/go:1.26.0
116+
- image: cimg/go:1.26.1
117117
steps: # steps that comprise the `build` job
118118
- checkout # check out source code to working directory
119119
- restore_cache: # restores saved cache if no changes are detected since last run

.claude/CLAUDE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,19 @@ func NewExampleCommand(clients *shared.ClientFactory) *cobra.Command {
135135
- Mock the `ClientFactory` and its dependencies for testing
136136
- Always mock file system operations using `afero.Fs` to enable testability
137137

138+
### Test Naming Conventions
139+
140+
Test function names use the format `Test_StructName_FunctionName` for methods on a struct, or `Test_FunctionName` for package-level functions:
141+
142+
```go
143+
func Test_Client_GetAppStatus(t *testing.T) { ... } // struct method
144+
func Test_getKeyLength(t *testing.T) { ... } // package-level function
145+
```
146+
147+
### Test Ordering Conventions
148+
149+
Constructor functions (`NewXYZ`) should always be declared first, at the top of the test file. After constructors, test functions should be ordered alphabetically within each file. When a file has logical sections (separated by comments), tests should be alphabetical within each section. Getter and setter functions are grouped together under the base name — ignore the `Get` or `Set` prefix when determining order (e.g. `Test_AppName` and `Test_SetAppName` both sort under `A`). Exceptions to alphabetical ordering can be made when it doesn't work well for readability or logical grouping.
150+
138151
### Table-Driven Test Conventions
139152

140153
**Preferred: Map pattern** - uses `tc` for test case variable:
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
---
2+
name: record-demo
3+
description: Record terminal demos as GIFs using VHS tape files. Use when asked to record a demo, create a terminal recording, or generate a GIF of CLI usage.
4+
argument-hint: <description>
5+
---
6+
7+
Record a demo of `$ARGUMENTS` using VHS.
8+
9+
1. **Check VHS is installed**: Run `which vhs`. If not found, tell the user to install it with `brew install vhs`.
10+
11+
2. **Create a `.tape` file** in `demos/` (create the directory if needed). Use this template:
12+
13+
```tape
14+
# Demo: <description>
15+
Output demos/<name>.gif # Always use .gif format
16+
17+
Set Shell "zsh"
18+
Set FontSize 16
19+
Set Width 1200
20+
Set Height 600
21+
Set Theme "Catppuccin Mocha"
22+
Set TypingSpeed 75ms
23+
Set Padding 20
24+
25+
Type "<command>"
26+
Sleep 500ms
27+
Enter
28+
Sleep 3s
29+
```
30+
31+
3. **VHS Tape DSL reference**: For the full command reference, see [vhs-reference.md](vhs-reference.md).
32+
33+
4. **Tips for good demos**:
34+
- Add `Sleep` after commands to let output render and be readable
35+
- Use `Hide`/`Show` to run setup commands invisibly
36+
- Keep demos short and focused (under 30 seconds)
37+
- Add a `Sleep 3s` at the end so viewers can see final output
38+
- Always add a `Sleep 500ms` pause after each `Type` line (before `Enter`) to mimic a human pause
39+
- For this project, use `./bin/slack` directly as the CLI binary path (do NOT export PATH)
40+
- When demoing from an app directory, use `Hide` to `cd` into the app, then use `../bin/slack` as the binary path
41+
- Prefer passing app IDs directly (e.g. `--app A12345`) to avoid interactive prompts when the ID is known
42+
5. **Run the recording**: Execute `vhs <filename>.tape` to generate the output file.
43+
44+
6. **Review**: Open the `demos/` directory with `open demos/` so the user can review the output.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# VHS Tape DSL Reference
2+
3+
## Output
4+
5+
- `Output <path>.gif` - Create a GIF output at the given path
6+
7+
## Require
8+
9+
- `Require <string>` - Ensure a program is on the $PATH to proceed
10+
11+
## Settings
12+
13+
- `Set FontSize <number>` - Set the font size of the terminal
14+
- `Set FontFamily <string>` - Set the font family of the terminal
15+
- `Set Height <number>` - Set the height of the terminal
16+
- `Set Width <number>` - Set the width of the terminal
17+
- `Set LetterSpacing <float>` - Set the font letter spacing (tracking)
18+
- `Set LineHeight <float>` - Set the font line height
19+
- `Set LoopOffset <float>%` - Set the starting frame offset for the GIF loop
20+
- `Set Theme <json|string>` - Set the theme of the terminal
21+
- `Set Padding <number>` - Set the padding of the terminal
22+
- `Set Framerate <number>` - Set the framerate of the recording
23+
- `Set PlaybackSpeed <float>` - Set the playback speed of the recording
24+
- `Set MarginFill <file|#000000>` - Set the file or color the margin will be filled with
25+
- `Set Margin <number>` - Set the size of the margin (no effect without MarginFill)
26+
- `Set BorderRadius <number>` - Set terminal border radius, in pixels
27+
- `Set WindowBar <string>` - Set window bar type (Rings, RingsRight, Colorful, ColorfulRight)
28+
- `Set WindowBarSize <number>` - Set window bar size, in pixels (default: 40)
29+
- `Set TypingSpeed <time>` - Set the typing speed of the terminal (default: 50ms)
30+
31+
## Sleep
32+
33+
- `Sleep <time>` - Sleep for a set amount of time in seconds
34+
35+
## Type
36+
37+
- `Type "<characters>"` - Type characters into the terminal
38+
- `Type@<time> "<characters>"` - Type characters with a custom delay between each character
39+
40+
## Keys
41+
42+
All keys accept an optional `@<time>` delay and an optional repeat `[number]`.
43+
44+
- `Escape` - Press the Escape key
45+
- `Backspace` - Press the Backspace key
46+
- `Delete` - Press the Delete key
47+
- `Insert` - Press the Insert key
48+
- `Enter` - Press the Enter key
49+
- `Space` - Press the Space key
50+
- `Tab` - Press the Tab key
51+
- `Up` / `Down` / `Left` / `Right` - Press arrow keys
52+
- `PageUp` / `PageDown` - Press Page Up/Down keys
53+
- `Ctrl+<key>` - Press Control + key (e.g. `Ctrl+C`)
54+
55+
## Display
56+
57+
- `Hide` - Hide subsequent commands from the output
58+
- `Show` - Show subsequent commands in the output

.github/MAINTAINERS_GUIDE.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,34 @@ The branch name can also be set by changing
383383
for the `build-lint-test-e2e-test` workflow in the `.circleci/config.yml` file,
384384
but take care not to merge this change into `main`!
385385
386+
#### Test naming conventions
387+
388+
Test function names should use the format `Test_StructName_FunctionName` for methods
389+
on a struct, or `Test_FunctionName` for package-level functions. The underscore after
390+
`Test` separates the Go test prefix from the identifier being tested:
391+
392+
```go
393+
// Testing a method on a struct
394+
func Test_Client_GetAppStatus(t *testing.T) { ... }
395+
396+
// Testing a package-level function
397+
func Test_getKeyLength(t *testing.T) { ... }
398+
```
399+
400+
#### Test ordering conventions
401+
402+
Constructor functions (`NewXYZ`) should always be declared first, at the top of the
403+
test file. After constructors, test functions should be ordered alphabetically. When
404+
a file has logical sections (separated by comments), tests should be alphabetical
405+
within each section.
406+
407+
Getter and setter functions should be grouped together under the base name. Ignore
408+
the `Get` or `Set` prefix when determining alphabetical order. For example,
409+
`Test_AppName` and `Test_SetAppName` are both sorted under `A` for `AppName`.
410+
411+
Exceptions to alphabetical ordering can be made when it doesn't work well for
412+
readability or logical grouping.
413+
386414
#### Contributing tests
387415

388416
If you'd like to add tests, please review our

.github/workflows/tests.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
- name: Set up Go
2626
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
2727
with:
28-
go-version: "1.26.0"
28+
go-version: "1.26.1"
2929
- name: Lint
3030
uses: golangci/golangci-lint-action@1e7e51e771db61008b38414a730f564565cf7c20 # v9.2.0
3131
with:
@@ -57,7 +57,7 @@ jobs:
5757
- name: Set up Go
5858
uses: actions/setup-go@4b73464bb391d4059bd26b0524d20df3927bd417 # v6.3.0
5959
with:
60-
go-version: "1.26.0"
60+
go-version: "1.26.1"
6161
- name: Report health score
6262
uses: slackapi/slack-health-score@d58a419f15cdaff97e9aa7f09f95772830ab66f7 # v0.1.1
6363
with:

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ package-lock.json
3737

3838
# End to End Test files
3939
test-e2e
40+
41+
# VHS demo recordings
42+
demos/

cmd/datastore/count_test.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ func TestCountCommand(t *testing.T) {
251251
}, nil)
252252
cm.IO.On("InputPrompt", mock.Anything, "Enter an expression", iostreams.InputPromptConfig{
253253
Required: false,
254-
}).Return("")
254+
}).Return("", nil)
255255
cm.API.On("AppsDatastoreCount", mock.Anything, mock.Anything, mock.Anything).
256256
Return(types.AppDatastoreCountResult{Datastore: "numbers", Count: 12}, nil)
257257
},
@@ -298,16 +298,16 @@ func TestCountCommand(t *testing.T) {
298298
}, nil)
299299
cm.IO.On("InputPrompt", mock.Anything, "Enter an expression", iostreams.InputPromptConfig{
300300
Required: false,
301-
}).Return("#n < :num AND #n <> :zero AND #prime = :bool")
301+
}).Return("#n < :num AND #n <> :zero AND #prime = :bool", nil)
302302
cm.IO.On("InputPrompt", mock.Anything, "Enter a value for ':num'", iostreams.InputPromptConfig{
303303
Required: true,
304-
}).Return("12")
304+
}).Return("12", nil)
305305
cm.IO.On("InputPrompt", mock.Anything, "Enter a value for ':zero'", iostreams.InputPromptConfig{
306306
Required: true,
307-
}).Return("0")
307+
}).Return("0", nil)
308308
cm.IO.On("InputPrompt", mock.Anything, "Enter a value for ':bool'", iostreams.InputPromptConfig{
309309
Required: true,
310-
}).Return("true")
310+
}).Return("true", nil)
311311
cm.API.On("AppsDatastoreCount", mock.Anything, mock.Anything, mock.Anything).
312312
Return(types.AppDatastoreCountResult{Datastore: "numbers", Count: 6}, nil)
313313
},

cmd/datastore/delete_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ func TestDeleteCommand(t *testing.T) {
186186
}, nil)
187187
clientsMock.IO.On("InputPrompt", mock.Anything, "Enter a task_id", iostreams.InputPromptConfig{
188188
Required: true,
189-
}).Return("1234")
189+
}).Return("1234", nil)
190190
},
191191
Teardown: func() {
192192
os.Args = os.Args[:len(os.Args)-1]

cmd/datastore/get_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ func TestGetCommand(t *testing.T) {
185185
}, nil)
186186
clientsMock.IO.On("InputPrompt", mock.Anything, "Enter a task_id", iostreams.InputPromptConfig{
187187
Required: true,
188-
}).Return("1234")
188+
}).Return("1234", nil)
189189
},
190190
Teardown: func() {
191191
os.Args = os.Args[:len(os.Args)-1]

0 commit comments

Comments
 (0)