@grove-dev/cli 0.1.5 → 0.2.5

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