@mapringg/standard 1.15.3 → 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.
@@ -15,7 +15,7 @@ a signed-in GitHub CLI account with admin access. Select **app** for the monorep
15
15
  **plain** for the shared PR check alone.
16
16
 
17
17
  ```sh
18
- pnpm dlx --package=github:mapringg/standard#v1.15.3 create-mapringg-repo
18
+ pnpm create mapringg-repo
19
19
  ```
20
20
 
21
21
  New repos default to private and start with `Initial commit`. The command runs applicable local checks, pushes the
@@ -39,15 +39,22 @@ Run the job on `pull_request` events of type `opened`, `synchronize`, `reopened`
39
39
  - uses: mapringg/standard/.github/actions/check-pr@vX.Y.Z
40
40
  ```
41
41
 
42
- Replace `vX.Y.Z` with a Standard release that includes the action. Link both skills from the same release in the
42
+ Replace `vX.Y.Z` with a Standard release that includes the action. Link both skills from Standard's main branch in the
43
43
  repository's `AGENTS.md`. Run the project's own checks in the same job.
44
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
+
45
52
  ## Install
46
53
 
47
54
  ```json
48
55
  {
49
56
  "devDependencies": {
50
- "@mapringg/standard": "github:mapringg/standard#<tag>",
57
+ "@mapringg/standard": "<version>",
51
58
  "knip": "<version>",
52
59
  "oxfmt": "<version>",
53
60
  "oxlint": "<version>",
@@ -63,7 +70,7 @@ repository's `AGENTS.md`. Run the project's own checks in the same job.
63
70
  }
64
71
  ```
65
72
 
66
- Use the latest release tag. Pin `knip`, `oxfmt`, `oxlint` and `tsrs` to the exact versions in that tag's `peerDependencies`.
73
+ Use the latest release. Pin `knip`, `oxfmt`, `oxlint` and `tsrs` to the exact versions in that tag's `peerDependencies`.
67
74
 
68
75
  ## Wiring
69
76
 
@@ -165,7 +172,7 @@ Keep skill links and their triggers under `## Sources` in the root `AGENTS.md` s
165
172
  ```
166
173
 
167
174
  Lint requires the installed links and rejects local copies of the two skills. For repositories without the package installed,
168
- link to both skills at the same pinned Standard release.
175
+ link to both skills on Standard's main branch.
169
176
  If the project has a verification skill, link it in the same section with one trigger for user-visible changes.
170
177
  Pin Agent Browser in projects that capture web evidence. Install its browser, and install FFmpeg for recordings.
171
178
 
package/README.md CHANGED
@@ -5,7 +5,7 @@ Provides shared review checks, agent skills and TypeScript tooling.
5
5
  ## Quick start
6
6
 
7
7
  ```sh
8
- pnpm dlx --package=github:mapringg/standard#v1.15.3 create-mapringg-repo
8
+ pnpm create mapringg-repo
9
9
  ```
10
10
 
11
11
  See [Adopt Standard](.claude/skills/adopt-standard/SKILL.md) for installation and CI wiring.
package/package.json CHANGED
@@ -1,9 +1,12 @@
1
1
  {
2
2
  "name": "@mapringg/standard",
3
- "version": "1.15.3",
3
+ "version": "1.15.4",
4
4
  "description": "Shared pull request checks, agent skills, and TypeScript tooling.",
5
5
  "license": "MIT",
6
- "repository": "github:mapringg/standard",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/mapringg/standard.git"
9
+ },
7
10
  "bin": {
8
11
  "check-pr": "./bin/check-pr.mjs",
9
12
  "create-mapringg-repo": "./packages/create-mapringg-repo/cli.mjs",
@@ -236,6 +236,7 @@ async function adopt(root, kind, scratch) {
236
236
  "pnpm-lock.yaml",
237
237
  "package-lock.json",
238
238
  ".github/workflows",
239
+ ".github/dependabot.yml",
239
240
  ]) {
240
241
  if (existsSync(join(work, file))) git(work, ["add", "--", file]);
241
242
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-mapringg-repo",
3
- "version": "0.2.0",
3
+ "version": "1.15.4",
4
4
  "description": "Create or adopt a GitHub repository with the Mapringg PR workflow.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -5,7 +5,9 @@ import { isMap, isSeq, parseDocument } from "yaml";
5
5
 
6
6
  import { releaseSha, releaseTag } from "./release.mjs";
7
7
 
8
- const STANDARD = "github:mapringg/standard#";
8
+ const PACKAGE = "@mapringg/standard";
9
+ const GROUP = "mapringg-standard";
10
+ const AUTOMERGE = join(".github", "workflows", "standard-updates.yml");
9
11
  const ACTION = "mapringg/standard/.github/actions/check-pr@";
10
12
  const CHECKOUT = "actions/checkout@fbc6f3992d24b796d5a048ff273f7fcc4a7b6c09";
11
13
  const EVENTS = ["opened", "synchronize", "reopened", "edited"];
@@ -26,7 +28,7 @@ function agents(root, installed) {
26
28
  const path = join(root, "AGENTS.md");
27
29
  const skillsRoot = installed
28
30
  ? "node_modules/@mapringg/standard/.claude/skills"
29
- : `https://github.com/mapringg/standard/blob/${releaseTag()}/.claude/skills`;
31
+ : "https://github.com/mapringg/standard/blob/main/.claude/skills";
30
32
  const original = read(path) ?? "# AGENTS.md\n";
31
33
  const shared = original.split("\n").filter((line) => SKILLS.test(line));
32
34
  if (
@@ -63,7 +65,7 @@ function workflowFiles(root) {
63
65
  const path = join(dir, name);
64
66
  const doc = parseDocument(read(path));
65
67
  if (doc.errors.length > 0) throw new Error(`Fix invalid workflow YAML in ${name} before adopting Standard.`);
66
- return { path, doc, data: doc.toJS() ?? {} };
68
+ return { path, name, doc, data: doc.toJS() ?? {} };
67
69
  });
68
70
  }
