Skip to content

feat: generate .gitignore for Mendix projects during init#163

Merged
ako merged 1 commit intomendixlabs:mainfrom
engalar:feat/gitignore-init
Apr 10, 2026
Merged

feat: generate .gitignore for Mendix projects during init#163
ako merged 1 commit intomendixlabs:mainfrom
engalar:feat/gitignore-init

Conversation

@engalar
Copy link
Copy Markdown
Contributor

@engalar engalar commented Apr 9, 2026

Summary

  • mxcli init now creates a .gitignore with standard Mendix project ignore patterns when one doesn't already exist
  • Covers build artifacts, IDE files, MPR locks/backups, journal files, and mxcli-specific files (mxcli, .mxcli/, .claude/settings.local.json)
  • Re-running init skips if .gitignore already exists (no overwrite)

Closes #118

Test plan

  • mxcli init in empty project creates .gitignore with all expected patterns
  • Re-running mxcli init does not overwrite existing .gitignore
  • make build passes

mxcli init now creates a .gitignore with standard Mendix project
ignore patterns when one doesn't already exist. Covers build
artifacts, IDE files, MPR locks, and mxcli-specific files.

Closes mendixlabs#118
@github-actions
Copy link
Copy Markdown

github-actions bot commented Apr 9, 2026

AI Code Review

What Looks Good

  • Scope & atomicity: The PR is tightly scoped to a single feature - adding .gitignore generation to mxcli init. No unrelated changes are mixed in.
  • Code quality: The implementation is clean and follows Go idioms:
    • Uses os.Stat with os.IsNotExist for proper existence checking
    • Defines the gitignore content as a constant for readability
    • Uses filepath.Join for cross-platform path handling
    • Includes appropriate error handling (logs to stderr but doesn't fail the entire init process)
    • Sets reasonable file permissions (0644)
  • Test coverage: The test plan covers the key scenarios:
    • Creating .gitignore in empty projects
    • Not overwriting existing .gitignore files
    • Build verification
  • Security & robustness:
    • No command injection risks (writing static content)
    • File I/O only happens during initialization (not in hot paths)
    • Correctly avoids overwriting existing user configurations
    • Uses standard Unix file permissions appropriate for a .gitignore
  • Correctness:
    • Logic properly checks for existing .gitignore before creating
    • Path handling is cross-platform safe
    • Error handling for file write operation is present
    • The .gitignore content is comprehensive and appropriate for Mendix projects (covers build artifacts, IDE files, version control specifics, and mxcli-related files)

Recommendation

Approve - The PR is well-scoped, implements a useful feature correctly, follows project conventions, and includes adequate testing. No changes are needed.


Automated review via OpenRouter (Nemotron Super 120B) — workflow source

Copy link
Copy Markdown
Collaborator

@ako ako left a comment

Choose a reason for hiding this comment

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

Small, focused, well-scoped. The .gitignore content correctly covers Mendix-specific patterns:

  • Build artifacts (deployment/, releases/, packages/)
  • MPR locks/backups (*.mpr.lock, *.mpr.bak)
  • MPR v2 journal files (mprcontents/mprjournal*)
  • The !/javascriptsource/**/node_modules/ negation correctly preserves widget node_modules
  • mxcli artifacts (mxcli, mxcli.exe, .mxcli/, .claude/settings.local.json)

Logic is correct — checks os.IsNotExist and skips if present.

Minor cosmetic: the "What was created" output unconditionally lists .gitignore even when skipped. Worth tracking whether it was actually created, but not blocking.

LGTM.

@ako ako merged commit 47fb0a9 into mendixlabs:main Apr 10, 2026
1 of 2 checks passed
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.

.gitignore

2 participants