Repository navigation
feat(cli): run universal-portals from an embedded tool (Beta) - #1740
Open
jacobovidal wants to merge 5 commits into
Open
jacobovidal wants to merge 5 commits into
jacobovidal wants to merge 5 commits into
Conversation
This was referenced Oct 26, 2026
jacobovidal
marked this pull request as ready for review
October 26, 2026 17:27
Replace the Go setup command with a launcher for the Universal Portals setup and audit tool, which is built into the binary as one JavaScript file and run with Node.js 20.12 or newer. The tool covers what the old command did and more: business portals, reuse on a second run, an audit with fixes, and JSON output. The tool reaches the Management API by calling this CLI again, so the login and the token stay inside the CLI. The launcher passes the path of the CLI and the tenant, writes the tool to a private temporary file that is removed afterwards, hands over the terminal, and returns the tool's exit code. It lets the tool finish its own message on Ctrl+C instead of exiting at once. Flags are not parsed by the CLI: every argument goes to the tool, which has its own help. The old runner and the three helpers only it used are removed. The command is temporary and its header comment lists what to delete when the plugin framework takes over. Co-Authored-By: Claude <noreply@anthropic.com>
The binary ships the embedded JavaScript file, so a file older than its sources would ship old code. A test recomputes a hash of the lockfile, the build script and the sources, and compares it with the hash the build wrote into the first lines of the file. The hash definition is pinned with a hand-computed value that the tool's own tests check too, so the two implementations cannot drift apart. A second test fails if plugins.go appears in this folder. The plugin framework skips a plugin whose name matches a built-in command, so once the framework is here the embedded command has to go first, and the message points at the list of what to delete. Co-Authored-By: Claude <noreply@anthropic.com>
Run `make docs` for the new universal-portals commands. The setup page no longer lists flags, because the tool handles them and shows them with --help. The audit command has a new page. Co-Authored-By: Claude <noreply@anthropic.com>
Remove an exit hook that no test replaced, and the second Node probe. The command asked ACUL's check whether node runs, then looked it up on the PATH again and checked its version, so Node was started twice and the lookup error could not be reached. ACUL's message also asked for Node v22, but this command runs on 20.12. Now there is one lookup and one version check, and the message names the version this command needs. A test covers the missing-Node case. The header comment is shorter and keeps only what is needed to remove the command. Co-Authored-By: Claude <noreply@anthropic.com>
The test sent SIGINT after a fixed 200 ms, which could land before the fake tool had started on a slow machine. The tool now creates a marker file when it starts and waits for the test to release it, so the signal always arrives while the tool is running. Also rename the tripwire test so no Go name mentions a plugin. Co-Authored-By: Claude <noreply@anthropic.com>
jacobovidal
force-pushed
the
feat/up-embedded-runner
branch
from
October 26, 2026 17:52
385774a to
c626a31
Compare
4 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔧 Changes
Third of three stacked PRs (on #1739).
auth0 universal-portals setupand the newauditnow run the Universal Portals tool that is built into the binary, instead of the Go code that was here.0700, file0600, removed afterwards), runs it with Node.js, hands over the terminal and returns its exit code. The tool reaches the Management API by calling this same CLI (auth0 api), so the login and the token stay inside the CLI. It lets the tool finish its own message on Ctrl+C instead of exiting at once (the same pattern asacul dev).--help. So the setup page indocs/no longer has a flag table, and the new audit page has none.utils_shared.go(missingScopes,scopesFromToken,deriveServiceURL).plugins.goappears in this folder: see below.make docs.Behaviour changes for people using the current beta command
--nameand--slugstill work.client_credentialsgrant type. The forms use a separate, minimal application. Portals created by the old command get audit findings P010 and P011 for this.--template businesswith a test user and organization,auditwith--fix,--strictand--organization, and--json.This is temporary. The header of
universal_portals.golists what to delete when the plugin framework can install the tool. The framework skips a plugin whose name matches a built-in command, which is why the second guard exists.Known limits: the command needs the CLI to be logged in even for
--help; Windows is not tested. Flag parsing is off, so the CLI's own login check does not see--tenantor--no-inputwhen they come after the subcommand: it checks the active tenant, and with an expired session it can offer to log in instead of failing. The tool then uses the tenant from--tenant. The missing-Node message is worded for this command and differs from the one ACUL shows. When the tool ends with a non-zero code, the launcher exits directly, so that run is not counted by the CLI's usage tracking. Ctrl+C: the tool decides, and a tool ended by the signal is reported as exit code 130, unlike the rest of this branch where the root handler exits 0.📚 References
Stacked on #1739. Related: the plugin framework PRs, which this stands in for until they are available on this branch.
🔬 Testing
New tests cover the launcher with a fake
node(arguments, environment, private temporary file, terminal input, exit code, Ctrl+C) and one test that runs the embedded file under the real Node.js.By hand, with a binary built from this branch against a development tenant:
auditof two existing portals, consumersetupplus a second run, businesssetupby email, andauditof each new portal; everything created was deleted and checked. Not tested here: interactive prompts in a real terminal, and Ctrl+C in the middle of a call.📝 Checklist
🤖 Generated with Claude Code