featureparity 0.0.32 → 0.0.34

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.
@@ -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
@@ -0,0 +1,91 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'open3'
4
+
5
+ module Fp
6
+ module Commands
7
+ # fp update [--check]
8
+ #
9
+ # Installs the newest published fp (Fizzy #1993). There was no way to update from
10
+ # inside fp and nothing said one was due; `gem update featureparity` was mentioned
11
+ # once, in the changed-test upgrade notes.
12
+ #
13
+ # The latest version comes from the API's public `GET /cli/version`, so this needs no
14
+ # key. The install runs RubyGems under the Ruby that is running fp, which is the one
15
+ # whose `fp` the person just typed: in a repo that pins a Ruby, that is the pinned one.
16
+ class Update < Base
17
+ help_summary 'Install the newest fp, or check whether one is available'
18
+ help_usage 'fp update [--check]'
19
+ help_flag :check, 'Only say whether a newer fp exists; install nothing'
20
+ help_example 'fp update', 'Install the newest fp under the Ruby running this one'
21
+ help_example 'fp update --check', 'Is a newer fp published?'
22
+ help_note "Needs no API key. Same as `gem update featureparity`, or re-running the installer.\n" \
23
+ 'After an update, run `fp skill install` and `fp init --force` in each repo that uses fp, ' \
24
+ "to refresh the agent skill and the AGENTS.md section.\n" \
25
+ 'fp also says when a newer version exists, at most once a day; FP_NO_UPDATE_CHECK=1 turns that off.'
26
+
27
+ KNOWN_FLAGS = { check: :boolean }.freeze
28
+
29
+ AFTER_UPDATE = [
30
+ ['fp skill install', "refresh the agent skill in a repo that has it"],
31
+ ['fp init --force', "refresh the FeatureParity section of a repo's AGENTS.md"]
32
+ ].freeze
33
+
34
+ class << self
35
+ # Runs the install and returns [combined output, success?]. Swapped in tests.
36
+ attr_writer :installer
37
+
38
+ def installer
39
+ @installer ||= lambda do
40
+ out, status = Open3.capture2e(
41
+ Gem.ruby, '-e', 'require "rubygems/gem_runner"; Gem::GemRunner.new.run(ARGV)',
42
+ 'install', 'featureparity'
43
+ )
44
+ [out, status.success?]
45
+ end
46
+ end
47
+ end
48
+
49
+ def run(args)
50
+ opts, = parse_flags(args, KNOWN_FLAGS)
51
+ status = UpdateCheck.status(config.api_url)
52
+ latest = status[:latest_version]
53
+
54
+ unless latest
55
+ output.error("Could not read the latest fp version from #{config.api_url}. " \
56
+ "To update anyway, run `#{UpdateCheck::GEM_COMMAND}`.")
57
+ exit 1
58
+ end
59
+
60
+ unless status[:update_available]
61
+ return output.success(status.merge(updated: false)) { puts "fp #{Fp::VERSION} is the latest version." }
62
+ end
63
+
64
+ if opts[:check]
65
+ return output.success(status.merge(updated: false)) { puts UpdateCheck.message(latest) }
66
+ end
67
+
68
+ install(status)
69
+ end
70
+
71
+ private
72
+
73
+ def install(status)
74
+ puts "Installing fp #{status[:latest_version]} (you have #{Fp::VERSION})..." unless output.json?
75
+ log, ok = self.class.installer.call
76
+
77
+ unless ok
78
+ output.error("The update failed. Run `#{UpdateCheck::GEM_COMMAND}` to see why.\n#{log.to_s.lines.last(5).join}".strip)
79
+ exit 1
80
+ end
81
+
82
+ output.success(status.merge(updated: true, next_steps: AFTER_UPDATE.map(&:first))) do
83
+ puts "✓ fp is updated. `fp version` shows what's installed."
84
+ puts
85
+ puts 'Next, in each repo that uses fp:'
86
+ AFTER_UPDATE.each { |command, why| puts " #{command.ljust(18)} # #{why}" }
87
+ end
88
+ end
89
+ end
90
+ end
91
+ end
@@ -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). Purely local; makes no API calls, so it
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 'Purely local; makes no API calls, so it works even without a valid key.'
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,7 +33,9 @@ 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'
38
+ require_relative 'commands/update'
37
39
  require_relative 'commands/help'
