Skip to content

Commit fd1d505

Browse files
Merge pull request #64 from stbenjam/linter
Use claudelint to verify our plugins and marketplace adhere to standards
2 parents 380fab7 + 77df8ff commit fd1d505

File tree

28 files changed

+429
-19
lines changed

28 files changed

+429
-19
lines changed

.claude-plugin/marketplace.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,16 @@
4848
"name": "agendas",
4949
"source": "./plugins/agendas",
5050
"description": "A plugin to create various meeting agendas"
51+
},
52+
{
53+
"name": "openshift",
54+
"source": "./plugins/openshift",
55+
"description": "OpenShift development utilities and helpers"
56+
},
57+
{
58+
"name": "yaml",
59+
"source": "./plugins/yaml",
60+
"description": "YAML documentation and utilities"
5161
}
5262
]
5363
}

.claudelint.yaml

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# claudelint configuration for ai-helpers marketplace
2+
# https://github.com/stbenjam/claudelint
3+
4+
rules:
5+
# Plugin structure rules
6+
plugin-json-required:
7+
enabled: true
8+
severity: error
9+
10+
plugin-json-valid:
11+
enabled: true
12+
severity: error
13+
14+
plugin-naming:
15+
enabled: true
16+
severity: warning
17+
18+
commands-dir-required:
19+
enabled: false # Plugins can have just skills or hooks
20+
severity: warning
21+
22+
commands-exist:
23+
enabled: false # Plugins can have just skills or hooks
24+
severity: info
25+
26+
plugin-readme:
27+
enabled: true
28+
severity: warning
29+
30+
# Command format rules
31+
command-naming:
32+
enabled: true
33+
severity: warning
34+
35+
command-frontmatter:
36+
enabled: true
37+
severity: error
38+
39+
command-sections:
40+
enabled: true
41+
severity: warning
42+
43+
command-name-format:
44+
enabled: true
45+
severity: warning
46+
47+
# Marketplace rules
48+
marketplace-json-valid:
49+
enabled: auto
50+
severity: error
51+
52+
marketplace-registration:
53+
enabled: auto
54+
severity: error
55+
56+
# Skills rules
57+
skill-frontmatter:
58+
enabled: true
59+
severity: warning
60+
61+
# Exclude patterns
62+
exclude: []
63+
64+
# Treat warnings as errors in CI
65+
strict: false
66+

.github/workflows/lint-plugins.yml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
name: Lint Plugins
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- 'plugins/**'
7+
- '.claude-plugin/**'
8+
- '.github/workflows/lint-plugins.yml'
9+
push:
10+
branches:
11+
- main
12+
13+
jobs:
14+
lint:
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- name: Checkout code
19+
uses: actions/checkout@v4
20+
21+
- name: Pull claudelint Docker image
22+
run: docker pull ghcr.io/stbenjam/claudelint:main
23+
24+
- name: Run claudelint
25+
run: |
26+
docker run --rm \
27+
-v ${{ github.workspace }}:/workspace \
28+
-w /workspace \
29+
ghcr.io/stbenjam/claudelint:main \
30+
-v --strict
31+
32+
- name: Comment on PR (on failure)
33+
if: failure() && github.event_name == 'pull_request'
34+
uses: actions/github-script@v7
35+
with:
36+
script: |
37+
const output = `⚠️ Plugin linter found issues.
38+
39+
Run locally to see details:
40+
\`\`\`bash
41+
docker run --rm -v $(pwd):/workspace ghcr.io/stbenjam/claudelint:main
42+
\`\`\`
43+
44+
Or install and run directly:
45+
\`\`\`bash
46+
pip install claudelint
47+
claudelint
48+
\`\`\`
49+
`;
50+
51+
github.rest.issues.createComment({
52+
issue_number: context.issue.number,
53+
owner: context.repo.owner,
54+
repo: context.repo.repo,
55+
body: output
56+
});

