Skip to content

Impl/srs v1.2.0 completion - #18

Merged
Bangkah merged 93 commits into
mainfrom
impl/srs-v1.2.0-completion
Oct 18, 2026
Merged

Bangkah merged 93 commits into
mainfrom
impl/srs-v1.2.0-completion

Conversation

@Bangkah

@Bangkah Bangkah commented Oct 16, 2026

Copy link
Copy Markdown
Member

No description provided.

Bangkah and others added 18 commits October 16, 2026 05:09
Removed the License section from the README.
* fix(gitignore): ignore dist/ generated output directory

Add /dist/ to .gitignore so generated artifacts are not accidentally
committed to the repository.

* docs(RELEASE): update Go prerequisite to 1.24.2

Change Go requirement from 1.22 to 1.24.2 to match the actual project
requirement and the reference machine used for benchmarks.

* chore(deps): tidy go.mod and go.sum

Remove unused indirect dependencies (charmbracelet/log, go-logfmt, go-udiff,
go-cmp, go-spew, go-difflib, godebug, sahilm/fuzzy, x/exp, yaml.v3, testify)
that are no longer referenced after template refactor. go directive stays at
1.24.2.

* fix(cli): allow dry-run on directories with existing conflicts

Move dry-run handling before the conflict-without-force check so
--dry-run can preview changes even when target files already exist.
Conflict exit code 3 is still enforced for actual commits without --force.

* refactor(templates): make Version a var for ldflags injection

Change Version from const to var so GoReleaser ldflags can override the
template version at build time (-X devopsgen.dev/devopsgen/internal/templates.Version).

* feat(validator): reject shell syntax in Dockerfile and unrendered template in workflow