38
40
  require_relative 'commands/attach'
39
41
  require_relative 'commands/attachments'
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
@@ -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',
@@ -0,0 +1,103 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'net/http'
4
+ require 'uri'
5
+ require 'json'
6
+ require 'time'
7
+ require 'fileutils'
8
+
9
+ module Fp
10
+ # Says when a newer fp has been published (Fizzy #1993). Nothing told a person or an
11
+ # agent that the gem they had was behind: `GET /api/cli/version` had the answer and
12
+ # nothing read it.
13
+ #
14
+ # The lookup is one unauthenticated GET with a short timeout, and every failure is
15
+ # silent: being offline or behind must never break or slow the command someone ran.
16
+ # FP_NO_UPDATE_CHECK=1 turns all of it off.
17
+ module UpdateCheck
18
+ INTERVAL = 24 * 60 * 60
19
+ TIMEOUT = 2
20
+ CACHE_NAME = 'update_check.json'
21
+ UPDATE_COMMAND = 'fp update'
22
+ GEM_COMMAND = 'gem update featureparity'
23
+
24
+ # Commands that say it themselves, or that are about the version already.
25
+ QUIET_COMMANDS = %w[update doctor version help].freeze
26
+
27
+ module_function
28
+
29
+ def disabled?
30
+ !['', '0', 'false'].include?(ENV.fetch('FP_NO_UPDATE_CHECK', '').strip.downcase)
31
+ end
32
+
33
+ # The version the API says is published, or nil when it can't be read.
34
+ def latest_version(api_url)
35
+ uri = URI.parse("#{api_url.to_s.chomp('/')}/api/cli/version")
36
+ http = Net::HTTP.new(uri.host, uri.port)
37
+ http.use_ssl = uri.scheme == 'https'
38
+ http.open_timeout = TIMEOUT
39
+ http.read_timeout = TIMEOUT
40
+ response = http.request(Net::HTTP::Get.new(uri))
41
+ return nil unless response.code.to_i == 200
42
+
43
+ version = JSON.parse(response.body).dig('cli', 'version').to_s
44
+ Gem::Version.correct?(version) ? version : nil
45
+ rescue StandardError
46
+ nil
47
+ end
48
+
49
+ def newer?(latest, current = Fp::VERSION)
50
+ Gem::Version.new(latest) > Gem::Version.new(current)
51
+ rescue ArgumentError, TypeError
52
+ false
53
+ end
54
+
55
+ # A live answer, for `fp doctor` and `fp update`.
56
+ def status(api_url)
57
+ latest = latest_version(api_url)
58
+ {
59
+ current_version: Fp::VERSION,
60
+ latest_version: latest,
61
+ update_available: latest ? newer?(latest) : false,
62
+ update_command: UPDATE_COMMAND
63
+ }
64
+ end
65
+
66
+ def message(latest)
67
+ "fp #{latest} is available (you have #{Fp::VERSION}). Run `#{UPDATE_COMMAND}` to install it."
68
+ end
69
+
70
+ # The line to show after a command, at most once a day: nil when the last look was
71
+ # under a day ago, when CI is running fp, or when there is nothing newer. A failed
72
+ # look still counts as today's, so an offline machine waits out the timeout once.
73
+ def daily_notice(api_url, command: nil, now: Time.now)
74
+ return nil if disabled? || QUIET_COMMANDS.include?(command.to_s)
75
+ return nil unless ENV['CI'].to_s.empty?
76
+ return nil if checked_recently?(now)
77
+
78
+ latest = latest_version(api_url)
79
+ remember(now, latest)
80
+ latest && newer?(latest) ? message(latest) : nil
81
+ rescue StandardError
82
+ nil
83
+ end
84
+
85
+ def cache_file
86
+ File.join(Fp::Config::CONFIG_DIR, CACHE_NAME)
87
+ end
88
+
89
+ def checked_recently?(now)
90
+ checked_at = Time.parse(JSON.parse(File.read(cache_file))['checked_at'].to_s)
91
+ now - checked_at < INTERVAL
92
+ rescue StandardError
93
+ false
94
+ end
95
+
96
+ def remember(now, latest)
97
+ FileUtils.mkdir_p(File.dirname(cache_file))
98
+ File.write(cache_file, JSON.generate('checked_at' => now.utc.iso8601, 'latest' => latest))
99
+ rescue SystemCallError
100
+ nil
101
+ end
102
+ end
103
+ end
data/lib/fp/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fp
4
- VERSION = '0.0.32'
4
+ VERSION = '0.0.34'
5
5
  end
