featureparity 0.0.32 → 0.0.33
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/cli.rb +4 -1
- data/lib/fp/client.rb +5 -0
- data/lib/fp/commands/check.rb +29 -0
- data/lib/fp/commands/help.rb +5 -0
- data/lib/fp/commands/init.rb +16 -3
- data/lib/fp/commands/mark.rb +242 -53
- data/lib/fp/commands/show.rb +3 -0
- data/lib/fp/commands/skill.rb +153 -0
- data/lib/fp/commands/whoami.rb +34 -3
- data/lib/fp/commands.rb +1 -0
- data/lib/fp/junit.rb +13 -0
- data/lib/fp/repo_detector.rb +17 -2
- data/lib/fp/version.rb +1 -1
- data/skills/fp/SKILL.md +6 -4
- data/skills/fp/references/cli.md +36 -7
- metadata +4 -4
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ed664952f7dd1c088b3d534868eb06023a3dcdfe5783417288745560217ab1ee
|
|
4
|
+
data.tar.gz: de7931594143ee7c9324a6b29968b77f60435c51af0f935ec01ea9f8347aebdc
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 73231f3b48feda8c832eaedaa25c58d637ffecc436be1f2518da1089c9e9747517a08b53765a1f44b9faf92174a4711f1eb371abac522a64d6a3c292ed7ac98a
|
|
7
|
+
data.tar.gz: f7fb9b80fe7d7236523279c13d1e42b1d80cd89bd3bdf8163015abe88cbb33f13b14acb35ca95a9de9bcbddbc6d15ade21a1cb362537038c8e6b4e3ce731b5f5
|
data/lib/fp/cli.rb
CHANGED
|
@@ -38,6 +38,7 @@ module Fp
|
|
|
38
38
|
'repos' => Commands::Repos,
|
|
39
39
|
'setup' => Commands::Setup,
|
|
40
40
|
'whoami' => Commands::Whoami,
|
|
41
|
+
'skill' => Commands::Skill,
|
|
41
42
|
'version' => Commands::Version,
|
|
42
43
|
'help' => Commands::Help,
|
|
43
44
|
'attach' => Commands::Attach,
|
|
@@ -83,7 +84,7 @@ module Fp
|
|
|
83
84
|
|
|
84
85
|
# Profile/config commands don't need auth. `init` is here too: it only writes
|
|
85
86
|
# files into the repo, and onboarding a repo must work before anyone has a key.
|
|
86
|
-
needs_auth = !%w[init doctor profile config repos setup whoami version help mark tutorial].include?(command_name)
|
|
87
|
+
needs_auth = !%w[init doctor profile config repos setup whoami skill version help mark tutorial].include?(command_name)
|
|
87
88
|
|
|
88
89
|
if needs_auth
|
|
89
90
|
config = Config.new(profile: global_opts[:profile], api_url: global_opts[:api_url])
|
|
@@ -95,6 +96,8 @@ module Fp
|
|
|
95
96
|
client = Client.new(config)
|
|
96
97
|
else
|
|
97
98
|
config = Config.new(profile: global_opts[:profile], api_url: global_opts[:api_url])
|
|
99
|
+
# whoami asks the API who the key acts as, but still works with no valid key.
|
|
100
|
+
client = Client.new(config) if command_name == 'whoami' && config.valid?
|
|
98
101
|
end
|
|
99
102
|
|
|
100
103
|
output = Output.new(json: global_opts[:json])
|
data/lib/fp/client.rb
CHANGED
data/lib/fp/commands/check.rb
CHANGED
|
@@ -281,6 +281,7 @@ module Fp
|
|
|
281
281
|
print_inherited(report)
|
|
282
282
|
print_orphans(report)
|
|
283
283
|
print_pending_reviews(report, project_slug)
|
|
284
|
+
print_retirements(report)
|
|
284
285
|
print_unscoped_warning(summary, project_slug)
|
|
285
286
|
print_next_steps(report, violations)
|
|
286
287
|
print_verdict(passed, violations, opts, report)
|
|
@@ -333,6 +334,34 @@ module Fp
|
|
|
333
334
|
puts
|
|
334
335
|
end
|
|
335
336
|
|
|
337
|
+
# Retired requirements whose tests still run somewhere: a removal was approved, but
|
|
338
|
+
# the feature hasn't come out of every surface yet (Fizzy #1820). It fails the gate
|
|
339
|
+
# wherever `missing` does — the server decides (`retirements_violate`, already
|
|
340
|
+
# folded into `passing`); here it is rendered as a violation or a note. On a pull
|
|
341
|
+
# request only the surfaces this run put it back on count.
|
|
342
|
+
def print_retirements(report)
|
|
343
|
+
retirements = report['retirements'] || []
|
|
344
|
+
return if retirements.empty?
|
|
345
|
+
|
|
346
|
+
violates = report['retirements_violate']
|
|
347
|
+
lead = "#{retirements.size} retired requirement(s) still shipping — the removal was approved, " \
|
|
348
|
+
'but their tests still run'
|
|
349
|
+
puts violates ? "#{lead} (a violation at this level):" : "#{lead} (not failing the gate at this level):"
|
|
350
|
+
headers = %w[SLUG STILL_SHIPPING_ON REMOVED_FROM]
|
|
351
|
+
headers << 'ADDED_BY_THIS_CHANGE' if report['pull_request']
|
|
352
|
+
output.table(
|
|
353
|
+
headers,
|
|
354
|
+
retirements.map do |r|
|
|
355
|
+
row = [r['slug'], Array(r['still_shipping_on']).join(', '), Array(r['removed_from']).join(', ')]
|
|
356
|
+
row << Array(r['introduced_on']).join(', ') if report['pull_request']
|
|
357
|
+
row
|
|
358
|
+
end
|
|
359
|
+
)
|
|
360
|
+
hint = retirements.first['action_hint']
|
|
361
|
+
puts "Next step (agent): #{hint}" if hint
|
|
362
|
+
puts
|
|
363
|
+
end
|
|
364
|
+
|
|
336
365
|
def print_violations(violations, report = {})
|
|
337
366
|
return if violations.empty?
|
|
338
367
|
|
data/lib/fp/commands/help.rb
CHANGED
|
@@ -108,6 +108,7 @@ module Fp
|
|
|
108
108
|
profile add|list Manage named profiles
|
|
109
109
|
config set|get|unset|list Manage global settings
|
|
110
110
|
whoami Show the resolved config (profile, env, API URL, key)
|
|
111
|
+
skill install [--agent X] Install the bundled agent skill (.claude/skills, .agents/skills)
|
|
111
112
|
repos set|get|list|unset Map surfaces to local repo paths
|
|
112
113
|
setup Interactive first-time setup
|
|
113
114
|
version Show version (also: fp --version, fp -v)
|
|
@@ -255,6 +256,10 @@ module Fp
|
|
|
255
256
|
fp whoami --json
|
|
256
257
|
fp --profile staging whoami
|
|
257
258
|
|
|
259
|
+
# Install the agent skill that ships with this gem (.claude/skills/fp, .agents/skills/fp)
|
|
260
|
+
fp skill install
|
|
261
|
+
fp skill install --agent claude --global
|
|
262
|
+
|
|
258
263
|
# Non-interactive setup for CI/automation
|
|
259
264
|
fp setup --api-key fp_... --profile ci-agent --non-interactive
|
|
260
265
|
|
data/lib/fp/commands/init.rb
CHANGED
|
@@ -533,6 +533,21 @@ module Fp
|
|
|
533
533
|
end
|
|
534
534
|
end
|
|
535
535
|
|
|
536
|
+
# How to get a report out of the suite, said for the repo's first detected test
|
|
537
|
+
# runner (Fizzy #1991). A pytest repo was told about RSpec's JSON report first.
|
|
538
|
+
def report_shortcut
|
|
539
|
+
runner = ((@detection || {})['test_runners'] || []).first
|
|
540
|
+
if runner && runner['fp_run'] && runner['name'] != 'rspec'
|
|
541
|
+
"To run the suite and report in one step, with no formatter added to the project:\n" \
|
|
542
|
+
"`#{runner['fp_run']}`. Or write the report yourself with\n" \
|
|
543
|
+
"`#{runner['report_command']}` and pass it to `--junit`."
|
|
544
|
+
else
|
|
545
|
+
"`--junit` also takes RSpec's own `--format json` report. To run the suite and report in\n" \
|
|
546
|
+
"one step with no formatter added to the project (rspec, pytest, vitest, playwright):\n" \
|
|
547
|
+
'`fp run --surface <surface> --repo <org/repo> -- <test command>`.'
|
|
548
|
+
end
|
|
549
|
+
end
|
|
550
|
+
|
|
536
551
|
def agents_section(project_slug)
|
|
537
552
|
<<~MARKDOWN
|
|
538
553
|
#{AGENTS_MARKER}
|
|
@@ -638,9 +653,7 @@ module Fp
|
|
|
638
653
|
--work-item <card-or-issue-url>
|
|
639
654
|
```
|
|
640
655
|
|
|
641
|
-
|
|
642
|
-
one step with no formatter added to the project (rspec, pytest, vitest, playwright):
|
|
643
|
-
`fp run --surface <surface> --repo <org/repo> -- <test command>`.
|
|
656
|
+
#{report_shortcut}
|
|
644
657
|
|
|
645
658
|
Report `present` or `stub` only — **never** claim `passing`/`failing`. Those are CI's
|
|
646
659
|
to write, via `fp ci-report`, and the gate trusts them precisely because agents can't
|
data/lib/fp/commands/mark.rb
CHANGED
|
@@ -1,27 +1,52 @@
|
|
|
1
1
|
# frozen_string_literal: true
|
|
2
2
|
|
|
3
|
+
require 'digest'
|
|
4
|
+
require 'fileutils'
|
|
5
|
+
require 'json'
|
|
6
|
+
require 'tmpdir'
|
|
7
|
+
|
|
3
8
|
module Fp
|
|
4
9
|
module Commands
|
|
5
|
-
# fp mark <slug> <file>:<line> [--surface a,b] [--type e2e]
|
|
10
|
+
# fp mark <slug> <file>:<line>|<file>::<test name> [more targets…] [--surface a,b] [--type e2e]
|
|
11
|
+
# [--comment '#'] [--dry-run]
|
|
12
|
+
#
|
|
13
|
+
# Insert an fp:<slug> marker directly above a test, in that file's own comment syntax
|
|
14
|
+
# and indentation (Fizzy #1786). Marking by hand across Ruby, JS, Swift and SQL meant a
|
|
15
|
+
# script per language and the occasional marker the scanner didn't recognise; this
|
|
16
|
+
# writes one the scanner reads back, and says which test it binds to. Purely local: no
|
|
17
|
+
# API key, no network.
|
|
6
18
|
#
|
|
7
|
-
#
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
#
|
|
11
|
-
#
|
|
19
|
+
# A test can be named instead of numbered (`file::test name`), and several targets can
|
|
20
|
+
# go in one call (Fizzy #1987). An agent that reads a file once and then marks three of
|
|
21
|
+
# its tests by line number put the second and third markers one and two lines too low,
|
|
22
|
+
# because each insert pushes everything below it down. A name is found in the file as
|
|
23
|
+
# it is when the command runs, and the line numbers given in one call all refer to the
|
|
24
|
+
# file before that call changes it.
|
|
25
|
+
#
|
|
26
|
+
# Separate calls are covered too (Fizzy #1991). fp remembers the marker lines it put
|
|
27
|
+
# into a file for a while, and while nothing else has edited that file, a line number
|
|
28
|
+
# that no longer points at a test is also read as it was numbered before those
|
|
29
|
+
# markers went in. So `fp mark a f:3`, `fp mark b f:7`, `fp mark c f:11`, all from one
|
|
30
|
+
# read of the file, land on the three tests that were on lines 3, 7 and 11.
|
|
12
31
|
class Mark < Base
|
|
13
32
|
help_summary 'Insert an fp:<slug> marker above a test, in the file\'s own comment syntax'
|
|
14
|
-
help_usage 'fp mark <slug> <file>:<line> [--surface a,b] [--type <test-type>] [--dry-run]'
|
|
33
|
+
help_usage 'fp mark <slug> <file>:<line>|<file>::<test name> [more targets…] [--surface a,b] [--type <test-type>] [--dry-run]'
|
|
15
34
|
help_flag :surface, 'Pin the marker to these surfaces (fp:slug@a,b); omit to use --surface at report time'
|
|
16
35
|
help_flag :type, 'Pin the kind of test (fp:slug@surface:e2e); needs --surface'
|
|
17
36
|
help_flag :comment, "Comment prefix to use when the extension isn't known (e.g. '#', '//', '--')"
|
|
18
37
|
help_flag :dry_run, 'Show the marker and where it would go; change nothing'
|
|
19
38
|
help_example 'fp mark academic_experience_required_fields spec/models/academic_experience_spec.rb:52'
|
|
39
|
+
help_example "fp mark locker_rejects_oversize tests/test_parcel_locker.py::test_rejects_oversize_parcel"
|
|
40
|
+
help_example "fp mark required_fields 'spec/models/user_spec.rb::requires an email' spec/models/user_spec.rb:40"
|
|
20
41
|
help_example 'fp mark checkout_flow e2e/checkout.spec.ts:10 --surface web --type e2e'
|
|
21
|
-
help_note "
|
|
22
|
-
"
|
|
23
|
-
"
|
|
24
|
-
"
|
|
42
|
+
help_note "A target is <file>:<line> (the `it`/`test`/`def test_` line) or <file>::<test name> (the name as the file declares it;\n" \
|
|
43
|
+
"a pytest id like file.py::TestClass::test_x works too). The marker goes directly above the test.\n" \
|
|
44
|
+
"Marking several tests in one file? Name them, and the line numbers can't go stale. Line numbers given in one call\n" \
|
|
45
|
+
"all refer to the file before that call. Across separate calls each insert shifts the lines below it down by one;\n" \
|
|
46
|
+
"fp allows for the markers it added itself, so line numbers from one read of the file keep working, and it says\n" \
|
|
47
|
+
"so when it moved one. If a number could mean two tests, fp asks for the name instead of guessing.\n" \
|
|
48
|
+
"The \"It binds to:\" line is the check: if it names the wrong test, or fp warns that no test declaration was\n" \
|
|
49
|
+
"recognised, the marker landed on the wrong line.\n" \
|
|
25
50
|
'Marking a test binds it to a requirement: never mark a test that is currently failing to make it count.'
|
|
26
51
|
|
|
27
52
|
KNOWN_FLAGS = {
|
|
@@ -44,18 +69,25 @@ module Fp
|
|
|
44
69
|
SLUG_RE = /\A[a-z0-9][a-z0-9_-]*\z/.freeze
|
|
45
70
|
KEY_RE = /\A[a-z0-9_-]+\z/.freeze
|
|
46
71
|
|
|
72
|
+
# How many of a file's test names to list when a named test isn't there.
|
|
73
|
+
NAMES_SHOWN = 12
|
|
74
|
+
|
|
75
|
+
# How long fp remembers the markers it inserted into a file, in seconds. Long enough
|
|
76
|
+
# for an agent working down a file from one read of it, short enough that a line
|
|
77
|
+
# number from a later, fresh read is rarely second-guessed.
|
|
78
|
+
JOURNAL_TTL = 30 * 60
|
|
79
|
+
|
|
47
80
|
def run(args)
|
|
48
81
|
opts, positional = parse_flags(args, KNOWN_FLAGS)
|
|
49
|
-
slug,
|
|
82
|
+
slug, *locations = positional
|
|
50
83
|
|
|
51
|
-
|
|
52
|
-
output.error('Usage: fp mark <slug> <file>:<line>')
|
|
84
|
+
if slug.nil? || locations.empty?
|
|
85
|
+
output.error('Usage: fp mark <slug> <file>:<line>|<file>::<test name> [more targets…]')
|
|
53
86
|
exit 1
|
|
54
87
|
end
|
|
55
88
|
|
|
56
89
|
fail_with("'#{slug}' isn't a valid slug (lowercase letters, numbers, - and _).") unless slug.match?(SLUG_RE)
|
|
57
90
|
|
|
58
|
-
path, line_no = parse_location(location)
|
|
59
91
|
surfaces = (opts[:surface] || '').split(',').map(&:strip).reject(&:empty?)
|
|
60
92
|
bad = surfaces.reject { |s| s.match?(KEY_RE) }
|
|
61
93
|
fail_with("Invalid surface key(s): #{bad.join(', ')}") unless bad.empty?
|
|
@@ -64,50 +96,195 @@ module Fp
|
|
|
64
96
|
fail_with('--type needs --surface: a marker pins its kind after its surfaces (fp:slug@api:e2e)') if surfaces.empty?
|
|
65
97
|
end
|
|
66
98
|
|
|
99
|
+
marker = "fp:#{slug}"
|
|
100
|
+
marker += "@#{surfaces.join(',')}" unless surfaces.empty?
|
|
101
|
+
marker += ":#{opts[:type]}" if opts[:type]
|
|
102
|
+
|
|
103
|
+
# Resolve every target against the files as they are now, before anything is
|
|
104
|
+
# written, so one target can't move another and a bad target changes nothing.
|
|
105
|
+
targets = locations.map { |location| parse_location(location) }
|
|
106
|
+
files = targets.map { |t| t[:path] }.uniq.to_h { |path| [path, File.read(path).lines] }
|
|
107
|
+
earlier = files.to_h { |path, lines| [path, earlier_inserts(path, lines)] }
|
|
108
|
+
targets.each { |t| t[:line] = resolve_line(t, files[t[:path]], earlier[t[:path]]) }
|
|
109
|
+
targets = targets.uniq { |t| [t[:path], t[:line]] }
|
|
110
|
+
|
|
111
|
+
results = targets.group_by { |t| t[:path] }.flat_map do |path, file_targets|
|
|
112
|
+
mark_file(path, files[path], file_targets, slug, marker, opts, earlier[path])
|
|
113
|
+
end
|
|
114
|
+
|
|
115
|
+
report(results)
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
private
|
|
119
|
+
|
|
120
|
+
# Insert the marker above each target in one file. Targets go in from the bottom up,
|
|
121
|
+
# so every line number still means what it meant when the command started; each
|
|
122
|
+
# result's `line` is then where its marker sits in the file as written.
|
|
123
|
+
def mark_file(path, lines, file_targets, slug, marker, opts, earlier = [])
|
|
67
124
|
prefix = opts[:comment] || comment_prefix_for(path)
|
|
68
125
|
unless prefix
|
|
69
126
|
fail_with("Don't know the comment syntax for #{File.basename(path)}. Pass --comment, e.g. --comment '#' or --comment '//'.")
|
|
70
127
|
end
|
|
71
128
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
129
|
+
updated = lines.dup
|
|
130
|
+
results = file_targets.sort_by { |t| -t[:line] }.map do |target|
|
|
131
|
+
line_no = target[:line]
|
|
132
|
+
if already_marked?(updated, line_no, marker)
|
|
133
|
+
next { file: path, original_line: line_no, marker: marker, already: true }
|
|
134
|
+
end
|
|
76
135
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
136
|
+
test_line = updated[line_no - 1]
|
|
137
|
+
comment_line = "#{test_line[/\A[ \t]*/]}#{prefix} #{marker}#{line_ending(test_line)}"
|
|
138
|
+
updated.insert(line_no - 1, comment_line)
|
|
139
|
+
found = Fp::JUnit.scan_markers(updated.join).find { |m| m[:line] == line_no && m[:slug] == slug }
|
|
140
|
+
unless found
|
|
141
|
+
fail_with("A '#{prefix}' comment isn't one fp's scanner reads as a marker. Use #, //, -- or /* … */.")
|
|
142
|
+
end
|
|
80
143
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
144
|
+
{ file: path, original_line: line_no, marker: marker, found: found, comment_line: comment_line.strip,
|
|
145
|
+
given_line: target[:given_line] }
|
|
146
|
+
end
|
|
84
147
|
|
|
85
|
-
|
|
86
|
-
|
|
148
|
+
File.write(path, updated.join) unless opts[:dry_run]
|
|
149
|
+
|
|
150
|
+
# A marker moves down one line for every marker inserted above it.
|
|
151
|
+
inserted = results.reject { |r| r[:already] }.map { |r| r[:original_line] }
|
|
152
|
+
results = results.sort_by { |r| r[:original_line] }.map do |r|
|
|
153
|
+
r.merge(line: r[:original_line] + inserted.count { |l| l < r[:original_line] }, dry_run: opts[:dry_run])
|
|
87
154
|
end
|
|
88
155
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
156
|
+
unless opts[:dry_run] || inserted.empty?
|
|
157
|
+
# Markers from earlier calls move down too: one line for each insert at or above them.
|
|
158
|
+
moved = earlier.map { |line| line + inserted.count { |l| l <= line } }
|
|
159
|
+
remember_inserts(path, updated, moved + results.reject { |r| r[:already] }.map { |r| r[:line] })
|
|
93
160
|
end
|
|
161
|
+
results
|
|
162
|
+
end
|
|
94
163
|
|
|
95
|
-
|
|
96
|
-
|
|
164
|
+
# The marker lines fp inserted into this file in earlier calls, as line numbers in the
|
|
165
|
+
# file as it stands, oldest first. Empty once anything else has edited the file (its
|
|
166
|
+
# content no longer matches what fp wrote) or the note is older than JOURNAL_TTL.
|
|
167
|
+
def earlier_inserts(path, lines)
|
|
168
|
+
note = JSON.parse(File.read(journal_file(path)))
|
|
169
|
+
return [] unless note['sha'] == Digest::SHA256.hexdigest(lines.join)
|
|
170
|
+
return [] if Time.now.to_i - note['at'].to_i > JOURNAL_TTL
|
|
171
|
+
|
|
172
|
+
Array(note['inserted']).map(&:to_i)
|
|
173
|
+
rescue StandardError
|
|
174
|
+
[]
|
|
97
175
|
end
|
|
98
176
|
|
|
99
|
-
|
|
177
|
+
# Best effort: without the note, line numbers are simply read as the file stands.
|
|
178
|
+
def remember_inserts(path, lines, inserted)
|
|
179
|
+
file = journal_file(path)
|
|
180
|
+
FileUtils.mkdir_p(File.dirname(file), mode: 0o700)
|
|
181
|
+
Dir.glob(File.join(File.dirname(file), '*.json')).each do |old|
|
|
182
|
+
File.delete(old) if Time.now - File.mtime(old) > JOURNAL_TTL
|
|
183
|
+
end
|
|
184
|
+
File.write(file, JSON.generate('sha' => Digest::SHA256.hexdigest(lines.join), 'at' => Time.now.to_i,
|
|
185
|
+
'inserted' => inserted))
|
|
186
|
+
rescue StandardError
|
|
187
|
+
nil
|
|
188
|
+
end
|
|
100
189
|
|
|
190
|
+
def journal_file(path)
|
|
191
|
+
File.join(Dir.tmpdir, "fp-mark-#{Process.uid}", "#{Digest::SHA256.hexdigest(File.expand_path(path))}.json")
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
# <file>::<test name> or <file>:<line>. The name form is checked first, so a test
|
|
195
|
+
# named with digits isn't read as a line number.
|
|
101
196
|
def parse_location(location)
|
|
197
|
+
if (m = location.match(/\A(.+?)::(.+)\z/))
|
|
198
|
+
path = m[1]
|
|
199
|
+
fail_with("No such file: #{path}") unless File.file?(path)
|
|
200
|
+
return { path: path, name: m[2] }
|
|
201
|
+
end
|
|
202
|
+
|
|
102
203
|
m = location.match(/\A(.+):(\d+)\z/)
|
|
103
|
-
fail_with("Give the test's location as <file>:<line> (got '#{location}').") unless m
|
|
204
|
+
fail_with("Give the test's location as <file>:<line> or <file>::<test name> (got '#{location}').") unless m
|
|
104
205
|
|
|
105
206
|
path = m[1]
|
|
106
207
|
line_no = m[2].to_i
|
|
107
208
|
fail_with("No such file: #{path}") unless File.file?(path)
|
|
108
209
|
fail_with('Line numbers start at 1.') if line_no < 1
|
|
109
210
|
|
|
110
|
-
|
|
211
|
+
{ path: path, line: line_no }
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
def resolve_line(target, lines, earlier = [])
|
|
215
|
+
path = target[:path]
|
|
216
|
+
if target[:name]
|
|
217
|
+
line_for_name(path, lines, target[:name])
|
|
218
|
+
else
|
|
219
|
+
fail_with("#{path} has #{lines.length} line(s); there is no line #{target[:line]}.") if target[:line] > lines.length
|
|
220
|
+
line = line_allowing_for_earlier_marks(path, lines, target[:line], earlier)
|
|
221
|
+
target[:given_line] = target[:line] if line != target[:line]
|
|
222
|
+
line
|
|
223
|
+
end
|
|
224
|
+
end
|
|
225
|
+
|
|
226
|
+
# A line number may have been read before fp's earlier markers pushed the file's
|
|
227
|
+
# lines down. Read it both ways: as the file stands, and as it was numbered before
|
|
228
|
+
# each run of those markers went in. When exactly one reading lands on a test
|
|
229
|
+
# declaration, that is the test. When none does, the number is taken as given, as it
|
|
230
|
+
# always was. When several do, nothing says which was meant, so nothing is written.
|
|
231
|
+
def line_allowing_for_earlier_marks(path, lines, given, earlier)
|
|
232
|
+
return given if earlier.empty?
|
|
233
|
+
|
|
234
|
+
readings = (0..earlier.length).filter_map { |known| line_numbered_without(lines, given, earlier[known..]) }.uniq
|
|
235
|
+
tests = readings.select { |line| Fp::JUnit.test_declared_on(lines[line - 1]) }
|
|
236
|
+
return given if tests.empty?
|
|
237
|
+
return tests.first if tests.length == 1
|
|
238
|
+
|
|
239
|
+
choices = tests.sort.map do |line|
|
|
240
|
+
name = Fp::JUnit.test_declared_on(lines[line - 1]).first
|
|
241
|
+
" #{path}::#{name} (line #{line} now)"
|
|
242
|
+
end
|
|
243
|
+
fail_with("fp added markers to #{path} a moment ago, so line #{given} could mean more than one test. " \
|
|
244
|
+
"Name the one you mean:\n#{choices.join("\n")}")
|
|
245
|
+
end
|
|
246
|
+
|
|
247
|
+
# The line that was numbered `given` before the marker lines in `unseen` existed.
|
|
248
|
+
def line_numbered_without(lines, given, unseen)
|
|
249
|
+
count = 0
|
|
250
|
+
(1..lines.length).each do |line|
|
|
251
|
+
next if unseen.include?(line)
|
|
252
|
+
|
|
253
|
+
count += 1
|
|
254
|
+
return line if count == given
|
|
255
|
+
end
|
|
256
|
+
nil
|
|
257
|
+
end
|
|
258
|
+
|
|
259
|
+
# The line declaring the test called `name`. Tried as given, then as the last part
|
|
260
|
+
# of a pytest id (TestClass::test_x), then without a pytest parameter suffix
|
|
261
|
+
# (test_x[case-1]), so an id copied out of a runner's output finds its test.
|
|
262
|
+
def line_for_name(path, lines, name)
|
|
263
|
+
declared = lines.each_with_index.filter_map do |line, i|
|
|
264
|
+
decl = Fp::JUnit.test_declared_on(line)
|
|
265
|
+
[decl.first, i + 1] if decl
|
|
266
|
+
end
|
|
267
|
+
|
|
268
|
+
candidates = [name, name.split('::').last]
|
|
269
|
+
candidates += candidates.map { |n| n.sub(/\[[^\]]*\]\z/, '') }
|
|
270
|
+
candidates.uniq.each do |candidate|
|
|
271
|
+
hits = declared.select { |n, _| n == candidate }.map(&:last)
|
|
272
|
+
return hits.first if hits.length == 1
|
|
273
|
+
next if hits.empty?
|
|
274
|
+
|
|
275
|
+
fail_with("#{path} declares '#{candidate}' more than once (lines #{hits.join(', ')}). " \
|
|
276
|
+
"Mark it as #{path}:<line> instead.")
|
|
277
|
+
end
|
|
278
|
+
|
|
279
|
+
known = declared.map(&:first).uniq
|
|
280
|
+
hint = if known.empty?
|
|
281
|
+
'fp recognises no test declarations in it; mark it as <file>:<line> instead.'
|
|
282
|
+
else
|
|
283
|
+
shown = known.first(NAMES_SHOWN).map { |n| " #{n}" }.join("\n")
|
|
284
|
+
more = known.length > NAMES_SHOWN ? "\n …and #{known.length - NAMES_SHOWN} more" : ''
|
|
285
|
+
"The tests it declares:\n#{shown}#{more}"
|
|
286
|
+
end
|
|
287
|
+
fail_with("No test named '#{name}' in #{path}. #{hint}")
|
|
111
288
|
end
|
|
112
289
|
|
|
113
290
|
def comment_prefix_for(path)
|
|
@@ -140,24 +317,36 @@ module Fp
|
|
|
140
317
|
s
|
|
141
318
|
end
|
|
142
319
|
|
|
143
|
-
def report(
|
|
144
|
-
data =
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
320
|
+
def report(results)
|
|
321
|
+
data = results.map do |r|
|
|
322
|
+
{ file: r[:file], line: r[:line], marker: r[:marker], already_marked: r[:already] || false,
|
|
323
|
+
dry_run: r[:dry_run] || false, binds_to: r[:found] && r[:found][:title] }.compact
|
|
324
|
+
end
|
|
325
|
+
# One target answers with the one object it always has; several with a list.
|
|
326
|
+
output.success(data.length == 1 ? data.first : { marks: data }) do
|
|
327
|
+
results.each { |r| print_result(r) }
|
|
328
|
+
end
|
|
329
|
+
end
|
|
151
330
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
331
|
+
def print_result(result)
|
|
332
|
+
path = result[:file]
|
|
333
|
+
line_no = result[:line]
|
|
334
|
+
if result[:already]
|
|
335
|
+
puts "#{path}:#{line_no} is already marked #{result[:marker]}; nothing changed."
|
|
336
|
+
return
|
|
337
|
+
end
|
|
338
|
+
|
|
339
|
+
if result[:given_line]
|
|
340
|
+
puts "Line #{result[:given_line]} was numbered before fp's earlier markers in #{path}; that test is on line #{result[:original_line]} now."
|
|
341
|
+
end
|
|
342
|
+
verb = result[:dry_run] ? 'Would insert' : 'Inserted'
|
|
343
|
+
puts "#{verb} at #{path}:#{line_no}:"
|
|
344
|
+
puts " #{result[:comment_line]}"
|
|
345
|
+
if result[:found][:title]
|
|
346
|
+
puts "It binds to: #{result[:found][:title]}"
|
|
347
|
+
else
|
|
348
|
+
puts "⚠️ No test declaration was recognised below line #{line_no}. Check that the line is the test itself;"
|
|
349
|
+
puts ' if the runner reports file paths, the marker still binds by file.'
|
|
161
350
|
end
|
|
162
351
|
end
|
|
163
352
|
|
data/lib/fp/commands/show.rb
CHANGED
|
@@ -201,6 +201,9 @@ module Fp
|
|
|
201
201
|
else
|
|
202
202
|
puts " Status: #{e['status']}"
|
|
203
203
|
end
|
|
204
|
+
# The requirement was retired and the default branch's CI no longer runs
|
|
205
|
+
# this test: the feature is out of this surface (Fizzy #1820).
|
|
206
|
+
puts " Removed: #{e['removed_at']} (CI no longer runs this test)" if e['removed_at']
|
|
204
207
|
# A pull request's CI may have written over the merged verdict; show both
|
|
205
208
|
# when they differ so "failing" next to "PR: …" reads as the branch's
|
|
206
209
|
# result, not the default branch's.
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
require 'fileutils'
|
|
4
|
+
|
|
5
|
+
module Fp
|
|
6
|
+
module Commands
|
|
7
|
+
# fp skill install [--agent claude|agents|all] [--dir PATH] [--global] [--path DIR] [--force]
|
|
8
|
+
# fp skill path
|
|
9
|
+
#
|
|
10
|
+
# Copies the Agent Skills package that ships inside the gem (`skills/fp/`) into an
|
|
11
|
+
# agent's skills directory (Fizzy #1984). The docs used to send agents to
|
|
12
|
+
# `npx skills add stowzilla/feature_parity`, which 404s because that repository is
|
|
13
|
+
# private. Installing from the gem needs no network, and the copy always matches the
|
|
14
|
+
# fp the agent will run, so re-running after `gem update featureparity` refreshes it.
|
|
15
|
+
#
|
|
16
|
+
# Targets, relative to the repo (or $HOME with --global):
|
|
17
|
+
# .claude/skills/fp Claude Code
|
|
18
|
+
# .agents/skills/fp Codex, Cursor, Gemini CLI, Copilot and the other agents that
|
|
19
|
+
# read the shared Agent Skills location
|
|
20
|
+
class Skill < Base
|
|
21
|
+
help_summary 'Install the fp agent skill bundled with this gem into a skills directory'
|
|
22
|
+
help_usage 'fp skill install [--agent claude|agents|all] [--dir PATH] [--global] [--force]',
|
|
23
|
+
'fp skill install --path <skills-dir>',
|
|
24
|
+
'fp skill path'
|
|
25
|
+
help_flag :agent, 'Which skills directory: claude (.claude/skills), agents (.agents/skills), or all (default)'
|
|
26
|
+
help_flag :dir, 'Repository to install into (defaults to the working directory)'
|
|
27
|
+
help_flag :global, 'Install into your home directory (~/.claude/skills, ~/.agents/skills) instead of a repo'
|
|
28
|
+
help_flag :path, 'An explicit skills directory; the skill is written to <path>/fp'
|
|
29
|
+
help_flag :force, "Replace a directory named fp that isn't the fp skill"
|
|
30
|
+
help_example 'fp skill install', 'Into .claude/skills/fp and .agents/skills/fp in this repo'
|
|
31
|
+
help_example 'fp skill install --agent claude --global', 'For Claude Code in every repo'
|
|
32
|
+
help_example 'fp skill path', 'Where the bundled skill lives, to copy it yourself'
|
|
33
|
+
help_note "Makes no API calls and needs no key. Re-run after upgrading the gem to refresh the copy.\n" \
|
|
34
|
+
'An existing fp skill is replaced; files you added inside it are removed.'
|
|
35
|
+
|
|
36
|
+
KNOWN_FLAGS = {
|
|
37
|
+
agent: :string,
|
|
38
|
+
dir: :string,
|
|
39
|
+
path: :string,
|
|
40
|
+
global: :boolean,
|
|
41
|
+
force: :boolean
|
|
42
|
+
}.freeze
|
|
43
|
+
|
|
44
|
+
SOURCE_DIR = File.expand_path('../../../skills/fp', __dir__)
|
|
45
|
+
SKILL_NAME = 'fp'
|
|
46
|
+
|
|
47
|
+
AGENT_DIRS = {
|
|
48
|
+
'claude' => File.join('.claude', 'skills'),
|
|
49
|
+
'agents' => File.join('.agents', 'skills')
|
|
50
|
+
}.freeze
|
|
51
|
+
|
|
52
|
+
def run(args)
|
|
53
|
+
opts, positional = parse_flags(args, KNOWN_FLAGS)
|
|
54
|
+
|
|
55
|
+
case positional.first
|
|
56
|
+
when 'install' then install(opts)
|
|
57
|
+
when 'path' then print_path
|
|
58
|
+
else
|
|
59
|
+
output.error("Usage: #{self.class.help_usage.join(' | ')}")
|
|
60
|
+
exit 1
|
|
61
|
+
end
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
private
|
|
65
|
+
|
|
66
|
+
def print_path
|
|
67
|
+
ensure_source!
|
|
68
|
+
output.success({ path: SOURCE_DIR, version: Fp::VERSION }) { puts SOURCE_DIR }
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def install(opts)
|
|
72
|
+
ensure_source!
|
|
73
|
+
|
|
74
|
+
installed = targets(opts).map { |skills_dir| install_into(skills_dir, opts[:force]) }
|
|
75
|
+
|
|
76
|
+
output.success({ version: Fp::VERSION, source: SOURCE_DIR, installed: installed }) do
|
|
77
|
+
installed.each do |i|
|
|
78
|
+
puts " #{i[:action].ljust(9)} #{i[:path]}"
|
|
79
|
+
end
|
|
80
|
+
puts
|
|
81
|
+
puts "Installed the fp #{Fp::VERSION} skill. Re-run `fp skill install` after upgrading the gem."
|
|
82
|
+
end
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
def targets(opts)
|
|
86
|
+
return [File.expand_path(opts[:path])] if opts[:path]
|
|
87
|
+
|
|
88
|
+
agent = opts[:agent] || 'all'
|
|
89
|
+
dirs = agent == 'all' ? AGENT_DIRS.values : [AGENT_DIRS[agent]]
|
|
90
|
+
unless dirs.all?
|
|
91
|
+
output.error("--agent must be one of: #{(AGENT_DIRS.keys + ['all']).join(', ')}")
|
|
92
|
+
exit 1
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
root = opts[:global] ? Dir.home : File.expand_path(opts[:dir] || Dir.pwd)
|
|
96
|
+
unless File.directory?(root)
|
|
97
|
+
output.error("Not a directory: #{root}")
|
|
98
|
+
exit 1
|
|
99
|
+
end
|
|
100
|
+
|
|
101
|
+
dirs.map { |d| File.join(root, d) }
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
def install_into(skills_dir, force)
|
|
105
|
+
dest = File.join(skills_dir, SKILL_NAME)
|
|
106
|
+
action = if !File.exist?(dest) then 'installed'
|
|
107
|
+
elsif same_tree?(dest) then 'unchanged'
|
|
108
|
+
else 'updated'
|
|
109
|
+
end
|
|
110
|
+
|
|
111
|
+
if action == 'updated' && !fp_skill?(dest) && !force
|
|
112
|
+
output.error("#{dest} exists and isn't the fp skill. Pass --force to replace it.")
|
|
113
|
+
exit 1
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
unless action == 'unchanged'
|
|
117
|
+
FileUtils.rm_rf(dest)
|
|
118
|
+
FileUtils.mkdir_p(skills_dir)
|
|
119
|
+
FileUtils.cp_r(SOURCE_DIR, dest)
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
{ path: dest, action: action }
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
# A previous copy of this skill (any version) says `name: fp` in its frontmatter.
|
|
126
|
+
def fp_skill?(dir)
|
|
127
|
+
File.read(File.join(dir, 'SKILL.md'))[/\A---\n.*?^name:\s*["']?fp["']?\s*$/m]
|
|
128
|
+
rescue SystemCallError
|
|
129
|
+
false
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
def same_tree?(dest)
|
|
133
|
+
relative_files(SOURCE_DIR) == relative_files(dest) &&
|
|
134
|
+
relative_files(SOURCE_DIR).all? do |f|
|
|
135
|
+
FileUtils.compare_file(File.join(SOURCE_DIR, f), File.join(dest, f))
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
def relative_files(root)
|
|
140
|
+
Dir.glob('**/*', File::FNM_DOTMATCH, base: root)
|
|
141
|
+
.reject { |f| File.basename(f) == '.' || File.directory?(File.join(root, f)) }
|
|
142
|
+
.sort
|
|
143
|
+
end
|
|
144
|
+
|
|
145
|
+
def ensure_source!
|
|
146
|
+
return if File.file?(File.join(SOURCE_DIR, 'SKILL.md'))
|
|
147
|
+
|
|
148
|
+
output.error("The fp skill isn't in this install (looked in #{SOURCE_DIR}). Reinstall the featureparity gem.")
|
|
149
|
+
exit 1
|
|
150
|
+
end
|
|
151
|
+
end
|
|
152
|
+
end
|
|
153
|
+
end
|
data/lib/fp/commands/whoami.rb
CHANGED
|
@@ -7,17 +7,19 @@ module Fp
|
|
|
7
7
|
# Show the *resolved* configuration the CLI would actually use for this
|
|
8
8
|
# invocation: which profile is active, the API URL and where it came from,
|
|
9
9
|
# the environment that URL targets, and whether an API key is present
|
|
10
|
-
# (masked — never the full token)
|
|
11
|
-
# works even without a valid key. Honors --profile / --api-url / --json.
|
|
10
|
+
# (masked — never the full token), then asks the API who that key acts as
|
|
11
|
+
# (best-effort, so it works even without a valid key). Honors --profile / --api-url / --json.
|
|
12
12
|
class Whoami < Base
|
|
13
13
|
help_summary 'Show the resolved config (profile, API URL, environment, masked key)'
|
|
14
14
|
help_usage 'fp whoami [--json]'
|
|
15
15
|
help_example 'fp whoami'
|
|
16
16
|
help_example 'fp --profile staging whoami'
|
|
17
|
-
help_note
|
|
17
|
+
help_note "Config is resolved locally; the 'Acting as' line asks the API who the key belongs to and is skipped if that fails."
|
|
18
18
|
|
|
19
19
|
def run(_args)
|
|
20
20
|
r = config.resolved
|
|
21
|
+
identity = fetch_identity(r)
|
|
22
|
+
r = r.merge(identity: identity[:data], identity_error: identity[:error]).compact
|
|
21
23
|
|
|
22
24
|
output.success(r) do
|
|
23
25
|
puts 'Resolved FeatureParity CLI configuration:'
|
|
@@ -27,6 +29,7 @@ module Fp
|
|
|
27
29
|
puts " API URL: #{format_value(r[:api_url], r[:api_url_source])}"
|
|
28
30
|
puts " API key: #{key_line(r)}"
|
|
29
31
|
puts " Config file: #{r[:config_file]}"
|
|
32
|
+
puts " Acting as: #{identity_line(r)}"
|
|
30
33
|
|
|
31
34
|
if r[:profile_environment] && r[:profile_environment] != r[:environment]
|
|
32
35
|
puts
|
|
@@ -48,6 +51,34 @@ module Fp
|
|
|
48
51
|
|
|
49
52
|
private
|
|
50
53
|
|
|
54
|
+
# Asks the API who the key is. Never fatal: whoami must still print the local
|
|
55
|
+
# config offline or with a bad key, so a failure is reported on the Acting as line.
|
|
56
|
+
def fetch_identity(r)
|
|
57
|
+
return {} unless client && r[:api_key_present]
|
|
58
|
+
|
|
59
|
+
result = client.whoami
|
|
60
|
+
return { data: result[:data]['whoami'] || result[:data] } if result[:ok]
|
|
61
|
+
|
|
62
|
+
{ error: result[:error] }
|
|
63
|
+
rescue StandardError => e
|
|
64
|
+
{ error: e.message }
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
def identity_line(r)
|
|
68
|
+
id = r[:identity]
|
|
69
|
+
return "(unknown: #{r[:identity_error]})" if r[:identity_error]
|
|
70
|
+
return '(not checked)' unless id
|
|
71
|
+
|
|
72
|
+
if id['type'] == 'agent'
|
|
73
|
+
key = id['key'] || {}
|
|
74
|
+
owner = id['owner']
|
|
75
|
+
who = owner ? "#{owner['email']}'s agent" : 'an agent'
|
|
76
|
+
"#{key['name']} (#{key['token_hint']}), #{who}"
|
|
77
|
+
else
|
|
78
|
+
"#{id['email']} (signed in as a person)"
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
51
82
|
def format_value(value, source)
|
|
52
83
|
display = value.nil? || value.to_s.empty? ? '(none)' : value
|
|
53
84
|
source && source != 'none' ? "#{display} [from #{source}]" : display.to_s
|
data/lib/fp/commands.rb
CHANGED
|
@@ -33,6 +33,7 @@ require_relative 'commands/config_cmd'
|
|
|
33
33
|
require_relative 'commands/repos'
|
|
34
34
|
require_relative 'commands/setup'
|
|
35
35
|
require_relative 'commands/whoami'
|
|
36
|
+
require_relative 'commands/skill'
|
|
36
37
|
require_relative 'commands/version'
|
|
37
38
|
require_relative 'commands/help'
|
|
38
39
|
require_relative 'commands/attach'
|
data/lib/fp/junit.rb
CHANGED
|
@@ -823,6 +823,19 @@ module Fp
|
|
|
823
823
|
[/\b(?:def|fun|func)\s+(test_?\w+)/i, :test] # minitest / xctest / pytest
|
|
824
824
|
].freeze
|
|
825
825
|
|
|
826
|
+
# The [name, kind] a single line declares, or nil when it declares no test we recognise.
|
|
827
|
+
# `fp mark <file>::<name>` finds its target with this, so it reads names exactly as the
|
|
828
|
+
# scanner will when the marker is bound.
|
|
829
|
+
def test_declared_on(line)
|
|
830
|
+
return nil if line.match?(COMMENT_LINE_RE)
|
|
831
|
+
|
|
832
|
+
TEST_DECL_PATTERNS.each do |re, kind|
|
|
833
|
+
match = line.match(re)
|
|
834
|
+
return [unescape_name(match.captures.last), kind] if match
|
|
835
|
+
end
|
|
836
|
+
nil
|
|
837
|
+
end
|
|
838
|
+
|
|
826
839
|
# The name of the first test declaration at or below `idx`, as [title, kind].
|
|
827
840
|
# Intervening comment and blank lines are skipped (a marker is often followed by more
|
|
828
841
|
# comments), but the search gives up at the first line of real code that declares
|
data/lib/fp/repo_detector.rb
CHANGED
|
@@ -339,7 +339,22 @@ module Fp
|
|
|
339
339
|
PY_MANIFESTS = %w[pyproject.toml requirements.txt requirements-dev.txt setup.cfg setup.py Pipfile].freeze
|
|
340
340
|
|
|
341
341
|
def python?(dir)
|
|
342
|
-
PY_MANIFESTS.any? { |f| file?(dir, f) } || file?(dir, 'pytest.ini')
|
|
342
|
+
PY_MANIFESTS.any? { |f| file?(dir, f) } || file?(dir, 'pytest.ini') || pytest_files?(dir)
|
|
343
|
+
end
|
|
344
|
+
|
|
345
|
+
# pytest-style tests with no manifest beside them (Fizzy #1991): a small repo is often
|
|
346
|
+
# just `tests/test_*.py`. A test directory is read as part of its parent, so `tests/`
|
|
347
|
+
# isn't also reported as a runner of its own.
|
|
348
|
+
PY_TEST_DIRS = %w[tests test].freeze
|
|
349
|
+
|
|
350
|
+
def pytest_files?(dir)
|
|
351
|
+
return false if PY_TEST_DIRS.include?(File.basename(dir))
|
|
352
|
+
|
|
353
|
+
files = Dir.glob(path(dir, '{test_*,*_test}.py')) +
|
|
354
|
+
Dir.glob(path(dir, "{#{PY_TEST_DIRS.join(',')}}", '**', '{test_*,*_test}.py'))
|
|
355
|
+
files.first(50).any? { |f| File.read(f).match?(/^\s*(?:async\s+)?def test_|^\s*import pytest|^\s*from pytest /) }
|
|
356
|
+
rescue SystemCallError
|
|
357
|
+
false
|
|
343
358
|
end
|
|
344
359
|
|
|
345
360
|
def inspect_python(dir, frameworks, runners, surfaces, databases)
|
|
@@ -356,7 +371,7 @@ module Fp
|
|
|
356
371
|
end
|
|
357
372
|
end
|
|
358
373
|
|
|
359
|
-
if has.call('pytest') || file?(dir, 'pytest.ini') || file?(dir, 'conftest.py')
|
|
374
|
+
if has.call('pytest') || file?(dir, 'pytest.ini') || file?(dir, 'conftest.py') || pytest_files?(dir)
|
|
360
375
|
runners << runner('pytest', dir,
|
|
361
376
|
command: 'pytest',
|
|
362
377
|
report_command: 'pytest -o junit_family=xunit1 --junitxml=junit.xml',
|
data/lib/fp/version.rb
CHANGED
data/skills/fp/SKILL.md
CHANGED
|
@@ -17,6 +17,7 @@ command -v fp && fp --version
|
|
|
17
17
|
```
|
|
18
18
|
|
|
19
19
|
If missing: `gem install featureparity` (or `bundle exec fp` inside an app that already depends on the gem).
|
|
20
|
+
This skill ships inside the gem; `fp skill install` refreshes an installed copy after an upgrade.
|
|
20
21
|
`fp doctor` checks the install, the config and the repo without an API key. If `fp` fails
|
|
21
22
|
inside a repo but works elsewhere, see Troubleshooting.
|
|
22
23
|
|
|
@@ -316,8 +317,8 @@ place you read it from.
|
|
|
316
317
|
Proposing several at once? Put them in a YAML file and run `fp propose --file reqs.yml
|
|
317
318
|
--dry-run` first. It lints every entry's wording and checks slugs and parents against the
|
|
318
319
|
catalog without writing anything. Then run it without `--dry-run`: the batch is created only if
|
|
319
|
-
every entry is valid. Bind tests with `fp mark <slug> <file>:<line>`
|
|
320
|
-
markers by hand.
|
|
320
|
+
every entry is valid. Bind tests with `fp mark <slug> <file>::<test name>` (or `<file>:<line>`)
|
|
321
|
+
rather than typing markers by hand; a name doesn't go stale when an earlier mark shifts the file.
|
|
321
322
|
|
|
322
323
|
**Confirm draft coverage with `fp coverage`.** The gate measures only active requirements,
|
|
323
324
|
so while everything you proposed is still a draft `fp check` says "Nothing to enforce yet"
|
|
@@ -549,8 +550,9 @@ The per-task loop assumes a catalog already describes the product. On a repo's f
|
|
|
549
550
|
there isn't one yet, so the job is to write it down, as drafts a human activates, rather
|
|
550
551
|
than to check work against it.
|
|
551
552
|
|
|
552
|
-
1. `fp doctor` confirms fp runs
|
|
553
|
-
|
|
553
|
+
1. `fp doctor` confirms fp runs in this repo and shows which API it writes to, then lists
|
|
554
|
+
the repo's test runners, database and devcontainer. fp is a Ruby gem whatever language
|
|
555
|
+
the repo is written in, so a repo that pins its own Ruby can hide it (see Troubleshooting).
|
|
554
556
|
2. `fp init --detect` suggests a project slug, surfaces, and the command that makes each
|
|
555
557
|
test runner write a report. If the project doesn't exist yet, create it with
|
|
556
558
|
`fp projects create <slug> --name "..." --surfaces <keys>`, then run
|
data/skills/fp/references/cli.md
CHANGED
|
@@ -408,21 +408,35 @@ one table. Run with `--dry-run` first to hand a human the batch for review.
|
|
|
408
408
|
|
|
409
409
|
```bash
|
|
410
410
|
fp mark academic_experience_required_fields spec/models/academic_experience_spec.rb:52
|
|
411
|
+
fp mark locker_rejects_oversize tests/test_parcel_locker.py::test_rejects_oversize_parcel
|
|
412
|
+
fp mark required_fields 'spec/models/user_spec.rb::requires an email' spec/models/user_spec.rb:40
|
|
411
413
|
fp mark checkout_flow e2e/checkout.spec.ts:10 --surface web --type e2e
|
|
412
414
|
```
|
|
413
415
|
|
|
414
|
-
Inserts `fp:<slug>` (with `@surfaces` and `:type` when given) directly above
|
|
415
|
-
|
|
416
|
+
Inserts `fp:<slug>` (with `@surfaces` and `:type` when given) directly above each test you
|
|
417
|
+
point at, using the file's own comment syntax (`#`, `//` or `--`) and indentation, then names the
|
|
416
418
|
test it binds to. Running it again on the same marker changes nothing. `--comment` sets the
|
|
417
419
|
prefix for an extension fp doesn't know, and `--dry-run` shows the line without writing it.
|
|
418
420
|
This is purely local and needs no API key. Never mark a failing test to make a requirement
|
|
419
421
|
look covered.
|
|
420
422
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
423
|
+
A target is `<file>:<line>` (the test's own line) or `<file>::<test name>`, the name as the
|
|
424
|
+
file declares it (`test_rejects_oversize_parcel`, `requires an email`). A pytest id copied from
|
|
425
|
+
the runner's output (`file.py::TestClass::test_x[case]`) works too. A name that isn't in the
|
|
426
|
+
file, or that two tests share, is refused with the file's test names, and nothing is written.
|
|
427
|
+
|
|
428
|
+
**Marking several tests in one file? Name them.** Each insert shifts every line below it down
|
|
429
|
+
by one, so a line number read before an earlier `fp mark` goes stale; a name doesn't. You can
|
|
430
|
+
also give several targets in one call (`fp mark <slug> f.py:8 f.py:18 f.py:25`): every line
|
|
431
|
+
number in a call means the file as it was before that call, and every target is checked before
|
|
432
|
+
anything is written. Across separate calls fp allows for the markers it added itself: while
|
|
433
|
+
nothing else has edited the file, a line number that no longer points at a test is read as it
|
|
434
|
+
was numbered before those markers went in, and fp says when it moved one. If a number could
|
|
435
|
+
then mean two tests, fp names both and writes nothing. `--json` answers one target with the usual object and several with
|
|
436
|
+
`{ "marks": [...] }`, each `line` being where the marker now sits. The `It binds to:` line is
|
|
437
|
+
the check: if it names a different test than you meant, or fp warns that no test declaration was
|
|
438
|
+
recognised, the marker landed on the wrong line (it is still written, and the exit code is 0,
|
|
439
|
+
so fix it by hand).
|
|
426
440
|
|
|
427
441
|
### fp propose-change
|
|
428
442
|
|
|
@@ -993,6 +1007,21 @@ fp --profile staging whoami # inspect a specific profile
|
|
|
993
1007
|
fp --api-url http://localhost:9292 whoami
|
|
994
1008
|
```
|
|
995
1009
|
|
|
1010
|
+
### fp skill
|
|
1011
|
+
|
|
1012
|
+
Install the agent skill bundled with the gem. Copies it into `.claude/skills/fp`
|
|
1013
|
+
(Claude Code) and `.agents/skills/fp` (Codex, Cursor, Gemini CLI and others) in the
|
|
1014
|
+
working directory. Makes no API calls. Re-run after upgrading the gem to refresh it;
|
|
1015
|
+
a directory named `fp` that isn't the fp skill is only replaced with `--force`.
|
|
1016
|
+
|
|
1017
|
+
```bash
|
|
1018
|
+
fp skill install # both directories, this repo
|
|
1019
|
+
fp skill install --agent claude # just .claude/skills
|
|
1020
|
+
fp skill install --global # ~/.claude/skills and ~/.agents/skills
|
|
1021
|
+
fp skill install --path ~/my-agent/skills # any skills directory (writes <path>/fp)
|
|
1022
|
+
fp skill path # where the bundled skill lives
|
|
1023
|
+
```
|
|
1024
|
+
|
|
996
1025
|
### fp repos
|
|
997
1026
|
|
|
998
1027
|
Map surfaces to local repo paths (stored locally, not in the web app).
|
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.33
|
|
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-14 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: net-http
|
|
@@ -127,6 +127,7 @@ files:
|
|
|
127
127
|
- lib/fp/commands/show.rb
|
|
128
128
|
- lib/fp/commands/showroom.rb
|
|
129
129
|
- lib/fp/commands/showroom_media.rb
|
|
130
|
+
- lib/fp/commands/skill.rb
|
|
130
131
|
- lib/fp/commands/spot_check.rb
|
|
131
132
|
- lib/fp/commands/surfaces.rb
|
|
132
133
|
- lib/fp/commands/tutorial.rb
|
|
@@ -157,8 +158,7 @@ licenses:
|
|
|
157
158
|
metadata:
|
|
158
159
|
rubygems_mfa_required: 'true'
|
|
159
160
|
homepage_uri: https://featureparity.dev
|
|
160
|
-
|
|
161
|
-
changelog_uri: https://github.com/stowzilla/feature_parity/blob/master/cli/CHANGELOG.md
|
|
161
|
+
documentation_uri: https://featureparity.dev/docs
|
|
162
162
|
post_install_message:
|
|
163
163
|
rdoc_options: []
|
|
164
164
|
require_paths:
|