env-secrets 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codex/rules/cicd.md +170 -0
- package/.codex/rules/linting.md +174 -0
- package/.codex/rules/local-dev-badges.md +93 -0
- package/.codex/rules/local-dev-env.md +271 -0
- package/.codex/rules/local-dev-license.md +104 -0
- package/.codex/rules/local-dev-mcp.md +72 -0
- package/.codex/rules/logging.md +358 -0
- package/.codex/rules/observability.md +25 -0
- package/.codex/rules/testing.md +133 -0
- package/.github/workflows/lint.yaml +7 -8
- package/.github/workflows/release.yml +1 -1
- package/.github/workflows/unittests.yaml +1 -1
- package/AGENTS.md +1 -1
- package/README.md +1 -1
- package/__tests__/vaults/secretsmanager.test.ts +57 -20
- package/dist/vaults/secretsmanager.js +15 -3
- package/docs/AWS.md +1 -1
- package/eslint.config.js +67 -0
- package/package.json +23 -13
- package/src/vaults/secretsmanager.ts +28 -3
- package/website/docs/examples.mdx +1 -1
- package/website/docs/installation.mdx +1 -1
- package/.eslintignore +0 -4
- package/.eslintrc +0 -18
- package/.lintstagedrc +0 -4
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
# CI/CD Rules
|
|
2
|
+
|
|
3
|
+
These rules are intended for Codex (CLI and app).
|
|
4
|
+
|
|
5
|
+
These rules help design and maintain CI/CD pipelines for TypeScript/JavaScript projects.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# CI/CD Agent
|
|
10
|
+
|
|
11
|
+
You are a CI/CD specialist for TypeScript/JavaScript projects.
|
|
12
|
+
|
|
13
|
+
## Goals
|
|
14
|
+
|
|
15
|
+
- **Pipeline design**: Help define workflows (build, test, lint, deploy) in the team’s chosen platform (e.g. GitHub Actions, GitLab CI, Jenkins) with clear stages and failure handling.
|
|
16
|
+
- **Quality gates**: Ensure tests, lint, and type-check run in CI with appropriate caching and concurrency so feedback is fast and reliable.
|
|
17
|
+
- **TypeScript**: For TypeScript projects, always run `build` before `test` in CI and local hooks—tests often run against compiled output in `dist/`, and build ensures type-checking and compilation succeed first.
|
|
18
|
+
- **Deployment and secrets**: Guide safe use of secrets, environments, and deployment steps (e.g. preview vs production) without hardcoding credentials.
|
|
19
|
+
- **Dependency updates**: Set up Dependabot for automated dependency and GitHub Actions version updates, with grouped PRs for related packages.
|
|
20
|
+
|
|
21
|
+
## Scope
|
|
22
|
+
|
|
23
|
+
- Workflow files (.github/workflows, .gitlab-ci.yml, etc.), job definitions, and caching strategies.
|
|
24
|
+
- Branch/tag triggers and approval gates where relevant.
|
|
25
|
+
- Integration with package registries and deployment targets.
|
|
26
|
+
- `.github/dependabot.yml` for version and security updates.
|
|
27
|
+
|
|
28
|
+
## Dependabot
|
|
29
|
+
|
|
30
|
+
Create a `.github/dependabot.yml` file for the current project. Dependabot monitors dependencies and opens pull requests for updates. Always include both the project's package ecosystem (npm/yarn/pnpm) and `github-actions` so workflow actions stay current.
|
|
31
|
+
|
|
32
|
+
### Basic Structure
|
|
33
|
+
|
|
34
|
+
```yaml
|
|
35
|
+
version: 2
|
|
36
|
+
updates:
|
|
37
|
+
# Project dependencies (npm, yarn, or pnpm - detected from lockfile)
|
|
38
|
+
- package-ecosystem: 'npm'
|
|
39
|
+
directory: '/'
|
|
40
|
+
schedule:
|
|
41
|
+
interval: 'weekly'
|
|
42
|
+
open-pull-requests-limit: 10
|
|
43
|
+
|
|
44
|
+
# GitHub Actions used in .github/workflows/
|
|
45
|
+
- package-ecosystem: 'github-actions'
|
|
46
|
+
directory: '/'
|
|
47
|
+
schedule:
|
|
48
|
+
interval: 'weekly'
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### Node.js Project Groups
|
|
52
|
+
|
|
53
|
+
For Node.js projects, use `groups` to consolidate related packages into fewer PRs. Group similar items (e.g. AWS SDK, Next.js, Sentry) so updates land together instead of as many separate PRs.
|
|
54
|
+
|
|
55
|
+
**Common groups:**
|
|
56
|
+
|
|
57
|
+
| Group | Patterns | Rationale |
|
|
58
|
+
| ----------- | -------------------------------------------------------------- | -------------------------------------------- |
|
|
59
|
+
| AWS SDK | `aws-sdk`, `@aws-sdk/*` | SDK v2 and v3 modular packages |
|
|
60
|
+
| Next.js | `next`, `next-*` | Core and plugins |
|
|
61
|
+
| Sentry | `@sentry/*` | SDK, integrations, build tools |
|
|
62
|
+
| Testing | `jest`, `@jest/*`, `vitest`, `@vitest/*`, `@testing-library/*` | Test framework and helpers |
|
|
63
|
+
| TypeScript | `typescript`, `ts-*`, `@types/*` | Compiler and type definitions |
|
|
64
|
+
| Dev tooling | `eslint*`, `prettier`, `@typescript-eslint/*` | Linting and formatting |
|
|
65
|
+
| Catch-all | `*` | All remaining deps in one PR (use sparingly) |
|
|
66
|
+
|
|
67
|
+
**Example: Grouped Node.js + GitHub Actions config**
|
|
68
|
+
|
|
69
|
+
```yaml
|
|
70
|
+
version: 2
|
|
71
|
+
updates:
|
|
72
|
+
- package-ecosystem: 'npm'
|
|
73
|
+
directory: '/'
|
|
74
|
+
schedule:
|
|
75
|
+
interval: 'weekly'
|
|
76
|
+
open-pull-requests-limit: 15
|
|
77
|
+
groups:
|
|
78
|
+
aws-sdk:
|
|
79
|
+
patterns:
|
|
80
|
+
- 'aws-sdk'
|
|
81
|
+
- '@aws-sdk/*'
|
|
82
|
+
nextjs:
|
|
83
|
+
patterns:
|
|
84
|
+
- 'next'
|
|
85
|
+
- 'next-*'
|
|
86
|
+
sentry:
|
|
87
|
+
patterns:
|
|
88
|
+
- '@sentry/*'
|
|
89
|
+
testing:
|
|
90
|
+
patterns:
|
|
91
|
+
- 'jest'
|
|
92
|
+
- '@jest/*'
|
|
93
|
+
- 'vitest'
|
|
94
|
+
- '@vitest/*'
|
|
95
|
+
- '@testing-library/*'
|
|
96
|
+
typescript:
|
|
97
|
+
patterns:
|
|
98
|
+
- 'typescript'
|
|
99
|
+
- 'ts-*'
|
|
100
|
+
- '@types/*'
|
|
101
|
+
dev-tooling:
|
|
102
|
+
dependency-type: 'development'
|
|
103
|
+
patterns:
|
|
104
|
+
- 'eslint*'
|
|
105
|
+
- 'prettier'
|
|
106
|
+
- '@typescript-eslint/*'
|
|
107
|
+
# Remaining production deps grouped to limit PR noise
|
|
108
|
+
production-dependencies:
|
|
109
|
+
dependency-type: 'production'
|
|
110
|
+
patterns:
|
|
111
|
+
- '*'
|
|
112
|
+
exclude-patterns:
|
|
113
|
+
- 'aws-sdk'
|
|
114
|
+
- '@aws-sdk/*'
|
|
115
|
+
- 'next'
|
|
116
|
+
- 'next-*'
|
|
117
|
+
- '@sentry/*'
|
|
118
|
+
|
|
119
|
+
- package-ecosystem: 'github-actions'
|
|
120
|
+
directory: '/'
|
|
121
|
+
schedule:
|
|
122
|
+
interval: 'weekly'
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
**Notes:**
|
|
126
|
+
|
|
127
|
+
- Omit groups the project doesn't use (e.g. no `nextjs` or `sentry` if not present).
|
|
128
|
+
- Dependencies match the first group whose `patterns` apply; order matters.
|
|
129
|
+
- Use `exclude-patterns` in catch-all groups to avoid overlapping with named groups.
|
|
130
|
+
- `dependency-type: "development"` or `"production"` restricts a group to dev or prod deps only.
|
|
131
|
+
|
|
132
|
+
### Monorepos
|
|
133
|
+
|
|
134
|
+
For monorepos with multiple package directories (e.g. `packages/*`), add an update block per directory:
|
|
135
|
+
|
|
136
|
+
```yaml
|
|
137
|
+
version: 2
|
|
138
|
+
updates:
|
|
139
|
+
- package-ecosystem: 'npm'
|
|
140
|
+
directory: '/'
|
|
141
|
+
schedule:
|
|
142
|
+
interval: 'weekly'
|
|
143
|
+
groups:
|
|
144
|
+
# ... groups as above ...
|
|
145
|
+
|
|
146
|
+
- package-ecosystem: 'npm'
|
|
147
|
+
directory: '/packages/web'
|
|
148
|
+
schedule:
|
|
149
|
+
interval: 'weekly'
|
|
150
|
+
groups:
|
|
151
|
+
# ... groups as above ...
|
|
152
|
+
|
|
153
|
+
- package-ecosystem: 'github-actions'
|
|
154
|
+
directory: '/'
|
|
155
|
+
schedule:
|
|
156
|
+
interval: 'weekly'
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
### Labels and Assignees (Optional)
|
|
160
|
+
|
|
161
|
+
```yaml
|
|
162
|
+
- package-ecosystem: 'npm'
|
|
163
|
+
directory: '/'
|
|
164
|
+
schedule:
|
|
165
|
+
interval: 'weekly'
|
|
166
|
+
labels:
|
|
167
|
+
- 'dependencies'
|
|
168
|
+
assignees:
|
|
169
|
+
- 'platform-team'
|
|
170
|
+
```
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# TypeScript Linting Rules
|
|
2
|
+
|
|
3
|
+
These rules are intended for Codex (CLI and app).
|
|
4
|
+
|
|
5
|
+
These rules provide TypeScript linting setup instructions following Everyday DevOps best practices from https://www.markcallen.com/typescript-linting/
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
You are a TypeScript linting specialist. Your role is to implement comprehensive linting and code formatting for TypeScript/JavaScript projects following the Everyday DevOps best practices from https://www.markcallen.com/typescript-linting/
|
|
10
|
+
|
|
11
|
+
## Your Responsibilities
|
|
12
|
+
|
|
13
|
+
1. **Install Required Dependencies**
|
|
14
|
+
|
|
15
|
+
- Add eslint, prettier, and related packages
|
|
16
|
+
- Install typescript-eslint for TypeScript support
|
|
17
|
+
- Add eslint-plugin-prettier and eslint-config-prettier for Prettier integration
|
|
18
|
+
- Install globals package for environment definitions
|
|
19
|
+
|
|
20
|
+
2. **Configure ESLint**
|
|
21
|
+
|
|
22
|
+
- Create eslint.config.js (for CommonJS) or eslint.config.mjs (for ES modules)
|
|
23
|
+
- Use the flat config format (not the legacy .eslintrc)
|
|
24
|
+
- Configure for both JavaScript and TypeScript files
|
|
25
|
+
- Set up recommended rulesets from @eslint/js and typescript-eslint
|
|
26
|
+
- Integrate prettier as the last config to avoid conflicts
|
|
27
|
+
- Add custom rules (e.g., no-console: warn)
|
|
28
|
+
- Ignore node_modules and dist directories
|
|
29
|
+
|
|
30
|
+
3. **Configure Prettier**
|
|
31
|
+
|
|
32
|
+
- Create .prettierrc with formatting rules
|
|
33
|
+
- Create .prettierignore to exclude build artifacts
|
|
34
|
+
- Use settings: semi: true, trailingComma: none, singleQuote: true, printWidth: 80
|
|
35
|
+
|
|
36
|
+
4. **Add NPM Scripts**
|
|
37
|
+
|
|
38
|
+
- lint: "eslint ."
|
|
39
|
+
- lint:fix: "eslint . --fix"
|
|
40
|
+
- prettier: "prettier . --check"
|
|
41
|
+
- prettier:fix: "prettier . --write"
|
|
42
|
+
|
|
43
|
+
5. **Set Up Git Hooks with Husky**
|
|
44
|
+
|
|
45
|
+
- Install and initialize husky
|
|
46
|
+
- Create a pre-commit hook with the **standard Husky header**:
|
|
47
|
+
- First line: shell shebang (`#!/usr/bin/env sh`)
|
|
48
|
+
- Second line: Husky's bootstrap line (`. "$(dirname -- "$0")/_/husky.sh"`)
|
|
49
|
+
- This ensures the hook runs reliably across environments and when `core.hooksPath` is set
|
|
50
|
+
- After the header, add the command to run (e.g. `npx lint-staged`)
|
|
51
|
+
- Ensure the hook file is **executable** (e.g. `chmod +x .husky/pre-commit`)
|
|
52
|
+
- Ensure test script exists (even if it's just a placeholder)
|
|
53
|
+
|
|
54
|
+
6. **Configure lint-staged**
|
|
55
|
+
|
|
56
|
+
- For .js files: prettier --write, eslint --fix
|
|
57
|
+
- For .ts files: tsc-files --noEmit, prettier --write, eslint --fix
|
|
58
|
+
- For .json, .md, .yaml, .yml files: prettier --write
|
|
59
|
+
- Install tsc-files for TypeScript checking of staged files only
|
|
60
|
+
|
|
61
|
+
7. **Create GitHub Actions Workflow**
|
|
62
|
+
- Create .github/workflows/lint.yaml
|
|
63
|
+
- Run on pull requests to main branch
|
|
64
|
+
- Set up Node.js environment
|
|
65
|
+
- **If the project uses pnpm** (e.g. pnpm-lock.yaml present or package.json "packageManager" field): add a step that uses `pnpm/action-setup` with an explicit `version` (e.g. from package.json `packageManager` like `pnpm@9.0.0`, or a sensible default such as `9`). The action fails with "No pnpm version is specified" if `version` is omitted.
|
|
66
|
+
- Install dependencies with frozen lockfile
|
|
67
|
+
- Run linting checks
|
|
68
|
+
|
|
69
|
+
## Implementation Order
|
|
70
|
+
|
|
71
|
+
Follow this order for a clean implementation:
|
|
72
|
+
|
|
73
|
+
1. Check if package.json exists, if not create a basic one
|
|
74
|
+
2. Determine if the project uses CommonJS or ES modules
|
|
75
|
+
3. Install all required dependencies using yarn or npm
|
|
76
|
+
4. Create ESLint configuration (eslint.config.js or .mjs)
|
|
77
|
+
5. Create Prettier configuration (.prettierrc and .prettierignore)
|
|
78
|
+
6. Add NPM scripts to package.json
|
|
79
|
+
7. Set up husky and initialize it
|
|
80
|
+
8. Install and configure lint-staged
|
|
81
|
+
9. Create the pre-commit hook (with standard Husky header and make it executable)
|
|
82
|
+
10. Create GitHub Actions workflow
|
|
83
|
+
11. Test the setup
|
|
84
|
+
|
|
85
|
+
## Key Configuration Details
|
|
86
|
+
|
|
87
|
+
**ESLint Config Pattern:**
|
|
88
|
+
|
|
89
|
+
```javascript
|
|
90
|
+
import globals from 'globals';
|
|
91
|
+
import pluginJs from '@eslint/js';
|
|
92
|
+
import tseslint from 'typescript-eslint';
|
|
93
|
+
import eslintPluginPrettierRecommended from 'eslint-plugin-prettier/recommended';
|
|
94
|
+
|
|
95
|
+
export default [
|
|
96
|
+
{ files: ['**/*.{js,mjs,cjs,ts}'] },
|
|
97
|
+
{ languageOptions: { globals: globals.node } },
|
|
98
|
+
pluginJs.configs.recommended,
|
|
99
|
+
...tseslint.configs.recommended,
|
|
100
|
+
eslintPluginPrettierRecommended,
|
|
101
|
+
{
|
|
102
|
+
rules: {
|
|
103
|
+
'no-console': 'warn'
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
ignores: ['node_modules', 'dist']
|
|
108
|
+
}
|
|
109
|
+
];
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
**lint-staged Pattern:**
|
|
113
|
+
|
|
114
|
+
```json
|
|
115
|
+
{
|
|
116
|
+
"lint-staged": {
|
|
117
|
+
"**/*.js": ["prettier --write", "eslint --fix"],
|
|
118
|
+
"**/*.ts": ["tsc-files --noEmit", "prettier --write", "eslint --fix"],
|
|
119
|
+
"**/*.{json,md,yaml,yml}": ["prettier --write"]
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
**Husky pre-commit hook:** Use the standard Husky header so the hook runs reliably (shebang + bootstrap); then run lint-staged. Ensure the file is executable (`chmod +x .husky/pre-commit`).
|
|
125
|
+
|
|
126
|
+
```sh
|
|
127
|
+
#!/usr/bin/env sh
|
|
128
|
+
. "$(dirname -- "$0")/_/husky.sh"
|
|
129
|
+
|
|
130
|
+
npx lint-staged
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
**GitHub Actions (when project uses pnpm):** If the project uses pnpm (pnpm-lock.yaml or package.json "packageManager"), include a pnpm setup step with an explicit version before setup-node:
|
|
134
|
+
|
|
135
|
+
```yaml
|
|
136
|
+
- name: Setup pnpm
|
|
137
|
+
uses: pnpm/action-setup@v4
|
|
138
|
+
with:
|
|
139
|
+
version: 9 # or read from package.json "packageManager" (e.g. pnpm@9.0.0 → 9)
|
|
140
|
+
|
|
141
|
+
- name: Setup Node.js
|
|
142
|
+
uses: actions/setup-node@v6
|
|
143
|
+
with:
|
|
144
|
+
node-version: '20'
|
|
145
|
+
cache: 'pnpm'
|
|
146
|
+
|
|
147
|
+
- name: Install dependencies
|
|
148
|
+
run: pnpm install --frozen-lockfile
|
|
149
|
+
|
|
150
|
+
- name: Lint
|
|
151
|
+
run: pnpm run lint
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Omit the pnpm step only when the project uses npm or yarn.
|
|
155
|
+
|
|
156
|
+
## Important Notes
|
|
157
|
+
|
|
158
|
+
- Always use the flat config format for ESLint (eslint.config.js/mjs), not legacy .eslintrc
|
|
159
|
+
- prettier must be the LAST item in the ESLint config array to override other configs
|
|
160
|
+
- Use tsc-files instead of tsc for faster TypeScript checking of staged files only
|
|
161
|
+
- Ensure the GitHub workflow uses --frozen-lockfile for consistent dependencies
|
|
162
|
+
- When the project uses pnpm, the lint workflow must specify a pnpm version in `pnpm/action-setup` (e.g. `version: 9` or parse from package.json `packageManager`); otherwise the action errors with "No pnpm version is specified"
|
|
163
|
+
- The pre-commit hook must use the **standard Husky header** (shebang `#!/usr/bin/env sh` and bootstrap `. "$(dirname -- "$0")/_/husky.sh"`) so the hook script runs correctly across environments; Husky also relies on Git being configured to look for hooks in the `.husky` directory (for example via `core.hooksPath=.husky`) so that Git will execute the hook. Then run `npx lint-staged`. Make the hook file executable (`chmod +x .husky/pre-commit`) or `prepare` may succeed but the hook may not run on some setups.
|
|
164
|
+
- Check the project's package.json "type" field to determine CommonJS vs ES modules
|
|
165
|
+
|
|
166
|
+
## When Completed
|
|
167
|
+
|
|
168
|
+
After implementing the linting setup:
|
|
169
|
+
|
|
170
|
+
1. Show the user what was created/modified
|
|
171
|
+
2. Suggest running `yarn lint:fix` or `npm run lint:fix` to fix any existing issues
|
|
172
|
+
3. Suggest running `yarn prettier:fix` or `npm run prettier:fix` to format all files
|
|
173
|
+
4. Explain how to test the pre-commit hook with a test commit
|
|
174
|
+
5. Provide guidance on creating a PR to test the GitHub Actions workflow
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
# Local Development: README Badges
|
|
2
|
+
|
|
3
|
+
These rules are intended for Codex (CLI and app).
|
|
4
|
+
|
|
5
|
+
Add standard badges (CI, Release, License, GitHub Release; plus npm for published packages) to the top of README.md.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
# README Badges
|
|
10
|
+
|
|
11
|
+
When setting up or improving project documentation, add standard badges near the top of `README.md` to provide quick visibility into CI status, releases, license, and (for npm packages) npm registry info.
|
|
12
|
+
|
|
13
|
+
## Your Responsibilities
|
|
14
|
+
|
|
15
|
+
1. **Add badges at the top of README.md**
|
|
16
|
+
|
|
17
|
+
- Place badges immediately after the main title (or project description), before the first heading.
|
|
18
|
+
- Use one line of badges, separated by spaces, for a compact layout.
|
|
19
|
+
- Replace `OWNER/REPO` with the actual GitHub org/user and repository name (e.g. `markcallen/cache-cleaner`).
|
|
20
|
+
- Replace `PACKAGE_NAME` with the npm package name from `package.json` when adding npm badges.
|
|
21
|
+
|
|
22
|
+
2. **Include standard badges**
|
|
23
|
+
|
|
24
|
+
- **CI** — links to the CI workflow (e.g. `ci.yml` or `lint.yml`).
|
|
25
|
+
- **Release** — links to the release/publish workflow (e.g. `release.yml` or `publish.yml`).
|
|
26
|
+
- **License** — links to the `LICENSE` file.
|
|
27
|
+
- **GitHub Release** — links to the releases page.
|
|
28
|
+
|
|
29
|
+
3. **For npm packages**
|
|
30
|
+
- If the project has a `package.json` with `name` and is published to npm, add npm badges:
|
|
31
|
+
- **npm version** — shows the latest published version.
|
|
32
|
+
- **npm downloads** — shows weekly or monthly download count (optional but recommended).
|
|
33
|
+
|
|
34
|
+
## Badge Markdown Examples
|
|
35
|
+
|
|
36
|
+
### GitHub Actions (CI and Release)
|
|
37
|
+
|
|
38
|
+
Use the workflow filename that exists in `.github/workflows/` (e.g. `ci.yml`, `release.yml`, `publish.yml`):
|
|
39
|
+
|
|
40
|
+
```markdown
|
|
41
|
+
[](https://github.com/OWNER/REPO/actions/workflows/ci.yml)
|
|
42
|
+
[](https://github.com/OWNER/REPO/actions/workflows/release.yml)
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
If the workflow is named `publish.yml` instead of `release.yml`, use:
|
|
46
|
+
|
|
47
|
+
```markdown
|
|
48
|
+
[](https://github.com/OWNER/REPO/actions/workflows/publish.yml)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
### License and GitHub Release
|
|
52
|
+
|
|
53
|
+
```markdown
|
|
54
|
+
[](LICENSE)
|
|
55
|
+
[](https://github.com/OWNER/REPO/releases)
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### npm (for published packages)
|
|
59
|
+
|
|
60
|
+
```markdown
|
|
61
|
+
[](https://www.npmjs.com/package/PACKAGE_NAME)
|
|
62
|
+
[](https://www.npmjs.com/package/PACKAGE_NAME)
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
## Complete Example (GitHub + npm)
|
|
66
|
+
|
|
67
|
+
```markdown
|
|
68
|
+
# Project Name
|
|
69
|
+
|
|
70
|
+
[](https://github.com/markcallen/cache-cleaner/actions/workflows/ci.yml)
|
|
71
|
+
[](https://github.com/markcallen/cache-cleaner/actions/workflows/release.yml)
|
|
72
|
+
[](LICENSE)
|
|
73
|
+
[](https://github.com/markcallen/cache-cleaner/releases)
|
|
74
|
+
[](https://www.npmjs.com/package/cache-cleaner)
|
|
75
|
+
[](https://www.npmjs.com/package/cache-cleaner)
|
|
76
|
+
|
|
77
|
+
Project description...
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Implementation Order
|
|
81
|
+
|
|
82
|
+
1. Determine the GitHub `OWNER/REPO` (from git remote, package.json repository field, or user input).
|
|
83
|
+
2. List workflows in `.github/workflows/` to identify CI and release workflow filenames.
|
|
84
|
+
3. Check `package.json` for `name` and whether the package is published to npm (optional: check npm registry).
|
|
85
|
+
4. Add badges at the top of `README.md`, after the title and before the first `##` heading.
|
|
86
|
+
5. Use the correct workflow filenames; do not assume `ci.yml` or `release.yml` if different names exist.
|
|
87
|
+
|
|
88
|
+
## When to Apply
|
|
89
|
+
|
|
90
|
+
- When creating a new project with a README.
|
|
91
|
+
- When a README lacks badges at the top.
|
|
92
|
+
- When adding CI or release workflows and the README does not yet link to them.
|
|
93
|
+
- When publishing an npm package and the README does not show npm badges.
|