69
71
 
@@ -116,7 +118,7 @@ function configureCheck(root, installed) {
116
118
  doc.setIn(["jobs", id, "steps", actionIndex, "uses"], `${ACTION}${releaseSha()}`);
117
119
  }
118
120
  if (doc.toString() !== before) write(path, doc.toString());
119
- return job.name ?? id;
121
+ return { name: job.name ?? id, workflow: check.data.name ?? `.github/workflows/${check.name}` };
120
122
  }
121
123
  const name = jobs.some(({ id, job }) => (job.name ?? id).toLowerCase() === "check") ? "Standard PR" : "Check";
122
124
  const path = join(root, ".github", "workflows", "standard-pr.yml");
@@ -125,7 +127,52 @@ function configureCheck(root, installed) {
125
127
  path,
126
128
  `name: Standard\n\non:\n pull_request:\n types: [${EVENTS.join(", ")}]\n push:\n branches: [main, develop]\n\npermissions:\n contents: read\n\njobs:\n check:\n name: ${name}\n runs-on: ubuntu-latest\n steps:\n - uses: ${CHECKOUT}\n with:\n persist-credentials: false\n - run: test -s AGENTS.md\n - uses: ${ACTION}${releaseSha()} # ${releaseTag()}\n`,
127
129
  );
