Portabilize hardcoded C:\Users\bowei paths across skill docs

Replace machine-specific C:\Users\bowei\... paths in 7 skill docs with
%USERPROFILE% / $env:USERPROFILE (or $USERPROFILE in Git Bash blocks).
Conda paths use a two-layout resolver (miniconda3\envs vs .conda\envs) or
reference ~\skills_env.md CONDA_LANGGRAPH_PYTHON, since the conda location
is machine-specific. Fixes paths that resolved wrong on non-bowei machines.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
bowei
2026-07-20 20:35:43 +08:00
co-authored by Claude Opus 4.8
parent 2ad9206a88
commit fbfa060b67
7 changed files with 48 additions and 45 deletions
+19 -16
View File
@@ -5,7 +5,7 @@ description: Use the LangGraph plan-review workflow from the current Claude Code
# LangGraph Plan Review Workflow
Use this skill to run the LangGraph plan-review workflow. All scripts are bundled under the skill's own `scripts\` directory (`C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\`) — no dependency on `E:\LangGraph_Design\lab00`.
Use this skill to run the LangGraph plan-review workflow. All scripts are bundled under the skill's own `scripts\` directory (`%USERPROFILE%\.claude\skills\langgraph-plan-review\scripts\`) — no dependency on `E:\LangGraph_Design\lab00`.
## 运行方式:进程内驱动,无 dev server(2026-07 起)
@@ -16,8 +16,9 @@ Use this skill to run the LangGraph plan-review workflow. All scripts are bundle
- **入口**:用 `langgraph` conda 环境的 python 跑 `clean_run.py`:
```powershell
$PY = "C:\Users\bowei\.conda\envs\langgraph\python.exe"
$RUN = "C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\clean_run.py"
# CONDA_LANGGRAPH_PYTHON from ~\skills_env.md; resolves either conda layout.
$PY = @("$env:USERPROFILE\miniconda3\envs\langgraph\python.exe","$env:USERPROFILE\.conda\envs\langgraph\python.exe") | Where-Object { Test-Path $_ } | Select-Object -First 1
$RUN = "$env:USERPROFILE\.claude\skills\langgraph-plan-review\scripts\clean_run.py"
# 首次(到 write_plan 中断):
& $PY $RUN --task-id 10 --work-dir "<work_dir>" --notes-dir Notes --prompt "<原始请求>"
# resume(写完/改完 Task10.md 后;resume 值 base64(JSON)):
@@ -61,7 +62,7 @@ conda run -n langgraph langgraph --version
| `langgraph-sdk` | Python client used by `run_workflow.py` to submit runs |
| `httpx` | HTTP health-check in `run_workflow.py` |
**Codex auth** (if not already set up): `C:\Users\bowei\.codex\auth.json` must contain a valid ChatGPT OAuth token. Run `codex auth login` if the file is missing.
**Codex auth** (if not already set up): `%USERPROFILE%\.codex\auth.json` must contain a valid ChatGPT OAuth token. Run `codex auth login` if the file is missing.
## Invariants
@@ -72,8 +73,8 @@ conda run -n langgraph langgraph --version
```powershell
<resolved conda.exe> run -n langgraph python
```
- Codex CLI is installed in the `langgraph` conda env as `codex.cmd` at `C:\Users\bowei\.conda\envs\langgraph\codex.cmd`. It must be invoked via `cmd /c` because `.cmd` files are not directly executable by Python subprocess on Windows.
- Codex auth uses ChatGPT OAuth tokens stored in `C:\Users\bowei\.codex\auth.json`. No API key is needed.
- Codex CLI is installed in the `langgraph` conda env as `codex.cmd` (path = the langgraph env from `~\skills_env.md` `CONDA_LANGGRAPH_PYTHON`, with `python.exe` → `codex.cmd`). It must be invoked via `cmd /c` because `.cmd` files are not directly executable by Python subprocess on Windows.
- Codex auth uses ChatGPT OAuth tokens stored in `%USERPROFILE%\.codex\auth.json`. No API key is needed.
- `run_langgraph.ps1` sets `CODEX_HOME` from `-CodexHome`, existing `CODEX_HOME`, or `<UserProfile>\.codex`.
- **Always use `review_task.py` as the Codex review shim.** Pass it via `--codex-review-command` as a JSON array with no spaces. This shim handles all Windows-specific codex invocation requirements: `cmd /c`, stdin prompt passing, `--skip-git-repo-check`, session resume, and explicit `cwd`.
- Keep all workflow files under `<Claude launch work_dir>\Notes` unless the user explicitly overrides `-NotesDir`.
@@ -92,13 +93,13 @@ Use `manage_dev_server.ps1` to start it before the first `run_langgraph.ps1` cal
```powershell
# Start (idempotent — safe to call even if already running)
C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 start
$env:USERPROFILE\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 start
# Stop (call once when workflow returns {"status":"done"})
C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 stop
$env:USERPROFILE\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 stop
# Status check
C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 status
$env:USERPROFILE\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 status
```
- `start` waits up to 45 s for `http://127.0.0.1:2024/ok` to respond, then prints the Studio URL.
@@ -116,7 +117,7 @@ C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps
1. Determine `TaskId` from the user. If missing, ask for it.
2. Start the dev server (idempotent):
```powershell
C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 start
$env:USERPROFILE\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 start
```
Wait for the "[dev-server] Ready" line in the output. Then **immediately tell the user** in your text response:
- that the dev server is running, and
@@ -127,10 +128,12 @@ C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps
> https://smith.langchain.com/studio/?baseUrl=http://127.0.0.1:2024
3. Start or resume the LangGraph app:
```powershell
# Use double backslashes (\\) in the JSON string so Windows paths are valid JSON.
# $task_path / $latest_discuss_path / etc. are Python Template placeholders — keep them literal.
$codexCmd = '["C:\\Users\\bowei\\.conda\\envs\\langgraph\\python.exe","C:\\Users\\bowei\\.claude\\skills\\langgraph-plan-review\\scripts\\review_task.py","$task_path","$latest_discuss_path","$codex_session_id","$work_dir"]'
C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\run_langgraph.ps1 `
# Build the JSON array with ConvertTo-Json so Windows backslashes are escaped for you.
# $task_path / $latest_discuss_path / etc. are Python Template placeholders — single-quote them literal.
$PY = @("$env:USERPROFILE\miniconda3\envs\langgraph\python.exe","$env:USERPROFILE\.conda\envs\langgraph\python.exe") | Where-Object { Test-Path $_ } | Select-Object -First 1
$review = "$env:USERPROFILE\.claude\skills\langgraph-plan-review\scripts\review_task.py"
$codexCmd = ConvertTo-Json -Compress @($PY,$review,'$task_path','$latest_discuss_path','$codex_session_id','$work_dir')
& "$env:USERPROFILE\.claude\skills\langgraph-plan-review\scripts\run_langgraph.ps1" `
-TaskId <TaskId> `
-Prompt "<original user request>" `
-CodexReviewCommand $codexCmd `
@@ -144,13 +147,13 @@ C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps
**Why `review_task.py`**: Using the shim keeps all codex-specific logic in Python, and the JSON array stays simple.
`run_langgraph.ps1` base64-encodes the JSON command and resume payload before passing them through `conda run`, so normal PowerShell single-quoted JSON can be used. **Windows paths inside the JSON string must use `\\` (double backslash) to produce valid JSON**, e.g. `C:\\Users\\bowei\\...`. `run_langgraph.ps1` automatically sets `PYTHONIOENCODING=utf-8` so prompts containing Unicode (Chinese, etc.) pass through correctly.
`run_langgraph.ps1` base64-encodes the JSON command and resume payload before passing them through `conda run`, so normal PowerShell single-quoted JSON can be used. **Windows paths inside the JSON string must use `\\` (double backslash) to produce valid JSON** (`ConvertTo-Json` does this for you), e.g. `%USERPROFILE%\\...`. `run_langgraph.ps1` automatically sets `PYTHONIOENCODING=utf-8` so prompts containing Unicode (Chinese, etc.) pass through correctly.
5. Inspect the command output after each resume.
- Check `"status"` to determine next action: `"waiting"` means perform the next `action_required`; `"done"` means the workflow is complete.
- If a new `latest_discuss_path` is present in the output, read that discuss file for context.
6. Stop when the workflow returns `{"status":"done", ...}`:
```powershell
C:\Users\bowei\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 stop
$env:USERPROFILE\.claude\skills\langgraph-plan-review\scripts\manage_dev_server.ps1 stop
```
## Rejection File Rule