Repository navigation
feat(cli): select targets like rustup selects toolchains - #593
Merged
Merged
Conversation
HalfSweet
force-pushed
the
feat/target-catalog
branch
from
October 19, 2026 07:08
9f01ea2 to
b0cb077
Compare
HalfSweet
force-pushed
the
feat/cli-target-selection
branch
from
October 19, 2026 07:08
84d1e11 to
542d50e
Compare
HalfSweet
force-pushed
the
feat/target-catalog
branch
from
October 19, 2026 07:28
b0cb077 to
a006551
Compare
HalfSweet
force-pushed
the
feat/cli-target-selection
branch
from
October 19, 2026 07:28
542d50e to
21332cc
Compare
HalfSweet
force-pushed
the
feat/target-catalog
branch
from
October 19, 2026 07:35
a006551 to
b275ced
Compare
HalfSweet
force-pushed
the
feat/cli-target-selection
branch
from
October 19, 2026 07:35
21332cc to
6768188
Compare
Every pocket check, compile and build named its target with --target or
--host-profile, and the CLI recognized a framework by its package name.
A verb now acts on the first of: an explicit +<id> (before or after the
command), --target or --host-profile; POCKET_TARGET; a directory override
of the current directory or an ancestor; the first entry of `targets` in
the project's pocket.config.ts; the user default. The CLI prints the target
and its source before it runs. pocket build --all builds every project
target in order.
- pocket.config.ts gains `targets`: catalog ids, { target, manifest }, or
{ hostProfile, manifest }. The project configuration is the nearest
pocket.config.ts above the manifest's directory; tools/pocket.ts project
bundles it with @pocketjs/framework mapped to the resolved framework.
- pocket show [--json] reports the framework and its source, the project,
the selection and why, the host, and the catalog. pocket default and
pocket override keep their state in <config>/pocket-nexus/settings.json.
- A framework is any directory whose package.json carries
"pocketjs": { "protocol": 1 }; the package name is not read, so a fork
under another name is recognized. The nearest of a checkout and an
installed node_modules/@pocketjs/framework wins. The CLI passes
--cli-protocol and either side stops on a mismatch.
- pocket create writes pocket.config.ts, and its package.json scripts name
no target.
HalfSweet
force-pushed
the
feat/cli-target-selection
branch
from
October 19, 2026 07:49
6768188 to
7a87fb1
Compare
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.
Stacked on #592 (← #591 ← #590 ← #588).
Summary
Every
pocket check,compileandbuildnamed its target with--targetor--host-profile, and the CLI recognized a framework by its package name.Selection. A verb acts on the first of:
pocket +<id> <verb>(rustup's position),pocket <verb> +<id>,--target <id>,--host-profile <file>— two that differ are an error, a+idanywhere else before--is an error;POCKET_TARGET;pocket override set <id> [--path DIR]);targetsin the project'spocket.config.ts;pocket default <id>).None present stops with the five ways to name one. Each run prints
pocket: target vita · directory override /work/gamefirst.pocket build --allbuilds every project target in order.Project configuration.
PocketConfiggainstargets: catalog ids,{ target, manifest }, or{ hostProfile, manifest }(the host profile'sidnames the target and may not equal a catalog id or a command word). The project configuration is the nearestpocket.config.tsabove the manifest's directory — the filetools/build.tsreadsthemefrom, soapps/note's own config keeps applying in a checkout — and the lookup stops there.tools/pocket.ts projectbundles the file with@pocketjs/frameworkmapped to the resolved framework, so it evaluates in a project withoutnode_modules(a Bun runtime plugin does not intercept that import; bundling does).pocket show [--json]reports the framework and its source (POCKETJS_FRAMEWORK_ROOT, checkout, registry, git/file:/link:spec frombun.lock, orlink → <path>), the project and its targets, the selection and why, the host, and the catalog with targets this host cannot install marked. Overrides and the default live in<config>/pocket-nexus/settings.json, written by rename.Framework identity. A framework is any directory whose
package.jsoncarries"pocketjs": { "protocol": 1 }(added to this package); the name is not read, so a fork published under another name is recognized. The nearest of a checkout and an installednode_modules/@pocketjs/frameworkwins (checkout on a tie). The CLI passes--cli-protocol 1and both sides stop on a mismatch.pocket createwritespocket.config.ts; itspackage.jsonscripts name no target (pocket check,pocket build -- --release,pocket build --output dist/<name>.pocketfor ESP-IDF).New modules:
tools/cli/framework.mjs,tools/cli/select.mjs,tools/targets/project.ts. Docs: the CLI reference gains Target selection, Project configuration, show, default, override and Switching to a fork.Validation
Every stage of
bun tools/test.tsindividually: unit 1085 pass / 1 fail (theclass-diagnostics--strict-classescase, failing on this machine onmain, passing in CI); all later stages pass.bunx tsc --noEmit: only the pre-existing errors intests/runtime-glyphs.test.tsandtests/pocket3d-icon.test.ts.