128
- return name;
130
+ return { name, workflow: "Standard" };
131
+ }
132
+
133
+ function updateEntry(ecosystem, pattern) {
134
+ return {
135
+ "package-ecosystem": ecosystem,
136
+ directory: "/",
137
+ schedule: { interval: "daily" },
138
+ allow: [{ "dependency-name": pattern }],
139
+ groups: { [GROUP]: { patterns: [pattern] } },
140
+ };
141
+ }
142
+
143
+ function dependabot(root, hasPackage) {
144
+ const path = join(root, ".github", "dependabot.yml");
145
+ const doc = parseDocument(read(path) ?? "version: 2\nupdates: []\n");
146
+ if (doc.errors.length > 0) throw new Error("Fix invalid YAML in dependabot.yml before adopting Standard.");
147
+ const before = doc.toString({ flowCollectionPadding: false });
148
+ const wanted = [["github-actions", "mapringg/standard*"], ...(hasPackage ? [["npm", PACKAGE]] : [])];
149
+ const updates = doc.get("updates", true);
150
+ for (const [ecosystem, pattern] of wanted) {
151
+ const index = (updates?.items ?? []).findIndex((item) => {
152
+ const entry = item.toJSON();
153
+ const directories = entry.directories ?? [entry.directory];
154
+ return entry["package-ecosystem"] === ecosystem && directories.includes("/");
155
+ });
156
+ if (index === -1) {
157
+ doc.addIn(["updates"], doc.createNode(updateEntry(ecosystem, pattern)));
158
+ continue;
159
+ }
160
+ const groups = doc.getIn(["updates", index, "groups"], true);
161
+ if (isMap(groups) && groups.has(GROUP)) continue;
162
+ const rest = isMap(groups) ? groups.items : [];
163
+ const group = doc.createNode({ [GROUP]: { patterns: [pattern] } });
164
+ group.items.push(...rest);
165
+ doc.setIn(["updates", index, "groups"], group);
166
+ }
167
+ const options = { flowCollectionPadding: false };
168
+ if (doc.toString(options) !== before) write(path, doc.toString(options));
169
+ }
170
+
171
+ function automerge(root, workflow) {
172
+ write(
173
+ join(root, AUTOMERGE),
174
+ `name: Standard updates\n\non:\n workflow_run:\n workflows: [${JSON.stringify(workflow)}]\n types: [completed]\n\npermissions:\n contents: write\n pull-requests: write\n\njobs:\n merge:\n if: >-\n github.event.workflow_run.conclusion == 'success' &&\n github.event.workflow_run.event == 'pull_request' &&\n github.event.workflow_run.actor.login == 'dependabot[bot]' &&\n contains(github.event.workflow_run.head_branch, '${GROUP}')\n runs-on: ubuntu-latest\n steps:\n - env:\n GH_TOKEN: \${{ github.token }}\n BRANCH: \${{ github.event.workflow_run.head_branch }}\n SHA: \${{ github.event.workflow_run.head_sha }}\n run: gh pr merge "$BRANCH" --repo "$GITHUB_REPOSITORY" --squash --match-head-commit "$SHA"\n`,
175
+ );
129
176
  }
130
177
 
131
178
  function pinBrowser(root) {
@@ -150,11 +197,12 @@ export function configure(root, name, { kind = "plain", initial = false } = {})
150
197
  const original = read(path);
151
198
  const manifest = original ? JSON.parse(original) : {};
152
199
  const current = manifest.devDependencies?.["@mapringg/standard"] ?? manifest.dependencies?.["@mapringg/standard"];
153
- const installed = typeof current === "string" && current.startsWith(STANDARD);
154
- const updateLock = installed && current !== `${STANDARD}${releaseTag()}`;
200
+ const installed = typeof current === "string";
201
+ const wanted = releaseTag().slice(1);
202
+ const updateLock = installed && current !== wanted;
155
203
  if (updateLock || isNewApp) {
156
204
  let next = original ?? "{}\n";
157
- if (updateLock) next = next.replaceAll(`"${current}"`, `"${STANDARD}${releaseTag()}"`);
205
+ if (updateLock) next = next.replaceAll(`"${current}"`, `"${wanted}"`);
158
206
  if (isNewApp) next = next.replace(/"name":\s*"monorepo"/, `"name": ${JSON.stringify(name.toLowerCase())}`);
159
207
  write(path, next);
160
208
  }
@@ -169,5 +217,8 @@ export function configure(root, name, { kind = "plain", initial = false } = {})
169
217
  }
170
218
  if (kind === "app") pinBrowser(root);
171
219
  agents(root, installed);
172
- return { check: configureCheck(root, installed), updateLock };
220
+ const check = configureCheck(root, installed);
221
+ dependabot(root, Boolean(original));
222
+ automerge(root, check.workflow);
223
+ return { check: check.name, updateLock };
173
224
  }