forked from diegoecab/oci-deal-accelerator
Lookup index auto-invalidates on KB updates + manual rebuild flag
Diego asked: does the persisted ``archcenter-refs-index.json`` auto-
update when the KB is updated? Partially — mtime on the cache root
catches add/remove of subdirs (POSIX), but NOT changes to files
INSIDE existing subdirs (description.md added, .drawio replaced).
Two fixes:
1. Both KB-update tools now ``touch`` ``kb/diagram/assets/archcenter-refs``
when they finish a run that produced changes:
- ``archcenter_description_fetcher.py`` after fetched > 0
- ``archcenter_zip_downloader.py`` after downloaded / extract /
overwrite events
The touch bumps the parent mtime, which the next lookup detects
and uses to rebuild its persisted index. Closes the silent-drift
case where description.md fetches landed but the index didn't
notice.
2. ``archcenter_pattern_lookup.py --rebuild-index`` flag — escape
hatch for manual KB edits (someone replaces a cached .drawio by
hand) where neither tool ran. Removes the stale index file before
the lookup, forcing a cold rebuild.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -402,7 +402,15 @@ def main() -> None:
|
||||
"before scoring (opt-in; requires "
|
||||
"ANTHROPIC_API_KEY). Useful for natural-language "
|
||||
"queries the synonym table doesn't cover.")
|
||||
parser.add_argument("--rebuild-index", action="store_true",
|
||||
help="Force-rebuild the cached archcenter-refs "
|
||||
"index (kb/diagram/assets/archcenter-refs-index.json). "
|
||||
"Use after a manual KB edit if mtime didn't bump.")
|
||||
args = parser.parse_args()
|
||||
if args.rebuild_index and CACHE_INDEX_FILE.exists():
|
||||
CACHE_INDEX_FILE.unlink()
|
||||
print(f"[lookup] removed stale index at {CACHE_INDEX_FILE.relative_to(PROJECT_ROOT)}",
|
||||
file=sys.stderr)
|
||||
|
||||
queries: list[str] = list(args.queries)
|
||||
if args.query:
|
||||
|
||||
Reference in New Issue
Block a user