docs(session): add restart-safe recovery workflow
Context: - codex cli 중단 후에도 작업 품질과 맥락을 안정적으로 복구하기 위해 Changes: - docs/00~07, 90 문서 세트 추가/정리 - commit convention 문서 및 .gitmessage-session.txt 템플릿 추가 - scripts/session/recover-context.sh 추가 - package.json에 session:recover 스크립트 추가 Validation: - npm run session:recover Session-State: session recovery docs, template, and script are in place Session-Next: apply this commit format to feature and refactor commits Session-Risks: legacy commits before this change do not include session trailers
This commit is contained in:
54
scripts/session/recover-context.sh
Executable file
54
scripts/session/recover-context.sh
Executable file
@@ -0,0 +1,54 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
set -euo pipefail
|
||||
|
||||
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
|
||||
cd "${ROOT_DIR}"
|
||||
|
||||
RECENT_COUNT="${1:-8}"
|
||||
|
||||
print_section() {
|
||||
local section_title="$1"
|
||||
local next_section="$2"
|
||||
if [[ -f docs/90_current_state.md ]]; then
|
||||
if [[ -n "${next_section}" ]]; then
|
||||
awk "/^## ${section_title}\$/{flag=1} /^## ${next_section}\$/{flag=0} flag" docs/90_current_state.md
|
||||
else
|
||||
awk "/^## ${section_title}\$/{flag=1} flag" docs/90_current_state.md
|
||||
fi
|
||||
fi
|
||||
}
|
||||
|
||||
echo "== Session Recovery =="
|
||||
echo "repo: ${ROOT_DIR}"
|
||||
echo "branch: $(git rev-parse --abbrev-ref HEAD)"
|
||||
echo "head: $(git log -1 --pretty=format:'%h %s (%ci)')"
|
||||
echo
|
||||
|
||||
echo "== Working Tree =="
|
||||
git status --short
|
||||
echo
|
||||
|
||||
echo "== Recent Commits (${RECENT_COUNT}) =="
|
||||
git log --oneline --decorate -n "${RECENT_COUNT}"
|
||||
echo
|
||||
|
||||
echo "== HEAD Commit Body =="
|
||||
git show -s --format=%B HEAD
|
||||
echo
|
||||
|
||||
echo "== HEAD Changed Files =="
|
||||
git show --name-status --pretty=format: HEAD | sed '/^$/d'
|
||||
echo
|
||||
|
||||
if [[ -f docs/90_current_state.md ]]; then
|
||||
echo "== docs/90_current_state.md =="
|
||||
print_section "DONE" "NEXT"
|
||||
echo
|
||||
print_section "NEXT" "RISKS"
|
||||
echo
|
||||
print_section "RISKS" "CHANGED FILES"
|
||||
echo
|
||||
print_section "CHANGED FILES" "QUICK VERIFY"
|
||||
echo
|
||||
fi
|
||||
Reference in New Issue
Block a user