@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
@@ -1,51 +0,0 @@
1
- # Contribution gate for pull requests against this index.
2
- #
3
- # Exit 0 = eligible for auto-merge, non-zero = manual review required. To
4
- # enforce it, require the status check named `validate / validate` in branch
5
- # protection — NOT `validate`. A thin caller reports its check run as
6
- # `<job key here> / <job key in the called workflow>`, and both happen to be
7
- # `validate`; rename `jobs.validate` below and the required context moves
8
- # with it. Requiring a context that never reports blocks every PR forever,
9
- # and looks exactly like the gate rejecting the contribution.
10
- #
11
- # `pull_request_target` is deliberate and safe HERE, and only because of
12
- # what the called workflow does: it runs grim-indexer from npm against the
13
- # trusted base checkout, and reads the PR head as data in a separate
14
- # directory without ever executing, importing, or installing from it. The
15
- # gate needs a forge token to resolve numeric namespace-owner ids, which an
16
- # unprivileged `pull_request` job does not have.
17
- #
18
- # Do not switch this to run contributor code, and do not widen
19
- # `permissions:` here.
20
- #
21
- # This gate covers third-party contributions. It does NOT cover an announce
22
- # your own CI makes (the `--with-skills` layout, where this repo publishes
23
- # into its own index): GitHub runs no workflows on a PR opened with
24
- # `secrets.GITHUB_TOKEN`, so `grim publish --announce` from CI lands an
25
- # effectively ungated PR — review it by hand. That PR also needs "Allow
26
- # GitHub Actions to create and approve pull requests" (Settings → Actions)
27
- # turned on, off by default; without it grim only pushes the branch and
28
- # reports `outcome: "branch-pushed"`. Enabling it lets any workflow in this
29
- # repo approve PRs too, so weigh it against your branch protection.
30
- #
31
- # Deliberately a thin caller: the job logic lives in a reusable workflow
32
- # grim-indexer owns, so upgrades arrive by bumping the pinned ref below
33
- # instead of re-scaffolding this repo over your edits.
34
- name: validate
35
-
36
- on:
37
- pull_request_target:
38
- paths:
39
- - "index/**"
40
- - "index-policy.json"
41
-
42
- permissions: {}
43
-
44
- jobs:
45
- validate:
46
- uses: grimoire-rs/indexer/.github/workflows/index-validate.yml@{{ref}}
47
- permissions:
48
- contents: read
49
- pull-requests: read
50
- with:
51
- grim-indexer-version: "{{version}}"
@@ -1,13 +0,0 @@
1
- # Builds this index for GitLab Pages and gates merge requests.
2
- #
3
- # Deliberately a thin caller: the job logic lives in a file grim-indexer
4
- # owns, so upgrades arrive by bumping the pinned ref in the URL below
5
- # instead of re-scaffolding this repo over your edits.
6
- #
7
- # If your GitLab instance blocks remote includes, vendor the file locally
8
- # and switch to `- local: "ci/grim-indexer.yml"`.
9
- include:
10
- - remote: "https://raw.githubusercontent.com/grimoire-rs/indexer/{{ref}}/templates/reusable/gitlab-index-ci.yml"
11
-
12
- variables:
13
- GRIM_INDEXER_VERSION: "{{version}}"
@@ -1,125 +0,0 @@
1
- # SPDX-License-Identifier: Apache-2.0
2
- # Copyright 2026 The Grimoire Authors
3
- #
4
- # GitLab counterpart of the two reusable GitHub workflows: scaffolded index
5
- # repos pull this in with `include: remote:` so a fix here reaches them
6
- # without a re-scaffold. Override any variable below in the including
7
- # `.gitlab-ci.yml`.
8
- #
9
- # A private GitLab instance may refuse to fetch a remote include. The
10
- # fallback is to vendor this file into the index repo and switch the
11
- # include to `local:`.
12
- variables:
13
- GRIM_INDEXER_VERSION: "latest"
14
- GRIM_INDEXER_NODE_IMAGE: "node:22-alpine"
15
- GRIM_INDEXER_OUT_DIR: "public"
16
- # Refresh READMEs, changelogs, logos and version lists from the registry
17
- # before building. Set to "false" for a pointers-only site that never
18
- # leaves the runner.
19
- GRIM_INDEXER_ENRICH: "true"
20
- # grim release the enrichment step reads the registry with: "latest" or a tag.
21
- GRIM_VERSION: "latest"
22
-
23
- stages:
24
- - test
25
- - deploy
26
-
27
- # Contribution gate. Exit 0 = eligible for auto-merge, non-zero = manual
28
- # review required, so this job's status IS the gate.
29
- #
30
- # The gate must judge the change against the COMMITTED policy, not the
31
- # policy the merge request proposes — otherwise a contributor allowlists
32
- # their own registry host in the same MR. So the target branch is checked
33
- # out into a sibling worktree and passed as `--root`, with the MR head
34
- # passed as `--pr-tree` and read as data only.
35
- #
36
- # RESIDUAL, and it is not fixable from this file: on GitLab the merge
37
- # request supplies its own `.gitlab-ci.yml`, so a contributor can delete
38
- # this job outright. Enforce it instance-side — a compliance pipeline, a
39
- # required merge check, or protected-branch approval rules — or treat the
40
- # GitLab gate as advisory.
41
- grim-indexer:validate:
42
- stage: test
43
- image: $GRIM_INDEXER_NODE_IMAGE
44
- variables:
45
- GIT_DEPTH: 0
46
- rules:
47
- - if: $CI_PIPELINE_SOURCE == "merge_request_event"
48
- # The job image is picked for `npx`, and `node:*-alpine` ships no git —
49
- # but this job diffs the merge request against its target branch, so git
50
- # is not optional. GitLab's runner clones with a separate helper image, so
51
- # nothing else puts git in here. Install it for whichever package manager
52
- # the (overridable) image has.
53
- #
54
- # The trailing check is the load-bearing part: the gate's contract is
55
- # "exit 0 = eligible for auto-merge", so a missing or failed-to-install
56
- # tool must fail the job, never silently skip validation.
57
- before_script:
58
- - |
59
- set -eu
60
- if ! command -v git >/dev/null 2>&1; then
61
- if command -v apk >/dev/null 2>&1; then
62
- apk add --no-cache git
63
- elif command -v apt-get >/dev/null 2>&1; then
64
- apt-get update -qq && apt-get install -y -qq --no-install-recommends git
65
- fi
66
- fi
67
- command -v git >/dev/null 2>&1 || {
68
- echo "grim-indexer: the gate needs git, and ${GRIM_INDEXER_NODE_IMAGE} has none" >&2
69
- exit 1
70
- }
71
- script:
72
- - |
73
- set -eu
74
- git fetch --quiet origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
75
- git worktree add --detach ../base "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
76
- # Every changed path, with no pathspec and no diff filter: rejecting an
77
- # out-of-bounds path is the gate's first job, and it ownership-checks a
78
- # deletion before allowing it. Narrowing to `-- index` would let an MR
79
- # that adds a valid entry and edits this very file pass; dropping `D`
80
- # would let one that deletes a stranger's entry pass.
81
- git diff --name-only "$CI_MERGE_REQUEST_DIFF_BASE_SHA" HEAD > changed.txt
82
- xargs -a changed.txt npx --yes "@grimoire-rs/indexer@$GRIM_INDEXER_VERSION" validate \
83
- --forge gitlab --root ../base --pr-tree .
84
-
85
- # GitLab Pages serves whatever the `pages` job leaves in `public/`.
86
- pages:
87
- stage: deploy
88
- image: $GRIM_INDEXER_NODE_IMAGE
89
- rules:
90
- - if: $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
91
- # The index stores pointers; README, changelog, logo and version list all
92
- # live in the registry, and grim is what reads a registry. Best-effort by
93
- # design — a registry outage degrades the site to pointers-only rather than
94
- # blocking a deploy, so the failure is logged and the build continues.
95
- #
96
- # Nothing is committed and no token is involved: the sidecars live only in
97
- # this job's workspace, which is why this needs no CI variables at all.
98
- script:
99
- - |
100
- set -eu
101
- if [ "$GRIM_INDEXER_ENRICH" = "true" ]; then
102
- if command -v apk >/dev/null 2>&1; then
103
- apk add --no-cache curl tar
104
- elif command -v apt-get >/dev/null 2>&1; then
105
- apt-get update -qq && apt-get install -y -qq --no-install-recommends curl tar ca-certificates
106
- fi
107
- # Alpine is musl; everything else here is glibc.
108
- if [ -f /etc/alpine-release ]; then libc=musl; else libc=gnu; fi
109
- case "$GRIM_VERSION" in
110
- latest) base=https://github.com/grimoire-rs/grimoire/releases/latest/download ;;
111
- *) base="https://github.com/grimoire-rs/grimoire/releases/download/$GRIM_VERSION" ;;
112
- esac
113
- tarball="grimoire-$(uname -m)-unknown-linux-$libc.tar.gz"
114
- tmp="$(mktemp -d)"
115
- ( cd "$tmp" \
116
- && curl -fsSL --proto '=https' --tlsv1.2 -O "$base/$tarball" -O "$base/$tarball.sha256" \
117
- && sha256sum -c "$tarball.sha256" \
118
- && tar -xzf "$tarball" -C /usr/local/bin --strip-components=1 "${tarball%.tar.gz}/grim" ) \
119
- && npx --yes "@grimoire-rs/indexer@$GRIM_INDEXER_VERSION" enrich \
120
- || echo "warning: enrich failed — building without READMEs, logos and version lists"
121
- fi
122
- - npx --yes "@grimoire-rs/indexer@$GRIM_INDEXER_VERSION" build --out-dir "$GRIM_INDEXER_OUT_DIR"
123
- artifacts:
124
- paths:
125
- - $GRIM_INDEXER_OUT_DIR