data/lib/fp.rb CHANGED
@@ -9,6 +9,7 @@ require_relative 'fp/source_fingerprint'
9
9
  require_relative 'fp/junit'
10
10
  require_relative 'fp/repo_detector'
11
11
  require_relative 'fp/output'
12
+ require_relative 'fp/update_check'
12
13
  require_relative 'fp/commands'
13
14
  require_relative 'fp/cli'
14
15
 
data/skills/fp/SKILL.md CHANGED
@@ -17,6 +17,9 @@ 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
+ To update fp, run `fp update` (or `gem update featureparity`); fp says on stderr, at most once
21
+ a day, when a newer version is published, and `fp doctor` shows it.
22
+ This skill ships inside the gem; `fp skill install` refreshes an installed copy after an upgrade.
20
23
  `fp doctor` checks the install, the config and the repo without an API key. If `fp` fails
21
24
  inside a repo but works elsewhere, see Troubleshooting.
22
25
 
@@ -316,8 +319,8 @@ place you read it from.
316
319
  Proposing several at once? Put them in a YAML file and run `fp propose --file reqs.yml
317
320
  --dry-run` first. It lints every entry's wording and checks slugs and parents against the
318
321
  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>` rather than typing
320
- markers by hand.
322
+ every entry is valid. Bind tests with `fp mark <slug> <file>::<test name>` (or `<file>:<line>`)
323
+ rather than typing markers by hand; a name doesn't go stale when an earlier mark shifts the file.
321
324
 
322
325
  **Confirm draft coverage with `fp coverage`.** The gate measures only active requirements,
323
326
  so while everything you proposed is still a draft `fp check` says "Nothing to enforce yet"
@@ -549,8 +552,9 @@ The per-task loop assumes a catalog already describes the product. On a repo's f
549
552
  there isn't one yet, so the job is to write it down, as drafts a human activates, rather
550
553
  than to check work against it.
551
554
 
552
- 1. `fp doctor` confirms fp runs under the repo's Ruby and shows which API it writes to,
553
- then lists the repo's test runners, database and devcontainer.
555
+ 1. `fp doctor` confirms fp runs in this repo and shows which API it writes to, then lists
556
+ the repo's test runners, database and devcontainer. fp is a Ruby gem whatever language
557
+ the repo is written in, so a repo that pins its own Ruby can hide it (see Troubleshooting).
554
558
  2. `fp init --detect` suggests a project slug, surfaces, and the command that makes each
555
559
  test runner write a report. If the project doesn't exist yet, create it with
556
560
  `fp projects create <slug> --name "..." --surfaces <keys>`, then run
@@ -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 the test on that
415
- line, using the file's own comment syntax (`#`, `//` or `--`) and indentation, then names the
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
- Each insert shifts every line below it down by one. When you mark several tests in one file
422
- from a single read of it, mark from the bottom of the file upward, or re-read the line numbers
423
- between marks. The `It binds to:` line is the check: if it names a different test than you
424
- meant, or fp warns that no test declaration was recognised, the marker landed on the wrong
425
- line (it is still written, and the exit code is 0, so fix it by hand).
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
 
@@ -923,7 +937,8 @@ secret exists is fine: the gate skips with an explanation and stays green.
923
937
 
924
938
  ### fp doctor
