Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .clover.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# yaml-language-server: $schema=https://raw.githubusercontent.com/gechr/clover/v0.4.3/internal/config/schema.json
required-version: ">=0.4.3"
paths:
exclude:
- "vendor/**"
- "dist/**"
- "site/**"
- "**/testdata/**"
- "**/*_test.go"
- "go.sum"
- "mise.lock"
- "**/.env*"
- "**/secrets/**"
- "**/credentials/**"
- "**/*.pem"
- "**/*.key"
annotate:
write: false
22 changes: 9 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,19 @@ concurrency:
permissions: {}

jobs:
go-test:
name: Go test
# clover: provider=auto tags=actions
uses: matcra587/github-actions/.github/workflows/go-test.yml@67f0de0d0ceebe69895e868207c04e5c66b3bde8
permissions:
contents: read

go-lint:
name: Go lint
# clover: provider=auto tags=actions
uses: matcra587/github-actions/.github/workflows/go-lint.yml@67f0de0d0ceebe69895e868207c04e5c66b3bde8
go-ci:
name: Go CI
# @clover: constraint=major tag-prefix=go-ci/ tags=actions
uses: matcra587/github-actions/.github/workflows/go-ci.yml@9e87045cb838afd0d6a65ebff3ae2d50fa7e8887 # go-ci/v0.3.2
permissions:
contents: read
with:
# clover: provider=github repository=golangci/golangci-lint constraint=major
golangci-version: v2.13.2

md-lint:
name: Markdown lint
# clover: provider=auto tags=actions
uses: matcra587/github-actions/.github/workflows/md-lint.yml@67f0de0d0ceebe69895e868207c04e5c66b3bde8
# @clover: constraint=major tag-prefix=go-ci/ tags=actions
uses: matcra587/github-actions/.github/workflows/md-lint.yml@9e87045cb838afd0d6a65ebff3ae2d50fa7e8887 # go-ci/v0.3.2
permissions:
contents: read
13 changes: 7 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,19 +28,20 @@ jobs:
pages: read # Required for configure-pages to fetch the site's base URL.
steps:
- name: Checkout
# clover: provider=auto constraint=minor tags=checkout
# @clover: constraint=major tags=checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Configure Pages
# clover: provider=auto constraint=minor tags=configure-pages
# @clover: constraint=major tags=configure-pages
uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0

- name: Set up Python
# clover: provider=auto constraint=minor tags=setup-python
# @clover: constraint=major tags=setup-python
uses: actions/setup-python@5fda3b95a4ea91299a34e894583c3862153e4b97 # v7.0.0
with:
# @clover: constraint=minor
python-version: '3.x'

- name: Install Zensical
Expand All @@ -50,7 +51,7 @@ jobs:
run: zensical build --clean --strict

- name: Upload artifact
# clover: provider=auto constraint=minor tags=upload-pages-artifact
# @clover: constraint=major tags=upload-pages-artifact
uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
with:
path: site
Expand All @@ -68,5 +69,5 @@ jobs:
steps:
- name: Deploy
id: deployment
# clover: provider=auto constraint=minor tags=deploy-pages
uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
# @clover: constraint=major tags=deploy-pages
uses: actions/deploy-pages@368f82528645a54fb793d4d04e342629a3f51346 # v5.0.1
17 changes: 9 additions & 8 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,19 @@ jobs:
id-token: write # Required for cosign via OIDC.
steps:
- name: Checkout
# clover: provider=auto constraint=minor tags=checkout
# @clover: constraint=major tags=checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false

- name: Install cosign
# clover: provider=auto constraint=minor tags=cosign-installer
# @clover: constraint=major tags=cosign-installer
uses: sigstore/cosign-installer@6f9f17788090df1f26f669e9d70d6ae9567deba6 # v4.1.2

- name: Install mise
# clover: provider=auto constraint=minor tags=mise-action
uses: jdx/mise-action@3c2e0cf82a5b2e5249f0d3635a4d83d0ae861518 # v4.2.5
# @clover: constraint=major tags=mise-action
uses: jdx/mise-action@c2a87611a18de5b3828c5652fe268e992400cb5c # v4.3.0
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
install_args: --locked
Expand All @@ -56,11 +56,12 @@ jobs:

- name: Run GoReleaser
if: steps.release-state.outputs.exists != 'true'
# clover: provider=auto constraint=minor tags=goreleaser-action
# @clover: constraint=major tags=goreleaser-action
uses: goreleaser/goreleaser-action@f06c13b6b1a9625abc9e6e439d9c05a8f2190e94 # v7.2.3
with:
distribution: goreleaser
version: ~> v2.15
# clover: provider=github repository=goreleaser/goreleaser constraint=major
version: ~> v2.18
args: release --clean
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down Expand Up @@ -90,7 +91,7 @@ jobs:

- name: Create Homebrew tap token
id: app-token
# clover: provider=auto constraint=minor tags=create-github-app-token
# @clover: constraint=major tags=create-github-app-token
uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0
with:
client-id: ${{ vars.APP_CLIENT_ID }}
Expand All @@ -99,7 +100,7 @@ jobs:
permission-contents: write # Formula push only; blanket app perms otherwise.

