18 Commits

Author SHA1 Message Date
Alex Dunmow
421f5ee0cb test(cli): cover autoCommitPluginMod commit and no-op paths
autoCommitPluginMod runs `git status --porcelain plugin.mod` then commits if
dirty. Add two cases: dirty plugin.mod produces an "Add plugin.mod" commit,
and a clean state leaves HEAD unchanged. Uses t.Chdir to scope CWD to the
temp repo without polluting parent state.
2026-06-03 09:11:37 +08:00
Alex Dunmow
ee76d76dc6 test(cli): cover BuildSourceArchive dirty-tree stash-create path
The dirty-tree branch (where git stash create captures uncommitted tracked
changes) was untested. Add two cases: one asserting the archive contains
the dirty working-copy contents (not HEAD) and the working tree is not
mutated; another asserting untracked files are excluded — the contract
the --allow-dirty publish warning relies on.
2026-06-03 09:11:08 +08:00
Alex Dunmow
ab465ef07c fix(cli): run gitignore-tracked warning before dirty-check so it fires unconditionally 2026-06-03 08:59:41 +08:00
Alex Dunmow
137a50c932 fix(cli): warn when publishing a repo that contains submodules
`git archive` does not recurse into submodules, so a plugin shipping
vendored code via submodule produced a tarball where the submodule path
existed but was empty — silent failure. Now publish reads .gitmodules
and lists submodule paths to stderr with guidance to vendor or pack
them separately. The publish still proceeds, since the developer may
not actually need the submodule contents in the archive.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-03 08:57:46 +08:00
Alex Dunmow
c3cfa18ae0 fix(cli): warn about untracked files when publishing with --allow-dirty
`git stash create` only captures tracked content, so a developer using
--allow-dirty after creating new files (but forgetting to `git add`)
would ship a tarball missing them with no indication. Now publish lists
the untracked, non-ignored files to stderr and suggests `git add` when
--allow-dirty is in play.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-03 08:56:43 +08:00
Alex Dunmow
4c0104619e fix(cli): friendly error when publishing from a repo with no commits
Previously a brand-new repo (git init, no commits) surfaced `git stash
create: exit status 128: You do not have the initial commit yet` from
deep inside the archive helper. Now the publish flow detects this case
via `git rev-parse --verify HEAD` up front and prints "no commits in
repository; run `git add . && git commit` before publishing". Also
updates the init flow's hint to mention `git init && git commit` so
users aren't misled into thinking `git init` alone is enough.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-06-03 08:56:27 +08:00
Alex Dunmow
d1c194ce66 fix(cli): archive working tree (via stash create) so --allow-dirty publishes uncommitted plugin.mod 2026-06-03 07:07:10 +08:00
Alex Dunmow
139d9b8543 fix(sdk): Coords trims leading @ from scope so callers can store either form 2026-06-03 07:03:19 +08:00
Alex Dunmow
12afdbd25e fix(cli): store scope without @ in plugin.mod so Coords() yields single @ 2026-06-03 07:02:35 +08:00
Alex Dunmow
f232effe69 feat(cli): init prompts for kind and categories 2026-06-03 06:56:07 +08:00
Alex Dunmow
08be22ec34 feat(sdk): add Kind and Categories to ModPlugin; writeMod emits them 2026-06-03 01:41:56 +08:00
Alex Dunmow
aafdc44f6f fix(cli): drop duplicated version in publish output (Coords already includes it) 2026-06-03 01:41:03 +08:00
Alex Dunmow
57a217f54d feat(cli): warn at publish when tracked files match .gitignore 2026-06-03 01:35:04 +08:00
Alex Dunmow
c825942c8d feat(cli): init auto-commits plugin.mod, drops ninja git remote 2026-06-03 01:34:42 +08:00
Alex Dunmow
e5b27f5a65 feat(cli): rewrite plugin publish to send tar.zst archive 2026-06-03 01:33:12 +08:00
Alex Dunmow
31e7b72b49 feat(cli): add BuildSourceArchive for plugin publish tar.zst 2026-06-03 01:21:55 +08:00
Alex Dunmow
2a76b30c51 feat(cli): scope subcommand, interactive scope prompt, bump+version helpers
Pre-existing CLI improvements ahead of the tarball-publish refactor:
- New top-level `ninja scope` command (create, list, set-default).
- `init` accepts no --scope: prompts from ListMyScopes or uses creds default.
- Plugin name prompted if not provided.
- `plugin bump <major|minor|patch>` writes the bumped version into plugin.mod.
- `plugin version` prints the current plugin.mod version.
- `login` prints a URL with ?user_code= so the link is one click.
- creds: HostCreds gains optional default_scope.
- plugin/version: ParseBaseSemver + BumpVersion helpers, with tests.
2026-06-03 01:18:11 +08:00
Alex Dunmow
7f4bce79c9 feat(cli): ninja CLI with login, plugin init/publish/status
Cobra scaffold, credentials store, Connect client, device-flow login,
whoami/logout, plugin init (creates + adds git remote), publish (tag + push
+ registry RPC), and status (list scopes/plugins). Proto copied from
orchestrator with buf codegen for client stubs.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-06-01 23:55:01 +08:00