@mapringg/standard 0.0.0-stage → 1.15.4
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/.claude/skills/adopt-standard/SKILL.md +196 -0
- package/.claude/skills/capture/SKILL.md +27 -0
- package/.claude/skills/pr/LICENSE +21 -0
- package/.claude/skills/pr/SKILL.md +170 -0
- package/.claude/skills/pr/UPSTREAM.md +4 -0
- package/.claude/skills/review-standard/SKILL.md +12 -0
- package/.claude/skills/test-audit/SKILL.md +25 -0
- package/.claude/skills/upgrade-standard/SKILL.md +25 -0
- package/LICENSE +21 -0
- package/README.md +10 -2
- package/bin/check-pr.mjs +11 -0
- package/bin/upload-evidence.mjs +120 -0
- package/knip.json +25 -0
- package/oxfmt.json +8 -0
- package/oxlint.json +464 -0
- package/package.json +66 -4
- package/packages/create-mapringg-repo/LICENSE +21 -0
- package/packages/create-mapringg-repo/cli.mjs +324 -0
- package/packages/create-mapringg-repo/github.mjs +128 -0
- package/packages/create-mapringg-repo/package.json +25 -0
- package/packages/create-mapringg-repo/release.mjs +52 -0
- package/packages/create-mapringg-repo/setup.mjs +224 -0
- package/src/plugin/agent-docs.mjs +240 -0
- package/src/plugin/design-system.mjs +75 -0
- package/src/plugin/feature-imports.mjs +38 -0
- package/src/plugin/hono.mjs +186 -0
- package/src/plugin/index.mjs +42 -0
- package/src/plugin/markdown-lines.mjs +35 -0
- package/src/plugin/next-data.mjs +124 -0
- package/src/plugin/next-routes.mjs +63 -0
- package/src/plugin/no-chained-assertions.mjs +22 -0
- package/src/plugin/no-comments.mjs +23 -0
- package/src/plugin/no-return-types.mjs +48 -0
- package/src/plugin/no-typeof.mjs +27 -0
- package/src/plugin/owners.mjs +428 -0
- package/src/plugin/params.mjs +75 -0
- package/src/plugin/paths.mjs +192 -0
- package/src/plugin/pr-check.mjs +141 -0
- package/src/plugin/query-client.mjs +49 -0
- package/src/plugin/reducer.mjs +84 -0
- package/src/plugin/repo-shape.mjs +351 -0
- package/src/plugin/repository-docs.mjs +119 -0
- package/src/plugin/server-actions.mjs +60 -0
- package/src/plugin/tests.mjs +222 -0
- package/tsconfig.json +23 -0
|
@@ -0,0 +1,196 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: adopt-standard
|
|
3
|
+
description: Create, adopt, or configure a repository that uses Standard.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Adopt Standard
|
|
7
|
+
|
|
8
|
+
For projects that start from a shared template, set up these commands and skill triggers in the template. Use the
|
|
9
|
+
[upgrade skill](../upgrade-standard/SKILL.md) to bring existing projects to the same release tag.
|
|
10
|
+
|
|
11
|
+
## Create or adopt a repo
|
|
12
|
+
|
|
13
|
+
Run the command outside a Git checkout to create a repository, or inside a checkout to adopt it. Use Node 26 and
|
|
14
|
+
a signed-in GitHub CLI account with admin access. Select **app** for the monorepo template and local app checks, or
|
|
15
|
+
**plain** for the shared PR check alone.
|
|
16
|
+
|
|
17
|
+
```sh
|
|
18
|
+
pnpm create mapringg-repo
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
New repos default to private and start with `Initial commit`. The command runs applicable local checks, pushes the
|
|
22
|
+
baseline, and waits for the GitHub check. Template production deploys start in manual mode. Existing repos retain
|
|
23
|
+
their history and checks. The command opens or reuses a setup PR when files need changes and reports its CI result.
|
|
24
|
+
Rerun the command after an interruption. Use `--help` for non-interactive options.
|
|
25
|
+
|
|
26
|
+
## Shared PR workflow
|
|
27
|
+
|
|
28
|
+
Open one pull request per change from the latest target branch. Start the title with a capitalised verb and fit it
|
|
29
|
+
within 80 characters including the squash suffix ` (#<number>)`. Write the body with the [PR skill](../pr/SKILL.md),
|
|
30
|
+
gather proof with [Capture](../capture/SKILL.md), and squash-merge after `Check` passes.
|
|
31
|
+
In GitHub's merge settings, enable only squash merging and set the default message to **Pull request title** so the
|
|
32
|
+
squash commit gets the PR title and an empty body.
|
|
33
|
+
Require an independent approval on projects with a reviewer. Make `Check` required where branch protection is available.
|
|
34
|
+
|
|
35
|
+
To check PRs in a repository that does not run Oxlint, add this step to its `Check` job.
|
|
36
|
+
Run the job on `pull_request` events of type `opened`, `synchronize`, `reopened`, and `edited`.
|
|
37
|
+
|
|
38
|
+
```yaml
|
|
39
|
+
- uses: mapringg/standard/.github/actions/check-pr@vX.Y.Z
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
Replace `vX.Y.Z` with a Standard release that includes the action. Link both skills from Standard's main branch in the
|
|
43
|
+
repository's `AGENTS.md`. Run the project's own checks in the same job.
|
|
44
|
+
|
|
45
|
+
## Updates
|
|
46
|
+
|
|
47
|
+
Each merge to Standard's main publishes a release to npm. The creator adds a `mapringg-standard` group to
|
|
48
|
+
`.github/dependabot.yml`, so Dependabot opens one PR per release for the package and the check-pr action.
|
|
49
|
+
The `standard-updates.yml` workflow merges that PR after the repo's check workflow passes on it. A failing
|
|
50
|
+
check leaves the PR open for review.
|
|
51
|
+
|
|
52
|
+
## Install
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@mapringg/standard": "<version>",
|
|
58
|
+
"knip": "<version>",
|
|
59
|
+
"oxfmt": "<version>",
|
|
60
|
+
"oxlint": "<version>",
|
|
61
|
+
"tsrs": "<version>"
|
|
62
|
+
},
|
|
63
|
+
"scripts": {
|
|
64
|
+
"prepare": "git config core.hooksPath .githooks",
|
|
65
|
+
"lint": "oxlint",
|
|
66
|
+
"format": "oxfmt -c node_modules/@mapringg/standard/oxfmt.json",
|
|
67
|
+
"format:check": "oxfmt -c node_modules/@mapringg/standard/oxfmt.json --check",
|
|
68
|
+
"knip": "knip -c node_modules/@mapringg/standard/knip.json && knip -c node_modules/@mapringg/standard/knip.json --production"
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
Use the latest release. Pin `knip`, `oxfmt`, `oxlint` and `tsrs` to the exact versions in that tag's `peerDependencies`.
|
|
74
|
+
|
|
75
|
+
## Wiring
|
|
76
|
+
|
|
77
|
+
Extend Standard in the root `.oxlintrc.json`.
|
|
78
|
+
|
|
79
|
+
```json
|
|
80
|
+
{ "extends": ["./node_modules/@mapringg/standard/oxlint.json"] }
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Extend the shared `tsconfig.json` in each app and package.
|
|
84
|
+
|
|
85
|
+
```json
|
|
86
|
+
{
|
|
87
|
+
"extends": "@mapringg/standard/tsconfig.json",
|
|
88
|
+
"include": ["src", "*.config.ts"]
|
|
89
|
+
}
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
A React app types CSS variables in a `.d.ts` file with ``declare module "react" { interface CSSProperties { [key: `--${string}`]: string | number } }``.
|
|
93
|
+
|
|
94
|
+
Each app's and package's `package.json` maps `#/` to its own `src`. Import with the file's extension, as `#/lib/env.ts`.
|
|
95
|
+
|
|
96
|
+
```json
|
|
97
|
+
{ "imports": { "#/*": "./src/*" } }
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
A package that compiles to `dist` also maps the compiled files, and its build tsconfig sets `"noEmit": false` and `"rewriteRelativeImportExtensions": true`. Run it with `node --conditions=compiled`.
|
|
101
|
+
|
|
102
|
+
```json
|
|
103
|
+
{
|
|
104
|
+
"imports": {
|
|
105
|
+
"#/*.ts": { "types": "./src/*.ts", "compiled": "./dist/*.js", "default": "./src/*.ts" },
|
|
106
|
+
"#/*": "./src/*"
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Use the same root commands in `.githooks/pre-push`. This example compares affected packages with `develop` when it
|
|
112
|
+
exists and `main` otherwise.
|
|
113
|
+
|
|
114
|
+
```sh
|
|
115
|
+
#!/bin/sh
|
|
116
|
+
set -e
|
|
117
|
+
base=origin/develop
|
|
118
|
+
git rev-parse --verify --quiet "$base" >/dev/null || base=origin/main
|
|
119
|
+
pnpm format:check
|
|
120
|
+
pnpm lint
|
|
121
|
+
pnpm knip
|
|
122
|
+
pnpm --filter "...[$base]" --if-present test
|
|
123
|
+
```
|
|
124
|
+
|
|
125
|
+
## Design system
|
|
126
|
+
|
|
127
|
+
Standard runs [@shadcn/lint](https://github.com/shadcn-ui/lint) on every UI app. Import components from
|
|
128
|
+
`#/components/ui`, keep the theme in the app's one global CSS file, and use only its tokens.
|
|
129
|
+
Keep the rules as shipped: no `settings.shadcn`, rule options, or overrides for `shadcn/*` rules.
|
|
130
|
+
|
|
131
|
+
Fix a `shadcn/no-restyle` finding in this order:
|
|
132
|
+
|
|
133
|
+
1. Use the component's existing variant or size that gives the look.
|
|
134
|
+
2. Move spacing around the component to margin on it or `gap` on its parent.
|
|
135
|
+
3. Add a variant or size in the component file and use it.
|
|
136
|
+
|
|
137
|
+
Fix other findings with the replacement the message names, or the nearest theme token. Add a token to the
|
|
138
|
+
theme only when the design needs a value the scale lacks.
|
|
139
|
+
|
|
140
|
+
## Repository documentation
|
|
141
|
+
|
|
142
|
+
Use one root README with the project title, a one-sentence overview, and a Quick start section.
|
|
143
|
+
Each prose paragraph and bullet may have up to 100 visible characters.
|
|
144
|
+
|
|
145
|
+
Use scoped AGENTS.md files starting with the title AGENTS.md.
|
|
146
|
+
Write flat, single-line bullets under Rules and optional Sources.
|
|
147
|
+
Put a verification command under Rules with its trigger.
|
|
148
|
+
In a repo with Vitest, add this bullet under the root Rules. Lint requires it.
|
|
149
|
+
|
|
150
|
+
```markdown
|
|
151
|
+
- Run `pnpm --filter <app> exec vitest run --since-last-run` after each change and `pnpm test` at the end.
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
Link to a skill under Sources when an agent needs a longer procedure.
|
|
155
|
+
Keep shared skill links at the root. Local Sources apply only to their directory.
|
|
156
|
+
|
|
157
|
+
Use no handwritten explanatory comments. Name things clearly and put lasting constraints in scoped Rules.
|
|
158
|
+
Keep machine-read directives and generated markers. Extend comment checks by format.
|
|
159
|
+
|
|
160
|
+
Run `pnpm exec check-pr --docs` from the repo root to check the layout before updating CI.
|
|
161
|
+
The shared PR action and the Standard PR lint rule use the same checks.
|
|
162
|
+
|
|
163
|
+
## Agent skills
|
|
164
|
+
|
|
165
|
+
Keep skill links and their triggers under `## Sources` in the root `AGENTS.md` so they are available in a fresh checkout.
|
|
166
|
+
|
|
167
|
+
```markdown
|
|
168
|
+
## Sources
|
|
169
|
+
|
|
170
|
+
- Use [PR writing](node_modules/@mapringg/standard/.claude/skills/pr/SKILL.md) when writing a pull request.
|
|
171
|
+
- Follow [Capture](node_modules/@mapringg/standard/.claude/skills/capture/SKILL.md) when preparing pull request evidence.
|
|
172
|
+
```
|
|
173
|
+
|
|
174
|
+
Lint requires the installed links and rejects local copies of the two skills. For repositories without the package installed,
|
|
175
|
+
link to both skills on Standard's main branch.
|
|
176
|
+
If the project has a verification skill, link it in the same section with one trigger for user-visible changes.
|
|
177
|
+
Pin Agent Browser in projects that capture web evidence. Install its browser, and install FFmpeg for recordings.
|
|
178
|
+
|
|
179
|
+
## CI
|
|
180
|
+
|
|
181
|
+
Run `pnpm lint` from the repository root. It includes type checking. Run `pnpm format:check`, `pnpm knip` and the
|
|
182
|
+
repository's tests separately.
|
|
183
|
+
|
|
184
|
+
Run lint on `pull_request` events with the settings below. The `edited` event reruns the check after a title or body
|
|
185
|
+
edit.
|
|
186
|
+
|
|
187
|
+
```yaml
|
|
188
|
+
on:
|
|
189
|
+
pull_request:
|
|
190
|
+
types: [opened, synchronize, reopened, edited]
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
Make the CI check required on the PR target branch to block merging when a check fails.
|
|
194
|
+
|
|
195
|
+
The [PR check](../../../src/plugin/pr-check.mjs) checks the title, template sections, and populated Before and After evidence.
|
|
196
|
+
A reviewer checks whether the evidence demonstrates the change.
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: capture
|
|
3
|
+
description: Capture and attach before and after evidence when preparing a pull request.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Capture PR evidence
|
|
7
|
+
|
|
8
|
+
Choose proof based on what changed.
|
|
9
|
+
|
|
10
|
+
- Use before and after PNG screenshots when still images show the visible difference.
|
|
11
|
+
- Use short MP4 recordings when motion, timing, or the sequence of an interaction is the difference.
|
|
12
|
+
- Use test or command output when the change has no visible effect. Skip media.
|
|
13
|
+
|
|
14
|
+
Follow the repo’s verification instructions for how to start the app, load test data, and reach the relevant state.
|
|
15
|
+
Use test accounts and fixtures. Compare the same scenario on the base and head with the same viewport and theme.
|
|
16
|
+
Use an isolated checkout for the base when it needs a separate build or database.
|
|
17
|
+
|
|
18
|
+
For web evidence, use the project’s pinned Agent Browser and run `agent-browser skills get core` through the same
|
|
19
|
+
launcher to load its command guide. For example, a mise project uses `mise exec -- agent-browser skills get core`.
|
|
20
|
+
Use a dedicated browser session per worktree. Wait for the expected state before taking a screenshot. Start recording
|
|
21
|
+
before the action and stop afterward to save the clip. Recording requires FFmpeg. Close the session when finished.
|
|
22
|
+
|
|
23
|
+
Use the platform’s capture tool for a native UI. If capture is blocked, state the specific blocker in Evidence and
|
|
24
|
+
include any execution results that show the behavior.
|
|
25
|
+
|
|
26
|
+
Put proof under **Before** and **After** in the PR. Use GitHub attachments where available. If the repo uses Standard’s
|
|
27
|
+
uploader, run `pnpm exec upload-evidence` with the finished files and put its Markdown in the PR.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Matt Pocock
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: pr
|
|
3
|
+
description: "Use when writing a PR body."
|
|
4
|
+
metadata:
|
|
5
|
+
credits:
|
|
6
|
+
skill: show-me
|
|
7
|
+
author: Dex Horthy
|
|
8
|
+
organisation: Humanlayer
|
|
9
|
+
url: "https://github.com/humanlayer/skills/blob/main/plugins/show-me/skills/show-me/SKILL.md"
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
Use this template for writing the PR body:
|
|
13
|
+
|
|
14
|
+
```markdown
|
|
15
|
+
## Summary
|
|
16
|
+
|
|
17
|
+
<diagram, diff-sketch, or tree>
|
|
18
|
+
|
|
19
|
+
## Evidence
|
|
20
|
+
|
|
21
|
+
- **Before:** <screenshot/output/failing test run>
|
|
22
|
+
**After:** <screenshot/output/passing test run>
|
|
23
|
+
|
|
24
|
+
## Merge Danger
|
|
25
|
+
|
|
26
|
+
**Door:** <one-way or two-way>
|
|
27
|
+
|
|
28
|
+
<optional: description>
|
|
29
|
+
|
|
30
|
+
**Blast Radius:** <one-word description>
|
|
31
|
+
|
|
32
|
+
<optional: potential ramifications of merge>
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
## Sections
|
|
36
|
+
|
|
37
|
+
Skip all preambles and keep prose brief. Use the user's domain language from `GLOSSARY.md`.
|
|
38
|
+
|
|
39
|
+
### Summary
|
|
40
|
+
|
|
41
|
+
Pick the smallest view that makes the key point clear.
|
|
42
|
+
|
|
43
|
+
- Show logic or an algorithm as pseudocode:
|
|
44
|
+
|
|
45
|
+
```text
|
|
46
|
+
on(save)
|
|
47
|
+
if content is unchanged
|
|
48
|
+
return cached result
|
|
49
|
+
write new content
|
|
50
|
+
return fresh result
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
- Show runtime control flow as a call tree:
|
|
54
|
+
|
|
55
|
+
```text
|
|
56
|
+
submitForm
|
|
57
|
+
createSession
|
|
58
|
+
persistPrompt
|
|
59
|
+
launchAgent
|
|
60
|
+
navigateToSession
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
- Show UI structure as a component tree, including state and module boundaries that matter:
|
|
64
|
+
|
|
65
|
+
```text
|
|
66
|
+
<SessionPage> (apps/example/src/routes/session.tsx)
|
|
67
|
+
useSessionEvents()
|
|
68
|
+
<SessionToolbar>
|
|
69
|
+
<RunSkillButton> (packages/ui)
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
- Show file responsibility or a broad refactor as a shallow file tree:
|
|
73
|
+
|
|
74
|
+
```text
|
|
75
|
+
src/
|
|
76
|
+
├── commands/ # parses user actions
|
|
77
|
+
├── sessions/ # owns session state
|
|
78
|
+
└── transport/ # sends API requests
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
- Show component interaction, control flow, or data flow with Mermaid:
|
|
82
|
+
|
|
83
|
+
```mermaid
|
|
84
|
+
sequenceDiagram
|
|
85
|
+
participant User
|
|
86
|
+
participant UI
|
|
87
|
+
participant Daemon
|
|
88
|
+
User->>UI: choose command
|
|
89
|
+
UI->>Daemon: send expanded prompt
|
|
90
|
+
Daemon-->>UI: stream result
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
- Use `diff` when the point is what changes and the surrounding shape already exists. Match the diff shape to the topic.
|
|
94
|
+
|
|
95
|
+
For a component change:
|
|
96
|
+
|
|
97
|
+
```diff
|
|
98
|
+
<SessionPage>
|
|
99
|
+
useSessionEvents()
|
|
100
|
+
<SessionToolbar>
|
|
101
|
+
+ <RunSkillButton />
|
|
102
|
+
<SessionTimeline>
|
|
103
|
+
+ <SkillResultCard />
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
For a file-layout change:
|
|
107
|
+
|
|
108
|
+
```diff
|
|
109
|
+
src/
|
|
110
|
+
├── commands/
|
|
111
|
+
+│ └── show-me.ts # expands the slash command
|
|
112
|
+
├── sessions/
|
|
113
|
+
-└── transport.ts
|
|
114
|
+
+└── transport/
|
|
115
|
+
+ ├── client.ts
|
|
116
|
+
+ └── stream.ts
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
For a call-tree or call-stack change:
|
|
120
|
+
|
|
121
|
+
```diff
|
|
122
|
+
submitForm
|
|
123
|
+
createSession
|
|
124
|
+
persistPrompt
|
|
125
|
+
+ expandSkillMention
|
|
126
|
+
launchAgent
|
|
127
|
+
- navigateToSession
|
|
128
|
+
+ navigateToSession
|
|
129
|
+
+ subscribeToEvents
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
For a state or control-flow change:
|
|
133
|
+
|
|
134
|
+
```diff
|
|
135
|
+
on(save)
|
|
136
|
+
- write content
|
|
137
|
+
+ if content is unchanged
|
|
138
|
+
+ return cached result
|
|
139
|
+
+ write new content
|
|
140
|
+
+ invalidate cache
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
- Show the whole block when most of it is new, when omitted context would hide ownership or order, or when the user needs a copyable target shape:
|
|
144
|
+
|
|
145
|
+
```ts
|
|
146
|
+
function expandSkill(command: string): string {
|
|
147
|
+
const skillName = command.slice(1);
|
|
148
|
+
return `use the ${skillName} skill`;
|
|
149
|
+
}
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
#### Guidance
|
|
153
|
+
|
|
154
|
+
Place each visual next to the short text it supports. Keep only the calls, files, props, states, and boundaries needed to answer the user's current question or the options to resolve the current discussion point.
|
|
155
|
+
|
|
156
|
+
You may use one of these, you may use several, it is unlikely you will use all of them. Use your judgement and don't overwhelm the user.
|
|
157
|
+
|
|
158
|
+
### Evidence
|
|
159
|
+
|
|
160
|
+
Concrete evidence that the change works. Show a before and after.
|
|
161
|
+
|
|
162
|
+
Screenshots are S-tier - when the environment is set up for it and the change is visual.
|
|
163
|
+
|
|
164
|
+
Execution-based evidence is A-tier. Test results, console output. Show the exact test that now fails and passes, using pseudocode.
|
|
165
|
+
|
|
166
|
+
### Merge Danger
|
|
167
|
+
|
|
168
|
+
Describe whether it's a one-way or two-way door. You can walk back through two-way doors, but not one-way doors. A PR that is cheap to roll back is lower risk. Changes that involve destructive actions or hard-to-reverse decisions are one-way doors.
|
|
169
|
+
|
|
170
|
+
The blast radius is the potential impact or scope of the changes introduced by this PR. Consider all possibilities. Examples are layout shift, breakages for consumers, mobile responsiveness, etc.
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: review-standard
|
|
3
|
+
description: Review a pull request or branch against the parts of the standard that require judgment.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Review against the standard
|
|
7
|
+
|
|
8
|
+
1. Read the installed standard README and the repository and app `AGENTS.md` files that apply to the diff.
|
|
9
|
+
2. Diff against `origin/develop`. Use `origin/main` when the repository has no develop branch.
|
|
10
|
+
3. Review changed lines for simplifications lint and types cannot judge. Look for redundant code, tests, files, dependencies, and agent instructions. Use the [test audit policy](../test-audit/SKILL.md) when deciding whether a test earns its place.
|
|
11
|
+
4. Ask for a concrete removal or simplification. Keep the behavior and coverage the removed code owns.
|
|
12
|
+
5. Report one finding per line in the form `path:line rule: what to remove or simplify`. With no findings, say `No findings.`
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: test-audit
|
|
3
|
+
description: Audit existing tests before a migration or broad refactor. Decide what to keep, rewrite, trim, move, or delete.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Audit tests
|
|
7
|
+
|
|
8
|
+
## Which tests to keep
|
|
9
|
+
|
|
10
|
+
Keep one test owner for each behavior. A useful test fails when the behavior breaks and still passes when the implementation changes. Assert outcomes through the public interface.
|
|
11
|
+
|
|
12
|
+
Keep tests for these contracts:
|
|
13
|
+
|
|
14
|
+
- API routes exercised through Hono `testClient` with the app's real test database.
|
|
15
|
+
- Authorization and permission decisions, including who can and cannot perform an action.
|
|
16
|
+
- External formats the app parses or produces, such as service payloads, webhooks, emails, exports, and migrations.
|
|
17
|
+
- Domain logic with real branches. Use tables of inputs and expected outputs.
|
|
18
|
+
- Regressions for real bugs with a non-obvious cause. Name the bug and assert the behavior that broke.
|
|
19
|
+
- Five to ten critical end-to-end journeys per app in `apps/<app>/e2e`. Keep a browser test when the interaction needs a browser to prove it.
|
|
20
|
+
|
|
21
|
+
Remove snapshots, sleep and polling tests, call-count-only assertions, render-only assertions, duplicates, and tests of framework behavior, trivial constants, or code being removed. Use MSW for HTTP doubles. When a valuable test uses an internal mock or another HTTP double, rewrite it to assert the contract at its boundary.
|
|
22
|
+
|
|
23
|
+
Before a migration, review the existing tests and record what to keep, rewrite, trim, move, or delete. Name the surviving test when removing duplicate coverage. Check that authorization, money, data integrity, and external contracts still have coverage. Apply the removals before lint autofix.
|
|
24
|
+
|
|
25
|
+
Lint checks test mechanics. Review decides whether a test protects a distinct contract.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: upgrade-standard
|
|
3
|
+
description: Upgrade a repository to a newer @mapringg/standard tag, or adopt it for the first time, with a passing baseline commit and one reviewable commit per rule.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Upgrade the standard
|
|
7
|
+
|
|
8
|
+
## Commit a passing baseline
|
|
9
|
+
|
|
10
|
+
1. Run `pnpm lint` on the current version and confirm it passes. Fix or report an existing failure before upgrading.
|
|
11
|
+
2. Point `@mapringg/standard` at the new release tag. Pin `knip`, `oxfmt`, `oxlint` and `tsrs` to the exact versions in that tag's `peerDependencies`. Run `pnpm install`.
|
|
12
|
+
3. Follow the installed [setup guide](../adopt-standard/SKILL.md) and apply any changes it calls for, such as scripts, `tsconfig.json` or `package.json` imports.
|
|
13
|
+
4. Run `pnpm lint`. Set each newly failing rule to `"off"` in `rules` of the root `.oxlintrc.json`. If a standard override turns a rule back on for some files, add an override with the same `files` that turns it off there too.
|
|
14
|
+
5. Run `pnpm lint`, `pnpm knip` and the format check until they pass. Commit the dependency, config and setup changes as one baseline.
|
|
15
|
+
|
|
16
|
+
## Enable one rule per commit
|
|
17
|
+
|
|
18
|
+
1. Remove one rule's temporary `"off"`, fix its findings, and rerun lint. Run the tests and type checks for code whose behavior or types changed. Commit the config and the fixes together.
|
|
19
|
+
2. Fix `shadcn/*` findings in the order the [design system section](../adopt-standard/SKILL.md#design-system) gives, never with a local exception.
|
|
20
|
+
3. A rule that reports correct code is a gap in the standard, not a local exception. Leave its `"off"` in place and open an issue or pull request on mapringg/standard with the code it reports. For an owner ban, ask for a row in the owners table.
|
|
21
|
+
4. Repeat for each temporary `"off"`. Remove a temporary `"off"` once a release fixes the gap.
|
|
22
|
+
|
|
23
|
+
## Review and squash
|
|
24
|
+
|
|
25
|
+
Open one pull request with the baseline and every rule commit. List each rule that stays off with a link to its issue or pull request on mapringg/standard, and include the lint and test results. Keep the commits through review and squash them when merging.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 mapringg
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Standard
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Provides shared review checks, agent skills and TypeScript tooling.
|
|
4
|
+
|
|
5
|
+
## Quick start
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
pnpm create mapringg-repo
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
See [Adopt Standard](.claude/skills/adopt-standard/SKILL.md) for installation and CI wiring.
|
package/bin/check-pr.mjs
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import { checkEvent } from "../src/plugin/pr-check.mjs";
|
|
4
|
+
import { repositoryDocProblems } from "../src/plugin/repository-docs.mjs";
|
|
5
|
+
|
|
6
|
+
if (process.argv.includes("--docs") || process.env.GITHUB_EVENT_NAME === "pull_request") {
|
|
7
|
+
const messages = repositoryDocProblems(process.cwd());
|
|
8
|
+
if (!process.argv.includes("--docs")) messages.push(...checkEvent(process.env.GITHUB_EVENT_PATH));
|
|
9
|
+
for (const message of messages) console.error(message);
|
|
10
|
+
if (messages.length > 0) process.exitCode = 1;
|
|
11
|
+
}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { execFileSync } from "node:child_process";
|
|
3
|
+
import { createHash } from "node:crypto";
|
|
4
|
+
import { mkdirSync, mkdtempSync, readFileSync, rmSync, statSync } from "node:fs";
|
|
5
|
+
import { homedir } from "node:os";
|
|
6
|
+
import nodePath from "node:path";
|
|
7
|
+
|
|
8
|
+
const BRANCH = process.env.EVIDENCE_BRANCH ?? "pr-evidence-assets";
|
|
9
|
+
if (!BRANCH.startsWith("pr-evidence-assets")) {
|
|
10
|
+
console.error(`EVIDENCE_BRANCH must start with pr-evidence-assets, got ${BRANCH}`);
|
|
11
|
+
process.exit(2);
|
|
12
|
+
}
|
|
13
|
+
const REMOTE = "origin";
|
|
14
|
+
const GIF_LIGHT_BYTES = 5_000_000;
|
|
15
|
+
|
|
16
|
+
const args = process.argv.slice(2);
|
|
17
|
+
const dryRun = args.includes("--dry-run");
|
|
18
|
+
const prFlag = args.indexOf("--pr");
|
|
19
|
+
const prArg = prFlag === -1 ? undefined : args[prFlag + 1];
|
|
20
|
+
const files = args.filter((arg, i) => !arg.startsWith("--") && (prFlag === -1 || i !== prFlag + 1));
|
|
21
|
+
|
|
22
|
+
if (files.length === 0) {
|
|
23
|
+
console.error("usage: upload-evidence [--dry-run] [--pr <number>] <file>...");
|
|
24
|
+
process.exit(2);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
for (const file of files) {
|
|
28
|
+
const bytes = statSync(file).size;
|
|
29
|
+
if (nodePath.extname(file).toLowerCase() === ".gif" && bytes > GIF_LIGHT_BYTES) {
|
|
30
|
+
console.error(`${file} is ${(bytes / 1e6).toFixed(1)} MB; shorten the clip so the PR loads quickly.`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
const git = (gitArgs, env = {}) =>
|
|
35
|
+
execFileSync("git", gitArgs, {
|
|
36
|
+
encoding: "utf8",
|
|
37
|
+
env: { ...process.env, ...env },
|
|
38
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
39
|
+
}).trim();
|
|
40
|
+
|
|
41
|
+
const repo = execFileSync("gh", ["repo", "view", "--json", "nameWithOwner", "--jq", ".nameWithOwner"], {
|
|
42
|
+
encoding: "utf8",
|
|
43
|
+
}).trim();
|
|
44
|
+
const pr = JSON.parse(
|
|
45
|
+
execFileSync("gh", ["pr", "view", ...(prArg ? [prArg] : []), "--json", "number,headRefOid"], {
|
|
46
|
+
encoding: "utf8",
|
|
47
|
+
}),
|
|
48
|
+
);
|
|
49
|
+
const prNumber = pr.number;
|
|
50
|
+
const head = pr.headRefOid;
|
|
51
|
+
const prefix = `pr/${prNumber}/${head}`;
|
|
52
|
+
const repoName = nodePath.basename(nodePath.dirname(git(["rev-parse", "--path-format=absolute", "--git-common-dir"])));
|
|
53
|
+
const cache = nodePath.join(
|
|
54
|
+
process.env.XDG_CACHE_HOME || nodePath.join(homedir(), ".cache"),
|
|
55
|
+
"verification",
|
|
56
|
+
repoName,
|
|
57
|
+
"evidence",
|
|
58
|
+
);
|
|
59
|
+
mkdirSync(cache, { recursive: true });
|
|
60
|
+
|
|
61
|
+
const blobs = files.map((file) => {
|
|
62
|
+
const ext = nodePath.extname(file);
|
|
63
|
+
const md5 = createHash("md5").update(readFileSync(file)).digest("hex");
|
|
64
|
+
return {
|
|
65
|
+
file,
|
|
66
|
+
path: `${prefix}/${nodePath.basename(file, ext)}-${md5}${ext}`,
|
|
67
|
+
sha: git(["hash-object", "-w", file]),
|
|
68
|
+
};
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
const remoteTip = () => {
|
|
72
|
+
if (!git(["ls-remote", "--heads", REMOTE, `refs/heads/${BRANCH}`])) return null;
|
|
73
|
+
git(["fetch", "--quiet", REMOTE, `+refs/heads/${BRANCH}:refs/remotes/${REMOTE}/${BRANCH}`]);
|
|
74
|
+
return git(["rev-parse", `refs/remotes/${REMOTE}/${BRANCH}`]);
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
const commitTree = (parent, env) => {
|
|
78
|
+
if (parent) git(["read-tree", parent], env);
|
|
79
|
+
for (const { path, sha } of blobs) {
|
|
80
|
+
git(["update-index", "--add", "--cacheinfo", `100644,${sha},${path}`], env);
|
|
81
|
+
}
|
|
82
|
+
const tree = git(["write-tree"], env);
|
|
83
|
+
if (parent && tree === git(["rev-parse", `${parent}^{tree}`])) return parent;
|
|
84
|
+
const parentArgs = parent ? ["-p", parent] : [];
|
|
85
|
+
return git(["commit-tree", tree, ...parentArgs, "-m", `Evidence: #${prNumber} at ${head}`]);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const commitOnto = (parent) => {
|
|
89
|
+
const scratch = mkdtempSync(nodePath.join(cache, "upload-"));
|
|
90
|
+
try {
|
|
91
|
+
return commitTree(parent, { GIT_INDEX_FILE: nodePath.join(scratch, "index") });
|
|
92
|
+
} finally {
|
|
93
|
+
rmSync(scratch, { recursive: true, force: true });
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
function upload(attempt) {
|
|
98
|
+
const commit = commitOnto(remoteTip());
|
|
99
|
+
if (dryRun) return commit;
|
|
100
|
+
try {
|
|
101
|
+
git(["push", "--quiet", "--no-verify", REMOTE, `${commit}:refs/heads/${BRANCH}`]);
|
|
102
|
+
return commit;
|
|
103
|
+
} catch (error) {
|
|
104
|
+
if (attempt >= 3) throw error;
|
|
105
|
+
return upload(attempt + 1);
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const commit = upload(1);
|
|
110
|
+
|
|
111
|
+
for (const { file, path } of blobs) {
|
|
112
|
+
const alt = nodePath.basename(file, nodePath.extname(file));
|
|
113
|
+
const url = `https://github.com/${repo}/raw/${commit}/${path
|
|
114
|
+
.split("/")
|
|
115
|
+
.map((segment) => encodeURIComponent(segment))
|
|
116
|
+
.join("/")}`;
|
|
117
|
+
const ext = nodePath.extname(file).toLowerCase();
|
|
118
|
+
console.log([".mp4", ".webm"].includes(ext) ? `[${alt}${ext}](${url})` : ``);
|
|
119
|
+
}
|
|
120
|
+
if (dryRun) console.error(`dry run: built ${commit}, nothing pushed`);
|