Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ All notable changes to this plugin are documented here. The format follows

## [Unreleased]

### Fixed

- Gemini CLI loads the five skills when it installs from a GitHub Release. It copies the download and rewrote the
root `skills` symlink to the temporary folder it then deletes, so 0.2.1 installed with no skill ("No skills
discovered"). The root `skills/` is now a copy of `plugins/freightright/skills`; `npm run sync-skills` refreshes
it and the validator fails if the two differ by a byte.

## [0.2.1] — 2026-11-10

### Added
Expand Down
5 changes: 3 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
.claude-plugin/marketplace.json the marketplace Claude Code reads
gemini-extension.json the Gemini CLI extension gallery manifest (repository root)
GEMINI.md connector facts Gemini CLI loads with the extension
skills -> plugins/freightright/skills
Gemini CLI reads skills/<name>/SKILL.md from the extension root
skills/ a copy of plugins/freightright/skills: Gemini CLI reads skills/<name>/SKILL.md
from the extension root and breaks a symlink there when it installs a release.
Edit the plugin's skills, then `npm run sync-skills`; the validator fails on drift
contract/tools.json a snapshot of the connector's real tool surface, with the fr-mcp revision
plugins/freightright/
plugin.json portable manifest
Expand Down
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ Once the repository carries the `gemini-cli-extension` GitHub topic, the same ex
| Codex CLI 0.155.1 | Verified | Verified |
| Copilot CLI 1.0.87 | Verified | Verified |
| Cursor 2.2.44 | Verified | Verified |
| Gemini CLI | Pending the next GitHub Release | The five skills, via a `skills` symlink |
| Gemini CLI 0.44.1 | Verified, from the latest GitHub Release | Verified |
| Grok 1.0.40 | Verified | Verified |
| Muse Code 1.3.0 | Verified, behind `MUSE_EXPERIMENTAL_PLUGINS` | Verified |

Expand All @@ -183,8 +183,9 @@ vendor's directory. Grok and Muse Code are the exceptions that prove the point:
[Agent Plugins](https://agent-plugins.org) manifest — Muse Code reads the Codex or Claude Code catalog as well — so
neither needs anything of its own. Muse Code installs the skills only: its plugin format cannot carry an authenticated
MCP server yet, which is why its install ends in a settings entry and a sign-in. Gemini CLI reads the root
`gemini-extension.json` and `GEMINI.md`. Its `skills` directory is a symlink to `plugins/freightright/skills`, so
it loads the same five skills.
`gemini-extension.json` and `GEMINI.md`. Its `skills` directory is a copy of `plugins/freightright/skills` that the
validator keeps byte-identical, so it loads the same five skills; a symlink does not survive Gemini CLI's install
from a release.

The production connector the plugin ships, `https://mcp.freightright.com/mcp`, is live: Freight Right's scripted
canary — a registered MCP client that signs in through the same OAuth flow these clients use — completes the sign-in
Expand Down
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"selftest": "node scripts/selftest.mjs",
"test": "npm run validate && npm run selftest",
"set-version": "node scripts/set-version.mjs",
"compare-skills": "node scripts/compare-skills.mjs"
"compare-skills": "node scripts/compare-skills.mjs",
"sync-skills": "node scripts/sync-skills.mjs"
}
}
8 changes: 5 additions & 3 deletions scripts/selftest.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,12 @@ const VALIDATOR_CASES = [
json(d, 'gemini-extension.json', (v) => {
v.mcpServers.freightright.httpUrl = 'https://dev-mcp.sm.freightright.com/mcp';
})],
['a Gemini CLI skills link that is not the plugin skills', (d) => {
rmSync(join(d, 'skills'));
symlinkSync('plugins/freightright/evals', join(d, 'skills'));
['a Gemini CLI skills symlink, which its release install breaks', (d) => {
rmSync(join(d, 'skills'), { recursive: true });
symlinkSync('plugins/freightright/skills', join(d, 'skills'));
}],
['a Gemini CLI skills copy drifting from the plugin skills', (d) =>
edit(d, 'skills/instant-pricing/SKILL.md', (s) => `${s}\nAn edit made only in the Gemini copy.\n`)],
['a client manifest drifting from the others', (d) =>
json(d, '.cursor-plugin/marketplace.json', (v) => { v.metadata.version = '9.9.9'; })],
['a tool with no mock, which would make a must-not-call check vacuous', (d) =>
Expand Down
18 changes: 18 additions & 0 deletions scripts/sync-skills.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env node
// Gemini CLI reads skills/<name>/SKILL.md from the extension root. A symlink there does not survive its install from a
// GitHub Release (it is rewritten to the temporary download folder and broken), so the root `skills/` is a real copy
// of the plugin's skills. Edit the plugin's skills, then run this; `npm run validate` fails while the two differ.
//
// npm run sync-skills

import { cpSync, rmSync } from 'node:fs';
import { dirname, join } from 'node:path';
import { fileURLToPath } from 'node:url';

const ROOT = join(dirname(fileURLToPath(import.meta.url)), '..');
const source = join(ROOT, 'plugins/freightright/skills');
const target = join(ROOT, 'skills');

rmSync(target, { recursive: true, force: true });
cpSync(source, target, { recursive: true });
console.log('skills/ now matches plugins/freightright/skills');
31 changes: 23 additions & 8 deletions scripts/validate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// names really exists on the connector, that no skill has drifted outside the portable Agent Skills fields, and that
// nothing here points at a development environment.

import { readFileSync, readdirSync, existsSync, lstatSync, readlinkSync, statSync } from 'node:fs';
import { readFileSync, readdirSync, existsSync, lstatSync, statSync } from 'node:fs';
import { join, relative, dirname } from 'node:path';
import { fileURLToPath } from 'node:url';

Expand Down Expand Up @@ -231,13 +231,28 @@ if (gemini && portable) {
fail('gemini-extension.json', 'contextFileName must be GEMINI.md');
}
if (!existsSync(join(ROOT, 'GEMINI.md'))) fail('GEMINI.md', 'is missing');
// Gemini CLI loads skills/<name>/SKILL.md from the extension root. A symlink keeps one copy with the
// other clients. A real directory here would drift.
const skillsLink = join(ROOT, 'skills');
if (!existsSync(skillsLink) || !lstatSync(skillsLink).isSymbolicLink()) {
fail('skills', 'must be a symlink to plugins/freightright/skills');
} else if (readlinkSync(skillsLink) !== 'plugins/freightright/skills') {
fail('skills', 'must point at plugins/freightright/skills');
// Gemini CLI loads skills/<name>/SKILL.md from the extension root. It installs from a GitHub Release by copying
// the download, and rewrites a symlink to the temporary folder it then deletes, so a symlink here loads no skill.
// The root skills/ is therefore a real copy of the plugin's skills, byte for byte (`npm run sync-skills`).
const geminiSkills = join(ROOT, 'skills');
const pluginSkills = join(ROOT, 'plugins/freightright/skills');
const filesUnder = (dir, prefix = '') =>
readdirSync(join(dir, prefix), { withFileTypes: true }).flatMap((e) =>
e.isDirectory() ? filesUnder(dir, join(prefix, e.name)) : [join(prefix, e.name)],
).sort();
if (!existsSync(geminiSkills) || lstatSync(geminiSkills).isSymbolicLink() || !statSync(geminiSkills).isDirectory()) {
fail('skills', 'must be a real directory copying plugins/freightright/skills (run npm run sync-skills)');
} else {
const want = filesUnder(pluginSkills);
const have = filesUnder(geminiSkills);
const missing = want.filter((f) => !have.includes(f));
const extra = have.filter((f) => !want.includes(f));
const changed = want.filter(
(f) => have.includes(f) && !readFileSync(join(geminiSkills, f)).equals(readFileSync(join(pluginSkills, f))),
);
for (const [what, list] of [['missing', missing], ['not in the plugin', extra], ['differs from the plugin', changed]]) {
if (list.length) fail('skills', `${list.join(', ')} ${what} (run npm run sync-skills)`);
}
}
const server = gemini.mcpServers?.[SERVER_KEY];
if (!server) fail('gemini-extension.json', `expected a server named "${SERVER_KEY}"`);
Expand Down
1 change: 0 additions & 1 deletion skills

This file was deleted.

76 changes: 76 additions & 0 deletions skills/booking-handoff/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
---
name: booking-handoff
description: Freight Right booking preparation — turn a chosen offer into a confirmation link that the customer opens and submits themselves, then read what they decided. Use after an instant price check or a QUOTED quote request when the customer wants to book an offer, and to check the state of a booking already prepared. No tool here books anything.
---

# Freight Right: preparing a booking

**Nothing here books anything.** These tools write a pending record and return a link. Only the customer, signed in
to Freight Right in their own browser, can submit it on that page. Give them the link and say plainly what it will
book.

Say "I have prepared a booking for you to confirm", never "I booked it".

## Which prepare tool

| Came from | Tool | Needs |
|---|---|---|
| An instant price check | `freightright_prepare_instant_booking` | `pricing_id` (`pj_…`) + `offer_id` (`of_…`) |
| A quote request | `freightright_prepare_rate_request_booking` | `rate_request_id` (`rfq_…`) + `offer_id` (`of_…`) |

The instant path needs an offer that is still bookable: **a price check without `bookable_until`, or whose
`bookable_until` has passed, is refused and nothing is prepared.** Without one, Freight Right did not keep the offers
for booking — they can be shown but not booked online, so do not offer a link: price the lane again later or, only
if the customer asks for it, send a quote request. Once it has passed, price again and book from the new price check.

The quote-request path is refused unless the request's status is **`QUOTED`**. Check it first and tell the customer
what the status actually is. It is also refused when the request's `may_book` is `false` — this connection can read
it but not book it, because booking takes the account that created the request, a current member of the
organization it is billed to, or an address Freight Right shared its quote with (an administrator books only the
requests their own account created). Say who can
book it instead of preparing a link that would fail.

Both take an optional `reference` (up to 64 characters — the customer's own PO or job number) and `note` (up to
2,000). Offer these; a reference is what the customer will recognise the shipment by later. If a note is refused as
too long, say that the note is too long and ask the customer to shorten it — it is their input, not an outage.

The offer's identity and revision are what was shown to the customer. The server attaches them; you never pass a
revision. If the offer has changed or expired upstream, the booking is refused rather than silently repriced.

## Three different expiry times — keep them apart

| Time | What it is |
|---|---|
| The link's `expires_at` | Up to **30 minutes** from preparing, cut short if the offer stops being bookable sooner |
| `bookable_until` | When the offer stops being bookable at all. A price check without one cannot be booked online |
| The offer's `valid_until` | A **date**, after which the price is no longer valid |

Show the link's deadline prominently, with its timezone. Never let "price valid until" imply the link still works.

**Preparing the same pending booking again returns the same link and does not extend it.** If the customer asks for
more time, the honest answer is that the deadline has not moved. Once an operation is decided — cancelled, expired
or failed — a fresh attempt can be prepared, and it gets a new link, provided the offer is still available.

## Reading what the customer decided

`freightright_get_booking_operation(operation_id)`.

| State | Means | Do |
|---|---|---|
| `PENDING_CONFIRMATION` | Waiting for the customer's click | Give them the link and the deadline |
| `SUBMITTING` | Being sent | Read again shortly |
| `DONE` | Freight Right has the request and is **reviewing** it | Say it is submitted and under review |
| `CANCELLED` | The customer declined on the page | Ask what they want instead |
| `EXPIRED` | The window passed unused | Offer to prepare it again if still bookable |
| `FAILED` | Freight Right refused it | Report the reason given |
| `UNKNOWN` | The outcome is not yet established | **Read it again shortly. Never prepare a second time** |

`UNKNOWN` is reconciled in the background using the same bytes and the same key. Preparing again in response to it
is how a customer ends up with two bookings — do not.

`DONE` is not a confirmed booking. It becomes `BOOKING_REQUESTED` at Freight Right, and **`BOOKED` is a separate
confirmation** that Freight Right makes. Do not tell the customer their freight is booked until it is.

The summary on the operation is a snapshot of what the customer was shown when it was prepared. It does not change
because the upstream moved, and that is deliberate — it is the promise. Present it as shown, and note that a long
charge list or note may be abbreviated for display while the whole note is what gets submitted.
91 changes: 91 additions & 0 deletions skills/connection-and-billing/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
---
name: connection-and-billing
description: Freight Right connection status, permissions and billing accounts. Use before the first price check, quote request or booking of a conversation; when a Freight Right call is refused for billing or permission reasons; when choosing which organization a price, quote or booking is billed to; or when a Freight Right capability appears to be missing.
---

# Freight Right: connection, permissions and billing

Three tools, all free to call and all read-only.

| Tool | Answers |
|---|---|
| `freightright_get_connection_status` | Who is signed in, which organizations they may **act for**, what the customer allowed, and whether access is `ok`, `paused` or `unavailable` |
| `freightright_get_account` | What this connection may do in the rates API, its rate limits, this month's usage, and how billing works |
| `freightright_list_billing_organizations` | The organizations this customer can be **billed through** |

Call `freightright_get_account` before the first price check or quote request of a conversation. It costs nothing
and it tells you the billing policy, which you need before you can send anything.

## Two different sets of organizations

They are not the same list and the counts often differ.

- **Act for** — `freightright_get_connection_status.organizations`. Whose shipments and quotes may be read.
- **Billed through** — `freightright_list_billing_organizations.organizations`. Who pays.

A customer can see the shipments of an organization they cannot be billed through. Never substitute one list for
the other, and when you name a set, say which one you mean.

`freightright_get_connection_status.role` says who is connected. `USER` is a customer: the two lists above are
theirs. `ADMIN` is a **Freight Right administrator**: `organizations` is empty and means *every organization*, not
none — they read every organization's shipments and quotes, and there is no billing list of their own. They name the
client organization to bill on each price check or quote request, found with `freightright_list_billing_organizations`
and its `query` (part of the id or name the user said). When exactly one organization matches what they said, use it;
when several match, or none, ask — never pick a near miss, and never guess an id.

An administrator's connection also shares quotes and finishes draft quotes. It reads every organization's requests
to Freight Right's team but files none: staff file for a customer on the staff page. A customer's connection gives
its own quotes a public link (`freightright_get_account.can.manage_public_links`) — never a quote only shared with
it.

## The three billing policies

`freightright_get_account.billing.policy` says which applies.

| Policy | What to send |
|---|---|
| `LINKED_ORGANIZATION` | `billing_organization_id` from `freightright_list_billing_organizations` |
| `COMPANY_NAME` | `billing_company_name` — there is nothing to choose |
| `ANY_ORGANIZATION_OR_COMPANY_NAME` | Either one is accepted — a Freight Right administrator: `billing_organization_id` of a client organization found with `query`, or `billing_company_name` for a customer without one. Nothing is chosen by default |

Never send both — that is refused. If several organizations exist and none is the default, **ask the customer which
one** rather than picking. If a call is refused for billing, read the policy again before retrying: it can change,
and the refusal will tell you what applies now. Describe it as the policy that applies *now*, never as a policy that
"changed" — nothing here knows the earlier value.

## Three different reasons a capability is not there

Do not report these as the same thing. The customer's fix is different in each case.

| What you see | What it means | What to say |
|---|---|---|
| The tool is **not in the tool list at all** | The capability is switched off for this deployment or this assistant | Freight Right has not enabled it here. Reconnecting will not help |
| The call returns an **authorization challenge** | The connection exists but was not granted that permission | The customer needs to reconnect and approve the extra permission. Permissions are fixed for the life of a connection |
| The call says the connection is **paused**, or asks you to reconnect | The grant is paused or dead at Freight Right's end | Paused: the customer resolves it in Shipment Manager. Dead: reconnect |
| The call says **"an older Freight Right build answered"** or that the environment **does not serve** a shipment's billing, customs, documents or the events feed yet | A rollout in progress, or a section not switched on in that environment | Try again in a minute, or ask Freight Right when it will be switched on. Nothing to reconnect, nothing wrong with the connection |

A read that returns nothing is not any of these. A customer's account only sees its own organizations' data (an
administrator's sees every organization's), so an empty result is an answer, not an error.

## Presenting this

Give the customer the plain words, not the scope strings: which capabilities they have, what this month's usage is
against the allowance, and which billing account will be used. If you are about to spend an allowance unit and the
month is nearly used up, say so first.

## Two more permissions: billing and documents

A shipment's billing and customs (`freightright_get_shipment_billing`, `freightright_get_shipment_customs`,
`freightright_list_invoices`) need the **shipment billing** permission, and its documents
(`freightright_list_shipment_documents`, `freightright_get_shipment_document`) the **shipment documents**
permission — each consented separately from reading shipments. A connection made before they existed asks for the
missing one when a tool first needs it: that is the authorization challenge above, and the customer reconnects and
approves the updated list. The events feed (`freightright_list_shipment_events`) needs only the shipments
permission; billing and document events are simply absent from it without theirs.

## Automation is not this connection

An assistant connection belongs to the person who approved it and acts inside a conversation. A scheduled job — a
sync, a watcher on arrivals, an invoice export — uses the customer's personal **API token** on Freight Right's two
public APIs (made in Shipment Manager, Profile → API tokens) and polls the events feed there. When a customer asks
for something to run on its own, say that, and do not offer this connection as the way to do it.
Loading
Loading