-
Notifications
You must be signed in to change notification settings - Fork 44
Expand file tree
/
Copy pathinstall_codex_skills.sh
More file actions
executable file
·86 lines (68 loc) · 2.33 KB
/
Copy pathinstall_codex_skills.sh
File metadata and controls
executable file
·86 lines (68 loc) · 2.33 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
#!/usr/bin/env bash
# SPDX-FileCopyrightText: Copyright (c) 2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
set -euo pipefail
OV_REPO="${1:-${OV_REPO:-$HOME/work/ov-blender-hermes-demo/omniverse-labs/projects/ov-blender-example}}"
GUIDE_ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
REPO_ROOT="$(cd "$GUIDE_ROOT/../../../.." && pwd -P)"
LEGACY_GUIDE_ROOT="$REPO_ROOT/examples/blender-omniverse-dgx-station"
CODEX_SKILLS_DIR="${CODEX_SKILLS_DIR:-$HOME/.agents/skills}"
usage() {
cat <<'USAGE'
Install the project Codex coaching skills and link the upstream OV add-on skills.
Usage:
install_codex_skills.sh [ov-blender-example-checkout]
Environment:
OV_REPO Default OV repository checkout
CODEX_SKILLS_DIR Codex user skill directory (default: ~/.agents/skills)
USAGE
}
if [ "${1:-}" = "-h" ] || [ "${1:-}" = "--help" ]; then
usage
exit 0
fi
if [ ! -f "$OV_REPO/skills/manifest.json" ]; then
echo "official OV project with skills not found: $OV_REPO" >&2
exit 1
fi
mkdir -p "$CODEX_SKILLS_DIR"
link_skill() {
local source_dir="$1"
local legacy_source_dir="${2:-}"
local skill_name target
skill_name="$(basename "$source_dir")"
target="$CODEX_SKILLS_DIR/$skill_name"
if [ ! -f "$source_dir/SKILL.md" ]; then
return
fi
if [ -n "$legacy_source_dir" ] && [ -L "$target" ] \
&& [ "$(readlink "$target")" = "$legacy_source_dir" ]; then
rm "$target"
echo "migrating moved project skill: $skill_name"
fi
if [ -L "$target" ] && [ "$(readlink -f "$target")" = "$(readlink -f "$source_dir")" ]; then
echo "already linked: $skill_name"
return
fi
if [ -e "$target" ] || [ -L "$target" ]; then
echo "refusing to replace existing Codex skill: $target" >&2
exit 1
fi
ln -s "$(readlink -f "$source_dir")" "$target"
echo "linked: $skill_name"
}
project_count=0
for skill_dir in "$GUIDE_ROOT"/codex-skills/*; do
if [ -f "$skill_dir/SKILL.md" ]; then
link_skill "$skill_dir" "$LEGACY_GUIDE_ROOT/codex-skills/$(basename "$skill_dir")"
project_count=$((project_count + 1))
fi
done
count=0
for skill_dir in "$OV_REPO"/skills/*; do
if [ -f "$skill_dir/SKILL.md" ]; then
link_skill "$skill_dir"
count=$((count + 1))
fi
done
echo "Linked $project_count project coaching skills and $count upstream OV skills from $OV_REPO"