featureparity 0.0.30 → 0.0.32

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7b3bad4ccc28e0695bdb790ecc37d6836d5477a84de09442c5255df871d98444
4
- data.tar.gz: 67fcd3d1ac1a1a7bd41197ae674942fea80d20bbea22d856075face50ad87007
3
+ metadata.gz: dc148bcfad876dfa40128241e661004d4469788e2c943263446513fa2023c61a
4
+ data.tar.gz: 1dc7dd025ad5e7d228cdefa76d2c40ccdbbd7a74ab1ff8a64e642f05625cdaf3
5
5
  SHA512:
6
- metadata.gz: b276bc10363baf2fe27e843e0824ed205ed62f7836f4671cf53db15fc92ddc6a579a2fb1f5da34c4f34e672ffe2c14c418d10239e55066aa1a4b5806f078b930
7
- data.tar.gz: 2769c008ecac2bdd2f02c13ef34cdc91619085709965138dc8750ab4127ebd22d119eae646a89202217db47235ddc4e75e1efae24528feeed1b1a7d53ec20f80
6
+ metadata.gz: 1e66acc239526910b5a67ea8436f056b4437ce2292cc825e367671e15b936e11cbb43a83bf2417e894901bd2203ecf0caefb9763adc4f25e1e1fb58c55587c5d
7
+ data.tar.gz: a63607ba0033c147e8ed262eee5d484b0026c56e46c17d097d6a349b06cec43aae472347d0e744fa04486110ffb7e842907f78d8c211fe4a66fb64f9e72da915
data/lib/fp/cli.rb CHANGED
@@ -60,6 +60,9 @@ module Fp
60
60
  # reported "Unknown command: --version".
61
61
  command_name = 'version' if %w[--version -v].include?(command_name)
62
62
 
63
+ # `fp --help` / `fp -h` are aliases for `fp help`, for the same reason.
64
+ command_name = 'help' if %w[--help -h].include?(command_name)
65
+
63
66
  command_class = COMMANDS[command_name]
64
67
 
65
68
  unless command_class
@@ -80,7 +83,7 @@ module Fp
80
83
 
81
84
  # Profile/config commands don't need auth. `init` is here too: it only writes
82
85
  # files into the repo, and onboarding a repo must work before anyone has a key.
83
- needs_auth = !%w[init doctor profile config repos setup whoami version help mark].include?(command_name)
86
+ needs_auth = !%w[init doctor profile config repos setup whoami version help mark tutorial].include?(command_name)
84
87
 
85
88
  if needs_auth
86
89
  config = Config.new(profile: global_opts[:profile], api_url: global_opts[:api_url])
@@ -22,8 +22,8 @@ module Fp
22
22
  help_flag :conflicts, 'Include cross-requirement conflict findings'
23
23
  help_flag :force, 'Re-analyze even cached (unchanged) requirements'
24
24
  help_flag :cached, 'Read cached analyses only; do not spend model calls'
25
- help_example 'fp analyze --project stowzilla'
26
- help_example 'fp analyze print_container_qr --project stowzilla --conflicts'
25
+ help_example 'fp analyze --project acme'
26
+ help_example 'fp analyze print_container_qr --project acme --conflicts'
27
27
 
