Skip to content

Commit e84a77f

Browse files
jamesbrinkTest User
andauthored
fix: use stable rust toolchain in version bump workflow (#5)
* fix: use stable rust toolchain in version bump workflow * fix: prevent duplicate version bump workflow runs * test: improve test coverage across multiple modules - Add comprehensive tests for template context validation - Add tests for error display and conversions - Expand CLI command parsing and execution tests - Add async template generation tests - Improve overall test coverage to 84.81% * style: fix code formatting issues * style: remove unnecessary borrows in try_parse_from calls Fix clippy::needless-borrows-for-generic-args warnings by removing unnecessary borrows when calling try_parse_from in test cases. * style: improve formatting of long array literals Split long array literals into multiple lines to improve readability and match rustfmt's preferred style. * chore: add rustfmt and clippy configuration files - Add .rustfmt.toml with stable-only features - Add clippy.toml to match CI settings - Update code formatting to match new configuration * chore: remove incorrect clippy.toml The clippy configuration should be passed via RUSTFLAGS in CI instead of using a configuration file. * docs: add CONTRIBUTING.md with development guidelines Add comprehensive contributing guidelines including: - Rust toolchain requirements - Code style and linting configuration - Development workflow - CI/CD configuration details * docs: update AI assistant guidelines - Add clear ALWAYS/NEVER directives for AI assistants - Standardize formatting and linting requirements - Add explicit rules for development, templates, and testing --------- Co-authored-by: Test User <[email protected]>
1 parent b3af1e0 commit e84a77f

File tree

8 files changed

+481
-137
lines changed

8 files changed

+481
-137
lines changed

.github/workflows/version-bump.yml

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,15 @@ permissions:
2020

2121
jobs:
2222
version-bump:
23-
if: github.event_name == 'workflow_dispatch' || (contains(github.event.pull_request.labels.*.name, 'release') && !contains(github.event.head_commit.message, 'bump version'))
23+
# Only run if:
24+
# 1. It's a workflow_dispatch event OR
25+
# 2. It's a label event with 'release' label AND the commit doesn't contain 'bump version' AND
26+
# we haven't already processed this PR (checking automated label)
27+
if: >
28+
github.event_name == 'workflow_dispatch' ||
29+
(contains(github.event.pull_request.labels.*.name, 'release') &&
30+
!contains(github.event.head_commit.message, 'bump version') &&
31+
!contains(github.event.pull_request.labels.*.name, 'automated'))
2432
runs-on: ubuntu-latest
2533
steps:
2634
- uses: actions/checkout@v4
@@ -31,7 +39,7 @@ jobs:
3139
- name: Install Rust toolchain
3240
uses: dtolnay/rust-toolchain@stable
3341
with:
34-
toolchain: ${{ env.RUST_VERSION }}
42+
toolchain: stable
3543

3644
- name: Install cargo-edit
3745
run: cargo install cargo-edit

.goosehints

Lines changed: 80 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,89 @@
1-
This is Essex, a Docker project template generator written in Rust. It helps create consistent and well-structured Docker projects.
1+
# Essex AI Assistant Guidelines
22

3-
# Project Context
4-
- Essex is designed to generate Docker projects from templates with a focus on best practices and consistency
5-
- The project uses Tera templating (Jinja2-like syntax) for template generation
6-
- The main binary is written in Rust and requires Rust 1.70 or later
3+
## Project Identity
4+
Essex is a Rust-based Docker project template generator focused on consistency and best practices.
75

8-
# Project Structure
9-
- `/src`: Contains the Rust source code for the Essex binary
10-
- `/templates`: Contains the template definitions
11-
- `/templates/basic`: The basic template which includes Dockerfile, Makefile, README.md, and runtime assets
12-
- Each generated project follows a consistent structure with:
13-
- Dockerfile (uses best practices and OCI-compliant labels)
14-
- Makefile (for common Docker operations)
15-
- README.md
16-
- runtime-assets (containing entrypoint scripts and other assets)
6+
## Code Style Requirements
7+
1. ALWAYS enforce these Rust formatting rules:
8+
```toml
9+
# .rustfmt.toml settings
10+
max_width = 100
11+
hard_tabs = false
12+
tab_spaces = 4
13+
newline_style = "Auto"
14+
use_small_heuristics = "Default"
15+
reorder_imports = true
16+
reorder_modules = true
17+
remove_nested_parens = true
18+
edition = "2021"
19+
merge_derives = true
20+
use_field_init_shorthand = true
21+
use_try_shorthand = true
22+
force_explicit_abi = true
23+
```
1724

18-
# Development Guidelines
19-
- Follow Test-Driven Development (TDD) practices:
20-
- Write tests first before implementing new features
21-
- Ensure each new feature or bug fix has corresponding tests
22-
- Keep test coverage high and meaningful
23-
- All code changes should maintain backward compatibility with existing templates
24-
- Follow Rust best practices and idiomatic code patterns
25-
- Ensure all templates follow Docker best practices:
26-
- Use multi-stage builds where appropriate
27-
- Include proper OCI labels
28-
- Follow principle of least privilege (run as non-root user)
29-
- Include proper documentation
30-
- Always ensure our cargo version matches our git tag for releases
25+
2. ALWAYS enforce these Clippy rules via RUSTFLAGS:
26+
```bash
27+
RUSTFLAGS="-D warnings -D clippy::redundant-pattern-matching -D clippy::needless-borrows-for-generic-args"
28+
```
3129

32-
# Testing Requirements
33-
- Run `cargo test` to ensure all tests pass before submitting changes
34-
- Test template generation with different parameters
35-
- Verify generated Dockerfiles can be built successfully
36-
- Check that Makefiles in templates work as expected
30+
## Development Rules
31+
1. NEVER skip running these checks before committing:
32+
- `cargo fmt --all -- --check`
33+
- `cargo clippy` with required RUSTFLAGS
34+
- `cargo test`
3735

38-
# Important Files
39-
- README.md: Primary documentation source
40-
- src/main.rs: Entry point for the Essex binary
41-
- templates/basic/*: Core template files that serve as examples
36+
2. ALWAYS maintain these standards:
37+
- Write tests before implementing features (TDD)
38+
- Keep backward compatibility with existing templates
39+
- Follow idiomatic Rust patterns
40+
- Match cargo version with git tags for releases
4241

43-
# Build Process
44-
- Use `cargo build --release` for production builds
45-
- Development builds can use `cargo build`
46-
- Generated projects use Make for building Docker images
42+
3. ALWAYS follow these Docker best practices:
43+
- Use multi-stage builds
44+
- Include OCI labels
45+
- Run as non-root user
46+
- Provide comprehensive documentation
4747

48-
# Template Variables
49-
The following variables are commonly used in templates:
50-
- repo_username: GitHub/container registry username
51-
- repo_namespace: Organization/namespace for the project
52-
- image_name: Name of the Docker image
53-
- vendor: Company/organization name
54-
- version: Project version
55-
- build_date: Build timestamp
56-
- vcs_ref: Git commit reference
48+
## Template Rules
49+
1. ALWAYS include these components in generated projects:
50+
- Dockerfile with best practices
51+
- Makefile for Docker operations
52+
- README.md
53+
- runtime-assets directory
5754

58-
# Best Practices
59-
- Keep templates minimal but functional
60-
- Ensure all generated projects include proper documentation
61-
- Follow security best practices in Dockerfile templates
62-
- Include comprehensive error handling in Rust code
63-
- Document any new template variables or features
55+
2. ALWAYS support these template variables:
56+
- repo_username
57+
- repo_namespace
58+
- image_name
59+
- vendor
60+
- version
61+
- build_date
62+
- vcs_ref
6463

65-
When working with this project, please:
66-
1. Consult the README.md first for basic information
67-
2. Run tests before making any changes
68-
3. Maintain the existing project structure
69-
4. Follow the established coding style and practices
70-
5. Update documentation when adding new features
64+
## Documentation Rules
65+
1. ALWAYS update documentation when:
66+
- Adding new features
67+
- Modifying template variables
68+
- Changing project structure
69+
- Updating dependencies
70+
71+
2. ALWAYS maintain these files:
72+
- README.md for project overview
73+
- CONTRIBUTING.md for development guidelines
74+
- Template-specific documentation
75+
76+
## Error Handling Rules
77+
1. ALWAYS provide:
78+
- Clear error messages
79+
- Proper error types
80+
- Recovery suggestions
81+
- Debug information when appropriate
82+
83+
## Testing Rules
84+
1. ALWAYS verify:
85+
- Template generation with various parameters
86+
- Docker build success for generated projects
87+
- Makefile functionality
88+
- Unit test coverage
89+
- Integration test coverage

.rustfmt.toml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
max_width = 100
2+
hard_tabs = false
3+
tab_spaces = 4
4+
newline_style = "Auto"
5+
use_small_heuristics = "Default"
6+
reorder_imports = true
7+
reorder_modules = true
8+
remove_nested_parens = true
9+
edition = "2021"
10+
merge_derives = true
11+
use_field_init_shorthand = true
12+
use_try_shorthand = true
13+
force_explicit_abi = true

.windsurfrules

Lines changed: 80 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,89 @@
1-
This is Essex, a Docker project template generator written in Rust. It helps create consistent and well-structured Docker projects.
1+
# Essex AI Assistant Guidelines
22

3-
# Project Context
4-
- Essex is designed to generate Docker projects from templates with a focus on best practices and consistency
5-
- The project uses Tera templating (Jinja2-like syntax) for template generation
6-
- The main binary is written in Rust and requires Rust 1.70 or later
3+
## Project Identity
4+
Essex is a Rust-based Docker project template generator focused on consistency and best practices.
75

8-
# Project Structure
9-
- `/src`: Contains the Rust source code for the Essex binary
10-
- `/templates`: Contains the template definitions
11-
- `/templates/basic`: The basic template which includes Dockerfile, Makefile, README.md, and runtime assets
12-
- Each generated project follows a consistent structure with:
13-
- Dockerfile (uses best practices and OCI-compliant labels)
14-
- Makefile (for common Docker operations)
15-
- README.md
16-
- runtime-assets (containing entrypoint scripts and other assets)
6+
## Code Style Requirements
7+
1. ALWAYS enforce these Rust formatting rules:
8+
```toml
9+
# .rustfmt.toml settings
10+
max_width = 100
11+
hard_tabs = false
12+
tab_spaces = 4
13+
newline_style = "Auto"
14+
use_small_heuristics = "Default"
15+
reorder_imports = true
16+
reorder_modules = true
17+
remove_nested_parens = true
18+
edition = "2021"
19+
merge_derives = true
20+
use_field_init_shorthand = true
21+
use_try_shorthand = true
22+
force_explicit_abi = true
23+
```
1724

18-
# Development Guidelines
19-
- Follow Test-Driven Development (TDD) practices:
20-
- Write tests first before implementing new features
21-
- Ensure each new feature or bug fix has corresponding tests
22-
- Keep test coverage high and meaningful
23-
- All code changes should maintain backward compatibility with existing templates
24-
- Follow Rust best practices and idiomatic code patterns
25-
- Ensure all templates follow Docker best practices:
26-
- Use multi-stage builds where appropriate
27-
- Include proper OCI labels
28-
- Follow principle of least privilege (run as non-root user)
29-
- Include proper documentation
30-
- Always ensure our cargo version matches our git tag for releases
25+
2. ALWAYS enforce these Clippy rules via RUSTFLAGS:
26+
```bash
27+
RUSTFLAGS="-D warnings -D clippy::redundant-pattern-matching -D clippy::needless-borrows-for-generic-args"
28+
```
3129

32-
# Testing Requirements
33-
- Run `cargo test` to ensure all tests pass before submitting changes
34-
- Test template generation with different parameters
35-
- Verify generated Dockerfiles can be built successfully
36-
- Check that Makefiles in templates work as expected
30+
## Development Rules
31+
1. NEVER skip running these checks before committing:
32+
- `cargo fmt --all -- --check`
33+
- `cargo clippy` with required RUSTFLAGS
34+
- `cargo test`
3735

38-
# Important Files
39-
- README.md: Primary documentation source
40-
- src/main.rs: Entry point for the Essex binary
41-
- templates/basic/*: Core template files that serve as examples
36+
2. ALWAYS maintain these standards:
37+
- Write tests before implementing features (TDD)
38+
- Keep backward compatibility with existing templates
39+
- Follow idiomatic Rust patterns
40+
- Match cargo version with git tags for releases
4241

43-
# Build Process
44-
- Use `cargo build --release` for production builds
45-
- Development builds can use `cargo build`
46-
- Generated projects use Make for building Docker images
42+
3. ALWAYS follow these Docker best practices:
43+
- Use multi-stage builds
44+
- Include OCI labels
45+
- Run as non-root user
46+
- Provide comprehensive documentation
4747

48-
# Template Variables
49-
The following variables are commonly used in templates:
50-
- repo_username: GitHub/container registry username
51-
- repo_namespace: Organization/namespace for the project
52-
- image_name: Name of the Docker image
53-
- vendor: Company/organization name
54-
- version: Project version
55-
- build_date: Build timestamp
56-
- vcs_ref: Git commit reference
48+
## Template Rules
49+
1. ALWAYS include these components in generated projects:
50+
- Dockerfile with best practices
51+
- Makefile for Docker operations
52+
- README.md
53+
- runtime-assets directory
5754

58-
# Best Practices
59-
- Keep templates minimal but functional
60-
- Ensure all generated projects include proper documentation
61-
- Follow security best practices in Dockerfile templates
62-
- Include comprehensive error handling in Rust code
63-
- Document any new template variables or features
55+
2. ALWAYS support these template variables:
56+
- repo_username
57+
- repo_namespace
58+
- image_name
59+
- vendor
60+
- version
61+
- build_date
62+
- vcs_ref
6463

65-
When working with this project, please:
66-
1. Consult the README.md first for basic information
67-
2. Run tests before making any changes
68-
3. Maintain the existing project structure
69-
4. Follow the established coding style and practices
70-
5. Update documentation when adding new features
64+
## Documentation Rules
65+
1. ALWAYS update documentation when:
66+
- Adding new features
67+
- Modifying template variables
68+
- Changing project structure
69+
- Updating dependencies
70+
71+
2. ALWAYS maintain these files:
72+
- README.md for project overview
73+
- CONTRIBUTING.md for development guidelines
74+
- Template-specific documentation
75+
76+
## Error Handling Rules
77+
1. ALWAYS provide:
78+
- Clear error messages
79+
- Proper error types
80+
- Recovery suggestions
81+
- Debug information when appropriate
82+
83+
## Testing Rules
84+
1. ALWAYS verify:
85+
- Template generation with various parameters
86+
- Docker build success for generated projects
87+
- Makefile functionality
88+
- Unit test coverage
89+
- Integration test coverage

0 commit comments

Comments
 (0)