@grimoire-rs/indexer 0.4.4 → 0.5.0

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 (60) hide show
  1. package/CHANGELOG.md +190 -0
  2. package/NOTICE +30 -0
  3. package/README.md +76 -331
  4. package/dist/cli/init.d.ts.map +1 -1
  5. package/dist/cli/init.js +35 -4
  6. package/dist/cli/init.js.map +1 -1
  7. package/dist/config.d.ts +107 -7
  8. package/dist/config.d.ts.map +1 -1
  9. package/dist/config.js +181 -36
  10. package/dist/config.js.map +1 -1
  11. package/dist/renderer/astro/components/CardLogo.d.ts +5 -0
  12. package/dist/renderer/astro/components/CardLogo.js +58 -0
  13. package/dist/renderer/astro/components/CardLogo.tsx +96 -0
  14. package/dist/renderer/astro/components/Catalog.d.ts +14 -1
  15. package/dist/renderer/astro/components/Catalog.js +467 -108
  16. package/dist/renderer/astro/components/Catalog.tsx +756 -349
  17. package/dist/renderer/astro/components/CommandBar.astro +66 -0
  18. package/dist/renderer/astro/components/CopyButton.d.ts +7 -0
  19. package/dist/renderer/astro/components/CopyButton.js +28 -0
  20. package/dist/renderer/astro/components/CopyButton.tsx +56 -0
  21. package/dist/renderer/astro/components/KindMark.d.ts +69 -0
  22. package/dist/renderer/astro/components/KindMark.js +66 -0
  23. package/dist/renderer/astro/components/KindMark.tsx +141 -0
  24. package/dist/renderer/astro/components/PackageCard.d.ts +18 -0
  25. package/dist/renderer/astro/components/PackageCard.js +50 -0
  26. package/dist/renderer/astro/components/PackageCard.tsx +273 -0
  27. package/dist/renderer/astro/components/PackageRow.d.ts +10 -0
  28. package/dist/renderer/astro/components/PackageRow.js +32 -0
  29. package/dist/renderer/astro/components/PackageRow.tsx +126 -0
  30. package/dist/renderer/astro/components/PickerMenu.astro +5 -14
  31. package/dist/renderer/astro/components/SiteFooter.astro +64 -0
  32. package/dist/renderer/astro/components/SiteHeader.astro +74 -0
  33. package/dist/renderer/astro/components/VersionMenu.astro +2 -2
  34. package/dist/renderer/astro/layouts/Base.astro +860 -206
  35. package/dist/renderer/astro/lib/base.d.ts +25 -0
  36. package/dist/renderer/astro/lib/base.js +23 -0
  37. package/dist/renderer/astro/lib/base.ts +27 -0
  38. package/dist/renderer/astro/lib/catalog.d.ts +24 -0
  39. package/dist/renderer/astro/lib/catalog.js +36 -0
  40. package/dist/renderer/astro/lib/catalog.ts +37 -0
  41. package/dist/renderer/astro/lib/commands.d.ts +58 -0
  42. package/dist/renderer/astro/lib/commands.js +86 -0
  43. package/dist/renderer/astro/lib/commands.ts +117 -0
  44. package/dist/renderer/astro/lib/keywordRail.d.ts +44 -0
  45. package/dist/renderer/astro/lib/keywordRail.js +99 -0
  46. package/dist/renderer/astro/lib/keywordRail.ts +110 -0
  47. package/dist/renderer/astro/pages/index.astro +40 -87
  48. package/dist/renderer/astro/pages/p/[...slug].astro +340 -195
  49. package/dist/renderer/astro/styles/tokens.css +40 -5
  50. package/dist/renderer/index.d.ts +58 -0
  51. package/dist/renderer/index.d.ts.map +1 -1
  52. package/dist/renderer/index.js +547 -5
  53. package/dist/renderer/index.js.map +1 -1
  54. package/dist/renderer/types.d.ts +9 -0
  55. package/dist/renderer/types.d.ts.map +1 -1
  56. package/package.json +9 -4
  57. package/templates/README.md +6 -0
  58. package/templates/gitignore +4 -1
  59. package/templates/theme/README.md +38 -0
  60. package/templates/tsconfig.json +47 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,190 @@