AGENTS.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -271,6 +271,20 @@ If your command needs helper scripts (Python, Bash, etc.):
271271
272272
**Example:** `plugins/prow-job/skills/prow-job-analyze-resource/parse_all_logs.py`
273273
274+
### Validating with the Linter
275+
276+
Before committing changes, always run the plugin linter to ensure compliance:
277+
278+
```bash
279+
make lint
280+
```
281+
282+
**When to run the linter:**
283+
- After creating a new plugin
284+
- After adding or modifying commands
285+
- Before committing changes
286+
- To diagnose structural issues
287+
274288
## Best Practices for AI Agents
275289
276290
### When Implementing Commands
@@ -281,6 +295,7 @@ If your command needs helper scripts (Python, Bash, etc.):
281295
4. **Include error handling:** Document failure scenarios and recovery
282296
5. **Add examples:** Show common usage patterns
283297
6. **Test before committing:** Verify the command works as expected
298+
7. **Run the linter:** Use `make lint` to validate your plugin structure and format
284299
285300
### When Writing SKILL.md Files
286301

Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Makefile for ai-helpers
2+
3+
# Container runtime (podman or docker)
4+
CONTAINER_RUNTIME ?= $(shell command -v podman 2>/dev/null || echo docker)
5+
6+
# claudelint image
7+
CLAUDELINT_IMAGE = ghcr.io/stbenjam/claudelint:main
8+
9+
.PHONY: help
10+
help: ## Show this help message
11+
@echo "Available targets:"
12+
@grep -E '^[a-zA-Z_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[36m%-20s\033[0m %s\n", $$1, $$2}'
13+
14+
.PHONY: lint
15+
lint: ## Run plugin linter (verbose, strict mode)
16+
@echo "Running claudelint with $(CONTAINER_RUNTIME)..."
17+
$(CONTAINER_RUNTIME) run --rm -v $(PWD):/workspace:Z ghcr.io/stbenjam/claudelint:main -v --strict
18+
19+
.PHONY: lint-pull
20+
lint-pull: ## Pull the latest claudelint image
21+
@echo "Pulling latest claudelint image..."
22+
$(CONTAINER_RUNTIME) pull $(CLAUDELINT_IMAGE)
23+
24+
.DEFAULT_GOAL := help
25+

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,19 @@ If you're contributing several related commands that warrant their own plugin:
135135
```
136136
3. Register your plugin in `.claude-plugin/marketplace.json`
137137

138+
### Validating Plugins
139+
140+
This repository uses [claudelint](https://github.com/stbenjam/claudelint) to validate plugin structure:
141+
142+
```bash
143+
make lint
144+
```
145+
146+
## Additional Documentation
147+
148+
- **[AGENTS.md](AGENTS.md)** - Complete guide for AI agents working with this repository
149+
- **[CLAUDE.md](CLAUDE.md)** - Claude-specific configuration and notes
150+
138151
## License
139152

140153
See [LICENSE](LICENSE) for details.

plugins/ci/commands/ask-sippy.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ argument-hint: [question]
44
---
55

66
## Name
7-
ask-sippy
7+
ci:ask-sippy
88

99
## Synopsis
1010
```

plugins/ci/commands/query-job-status.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ argument-hint: <execution-id>
44
---
55

66
## Name
7-
query-job-status
7+
ci:query-job-status
88

99
## Synopsis
1010
```

plugins/ci/commands/trigger-periodic.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ argument-hint: <job-name> [ENV_VAR=value ...]
44
---
55

66
## Name
7-
trigger-periodic
7+
ci:trigger-periodic
88

99
## Synopsis
1010
```

plugins/ci/commands/trigger-postsubmit.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ argument-hint: <job-name> <org> <repo> <base-ref> <base-sha> [ENV_VAR=value ...]
44
---
55

66
## Name
7-
trigger-postsubmit
7+
ci:trigger-postsubmit
88

99
## Synopsis
1010
```

0 commit comments

Comments
 (0)