@grimoire-rs/indexer 0.2.2 → 0.3.1

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.
Files changed (82) hide show
  1. package/README.md +59 -18
  2. package/dist/ci.d.ts +149 -0
  3. package/dist/ci.d.ts.map +1 -0
  4. package/dist/ci.js +338 -0
  5. package/dist/ci.js.map +1 -0
  6. package/dist/cli/build.d.ts.map +1 -1
  7. package/dist/cli/build.js +3 -9
  8. package/dist/cli/build.js.map +1 -1
  9. package/dist/cli/ci.d.ts +6 -0
  10. package/dist/cli/ci.d.ts.map +1 -0
  11. package/dist/cli/ci.js +43 -0
  12. package/dist/cli/ci.js.map +1 -0
  13. package/dist/cli/dev.d.ts +7 -0
  14. package/dist/cli/dev.d.ts.map +1 -0
  15. package/dist/cli/dev.js +57 -0
  16. package/dist/cli/dev.js.map +1 -0
  17. package/dist/cli/init.d.ts +18 -2
  18. package/dist/cli/init.d.ts.map +1 -1
  19. package/dist/cli/init.js +584 -100
  20. package/dist/cli/init.js.map +1 -1
  21. package/dist/cli/main.d.ts.map +1 -1
  22. package/dist/cli/main.js +71 -10
  23. package/dist/cli/main.js.map +1 -1
  24. package/dist/cli/out_dir.d.ts +11 -0
  25. package/dist/cli/out_dir.d.ts.map +1 -0
  26. package/dist/cli/out_dir.js +30 -0
  27. package/dist/cli/out_dir.js.map +1 -0
  28. package/dist/cli/validate.d.ts +1 -0
  29. package/dist/cli/validate.d.ts.map +1 -1
  30. package/dist/cli/validate.js +47 -1
  31. package/dist/cli/validate.js.map +1 -1
  32. package/dist/renderer/astro/components/BrandMark.js +0 -1
  33. package/dist/renderer/astro/components/Catalog.js +0 -1
  34. package/dist/renderer/astro/lib/base.js +0 -1
  35. package/dist/renderer/astro/lib/catalog.js +0 -1
  36. package/dist/renderer/astro/lib/code.js +0 -1
  37. package/dist/renderer/astro/lib/data.js +0 -1
  38. package/dist/renderer/index.d.ts.map +1 -1
  39. package/dist/renderer/index.js +16 -0
  40. package/dist/renderer/index.js.map +1 -1
  41. package/dist/templates.d.ts +12 -0
  42. package/dist/templates.d.ts.map +1 -0
  43. package/dist/templates.js +40 -0
  44. package/dist/templates.js.map +1 -0
  45. package/dist/validate/adapters/files.d.ts.map +1 -1
  46. package/dist/validate/adapters/files.js +13 -3
  47. package/dist/validate/adapters/files.js.map +1 -1
  48. package/dist/validate/index.js +17 -2
  49. package/dist/validate/index.js.map +1 -1
  50. package/package.json +2 -2
  51. package/templates/README.md +115 -19
  52. package/templates/ci/github-automerge.yml +36 -0
  53. package/templates/ci/github-enrich.yml +27 -0
  54. package/templates/ci/github-pages.yml +64 -0
  55. package/templates/ci/github-publish.yml +89 -0
  56. package/templates/ci/github-validate.yml +157 -0
  57. package/templates/ci/github-verify-ci.yml +47 -0
  58. package/templates/ci/gitlab-ci.yml +149 -0
  59. package/templates/ci/gitlab-enrich.sh +26 -0
  60. package/templates/ci/gitlab-publish.yml +50 -0
  61. package/templates/ci/gitlab-verify.yml +16 -0
  62. package/templates/ci/header.txt +19 -0
  63. package/templates/gitattributes +4 -0
  64. package/templates/gitignore +7 -2
  65. package/templates/package.json +18 -0
  66. package/templates/publish.toml +2 -2
  67. package/dist/renderer/astro/components/BrandMark.d.ts.map +0 -1
  68. package/dist/renderer/astro/components/BrandMark.js.map +0 -1
  69. package/dist/renderer/astro/components/Catalog.d.ts.map +0 -1
  70. package/dist/renderer/astro/components/Catalog.js.map +0 -1
  71. package/dist/renderer/astro/lib/base.d.ts.map +0 -1
  72. package/dist/renderer/astro/lib/base.js.map +0 -1
  73. package/dist/renderer/astro/lib/catalog.d.ts.map +0 -1
  74. package/dist/renderer/astro/lib/catalog.js.map +0 -1
  75. package/dist/renderer/astro/lib/code.d.ts.map +0 -1
  76. package/dist/renderer/astro/lib/code.js.map +0 -1
  77. package/dist/renderer/astro/lib/data.d.ts.map +0 -1
  78. package/dist/renderer/astro/lib/data.js.map +0 -1
  79. package/templates/github-pages.yml +0 -24
  80. package/templates/github-validate.yml +0 -51
  81. package/templates/gitlab-ci.yml +0 -13
  82. package/templates/reusable/gitlab-index-ci.yml +0 -125
