Commit Graph

11 Commits

Author SHA1 Message Date
alt-glitch
3e931466c0 fix(move): files that leave a folder that stays move alone
rewrite_imports.py and rewrite_docs.py treated every folder above a moved
file as a moved folder. That holds when a whole package moves. When a few
files leave a folder it does not: moving three files from tools/ to cron/
printed 58 flags that named tools/, tests/ and tests/tools/ as moved, and
rewrote every `tools/*.py` glob in the docs to `cron/*.py`.

A folder now counts as moved only when every tracked file under it moved.
renames.py holds that rule once (emptied_folders) together with the path
questions the import and TOML passes ask (MovedPaths); the docs pass reads
the same rule. A path built from pieces is flagged by the name of the
outermost file or folder the move took away, so a file that left a folder
that stays is still found. A docs glob follows a move only when every file
it matches moved together under its own name; otherwise it stays as
written and is counted as partial-glob.

rewrite_imports.py takes --no-compat-table for a move whose old names no
release, updater or plugin imports. The default still writes the table,
so build_chunk.py and migrate_branch.py are unchanged.

Whole-folder moves give the same output as before: on
`git mv acp_adapter hermes_agent/acp_adapter` both scripts print the same
log and write the same diff with and without this change.
2026-11-16 17:23:26 +05:30
alt-glitch
edd4b3ed51 fix(move): docs pass keeps gateway.platforms before a placeholder as written
The config.yaml key gateway.platforms.<name>.enabled was rewritten to
hermes_agent.gateway.platforms.<name>.enabled. The config-path deny list
matches gateway.platforms. only when a real segment follows, and a name
token stops at a placeholder or a wildcard, so the bare gateway.platforms
was read as the package. A config path that is also a package, alone or
before a placeholder or wildcard, now stays as written and is counted as
flagged-config-or-module for a person to check.
2026-11-13 20:47:05 +00:00
alt-glitch
3d7774434f fix(move): count a skipped whole-folder glob only when its folder moves
The docs pass counted a `bare-dir` skip for every `cron/*`, `tools/*` or
`plugins/**` it saw, even in a chunk that does not move that folder, so the
skip counts in the build log were inflated. The check now runs only for a
folder the chunk moves. What the pass writes is unchanged.

Add a test that a whole-folder glob on a moved folder that is not ambiguous
(`tui_gateway/*`) is still rewritten, and that an unmoved `cron/*` counts no
skip.
2026-11-13 20:47:05 +00:00
alt-glitch
1a91ce56b7 fix(move): docs pass keeps whole-folder globs on ambiguous names such as cron/* as written
A glob that takes every file of a folder whose name is also a HERMES_HOME dir or an MCP method family (cron/*, tools/*, plugins/**) is skipped like the bare folder; a file pattern such as cron/*.py still follows the move.
2026-11-13 20:47:05 +00:00
alt-glitch
d3cb8b4f67 fix(move): docs pass leaves commit and tag permalinks to moved files unchanged
Only a blob/main/ link follows the move; a commit or tag link points at a tree that keeps the old path.
2026-11-13 20:47:05 +00:00
alt-glitch
ddc718e679 fix(move): docs pass runs from a copy of scripts/move outside the checkout
rewrite_docs.py imports the old-path file generator only when it checks a .py path, so a copy of scripts/move outside the checkout no longer exits or fails to import.
2026-11-13 20:47:05 +00:00
alt-glitch
82e9576c63 fix(move): docs pass skips generated old-path files by path, not by a first-line header 2026-11-13 20:47:05 +00:00
alt-glitch
8309d5967f fix(move): docs pass rewrites a name only where it is code or resolves to a moved module
English that follows from/import in running prose ("from providers like X") and config keys named like a
moved package (plugins.enabled, providers.<id>.api_key) were rewritten to hermes_agent.* names.

- from M import ... / import M / -m M are rewritten only as code: in a code span, a code fence, a >>> line, or
  an import statement that parses as Python and starts its line. A bare top-level word alone is never
  rewritten. import M becomes from hermes_agent import M.
- A dotted name is rewritten when it names a moved module or package, or a moved module plus an attribute it
  defines; a bare package that is also a config section (agent, plugins, providers, ...) needs the attribute.
- DEFAULT_CONFIG keys (shared reader in renames.py, found wherever hermes_cli moved to) and i18n keys
  (locales/en.yaml, first argument of t()) are left alone.
- Files generate_shims.py wrote are skipped.
2026-11-13 20:47:05 +00:00
alt-glitch
e5928a41ac fix(move): read docs with utf-8-sig and keep a BOM on write in rewrite_docs
The windows-footguns check flagged three reads/writes in rewrite_docs without
the policy encoding. Reads now use utf-8-sig; a file that started with a BOM
gets it back via write_bytes so rewritten files keep their bytes.
2026-11-13 20:47:05 +00:00
alt-glitch
f013b0b471 style(move): satisfy the repo ruff config in rewrite_docs 2026-11-13 20:47:05 +00:00
alt-glitch
82b3de05e7 feat(move): rewrite moved paths and module names in docs and comments 2026-11-13 20:47:05 +00:00