Skip to content

Commit d51294a

Browse files
committed
Add plain-pre-commit skill and rename plain-check to plain-lint
- Add plain-pre-commit skill (in plain-dev) for running pre-commit checks when done with changes. Triggers both proactively and via /pre-commit. - Rename plain-check to plain-lint to clarify it's for linting/formatting. - Update skills install to remove orphaned skills from destination.
1 parent df353b8 commit d51294a

File tree

3 files changed

+44
-17
lines changed

3 files changed

+44
-17
lines changed

plain-code/plain/code/skills/plain-check/SKILL.md renamed to plain-code/plain/code/skills/plain-lint/SKILL.md

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
---
2-
name: plain-check
3-
description: Runs code quality checks including ruff, type checking, and biome. Use for linting, formatting, or preflight validation.
2+
name: plain-lint
3+
description: Runs linting and formatting checks using ruff, ty, and biome. Use for quick code quality feedback during development.
44
---
55

6-
# Code Quality
6+
# Linting and Formatting
77

88
## Check for Issues
99

@@ -25,11 +25,3 @@ Options:
2525

2626
- `--unsafe-fixes` - Apply ruff unsafe fixes
2727
- `--add-noqa` - Add noqa comments to suppress errors
28-
29-
## Preflight Checks
30-
31-
```
32-
uv run plain preflight
33-
```
34-
35-
Validates Plain configuration.
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
---
2+
name: plain-pre-commit
3+
description: Runs pre-commit checks before finalizing changes. Use this when you've finished making code changes to verify everything passes before committing.
4+
---
5+
6+
# Pre-commit Checks
7+
8+
Run this when you've finished making changes to catch any issues before committing.
9+
10+
```
11+
uv run plain pre-commit
12+
```
13+
14+
Runs code checks, preflight validation, migration checks, build, and tests.
15+
16+
If checks fail, fix the issues and re-run.

plain/plain/cli/skills.py

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -84,11 +84,25 @@ def _get_skill_destinations() -> list[Path]:
8484

8585
def _install_skills_to(
8686
dest_skills_dir: Path, skills_by_package: dict[str, list[Path]]
87-
) -> int:
88-
"""Install skills to a destination directory. Returns count of installed skills."""
87+
) -> tuple[int, int]:
88+
"""Install skills to a destination directory. Returns (installed_count, removed_count)."""
8989
dest_skills_dir.mkdir(parents=True, exist_ok=True)
9090

91+
# Collect all source skill names
92+
source_skill_names: set[str] = set()
93+
for skill_dirs in skills_by_package.values():
94+
for skill_dir in skill_dirs:
95+
source_skill_names.add(skill_dir.name)
96+
9197
installed_count = 0
98+
removed_count = 0
99+
100+
# Remove orphaned skills (exist in dest but not in source)
101+
if dest_skills_dir.exists():
102+
for dest_dir in dest_skills_dir.iterdir():
103+
if dest_dir.is_dir() and dest_dir.name not in source_skill_names:
104+
shutil.rmtree(dest_dir)
105+
removed_count += 1
92106

93107
for pkg_name in sorted(skills_by_package.keys()):
94108
for skill_dir in skills_by_package[pkg_name]:
@@ -110,7 +124,7 @@ def _install_skills_to(
110124
shutil.copytree(skill_dir, dest_dir)
111125
installed_count += 1
112126

113-
return installed_count
127+
return installed_count, removed_count
114128

115129

116130
@click.command()
@@ -148,6 +162,11 @@ def skills(install: bool) -> None:
148162

149163
# Install to each destination
150164
for dest in destinations:
151-
installed_count = _install_skills_to(dest, skills_by_package)
152-
if installed_count > 0:
153-
click.echo(f"Installed {installed_count} skill(s) to {dest}/")
165+
installed_count, removed_count = _install_skills_to(dest, skills_by_package)
166+
if installed_count > 0 or removed_count > 0:
167+
parts = []
168+
if installed_count > 0:
169+
parts.append(f"installed {installed_count}")
170+
if removed_count > 0:
171+
parts.append(f"removed {removed_count}")
172+
click.echo(f"Skills: {', '.join(parts)} in {dest}/")

0 commit comments

Comments
 (0)