Skip to content

Commit c763ff9

Browse files
feat(cli): auto-register generators and clean up ci smoke (#214)
## Type - [x] `feat` — New feature - [x] `fix` — Bug fix - [x] `refactor` — Code restructure (no behavior change) - [x] `docs` — Documentation only - [x] `test` — Test coverage - [x] `chore` — Build, CI, tooling - [ ] `perf` — Performance improvement ## Summary This PR completes provider/controller auto-registration in the CLI and cleans up CI smoke checks by moving inline workflow scripts into Makefile targets. Release artifact automation changes were intentionally removed and will be handled in a later PR. ## Changes - Added idempotent AST insertion for providers and controllers with typed errors and atomic write behavior. - Integrated auto-registration into `modkit new provider` and `modkit new controller` with explicit partial-failure remediation output. - Propagated registration failures as non-zero errors from CLI commands while preserving user guidance output. - Normalized provider token component names (`-` -> `_`) to keep generated tokens valid for module.component format. - Expanded CLI/AST tests for insertion, duplicate prevention, malformed module shapes, helper/error paths, and command failure paths. - Updated README quickstart examples to avoid ambiguous `--module` usage when already inside a module directory. - Refactored `.github/workflows/ci.yml` `cli-smoke` job to call Makefile targets instead of inline shell blocks. - Added `make cli-smoke-build` and `make cli-smoke-scaffold` targets and documented them in `CONTRIBUTING.md`. - Updated smoke compile step to build package directory (`go build ./cmd/api`). - Simplified Codecov upload input to `.coverage/coverage.out` (removed missing `.coverage/coverage-examples.out`). - Removed GoReleaser-related files/workflow changes from this PR (`.goreleaser.yml` deletion + release workflow revert). - Added `.sisyphus/` to `.gitignore` and removed tracked `.sisyphus` artifacts to prevent leaking local paths/session metadata. ## Breaking Changes None ## Validation ```bash make fmt && make lint && make vuln && make test && make test-coverage make test-patch-coverage make cli-smoke-build && make cli-smoke-scaffold ``` ## Checklist - [x] Code follows project style (`make fmt` passes) - [x] Linter passes (`make lint`) - [x] Tests pass (`make test`) - [x] Tests added/updated for new functionality - [x] Documentation updated (if applicable) - [x] Commit messages follow [Conventional Commits](https://www.conventionalcommits.org/) ## Resolves N/A (not issue-driven) ## Notes - Releaser automation is explicitly deferred to a separate follow-up PR. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * CLI now auto-attempts to register newly created controllers and providers and reports Created / Registered status with actionable guidance if registration fails * **Documentation** * Expanded README and contributing guide with installation, CLI quick-start, onboarding steps, features, and CI smoke-check instructions * **Tests** * Added/expanded tests covering registration, idempotency, token normalization, and failure paths * **Chores** * CI smoke-check workflow and Makefile targets to build/scaffold the CLI; added .sisyphus/ to .gitignore <!-- end of auto-generated comment: release notes by coderabbit.ai --> --------- Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
1 parent ae220be commit c763ff9

12 files changed

Lines changed: 1358 additions & 40 deletions

File tree

.github/workflows/ci.yml

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,5 +67,23 @@ jobs:
6767
uses: codecov/codecov-action@v5
6868
with:
6969
token: ${{ secrets.CODECOV_TOKEN }}
70-
files: .coverage/coverage.out,.coverage/coverage-examples.out
70+
files: .coverage/coverage.out
7171
fail_ci_if_error: false
72+
73+
cli-smoke:
74+
name: CLI Smoke Test
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v6
78+
- uses: actions/setup-go@v6
79+
with:
80+
go-version: "1.25.7"
81+
cache-dependency-path: |
82+
tools/tools.go
83+
go.mod
84+
85+
- name: Build CLI
86+
run: make cli-smoke-build
87+
88+
- name: Test CLI scaffolding
89+
run: make cli-smoke-scaffold

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,4 @@ dist/
1010
# Internal planning files
1111
.plans/
1212
.cursor/
13+
.sisyphus/

CONTRIBUTING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,15 @@ Runs `govulncheck`.
9696
make test
9797
```
9898

99+
### Run CLI Smoke Checks
100+
101+
These are the same checks used by the CI `cli-smoke` job:
102+
103+
```bash
104+
make cli-smoke-build
105+
make cli-smoke-scaffold
106+
```
107+
99108
### Install Development Tools
100109

101110
```bash

Makefile

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
SHELL := /bin/sh
22

3-
.PHONY: fmt lint vuln test test-coverage test-patch-coverage tools setup-hooks lint-commit
3+
.PHONY: fmt lint vuln test test-coverage test-patch-coverage tools setup-hooks lint-commit cli-smoke-build cli-smoke-scaffold
44

55
GOPATH ?= $(shell go env GOPATH)
66
GOIMPORTS ?= $(GOPATH)/bin/goimports
@@ -69,3 +69,15 @@ setup-hooks: tools
6969
# Validate a commit message (for manual testing)
7070
lint-commit:
7171
@echo "$(MSG)" | $(COMMITLINT) lint
72+
73+
cli-smoke-build:
74+
go build -o /tmp/modkit ./cmd/modkit
75+
76+
cli-smoke-scaffold: cli-smoke-build
77+
@rm -rf /tmp/cli-test
78+
@mkdir -p /tmp/cli-test
79+
@cd /tmp/cli-test && /tmp/modkit new app testapp
80+
@test -f /tmp/cli-test/testapp/cmd/api/main.go
81+
@test -f /tmp/cli-test/testapp/internal/modules/app/module.go
82+
@test -f /tmp/cli-test/testapp/go.mod
83+
@cd /tmp/cli-test/testapp && go build ./cmd/api

README.md

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,72 @@ func main() {
7676

7777
## Installation
7878

79+
### Library
80+
7981
```bash
8082
go get github.com/go-modkit/modkit
8183
```
8284

85+
### CLI Tool
86+
87+
Install the `modkit` CLI using go install:
88+
89+
```bash
90+
go install github.com/go-modkit/modkit/cmd/modkit@latest
91+
```
92+
93+
Or download a pre-built binary from the [releases page](https://github.com/go-modkit/modkit/releases).
94+
8395
Requires Go 1.25.7+
8496
We pin the patch level to 1.25.7 in CI to align with vulnerability scanning and keep a consistent security posture.
8597

98+
## Quick Start with CLI
99+
100+
Scaffold a new modkit application in seconds:
101+
102+
```bash
103+
# Create a new app
104+
modkit new app myapp
105+
cd myapp
106+
107+
# Run the application
108+
go run cmd/api/main.go
109+
```
110+
111+
Add providers and controllers to existing modules:
112+
113+
```bash
114+
# Create a new module
115+
cd internal/modules
116+
mkdir users
117+
cd users
118+
119+
# Initialize module.go with basic structure
120+
cat > module.go << 'EOF'
121+
package users
122+
123+
import "github.com/go-modkit/modkit/modkit/module"
124+
125+
type UsersModule struct{}
126+
127+
func (m *UsersModule) Definition() module.ModuleDef {
128+
return module.ModuleDef{
129+
Name: "users",
130+
Providers: []module.ProviderDef{},
131+
Controllers: []module.ControllerDef{},
132+
}
133+
}
134+
EOF
135+
136+
# Add a provider
137+
modkit new provider service
138+
139+
# Add a controller
140+
modkit new controller users
141+
```
142+
143+
The CLI automatically registers providers and controllers in your module's `Definition()` function.
144+
86145
## Features
87146

88147
- **Module System** — Compose apps from self-contained modules with explicit boundaries

go.work.sum

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9 h1:VpgP7xuJadIUu
2222
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0 h1:59MxjQVfjXsBpLy+dbd2/ELV5ofnUkUZBvWSC85sheA=
2323
github.com/AdamKorcz/go-118-fuzz-build v0.0.0-20230306123547-8075edf89bb0/go.mod h1:OahwfttHWG6eJ0clwcfBAHoDI6X/LV/15hx/wlMZSrU=
2424
github.com/BurntSushi/xgb v0.0.0-20160522181843-27f122750802 h1:1BDTz0u9nC3//pOCMdNH+CiXJVYJh5UQNCOBG7jbELc=
25+
github.com/Masterminds/goutils v1.1.0 h1:zukEsf/1JZwCMgHiK3GZftabmxiCw4apj3a28RPBiVg=
2526
github.com/Masterminds/goutils v1.1.0/go.mod h1:8cTjp+g8YejhMuvIA5y2vz3BpJxksy863GQaJW2MFNU=
2627
github.com/Masterminds/semver v1.5.0 h1:H65muMkzWKEuNDnfl9d70GUjFniHKHRbFPGBuZ3QEww=
2728
github.com/Masterminds/semver v1.5.0/go.mod h1:MB6lktGJrhw8PrUyiEoblNEGEQ+RzHPF078ddwwvV3Y=
29+
github.com/Masterminds/sprig v2.22.0+incompatible h1:z4yfnGrZ7netVz+0EDJ0Wi+5VZCSYp4Z0m2dk6cEM60=
2830
github.com/Masterminds/sprig v2.22.0+incompatible/go.mod h1:y6hNFY5UBTIWBxnzTeuNhlNS5hqE0NB0E6fgfo2Br3o=
2931
github.com/Microsoft/hcsshim v0.11.5 h1:haEcLNpj9Ka1gd3B3tAEs9CpE0c+1IhoL59w/exYU38=
3032
github.com/Microsoft/hcsshim v0.11.5/go.mod h1:MV8xMfmECjl5HdO7U/3/hFVnkmSBjAjmA09d4bExKcU=
@@ -38,11 +40,13 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751 h1:JYp7IbQjafo
3840
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d h1:UQZhZ2O0vMHr2cI+DC1Mbh0TJxzA3RcLoMsFw+aXw7E=
3941
github.com/armon/go-metrics v0.3.10 h1:FR+drcQStOe+32sYyJYyZ7FIdgoGGBnwLl+flodp8Uo=
4042
github.com/armon/go-metrics v0.3.10/go.mod h1:4O98XIr/9W0sxpJ8UaYkvjk10Iff7SnFrb4QAOwNTFc=
43+
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310 h1:BUAU3CGlLvorLI26FmByPp2eC2qla6E1Tw+scpcg/to=
4144
github.com/armon/go-radix v0.0.0-20180808171621-7fddfc383310/go.mod h1:ufUuZ+zHj4x4TnLV4JWEpy2hxWSpsRywHrMgIH9cCH8=
4245
github.com/aymanbagabas/go-udiff v0.2.0 h1:TK0fH4MteXUDspT88n8CKzvK0X9O2xu9yQjWpi6yML8=
4346
github.com/aymanbagabas/go-udiff v0.2.0/go.mod h1:RE4Ex0qsGkTAJoQdQQCA0uG+nAzJO/pI/QwceO5fgrA=
4447
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
4548
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
49+
github.com/bgentry/speakeasy v0.1.0 h1:ByYyxL9InA1OWqxJqqp2A5pYHUrCiAL6K3J+LKSsQkY=
4650
github.com/bgentry/speakeasy v0.1.0/go.mod h1:+zsyZBPWlz7T6j88CTgSN5bM796AkVf0kBD4zp0CCIs=
4751
github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM=
4852
github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ=
@@ -171,6 +175,7 @@ github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 h1:Ovs26xHkKqVztRpIrF/92Bcuy
171175
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0/go.mod h1:8NvIoxWQoOIhqOTXgfV/d3M/q6VIi02HzZEHgUlZvzk=
172176
github.com/hashicorp/consul/api v1.12.0 h1:k3y1FYv6nuKyNTqj6w9gXOx5r5CfLj/k/euUeBXj1OY=
173177
github.com/hashicorp/consul/api v1.12.0/go.mod h1:6pVBMo0ebnYdt2S3H87XhekM/HHrUoTD2XXb/VrZVy0=
178+
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
174179
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
175180
github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I=
176181
github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
@@ -180,6 +185,7 @@ github.com/hashicorp/go-hclog v1.2.0 h1:La19f8d7WIlm4ogzNHB0JGqs5AUDAZ2UfCY4sJXc
180185
github.com/hashicorp/go-hclog v1.2.0/go.mod h1:whpDNt7SSdeAju8AWKIWsul05p54N/39EeqMAyrmvFQ=
181186
github.com/hashicorp/go-immutable-radix v1.3.1 h1:DKHmCUm2hRBK510BaiZlwvpD40f8bJFeZnpfm2KLowc=
182187
github.com/hashicorp/go-immutable-radix v1.3.1/go.mod h1:0y9vanUI8NX6FsYoO3zeMjhV/C5i9g4Q3DwcSNZ4P60=
188+
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
183189
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
184190
github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+lD48awMYo=
185191
github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM=
@@ -189,8 +195,10 @@ github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+l
189195
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
190196
github.com/hashicorp/serf v0.9.7 h1:hkdgbqizGQHuU5IPqYM1JdSMV8nKfpuOnZYXssk9muY=
191197
github.com/hashicorp/serf v0.9.7/go.mod h1:TXZNMjZQijwlDvp+r0b63xZ45H7JmCmgg4gpTwn9UV4=
198+
github.com/huandu/xstrings v1.3.2 h1:L18LIDzqlW6xN2rEkpdV8+oL/IXWJ1APd+vsdYy4Wdw=
192199
github.com/huandu/xstrings v1.3.2/go.mod h1:y5/lhBue+AyNmUVz9RLU9xbLR0o4KIIExikq4ovT0aE=
193200
github.com/ianlancetaylor/demangle v0.0.0-20181102032728-5e5cf60278f6 h1:UDMh68UUwekSh5iP2OMhRRZJiiBccgV7axzUG8vi56c=
201+
github.com/imdario/mergo v0.3.11 h1:3tnifQM4i+fbajXKBHXWEH+KvNHqojZ778UH75j3bGA=
194202
github.com/imdario/mergo v0.3.11/go.mod h1:jmQim1M+e3UYxmgPu/WyfjB3N3VflVyUjjjwH0dnCYA=
195203
github.com/intel/goresctrl v0.3.0 h1:K2D3GOzihV7xSBedGxONSlaw/un1LZgWsc9IfqipN4c=
196204
github.com/intel/goresctrl v0.3.0/go.mod h1:fdz3mD85cmP9sHD8JUlrNWAxvwM86CrbmVXltEKd7zk=
@@ -235,6 +243,7 @@ github.com/minio/sha256-simd v1.0.0 h1:v1ta+49hkWZyvaKwrQB8elexRqm6Y0aMLjCNsrYxo
235243
github.com/minio/sha256-simd v1.0.0/go.mod h1:OuYzVNI5vcoYIAmbIvHPl3N3jUzVedXbKy5RFepssQM=
236244
github.com/mistifyio/go-zfs/v3 v3.0.1 h1:YaoXgBePoMA12+S1u/ddkv+QqxcfiZK4prI6HPnkFiU=
237245
github.com/mistifyio/go-zfs/v3 v3.0.1/go.mod h1:CzVgeB0RvF2EGzQnytKVvVSDwmKJXxkOTUGbNrTja/k=
246+
github.com/mitchellh/cli v1.1.2 h1:PvH+lL2B7IQ101xQL63Of8yFS2y+aDlsFcsqNc+u/Kw=
238247
github.com/mitchellh/cli v1.1.2/go.mod h1:6iaV0fGdElS6dPBx0EApTxHrcWvmJphyh2n8YBLPPZ4=
239248
github.com/moby/locker v1.0.1 h1:fOXqR41zeveg4fFODix+1Ch4mj/gT0NE1XJbp/epuBg=
240249
github.com/moby/locker v1.0.1/go.mod h1:S7SDdo5zpBK84bzzVlKr2V0hz+7x9hWbYC/kq7oQppc=
@@ -268,6 +277,7 @@ github.com/otiai10/curr v1.0.0 h1:TJIWdbX0B+kpNagQrjgq8bCMrbhiuX73M2XwgtDMoOI=
268277
github.com/otiai10/mint v1.3.1 h1:BCmzIS3n71sGfHB5NMNDB3lHYPz8fWSkCAErHed//qc=
269278
github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d h1:CdDQnGF8Nq9ocOS/xlSptM1N3BbrA6/kmaep5ggwaIA=
270279
github.com/phayes/checkstyle v0.0.0-20170904204023-bfd46e6a821d/go.mod h1:3OzsM7FXDQlpCiw2j81fOmAwQLnZnLGXVKUzeKQXIAw=
280+
github.com/posener/complete v1.1.1 h1:ccV59UEOTzVDnDUEFdT95ZzHVZ+5+158q8+SJb2QV5w=
271281
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
272282
github.com/prometheus/client_golang v1.14.0 h1:nJdhIvne2eSX/XRAFV9PcvFFRbrjbcTUj0VP62TMhnw=
273283
github.com/prometheus/client_golang v1.14.0/go.mod h1:8vpkKitgIVNcqrRBWh1C4TIUQgYNtG/XQE4E/Zae36Y=
@@ -387,6 +397,7 @@ gopkg.in/alecthomas/kingpin.v2 v2.2.6 h1:jMFz6MfLP0/4fUyZle81rXUoxOBFi19VUFKVDOQ
387397
gopkg.in/errgo.v2 v2.1.0 h1:0vLT13EuvQ0hNvakwLuFZ/jYrLp5F3kcWHXdRggjCE8=
388398
gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc=
389399
gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw=
400+
gopkg.in/src-d/go-billy.v4 v4.3.2 h1:0SQA1pRztfTFx2miS8sA97XvooFeNOmvUenF4o0EcVg=
390401
gopkg.in/src-d/go-billy.v4 v4.3.2/go.mod h1:nDjArDMp+XMs1aFAESLRjfGSgfvoYN0hDfzEk0GjC98=
391402
k8s.io/api v0.26.2 h1:dM3cinp3PGB6asOySalOZxEG4CZ0IAdJsrYZXE/ovGQ=
392403
k8s.io/api v0.26.2/go.mod h1:1kjMQsFE+QHPfskEcVNgL3+Hp88B80uj0QtSOlj8itU=

0 commit comments

Comments
 (0)