featureparity 0.0.34 → 0.0.36
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/doctor.rb +1 -1
- data/lib/fp/commands/list.rb +6 -0
- data/lib/fp/commands/mark.rb +40 -2
- data/lib/fp/commands/matrix.rb +6 -1
- data/lib/fp/commands/report.rb +15 -3
- data/lib/fp/commands/run.rb +12 -0
- data/lib/fp/commands/surfaces.rb +449 -11
- data/lib/fp/repo_detector.rb +8 -2
- data/lib/fp/version.rb +1 -1
- data/skills/fp/SKILL.md +17 -0
- data/skills/fp/references/cli.md +25 -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: 2f2ed0718caaa1c3c2ceb9cb158d0c2a5a7718ad2d8d42d63f9e1e6056b89cd2
|
|
4
|
+
data.tar.gz: a383fe678a4c083d61f2477c4777eb7992153206e8caba98c39e7443f581635b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 01ae66612f6481088a79f7d33a101ab27d49bf07cc4484fd59c5f8cebf5588c9e2790b9b2ac7098d8861dd60ecdd6d9003c91bfcf0c248ace3dde7bb56ac9755
|
|
7
|
+
data.tar.gz: f9554935e264053682bf4fb6d720662a0d6815f03aceadf11385995cb9cca7a5be27a8c4c0462b771fdf131c71f2afb7a06c67c13ea05626851d721511dfca3b
|
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/doctor.rb
CHANGED
data/lib/fp/commands/list.rb
CHANGED
|
@@ -263,6 +263,12 @@ module Fp
|
|
|
263
263
|
puts "Note: #{unscoped} requirement(s) name no surface this project has, " \
|
|
264
264
|
'so nothing can cover them.'
|
|
265
265
|
end
|
|
266
|
+
# Gaps are counted on approved requirements. A project that is all drafts has
|
|
267
|
+
# none of those, which is not the same as having nothing left to test.
|
|
268
|
+
if filter_desc.empty? && (report['summary'] || {})['requirements'].to_i.zero?
|
|
269
|
+
puts 'No requirement has been approved yet, so there is nothing to measure. ' \
|
|
270
|
+
'Drafts with no test: fp list --status draft --gaps, or fp coverage.'
|
|
271
|
+
end
|
|
266
272
|
next
|
|
267
273
|
end
|
|
268
274
|
|
data/lib/fp/commands/mark.rb
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'timeout'
|
|
4
|
+
|
|
3
5
|
require 'digest'
|
|
4
6
|
require 'fileutils'
|
|
5
7
|
require 'json'
|
|
@@ -77,6 +79,9 @@ module Fp
|
|
|
77
79
|
# number from a later, fresh read is rarely second-guessed.
|
|
78
80
|
JOURNAL_TTL = 30 * 60
|
|
79
81
|
|
|
82
|
+
# How long the check that a slug names a requirement may take before it is skipped.
|
|
83
|
+
SLUG_LOOKUP_SECONDS = 3
|
|
84
|
+
|
|
80
85
|
def run(args)
|
|
81
86
|
opts, positional = parse_flags(args, KNOWN_FLAGS)
|
|
82
87
|
slug, *locations = positional
|
|
@@ -112,11 +117,42 @@ module Fp
|
|
|
112
117
|
mark_file(path, files[path], file_targets, slug, marker, opts, earlier[path])
|
|
113
118
|
end
|
|
114
119
|
|
|
115
|
-
report(results)
|
|
120
|
+
report(results, unknown_slug_warning(slug))
|
|
116
121
|
end
|
|
117
122
|
|
|
118
123
|
private
|
|
119
124
|
|
|
125
|
+
# A marker whose slug names no requirement binds nothing, and a typo here is silent
|
|
126
|
+
# until someone wonders why a test never showed up as evidence (Fizzy #2040). So
|
|
127
|
+
# when fp can ask, it says. It only asks from a checkout whose .featureparity.yml
|
|
128
|
+
# names the project and with a key configured; `fp mark` needs neither, and marking
|
|
129
|
+
# before the requirement is proposed is fine, so this warns and never refuses.
|
|
130
|
+
def unknown_slug_warning(slug)
|
|
131
|
+
return nil unless config&.valid?
|
|
132
|
+
|
|
133
|
+
project = ProjectConfig.discover(Dir.pwd).project
|
|
134
|
+
return nil unless project
|
|
135
|
+
|
|
136
|
+
api = client || Client.new(config)
|
|
137
|
+
# Marking is a local edit; a slow API must not make it wait.
|
|
138
|
+
requirements = Timeout.timeout(SLUG_LOOKUP_SECONDS) do
|
|
139
|
+
projects = api.list_projects
|
|
140
|
+
return nil unless projects[:ok]
|
|
141
|
+
|
|
142
|
+
found = (projects[:data]['projects'] || []).find { |p| p['slug'] == project || p['id'] == project }
|
|
143
|
+
return nil unless found
|
|
144
|
+
|
|
145
|
+
api.list_requirements(project_id: found['id'])
|
|
146
|
+
end
|
|
147
|
+
return nil unless requirements[:ok]
|
|
148
|
+
return nil if (requirements[:data]['requirements'] || []).any? { |r| r['slug'] == slug }
|
|
149
|
+
|
|
150
|
+
"No requirement '#{slug}' in project '#{project}'. The marker is written, but it binds nothing until " \
|
|
151
|
+
"that requirement exists: check the slug against `fp list` and `fp list --status draft`, or propose it."
|
|
152
|
+
rescue StandardError, Timeout::Error
|
|
153
|
+
nil
|
|
154
|
+
end
|
|
155
|
+
|
|
120
156
|
# Insert the marker above each target in one file. Targets go in from the bottom up,
|
|
121
157
|
# so every line number still means what it meant when the command started; each
|
|
122
158
|
# result's `line` is then where its marker sits in the file as written.
|
|
@@ -317,7 +353,9 @@ module Fp
|
|
|
317
353
|
s
|
|
318
354
|
end
|
|
319
355
|
|
|
320
|
-
def report(results)
|
|
356
|
+
def report(results, warning = nil)
|
|
357
|
+
# On stderr, so --json output stays one parseable document.
|
|
358
|
+
warn "Warning: #{warning}" if warning
|
|
321
359
|
data = results.map do |r|
|
|
322
360
|
{ file: r[:file], line: r[:line], marker: r[:marker], already_marked: r[:already] || false,
|
|
323
361
|
dry_run: r[:dry_run] || false, binds_to: r[:found] && r[:found][:title] }.compact
|
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])
|
|
@@ -52,6 +56,7 @@ module Fp
|
|
|
52
56
|
if requirements.empty?
|
|
53
57
|
output.success(report.merge('project' => project_slug)) do
|
|
54
58
|
puts 'No active requirements. The matrix is empty.'
|
|
59
|
+
puts 'Drafts join it once a human approves them. Until then, see them with: fp coverage'
|
|
55
60
|
puts "Surfaces: #{surfaces.join(', ')}" unless surfaces.empty?
|
|
56
61
|
end
|
|
57
62
|
return
|
data/lib/fp/commands/report.rb
CHANGED
|
@@ -29,7 +29,7 @@ module Fp
|
|
|
29
29
|
help_flag :test_type, "Kind of test (project's vocabulary, e.g. unit, integration, e2e)"
|
|
30
30
|
help_flag :file, 'Path to the test file (single-requirement mode)', required: true
|
|
31
31
|
help_flag :line, 'Line number of the test within the file'
|
|
32
|
-
help_flag :repo,
|
|
32
|
+
help_flag :repo, "Repository the test lives in (org/repo). Defaults to the checkout's git origin remote"
|
|
33
33
|
help_flag :pr, 'Pull request URL'
|
|
34
34
|
help_flag :sha, 'Commit SHA the evidence was observed at'
|
|
35
35
|
help_flag :work_item, 'Work-item URL (card/issue) that prompted the work'
|
|
@@ -69,6 +69,11 @@ module Fp
|
|
|
69
69
|
|
|
70
70
|
VALID_STATES = %w[present stub].freeze
|
|
71
71
|
|
|
72
|
+
# "org/repo" from the git origin remote of the checkout at `dir`, or nil.
|
|
73
|
+
def self.inferred_repo(dir = Dir.pwd)
|
|
74
|
+
RepoDetector.new(dir).git_remote_repo
|
|
75
|
+
end
|
|
76
|
+
|
|
72
77
|
def run(args)
|
|
73
78
|
opts, positional = parse_flags(args, KNOWN_FLAGS)
|
|
74
79
|
|
|
@@ -83,7 +88,7 @@ module Fp
|
|
|
83
88
|
require_project!(opts)
|
|
84
89
|
require_flag(opts, :surface)
|
|
85
90
|
require_flag(opts, :file)
|
|
86
|
-
|
|
91
|
+
resolve_repo!(opts)
|
|
87
92
|
|
|
88
93
|
# Validate state
|
|
89
94
|
state = opts[:state] || 'present'
|
|
@@ -207,13 +212,20 @@ module Fp
|
|
|
207
212
|
stored_source == 'ci' && CI_STATUSES.include?(stored_status) && stored_status != requested_state
|
|
208
213
|
end
|
|
209
214
|
|
|
215
|
+
# --repo, or the checkout's own origin remote when it wasn't given: an agent working
|
|
216
|
+
# in a clone shouldn't have to retype what git already knows (Fizzy #2040).
|
|
217
|
+
def resolve_repo!(opts)
|
|
218
|
+
opts[:repo] ||= self.class.inferred_repo
|
|
219
|
+
require_flag(opts, :repo, '--repo is required (org/repo): this checkout has no git origin remote to read it from')
|
|
220
|
+
end
|
|
221
|
+
|
|
210
222
|
# Batch-upload evidence from a JUnit XML report.
|
|
211
223
|
def run_junit(opts)
|
|
212
224
|
# The report's own checkout says which project it is: discovering from the
|
|
213
225
|
# report's directory (and up) means `fp report --junit hexhaven/junit.xml` run
|
|
214
226
|
# from a parent folder reads hexhaven's .featureparity.yml, not the parent's.
|
|
215
227
|
require_project!(opts, ProjectConfig.discover(File.dirname(File.expand_path(opts[:junit].to_s))))
|
|
216
|
-
|
|
228
|
+
resolve_repo!(opts)
|
|
217
229
|
# --surface is the default for markers that don't pin their own surface
|
|
218
230
|
# (e.g. `fp:slug@api,web`). It's only strictly required when at least one
|
|
219
231
|
# matched marker omits a surface — validated below once we know.
|
data/lib/fp/commands/run.rb
CHANGED
|
@@ -62,6 +62,18 @@ module Fp
|
|
|
62
62
|
exit 1
|
|
63
63
|
end
|
|
64
64
|
|
|
65
|
+
# The report needs a repo. Settle it before the suite runs, so a missing one costs
|
|
66
|
+
# a second rather than the whole run (Fizzy #2040).
|
|
67
|
+
unless report_args.include?('--repo') || report_args.any? { |a| a.start_with?('--repo=') }
|
|
68
|
+
repo = Report.inferred_repo
|
|
69
|
+
unless repo
|
|
70
|
+
output.error('--repo is required (org/repo): this checkout has no git origin remote to read it from. ' \
|
|
71
|
+
'Nothing was run.')
|
|
72
|
+
exit 1
|
|
73
|
+
end
|
|
74
|
+
report_args += ['--repo', repo]
|
|
75
|
+
end
|
|
76
|
+
|
|
65
77
|
tmp = Dir.mktmpdir('fp-run-')
|
|
66
78
|
begin
|
|
67
79
|
report_path, argv, env = self.class.inject(runner, command, tmp)
|
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: ask AI which of the source requirements apply to the new surface (paid plans; returns data, drafts nothing)'
|
|
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,30 @@ module Fp
|
|
|
162
186
|
|
|
163
187
|
project_id = resolve_project_id(opts[:project])
|
|
164
188
|
|
|
189
|
+
# With --from, everything that can refuse is checked before the surface is created:
|
|
190
|
+
# the source surface, the new key, that there is something to carry over, and (for
|
|
191
|
+
# --evaluate) that the project may use AI. A run that can't do its job leaves
|
|
192
|
+
# nothing behind (Fizzy #2040).
|
|
193
|
+
source_surface = nil
|
|
194
|
+
candidates = []
|
|
195
|
+
evaluations = []
|
|
196
|
+
if opts[:from]
|
|
197
|
+
source_result = client.find_surface_by_key(project_id, opts[:from])
|
|
198
|
+
unless source_result[:ok]
|
|
199
|
+
output.error("Source surface '#{opts[:from]}' not found in project '#{opts[:project]}'")
|
|
200
|
+
exit 1
|
|
201
|
+
end
|
|
202
|
+
source_surface = source_result[:data]['surface']
|
|
203
|
+
|
|
204
|
+
surface_exists!(key, opts[:project]) if client.find_surface_by_key(project_id, key)[:ok]
|
|
205
|
+
|
|
206
|
+
candidates = carry_over_candidates!(project_id, opts, key)
|
|
207
|
+
evaluations = evaluate_requirements_for_surface!(candidates, opts[:from], key) if opts[:evaluate]
|
|
208
|
+
elsif opts[:evaluate]
|
|
209
|
+
output.error('--evaluate needs --from <source surface>: it asks which of that surface\'s requirements apply to the new one.')
|
|
210
|
+
exit 1
|
|
211
|
+
end
|
|
212
|
+
|
|
165
213
|
# The API derives key from name and defaults kind/audience/default_branch, but we
|
|
166
214
|
# send the key explicitly because here the key is what the caller actually typed —
|
|
167
215
|
# `add api --name "Backend API"` must produce `api`, not `backend_api`.
|
|
@@ -173,14 +221,7 @@ module Fp
|
|
|
173
221
|
|
|
174
222
|
result = client.create_surface(project_id, params)
|
|
175
223
|
|
|
176
|
-
if !result[:ok] && result[:status] == 409
|
|
177
|
-
output.error(
|
|
178
|
-
"Surface '#{key}' already exists in project '#{opts[:project]}'. " \
|
|
179
|
-
"Change it with: fp surfaces edit #{key} --project #{opts[:project]} [--name ...] [--kind ...] [--repo ...]",
|
|
180
|
-
status: 409
|
|
181
|
-
)
|
|
182
|
-
exit 1
|
|
183
|
-
end
|
|
224
|
+
surface_exists!(key, opts[:project]) if !result[:ok] && result[:status] == 409
|
|
184
225
|
|
|
185
226
|
unless result[:ok]
|
|
186
227
|
output.error(result[:error], status: result[:status])
|
|
@@ -189,13 +230,37 @@ module Fp
|
|
|
189
230
|
|
|
190
231
|
surface = result[:data]['surface'] || {}
|
|
191
232
|
|
|
192
|
-
|
|
233
|
+
# Without --evaluate, propose the new surface on every candidate.
|
|
234
|
+
drafted = []
|
|
235
|
+
gaps = []
|
|
236
|
+
skipped = []
|
|
237
|
+
if source_surface && !opts[:evaluate]
|
|
238
|
+
drafted, gaps, skipped = draft_requirements_from_surface(project_id, opts[:project], surface, candidates,
|
|
239
|
+
opts[:from], key)
|
|
240
|
+
end
|
|
241
|
+
|
|
242
|
+
response_data = result[:data].merge('drafted' => drafted, 'gaps' => gaps)
|
|
243
|
+
response_data['skipped'] = skipped unless skipped.empty?
|
|
244
|
+
response_data['evaluations'] = evaluations unless evaluations.empty?
|
|
245
|
+
|
|
246
|
+
output.success(response_data) do
|
|
193
247
|
puts "Created surface '#{surface['key'] || key}' in project '#{opts[:project]}'."
|
|
194
248
|
puts
|
|
195
249
|
puts " Name: #{surface['name']}"
|
|
196
250
|
puts " Kind: #{surface['kind']}"
|
|
197
251
|
puts " Audience: #{surface['audience']}"
|
|
198
252
|
puts " Repo: #{surface['repo'] || '(none)'}"
|
|
253
|
+
|
|
254
|
+
if source_surface
|
|
255
|
+
puts
|
|
256
|
+
if opts[:evaluate]
|
|
257
|
+
print_evaluations(evaluations, opts[:from], key)
|
|
258
|
+
else
|
|
259
|
+
print_drafted_requirements(drafted, opts[:from], key)
|
|
260
|
+
print_skipped_requirements(skipped)
|
|
261
|
+
print_gap_list(gaps, key) unless gaps.empty?
|
|
262
|
+
end
|
|
263
|
+
end
|
|
199
264
|
end
|
|
200
265
|
end
|
|
201
266
|
|
|
@@ -347,6 +412,149 @@ module Fp
|
|
|
347
412
|
end
|
|
348
413
|
end
|
|
349
414
|
|
|
415
|
+
# POST /projects/:id/surfaces/:surface_id/batch_draft
|
|
416
|
+
#
|
|
417
|
+
# Batch-draft requirements for a surface (Fizzy #2009). Takes a list of requirement
|
|
418
|
+
# slugs and proposes adding this surface to each one's required_surfaces. Used after
|
|
419
|
+
# `fp surfaces add --from --evaluate` to draft only the requirements the agent
|
|
420
|
+
# decides apply.
|
|
421
|
+
def batch_draft(args)
|
|
422
|
+
opts, positional = parse_flags(args, BATCH_DRAFT_FLAGS)
|
|
423
|
+
|
|
424
|
+
# Check mutually exclusive flags before doing any API calls
|
|
425
|
+
if opts[:slugs] && opts[:slugs_file]
|
|
426
|
+
output.error('Pass --slugs or --slugs-file, not both.')
|
|
427
|
+
exit 1
|
|
428
|
+
end
|
|
429
|
+
|
|
430
|
+
require_project!(opts)
|
|
431
|
+
|
|
432
|
+
key = positional.first
|
|
433
|
+
if key.nil? || key.strip.empty?
|
|
434
|
+
output.error('Usage: fp surfaces batch-draft <key> --project <slug> --slugs slug1,slug2 | --slugs-file file.json')
|
|
435
|
+
exit 1
|
|
436
|
+
end
|
|
437
|
+
|
|
438
|
+
project_id = resolve_project_id(opts[:project])
|
|
439
|
+
surface = find_surface!(project_id, key)
|
|
440
|
+
|
|
441
|
+
slugs = resolve_batch_draft_slugs(opts)
|
|
442
|
+
if slugs.empty?
|
|
443
|
+
output.error('No slugs provided. Use --slugs slug1,slug2 or --slugs-file file.json')
|
|
444
|
+
exit 1
|
|
445
|
+
end
|
|
446
|
+
|
|
447
|
+
result = client.batch_draft_surface_requirements(
|
|
448
|
+
project_id,
|
|
449
|
+
surface['id'],
|
|
450
|
+
slugs: slugs,
|
|
451
|
+
reason: opts[:reason],
|
|
452
|
+
source_type: opts[:source_type],
|
|
453
|
+
source_url: opts[:source_url],
|
|
454
|
+
source_context: opts[:source_context]
|
|
455
|
+
)
|
|
456
|
+
|
|
457
|
+
unless result[:ok]
|
|
458
|
+
output.error(result[:error], status: result[:status])
|
|
459
|
+
exit 1
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
data = result[:data]
|
|
463
|
+
output.success(data) do
|
|
464
|
+
print_batch_draft_result(data, key, opts[:project])
|
|
465
|
+
end
|
|
466
|
+
end
|
|
467
|
+
|
|
468
|
+
# Resolve slugs from --slugs or --slugs-file. Accepts:
|
|
469
|
+
# - --slugs as comma-separated: "login,checkout,profile"
|
|
470
|
+
# - --slugs-file as JSON: ["login", "checkout"] or [{"slug": "login"}, ...]
|
|
471
|
+
def resolve_batch_draft_slugs(opts)
|
|
472
|
+
# Mutual exclusion already checked in batch_draft before API calls
|
|
473
|
+
|
|
474
|
+
if opts[:slugs]
|
|
475
|
+
return opts[:slugs].to_s.split(',').map(&:strip).reject(&:empty?)
|
|
476
|
+
end
|
|
477
|
+
|
|
478
|
+
if opts[:slugs_file]
|
|
479
|
+
return read_slugs_file(opts[:slugs_file])
|
|
480
|
+
end
|
|
481
|
+
|
|
482
|
+
[]
|
|
483
|
+
end
|
|
484
|
+
|
|
485
|
+
# Read slugs from a JSON file. Accepts:
|
|
486
|
+
# - Array of strings: ["login", "checkout"]
|
|
487
|
+
# - Array of objects with "slug" key: [{"slug": "login", "applies": true}, ...]
|
|
488
|
+
# (the output format of --evaluate, filtered)
|
|
489
|
+
def read_slugs_file(path)
|
|
490
|
+
unless File.file?(path)
|
|
491
|
+
output.error("--slugs-file: no such file '#{path}'")
|
|
492
|
+
exit 1
|
|
493
|
+
end
|
|
494
|
+
|
|
495
|
+
content = File.read(path).strip
|
|
496
|
+
begin
|
|
497
|
+
data = JSON.parse(content)
|
|
498
|
+
rescue JSON::ParserError => e
|
|
499
|
+
output.error("--slugs-file: invalid JSON (#{e.message})")
|
|
500
|
+
exit 1
|
|
501
|
+
end
|
|
502
|
+
|
|
503
|
+
unless data.is_a?(Array)
|
|
504
|
+
output.error("--slugs-file: expected a JSON array of slugs or objects with 'slug' key")
|
|
505
|
+
exit 1
|
|
506
|
+
end
|
|
507
|
+
|
|
508
|
+
data.map do |item|
|
|
509
|
+
case item
|
|
510
|
+
when String
|
|
511
|
+
item.strip
|
|
512
|
+
when Hash
|
|
513
|
+
item['slug']&.to_s&.strip
|
|
514
|
+
else
|
|
515
|
+
nil
|
|
516
|
+
end
|
|
517
|
+
end.compact.reject(&:empty?)
|
|
518
|
+
end
|
|
519
|
+
|
|
520
|
+
def print_batch_draft_result(data, surface_key, project_slug)
|
|
521
|
+
summary = data['summary'] || {}
|
|
522
|
+
drafted = data['drafted'] || []
|
|
523
|
+
skipped = data['skipped'] || []
|
|
524
|
+
errors = data['errors'] || []
|
|
525
|
+
|
|
526
|
+
puts "Batch draft for surface '#{surface_key}' in project '#{project_slug}':"
|
|
527
|
+
puts
|
|
528
|
+
puts " Requested: #{summary['requested'] || 0}"
|
|
529
|
+
puts " Drafted: #{summary['drafted'] || 0}"
|
|
530
|
+
puts " Skipped: #{summary['skipped'] || 0}"
|
|
531
|
+
puts " Errors: #{summary['errors'] || 0}"
|
|
532
|
+
|
|
533
|
+
if drafted.any?
|
|
534
|
+
puts
|
|
535
|
+
puts "Drafted (#{drafted.size}):"
|
|
536
|
+
drafted.each { |d| puts " ✅ #{d['slug']}: #{truncate(d['title'], 50)}" }
|
|
537
|
+
end
|
|
538
|
+
|
|
539
|
+
if skipped.any?
|
|
540
|
+
puts
|
|
541
|
+
puts "Skipped (#{skipped.size}):"
|
|
542
|
+
skipped.each { |s| puts " ⏭️ #{s['slug']}: #{s['reason']}" }
|
|
543
|
+
end
|
|
544
|
+
|
|
545
|
+
if errors.any?
|
|
546
|
+
puts
|
|
547
|
+
puts "Errors (#{errors.size}):"
|
|
548
|
+
errors.each { |e| puts " ❌ #{e['slug']}: #{e['error']}" }
|
|
549
|
+
end
|
|
550
|
+
|
|
551
|
+
return unless drafted.any?
|
|
552
|
+
|
|
553
|
+
puts
|
|
554
|
+
puts '⚠️ These are now DRAFTS awaiting human review.'
|
|
555
|
+
puts ' A human must approve each change in the web app before the surface is measured.'
|
|
556
|
+
end
|
|
557
|
+
|
|
350
558
|
# Same guard as `fp projects delete`: --yes skips the prompt, an interactive
|
|
351
559
|
# terminal types the key back, and anything else is refused.
|
|
352
560
|
def confirm_delete!(surface, opts)
|
|
@@ -471,6 +679,236 @@ module Fp
|
|
|
471
679
|
[]
|
|
472
680
|
end
|
|
473
681
|
end
|
|
682
|
+
|
|
683
|
+
# --- --from: draft requirements from a source surface ---
|
|
684
|
+
|
|
685
|
+
def surface_exists!(key, project_slug)
|
|
686
|
+
output.error(
|
|
687
|
+
"Surface '#{key}' already exists in project '#{project_slug}'. " \
|
|
688
|
+
"Change it with: fp surfaces edit #{key} --project #{project_slug} [--name ...] [--kind ...] [--repo ...]",
|
|
689
|
+
status: 409
|
|
690
|
+
)
|
|
691
|
+
exit 1
|
|
692
|
+
end
|
|
693
|
+
|
|
694
|
+
# The requirements --from carries over: active ones and drafts that name the source
|
|
695
|
+
# surface and not yet the new one. Drafts count because a project an agent has just
|
|
696
|
+
# onboarded has nothing else, and `fp surfaces batch-draft` takes them too. Parents
|
|
697
|
+
# come before their children, since a child can't require a surface its parent
|
|
698
|
+
# doesn't. Exits before anything is created when the list can't be read or is empty.
|
|
699
|
+
def carry_over_candidates!(project_id, opts, new_surface_key)
|
|
700
|
+
source_key = opts[:from]
|
|
701
|
+
result = client.list_requirements(project_id: project_id)
|
|
702
|
+
unless result[:ok]
|
|
703
|
+
output.error("Could not list requirements to carry over from '#{source_key}': #{result[:error]}. " \
|
|
704
|
+
'Nothing was created.', status: result[:status])
|
|
705
|
+
exit 1
|
|
706
|
+
end
|
|
707
|
+
|
|
708
|
+
requirements = result[:data]['requirements'] || []
|
|
709
|
+
candidates = requirements.select do |req|
|
|
710
|
+
surfaces = req['required_surfaces'] || []
|
|
711
|
+
%w[active draft].include?(req['status']) && surfaces.include?(source_key) && !surfaces.include?(new_surface_key)
|
|
712
|
+
end
|
|
713
|
+
|
|
714
|
+
if candidates.empty?
|
|
715
|
+
output.error(
|
|
716
|
+
"No active or draft requirement names '#{source_key}' without already naming '#{new_surface_key}', " \
|
|
717
|
+
"so there is nothing to carry over. Nothing was created. To add the surface on its own: " \
|
|
718
|
+
"fp surfaces add #{new_surface_key} --project #{opts[:project]}"
|
|
719
|
+
)
|
|
720
|
+
exit 1
|
|
721
|
+
end
|
|
722
|
+
|
|
723
|
+
by_id = requirements.to_h { |req| [req['id'], req] }
|
|
724
|
+
candidates.sort_by.with_index { |req, index| [requirement_depth(req, by_id), index] }
|
|
725
|
+
end
|
|
726
|
+
|
|
727
|
+
def requirement_depth(requirement, by_id)
|
|
728
|
+
depth = 0
|
|
729
|
+
seen = {}
|
|
730
|
+
parent = by_id[requirement['parent_id']]
|
|
731
|
+
while parent && !seen[parent['id']]
|
|
732
|
+
seen[parent['id']] = true
|
|
733
|
+
depth += 1
|
|
734
|
+
parent = by_id[parent['parent_id']]
|
|
735
|
+
end
|
|
736
|
+
depth
|
|
737
|
+
end
|
|
738
|
+
|
|
739
|
+
# Propose the new surface on every candidate, through the same endpoint as
|
|
740
|
+
# `fp surfaces batch-draft` so the two can't disagree about what gets drafted or
|
|
741
|
+
# skipped. Returns [drafted, gaps, skipped].
|
|
742
|
+
def draft_requirements_from_surface(project_id, project_slug, surface, candidates, source_key, new_surface_key)
|
|
743
|
+
result = client.batch_draft_surface_requirements(
|
|
744
|
+
project_id,
|
|
745
|
+
surface['id'],
|
|
746
|
+
slugs: candidates.map { |req| req['slug'] },
|
|
747
|
+
reason: "Adding '#{new_surface_key}' surface (from 'fp surfaces add --from #{source_key}')",
|
|
748
|
+
source_type: 'manual'
|
|
749
|
+
)
|
|
750
|
+
|
|
751
|
+
unless result[:ok]
|
|
752
|
+
output.error(
|
|
753
|
+
"Created surface '#{new_surface_key}', but could not draft requirements for it: #{result[:error]}. " \
|
|
754
|
+
"Retry with: fp surfaces batch-draft #{new_surface_key} --project #{project_slug} " \
|
|
755
|
+
"--slugs #{candidates.map { |req| req['slug'] }.join(',')}",
|
|
756
|
+
status: result[:status]
|
|
757
|
+
)
|
|
758
|
+
exit 1
|
|
759
|
+
end
|
|
760
|
+
|
|
761
|
+
data = result[:data]
|
|
762
|
+
by_slug = candidates.to_h { |req| [req['slug'], req] }
|
|
763
|
+
|
|
764
|
+
(data['errors'] || []).each do |err|
|
|
765
|
+
warn "Warning: could not draft '#{err['slug']}': #{err['error']}"
|
|
766
|
+
end
|
|
767
|
+
|
|
768
|
+
drafted = (data['drafted'] || []).map do |row|
|
|
769
|
+
req = by_slug[row['slug']] || {}
|
|
770
|
+
{
|
|
771
|
+
'slug' => row['slug'],
|
|
772
|
+
'title' => row['title'] || req['title'],
|
|
773
|
+
'surfaces' => (req['required_surfaces'] || []) + [new_surface_key]
|
|
774
|
+
}
|
|
775
|
+
end
|
|
776
|
+
|
|
777
|
+
# The gap list is every requirement we just drafted — they all need evidence on
|
|
778
|
+
# the new surface. Format matches what `fp list --gaps` returns.
|
|
779
|
+
gaps = drafted.map do |req|
|
|
780
|
+
{
|
|
781
|
+
'slug' => req['slug'],
|
|
782
|
+
'title' => req['title'],
|
|
783
|
+
'surfaces' => [{ 'surface' => new_surface_key, 'state' => 'missing' }]
|
|
784
|
+
}
|
|
785
|
+
end
|
|
786
|
+
|
|
787
|
+
[drafted, gaps, data['skipped'] || []]
|
|
788
|
+
end
|
|
789
|
+
|
|
790
|
+
# --- --from --evaluate: evaluate requirements for applicability ---
|
|
791
|
+
|
|
792
|
+
# A refusal that will be the same for every requirement: no AI access for this
|
|
793
|
+
# project (402), a key that can't reach it, or the analyzer being unavailable.
|
|
794
|
+
EVALUATION_BLOCKED = [401, 402, 403, 503].freeze
|
|
795
|
+
|
|
796
|
+
# Ask, for each candidate, whether it applies to the new surface. Returns a list of
|
|
797
|
+
# evaluations with applicability verdicts and reasoning for agent decision-making.
|
|
798
|
+
# Runs before the surface is created: a project without AI access is told once and
|
|
799
|
+
# the command exits 1 with nothing made, as `fp analyze` does.
|
|
800
|
+
def evaluate_requirements_for_surface!(candidates, source_key, new_surface_key)
|
|
801
|
+
candidates.map do |req|
|
|
802
|
+
progress("Evaluating #{req['slug']} ...")
|
|
803
|
+
|
|
804
|
+
eval_result = client.evaluate_surface_applicability(req['id'], new_surface_key, source_key)
|
|
805
|
+
|
|
806
|
+
if eval_result[:ok]
|
|
807
|
+
evaluation = eval_result[:data]['evaluation'] || {}
|
|
808
|
+
{
|
|
809
|
+
'slug' => req['slug'],
|
|
810
|
+
'title' => req['title'],
|
|
811
|
+
'applies' => evaluation['applies'],
|
|
812
|
+
'probability' => evaluation['probability'],
|
|
813
|
+
'confidence' => evaluation['confidence'],
|
|
814
|
+
'reason' => evaluation['reason']
|
|
815
|
+
}
|
|
816
|
+
elsif EVALUATION_BLOCKED.include?(eval_result[:status])
|
|
817
|
+
output.error(
|
|
818
|
+
"#{eval_result[:error]} Nothing was created. Without --evaluate, " \
|
|
819
|
+
"fp surfaces add #{new_surface_key} --from #{source_key} drafts every requirement on '#{source_key}' for review.",
|
|
820
|
+
status: eval_result[:status]
|
|
821
|
+
)
|
|
822
|
+
exit 1
|
|
823
|
+
else
|
|
824
|
+
# One requirement failed for a reason of its own; the rest still get an answer.
|
|
825
|
+
{
|
|
826
|
+
'slug' => req['slug'],
|
|
827
|
+
'title' => req['title'],
|
|
828
|
+
'applies' => nil,
|
|
829
|
+
'probability' => nil,
|
|
830
|
+
'confidence' => nil,
|
|
831
|
+
'reason' => nil,
|
|
832
|
+
'error' => eval_result[:error]
|
|
833
|
+
}
|
|
834
|
+
end
|
|
835
|
+
end
|
|
836
|
+
end
|
|
837
|
+
|
|
838
|
+
def print_evaluations(evaluations, source_key, new_key)
|
|
839
|
+
applies = evaluations.select { |e| e['applies'] == true }
|
|
840
|
+
does_not_apply = evaluations.select { |e| e['applies'] == false }
|
|
841
|
+
errors = evaluations.select { |e| e['error'] }
|
|
842
|
+
|
|
843
|
+
puts "Evaluated #{evaluations.size} requirement(s) from '#{source_key}' for '#{new_key}':"
|
|
844
|
+
puts
|
|
845
|
+
puts " ✅ Applies (#{applies.size}):"
|
|
846
|
+
applies.each do |e|
|
|
847
|
+
puts " #{e['slug']}: #{truncate(e['title'], 50)}"
|
|
848
|
+
puts " #{e['reason']}" if e['reason']
|
|
849
|
+
end
|
|
850
|
+
|
|
851
|
+
puts
|
|
852
|
+
puts " ❌ Does not apply (#{does_not_apply.size}):"
|
|
853
|
+
does_not_apply.each do |e|
|
|
854
|
+
puts " #{e['slug']}: #{truncate(e['title'], 50)}"
|
|
855
|
+
puts " #{e['reason']}" if e['reason']
|
|
856
|
+
end
|
|
857
|
+
|
|
858
|
+
unless errors.empty?
|
|
859
|
+
puts
|
|
860
|
+
puts " ⚠️ Evaluation failed (#{errors.size}):"
|
|
861
|
+
errors.each do |e|
|
|
862
|
+
puts " #{e['slug']}: #{e['error']}"
|
|
863
|
+
end
|
|
864
|
+
end
|
|
865
|
+
|
|
866
|
+
puts
|
|
867
|
+
puts 'Nothing was drafted. Draft the ones you decide apply with:'
|
|
868
|
+
puts " fp surfaces batch-draft #{new_key} --slugs slug1,slug2"
|
|
869
|
+
end
|
|
870
|
+
|
|
871
|
+
def progress(message)
|
|
872
|
+
warn message unless output.json?
|
|
873
|
+
end
|
|
874
|
+
|
|
875
|
+
def print_drafted_requirements(drafted, source_key, new_key)
|
|
876
|
+
if drafted.empty?
|
|
877
|
+
puts "No requirement on '#{source_key}' was drafted for '#{new_key}'."
|
|
878
|
+
return
|
|
879
|
+
end
|
|
880
|
+
|
|
881
|
+
puts "Drafted #{drafted.size} requirement(s) from '#{source_key}' to include '#{new_key}':"
|
|
882
|
+
drafted.each { |req| puts " - #{req['slug']}: #{truncate(req['title'], 50)}" }
|
|
883
|
+
puts
|
|
884
|
+
puts '⚠️ These are now DRAFTS awaiting human review.'
|
|
885
|
+
puts ' A human must approve each change in the web app before the surface is measured.'
|
|
886
|
+
end
|
|
887
|
+
|
|
888
|
+
SKIP_REASONS = {
|
|
889
|
+
'has_pending_change' => 'already has a change awaiting review',
|
|
890
|
+
'already_includes_surface' => 'already names this surface',
|
|
891
|
+
'archived' => 'archived'
|
|
892
|
+
}.freeze
|
|
893
|
+
|
|
894
|
+
def print_skipped_requirements(skipped)
|
|
895
|
+
return if skipped.empty?
|
|
896
|
+
|
|
897
|
+
puts
|
|
898
|
+
puts "Skipped (#{skipped.size}):"
|
|
899
|
+
skipped.each { |row| puts " - #{row['slug']}: #{SKIP_REASONS[row['reason']] || row['reason']}" }
|
|
900
|
+
end
|
|
901
|
+
|
|
902
|
+
def print_gap_list(gaps, new_key)
|
|
903
|
+
puts
|
|
904
|
+
puts "Gap list for '#{new_key}' (#{gaps.size} requirement(s) need coverage):"
|
|
905
|
+
headers = %w[SLUG TITLE STATE]
|
|
906
|
+
rows = gaps.map do |gap|
|
|
907
|
+
state = gap['surfaces'].first
|
|
908
|
+
[gap['slug'], truncate(gap['title'], 40), state ? "#{state['surface']} (#{state['state']})" : '-']
|
|
909
|
+
end
|
|
910
|
+
output.table(headers, rows)
|
|
911
|
+
end
|
|
474
912
|
end
|
|
475
913
|
end
|
|
476
914
|
end
|
data/lib/fp/repo_detector.rb
CHANGED
|
@@ -101,9 +101,15 @@ module Fp
|
|
|
101
101
|
end
|
|
102
102
|
|
|
103
103
|
# Human-readable summary of #detect, printed by `fp doctor` and `fp init --detect`.
|
|
104
|
-
|
|
104
|
+
# `project` is the slug the repo's .featureparity.yml already names; with one there is
|
|
105
|
+
# nothing left to suggest.
|
|
106
|
+
def self.print_summary(repo, out: $stdout, project: nil)
|
|
105
107
|
out.puts 'Repo'
|
|
106
|
-
|
|
108
|
+
if project
|
|
109
|
+
out.puts " Project: #{project} (from the project file)"
|
|
110
|
+
else
|
|
111
|
+
out.puts " Suggested slug: #{repo['slug']}#{repo['repo'] ? " (from git remote #{repo['repo']})" : ' (from the directory name)'}"
|
|
112
|
+
end
|
|
107
113
|
frameworks = repo['frameworks'].map { |f| f['dir'] == '.' ? f['name'] : "#{f['name']} (#{f['dir']})" }
|
|
108
114
|
out.puts " Frameworks: #{frameworks.empty? ? '(none recognised)' : frameworks.uniq.join(', ')}"
|
|
109
115
|
|
data/lib/fp/version.rb
CHANGED
data/skills/fp/SKILL.md
CHANGED
|
@@ -516,6 +516,23 @@ media remove <id> --yes` takes one down. A surface with media but no link is sti
|
|
|
516
516
|
Feedback and the share link are human-only, so after writing the content tell a person
|
|
517
517
|
it's ready.
|
|
518
518
|
|
|
519
|
+
### 10. Add a platform the product now ships on
|
|
520
|
+
|
|
521
|
+
When the product gains a surface (Android when it already has web), carry the catalog
|
|
522
|
+
over instead of re-typing it:
|
|
523
|
+
|
|
524
|
+
```bash
|
|
525
|
+
fp surfaces add android --from web # create android, propose it on every requirement that names web
|
|
526
|
+
fp surfaces add android --from web --evaluate --json > eval.json # or ask AI which ones apply first (paid plans)
|
|
527
|
+
fp surfaces batch-draft android --slugs login,checkout # then propose it on the ones you chose
|
|
528
|
+
```
|
|
529
|
+
|
|
530
|
+
`--from` takes active and draft requirements, and creates nothing when it has nothing to
|
|
531
|
+
carry over or `--evaluate` isn't available on the project's plan. Each proposal waits for
|
|
532
|
+
a human: until it is approved the new surface isn't required, the existing tests keep
|
|
533
|
+
their verdicts, and `fp check` is unchanged. After approval, `fp list --gaps --surface
|
|
534
|
+
android` is the list of tests to write.
|
|
535
|
+
|
|
519
536
|
### Repo-local config (`.featureparity.yml`)
|
|
520
537
|
|
|
521
538
|
If a repo has a `.featureparity.yml`, `--project` is optional — `fp` reads the slug from
|
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,28 @@ 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 or draft requirement that names `web`,
|
|
78
|
+
proposes adding the new surface to each (parents before their children), and returns a
|
|
79
|
+
gap list. The proposals await human review. It goes through the same endpoint as `fp
|
|
80
|
+
surfaces batch-draft`, so a requirement that already has a change awaiting review is
|
|
81
|
+
skipped and named. Everything is checked first: if the source surface doesn't exist, the
|
|
82
|
+
new key is taken, or no requirement names the source, the command exits 1 and creates
|
|
83
|
+
nothing.
|
|
84
|
+
|
|
85
|
+
**`--from --evaluate`**: Instead of mass-drafting, asks the AI whether each source
|
|
86
|
+
requirement applies to the target platform. Returns applicability verdicts with
|
|
87
|
+
reasoning — which requirements apply (✅), which don't (❌), and why. Nothing is
|
|
88
|
+
drafted; send the slugs you decide apply to `fp surfaces batch-draft`. Useful for
|
|
89
|
+
filtering the ~10% that are platform-specific (browser resize, web-only APIs) from the
|
|
90
|
+
90% that transfer to any client. Requires a Pro plan or a project owner with AI access:
|
|
91
|
+
without it the command says so once, exits 1, and creates nothing.
|
|
92
|
+
|
|
93
|
+
**While a new surface awaits review, nothing else moves.** A proposal that only adds a
|
|
94
|
+
required surface leaves the existing tests' verdicts as they were, and the gate keeps
|
|
95
|
+
measuring the requirement on the surfaces it already had. The new surface is required
|
|
96
|
+
(and its cells `missing`) only once a human approves it.
|
|
97
|
+
|
|
74
98
|
A surface that requirements still require can't be deleted or re-keyed — the server
|
|
75
99
|
refuses and names them. Taking a surface off a requirement is a human's call, so ask
|
|
76
100
|
one rather than working around it.
|
|
@@ -1053,7 +1077,7 @@ fp repos unset customer_android --project acme
|
|
|
1053
1077
|
fp is a Ruby gem, so any of these installs the newest version:
|
|
1054
1078
|
|
|
1055
1079
|
```bash
|
|
1056
|
-
fp update #
|
|
1080
|
+
fp update # fp 0.0.34 and newer
|
|
1057
1081
|
gem update featureparity
|
|
1058
1082
|
curl -fsSL https://api.featureparity.dev/api/cli/install | bash # the installer again
|
|
1059
1083
|
```
|
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.36
|
|
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
|