reffy-cli 0.6.6 → 0.6.7

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.
Files changed (2) hide show
  1. package/dist/cli.js +12 -2
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1,10 +1,13 @@
1
1
  #!/usr/bin/env node
2
+ import { createRequire } from "node:module";
2
3
  import { existsSync, promises as fs, statSync } from "node:fs";
3
4
  import path from "node:path";
4
5
  import { renderDiagram } from "./diagram.js";
5
6
  import { runDoctor } from "./doctor.js";
6
7
  import { ReferencesStore } from "./storage.js";
7
8
  import { summarizeArtifacts } from "./summarize.js";
9
+ const require = createRequire(import.meta.url);
10
+ const { version: packageVersion } = require("../package.json");
8
11
  const REFFY_ASCII = [
9
12
  " __ __ ",
10
13
  " _ __ ___ / _|/ _|_ _",
@@ -224,6 +227,9 @@ function usage() {
224
227
  return [
225
228
  "Usage: reffy <command> [--repo PATH] [--output text|json]",
226
229
  "",
230
+ "Flags:",
231
+ " --version Print the installed reffy package version.",
232
+ "",
227
233
  "Commands:",
228
234
  " init Ensure root AGENTS.md block and .reffy/AGENTS.md are up to date.",
229
235
  " bootstrap Run init, ensure .reffy structure exists, then reindex artifacts.",
@@ -365,9 +371,13 @@ function printSection(title, values) {
365
371
  }
366
372
  async function main() {
367
373
  const [, , command, ...rest] = process.argv;
368
- if (!command) {
374
+ if (!command || command === "--help" || command === "-h") {
369
375
  console.error(usage());
370
- return 1;
376
+ return command ? 0 : 1;
377
+ }
378
+ if (command === "--version") {
379
+ console.log(packageVersion);
380
+ return 0;
371
381
  }
372
382
  if (command === "diagram") {
373
383
  const [subcommand, ...diagramArgs] = rest;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "reffy-cli",
3
- "version": "0.6.6",
3
+ "version": "0.6.7",
4
4
  "description": "CLI-first, framework-agnostic references workflow for any repo (TypeScript)",
5
5
  "keywords": [
6
6
  "reffy",