Add validation rules:
- Dockerfile COPY/ADD must not contain shell syntax (2>/dev/null, ||, &&)
- Workflow CI must not contain unrendered [[ or {{. template syntax

These catch template rendering bugs before artifacts reach CI.

* fix(docker/go): use ARG GO_VERSION=1.24 with GOTOOLCHAIN=auto and optional go.sum

Replace hardcoded golang:1.22-alpine with ARG GO_VERSION=1.24 so projects
requiring newer Go (e.g. 1.24.2) build successfully. Add GOTOOLCHAIN=auto as
a safety net and make go.sum optional via COPY go.mod go.sum*. Override with
docker build --build-arg GO_VERSION=1.25.

* fix(docker/node): fall back to npm install when package-lock.json is missing

Replace plain RUN npm ci with a shell guard so Node Dockerfiles work for
projects without a lockfile:
  RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi

Also add ENV NODE_ENV=production and COPY --from=builder /app ./ to runtime
stage for consistency across express, generic, nestjs, nextjs, and vite.

* fix(ci/workflow): use template conditionals, setup-go via go.mod, and lockfile fallback

Replace shell if: guards with [[if eq ...]] template conditionals so unused
steps are removed at render time. Use go-version-file: go.mod for Go setup
(instead of hardcoded 1.22), pin setup-node action, add npm ci/install
fallback, and guard registry logins/push with github.event_name != 'pull_request'.

* chore(release): harden GoReleaser config for multi-platform release

Add CGO_ENABLED=0 env, inject version/commit/date ldflags, switch archives
to formats list with zip for Windows, use version_template for snapshots,
and simplify changelog filters to mapping format.

* feat(ci): add actionlint to workflow lint step

Install actionlint v1.7.12 via go install and lint .github/workflows/ci.yml
on every push/PR to prevent syntax errors in generated workflow templates
from reaching CI.
- Write go tool cover output to file then cat, avoiding SC2046
- Quote  in awk -v assignment to avoid SC2086
- Quote C:\Users\atha\go to prevent word splitting (SC2046)
- Keep  quoted in awk assignment (SC2086)
Verified locally: actionlint exits 0 on .github/workflows/ci.yml
* fix(gitignore): ignore dist/ generated output directory

Add /dist/ to .gitignore so generated artifacts are not accidentally
committed to the repository.

* docs(RELEASE): update Go prerequisite to 1.24.2

Change Go requirement from 1.22 to 1.24.2 to match the actual project
requirement and the reference machine used for benchmarks.

* chore(deps): tidy go.mod and go.sum

Remove unused indirect dependencies (charmbracelet/log, go-logfmt, go-udiff,
go-cmp, go-spew, go-difflib, godebug, sahilm/fuzzy, x/exp, yaml.v3, testify)
that are no longer referenced after template refactor. go directive stays at
1.24.2.

* fix(cli): allow dry-run on directories with existing conflicts

Move dry-run handling before the conflict-without-force check so
--dry-run can preview changes even when target files already exist.
Conflict exit code 3 is still enforced for actual commits without --force.

* refactor(templates): make Version a var for ldflags injection

Change Version from const to var so GoReleaser ldflags can override the
template version at build time (-X devopsgen.dev/devopsgen/internal/templates.Version).

* feat(validator): reject shell syntax in Dockerfile and unrendered template in workflow

Add validation rules:
- Dockerfile COPY/ADD must not contain shell syntax (2>/dev/null, ||, &&)
- Workflow CI must not contain unrendered [[ or {{. template syntax

These catch template rendering bugs before artifacts reach CI.

* fix(docker/go): use ARG GO_VERSION=1.24 with GOTOOLCHAIN=auto and optional go.sum

Replace hardcoded golang:1.22-alpine with ARG GO_VERSION=1.24 so projects
requiring newer Go (e.g. 1.24.2) build successfully. Add GOTOOLCHAIN=auto as
a safety net and make go.sum optional via COPY go.mod go.sum*. Override with
docker build --build-arg GO_VERSION=1.25.

* fix(docker/node): fall back to npm install when package-lock.json is missing

Replace plain RUN npm ci with a shell guard so Node Dockerfiles work for
projects without a lockfile:
  RUN if [ -f package-lock.json ]; then npm ci; else npm install; fi

Also add ENV NODE_ENV=production and COPY --from=builder /app ./ to runtime
stage for consistency across express, generic, nestjs, nextjs, and vite.

* fix(ci/workflow): use template conditionals, setup-go via go.mod, and lockfile fallback

Replace shell if: guards with [[if eq ...]] template conditionals so unused
steps are removed at render time. Use go-version-file: go.mod for Go setup
(instead of hardcoded 1.22), pin setup-node action, add npm ci/install
fallback, and guard registry logins/push with github.event_name != 'pull_request'.

* chore(release): harden GoReleaser config for multi-platform release

Add CGO_ENABLED=0 env, inject version/commit/date ldflags, switch archives
to formats list with zip for Windows, use version_template for snapshots,
and simplify changelog filters to mapping format.

* feat(ci): add actionlint to workflow lint step

Install actionlint v1.7.12 via go install and lint .github/workflows/ci.yml
on every push/PR to prevent syntax errors in generated workflow templates
from reaching CI.

* fix(ci): quote shell variables to satisfy actionlint/shellcheck

- Write go tool cover output to file then cat, avoiding SC2046
- Quote  in awk -v assignment to avoid SC2086

* fix(ci): quote shell variables in actionlint and coverage steps

- Quote C:\Users\atha\go to prevent word splitting (SC2046)
- Keep  quoted in awk assignment (SC2086)
Verified locally: actionlint exits 0 on .github/workflows/ci.yml
…CI workflow

- Add StackPython to config with fastapi, django, flask, py-generic app types
- Dockerfile.python.tmpl: multi-stage build with venv at /opt/venv
  (runtime user 1000 can read packages, unlike /root/.local)
- ci-workflow.yaml.tmpl: Python setup step (setup-python, pip install)
- Trim markers [[- if to eliminate blank lines in generated ci.yml
- Validator: check {{. instead of [[ to allow bash [[ -f ]] syntax
- Detector: detectPython via requirements.txt, pyproject.toml, setup.py, main.py, app.py
- CLI list: show python stack and app types
- Regression tests: rules_test.go, regression_test.go (dry-run conflict + python stack)
Resolve merge conflicts between local and origin/fix/dry-run-conflict-and-actionlint:
- Use StackPython/AppTypeGeneric consistently across config, validate, generator
- Dockerfile.python.tmpl: python:3.12-slim base with /opt/venv
- validator.go: only flag {{. as unrendered template (bash [[ is valid)
- ci.yml: keep hadolint Dockerfile lint step
- ci-workflow.yaml.tmpl: use [[if template syntax
- Remove duplicate detectPython from detector.go
- generator.go: use StackPython

All tests pass.
Resolve merge conflicts between local and origin/fix/dry-run-conflict-and-actionlint:
- Use StackPython/AppTypeGeneric consistently across config, validate, generator
- Dockerfile.python.tmpl: python:3.12-slim base with /opt/venv
- validator.go: only flag {{. as unrendered template (bash [[ is valid)
- ci.yml: keep hadolint Dockerfile lint step
- ci-workflow.yaml.tmpl: use [[if template syntax
- Remove duplicate detectPython from detector.go
- generator.go: use StackPython

All tests pass.
Resolve conflicts between fix/dry-run-conflict-and-actionlint and origin/main:
- config.go/validate.go: use StackPython/AppTypeGeneric consistently
- generator.go: use StackPython, remove duplicate case
- root.go: generic (Python) app type listing
- Dockerfile.python.tmpl: slim base with /opt/venv
- ci-workflow.yaml.tmpl: [[if template syntax

All tests pass.
…tector.go

- config.go: remove stray closing paren after AppType const block
- detector.go: remove duplicate detectPython (HEAD duplicate of incoming version)
Split monolithic deployment.yaml into separate files:
- kubernetes/deployment.yaml (Deployment only)
- kubernetes/service.yaml (Service only)
- kubernetes/ingress.yaml (Ingress, only when --ingress)

This matches SRS section 4.8 which specifies separate files:
- deployment.yaml
- service.yaml
- ingress.yaml (if requested)

Updated generator.go to emit all three artifacts when K8s enabled.
Updated generator_test.go to verify separated file structure.

All tests pass (go build ./..., go test ./...).
… fixes

- Add strict tag validation (FR-09): max 128 chars, no shell/YAML metacharacters
- Remove Python from MVP scope (SRS 2.3): only go and nodejs stacks
- Implement full Bubble Tea TUI wizard with Init/Update/View/Run cycle
- Add structural YAML validator with recursive artifact discovery (FR-13)
- Fix filesystem rollback: backup collision, symlink parent checks, dir tracking
- Fix generator: Go build-cmd, Node.js npm run wrapper, Vite npx serve
- Separate K8s manifests: deployment.yaml, service.yaml, ingress.yaml
- Add CI/CD pipeline: test, coverage floor 80%, build, e2e, release
- Add comprehensive tests for all core packages
- Tambah hadolint (Dockerfile), kubeconform (K8s), dan docker build nyata ke CI
- Uji e2e untuk Go dan Node.js dengan validasi lengkap
- Coverage per-paket dengan floor 80% untuk config, detector, generator, validator, filesystem
- Tambah test coverage untuk filesystem (rollback, symlink parent, traversal)
- Tambah test coverage untuk cli (init edge cases, Node.js defaults)
- Tambah test coverage untuk wizard (registry, image, k8s steps)
- Perbaiki gofmt pada 5 file
Copilot AI balanced review requested due to automatic review settings October 16, 2026 13:40

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

…dator, K8s manifests

- Validate tag before rendering to workflow and K8s manifests (no shell/YAML metacharacters)
- Deterministic filesystem rollback: sorted backup restore, track created dirs, report rollback errors separately, reject backup collision and symlink parents
- Implement full Bubble Tea wizard loop collecting all parameters (image, port, tag, k8s, ingress)
- Validator: structural YAML parsing, recursive directory scan, cross-resource consistency (Service selector vs Deployment labels, targetPort vs containerPort, Ingress backend vs Service)
- Generator: separate K8s files (deployment.yaml, service.yaml, ingress.yaml), sanitize K8s resource name, respect custom BuildCmd for Go, Vite uses npm run preview instead of serve, package-manager-aware build/test/start commands
- Remove Python from MVP scope (per SRS v1.2.0 section 2.3)
- Add whitebox and blackbox tests; core packages >= 80% coverage
Fix struct field alignment flagged by gofmt in CI Lint check so the
lint job passes.
Allow the generated Go Dockerfile to build from a subdirectory (e.g.
./cmd/devopsgen) instead of always the project root. This lets DevOpsGen
dogfood itself, since its main package lives under cmd/devopsgen/.

Adds BuildPath to config.Config with path-safety validation, a
--build-path flag (default .) on init, and wires it into
BuildOrDefault(). Also includes the Dockerfile + Kubernetes manifests
generated for this project as dogfooding evidence.
On Linux, os.Lstat on a path whose parent is a regular file returns
ENOTDIR ('not a directory') rather than os.ErrNotExist. PlanBuild turned
that into a planning error, but the rollback tests expect PlanBuild to
succeed and Commit to fail (with rollback). Treat non-NotExist lstat
errors as create targets so Commit surfaces the real error and rolls back.
checkSymlinkParents returned lstat errors (e.g. ENOTDIR when a parent
component is a regular file) directly from PlanBuild, breaking the
rollback tests which expect PlanBuild to succeed and Commit to fail.
Skip the symlink check for unresolvable parents; Commit surfaces the
real error and rolls back.
- Upgrade lint job go-version to 1.25 (actionlint v1.7.12 requires >=1.25)
- Pass workflow YAML files (not directory) to actionlint
- Add validator tests (parseYAML, deploymentPodLabels, deploymentImage,
  container port, cross-resource empty, result strings) raising validator
  coverage from 78.9% to 86.3%, above the 80% floor
List workflow files explicitly instead of unquoted command substitution
so actionlint's shellcheck passes.
Add a fallback package.json before npm install so generated Dockerfiles
do not fail on empty projects (e.g. CI generating into a temp dir without
an existing Node project). Applies to express, generic, nextjs, nestjs,
and vite templates.
Add a fallback go.mod before go mod download so generated Dockerfiles do
not fail on empty projects (e.g. CI generating into a temp dir without
an existing Go module).
Use printf '%s\n' instead of printf '...\\n' so the generated package.json
and go.mod contain actual newlines, not literal backslash-n. Previous value
produced invalid JSON/go.mod causing npm install and go mod download to fail.
@Bangkah
Bangkah merged commit 6320acc into main Oct 18, 2026
9 checks passed
@Bangkah
Bangkah deleted the impl/srs-v1.2.0-completion branch October 18, 2026 17:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants