-
Notifications
You must be signed in to change notification settings - Fork 81
feat(omp): add OMP (Oh My Pi) harness support #297
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
Closed
Closed
Changes from all commits
Commits
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
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,48 @@ | ||
| import { afterEach, describe, expect, it } from "bun:test"; | ||
| import { mkdirSync, mkdtempSync, rmSync, writeFileSync } from "node:fs"; | ||
| import { tmpdir } from "node:os"; | ||
| import { join } from "node:path"; | ||
| import { OmpAdapter } from "./omp"; | ||
|
|
||
| const original = { | ||
| HOME: process.env.HOME, | ||
| PATH: process.env.PATH, | ||
| PI_CODING_AGENT_DIR: process.env.PI_CODING_AGENT_DIR, | ||
| XDG_DATA_HOME: process.env.XDG_DATA_HOME, | ||
| }; | ||
| const roots: string[] = []; | ||
|
|
||
| afterEach(() => { | ||
| for (const [key, value] of Object.entries(original)) { | ||
| if (value === undefined) delete process.env[key]; | ||
| else process.env[key] = value; | ||
| } | ||
| for (const root of roots.splice(0)) rmSync(root, { recursive: true, force: true }); | ||
| }); | ||
|
|
||
| describe("OmpAdapter", () => { | ||
| it("detects an enabled Magic Context plugin from omp plugin list", () => { | ||
| const root = mkdtempSync(join(tmpdir(), "mc-omp-adapter-")); | ||
| roots.push(root); | ||
| const bin = join(root, "bin"); | ||
| mkdirSync(bin, { recursive: true }); | ||
| const omp = join(bin, "omp"); | ||
| writeFileSync( | ||
| omp, | ||
| `#!/bin/sh | ||
| if [ "$1 $2 $3" = "plugin list --json" ]; then | ||
| printf '%s' '{"npm":[{"name":"@cortexkit/pi-magic-context","version":"0.33.0","enabled":true}],"marketplace":[]}' | ||
| fi | ||
| `, | ||
| { mode: 0o755 }, | ||
| ); | ||
| process.env.PATH = bin; | ||
| process.env.HOME = root; | ||
| delete process.env.XDG_DATA_HOME; | ||
|
|
||
| const adapter = new OmpAdapter(); | ||
| expect(adapter.isInstalled()).toBe(true); | ||
| expect(adapter.hasPluginEntry()).toBe(true); | ||
| expect(adapter.getInstalledPluginVersion()).toBe("0.33.0"); | ||
| }); | ||
| }); |
Oops, something went wrong.
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.
The new OMP job executes
actions/checkout@v5andoven-sh/setup-bun@v2through mutable major-version tags. Pinning both actions to full commit SHAs prevents a repointed tag from running unreviewed code with the job's repository and workflow permissions.Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
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.
Declining in this PR, deliberately — this is a repo-wide policy call, not something the OMP job introduced.
Every action reference in
.github/workflows/uses a mutable major tag today:Zero SHA pins across 57 references. The new
e2e-ompjob follows that convention exactly.Pinning just these two would add a second convention alongside the existing one while 55 references stay mutable — the threat model is unchanged (any repointed
@v5still runs in the other 24 jobs, several with broader permissions than this one), so the benefit is cosmetic and the inconsistency is real.Worth doing as its own change across all workflows, ideally with Dependabot
package-ecosystem: github-actionsto keep the pins current. Happy to open that separately if a maintainer wants it — flagging rather than silently expanding this PR.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.
That's a fair and well-reasoned pushback. You're right — flagging two references while 55 others stay mutable is inconsistent and doesn't move the threat model. A repo-wide sweep with Dependabot
package-ecosystem: github-actionsis the correct fix, and this PR shouldn't carry a partial one.Shall I remember this as a rule: "Do not flag mutable action tags on individual jobs in this repo — it's an established convention; recommend a repo-wide Dependabot fix instead"?
Tip: You can customize Greptile's behavior for this repo with
.greptile/rules.mdand.greptile/config.json.