-
Notifications
You must be signed in to change notification settings - Fork 0
P0: add agent installer workflow #144
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
11 commits
Select commit
Hold shift + click to select a range
5d8fca4
Add agent installer workflow
lzehrung 5eac588
Address installer review feedback
lzehrung 733a0f9
Stabilize OpenCode skill doctor test
lzehrung f6bf7dd
Address installer ownership feedback
lzehrung efc1249
Resolve installer review blockers
lzehrung 59a96ad
Preserve installer skill customizations
lzehrung 3697365
Report installer skill payload removals
lzehrung 6fa7ec4
Validate installer print-config conflicts
lzehrung 932b406
Polish installer diagnostics and tests
lzehrung 20cc49e
Fix installer agents feedback
lzehrung 9b93153
Clean up installer print-config and mcp help placement
lzehrung 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
Some comments aren't visible on the classic Files Changed page.
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
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,103 @@ | ||
| import { | ||
| detectInstallTargets, | ||
| installCodegraphTargets, | ||
| parseInstallTargetId, | ||
| parseInstallTargetIds, | ||
| printInstallConfig, | ||
| uninstallCodegraphTargets, | ||
| type InstallTargetId, | ||
| } from "../installer/registry.js"; | ||
|
|
||
| export type InstallerCommandContext = { | ||
| command: "install" | "uninstall"; | ||
| positionals: string[]; | ||
| getOpt: (name: string) => string | undefined; | ||
| hasFlag: (name: string) => boolean; | ||
| writeJSONLine: (value: unknown) => void; | ||
| writeStdoutLine: (message: string) => void; | ||
| writeStderrLine: (message: string) => void; | ||
| exit: (code: number) => never; | ||
| }; | ||
|
|
||
| export async function handleInstallerCommand(context: InstallerCommandContext): Promise<void> { | ||
| const printConfigTarget = context.getOpt("--print-config"); | ||
|
|
||
| if (printConfigTarget !== undefined) { | ||
| assertPrintConfigIsExclusive(context); | ||
| const targetId = parseInstallerTargetOrExit(context, printConfigTarget); | ||
| context.writeStdoutLine(printInstallConfig({ targetId }).trimEnd()); | ||
| return; | ||
| } | ||
|
|
||
| const targetIds = parseInstallerTargets(context); | ||
| const options = { | ||
| ...(targetIds !== undefined ? { targetIds } : {}), | ||
| yes: context.hasFlag("--yes"), | ||
| dryRun: context.hasFlag("--dry-run"), | ||
| }; | ||
|
|
||
| if (context.hasFlag("--detect")) { | ||
| context.writeJSONLine({ targets: await detectInstallTargets(options) }); | ||
| return; | ||
| } | ||
|
|
||
| if (context.command === "install") { | ||
| context.writeJSONLine(await installCodegraphTargets(options)); | ||
| return; | ||
| } | ||
|
|
||
| context.writeJSONLine(await uninstallCodegraphTargets(options)); | ||
| } | ||
|
|
||
| function parseInstallerTargets(context: InstallerCommandContext): InstallTargetId[] | undefined { | ||
| const targetOpt = context.getOpt("--target"); | ||
| const positionalTarget = context.positionals[0]; | ||
| if (context.positionals.length > 1) { | ||
| context.writeStderrLine(`Unexpected positional argument for ${context.command}: ${context.positionals[1]!}`); | ||
| context.exit(2); | ||
| } | ||
| if (targetOpt !== undefined && positionalTarget !== undefined) { | ||
| failUsage(context, "Use either --target or a positional target, not both."); | ||
| } | ||
| return parseInstallerTargetIdsOrExit(context, targetOpt ?? positionalTarget); | ||
| } | ||
|
|
||
| function assertPrintConfigIsExclusive(context: InstallerCommandContext): void { | ||
| const conflicts: string[] = []; | ||
| if (context.getOpt("--target") !== undefined) conflicts.push("--target"); | ||
| if (context.positionals.length) conflicts.push("positional targets"); | ||
| if (context.hasFlag("--detect")) conflicts.push("--detect"); | ||
| if (context.hasFlag("--yes")) conflicts.push("--yes"); | ||
| if (context.hasFlag("--dry-run")) conflicts.push("--dry-run"); | ||
| if (!conflicts.length) return; | ||
| failUsage(context, `--print-config cannot be combined with ${conflicts.join(", ")}.`); | ||
| } | ||
|
|
||
| function parseInstallerTargetOrExit(context: InstallerCommandContext, value: string): InstallTargetId { | ||
| try { | ||
| return parseInstallTargetId(value); | ||
| } catch (error) { | ||
| failUsage(context, errorMessage(error)); | ||
| } | ||
| } | ||
|
|
||
| function parseInstallerTargetIdsOrExit( | ||
| context: InstallerCommandContext, | ||
| value: string | undefined, | ||
| ): InstallTargetId[] | undefined { | ||
| try { | ||
| return parseInstallTargetIds(value); | ||
| } catch (error) { | ||
| failUsage(context, errorMessage(error)); | ||
| } | ||
| } | ||
|
|
||
| function failUsage(context: InstallerCommandContext, message: string): never { | ||
| context.writeStderrLine(message); | ||
| context.exit(2); | ||
| } | ||
|
|
||
| function errorMessage(error: unknown): string { | ||
| if (error instanceof Error) return error.message; | ||
| return String(error); | ||
| } | ||
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
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.
Addressed in 3697365. Installer commands no longer advertise or accept
--json; help/docs/skill guidance now state installer reporting is text-only while analysis commands keep JSON output.