featureparity 0.0.34 → 0.0.35
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 +4 -4
- data/lib/fp/client.rb +26 -0
- data/lib/fp/commands/coverage.rb +5 -1
- data/lib/fp/commands/matrix.rb +5 -1
- data/lib/fp/commands/surfaces.rb +407 -3
- data/lib/fp/version.rb +1 -1
- data/skills/fp/references/cli.md +15 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 312f91d87b5afc777f045b11dd38db0660bfc55aaa7faa523f2cd4ca464c348b
|
|
4
|
+
data.tar.gz: 3c8b90e1c24911b17751e1574555fc9e5692cf4eacc94c5d27af262dcf6e7328
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 803c8fc5b8586ea9d62a3eaa171f04373308c67d13e2f66aa7cf82213f4ba65f95f840c60596c145790d32e39e8116570a48074431c03727930a9085dc85dcf9
|
|
7
|
+
data.tar.gz: ca6aa9b65707f0bcf5c839672135c1419918760df4027e414acfc7a20854ae697cd58be43cbc381841863869f136e69a8e825a575f8d634550d28c20e057c13a
|
data/lib/fp/client.rb
CHANGED
|
@@ -87,6 +87,22 @@ module Fp
|
|
|
87
87
|
delete("/api/projects/#{project_id}/surfaces/#{surface_id}")
|
|
88
88
|
end
|
|
89
89
|
|
|
90
|
+
# POST /projects/:id/surfaces/:surface_id/batch_draft
|
|
91
|
+
#
|
|
92
|
+
# Batch-draft requirements for a surface (Fizzy #2009). Takes a list of requirement
|
|
93
|
+
# slugs and proposes adding this surface to each one's required_surfaces. Used after
|
|
94
|
+
# `fp surfaces add --from --evaluate` to draft only the requirements the agent
|
|
95
|
+
# decides apply.
|
|
96
|
+
def batch_draft_surface_requirements(project_id, surface_id, slugs:, reason: nil, source_type: nil,
|
|
97
|
+
source_url: nil, source_context: nil)
|
|
98
|
+
body = { slugs: slugs }
|
|
99
|
+
body[:reason] = reason if reason
|
|
100
|
+
body[:source_type] = source_type if source_type
|
|
101
|
+
body[:source_url] = source_url if source_url
|
|
102
|
+
body[:source_context] = source_context if source_context
|
|
103
|
+
post("/api/projects/#{project_id}/surfaces/#{surface_id}/batch_draft", body)
|
|
104
|
+
end
|
|
105
|
+
|
|
90
106
|
# GET /projects/:id/showroom
|
|
91
107
|
# The client showroom as a client would see it (Fizzy #1479). Open to the team and
|
|
92
108
|
# their agents; the response carries only what a client is shown.
|
|
@@ -219,6 +235,16 @@ module Fp
|
|
|
219
235
|
post("/api/requirements/#{requirement_id}/test_review", { tests: tests })
|
|
220
236
|
end
|
|
221
237
|
|
|
238
|
+
# POST /requirements/:id/surface_applicability — Jev's evaluation of whether a
|
|
239
|
+
# requirement applies to a different surface (`fp surfaces add --from --evaluate`,
|
|
240
|
+
# Fizzy #2009). Paid plans only (402 otherwise).
|
|
241
|
+
def evaluate_surface_applicability(requirement_id, target_surface, source_surface)
|
|
242
|
+
post("/api/requirements/#{requirement_id}/surface_applicability", {
|
|
243
|
+
target_surface: target_surface,
|
|
244
|
+
source_surface: source_surface
|
|
245
|
+
})
|
|
246
|
+
end
|
|
247
|
+
|
|
222
248
|
# GET /requirements/:id/changes
|
|
223
249
|
#
|
|
224
250
|
# A requirement's change history: what it was, what changed, who changed it, and
|
data/lib/fp/commands/coverage.rb
CHANGED
|
@@ -42,7 +42,11 @@ module Fp
|
|
|
42
42
|
project_config = ProjectConfig.discover
|
|
43
43
|
project_slug = require_project!(opts, project_config)
|
|
44
44
|
project_id = resolve_project_id(project_slug)
|
|
45
|
-
|
|
45
|
+
# Unlike fp check and fp matrix, draft coverage shows the full picture by default.
|
|
46
|
+
# The pinned surface from .featureparity.yml is ignored unless --surface is explicit;
|
|
47
|
+
# on a new project with only drafts you want to see every surface's column, not just
|
|
48
|
+
# the one this repo happens to ship (Fizzy #2008).
|
|
49
|
+
surface = opts[:surface]
|
|
46
50
|
|
|
47
51
|
result = client.get_parity_with_drafts(project_id, surface: surface)
|
|
48
52
|
unless result[:ok]
|
data/lib/fp/commands/matrix.rb
CHANGED
|
@@ -35,10 +35,14 @@ module Fp
|
|
|
35
35
|
project_slug = require_project!(opts, project_config)
|
|
36
36
|
project_id = resolve_project_id(project_slug)
|
|
37
37
|
|
|
38
|
+
# The matrix shows the full grid by default. The pinned surface from
|
|
39
|
+
# .featureparity.yml is ignored unless --surface is explicit; a team reviewing
|
|
40
|
+
# parity wants to see every surface's column, not just the one this repo ships.
|
|
41
|
+
# (fp check keeps using the pinned surface because it gates that surface's CI.)
|
|
38
42
|
result = client.get_parity(
|
|
39
43
|
project_id,
|
|
40
44
|
level: opts[:level] || project_config.enforcement,
|
|
41
|
-
surface: opts[:surface]
|
|
45
|
+
surface: opts[:surface]
|
|
42
46
|
)
|
|
43
47
|
unless result[:ok]
|
|
44
48
|
output.error(result[:error], status: result[:status])
|
data/lib/fp/commands/surfaces.rb
CHANGED
|
@@ -32,7 +32,19 @@ module Fp
|
|
|
32
32
|
kind: :string,
|
|
33
33
|
audience: :string,
|
|
34
34
|
repo: :string,
|
|
35
|
-
default_branch: :string
|
|
35
|
+
default_branch: :string,
|
|
36
|
+
from: :string,
|
|
37
|
+
evaluate: :boolean
|
|
38
|
+
}.freeze
|
|
39
|
+
|
|
40
|
+
BATCH_DRAFT_FLAGS = {
|
|
41
|
+
project: :string,
|
|
42
|
+
slugs: :string,
|
|
43
|
+
slugs_file: :string,
|
|
44
|
+
reason: :string,
|
|
45
|
+
source_type: :string,
|
|
46
|
+
source_url: :string,
|
|
47
|
+
source_context: :string
|
|
36
48
|
}.freeze
|
|
37
49
|
|
|
38
50
|
SHOWROOM_FLAGS = {
|
|
@@ -57,22 +69,32 @@ module Fp
|
|
|
57
69
|
help_usage 'fp surfaces --project <slug>',
|
|
58
70
|
'fp surfaces show <key> --project <slug>',
|
|
59
71
|
'fp surfaces add <key> --project <slug> [--name ...] [--kind K] [--repo org/repo]',
|
|
72
|
+
'fp surfaces add <key> --project <slug> --from <source_key>',
|
|
60
73
|
'fp surfaces edit <key> --project <slug> [flags]',
|
|
61
|
-
'fp surfaces delete <key> --project <slug> [--yes]'
|
|
74
|
+
'fp surfaces delete <key> --project <slug> [--yes]',
|
|
75
|
+
'fp surfaces batch-draft <key> --project <slug> --slugs slug1,slug2 | --slugs-file file.json'
|
|
62
76
|
help_flag :project, 'Project slug (falls back to .featureparity.yml)'
|
|
63
77
|
help_flag :name, 'Human-readable surface name'
|
|
64
78
|
help_flag :kind, "Surface kind: #{VALID_KINDS.join(', ')}"
|
|
65
79
|
help_flag :audience, "Audience: #{VALID_AUDIENCES.join(', ')}"
|
|
66
80
|
help_flag :repo, 'Repository the surface maps to (org/repo)'
|
|
67
81
|
help_flag :default_branch, 'Default branch for the repo'
|
|
82
|
+
help_flag :from, 'Source surface to copy requirements from (drafts them for the new surface)'
|
|
83
|
+
help_flag :evaluate, 'With --from: run each requirement through Jev to evaluate applicability (returns data; does not auto-draft)'
|
|
68
84
|
help_flag :showroom_url, 'Client showroom card: the http(s) link a client opens (edit; empty clears)'
|
|
69
85
|
help_flag :showroom_label, 'Client showroom card: the button text for that link (edit)'
|
|
70
86
|
help_flag :showroom_instructions, 'Client showroom card: how to sign in and try the surface (edit)'
|
|
71
87
|
help_flag :showroom_instructions_file, 'Read --showroom-instructions from a file (multi-line)'
|
|
72
88
|
help_flag :showroom_position, 'Client showroom order: 1 is first; empty clears (unplaced surfaces follow, A-Z) (edit)'
|
|
73
89
|
help_flag :yes, 'Skip the typed-key confirmation on delete'
|
|
90
|
+
help_flag :slugs, 'Comma-separated requirement slugs to draft (batch-draft)'
|
|
91
|
+
help_flag :slugs_file, 'JSON file with slugs to draft: array of strings or objects with "slug" keys (batch-draft)'
|
|
74
92
|
help_example 'fp surfaces --project acme'
|
|
75
93
|
help_example 'fp surfaces add customer_android --project acme --kind android --repo acme/customer-android'
|
|
94
|
+
help_example 'fp surfaces add android --project acme --from web', 'Create android, drafting requirements that apply to web'
|
|
95
|
+
help_example 'fp surfaces add android --project acme --from web --evaluate', 'Create android, evaluate which web requirements apply (agent workflow)'
|
|
96
|
+
help_example 'fp surfaces batch-draft android --project acme --slugs login,checkout', 'Draft specific requirements for the android surface'
|
|
97
|
+
help_example 'fp surfaces batch-draft android --project acme --slugs-file /tmp/applying.json', 'Draft from a JSON file (output of --evaluate filtered by agent)'
|
|
76
98
|
help_example 'fp surfaces delete web --project acme --yes'
|
|
77
99
|
help_example 'fp surfaces edit web --project acme --showroom-url https://dev.example.com --showroom-instructions-file docs/showroom/web.txt'
|
|
78
100
|
help_example 'fp surfaces edit web --project acme --showroom-position 1'
|
|
@@ -89,6 +111,8 @@ module Fp
|
|
|
89
111
|
edit(args[1..])
|
|
90
112
|
when 'delete'
|
|
91
113
|
delete(args[1..])
|
|
114
|
+
when 'batch-draft'
|
|
115
|
+
batch_draft(args[1..])
|
|
92
116
|
else
|
|
93
117
|
list(args)
|
|
94
118
|
end
|
|
@@ -162,6 +186,17 @@ module Fp
|
|
|
162
186
|
|
|
163
187
|
project_id = resolve_project_id(opts[:project])
|
|
164
188
|
|
|
189
|
+
# Validate --from surface exists before creating anything
|
|
190
|
+
source_surface = nil
|
|
191
|
+
if opts[:from]
|
|
192
|
+
source_result = client.find_surface_by_key(project_id, opts[:from])
|
|
193
|
+
unless source_result[:ok]
|
|
194
|
+
output.error("Source surface '#{opts[:from]}' not found in project '#{opts[:project]}'")
|
|
195
|
+
exit 1
|
|
196
|
+
end
|
|
197
|
+
source_surface = source_result[:data]['surface']
|
|
198
|
+
end
|
|
199
|
+
|
|
165
200
|
# The API derives key from name and defaults kind/audience/default_branch, but we
|
|
166
201
|
# send the key explicitly because here the key is what the caller actually typed —
|
|
167
202
|
# `add api --name "Backend API"` must produce `api`, not `backend_api`.
|
|
@@ -189,13 +224,40 @@ module Fp
|
|
|
189
224
|
|
|
190
225
|
surface = result[:data]['surface'] || {}
|
|
191
226
|
|
|
192
|
-
|
|
227
|
+
# If --from was given, either evaluate or draft requirements from the source surface
|
|
228
|
+
drafted = []
|
|
229
|
+
gaps = []
|
|
230
|
+
evaluations = []
|
|
231
|
+
if source_surface
|
|
232
|
+
if opts[:evaluate]
|
|
233
|
+
# --evaluate: run each through Jev and return applicability data (no drafting)
|
|
234
|
+
evaluations = evaluate_requirements_for_surface(project_id, opts[:project], source_surface, key)
|
|
235
|
+
else
|
|
236
|
+
# No --evaluate: draft all requirements from the source surface
|
|
237
|
+
drafted, gaps = draft_requirements_from_surface(project_id, opts[:project], source_surface, key)
|
|
238
|
+
end
|
|
239
|
+
end
|
|
240
|
+
|
|
241
|
+
response_data = result[:data].merge('drafted' => drafted, 'gaps' => gaps)
|
|
242
|
+
response_data['evaluations'] = evaluations unless evaluations.empty?
|
|
243
|
+
|
|
244
|
+
output.success(response_data) do
|
|
193
245
|
puts "Created surface '#{surface['key'] || key}' in project '#{opts[:project]}'."
|
|
194
246
|
puts
|
|
195
247
|
puts " Name: #{surface['name']}"
|
|
196
248
|
puts " Kind: #{surface['kind']}"
|
|
197
249
|
puts " Audience: #{surface['audience']}"
|
|
198
250
|
puts " Repo: #{surface['repo'] || '(none)'}"
|
|
251
|
+
|
|
252
|
+
if source_surface
|
|
253
|
+
puts
|
|
254
|
+
if opts[:evaluate]
|
|
255
|
+
print_evaluations(evaluations, opts[:from], key)
|
|
256
|
+
else
|
|
257
|
+
print_drafted_requirements(drafted, opts[:from], key)
|
|
258
|
+
print_gap_list(gaps, key) unless gaps.empty?
|
|
259
|
+
end
|
|
260
|
+
end
|
|
199
261
|
end
|
|
200
262
|
end
|
|
201
263
|
|
|
@@ -347,6 +409,149 @@ module Fp
|
|
|
347
409
|
end
|
|
348
410
|
end
|
|
349
411
|
|
|
412
|
+
# POST /projects/:id/surfaces/:surface_id/batch_draft
|
|
413
|
+
#
|
|
414
|
+
# Batch-draft requirements for a surface (Fizzy #2009). Takes a list of requirement
|
|
415
|
+
# slugs and proposes adding this surface to each one's required_surfaces. Used after
|
|
416
|
+
# `fp surfaces add --from --evaluate` to draft only the requirements the agent
|
|
417
|
+
# decides apply.
|
|
418
|
+
def batch_draft(args)
|
|
419
|
+
opts, positional = parse_flags(args, BATCH_DRAFT_FLAGS)
|
|
420
|
+
|
|
421
|
+
# Check mutually exclusive flags before doing any API calls
|
|
422
|
+
if opts[:slugs] && opts[:slugs_file]
|
|
423
|
+
output.error('Pass --slugs or --slugs-file, not both.')
|
|
424
|
+
exit 1
|
|
425
|
+
end
|
|
426
|
+
|
|
427
|
+
require_project!(opts)
|
|
428
|
+
|
|
429
|
+
key = positional.first
|
|
430
|
+
if key.nil? || key.strip.empty?
|
|
431
|
+
output.error('Usage: fp surfaces batch-draft <key> --project <slug> --slugs slug1,slug2 | --slugs-file file.json')
|
|
432
|
+
exit 1
|
|
433
|
+
end
|
|
434
|
+
|
|
435
|
+
project_id = resolve_project_id(opts[:project])
|
|
436
|
+
surface = find_surface!(project_id, key)
|
|
437
|
+
|
|
438
|
+
slugs = resolve_batch_draft_slugs(opts)
|
|
439
|
+
if slugs.empty?
|
|
440
|
+
output.error('No slugs provided. Use --slugs slug1,slug2 or --slugs-file file.json')
|
|
441
|
+
exit 1
|
|
442
|
+
end
|
|
443
|
+
|
|
444
|
+
result = client.batch_draft_surface_requirements(
|
|
445
|
+
project_id,
|
|
446
|
+
surface['id'],
|
|
447
|
+
slugs: slugs,
|
|
448
|
+
reason: opts[:reason],
|
|
449
|
+
source_type: opts[:source_type],
|
|
450
|
+
source_url: opts[:source_url],
|
|
451
|
+
source_context: opts[:source_context]
|
|
452
|
+
)
|
|
453
|
+
|
|
454
|
+
unless result[:ok]
|
|
455
|
+
output.error(result[:error], status: result[:status])
|
|
456
|
+
exit 1
|
|
457
|
+
end
|
|
458
|
+
|
|
459
|
+
data = result[:data]
|
|
460
|
+
output.success(data) do
|
|
461
|
+
print_batch_draft_result(data, key, opts[:project])
|
|
462
|
+
end
|
|
463
|
+
end
|
|
464
|
+
|
|
465
|
+
# Resolve slugs from --slugs or --slugs-file. Accepts:
|
|
466
|
+
# - --slugs as comma-separated: "login,checkout,profile"
|
|
467
|
+
# - --slugs-file as JSON: ["login", "checkout"] or [{"slug": "login"}, ...]
|
|
468
|
+
def resolve_batch_draft_slugs(opts)
|
|
469
|
+
# Mutual exclusion already checked in batch_draft before API calls
|
|
470
|
+
|
|
471
|
+
if opts[:slugs]
|
|
472
|
+
return opts[:slugs].to_s.split(',').map(&:strip).reject(&:empty?)
|
|
473
|
+
end
|
|
474
|
+
|
|
475
|
+
if opts[:slugs_file]
|
|
476
|
+
return read_slugs_file(opts[:slugs_file])
|
|
477
|
+
end
|
|
478
|
+
|
|
479
|
+
[]
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
# Read slugs from a JSON file. Accepts:
|
|
483
|
+
# - Array of strings: ["login", "checkout"]
|
|
484
|
+
# - Array of objects with "slug" key: [{"slug": "login", "applies": true}, ...]
|
|
485
|
+
# (the output format of --evaluate, filtered)
|
|
486
|
+
def read_slugs_file(path)
|
|
487
|
+
unless File.file?(path)
|
|
488
|
+
output.error("--slugs-file: no such file '#{path}'")
|
|
489
|
+
exit 1
|
|
490
|
+
end
|
|
491
|
+
|
|
492
|
+
content = File.read(path).strip
|
|
493
|
+
begin
|
|
494
|
+
data = JSON.parse(content)
|
|
495
|
+
rescue JSON::ParserError => e
|
|
496
|
+
output.error("--slugs-file: invalid JSON (#{e.message})")
|
|
497
|
+
exit 1
|
|
498
|
+
end
|
|
499
|
+
|
|
500
|
+
unless data.is_a?(Array)
|
|
501
|
+
output.error("--slugs-file: expected a JSON array of slugs or objects with 'slug' key")
|
|
502
|
+
exit 1
|
|
503
|
+
end
|
|
504
|
+
|
|
505
|
+
data.map do |item|
|
|
506
|
+
case item
|
|
507
|
+
when String
|
|
508
|
+
item.strip
|
|
509
|
+
when Hash
|
|
510
|
+
item['slug']&.to_s&.strip
|
|
511
|
+
else
|
|
512
|
+
nil
|
|
513
|
+
end
|
|
514
|
+
end.compact.reject(&:empty?)
|
|
515
|
+
end
|
|
516
|
+
|
|
517
|
+
def print_batch_draft_result(data, surface_key, project_slug)
|
|
518
|
+
summary = data['summary'] || {}
|
|
519
|
+
drafted = data['drafted'] || []
|
|
520
|
+
skipped = data['skipped'] || []
|
|
521
|
+
errors = data['errors'] || []
|
|
522
|
+
|
|
523
|
+
puts "Batch draft for surface '#{surface_key}' in project '#{project_slug}':"
|
|
524
|
+
puts
|
|
525
|
+
puts " Requested: #{summary['requested'] || 0}"
|
|
526
|
+
puts " Drafted: #{summary['drafted'] || 0}"
|
|
527
|
+
puts " Skipped: #{summary['skipped'] || 0}"
|
|
528
|
+
puts " Errors: #{summary['errors'] || 0}"
|
|
529
|
+
|
|
530
|
+
if drafted.any?
|
|
531
|
+
puts
|
|
532
|
+
puts "Drafted (#{drafted.size}):"
|
|
533
|
+
drafted.each { |d| puts " ✅ #{d['slug']}: #{truncate(d['title'], 50)}" }
|
|
534
|
+
end
|
|
535
|
+
|
|
536
|
+
if skipped.any?
|
|
537
|
+
puts
|
|
538
|
+
puts "Skipped (#{skipped.size}):"
|
|
539
|
+
skipped.each { |s| puts " ⏭️ #{s['slug']}: #{s['reason']}" }
|
|
540
|
+
end
|
|
541
|
+
|
|
542
|
+
if errors.any?
|
|
543
|
+
puts
|
|
544
|
+
puts "Errors (#{errors.size}):"
|
|
545
|
+
errors.each { |e| puts " ❌ #{e['slug']}: #{e['error']}" }
|
|
546
|
+
end
|
|
547
|
+
|
|
548
|
+
return unless drafted.any?
|
|
549
|
+
|
|
550
|
+
puts
|
|
551
|
+
puts '⚠️ These are now DRAFTS awaiting human review.'
|
|
552
|
+
puts ' A human must approve each change in the web app before the surface is measured.'
|
|
553
|
+
end
|
|
554
|
+
|
|
350
555
|
# Same guard as `fp projects delete`: --yes skips the prompt, an interactive
|
|
351
556
|
# terminal types the key back, and anything else is refused.
|
|
352
557
|
def confirm_delete!(surface, opts)
|
|
@@ -471,6 +676,205 @@ module Fp
|
|
|
471
676
|
[]
|
|
472
677
|
end
|
|
473
678
|
end
|
|
679
|
+
|
|
680
|
+
# --- --from: draft requirements from a source surface ---
|
|
681
|
+
|
|
682
|
+
# Draft requirements from a source surface for the newly created surface. For each
|
|
683
|
+
# active requirement that includes the source surface, propose adding the new
|
|
684
|
+
# surface to its required_surfaces. Returns the list of drafted requirements and
|
|
685
|
+
# the gap list for the new surface.
|
|
686
|
+
def draft_requirements_from_surface(project_id, project_slug, source_surface, new_surface_key)
|
|
687
|
+
result = client.list_requirements(project_id: project_id)
|
|
688
|
+
unless result[:ok]
|
|
689
|
+
warn "Warning: could not list requirements to draft from '#{source_surface['key']}': #{result[:error]}"
|
|
690
|
+
return [[], []]
|
|
691
|
+
end
|
|
692
|
+
|
|
693
|
+
requirements = result[:data]['requirements'] || []
|
|
694
|
+
source_key = source_surface['key']
|
|
695
|
+
|
|
696
|
+
# Find active requirements that include the source surface
|
|
697
|
+
candidates = requirements.select do |req|
|
|
698
|
+
req['status'] == 'active' && (req['required_surfaces'] || []).include?(source_key)
|
|
699
|
+
end
|
|
700
|
+
|
|
701
|
+
return [[], []] if candidates.empty?
|
|
702
|
+
|
|
703
|
+
drafted = []
|
|
704
|
+
errors = []
|
|
705
|
+
|
|
706
|
+
candidates.each do |req|
|
|
707
|
+
current_surfaces = req['required_surfaces'] || []
|
|
708
|
+
next if current_surfaces.include?(new_surface_key) # Already has this surface
|
|
709
|
+
|
|
710
|
+
new_surfaces = current_surfaces + [new_surface_key]
|
|
711
|
+
change_result = client.propose_requirement_change(
|
|
712
|
+
req['id'],
|
|
713
|
+
required_surfaces: new_surfaces,
|
|
714
|
+
reason: "Adding '#{new_surface_key}' surface (from 'fp surfaces add --from #{source_key}')",
|
|
715
|
+
source_type: 'manual'
|
|
716
|
+
)
|
|
717
|
+
|
|
718
|
+
if change_result[:ok]
|
|
719
|
+
drafted << {
|
|
720
|
+
'slug' => req['slug'],
|
|
721
|
+
'title' => req['title'],
|
|
722
|
+
'surfaces' => new_surfaces
|
|
723
|
+
}
|
|
724
|
+
else
|
|
725
|
+
errors << {
|
|
726
|
+
'slug' => req['slug'],
|
|
727
|
+
'error' => change_result[:error]
|
|
728
|
+
}
|
|
729
|
+
end
|
|
730
|
+
end
|
|
731
|
+
|
|
732
|
+
# Warn about errors but don't fail the whole operation
|
|
733
|
+
errors.each do |err|
|
|
734
|
+
warn "Warning: could not draft '#{err['slug']}': #{err['error']}"
|
|
735
|
+
end
|
|
736
|
+
|
|
737
|
+
# The gap list is every requirement we just drafted — they all need evidence on
|
|
738
|
+
# the new surface. Format matches what `fp list --gaps` returns.
|
|
739
|
+
gaps = drafted.map do |req|
|
|
740
|
+
{
|
|
741
|
+
'slug' => req['slug'],
|
|
742
|
+
'title' => req['title'],
|
|
743
|
+
'surfaces' => [{ 'surface' => new_surface_key, 'state' => 'missing' }]
|
|
744
|
+
}
|
|
745
|
+
end
|
|
746
|
+
|
|
747
|
+
[drafted, gaps]
|
|
748
|
+
end
|
|
749
|
+
|
|
750
|
+
# --- --from --evaluate: evaluate requirements for applicability ---
|
|
751
|
+
|
|
752
|
+
# Evaluate requirements from a source surface to determine which apply to a new
|
|
753
|
+
# surface. For each active requirement that includes the source surface, ask Jev
|
|
754
|
+
# whether it applies to the target surface. Returns a list of evaluations with
|
|
755
|
+
# applicability verdicts and reasoning for agent decision-making.
|
|
756
|
+
def evaluate_requirements_for_surface(project_id, project_slug, source_surface, new_surface_key)
|
|
757
|
+
result = client.list_requirements(project_id: project_id)
|
|
758
|
+
unless result[:ok]
|
|
759
|
+
warn "Warning: could not list requirements to evaluate from '#{source_surface['key']}': #{result[:error]}"
|
|
760
|
+
return []
|
|
761
|
+
end
|
|
762
|
+
|
|
763
|
+
requirements = result[:data]['requirements'] || []
|
|
764
|
+
source_key = source_surface['key']
|
|
765
|
+
|
|
766
|
+
# Find active requirements that include the source surface
|
|
767
|
+
candidates = requirements.select do |req|
|
|
768
|
+
req['status'] == 'active' && (req['required_surfaces'] || []).include?(source_key)
|
|
769
|
+
end
|
|
770
|
+
|
|
771
|
+
return [] if candidates.empty?
|
|
772
|
+
|
|
773
|
+
evaluations = []
|
|
774
|
+
candidates.each do |req|
|
|
775
|
+
current_surfaces = req['required_surfaces'] || []
|
|
776
|
+
next if current_surfaces.include?(new_surface_key) # Already has this surface
|
|
777
|
+
|
|
778
|
+
progress("Evaluating #{req['slug']} ...")
|
|
779
|
+
|
|
780
|
+
eval_result = client.evaluate_surface_applicability(
|
|
781
|
+
req['id'],
|
|
782
|
+
new_surface_key,
|
|
783
|
+
source_key
|
|
784
|
+
)
|
|
785
|
+
|
|
786
|
+
if eval_result[:ok]
|
|
787
|
+
evaluation = eval_result[:data]['evaluation'] || {}
|
|
788
|
+
evaluations << {
|
|
789
|
+
'slug' => req['slug'],
|
|
790
|
+
'title' => req['title'],
|
|
791
|
+
'applies' => evaluation['applies'],
|
|
792
|
+
'probability' => evaluation['probability'],
|
|
793
|
+
'confidence' => evaluation['confidence'],
|
|
794
|
+
'reason' => evaluation['reason']
|
|
795
|
+
}
|
|
796
|
+
else
|
|
797
|
+
# Evaluation failed (likely 402 for no AI access) — include as an error entry
|
|
798
|
+
evaluations << {
|
|
799
|
+
'slug' => req['slug'],
|
|
800
|
+
'title' => req['title'],
|
|
801
|
+
'applies' => nil,
|
|
802
|
+
'probability' => nil,
|
|
803
|
+
'confidence' => nil,
|
|
804
|
+
'reason' => nil,
|
|
805
|
+
'error' => eval_result[:error]
|
|
806
|
+
}
|
|
807
|
+
end
|
|
808
|
+
end
|
|
809
|
+
|
|
810
|
+
evaluations
|
|
811
|
+
end
|
|
812
|
+
|
|
813
|
+
def print_evaluations(evaluations, source_key, new_key)
|
|
814
|
+
if evaluations.empty?
|
|
815
|
+
puts "No requirements on '#{source_key}' to evaluate for '#{new_key}'."
|
|
816
|
+
return
|
|
817
|
+
end
|
|
818
|
+
|
|
819
|
+
applies = evaluations.select { |e| e['applies'] == true }
|
|
820
|
+
does_not_apply = evaluations.select { |e| e['applies'] == false }
|
|
821
|
+
errors = evaluations.select { |e| e['error'] }
|
|
822
|
+
|
|
823
|
+
puts "Evaluated #{evaluations.size} requirement(s) from '#{source_key}' for '#{new_key}':"
|
|
824
|
+
puts
|
|
825
|
+
puts " ✅ Applies (#{applies.size}):"
|
|
826
|
+
applies.each do |e|
|
|
827
|
+
puts " #{e['slug']}: #{truncate(e['title'], 50)}"
|
|
828
|
+
puts " #{e['reason']}" if e['reason']
|
|
829
|
+
end
|
|
830
|
+
|
|
831
|
+
puts
|
|
832
|
+
puts " ❌ Does not apply (#{does_not_apply.size}):"
|
|
833
|
+
does_not_apply.each do |e|
|
|
834
|
+
puts " #{e['slug']}: #{truncate(e['title'], 50)}"
|
|
835
|
+
puts " #{e['reason']}" if e['reason']
|
|
836
|
+
end
|
|
837
|
+
|
|
838
|
+
unless errors.empty?
|
|
839
|
+
puts
|
|
840
|
+
puts " ⚠️ Evaluation failed (#{errors.size}):"
|
|
841
|
+
errors.each do |e|
|
|
842
|
+
puts " #{e['slug']}: #{e['error']}"
|
|
843
|
+
end
|
|
844
|
+
end
|
|
845
|
+
|
|
846
|
+
puts
|
|
847
|
+
puts 'Nothing was drafted. Use the evaluation data above to decide which requirements to'
|
|
848
|
+
puts 'add manually, or re-run without --evaluate to draft all requirements at once.'
|
|
849
|
+
end
|
|
850
|
+
|
|
851
|
+
def progress(message)
|
|
852
|
+
warn message unless output.json?
|
|
853
|
+
end
|
|
854
|
+
|
|
855
|
+
def print_drafted_requirements(drafted, source_key, new_key)
|
|
856
|
+
if drafted.empty?
|
|
857
|
+
puts "No requirements on '#{source_key}' to draft for '#{new_key}'."
|
|
858
|
+
return
|
|
859
|
+
end
|
|
860
|
+
|
|
861
|
+
puts "Drafted #{drafted.size} requirement(s) from '#{source_key}' to include '#{new_key}':"
|
|
862
|
+
drafted.each { |req| puts " - #{req['slug']}: #{truncate(req['title'], 50)}" }
|
|
863
|
+
puts
|
|
864
|
+
puts '⚠️ These are now DRAFTS awaiting human review.'
|
|
865
|
+
puts ' A human must approve each change in the web app before the surface is measured.'
|
|
866
|
+
end
|
|
867
|
+
|
|
868
|
+
def print_gap_list(gaps, new_key)
|
|
869
|
+
puts
|
|
870
|
+
puts "Gap list for '#{new_key}' (#{gaps.size} requirement(s) need coverage):"
|
|
871
|
+
headers = %w[SLUG TITLE STATE]
|
|
872
|
+
rows = gaps.map do |gap|
|
|
873
|
+
state = gap['surfaces'].first
|
|
874
|
+
[gap['slug'], truncate(gap['title'], 40), state ? "#{state['surface']} (#{state['state']})" : '-']
|
|
875
|
+
end
|
|
876
|
+
output.table(headers, rows)
|
|
877
|
+
end
|
|
474
878
|
end
|
|
475
879
|
end
|
|
476
880
|
end
|
data/lib/fp/version.rb
CHANGED
data/skills/fp/references/cli.md
CHANGED
|
@@ -61,6 +61,8 @@ fp surfaces --project acme
|
|
|
61
61
|
fp surfaces --project acme --json
|
|
62
62
|
fp surfaces show <key> --project acme
|
|
63
63
|
fp surfaces add <key> --project acme [--name "..."] [--kind api|web|android|ios|other] [--audience ...] [--repo org/repo] [--default-branch main]
|
|
64
|
+
fp surfaces add <key> --project acme --from <source> # Create and draft requirements from the source surface
|
|
65
|
+
fp surfaces add <key> --project acme --from <source> --evaluate # Create, evaluate applicability, return data (no drafting)
|
|
64
66
|
fp surfaces edit <key> --project acme [--name "..."] [--kind ...] [--audience ...] [--repo ...] [--default-branch ...] [--key new_key]
|
|
65
67
|
fp surfaces edit <key> --project acme [--showroom-url URL] [--showroom-label "..."] [--showroom-instructions "..." | --showroom-instructions-file PATH] [--showroom-position N]
|
|
66
68
|
fp surfaces delete <key> --project acme [--yes]
|
|
@@ -71,6 +73,18 @@ you at `edit` — use `edit` to fill in the kind or repo of a surface that `fp p
|
|
|
71
73
|
create --surfaces` made with defaults. `edit` only sends the flags you pass. `delete`
|
|
72
74
|
asks you to type the key back in a terminal and refuses without `--yes` otherwise.
|
|
73
75
|
|
|
76
|
+
**`--from`**: When adding a platform that mirrors an existing one (Android when you
|
|
77
|
+
have web), `--from web` finds every active requirement on `web`, proposes adding the
|
|
78
|
+
new surface to each, and returns a gap list. The drafts await human review.
|
|
79
|
+
|
|
80
|
+
**`--from --evaluate`**: Instead of mass-drafting, asks the AI whether each source
|
|
81
|
+
requirement applies to the target platform. Returns applicability verdicts with
|
|
82
|
+
reasoning — which requirements apply (✅), which don't (❌), and why. Nothing is
|
|
83
|
+
drafted; the agent uses the evaluation data to decide which requirements to add
|
|
84
|
+
manually. Useful for filtering the ~10% that are platform-specific (browser resize,
|
|
85
|
+
web-only APIs) from the 90% that transfer to any client. Requires a Pro plan or a
|
|
86
|
+
project owner with AI access.
|
|
87
|
+
|
|
74
88
|
A surface that requirements still require can't be deleted or re-keyed — the server
|
|
75
89
|
refuses and names them. Taking a surface off a requirement is a human's call, so ask
|
|
76
90
|
one rather than working around it.
|
|
@@ -1053,7 +1067,7 @@ fp repos unset customer_android --project acme
|
|
|
1053
1067
|
fp is a Ruby gem, so any of these installs the newest version:
|
|
1054
1068
|
|
|
1055
1069
|
```bash
|
|
1056
|
-
fp update # from fp 0.0.
|
|
1070
|
+
fp update # from fp 0.0.35
|
|
1057
1071
|
gem update featureparity
|
|
1058
1072
|
curl -fsSL https://api.featureparity.dev/api/cli/install | bash # the installer again
|
|
1059
1073
|
```
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: featureparity
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.35
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Stowzilla
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: net-http
|