delivery-friction-analyzer 0.24.0 → 0.25.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -141,6 +141,8 @@ Use `--json` when automation needs the full machine-readable completion receipt
141
141
 
142
142
  Use `--interactive` only in a terminal when you want prompts for live GitHub setup. Enter `?` at supported prompts for contextual help without restarting the flow. When combined with `--json`, prompts and progress stay off stdout so the final completion receipt remains parseable JSON.
143
143
 
144
+ Use `--version` or `-v` as the only argument to print the package version.
145
+
144
146
  ## How To Read A Report
145
147
 
146
148
  Start with `friction-report.md`. If a bottleneck looks surprising, inspect `methodology.md`, the CSV exports, `friction-report.json`, and `source-bundle.json`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "delivery-friction-analyzer",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "description": "Local GitHub pull request analytics for delivery friction reports.",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/release-log.md CHANGED
@@ -2,6 +2,14 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ### 2026-07-02 — First-Run CLI Trust Polish
6
+
7
+ - What changed: The CLI now supports standalone `--version` and `-v` package-version output, documents that version check in help and README options, gives missing-profile live runs starter-profile recovery guidance, and verifies `--json` completion keeps parseable JSON on stdout while progress stays on stderr.
8
+ - Why it matters: First-time users and automation can check the installed package, recover from missing live-analysis setup, and trust stdout/stderr behavior without guessing from implementation details.
9
+ - Who is affected: Users running the CLI for the first time, maintainers setting up live GitHub analysis, and scripts that parse `--json` completion output.
10
+ - Action needed: None.
11
+ - PR: https://github.com/hannasdev/delivery-friction-analyzer/pull/72
12
+
5
13
  ### 2026-06-29 — Report Confidence Digest Usability
6
14
 
7
15
  - What changed: Generated Markdown reports now keep edge-case confidence caveats visible in the top digest, including review-thread-only coverage gaps, one-class PR-class comparison limits, and correctly ordered contribution ranges.