- name: Publish Homebrew formula
# clover: provider=auto constraint=minor tags=actions
# @clover: constraint=major tag-prefix=homebrew/ tags=actions
uses: matcra587/github-actions/packages/homebrew-publish-formula@6e3053f35d4ec31adc4f82c04a2c43209f3b36e6 # homebrew/v0.1.0
with:
token: ${{ steps.app-token.outputs.token }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ permissions:
jobs:
security:
name: Security
# clover: provider=auto constraint=minor tag-prefix=security/ tags=actions
# @clover: constraint=major tag-prefix=security/ tags=actions
uses: matcra587/github-actions/.github/workflows/security.yml@09a32f29285295a6b9f604ed98098ea409b899b4 # security/v0.4.2
permissions:
contents: read
Expand Down
3 changes: 2 additions & 1 deletion .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -139,4 +139,5 @@ formatters:
- gofumpt
settings:
gofumpt:
extra-rules: true
extra:
group-params: true
28 changes: 18 additions & 10 deletions .mise.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,24 @@ min_version = "2026.5.0"
lockfile = true

[tools]
# clover: provider=auto constraint=minor tags=go
go = "1.26.6"
actionlint = "latest"
goreleaser = "latest"
cosign = "latest"
zizmor = "latest"
rumdl = "latest"
hk = "latest"
pkl = "latest"
shellcheck = "latest"
# @clover: constraint=minor tags=go
go = "1.27.1"
# @clover: constraint=major tags=actionlint
actionlint = "1.7.12"
# @clover: constraint=major tags=goreleaser
goreleaser = "2.18.1"
# @clover: constraint=major tags=cosign
cosign = "3.1.3"
# @clover: constraint=major tags=zizmor
zizmor = "1.30.1"
# @clover: constraint=major tags=rumdl
rumdl = "0.2.69"
# @clover: id=hk constraint=major tags=hk
hk = "1.58.1"
# @clover: constraint=major tags=pkl
pkl = "0.32.1"
# @clover: constraint=major tags=shellcheck
shellcheck = "0.11.0"

[env]
HK_MISE = 1
Expand Down
20 changes: 12 additions & 8 deletions cmd/slick/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ import (
"github.com/gechr/clib/help"
"github.com/gechr/clib/theme"
"github.com/gechr/clog"
"github.com/gechr/x/human"
"github.com/gechr/x/shell"
xfilepath "github.com/gechr/x/filepath"
"github.com/gechr/x/terminal"
"github.com/google/uuid"
"github.com/matcra587/slack-cli/internal/agent"
cliagent "github.com/matcra587/slack-cli/internal/cli/agent"
cliauth "github.com/matcra587/slack-cli/internal/cli/auth"
clicache "github.com/matcra587/slack-cli/internal/cli/cache"
clichannel "github.com/matcra587/slack-cli/internal/cli/channel"
"github.com/matcra587/slack-cli/internal/cli/clitheme"
clicompletion "github.com/matcra587/slack-cli/internal/cli/completion"
cliconfig "github.com/matcra587/slack-cli/internal/cli/config"
clifile "github.com/matcra587/slack-cli/internal/cli/file"
Expand Down Expand Up @@ -212,7 +212,7 @@ func NewRootCommand(options ...RootOption) *cobra.Command {

clog.SetEnvPrefix("SLICK")
theme.SetEnvPrefix("SLICK")
getTheme := sync.OnceValue(theme.Default)
getTheme := sync.OnceValue(clitheme.Default)
th := getTheme()
renderer := help.NewRenderer(th)
runtime.Theme = th
Expand Down Expand Up @@ -321,14 +321,18 @@ func NewRootCommand(options ...RootOption) *cobra.Command {

func defaultConfigPath() string {
if path := os.Getenv("SLICK_CONFIG"); path != "" {
return human.ExpandPath(path)
return xfilepath.Expand(path)
}
if path := os.Getenv("SLACK_CLI_CONFIG"); path != "" {
return human.ExpandPath(path)
return xfilepath.Expand(path)
}
dir, err := shell.XDGConfigHome()
if err != nil {
return ""
dir := os.Getenv("XDG_CONFIG_HOME")
if dir == "" {
home, err := os.UserHomeDir()
if err != nil {
return ""
}
dir = filepath.Join(home, ".config")
}
return filepath.Join(dir, "slick", "config.toml")
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/slick/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,11 @@ func TestDefaultConfigPathUsesXDGConfigDirAndEnvOverride(t *testing.T) {
t.Fatalf("defaultConfigPath = %q, want %q", got, want)
}

t.Setenv("XDG_CONFIG_HOME", "relative-config")
if got, want := defaultConfigPath(), filepath.Join("relative-config", "slick", "config.toml"); got != want {
t.Fatalf("relative XDG config path = %q, want %q", got, want)
}

t.Setenv("XDG_CONFIG_HOME", "")
home = t.TempDir()
t.Setenv("HOME", home)
Expand Down
14 changes: 1 addition & 13 deletions cmd/slick/output_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,17 +587,5 @@ func newOutputTestContext(mode RenderMode, colorMode ...clog.ColorMode) (*Comman
}

func buildTestLoggers(stdout, stderr *bytes.Buffer) (*clog.Logger, *clog.Logger) {
sl := clog.New(clog.TestOutput(stdout))
sl.SetOmitZero(true)
// Mirror BuildBaseLoggers: stdout success events drop the level prefix so
// plain-mode output reads as "Message sent ts=..." not "INF Message sent".
sl.SetParts(clog.PartMessage, clog.PartFields)

el := clog.New(clog.TestOutput(stderr))
el.SetOmitZero(true)
el.SetParts(clog.PartLevel, clog.PartMessage, clog.PartFields)
el.SetNonTTYLevel(clog.LevelWarn)
el.SetJSONPrintMode(clog.JSONFlat)

return sl, el
return buildBaseLoggers(stdout, stderr, clog.ColorNever)
}
Loading
Loading