-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add install-info command and buildInstallSnippet API #18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
4f74ef5
refactor: migrate cursor to the target registry (no behavior change)
steve-calvert-glean 6b9be44
fix: apply the per-plugin version override in cursor's manifest
steve-calvert-glean d0677f1
refactor: migrate claude to the target registry (no behavior change)
steve-calvert-glean afbe182
fix: correct Codex plugin output for the target registry
steve-calvert-glean 5c63d1e
fix: restore deeper hooks.json validation dropped during target migra…
steve-calvert-glean ee4ab2b
refactor: delete legacy per-target emitters/validators now that all t…
steve-calvert-glean 8f54038
docs: note the shared hooks validation depth in CONFORMANCE.md
steve-calvert-glean f49ddc4
feat: add install-info command and buildInstallSnippet API
steve-calvert-glean cdb05b5
Merge remote-tracking branch 'origin/main' into feat/install-snippet
steve-calvert-glean File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| import { targets as registry } from "./targets/registry.js"; | ||
| import type { | ||
| Citation, | ||
| InstallParams, | ||
| InstallSnippet, | ||
| } from "./targets/types.js"; | ||
| import type { TargetName } from "./types.js"; | ||
|
|
||
| export type { | ||
| Citation, | ||
| InstallParams, | ||
| InstallSnippet, | ||
| } from "./targets/types.js"; | ||
|
|
||
| /** | ||
| * Builds the real, doc-verified command or URL a user needs to add a | ||
| * pluginpack-built marketplace for `target`. See each target's | ||
| * `installSnippet.citation` (and `getInstallSnippetCitation`) for the source | ||
| * this is based on. | ||
| */ | ||
| export function buildInstallSnippet( | ||
| target: TargetName, | ||
| params: InstallParams, | ||
| ): InstallSnippet { | ||
| const definition = registry[target].installSnippet; | ||
| if (!definition.userConfigurable || !definition.build) { | ||
| return { | ||
| userConfigurable: false, | ||
| reason: | ||
| definition.unsupportedReason ?? | ||
| `${target} has no install command or URL.`, | ||
| }; | ||
| } | ||
| return { userConfigurable: true, ...definition.build(params) }; | ||
| } | ||
|
|
||
| /** The citation backing `target`'s install snippet. */ | ||
| export function getInstallSnippetCitation(target: TargetName): Citation { | ||
| return registry[target].installSnippet.citation; | ||
| } | ||
|
|
||
| /** Targets with a real, user-configurable install snippet today. */ | ||
| export function getSupportedInstallTargets(): TargetName[] { | ||
| return (Object.keys(registry) as TargetName[]).filter( | ||
| (target) => registry[target].installSnippet.userConfigurable, | ||
| ); | ||
| } | ||
|
|
||
| /** Targets with no install snippet — empty today, kept for forward-compatibility. */ | ||
| export function getUnsupportedInstallTargets(): TargetName[] { | ||
| return (Object.keys(registry) as TargetName[]).filter( | ||
| (target) => !registry[target].installSnippet.userConfigurable, | ||
| ); | ||
| } | ||
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Issue: Potential TypeError: buildInstallSnippet indexes target registry without handling partial registry entries. If registry[target] is undefined (e.g., targets not yet migrated to the registry), accessing .installSnippet will throw at runtime when CLI install-info or library callers pass such a target.
Suggested fix: Mirror the adapters' partial-registry pattern: guard registry[target] and fall back to a legacy install snippet definition or return a structured userConfigurable:false result with a clear reason. For example: const def = registry[target]?.installSnippet; if (!def || !def.userConfigurable || !def.build) return { userConfigurable: false, reason: def?.unsupportedReason ??
${target} has no install command or URL.}; otherwise return { userConfigurable: true, ...def.build(params) }. Alternatively, ensure all TargetName variants are present in the registry before using it here.🔧 Tag
@ glean-for-engineeringto fix or click here to fix in Glean💬 Help us improve! Was this comment helpful? React with 👍 or 👎