返回 last30days-skill
digg-cli-agent-path-setup-wizard.md
根目录 / docs / solutions / integration-issues / digg-cli-agent-path-setup-wizard.md
1 ---
2 title: Digg NUX must match printing-press-library install paths and agent subprocess PATH
3 date: 2026-06-17
4 category: docs/solutions/integration-issues
5 module: lib/setup_wizard
6 problem_type: integration_issue
7 component: development_workflow
8 severity: medium
9 symptoms:
10 - Digg source silently off after first-run setup reports success on Hermes or OpenClaw
11 - Users who already installed pp-digg via printing-press-library still see Digg missing from --diagnose available_sources
12 - Setup wizard probed ~/go/bin while the catalog installer writes to ~/.local/bin (printing-press-library 0.1.16+)
13 - OpenClaw setup --openclaw path skipped Digg install entirely
14 root_cause: config_error
15 resolution_type: code_fix
16 related_components:
17 - lib/pipeline
18 - lib/digg
19 - CONFIGURATION.md
20 tags:
21 - digg
22 - setup-wizard
23 - printing-press-library
24 - agent-path
25 - hermes
26 - openclaw
27 - nux
28 - optional-cli-sources
29 ---
30
31 # Digg NUX must match printing-press-library install paths and agent subprocess PATH
32
33 ## Problem
34
35 First-run setup auto-install for `digg-pp-cli` could report success while the engine still omitted Digg, especially on Hermes and OpenClaw where the agent subprocess PATH often excludes `$HOME/.local/bin`. The initial PR also used the deprecated `@mvanhorn/printing-press` package and probed legacy `~/go/bin` fallbacks instead of the current Printing Press default install dir.
36
37 ## Symptoms
38
39 - `--diagnose` `available_sources` lacks `digg` even though pp-digg or setup "installed" the CLI.
40 - Hermes/OpenClaw users with a prior `npx @mvanhorn/printing-press-library install digg --cli-only` run hit false failures or false "now active" messages depending on probe logic.
41 - OpenClaw `setup --openclaw` never attempted Digg install (desktop NUX only).
42
43 ## What Didn't Work
44
45 - **Treating "binary exists somewhere" as installed** — `pipeline.available_sources()` and `digg._is_available()` gate on `shutil.which("digg-pp-cli")` only. Probing `~/go/bin` without PATH visibility produced false positives.
46 - **Assuming Hermes vs OpenClaw use different binary locations** — both harnesses use the same printing-press-library default (`$HOME/.local/bin`); only the focused pp-digg *skill* wiring differs.
47 - **Using `@mvanhorn/printing-press`** — superseded by `@mvanhorn/printing-press-library`; install defaults moved from `$GOPATH/bin` to `$HOME/.local/bin` in npm 0.1.16.
48
49 ## Solution
50
51 Align setup wizard with the catalog installer and the engine PATH gate:
52
53 1. **Pin installer:** `npx -y @mvanhorn/printing-press-library@<pin> install digg --cli-only` (`--cli-only` only — last30days embeds Digg as an engine source, not pp-digg skill). The pin is `health.PRINTING_PRESS_NPM`, the only copy in `lib/` (0.1.27 as of 2026-11); `setup_wizard` imports it, so setup and doctor cannot drift apart. `health.helper_upgrade_cmd(slug)` renders the command.
54 2. **Split outcomes:** `already_installed` / `installed` / `upgraded` only when `shutil.which` resolves; `installed_off_path` when the binary exists under known dirs (`~/.local/bin`, legacy `~/go/bin`, Windows PrintingPress bin) but is not PATH-visible; surface `digg_path` and PATH-restart guidance in status text. On Windows the engine appends the PrintingPress bin dir to its own PATH at startup (`health.add_managed_bin_dir_to_path`, #1434), so binaries there resolve without a manual PATH edit.
55 3. **Upgrade a helper that is too old:** PATH-visible is not enough when the binary predates the call the engine makes. `digg-pp-cli` before 2026.10.1 rejects `search --topic`, which the engine sends whenever `search --help` lists no `--sort` (a Grok Bot box with 2026.7.1 crashed on it). `health.MIN_HELPER_VERSIONS` holds the oldest version the engine can call, per helper; versions compare as dotted integer tuples and never across helpers (`digg-pp-cli 2026.11.1` beside `yahoo-finance-pp-cli 1.0.0`). When the helper on PATH is below its entry, setup re-runs the pinned install and reports `upgraded`, but only after the PATH-resolved binary reads at or above the minimum. A failed upgrade or a missing `npx` reports `install_failed` / `no_npx` with the helper still marked present, plus the manual command. A helper with no entry, or whose `--version` cannot be parsed, is never upgraded. Doctor reports a below-minimum Digg as degraded with the upgrade command, and an unparseable version as unknown, not outdated.
56 4. **OpenClaw parity:** `run_openclaw_setup()` runs the same `_install_digg_cli()` and returns `digg_cli`, `digg_action`, optional `digg_path`.
57 5. **Docs:** CONFIGURATION.md, SKILL.md Step 0, HERMES_SETUP.md, AGENTS.md rule for CLI-gated sources.
58
59 Key helper shape in `setup_wizard.py`:
60
61 ```python
62 def _digg_on_path() -> Optional[str]:
63 return shutil.which(DIGG_CLI_BIN) # engine gate
64
65 def _digg_off_path_binary() -> Optional[str]:
66 for candidate in _digg_bin_candidate_paths(): # ~/.local/bin first
67 if candidate.is_file() and os.access(candidate, os.X_OK):
68 return str(candidate)
69 return None
70 ```
71
72 ## Why This Works
73
74 The engine never reads "is pp-digg skill installed?" — every research run shells out to `digg-pp-cli` by name on PATH. Printing Press already installs to a managed user bin dir and warns when that dir is off PATH; last30days setup must mirror that contract instead of inventing a separate success definition. Detecting off-PATH binaries lets setup reuse prior pp-digg installs without lying about activation.
75
76 ## Prevention
77
78 - When adding NUX auto-install for a CLI-gated source, match the upstream installer's default bin dir and pin the npm semver.
79 - Success messaging must use the same probe as `available_sources()` (`shutil.which`), with a separate off-PATH outcome when the binary exists on disk.
80 - Bump the installer pin in one place (`health.PRINTING_PRESS_NPM`); `tests/test_health.py` fails if a second pinned copy appears in `lib/`.
81 - When a helper release changes a flag the engine sends, add that helper's minimum to `health.MIN_HELPER_VERSIONS`, taken from its release history (the library's per-CLI `CHANGELOG.md`), not guessed.
82 - Cover Hermes/OpenClaw in tests with redirected `HOME` and mocked PATH; add OpenClaw JSON fields when server setup should mirror desktop NUX.
83 - Search `docs/solutions/` for `digg`, `setup-wizard`, and `agent-path` before changing optional-source onboarding.
84
84 lines MARKDOWN