@grimoire-rs/indexer 0.1.8 → 0.2.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.
- package/README.md +38 -0
- package/dist/cli/init.js +1 -1
- package/dist/cli/init.js.map +1 -1
- package/dist/config.d.ts +21 -1
- package/dist/config.d.ts.map +1 -1
- package/dist/config.js +19 -2
- package/dist/config.js.map +1 -1
- package/dist/enrich/index.d.ts.map +1 -1
- package/dist/enrich/index.js +62 -0
- package/dist/enrich/index.js.map +1 -1
- package/dist/renderer/astro/components/BrandMark.d.ts +14 -0
- package/dist/renderer/astro/components/BrandMark.d.ts.map +1 -0
- package/dist/renderer/astro/components/BrandMark.js +16 -0
- package/dist/renderer/astro/components/BrandMark.js.map +1 -0
- package/dist/renderer/astro/components/BrandMark.tsx +19 -0
- package/dist/renderer/astro/components/Catalog.d.ts.map +1 -1
- package/dist/renderer/astro/components/Catalog.js +310 -18
- package/dist/renderer/astro/components/Catalog.js.map +1 -1
- package/dist/renderer/astro/components/Catalog.tsx +445 -63
- package/dist/renderer/astro/components/CommandField.astro +43 -0
- package/dist/renderer/astro/components/PickerMenu.astro +68 -0
- package/dist/renderer/astro/components/VersionMenu.astro +6 -2
- package/dist/renderer/astro/content.config.ts +23 -5
- package/dist/renderer/astro/layouts/Base.astro +794 -66
- package/dist/renderer/astro/lib/catalog.d.ts +24 -0
- package/dist/renderer/astro/lib/catalog.d.ts.map +1 -1
- package/dist/renderer/astro/lib/catalog.js +62 -0
- package/dist/renderer/astro/lib/catalog.js.map +1 -1
- package/dist/renderer/astro/lib/catalog.ts +62 -0
- package/dist/renderer/astro/lib/code.d.ts +22 -0
- package/dist/renderer/astro/lib/code.d.ts.map +1 -0
- package/dist/renderer/astro/lib/code.js +21 -0
- package/dist/renderer/astro/lib/code.js.map +1 -0
- package/dist/renderer/astro/lib/code.ts +21 -0
- package/dist/renderer/astro/pages/index.astro +144 -36
- package/dist/renderer/astro/pages/p/[...slug].astro +403 -55
- package/dist/renderer/index.d.ts +23 -0
- package/dist/renderer/index.d.ts.map +1 -1
- package/dist/renderer/index.js +117 -30
- package/dist/renderer/index.js.map +1 -1
- package/package.json +5 -1
- package/dist/renderer/astro/components/CopyButton.astro +0 -24
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
---
|
|
2
|
+
// The leading segment of a command bar: a `<details>` menu that swaps which
|
|
3
|
+
// command the field beside it shows. Used twice — platform for the installer,
|
|
4
|
+
// scope for the registry add — because the two bars differ only in what the
|
|
5
|
+
// choices mean and which icon set draws them.
|
|
6
|
+
//
|
|
7
|
+
// The trigger carries every glyph and shows one; `hidden` picks it, and
|
|
8
|
+
// `Base.astro`'s `[data-os-switch]` handler moves it. That handler is generic
|
|
9
|
+
// over bars, so this component ships no script of its own.
|
|
10
|
+
//
|
|
11
|
+
// Icons arrive one of two ways and both render to static SVG at build time:
|
|
12
|
+
// `path` for a `@mdi/js` brand mark, `Icon` for a Lucide component. Lucide
|
|
13
|
+
// carries no brand marks and MDI is not the set the rest of the site draws
|
|
14
|
+
// with, so neither alone covers both bars.
|
|
15
|
+
import { ChevronDown } from "lucide-preact";
|
|
16
|
+
import { BrandMark } from "./BrandMark.tsx";
|
|
17
|
+
|
|
18
|
+
export interface Choice {
|
|
19
|
+
/** Shown in the menu, and matched against `data-os-glyph` when picking. */
|
|
20
|
+
name: string;
|
|
21
|
+
/** What the field shows and copies once this choice is picked. */
|
|
22
|
+
command: string;
|
|
23
|
+
/** `@mdi/js` path string. */
|
|
24
|
+
path?: string;
|
|
25
|
+
/** Lucide component, taking a `size` prop. */
|
|
26
|
+
Icon?: (props: { size?: number }) => unknown;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
interface Props {
|
|
30
|
+
choices: Choice[];
|
|
31
|
+
/** Accessible name for the trigger, e.g. "Choose your platform". */
|
|
32
|
+
label: string;
|
|
33
|
+
/** Short trigger tooltip, e.g. "Platform". */
|
|
34
|
+
title: string;
|
|
35
|
+
}
|
|
36
|
+
const { choices, label, title } = Astro.props;
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
<details class="os-menu">
|
|
40
|
+
<summary title={title} aria-label={label}>
|
|
41
|
+
{
|
|
42
|
+
choices.map((choice, i) => (
|
|
43
|
+
<span class="os-glyph" data-os-glyph={choice.name} hidden={i > 0}>
|
|
44
|
+
{choice.path ? <BrandMark path={choice.path} /> : choice.Icon && <choice.Icon size={16} />}
|
|
45
|
+
</span>
|
|
46
|
+
))
|
|
47
|
+
}
|
|
48
|
+
<ChevronDown size={12} aria-hidden="true" />
|
|
49
|
+
</summary>
|
|
50
|
+
<ul role="menu">
|
|
51
|
+
{
|
|
52
|
+
choices.map((choice, i) => (
|
|
53
|
+
<li>
|
|
54
|
+
<button
|
|
55
|
+
type="button"
|
|
56
|
+
role="menuitemradio"
|
|
57
|
+
aria-checked={i === 0 ? "true" : "false"}
|
|
58
|
+
data-os-pick={choice.command}
|
|
59
|
+
data-os-name={choice.name}
|
|
60
|
+
>
|
|
61
|
+
{choice.path ? <BrandMark path={choice.path} /> : choice.Icon && <choice.Icon size={16} />}
|
|
62
|
+
<span>{choice.name}</span>
|
|
63
|
+
</button>
|
|
64
|
+
</li>
|
|
65
|
+
))
|
|
66
|
+
}
|
|
67
|
+
</ul>
|
|
68
|
+
</details>
|
|
@@ -11,7 +11,10 @@ interface Props {
|
|
|
11
11
|
current?: boolean;
|
|
12
12
|
}
|
|
13
13
|
const { pkgRef, tag, current = false } = Astro.props;
|
|
14
|
-
|
|
14
|
+
// `:latest` is what every grim command already resolves to with no tag, so
|
|
15
|
+
// spelling it out is noise the visitor has to delete — the bare ref is the
|
|
16
|
+
// same request. Every other tag pins and has to survive the copy.
|
|
17
|
+
const pinned = tag === "latest" ? pkgRef : `${pkgRef}:${tag}`;
|
|
15
18
|
const menuId = `vm-${tag.replace(/[^a-z0-9]+/gi, "-")}`;
|
|
16
19
|
const commands: [string, string][] = [
|
|
17
20
|
["copy reference", pinned],
|
|
@@ -26,6 +29,7 @@ const commands: [string, string][] = [
|
|
|
26
29
|
type="button"
|
|
27
30
|
class:list={["version", { current }]}
|
|
28
31
|
data-copy={pinned}
|
|
32
|
+
data-copy-name={tag === "latest" ? "reference" : `pinned ${tag}`}
|
|
29
33
|
data-menu={menuId}
|
|
30
34
|
aria-current={current ? "true" : undefined}
|
|
31
35
|
title={`Copy ${pinned} — right-click for commands`}>{tag}</button
|
|
@@ -34,7 +38,7 @@ const commands: [string, string][] = [
|
|
|
34
38
|
<div popover="manual" id={menuId} class="version-menu">
|
|
35
39
|
{
|
|
36
40
|
commands.map(([label, cmd]) => (
|
|
37
|
-
<button type="button" class="cmd" data-copy={cmd} title={cmd}>
|
|
41
|
+
<button type="button" class="cmd" data-copy={cmd} data-copy-name={`grim ${label}`} title={cmd}>
|
|
38
42
|
<span>{label}</span>
|
|
39
43
|
</button>
|
|
40
44
|
))
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
// SPDX-License-Identifier: Apache-2.0
|
|
2
2
|
// Copyright 2026 The Grimoire Authors
|
|
3
3
|
|
|
4
|
-
// Loads enrich/<namespace>/<name>/{readme,changelog}.md
|
|
4
|
+
// Loads enrich/<namespace>/<name>/{readme,changelog,contents}.md plus the
|
|
5
|
+
// `contents.json` a bundle or an MCP server carries instead. `base` is
|
|
5
6
|
// resolved relative to the Astro root, which `buildSite` sets to the index
|
|
6
7
|
// repo root — no cwd walk-up, no marker file. The tree is optional:
|
|
7
8
|
// glob() degrades to an empty collection when its base dir doesn't exist.
|
|
@@ -9,9 +10,9 @@ import { defineCollection } from "astro:content";
|
|
|
9
10
|
import { glob } from "astro/loaders";
|
|
10
11
|
|
|
11
12
|
// id = "<namespace>/<name>", matching the page slug, by stripping the
|
|
12
|
-
// trailing "/<file
|
|
13
|
-
function idFromFile(file: string) {
|
|
14
|
-
const re = new RegExp(`/${file}
|
|
13
|
+
// trailing "/<file>.<ext>" off the glob-relative entry path.
|
|
14
|
+
function idFromFile(file: string, ext = "md") {
|
|
15
|
+
const re = new RegExp(`/${file}\\.${ext}$`);
|
|
15
16
|
return ({ entry }: { entry: string }) => entry.replace(re, "");
|
|
16
17
|
}
|
|
17
18
|
|
|
@@ -27,4 +28,21 @@ const changelogs = defineCollection({
|
|
|
27
28
|
}),
|
|
28
29
|
});
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
// The artifact's own entry point: SKILL.md for a skill, the rule or agent
|
|
32
|
+
// markdown for those. Rendered, not quoted — this is the instruction text a
|
|
33
|
+
// reader is deciding whether to install.
|
|
34
|
+
const contents = defineCollection({
|
|
35
|
+
loader: glob({ pattern: "**/contents.md", base: "./enrich", generateId: idFromFile("contents") }),
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
// A bundle's member list and an MCP server's descriptor are JSON, not prose,
|
|
39
|
+
// so they arrive as a data collection rather than a rendered one.
|
|
40
|
+
const contentData = defineCollection({
|
|
41
|
+
loader: glob({
|
|
42
|
+
pattern: "**/contents.json",
|
|
43
|
+
base: "./enrich",
|
|
44
|
+
generateId: idFromFile("contents", "json"),
|
|
45
|
+
}),
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
export const collections = { readmes, changelogs, contents, contentData };
|