Skip to content

feat(connect): create and update a Connect app from one.connect.ts (v2.10.0) - #217

Merged
paulkr merged 9 commits into
mainfrom
feat/connect-create
Oct 28, 2026
Merged

paulkr merged 9 commits into
mainfrom
feat/connect-create

Conversation

@krish221997

@krish221997 krish221997 commented Oct 28, 2026 •

Copy link
Copy Markdown
Collaborator

Part of programmatic Connect app creation (@withone/connect 0.19.0 adds defineConnectApp; the dashboard page is core-ui #1001). No backend change: the API key never creates or changes a Connect app (pica-v2 #1092 closed, per Sam's review).

one connect create reads one.connect.ts (also .mts, .mjs, .js) and resolves tool slugs and custom action names to catalog ids (the only API-key calls, all existing catalog reads). Then, like one login, it listens on 127.0.0.1 and opens the setup page with the config in the link's fragment, deflated and base64url'd (about half the size; 400 custom actions make a 13.6 KB link). A config over 32,000 characters stops with a message; on Windows a link too long for PowerShell is printed to open by hand:

no ONE_CLIENT_ID in .env   → /cli/connect/new      review → create app, ask, both secrets → copy them
ONE_CLIENT_ID in .env      → /cli/connect/<id>     review only what changes → approve

The person approves with their dashboard session. The page reports the ids back (never a secret, checked against state, plain ids only), and the CLI writes ONE_CLIENT_ID, ONE_PERMISSION_SET and ONE_REDIRECT_URI to .env.local (or .env), keeping every other line, then sends the browser to the summary. It waits up to 10 minutes; a cancel in the browser ends it at once. In --agent mode the link goes to stderr straight away and the JSON result (outcome: created | updated | unchanged) comes once approved.

one connect types writes one-connect-env.d.ts, augmenting ConnectRegistry with every tool slug and action names for the tools the config asks for.

  • Access levels map to the same rules the dashboard writes (policyToRuleFields in core-ui).
  • An action name two actions share is left out, so a name never picks one silently; those stay reachable by id.
  • A .ts config loads natively on Node 22.18+; older Node gets a message pointing at one.connect.mjs. If the config can't import @withone/connect (not installed, or older than 0.19.0), it says to install it first. No new dependency.
  • README, One skill, guide and help text updated; version 2.10.0.

Tests: connect-app.test.ts (rules, handoff encoding, missing SDK), connect-callback.test.ts (state, id checks, cancel, the redirect), and the setup/summary links. npm run typecheck and npm run build pass. npm test is 703/709: the 6 resolveConfig failures also fail on untouched main on this machine (they read the real ~/.one). Checked end to end against local core with the dashboard: create, update and a no-change re-run.

🤖 Generated with Claude Code

krish221997 and others added 9 commits October 28, 2026 18:49
…2.10.0)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…v; the page makes the connect key

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t to .env; the page makes the connect key"

This reverts commit 2e6c0c9.
…'t import it

The config imports the SDK from the project, not from the CLI. Node's raw
'Cannot find package' error now reads as an instruction, and an SDK older
than 0.19.0 (no /config export) says to upgrade. The skill and guide say to
install the SDK before writing the file.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… it should say

connect create now opens /cli/connect/<id> (beside one login's /cli/auth)
with ?env=<file>, so the page tells the developer where to paste the two
secrets. Docs call it the setup page.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… it with the API key

connect create resolves the config to catalog ids, then opens the setup
page with it in the link's fragment (/cli/connect/new, or the app's id to
review changes) and waits on 127.0.0.1, like one login. The person
approves with their dashboard session; the page reports the ids back and
the CLI writes them to the env file. The API key only reads the catalog.
Drops the create/update API methods.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…he actions hint

The handoff is deflated before base64url (the page inflates it with the
browser's DecompressionStream), roughly halving long action lists. A config
over 32,000 characters stops with a message instead of opening a link a
terminal can't hand over, and on Windows a link too long for PowerShell is
printed to open by hand. The unknown-action hint and README now name
`one actions find`; `one actions search` no longer exists.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… test per project

Windows writes the package path in ERR_PACKAGE_PATH_NOT_EXPORTED as
@withone\connect, so the upgrade hint never showed there; the check now
takes either separator. The test loaded one config file twice, which Node
22 answers from its cache of the first failed import; each case now gets
its own project.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@paulkr
paulkr merged commit 9b39d03 into main Oct 28, 2026
7 checks passed
@paulkr
paulkr deleted the feat/connect-create branch October 28, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants