首次提交
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
# 寸进(InchStep)项目技能注册脚本
|
||||
# 将 project/skills/ 下的技能注册到 Codex 可识别的路径
|
||||
# 用法: powershell -ExecutionPolicy Bypass .\scripts\setup-skills.ps1
|
||||
|
||||
$CODEX_SKILLS = "$env:USERPROFILE\.codex\skills"
|
||||
$PROJECT_SKILLS = "$PSScriptRoot\..\skills"
|
||||
|
||||
if (-not (Test-Path $CODEX_SKILLS)) {
|
||||
New-Item -Path $CODEX_SKILLS -ItemType Directory -Force | Out-Null
|
||||
}
|
||||
|
||||
Get-ChildItem $PROJECT_SKILLS -Directory | ForEach-Object {
|
||||
$skillName = $_.Name
|
||||
$globalPath = Join-Path $CODEX_SKILLS $skillName
|
||||
$projectPath = $_.FullName
|
||||
|
||||
if (Test-Path $globalPath) {
|
||||
# 检查是否已经是 junctions
|
||||
if ((Get-Item $globalPath).LinkType -eq 'Junction') {
|
||||
Write-Host "[SKIP] $skillName - 已是 junction 链接"
|
||||
return
|
||||
}
|
||||
# 备份后删除
|
||||
$backup = "$globalPath.bak"
|
||||
if (-not (Test-Path $backup)) {
|
||||
Rename-Item $globalPath $backup
|
||||
Write-Host "[BACKUP] $skillName -> $backup"
|
||||
}
|
||||
Remove-Item $globalPath -Recurse -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
# 创建 junction(目录符号链接)
|
||||
New-Item -Path $globalPath -ItemType Junction -Target $projectPath -Force | Out-Null
|
||||
Write-Host "[LINK] $skillName -> $projectPath"
|
||||
}
|
||||
|
||||
Write-Host "`n技能注册完成。重启 Codex 后生效。"
|
||||
Write-Host "提示: 编辑 project/skills/ 下的文件会同步反映到 Codex。"
|
||||
Reference in New Issue
Block a user