@grove-dev/cli 0.3.1 → 0.3.2
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 +8 -93
- package/dist/index.d.ts +1 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +95 -1931
- package/dist/index.js.map +1 -1
- package/dist/init.d.ts +11 -0
- package/dist/init.d.ts.map +1 -0
- package/dist/init.js +82 -0
- package/dist/init.js.map +1 -0
- package/dist/package.json +6 -17
- package/dist/site/.github/ISSUE_TEMPLATE/bug_report.md +33 -0
- package/dist/site/.github/ISSUE_TEMPLATE/feature_request.md +20 -0
- package/dist/site/.github/ISSUE_TEMPLATE/record_submission.md +48 -0
- package/dist/site/.github/pull_request_template.md +27 -0
- package/dist/site/.github/workflows/ci.yml +21 -0
- package/dist/site/.github/workflows/cleanup.yml +23 -0
- package/dist/site/.github/workflows/deploy.yml +36 -0
- package/dist/site/.github/workflows/sync-contributors.yml +28 -0
- package/dist/site/.github/workflows/sync-github.yml +31 -0
- package/dist/site/astro.config.mjs +24 -0
- package/dist/site/content/pages/about.md +63 -0
- package/dist/site/content/pages/methodology.md +103 -0
- package/dist/site/data/health.yml +13 -0
- package/dist/site/data/records/.gitkeep +0 -0
- package/dist/site/data/records/crewai.yml +21 -0
- package/dist/site/data/records/dify.yml +21 -0
- package/dist/site/data/records/flowise.yml +21 -0
- package/dist/site/data/records/llamaindex.yml +21 -0
- package/dist/site/data/records/ollama.yml +28 -0
- package/dist/site/data/records/open-webui.yml +21 -0
- package/dist/site/data/taxonomy/categories.yml +10 -0
- package/dist/site/data/taxonomy/distribution-channels.yml +43 -0
- package/dist/site/data/taxonomy/platforms.yml +27 -0
- package/dist/site/data/taxonomy/stacks.yml +18 -0
- package/dist/site/grove.config.ts +76 -0
- package/dist/site/package.json +33 -0
- package/dist/site/public/icons/platforms/android.svg +1 -0
- package/dist/site/public/icons/platforms/apple-dark.svg +1 -0
- package/dist/site/public/icons/platforms/apple-light.svg +1 -0
- package/dist/site/public/icons/platforms/chrome.svg +1 -0
- package/dist/site/public/icons/platforms/chromeos.svg +5 -0
- package/dist/site/public/icons/platforms/desktop.svg +4 -0
- package/dist/site/public/icons/platforms/embedded.svg +5 -0
- package/dist/site/public/icons/platforms/ios.svg +1 -0
- package/dist/site/public/icons/platforms/linux.svg +1 -0
- package/dist/site/public/icons/platforms/macos.svg +1 -0
- package/dist/site/public/icons/platforms/ubuntu.svg +1 -0
- package/dist/site/public/icons/platforms/web.svg +5 -0
- package/dist/site/public/icons/platforms/windows.svg +6 -0
- package/dist/site/public/icons/stacks/android.svg +1 -0
- package/dist/site/public/icons/stacks/apple-dark.svg +1 -0
- package/dist/site/public/icons/stacks/apple-light.svg +1 -0
- package/dist/site/public/icons/stacks/bun.svg +1 -0
- package/dist/site/public/icons/stacks/capacitor.svg +14 -0
- package/dist/site/public/icons/stacks/clojure.svg +1 -0
- package/dist/site/public/icons/stacks/clojurescript.svg +1 -0
- package/dist/site/public/icons/stacks/dart.svg +1 -0
- package/dist/site/public/icons/stacks/deno.svg +1 -0
- package/dist/site/public/icons/stacks/django.svg +1 -0
- package/dist/site/public/icons/stacks/docker.svg +1 -0
- package/dist/site/public/icons/stacks/firebase.svg +1 -0
- package/dist/site/public/icons/stacks/flutter.svg +1 -0
- package/dist/site/public/icons/stacks/go.svg +1 -0
- package/dist/site/public/icons/stacks/graphql.svg +1 -0
- package/dist/site/public/icons/stacks/ionic.svg +4 -0
- package/dist/site/public/icons/stacks/java.svg +1 -0
- package/dist/site/public/icons/stacks/javascript.svg +1 -0
- package/dist/site/public/icons/stacks/kotlin.svg +1 -0
- package/dist/site/public/icons/stacks/llm.svg +1 -0
- package/dist/site/public/icons/stacks/mongodb.svg +1 -0
- package/dist/site/public/icons/stacks/node.js.svg +1 -0
- package/dist/site/public/icons/stacks/nodejs.svg +1 -0
- package/dist/site/public/icons/stacks/python.svg +1 -0
- package/dist/site/public/icons/stacks/rag.svg +7 -0
- package/dist/site/public/icons/stacks/react-native.svg +1 -0
- package/dist/site/public/icons/stacks/react.svg +1 -0
- package/dist/site/public/icons/stacks/rust.svg +1 -0
- package/dist/site/public/icons/stacks/solidity.svg +1 -0
- package/dist/site/public/icons/stacks/sveltekit.svg +1 -0
- package/dist/site/public/icons/stacks/swift.svg +1 -0
- package/dist/site/public/icons/stacks/tensorflow.svg +1 -0
- package/dist/site/public/icons/stacks/typescript.svg +1 -0
- package/dist/site/public/icons/stacks/vue.svg +1 -0
- package/dist/site/public/og-image.svg +48 -0
- package/dist/site/public/robots.txt +53 -0
- package/dist/site/src/pages/404.astro +64 -0
- package/dist/site/src/pages/[slug]/[recordSlug].astro +527 -0
- package/dist/site/src/pages/[slug]/index.astro +242 -0
- package/dist/site/src/pages/about.astro +189 -0
- package/dist/site/src/pages/apps/[recordSlug].astro +34 -0
- package/dist/site/src/pages/contributors.astro +113 -0
- package/dist/site/src/pages/index.astro +131 -0
- package/dist/site/src/pages/submit.astro +170 -0
- package/dist/site/src/styles/global.css +33 -0
- package/dist/site/tsconfig.json +13 -0
- package/package.json +7 -18
- package/dist/helpers.d.ts +0 -27
- package/dist/helpers.d.ts.map +0 -1
- package/dist/helpers.js +0 -41
- package/dist/helpers.js.map +0 -1
- package/dist/template-loader.d.ts +0 -99
- package/dist/template-loader.d.ts.map +0 -1
- package/dist/template-loader.js +0 -338
- package/dist/template-loader.js.map +0 -1
- package/dist/template-loader.test.d.ts +0 -2
- package/dist/template-loader.test.d.ts.map +0 -1
- package/dist/template-loader.test.js +0 -317
- package/dist/template-loader.test.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,871 +1,117 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
/**
|
|
3
|
-
* Grove CLI — scaffolds Grove-powered spaces and orchestrates
|
|
4
|
-
* `@grove-dev/core` commands.
|
|
5
|
-
*
|
|
6
|
-
* V1 command surface:
|
|
7
|
-
* grove new <name> scaffold a new project (asks blueprint + framework)
|
|
8
|
-
* grove run [action] dev-internal: scaffold from LOCAL template and run it
|
|
9
|
-
* (dev | build | init). Links local Grove packages.
|
|
10
|
-
* grove import <src> turn an awesome list into records/*.yml
|
|
11
|
-
* grove validate check records, taxonomy, health, decisions
|
|
12
|
-
* grove generate build data/generated/records.{full,index}.json
|
|
13
|
-
* grove sitemap write public/sitemap.xml
|
|
14
|
-
* grove llms write public/llms.txt and llms-full.txt
|
|
15
|
-
* grove sync github optional: enrich records with GitHub metadata
|
|
16
|
-
* grove cleanup stale flag records that need human review
|
|
17
|
-
* grove workflows sync re-emit GitHub workflow files
|
|
18
|
-
* grove build run the framework's build command
|
|
19
|
-
* grove dev run the framework's dev server
|
|
20
|
-
*/
|
|
21
2
|
import { spawn } from "node:child_process";
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
24
|
-
import { dirname, join, resolve } from "node:path";
|
|
25
|
-
import { fileURLToPath } from "node:url";
|
|
3
|
+
import { readFile, readdir, writeFile } from "node:fs/promises";
|
|
4
|
+
import { basename, join, resolve } from "node:path";
|
|
26
5
|
import { Command } from "commander";
|
|
27
|
-
import
|
|
28
|
-
import { cleanupStale, enrichFromGithubHtml, fetchGithubMetadata, generate, blueprintKind, importAwesomeList, loadConfig, parseGithubRepoUrl, stringifyRecordYaml, validateProject, } from "@grove-dev/core";
|
|
6
|
+
import { cleanupStale, enrichFromGithubHtml, fetchGithubMetadata, loadConfig, parseGithubRepoUrl, prepareDirectory, stringifyRecordYaml, syncContributors, validateProject, } from "@grove-dev/core";
|
|
29
7
|
import { parse as parseYaml } from "yaml";
|
|
30
|
-
import {
|
|
31
|
-
import { DEPLOY_PROVIDERS, parseDeployProvider } from "./helpers.js";
|
|
32
|
-
/**
|
|
33
|
-
* Resolve the CLI's own version. After `tsc` builds, the build script
|
|
34
|
-
* copies `package.json` next to `index.js` so production usage can read
|
|
35
|
-
* it via `import.meta.url`. In dev (`tsx src/index.ts`) we fall back
|
|
36
|
-
* to a `require` of the source `package.json`.
|
|
37
|
-
*/
|
|
38
|
-
function readOwnVersion() {
|
|
39
|
-
// 1) Production: dist/index.js → ./package.json (alongside the built file).
|
|
40
|
-
try {
|
|
41
|
-
const distPkg = createRequire(import.meta.url)("./package.json");
|
|
42
|
-
if (distPkg?.version)
|
|
43
|
-
return String(distPkg.version);
|
|
44
|
-
}
|
|
45
|
-
catch {
|
|
46
|
-
/* not built yet — fall through */
|
|
47
|
-
}
|
|
48
|
-
// 2) Dev: src/index.ts → ../../package.json.
|
|
49
|
-
try {
|
|
50
|
-
const srcPkg = createRequire(import.meta.url)("../../package.json");
|
|
51
|
-
if (srcPkg?.version)
|
|
52
|
-
return String(srcPkg.version);
|
|
53
|
-
}
|
|
54
|
-
catch {
|
|
55
|
-
/* missing — fall through */
|
|
56
|
-
}
|
|
57
|
-
return "0.0.0-dev";
|
|
58
|
-
}
|
|
59
|
-
const CLI_VERSION = readOwnVersion();
|
|
8
|
+
import { initDirectory, readCliVersion } from "./init.js";
|
|
60
9
|
const program = new Command();
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
"resource-hub": { label: "resource-hub", hint: "Guides, comparisons, resources" },
|
|
74
|
-
"ecosystem-map": { label: "ecosystem-map", hint: "Orgs, products, communities" },
|
|
75
|
-
};
|
|
10
|
+
function run(command, args, cwd = process.cwd()) {
|
|
11
|
+
return new Promise((resolvePromise, reject) => {
|
|
12
|
+
const child = spawn(command, args, { cwd, stdio: "inherit", shell: false });
|
|
13
|
+
child.once("error", reject);
|
|
14
|
+
child.once("exit", (code, signal) => {
|
|
15
|
+
if (code === 0)
|
|
16
|
+
resolvePromise();
|
|
17
|
+
else
|
|
18
|
+
reject(new Error(`${command} exited with ${signal ?? code ?? "unknown status"}`));
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
}
|
|
76
22
|
program
|
|
77
23
|
.name("grove")
|
|
78
|
-
.description("
|
|
79
|
-
.version(
|
|
80
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
81
|
-
// grove new
|
|
82
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
83
|
-
program
|
|
84
|
-
.command("new")
|
|
85
|
-
.argument("[name]", "project directory name (current dir if omitted)")
|
|
86
|
-
.description("Scaffold a new Grove project from a framework template.")
|
|
87
|
-
.option("-b, --blueprint <name>", "blueprint: project-directory | resource-hub | ecosystem-map")
|
|
88
|
-
.option("-f, --framework <name>", "framework: astro (V1: astro only — nextjs/svelte roadmap)")
|
|
89
|
-
.option("-t, --template <name>", "template name", "default")
|
|
90
|
-
.option("-d, --deploy <provider>", `deploy provider: ${DEPLOY_PROVIDERS.join(" | ")}`)
|
|
91
|
-
.option("-g, --github <mode>", "GitHub workflow mode: none | public (V1: none=private, public=community)")
|
|
92
|
-
.option("--local", "link @grove-dev/* dependencies to the local monorepo (workspace development only)")
|
|
93
|
-
.option("--no-git", "skip `git init` after scaffolding")
|
|
94
|
-
.option("--no-install", "skip `pnpm install` after scaffolding")
|
|
95
|
-
.option("-y, --yes", "accept defaults for every prompt (CI / scripted use)")
|
|
96
|
-
.action(async (name, opts) => {
|
|
97
|
-
p.intro("🌱 Grow a new Grove space");
|
|
98
|
-
const projectDir = opts.yes || name ? name ?? "." : await resolveText("Where should the new space live?", ".");
|
|
99
|
-
const projectName = opts.yes || name
|
|
100
|
-
? (projectDir === "." ? "Grove Directory" : projectDir)
|
|
101
|
-
: await resolveText("What is the name of this space?", "Grove Directory");
|
|
102
|
-
// Blueprint
|
|
103
|
-
let blueprint;
|
|
104
|
-
const validBlueprints = Object.keys(BLUEPRINT_LABELS);
|
|
105
|
-
if (opts.blueprint && validBlueprints.includes(opts.blueprint)) {
|
|
106
|
-
blueprint = opts.blueprint;
|
|
107
|
-
}
|
|
108
|
-
else if (opts.blueprint) {
|
|
109
|
-
p.log.error(`Unknown blueprint: ${opts.blueprint}.`);
|
|
110
|
-
p.log.info(`Try one of: ${validBlueprints.join(", ")}`);
|
|
111
|
-
process.exit(1);
|
|
112
|
-
}
|
|
113
|
-
else if (opts.yes) {
|
|
114
|
-
blueprint = "project-directory";
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
const b = unwrapPrompt(await p.select({
|
|
118
|
-
message: "Pick a blueprint",
|
|
119
|
-
options: validBlueprints.map((b) => ({
|
|
120
|
-
value: b,
|
|
121
|
-
label: BLUEPRINT_LABELS[b].label,
|
|
122
|
-
hint: BLUEPRINT_LABELS[b].hint,
|
|
123
|
-
})),
|
|
124
|
-
initialValue: "project-directory",
|
|
125
|
-
}));
|
|
126
|
-
blueprint = b;
|
|
127
|
-
}
|
|
128
|
-
// GitHub integration
|
|
129
|
-
// "none" — private/local mode: only validate-data.yml + build.yml
|
|
130
|
-
// "public" — public GitHub mode: + sync + cleanup + update + issue/PR templates
|
|
131
|
-
let githubMode;
|
|
132
|
-
if (opts.github && (opts.github === "none" || opts.github === "public")) {
|
|
133
|
-
githubMode = opts.github;
|
|
134
|
-
}
|
|
135
|
-
else if (opts.github) {
|
|
136
|
-
p.log.error(`Unknown GitHub mode: ${opts.github}.`);
|
|
137
|
-
p.log.info(`Try one of: none | public`);
|
|
138
|
-
process.exit(1);
|
|
139
|
-
}
|
|
140
|
-
else if (opts.yes) {
|
|
141
|
-
githubMode = "none";
|
|
142
|
-
}
|
|
143
|
-
else {
|
|
144
|
-
const g = unwrapPrompt(await p.select({
|
|
145
|
-
message: "GitHub automation mode?",
|
|
146
|
-
options: [
|
|
147
|
-
{
|
|
148
|
-
value: "none",
|
|
149
|
-
label: "none / private",
|
|
150
|
-
hint: "Private or local — no GitHub token, only validate + build",
|
|
151
|
-
},
|
|
152
|
-
{
|
|
153
|
-
value: "public",
|
|
154
|
-
label: "public GitHub metadata",
|
|
155
|
-
hint: "Community sites — syncs stars, contributors, stale records (token-gated)",
|
|
156
|
-
},
|
|
157
|
-
],
|
|
158
|
-
initialValue: "none",
|
|
159
|
-
}));
|
|
160
|
-
githubMode = g;
|
|
161
|
-
}
|
|
162
|
-
// Framework
|
|
163
|
-
let framework;
|
|
164
|
-
if (opts.framework && isFramework(opts.framework)) {
|
|
165
|
-
framework = opts.framework;
|
|
166
|
-
}
|
|
167
|
-
else if (opts.framework) {
|
|
168
|
-
p.log.error(`Unknown framework: ${opts.framework}.`);
|
|
169
|
-
p.log.info(`Try one of: ${SUPPORTED_FRAMEWORKS.join(", ")}`);
|
|
170
|
-
process.exit(1);
|
|
171
|
-
}
|
|
172
|
-
else if (opts.yes) {
|
|
173
|
-
framework = "astro";
|
|
174
|
-
}
|
|
175
|
-
else {
|
|
176
|
-
const f = unwrapPrompt(await p.select({
|
|
177
|
-
message: "Pick a framework (V1: astro only — nextjs/svelte land in v0.3.0)",
|
|
178
|
-
options: SUPPORTED_FRAMEWORKS.map((f) => ({
|
|
179
|
-
value: f,
|
|
180
|
-
label: FRAMEWORK_LABELS[f].label,
|
|
181
|
-
hint: FRAMEWORK_LABELS[f].hint,
|
|
182
|
-
})),
|
|
183
|
-
initialValue: "astro",
|
|
184
|
-
}));
|
|
185
|
-
framework = f;
|
|
186
|
-
}
|
|
187
|
-
const template = opts.template;
|
|
188
|
-
let deploy;
|
|
189
|
-
if (opts.deploy && DEPLOY_PROVIDERS.includes(opts.deploy)) {
|
|
190
|
-
deploy = opts.deploy;
|
|
191
|
-
}
|
|
192
|
-
else if (opts.deploy) {
|
|
193
|
-
p.log.error(`Unknown deploy provider: ${opts.deploy}.`);
|
|
194
|
-
p.log.info(`Try one of: ${DEPLOY_PROVIDERS.join(", ")}`);
|
|
195
|
-
process.exit(1);
|
|
196
|
-
}
|
|
197
|
-
else if (opts.yes) {
|
|
198
|
-
deploy = "github-pages";
|
|
199
|
-
}
|
|
200
|
-
else {
|
|
201
|
-
const d = unwrapPrompt(await p.select({
|
|
202
|
-
message: "Where will this space be deployed?",
|
|
203
|
-
options: DEPLOY_PROVIDERS.map((d) => ({
|
|
204
|
-
value: d,
|
|
205
|
-
label: DEPLOY_LABELS[d].label,
|
|
206
|
-
hint: DEPLOY_LABELS[d].hint,
|
|
207
|
-
})),
|
|
208
|
-
initialValue: "github-pages",
|
|
209
|
-
}));
|
|
210
|
-
deploy = d;
|
|
211
|
-
}
|
|
212
|
-
const initGit = opts.yes
|
|
213
|
-
? (opts.git ?? true)
|
|
214
|
-
: unwrapPrompt(await p.confirm({
|
|
215
|
-
message: "Initialize a git repository?",
|
|
216
|
-
initialValue: opts.git ?? true,
|
|
217
|
-
}));
|
|
218
|
-
const installDeps = opts.yes
|
|
219
|
-
? (opts.install ?? true)
|
|
220
|
-
: unwrapPrompt(await p.confirm({
|
|
221
|
-
message: "Install dependencies with pnpm?",
|
|
222
|
-
initialValue: opts.install ?? true,
|
|
223
|
-
}));
|
|
224
|
-
const root = resolve(projectDir);
|
|
225
|
-
const templates = await listTemplates(framework);
|
|
226
|
-
const tpl = templates.find((t) => t.template === template) ?? templates[0];
|
|
227
|
-
if (!tpl) {
|
|
228
|
-
p.log.error(`No templates found for ${framework}.`);
|
|
229
|
-
process.exit(1);
|
|
230
|
-
}
|
|
231
|
-
const s = p.spinner();
|
|
232
|
-
s.start("Scaffolding");
|
|
233
|
-
await mkdir(root, { recursive: true });
|
|
234
|
-
await copyTemplate(framework, root, tpl.template);
|
|
235
|
-
const renameResult = await renameProjectInTemplate(framework, root, projectName, tpl.template, { mode: opts.local ? "file" : "published" });
|
|
236
|
-
if (renameResult.rewrittenDeps.length > 0) {
|
|
237
|
-
const depLabel = opts.local ? "local monorepo link" : "published version";
|
|
238
|
-
p.log.step(`Rewrote @grove-dev/* deps to ${depLabel}: ${renameResult.rewrittenDeps.join(", ")}`);
|
|
239
|
-
}
|
|
240
|
-
await Promise.all([
|
|
241
|
-
ensureDir(join(root, "data")),
|
|
242
|
-
ensureDir(join(root, "data", "records")),
|
|
243
|
-
ensureDir(join(root, "data", "taxonomy")),
|
|
244
|
-
ensureDir(join(root, "data", "generated")),
|
|
245
|
-
ensureDir(join(root, "content")),
|
|
246
|
-
ensureDir(join(root, "content", "pages")),
|
|
247
|
-
ensureDir(join(root, "content", "records")),
|
|
248
|
-
ensureDir(join(root, "public")),
|
|
249
|
-
ensureDir(join(root, ".github")),
|
|
250
|
-
ensureDir(join(root, ".github", "ISSUE_TEMPLATE")),
|
|
251
|
-
ensureDir(join(root, ".github", "workflows")),
|
|
252
|
-
]);
|
|
253
|
-
await writeIfMissing(join(root, "grove.config.ts"), projectConfig(projectName, blueprint, githubMode));
|
|
254
|
-
await writeIfMissing(join(root, "README.md"), projectReadme(projectName, blueprint, framework));
|
|
255
|
-
await writeIfMissing(join(root, ".gitignore"), gitignoreTemplate());
|
|
256
|
-
await writeIfMissing(join(root, "data", "decisions.yml"), "decisions: []\n");
|
|
257
|
-
await writeIfMissing(join(root, "content", "methodology.md"), "# Methodology\n\nGrove uses repository metadata as a signal. Human curation decisions control final visibility.\n");
|
|
258
|
-
// Always-on workflows (safe for both private and public projects)
|
|
259
|
-
await writeIfMissing(join(root, ".github", "workflows", "validate-data.yml"), workflowValidate());
|
|
260
|
-
// The build workflow's deploy step depends on the chosen provider.
|
|
261
|
-
// For `github-pages` we keep the Pages deploy inline (the original
|
|
262
|
-
// V1 behaviour). For `vercel` / `netlify` / `cloudflare` / `none`
|
|
263
|
-
// we write a thin build workflow + a separate deploy workflow (or
|
|
264
|
-
// skip the deploy workflow entirely for `none`).
|
|
265
|
-
await writeIfMissing(join(root, ".github", "workflows", "build.yml"), workflowBuild(framework, deploy));
|
|
266
|
-
// Provider-specific config files (vercel.json, netlify.toml, wrangler.jsonc).
|
|
267
|
-
// These live at the project root and are picked up automatically by
|
|
268
|
-
// the provider's CLI / build hook.
|
|
269
|
-
for (const file of deployConfigFiles(deploy, projectName)) {
|
|
270
|
-
await writeIfMissing(join(root, file.path), file.content);
|
|
271
|
-
}
|
|
272
|
-
// For vercel / netlify / cloudflare we also write a GitHub Actions
|
|
273
|
-
// workflow that triggers the provider's deploy on push to main.
|
|
274
|
-
// (`github-pages` deploys inline in build.yml; `none` skips this.)
|
|
275
|
-
if (deploy === "vercel" || deploy === "netlify" || deploy === "cloudflare") {
|
|
276
|
-
await writeIfMissing(join(root, ".github", "workflows", `deploy-${deploy}.yml`), workflowDeploy(deploy));
|
|
277
|
-
}
|
|
278
|
-
// Issue templates — both modes support a basic set
|
|
279
|
-
await writeIfMissing(join(root, ".github", "ISSUE_TEMPLATE", "record_submission.md"), issueTemplateSubmission(blueprint));
|
|
280
|
-
await writeIfMissing(join(root, ".github", "ISSUE_TEMPLATE", "bug_report.md"), issueTemplateBug());
|
|
281
|
-
await writeIfMissing(join(root, ".github", "ISSUE_TEMPLATE", "feature_request.md"), issueTemplateFeature());
|
|
282
|
-
// Public-GitHub-only workflows and templates
|
|
283
|
-
if (githubMode === "public") {
|
|
284
|
-
await writeIfMissing(join(root, ".github", "workflows", "sync-github-metadata.yml"), workflowSyncGithubMetadata());
|
|
285
|
-
await writeIfMissing(join(root, ".github", "workflows", "sync-contributors.yml"), workflowSyncContributors());
|
|
286
|
-
await writeIfMissing(join(root, ".github", "workflows", "cleanup-stale-records.yml"), workflowCleanupStaleRecords());
|
|
287
|
-
await writeIfMissing(join(root, ".github", "workflows", "update-records.yml"), workflowUpdateRecords());
|
|
288
|
-
await writeIfMissing(join(root, ".github", "ISSUE_TEMPLATE", "report-broken-record.md"), issueTemplateBrokenRecord());
|
|
289
|
-
await writeIfMissing(join(root, ".github", "pull_request_template.md"), pullRequestTemplate());
|
|
290
|
-
}
|
|
291
|
-
await writeIfMissing(join(root, "LICENSE"), licenseMIT(projectName));
|
|
292
|
-
s.stop("Scaffolded");
|
|
293
|
-
if (initGit) {
|
|
294
|
-
try {
|
|
295
|
-
await runExternal("git", ["init", "-b", "main"], { stdio: "ignore", cwd: root });
|
|
296
|
-
p.log.step("Initialized git repo on `main`");
|
|
297
|
-
}
|
|
298
|
-
catch {
|
|
299
|
-
p.log.warn("git not found — skipping git init");
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
if (installDeps) {
|
|
303
|
-
const installSpinner = p.spinner();
|
|
304
|
-
installSpinner.start("Installing dependencies");
|
|
305
|
-
try {
|
|
306
|
-
await runExternal("pnpm", ["install"], { stdio: "ignore", cwd: root });
|
|
307
|
-
installSpinner.stop("Installed dependencies");
|
|
308
|
-
}
|
|
309
|
-
catch {
|
|
310
|
-
installSpinner.stop("Install failed");
|
|
311
|
-
p.log.warn(`Run \`pnpm install\` inside ${root} to retry.`);
|
|
312
|
-
// The scaffold succeeded but the install didn't — flag the
|
|
313
|
-
// partial-success state to the parent process. The outro
|
|
314
|
-
// still prints so the user sees the path + next steps, but
|
|
315
|
-
// the non-zero exit code means CI / shell wrappers can
|
|
316
|
-
// detect the failure and stop before calling `grove build`
|
|
317
|
-
// on a half-installed project. (Audit finding: a warning
|
|
318
|
-
// alone is silent failure for `grove new`.)
|
|
319
|
-
process.exitCode = 1;
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
const ghLabel = githubMode === "public"
|
|
323
|
-
? "public GitHub metadata (sync + cleanup + update workflows)"
|
|
324
|
-
: "none / private (only validate + build workflows)";
|
|
325
|
-
const deployLabel = deploy === "none"
|
|
326
|
-
? "none (no deploy workflow written)"
|
|
327
|
-
: `${deploy} workflow + config written`;
|
|
328
|
-
p.outro(`🌳 ${projectName} is ready at ${root}\n\n` +
|
|
329
|
-
`Blueprint: ${blueprint}\n` +
|
|
330
|
-
`GitHub mode: ${ghLabel}\n` +
|
|
331
|
-
`Deploy: ${deployLabel}\n\n` +
|
|
332
|
-
`Next steps:\n` +
|
|
333
|
-
` cd ${projectDir}\n` +
|
|
334
|
-
` grove validate\n` +
|
|
335
|
-
` grove generate\n` +
|
|
336
|
-
` grove build\n`);
|
|
337
|
-
});
|
|
338
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
339
|
-
// grove run — dev-only "pretend user" smoke test
|
|
340
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
341
|
-
//
|
|
342
|
-
// `grove new` is the production path: it copies the framework template
|
|
343
|
-
// into a fresh dir, keeps its published Grove package versions, and
|
|
344
|
-
// (optionally) installs + inits git.
|
|
345
|
-
//
|
|
346
|
-
// `grove run` is the dev / CI-internal path. It does almost the same
|
|
347
|
-
// scaffolding, but with two differences that make it useful when
|
|
348
|
-
// iterating on the monorepo:
|
|
349
|
-
//
|
|
350
|
-
// 1. Grove dependencies in the scaffolded `package.json` are
|
|
351
|
-
// rewritten to direct local links, so package changes are picked
|
|
352
|
-
// up by the next `grove run` without a publish step.
|
|
353
|
-
//
|
|
354
|
-
// 2. The scaffold lives INSIDE the monorepo, under
|
|
355
|
-
// `<monorepo-root>/.grove/run/<timestamp>/`. `.grove/*` is
|
|
356
|
-
// registered in `pnpm-workspace.yaml`, so root-level tooling can
|
|
357
|
-
// discover and operate on the generated project.
|
|
358
|
-
//
|
|
359
|
-
// After scaffolding and (optionally) installing, `grove run` can launch
|
|
360
|
-
// the framework dev server in-process. That makes end-to-end smoke
|
|
361
|
-
// tests a one-liner:
|
|
362
|
-
//
|
|
363
|
-
// grove run dev # scaffold → install → astro dev
|
|
364
|
-
// grove run build # scaffold → install → astro build
|
|
365
|
-
// grove run init --no-install # just scaffold, fix deps manually
|
|
366
|
-
//
|
|
367
|
-
// V1 only supports `astro` because that's the only framework with a
|
|
368
|
-
// real template + peer wiring. `nextjs` and `svelte` are not exposed as
|
|
369
|
-
// scaffold options in V1 — they exist as skeleton packages but their
|
|
370
|
-
// templates have no real pages / components / layouts.
|
|
371
|
-
program
|
|
372
|
-
.command("run")
|
|
373
|
-
.argument("[action]", "run action: dev (default) | build | init", "dev")
|
|
374
|
-
.argument("[name]", "project directory name (default: grove-run-<timestamp>)")
|
|
375
|
-
.description("Scaffold a Grove project from the LOCAL workspace template and run it.")
|
|
376
|
-
.option("-f, --framework <name>", "framework: astro (V1: astro only — nextjs/svelte roadmap)", "astro")
|
|
377
|
-
.option("-t, --template <name>", "template name", "default")
|
|
378
|
-
.option("-d, --dir <name>", "project directory name (overrides positional name; relative to monorepo root)")
|
|
379
|
-
.option("--no-install", "skip `pnpm install` after scaffolding")
|
|
380
|
-
.option("--no-git", "skip `git init` after scaffolding")
|
|
381
|
-
.option("--port <port>", "dev server port (only used by `dev` action; passed to astro dev; 1-65535)", (value) => {
|
|
382
|
-
// Commander passes the raw string here. We accept decimal
|
|
383
|
-
// integers, reject floats, NaN, and out-of-range values.
|
|
384
|
-
// Throwing makes commander surface the message AND exit 1
|
|
385
|
-
// before the action handler runs — exactly the behaviour the
|
|
386
|
-
// audit wanted (a non-integer or out-of-range port used to
|
|
387
|
-
// silently become `NaN`, which astro dev then printed as
|
|
388
|
-
// `--port NaN` and refused to bind).
|
|
389
|
-
const port = Number(value);
|
|
390
|
-
if (!Number.isInteger(port) || port < 1 || port > 65535) {
|
|
391
|
-
throw new Error(`Invalid --port: "${value}" is not an integer in 1..65535.`);
|
|
392
|
-
}
|
|
393
|
-
return port;
|
|
394
|
-
})
|
|
395
|
-
.action(async (action, name, opts) => {
|
|
396
|
-
// ── Validate action ────────────────────────────────────────────
|
|
397
|
-
const validActions = ["dev", "build", "init"];
|
|
398
|
-
if (!validActions.includes(action)) {
|
|
399
|
-
p.log.error(`Unknown run action: ${action}.`);
|
|
400
|
-
p.log.info(`Try one of: ${validActions.join(", ")}`);
|
|
401
|
-
process.exit(1);
|
|
402
|
-
}
|
|
403
|
-
const runAction = action;
|
|
404
|
-
// ── Validate framework ─────────────────────────────────────────
|
|
405
|
-
if (!isFramework(opts.framework)) {
|
|
406
|
-
p.log.error(`Unknown framework: ${opts.framework}.`);
|
|
407
|
-
p.log.info(`Try one of: ${SUPPORTED_FRAMEWORKS.join(", ")}`);
|
|
408
|
-
process.exit(1);
|
|
409
|
-
}
|
|
410
|
-
const framework = opts.framework;
|
|
411
|
-
const _exhaustive = framework;
|
|
412
|
-
p.intro(`🧪 Grove run — ${runAction}`);
|
|
413
|
-
// ── Locate the monorepo root ───────────────────────────────────
|
|
414
|
-
// We need the monorepo root so we can:
|
|
415
|
-
// (a) decide where to put the scaffolded project (always
|
|
416
|
-
// inside the monorepo, under `.grove/run/<stamp>/`)
|
|
417
|
-
// (b) run `pnpm install --filter` from there, so the
|
|
418
|
-
// workspace protocol resolves `packages/*` siblings.
|
|
419
|
-
const cliLocation = dirname(fileURLToPath(import.meta.url));
|
|
420
|
-
let monorepoRoot;
|
|
421
|
-
try {
|
|
422
|
-
monorepoRoot = findMonorepoRoot(cliLocation);
|
|
423
|
-
}
|
|
424
|
-
catch (err) {
|
|
425
|
-
p.log.error(err.message);
|
|
426
|
-
process.exit(1);
|
|
427
|
-
}
|
|
428
|
-
p.log.info(`Monorepo root: ${monorepoRoot}`);
|
|
429
|
-
// ── Resolve target directory ───────────────────────────────────
|
|
430
|
-
// If the caller did not pin a project (no `--dir`, no positional
|
|
431
|
-
// name), reuse an existing scaffold under `.grove/run/` so that
|
|
432
|
-
// repeat invocations of `pnpm grove:dev` / `grove:build` don't
|
|
433
|
-
// pile up a new timestamped folder on every run.
|
|
434
|
-
//
|
|
435
|
-
// Selection rules when no name is given:
|
|
436
|
-
// - 0 existing scaffolds → fall back to a fresh timestamped name.
|
|
437
|
-
// - 1 existing scaffold → use it.
|
|
438
|
-
// - 2+ existing scaffolds → refuse and ask the caller to pass
|
|
439
|
-
// `--dir <name>` so we don't pick
|
|
440
|
-
// silently and surprise the user.
|
|
441
|
-
const runRoot = resolve(monorepoRoot, ".grove", "run");
|
|
442
|
-
let dirRel;
|
|
443
|
-
if (opts.dir) {
|
|
444
|
-
dirRel = opts.dir;
|
|
445
|
-
}
|
|
446
|
-
else if (name) {
|
|
447
|
-
dirRel = name;
|
|
448
|
-
}
|
|
449
|
-
else {
|
|
450
|
-
const existing = [];
|
|
451
|
-
try {
|
|
452
|
-
const entries = await readdir(runRoot, { withFileTypes: true });
|
|
453
|
-
for (const entry of entries) {
|
|
454
|
-
if (!entry.isDirectory())
|
|
455
|
-
continue;
|
|
456
|
-
// Only count it as a scaffold if it has a package.json —
|
|
457
|
-
// that's the same sentinel `run` uses to detect a previous
|
|
458
|
-
// scaffold, so we stay consistent with the "is this
|
|
459
|
-
// reusable?" check below.
|
|
460
|
-
try {
|
|
461
|
-
await access(join(runRoot, entry.name, "package.json"));
|
|
462
|
-
existing.push(entry.name);
|
|
463
|
-
}
|
|
464
|
-
catch {
|
|
465
|
-
/* not a scaffold, skip */
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
catch {
|
|
470
|
-
/* runRoot doesn't exist yet — we'll create it */
|
|
471
|
-
}
|
|
472
|
-
if (existing.length === 0) {
|
|
473
|
-
const stamp = new Date()
|
|
474
|
-
.toISOString()
|
|
475
|
-
.replace(/[-:]/g, "")
|
|
476
|
-
.replace(/\..+$/, "")
|
|
477
|
-
.replace("T", "-");
|
|
478
|
-
dirRel = `grove-run-${stamp}`;
|
|
479
|
-
}
|
|
480
|
-
else if (existing.length === 1) {
|
|
481
|
-
const only = existing[0];
|
|
482
|
-
if (only) {
|
|
483
|
-
dirRel = only;
|
|
484
|
-
p.log.info(`Reusing scaffold: ${dirRel} (pass --dir <name> to override)`);
|
|
485
|
-
}
|
|
486
|
-
else {
|
|
487
|
-
dirRel = "grove-run-default";
|
|
488
|
-
}
|
|
489
|
-
}
|
|
490
|
-
else {
|
|
491
|
-
p.log.error(`Found ${existing.length} scaffolds under .grove/run/. ` +
|
|
492
|
-
`Pass --dir <name> to pick one:`);
|
|
493
|
-
for (const e of existing.sort())
|
|
494
|
-
p.log.info(` - ${e}`);
|
|
495
|
-
process.exit(1);
|
|
496
|
-
}
|
|
497
|
-
}
|
|
498
|
-
// Always live under <monorepo-root>/.grove/run/<name>/ so the
|
|
499
|
-
// workspace picks it up via the `.grove/*` glob in
|
|
500
|
-
// `pnpm-workspace.yaml`.
|
|
501
|
-
const root = resolve(monorepoRoot, ".grove", "run", dirRel);
|
|
502
|
-
// The dir name and the package.json `name` are not the same —
|
|
503
|
-
// `packageNameFromProjectName` slugifies the dir name and appends
|
|
504
|
-
// `-<framework>-<template>`. We need the package name to drive
|
|
505
|
-
// `pnpm --filter`, so compute it once and reuse.
|
|
506
|
-
const projectName = root.split("/").filter(Boolean).pop() ?? dirRel;
|
|
507
|
-
// ── Look up the LOCAL template via @grove-dev/<framework>'s
|
|
508
|
-
// `templates/<name>` directory. Inside this monorepo, that
|
|
509
|
-
// is a symlink straight to packages/astro/templates/default/,
|
|
510
|
-
// so a template change in the source tree flows through to
|
|
511
|
-
// the scaffolded project with no publish step. ─────────────
|
|
512
|
-
const templates = await listTemplates(framework);
|
|
513
|
-
const tpl = templates.find((t) => t.template === opts.template) ?? templates[0];
|
|
514
|
-
if (!tpl) {
|
|
515
|
-
p.log.error(`No templates found for ${framework}.`);
|
|
516
|
-
process.exit(1);
|
|
517
|
-
}
|
|
518
|
-
p.log.info(`Template: ${tpl.path}`);
|
|
519
|
-
const packageName = packageNameFromProjectName(projectName, framework, tpl.template);
|
|
520
|
-
p.log.info(`Project: ${projectName} (package: ${packageName}) → ${root}`);
|
|
521
|
-
// ── Scaffold (or reuse an existing scaffold) ──────────────────
|
|
522
|
-
// If the target dir already contains the expected package, this
|
|
523
|
-
// is a re-run. Refresh template-owned files in place so edits to
|
|
524
|
-
// the local adapter are visible immediately; node_modules and
|
|
525
|
-
// generated data are excluded by copyTemplate and stay reusable.
|
|
526
|
-
const sentinel = join(root, "package.json");
|
|
527
|
-
let alreadyScaffolded = false;
|
|
528
|
-
try {
|
|
529
|
-
const existing = JSON.parse(await readFile(sentinel, "utf8"));
|
|
530
|
-
const expectedName = packageNameFromProjectName(projectName, framework, tpl.template);
|
|
531
|
-
alreadyScaffolded = existing.name === expectedName;
|
|
532
|
-
}
|
|
533
|
-
catch {
|
|
534
|
-
alreadyScaffolded = false;
|
|
535
|
-
}
|
|
536
|
-
const s = p.spinner();
|
|
537
|
-
if (alreadyScaffolded) {
|
|
538
|
-
s.start("Refreshing scaffold from local template");
|
|
539
|
-
await copyTemplate(framework, root, tpl.template, { force: true });
|
|
540
|
-
await renameProjectInTemplate(framework, root, projectName, tpl.template, { mode: "file" });
|
|
541
|
-
s.stop("Refreshed scaffold (local package deps)");
|
|
542
|
-
}
|
|
543
|
-
else {
|
|
544
|
-
s.start("Scaffolding");
|
|
545
|
-
await mkdir(root, { recursive: true });
|
|
546
|
-
await copyTemplate(framework, root, tpl.template);
|
|
547
|
-
// Use local package paths for the dev-only run path. Installing
|
|
548
|
-
// the generated project as a standalone package avoids pnpm's
|
|
549
|
-
// workspace discovery cache when a project appears mid-command.
|
|
550
|
-
await renameProjectInTemplate(framework, root, projectName, tpl.template, { mode: "file" });
|
|
551
|
-
s.stop("Scaffolded (local package deps)");
|
|
552
|
-
}
|
|
553
|
-
// ── git init ───────────────────────────────────────────────────
|
|
554
|
-
if (opts.git !== false) {
|
|
555
|
-
try {
|
|
556
|
-
await runExternal("git", ["init", "-b", "main"], { stdio: "ignore", cwd: root });
|
|
557
|
-
p.log.step("Initialized git repo on `main`");
|
|
558
|
-
}
|
|
559
|
-
catch {
|
|
560
|
-
p.log.warn("git not found — skipping git init");
|
|
561
|
-
}
|
|
562
|
-
}
|
|
563
|
-
// ── pnpm install (from monorepo root, scoped to this project) ──
|
|
564
|
-
if (opts.install !== false) {
|
|
565
|
-
const installSpinner = p.spinner();
|
|
566
|
-
installSpinner.start("Installing dependencies");
|
|
567
|
-
try {
|
|
568
|
-
await runExternal("pnpm", ["install", "--ignore-workspace"], {
|
|
569
|
-
stdio: "ignore",
|
|
570
|
-
cwd: root,
|
|
571
|
-
});
|
|
572
|
-
installSpinner.stop("Installed dependencies");
|
|
573
|
-
}
|
|
574
|
-
catch {
|
|
575
|
-
installSpinner.stop("Install failed");
|
|
576
|
-
p.log.warn(`Run \`pnpm install --ignore-workspace\` from ${root} to retry.`);
|
|
577
|
-
if (runAction !== "init") {
|
|
578
|
-
p.log.error("Cannot continue without a working install.");
|
|
579
|
-
process.exit(1);
|
|
580
|
-
}
|
|
581
|
-
// For `grove run init` we still want a non-zero exit so CI
|
|
582
|
-
// / shell wrappers can detect the partial-success state
|
|
583
|
-
// (audit finding: warnings alone are silent failures).
|
|
584
|
-
process.exitCode = 1;
|
|
585
|
-
}
|
|
586
|
-
}
|
|
587
|
-
// ── Run the requested action ───────────────────────────────────
|
|
588
|
-
if (runAction === "init") {
|
|
589
|
-
p.outro(`🌳 Scaffolded at ${root}\n\n` +
|
|
590
|
-
`Next steps:\n` +
|
|
591
|
-
` cd ${root}\n` +
|
|
592
|
-
` pnpm dev\n`);
|
|
593
|
-
return;
|
|
594
|
-
}
|
|
595
|
-
if (runAction === "build") {
|
|
596
|
-
// Run the template's `build` script, not `astro build` directly.
|
|
597
|
-
// The script chains `build:data` + `build:sitemap` + `build:llms`
|
|
598
|
-
// + `astro build` so the data is generated first. Skipping that
|
|
599
|
-
// chain gives you a half-built site with no records.
|
|
600
|
-
p.log.step(`Building ${packageName} via 'pnpm run build' (this can take a while)…`);
|
|
601
|
-
await runExternal("pnpm", ["--filter", packageName, "run", "build"], {
|
|
602
|
-
stdio: "inherit",
|
|
603
|
-
cwd: monorepoRoot,
|
|
604
|
-
});
|
|
605
|
-
p.outro(`🌳 Build done at ${root}`);
|
|
606
|
-
return;
|
|
607
|
-
}
|
|
608
|
-
// runAction === "dev" — start the dev server in-process.
|
|
609
|
-
//
|
|
610
|
-
// The template's `dev` script chains `build:data && astro dev`,
|
|
611
|
-
// which is what we want for a production user. But for a dev
|
|
612
|
-
// smoke test, the script's `&&` makes pnpm's `--` forwarding
|
|
613
|
-
// land in a tricky place: `pnpm run dev -- --port 4327` becomes
|
|
614
|
-
// `astro dev -- --port 4327`, where Astro treats `--port 4327`
|
|
615
|
-
// as positional args (port flag ignored).
|
|
616
|
-
//
|
|
617
|
-
// Cleanest workaround: run `build:data` separately (the only
|
|
618
|
-
// pre-step `dev` does), then `pnpm exec astro dev` directly with
|
|
619
|
-
// the port flag in the right place. Two `runExternal` calls is
|
|
620
|
-
// fine — they're both fast (`build:data` is a quick
|
|
621
|
-
// `grove generate`, and `astro dev` is what the user actually
|
|
622
|
-
// wants to see).
|
|
623
|
-
const port = typeof opts.port === "number" ? opts.port : 4321;
|
|
624
|
-
p.log.step(`Generating data via 'pnpm run build:data'…`);
|
|
625
|
-
try {
|
|
626
|
-
await runExternal("pnpm", ["--filter", packageName, "run", "build:data"], { stdio: "inherit", cwd: monorepoRoot });
|
|
627
|
-
}
|
|
628
|
-
catch {
|
|
629
|
-
p.log.warn(`build:data failed — starting astro dev anyway, site will be empty.`);
|
|
630
|
-
}
|
|
631
|
-
p.log.step(`Starting astro dev on port ${port} (Ctrl-C to stop)…`);
|
|
632
|
-
await runExternal("pnpm", ["--filter", packageName, "exec", "astro", "dev", "--port", String(port)], { stdio: "inherit", cwd: monorepoRoot });
|
|
633
|
-
});
|
|
634
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
635
|
-
// grove import
|
|
636
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
24
|
+
.description("Build and maintain a Grove-powered directory.")
|
|
25
|
+
.version(readCliVersion());
|
|
637
26
|
program
|
|
638
|
-
.command("
|
|
639
|
-
.argument("
|
|
640
|
-
.description("
|
|
641
|
-
.
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
const
|
|
645
|
-
await
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
tags: [],
|
|
655
|
-
links: record.links,
|
|
656
|
-
source: { type: "import" },
|
|
657
|
-
};
|
|
658
|
-
if (expectedKind === "project") {
|
|
659
|
-
yamlObj.name = record.name;
|
|
660
|
-
}
|
|
661
|
-
else if (expectedKind === "resource") {
|
|
662
|
-
yamlObj.title = record.name;
|
|
663
|
-
yamlObj.type = "link";
|
|
664
|
-
yamlObj.topic = record.category;
|
|
665
|
-
}
|
|
666
|
-
else if (expectedKind === "entity") {
|
|
667
|
-
yamlObj.name = record.name;
|
|
668
|
-
yamlObj.type = "other";
|
|
669
|
-
}
|
|
670
|
-
const path = join(recordsDir, `${record.slug}.yml`);
|
|
671
|
-
await writeFile(path, stringifyRecordYaml(yamlObj), "utf8");
|
|
672
|
-
written++;
|
|
673
|
-
}
|
|
674
|
-
console.log(`Imported ${written} record(s) into ${recordsDir}`);
|
|
27
|
+
.command("init")
|
|
28
|
+
.argument("[directory]", "directory to create", ".")
|
|
29
|
+
.description("Create a complete Grove directory from the official site.")
|
|
30
|
+
.option("--no-install", "skip pnpm install")
|
|
31
|
+
.option("--no-git", "skip git init")
|
|
32
|
+
.action(async (directory, options) => {
|
|
33
|
+
const target = resolve(process.cwd(), directory);
|
|
34
|
+
const result = await initDirectory(target, {
|
|
35
|
+
...(directory === "." ? {} : { projectName: basename(resolve(directory)) }),
|
|
36
|
+
});
|
|
37
|
+
console.log(`Created ${result.projectName} in ${result.targetDir}`);
|
|
38
|
+
if (options.install)
|
|
39
|
+
await run("pnpm", ["install"], target);
|
|
40
|
+
if (options.git)
|
|
41
|
+
await run("git", ["init"], target);
|
|
42
|
+
console.log(`\nNext:\n cd ${directory}\n pnpm dev`);
|
|
675
43
|
});
|
|
676
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
677
|
-
// grove validate
|
|
678
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
679
44
|
program
|
|
680
|
-
.command("
|
|
681
|
-
.description("Validate
|
|
682
|
-
.option("--strict", "
|
|
683
|
-
.action(async (
|
|
45
|
+
.command("check")
|
|
46
|
+
.description("Validate data, generate artifacts, and run Astro checks.")
|
|
47
|
+
.option("--strict", "treat Grove warnings as errors")
|
|
48
|
+
.action(async (options) => {
|
|
684
49
|
const config = await loadConfig();
|
|
685
|
-
const result = await validateProject(config,
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
50
|
+
const result = await validateProject(config, {
|
|
51
|
+
...(options.strict === undefined ? {} : { strict: options.strict }),
|
|
52
|
+
});
|
|
53
|
+
for (const issue of result.issues) {
|
|
54
|
+
const output = issue.severity === "error" ? console.error : console.warn;
|
|
55
|
+
output(`[${issue.severity}] ${issue.code}: ${issue.message}`);
|
|
691
56
|
}
|
|
692
|
-
if (!result.ok) {
|
|
57
|
+
if (!result.ok || (options.strict && result.warnings.length > 0)) {
|
|
693
58
|
process.exitCode = 1;
|
|
694
|
-
const total = result.issues.length;
|
|
695
|
-
const errorCount = result.errors.length;
|
|
696
|
-
const warnCount = result.warnings.length;
|
|
697
|
-
console.log(`Validation failed with ${errorCount} error(s) and ${warnCount} warning(s) (${total} total).`);
|
|
698
59
|
return;
|
|
699
60
|
}
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
else {
|
|
704
|
-
console.log("Validation passed.");
|
|
705
|
-
}
|
|
706
|
-
});
|
|
707
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
708
|
-
// grove generate
|
|
709
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
710
|
-
program
|
|
711
|
-
.command("generate")
|
|
712
|
-
.description("Build data/generated/records.{full,index}.json from data/records/*.yml.")
|
|
713
|
-
.action(async () => {
|
|
714
|
-
const result = await generate();
|
|
715
|
-
console.log(`[generate] ${result.totalRecords} total, ${result.visibleRecords} visible\n` +
|
|
716
|
-
` full: ${result.fullPath}\n` +
|
|
717
|
-
` index: ${result.indexPath}\n` +
|
|
718
|
-
` alias: ${result.aliasPath}`);
|
|
61
|
+
const prepared = await prepareDirectory();
|
|
62
|
+
console.log(`[grove] ${prepared.generated.totalRecords} records prepared; sitemap and llms files updated.`);
|
|
63
|
+
await run("pnpm", ["exec", "astro", "check"]);
|
|
719
64
|
});
|
|
720
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
721
|
-
// grove sitemap
|
|
722
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
723
|
-
program
|
|
724
|
-
.command("sitemap")
|
|
725
|
-
.description("Generate public/sitemap.xml from data/generated/records.full.json.")
|
|
726
|
-
.action(async () => {
|
|
727
|
-
const config = await loadConfig();
|
|
728
|
-
const { buildSitemap } = await import("@grove-dev/core");
|
|
729
|
-
const recordsPath = join(process.cwd(), config.paths.generatedDir, "records.full.json");
|
|
730
|
-
let payload;
|
|
731
|
-
try {
|
|
732
|
-
payload = JSON.parse(await readFile(recordsPath, "utf8"));
|
|
733
|
-
}
|
|
734
|
-
catch {
|
|
735
|
-
payload = { records: [] };
|
|
736
|
-
}
|
|
737
|
-
const items = (payload.records ?? []);
|
|
738
|
-
const result = await buildSitemap({
|
|
739
|
-
generatedAt: payload.generatedAt ?? new Date().toISOString(),
|
|
740
|
-
items,
|
|
741
|
-
});
|
|
742
|
-
console.log(`[sitemap] wrote ${result.urlCount} URLs → ${result.path}`);
|
|
743
|
-
});
|
|
744
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
745
|
-
// grove llms
|
|
746
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
747
|
-
program
|
|
748
|
-
.command("llms")
|
|
749
|
-
.description("Generate public/llms.txt and public/llms-full.txt.")
|
|
750
|
-
.action(async () => {
|
|
751
|
-
const config = await loadConfig();
|
|
752
|
-
const { buildLlmsFiles } = await import("@grove-dev/core");
|
|
753
|
-
const recordsPath = join(process.cwd(), config.paths.generatedDir, "records.full.json");
|
|
754
|
-
let payload;
|
|
755
|
-
try {
|
|
756
|
-
payload = JSON.parse(await readFile(recordsPath, "utf8"));
|
|
757
|
-
}
|
|
758
|
-
catch {
|
|
759
|
-
payload = { records: [] };
|
|
760
|
-
}
|
|
761
|
-
const records = (payload.records ?? []);
|
|
762
|
-
const result = await buildLlmsFiles({
|
|
763
|
-
generatedAt: payload.generatedAt ?? new Date().toISOString(),
|
|
764
|
-
records: records.map((r) => {
|
|
765
|
-
// Build the optional fields conditionally so we never assign
|
|
766
|
-
// `undefined` to a property typed as `string` (breaks
|
|
767
|
-
// `exactOptionalPropertyTypes` in the consumer's types).
|
|
768
|
-
const base = {
|
|
769
|
-
slug: r.slug,
|
|
770
|
-
name: r.name ?? r.title ?? r.slug,
|
|
771
|
-
};
|
|
772
|
-
if (r.description !== undefined)
|
|
773
|
-
base.description = r.description;
|
|
774
|
-
if (r.category !== undefined)
|
|
775
|
-
base.category = r.category;
|
|
776
|
-
if (r.stack !== undefined)
|
|
777
|
-
base.stack = r.stack;
|
|
778
|
-
if (r.stars !== undefined)
|
|
779
|
-
base.stars = r.stars;
|
|
780
|
-
if (r.visibility !== undefined)
|
|
781
|
-
base.visibility = r.visibility;
|
|
782
|
-
return base;
|
|
783
|
-
}),
|
|
784
|
-
});
|
|
785
|
-
console.log(`[llms] ${result.indexed} indexed → ${result.txtPath} + ${result.fullPath}`);
|
|
786
|
-
});
|
|
787
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
788
|
-
// grove sync github
|
|
789
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
790
65
|
program
|
|
791
66
|
.command("sync")
|
|
792
67
|
.argument("<target>", "github | contributors")
|
|
793
|
-
.description("
|
|
794
|
-
.option("--limit <
|
|
795
|
-
.option("--strict", "fail
|
|
68
|
+
.description("Refresh GitHub metadata owned by Grove.")
|
|
69
|
+
.option("--limit <count>", "limit records to sync", Number)
|
|
70
|
+
.option("--strict", "fail if any GitHub record cannot be refreshed")
|
|
796
71
|
.action(async (target, options) => {
|
|
797
72
|
const config = await loadConfig();
|
|
798
|
-
if (target !== "github" && target !== "contributors") {
|
|
799
|
-
console.error(`Unknown sync target: ${target}. Use "github" or "contributors".`);
|
|
800
|
-
process.exit(1);
|
|
801
|
-
}
|
|
802
73
|
if (target === "contributors") {
|
|
803
|
-
|
|
74
|
+
await prepareDirectory();
|
|
804
75
|
const result = await syncContributors({
|
|
805
76
|
cwd: process.cwd(),
|
|
806
77
|
generatedDir: config.paths.generatedDir,
|
|
78
|
+
...(config.site.repoUrl ? { repoUrl: config.site.repoUrl } : {}),
|
|
807
79
|
});
|
|
808
|
-
console.log(`[sync contributors] ${result.contributors} contributors from `
|
|
809
|
-
`${result.repositories} repositories → ${result.outputPath}` +
|
|
810
|
-
(result.failed ? ` (${result.failed} failed)` : ""));
|
|
80
|
+
console.log(`[sync contributors] ${result.contributors} contributors from ${result.repositories} repository → ${result.outputPath}`);
|
|
811
81
|
return;
|
|
812
82
|
}
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
let entries = [];
|
|
816
|
-
try {
|
|
817
|
-
entries = await readdir(recordsDir);
|
|
818
|
-
}
|
|
819
|
-
catch {
|
|
820
|
-
console.error(`[sync github] ${recordsDir} does not exist.`);
|
|
821
|
-
process.exit(1);
|
|
83
|
+
if (target !== "github") {
|
|
84
|
+
throw new Error(`Unknown sync target "${target}". Use github or contributors.`);
|
|
822
85
|
}
|
|
823
|
-
const
|
|
824
|
-
const
|
|
86
|
+
const recordsDir = resolve(process.cwd(), config.paths.recordsDir);
|
|
87
|
+
const files = (await readdir(recordsDir))
|
|
88
|
+
.filter((file) => file.endsWith(".yml"))
|
|
89
|
+
.sort();
|
|
90
|
+
const selected = options.limit === undefined ? files : files.slice(0, options.limit);
|
|
825
91
|
let updated = 0;
|
|
826
92
|
let htmlOnly = 0;
|
|
827
93
|
let failed = 0;
|
|
828
94
|
for (const file of selected) {
|
|
829
|
-
const
|
|
830
|
-
const
|
|
831
|
-
const raw = (parseYaml(text) ?? {});
|
|
832
|
-
// Canonical repo URL: `repoUrl` first (the project-directory
|
|
833
|
-
// canonical field per the schema), then fall back to
|
|
834
|
-
// `links.github` for sites that only use the human-facing link.
|
|
835
|
-
// When both are present and disagree, warn loudly — a curator
|
|
836
|
-
// who updated only `links.github` and forgot `repoUrl` would
|
|
837
|
-
// otherwise see stale metadata with no explanation.
|
|
95
|
+
const filePath = join(recordsDir, file);
|
|
96
|
+
const raw = (parseYaml(await readFile(filePath, "utf8")) ?? {});
|
|
838
97
|
const links = raw.links ?? {};
|
|
839
|
-
const
|
|
840
|
-
const linksGithub = links.github;
|
|
841
|
-
if (rawRepoUrl &&
|
|
842
|
-
linksGithub &&
|
|
843
|
-
rawRepoUrl.trim() !== linksGithub.trim()) {
|
|
844
|
-
process.stderr.write(`[sync github] ${file}: repoUrl "${rawRepoUrl}" and links.github "${linksGithub}" disagree — using repoUrl. Update repoUrl (or remove it) to silence this.\n`);
|
|
845
|
-
}
|
|
846
|
-
const repoUrl = rawRepoUrl ?? linksGithub ?? null;
|
|
98
|
+
const repoUrl = raw.repoUrl ?? links.github;
|
|
847
99
|
if (!repoUrl) {
|
|
848
|
-
|
|
100
|
+
console.log(`[sync github] ${file}: no repository, skipped`);
|
|
849
101
|
continue;
|
|
850
102
|
}
|
|
851
103
|
const ref = parseGithubRepoUrl(repoUrl);
|
|
852
104
|
if (!ref) {
|
|
853
|
-
|
|
105
|
+
console.log(`[sync github] ${file}: invalid GitHub URL, skipped`);
|
|
854
106
|
continue;
|
|
855
107
|
}
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
// skip the file (both fail). The `sync` block records which
|
|
860
|
-
// path the data came from so downstream consumers can tell
|
|
861
|
-
// full metadata from partial.
|
|
862
|
-
const gh = raw.github ?? {};
|
|
863
|
-
const githubPatch = {};
|
|
864
|
-
let syncSource = null;
|
|
108
|
+
const github = raw.github ?? {};
|
|
109
|
+
const patch = {};
|
|
110
|
+
let source;
|
|
865
111
|
try {
|
|
866
112
|
const metadata = await fetchGithubMetadata(ref);
|
|
867
113
|
if (metadata) {
|
|
868
|
-
|
|
114
|
+
patch.repository = {
|
|
869
115
|
full_name: metadata.fullName,
|
|
870
116
|
stargazers_count: metadata.stars,
|
|
871
117
|
forks_count: metadata.forks,
|
|
@@ -878,1141 +124,59 @@ program
|
|
|
878
124
|
: null,
|
|
879
125
|
topics: metadata.topics,
|
|
880
126
|
};
|
|
881
|
-
|
|
127
|
+
source = "api";
|
|
882
128
|
}
|
|
883
129
|
}
|
|
884
130
|
catch {
|
|
885
|
-
//
|
|
131
|
+
// The token-free HTML fallback below keeps scheduled syncs useful.
|
|
886
132
|
}
|
|
887
|
-
if (
|
|
133
|
+
if (!source) {
|
|
888
134
|
try {
|
|
889
135
|
const enriched = await enrichFromGithubHtml(repoUrl);
|
|
890
136
|
if (!enriched.notFound && !enriched.rateLimited && !enriched.error) {
|
|
891
|
-
|
|
137
|
+
patch.html = {
|
|
892
138
|
license: enriched.fields.license,
|
|
893
139
|
language: enriched.fields.language,
|
|
894
140
|
topics: enriched.fields.topics,
|
|
895
141
|
homepage: enriched.fields.homepage,
|
|
896
142
|
};
|
|
897
|
-
|
|
898
|
-
htmlOnly
|
|
143
|
+
source = "html";
|
|
144
|
+
htmlOnly += 1;
|
|
899
145
|
}
|
|
900
146
|
}
|
|
901
147
|
catch {
|
|
902
|
-
// both
|
|
148
|
+
// Report the record once both metadata sources have failed.
|
|
903
149
|
}
|
|
904
150
|
}
|
|
905
|
-
if (
|
|
906
|
-
|
|
907
|
-
|
|
151
|
+
if (!source) {
|
|
152
|
+
failed += 1;
|
|
153
|
+
console.log(`[sync github] ${file}: unavailable`);
|
|
908
154
|
continue;
|
|
909
155
|
}
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
};
|
|
914
|
-
const next = {
|
|
915
|
-
...raw,
|
|
916
|
-
github: { ...gh, ...githubPatch },
|
|
917
|
-
};
|
|
918
|
-
await writeFile(path, stringifyRecordYaml(next), "utf8");
|
|
919
|
-
process.stdout.write(syncSource === "api" ? "updated\n" : "html-fallback\n");
|
|
920
|
-
updated++;
|
|
156
|
+
patch.sync = { syncedAt: new Date().toISOString(), source };
|
|
157
|
+
await writeFile(filePath, stringifyRecordYaml({ ...raw, github: { ...github, ...patch } }), "utf8");
|
|
158
|
+
updated += 1;
|
|
159
|
+
console.log(`[sync github] ${file}: ${source}`);
|
|
921
160
|
}
|
|
922
|
-
console.log(
|
|
923
|
-
|
|
924
|
-
if (options.strict && failed > 0) {
|
|
161
|
+
console.log(`[sync github] ${updated} updated (${htmlOnly} HTML fallback), ${failed} failed`);
|
|
162
|
+
if (options.strict && failed > 0)
|
|
925
163
|
process.exitCode = 1;
|
|
926
|
-
console.error(`[sync github] --strict: ${failed} record(s) could not be synced.`);
|
|
927
|
-
}
|
|
928
164
|
});
|
|
929
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
930
|
-
// grove cleanup stale
|
|
931
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
932
165
|
program
|
|
933
166
|
.command("cleanup")
|
|
934
|
-
.
|
|
935
|
-
.
|
|
936
|
-
.
|
|
937
|
-
.option("--strict", "fail the run if any candidates need curation")
|
|
938
|
-
.action(async (target, opts) => {
|
|
939
|
-
if (target !== "stale") {
|
|
940
|
-
console.error(`Unknown cleanup target: ${target}. Use "stale".`);
|
|
941
|
-
process.exit(1);
|
|
942
|
-
}
|
|
167
|
+
.description("Write a report of records that need human review.")
|
|
168
|
+
.option("--strict", "fail when review candidates exist")
|
|
169
|
+
.action(async (options) => {
|
|
943
170
|
const { report, path } = await cleanupStale();
|
|
944
|
-
console.log(`[cleanup
|
|
945
|
-
for (const
|
|
946
|
-
console.log(` - ${
|
|
171
|
+
console.log(`[cleanup] ${report.totalCandidates} candidate(s) → ${path}`);
|
|
172
|
+
for (const candidate of report.candidates.slice(0, 10)) {
|
|
173
|
+
console.log(` - ${candidate.slug} (${candidate.status}, ${candidate.stars}★)`);
|
|
947
174
|
}
|
|
948
|
-
if (
|
|
175
|
+
if (options.strict && report.totalCandidates > 0)
|
|
949
176
|
process.exitCode = 1;
|
|
950
|
-
console.error(`[cleanup stale] --strict: ${report.totalCandidates} record(s) need human review.`);
|
|
951
|
-
}
|
|
952
|
-
});
|
|
953
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
954
|
-
// grove workflows sync
|
|
955
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
956
|
-
program
|
|
957
|
-
.command("workflows")
|
|
958
|
-
.argument("<action>", "sync")
|
|
959
|
-
.description("Sync Grove workflow templates into the current project.")
|
|
960
|
-
.option("--force", "overwrite existing workflow files")
|
|
961
|
-
.option("-d, --deploy <provider>", `deploy provider for the build workflow + config files: ${DEPLOY_PROVIDERS.join(" | ")} (default: github-pages)`)
|
|
962
|
-
.action(async (action, opts) => {
|
|
963
|
-
if (action !== "sync") {
|
|
964
|
-
console.error(`Unknown workflows action: ${action}. Use "sync".`);
|
|
965
|
-
process.exit(1);
|
|
966
|
-
}
|
|
967
|
-
const config = await loadConfig();
|
|
968
|
-
// config.integrations.github is the configured GitHub integration mode.
|
|
969
|
-
// `false` → "none" (private); anything else → "public".
|
|
970
|
-
const githubMode = config.integrations?.github === false || config.integrations?.github === undefined
|
|
971
|
-
? "none"
|
|
972
|
-
: "public";
|
|
973
|
-
// Validate the --deploy option. The previous implementation
|
|
974
|
-
// silently fell back to "github-pages" for any value not in
|
|
975
|
-
// DEPLOY_PROVIDERS — which is a footgun for scripted use: a
|
|
976
|
-
// typo (e.g. `--deploy vercels`) would write a Pages deploy
|
|
977
|
-
// workflow for a project the user explicitly targeted at
|
|
978
|
-
// Vercel. We now fail loudly with the valid set, and default
|
|
979
|
-
// to "github-pages" only when --deploy is omitted entirely
|
|
980
|
-
// (commander leaves the field `undefined` for the no-flag
|
|
981
|
-
// case). The default text moved to the help string above.
|
|
982
|
-
const deploy = parseDeployProvider(opts.deploy);
|
|
983
|
-
const root = process.cwd();
|
|
984
|
-
// Make sure the directories exist. `ensureDir` returns a
|
|
985
|
-
// promise; without `await`, the subsequent `writeFile` can race
|
|
986
|
-
// the directory creation on cold start.
|
|
987
|
-
await ensureDir(join(root, ".github", "workflows"));
|
|
988
|
-
await ensureDir(join(root, ".github", "ISSUE_TEMPLATE"));
|
|
989
|
-
const files = [
|
|
990
|
-
{ path: join(root, ".github", "workflows", "validate-data.yml"), content: workflowValidate() },
|
|
991
|
-
{ path: join(root, ".github", "workflows", "build.yml"), content: workflowBuild("astro", deploy) },
|
|
992
|
-
];
|
|
993
|
-
// Provider-specific deploy workflow (vercel / netlify / cloudflare).
|
|
994
|
-
// GitHub Pages deploys inline in build.yml; `none` writes nothing.
|
|
995
|
-
if (deploy === "vercel" || deploy === "netlify" || deploy === "cloudflare") {
|
|
996
|
-
files.push({
|
|
997
|
-
path: join(root, ".github", "workflows", `deploy-${deploy}.yml`),
|
|
998
|
-
content: workflowDeploy(deploy),
|
|
999
|
-
});
|
|
1000
|
-
}
|
|
1001
|
-
// Provider-specific config files at the project root.
|
|
1002
|
-
const projectName = config.site?.name ?? "Grove Directory";
|
|
1003
|
-
for (const file of deployConfigFiles(deploy, projectName)) {
|
|
1004
|
-
files.push({ path: join(root, file.path), content: file.content });
|
|
1005
|
-
}
|
|
1006
|
-
if (githubMode === "public") {
|
|
1007
|
-
files.push({ path: join(root, ".github", "workflows", "sync-github-metadata.yml"), content: workflowSyncGithubMetadata() }, { path: join(root, ".github", "workflows", "sync-contributors.yml"), content: workflowSyncContributors() }, { path: join(root, ".github", "workflows", "cleanup-stale-records.yml"), content: workflowCleanupStaleRecords() }, { path: join(root, ".github", "workflows", "update-records.yml"), content: workflowUpdateRecords() }, { path: join(root, ".github", "ISSUE_TEMPLATE", "report-broken-record.md"), content: issueTemplateBrokenRecord() }, { path: join(root, ".github", "pull_request_template.md"), content: pullRequestTemplate() });
|
|
1008
|
-
}
|
|
1009
|
-
let written = 0;
|
|
1010
|
-
let skipped = 0;
|
|
1011
|
-
for (const f of files) {
|
|
1012
|
-
if (!opts.force && (await existsLocal(f.path))) {
|
|
1013
|
-
skipped++;
|
|
1014
|
-
continue;
|
|
1015
|
-
}
|
|
1016
|
-
await writeFile(f.path, f.content, "utf8");
|
|
1017
|
-
written++;
|
|
1018
|
-
}
|
|
1019
|
-
console.log(`[workflows sync] ${githubMode} mode, deploy=${deploy}: ${written} written, ${skipped} skipped` +
|
|
1020
|
-
(opts.force ? " (--force)" : ""));
|
|
1021
|
-
});
|
|
1022
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
1023
|
-
// grove build / grove dev
|
|
1024
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
1025
|
-
program
|
|
1026
|
-
.command("build")
|
|
1027
|
-
.description("Build the static site in the current project repo.")
|
|
1028
|
-
.action(async () => {
|
|
1029
|
-
const framework = await detectFramework();
|
|
1030
|
-
const cmd = frameworkBuildCommand(framework);
|
|
1031
|
-
await runExternal(cmd[0], cmd[1], { stdio: "inherit" });
|
|
1032
|
-
});
|
|
1033
|
-
program
|
|
1034
|
-
.command("dev")
|
|
1035
|
-
.description("Start the framework dev server in the current project repo.")
|
|
1036
|
-
.action(async () => {
|
|
1037
|
-
const framework = await detectFramework();
|
|
1038
|
-
const cmd = frameworkDevCommand(framework);
|
|
1039
|
-
await runExternal(cmd[0], cmd[1], { stdio: "inherit" });
|
|
1040
|
-
});
|
|
1041
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
1042
|
-
// Framework discovery
|
|
1043
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
1044
|
-
async function detectFramework() {
|
|
1045
|
-
try {
|
|
1046
|
-
const pkg = JSON.parse(await readFile("package.json", "utf8"));
|
|
1047
|
-
const all = { ...(pkg.dependencies ?? {}), ...(pkg.devDependencies ?? {}) };
|
|
1048
|
-
if (all["@grove-dev/astro"])
|
|
1049
|
-
return "astro";
|
|
1050
|
-
}
|
|
1051
|
-
catch {
|
|
1052
|
-
/* ignore */
|
|
1053
|
-
}
|
|
1054
|
-
console.error("Could not detect a Grove framework in the current project.");
|
|
1055
|
-
console.error("Install @grove-dev/astro first. (V1 supports Astro only.)");
|
|
1056
|
-
process.exit(1);
|
|
1057
|
-
}
|
|
1058
|
-
function frameworkBuildCommand(fw) {
|
|
1059
|
-
switch (fw) {
|
|
1060
|
-
case "astro":
|
|
1061
|
-
return ["pnpm", ["exec", "astro", "build"]];
|
|
1062
|
-
}
|
|
1063
|
-
}
|
|
1064
|
-
function frameworkDevCommand(fw) {
|
|
1065
|
-
switch (fw) {
|
|
1066
|
-
case "astro":
|
|
1067
|
-
return ["pnpm", ["exec", "astro", "dev"]];
|
|
1068
|
-
}
|
|
1069
|
-
}
|
|
1070
|
-
function runExternal(bin, args, opts = {}) {
|
|
1071
|
-
return new Promise((resolveP, rejectP) => {
|
|
1072
|
-
const child = spawn(bin, args, {
|
|
1073
|
-
stdio: opts.stdio ?? "inherit",
|
|
1074
|
-
cwd: opts.cwd,
|
|
1075
|
-
shell: process.platform === "win32",
|
|
1076
|
-
});
|
|
1077
|
-
child.on("exit", (code) => {
|
|
1078
|
-
if (code === 0)
|
|
1079
|
-
resolveP();
|
|
1080
|
-
else
|
|
1081
|
-
rejectP(new Error(`${bin} ${args.join(" ")} exited with code ${code}`));
|
|
1082
|
-
});
|
|
1083
|
-
});
|
|
1084
|
-
}
|
|
1085
|
-
async function existsLocal(path) {
|
|
1086
|
-
try {
|
|
1087
|
-
await access(path);
|
|
1088
|
-
return true;
|
|
1089
|
-
}
|
|
1090
|
-
catch {
|
|
1091
|
-
return false;
|
|
1092
|
-
}
|
|
1093
|
-
}
|
|
1094
|
-
// parseDeployProvider and DEPLOY_PROVIDERS live in ./helpers.js
|
|
1095
|
-
// so they can be unit-tested without booting the whole CLI
|
|
1096
|
-
// program. Re-exported here for consumers that previously
|
|
1097
|
-
// imported them from the index.
|
|
1098
|
-
export { parseDeployProvider, DEPLOY_PROVIDERS };
|
|
1099
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
1100
|
-
// Helper: project file templates
|
|
1101
|
-
// ──────────────────────────────────────────────────────────────────────
|
|
1102
|
-
/**
|
|
1103
|
-
* Unwrap a clack prompt result, treating cancellation as a clean exit.
|
|
1104
|
-
*
|
|
1105
|
-
* Clack's `p.isCancel(x)` is the only blessed way to detect that the
|
|
1106
|
-
* user pressed Ctrl-C / Escape on a prompt. The standard exit shape is
|
|
1107
|
-
* - log the abort message via `p.cancel(...)`
|
|
1108
|
-
* - terminate the process with exit 0 (clean exit, not an error)
|
|
1109
|
-
*
|
|
1110
|
-
* Seven call sites in this file used to inline that three-line dance.
|
|
1111
|
-
* Centralising it here:
|
|
1112
|
-
* 1. makes the abort behaviour auditable from one place,
|
|
1113
|
-
* 2. lets the verifier grep for a single `process.exit(0)` and
|
|
1114
|
-
* confirm there are no stragglers, and
|
|
1115
|
-
* 3. makes future changes (e.g. switching the abort message to a
|
|
1116
|
-
* localised string) a one-line edit.
|
|
1117
|
-
*
|
|
1118
|
-
* Callers should pass the raw `p.text(...)` / `p.select(...)` / etc.
|
|
1119
|
-
* return value and a TypeScript type parameter so the narrowed return
|
|
1120
|
-
* is correctly inferred. Example:
|
|
1121
|
-
*
|
|
1122
|
-
* const b = unwrapPrompt<Blueprint>(await p.select({ ... }));
|
|
1123
|
-
*/
|
|
1124
|
-
function unwrapPrompt(value, message = "Aborted.") {
|
|
1125
|
-
if (p.isCancel(value)) {
|
|
1126
|
-
p.cancel(message);
|
|
1127
|
-
process.exit(0);
|
|
1128
|
-
}
|
|
1129
|
-
return value;
|
|
1130
|
-
}
|
|
1131
|
-
async function resolveText(message, fallback, placeholder) {
|
|
1132
|
-
// Build the options object conditionally so `placeholder` is
|
|
1133
|
-
// omitted entirely (not set to `undefined`) — the CLI library's
|
|
1134
|
-
// TextOptions has `placeholder: string` under
|
|
1135
|
-
// exactOptionalPropertyTypes, so passing `undefined` is a type
|
|
1136
|
-
// error.
|
|
1137
|
-
const textOpts = {
|
|
1138
|
-
message,
|
|
1139
|
-
defaultValue: fallback,
|
|
1140
|
-
...(placeholder !== undefined ? { placeholder } : {}),
|
|
1141
|
-
validate: (value) => {
|
|
1142
|
-
if (!value || value.trim().length === 0)
|
|
1143
|
-
return `${message} is required`;
|
|
1144
|
-
return undefined;
|
|
1145
|
-
},
|
|
1146
|
-
};
|
|
1147
|
-
const result = unwrapPrompt(await p.text(textOpts));
|
|
1148
|
-
return result;
|
|
1149
|
-
}
|
|
1150
|
-
async function writeIfMissing(path, content) {
|
|
1151
|
-
try {
|
|
1152
|
-
await readFile(path, "utf8");
|
|
1153
|
-
}
|
|
1154
|
-
catch {
|
|
1155
|
-
await mkdir(dirname(path), { recursive: true });
|
|
1156
|
-
await writeFile(path, content, "utf8");
|
|
1157
|
-
}
|
|
1158
|
-
}
|
|
1159
|
-
function projectConfig(projectName, blueprint, githubMode) {
|
|
1160
|
-
const githubIntegrations = githubMode === "public"
|
|
1161
|
-
? `integrations: { github: { metadata: true, health: true } },`
|
|
1162
|
-
: `integrations: { github: false },`;
|
|
1163
|
-
return `import { defineConfig } from "@grove-dev/core";
|
|
1164
|
-
|
|
1165
|
-
export default defineConfig({
|
|
1166
|
-
blueprint: "${blueprint}",
|
|
1167
|
-
|
|
1168
|
-
site: {
|
|
1169
|
-
name: "${projectName}",
|
|
1170
|
-
tagline: "A growing community knowledge site.",
|
|
1171
|
-
},
|
|
1172
|
-
|
|
1173
|
-
${githubIntegrations}
|
|
1174
|
-
|
|
1175
|
-
facets: ["category", "tags"],
|
|
1176
177
|
});
|
|
1177
|
-
`;
|
|
1178
|
-
}
|
|
1179
|
-
function projectReadme(projectName, blueprint, framework) {
|
|
1180
|
-
return `# ${projectName}
|
|
1181
|
-
|
|
1182
|
-
A growing community knowledge site built with [Grove](https://github.com/tortuvshin/grove).
|
|
1183
|
-
|
|
1184
|
-
Blueprint: **${blueprint}** · Framework: **${framework}**
|
|
1185
|
-
|
|
1186
|
-
## What this is
|
|
1187
|
-
|
|
1188
|
-
This repository is **data + branding + decisions**, not the framework.
|
|
1189
|
-
The CLI and the renderer live in the \`grove\` repo; you consume them as
|
|
1190
|
-
\`@grove-dev/core\`, \`@grove-dev/cli\`, and \`@grove-dev/${framework}\`.
|
|
1191
|
-
|
|
1192
|
-
## Workflow
|
|
1193
|
-
|
|
1194
|
-
\`\`\`bash
|
|
1195
|
-
grove import <awesome-list-url> # write data/records/*.yml
|
|
1196
|
-
grove sync github # optional: enrich with GitHub metadata
|
|
1197
|
-
grove cleanup stale # flag records that need human review
|
|
1198
|
-
grove validate # check schemas, slugs, taxonomy
|
|
1199
|
-
grove generate # build data/generated/records.{full,index}.json
|
|
1200
|
-
grove sitemap # write public/sitemap.xml
|
|
1201
|
-
grove llms # write public/llms.txt + llms-full.txt
|
|
1202
|
-
grove build # run the framework's build command
|
|
1203
|
-
\`\`\`
|
|
1204
|
-
|
|
1205
|
-
## Files
|
|
1206
|
-
|
|
1207
|
-
- \`grove.config.ts\` — site name, blueprint, integrations, theme, paths.
|
|
1208
|
-
- \`data/records/\` — per-record YAML (commit this).
|
|
1209
|
-
- \`data/decisions.yml\` — human curation decisions.
|
|
1210
|
-
- \`data/generated/\` — auto-generated JSON; do not commit.
|
|
1211
|
-
- \`content/pages/\` — Markdown pages (\`about.md\`, \`methodology.md\`, ...).
|
|
1212
|
-
- \`content/records/\` — optional Markdown body per record.
|
|
1213
|
-
- \`public/\` — logo, OG image, and other static assets.
|
|
1214
|
-
- \`.github/workflows/\` — validate + build + (optional) sync workflows.
|
|
1215
|
-
`;
|
|
1216
|
-
}
|
|
1217
|
-
function gitignoreTemplate() {
|
|
1218
|
-
return `node_modules/
|
|
1219
|
-
dist/
|
|
1220
|
-
.astro/
|
|
1221
|
-
.next/
|
|
1222
|
-
.svelte-kit/
|
|
1223
|
-
.DS_Store
|
|
1224
|
-
.env
|
|
1225
|
-
.env.*
|
|
1226
|
-
!.env.example
|
|
1227
|
-
data/generated/
|
|
1228
|
-
coverage/
|
|
1229
|
-
.tmp-test/
|
|
1230
|
-
.idea/
|
|
1231
|
-
.vscode/
|
|
1232
|
-
*.log
|
|
1233
|
-
*.tsbuildinfo
|
|
1234
|
-
`;
|
|
1235
|
-
}
|
|
1236
|
-
function workflowValidate() {
|
|
1237
|
-
return `name: Validate data
|
|
1238
|
-
|
|
1239
|
-
# Runs on every PR, every push to main, and on manual dispatch.
|
|
1240
|
-
# No secrets required — safe for fork PRs.
|
|
1241
|
-
on:
|
|
1242
|
-
pull_request:
|
|
1243
|
-
push:
|
|
1244
|
-
branches:
|
|
1245
|
-
- main
|
|
1246
|
-
workflow_dispatch:
|
|
1247
|
-
|
|
1248
|
-
permissions:
|
|
1249
|
-
contents: read
|
|
1250
|
-
|
|
1251
|
-
jobs:
|
|
1252
|
-
validate:
|
|
1253
|
-
runs-on: ubuntu-latest
|
|
1254
|
-
|
|
1255
|
-
steps:
|
|
1256
|
-
- name: Checkout
|
|
1257
|
-
uses: actions/checkout@v4
|
|
1258
|
-
|
|
1259
|
-
- name: Setup pnpm
|
|
1260
|
-
uses: pnpm/action-setup@v4
|
|
1261
|
-
|
|
1262
|
-
- name: Setup Node
|
|
1263
|
-
uses: actions/setup-node@v4
|
|
1264
|
-
with:
|
|
1265
|
-
node-version: "24"
|
|
1266
|
-
cache: pnpm
|
|
1267
|
-
|
|
1268
|
-
- name: Install dependencies
|
|
1269
|
-
run: pnpm install --frozen-lockfile
|
|
1270
|
-
|
|
1271
|
-
- name: Validate Grove data
|
|
1272
|
-
run: pnpm exec grove validate
|
|
1273
|
-
`;
|
|
1274
|
-
}
|
|
1275
|
-
function workflowBuild(framework, deploy) {
|
|
1276
|
-
// The project's "build" script in package.json already chains
|
|
1277
|
-
// grove generate && grove sitemap && grove llms && <framework> build
|
|
1278
|
-
// via the `grove` package's own build orchestration. Keep the workflow thin.
|
|
1279
|
-
//
|
|
1280
|
-
// For `github-pages` we add a deploy-pages step at the end so the
|
|
1281
|
-
// build workflow is self-contained (the `pages: write` permission
|
|
1282
|
-
// and the `actions/configure-pages` + `actions/deploy-pages` steps
|
|
1283
|
-
// are the canonical Pages deploy path).
|
|
1284
|
-
//
|
|
1285
|
-
// For `vercel` / `netlify` / `cloudflare` we keep build.yml as a
|
|
1286
|
-
// pure build + artifact upload; the provider-specific deploy lives
|
|
1287
|
-
// in a separate `.github/workflows/deploy-<provider>.yml` workflow.
|
|
1288
|
-
// For `none` we still upload the artifact so a user can manually
|
|
1289
|
-
// download it, but skip the deploy step.
|
|
1290
|
-
const isPages = deploy === "github-pages";
|
|
1291
|
-
const pagesSteps = isPages
|
|
1292
|
-
? ` - name: Setup Pages
|
|
1293
|
-
uses: actions/configure-pages@v5
|
|
1294
|
-
|
|
1295
|
-
- name: Upload Pages artifact
|
|
1296
|
-
uses: actions/upload-pages-artifact@v3
|
|
1297
|
-
with:
|
|
1298
|
-
path: ./dist
|
|
1299
|
-
|
|
1300
|
-
- name: Deploy to GitHub Pages
|
|
1301
|
-
id: deployment
|
|
1302
|
-
uses: actions/deploy-pages@v4
|
|
1303
|
-
|
|
1304
|
-
- name: Summary
|
|
1305
|
-
if: success()
|
|
1306
|
-
run: |
|
|
1307
|
-
echo "✅ Deployed to \${{ steps.deployment.outputs.page_url }}"
|
|
1308
|
-
`
|
|
1309
|
-
: "";
|
|
1310
|
-
const pagesPermissions = isPages
|
|
1311
|
-
? ` contents: read
|
|
1312
|
-
pages: write
|
|
1313
|
-
id-token: write
|
|
1314
|
-
`
|
|
1315
|
-
: ` contents: read
|
|
1316
|
-
`;
|
|
1317
|
-
return `name: Build site
|
|
1318
|
-
|
|
1319
|
-
# Runs on every PR, every push to main, and on manual dispatch.
|
|
1320
|
-
# No secrets required — safe for fork PRs.
|
|
1321
|
-
on:
|
|
1322
|
-
pull_request:
|
|
1323
|
-
push:
|
|
1324
|
-
branches:
|
|
1325
|
-
- main
|
|
1326
|
-
workflow_dispatch:
|
|
1327
|
-
|
|
1328
|
-
permissions:
|
|
1329
|
-
${pagesPermissions}
|
|
1330
|
-
jobs:
|
|
1331
|
-
build:
|
|
1332
|
-
runs-on: ubuntu-latest
|
|
1333
|
-
|
|
1334
|
-
steps:
|
|
1335
|
-
- name: Checkout
|
|
1336
|
-
uses: actions/checkout@v4
|
|
1337
|
-
|
|
1338
|
-
- name: Setup pnpm
|
|
1339
|
-
uses: pnpm/action-setup@v4
|
|
1340
|
-
|
|
1341
|
-
- name: Setup Node
|
|
1342
|
-
uses: actions/setup-node@v4
|
|
1343
|
-
with:
|
|
1344
|
-
node-version: "24"
|
|
1345
|
-
cache: pnpm
|
|
1346
|
-
cache-dependency-path: "**/pnpm-lock.yaml"
|
|
1347
|
-
|
|
1348
|
-
- name: Install dependencies
|
|
1349
|
-
run: pnpm install --frozen-lockfile
|
|
1350
|
-
|
|
1351
|
-
# \`build\` chains build:data + build:sitemap + build:llms + <framework> build.
|
|
1352
|
-
# Site URL is overridden so sitemap/OG/canonical links resolve to
|
|
1353
|
-
# the deployed URL rather than the placeholder in grove.config.ts.
|
|
1354
|
-
- name: Build the site
|
|
1355
|
-
env:
|
|
1356
|
-
SITE_URL: \${{ vars.SITE_URL || github.pages.custom_domain || format('https://{0}.github.io/{1}', github.repository_owner, github.event.repository.name) }}
|
|
1357
|
-
run: pnpm run build
|
|
1358
|
-
${pagesSteps}`;
|
|
1359
|
-
}
|
|
1360
|
-
/**
|
|
1361
|
-
* Provider-specific deploy workflow. Triggered after a successful build
|
|
1362
|
-
* to deploy the static site to the chosen provider via its CLI / API.
|
|
1363
|
-
* Used for vercel / netlify / cloudflare (GitHub Pages deploys inline
|
|
1364
|
-
* in build.yml, and `none` writes no deploy workflow at all).
|
|
1365
|
-
*/
|
|
1366
|
-
function workflowDeploy(deploy) {
|
|
1367
|
-
switch (deploy) {
|
|
1368
|
-
case "vercel":
|
|
1369
|
-
return `name: Deploy to Vercel
|
|
1370
|
-
|
|
1371
|
-
# Runs after a successful build on main. Uses the Vercel CLI to deploy
|
|
1372
|
-
# the built \`dist/\` directory. Requires a VERCEL_TOKEN secret (and
|
|
1373
|
-
# optionally VERCEL_ORG_ID / VERCEL_PROJECT_ID for project linking).
|
|
1374
|
-
on:
|
|
1375
|
-
workflow_run:
|
|
1376
|
-
workflows: ["Build site"]
|
|
1377
|
-
types:
|
|
1378
|
-
- completed
|
|
1379
|
-
workflow_dispatch:
|
|
1380
|
-
|
|
1381
|
-
permissions:
|
|
1382
|
-
contents: read
|
|
1383
|
-
|
|
1384
|
-
jobs:
|
|
1385
|
-
deploy:
|
|
1386
|
-
if: \${{ github.event.workflow_run.conclusion == 'success' }}
|
|
1387
|
-
runs-on: ubuntu-latest
|
|
1388
|
-
|
|
1389
|
-
steps:
|
|
1390
|
-
- name: Checkout
|
|
1391
|
-
uses: actions/checkout@v4
|
|
1392
|
-
|
|
1393
|
-
- name: Setup pnpm
|
|
1394
|
-
uses: pnpm/action-setup@v4
|
|
1395
|
-
|
|
1396
|
-
- name: Setup Node
|
|
1397
|
-
uses: actions/setup-node@v4
|
|
1398
|
-
with:
|
|
1399
|
-
node-version: "24"
|
|
1400
|
-
cache: pnpm
|
|
1401
|
-
cache-dependency-path: "**/pnpm-lock.yaml"
|
|
1402
|
-
|
|
1403
|
-
- name: Install Vercel CLI
|
|
1404
|
-
run: pnpm add -g vercel@latest
|
|
1405
|
-
|
|
1406
|
-
- name: Pull Vercel project info
|
|
1407
|
-
id: vercel
|
|
1408
|
-
run: |
|
|
1409
|
-
echo "PROJECT_ID=\${VERCEL_PROJECT_ID}" >> $GITHUB_OUTPUT
|
|
1410
|
-
env:
|
|
1411
|
-
VERCEL_TOKEN: \${{ secrets.VERCEL_TOKEN }}
|
|
1412
|
-
VERCEL_ORG_ID: \${{ secrets.VERCEL_ORG_ID }}
|
|
1413
|
-
VERCEL_PROJECT_ID: \${{ secrets.VERCEL_PROJECT_ID }}
|
|
1414
|
-
|
|
1415
|
-
- name: Deploy to Vercel (production)
|
|
1416
|
-
run: vercel deploy --prod --yes --token \$VERCEL_TOKEN
|
|
1417
|
-
env:
|
|
1418
|
-
VERCEL_TOKEN: \${{ secrets.VERCEL_TOKEN }}
|
|
1419
|
-
`;
|
|
1420
|
-
case "netlify":
|
|
1421
|
-
return `name: Deploy to Netlify
|
|
1422
|
-
|
|
1423
|
-
# Runs after a successful build on main. Uses the Netlify CLI to deploy
|
|
1424
|
-
# the built \`dist/\` directory. Requires NETLIFY_AUTH_TOKEN and
|
|
1425
|
-
# NETLIFY_SITE_ID secrets.
|
|
1426
|
-
on:
|
|
1427
|
-
workflow_run:
|
|
1428
|
-
workflows: ["Build site"]
|
|
1429
|
-
types:
|
|
1430
|
-
- completed
|
|
1431
|
-
workflow_dispatch:
|
|
1432
|
-
|
|
1433
|
-
permissions:
|
|
1434
|
-
contents: read
|
|
1435
|
-
|
|
1436
|
-
jobs:
|
|
1437
|
-
deploy:
|
|
1438
|
-
if: \${{ github.event.workflow_run.conclusion == 'success' }}
|
|
1439
|
-
runs-on: ubuntu-latest
|
|
1440
|
-
|
|
1441
|
-
steps:
|
|
1442
|
-
- name: Checkout
|
|
1443
|
-
uses: actions/checkout@v4
|
|
1444
|
-
|
|
1445
|
-
- name: Setup pnpm
|
|
1446
|
-
uses: pnpm/action-setup@v4
|
|
1447
|
-
|
|
1448
|
-
- name: Setup Node
|
|
1449
|
-
uses: actions/setup-node@v4
|
|
1450
|
-
with:
|
|
1451
|
-
node-version: "24"
|
|
1452
|
-
cache: pnpm
|
|
1453
|
-
cache-dependency-path: "**/pnpm-lock.yaml"
|
|
1454
|
-
|
|
1455
|
-
- name: Install Netlify CLI
|
|
1456
|
-
run: pnpm add -g netlify-cli@latest
|
|
1457
|
-
|
|
1458
|
-
- name: Deploy to Netlify (production)
|
|
1459
|
-
run: netlify deploy --prod --dir=dist --message "Deploy from GitHub Actions"
|
|
1460
|
-
env:
|
|
1461
|
-
NETLIFY_AUTH_TOKEN: \${{ secrets.NETLIFY_AUTH_TOKEN }}
|
|
1462
|
-
NETLIFY_SITE_ID: \${{ secrets.NETLIFY_SITE_ID }}
|
|
1463
|
-
`;
|
|
1464
|
-
case "cloudflare":
|
|
1465
|
-
return `name: Deploy to Cloudflare Pages
|
|
1466
|
-
|
|
1467
|
-
# Runs after a successful build on main. Uses wrangler to deploy the
|
|
1468
|
-
# built \`dist/\` directory to Cloudflare Pages. Requires
|
|
1469
|
-
# CLOUDFLARE_API_TOKEN + CLOUDFLARE_ACCOUNT_ID secrets.
|
|
1470
|
-
on:
|
|
1471
|
-
workflow_run:
|
|
1472
|
-
workflows: ["Build site"]
|
|
1473
|
-
types:
|
|
1474
|
-
- completed
|
|
1475
|
-
workflow_dispatch:
|
|
1476
|
-
|
|
1477
|
-
permissions:
|
|
1478
|
-
contents: read
|
|
1479
|
-
|
|
1480
|
-
jobs:
|
|
1481
|
-
deploy:
|
|
1482
|
-
if: \${{ github.event.workflow_run.conclusion == 'success' }}
|
|
1483
|
-
runs-on: ubuntu-latest
|
|
1484
|
-
|
|
1485
|
-
steps:
|
|
1486
|
-
- name: Checkout
|
|
1487
|
-
uses: actions/checkout@v4
|
|
1488
|
-
|
|
1489
|
-
- name: Setup pnpm
|
|
1490
|
-
uses: pnpm/action-setup@v4
|
|
1491
|
-
|
|
1492
|
-
- name: Setup Node
|
|
1493
|
-
uses: actions/setup-node@v4
|
|
1494
|
-
with:
|
|
1495
|
-
node-version: "24"
|
|
1496
|
-
cache: pnpm
|
|
1497
|
-
cache-dependency-path: "**/pnpm-lock.yaml"
|
|
1498
|
-
|
|
1499
|
-
- name: Install wrangler
|
|
1500
|
-
run: pnpm add -g wrangler@latest
|
|
1501
|
-
|
|
1502
|
-
- name: Deploy to Cloudflare Pages
|
|
1503
|
-
run: wrangler pages deploy dist --project-name ${"${{ github.event.repository.name }}"} --commit-dirty=true
|
|
1504
|
-
env:
|
|
1505
|
-
CLOUDFLARE_API_TOKEN: \${{ secrets.CLOUDFLARE_API_TOKEN }}
|
|
1506
|
-
CLOUDFLARE_ACCOUNT_ID: \${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
|
|
1507
|
-
`;
|
|
1508
|
-
default:
|
|
1509
|
-
// github-pages and none never reach this path; build.yml handles
|
|
1510
|
-
// github-pages, and `none` writes no deploy workflow.
|
|
1511
|
-
throw new Error(`workflowDeploy: unsupported deploy provider ${deploy}`);
|
|
1512
|
-
}
|
|
1513
|
-
}
|
|
1514
|
-
/**
|
|
1515
|
-
* Provider-specific config files written at the project root so the
|
|
1516
|
-
* provider's CLI / build hook picks them up automatically. V1 only
|
|
1517
|
-
* emits configs for vercel / netlify / cloudflare / github-pages.
|
|
1518
|
-
* `none` emits nothing.
|
|
1519
|
-
*/
|
|
1520
|
-
function deployConfigFiles(deploy, projectName) {
|
|
1521
|
-
switch (deploy) {
|
|
1522
|
-
case "vercel":
|
|
1523
|
-
return [
|
|
1524
|
-
{
|
|
1525
|
-
path: "vercel.json",
|
|
1526
|
-
content: `{
|
|
1527
|
-
"$schema": "https://openapi.vercel.sh/vercel.json",
|
|
1528
|
-
"buildCommand": "pnpm run build",
|
|
1529
|
-
"outputDirectory": "dist",
|
|
1530
|
-
"framework": null,
|
|
1531
|
-
"cleanUrls": true,
|
|
1532
|
-
"trailingSlash": false
|
|
1533
|
-
}
|
|
1534
|
-
`,
|
|
1535
|
-
},
|
|
1536
|
-
];
|
|
1537
|
-
case "netlify":
|
|
1538
|
-
return [
|
|
1539
|
-
{
|
|
1540
|
-
path: "netlify.toml",
|
|
1541
|
-
content: `# Netlify configuration for ${projectName}.
|
|
1542
|
-
# Generated by \`grove new --deploy netlify\`. See https://docs.netlify.com/configure-netlify/file-based-configuration/
|
|
1543
|
-
|
|
1544
|
-
[build]
|
|
1545
|
-
command = "pnpm run build"
|
|
1546
|
-
publish = "dist"
|
|
1547
|
-
|
|
1548
|
-
[build.environment]
|
|
1549
|
-
NODE_VERSION = "20"
|
|
1550
|
-
PNPM_VERSION = "10"
|
|
1551
|
-
|
|
1552
|
-
# Astro renders clean URLs out of the box; keep static asset caching
|
|
1553
|
-
# aggressive but always revalidate HTML so a fresh deploy shows up.
|
|
1554
|
-
[[headers]]
|
|
1555
|
-
for = "/*"
|
|
1556
|
-
[headers.values]
|
|
1557
|
-
X-Content-Type-Options = "nosniff"
|
|
1558
|
-
X-Frame-Options = "DENY"
|
|
1559
|
-
Referrer-Policy = "strict-origin-when-cross-origin"
|
|
1560
|
-
|
|
1561
|
-
[[headers]]
|
|
1562
|
-
for = "/assets/*"
|
|
1563
|
-
[headers.values]
|
|
1564
|
-
Cache-Control = "public, max-age=31536000, immutable"
|
|
1565
|
-
`,
|
|
1566
|
-
},
|
|
1567
|
-
];
|
|
1568
|
-
case "cloudflare":
|
|
1569
|
-
return [
|
|
1570
|
-
{
|
|
1571
|
-
path: "wrangler.jsonc",
|
|
1572
|
-
content: `// Cloudflare Pages configuration for ${projectName}.
|
|
1573
|
-
// Generated by \`grove new --deploy cloudflare\`. See https://developers.cloudflare.com/pages/functions/wrangler-configuration/
|
|
1574
|
-
{
|
|
1575
|
-
"name": "${slugifyProjectName(projectName)}",
|
|
1576
|
-
"compatibility_date": "${new Date().toISOString().slice(0, 10)}",
|
|
1577
|
-
"pages_build_output_dir": "./dist",
|
|
1578
|
-
"observability": {
|
|
1579
|
-
"enabled": true
|
|
1580
|
-
}
|
|
1581
|
-
}
|
|
1582
|
-
`,
|
|
1583
|
-
},
|
|
1584
|
-
];
|
|
1585
|
-
case "github-pages":
|
|
1586
|
-
// GitHub Pages uses repo-level Pages settings; no config file.
|
|
1587
|
-
return [];
|
|
1588
|
-
case "none":
|
|
1589
|
-
return [];
|
|
1590
|
-
}
|
|
1591
|
-
}
|
|
1592
|
-
function slugifyProjectName(name) {
|
|
1593
|
-
return name
|
|
1594
|
-
.toLowerCase()
|
|
1595
|
-
.replace(/[^a-z0-9-]+/g, "-")
|
|
1596
|
-
.replace(/^-+|-+$/g, "") || "grove-site";
|
|
1597
|
-
}
|
|
1598
|
-
function issueTemplateSubmission(blueprint) {
|
|
1599
|
-
const labelHint = blueprint === "project-directory"
|
|
1600
|
-
? `- **Repository URL** (required):
|
|
1601
|
-
- **Name**:
|
|
1602
|
-
- **One-line description** (≤ 120 chars):
|
|
1603
|
-
- **Category** (e.g. tools, libraries, frameworks):`
|
|
1604
|
-
: blueprint === "resource-hub"
|
|
1605
|
-
? `- **Resource URL** (required):
|
|
1606
|
-
- **Title**:
|
|
1607
|
-
- **Type** (guide | comparison | link | explainer | other):
|
|
1608
|
-
- **Topic**:`
|
|
1609
|
-
: `- **Name**:
|
|
1610
|
-
- **Type** (company | organization | community | school | ...):
|
|
1611
|
-
- **Category**:
|
|
1612
|
-
- **Website URL**:`;
|
|
1613
|
-
return `---
|
|
1614
|
-
name: Submit a record
|
|
1615
|
-
about: Suggest a new record to add to this Grove site
|
|
1616
|
-
title: "[Submit] "
|
|
1617
|
-
labels: submission
|
|
1618
|
-
---
|
|
1619
|
-
|
|
1620
|
-
${labelHint}
|
|
1621
|
-
|
|
1622
|
-
## Why include it?
|
|
1623
|
-
|
|
1624
|
-
A few sentences on what makes this record worth listing.
|
|
1625
|
-
`;
|
|
1626
|
-
}
|
|
1627
|
-
function workflowSyncGithubMetadata() {
|
|
1628
|
-
return `name: Sync GitHub metadata
|
|
1629
|
-
|
|
1630
|
-
# Refreshes GitHub repository metadata (stars, forks, last commit, license, …)
|
|
1631
|
-
# for records that link to public GitHub repos. Runs nightly and on demand.
|
|
1632
|
-
# Uses GROVE_GITHUB_TOKEN if set, else falls back to GITHUB_TOKEN.
|
|
1633
|
-
#
|
|
1634
|
-
# This workflow DOES mutate data/records/*.yml: 'grove sync github' writes
|
|
1635
|
-
# a 'github.repository' block back into the owning record file. The PR
|
|
1636
|
-
# below is the human review point for that diff.
|
|
1637
|
-
on:
|
|
1638
|
-
schedule:
|
|
1639
|
-
- cron: "0 2 * * *"
|
|
1640
|
-
workflow_dispatch:
|
|
1641
|
-
|
|
1642
|
-
permissions:
|
|
1643
|
-
contents: write
|
|
1644
|
-
pull-requests: write
|
|
1645
|
-
|
|
1646
|
-
jobs:
|
|
1647
|
-
sync:
|
|
1648
|
-
runs-on: ubuntu-latest
|
|
1649
|
-
|
|
1650
|
-
steps:
|
|
1651
|
-
- name: Checkout
|
|
1652
|
-
uses: actions/checkout@v4
|
|
1653
|
-
|
|
1654
|
-
- name: Setup pnpm
|
|
1655
|
-
uses: pnpm/action-setup@v4
|
|
1656
|
-
|
|
1657
|
-
- name: Setup Node
|
|
1658
|
-
uses: actions/setup-node@v4
|
|
1659
|
-
with:
|
|
1660
|
-
node-version: "24"
|
|
1661
|
-
cache: pnpm
|
|
1662
|
-
cache-dependency-path: "**/pnpm-lock.yaml"
|
|
1663
|
-
|
|
1664
|
-
- name: Install dependencies
|
|
1665
|
-
run: pnpm install --frozen-lockfile
|
|
1666
|
-
|
|
1667
|
-
- name: Sync GitHub metadata
|
|
1668
|
-
run: pnpm exec grove sync github
|
|
1669
|
-
env:
|
|
1670
|
-
GITHUB_TOKEN: \${{ secrets.GROVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
|
1671
|
-
|
|
1672
|
-
- name: Regenerate Grove data
|
|
1673
|
-
run: pnpm exec grove generate
|
|
1674
|
-
|
|
1675
|
-
- name: Open PR with metadata refresh
|
|
1676
|
-
uses: peter-evans/create-pull-request@v6
|
|
1677
|
-
with:
|
|
1678
|
-
branch: chore/grove-sync-github-metadata
|
|
1679
|
-
title: "chore: sync GitHub metadata"
|
|
1680
|
-
commit-message: "chore: sync GitHub metadata"
|
|
1681
|
-
body: |
|
|
1682
|
-
Automated metadata refresh by Grove.
|
|
1683
|
-
|
|
1684
|
-
- Updated GitHub stars, forks, last commit, license, etc.
|
|
1685
|
-
- Each touched record YAML now carries a \`github.sync\` block
|
|
1686
|
-
with the \`syncedAt\` timestamp and the \`source\` ("api" or
|
|
1687
|
-
"html" fallback).
|
|
1688
|
-
- Triggered by: \${{ github.event_name }}
|
|
1689
|
-
add-paths: |
|
|
1690
|
-
data/records/*.yml
|
|
1691
|
-
data/generated/*.json
|
|
1692
|
-
`;
|
|
1693
|
-
}
|
|
1694
|
-
function workflowSyncContributors() {
|
|
1695
|
-
return `name: Sync contributors
|
|
1696
|
-
|
|
1697
|
-
# Refreshes contributor data (avatars, recent activity, top contributors)
|
|
1698
|
-
# for records that have a public GitHub repository. Runs weekly and on demand.
|
|
1699
|
-
# Uses GROVE_GITHUB_TOKEN if set, else falls back to GITHUB_TOKEN.
|
|
1700
|
-
on:
|
|
1701
|
-
schedule:
|
|
1702
|
-
- cron: "0 3 * * 1"
|
|
1703
|
-
workflow_dispatch:
|
|
1704
|
-
|
|
1705
|
-
permissions:
|
|
1706
|
-
contents: write
|
|
1707
|
-
pull-requests: write
|
|
1708
|
-
|
|
1709
|
-
jobs:
|
|
1710
|
-
sync:
|
|
1711
|
-
runs-on: ubuntu-latest
|
|
1712
|
-
|
|
1713
|
-
steps:
|
|
1714
|
-
- name: Checkout
|
|
1715
|
-
uses: actions/checkout@v4
|
|
1716
|
-
|
|
1717
|
-
- name: Setup pnpm
|
|
1718
|
-
uses: pnpm/action-setup@v4
|
|
1719
|
-
|
|
1720
|
-
- name: Setup Node
|
|
1721
|
-
uses: actions/setup-node@v4
|
|
1722
|
-
with:
|
|
1723
|
-
node-version: "24"
|
|
1724
|
-
cache: pnpm
|
|
1725
|
-
cache-dependency-path: "**/pnpm-lock.yaml"
|
|
1726
|
-
|
|
1727
|
-
- name: Install dependencies
|
|
1728
|
-
run: pnpm install --frozen-lockfile
|
|
1729
|
-
|
|
1730
|
-
- name: Sync contributors
|
|
1731
|
-
run: pnpm exec grove sync contributors
|
|
1732
|
-
env:
|
|
1733
|
-
GITHUB_TOKEN: \${{ secrets.GROVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
|
1734
|
-
|
|
1735
|
-
- name: Open PR with contributor refresh
|
|
1736
|
-
uses: peter-evans/create-pull-request@v6
|
|
1737
|
-
with:
|
|
1738
|
-
branch: chore/grove-sync-contributors
|
|
1739
|
-
title: "chore: sync contributors"
|
|
1740
|
-
commit-message: "chore: sync contributors"
|
|
1741
|
-
body: |
|
|
1742
|
-
Automated contributor refresh by Grove.
|
|
1743
|
-
|
|
1744
|
-
- Updated contributor lists, avatars, and recent activity.
|
|
1745
|
-
- Triggered by: \${{ github.event_name }}
|
|
1746
|
-
add-paths: |
|
|
1747
|
-
data/generated/contributors.json
|
|
1748
|
-
.grove/cache/contributors.json
|
|
1749
|
-
`;
|
|
1750
|
-
}
|
|
1751
|
-
function workflowCleanupStaleRecords() {
|
|
1752
|
-
return `name: Cleanup stale records
|
|
1753
|
-
|
|
1754
|
-
# Reports records that may be outdated, archived, or no longer useful.
|
|
1755
|
-
# V1 behaviour is REPORT-ONLY — does not delete records. Use --strict in
|
|
1756
|
-
# the CLI to fail the run if any candidates are flagged.
|
|
1757
|
-
on:
|
|
1758
|
-
schedule:
|
|
1759
|
-
- cron: "0 4 * * 0"
|
|
1760
|
-
workflow_dispatch:
|
|
1761
|
-
|
|
1762
|
-
permissions:
|
|
1763
|
-
contents: write
|
|
1764
|
-
pull-requests: write
|
|
1765
|
-
issues: write
|
|
1766
|
-
|
|
1767
|
-
jobs:
|
|
1768
|
-
cleanup:
|
|
1769
|
-
runs-on: ubuntu-latest
|
|
1770
|
-
|
|
1771
|
-
steps:
|
|
1772
|
-
- name: Checkout
|
|
1773
|
-
uses: actions/checkout@v4
|
|
1774
|
-
|
|
1775
|
-
- name: Setup pnpm
|
|
1776
|
-
uses: pnpm/action-setup@v4
|
|
1777
|
-
|
|
1778
|
-
- name: Setup Node
|
|
1779
|
-
uses: actions/setup-node@v4
|
|
1780
|
-
with:
|
|
1781
|
-
node-version: "24"
|
|
1782
|
-
cache: pnpm
|
|
1783
|
-
cache-dependency-path: "**/pnpm-lock.yaml"
|
|
1784
|
-
|
|
1785
|
-
- name: Install dependencies
|
|
1786
|
-
run: pnpm install --frozen-lockfile
|
|
1787
|
-
|
|
1788
|
-
- name: Generate stale-record report
|
|
1789
|
-
run: pnpm exec grove cleanup stale
|
|
1790
|
-
env:
|
|
1791
|
-
GITHUB_TOKEN: \${{ secrets.GROVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
|
1792
|
-
|
|
1793
|
-
- name: Open PR with stale-record report
|
|
1794
|
-
uses: peter-evans/create-pull-request@v6
|
|
1795
|
-
with:
|
|
1796
|
-
branch: chore/grove-stale-record-report
|
|
1797
|
-
title: "chore: update stale record report"
|
|
1798
|
-
commit-message: "chore: update stale record report"
|
|
1799
|
-
body: |
|
|
1800
|
-
Automated stale record report by Grove.
|
|
1801
|
-
|
|
1802
|
-
- Records flagged for human review (archived, inactive, broken links, …).
|
|
1803
|
-
- Triggered by: \${{ github.event_name }}
|
|
1804
|
-
add-paths: |
|
|
1805
|
-
data/generated/stale-records.json
|
|
1806
|
-
docs/generated/stale-records.md
|
|
1807
|
-
`;
|
|
1808
|
-
}
|
|
1809
|
-
function workflowUpdateRecords() {
|
|
1810
|
-
return `name: Update Grove records
|
|
1811
|
-
|
|
1812
|
-
# Full maintenance cycle: validate + sync GitHub metadata + sync contributors
|
|
1813
|
-
# + cleanup stale records + regenerate. Run on demand, or weekly if your
|
|
1814
|
-
# project needs hands-off maintenance.
|
|
1815
|
-
on:
|
|
1816
|
-
workflow_dispatch:
|
|
1817
|
-
schedule:
|
|
1818
|
-
- cron: "0 5 * * 1"
|
|
1819
|
-
|
|
1820
|
-
permissions:
|
|
1821
|
-
contents: write
|
|
1822
|
-
pull-requests: write
|
|
1823
|
-
issues: write
|
|
1824
|
-
|
|
1825
|
-
jobs:
|
|
1826
|
-
update:
|
|
1827
|
-
runs-on: ubuntu-latest
|
|
1828
|
-
|
|
1829
|
-
steps:
|
|
1830
|
-
- name: Checkout
|
|
1831
|
-
uses: actions/checkout@v4
|
|
1832
|
-
|
|
1833
|
-
- name: Setup pnpm
|
|
1834
|
-
uses: pnpm/action-setup@v4
|
|
1835
|
-
|
|
1836
|
-
- name: Setup Node
|
|
1837
|
-
uses: actions/setup-node@v4
|
|
1838
|
-
with:
|
|
1839
|
-
node-version: "24"
|
|
1840
|
-
cache: pnpm
|
|
1841
|
-
cache-dependency-path: "**/pnpm-lock.yaml"
|
|
1842
|
-
|
|
1843
|
-
- name: Install dependencies
|
|
1844
|
-
run: pnpm install --frozen-lockfile
|
|
1845
|
-
|
|
1846
|
-
- name: Validate records
|
|
1847
|
-
run: pnpm exec grove validate
|
|
1848
|
-
|
|
1849
|
-
- name: Sync GitHub metadata
|
|
1850
|
-
run: pnpm exec grove sync github
|
|
1851
|
-
env:
|
|
1852
|
-
GITHUB_TOKEN: \${{ secrets.GROVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
|
1853
|
-
|
|
1854
|
-
- name: Sync contributors
|
|
1855
|
-
run: pnpm exec grove sync contributors
|
|
1856
|
-
env:
|
|
1857
|
-
GITHUB_TOKEN: \${{ secrets.GROVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
|
1858
|
-
|
|
1859
|
-
- name: Cleanup stale records
|
|
1860
|
-
run: pnpm exec grove cleanup stale
|
|
1861
|
-
env:
|
|
1862
|
-
GITHUB_TOKEN: \${{ secrets.GROVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
|
|
1863
|
-
|
|
1864
|
-
- name: Regenerate
|
|
1865
|
-
run: pnpm exec grove generate
|
|
1866
|
-
|
|
1867
|
-
- name: Open PR with maintenance update
|
|
1868
|
-
uses: peter-evans/create-pull-request@v6
|
|
1869
|
-
with:
|
|
1870
|
-
branch: chore/grove-update-records
|
|
1871
|
-
title: "chore: update Grove records"
|
|
1872
|
-
commit-message: "chore: update Grove records"
|
|
1873
|
-
body: |
|
|
1874
|
-
Automated Grove maintenance update.
|
|
1875
|
-
|
|
1876
|
-
- Validated records
|
|
1877
|
-
- Synced GitHub metadata
|
|
1878
|
-
- Synced contributors
|
|
1879
|
-
- Flagged stale records (report only)
|
|
1880
|
-
- Regenerated indexes
|
|
1881
|
-
|
|
1882
|
-
Triggered by: \${{ github.event_name }}
|
|
1883
|
-
`;
|
|
1884
|
-
}
|
|
1885
|
-
function issueTemplateBrokenRecord() {
|
|
1886
|
-
return `---
|
|
1887
|
-
name: Report broken record
|
|
1888
|
-
about: Report a broken link, dead project, wrong category, or duplicate record
|
|
1889
|
-
title: "[Broken] "
|
|
1890
|
-
labels: broken-record
|
|
1891
|
-
---
|
|
1892
|
-
|
|
1893
|
-
## Which record is broken?
|
|
1894
|
-
|
|
1895
|
-
Record slug (e.g. \`zod\`) or full URL of the record page:
|
|
1896
|
-
|
|
1897
|
-
## What is wrong?
|
|
1898
|
-
|
|
1899
|
-
- [ ] Broken link (404, dead site, repo not found)
|
|
1900
|
-
- [ ] Dead / abandoned / archived project
|
|
1901
|
-
- [ ] Wrong category or tags
|
|
1902
|
-
- [ ] Duplicate of an existing record
|
|
1903
|
-
- [ ] Security concern
|
|
1904
|
-
- [ ] Outdated metadata (stars, last commit, etc.)
|
|
1905
|
-
- [ ] Incorrect description
|
|
1906
|
-
- [ ] Other (describe below)
|
|
1907
|
-
|
|
1908
|
-
## Details
|
|
1909
|
-
|
|
1910
|
-
A short description of the issue, with evidence if possible (link to a working
|
|
1911
|
-
alternative, archive.org snapshot, or commit history).
|
|
1912
|
-
|
|
1913
|
-
## Suggested fix (optional)
|
|
1914
|
-
|
|
1915
|
-
If you know what should change, describe it here.
|
|
1916
|
-
`;
|
|
1917
|
-
}
|
|
1918
|
-
function pullRequestTemplate() {
|
|
1919
|
-
return `## What did you add or change?
|
|
1920
|
-
|
|
1921
|
-
<!-- A short summary of your change. -->
|
|
1922
|
-
|
|
1923
|
-
## Is this a new record?
|
|
1924
|
-
|
|
1925
|
-
- [ ] Yes — adds a new record under \`data/records/\`
|
|
1926
|
-
- [ ] No — updates an existing record, fixes a bug, or changes infrastructure
|
|
1927
|
-
|
|
1928
|
-
## Checklist
|
|
1929
|
-
|
|
1930
|
-
- [ ] I added or updated records under \`data/records/\`
|
|
1931
|
-
- [ ] The record has a clear, accurate description
|
|
1932
|
-
- [ ] The category and tags are appropriate
|
|
1933
|
-
- [ ] I ran \`pnpm exec grove validate\` and it passed
|
|
1934
|
-
- [ ] I did not add generated files manually unless required
|
|
1935
|
-
- [ ] I included the official / source link where available
|
|
1936
|
-
- [ ] This PR is safe to publish (no private or sensitive data)
|
|
1937
|
-
`;
|
|
1938
|
-
}
|
|
1939
|
-
function issueTemplateBug() {
|
|
1940
|
-
return `---
|
|
1941
|
-
name: Bug report
|
|
1942
|
-
about: Something is broken or wrong
|
|
1943
|
-
title: "[Bug] "
|
|
1944
|
-
labels: bug
|
|
1945
|
-
---
|
|
1946
|
-
|
|
1947
|
-
## What happened
|
|
1948
|
-
|
|
1949
|
-
A clear description of the bug.
|
|
1950
|
-
|
|
1951
|
-
## How to reproduce
|
|
1952
|
-
|
|
1953
|
-
Steps to reproduce the behaviour.
|
|
1954
|
-
|
|
1955
|
-
## Expected
|
|
1956
|
-
|
|
1957
|
-
What you expected to happen.
|
|
1958
|
-
`;
|
|
1959
|
-
}
|
|
1960
|
-
function issueTemplateFeature() {
|
|
1961
|
-
return `---
|
|
1962
|
-
name: Feature request
|
|
1963
|
-
about: Suggest a new feature
|
|
1964
|
-
title: "[Feature] "
|
|
1965
|
-
labels: enhancement
|
|
1966
|
-
---
|
|
1967
|
-
|
|
1968
|
-
## What
|
|
1969
|
-
|
|
1970
|
-
A clear description of the feature.
|
|
1971
|
-
|
|
1972
|
-
## Why
|
|
1973
|
-
|
|
1974
|
-
What problem does this solve?
|
|
1975
|
-
`;
|
|
1976
|
-
}
|
|
1977
|
-
function licenseMIT(projectName) {
|
|
1978
|
-
const year = new Date().getFullYear();
|
|
1979
|
-
return `MIT License
|
|
1980
|
-
|
|
1981
|
-
Copyright (c) ${year} ${projectName}
|
|
1982
|
-
|
|
1983
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1984
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
1985
|
-
in the Software without restriction, including without limitation the rights
|
|
1986
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1987
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
1988
|
-
furnished to do so, subject to the following conditions:
|
|
1989
|
-
|
|
1990
|
-
The above copyright notice and this permission notice shall be included in all
|
|
1991
|
-
copies or substantial portions of the Software.
|
|
1992
|
-
|
|
1993
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1994
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1995
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1996
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1997
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1998
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1999
|
-
SOFTWARE.
|
|
2000
|
-
`;
|
|
2001
|
-
}
|
|
2002
178
|
program.parseAsync().catch((error) => {
|
|
2003
|
-
|
|
2004
|
-
|
|
2005
|
-
// for Error subclasses; `error.message` is the fallback when
|
|
2006
|
-
// something non-Error was thrown (e.g. a bare string).
|
|
2007
|
-
if (error instanceof Error && error.stack) {
|
|
2008
|
-
console.error(error.stack);
|
|
2009
|
-
}
|
|
2010
|
-
else if (error instanceof Error) {
|
|
2011
|
-
console.error(error.message);
|
|
2012
|
-
}
|
|
2013
|
-
else {
|
|
2014
|
-
console.error(String(error));
|
|
2015
|
-
}
|
|
2016
|
-
process.exit(1);
|
|
179
|
+
console.error(error instanceof Error ? error.message : String(error));
|
|
180
|
+
process.exitCode = 1;
|
|
2017
181
|
});
|
|
2018
182
|
//# sourceMappingURL=index.js.map
|