feat: implement hierarchical AST extraction with prefaces and fallback support - #57
Open
IbukunChife wants to merge 4 commits into
Open
feat: implement hierarchical AST extraction with prefaces and fallback support#57IbukunChife wants to merge 4 commits into
IbukunChife wants to merge 4 commits into
Conversation
12 tasks
Owner
|
Ibukun — thanks for pushing on this. Two things blocking a merge as-is:
The path I'd suggest: open the architecture issue we discussed with a One more note: the virtual nodes hardcode Portuguese strings ("Prefácio / Introdução", "Documento Completo"). Since the tool runs across languages, those would need to be language-neutral or localized before merge. |
This was referenced Jul 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What & why
Este Pull Request implementa a extração de uma Árvore de Granularidade do Documento (Hierarchical AST) em
detect_structure. O objetivo é combater a "tributação de contexto" desnecessária em agentes de IA, permitindo que as ferramentas localizem dinamicamente e cortem apenas fatias (slices) exatas de capítulos ou subseções do documento para o contexto de prompts.As responsabilidades e regras de design foram desenhadas de forma extremamente robusta:
"Prefácio / Introdução"se houver conteúdo não-vazio no texto antes do primeiro cabeçalho oficial do capítulo 1."Documento Completo"mapeando do caractere0alen(text), garantindo que a AST nunca retorne vazia."start_char"e"end_char"precisos delimitando a respectiva seção.Evidence
tests/test_chapter_detector.pycobrindo cenários recursivos complexos, livros planos normais de múltiplos capítulos, documentos sem cabeçalhos e textos com prefácios iniciais.pytest) passando com 100% de sucesso.ruff checkexecutado com sucesso e retornando perfeitamente limpo (All checks passed!).Checklist
ruff check .cleanpytest -qgreenpython3 tools/validate_skill.py SKILL.mdpasses (não modificado)CHANGELOG.mdupdated under## [Unreleased]