@@ -0,0 +1,40 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright 2026 The Grimoire Authors
3
+ // The scaffold's tiny template engine, shared by `init` and `ci`. Both write
4
+ // files into somebody else's repository from the same `templates/` tree, so
5
+ // they read and substitute through one implementation.
6
+ import fs from "node:fs";
7
+ import path from "node:path";
8
+ import { fileURLToPath } from "node:url";
9
+ import { CliError, EXIT } from "./cli/exit.js";
10
+ /** Scaffold templates ship beside `dist/`, so this resolves identically from `src/` and `dist/`. */
11
+ export const TEMPLATE_DIR = fileURLToPath(new URL("../templates/", import.meta.url));
12
+ /** `{{name}}`, but never GitHub Actions' `${{ ... }}` — hence the `$` lookbehind. */
13
+ const PLACEHOLDER = /(?<!\$)\{\{\s*([A-Za-z_]\w*)\s*\}\}/g;
14
+ export function readTemplate(rel) {
15
+ const file = path.join(TEMPLATE_DIR, rel);
16
+ try {
17
+ return fs.readFileSync(file, "utf8");
18
+ }
19
+ catch {
20
+ throw new CliError(`scaffold template ${rel} is missing from ${TEMPLATE_DIR} — the installed package is incomplete`, EXIT.unavailable);
21
+ }
22
+ }
23
+ /**
24
+ * Substitute `{{key}}` placeholders. Single pass: a value that itself
25
+ * contains a placeholder is left alone, so a composed block (the enrich
26
+ * steps, say) has to be rendered before it is handed in as a value.
27
+ */
28
+ export function render(template, vars, rel) {
29
+ return template.replace(PLACEHOLDER, (match, key) => {
30
+ if (!(key in vars)) {
31
+ throw new CliError(`scaffold template ${rel} references unknown placeholder {{${key}}}`);
32
+ }
33
+ return vars[key];
34
+ });
35
+ }
36
+ /** Read and substitute in one step — the common case. */
37
+ export function fromTemplate(rel, vars) {
38
+ return render(readTemplate(rel), vars, rel);
39
+ }
40
+ //# sourceMappingURL=templates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"templates.js","sourceRoot":"","sources":["../src/templates.ts"],"names":[],"mappings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AU,YAAY,CAAC,GAAW,EAAE,IAA4B;IACpE,OAAO,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,EAAE,IAAI,EAAE,GAAG,CAAC,CAAC;AAC9C,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/validate/adapters/files.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,QAAQ,GAChB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAMtC;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CAgCnB"}
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/validate/adapters/files.ts"],"names":[],"mappings":"AAcA,MAAM,MAAM,QAAQ,GAChB;IAAE,IAAI,EAAE,SAAS,CAAA;CAAE,GACnB;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC9B;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAMtC;;;;;GAKG;AACH,wBAAsB,aAAa,CACjC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,QAAQ,CAAC,CA0CnB"}
@@ -29,9 +29,19 @@ export async function readIndexFile(root, relative) {
29
29
  if (!contained(base, target)) {
30
30
  return { kind: "error", reason: "path escapes the index root" };
31
31
  }
32
- const stat = await lstat(target).catch(() => null);
33
- if (stat === null)
34
- return { kind: "missing" };
32
+ // Only a genuinely absent path is "missing". Every other errno used to
33
+ // collapse into it, and "missing" now means "an owner deleted this" — so an
34
+ // EACCES or EIO on a file that also exists in the committed tree, which is
35
+ // what an ordinary *modification* looks like, would be authorized as a
36
+ // deletion with its ref, registry host and owner id never read. Neither
37
+ // template can reach that state, so this closes a fail-open on fault rather
38
+ // than a live exploit.
39
+ const stat = await lstat(target).catch((err) => err);
40
+ if (stat instanceof Error) {
41
+ if (stat.code === "ENOENT" || stat.code === "ENOTDIR")
42
+ return { kind: "missing" };
43
+ return { kind: "error", reason: `cannot read: ${stat.code ?? "unknown error"}` };
44
+ }
35
45
  if (stat.isSymbolicLink()) {
36
46
  return { kind: "error", reason: "symlinks are not accepted" };
37
47
  }
@@ -1 +1 @@
1
- {"version":3,"file":"files.js","sourceRoot":"","sources":["../../../src/validate/adapters/files.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,sCAAsC;AAEtC;;;;GAIG;AAEH,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,MAAM,qBAAqB,CAAC;AAOzD,SAAS,SAAS,CAAC,IAAY,EAAE,MAAc;IAC7C,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,UAAU,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,aAAa,CACjC,IAAY,EACZ,QAAgB;IAEhB,IAAI,QAAQ,CAAC,QAAQ,CAAC,IAAI,CAAC,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;QACpD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,yCAAyC,EAAE,CAAC;IAC9E,CAAC;IAED,MAAM,IAAI,GAAG,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;IACpD,IAA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AAC,EAAE,CAAC;QAC5C,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,EAAE,6BAA6B,EAAE,CAAC;IAClE,CAAC;IAED,OAAO,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;AAChE,CAAC"}
@@ -137,9 +137,24 @@ async function collectReasons(options) {
137
137
  async function checkFile(path, identities, options) {
138
138
  const read = await readIndexFile(options.prTree, path.file);
139
139
  // A path with no file in the PR tree is a deletion by the namespace owner,
140
- // whose ownership was already established above.
141
- if (read.kind === "missing")
140
+ // whose ownership was already established above — but only if there was
141
+ // something there to delete. A path missing from BOTH trees was never real:
142
+ // that is what a fabricated or shell-mangled changed-path entry looks like,
143
+ // and treating it as a deletion authorized a merge on the strength of a
144
+ // file whose ref, owner id and registry host nobody ever read.
145
+ if (read.kind === "missing") {
146
+ // `!== "text"`, not `=== "missing"`. Narrowing the adapter's errno
147
+ // handling made an unreadable base file `{kind:"error"}` rather than
148
+ // `missing`, and an `=== "missing"` test then fell through to `null` —
149
+ // "authorized deletion" — for exactly the fault the narrowing was meant
150
+ // to stop being silent. Only proof that something IS committed there may
151
+ // authorize removing it.
152
+ const committed = await readIndexFile(options.root, path.file);
153
+ if (committed.kind !== "text") {
154
+ return "present in neither the contribution nor this repository — manual review";
155
+ }
142
156
  return null;
157
+ }
143
158
  if (read.kind === "error")
144
159
  return read.reason;
145
160
  const parsed = parseMetadataJson(read.text);
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/validate/index.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,sCAAsC;AAEtC;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,WAAW,EAA0B,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAA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AAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC,0BAA0B,IAAI,CAAC,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,KAAK,CAAC,EAAE,CAAC,EAAE,CAAC;IAC5H,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grimoire-rs/indexer",
3
- "version": "0.2.2",
3
+ "version": "0.3.1",
4
4
  "description": "CLI + Astro integration for running your own grim package index",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
@@ -25,7 +25,7 @@
25
25
  }
26
26
  },
27
27
  "scripts": {
28
- "build": "tsc -p tsconfig.json && mkdir -p dist/renderer/astro dist/renderer/public && cp -r src/renderer/astro/. dist/renderer/astro/ && cp -r src/renderer/public/. dist/renderer/public/",
28
+ "build": "tsc -p tsconfig.json && mkdir -p dist/renderer/astro dist/renderer/public && cp -r src/renderer/astro/. dist/renderer/astro/ && cp -r src/renderer/public/. dist/renderer/public/ && node scripts/prune-template-maps.mjs",
29
29
  "dev": "npm run build && node scripts/dev.mjs",
30
30
  "dev:smoke": "npm run build && node scripts/dev.mjs --smoke",
31
31
  "test": "vitest run",
@@ -1,6 +1,6 @@
1
1
  # {{title}}
2
2
 
3
- A [Grimoire](https://github.com/grimoire-rs/grimoire) package index a
3
+ A [Grimoire](https://github.com/grimoire-rs/grimoire) package index - a
4
4
  static site listing the skills, rules, agents, mcp servers, and bundles
5
5
  available in `{{registryHost}}`, served at {{baseUrl}}.
6
6
 
@@ -8,41 +8,137 @@ available in `{{registryHost}}`, served at {{baseUrl}}.
8
8
 
9
9
  | Path | Purpose |
10
10
  |---|---|
11
- | `index/<namespace>/<package>/metadata.json` | One entry per package the source of truth |
12
- | `index.config.json` | Site identity: title, base URL, registry, branding |
11
+ | `index/<host>/<namespace>/<package>/metadata.json` | One entry per package - the source of truth |
12
+ | `index.config.json` | Site identity, branding, and the `ci` block the workflows are rendered from |
13
13
  | `index-policy.json` | Committed allowlist of registry hosts contributions may point at |
14
- | `dist/` | Build output (`all.json`, per-path copies, the rendered site) not committed |
14
+ | `package.json` / `package-lock.json` | The renderer this index runs, pinned |
15
+ | `dist/` | Build output (`all.json`, per-path copies, the rendered site) - not committed |
16
+
17
+ ## Getting set up
18
+
19
+ ```sh
20
+ npm install
21
+ ```
22
+
23
+ That is the whole toolchain. `package-lock.json` pins the exact renderer this
24
+ index builds, validates and deploys with - commit it, because CI installs from
25
+ it with `npm ci` and nothing is resolved on the runner.
26
+
27
+ ## Everyday workflow
28
+
29
+ | Command | What it does |
30
+ |---|---|
31
+ | `npm run dev` | Serve the index locally with a live preview |
32
+ | `npm run build` | Compile `index/**` into `dist/` and render the site |
33
+ | `npm run validate` | Run the contribution gate over changed paths |
34
+ | `npm run enrich` | Refresh READMEs, logos and version lists from the registry (needs `grim`) |
35
+ | `npm run ci` | Re-render the CI workflows from `index.config.json` |
36
+ | `npm run ci:check` | Fail if the committed workflows have drifted from the config |
37
+
38
+ ### Review a change locally
39
+
40
+ ```sh
41
+ npm run dev
42
+ ```
43
+
44
+ `dev` prints the URL to open once it is up - the site exactly as it deploys.
45
+ A domain-rooted `site` serves at `http://localhost:4321`; a project-Pages
46
+ `site` (`https://<owner>.github.io/<repo>`) serves under a `/<repo>` path
47
+ segment instead, because that is Astro's `base` for that layout too.
48
+
49
+ Entries under `index/` and the settings in `index.config.json` are read once,
50
+ at start-up, so restart after editing them. The dev server renders through the
51
+ same code path `npm run build` does: what you see is what deploys.
52
+
53
+ ### Test a contribution before you open the pull request
54
+
55
+ `validate` is the same gate CI runs, and the same exit-code contract - 0
56
+ means eligible for auto-merge, non-zero means a maintainer takes a look -
57
+ but CI reads the forge identity and the PR tree off the platform, so a
58
+ local run has to supply them by hand:
59
+
60
+ ```sh
61
+ npm run validate -- \
62
+ --root . --pr-tree . \
63
+ --forge github --author-login <your-github-login> --author-id <your-numeric-id> \
64
+ -- index/<host>/<your-namespace>/<your-package>/metadata.json
65
+ ```
66
+
67
+ `--root` and `--pr-tree` both point at your own checkout here; CI points
68
+ them at two different checkouts (the trusted base and the PR head) so it
69
+ can also catch a re-registered login trying to inherit someone else's
70
+ package - fine to collapse for a solo sanity check, not something CI does.
71
+ `--author-id` is your numeric forge account id, not your login - find yours
72
+ at `https://api.github.com/users/<your-github-login>`. The gate makes real
73
+ calls to the forge API and to the registry, so it needs network access and
74
+ an entry that is actually yours to pass.
15
75
 
16
76
  ## Contributing a package
17
77
 
18
- Add `index/<namespace>/<package>/metadata.json`, then open a pull request.
19
- CI runs `grim-indexer validate` on it: a clean run means the entry is
20
- eligible for auto-merge, a failing one means a maintainer takes a look.
78
+ Add `index/<host>/<your-namespace>/<your-package>/metadata.json` (`<host>`
79
+ is the forge this repo is hosted on, e.g. `github.com`), then open a pull
80
+ request.
21
81
 
22
82
  ```json
23
83
  {
24
84
  "schema": 1,
25
85
  "name": "{{name}}-example",
26
86
  "kind": "skill",
27
- "ref": "{{registryHost}}/{{registryAlias}}/skills/{{name}}-example:1.0.0",
87
+ "ref": "{{registryHost}}/{{registryAlias}}/skills/{{name}}-example",
28
88
  "description": "One line describing what this package does.",
29
- "owner": { "id": 0, "github": "your-github-login" }
89
+ "owner": { "id": 12345678, "github": "your-github-login" }
30
90
  }
31
91
  ```
32
92
 
33
93
  The directory name must equal `name`, and `kind` is one of `skill`,
34
- `rule`, `agent`, `mcp`, `bundle`.
94
+ `rule`, `agent`, `mcp`, `bundle`. `ref` names a repository, not a tag or
95
+ digest - the gate resolves it to whatever is published. `owner.id` must be
96
+ your real numeric GitHub account id, not the placeholder above - find yours
97
+ at `https://api.github.com/users/your-github-login`; the gate checks it
98
+ against the forge, not the `github` login, since a login can be
99
+ re-registered by someone else.
35
100
 
36
- ## Local development
101
+ ## CI
102
+
103
+ This repo owns and runs its own CI: the workflow files are committed here, not
104
+ called from anywhere else. They are *rendered* from the `ci` block of
105
+ `index.config.json`, so the way to change what CI does is to change the config
106
+ and run `npm run ci`.
107
+
108
+ | Key | Default | What it changes |
109
+ |---|---|---|
110
+ | `forge` | `github` | Which pipeline is rendered - `github` or `gitlab` |
111
+ | `nodeVersion` | `22` | Node the jobs run on, and the GitLab image tag |
112
+ | `enrich` | `true` | Pull READMEs, logos and version lists from the registry before building |
113
+ | `grimVersion` | `latest` | grim release the enrichment step uses |
114
+ | `autoMerge` | `false` | Squash-merge a pull request the gate passed, then deploy (GitHub only) |
115
+ | `allowManualEdits` | `false` | Own the files by hand; drops the drift guard |
116
+
117
+ `autoMerge` is off until you turn it on: merging an untrusted contribution
118
+ unattended is your policy to set, not this package's to assume. It is GitHub
119
+ only, and that is not an oversight - GitHub always runs the base branch's copy
120
+ of a `pull_request_target` workflow, so the gate a pull request faces is one it
121
+ cannot edit. On GitLab the merge request supplies its own `.gitlab-ci.yml` and a
122
+ fork's pipeline runs in the fork, so an auto-merge there would act on a verdict
123
+ the contributor wrote. Setting `autoMerge` with `forge: gitlab` is refused
124
+ rather than rendered inert.
125
+
126
+ A `verify-ci` job re-renders and diffs on every change that can produce
127
+ drift - pushes and pull requests touching `index.config.json`,
128
+ `package.json`, `package-lock.json`, or `.github/workflows/**` - so a
129
+ hand-edit fails CI instead of silently forking. Action pins are excluded
130
+ from that diff, so Renovate may bump `uses: owner/action@<ref>` freely.
131
+
132
+ To pick up renderer fixes, bump `@grimoire-rs/indexer` the ordinary npm way and
133
+ re-render:
37
134
 
38
135
  ```sh
39
- npx @grimoire-rs/indexer build # index/** -> dist/
40
- npx @grimoire-rs/indexer validate # run the contribution gate locally
136
+ npm update @grimoire-rs/indexer
137
+ npm run ci
41
138
  ```
42
139
 
43
- ## Upgrading CI
44
-
45
- The workflows in this repo are thin callers of reusable workflows that
46
- [grim-indexer](https://github.com/grimoire-rs/indexer) owns. To
47
- pick up CI fixes, bump the pinned ref in the `uses:` line — nothing needs
48
- re-scaffolding, and your local edits are never overwritten.
140
+ No CI *definitions* are fetched from outside this repo - no reusable
141
+ workflow, no remote `include:` - so what you review in a diff is exactly
142
+ what runs. The jobs themselves still reach the network: `npm ci` from the
143
+ npm registry, `uses: actions/...@<sha>` from GitHub, and - with `enrich`
144
+ on - a grim release tarball.
@@ -0,0 +1,36 @@
1
+
2
+ # `needs: validate` is the entire safety condition. The gate's exit code is
3
+ # the authorization - 0 means "eligible for auto-merge" - and `needs:` is
4
+ # what turns that into "this job does not start". A cancelled or skipped
5
+ # gate is not a success either, so both also stop here.
6
+ #
7
+ # This job checks nothing out. Contributor content never touches the runner
8
+ # that holds the write token; the only thing it does with the pull request is
9
+ # name its number to `gh`.
10
+ #
11
+ # `--match-head-commit` closes the window between the two jobs: the gate
12
+ # judged one head sha, and without this a push landing while it ran would be
13
+ # what got merged - the contribution reviewed and the contribution merged
14
+ # would be different commits. Mismatch fails the job, and the next
15
+ # `synchronize` event re-runs the gate against the new head anyway.
16
+ automerge:
17
+ needs: validate
18
+ runs-on: ubuntu-latest
19
+ permissions:
20
+ contents: write
21
+ pull-requests: write
22
+ actions: write # dispatch pages.yml after the merge
23
+ steps:
24
+ - name: Merge and deploy
25
+ env:
26
+ GH_TOKEN: ${{ github.token }}
27
+ REPO: ${{ github.repository }}
28
+ PR: ${{ github.event.pull_request.number }}
29
+ HEAD_SHA: ${{ github.event.pull_request.head.sha }}
30
+ BRANCH: ${{ github.event.repository.default_branch }}
31
+ run: |
32
+ set -euo pipefail
33
+ gh pr merge "$PR" --repo "$REPO" --squash --match-head-commit "$HEAD_SHA"
34
+ # A push made with GITHUB_TOKEN triggers no workflow, so the merge
35
+ # this job just made would never build the site. Dispatch it.
36
+ gh workflow run pages.yml --repo "$REPO" --ref "$BRANCH"
@@ -0,0 +1,27 @@
1
+
2
+ # The index stores pointers; everything a reader looks at - README,
3
+ # changelog, logo, version list - lives in the registry, and grim is
4
+ # what reads a registry. `ci.grimVersion` pins the binary.
5
+ - name: Install grim
6
+ env:
7
+ # Resolved from `ci.grimVersion` when this file was rendered, so
8
+ # there is no version branch left to take at run time.
9
+ GRIM_RELEASE_BASE: "{{grimReleaseBase}}"
10
+ run: |
11
+ set -euo pipefail
12
+ tarball="grimoire-$(uname -m)-unknown-linux-gnu.tar.gz"
13
+ cd "$(mktemp -d)"
14
+ curl -fsSL --proto '=https' --tlsv1.2 \
15
+ -O "${GRIM_RELEASE_BASE}/${tarball}" -O "${GRIM_RELEASE_BASE}/${tarball}.sha256"
16
+ sha256sum -c "${tarball}.sha256"
17
+ tar -xzf "${tarball}" --strip-components=1 --wildcards -C /usr/local/bin '*/grim'
18
+ grim --version
19
+
20
+ # Enrichment is best-effort by design: a registry outage must degrade
21
+ # the site to pointers-only, never block a deploy that is otherwise
22
+ # ready. `enrich` itself keeps any sidecar it fails to refresh. Set
23
+ # `"enrich": false` in the `ci` block to drop these two steps entirely.
24
+ - name: Refresh package metadata
25
+ run: |
26
+ npm run enrich ||
27
+ echo "::warning::enrich failed - building without READMEs, logos and version lists"
@@ -0,0 +1,64 @@
1
+ {{header}}
2
+ # Builds this index and deploys it to GitHub Pages.
3
+ #
4
+ # Enable it once, in Settings -> Pages -> Source: "GitHub Actions". Until
5
+ # that is set, this workflow runs green and deploys nothing.
6
+ name: pages
7
+
8
+ on:
9
+ push:
10
+ branches: [{{defaultBranch}}]
11
+ workflow_dispatch:
12
+
13
+ # Default-deny at the top; every job pays for exactly what it needs.
14
+ permissions: {}
15
+
16
+ concurrency:
17
+ group: grim-indexer-pages
18
+ cancel-in-progress: false
19
+
20
+ jobs:
21
+ build:
22
+ runs-on: ubuntu-latest
23
+ permissions:
24
+ contents: read
25
+ steps:
26
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
27
+ with:
28
+ persist-credentials: false
29
+
30
+ - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
31
+ with:
32
+ node-version: "{{nodeVersion}}"
33
+ cache: npm
34
+
35
+ # `npm ci` installs exactly package-lock.json, so which renderer builds
36
+ # this site is a reviewed fact in the repository, not a resolution that
37
+ # happens on the runner. `--ignore-scripts` because this job runs
38
+ # MERGED contributor content: a `prepare` script or a lock entry that
39
+ # arrived through an auto-merged pull request would otherwise execute
40
+ # here, in the job that publishes the site.
41
+ - name: Install
42
+ run: npm ci --ignore-scripts
43
+ {{githubEnrichSteps}}
44
+ - name: Build index
45
+ run: npm run build
46
+
47
+ - uses: actions/configure-pages@45bfe0192ca1faeb007ade9deae92b16b8254a0d # v6.0.0
48
+
49
+ - uses: actions/upload-pages-artifact@fc324d3547104276b827a68afc52ff2a11cc49c9 # v5.0.0
50
+ with:
51
+ path: dist
52
+
53
+ deploy:
54
+ needs: build
55
+ runs-on: ubuntu-latest
56
+ permissions:
57
+ pages: write
58
+ id-token: write
59
+ environment:
60
+ name: github-pages
61
+ url: ${{ steps.deployment.outputs.page_url }}
62
+ steps:
63
+ - id: deployment
64
+ uses: actions/deploy-pages@cd2ce8fcbc39b97be8ca5fce6e763baed58fa128 # v5.0.0
@@ -0,0 +1,89 @@
1
+ {{header}}
2
+ # Publishes this repository's own packages to the registry, then announces
3
+ # them into the index that lives beside them - the combined layout
4
+ # `grim-indexer init --with-skills` scaffolds. `publish.toml` says what gets
5
+ # pushed and where; the `ci.publish` key in index.config.json says when.
6
+ #
7
+ # ONE REPOSITORY SETTING is needed and cannot be set from here: Settings ->
8
+ # Actions -> General -> Workflow permissions -> "Allow GitHub Actions to
9
+ # create and approve pull requests". Without it the packages publish and the
10
+ # announce then fails with a 403 opening the pull request.
11
+ name: publish
12
+
13
+ on:
14
+ {{publishTrigger}}
15
+ workflow_dispatch:
16
+
17
+ # Default-deny at the top; the job pays for exactly what it needs.
18
+ permissions: {}
19
+
20
+ # Serialized against itself. Two publishes racing would both read the same
21
+ # "already published?" answer and both push.
22
+ concurrency:
23
+ group: grim-indexer-publish
24
+ cancel-in-progress: false
25
+
26
+ jobs:
27
+ publish:
28
+ runs-on: ubuntu-latest
29
+ permissions:
30
+ contents: read
31
+ # Pushing to this repository's own GHCR packages.
32
+ packages: write
33
+ # `--announce` opens its pull request against THIS repository, because in
34
+ # the combined layout this repository is the index.
35
+ pull-requests: write
36
+ steps:
37
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
38
+
39
+ # The same pinned-by-config install the enrichment step uses: a release
40
+ # tarball whose checksum is verified before it runs, at the version
41
+ # `ci.grimVersion` resolved when this file was rendered.
42
+ - name: Install grim
43
+ env:
44
+ GRIM_RELEASE_BASE: "{{grimReleaseBase}}"
45
+ run: |
46
+ set -euo pipefail
47
+ tarball="grimoire-$(uname -m)-unknown-linux-gnu.tar.gz"
48
+ cd "$(mktemp -d)"
49
+ curl -fsSL --proto '=https' --tlsv1.2 \
50
+ -O "${GRIM_RELEASE_BASE}/${tarball}" -O "${GRIM_RELEASE_BASE}/${tarball}.sha256"
51
+ sha256sum -c "${tarball}.sha256"
52
+ tar -xzf "${tarball}" --strip-components=1 --wildcards -C /usr/local/bin '*/grim'
53
+ grim --version
54
+
55
+ # The defaults are the zero-setup GHCR path: the built-in token can push
56
+ # to this repository's own packages, so nothing has to be configured.
57
+ # Publishing anywhere else is three repository settings and no edit to
58
+ # this generated file - set the variables GRIM_REGISTRY_HOST and
59
+ # GRIM_REGISTRY_USER, and the secret GRIM_REGISTRY_TOKEN.
60
+ - name: Log in to the registry
61
+ env:
62
+ REGISTRY: ${{ vars.GRIM_REGISTRY_HOST || 'ghcr.io' }}
63
+ REGISTRY_USER: ${{ vars.GRIM_REGISTRY_USER || github.actor }}
64
+ REGISTRY_TOKEN: ${{ secrets.GRIM_REGISTRY_TOKEN || secrets.GITHUB_TOKEN }}
65
+ run: |
66
+ set -euo pipefail
67
+ printf '%s' "$REGISTRY_TOKEN" | grim login "$REGISTRY" \
68
+ -u "$REGISTRY_USER" --password-stdin --allow-insecure-store
69
+
70
+ # `--announce` opens the pull request through the REST API, but the
71
+ # branch it proposes is pushed over git - which reads the token from
72
+ # git's credential helper, not from the environment.
73
+ - name: Wire the announce token into git
74
+ env:
75
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
76
+ run: gh auth setup-git
77
+
78
+ # Skip-existing is the default, so a re-run over unchanged versions is a
79
+ # no-op and only a bumped version pushes. That is what makes triggering
80
+ # on every default-branch push reasonable.
81
+ #
82
+ # THE PULL REQUEST THIS OPENS IS NOT GATED. GitHub runs no workflows on a
83
+ # pull request opened with the built-in token, so `validate` never fires
84
+ # on it - review it, or merge it knowing nothing checked it. That is the
85
+ # standing cost of the combined layout, not a fault in this workflow.
86
+ - name: Publish and announce
87
+ env:
88
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89
+ run: grim publish --announce