Add some cursor rules to help our AI assistants#642
Add some cursor rules to help our AI assistants#642mangelajo merged 2 commits intojumpstarter-dev:mainfrom
Conversation
✅ Deploy Preview for jumpstarter-docs ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughAdds two new Cursor rules docs, updates contributing guidelines with AI assistant guidance, and modifies the create_driver.sh template to introduce and propagate DRIVER_MODULE_NAME (hyphen-to-underscore conversion) for module paths and README/config generation. No runtime logic beyond the script’s scaffolding behavior is introduced. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor Dev as Developer
participant Script as create_driver.sh
participant FS as Filesystem
participant Docs as README/config templates
Dev->>Script: ./create_driver.sh <driver-name> <Class> <author> <email>
Script->>Script: DRIVER_MODULE_NAME = driver-name (hyphens → underscores)
Script->>FS: Create module dir: jumpstarter_driver_${DRIVER_MODULE_NAME}/...
Script->>Docs: Generate README/config using ${DRIVER_MODULE_NAME} and ${DRIVER_CLASS}
Script-->>Dev: Output next steps (navigate, implement, test)
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Possibly related PRs
Suggested reviewers
Poem
Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (3)
__templates__/create_driver.sh (2)
27-33: Fix macOS sed -i handling; current approach passes a literal '' backup suffix.Using a string var for
sed -i ''doesn’t preserve the empty argument after expansion. Use a helper or a Bash array to pass args safely.Apply:
-if command -v gsed &> /dev/null; then - sed_cmd="gsed" -elif [[ "$(uname)" == "Darwin" ]]; then - sed_cmd="sed -i ''" -else - sed_cmd="sed -i" -fi +if command -v gsed &> /dev/null; then + sed_inplace() { gsed -i "$@"; } +elif [[ "$(uname)" == "Darwin" ]]; then + sed_inplace() { sed -i '' "$@"; } +else + sed_inplace() { sed -i "$@"; } +fi @@ -# Need to expand variables after EOF to prevent early expansion -$sed_cmd "s/\${DRIVER_CLASS}/${DRIVER_CLASS}/g; s/\${DRIVER_NAME}/${DRIVER_NAME}/g; s/\${DRIVER_MODULE_NAME}/${DRIVER_MODULE_NAME}/g" "${README_FILE}" +# Need to expand variables after EOF to prevent early expansion +sed_inplace -e "s/\${DRIVER_CLASS}/${DRIVER_CLASS}/g; s/\${DRIVER_NAME}/${DRIVER_NAME}/g; s/\${DRIVER_MODULE_NAME}/${DRIVER_MODULE_NAME}/g" "${README_FILE}"Also applies to: 76-78
88-96: Replace jumpstarter_driver_${DRIVER_NAME} with ${DRIVER_MODULE_NAME} in templatesOccurrences found — replace the substring "jumpstarter_driver_${DRIVER_NAME}" with "${DRIVER_MODULE_NAME}" in:
- templates/driver/pyproject.toml.tmpl (line ~28: testpaths)
- templates/driver/examples/exporter.yaml.tmpl (line 10: type)
- templates/driver/jumpstarter_driver/driver.py.tmpl (line 19: client return)
docs/source/contributing.md (1)
28-33: Align Makefile target naming in docs to pkg-ty/pkg-testContributing.md lists
make ty-pkg-${package_name}andmake test-pkg-${package_name}; the Makefile definespkg-ty-*andpkg-test-*(e.g.pkg-test-all,pkg-ty-allat Makefile lines 71 and 73). Update docs (docs/source/contributing.md: 28–33; also line 79) to usemake pkg-ty-${package_name}andmake pkg-test-${package_name}.
🧹 Nitpick comments (7)
.cursor/rules/creating-new-drivers.mdc (1)
106-108: Typo: “Drives” → “Drivers”.Apply:
-Drives which have children drivers should be composite drivers, and the client interface should +Drivers which have children drivers should be composite drivers, and the client interface should__templates__/create_driver.sh (3)
23-25: Address ShellCheck SC2155 (and minor robustness).Avoid assigning in export; set then export.
Apply:
-# Convert hyphens to underscores for Python module name -export DRIVER_MODULE_NAME=$(echo "${DRIVER_NAME}" | sed 's/-/_/g') +# Convert hyphens to underscores for Python module name +DRIVER_MODULE_NAME=$(echo "${DRIVER_NAME}" | sed 's/-/_/g') +export DRIVER_MODULE_NAME
2-2: Optional: safer defaults for shell flags.Consider
set -euo pipefailand gate-x/-vbehind a DEBUG flag to reduce noise in CI/user terminals.
88-96: Optional: check for envsubst availability.
envsubstisn’t on stock macOS; fail fast with a helpful message.Apply:
for f in __init__.py client.py driver_test.py driver.py; do @@ done + +if ! command -v envsubst >/dev/null 2>&1; then + echo "error: envsubst not found. Install gettext (e.g., brew install gettext && brew link --force gettext) or ensure it's on PATH." >&2 + exit 1 +fi.cursor/rules/project-structure.mdc (3)
149-153: Typo: mentions pytest in the type-checking section.This should reference the type checker (mypy/pyright) rather than pytest.
Apply:
- never invoke pytest manually. Use this because it will be more reliable and + never invoke the type checker manually. Use this because it will be more reliable and
156-157: Minor punctuation/spacing.Apply:
-When running linting you should use the `make lint-fix`command. +When running linting you should use the `make lint-fix` command.
128-136: Consistent platform capitalization.Apply:
-5. **Testing**: Comprehensive test coverage required, but always try to focus on starting a server and client to test it e2e. Mock sometimes when there is too much dependency on system tools/services/compatibility issues between MacOs/Linux. +5. **Testing**: Comprehensive test coverage required, but always try to focus on starting a server and client to test it e2e. Mock sometimes when there is too much dependency on system tools/services/compatibility issues between macOS/Linux.
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (4)
.cursor/rules/creating-new-drivers.mdc(1 hunks).cursor/rules/project-structure.mdc(1 hunks)__templates__/create_driver.sh(5 hunks)docs/source/contributing.md(1 hunks)
🧰 Additional context used
🪛 Shellcheck (0.11.0)
__templates__/create_driver.sh
[warning] 24-24: Declare and assign separately to avoid masking return values.
(SC2155)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (10)
- GitHub Check: Redirect rules - jumpstarter-docs
- GitHub Check: pytest-matrix (ubuntu-24.04, 3.13)
- GitHub Check: pytest-matrix (macos-15, 3.13)
- GitHub Check: pytest-matrix (macos-15, 3.11)
- GitHub Check: pytest-matrix (macos-15, 3.12)
- GitHub Check: pytest-matrix (ubuntu-24.04, 3.12)
- GitHub Check: pytest-matrix (ubuntu-24.04, 3.11)
- GitHub Check: e2e
- GitHub Check: Header rules - jumpstarter-docs
- GitHub Check: Pages changed - jumpstarter-docs
🔇 Additional comments (2)
docs/source/contributing.md (1)
53-67: LGTM: Clear AI assistant guidance.Good callouts on licensing diligence and pointing to Cursor rules and the driver script.
.cursor/rules/project-structure.mdc (1)
146-151: Canonical targets are pkg-test- and pkg-ty- — original comment is incorrectMakefile defines pkg-test-all and pkg-ty-all and per-package targets (Makefile:24,30,71–73,115–118); no test-pkg-/ty-pkg- targets found — keep .cursor/rules/project-structure.mdc as-is or update other docs to use pkg-test/pkg-ty.
Likely an incorrect or invalid review comment.
|
@kirkbrauer @bkhizgiy @bennyz do you mind if we merge this? I know it's cursor specific, I am happy to see this generalized to other assistants later, but I have not started a couple of easy drivers because we didn't have this in place and I didn't want to bother :D but it was quite useful TBH :) |
bkhizgiy
left a comment
There was a problem hiding this comment.
Agree with @mangelajo that it can be really useful, especially for the easier flows, and can be extended later to other assistance if needed/requested.
|
Thank you bella! :D |
Improves the driver creation process, and introduces general project structure details.
Summary by CodeRabbit
Documentation
Chores