[BUG] apm compile reports 'Referenced file not found' for links with a #fragment
I maintainer di solito rispondono entro 1 giorno
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Idoneità per principianti
- 76/100
Direzione di ricerca
Inizia con validate_link_targets in src/apm_cli/compilation/link_resolver.py e i test del risolutore dei link in tests/unit/compilation/test_link_resolver*.py. Controlla come vengono risolti i link relativi con frammenti e stringhe di query, quindi esegui i test di regressione per i file esistenti e mancanti. Il lavoro è completato quando i target esistenti superano i test e quelli mancanti vengono segnalati senza il suffisso.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Describe the bug
apm compile warns Referenced file not found for a relative Markdown link that carries a fragment, such as [template](references/standards.md#template), even though references/standards.md exists. validate_link_targets in src/apm_cli/compilation/link_resolver.py skips links that start with #, but passes file.md#fragment to _resolve_path unchanged, so the existence check looks for a file literally named standards.md#template. ?query suffixes behave the same.
Skills commonly link to a heading in a reference file, so a skill package with valid links produces one warning per link.
To Reproduce
from pathlib import Path
from apm_cli.compilation.link_resolver import validate_link_targets
base = Path("pkg"); (base / "references").mkdir(parents=True, exist_ok=True)
(base / "references" / "standards.md").write_text("# Template\n")
print(validate_link_targets("[t](references/standards.md#template)", base))
# ["Referenced file not found: references/standards.md#template (in link 't')"]
Or apm install a skill whose SKILL.md links to references/<file>.md#<heading>, then run apm compile --dry-run.
Expected behavior
The fragment (and query) is ignored for the existence check: an existing file passes and a missing file is still reported, without the fragment.
Environment
- OS: macOS 26 (also expected on Linux and Windows; the check is platform independent)
- Python Version: 3.12
- APM Version: 0.33.0 (code unchanged on
main)
Additional context
Proposed fix (happy to open a PR once the scope is approved), in validate_link_targets before _resolve_path:
# Strip a #fragment or ?query: it targets a heading, not a file
path = re.split(r"[#?]", path, maxsplit=1)[0]
With two regression tests (an existing file with a fragment passes; a missing file with a fragment is reported without it), tests/unit/compilation/test_link_resolver*.py passes (164 tests). resolve_markdown_links has the same startswith("#")-only skip, so a context link with a fragment is not inlined; it may want the same treatment.
- Lingua principale
- Python
- Stelle
- 4.2k
- Fork
- 412
- Merge medio
- 1g 12h
- PR unite (30g)
- 68
Preparare l'ambiente
- Nessun Dockerfile né file Docker Compose
- Ha un modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di microsoft/apm
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 60/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 80/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
I maintainer di solito rispondono entro 1 giorno
-
[BUG] `apm install <plugin>@<marketplace>` ignores a `github` source's `sha` and writes an unpinned dependencyForse già presa @abhishekacharya200 l’ha presa 2 giorni fa. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 85/100
microsoft/apm#3426 · 1 commento ·
I maintainer di solito rispondono entro 1 giorno
-
[BUG] Codex: stdio MCP env ${VAR} written as plaintext into .codex/config.toml instead of using env_varsForse già presa @abhishekacharya200 l’ha presa 6 giorni fa. Apertatype/bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 69/100
I maintainer di solito rispondono entro 1 giorno
Tutte le issue di microsoft/apm
Issue simili
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
microsoft/markitdown#2820 ·
I maintainer di solito rispondono entro 1 giorno
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 66/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
yt-project/yt#5624 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
-
bug
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
NousResearch/hermes-agent#148376 ·
I maintainer di solito rispondono entro 1 giorno