Skip to content

Commit 891235a

Browse files
authored
Merge pull request #19 from baskduf/feat/version-update-commands
feat: add version and update commands
2 parents 3928f6e + d38b42c commit 891235a

8 files changed

Lines changed: 324 additions & 0 deletions

File tree

README.ja.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ codex-fable5 findings gate
196196
| コマンド | 目的 |
197197
| --- | --- |
198198
| `codex-fable5 status` | findings と goal の進捗を表示します。 |
199+
| `codex-fable5 version` | インストール済み plugin version、パス、git checkout 状態を表示します。 |
200+
| `codex-fable5 update` | FableCodex checkout/plugin package を最新の安定版 `v*` tag に更新します。 |
199201
| `codex-fable5 goals create` | ローカルの multi-step goal ledger を作成します。 |
200202
| `codex-fable5 goals next` | 次の goal を開始または再開します。 |
201203
| `codex-fable5 goals checkpoint` | evidence 付きで goal を complete、failed、blocked にします。 |
@@ -210,6 +212,8 @@ codex-fable5 findings gate
210212
plugins/codex-fable5/bin/codex-fable5 status
211213
```
212214

215+
`codex-fable5 update` が変更するのは FableCodex checkout/plugin package だけです。model access、provider credential、hidden runtime behavior は変更しません。最新の安定版ではなく開発 branch を意図的に使う場合だけ、`codex-fable5 update --ref main` を使用してください。
216+
213217
## インストール方法
214218

215219
安定版:

README.ko.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ codex-fable5 findings gate
196196
| 명령어 | 용도 |
197197
| --- | --- |
198198
| `codex-fable5 status` | findings와 goal 진행 상태를 봅니다. |
199+
| `codex-fable5 version` | 설치된 plugin version, 경로, git checkout 상태를 봅니다. |
200+
| `codex-fable5 update` | FableCodex checkout/plugin package를 최신 안정 `v*` tag로 업데이트합니다. |
199201
| `codex-fable5 goals create` | 로컬 multi-step goal ledger를 만듭니다. |
200202
| `codex-fable5 goals next` | 다음 goal을 시작하거나 재개합니다. |
201203
| `codex-fable5 goals checkpoint` | goal을 evidence와 함께 complete, failed, blocked로 표시합니다. |
@@ -210,6 +212,8 @@ codex-fable5 findings gate
210212
plugins/codex-fable5/bin/codex-fable5 status
211213
```
212214

215+
`codex-fable5 update`는 FableCodex checkout/plugin package만 변경합니다. model access, provider credential, hidden runtime behavior는 바꾸지 않습니다. 최신 안정 release가 아니라 개발 branch를 의도적으로 쓰려면 `codex-fable5 update --ref main`을 사용하세요.
216+
213217
## 설치 옵션
214218

215219
안정 버전:

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ The gate fails while `open` or `blocked` findings remain. Final goal completion
196196
| Command | Purpose |
197197
| --- | --- |
198198
| `codex-fable5 status` | Show findings and goal progress. |
199+
| `codex-fable5 version` | Show the installed plugin version, paths, and git checkout state. |
200+
| `codex-fable5 update` | Update the FableCodex checkout/plugin package to the latest stable `v*` tag. |
199201
| `codex-fable5 goals create` | Create a local multi-step goal ledger. |
200202
| `codex-fable5 goals next` | Start or resume the next goal. |
201203
| `codex-fable5 goals checkpoint` | Mark a goal complete, failed, or blocked with evidence. |
@@ -210,6 +212,8 @@ Without changing `PATH`, run the checkout helper directly:
210212
plugins/codex-fable5/bin/codex-fable5 status
211213
```
212214

215+
`codex-fable5 update` changes only the FableCodex checkout/plugin package. It does not change model access, provider credentials, or hidden runtime behavior. Use `codex-fable5 update --ref main` only when you intentionally want the development branch instead of the latest stable release.
216+
213217
## Install Options
214218

215219
Stable release:

README.zh-CN.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ codex-fable5 findings gate
196196
| 命令 | 用途 |
197197
| --- | --- |
198198
| `codex-fable5 status` | 查看 findings 和 goal 进度。 |
199+
| `codex-fable5 version` | 显示已安装的 plugin version、路径和 git checkout 状态。 |
200+
| `codex-fable5 update` | 将 FableCodex checkout/plugin package 更新到最新稳定 `v*` tag。 |
199201
| `codex-fable5 goals create` | 创建本地 multi-step goal ledger。 |
200202
| `codex-fable5 goals next` | 开始或继续下一个 goal。 |
201203
| `codex-fable5 goals checkpoint` | 带 evidence 将 goal 标记为 complete、failed 或 blocked。 |
@@ -210,6 +212,8 @@ codex-fable5 findings gate
210212
plugins/codex-fable5/bin/codex-fable5 status
211213
```
212214

215+
`codex-fable5 update` 只会更改 FableCodex checkout/plugin package。它不会更改 model access、provider credential 或 hidden runtime behavior。只有在你明确想使用开发 branch 而不是最新稳定版时,才使用 `codex-fable5 update --ref main`
216+
213217
## 安装选项
214218

215219
稳定版:

README.zh-TW.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,8 @@ codex-fable5 findings gate
196196
| 指令 | 用途 |
197197
| --- | --- |
198198
| `codex-fable5 status` | 查看 findings 和 goal 進度。 |
199+
| `codex-fable5 version` | 顯示已安裝的 plugin version、路徑和 git checkout 狀態。 |
200+
| `codex-fable5 update` | 將 FableCodex checkout/plugin package 更新到最新穩定 `v*` tag。 |
199201
| `codex-fable5 goals create` | 建立本地 multi-step goal ledger。 |
200202
| `codex-fable5 goals next` | 開始或繼續下一個 goal。 |
201203
| `codex-fable5 goals checkpoint` | 帶 evidence 將 goal 標記為 complete、failed 或 blocked。 |
@@ -210,6 +212,8 @@ codex-fable5 findings gate
210212
plugins/codex-fable5/bin/codex-fable5 status
211213
```
212214

215+
`codex-fable5 update` 只會變更 FableCodex checkout/plugin package。它不會變更 model access、provider credential 或 hidden runtime behavior。只有在你明確想使用開發 branch 而不是最新穩定版時,才使用 `codex-fable5 update --ref main`
216+
213217
## 安裝選項
214218

215219
穩定版:

plugins/codex-fable5/bin/codex-fable5

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,156 @@
22
set -eu
33

44
SCRIPT_DIR=$(CDPATH= cd "$(dirname "$0")" && pwd)
5+
PLUGIN_ROOT=$(CDPATH= cd "$SCRIPT_DIR/.." && pwd)
6+
REPO_ROOT=$(CDPATH= cd "$PLUGIN_ROOT/../.." && pwd)
7+
MANIFEST="$PLUGIN_ROOT/.codex-plugin/plugin.json"
58
GOALS="$SCRIPT_DIR/../skills/codex-fable5/scripts/codex_goals.py"
69
FINDINGS="$SCRIPT_DIR/../skills/codex-fable5/scripts/codex_findings.py"
10+
SKILL_ROOT=$(CDPATH= cd "$SCRIPT_DIR/../skills/codex-fable5" && pwd)
11+
SKILL="$SKILL_ROOT/SKILL.md"
712

813
usage() {
914
cat <<'EOF'
1015
Usage:
1116
codex-fable5 status
17+
codex-fable5 version
18+
codex-fable5 update [--ref <ref>] [--no-fetch]
1219
codex-fable5 goals <command> [args...]
1320
codex-fable5 findings <command> [args...]
1421
1522
Examples:
1623
codex-fable5 status
24+
codex-fable5 version
25+
codex-fable5 update
26+
codex-fable5 update --ref main
1727
codex-fable5 findings add --title "Missing verification" --evidence "No test evidence"
1828
codex-fable5 findings gate
1929
codex-fable5 goals next
2030
EOF
2131
}
2232

33+
manifest_value() {
34+
key=$1
35+
python3 - "$MANIFEST" "$key" <<'PY'
36+
import json
37+
import sys
38+
path, key = sys.argv[1:]
39+
try:
40+
data = json.loads(open(path, encoding="utf-8").read())
41+
except OSError as exc:
42+
raise SystemExit(f"codex-fable5: could not read manifest: {exc}")
43+
value = data.get(key, "")
44+
print(value if isinstance(value, str) else "")
45+
PY
46+
}
47+
48+
cmd_version() {
49+
name=$(manifest_value name)
50+
version=$(manifest_value version)
51+
printf '%s %s\n' "$name" "$version"
52+
printf 'plugin: %s\n' "$PLUGIN_ROOT"
53+
printf 'skill: %s\n' "$SKILL"
54+
printf 'wrapper: %s\n' "$0"
55+
if git -C "$REPO_ROOT" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
56+
branch=$(git -C "$REPO_ROOT" rev-parse --abbrev-ref HEAD 2>/dev/null || printf 'unknown')
57+
commit=$(git -C "$REPO_ROOT" rev-parse --short HEAD 2>/dev/null || printf 'unknown')
58+
if [ -n "$(git -C "$REPO_ROOT" status --porcelain 2>/dev/null || true)" ]; then
59+
state=dirty
60+
else
61+
state=clean
62+
fi
63+
printf 'git: %s %s %s\n' "$branch" "$commit" "$state"
64+
fi
65+
}
66+
67+
latest_stable_tag() {
68+
git -C "$REPO_ROOT" tag --list 'v[0-9]*' --sort=-v:refname | grep -E '^v[0-9]+(\.[0-9]+)*$' | sed -n '1p'
69+
}
70+
71+
cmd_update() {
72+
ref=""
73+
fetch=1
74+
while [ "$#" -gt 0 ]; do
75+
case "$1" in
76+
--ref)
77+
shift
78+
if [ "$#" -eq 0 ]; then
79+
printf '%s\n' "codex-fable5: --ref requires a value" >&2
80+
exit 2
81+
fi
82+
ref=$1
83+
;;
84+
--no-fetch)
85+
fetch=0
86+
;;
87+
-h|--help|help)
88+
printf '%s\n' "Usage: codex-fable5 update [--ref <ref>] [--no-fetch]"
89+
printf '%s\n' "Default updates the FableCodex checkout/plugin package to the latest stable v* tag."
90+
return 0
91+
;;
92+
*)
93+
printf '%s\n' "codex-fable5: unknown update option '$1'" >&2
94+
exit 2
95+
;;
96+
esac
97+
shift
98+
done
99+
100+
current=$(manifest_value version)
101+
printf 'codex-fable5: current version %s\n' "$current"
102+
printf '%s\n' "codex-fable5: updates the FableCodex checkout/plugin package only; it does not change model/provider access."
103+
104+
if ! git -C "$REPO_ROOT" rev-parse --is-inside-work-tree >/dev/null 2>&1; then
105+
target=${ref:-'<latest-stable-tag>'}
106+
printf '%s\n' "codex-fable5: this installation is not inside a git checkout; update with Codex plugin commands:"
107+
printf ' codex plugin marketplace add baskduf/FableCodex --ref %s\n' "$target"
108+
printf '%s\n' " codex plugin add codex-fable5@fablecodex"
109+
printf '%s\n' "codex-fable5: restart Codex after updating."
110+
return 0
111+
fi
112+
113+
if [ -n "$(git -C "$REPO_ROOT" status --porcelain)" ]; then
114+
printf '%s\n' "codex-fable5: refusing to update a dirty checkout. Commit, stash, or clean local changes first." >&2
115+
exit 1
116+
fi
117+
118+
if [ "$fetch" -eq 1 ]; then
119+
git -C "$REPO_ROOT" fetch --tags --prune --quiet
120+
fi
121+
122+
if [ -z "$ref" ]; then
123+
ref=$(latest_stable_tag)
124+
if [ -z "$ref" ]; then
125+
printf '%s\n' "codex-fable5: no stable v* tags found." >&2
126+
exit 1
127+
fi
128+
fi
129+
130+
if [ "$ref" = "main" ]; then
131+
current_ref=$(git -C "$REPO_ROOT" rev-parse --abbrev-ref HEAD)
132+
if [ "$current_ref" != "main" ]; then
133+
git -C "$REPO_ROOT" checkout main
134+
fi
135+
git -C "$REPO_ROOT" pull --ff-only
136+
printf '%s\n' "codex-fable5: updated to main."
137+
else
138+
if ! git -C "$REPO_ROOT" rev-parse --verify --quiet "$ref^{commit}" >/dev/null; then
139+
printf 'codex-fable5: ref not found: %s\n' "$ref" >&2
140+
exit 1
141+
fi
142+
current_commit=$(git -C "$REPO_ROOT" rev-parse HEAD)
143+
target_commit=$(git -C "$REPO_ROOT" rev-parse "$ref^{commit}")
144+
if [ "$current_commit" = "$target_commit" ]; then
145+
printf 'codex-fable5: already up to date at %s\n' "$ref"
146+
else
147+
git -C "$REPO_ROOT" checkout "$ref"
148+
printf 'codex-fable5: updated to %s\n' "$ref"
149+
fi
150+
fi
151+
152+
printf '%s\n' "codex-fable5: restart Codex to reload the plugin."
153+
}
154+
23155
if [ "$#" -eq 0 ]; then
24156
usage
25157
exit 0
@@ -37,6 +169,13 @@ case "$1" in
37169
printf '%s\n' "codex-fable5: no goal plan"
38170
fi
39171
;;
172+
version|--version|-v)
173+
cmd_version
174+
;;
175+
update)
176+
shift
177+
cmd_update "$@"
178+
;;
40179
findings|finding|f)
41180
shift
42181
exec python3 "$FINDINGS" "$@"

0 commit comments

Comments
 (0)