From 57a217f54da6da24fdeedf2ce1e4d789aea113b6 Mon Sep 17 00:00:00 2001 From: Alex Dunmow Date: Wed, 3 Jun 2026 01:35:04 +0800 Subject: [PATCH] feat(cli): warn at publish when tracked files match .gitignore --- cmd/ninja/cmd/plugin.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/cmd/ninja/cmd/plugin.go b/cmd/ninja/cmd/plugin.go index c3437b3..fbf67f1 100644 --- a/cmd/ninja/cmd/plugin.go +++ b/cmd/ninja/cmd/plugin.go @@ -235,6 +235,15 @@ func newPluginPublishCmd() *cobra.Command { } } + out, _ := exec.Command("git", "ls-files", "--cached", "--ignored", "--exclude-standard").Output() + if names := strings.TrimSpace(string(out)); names != "" { + fmt.Fprintln(os.Stderr, "warning: these tracked files match .gitignore and will still be shipped:") + for _, n := range strings.Split(names, "\n") { + fmt.Fprintln(os.Stderr, " "+n) + } + fmt.Fprintln(os.Stderr, " (run `git rm --cached ` to drop)") + } + archiveBytes, err := archive.BuildSourceArchive(".") if err != nil { return fmt.Errorf("build archive: %w", err)