@@ -34,11 +34,15 @@ import {
34
34
 
35
35
  const RUN_PRESET_SCHEMA_VERSION = "analyze-github-run-preset.v1";
36
36
  const SAMPLE_SOURCE_LABEL = "Bundled synthetic sample, not live GitHub data";
37
+ const PACKAGE_JSON_URL = new URL("../../package.json", import.meta.url);
37
38
  const SAMPLE_SOURCE_BUNDLE_URL = new URL("../../examples/tutorial/source-bundle.json", import.meta.url);
38
39
  const SAMPLE_PROFILE_URL = new URL("../../examples/tutorial/profile.json", import.meta.url);
39
40
  const STARTER_PROFILE_PROMPT_COPY = "Starter profiles are valid, but until you add rules the report may classify PR classes, file roles, and functional surfaces as unknown.";
40
41
  const CONVENTIONAL_COMMIT_PRESET_PROMPT_COPY = "Add Conventional Commit PR class rules?\nUse this when PR titles usually start with feat:, fix:, docs:, test:, chore(deps):, or similar prefixes.\nIt writes title-based dependency, feature, fix, docs, test, and maintenance classes so fewer PRs are classified as unknown.\nSkip it for release titles, ticket prefixes, free-form titles, or another custom PR taxonomy.\nIt does not change scoring, rankings, GitHub collection, or CSV export shape.";
41
42
  const STARTER_PROFILE_COMPLETION_COPY = "Created a starter profile. Review or refine it before relying on report labels for PR classes, file roles, or functional surfaces.";
43
+ const MISSING_PROFILE_GUIDANCE = `Live GitHub analysis needs a repository-profile.v1 JSON file.
44
+ Run with --interactive to create a starter profile, or pass --profile path/to/profile.json.
45
+ Starter profiles are valid, but review them before trusting PR class, file role, or functional-surface labels.`;
42
46
 
43
47
  const ALLOWED_OPTIONS = new Set([
44
48
  "source",
@@ -111,6 +115,7 @@ const RUN_PRESET_OPTION_KEYS = Object.freeze([
111
115
  ]);
112
116
 
113
117
  const REPOSITORY_SLUG = /^([A-Za-z0-9_.-]+)\/([A-Za-z0-9_.-]+)$/;
118
+ let packageVersionPromise = null;
114
119
 
115
120
  export const ANALYZE_GITHUB_ARTIFACTS = Object.freeze({
116
121
  sourceBundle: "source-bundle.json",
@@ -156,6 +161,9 @@ Output controls:
156
161
  --csv Enable curated CSV evidence exports when a preset disabled them.
157
162
  --no-csv Suppress curated CSV evidence exports.
158
163
 
164
+ Global options:
165
+ --version, -v Print the package version. Use as the only argument.
166
+
159
167
  Help:
160
168
  --source sample --help Show sample-mode options.
161
169
  --source github --help Show live GitHub, dry-run, interactive, and preset options.
@@ -175,6 +183,9 @@ Sample output controls:
175
183
  --csv Enable curated CSV evidence exports.
176
184
  --no-csv Suppress curated CSV evidence exports.
177
185
 
186
+ Global options:
187
+ --version, -v Print the package version. Use as the only argument.
188
+
178
189
  Live-only flags are not supported with --source sample:
179
190
  --repo, --limit, --profile, --dry-run, --metadata-only, --validation-target,
180
191
  --interactive, --preset, --save-preset, --exclude-pr-class, --allow-product-repository
@@ -213,6 +224,9 @@ Interactive setup and presets:
213
224
  --interactive Prompt for missing live GitHub run options in a terminal; enter ? at supported prompts for contextual help.
214
225
  --preset <path> Load reusable live GitHub run settings from a saved preset. Explicit CLI flags override preset values.
215
226
  --save-preset <path> Save reusable live GitHub run settings for non-interactive reruns.
227
+
228
+ Global options:
229
+ --version, -v Print the package version. Use as the only argument.
216
230
  `;
217
231
 
218
232
  export const SOURCE_SELECTION_GUIDANCE = `Choose what to analyze.
@@ -223,6 +237,12 @@ Try the bundled sample:
223
237
  Analyze a GitHub repository:
224
238
  delivery-friction-analyzer --source github --repo owner/name --limit 30 --profile path/to/profile.json --out reports/owner-name`;
225
239
 
240
+ async function readPackageVersion() {
241
+ packageVersionPromise ??= readFile(PACKAGE_JSON_URL, "utf8")
242
+ .then(text => JSON.parse(text).version);
243
+ return packageVersionPromise;
244
+ }
245
+
226
246
  function attachOptionSource(options, property, value) {
227
247
  Object.defineProperty(options, property, {
228
248
  value,
@@ -517,10 +537,18 @@ function requireOptions(options) {
517
537
  if (!options.profilePath) missing.push("--profile");
518
538
  if (!options.outDir) missing.push("--out");
519
539
  if (missing.length > 0) {
520
- throw new Error(`Missing required option(s): ${missing.join(", ")}`);
540
+ throw new Error(missingRequiredOptionsMessage(missing));
521
541
  }
522
542
  }
523
543
 
544
+ function missingRequiredOptionsMessage(missing) {
545
+ const lines = [`Missing required option(s): ${missing.join(", ")}`];
546
+ if (missing.includes("--profile")) {
547
+ lines.push("", MISSING_PROFILE_GUIDANCE);
548
+ }
549
+ return lines.join("\n");
550
+ }
551
+
524
552
  function requireSampleOptions(options) {
525
553
  if (!options.outDir) {
526
554
  throw new Error("Missing required option(s): --out");
@@ -2054,6 +2082,10 @@ export async function runAnalyzeGithubCli(argv, {
2054
2082
  let savedProfilePath = null;
2055
2083
  let savedRunPresetPath = null;
2056
2084
  try {
2085
+ if (hasVersionOption(argv)) {
2086
+ stdout.write(`${await readPackageVersion()}\n`);
2087
+ return null;
2088
+ }
2057
2089
  const parsedOptions = parseAnalyzeGithubArgs(argv);
2058
2090
  if (parsedOptions.help) {
2059
2091
  stdout.write(usageForOptions(parsedOptions));
@@ -2132,6 +2164,10 @@ export async function runAnalyzeGithubCli(argv, {
2132
2164
  }
2133
2165
  }
2134
2166
 
2167
+ function hasVersionOption(argv) {
2168
+ return argv.length === 1 && (argv[0] === "--version" || argv[0] === "-v");
2169
+ }
2170
+
2135
2171
  async function main(argv) {
2136
2172
  await runAnalyzeGithubCli(argv);
2137
2173
  }