portage-cli 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9f134c077a1b0ca29666bd9e489428b1931b53d8c8a509f21527a2cfcd7d5e55
4
- data.tar.gz: 1cca70da2c1d6b48201601f6812b674d1aaffa40fd0fd01ec6da132fb6a6751c
3
+ metadata.gz: 7b58aee770288e6234255f5351c43c4cdeb712c4e1b397c29c13e09315af92f6
4
+ data.tar.gz: 6e10beb419ccea062ba6a4d69ddb03819c12f1332497c4cb2857fda8e66d6bc7
5
5
  SHA512:
6
- metadata.gz: 914d2bc50dd358408b735a28bd156d092334969bf5794b3a36056594a17da0152b3eebfa7e8a32d690197ded3231def669009486a5767706aa9d742becc76949
7
- data.tar.gz: ceecc1e021f84988940a963b838691cff70fd05cf5e933423f8a873c04013b22deb5d3bb9b3d13801598a36763c7c661f83f7200bf01dbc8d307b01cf0a7886a
6
+ metadata.gz: 119a123b36d3002a42df72077a29d5307f61745c45f94ef0c2ee6dba81859a037a6ba9d25d34b591f659b339643c60c662c4826f564875e708e25c5f0bb16263
7
+ data.tar.gz: 0214b301b73c31f65fa0331ce6465e175dca3b533325f7e6a92e52458696b8c05ab9897e818f5cc1ef6e503dee8ab7f43fa5e2f3a534ae24a3766687f95c27b9
data/CHANGELOG.md CHANGED
@@ -6,6 +6,15 @@ pre-1.0, so APIs may still shift between minor versions.
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.16.0] - 2026-11-18
10
+
11
+ - **Added: stores that serve only UCP REST work in `buy` and `find`.** Discovery now picks MCP or REST (UCP 2026-08-25's core transport) from the manifest, so a REST-only store such as the one in issue #178 no longer fails with "manifest has no mcp service entry". Requires `portage-ucp-client` `~> 0.8`.
12
+ - **Fix: a store's refusal keeps its HTTP status and text.** `buy` reports a REST refusal as `HTTP 403: Invalid API key` rather than dropping the status, and a refused completion now includes the store's text next to the permission-denied message.
13
+ - **Fix: `buy` sends the agent profile on `complete_checkout`.** The call was made without `meta`, so the client raised `MissingAgentProfileError` at the last step instead of completing the purchase.
14
+
15
+ ## [0.15.0] - 2026-10-22
16
+
17
+ - **Changed: requires `mcp` `~> 1.8`** (was `~> 0.24`), which serves MCP 2026-07-28 through `server/discover` and keeps `initialize` for 2025-11-25 and earlier, so `portage mcp` speaks the new spec. Minor bump because the `mcp` requirement moved from 0.x to 1.x; no CLI or tool change and no changes under `lib/`. Requires `portage-ucp` `~> 0.17` and `portage-ucp-client` `~> 0.7`, the first releases that also take `mcp` 1.x.
9
18
  ## [0.14.0] - 2026-10-21
10
19
 
11
20
  - **Added: index and browser import tools in `portage mcp`.** Two more tools, 14 in all: `add_store` (`index add URL`, with `crawl` for `--crawl`) and `import_browser_history` (`browser import`). The import is a `--dry-run` preview unless `confirm` is exactly `true`, which passes `--yes` to save it; it is the only argv besides `buy_quote` with `--yes`, and it only writes the local index. It always passes `--max-probes`, at most 15, because probes run one at a time with a 5-second timeout each, and the CLI's default of 200 could run for about 17 minutes, well past the server's 120-second limit. `browser` must be one of the CLI's six browsers, and `exclude` must be host names. Phase 4 of docs/plans/buyer-mcp-server.md.
@@ -318,10 +318,17 @@ module Portage
318
318
  url = error.continue_url
319
319
  build_report(
320
320
  source: "native_ucp", outcome: "store_refused", browse: true, checkout: false, checkout_url: url,
321
- message: "#{@uri} couldn't complete this: #{error.summary}#{url && " — finish it at #{url}"}"
321
+ message: "#{@uri} couldn't complete this: #{server_error_text(error)}#{url && " — finish it at #{url}"}"
322
322
  )
323
323
  end
324
324
 
325
+ # A REST refusal's message is already the store's own text led by its
326
+ # HTTP status ("HTTP 403: Invalid API key"); #summary would drop the
327
+ # status. An MCP refusal's message is the whole envelope, so #summary.
328
+ def server_error_text(error)
329
+ error.message.start_with?("HTTP ") ? error.message : error.summary
330
+ end
331
+
325
332
  def catalog_only(session)
326
333
  products = safe_search(session)
327
334
  report = build_report(
@@ -1173,7 +1180,7 @@ module Portage
1173
1180
  return held if held
1174
1181
 
1175
1182
  completed = recording_transaction(source, checkout) do
1176
- session.complete_checkout(checkout_id: checkout["id"], payment_token: @payment_token)
1183
+ session.complete_checkout(checkout_id: checkout["id"], payment_token: @payment_token, meta: agent_meta)
1177
1184
  end
1178
1185
  # `complete_checkout` can hand back `requires_escalation` too (e.g.
1179
1186
  # Shopify's cartSubmitForCompletion result carrying `errors`) — this
@@ -1184,8 +1191,8 @@ module Portage
1184
1191
 
1185
1192
  checkout_report(source, products, completed, outcome: "purchased", message: "Purchased.",
1186
1193
  warnings: warnings + Array(@unrecorded_warning))
1187
- rescue Portage::Ucp::Client::PaymentPermissionError
1188
- permission_denied_report(source, products, checkout, warnings)
1194
+ rescue Portage::Ucp::Client::PaymentPermissionError => e
1195
+ permission_denied_report(source, products, checkout, warnings, e)
1189
1196
  end
1190
1197
 
1191
1198
  # PolicyGuard's rolling cap and velocity limit count the completed
@@ -1349,11 +1356,18 @@ module Portage
1349
1356
  # shopper finishes on the merchant's own continue_url/checkout link,
1350
1357
  # same hand-off requires_escalation already uses (see
1351
1358
  # Client::PaymentPermissionError).
1352
- def permission_denied_report(source, products, checkout, warnings)
1359
+ def permission_denied_report(source, products, checkout, warnings, error)
1353
1360
  handoff_report(source, products, checkout, warnings,
1354
1361
  outcome: "permission_denied",
1355
- message: "This agent isn't yet granted permission to complete checkout on this store — " \
1356
- "visit the link to finish it yourself.")
1362
+ message: "This agent isn't yet granted permission to complete checkout on this store " \
1363
+ "(#{permission_text(error)}) — visit the link to finish it yourself.")
1364
+ end
1365
+
1366
+ # Over MCP the refusal wraps the store's ServerError as its cause, whose
1367
+ # message is the whole envelope, so trim it the same way. REST raises
1368
+ # it with the status and store text already in the message.
1369
+ def permission_text(error)
1370
+ error.cause.is_a?(Portage::Ucp::Client::ServerError) ? server_error_text(error.cause) : error.message
1357
1371
  end
1358
1372
 
1359
1373
  def escalation_report(source, products, checkout, warnings)
@@ -1,5 +1,5 @@
1
1
  module Portage
2
2
  module Cli
3
- VERSION = "0.14.0".freeze
3
+ VERSION = "0.16.0".freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: portage-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Whitbread
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2026-10-21 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: base64
@@ -44,48 +43,42 @@ dependencies:
44
43
  requirements:
45
44
  - - "~>"
46
45
  - !ruby/object:Gem::Version
47
- version: '0.24'
46
+ version: '1.8'
48
47
  type: :runtime
49
48
  prerelease: false
50
49
  version_requirements: !ruby/object:Gem::Requirement
51
50
  requirements:
52
51
  - - "~>"
53
52
  - !ruby/object:Gem::Version
54
- version: '0.24'
53
+ version: '1.8'
55
54
  - !ruby/object:Gem::Dependency
56
55
  name: portage-ucp
57
56
  requirement: !ruby/object:Gem::Requirement
58
57
  requirements:
59
58
  - - "~>"
60
59
  - !ruby/object:Gem::Version
61
- version: '0.16'
60
+ version: '0.17'
62
61
  type: :runtime
63
62
  prerelease: false
64
63
  version_requirements: !ruby/object:Gem::Requirement
65
64
  requirements:
66
65
  - - "~>"
67
66
  - !ruby/object:Gem::Version
68
- version: '0.16'
67
+ version: '0.17'
69
68
  - !ruby/object:Gem::Dependency
70
69
  name: portage-ucp-client
71
70
  requirement: !ruby/object:Gem::Requirement
72
71
  requirements:
73
72
  - - "~>"
74
73
  - !ruby/object:Gem::Version
75
- version: '0.6'
76
- - - ">="
77
- - !ruby/object:Gem::Version
78
- version: 0.6.3
74
+ version: '0.8'
79
75
  type: :runtime
80
76
  prerelease: false
81
77
  version_requirements: !ruby/object:Gem::Requirement
82
78
  requirements:
83
79
  - - "~>"
84
80
  - !ruby/object:Gem::Version
85
- version: '0.6'
86
- - - ">="
87
- - !ruby/object:Gem::Version
88
- version: 0.6.3
81
+ version: '0.8'
89
82
  - !ruby/object:Gem::Dependency
90
83
  name: portage-ucp-journal
91
84
  requirement: !ruby/object:Gem::Requirement
@@ -198,7 +191,6 @@ description: 'Ships the `portage` executable. `portage buy <url>` tries native U
198
191
  is a hard dependency. Ranking, escalation and the spend-policy check use portage-ucp
199
192
  core''s rules; portage-ucp-decision is optional and only the opt-in confidence gate
200
193
  needs it.'
201
- email:
202
194
  executables:
203
195
  - portage
204
196
  - portage-console
@@ -347,7 +339,6 @@ metadata:
347
339
  source_code_uri: https://github.com/tomtom87/Portage/tree/main/portage-cli
348
340
  changelog_uri: https://github.com/tomtom87/Portage/blob/main/portage-cli/CHANGELOG.md
349
341
  rubygems_mfa_required: 'true'
350
- post_install_message:
351
342
  rdoc_options: []
352
343
  require_paths:
353
344
  - lib
@@ -362,8 +353,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
362
353
  - !ruby/object:Gem::Version
363
354
  version: '0'
364
355
  requirements: []
365
- rubygems_version: 3.5.22
366
- signing_key:
356
+ rubygems_version: 4.0.20
367
357
  specification_version: 4
368
358
  summary: portage — one CLI command to buy from any store, native UCP or not
369
359
  test_files: []