@grimoire-rs/indexer 0.1.7 → 0.1.9
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/dist/renderer/astro/layouts/Base.astro +14 -0
- package/dist/renderer/astro/lib/catalog.d.ts +14 -0
- package/dist/renderer/astro/lib/catalog.d.ts.map +1 -1
- package/dist/renderer/astro/lib/catalog.js +34 -0
- package/dist/renderer/astro/lib/catalog.js.map +1 -1
- package/dist/renderer/astro/lib/catalog.ts +35 -0
- package/dist/renderer/astro/pages/index.astro +14 -0
- package/package.json +1 -1
- package/templates/reusable/gitlab-index-ci.yml +6 -1
|
@@ -329,6 +329,20 @@ const brandRest =
|
|
|
329
329
|
.install-row code::-webkit-scrollbar {
|
|
330
330
|
display: none;
|
|
331
331
|
}
|
|
332
|
+
/* The one row whose action is the link itself rather than a command
|
|
333
|
+
to copy, so it spans the code and copy-button columns. */
|
|
334
|
+
.install-row .vscode-add {
|
|
335
|
+
grid-column: 2 / -1;
|
|
336
|
+
justify-self: start;
|
|
337
|
+
font-size: 0.85rem;
|
|
338
|
+
font-weight: 500;
|
|
339
|
+
color: var(--accent);
|
|
340
|
+
text-decoration: none;
|
|
341
|
+
}
|
|
342
|
+
.install-row .vscode-add:hover,
|
|
343
|
+
.install-row .vscode-add:focus-visible {
|
|
344
|
+
text-decoration: underline;
|
|
345
|
+
}
|
|
332
346
|
/* The `[[registries]]` snippet is the one multi-line command: let it
|
|
333
347
|
wrap inside its cell instead of scrolling a three-line block. */
|
|
334
348
|
.install-row code.block {
|
|
@@ -4,4 +4,18 @@ export declare function compareVersions(a: string, b: string): number;
|
|
|
4
4
|
export declare function timeAgo(iso: string): string;
|
|
5
5
|
/** `vscode://<publisher.extension>/open?repo=<ref>`, or null when disabled. */
|
|
6
6
|
export declare function vscodeUrl(extension: string | null, ref: string): string | null;
|
|
7
|
+
/**
|
|
8
|
+
* `vscode://<publisher.extension>/add-registry?index=<url>&alias=<name>` — the
|
|
9
|
+
* one-click counterpart of the `grim config registry add` line beside it.
|
|
10
|
+
*
|
|
11
|
+
* Null unless the link would actually work: the handler takes https only (an
|
|
12
|
+
* index locator is fetched with whatever credentials the user configures for
|
|
13
|
+
* it), refuses embedded credentials, and caps the URL at 2048 characters.
|
|
14
|
+
* Checking here keeps a broken button off the page rather than putting the
|
|
15
|
+
* failure in the user's hands.
|
|
16
|
+
*/
|
|
17
|
+
export declare function addRegistryUrl(extension: string | null, registry: {
|
|
18
|
+
alias: string;
|
|
19
|
+
index: string;
|
|
20
|
+
} | null): string | null;
|
|
7
21
|
//# sourceMappingURL=catalog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../../src/renderer/astro/lib/catalog.ts"],"names":[],"mappings":"AAOA,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKrD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAWpF;AAID,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAa5D;AAcD,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAS3C;AAED,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE9E"}
|
|
1
|
+
{"version":3,"file":"catalog.d.ts","sourceRoot":"","sources":["../../../../src/renderer/astro/lib/catalog.ts"],"names":[],"mappings":"AAOA,YAAY,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAKrD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAWpF;AAID,wBAAgB,eAAe,CAAC,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAa5D;AAcD,wBAAgB,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAS3C;AAED,+EAA+E;AAC/E,wBAAgB,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAE9E;AAUD;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAC5B,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,QAAQ,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,GAAG,IAAI,GAChD,MAAM,GAAG,IAAI,CAYf"}
|
|
@@ -58,4 +58,38 @@ export function timeAgo(iso) {
|
|
|
58
58
|
export function vscodeUrl(extension, ref) {
|
|
59
59
|
return extension ? `vscode://${extension}/open?repo=${encodeURIComponent(ref)}` : null;
|
|
60
60
|
}
|
|
61
|
+
/**
|
|
62
|
+
* Alias charset the extension's `/add-registry` handler accepts. It has to be
|
|
63
|
+
* a TOML bare key and safe as a CLI argument, so it refuses a link rather
|
|
64
|
+
* than escaping one. Mirrored here so a config that cannot produce a working
|
|
65
|
+
* link renders no button at all, instead of one that silently does nothing.
|
|
66
|
+
*/
|
|
67
|
+
const REGISTRY_ALIAS = /^[A-Za-z0-9][A-Za-z0-9_-]{0,31}$/;
|
|
68
|
+
/**
|
|
69
|
+
* `vscode://<publisher.extension>/add-registry?index=<url>&alias=<name>` — the
|
|
70
|
+
* one-click counterpart of the `grim config registry add` line beside it.
|
|
71
|
+
*
|
|
72
|
+
* Null unless the link would actually work: the handler takes https only (an
|
|
73
|
+
* index locator is fetched with whatever credentials the user configures for
|
|
74
|
+
* it), refuses embedded credentials, and caps the URL at 2048 characters.
|
|
75
|
+
* Checking here keeps a broken button off the page rather than putting the
|
|
76
|
+
* failure in the user's hands.
|
|
77
|
+
*/
|
|
78
|
+
export function addRegistryUrl(extension, registry) {
|
|
79
|
+
if (!extension || !registry || !REGISTRY_ALIAS.test(registry.alias))
|
|
80
|
+
return null;
|
|
81
|
+
let url;
|
|
82
|
+
try {
|
|
83
|
+
url = new URL(registry.index);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
if (url.protocol !== "https:" || url.username !== "" || url.password !== "")
|
|
89
|
+
return null;
|
|
90
|
+
if (url.href.length > 2048)
|
|
91
|
+
return null;
|
|
92
|
+
const query = new URLSearchParams({ index: url.href, alias: registry.alias });
|
|
93
|
+
return `vscode://${extension}/add-registry?${query.toString()}`;
|
|
94
|
+
}
|
|
61
95
|
//# sourceMappingURL=catalog.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"catalog.js","sourceRoot":"","sources":["../../../../src/renderer/astro/lib/catalog.ts"],"names":[],"mappings":"AAAA,sCAAsC;AACtC,sCAAsC;AAQtC,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,MAAM,UAAU,cAAc,CAAC,OAA2B,EAAE,IAAc;IACxE,MAAM,MAAM,GAAG,OAAO,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5D,yEAAyE;IACzE,yEAAyE;IACzE,MAAM,CAAC,KAAK,EAAE,KAAK,CAAC,GAAG,CAAC,MAAM,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACjD,MAAM,KAAK,GAAG,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,IAAI,KAAK,EAAE,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,MAAM,CAC/E,CAAC,CAAC,EAAe,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAC5C,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ACjF,IAAI,GAAQ,CAAC;IACb,IAAI,CAAC;QACH,GAAG,GAAG,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAChC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAC;IACd,CAAC;IACD,IAAI,GAAG,CAAC,QAAQ,KAAK,QAAQ,IAAI,GAAG,CAAC,QAAQ,KAAK,EAAE,IAAI,GAAG,CAAC,QAAQ,KAAK,EAAE;QAAE,OAAO,IAAI,CAAC;IACzF,IAAI,GAAG,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI;QAAE,OAAO,IAAI,CAAC;IACxC,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,EAAE,KAAK,EAAE,GAAG,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC,CAAC;IAC9E,OAAO,YAAY,SAAS,iBAAiB,KAAK,CAAC,QAAQ,EAAE,EAAE,CAAC;AAClE,CAAC"}
|
|
@@ -67,3 +67,38 @@ export function timeAgo(iso: string): string {
|
|
|
67
67
|
export function vscodeUrl(extension: string | null, ref: string): string | null {
|
|
68
68
|
return extension ? `vscode://${extension}/open?repo=${encodeURIComponent(ref)}` : null;
|
|
69
69
|
}
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* Alias charset the extension's `/add-registry` handler accepts. It has to be
|
|
73
|
+
* a TOML bare key and safe as a CLI argument, so it refuses a link rather
|
|
74
|
+
* than escaping one. Mirrored here so a config that cannot produce a working
|
|
75
|
+
* link renders no button at all, instead of one that silently does nothing.
|
|
76
|
+
*/
|
|
77
|
+
const REGISTRY_ALIAS = /^[A-Za-z0-9][A-Za-z0-9_-]{0,31}$/;
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* `vscode://<publisher.extension>/add-registry?index=<url>&alias=<name>` — the
|
|
81
|
+
* one-click counterpart of the `grim config registry add` line beside it.
|
|
82
|
+
*
|
|
83
|
+
* Null unless the link would actually work: the handler takes https only (an
|
|
84
|
+
* index locator is fetched with whatever credentials the user configures for
|
|
85
|
+
* it), refuses embedded credentials, and caps the URL at 2048 characters.
|
|
86
|
+
* Checking here keeps a broken button off the page rather than putting the
|
|
87
|
+
* failure in the user's hands.
|
|
88
|
+
*/
|
|
89
|
+
export function addRegistryUrl(
|
|
90
|
+
extension: string | null,
|
|
91
|
+
registry: { alias: string; index: string } | null,
|
|
92
|
+
): string | null {
|
|
93
|
+
if (!extension || !registry || !REGISTRY_ALIAS.test(registry.alias)) return null;
|
|
94
|
+
let url: URL;
|
|
95
|
+
try {
|
|
96
|
+
url = new URL(registry.index);
|
|
97
|
+
} catch {
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
if (url.protocol !== "https:" || url.username !== "" || url.password !== "") return null;
|
|
101
|
+
if (url.href.length > 2048) return null;
|
|
102
|
+
const query = new URLSearchParams({ index: url.href, alias: registry.alias });
|
|
103
|
+
return `vscode://${extension}/add-registry?${query.toString()}`;
|
|
104
|
+
}
|
|
@@ -2,10 +2,16 @@
|
|
|
2
2
|
import Base from "../layouts/Base.astro";
|
|
3
3
|
import Catalog from "../components/Catalog.tsx";
|
|
4
4
|
import CopyButton from "../components/CopyButton.astro";
|
|
5
|
+
import { addRegistryUrl } from "../lib/catalog";
|
|
5
6
|
import { data } from "../lib/data";
|
|
6
7
|
|
|
7
8
|
const { config, packages } = data;
|
|
8
9
|
|
|
10
|
+
// One-click counterpart of the `grim config registry add` line: the VS Code
|
|
11
|
+
// extension registers a URI handler that writes the registry after a modal
|
|
12
|
+
// confirmation. Null whenever the link would not work — see `addRegistryUrl`.
|
|
13
|
+
const addRegistry = addRegistryUrl(config.vscodeExtension, config.registry);
|
|
14
|
+
|
|
9
15
|
// The "add this index" ergonomic (`helm repo add`): the command a visitor
|
|
10
16
|
// needs to point their own grim at *this* index, plus the equivalent
|
|
11
17
|
// hand-edit. Absent `registry` config means the index has no public URL to
|
|
@@ -60,6 +66,14 @@ const registryRows = config.registry
|
|
|
60
66
|
<CopyButton value={row.command} label={row.label} />
|
|
61
67
|
</div>
|
|
62
68
|
))}
|
|
69
|
+
{addRegistry && (
|
|
70
|
+
<div class="install-row">
|
|
71
|
+
<span class="os">VS Code</span>
|
|
72
|
+
<a class="vscode-add" href={addRegistry}>
|
|
73
|
+
Add this index to VS Code
|
|
74
|
+
</a>
|
|
75
|
+
</div>
|
|
76
|
+
)}
|
|
63
77
|
</div>
|
|
64
78
|
)
|
|
65
79
|
}
|
package/package.json
CHANGED
|
@@ -73,7 +73,12 @@ grim-indexer:validate:
|
|
|
73
73
|
set -eu
|
|
74
74
|
git fetch --quiet origin "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
|
|
75
75
|
git worktree add --detach ../base "origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME"
|
|
76
|
-
|
|
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
|
|
77
82
|
xargs -a changed.txt npx --yes "@grimoire-rs/indexer@$GRIM_INDEXER_VERSION" validate \
|
|
78
83
|
--forge gitlab --root ../base --pr-tree .
|
|
79
84
|
|