@yuwei838/fotor-cli
v0.1.0
Published
Fotor CLI — device-code login (RFC 8628) against fotor-device-auth, local credential store, for Accio cli-login + webAuth:device-code.
Readme
fotor-cli
The CLI half of the Fotor connector demo — pairs with
fotor-device-auth (the server half). Together they
demonstrate the full cli-login + webAuth: device-code contract from the
Accio 接入规范 (§6.3.2 / §6.3.4), end to end.
Run
npm install
npm run build
# in another terminal, from ../fotor-device-auth:
npm run dev
# then:
node dist/cli.js auth login --deviceauth login --device will:
- Call
POST /device/authon the auth server. - Print one line of JSON to stdout —
verification_uri_complete,device_code,user_code,expires_in,interval— this is exactly the contract Accio'scli.webAuth.stdout.*Keyconfig reads from a real CLI's stdout (§6.3.4). Everything else goes to stderr, never mixed into that line. - Poll
POST /tokenuntil the user finishes the browser step. - Write the issued token to
~/.fotor-cli/credentials— matches thecredential.home: ".fotor-cli/credentials"we'd declare inconnectors/connectors.json.
Other commands:
node dist/cli.js auth status # show masked key + credential file path
node dist/cli.js auth logout # delete the credential fileVerified working
Ran the full loop for real (not just typechecked): started the auth server,
ran auth login --device, drove an actual browser through the login +
consent pages this repo's server renders, and confirmed:
- the CLI's stdout line parses as valid JSON with the right keys
- the browser flow completes with oidc-provider's built-in "Sign-in Success" page
- the CLI's background poll picks up the token and writes
~/.fotor-cli/credentials auth statusreads it back,auth logoutremoves it (verified exit codes: 0 while logged in, 1 after logout)
What's still a stand-in
auth loginonly implements--device; the non-device (local loopback) variant from §6.3.2 isn't built.- No subcommand actually calls a Fotor generation API yet — this repo proves
the auth handshake, not the business logic. A real
fotor-skillsrefactor would add commands here (e.g.fotor-cli generate ...) that read~/.fotor-cli/credentialsinstead of theFOTOR_OPENAPI_KEYenv var. - Not published to npm —
connectors.json'sauth.npmPackage/mcpServer.npmPackageneed a real published package name once this is ready to wire into Accio for real.