28
28
  KNOWN_FLAGS = {
29
29
  project: :string,
@@ -148,6 +148,7 @@ module Fp
148
148
  'status' => requirement['status'],
149
149
  'action' => action,
150
150
  'verdict' => analysis && analysis['verdict'],
151
+ 'verdict_reasons' => (analysis && analysis['verdict_reasons']) || [],
151
152
  'failed_checks' => analysis ? failed_legitimacy_checks(analysis) : [],
152
153
  'issues' => issues,
153
154
  'duplicate_of' => issues.find { |i| i['type'] == 'duplicate' }&.dig('duplicate_of'),
@@ -202,12 +203,14 @@ module Fp
202
203
  puts " issues: #{entry['issues'].map { |i| i['type'] }.join(', ')}" unless entry['issues'].empty?
203
204
  warrants = warrants_line(entry['warrants_requirement'])
204
205
  puts " #{warrants}" if warrants && entry['warrants_requirement']['judgment'] == false
206
+ print_verdict_reasons(entry, indent: ' ')
205
207
  puts " error: #{entry['error']}" if entry['error']
206
208
  end
207
209
 
208
210
  def print_detail(entry)
209
211
  puts "#{entry['slug']} — #{entry['title']}"
210
212
  puts " verdict: #{entry['verdict'] || '(none)'} suggested: #{ACTIONS[entry['action']]}"
213
+ print_verdict_reasons(entry, indent: ' ')
211
214
  puts " superseded by: #{entry['duplicate_of']}" if entry['duplicate_of']
212
215
  warrants = warrants_line(entry['warrants_requirement'])
213
216
  puts " #{warrants}" if warrants
@@ -220,6 +223,18 @@ module Fp
220
223
  puts " error: #{entry['error']}" if entry['error']
221
224
  end
222
225
 
226
+ # Why the verdict is what it is (Fizzy #1896). The server decides the verdict as a
227
+ # gate — an issue means needs work, a weakness means acceptable — and sends the
228
+ # reasons; the CLI only prints them, so an agent reading "acceptable" knows what
229
+ # to fix before it asks a human to look.
230
+ def print_verdict_reasons(entry, indent:)
231
+ reasons = entry['verdict_reasons'] || []
232
+ return if reasons.empty? || entry['verdict'].nil? || entry['verdict'] == 'good'
233
+
234
+ puts "#{indent}why #{entry['verdict'].tr('_', ' ')}:"
235
+ reasons.each { |reason| puts "#{indent} - #{reason}" }
236
+ end
237
+
223
238
  # The analyzer's yes/no on whether the concept deserves to be a requirement at all.
224
239
  # A "no" carries its reason so a human can decide to withdraw it — the CLI only
225
240
  # reports it; nothing is withdrawn or proposed on the strength of the judgment.
@@ -18,8 +18,8 @@ module Fp
18
18
  help_flag :sha, 'Commit SHA the capture observed'
19
19
  help_flag :example_title, 'Name of the individual test this media proves'
20
20
  help_flag :evidence_key, 'Composite receipt key (surface:repo:test_type) to bind to'
21
- help_example 'fp attach print_qr e2e-run.webm --project stowzilla --surface customer_web --example-title "prints a QR code onto the container label"'
22
- help_example 'fp attach rm print_qr <attachment-id> --project stowzilla'
21
+ help_example 'fp attach print_qr e2e-run.webm --project acme --surface customer_web --example-title "prints a QR code onto the container label"'
22
+ help_example 'fp attach rm print_qr <attachment-id> --project acme'
23
23
  help_note 'Visual: png, jpg, gif, webp, mp4, webm, mov. Text/docs: txt, md, json, svg, pdf. Max 100 MB.'
24
24
 
25
25
  CONTENT_TYPES = {
@@ -10,7 +10,7 @@ module Fp
10
10
  help_usage 'fp attachments <slug> --project <slug>',
11
11
  'fp attachments <slug> <attachment-id> --project <slug>'
12
12
  help_flag :project, 'Project slug (falls back to .featureparity.yml)'
13
- help_example 'fp attachments print_container_qr --project stowzilla'
13
+ help_example 'fp attachments print_container_qr --project acme'
14
14
 
15
15
  KNOWN_FLAGS = { project: :string }.freeze
16
16
 
@@ -69,7 +69,7 @@ module Fp
69
69
  help_flag :sha, 'Checkout commit SHA'
70
70
  help_flag :allow_empty, 'Do not error when a report resolves no fp:<slug> markers'
71
71
  help_flag :local, 'No CI available: report a suite a person ran locally at a clean, committed HEAD (--ci-url optional)'
72
- help_example 'fp ci-report --junit junit.xml --project stowzilla --surface api --ci-url "$CI_RUN_URL"'
72
+ help_example 'fp ci-report --junit junit.xml --project acme --surface api --ci-url "$CI_RUN_URL"'
73
73
  help_example 'fp ci-report --junit web.xml --surface web --base-dir frontend --pr "$PR_URL"'
74
74
  help_example 'fp ci-report --local --junit junit.xml --surface api'
75
75
  help_note "This is CI's command, not an agent's: only it writes passing/failing. Run it on both\n" \
@@ -27,7 +27,7 @@ module Fp
27
27
  help_flag :source_type, "Origin type: #{VALID_SOURCE_TYPES.join(', ')}"
28
28
  help_flag :source_url, 'Origin URL'
29
29
  help_flag :source_context, 'Free-form origin note'
30
- help_example 'fp comment print_qr --body "This conflicts with the freezer label requirement" --project stowzilla'
30
+ help_example 'fp comment print_qr --body "This conflicts with the freezer label requirement" --project acme'
31
31
 
32
32
  def run(args)
33
33
  opts, positional = parse_flags(args, KNOWN_FLAGS)
@@ -19,7 +19,7 @@ module Fp
19
19
  help_flag :project, 'Project slug (falls back to .featureparity.yml)'
20
20
  help_flag :body, 'Post this comment (omit to list the comments)'
21
21
  help_flag :tag, 'Comma-separated people (email or name) or agents (name or key name) to tag'
22
- help_example 'fp comments print_qr --project stowzilla'
22
+ help_example 'fp comments print_qr --project acme'
23
23
  help_example 'fp comments print_qr --body "The redesign dropped this screen — retire it?" --tag andy@example.com'
24
24
 
25
25
  def run(args)
@@ -18,8 +18,8 @@ module Fp
18
18
  help_flag :category, 'Only requirements in this category'
19
19
  help_flag :surface, 'Only requirements that name this surface'
20
20
  help_flag :output, 'Write to this file instead of stdout'
21
- help_example 'fp export --project stowzilla > requirements.md'
22
- help_example 'fp export --project stowzilla --status active --surface customer_android --output reqs.md'
21
+ help_example 'fp export --project acme > requirements.md'
22
+ help_example 'fp export --project acme --status active --surface customer_android --output reqs.md'
23
23
 
24
24
  KNOWN_FLAGS = {
25
25
  project: :string,
@@ -9,6 +9,8 @@ module Fp
9
9
  class Help < Base
10
10
  def run(args)
11
11
  topic = args.first
12
+ return print_index if output&.json? && (topic.nil? || topic.start_with?('-'))
13
+
12
14
  if topic && Fp::CLI::COMMANDS.key?(topic)
13
15
  puts Fp::CLI::COMMANDS[topic].help_text(topic)
14
16
  return
@@ -26,6 +28,17 @@ module Fp
26
28
 
27
29
  private
28
30
 
31
+ # `fp help --json`: every command with its summary and usage, from the same
32
+ # metadata `fp <cmd> --help --json` reads. A command with no declared summary
33
+ # still appears by name (summary nil, usage the generic line).
34
+ def print_index
35
+ commands = Fp::CLI::COMMANDS.map do |name, klass|
36
+ schema = klass.help_schema(name)
37
+ { 'name' => name, 'summary' => schema['summary'], 'usage' => schema['usage'] }
38
+ end
39
+ output.success({ 'version' => Fp::VERSION, 'commands' => commands })
40
+ end
41
+
29
42
  def print_overview
30
43
  puts <<~HELP
31
44
  fp - FeatureParity CLI for agents
@@ -222,13 +235,13 @@ module Fp
222
235
  # Onboard a repo onto FeatureParity: writes .featureparity.yml, a CI gate
223
236
  # workflow, and a FeatureParity section in AGENTS.md telling agents to mark
224
237
  # and report their tests. Needs no API key.
225
- fp init --project stowzilla --surface api
226
- fp init --project stowzilla --no-workflow # skip the CI workflow
227
- fp init --project stowzilla --force # refresh previously written files
238
+ fp init --project acme --surface api
239
+ fp init --project acme --no-workflow # skip the CI workflow
240
+ fp init --project acme --force # refresh previously written files
228
241
 
229
242
  # Enforce parity. Exits 1 on violations, so CI blocks the merge.
230
243
  fp check # project from .featureparity.yml
231
- fp check --project stowzilla --surface api # gate one surface only
244
+ fp check --project acme --surface api # gate one surface only
232
245
  fp check --level covered # demand coverage, not just no regressions
233
246
  fp check --warn-only # report violations but exit 0
234
247
  fp check --json # machine-readable violations
@@ -260,38 +273,38 @@ module Fp
260
273
  fp projects delete calib-rate --yes
261
274
 
262
275
  # List the surfaces a project tracks (requirements may only name these)
263
- fp surfaces --project stowzilla
276
+ fp surfaces --project acme
264
277
 
265
278
  # View a single surface's details (owner, repo, kind, test globs)
266
- fp surfaces show customer_android --project stowzilla
279
+ fp surfaces show customer_android --project acme
267
280
 
268
281
  # Create a surface (agents can do this — no need to wait on the web app)
269
- fp surfaces add customer_android --project stowzilla \\
282
+ fp surfaces add customer_android --project acme \\
270
283
  --name "Customer Android App" \\
271
284
  --kind android \\
272
- --repo stowzilla/customer-android
285
+ --repo acme/customer-android
273
286
 
274
287
  # Fix up an existing surface (add refuses a key that already exists)
275
- fp surfaces edit web --project stowzilla --kind web --repo stowzilla/web
288
+ fp surfaces edit web --project acme --kind web --repo acme/web
276
289
 
277
290
  # Delete a surface (type the key back, or --yes non-interactively)
278
- fp surfaces delete web --project stowzilla --yes
291
+ fp surfaces delete web --project acme --yes
279
292
 
280
293
  # List requirements for a project
281
- fp list --project stowzilla
294
+ fp list --project acme
282
295
 
283
296
  # List requirements filtered by category
284
- fp list --project stowzilla --category security
297
+ fp list --project acme --category security
285
298
 
286
299
  # List requirements filtered by tag (free-form label)
287
- fp list --project stowzilla --tag mobile
300
+ fp list --project acme --tag mobile
288
301
 
289
302
  # Show gaps: requirements with a required surface that has no real evidence
290
303
  # (missing, stubbed, or failing). Unlike `fp list`, this reads evidence.
291
- fp list --project stowzilla --gaps --surface customer_android
304
+ fp list --project acme --gaps --surface customer_android
292
305
 
293
306
  # Show a specific requirement
294
- fp show print_container_qr --project stowzilla
307
+ fp show print_container_qr --project acme
295
308
 
296
309
  # Propose a new requirement (creates as draft).
297
310
  # A requirement records the current shared understanding, not a decree handed from
@@ -352,7 +365,7 @@ module Fp
352
365
  # vague, revise or ask. Then read it as a manager deciding scope: is the value clear,
353
366
  # is the result observable, are decisions separated from guesses, and does every
354
367
  # sentence earn its place? Do not save until the draft passes this review.
355
- fp propose --project stowzilla \\
368
+ fp propose --project acme \\
356
369
  --slug print_container_qr \\
357
370
  --name "Print QR code on container label" \\
358
371
  --why "Staff scan the label to find a container; without a QR they key the ID by hand and mis-type it" \\
@@ -363,7 +376,7 @@ module Fp
363
376
 
364
377
  # Nest a requirement under a parent (--parent takes the parent's SLUG).
365
378
  # A child's --required surfaces must be a subset of its parent's.
366
- fp propose --project stowzilla \\
379
+ fp propose --project acme \\
367
380
  --slug print_container_qr_ios \\
368
381
  --name "Print QR on iOS" \\
369
382
  --parent print_container_qr \\
@@ -372,7 +385,7 @@ module Fp
372
385
  # Propose a change to a requirement that already exists. Say what prompted it
373
386
  # — the card, the thread, the issue. The requirement drops back to DRAFT and a
374
387
  # human reviews the old-vs-new diff before it counts again.
375
- fp propose-change print_container_qr --project stowzilla \\
388
+ fp propose-change print_container_qr --project acme \\
376
389
  --name "Print a scannable container QR" \\
377
390
  --slug print_scannable_container_qr \\
378
391
  --why "Labels must survive a freezer" \\
@@ -382,27 +395,27 @@ module Fp
382
395
  --source-url https://app.fizzy.do/6098707/cards/1377
383
396
 
384
397
  # Propose deleting a requirement (nothing is destroyed — a human decides)
385
- fp propose-change print_container_qr --project stowzilla \\
398
+ fp propose-change print_container_qr --project acme \\
386
399
  --removal \\
387
400
  --reason "Superseded by print_container_label"
388
401
 
389
402
  # Un-nest a child back to the top level (clears its parent)
390
- fp propose-change print_container_qr_ios --project stowzilla --no-parent \\
403
+ fp propose-change print_container_qr_ios --project acme --no-parent \\
391
404
  --reason "Promoted to a top-level promise"
392
405
 
393
406
  # Amend a proposal you already opened: the single-open-proposal rule won't let
394
407
  # you open a second, so withdraw yours (restoring the requirement) and propose
395
408
  # again. Only the author can withdraw; someone else's proposal goes to review.
396
- fp propose-change print_container_qr --project stowzilla --withdraw
409
+ fp propose-change print_container_qr --project acme --withdraw
397
410
 
398
411
  # See what changed, why, and who asked for it
399
- fp history print_container_qr --project stowzilla
400
- fp history print_container_qr --project stowzilla --pending
412
+ fp history print_container_qr --project acme
413
+ fp history print_container_qr --project acme --pending
401
414
 
402
415
  # Triage the catalog's quality: duplicates, fragments, vague wording, conflicts.
403
416
  # One model call per uncached requirement; unchanged ones are read back free.
404
- fp analyze --project stowzilla
405
- fp analyze print_container_qr --project stowzilla --conflicts
417
+ fp analyze --project acme
418
+ fp analyze print_container_qr --project acme --conflicts
406
419
 
407
420
  # Upload visual test evidence to a requirement. Images and videos require
408
421
  # --surface; deployment fields let reviewers verify exactly what build the
@@ -416,28 +429,28 @@ module Fp
416
429
  # Text formats: txt, md, json (render inline as code blocks for API evidence)
417
430
  # Documents: svg, pdf (downloadable)
418
431
  # Max 100 MB.
419
- fp attach print_container_qr e2e-run.webm --project stowzilla \\
432
+ fp attach print_container_qr e2e-run.webm --project acme \\
420
433
  --surface customer_web \\
421
434
  --example-title "prints a QR code onto the container label" \\
422
435
  --captured-at 2026-10-15T01:42:00Z \\
423
436
  --deployed-at 2026-10-15T01:30:00Z \\
424
437
  --sha abc1234 \\
425
438
  --deployment-url https://preview.example.test \\
426
- --test-run-url https://github.com/stowzilla/app/actions/runs/123
439
+ --test-run-url https://github.com/acme/app/actions/runs/123
427
440
 
428
441
  # For API tests, attach the JSON response as inline evidence
429
- fp attach api_returns_order_details response.json --project stowzilla \\
442
+ fp attach api_returns_order_details response.json --project acme \\
430
443
  --surface api \\
431
- --evidence-key "api:stowzilla/api:e2e"
444
+ --evidence-key "api:acme/api:e2e"
432
445
 
433
446
  # List attachments and their capture/deployment context
434
- fp attachments print_container_qr --project stowzilla
447
+ fp attachments print_container_qr --project acme
435
448
 
436
449
  # Get a download URL for a specific attachment
437
- fp attachments print_container_qr <attachment-id> --project stowzilla
450
+ fp attachments print_container_qr <attachment-id> --project acme
438
451
 
439
452
  # Delete an attachment
440
- fp attach rm print_container_qr <attachment-id> --project stowzilla
453
+ fp attach rm print_container_qr <attachment-id> --project acme
441
454
 
442
455
  # Read a Pari conversation so an agent can review AI suggestions.
443
456
  # A conversation is just a record identified by its id — no --project
@@ -446,12 +459,12 @@ module Fp
446
459
  fp conversation 03h0abc123xyz
447
460
 
448
461
  # Report evidence for a requirement
449
- fp report print_container_qr --project stowzilla \\
462
+ fp report print_container_qr --project acme \\
450
463
  --surface customer_android \\
451
464
  --file app/src/test/java/PrintQrTest.kt \\
452
465
  --line 42 \\
453
- --repo stowzilla/customer-android \\
454
- --pr https://github.com/stowzilla/customer-android/pull/123 \\
466
+ --repo acme/customer-android \\
467
+ --pr https://github.com/acme/customer-android/pull/123 \\
455
468
  --work-item https://app.fizzy.do/123/cards/456 \\
456
469
  --title "prints a QR code onto the container label"
457
470
 
@@ -461,10 +474,10 @@ module Fp
461
474
  # rspec --format RspecJunitFormatter --out junit.xml # (or your runner's equivalent)
462
475
  # RSpec's own `--format json --out rspec.json` works as --junit too, with no extra gem.
463
476
  # Or let fp add the formatter and report in one step (rspec, pytest, vitest, playwright):
464
- # fp run --surface api --repo stowzilla/marketplace -- bundle exec rspec
465
- fp report --junit junit.xml --project stowzilla \\
477
+ # fp run --surface api --repo acme/marketplace -- bundle exec rspec
478
+ fp report --junit junit.xml --project acme \\
466
479
  --surface api \\
467
- --repo stowzilla/marketplace \\
480
+ --repo acme/marketplace \\
468
481
  --work-item https://app.fizzy.do/123/cards/456
469
482
  # --base-dir sets where relative test file paths in the report resolve from
470
483
  # Skipped tests are reported as 'stub'; everything else as 'present'.
@@ -478,15 +491,15 @@ module Fp
478
491
  # runner's testDir is searched for under base-dir, and --attach-media uploads
479
492
  # the videos/screenshots the run recorded ([[ATTACHMENT|…]]) as visual
480
493
  # evidence, each nested under the test it proves.
481
- fp report --junit junit.xml --project stowzilla \\
482
- --surface web --repo stowzilla/app --base-dir frontend --attach-media
494
+ fp report --junit junit.xml --project acme \\
495
+ --surface web --repo acme/app --base-dir frontend --attach-media
483
496
 
484
497
  # CI ONLY: ingest real pass/fail results. Run in your CI pipeline after
485
498
  # the suite (on green AND red builds). Unlike `fp report`, this writes
486
499
  # passing/failing evidence and marks vanished-but-previously-passing
487
500
  # slugs as failing. This is the half of the loop that turns the matrix
488
501
  # circles into ✓ / ✗.
489
- fp ci-report --junit junit.xml --project stowzilla \\
502
+ fp ci-report --junit junit.xml --project acme \\
490
503
  --surface api \\
491
504
  --ci-url "$CI_RUN_URL"
492
505
  # Pass --junit more than once to ingest several reports for one surface.
@@ -497,25 +510,25 @@ module Fp
497
510
  # --allow-empty when a suite genuinely has none.
498
511
 
499
512
  # Show the parity matrix
500
- fp matrix --project stowzilla
513
+ fp matrix --project acme
501
514
 
502
515
  # Export matrix as CSV
503
- fp matrix --project stowzilla --csv > matrix.csv
516
+ fp matrix --project acme --csv > matrix.csv
504
517
 
505
518
  # Export the full requirements document as Markdown
506
- fp export --project stowzilla > requirements.md
519
+ fp export --project acme > requirements.md
507
520
 
508
521
  # Export only active requirements for one surface, written to a file
509
- fp export --project stowzilla --status active \\
522
+ fp export --project acme --status active \\
510
523
  --surface customer_android --output requirements.md
511
524
 
512
525
  # Map a surface to a local repo on this machine
513
526
  fp repos set customer_android ~/code/customer-android \\
514
- --project stowzilla --repo stowzilla/customer-android
527
+ --project acme --repo acme/customer-android
515
528
 
516
529
  # Find where a surface's code lives locally (for agents)
517
- fp repos get customer_android --project stowzilla
518
- cd "$(fp repos get customer_android --project stowzilla)"
530
+ fp repos get customer_android --project acme
531
+ cd "$(fp repos get customer_android --project acme)"
519
532
 
520
533
  MARKER CONVENTION
521
534
  Tests are bound to requirements using the fp:<slug> marker in the test file.
@@ -14,8 +14,8 @@ module Fp
14
14
  help_flag :project, 'Project slug (falls back to .featureparity.yml)'
15
15
  help_flag :pending, 'Show only the open proposal, if any'
16
16
  help_flag :limit, 'Cap the number of events shown'
17
- help_example 'fp history print_container_qr --project stowzilla'
18
- help_example 'fp history print_container_qr --project stowzilla --pending'
17
+ help_example 'fp history print_container_qr --project acme'
18
+ help_example 'fp history print_container_qr --project acme --pending'
19
19
 
20
20
  KNOWN_FLAGS = { project: :string, pending: :boolean, limit: :string }.freeze
21
21
 
@@ -34,8 +34,8 @@ module Fp
34
34
  help_flag :force, 'Refresh files fp previously wrote'
35
35
  help_flag :no_workflow, 'Skip writing the CI workflow'
36
36
  help_flag :no_agents, 'Skip appending the AGENTS.md section'
37
- help_example 'fp init --project stowzilla --surface api'
38
- help_example 'fp init --project stowzilla --no-workflow'
37
+ help_example 'fp init --project acme --surface api'
38
+ help_example 'fp init --project acme --no-workflow'
39
39
  help_example 'fp init --detect', 'See what fp makes of this repo before choosing a slug and surfaces'
40
40
  help_note "Makes no API calls, so a repo can be onboarded before anyone has a key.\n" \
41
41
  'Committing the workflow before the FP_API_KEY secret exists is fine: the gate skips with an explanation.'
@@ -183,10 +183,11 @@ module Fp
183
183
  next
184
184
  end
185
185
 
186
- content = strip_existing_section(content) if content.include?(AGENTS_MARKER)
186
+ refreshed = content.include?(AGENTS_MARKER)
187
+ content = strip_existing_section(content) if refreshed
187
188
  separator = content.end_with?("\n") ? "\n" : "\n\n"
188
189
  File.write(path, "#{content}#{separator}#{section}")
189
- written << [relative(root, path), 'appended FeatureParity section']
190
+ written << [relative(root, path), refreshed ? 'refreshed FeatureParity section' : 'appended FeatureParity section']
190
191
  else
191
192
  File.write(path, section)
192
193
  written << [relative(root, path), 'created']
@@ -514,6 +515,24 @@ module Fp
514
515
  # The agent-facing brief. Written as instructions rather than description, because
515
516
  # this text is read by something that is about to write a test and needs to know
516
517
  # exactly what to do.
518
+ # The first marker example in the section, in the language of the repo's first
519
+ # detected test runner (nothing detected, or a runner we have no example for, keeps
520
+ # the Ruby/RSpec one). A pytest repo reading `it '...' do` first was misled.
521
+ def marker_example
522
+ name = ((@detection || {})['test_runners'] || []).first&.fetch('name', nil)
523
+ case name
524
+ when 'pytest'
525
+ { lang: 'python', comment: '#',
526
+ code: "# fp:print_container_qr\ndef test_prints_a_qr_code_onto_the_container_label():" }
527
+ when 'jest', 'vitest', 'playwright'
528
+ { lang: 'javascript', comment: '//',
529
+ code: "// fp:print_container_qr\nit('prints a QR code onto the container label', () => {" }
530
+ else
531
+ { lang: 'ruby', comment: '#',
532
+ code: "# fp:print_container_qr\nit 'prints a QR code onto the container label' do" }
533
+ end
534
+ end
535
+
517
536
  def agents_section(project_slug)
518
537
  <<~MARKDOWN
519
538
  #{AGENTS_MARKER}
@@ -602,13 +621,12 @@ module Fp
602
621
  Add an `fp:<slug>` comment directly above the test. Keep the test's own name
603
622
  readable — the marker is the join, not the name.
604
623
 
605
- ```ruby
606
- # fp:print_container_qr
607
- it 'prints a QR code onto the container label' do
624
+ ```#{marker_example[:lang]}
625
+ #{marker_example[:code]}
608
626
  ```
609
627
 
610
628
  Pin surfaces in the marker when one test satisfies more than one:
611
- `# fp:print_container_qr@api,web`.
629
+ `#{marker_example[:comment]} fp:print_container_qr@api,web`.
612
630
 
613
631
  Every feature needs one. A requirement with no marked test is a gap, and gaps are
614
632
  what the gate is eventually going to fail on.
@@ -13,9 +13,9 @@ module Fp
13
13
  help_flag :tag, 'Filter by a free-form tag'
14
14
  help_flag :status, 'Filter by status: active (default), draft, archived'
15
15
  help_flag :gaps, 'Show only requirements with an uncovered required surface (reads evidence)'
16
- help_example 'fp list --project stowzilla'
17
- help_example 'fp list --project stowzilla --status draft', 'Drafts are hidden by default'
18
- help_example 'fp list --project stowzilla --gaps --surface customer_android'
16
+ help_example 'fp list --project acme'
17
+ help_example 'fp list --project acme --status draft', 'Drafts are hidden by default'
18
+ help_example 'fp list --project acme --gaps --surface customer_android'
19
19
  help_example 'fp list --status draft --gaps', 'Drafts lacking evidence on a required surface'
20
20
 
21
21
  KNOWN_FLAGS = {
@@ -19,6 +19,9 @@ module Fp
19
19
  help_example 'fp mark academic_experience_required_fields spec/models/academic_experience_spec.rb:52'
20
20
  help_example 'fp mark checkout_flow e2e/checkout.spec.ts:10 --surface web --type e2e'
21
21
  help_note "<line> is the test's own line (the `it`/`test`/`def test_` line); the marker goes directly above it.\n" \
22
+ "Each insert shifts every line below it down by one. Marking several tests in one file from a single read of it?\n" \
23
+ "Mark from the bottom of the file upward, or re-read the line numbers between marks. The \"It binds to:\" line is the check:\n" \
24
+ "if it names the wrong test, or fp warns that no test declaration was recognised, the marker landed on the wrong line.\n" \
22
25
  'Marking a test binds it to a requirement: never mark a test that is currently failing to make it count.'
23
26
 
24
27
  KNOWN_FLAGS = {
@@ -19,8 +19,8 @@ module Fp
19
19
  help_flag :surface, 'Limit to one surface'
20
20
  help_flag :level, 'Evaluate against this enforcement level (off/regression/covered/strict)'
21
21
  help_flag :csv, 'Emit CSV instead of the ASCII table'
22
- help_example 'fp matrix --project stowzilla'
23
- help_example 'fp matrix --project stowzilla --csv > matrix.csv'
22
+ help_example 'fp matrix --project acme'
23
+ help_example 'fp matrix --project acme --csv > matrix.csv'
24
24
 
25
25
  KNOWN_FLAGS = {
26
26
  project: :string,
@@ -54,7 +54,8 @@ module Fp
54
54
 
55
55
  # The global CLI parser consumes --api-url before the command runs, so
56
56
  # honor it via the config object when the local flag wasn't captured.
57
- api_url = opts[:api_url] || config&.explicit_api_url
57
+ # Saved without a trailing /api: the website used to hand that form out (Fizzy #1980).
58
+ api_url = Config.normalize_api_url(opts[:api_url] || config&.explicit_api_url)
58
59
  Config.save_profile(name, api_key: opts[:api_key], api_url: api_url, environment: opts[:environment])
59
60
 
60
61
  effective_url = api_url || Config.get_setting('api_url') || Config::DEFAULT_API_URL
@@ -33,7 +33,7 @@ module Fp
33
33
  help_flag :source_ref, 'A place in the repo it was read from, e.g. app/models/order.rb:42 (repeatable)'
34
34
  help_flag :file, 'YAML or JSON file of requirements to propose in one batch (validated all-or-nothing)'
35
35
  help_flag :dry_run, 'Validate and lint the wording; write nothing'
36
- help_example 'fp propose --project stowzilla --slug print_qr --name "Print QR on container label" --why "Staff mis-type the ID without a scannable code" --required api,customer_ios --acceptance "QR scans to the container detail page"'
36
+ help_example 'fp propose --project acme --slug print_qr --name "Print QR on container label" --why "Staff mis-type the ID without a scannable code" --required api,customer_ios --acceptance "QR scans to the container detail page"'
37
37
  help_example 'fp propose --file requirements.yml --dry-run', 'Lint a batch and show what would be created'
38
38
  help_example 'fp propose --file requirements.yml --source-type repo_scan', 'Create the batch; flags are defaults for every entry'
39
39
  help_note "Agents can only create drafts. A human activates it in the web app.\n" \
@@ -503,6 +503,9 @@ module Fp
503
503
 
504
504
  analysis = feedback[:analysis]
505
505
  puts "Quality feedback: #{analysis['verdict'] || 'no verdict'}"
506
+ # The server decides the verdict as a gate and says what decided it (Fizzy
507
+ # #1896); an agent reading "acceptable" learns what to fix without asking.
508
+ Array(analysis['verdict_reasons']).each { |reason| puts " why: #{reason}" }
506
509
  Array(analysis['issues']).each do |issue|
507
510
  puts " - #{issue['type'].to_s.tr('_', ' ')}"
508
511
  end
@@ -23,6 +23,7 @@ module Fp
23
23
  help_flag :parent, "Set the parent requirement's slug"
24
24
  help_flag :no_parent, 'Propose un-nesting the requirement back to the top level (clears --parent)'
25
25
  help_flag :slug, 'Proposed new slug (evidence follows; markers still need updating)'
26
+ help_flag :tags, 'Proposed new tags, in order (comma-separated; replaces the current list, "" clears it)'
26
27
  help_flag :reason, 'What prompted this change, in words (recorded on the change)'
27
28
  help_flag :removal, 'Propose deleting the requirement instead of changing it'
28
29
  help_flag :withdraw, 'Take back the open proposal you authored, restoring the requirement as it was'
@@ -30,7 +31,8 @@ module Fp
30
31
  help_flag :source_url, 'URL of the card/issue/thread that prompted this proposal'
31
32
  help_flag :source_context, 'Free-form note about what prompted this proposal'
32
33
  help_flag :source_ref, 'A place in the repo that prompted it, e.g. app/models/order.rb:42 (repeatable)'
33
- help_example 'fp propose-change print_qr --project stowzilla --acceptance "QR scans after 24h at -20C" --reason "Cold-chain rollout"'
34
+ help_example 'fp propose-change print_qr --project acme --acceptance "QR scans after 24h at -20C" --reason "Cold-chain rollout"'
35
+ help_example 'fp propose-change summon_can_be_undone --tags rules,units --reason "Rulebook check reads the first tag"'
34
36
  help_example 'fp propose-change print_qr --removal --reason "Superseded by print_container_label"'
35
37
  help_note "Applies the change and drops the requirement to draft for a human to review. --reason and\n" \
36
38
  "--source-* record what prompted the proposal in its history; the requirement's own origin is unchanged."
@@ -38,6 +40,7 @@ module Fp
38
40
  KNOWN_FLAGS = {
39
41
  project: :string, name: :string, why: :string, acceptance: :string,
40
42
  required: :string, required_types: :string, category: :string, parent: :string, slug: :string,
43
+ tags: :string,
41
44
  no_parent: :boolean,
42
45
  reason: :string, source_type: :string, source_url: :string, source_context: :string,
43
46
  removal: :boolean, withdraw: :boolean
@@ -80,7 +83,7 @@ module Fp
80
83
 
81
84
  if !removal && params.keys.none? { |k| proposed_field?(k) }
82
85
  output.error('Nothing to propose. Pass at least one of --name/--slug/--why/--acceptance/' \
83
- '--required/--required-types/--category/--parent/--no-parent, or --removal to ' \
86
+ '--required/--required-types/--category/--tags/--parent/--no-parent, or --removal to ' \
84
87
  'propose deletion.')
85
88
  exit 1
86
89
  end
@@ -175,6 +178,11 @@ module Fp
175
178
  exit 1
176
179
  end
177
180
 
181
+ if opts[:tags] == true
182
+ output.error('--tags needs a value, e.g. --tags rules,units (or --tags "" to clear them).')
183
+ exit 1
184
+ end
185
+
178
186
  return unless opts[:withdraw] && opts[:removal]
179
187
 
180
188
  output.error('--withdraw cancels an open proposal; it cannot be combined with --removal.')
@@ -214,6 +222,7 @@ module Fp
214
222
  if opts[:required_types]
215
223
  params[:required_test_types] = opts[:required_types].split(',').map { |t| t.strip.downcase }.reject(&:empty?)
216
224
  end
225
+ params[:tags] = opts[:tags].split(',').map(&:strip).reject(&:empty?) unless opts[:tags].nil?
217
226
  params[:parent_id] = resolve_parent_id(project_id, opts[:parent]) if opts[:parent]
218
227
  # --no-parent un-nests a child back to top level: an empty parent_id. The server
219
228
  # treats "" as "no parent" and diffs it against the current parent (Fizzy #1492).
@@ -230,7 +239,7 @@ module Fp
230
239
  end
231
240
 
232
241
  def proposed_field?(key)
233
- %i[title why acceptance category slug required_surfaces required_test_types parent_id].include?(key)
242
+ %i[title why acceptance category slug tags required_surfaces required_test_types parent_id].include?(key)
234
243
  end
235
244
 
236
245
  def resolve_parent_id(project_id, parent_slug)