Skip to content

Commit 60d1927

Browse files
feat: add copilot instructions and prompt for adding new scripts to README.md (#108)
1 parent 455fa85 commit 60d1927

File tree

2 files changed

+153
-0
lines changed

2 files changed

+153
-0
lines changed

.github/copilot-instructions.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Copilot instructions
2+
3+
## scripts in the `gh-cli` and `scripts` directories
4+
5+
When creating or modifying scripts in the `gh-cli` directory, ensure:
6+
7+
- The script has input parameters
8+
- The script has a basic description and usage examples at the top
9+
- We make sure to paginate (`--paginate`) when retrieving results
10+
- Note any special permissions/token requirements
11+
- If modifying input parameters to a script, make sure to update the respective `README.md` in the script directory (if applicable)
12+
13+
## README.md documentation
14+
15+
When adding new scripts to any directory:
16+
17+
- Always add an entry to the appropriate `README.md` file in alphabetical order
18+
- Follow the existing format and structure in the README
19+
- Include a clear description, usage examples, and any prerequisites/notes
20+
- Use proper kebab-case naming convention for script files
21+
- Avoid short words like "repo" (use "repository"), "org" (use "organization")
22+
- Test that the entry passes `lint-readme.js` validation
23+
24+
## Script naming and structure
25+
26+
- Use kebab-case for all script filenames (e.g., `get-organization-repositories.sh`)
27+
- Include appropriate file extensions (.sh, .ps1, .js, .py)
28+
- Make shell scripts executable with `chmod +x`
29+
- Add shebang lines at the top of scripts (e.g., `#!/bin/bash`)
30+
- Include error handling and parameter validation
31+
32+
## API and authentication patterns
33+
34+
- Use `gh api --paginate` for GitHub CLI API calls
35+
- Include proper error handling for API rate limits and permissions
36+
- Document required scopes and permissions in script comments
37+
- Use environment variables or parameters for sensitive data (never hardcode tokens)
38+
- For scripts requiring special permissions, mention this in both script comments and README
Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
# Add New Script to README.md
2+
3+
You are helping to add a new script to the appropriate README.md file in this repository while ensuring it passes the lint-readme.js validation.
4+
5+
## Context
6+
7+
This repository contains GitHub-related scripts organized in different directories:
8+
9+
- `gh-cli/` - Scripts using GitHub CLI
10+
- `api/` - Scripts using direct API calls
11+
- `scripts/` - General utility scripts
12+
- `graphql/` - GraphQL-specific scripts
13+
14+
Each directory has its own README.md that documents the scripts in that directory.
15+
16+
## Requirements
17+
18+
When adding a new script entry to a README.md, you must ensure it meets these criteria from `lint-readme.js`:
19+
20+
### 1. Alphabetical Order
21+
22+
- Script entries must be in alphabetical order within the "Scripts" section
23+
- Use the appropriate heading level (### for gh-cli, ## for other directories)
24+
- Check existing entries to maintain proper ordering
25+
26+
### 2. Naming Convention
27+
28+
- Script names must follow kebab-case convention
29+
- Avoid short words like "repo" (use "repository"), "org" (use "organization")
30+
- File extensions should be included (.sh, .ps1, .js, .py, etc.)
31+
32+
### 3. Required Information
33+
34+
Each script entry must include:
35+
36+
- **Heading**: `### script-name.sh` (or appropriate extension)
37+
- **Description**: Brief explanation of what the script does
38+
- **Usage examples**: If applicable, show how to run the script
39+
- **Notes/Warnings**: Any important information about prerequisites, permissions, or limitations
40+
41+
### 4. File Existence
42+
43+
- Only add entries for scripts that actually exist in the repository
44+
- The script file must be committed to Git (not just local files)
45+
46+
## Template Format
47+
48+
Use this template when adding a new script entry:
49+
50+
```markdown
51+
### script-name.sh
52+
53+
Brief description of what the script does.
54+
55+
Usage:
56+
57+
\`\`\`shell
58+
./script-name.sh <parameter1> <parameter2>
59+
\`\`\`
60+
61+
Additional details, examples, or notes if needed.
62+
63+
> [!NOTE]
64+
> Any important notes about requirements or limitations.
65+
```
66+
67+
## Process
68+
69+
1. **Identify the correct directory** where the script belongs
70+
2. **Check the existing README.md** in that directory for formatting patterns
71+
3. **Find the correct alphabetical position** for the new entry
72+
4. **Add the script entry** using the template above
73+
5. **Verify the entry** includes all required information
74+
75+
## Validation
76+
77+
After adding the script entry, the lint-readme.js will check:
78+
79+
- ✅ Script exists in the repository and is committed
80+
- ✅ Entry is in alphabetical order
81+
- ✅ Follows kebab-case naming convention
82+
- ✅ Uses appropriate heading level
83+
- ✅ Avoids short words in file names
84+
85+
## Examples
86+
87+
Good script entry:
88+
89+
```markdown
90+
### get-organization-repositories.sh
91+
92+
Gets a list of all repositories in an organization with optional filtering.
93+
94+
Usage:
95+
96+
\`\`\`shell
97+
./get-organization-repositories.sh my-org
98+
./get-organization-repositories.sh my-org --type=private
99+
\`\`\`
100+
101+
> [!NOTE]
102+
> Requires organization member permissions to see private repositories.
103+
```
104+
105+
## Instructions
106+
107+
When I provide you with a script name and description, please:
108+
109+
1. Determine which directory/README.md it belongs in
110+
2. Find the correct alphabetical position
111+
3. Create a properly formatted entry following the template
112+
4. Include appropriate usage examples and notes
113+
5. Ensure it will pass all lint-readme.js validations
114+
115+
Ask for clarification if you need more details about the script's functionality or usage patterns.

0 commit comments

Comments
 (0)