Skip to content

Commit 591da5e

Browse files
Refactor configuration rules for dotfiles, Git/SSH, GitHub workflows, shell, and terminal settings to improve clarity and consistency. Update conventions for managing shared and host-specific configurations, enhance formatting guidelines, and ensure compliance with pre-commit standards.
1 parent bc34abb commit 591da5e

14 files changed

Lines changed: 166 additions & 21 deletions

.claude/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Claude Topic Docs
2+
3+
Claude Code uses shared docs referenced by `CLAUDE.md`:
4+
5+
- `.cursor/shared/shell.md`
6+
- `.cursor/shared/git-ssh.md`
7+
- `.cursor/shared/stow-scripts.md`
8+
- `.cursor/shared/workflows.md`

.codex/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# Codex Topic Docs
2+
3+
Codex uses shared docs referenced by `AGENTS.md`:
4+
5+
- `.cursor/shared/shell.md`
6+
- `.cursor/shared/git-ssh.md`
7+
- `.cursor/shared/stow-scripts.md`
8+
- `.cursor/shared/workflows.md`

.cursor/rules/core-dotfiles.mdc

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@ alwaysApply: true
55

66
# Dotfiles conventions
77

8-
- This repo is managed with GNU Stow; keep packages as top-level folders.
9-
- Mirror `$HOME` paths inside packages (e.g., `.config/...`, `.ssh/...`).
10-
- Put shared defaults in `common/`; host-specific overrides live in host folders.
11-
- Avoid absolute paths and secrets in committed configs.
12-
- Update `stow-all.sh` and README when adding packages or changing usage.
8+
- Manage links with GNU Stow; package directories must mirror `$HOME` paths (for example `.config/...`, `.ssh/...`).
9+
- Keep shared defaults in `common/`; host overlays belong in `mac/`, `sherlock/`, `wsl-ubuntu/`, `lab-ubuntu/`, `marlowe/`, `fedora/`, `ubuntu/`, or `win/`.
10+
- Follow the layering model: stow `common/` first, then one host folder via `./stow-all.sh [host]`.
11+
- Keep `.stowrc`, `stow-all.sh`, and `README.md` consistent whenever package layout or setup commands change.
12+
- Base configs in `common/` should source host extension files from `~/.config/...` when per-host behavior is needed.
13+
- Never commit secrets, private keys, or machine-specific absolute paths.

.cursor/rules/git-ssh-configs.mdc

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ description: Git and SSH config conventions
33
globs:
44
- "**/.gitconfig"
55
- "**/.gitconfig_local"
6+
- "**/.gitignore_global"
67
- "**/.gitignore"
78
- "**/.gitmodules"
89
- "**/.ssh/config"
@@ -12,7 +13,9 @@ alwaysApply: false
1213

1314
# Git and SSH configs
1415

15-
- Keep shared git settings in `common/git/.gitconfig`; put machine-specific overrides in `*/git/.gitconfig_local`.
16-
- Prefer include/includeIf blocks over duplicating settings across hosts.
17-
- Do not commit secrets; SSH config should reference key paths only.
18-
- Keep `.gitmodules` in sync with submodule paths and URLs.
16+
- Keep shared Git defaults in `common/git/.gitconfig`; host-local identity or machine overrides live in `*/git/.gitconfig_local`.
17+
- Preserve the include pattern used by this repo: `[include] path = ~/.gitconfig_local` in shared config.
18+
- Keep SSH root config minimal: `common/ssh/.ssh/config` should delegate to `Include ~/.ssh/config.d/*.conf`.
19+
- Split host/service SSH rules into focused files under `.ssh/config.d/` (for example `github.conf`, `stanford.conf`, `legacy.conf`).
20+
- Never commit private key material, tokens, or secrets in Git/SSH config files.
21+
- Keep `.gitmodules` synchronized with submodule path and URL changes.

.cursor/rules/github-workflows.mdc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,15 @@
11
---
22
description: GitHub workflow conventions
3-
globs: ".github/workflows/*.yml"
3+
globs:
4+
- ".github/workflows/*.yml"
5+
- ".pre-commit-config.yaml"
46
alwaysApply: false
57
---
68

79
# GitHub workflows
810

9-
- Keep workflows minimal and deterministic; pin action versions.
10-
- Use repo tooling (`shellcheck`, `shfmt`, `stylua`) when adding workflow steps that run scripts.
11-
- Update README when CI behavior or required checks change.
11+
- Keep workflows deterministic and pinned; avoid floating action tags.
12+
- Keep CI behavior aligned with `.pre-commit-config.yaml` tooling (`shellcheck`, `shfmt`, `stylua`, and hygiene hooks).
13+
- Update `.github/workflows/ci.yml` when repo lint/format policy changes.
14+
- Keep `.github/workflows/update-pymolscripts-submodule.yml` focused on submodule sync logic only.
15+
- If workflow behavior changes user setup or contribution flow, update `README.md` in the same change.

