chore: import upstream snapshot with attribution
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$scriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
|
||||
$skillDir = Split-Path -Parent $scriptDir
|
||||
$repoRoot = Split-Path -Parent $skillDir
|
||||
$pluginDir = Join-Path $repoRoot "cli-anything-plugin"
|
||||
$previewProtocol = Join-Path $repoRoot "docs/PREVIEW_PROTOCOL.md"
|
||||
|
||||
$codexHome = if ($env:CODEX_HOME) {
|
||||
$env:CODEX_HOME
|
||||
} elseif ($env:USERPROFILE) {
|
||||
Join-Path $env:USERPROFILE ".codex"
|
||||
} else {
|
||||
throw "CODEX_HOME is not set and USERPROFILE is unavailable."
|
||||
}
|
||||
|
||||
$destRoot = Join-Path $codexHome "skills"
|
||||
$destDir = Join-Path $destRoot "cli-anything"
|
||||
$stagingDir = $null
|
||||
|
||||
if (-not (Test-Path (Join-Path $pluginDir "HARNESS.md"))) {
|
||||
throw "Cannot find canonical CLI-Anything resources at: $pluginDir`nRun this installer from a full CLI-Anything repository checkout."
|
||||
}
|
||||
|
||||
if (-not (Test-Path $previewProtocol)) {
|
||||
throw "Cannot find preview protocol at: $previewProtocol`nRun this installer from a full CLI-Anything repository checkout."
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Path $destRoot -Force | Out-Null
|
||||
|
||||
if (Test-Path $destDir) {
|
||||
throw "Refusing to overwrite existing skill: $destDir`nRemove it manually if you want to reinstall."
|
||||
}
|
||||
|
||||
try {
|
||||
$stagingDir = Join-Path $destRoot (".cli-anything.tmp." + [System.Guid]::NewGuid().ToString("N"))
|
||||
New-Item -ItemType Directory -Path $stagingDir | Out-Null
|
||||
Get-ChildItem -LiteralPath $skillDir -Force | Copy-Item -Destination $stagingDir -Recurse -Force
|
||||
|
||||
$referenceDir = Join-Path $stagingDir "references"
|
||||
$referenceCommands = Join-Path $referenceDir "commands"
|
||||
$referenceDocs = Join-Path $referenceDir "docs"
|
||||
$referenceGuides = Join-Path $referenceDir "guides"
|
||||
$resourceScripts = Join-Path $stagingDir "scripts"
|
||||
$scriptTemplates = Join-Path $resourceScripts "templates"
|
||||
|
||||
New-Item -ItemType Directory -Path $referenceCommands, $referenceDocs, $referenceGuides, $scriptTemplates -Force | Out-Null
|
||||
|
||||
Copy-Item -Path (Join-Path $pluginDir "HARNESS.md") -Destination (Join-Path $referenceDir "HARNESS.md")
|
||||
Copy-Item -Path (Join-Path $pluginDir "commands/*.md") -Destination $referenceCommands
|
||||
Copy-Item -Path (Join-Path $pluginDir "guides/*.md") -Destination $referenceGuides
|
||||
Copy-Item -Path (Join-Path $pluginDir "repl_skin.py") -Destination (Join-Path $resourceScripts "repl_skin.py")
|
||||
Copy-Item -Path (Join-Path $pluginDir "preview_bundle.py") -Destination (Join-Path $resourceScripts "preview_bundle.py")
|
||||
Copy-Item -Path (Join-Path $pluginDir "skill_generator.py") -Destination (Join-Path $resourceScripts "skill_generator.py")
|
||||
Copy-Item -Path (Join-Path $pluginDir "templates/*") -Destination $scriptTemplates
|
||||
Copy-Item -Path $previewProtocol -Destination (Join-Path $referenceDocs "PREVIEW_PROTOCOL.md")
|
||||
|
||||
Move-Item -Path $stagingDir -Destination $destDir
|
||||
} finally {
|
||||
if ($stagingDir -and (Test-Path $stagingDir)) {
|
||||
Remove-Item -Path $stagingDir -Recurse -Force
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "Installed Codex skill to: $destDir"
|
||||
Write-Host "Vendored CLI-Anything methodology resources into the installed skill."
|
||||
Write-Host "Restart Codex to pick up the new skill."
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
SKILL_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
|
||||
REPO_ROOT="$(cd "${SKILL_DIR}/.." && pwd)"
|
||||
PLUGIN_DIR="${REPO_ROOT}/cli-anything-plugin"
|
||||
PREVIEW_PROTOCOL="${REPO_ROOT}/docs/PREVIEW_PROTOCOL.md"
|
||||
DEST_ROOT="${CODEX_HOME:-$HOME/.codex}/skills"
|
||||
DEST_DIR="${DEST_ROOT}/cli-anything"
|
||||
STAGING_DIR=""
|
||||
|
||||
if [[ ! -f "${PLUGIN_DIR}/HARNESS.md" ]]; then
|
||||
echo "Cannot find canonical CLI-Anything resources at: ${PLUGIN_DIR}" >&2
|
||||
echo "Run this installer from a full CLI-Anything repository checkout." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [[ ! -f "${PREVIEW_PROTOCOL}" ]]; then
|
||||
echo "Cannot find preview protocol at: ${PREVIEW_PROTOCOL}" >&2
|
||||
echo "Run this installer from a full CLI-Anything repository checkout." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
mkdir -p "${DEST_ROOT}"
|
||||
|
||||
if [[ -e "${DEST_DIR}" ]]; then
|
||||
echo "Refusing to overwrite existing skill: ${DEST_DIR}" >&2
|
||||
echo "Remove it manually if you want to reinstall." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
cleanup() {
|
||||
if [[ -n "${STAGING_DIR}" && -d "${STAGING_DIR}" ]]; then
|
||||
rm -rf "${STAGING_DIR}"
|
||||
fi
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
STAGING_DIR="$(mktemp -d "${DEST_ROOT}/.cli-anything.tmp.XXXXXX")"
|
||||
cp -R "${SKILL_DIR}/." "${STAGING_DIR}/"
|
||||
mkdir -p \
|
||||
"${STAGING_DIR}/references/commands" \
|
||||
"${STAGING_DIR}/references/docs" \
|
||||
"${STAGING_DIR}/references/guides" \
|
||||
"${STAGING_DIR}/scripts/templates"
|
||||
|
||||
cp "${PLUGIN_DIR}/HARNESS.md" "${STAGING_DIR}/references/HARNESS.md"
|
||||
cp "${PLUGIN_DIR}/commands/"*.md "${STAGING_DIR}/references/commands/"
|
||||
cp "${PLUGIN_DIR}/guides/"*.md "${STAGING_DIR}/references/guides/"
|
||||
cp "${PLUGIN_DIR}/repl_skin.py" "${STAGING_DIR}/scripts/repl_skin.py"
|
||||
cp "${PLUGIN_DIR}/preview_bundle.py" "${STAGING_DIR}/scripts/preview_bundle.py"
|
||||
cp "${PLUGIN_DIR}/skill_generator.py" "${STAGING_DIR}/scripts/skill_generator.py"
|
||||
cp "${PLUGIN_DIR}/templates/"* "${STAGING_DIR}/scripts/templates/"
|
||||
cp "${PREVIEW_PROTOCOL}" "${STAGING_DIR}/references/docs/PREVIEW_PROTOCOL.md"
|
||||
|
||||
mv "${STAGING_DIR}" "${DEST_DIR}"
|
||||
|
||||
echo "Installed Codex skill to: ${DEST_DIR}"
|
||||
echo "Vendored CLI-Anything methodology resources into the installed skill."
|
||||
echo "Restart Codex to pick up the new skill."
|
||||
Reference in New Issue
Block a user