1
+ # Changelog
2
+
3
+ All notable changes to `@grimoire-rs/indexer` are recorded here, in
4
+ [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) format. This project
5
+ adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
+
7
+ > This file starts at `0.5.0`. Releases up to and including `v0.4.4` shipped
8
+ > before it existed and are not reconstructed here — the git tags and
9
+ > `git log v0.4.3..v0.4.4` are the record for those. Every release from the
10
+ > next one on is written down here.
11
+
12
+ Component overrides sit in the **Unstable** tier of the
13
+ [stability table](docs/reference/theme-overlay.md#stability): their file paths
14
+ and props may move in a minor release, and this file is where that is
15
+ announced. Everything in the Contract tier moves only in a major.
16
+
17
+ An entry for such a move carries both halves or it announces nothing an
18
+ overrider can act on: the component's name, and the move itself as old → new —
19
+ `PackageRow`: `components/PackageRow.tsx` → `components/list/PackageRow.tsx`,
20
+ props `{ pkg }` → `{ pkg, compact }`.
21
+
22
+ ## [Unreleased]
23
+
24
+ ## [0.5.0] - 2026-08-30
25
+
26
+ ### Added
27
+
28
+ - **Theme overlay.** A `theme/` directory in an index repo is copied over the
29
+ renderer's staged sources before every build. A file at a path the renderer
30
+ does not ship adds one — `theme/pages/setup.astro` becomes `/setup/` — and a
31
+ file at a path it does ship replaces it. Structure is customizable now, not
32
+ just CSS. Only on the staged-copy path: a caller-supplied `srcDir` is left
33
+ alone.
34
+ - **Two paths the overlay refuses**, `theme/lib/**` and a root
35
+ `theme/content.config.ts`, so the renderer stays free to move its own helpers
36
+ and its one content-collection entrypoint. Each prints a line to stderr and
37
+ the build still succeeds. The same rule applies to `dev`'s mirror, because a
38
+ deny-list only one of the two writers honours lets an author develop against
39
+ a file the build then drops in silence. It is a compatibility guard, not a
40
+ security boundary: the copy does not follow symlinks either way.
41
+ - **`@grim/*` import specifier**, resolving to the renderer's sources so an
42
+ added page reaches the layout, components and helpers without a relative
43
+ path that encodes how deep it sits under `pages/`. It resolves *after* the
44
+ overlay, so an index that replaced a component imports its own.
45
+ - **`@grim-original/*`**, the same tree as it was *before* the overlay ran, so
46
+ an override can wrap the file it replaced instead of owning it outright.
47
+ `@grim/*` cannot serve that purpose once the theme has taken the path, and
48
+ the package's `exports` do not publish the Astro sources for a deep import.
49
+ - **One stderr line per overlaid path that replaces a shipped file**, naming
50
+ the path and the indexer version that shipped it. That is what makes the
51
+ Unstable tier below honest without a manifest. A path that only adds a file
52
+ is not logged.
53
+ - **`dev` mirrors `theme/**` edits** into the staged tree, so a page reloads as
54
+ it is saved. It creates `theme/` first if it is absent — a directory added
55
+ after the server started now mirrors instead of 404ing forever — and removes
56
+ it again on shutdown if you left it empty. Deletes are still not mirrored;
57
+ restart for those. A fault in the platform's recursive-watch backend disables
58
+ mirroring with a message rather than taking the server down.
59
+ - **`nav` config key.** An ordered `{label, href}` list that takes the header
60
+ over. Unset, it synthesizes exactly what the header has always shown, so an
61
+ index that predates the key renders unchanged; `[]` leaves the theme toggle
62
+ standing alone.
63
+ - **`notice` config key.** One line above the page content, in the site's own
64
+ width, on every page, carrying `data-slot="site-notice"`. Named `notice`
65
+ rather than `banner` because `--grim-color-banner-*` is the existing amber
66
+ palette for the deprecated-package banner, and a key called `banner` would
67
+ invite an index runner to override that token family by mistake.
68
+ - **`nav[].external` and `footerLinks[].external`.** Optional per entry, and it
69
+ decides only the new-tab affordance — the deployment base prefix is applied
70
+ either way. Unset keeps the old inference from the href's shape. `false` is
71
+ the case that inference cannot express: an absolute URL that is still your
72
+ own site, a staging host or an intranet mirror.
73
+ - **A build-time warning for a `nav` or `footerLinks` href that leads nowhere.**
74
+ A `/`-rooted href matching no emitted route and no `public/` file prints
75
+ `nav[0].href "/setup/": nothing is published at that path — the link will
76
+ 404`. It warns and never fails: a path served by something outside the build
77
+ is indistinguishable from a typo, and refusing a whole site over a footer
78
+ typo is worse than the typo. Checked after the build, which is the one moment
79
+ both the emitted routes and every `public/` layer exist at once.
80
+ - **A warning for an unrecognised top-level key in `index.config.json`**,
81
+ naming the key. Without it a typo — or a config predating the `banner` →
82
+ `notice` rename — loaded clean and silently rendered nothing.
83
+ - **`init` scaffolds `theme/README.md` and a `tsconfig.json`** mapping
84
+ `@grim/*` for editors. The README states where a page goes and which parts of
85
+ the overlay are promised, which a `.gitkeep` could not; both reserve `theme/`
86
+ for git equally well. `theme/pages/` is no longer created empty. The build
87
+ does not read that tsconfig.
88
+ - **A documentation site** (MkDocs Material, Diátaxis), built `--strict` as the
89
+ docs' pre-merge gate and published to GitHub Pages. `task docs:build`,
90
+ `docs:serve`, `docs:clean` — deliberately not part of `task check`, which
91
+ must stay runnable with no Python toolchain.
92
+ - **Individually replaceable components**: `SiteHeader`, `SiteFooter`,
93
+ `CommandBar`, `CopyButton`, `CardLogo`, `PackageCard`, `PackageRow`.
94
+ - **This changelog**, which two docs pages already made the sole mitigation for
95
+ the Unstable tier. It ships in the npm tarball, so the copy that matches your
96
+ pinned version is `node_modules/@grimoire-rs/indexer/CHANGELOG.md`.
97
+ - **`npm run typecheck:tests`**, type-checking the `test` tree under its own
98
+ `tsconfig.test.json`. Deliberately not wired into `task check` yet: the tree
99
+ has 95 real type errors, which is its own piece of work.
100
+
101
+ ### Changed
102
+
103
+ - **`footerLinks[].href` now accepts a site-root path** (`/setup/`) as well as
104
+ an absolute `http(s)` URL — previously `http(s)` only. `nav` takes the same
105
+ rule from one shared validator, and so now do `logo` and `favicon`, which had
106
+ three different answers between them and one that validated nothing. Both
107
+ link keys are checked when the config *loads*, so a `javascript:` or
108
+ protocol-relative href fails the build with the key that carried it, rather
109
+ than reaching a rendered anchor. A bare relative path is still refused: it
110
+ would resolve against whichever page carries the link, and the detail pages
111
+ sit two levels deep.
112
+ - **`/\host/x` and userinfo are refused everywhere a config value becomes a
113
+ URL.** Browsers read `/\host/x` the way they read `//host/x`, and
114
+ `https://good.test@evil.test/` resolves to `evil.test` while reading as
115
+ `good.test`. Two of the four validators already rejected userinfo; all four
116
+ do now.
117
+ - **Footer links go through the deployment base prefix, and honour the same
118
+ new-tab rule as the header.** They did neither before. **This changes an
119
+ existing site:** an `https://` footer link now opens in a new tab. Set
120
+ `"external": false` on the entry to keep it in the same tab.
121
+ - **`Base.astro` no longer contains the header and footer markup** — they are
122
+ `SiteHeader.astro` and `SiteFooter.astro`. Neither takes props: everything
123
+ they draw is build-time config. The head, the centered `main`, the copy toast
124
+ and every default style still come from the layout.
125
+ - **The platform-preselect loop moved into `Base.astro`**, so a `<CommandBar
126
+ detect />` on a page you added under `theme/pages/` preselects the visitor's
127
+ own platform. It used to run only on the shipped landing page, so the same
128
+ markup elsewhere silently showed the configured first choice instead.
129
+ - **`Catalog.tsx` no longer contains the card and row markup** — they are
130
+ `PackageCard.tsx` and `PackageRow.tsx`, and they *do* take props, because a
131
+ component that hydrates in the browser cannot read the build-time payload.
132
+ Those props are the contract the Unstable tier is about.
133
+ - **The install/registry/package command boxes are one `CommandBar`**, with
134
+ their choices derived in `@grim/lib/commands` — so a page an index adds can
135
+ draw the site's real install bar from the site's own config instead of
136
+ restating the command in a code block that drifts.
137
+ - **The renderer ships square.** `--grim-radius-base` is `0px`; set it to `4px`
138
+ to restore the rounding of `0.4.x` and earlier in one line.
139
+ - **Radius tokens are named for their role**: `--grim-radius-sm`/`-md`/`-lg`/
140
+ `-xl` are now `-code`, `-inset`, `-control` and `-surface`, and they derive
141
+ from `--grim-radius-base` rather than carrying their own values. `-pill` is
142
+ unchanged and off the knob. An override under an old name is silently
143
+ ignored, like any unknown property.
144
+ - **The list view leads with the package logo**, then the name, then the kind
145
+ mark.
146
+ - **The README is a pointer to the docs site.** The theming contract, the stats
147
+ sidecar schema and the CLI reference moved into `docs/`.
148
+ - **The scaffolded `tsconfig.json` sets `module` and `moduleResolution`** —
149
+ `esnext`/`bundler`, what actually reads those specifiers — and no longer sets
150
+ `baseUrl`, which is deprecated on the pinned TypeScript and made the file
151
+ fail to load. It stays free of `extends` on purpose.
152
+ - **The docs workflow splits `configure-pages` into its own job**, so the job
153
+ that resolves and executes unpinned transitive PyPI packages holds
154
+ `contents: read` and nothing else — `id-token: write` is a job-wide grant.
155
+ lychee now checks the external links `mkdocs --strict` never resolves and,
156
+ with `--include-fragments`, the `#anchor` half of the internal ones, which
157
+ `--strict` logs at INFO and exits 0 on.
158
+ - **eslint and vitest skip `.agents/worktrees/`.** Both tools walk the tree
159
+ themselves rather than asking git, and neither knew about a path `.gitignore`
160
+ had carried all along: eslint found a `tsconfig.json` per worktree and
161
+ reported a parse error on every file in the repo, and vitest collected and
162
+ ran each worktree's whole suite. A `.gitignore` entry and a tool's own ignore
163
+ list are two independent claims.
164
+
165
+ ### Fixed
166
+
167
+ - **Scaffold → `npm install` → build was broken end to end.** An index repo has
168
+ its own `node_modules`, and the staged root Astro builds in sits inside it,
169
+ so `preact-render-to-string` resolved to a second copy of preact. The first
170
+ hook rendered died with `Cannot read properties of undefined (reading
171
+ 'context')`, in a stack naming preact and lucide and nothing that leads back
172
+ to dependency resolution. Every preact-touching module is pinned to one copy
173
+ now, and `preact-render-to-string` is a declared dependency so it resolves
174
+ under an isolated install layout too.
175
+ - **A replaced header with no theme toggle no longer breaks the rest of the
176
+ page.** The `#theme-toggle` lookup in `Base.astro` is null-safe, so the copy
177
+ buttons, the picker wiring and the toast still run.
178
+ - **A `tsconfig.json` in the index repo that cannot be parsed is now named.**
179
+ It made the build fail while rendering a page with an error about preact; the
180
+ usual cause is an `extends` pointing into a `node_modules` that has not been
181
+ installed yet.
182
+ - **`dev` cleans up after itself.** Stopping the server is idempotent, and a
183
+ failure part-way through staging removes the scratch directory rather than
184
+ leaving it in the index repo. One case is not fixable from inside shutdown
185
+ and is written up in the docs: interrupting `dev` within about a second of
186
+ boot can leave a `.index-*` holding Vite's `deps_temp_<hash>`, which the
187
+ dependency optimizer recreates after the removal has already returned.
188
+
189
+ [Unreleased]: https://github.com/grimoire-rs/indexer/compare/v0.5.0...HEAD
190
+ [0.5.0]: https://github.com/grimoire-rs/indexer/compare/v0.4.4...v0.5.0
package/NOTICE ADDED
@@ -0,0 +1,30 @@
1
+ grim-indexer
2
+ Copyright 2026 The Grimoire Authors
3
+
4
+ This product includes software developed by The Grimoire Authors, licensed
5
+ under the Apache License, Version 2.0. See LICENSE.
6
+
7
+ --------------------------------------------------------------------------
8
+ Third-party assets bundled in the rendered site
9
+ --------------------------------------------------------------------------
10
+
11
+ codicons
12
+ https://github.com/microsoft/vscode-codicons
13
+ Copyright (c) Microsoft Corporation
14
+ Licensed under CC BY 4.0 — https://creativecommons.org/licenses/by/4.0/
15
+
16
+ Six glyphs (sparkle, law, agent, mcp, package, warning) are inlined as SVG
17
+ path data in `src/renderer/astro/components/KindMark.tsx` and rendered into
18
+ every built index. Extracted from @vscode/codicons 0.0.45, unmodified. They
19
+ are the same marks the Grimoire VS Code extension shows for each artifact
20
+ kind, so one catalogue reads the same on both surfaces.
21
+
22
+ Lucide
23
+ https://github.com/lucide-icons/lucide
24
+ Copyright (c) Lucide Contributors
25
+ Licensed under the ISC License.
26
+
27
+ Material Design Icons (@mdi/js)
28
+ https://github.com/Templarian/MaterialDesign
29
+ Licensed under the Apache License, Version 2.0.
30
+ Used only for brand marks Lucide does not carry.