925
939
 
926
- Check that fp works here, with no API key and no API calls.
940
+ Check that fp works here, with no API key. It reads everything locally except the newest
941
+ published fp version, one lookup that is skipped when the API can't be reached.
927
942
 
928
943
  ```bash
929
944
  fp doctor
@@ -937,6 +952,8 @@ fp doctor --json
937
952
  the fix: install the gem under the pinned Ruby (`mise exec ruby@<pinned> -- gem install
938
953
  featureparity`, or `gem install featureparity` in the repo), or put the running Ruby's bin
939
954
  directory first on `PATH`.
955
+ - **Latest fp:** the newest published version. When it's newer than the one running, doctor
956
+ names `fp update` (and `gem update featureparity`) to install it.
940
957
  - **Config:** the API environment (warning when it isn't production), whether a key is
941
958
  present, which `.featureparity.yml` applies, and which fp wrote the `AGENTS.md` section.
942
959
  - **Repo:** the same summary as `fp init --detect`.
@@ -993,6 +1010,33 @@ fp --profile staging whoami # inspect a specific profile
993
1010
  fp --api-url http://localhost:9292 whoami
994
1011
  ```
995
1012
 
1013
+ ### fp skill
1014
+
1015
+ Install the agent skill bundled with the gem. Copies it into `.claude/skills/fp`
1016
+ (Claude Code) and `.agents/skills/fp` (Codex, Cursor, Gemini CLI and others) in the
1017
+ working directory. Makes no API calls. Re-run after upgrading the gem to refresh it;
1018
+ a directory named `fp` that isn't the fp skill is only replaced with `--force`.
1019
+
1020
+ ```bash
1021
+ fp skill install # both directories, this repo
1022
+ fp skill install --agent claude # just .claude/skills
1023
+ fp skill install --global # ~/.claude/skills and ~/.agents/skills
1024
+ fp skill install --path ~/my-agent/skills # any skills directory (writes <path>/fp)
1025
+ fp skill path # where the bundled skill lives
1026
+ ```
1027
+
1028
+ ### fp update
1029
+
1030
+ Install the newest fp, or check whether one is published. Needs no API key.
1031
+
1032
+ ```bash
1033
+ fp update # install the newest fp under the Ruby running this one
1034
+ fp update --check # only say whether a newer one exists
1035
+ fp update --json
1036
+ ```
1037
+
1038
+ See [Updating fp](#updating-fp) for what to do afterwards.
1039
+
996
1040
  ### fp repos
997
1041
 
998
1042
  Map surfaces to local repo paths (stored locally, not in the web app).
@@ -1004,6 +1048,30 @@ fp repos get customer_android --project acme
1004
1048
  fp repos unset customer_android --project acme
1005
1049
  ```
1006
1050
 
1051
+ ## Updating fp
1052
+
1053
+ fp is a Ruby gem, so any of these installs the newest version:
1054
+
1055
+ ```bash
1056
+ fp update # from fp 0.0.34
1057
+ gem update featureparity
1058
+ curl -fsSL https://api.featureparity.dev/api/cli/install | bash # the installer again
1059
+ ```
1060
+
1061
+ Then, in each repo that uses fp:
1062
+
1063
+ ```bash
1064
+ fp skill install # refresh the agent skill, if the repo has it installed
1065
+ fp init --force # refresh the FeatureParity section of AGENTS.md
1066
+ ```
1067
+
1068
+ `fp version` shows what's installed and `fp update --check` whether a newer one exists.
1069
+ `fp doctor` shows the newest published version and, when the one running is behind, the
1070
+ command that installs it. At most once a day, an fp command that finds a newer version
1071
+ says so on stderr after its own output. It stays quiet with `--json`, when `CI` is set,
1072
+ and when `FP_NO_UPDATE_CHECK=1`. A repo that pins a Ruby has its own copy of the gem: run
1073
+ the update inside that repo so the pinned Ruby's copy is the one that changes.
1074
+
1007
1075
  ## Exit codes
1008
1076
 
1009
1077
  | Code | Meaning |