Add command target presets for extras init#179
Conversation
cf34171 to
ea84676
Compare
There was a problem hiding this comment.
Code Review
This pull request introduces command target presets (claude, cursor, and codex) for the 'extras init commands' command, allowing users to easily configure common agent directories in both global and project modes. It updates the command-line help, documentation, and interactive TUI placeholders, and adds corresponding unit tests. The review feedback highlights a potential compatibility issue in the tests where t.Chdir is used, which requires Go 1.24 or later, and suggests a backward-compatible alternative using os.Chdir and t.Cleanup.
|
|
||
| func TestCmdExtrasInit_CommandsProjectPresets(t *testing.T) { | ||
| root := t.TempDir() | ||
| t.Chdir(root) |
There was a problem hiding this comment.
Using t.Chdir requires Go 1.24 or later. If the project supports older Go versions (such as Go 1.22 or 1.23), this will cause a compilation error. Consider using os.Chdir with t.Cleanup to restore the working directory for backward compatibility. Note that you will also need to import the os package.
| t.Chdir(root) | |
| oldWD, err := os.Getwd() | |
| if err != nil { | |
| t.Fatalf("get wd: %v", err) | |
| } | |
| if err := os.Chdir(root); err != nil { | |
| t.Fatalf("chdir: %v", err) | |
| } | |
| t.Cleanup(func() { | |
| _ = os.Chdir(oldWD) | |
| }) |
ea84676 to
7605ed7
Compare
Addresses #146.
Summary
extras init commands(claude/claude-code,cursor,codex).~/.claude/commands,~/.cursor/commands, and~/.codex/prompts; mapped project presets to.claude/commandsand.cursor/commands.codexpreset with a clear message because Codex prompt files are home-scoped rather than project-discovered.Validation
go test ./cmd/skillshare -run 'TestResolveExtraInitTargetPresets|TestCmdExtrasInit_Commands' -count=1\n-make test-unit