Skip to content

Commit 519f3b3

Browse files
committed
Install Plannotator skills under Codex home
1 parent ff2759b commit 519f3b3

4 files changed

Lines changed: 93 additions & 16 deletions

File tree

scripts/install.cmd

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -475,14 +475,25 @@ echo Address the annotation feedback above. The user has reviewed your last mess
475475
echo Installed /plannotator-last command to !CLAUDE_COMMANDS_DIR!\plannotator-last.md
476476

477477
REM Install skills (requires git)
478+
REM Remove legacy Codex-oriented skills from the older shared agent scope.
479+
set "LEGACY_AGENTS_SKILLS_DIR=%USERPROFILE%\.agents\skills"
480+
set "LEGACY_SKILLS_REMOVED=0"
481+
for %%S in (plannotator-review plannotator-annotate plannotator-last) do (
482+
if exist "!LEGACY_AGENTS_SKILLS_DIR!\%%S" (
483+
rmdir /s /q "!LEGACY_AGENTS_SKILLS_DIR!\%%S" >nul 2>&1
484+
set "LEGACY_SKILLS_REMOVED=1"
485+
)
486+
)
487+
if "!LEGACY_SKILLS_REMOVED!"=="1" echo Removed legacy Plannotator skills from !LEGACY_AGENTS_SKILLS_DIR!
488+
478489
where git >nul 2>&1
479490
if !ERRORLEVEL! equ 0 (
480491
if defined CLAUDE_CONFIG_DIR (
481492
set "CLAUDE_SKILLS_DIR=%CLAUDE_CONFIG_DIR%\skills"
482493
) else (
483494
set "CLAUDE_SKILLS_DIR=%USERPROFILE%\.claude\skills"
484495
)
485-
set "AGENTS_SKILLS_DIR=%USERPROFILE%\.agents\skills"
496+
set "CODEX_SKILLS_DIR=%USERPROFILE%\.codex\skills"
486497
set "SKILLS_TMP=%TEMP%\plannotator-skills-%RANDOM%"
487498
mkdir "!SKILLS_TMP!" >nul 2>&1
488499

@@ -493,10 +504,10 @@ if !ERRORLEVEL! equ 0 (
493504

494505
if exist "apps\skills" (
495506
if not exist "!CLAUDE_SKILLS_DIR!" mkdir "!CLAUDE_SKILLS_DIR!"
496-
if not exist "!AGENTS_SKILLS_DIR!" mkdir "!AGENTS_SKILLS_DIR!"
507+
if not exist "!CODEX_SKILLS_DIR!" mkdir "!CODEX_SKILLS_DIR!"
497508
xcopy /s /y /q "apps\skills\*" "!CLAUDE_SKILLS_DIR!\" >nul 2>&1
498-
xcopy /s /y /q "apps\skills\*" "!AGENTS_SKILLS_DIR!\" >nul 2>&1
499-
echo Installed skills to !CLAUDE_SKILLS_DIR!\ and !AGENTS_SKILLS_DIR!\
509+
xcopy /s /y /q "apps\skills\*" "!CODEX_SKILLS_DIR!\" >nul 2>&1
510+
echo Installed skills to !CLAUDE_SKILLS_DIR!\ and !CODEX_SKILLS_DIR!\
500511
)
501512

502513
popd

scripts/install.ps1

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -394,10 +394,24 @@ description: Annotate the last assistant message
394394

395395
Write-Host "Installed /plannotator-last command to $opencodeCommandsDir\plannotator-last.md"
396396

397+
# Remove legacy Codex-oriented skills from the older shared agent scope.
398+
$legacyAgentsSkillsDir = "$env:USERPROFILE\.agents\skills"
399+
$legacySkillsRemoved = $false
400+
foreach ($skill in @("plannotator-review", "plannotator-annotate", "plannotator-last")) {
401+
$legacySkillPath = Join-Path $legacyAgentsSkillsDir $skill
402+
if (Test-Path $legacySkillPath) {
403+
Remove-Item -Recurse -Force $legacySkillPath -ErrorAction SilentlyContinue
404+
$legacySkillsRemoved = $true
405+
}
406+
}
407+
if ($legacySkillsRemoved) {
408+
Write-Host "Removed legacy Plannotator skills from $legacyAgentsSkillsDir"
409+
}
410+
397411
# Install skills (requires git)
398412
if (Get-Command git -ErrorAction SilentlyContinue) {
399413
$claudeSkillsDir = if ($env:CLAUDE_CONFIG_DIR) { "$env:CLAUDE_CONFIG_DIR\skills" } else { "$env:USERPROFILE\.claude\skills" }
400-
$agentsSkillsDir = "$env:USERPROFILE\.agents\skills"
414+
$codexSkillsDir = "$env:USERPROFILE\.codex\skills"
401415
$skillsTmp = Join-Path ([System.IO.Path]::GetTempPath()) "plannotator-skills-$(Get-Random)"
402416
New-Item -ItemType Directory -Force -Path $skillsTmp | Out-Null
403417

@@ -421,10 +435,10 @@ if (Get-Command git -ErrorAction SilentlyContinue) {
421435
$items = Get-ChildItem "apps\skills" -ErrorAction SilentlyContinue
422436
if ($items) {
423437
New-Item -ItemType Directory -Force -Path $claudeSkillsDir | Out-Null
424-
New-Item -ItemType Directory -Force -Path $agentsSkillsDir | Out-Null
438+
New-Item -ItemType Directory -Force -Path $codexSkillsDir | Out-Null
425439
Copy-Item -Recurse -Force "apps\skills\*" $claudeSkillsDir
426-
Copy-Item -Recurse -Force "apps\skills\*" $agentsSkillsDir
427-
Write-Host "Installed skills to $claudeSkillsDir\ and $agentsSkillsDir\"
440+
Copy-Item -Recurse -Force "apps\skills\*" $codexSkillsDir
441+
Write-Host "Installed skills to $claudeSkillsDir\ and $codexSkillsDir\"
428442
}
429443
}
430444
} finally {

scripts/install.sh

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -624,10 +624,25 @@ COMMAND_EOF
624624

625625
echo "Installed /plannotator-last command to ${OPENCODE_COMMANDS_DIR}/plannotator-last.md"
626626

627+
# Remove legacy Codex-oriented skills from the older shared agent scope.
628+
LEGACY_AGENTS_SKILLS_DIR="$HOME/.agents/skills"
629+
legacy_skills_removed=0
630+
if [ -d "$LEGACY_AGENTS_SKILLS_DIR" ]; then
631+
for skill in plannotator-review plannotator-annotate plannotator-last; do
632+
if [ -d "$LEGACY_AGENTS_SKILLS_DIR/$skill" ]; then
633+
rm -rf "$LEGACY_AGENTS_SKILLS_DIR/$skill"
634+
legacy_skills_removed=1
635+
fi
636+
done
637+
fi
638+
if [ "$legacy_skills_removed" -eq 1 ]; then
639+
echo "Removed legacy Plannotator skills from ${LEGACY_AGENTS_SKILLS_DIR}"
640+
fi
641+
627642
# Install skills (requires git)
628643
if command -v git &>/dev/null; then
629644
CLAUDE_SKILLS_DIR="${CLAUDE_CONFIG_DIR:-$HOME/.claude}/skills"
630-
AGENTS_SKILLS_DIR="$HOME/.agents/skills"
645+
CODEX_SKILLS_DIR="$HOME/.codex/skills"
631646
skills_tmp=$(mktemp -d)
632647

633648
# Wrap the cd-bearing block in a subshell so any `cd` is scoped to
@@ -649,11 +664,11 @@ if command -v git &>/dev/null; then
649664
git sparse-checkout set apps/skills 2>/dev/null &&
650665
[ -d "apps/skills" ] &&
651666
[ "$(ls -A apps/skills 2>/dev/null)" ] &&
652-
mkdir -p "$CLAUDE_SKILLS_DIR" "$AGENTS_SKILLS_DIR" &&
667+
mkdir -p "$CLAUDE_SKILLS_DIR" "$CODEX_SKILLS_DIR" &&
653668
cp -r apps/skills/* "$CLAUDE_SKILLS_DIR/" &&
654-
cp -r apps/skills/* "$AGENTS_SKILLS_DIR/"
669+
cp -r apps/skills/* "$CODEX_SKILLS_DIR/"
655670
); then
656-
echo "Installed skills to ${CLAUDE_SKILLS_DIR}/ and ${AGENTS_SKILLS_DIR}/"
671+
echo "Installed skills to ${CLAUDE_SKILLS_DIR}/ and ${CODEX_SKILLS_DIR}/"
657672
else
658673
echo "Skipping skills install (git sparse-checkout failed or apps/skills empty)"
659674
fi

scripts/install.test.ts

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*/
99

1010
import { describe, expect, test } from "bun:test";
11-
import { readFileSync } from "node:fs";
11+
import { existsSync, readFileSync } from "node:fs";
1212
import { join } from "node:path";
1313

1414
const scriptsDir = import.meta.dir;
@@ -56,10 +56,20 @@ describe("install.sh", () => {
5656
expect(script).toContain("git clone --depth 1 --filter=blob:none --sparse");
5757
expect(script).toContain("git sparse-checkout set apps/skills");
5858
expect(script).toContain("CLAUDE_SKILLS_DIR");
59-
expect(script).toContain("AGENTS_SKILLS_DIR");
59+
expect(script).toContain("CODEX_SKILLS_DIR");
60+
expect(script).toContain("$HOME/.codex/skills");
61+
expect(script).not.toContain('mkdir -p "$CLAUDE_SKILLS_DIR" "$AGENTS_SKILLS_DIR"');
62+
expect(script).not.toContain('cp -r apps/skills/* "$AGENTS_SKILLS_DIR/"');
6063
expect(script).toContain('Skipping skills install (git not found)');
6164
});
6265

66+
test("cleans only legacy command-overlap agent skills", () => {
67+
expect(script).toContain("LEGACY_AGENTS_SKILLS_DIR");
68+
expect(script).toContain("plannotator-review plannotator-annotate plannotator-last");
69+
expect(script).not.toContain("plannotator-review plannotator-annotate plannotator-last plannotator-compound");
70+
expect(script).not.toContain("plannotator-review plannotator-annotate plannotator-last plannotator-setup-goal");
71+
});
72+
6373
test("installs slash commands for Claude Code and OpenCode", () => {
6474
expect(script).toContain("plannotator-review.md");
6575
expect(script).toContain("plannotator-annotate.md");
@@ -147,10 +157,19 @@ describe("install.ps1", () => {
147157
expect(script).toContain("git clone --depth 1 --filter=blob:none --sparse");
148158
expect(script).toContain("git sparse-checkout set apps/skills");
149159
expect(script).toContain("claudeSkillsDir");
150-
expect(script).toContain("agentsSkillsDir");
160+
expect(script).toContain("codexSkillsDir");
161+
expect(script).toContain("$env:USERPROFILE\\.codex\\skills");
162+
expect(script).not.toContain('$agentsSkillsDir = "$env:USERPROFILE\\.agents\\skills"');
151163
expect(script).toContain('Skipping skills install (git not found)');
152164
});
153165

166+
test("cleans only legacy command-overlap agent skills", () => {
167+
expect(script).toContain("legacyAgentsSkillsDir");
168+
expect(script).toContain('"plannotator-review", "plannotator-annotate", "plannotator-last"');
169+
expect(script).not.toContain('"plannotator-review", "plannotator-annotate", "plannotator-last", "plannotator-compound"');
170+
expect(script).not.toContain('"plannotator-review", "plannotator-annotate", "plannotator-last", "plannotator-setup-goal"');
171+
});
172+
154173
test("installs slash commands", () => {
155174
expect(script).toContain("plannotator-review.md");
156175
expect(script).toContain("plannotator-annotate.md");
@@ -208,10 +227,19 @@ describe("install.cmd", () => {
208227
expect(script).toContain("git clone --depth 1 --filter=blob:none --sparse");
209228
expect(script).toContain("git sparse-checkout set apps/skills");
210229
expect(script).toContain("CLAUDE_SKILLS_DIR");
211-
expect(script).toContain("AGENTS_SKILLS_DIR");
230+
expect(script).toContain("CODEX_SKILLS_DIR");
231+
expect(script).toContain("%USERPROFILE%\\.codex\\skills");
232+
expect(script).not.toContain('set "AGENTS_SKILLS_DIR=%USERPROFILE%\\.agents\\skills"');
212233
expect(script).toContain("Skipping skills install");
213234
});
214235

236+
test("cleans only legacy command-overlap agent skills", () => {
237+
expect(script).toContain("LEGACY_AGENTS_SKILLS_DIR");
238+
expect(script).toContain("plannotator-review plannotator-annotate plannotator-last");
239+
expect(script).not.toContain("plannotator-review plannotator-annotate plannotator-last plannotator-compound");
240+
expect(script).not.toContain("plannotator-review plannotator-annotate plannotator-last plannotator-setup-goal");
241+
});
242+
215243
test("installs slash commands", () => {
216244
expect(script).toContain("plannotator-review.md");
217245
expect(script).toContain("plannotator-annotate.md");
@@ -246,6 +274,15 @@ describe("install.cmd", () => {
246274
});
247275
});
248276

277+
describe("Codex Plannotator skills", () => {
278+
test("command-overlap skills include OpenAI agent config", () => {
279+
for (const skill of ["plannotator-review", "plannotator-annotate", "plannotator-last"]) {
280+
const configPath = join(scriptsDir, "..", "apps", "skills", skill, "agents", "openai.yaml");
281+
expect(existsSync(configPath)).toBe(true);
282+
}
283+
});
284+
});
285+
249286
describe("install shared behavior", () => {
250287
const sh = readFileSync(join(scriptsDir, "install.sh"), "utf-8");
251288
const ps = readFileSync(join(scriptsDir, "install.ps1"), "utf-8");

0 commit comments

Comments
 (0)