-
Notifications
You must be signed in to change notification settings - Fork 0
Add OpenAI host support for skill discovery #6
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -12,6 +12,7 @@ import { | |
| pathExists, | ||
| readTextFile, | ||
| } from "../fs-scan.ts"; | ||
| import { openaiHome } from "../paths.ts"; | ||
| import { skillId } from "./ids.ts"; | ||
| import { skillRoots } from "./scan-policy.ts"; | ||
| import type { HostId, IndexCard } from "./types.ts"; | ||
|
|
@@ -26,6 +27,12 @@ function hostForSkillRoot(root: string, ctx: ScanContext): HostId { | |
| if (root.includes("/.cursor/") || root.includes("skills-cursor")) { | ||
| return "cursor"; | ||
| } | ||
| if ( | ||
| root === join(openaiHome(), "skills") || | ||
| (ctx.repoRoot !== null && root === join(ctx.repoRoot, ".openai", "skills")) | ||
|
Comment on lines
+30
to
+32
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
When a repository lives beneath a host-owned directory such as Useful? React with 👍 / 👎. |
||
| ) { | ||
| return "openai"; | ||
| } | ||
| if (root.includes("/.codex/")) { | ||
| return "codex"; | ||
| } | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,6 +7,7 @@ export type HostId = | |
| | "grok" | ||
| | "codex" | ||
| | "cursor" | ||
| | "openai" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
This changes AGENTS.md reference: AGENTS.md:L55-L58 Useful? React with 👍 / 👎. |
||
| | "gemini" | ||
| | "kimi" | ||
| | "git" | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,6 +26,11 @@ export function cursorHome(): string { | |
| return join(homeDir(), ".cursor"); | ||
| } | ||
|
|
||
| /** OpenAI agent/CLI home. */ | ||
| export function openaiHome(): string { | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The package exposes only its Useful? React with 👍 / 👎. |
||
| return join(homeDir(), ".openai"); | ||
| } | ||
|
|
||
| /** Google Gemini CLI / Antigravity home. */ | ||
| export function geminiHome(): string { | ||
| return join(homeDir(), ".gemini"); | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,8 +1,12 @@ | ||
| import { describe, expect, test } from "bun:test"; | ||
| import { mkdirSync, mkdtempSync, realpathSync, writeFileSync } from "node:fs"; | ||
| import { tmpdir } from "node:os"; | ||
| import { join } from "node:path"; | ||
| import { buildContext } from "../src/catalog/context.ts"; | ||
| import { buildScanContext } from "../src/catalog/context-builder.ts"; | ||
| import { findAssets } from "../src/catalog/find.ts"; | ||
| import { whereAmI } from "../src/catalog/where.ts"; | ||
| import { DEFAULT_CONFIG } from "../src/config.ts"; | ||
|
|
||
| describe("find", () => { | ||
| test("find instructions in let repo", async () => { | ||
|
|
@@ -23,6 +27,58 @@ describe("find", () => { | |
| expect(r.items.length).toBeLessThanOrEqual(ctx.limit); | ||
| }); | ||
|
|
||
| test("find skills discovers project openai skill roots", async () => { | ||
| const root = mkdtempSync(join(tmpdir(), "let-openai-")); | ||
| Bun.spawnSync(["git", "init"], { cwd: root }); | ||
| const skillDir = join(root, ".openai", "skills", "agent-coordination"); | ||
| mkdirSync(skillDir, { recursive: true }); | ||
| writeFileSync( | ||
| join(skillDir, "SKILL.md"), | ||
| "---\nname: agent-coordination\ndescription: Coordinate agents\n---\n# Coordination\n", | ||
| ); | ||
| const ctx = buildScanContext({ | ||
| cwd: root, | ||
| scope: "project", | ||
| config: { | ||
| ...DEFAULT_CONFIG, | ||
| find: { ...DEFAULT_CONFIG.find, include_user_skills: false }, | ||
| }, | ||
| }); | ||
| const r = await findAssets("skills", ctx, { host: "openai" }); | ||
| expect(r.items).toHaveLength(1); | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
On any developer or CI account that already has entries under Useful? React with 👍 / 👎. |
||
| expect(r.items[0]?.host).toBe("openai"); | ||
| expect(r.items[0]?.name).toBe("agent-coordination"); | ||
| expect(realpathSync(r.items[0]?.path ?? "")).toBe( | ||
| realpathSync(join(skillDir, "SKILL.md")), | ||
| ); | ||
| }); | ||
|
|
||
| test("find skills keeps generic project roots below .openai attributed to project", async () => { | ||
| const parent = mkdtempSync(join(tmpdir(), "let-openai-parent-")); | ||
| const root = join(parent, ".openai", "worktrees", "repo"); | ||
| mkdirSync(root, { recursive: true }); | ||
| Bun.spawnSync(["git", "init"], { cwd: root }); | ||
| const skillDir = join(root, "skills", "generic-skill"); | ||
| mkdirSync(skillDir, { recursive: true }); | ||
| writeFileSync(join(skillDir, "SKILL.md"), "# Generic skill\n"); | ||
|
|
||
| const ctx = buildScanContext({ | ||
| cwd: root, | ||
| scope: "project", | ||
| config: { | ||
| ...DEFAULT_CONFIG, | ||
| find: { ...DEFAULT_CONFIG.find, include_user_skills: false }, | ||
| }, | ||
| }); | ||
| const r = await findAssets("skills", ctx, { host: "project" }); | ||
| const genericSkill = r.items.find( | ||
| (item) => | ||
| realpathSync(item.path) === realpathSync(join(skillDir, "SKILL.md")), | ||
| ); | ||
|
|
||
| expect(genericSkill?.host).toBe("project"); | ||
| }); | ||
|
|
||
| test("find worktrees dedupes paths", async () => { | ||
| const ctx = buildScanContext({ cwd: process.cwd() }); | ||
| const r = await findAssets("worktrees", ctx); | ||
|
|
||
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.
This newly added OpenAI row introduces em-dash characters in authored content, directly violating the repository rule requiring hyphens or colons instead; replace these placeholders with permitted characters.
AGENTS.md reference: AGENTS.md:L61-L61
Useful? React with 👍 / 👎.