Skip to content
This repository was archived by the owner on Jan 23, 2026. It is now read-only.

Add some cursor rules to help our AI assistants#642

Merged
mangelajo merged 2 commits intojumpstarter-dev:mainfrom
mangelajo:cursor-rules
Nov 27, 2025
Merged

Add some cursor rules to help our AI assistants#642
mangelajo merged 2 commits intojumpstarter-dev:mainfrom
mangelajo:cursor-rules

Conversation

@mangelajo
Copy link
Copy Markdown
Member

@mangelajo mangelajo commented Sep 23, 2025

Improves the driver creation process, and introduces general project structure details.

Summary by CodeRabbit

  • Documentation

    • Added comprehensive guides for creating new drivers, including workflow, naming conventions, directory structure, and best practices.
    • Documented monorepo project structure, build/test workflows, and package organization.
    • Expanded contributing guidelines with AI assistant considerations, driver creation examples, and reminders for tests and docs.
  • Chores

    • Enhanced the driver creation script to normalize hyphenated driver names to module-safe underscores in generated artifacts and examples, improving consistency and usability.

@netlify
Copy link
Copy Markdown

netlify Bot commented Sep 23, 2025

Deploy Preview for jumpstarter-docs ready!

Name Link
🔨 Latest commit 55bcb81
🔍 Latest deploy log https://app.netlify.com/projects/jumpstarter-docs/deploys/69280f7aa4c586000889c19c
😎 Deploy Preview https://deploy-preview-642--jumpstarter-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Sep 23, 2025

Walkthrough

Adds 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

Cohort / File(s) Summary
Cursor rules: driver creation and project structure
\.cursor/rules/creating-new-drivers.mdc, \.cursor/rules/project-structure.mdc
New documentation detailing end-to-end driver creation workflow, naming conventions, directory structure, style/testing guidelines, and monorepo layout/build/test practices.
Driver scaffold script update
__templates__/create_driver.sh
Introduces exported DRIVER_MODULE_NAME (hyphens → underscores). Updates module directory, type paths, README/config templates, and usage examples to use ${DRIVER_MODULE_NAME}. Keeps OS-specific sed handling.
Contributing guide updates
docs/source/contributing.md
Adds “AI Assistants” notes, references Cursor rules, shows driver creation example via create_driver.sh, and reiterates testing/documentation expectations.

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)
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • raballew
  • kirkbrauer
  • NickCao
  • bennyz

Poem

A hop, a skip, a module name anew,
Hyphens turn to underscores—neat and true.
Scripts lay paths, docs chart the way,
Drivers sprout fast like springtime hay.
I thump approval: test, then write—
Carrots compiled, all green lights bright! 🥕✨

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changes. Docstring coverage check skipped.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The title clearly conveys that the pull request is about adding cursor rules to support AI assistants, which matches the introduction of new .cursor/rules documentation and related guidance in the PR.
✨ Finishing touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

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 templates

Occurrences 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-test

Contributing.md lists make ty-pkg-${package_name} and make test-pkg-${package_name}; the Makefile defines pkg-ty-* and pkg-test-* (e.g. pkg-test-all, pkg-ty-all at Makefile lines 71 and 73). Update docs (docs/source/contributing.md: 28–33; also line 79) to use make pkg-ty-${package_name} and make 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 pipefail and gate -x/-v behind a DEBUG flag to reduce noise in CI/user terminals.


88-96: Optional: check for envsubst availability.

envsubst isn’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

📥 Commits

Reviewing files that changed from the base of the PR and between dba99a7 and 1e5c207.

📒 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 incorrect

Makefile 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.

Comment thread .cursor/rules/creating-new-drivers.mdc
@mangelajo mangelajo changed the title Add some cursor rules to help us better us AI assistants Add some cursor rules to help our AI assistants Sep 25, 2025
@mangelajo
Copy link
Copy Markdown
Member Author

@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 :)

Copy link
Copy Markdown
Member

@bkhizgiy bkhizgiy left a comment

Choose a reason for hiding this comment

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

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.

@mangelajo mangelajo merged commit 09cb716 into jumpstarter-dev:main Nov 27, 2025
18 checks passed
@mangelajo
Copy link
Copy Markdown
Member Author

Thank you bella! :D

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants