@grove-dev/cli 0.1.4 → 0.2.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/dist/index.js CHANGED
@@ -1,18 +1,27 @@
1
1
  #!/usr/bin/env node
2
2
  /**
3
- * Grove CLI — turns awesome lists into living, health-aware developer directories.
3
+ * Grove CLI — scaffolds Grove-powered spaces and orchestrates
4
+ * `@grove-dev/core` commands.
4
5
  *
5
- * Layered on top of `@grove-dev/core`. The CLI is intentionally
6
- * framework-agnostic: it orchestrates `core` functions and asks the
7
- * matching framework adapter (e.g. `@grove-dev/astro`) for templates
8
- * to scaffold a project.
6
+ * V1 command surface:
7
+ * grove new <name> scaffold a new project (asks blueprint + framework)
8
+ * grove import <src> turn an awesome list into records/*.yml
9
+ * grove validate check records, taxonomy, health, decisions
10
+ * grove generate build data/generated/records.{full,index}.json
11
+ * grove sitemap write public/sitemap.xml
12
+ * grove llms write public/llms.txt and llms-full.txt
13
+ * grove sync github optional: enrich records with GitHub metadata
14
+ * grove cleanup stale flag records that need human review
15
+ * grove build run the framework's build command
16
+ * grove dev run the framework's dev server
9
17
  */
10
18
  import { spawn } from "node:child_process";
11
- import { mkdir, readFile, writeFile } from "node:fs/promises";
19
+ import { mkdir, readFile, writeFile, access } from "node:fs/promises";
12
20
  import { dirname, join, resolve } from "node:path";
13
21
  import { Command } from "commander";
14
22
  import * as p from "@clack/prompts";
15
- import { buildData, buildLlmsFiles, buildReviewReport, buildSitemap, classifyHealth, enrichFromGithubHtml, fetchGithubMetadata, importAwesomeList, itemsFileSchema, loadConfig, parseAppYaml, parseGithubRepoUrl, readYamlFile, normalizeAppRecord, stringifyAppYaml, validateProject, writeTextFile, writeYamlFile, } from "@grove-dev/core";
23
+ import { cleanupStale, enrichFromGithubHtml, fetchGithubMetadata, generate, blueprintKind, importAwesomeList, loadConfig, parseGithubRepoUrl, stringifyRecordYaml, validateProject, } from "@grove-dev/core";
24
+ import { parse as parseYaml } from "yaml";
16
25
  import { copyTemplate, ensureDir, isFramework, listTemplates, renameProjectInTemplate, SUPPORTED_FRAMEWORKS, } from "./template-loader.js";
17
26
  const program = new Command();
18
27
  const DEPLOY_PROVIDERS = ["vercel", "netlify", "cloudflare", "github-pages", "none"];
@@ -24,43 +33,109 @@ const DEPLOY_LABELS = {
24
33
  none: { label: "None", hint: "I'll bring my own deploy — no workflow" },
25
34
  };
26
35
  const FRAMEWORK_LABELS = {
27
- astro: { label: "Astro", hint: "Static-first, great for content sites" },
28
- nextjs: { label: "Next.js", hint: "App router + RSC, React ecosystem" },
29
- svelte: { label: "SvelteKit", hint: "Compact, fast, single-file components" },
36
+ astro: { label: "Astro", hint: "Static-first, great for content sites (V1 supported)" },
37
+ nextjs: { label: "Next.js", hint: "Roadmap only — not in V1" },
38
+ svelte: { label: "SvelteKit", hint: "Roadmap only — not in V1" },
39
+ };
40
+ const BLUEPRINT_LABELS = {
41
+ "project-directory": { label: "project-directory", hint: "Structured projects/tools/apps" },
42
+ "resource-hub": { label: "resource-hub", hint: "Guides, comparisons, resources" },
43
+ "ecosystem-map": { label: "ecosystem-map", hint: "Orgs, products, communities" },
30
44
  };
31
45
  program
32
46
  .name("grove")
33
- .description("Turn awesome lists into living, health-aware developer directories.")
34
- .version("0.1.0");
47
+ .description("Grove — grow a community knowledge site.")
48
+ .version("0.1.5");
35
49
  // ──────────────────────────────────────────────────────────────────────
36
50
  // grove new
37
- //
38
- // Scaffold a brand-new project repo. Interactive by default
39
- // (matches `pnpm create astro`, `create-next-app`, etc.); every
40
- // prompt has a CLI flag for non-interactive use.
41
51
  // ──────────────────────────────────────────────────────────────────────
42
52
  program
43
53
  .command("new")
44
54
  .argument("[name]", "project directory name (current dir if omitted)")
45
55
  .description("Scaffold a new Grove project from a framework template.")
46
- .option("-f, --framework <name>", "framework: astro | nextjs | svelte")
56
+ .option("-b, --blueprint <name>", "blueprint: project-directory | resource-hub | ecosystem-map")
57
+ .option("-f, --framework <name>", "framework: astro | nextjs | svelte (V1: astro)")
47
58
  .option("-t, --template <name>", "template name", "default")
48
59
  .option("-d, --deploy <provider>", `deploy provider: ${DEPLOY_PROVIDERS.join(" | ")}`)
60
+ .option("-g, --github <mode>", "GitHub workflow mode: none | public (V1: none=private, public=community)")
49
61
  .option("--no-git", "skip `git init` after scaffolding")
50
62
  .option("--no-install", "skip `pnpm install` after scaffolding")
51
63
  .option("-y, --yes", "accept defaults for every prompt (CI / scripted use)")
52
64
  .action(async (name, opts) => {
53
65
  p.intro("🌱 Grow a new Grove space");
54
- // ── 1. Project name ────────────────────────────────────────
55
- // Non-interactive path: if --yes was passed OR a name positional was
56
- // given, skip both text prompts and derive values from the args.
57
- // Without this, the CLI hangs on `p.text` in non-TTY environments
58
- // (CI, agent shells, piped stdin) because clack has no TTY to read from.
59
66
  const projectDir = opts.yes || name ? name ?? "." : await resolveText("Where should the new space live?", ".");
60
67
  const projectName = opts.yes || name
61
68
  ? (projectDir === "." ? "Grove Directory" : projectDir)
62
69
  : await resolveText("What is the name of this space?", "Grove Directory");
63
- // ── 2. Framework ───────────────────────────────────────────
70
+ // Blueprint
71
+ let blueprint;
72
+ const validBlueprints = Object.keys(BLUEPRINT_LABELS);
73
+ if (opts.blueprint && validBlueprints.includes(opts.blueprint)) {
74
+ blueprint = opts.blueprint;
75
+ }
76
+ else if (opts.blueprint) {
77
+ p.log.error(`Unknown blueprint: ${opts.blueprint}.`);
78
+ p.log.info(`Try one of: ${validBlueprints.join(", ")}`);
79
+ process.exit(1);
80
+ }
81
+ else if (opts.yes) {
82
+ blueprint = "project-directory";
83
+ }
84
+ else {
85
+ const b = await p.select({
86
+ message: "Pick a blueprint",
87
+ options: validBlueprints.map((b) => ({
88
+ value: b,
89
+ label: BLUEPRINT_LABELS[b].label,
90
+ hint: BLUEPRINT_LABELS[b].hint,
91
+ })),
92
+ initialValue: "project-directory",
93
+ });
94
+ if (p.isCancel(b)) {
95
+ p.cancel("Aborted.");
96
+ process.exit(0);
97
+ }
98
+ blueprint = b;
99
+ }
100
+ // GitHub integration
101
+ // "none" — private/local mode: only validate-data.yml + build.yml
102
+ // "public" — public GitHub mode: + sync + cleanup + update + issue/PR templates
103
+ let githubMode;
104
+ if (opts.github && (opts.github === "none" || opts.github === "public")) {
105
+ githubMode = opts.github;
106
+ }
107
+ else if (opts.github) {
108
+ p.log.error(`Unknown GitHub mode: ${opts.github}.`);
109
+ p.log.info(`Try one of: none | public`);
110
+ process.exit(1);
111
+ }
112
+ else if (opts.yes) {
113
+ githubMode = "none";
114
+ }
115
+ else {
116
+ const g = (await p.select({
117
+ message: "GitHub automation mode?",
118
+ options: [
119
+ {
120
+ value: "none",
121
+ label: "none / private",
122
+ hint: "Private or local — no GitHub token, only validate + build",
123
+ },
124
+ {
125
+ value: "public",
126
+ label: "public GitHub metadata",
127
+ hint: "Community sites — syncs stars, contributors, stale records (token-gated)",
128
+ },
129
+ ],
130
+ initialValue: "none",
131
+ }));
132
+ if (p.isCancel(g)) {
133
+ p.cancel("Aborted.");
134
+ process.exit(0);
135
+ }
136
+ githubMode = g;
137
+ }
138
+ // Framework
64
139
  let framework;
65
140
  if (opts.framework && isFramework(opts.framework)) {
66
141
  framework = opts.framework;
@@ -75,7 +150,7 @@ program
75
150
  }
76
151
  else {
77
152
  const f = await p.select({
78
- message: "Pick a framework",
153
+ message: "Pick a framework (V1 only supports astro)",
79
154
  options: SUPPORTED_FRAMEWORKS.map((f) => ({
80
155
  value: f,
81
156
  label: FRAMEWORK_LABELS[f].label,
@@ -89,9 +164,7 @@ program
89
164
  }
90
165
  framework = f;
91
166
  }
92
- // ── 3. Template name ───────────────────────────────────────
93
167
  const template = opts.template;
94
- // ── 4. Deploy provider ─────────────────────────────────────
95
168
  let deploy;
96
169
  if (opts.deploy && DEPLOY_PROVIDERS.includes(opts.deploy)) {
97
170
  deploy = opts.deploy;
@@ -120,7 +193,6 @@ program
120
193
  }
121
194
  deploy = d;
122
195
  }
123
- // ── 5. git init? ───────────────────────────────────────────
124
196
  const initGit = opts.yes
125
197
  ? (opts.git ?? true)
126
198
  : await p.confirm({
@@ -131,7 +203,6 @@ program
131
203
  p.cancel("Aborted.");
132
204
  process.exit(0);
133
205
  }
134
- // ── 6. install deps? ───────────────────────────────────────
135
206
  const installDeps = opts.yes
136
207
  ? (opts.install ?? true)
137
208
  : await p.confirm({
@@ -142,7 +213,6 @@ program
142
213
  p.cancel("Aborted.");
143
214
  process.exit(0);
144
215
  }
145
- // ── 7. scaffold ────────────────────────────────────────────
146
216
  const root = resolve(projectDir);
147
217
  const templates = await listTemplates(framework);
148
218
  const tpl = templates.find((t) => t.template === template) ?? templates[0];
@@ -159,38 +229,41 @@ program
159
229
  p.log.step(`Rewrote workspace deps to published version: ${renameResult.rewrittenDeps.join(", ")}`);
160
230
  }
161
231
  await Promise.all([
162
- ensureDir(join(root, "sources")),
163
232
  ensureDir(join(root, "data")),
164
- ensureDir(join(root, "data", "apps")),
233
+ ensureDir(join(root, "data", "records")),
165
234
  ensureDir(join(root, "data", "taxonomy")),
166
235
  ensureDir(join(root, "data", "generated")),
167
236
  ensureDir(join(root, "content")),
237
+ ensureDir(join(root, "content", "pages")),
238
+ ensureDir(join(root, "content", "records")),
168
239
  ensureDir(join(root, "public")),
169
240
  ensureDir(join(root, ".github")),
170
241
  ensureDir(join(root, ".github", "ISSUE_TEMPLATE")),
171
242
  ensureDir(join(root, ".github", "workflows")),
172
243
  ]);
173
- await writeIfMissing(join(root, "curated.config.ts"), projectConfig(projectName));
174
- await writeIfMissing(join(root, "README.md"), projectReadme(projectName, framework));
244
+ await writeIfMissing(join(root, "grove.config.ts"), projectConfig(projectName, blueprint, githubMode));
245
+ await writeIfMissing(join(root, "README.md"), projectReadme(projectName, blueprint, framework));
175
246
  await writeIfMissing(join(root, ".gitignore"), gitignoreTemplate());
176
- await writeIfMissing(join(root, "data", "items.yml"), "items: []\n");
177
- await writeIfMissing(join(root, "data", "health.yml"), "health: []\n");
178
247
  await writeIfMissing(join(root, "data", "decisions.yml"), "decisions: []\n");
179
- await writeIfMissing(join(root, "data", "overrides.yml"), "overrides: []\n");
180
- await writeIfMissing(join(root, "data", "taxonomy", "stacks.yml"), taxonomyStacks());
181
- await writeIfMissing(join(root, "data", "taxonomy", "platforms.yml"), taxonomyPlatforms());
182
- await writeIfMissing(join(root, "data", "taxonomy", "categories.yml"), taxonomyCategories());
183
- await writeIfMissing(join(root, "data", "taxonomy", "distribution-channels.yml"), taxonomyDistribution());
184
248
  await writeIfMissing(join(root, "content", "methodology.md"), "# Methodology\n\nGrove uses repository metadata as a signal. Human curation decisions control final visibility.\n");
249
+ // Always-on workflows (safe for both private and public projects)
185
250
  await writeIfMissing(join(root, ".github", "workflows", "validate-data.yml"), workflowValidate());
186
- await writeIfMissing(join(root, ".github", "workflows", "import.yml"), workflowImport());
187
- await writeIfMissing(join(root, ".github", "workflows", "deploy.yml"), workflowDeploy(deploy, framework));
188
- await writeIfMissing(join(root, ".github", "ISSUE_TEMPLATE", "app_submission.md"), issueTemplateSubmission());
251
+ await writeIfMissing(join(root, ".github", "workflows", "build.yml"), workflowBuild(framework));
252
+ // Issue templates — both modes support a basic set
253
+ await writeIfMissing(join(root, ".github", "ISSUE_TEMPLATE", "record_submission.md"), issueTemplateSubmission(blueprint));
189
254
  await writeIfMissing(join(root, ".github", "ISSUE_TEMPLATE", "bug_report.md"), issueTemplateBug());
190
255
  await writeIfMissing(join(root, ".github", "ISSUE_TEMPLATE", "feature_request.md"), issueTemplateFeature());
256
+ // Public-GitHub-only workflows and templates
257
+ if (githubMode === "public") {
258
+ await writeIfMissing(join(root, ".github", "workflows", "sync-github-metadata.yml"), workflowSyncGithubMetadata());
259
+ await writeIfMissing(join(root, ".github", "workflows", "sync-contributors.yml"), workflowSyncContributors());
260
+ await writeIfMissing(join(root, ".github", "workflows", "cleanup-stale-records.yml"), workflowCleanupStaleRecords());
261
+ await writeIfMissing(join(root, ".github", "workflows", "update-records.yml"), workflowUpdateRecords());
262
+ await writeIfMissing(join(root, ".github", "ISSUE_TEMPLATE", "report-broken-record.md"), issueTemplateBrokenRecord());
263
+ await writeIfMissing(join(root, ".github", "pull_request_template.md"), pullRequestTemplate());
264
+ }
191
265
  await writeIfMissing(join(root, "LICENSE"), licenseMIT(projectName));
192
266
  s.stop("Scaffolded");
193
- // ── 8. git init ────────────────────────────────────────────
194
267
  if (initGit) {
195
268
  try {
196
269
  await runExternal("git", ["init", "-b", "main"], { stdio: "ignore", cwd: root });
@@ -200,7 +273,6 @@ program
200
273
  p.log.warn("git not found — skipping git init");
201
274
  }
202
275
  }
203
- // ── 9. pnpm install ────────────────────────────────────────
204
276
  if (installDeps) {
205
277
  const installSpinner = p.spinner();
206
278
  installSpinner.start("Installing dependencies");
@@ -208,15 +280,21 @@ program
208
280
  await runExternal("pnpm", ["install"], { stdio: "ignore", cwd: root });
209
281
  installSpinner.stop("Installed dependencies");
210
282
  }
211
- catch (err) {
283
+ catch {
212
284
  installSpinner.stop("Install failed");
213
285
  p.log.warn(`Run \`pnpm install\` inside ${root} to retry.`);
214
286
  }
215
287
  }
288
+ const ghLabel = githubMode === "public"
289
+ ? "public GitHub metadata (sync + cleanup + update workflows)"
290
+ : "none / private (only validate + build workflows)";
216
291
  p.outro(`🌳 ${projectName} is ready at ${root}\n\n` +
292
+ `Blueprint: ${blueprint}\n` +
293
+ `GitHub mode: ${ghLabel}\n\n` +
217
294
  `Next steps:\n` +
218
295
  ` cd ${projectDir}\n` +
219
- ` grove import <awesome-list-url>\n` +
296
+ ` grove validate\n` +
297
+ ` grove generate\n` +
220
298
  ` grove build\n`);
221
299
  });
222
300
  // ──────────────────────────────────────────────────────────────────────
@@ -225,130 +303,104 @@ program
225
303
  program
226
304
  .command("import")
227
305
  .argument("<source>", "GitHub awesome-list URL, raw README URL, or local README.md")
228
- .description("Import Markdown links into data/items.yml.")
306
+ .description("Import Markdown links into data/records/*.yml for the current blueprint.")
229
307
  .action(async (source) => {
230
308
  const config = await loadConfig();
231
309
  const result = await importAwesomeList(source);
232
- await writeYamlFile(config.paths.items, { items: result.items });
233
- const report = [
234
- "# Import Report",
235
- "",
236
- `Source: ${source}`,
237
- `Imported: ${result.report.imported}`,
238
- `Skipped: ${result.report.skipped}`,
239
- `Categories: ${result.report.categories.length}`,
240
- `Duplicate slugs adjusted: ${result.report.duplicateSlugs}`,
241
- "",
242
- "## Categories",
243
- "",
244
- ...result.report.categories.map((category) => `- ${category}`),
245
- "",
246
- ].join("\n");
247
- await writeTextFile(join(config.paths.sourcesDir, "import-report.md"), report);
248
- console.log(`Imported ${result.items.length} items into ${config.paths.items}`);
249
- });
250
- // ──────────────────────────────────────────────────────────────────────
251
- // grove analyze
252
- // ──────────────────────────────────────────────────────────────────────
253
- program
254
- .command("analyze")
255
- .description("Fetch GitHub metadata and generate data/health.yml.")
256
- .option("--limit <n>", "limit analyzed items for demos/rate limits", (value) => Number(value))
257
- .action(async (options) => {
258
- const config = await loadConfig();
259
- const items = itemsFileSchema.parse(await readYamlFile(config.paths.items));
260
- const list = "items" in items ? items.items : items;
261
- const selected = typeof options.limit === "number" ? list.slice(0, options.limit) : list;
262
- const health = [];
263
- for (const item of selected) {
264
- const ref = parseGithubRepoUrl(item.links.github);
265
- if (!ref) {
266
- health.push(classifyHealth(item.id));
267
- continue;
310
+ const recordsDir = resolve(process.cwd(), config.paths.recordsDir);
311
+ await mkdir(recordsDir, { recursive: true });
312
+ const expectedKind = blueprintKind[config.blueprint];
313
+ let written = 0;
314
+ for (const record of result.records) {
315
+ const yamlObj = {
316
+ kind: expectedKind,
317
+ slug: record.slug,
318
+ description: record.description,
319
+ category: record.category,
320
+ tags: [],
321
+ links: record.links,
322
+ source: { type: "import" },
323
+ };
324
+ if (expectedKind === "project") {
325
+ yamlObj.name = record.name;
326
+ }
327
+ else if (expectedKind === "resource") {
328
+ yamlObj.title = record.name;
329
+ yamlObj.type = "link";
330
+ yamlObj.topic = record.category;
331
+ }
332
+ else if (expectedKind === "entity") {
333
+ yamlObj.name = record.name;
334
+ yamlObj.type = "other";
268
335
  }
269
- console.log(`Analyzing ${ref.owner}/${ref.repo}`);
270
- const metadata = await fetchGithubMetadata(ref);
271
- health.push(classifyHealth(item.id, metadata));
336
+ const path = join(recordsDir, `${record.slug}.yml`);
337
+ await writeFile(path, stringifyRecordYaml(yamlObj), "utf8");
338
+ written++;
272
339
  }
273
- await writeYamlFile(config.paths.health, { health });
274
- console.log(`Wrote ${health.length} health entries to ${config.paths.health}`);
340
+ console.log(`Imported ${written} record(s) into ${recordsDir}`);
275
341
  });
276
342
  // ──────────────────────────────────────────────────────────────────────
277
343
  // grove validate
278
344
  // ──────────────────────────────────────────────────────────────────────
279
345
  program
280
346
  .command("validate")
281
- .description("Validate project data files.")
282
- .action(async () => {
347
+ .description("Validate project data files against the configured blueprint.")
348
+ .option("--strict", "fail on warnings as well as errors")
349
+ .action(async (opts) => {
283
350
  const config = await loadConfig();
284
- const result = await validateProject(config);
285
- for (const issue of result.issues) {
286
- console.log(`${issue.code}: ${issue.message}`);
351
+ const result = await validateProject(config, { strict: opts.strict });
352
+ for (const issue of result.errors) {
353
+ console.log(`✖ ${issue.code}: ${issue.message}`);
354
+ }
355
+ for (const issue of result.warnings) {
356
+ console.log(`⚠ ${issue.code}: ${issue.message}`);
287
357
  }
288
358
  if (!result.ok) {
289
359
  process.exitCode = 1;
290
- console.log(`Validation failed with ${result.issues.length} issue(s).`);
360
+ const total = result.issues.length;
361
+ const errorCount = result.errors.length;
362
+ const warnCount = result.warnings.length;
363
+ console.log(`Validation failed with ${errorCount} error(s) and ${warnCount} warning(s) (${total} total).`);
291
364
  return;
292
365
  }
293
- console.log("Validation passed.");
294
- });
295
- // ──────────────────────────────────────────────────────────────────────
296
- // grove build
297
- //
298
- // Build the static site in the current project. Discovers the
299
- // framework by reading the project's package.json (deps on
300
- // @grove-dev/<framework>), then runs the matching build command
301
- // (`astro build`, `next build`, `vite build`).
302
- // ──────────────────────────────────────────────────────────────────────
303
- program
304
- .command("build")
305
- .description("Build the static directory in the current project repo.")
306
- .action(async () => {
307
- const framework = await detectFramework();
308
- const cmd = frameworkBuildCommand(framework);
309
- runExternal(cmd[0], cmd[1], { stdio: "inherit" });
310
- });
311
- // ──────────────────────────────────────────────────────────────────────
312
- // grove dev
313
- // ──────────────────────────────────────────────────────────────────────
314
- program
315
- .command("dev")
316
- .description("Start the framework dev server in the current project repo.")
317
- .action(async () => {
318
- const framework = await detectFramework();
319
- const cmd = frameworkDevCommand(framework);
320
- runExternal(cmd[0], cmd[1], { stdio: "inherit" });
366
+ if (result.warnings.length > 0) {
367
+ console.log(`Validation passed with ${result.warnings.length} warning(s).`);
368
+ }
369
+ else {
370
+ console.log("Validation passed.");
371
+ }
321
372
  });
322
373
  // ──────────────────────────────────────────────────────────────────────
323
- // grove build-data
374
+ // grove generate
324
375
  // ──────────────────────────────────────────────────────────────────────
325
376
  program
326
- .command("build-data")
327
- .description("Build data/generated/*.json from data/apps/*.yml + curated.config.ts.")
377
+ .command("generate")
378
+ .description("Build data/generated/records.{full,index}.json from data/records/*.yml.")
328
379
  .action(async () => {
329
- const result = await buildData();
330
- console.log(`[build-data] ${result.totalApps} full, ${result.visibleApps} visible index\n` +
380
+ const result = await generate();
381
+ console.log(`[generate] ${result.totalRecords} total, ${result.visibleRecords} visible\n` +
331
382
  ` full: ${result.fullPath}\n` +
332
383
  ` index: ${result.indexPath}\n` +
333
- ` config: ${result.configTsPath}`);
384
+ ` alias: ${result.aliasPath}`);
334
385
  });
335
386
  // ──────────────────────────────────────────────────────────────────────
336
387
  // grove sitemap
337
388
  // ──────────────────────────────────────────────────────────────────────
338
389
  program
339
390
  .command("sitemap")
340
- .description("Generate public/sitemap.xml from data/generated/apps.full.json + curated.config.ts.")
391
+ .description("Generate public/sitemap.xml from data/generated/records.full.json.")
341
392
  .action(async () => {
342
393
  const config = await loadConfig();
343
- const appsPath = join(process.cwd(), config.paths.generatedDir, "apps.full.json");
394
+ const { buildSitemap } = await import("@grove-dev/core");
395
+ const recordsPath = join(process.cwd(), config.paths.generatedDir, "records.full.json");
344
396
  let payload;
345
397
  try {
346
- payload = JSON.parse(await readFile(appsPath, "utf8"));
398
+ payload = JSON.parse(await readFile(recordsPath, "utf8"));
347
399
  }
348
400
  catch {
349
- payload = { apps: [] };
401
+ payload = { records: [] };
350
402
  }
351
- const items = (payload.apps ?? []);
403
+ const items = (payload.records ?? []);
352
404
  const result = await buildSitemap({
353
405
  generatedAt: payload.generatedAt ?? new Date().toISOString(),
354
406
  items,
@@ -356,123 +408,205 @@ program
356
408
  console.log(`[sitemap] wrote ${result.urlCount} URLs → ${result.path}`);
357
409
  });
358
410
  // ──────────────────────────────────────────────────────────────────────
359
- // grove enrich
411
+ // grove llms
360
412
  // ──────────────────────────────────────────────────────────────────────
361
413
  program
362
- .command("enrich")
363
- .description("Enrich data/apps/*.yml with HTML-scrape GitHub metadata (no token required).")
364
- .option("--limit <n>", "limit enriched apps for rate limits", (value) => Number(value))
365
- .action(async (options) => {
414
+ .command("llms")
415
+ .description("Generate public/llms.txt and public/llms-full.txt.")
416
+ .action(async () => {
366
417
  const config = await loadConfig();
367
- const appsDir = resolve(process.cwd(), config.paths.appsDir);
418
+ const { buildLlmsFiles } = await import("@grove-dev/core");
419
+ const recordsPath = join(process.cwd(), config.paths.generatedDir, "records.full.json");
420
+ let payload;
421
+ try {
422
+ payload = JSON.parse(await readFile(recordsPath, "utf8"));
423
+ }
424
+ catch {
425
+ payload = { records: [] };
426
+ }
427
+ const records = (payload.records ?? []);
428
+ const result = await buildLlmsFiles({
429
+ generatedAt: payload.generatedAt ?? new Date().toISOString(),
430
+ records: records.map((r) => ({
431
+ slug: r.slug,
432
+ name: r.name ?? r.title ?? r.slug,
433
+ description: r.description,
434
+ category: r.category,
435
+ stack: r.stack,
436
+ stars: r.stars,
437
+ visibility: r.visibility,
438
+ })),
439
+ });
440
+ console.log(`[llms] ${result.indexed} indexed → ${result.txtPath} + ${result.fullPath}`);
441
+ });
442
+ // ──────────────────────────────────────────────────────────────────────
443
+ // grove sync github
444
+ // ──────────────────────────────────────────────────────────────────────
445
+ program
446
+ .command("sync")
447
+ .argument("<target>", "github | contributors")
448
+ .description("Optional GitHub integration: enrich records with GitHub metadata.")
449
+ .option("--limit <n>", "limit records to sync (rate-limit guard)", (value) => Number(value))
450
+ .option("--strict", "fail on unavailable GitHub metadata")
451
+ .action(async (target, options) => {
452
+ const config = await loadConfig();
453
+ if (target !== "github" && target !== "contributors") {
454
+ console.error(`Unknown sync target: ${target}. Use "github" or "contributors".`);
455
+ process.exit(1);
456
+ }
457
+ if (target === "contributors") {
458
+ console.log("[sync contributors] contributor sync is not yet implemented in V1.");
459
+ return;
460
+ }
461
+ const recordsDir = resolve(process.cwd(), config.paths.recordsDir);
368
462
  const { readdir } = await import("node:fs/promises");
369
- let entries;
463
+ let entries = [];
370
464
  try {
371
- entries = await readdir(appsDir);
465
+ entries = await readdir(recordsDir);
372
466
  }
373
- catch (err) {
374
- console.error(`[enrich] ${appsDir} does not exist.`);
467
+ catch {
468
+ console.error(`[sync github] ${recordsDir} does not exist.`);
375
469
  process.exit(1);
376
470
  }
377
471
  const files = entries.filter((f) => f.endsWith(".yml")).sort();
378
472
  const selected = typeof options.limit === "number" ? files.slice(0, options.limit) : files;
379
473
  let updated = 0;
380
- let skipped = 0;
381
- const failed = [];
474
+ let failed = 0;
382
475
  for (const file of selected) {
383
- const path = join(appsDir, file);
476
+ const path = join(recordsDir, file);
384
477
  const text = await readFile(path, "utf8");
385
- const raw = parseAppYaml(text, file.replace(/\.yml$/, ""));
386
- const app = normalizeAppRecord(raw, file.replace(/\.yml$/, ""));
387
- if (!app.repoUrl) {
388
- skipped++;
389
- continue;
390
- }
391
- process.stdout.write(`[enrich] ${app.slug} ... `);
392
- const res = await enrichFromGithubHtml(app.repoUrl);
393
- if (res.notFound) {
394
- process.stdout.write("skip (404)\n");
395
- skipped++;
478
+ const raw = (parseYaml(text) ?? {});
479
+ const links = raw.links ?? {};
480
+ if (!links.github)
396
481
  continue;
397
- }
398
- if (res.rateLimited) {
399
- process.stdout.write("rate-limited\n");
400
- failed.push(`${app.slug}: rate-limited`);
482
+ const ref = parseGithubRepoUrl(links.github);
483
+ if (!ref)
401
484
  continue;
485
+ process.stdout.write(`[sync github] ${ref.owner}/${ref.repo} ... `);
486
+ let metadata = null;
487
+ let didEnrich = false;
488
+ try {
489
+ metadata = await fetchGithubMetadata(ref);
402
490
  }
403
- if (res.error) {
404
- process.stdout.write(`error: ${res.error}\n`);
405
- failed.push(`${app.slug}: ${res.error}`);
406
- continue;
491
+ catch {
492
+ try {
493
+ const enriched = await enrichFromGithubHtml(links.github);
494
+ if (enriched.fields) {
495
+ process.stdout.write("html-fallback\n");
496
+ didEnrich = true;
497
+ }
498
+ }
499
+ catch {
500
+ process.stdout.write("skipped (api error)\n");
501
+ failed++;
502
+ continue;
503
+ }
407
504
  }
408
- const f = res.fields;
409
- const repo = raw.github?.repository;
505
+ const gh = raw.github ?? {};
410
506
  const next = {
411
- ...(repo ?? {}),
412
- ...(f.license ? { license: { spdx_id: f.license, key: null, name: null, url: null } } : {}),
413
- ...(f.language ? { language: f.language } : {}),
414
- ...(f.topics.length > 0 ? { topics: f.topics } : {}),
415
- ...(f.homepage ? { homepage: f.homepage } : {}),
507
+ ...raw,
508
+ github: { ...gh, repository: metadata },
416
509
  };
417
- const nextDoc = { ...raw, github: { ...(raw.github ?? {}), repository: next } };
418
- const out = stringifyAppYaml(nextDoc);
419
- if (out !== text) {
420
- await writeFile(path, out, "utf8");
421
- process.stdout.write(`updated (license=${f.license ?? "—"} lang=${f.language ?? "—"})\n`);
422
- updated++;
423
- }
424
- else {
425
- process.stdout.write("no change\n");
426
- }
510
+ await writeFile(path, stringifyRecordYaml(next), "utf8");
511
+ if (!didEnrich)
512
+ process.stdout.write("updated\n");
513
+ updated++;
514
+ }
515
+ console.log(`\n[sync github] ${updated} updated, ${failed} failed`);
516
+ // In strict mode, fail the build if any record could not be synced.
517
+ if (options.strict && failed > 0) {
518
+ process.exitCode = 1;
519
+ console.error(`[sync github] --strict: ${failed} record(s) could not be synced.`);
427
520
  }
428
- console.log(`\n[enrich] ${updated} updated, ${skipped} skipped, ${failed.length} failed`);
429
521
  });
430
522
  // ──────────────────────────────────────────────────────────────────────
431
- // grove review
523
+ // grove cleanup stale
432
524
  // ──────────────────────────────────────────────────────────────────────
433
525
  program
434
- .command("review")
435
- .description("List items that need human curation (cleanup candidates, unknown, etc).")
436
- .action(async () => {
437
- const { report, path } = await buildReviewReport();
438
- console.log(`[review] ${report.totalCandidates} candidate(s) → ${path}`);
526
+ .command("cleanup")
527
+ .argument("<target>", "stale")
528
+ .description("List records that need human curation.")
529
+ .option("--report", "produce a report (default behaviour in V1)")
530
+ .option("--strict", "fail the run if any candidates need curation")
531
+ .action(async (target, opts) => {
532
+ if (target !== "stale") {
533
+ console.error(`Unknown cleanup target: ${target}. Use "stale".`);
534
+ process.exit(1);
535
+ }
536
+ const { report, path } = await cleanupStale();
537
+ console.log(`[cleanup stale] ${report.totalCandidates} candidate(s) → ${path}`);
439
538
  for (const c of report.candidates.slice(0, 10)) {
440
539
  console.log(` - ${c.slug} (${c.status}, ${c.stars}★)`);
441
540
  }
541
+ if (opts.strict && report.totalCandidates > 0) {
542
+ process.exitCode = 1;
543
+ console.error(`[cleanup stale] --strict: ${report.totalCandidates} record(s) need human review.`);
544
+ }
442
545
  });
443
546
  // ──────────────────────────────────────────────────────────────────────
444
- // grove build-llms-full
547
+ // grove workflows sync
445
548
  // ──────────────────────────────────────────────────────────────────────
446
549
  program
447
- .command("build-llms-full")
448
- .description("Generate public/llms.txt and public/llms-full.txt from generated apps data.")
449
- .action(async () => {
550
+ .command("workflows")
551
+ .argument("<action>", "sync")
552
+ .description("Sync Grove workflow templates into the current project.")
553
+ .option("--force", "overwrite existing workflow files")
554
+ .action(async (action, opts) => {
555
+ if (action !== "sync") {
556
+ console.error(`Unknown workflows action: ${action}. Use "sync".`);
557
+ process.exit(1);
558
+ }
450
559
  const config = await loadConfig();
451
- const appsPath = join(process.cwd(), config.paths.generatedDir, "apps.full.json");
452
- let payload;
453
- try {
454
- payload = JSON.parse(await readFile(appsPath, "utf8"));
560
+ // config.integrations.github is the configured GitHub integration mode.
561
+ // `false` → "none" (private); anything else → "public".
562
+ const githubMode = config.integrations?.github === false || config.integrations?.github === undefined
563
+ ? "none"
564
+ : "public";
565
+ const root = process.cwd();
566
+ // Make sure the directories exist.
567
+ ensureDir(join(root, ".github", "workflows"));
568
+ ensureDir(join(root, ".github", "ISSUE_TEMPLATE"));
569
+ const files = [
570
+ { path: join(root, ".github", "workflows", "validate-data.yml"), content: workflowValidate() },
571
+ { path: join(root, ".github", "workflows", "build.yml"), content: workflowBuild("astro") },
572
+ ];
573
+ if (githubMode === "public") {
574
+ 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() });
455
575
  }
456
- catch {
457
- payload = { apps: [] };
576
+ let written = 0;
577
+ let skipped = 0;
578
+ for (const f of files) {
579
+ if (!opts.force && (await existsLocal(f.path))) {
580
+ skipped++;
581
+ continue;
582
+ }
583
+ await writeFile(f.path, f.content, "utf8");
584
+ written++;
458
585
  }
459
- const apps = (payload.apps ?? []);
460
- const result = await buildLlmsFiles({
461
- generatedAt: payload.generatedAt ?? new Date().toISOString(),
462
- apps: apps.map((a) => ({
463
- slug: a.slug,
464
- name: a.name,
465
- description: a.description,
466
- category: a.category,
467
- stack: a.stack,
468
- stars: a.stars,
469
- visibility: a.visibility,
470
- })),
471
- });
472
- console.log(`[build-llms-full] ${result.indexed} indexed → ${result.txtPath} + ${result.fullPath}`);
586
+ console.log(`[workflows sync] ${githubMode} mode: ${written} written, ${skipped} skipped` +
587
+ (opts.force ? " (--force)" : ""));
473
588
  });
474
589
  // ──────────────────────────────────────────────────────────────────────
475
- // Framework discovery + command resolution
590
+ // grove build / grove dev
591
+ // ──────────────────────────────────────────────────────────────────────
592
+ program
593
+ .command("build")
594
+ .description("Build the static site in the current project repo.")
595
+ .action(async () => {
596
+ const framework = await detectFramework();
597
+ const cmd = frameworkBuildCommand(framework);
598
+ await runExternal(cmd[0], cmd[1], { stdio: "inherit" });
599
+ });
600
+ program
601
+ .command("dev")
602
+ .description("Start the framework dev server in the current project repo.")
603
+ .action(async () => {
604
+ const framework = await detectFramework();
605
+ const cmd = frameworkDevCommand(framework);
606
+ await runExternal(cmd[0], cmd[1], { stdio: "inherit" });
607
+ });
608
+ // ──────────────────────────────────────────────────────────────────────
609
+ // Framework discovery
476
610
  // ──────────────────────────────────────────────────────────────────────
477
611
  async function detectFramework() {
478
612
  try {
@@ -489,7 +623,7 @@ async function detectFramework() {
489
623
  /* ignore */
490
624
  }
491
625
  console.error("Could not detect a Grove framework in the current project.");
492
- console.error("Install @grove-dev/astro, @grove-dev/nextjs, or @grove-dev/svelte first.");
626
+ console.error("Install @grove-dev/astro first. (Next.js and SvelteKit are roadmap-only in V1.)");
493
627
  process.exit(1);
494
628
  }
495
629
  function frameworkBuildCommand(fw) {
@@ -527,9 +661,17 @@ function runExternal(bin, args, opts = {}) {
527
661
  });
528
662
  });
529
663
  }
664
+ async function existsLocal(path) {
665
+ try {
666
+ await access(path);
667
+ return true;
668
+ }
669
+ catch {
670
+ return false;
671
+ }
672
+ }
530
673
  // ──────────────────────────────────────────────────────────────────────
531
- // Templated project files (these stay in the CLI; they're emitted
532
- // per-project and have nothing to do with the framework adapter).
674
+ // Helper: project file templates
533
675
  // ──────────────────────────────────────────────────────────────────────
534
676
  async function resolveText(message, fallback, placeholder) {
535
677
  const result = await p.text({
@@ -556,53 +698,62 @@ async function writeIfMissing(path, content) {
556
698
  await writeFile(path, content, "utf8");
557
699
  }
558
700
  }
559
- function projectConfig(projectName) {
701
+ function projectConfig(projectName, blueprint, githubMode) {
702
+ const githubIntegrations = githubMode === "public"
703
+ ? `integrations: { github: { metadata: true, health: true } },`
704
+ : `integrations: { github: false },`;
560
705
  return `import { defineConfig } from "@grove-dev/core";
561
706
 
562
707
  export default defineConfig({
563
- name: "${projectName}",
564
- tagline: "A living, health-aware developer directory.",
565
- itemLabel: "project",
708
+ blueprint: "${blueprint}",
709
+
710
+ site: {
711
+ name: "${projectName}",
712
+ tagline: "A growing community knowledge site.",
713
+ },
714
+
715
+ ${githubIntegrations}
716
+
717
+ facets: ["category", "tags"],
566
718
  });
567
719
  `;
568
720
  }
569
- function projectReadme(projectName, framework) {
721
+ function projectReadme(projectName, blueprint, framework) {
570
722
  return `# ${projectName}
571
723
 
572
- A living, health-aware developer directory built with [Grove](https://github.com/tortuvshin/grove).
724
+ A growing community knowledge site built with [Grove](https://github.com/tortuvshin/grove).
573
725
 
574
- Framework: **${framework}**
726
+ Blueprint: **${blueprint}** · Framework: **${framework}**
575
727
 
576
728
  ## What this is
577
729
 
578
730
  This repository is **data + branding + decisions**, not the framework.
579
- The CLI and static framework live in the separate \`grove\` repo.
731
+ The CLI and the renderer live in the \`grove\` repo; you consume them as
732
+ \`@grove-dev/core\`, \`@grove-dev/cli\`, and \`@grove-dev/${framework}\`.
580
733
 
581
734
  ## Workflow
582
735
 
583
736
  \`\`\`bash
584
- grove import <source>
585
- grove analyze
586
- grove review
587
- grove validate
588
- grove build-data
589
- grove build-llms-full
590
- grove sitemap
591
- grove build
737
+ grove import <awesome-list-url> # write data/records/*.yml
738
+ grove sync github # optional: enrich with GitHub metadata
739
+ grove cleanup stale # flag records that need human review
740
+ grove validate # check schemas, slugs, taxonomy
741
+ grove generate # build data/generated/records.{full,index}.json
742
+ grove sitemap # write public/sitemap.xml
743
+ grove llms # write public/llms.txt + llms-full.txt
744
+ grove build # run the framework's build command
592
745
  \`\`\`
593
746
 
594
747
  ## Files
595
748
 
596
- - \`curated.config.ts\` — site name, tagline, and data paths.
597
- - \`sources/\` — original Markdown lists that feed the directory.
598
- - \`data/items.yml\` — parsed project list (commit this).
599
- - \`data/apps/\` — per-app YAML records (commit this).
600
- - \`data/health.yml\` — generated GitHub health metadata (regenerate on demand).
601
- - \`data/overrides.yml\` — manual corrections to items.
749
+ - \`grove.config.ts\` — site name, blueprint, integrations, theme, paths.
750
+ - \`data/records/\` — per-record YAML (commit this).
602
751
  - \`data/decisions.yml\` — human curation decisions.
603
- - \`data/taxonomy/\` — registry of stacks, platforms, categories, distribution channels.
604
- - \`content/methodology.md\` — the public methodology page.
752
+ - \`data/generated/\` — auto-generated JSON; do not commit.
753
+ - \`content/pages/\` — Markdown pages (\`about.md\`, \`methodology.md\`, ...).
754
+ - \`content/records/\` — optional Markdown body per record.
605
755
  - \`public/\` — logo, OG image, and other static assets.
756
+ - \`.github/workflows/\` — validate + build + (optional) sync workflows.
606
757
  `;
607
758
  }
608
759
  function gitignoreTemplate() {
@@ -615,7 +766,6 @@ dist/
615
766
  .env
616
767
  .env.*
617
768
  !.env.example
618
- data/.cache/
619
769
  data/generated/
620
770
  coverage/
621
771
  .tmp-test/
@@ -625,311 +775,429 @@ coverage/
625
775
  *.tsbuildinfo
626
776
  `;
627
777
  }
628
- function taxonomyStacks() {
629
- return `- id: typescript
630
- name: TypeScript
631
- family: language
632
- languages: [typescript, javascript]
633
- - id: javascript
634
- name: JavaScript
635
- family: language
636
- languages: [javascript]
637
- - id: rust
638
- name: Rust
639
- family: language
640
- languages: [rust]
641
- - id: go
642
- name: Go
643
- family: language
644
- languages: [go]
645
- - id: python
646
- name: Python
647
- family: language
648
- languages: [python]
649
- - id: flutter
650
- name: Flutter
651
- family: cross-platform
652
- languages: [dart]
653
- platforms: [ios, android, web, macos, windows, linux]
654
- - id: react-native
655
- name: React Native
656
- family: cross-platform
657
- languages: [typescript, javascript]
658
- platforms: [ios, android]
659
- `;
660
- }
661
- function taxonomyPlatforms() {
662
- return `- id: web
663
- name: Web
664
- - id: ios
665
- name: iOS
666
- - id: android
667
- name: Android
668
- - id: macos
669
- name: macOS
670
- - id: windows
671
- name: Windows
672
- - id: linux
673
- name: Linux
674
- - id: desktop
675
- name: Desktop
676
- - id: embedded
677
- name: Embedded
678
- `;
679
- }
680
- function taxonomyCategories() {
681
- return `- id: tools
682
- name: Tools
683
- - id: libraries
684
- name: Libraries
685
- - id: frameworks
686
- name: Frameworks
687
- - id: applications
688
- name: Applications
689
- - id: ai
690
- name: AI / ML
691
- - id: devtools
692
- name: Developer Tools
693
- - id: web
694
- name: Web
695
- - id: mobile
696
- name: Mobile
697
- - id: backend
698
- name: Backend
699
- - id: infrastructure
700
- name: Infrastructure
701
- `;
702
- }
703
- function taxonomyDistribution() {
704
- return `- id: app-store
705
- name: App Store
706
- platforms: [ios, macos]
707
- - id: play-store
708
- name: Play Store
709
- platforms: [android]
710
- - id: fdroid
711
- name: F-Droid
712
- platforms: [android]
713
- - id: github-releases
714
- name: GitHub Releases
715
- platforms: [ios, android, macos, windows, linux]
716
- - id: website
717
- name: Website
718
- platforms: [web, ios, android, macos, windows, linux]
719
- - id: package-registry
720
- name: Package Registry
721
- - id: npm
722
- name: npm
723
- - id: crates-io
724
- name: crates.io
725
- - id: pypi
726
- name: PyPI
727
- - id: other
728
- name: Other
729
- `;
730
- }
731
778
  function workflowValidate() {
732
779
  return `name: Validate data
733
780
 
781
+ # Runs on every PR, every push to main, and on manual dispatch.
782
+ # No secrets required — safe for fork PRs.
734
783
  on:
735
784
  pull_request:
736
- paths:
737
- - "data/**"
738
- - "curated.config.ts"
739
- - "package.json"
785
+ push:
786
+ branches:
787
+ - main
740
788
  workflow_dispatch:
741
789
 
790
+ permissions:
791
+ contents: read
792
+
742
793
  jobs:
743
794
  validate:
744
795
  runs-on: ubuntu-latest
796
+
745
797
  steps:
746
- - uses: actions/checkout@v4
747
- - uses: pnpm/action-setup@v4
748
- - uses: actions/setup-node@v4
798
+ - name: Checkout
799
+ uses: actions/checkout@v4
800
+
801
+ - name: Setup pnpm
802
+ uses: pnpm/action-setup@v4
803
+
804
+ - name: Setup Node
805
+ uses: actions/setup-node@v4
749
806
  with:
750
807
  node-version: "20"
751
808
  cache: pnpm
752
- - run: pnpm install --frozen-lockfile
753
- - run: pnpm run validate:data
809
+
810
+ - name: Install dependencies
811
+ run: pnpm install --frozen-lockfile
812
+
813
+ - name: Validate Grove data
814
+ run: pnpm exec grove validate
754
815
  `;
755
816
  }
756
- function workflowImport() {
757
- return `name: Refresh data
817
+ function workflowBuild(framework) {
818
+ // The project's "build" script in package.json already chains
819
+ // grove generate && grove sitemap && grove llms && <framework> build
820
+ // via the `grove` package's own build orchestration. Keep the workflow thin.
821
+ return `name: Build site
758
822
 
823
+ # Runs on every PR, every push to main, and on manual dispatch.
824
+ # No secrets required — safe for fork PRs.
759
825
  on:
760
- schedule:
761
- - cron: "0 6 * * *"
826
+ pull_request:
827
+ push:
828
+ branches:
829
+ - main
762
830
  workflow_dispatch:
763
831
 
832
+ permissions:
833
+ contents: read
834
+
764
835
  jobs:
765
- refresh:
836
+ build:
766
837
  runs-on: ubuntu-latest
767
- permissions:
768
- contents: write
769
- pull-requests: write
838
+
770
839
  steps:
771
- - uses: actions/checkout@v4
772
- - uses: pnpm/action-setup@v4
773
- - uses: actions/setup-node@v4
840
+ - name: Checkout
841
+ uses: actions/checkout@v4
842
+
843
+ - name: Setup pnpm
844
+ uses: pnpm/action-setup@v4
845
+
846
+ - name: Setup Node
847
+ uses: actions/setup-node@v4
774
848
  with:
775
849
  node-version: "20"
776
850
  cache: pnpm
777
- - run: pnpm install --frozen-lockfile
778
- - name: Refresh items
779
- run: |
780
- grove import "$AWESOME_SOURCE"
781
- grove analyze
782
- grove review
783
- grove build-data
784
- grove build-llms-full
785
- grove sitemap
786
- env:
787
- AWESOME_SOURCE: \${{ vars.AWESOME_SOURCE }}
788
- GITHUB_TOKEN: \${{ secrets.GITHUB_TOKEN }}
789
- - name: Open PR
790
- uses: peter-evans/create-pull-request@v6
851
+ cache-dependency-path: "**/pnpm-lock.yaml"
852
+
853
+ - name: Install dependencies
854
+ run: pnpm install --frozen-lockfile
855
+
856
+ - name: Build the site
857
+ run: pnpm build
858
+
859
+ - name: Upload build artifact
860
+ uses: actions/upload-artifact@v4
791
861
  with:
792
- title: "chore(data): refresh from upstream"
793
- commit-message: "chore(data): refresh from upstream"
794
- branch: chore/data-refresh
862
+ name: dist
863
+ path: dist
864
+ retention-days: 7
795
865
  `;
796
866
  }
797
- function workflowDeploy(provider, framework) {
798
- switch (provider) {
799
- case "vercel":
800
- return `name: Deploy to Vercel
867
+ function issueTemplateSubmission(blueprint) {
868
+ const labelHint = blueprint === "project-directory"
869
+ ? `- **Repository URL** (required):
870
+ - **Name**:
871
+ - **One-line description** (≤ 120 chars):
872
+ - **Category** (e.g. tools, libraries, frameworks):`
873
+ : blueprint === "resource-hub"
874
+ ? `- **Resource URL** (required):
875
+ - **Title**:
876
+ - **Type** (guide | comparison | link | explainer | other):
877
+ - **Topic**:`
878
+ : `- **Name**:
879
+ - **Type** (company | organization | community | school | ...):
880
+ - **Category**:
881
+ - **Website URL**:`;
882
+ return `---
883
+ name: Submit a record
884
+ about: Suggest a new record to add to this Grove site
885
+ title: "[Submit] "
886
+ labels: submission
887
+ ---
888
+
889
+ ${labelHint}
890
+
891
+ ## Why include it?
892
+
893
+ A few sentences on what makes this record worth listing.
894
+ `;
895
+ }
896
+ function workflowSyncGithubMetadata() {
897
+ return `name: Sync GitHub metadata
898
+
899
+ # Refreshes GitHub repository metadata (stars, forks, last commit, license, …)
900
+ # for records that link to public GitHub repos. Runs nightly and on demand.
901
+ # Uses GROVE_GITHUB_TOKEN if set, else falls back to GITHUB_TOKEN.
902
+ # Does NOT mutate human-owned data/records/*.yml files — it writes
903
+ # .grove/generated/github-metadata.json and data/records metadata only.
801
904
  on:
802
- push:
803
- branches: [main]
905
+ schedule:
906
+ - cron: "0 2 * * *"
804
907
  workflow_dispatch:
908
+
909
+ permissions:
910
+ contents: write
911
+ pull-requests: write
912
+
805
913
  jobs:
806
- deploy:
914
+ sync:
807
915
  runs-on: ubuntu-latest
916
+
808
917
  steps:
809
- - uses: actions/checkout@v4
810
- - uses: pnpm/action-setup@v4
811
- - uses: actions/setup-node@v4
812
- with: { node-version: "20", cache: pnpm }
813
- - run: pnpm install --frozen-lockfile
814
- - run: pnpm run build
815
- - uses: amondnet/vercel-action@v25
918
+ - name: Checkout
919
+ uses: actions/checkout@v4
920
+
921
+ - name: Setup pnpm
922
+ uses: pnpm/action-setup@v4
923
+
924
+ - name: Setup Node
925
+ uses: actions/setup-node@v4
816
926
  with:
817
- vercel-token: \${{ secrets.VERCEL_TOKEN }}
818
- vercel-org-id: \${{ secrets.VERCEL_ORG_ID }}
819
- vercel-project-id: \${{ secrets.VERCEL_PROJECT_ID }}
820
- vercel-args: '--prod'
821
- working-directory: ./
927
+ node-version: "20"
928
+ cache: pnpm
929
+ cache-dependency-path: "**/pnpm-lock.yaml"
930
+
931
+ - name: Install dependencies
932
+ run: pnpm install --frozen-lockfile
933
+
934
+ - name: Sync GitHub metadata
935
+ run: pnpm exec grove sync github
936
+ env:
937
+ GITHUB_TOKEN: \${{ secrets.GROVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
938
+
939
+ - name: Regenerate Grove data
940
+ run: pnpm exec grove generate
941
+
942
+ - name: Open PR with metadata refresh
943
+ uses: peter-evans/create-pull-request@v6
944
+ with:
945
+ branch: chore/grove-sync-github-metadata
946
+ title: "chore: sync GitHub metadata"
947
+ commit-message: "chore: sync GitHub metadata"
948
+ body: |
949
+ Automated metadata refresh by Grove.
950
+
951
+ - Updated GitHub stars, forks, last commit, license, etc.
952
+ - Triggered by: \${{ github.event_name }}
953
+ add-paths: |
954
+ data/records/*.yml
955
+ data/generated/*.json
822
956
  `;
823
- case "netlify":
824
- return `name: Deploy to Netlify
957
+ }
958
+ function workflowSyncContributors() {
959
+ return `name: Sync contributors
960
+
961
+ # Refreshes contributor data (avatars, recent activity, top contributors)
962
+ # for records that have a public GitHub repository. Runs weekly and on demand.
963
+ # Uses GROVE_GITHUB_TOKEN if set, else falls back to GITHUB_TOKEN.
825
964
  on:
826
- push:
827
- branches: [main]
965
+ schedule:
966
+ - cron: "0 3 * * 1"
828
967
  workflow_dispatch:
968
+
969
+ permissions:
970
+ contents: write
971
+ pull-requests: write
972
+
829
973
  jobs:
830
- deploy:
974
+ sync:
831
975
  runs-on: ubuntu-latest
976
+
832
977
  steps:
833
- - uses: actions/checkout@v4
834
- - uses: pnpm/action-setup@v4
835
- - uses: actions/setup-node@v4
836
- with: { node-version: "20", cache: pnpm }
837
- - run: pnpm install --frozen-lockfile
838
- - run: pnpm run build
839
- - uses: nwtgck/actions-netlify@v3.0
978
+ - name: Checkout
979
+ uses: actions/checkout@v4
980
+
981
+ - name: Setup pnpm
982
+ uses: pnpm/action-setup@v4
983
+
984
+ - name: Setup Node
985
+ uses: actions/setup-node@v4
840
986
  with:
841
- publish-dir: ./dist
842
- production-deploy: true
843
- deploy-message: "Deploy from GitHub Actions"
987
+ node-version: "20"
988
+ cache: pnpm
989
+ cache-dependency-path: "**/pnpm-lock.yaml"
990
+
991
+ - name: Install dependencies
992
+ run: pnpm install --frozen-lockfile
993
+
994
+ - name: Sync contributors
995
+ run: pnpm exec grove sync contributors
844
996
  env:
845
- NETLIFY_AUTH_TOKEN: \${{ secrets.NETLIFY_AUTH_TOKEN }}
846
- NETLIFY_SITE_ID: \${{ secrets.NETLIFY_SITE_ID }}
997
+ GITHUB_TOKEN: \${{ secrets.GROVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
998
+
999
+ - name: Open PR with contributor refresh
1000
+ uses: peter-evans/create-pull-request@v6
1001
+ with:
1002
+ branch: chore/grove-sync-contributors
1003
+ title: "chore: sync contributors"
1004
+ commit-message: "chore: sync contributors"
1005
+ body: |
1006
+ Automated contributor refresh by Grove.
1007
+
1008
+ - Updated contributor lists, avatars, and recent activity.
1009
+ - Triggered by: \${{ github.event_name }}
1010
+ add-paths: |
1011
+ data/generated/contributors.json
1012
+ .grove/cache/contributors.json
847
1013
  `;
848
- case "cloudflare":
849
- return `name: Deploy to Cloudflare Pages
1014
+ }
1015
+ function workflowCleanupStaleRecords() {
1016
+ return `name: Cleanup stale records
1017
+
1018
+ # Reports records that may be outdated, archived, or no longer useful.
1019
+ # V1 behaviour is REPORT-ONLY — does not delete records. Use --strict in
1020
+ # the CLI to fail the run if any candidates are flagged.
850
1021
  on:
851
- push:
852
- branches: [main]
1022
+ schedule:
1023
+ - cron: "0 4 * * 0"
853
1024
  workflow_dispatch:
1025
+
1026
+ permissions:
1027
+ contents: write
1028
+ pull-requests: write
1029
+ issues: write
1030
+
854
1031
  jobs:
855
- deploy:
1032
+ cleanup:
856
1033
  runs-on: ubuntu-latest
1034
+
857
1035
  steps:
858
- - uses: actions/checkout@v4
859
- - uses: pnpm/action-setup@v4
860
- - uses: actions/setup-node@v4
861
- with: { node-version: "20", cache: pnpm }
862
- - run: pnpm install --frozen-lockfile
863
- - run: pnpm run build
864
- - uses: cloudflare/pages-action@v1
1036
+ - name: Checkout
1037
+ uses: actions/checkout@v4
1038
+
1039
+ - name: Setup pnpm
1040
+ uses: pnpm/action-setup@v4
1041
+
1042
+ - name: Setup Node
1043
+ uses: actions/setup-node@v4
1044
+ with:
1045
+ node-version: "20"
1046
+ cache: pnpm
1047
+ cache-dependency-path: "**/pnpm-lock.yaml"
1048
+
1049
+ - name: Install dependencies
1050
+ run: pnpm install --frozen-lockfile
1051
+
1052
+ - name: Generate stale-record report
1053
+ run: pnpm exec grove cleanup stale
1054
+ env:
1055
+ GITHUB_TOKEN: \${{ secrets.GROVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
1056
+
1057
+ - name: Open PR with stale-record report
1058
+ uses: peter-evans/create-pull-request@v6
865
1059
  with:
866
- apiToken: \${{ secrets.CLOUDFLARE_API_TOKEN }}
867
- accountId: \${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
868
- projectName: ${framework}-site
869
- directory: dist
1060
+ branch: chore/grove-stale-record-report
1061
+ title: "chore: update stale record report"
1062
+ commit-message: "chore: update stale record report"
1063
+ body: |
1064
+ Automated stale record report by Grove.
1065
+
1066
+ - Records flagged for human review (archived, inactive, broken links, …).
1067
+ - Triggered by: \${{ github.event_name }}
1068
+ add-paths: |
1069
+ data/generated/stale-records.json
1070
+ docs/generated/stale-records.md
870
1071
  `;
871
- case "github-pages":
872
- return `name: Build & deploy to GitHub Pages
1072
+ }
1073
+ function workflowUpdateRecords() {
1074
+ return `name: Update Grove records
1075
+
1076
+ # Full maintenance cycle: validate + sync GitHub metadata + sync contributors
1077
+ # + cleanup stale records + regenerate. Run on demand, or weekly if your
1078
+ # project needs hands-off maintenance.
873
1079
  on:
874
- push:
875
- branches: [main]
876
1080
  workflow_dispatch:
1081
+ schedule:
1082
+ - cron: "0 5 * * 1"
1083
+
1084
+ permissions:
1085
+ contents: write
1086
+ pull-requests: write
1087
+ issues: write
1088
+
877
1089
  jobs:
878
- build:
1090
+ update:
879
1091
  runs-on: ubuntu-latest
1092
+
880
1093
  steps:
881
- - uses: actions/checkout@v4
882
- - uses: pnpm/action-setup@v4
883
- - uses: actions/setup-node@v4
884
- with: { node-version: "20", cache: pnpm }
885
- - run: pnpm install --frozen-lockfile
886
- - run: pnpm run build
887
- - uses: actions/upload-pages-artifact@v3
1094
+ - name: Checkout
1095
+ uses: actions/checkout@v4
1096
+
1097
+ - name: Setup pnpm
1098
+ uses: pnpm/action-setup@v4
1099
+
1100
+ - name: Setup Node
1101
+ uses: actions/setup-node@v4
888
1102
  with:
889
- path: dist
890
- deploy:
891
- needs: build
892
- if: github.ref == 'refs/heads/main'
893
- runs-on: ubuntu-latest
894
- permissions:
895
- pages: write
896
- id-token: write
897
- environment:
898
- name: github-pages
899
- url: \${{ steps.deployment.outputs.page_url }}
900
- steps:
901
- - id: deployment
902
- uses: actions/deploy-pages@v4
1103
+ node-version: "20"
1104
+ cache: pnpm
1105
+ cache-dependency-path: "**/pnpm-lock.yaml"
1106
+
1107
+ - name: Install dependencies
1108
+ run: pnpm install --frozen-lockfile
1109
+
1110
+ - name: Validate records
1111
+ run: pnpm exec grove validate
1112
+
1113
+ - name: Sync GitHub metadata
1114
+ run: pnpm exec grove sync github
1115
+ env:
1116
+ GITHUB_TOKEN: \${{ secrets.GROVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
1117
+
1118
+ - name: Sync contributors
1119
+ run: pnpm exec grove sync contributors
1120
+ env:
1121
+ GITHUB_TOKEN: \${{ secrets.GROVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
1122
+
1123
+ - name: Cleanup stale records
1124
+ run: pnpm exec grove cleanup stale
1125
+ env:
1126
+ GITHUB_TOKEN: \${{ secrets.GROVE_GITHUB_TOKEN || secrets.GITHUB_TOKEN }}
1127
+
1128
+ - name: Regenerate
1129
+ run: pnpm exec grove generate
1130
+
1131
+ - name: Open PR with maintenance update
1132
+ uses: peter-evans/create-pull-request@v6
1133
+ with:
1134
+ branch: chore/grove-update-records
1135
+ title: "chore: update Grove records"
1136
+ commit-message: "chore: update Grove records"
1137
+ body: |
1138
+ Automated Grove maintenance update.
1139
+
1140
+ - Validated records
1141
+ - Synced GitHub metadata
1142
+ - Synced contributors
1143
+ - Flagged stale records (report only)
1144
+ - Regenerated indexes
1145
+
1146
+ Triggered by: \${{ github.event_name }}
903
1147
  `;
904
- case "none":
905
- return `# No deploy workflow generated. Add your own when ready.`;
906
- }
907
1148
  }
908
- function issueTemplateSubmission() {
1149
+ function issueTemplateBrokenRecord() {
909
1150
  return `---
910
- name: Submit a project
911
- about: Suggest an open-source project to add to this directory
912
- title: "[Submit] "
913
- labels: submission
1151
+ name: Report broken record
1152
+ about: Report a broken link, dead project, wrong category, or duplicate record
1153
+ title: "[Broken] "
1154
+ labels: broken-record
914
1155
  ---
915
1156
 
916
- ## Project
1157
+ ## Which record is broken?
917
1158
 
918
- - **Repository URL** (required):
919
- - **Name**:
920
- - **One-line description** (≤ 120 chars):
921
- - **Category** (e.g. tools, libraries, frameworks):
922
- - **Stack / language** (e.g. typescript, rust):
923
- - **Platforms** (e.g. web, ios, android):
1159
+ Record slug (e.g. \`zod\`) or full URL of the record page:
924
1160
 
925
- ## Why include it?
1161
+ ## What is wrong?
1162
+
1163
+ - [ ] Broken link (404, dead site, repo not found)
1164
+ - [ ] Dead / abandoned / archived project
1165
+ - [ ] Wrong category or tags
1166
+ - [ ] Duplicate of an existing record
1167
+ - [ ] Security concern
1168
+ - [ ] Outdated metadata (stars, last commit, etc.)
1169
+ - [ ] Incorrect description
1170
+ - [ ] Other (describe below)
1171
+
1172
+ ## Details
1173
+
1174
+ A short description of the issue, with evidence if possible (link to a working
1175
+ alternative, archive.org snapshot, or commit history).
1176
+
1177
+ ## Suggested fix (optional)
1178
+
1179
+ If you know what should change, describe it here.
1180
+ `;
1181
+ }
1182
+ function pullRequestTemplate() {
1183
+ return `## What did you add or change?
1184
+
1185
+ <!-- A short summary of your change. -->
1186
+
1187
+ ## Is this a new record?
926
1188
 
927
- A few sentences on what makes this project worth listing — maturity,
928
- adoption, learning value, or unique qualities.
1189
+ - [ ] Yes — adds a new record under \`data/records/\`
1190
+ - [ ] No — updates an existing record, fixes a bug, or changes infrastructure
929
1191
 
930
- ## Source
1192
+ ## Checklist
931
1193
 
932
- Where did you find it? (Awesome list, blog post, etc.)
1194
+ - [ ] I added or updated records under \`data/records/\`
1195
+ - [ ] The record has a clear, accurate description
1196
+ - [ ] The category and tags are appropriate
1197
+ - [ ] I ran \`pnpm exec grove validate\` and it passed
1198
+ - [ ] I did not add generated files manually unless required
1199
+ - [ ] I included the official / source link where available
1200
+ - [ ] This PR is safe to publish (no private or sensitive data)
933
1201
  `;
934
1202
  }
935
1203
  function issueTemplateBug() {
@@ -956,7 +1224,7 @@ What you expected to happen.
956
1224
  function issueTemplateFeature() {
957
1225
  return `---
958
1226
  name: Feature request
959
- about: Suggest a new feature for this directory
1227
+ about: Suggest a new feature
960
1228
  title: "[Feature] "
961
1229
  labels: enhancement
962
1230
  ---