From 68e0e9bbac483441ec0a3c45649aa63ebf77b515 Mon Sep 17 00:00:00 2001 From: Deepanshu Pal <40927968+DeepanshuPal@users.noreply.github.com> Date: Fri, 9 Oct 2026 03:13:27 +0530 Subject: [PATCH] fix(skill): preserve persisted scan options across skill runs Read existing CLI build-config options in fresh and incremental skill scan fragments, keeping corpus boundaries consistent without changing standalone detection API defaults. Regenerate all host artifacts and snapshots. Add rendered-snippet regressions and explicit-override tests. Fixes #4240. AI-Assisted-By: AI coding assistant (cherry picked from commit 3f68952d8044555bcaaa99c338437d01ba0636ec) --- graphify/skill-agents.md | 4 +- graphify/skill-aider.md | 8 +- graphify/skill-amp.md | 4 +- graphify/skill-claw.md | 4 +- graphify/skill-codex.md | 4 +- graphify/skill-copilot.md | 4 +- graphify/skill-devin.md | 8 +- graphify/skill-droid.md | 4 +- graphify/skill-kilo.md | 4 +- graphify/skill-kiro.md | 4 +- graphify/skill-opencode.md | 4 +- graphify/skill-pi.md | 4 +- graphify/skill-trae.md | 4 +- graphify/skill-vscode.md | 4 +- graphify/skill-windows.md | 4 +- graphify/skill.md | 4 +- graphify/skills/agents/references/update.md | 4 +- graphify/skills/amp/references/update.md | 4 +- graphify/skills/claude/references/update.md | 4 +- graphify/skills/claw/references/update.md | 4 +- graphify/skills/codex/references/update.md | 4 +- graphify/skills/copilot/references/update.md | 4 +- graphify/skills/droid/references/update.md | 4 +- graphify/skills/kilo/references/update.md | 4 +- graphify/skills/kiro/references/update.md | 4 +- graphify/skills/opencode/references/update.md | 4 +- graphify/skills/pi/references/update.md | 4 +- graphify/skills/trae/references/update.md | 4 +- graphify/skills/vscode/references/update.md | 4 +- graphify/skills/windows/references/update.md | 4 +- tests/test_skill_persisted_scan_options.py | 76 +++++++++++++++++++ .../expected/graphify__skill-agents.md | 4 +- .../expected/graphify__skill-aider.md | 8 +- .../skillgen/expected/graphify__skill-amp.md | 4 +- .../skillgen/expected/graphify__skill-claw.md | 4 +- .../expected/graphify__skill-codex.md | 4 +- .../expected/graphify__skill-copilot.md | 4 +- .../expected/graphify__skill-devin.md | 8 +- .../expected/graphify__skill-droid.md | 4 +- .../skillgen/expected/graphify__skill-kilo.md | 4 +- .../skillgen/expected/graphify__skill-kiro.md | 4 +- .../expected/graphify__skill-opencode.md | 4 +- tools/skillgen/expected/graphify__skill-pi.md | 4 +- .../skillgen/expected/graphify__skill-trae.md | 4 +- .../expected/graphify__skill-vscode.md | 4 +- .../expected/graphify__skill-windows.md | 4 +- tools/skillgen/expected/graphify__skill.md | 4 +- ...ify__skills__agents__references__update.md | 4 +- ...aphify__skills__amp__references__update.md | 4 +- ...ify__skills__claude__references__update.md | 4 +- ...phify__skills__claw__references__update.md | 4 +- ...hify__skills__codex__references__update.md | 4 +- ...fy__skills__copilot__references__update.md | 4 +- ...hify__skills__droid__references__update.md | 4 +- ...phify__skills__kilo__references__update.md | 4 +- ...phify__skills__kiro__references__update.md | 4 +- ...y__skills__opencode__references__update.md | 4 +- ...raphify__skills__pi__references__update.md | 4 +- ...phify__skills__trae__references__update.md | 4 +- ...ify__skills__vscode__references__update.md | 4 +- ...fy__skills__windows__references__update.md | 4 +- tools/skillgen/fragments/core/aider.md | 8 +- tools/skillgen/fragments/core/core.md | 4 +- tools/skillgen/fragments/core/devin.md | 8 +- .../fragments/references/shared/update.md | 4 +- tools/skillgen/gen.py | 13 ++++ 66 files changed, 299 insertions(+), 70 deletions(-) create mode 100644 tests/test_skill_persisted_scan_options.py diff --git a/graphify/skill-agents.md b/graphify/skill-agents.md index f09e56ca8..435bd1fed 100644 --- a/graphify/skill-agents.md +++ b/graphify/skill-agents.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skill-aider.md b/graphify/skill-aider.md index 97c3afb59..2ca7f3bf2 100644 --- a/graphify/skill-aider.md +++ b/graphify/skill-aider.md @@ -111,7 +111,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) print(json.dumps(result)) " > .graphify_detect.json ``` @@ -772,7 +774,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2)) Path('.graphify_incremental.json').write_text(json.dumps(result)) diff --git a/graphify/skill-amp.md b/graphify/skill-amp.md index f09e56ca8..435bd1fed 100644 --- a/graphify/skill-amp.md +++ b/graphify/skill-amp.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skill-claw.md b/graphify/skill-claw.md index 612da0090..4611240c5 100644 --- a/graphify/skill-claw.md +++ b/graphify/skill-claw.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skill-codex.md b/graphify/skill-codex.md index d826d76e6..952f319b1 100644 --- a/graphify/skill-codex.md +++ b/graphify/skill-codex.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skill-copilot.md b/graphify/skill-copilot.md index 612da0090..4611240c5 100644 --- a/graphify/skill-copilot.md +++ b/graphify/skill-copilot.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skill-devin.md b/graphify/skill-devin.md index af7e532c4..b9be67de9 100644 --- a/graphify/skill-devin.md +++ b/graphify/skill-devin.md @@ -124,7 +124,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) print(json.dumps(result)) " > graphify-out/.graphify_detect.json ``` @@ -911,7 +913,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result)) diff --git a/graphify/skill-droid.md b/graphify/skill-droid.md index ada369b7d..91767d3c3 100644 --- a/graphify/skill-droid.md +++ b/graphify/skill-droid.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skill-kilo.md b/graphify/skill-kilo.md index 9b043233f..73eb3ef61 100644 --- a/graphify/skill-kilo.md +++ b/graphify/skill-kilo.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skill-kiro.md b/graphify/skill-kiro.md index 612da0090..4611240c5 100644 --- a/graphify/skill-kiro.md +++ b/graphify/skill-kiro.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skill-opencode.md b/graphify/skill-opencode.md index 5cb74e81a..aeba6b0df 100644 --- a/graphify/skill-opencode.md +++ b/graphify/skill-opencode.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skill-pi.md b/graphify/skill-pi.md index 612da0090..4611240c5 100644 --- a/graphify/skill-pi.md +++ b/graphify/skill-pi.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skill-trae.md b/graphify/skill-trae.md index 2037e539f..a5878899d 100644 --- a/graphify/skill-trae.md +++ b/graphify/skill-trae.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skill-vscode.md b/graphify/skill-vscode.md index 9002650e4..c3d571d86 100644 --- a/graphify/skill-vscode.md +++ b/graphify/skill-vscode.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skill-windows.md b/graphify/skill-windows.md index 1246089d5..fc2f2ccfd 100644 --- a/graphify/skill-windows.md +++ b/graphify/skill-windows.md @@ -145,7 +145,9 @@ If the import succeeds, print nothing and move straight to Step 2. import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding="utf-8") diff --git a/graphify/skill.md b/graphify/skill.md index 612da0090..4611240c5 100644 --- a/graphify/skill.md +++ b/graphify/skill.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/agents/references/update.md b/graphify/skills/agents/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/agents/references/update.md +++ b/graphify/skills/agents/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/amp/references/update.md b/graphify/skills/amp/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/amp/references/update.md +++ b/graphify/skills/amp/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/claude/references/update.md b/graphify/skills/claude/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/claude/references/update.md +++ b/graphify/skills/claude/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/claw/references/update.md b/graphify/skills/claw/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/claw/references/update.md +++ b/graphify/skills/claw/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/codex/references/update.md b/graphify/skills/codex/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/codex/references/update.md +++ b/graphify/skills/codex/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/copilot/references/update.md b/graphify/skills/copilot/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/copilot/references/update.md +++ b/graphify/skills/copilot/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/droid/references/update.md b/graphify/skills/droid/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/droid/references/update.md +++ b/graphify/skills/droid/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/kilo/references/update.md b/graphify/skills/kilo/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/kilo/references/update.md +++ b/graphify/skills/kilo/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/kiro/references/update.md b/graphify/skills/kiro/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/kiro/references/update.md +++ b/graphify/skills/kiro/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/opencode/references/update.md b/graphify/skills/opencode/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/opencode/references/update.md +++ b/graphify/skills/opencode/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/pi/references/update.md b/graphify/skills/pi/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/pi/references/update.md +++ b/graphify/skills/pi/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/trae/references/update.md b/graphify/skills/trae/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/trae/references/update.md +++ b/graphify/skills/trae/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/vscode/references/update.md b/graphify/skills/vscode/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/vscode/references/update.md +++ b/graphify/skills/vscode/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/graphify/skills/windows/references/update.md b/graphify/skills/windows/references/update.md index bd8e659d3..7325bbbf0 100644 --- a/graphify/skills/windows/references/update.md +++ b/graphify/skills/windows/references/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tests/test_skill_persisted_scan_options.py b/tests/test_skill_persisted_scan_options.py new file mode 100644 index 000000000..86327c2c6 --- /dev/null +++ b/tests/test_skill_persisted_scan_options.py @@ -0,0 +1,76 @@ +"""Skill scans must preserve the CLI's persisted corpus boundaries (#4240).""" +from __future__ import annotations +import json +import re +import subprocess +import sys +from pathlib import Path +import pytest +from graphify import paths +from tools.skillgen import gen +from graphify.detect import detect, save_manifest +from graphify.watch import _write_build_config, _read_build_excludes, _read_build_gitignore + + +def _scan_blocks(): + found = [] + for art in gen.render_all(gen.load_platforms()): + for block in re.findall(r'```bash\n(.*?)```', art.content, re.S): + if "result = detect(Path('INPUT_PATH')" not in block and "result = detect_incremental(Path('INPUT_PATH')" not in block: + continue + m = re.search(r' -c "\n(.*)\n"', block, re.S) + if m: + found.append((art.path, m.group(1).replace('\\"', '"'))) + assert len(found) == 31 + return found + + +@pytest.mark.parametrize('art,source', _scan_blocks(), ids=lambda value: value.split('\n', 1)[0]) +def test_skill_scan_honors_persisted_options(tmp_path, monkeypatch, art, source): + monkeypatch.delenv('GRAPHIFY_OUT', raising=False) + monkeypatch.setattr(paths, 'GRAPHIFY_OUT', 'graphify-out') + corpus = tmp_path / 'corpus' + corpus.mkdir() + subprocess.run(['git', 'init', '-q', str(corpus)], check=True) + (corpus / '.gitignore').write_text('notes/\n', encoding='utf-8') + (corpus / 'notes').mkdir() + (corpus / 'docs').mkdir() + for name in ('notes/a.md', 'docs/b.md', 'docs/skip.md'): + (corpus / name).write_text('# sample\n', encoding='utf-8') + out = tmp_path / 'graphify-out' + _write_build_config(out, excludes=['docs/skip.md'], gitignore=False) + # Match the skill's documented CWD-relative output/manifest layout, with + # INPUT_PATH pointing to a distinct corpus rather than the output parent. + if 'detect_incremental' in source: + files = detect(corpus, gitignore=False, extra_excludes=['docs/skip.md'])['files'] + save_manifest(files, str(out / 'manifest.json'), root=corpus) + # Only exercise the scan contract, not subsequent sidecar/report steps. + src = source.split('result = ', 1)[0] + 'result = ' + source.split('result = ', 1)[1].split('\n', 1)[0] + src += '\nprint(json.dumps(result))\n' + src = src.replace('INPUT_PATH', corpus.as_posix()) + result = subprocess.run([sys.executable, '-c', src], cwd=tmp_path, check=True, capture_output=True, text=True) + data = json.loads(result.stdout) + actual = {Path(f).relative_to(corpus).as_posix() for files in data['files'].values() for f in files} + assert actual == {'notes/a.md', 'docs/b.md'}, art + if 'detect_incremental' in source: + assert data['excluded_files'] == [], art + + +@pytest.mark.parametrize('contents', [None, '{', '[]', '{"gitignore": "false", "excludes": 12}']) +def test_absent_or_malformed_build_options_use_defaults(tmp_path, contents): + if contents is not None: + (tmp_path / '.graphify_build.json').write_text(contents, encoding='utf-8') + assert _read_build_gitignore(tmp_path) is True + assert _read_build_excludes(tmp_path) == [] + + +def test_detection_api_explicit_options_are_not_overridden(tmp_path): + subprocess.run(['git', 'init', '-q', str(tmp_path)], check=True) + (tmp_path / '.gitignore').write_text('notes/\n', encoding='utf-8') + (tmp_path / 'notes').mkdir() + for name in ('notes/a.md', 'keep.md'): + (tmp_path / name).write_text('# sample\n', encoding='utf-8') + _write_build_config(tmp_path / 'graphify-out', excludes=['keep.md'], gitignore=False) + data = detect(tmp_path, gitignore=True, extra_excludes=[]) + actual = {Path(f).name for files in data['files'].values() for f in files} + assert actual == {'keep.md'} diff --git a/tools/skillgen/expected/graphify__skill-agents.md b/tools/skillgen/expected/graphify__skill-agents.md index f09e56ca8..435bd1fed 100644 --- a/tools/skillgen/expected/graphify__skill-agents.md +++ b/tools/skillgen/expected/graphify__skill-agents.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skill-aider.md b/tools/skillgen/expected/graphify__skill-aider.md index 97c3afb59..2ca7f3bf2 100644 --- a/tools/skillgen/expected/graphify__skill-aider.md +++ b/tools/skillgen/expected/graphify__skill-aider.md @@ -111,7 +111,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) print(json.dumps(result)) " > .graphify_detect.json ``` @@ -772,7 +774,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2)) Path('.graphify_incremental.json').write_text(json.dumps(result)) diff --git a/tools/skillgen/expected/graphify__skill-amp.md b/tools/skillgen/expected/graphify__skill-amp.md index f09e56ca8..435bd1fed 100644 --- a/tools/skillgen/expected/graphify__skill-amp.md +++ b/tools/skillgen/expected/graphify__skill-amp.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skill-claw.md b/tools/skillgen/expected/graphify__skill-claw.md index 612da0090..4611240c5 100644 --- a/tools/skillgen/expected/graphify__skill-claw.md +++ b/tools/skillgen/expected/graphify__skill-claw.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skill-codex.md b/tools/skillgen/expected/graphify__skill-codex.md index d826d76e6..952f319b1 100644 --- a/tools/skillgen/expected/graphify__skill-codex.md +++ b/tools/skillgen/expected/graphify__skill-codex.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skill-copilot.md b/tools/skillgen/expected/graphify__skill-copilot.md index 612da0090..4611240c5 100644 --- a/tools/skillgen/expected/graphify__skill-copilot.md +++ b/tools/skillgen/expected/graphify__skill-copilot.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skill-devin.md b/tools/skillgen/expected/graphify__skill-devin.md index af7e532c4..b9be67de9 100644 --- a/tools/skillgen/expected/graphify__skill-devin.md +++ b/tools/skillgen/expected/graphify__skill-devin.md @@ -124,7 +124,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) print(json.dumps(result)) " > graphify-out/.graphify_detect.json ``` @@ -911,7 +913,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result)) diff --git a/tools/skillgen/expected/graphify__skill-droid.md b/tools/skillgen/expected/graphify__skill-droid.md index ada369b7d..91767d3c3 100644 --- a/tools/skillgen/expected/graphify__skill-droid.md +++ b/tools/skillgen/expected/graphify__skill-droid.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skill-kilo.md b/tools/skillgen/expected/graphify__skill-kilo.md index 9b043233f..73eb3ef61 100644 --- a/tools/skillgen/expected/graphify__skill-kilo.md +++ b/tools/skillgen/expected/graphify__skill-kilo.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skill-kiro.md b/tools/skillgen/expected/graphify__skill-kiro.md index 612da0090..4611240c5 100644 --- a/tools/skillgen/expected/graphify__skill-kiro.md +++ b/tools/skillgen/expected/graphify__skill-kiro.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skill-opencode.md b/tools/skillgen/expected/graphify__skill-opencode.md index 5cb74e81a..aeba6b0df 100644 --- a/tools/skillgen/expected/graphify__skill-opencode.md +++ b/tools/skillgen/expected/graphify__skill-opencode.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skill-pi.md b/tools/skillgen/expected/graphify__skill-pi.md index 612da0090..4611240c5 100644 --- a/tools/skillgen/expected/graphify__skill-pi.md +++ b/tools/skillgen/expected/graphify__skill-pi.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skill-trae.md b/tools/skillgen/expected/graphify__skill-trae.md index 2037e539f..a5878899d 100644 --- a/tools/skillgen/expected/graphify__skill-trae.md +++ b/tools/skillgen/expected/graphify__skill-trae.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skill-vscode.md b/tools/skillgen/expected/graphify__skill-vscode.md index 9002650e4..c3d571d86 100644 --- a/tools/skillgen/expected/graphify__skill-vscode.md +++ b/tools/skillgen/expected/graphify__skill-vscode.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skill-windows.md b/tools/skillgen/expected/graphify__skill-windows.md index 1246089d5..fc2f2ccfd 100644 --- a/tools/skillgen/expected/graphify__skill-windows.md +++ b/tools/skillgen/expected/graphify__skill-windows.md @@ -145,7 +145,9 @@ If the import succeeds, print nothing and move straight to Step 2. import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding="utf-8") diff --git a/tools/skillgen/expected/graphify__skill.md b/tools/skillgen/expected/graphify__skill.md index 612da0090..4611240c5 100644 --- a/tools/skillgen/expected/graphify__skill.md +++ b/tools/skillgen/expected/graphify__skill.md @@ -117,7 +117,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__agents__references__update.md b/tools/skillgen/expected/graphify__skills__agents__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__agents__references__update.md +++ b/tools/skillgen/expected/graphify__skills__agents__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__amp__references__update.md b/tools/skillgen/expected/graphify__skills__amp__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__amp__references__update.md +++ b/tools/skillgen/expected/graphify__skills__amp__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__claude__references__update.md b/tools/skillgen/expected/graphify__skills__claude__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__claude__references__update.md +++ b/tools/skillgen/expected/graphify__skills__claude__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__claw__references__update.md b/tools/skillgen/expected/graphify__skills__claw__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__claw__references__update.md +++ b/tools/skillgen/expected/graphify__skills__claw__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__codex__references__update.md b/tools/skillgen/expected/graphify__skills__codex__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__codex__references__update.md +++ b/tools/skillgen/expected/graphify__skills__codex__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__copilot__references__update.md b/tools/skillgen/expected/graphify__skills__copilot__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__copilot__references__update.md +++ b/tools/skillgen/expected/graphify__skills__copilot__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__droid__references__update.md b/tools/skillgen/expected/graphify__skills__droid__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__droid__references__update.md +++ b/tools/skillgen/expected/graphify__skills__droid__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__kilo__references__update.md b/tools/skillgen/expected/graphify__skills__kilo__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__kilo__references__update.md +++ b/tools/skillgen/expected/graphify__skills__kilo__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__kiro__references__update.md b/tools/skillgen/expected/graphify__skills__kiro__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__kiro__references__update.md +++ b/tools/skillgen/expected/graphify__skills__kiro__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__opencode__references__update.md b/tools/skillgen/expected/graphify__skills__opencode__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__opencode__references__update.md +++ b/tools/skillgen/expected/graphify__skills__opencode__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__pi__references__update.md b/tools/skillgen/expected/graphify__skills__pi__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__pi__references__update.md +++ b/tools/skillgen/expected/graphify__skills__pi__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__trae__references__update.md b/tools/skillgen/expected/graphify__skills__trae__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__trae__references__update.md +++ b/tools/skillgen/expected/graphify__skills__trae__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__vscode__references__update.md b/tools/skillgen/expected/graphify__skills__vscode__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__vscode__references__update.md +++ b/tools/skillgen/expected/graphify__skills__vscode__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/expected/graphify__skills__windows__references__update.md b/tools/skillgen/expected/graphify__skills__windows__references__update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/expected/graphify__skills__windows__references__update.md +++ b/tools/skillgen/expected/graphify__skills__windows__references__update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/fragments/core/aider.md b/tools/skillgen/fragments/core/aider.md index 97c3afb59..2ca7f3bf2 100644 --- a/tools/skillgen/fragments/core/aider.md +++ b/tools/skillgen/fragments/core/aider.md @@ -111,7 +111,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) print(json.dumps(result)) " > .graphify_detect.json ``` @@ -772,7 +774,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2)) Path('.graphify_incremental.json').write_text(json.dumps(result)) diff --git a/tools/skillgen/fragments/core/core.md b/tools/skillgen/fragments/core/core.md index 412535088..dedf3a7c2 100644 --- a/tools/skillgen/fragments/core/core.md +++ b/tools/skillgen/fragments/core/core.md @@ -70,7 +70,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) # Write the sidecar from Python, not a shell redirect, so the same block renders # on PowerShell hosts without console-encoding drift (#2528). Path('graphify-out/.graphify_detect.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/fragments/core/devin.md b/tools/skillgen/fragments/core/devin.md index af7e532c4..b9be67de9 100644 --- a/tools/skillgen/fragments/core/devin.md +++ b/tools/skillgen/fragments/core/devin.md @@ -124,7 +124,9 @@ $(cat graphify-out/.graphify_python) -c " import json from graphify.detect import detect from pathlib import Path -result = detect(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) print(json.dumps(result)) " > graphify-out/.graphify_detect.json ``` @@ -911,7 +913,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result)) diff --git a/tools/skillgen/fragments/references/shared/update.md b/tools/skillgen/fragments/references/shared/update.md index bd8e659d3..7325bbbf0 100644 --- a/tools/skillgen/fragments/references/shared/update.md +++ b/tools/skillgen/fragments/references/shared/update.md @@ -12,7 +12,9 @@ import sys, json from graphify.detect import detect_incremental, save_manifest from pathlib import Path -result = detect_incremental(Path('INPUT_PATH')) +from graphify.paths import out_path +from graphify.watch import _read_build_excludes, _read_build_gitignore +result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path())) new_total = result.get('new_total', 0) print(json.dumps(result, indent=2, ensure_ascii=False)) Path('graphify-out/.graphify_incremental.json').write_text(json.dumps(result, ensure_ascii=False), encoding=\"utf-8\") diff --git a/tools/skillgen/gen.py b/tools/skillgen/gen.py index bda0ab2e4..993d0f2fe 100644 --- a/tools/skillgen/gen.py +++ b/tools/skillgen/gen.py @@ -1197,6 +1197,18 @@ def _is_graph_diff_direction_fix_line(line: str) -> bool: ) +def _is_persisted_scan_options_fix_line(line: str) -> bool: + """Skill scans reuse CLI corpus-shaping options without changing detect defaults (#4240).""" + return line.strip() in ( + "from graphify.paths import out_path", + "from graphify.watch import _read_build_excludes, _read_build_gitignore", + "result = detect(Path('INPUT_PATH'))", + "result = detect_incremental(Path('INPUT_PATH'))", + "result = detect(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path()))", + "result = detect_incremental(Path('INPUT_PATH'), extra_excludes=_read_build_excludes(out_path()), gitignore=_read_build_gitignore(out_path()))", + ) + + # Every line that may differ between a rendered monolith and its pristine v8 # baseline. Each predicate documents one sanctioned change-class; a blank line is # allowed because the multi-line fix blocks insert spacing. Anything else failing @@ -1221,6 +1233,7 @@ _SANCTIONED_MONOLITH_DIFFS = ( _is_step1_root_marker_fix_line, _is_watch_injection_fix_line, _is_graph_diff_direction_fix_line, + _is_persisted_scan_options_fix_line, )