.cursor/rules/shell-configs.mdc

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,23 @@
11
---
22
description: Shell config and script conventions
33
globs:
4+
- "**/.aliases"
45
- "**/.zsh*"
56
- "**/.bash*"
67
- "**/.profile"
8+
- "**/.config/sh/**"
9+
- "**/.config/bash/**"
10+
- "**/.config/zsh/**"
711
- "**/*.sh"
812
- "**/*.zsh"
913
alwaysApply: false
1014
---
1115

1216
# Shell configs
1317

14-
- Keep POSIX sh compatible logic in `sh/` packages; use bash/zsh features only in their files.
15-
- Prefer aliases in `.zsh_aliases` / `.bash_aliases`; keep `*.rc` focused on options and sourcing.
16-
- Place host-specific logic in host folders, guarded by OS/host checks if needed.
17-
- For scripts in `common/zsh/.local/bin`, include a shebang and keep output quiet by default.
18-
- Keep formatting compatible with `shfmt` and avoid shellcheck violations.
18+
- Keep POSIX-compatible logic in `common/sh/` and `*/sh/`; use Bash/Zsh-only features only in their shell-specific files.
19+
- Preserve the override chain: shared `common/sh/.aliases` and `common/sh/.profile` source host files from `~/.config/sh/` when present.
20+
- Keep `*.rc` files focused on options and sourcing; prefer aliases/functions in `.bash_aliases`, `.zsh_aliases`, and `~/.config/sh/.aliases`.
21+
- Keep dotfiles update integration consistent: shell startup files may source `dotfiles-update.sh`, but the script itself remains POSIX `sh`.
22+
- Match pre-commit formatting: `shfmt -i 4 -ci` with dialect-specific `-ln bash`, `-ln posix`, or `-ln zsh`.
23+
- Avoid shellcheck violations; if a suppression is required, scope it to a single line with a brief reason.

.cursor/rules/stow-scripts.mdc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
---
2+
description: Stow helper and update script conventions
3+
globs:
4+
- "stow-all.sh"
5+
- "dotfiles-update.sh"
6+
- ".stowrc"
7+
alwaysApply: false
8+
---
9+
10+
# Stow and update scripts
11+
12+
- Keep `stow-all.sh` as the canonical entrypoint: stow `common/` first, then optional host packages.
13+
- Preserve `stow --restow --no-folding` behavior unless there is a repo-wide migration plan.
14+
- Keep `.stowrc` as the source of global Stow target/ignore defaults (`--target=~` and ignore patterns).
15+
- Use `set -euo pipefail` in Bash scripts like `stow-all.sh`; keep POSIX `sh` scripts (`dotfiles-update.sh`) portable.
16+
- For startup-update logic, keep the `_DOTFILES_CHECKED` session-marker pattern so checks run once per login session.
17+
- If setup flow changes, update both script comments and `README.md` usage examples together.

.cursor/rules/terminal-configs.mdc

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ alwaysApply: false
99

1010
# Terminal configs
1111

12-
- Keep shared settings in `common/`; host-specific overrides belong in host folders.
13-
- Group related options and keep key mappings together for readability.
14-
- For wezterm Lua, use explicit tables and avoid side effects at load time.
12+
- Keep shared terminal defaults in `common/`; host-specific overrides belong in host folders only.
13+
- Group related settings (font, appearance, keymaps, shell integration) in contiguous blocks.
14+
- For `common/kitty/.config/kitty/current-theme.conf`, keep it theme-only (no unrelated behavior settings).
15+
- For `.wezterm.lua`, prefer explicit tables and pure setup logic (no stateful side effects at import time).
16+
- Keep comments short and task-oriented; remove stale commented-out settings.

.cursor/shared/git-ssh.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Git and SSH conventions
2+
3+
- Keep shared Git config in `common/git/.gitconfig`.
4+
- Keep host-local Git overrides in `*/git/.gitconfig_local`.
5+
- Preserve include chain: `[include] path = ~/.gitconfig_local`.
6+
- Keep SSH root config minimal in `common/ssh/.ssh/config`:
7+
- `Include ~/.ssh/config.d/*.conf`
8+
- Keep SSH targets split by concern in `.ssh/config.d/*.conf`.
9+
- Do not commit secrets or private key material.

.cursor/shared/shell.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Shell conventions
2+
3+
- Keep POSIX logic in `common/sh/` and host `*/sh/` paths.
4+
- Use Bash/Zsh-specific syntax only in matching shell files.
5+
- Preserve override sourcing patterns from shared files:
6+
- `common/sh/.aliases` sources `~/.config/sh/.aliases`
7+
- `common/sh/.profile` sources `~/.config/sh/.profile`
8+
- Keep startup flow quiet and idempotent; avoid duplicate side effects.
9+
- Follow pre-commit shell style:
10+
- Bash: `shfmt -i 4 -ci -ln bash`
11+
- POSIX: `shfmt -i 4 -ci -ln posix`
12+
- Zsh: `shfmt -i 4 -ci -ln zsh`

0 commit comments

Comments
 (0)