argos-cli 0.3.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- argos/__init__.py +5 -0
- argos/__main__.py +4 -0
- argos/adapters/__init__.py +9 -0
- argos/adapters/_libreoffice_worker.py +111 -0
- argos/adapters/ai.py +1506 -0
- argos/adapters/ai_remote.py +654 -0
- argos/adapters/attachment_conversion.py +132 -0
- argos/adapters/capabilities.py +31 -0
- argos/adapters/chart_render.py +72 -0
- argos/adapters/docx_pdf.py +2953 -0
- argos/adapters/limesurvey.py +1079 -0
- argos/adapters/model_call.py +274 -0
- argos/adapters/report_publication.py +1530 -0
- argos/adapters/url_fetch.py +146 -0
- argos/adapters/xlsx.py +454 -0
- argos/analytics.py +731 -0
- argos/assets.py +257 -0
- argos/audit_result.py +369 -0
- argos/booleans.py +105 -0
- argos/catalog.py +1205 -0
- argos/cli.py +606 -0
- argos/contracts.py +532 -0
- argos/core.py +325 -0
- argos/default_skills/README.md +23 -0
- argos/default_skills/criar-matriz-planejamento/SKILL.md +200 -0
- argos/default_skills/elaborar-survey-limesurvey/SKILL.md +106 -0
- argos/default_skills/operar-argos/SKILL.md +74 -0
- argos/default_skills/verificar-diretrizes-fiscalizacao/SKILL.md +129 -0
- argos/default_skills/verificar-diretrizes-fiscalizacao/assets/relatorio-avaliacao.md +54 -0
- argos/default_skills/verificar-diretrizes-fiscalizacao/references/contrato-saidas.md +36 -0
- argos/default_skills/verificar-diretrizes-fiscalizacao/references/papeis-das-pastas.md +37 -0
- argos/default_skills/verificar-diretrizes-fiscalizacao/references/roteiro-verificacoes.md +27 -0
- argos/default_skills/verificar-diretrizes-fiscalizacao/scripts/avaliacao.py +253 -0
- argos/engines/__init__.py +3 -0
- argos/engines/adjustments.py +571 -0
- argos/engines/analytics.py +195 -0
- argos/engines/audit.py +2730 -0
- argos/engines/evaluation.py +6088 -0
- argos/engines/index.py +1683 -0
- argos/engines/matrix.py +5736 -0
- argos/engines/matrix_html.py +698 -0
- argos/engines/model_request.py +201 -0
- argos/engines/report_document.py +137 -0
- argos/engines/reports.py +1200 -0
- argos/engines/survey.py +4445 -0
- argos/envfile.py +53 -0
- argos/errors.py +29 -0
- argos/evidence_staging.py +293 -0
- argos/executions.py +565 -0
- argos/findings_matrix.py +2549 -0
- argos/fingerprints.py +487 -0
- argos/index_dsl.py +2100 -0
- argos/matrix_markdown.py +475 -0
- argos/matrix_widths.py +280 -0
- argos/pipeline.py +1745 -0
- argos/products.py +220 -0
- argos/progress.py +221 -0
- argos/project.py +608 -0
- argos/report_config.py +158 -0
- argos/resources/ESPECIFICACAO_MARKDOWN_MATRIZ_ACHADOS.md +539 -0
- argos/resources/ESPECIFICACAO_MARKDOWN_MATRIZ_PLANEJAMENTO.md +1000 -0
- argos/resources/ESPECIFICACAO_UNIFICADA_MATRIZES_V1_3.md +1142 -0
- argos/resources/anexo-evidencias-base.docx +0 -0
- argos/resources/argos-index-dsl-v1.schema.json +539 -0
- argos/resources/argos-report-config-v1.schema.json +113 -0
- argos/resources/diretrizes-projeto.md +476 -0
- argos/resources/env.example +37 -0
- argos/resources/exemplos/matriz_achados_boilerplate.md +61 -0
- argos/resources/exemplos/matriz_achados_draft.md +106 -0
- argos/resources/exemplos/matriz_achados_larguras_v1_3.md +114 -0
- argos/resources/exemplos/matriz_achados_v1_3.md +107 -0
- argos/resources/exemplos/matriz_planejamento_boilerplate.md +64 -0
- argos/resources/exemplos/matriz_planejamento_larguras_v1_3.md +115 -0
- argos/resources/exemplos/matriz_planejamento_v1_3.md +108 -0
- argos/resources/template-base-estilos-sigiloso.docx +0 -0
- argos/resources/template-base-estilos.docx +0 -0
- argos/resources/template-matriz-planejamento.docx +0 -0
- argos/resources/template-relatorio-consolidado-comum.docx +0 -0
- argos/resources/template-relatorio-consolidado-institucional.docx +0 -0
- argos/response_profiles.py +856 -0
- argos/scheduler.py +142 -0
- argos/status.py +367 -0
- argos/store.py +1228 -0
- argos/survey_collection.py +832 -0
- argos/telemetry.py +84 -0
- argos/tui.py +1262 -0
- argos/tui.tcss +827 -0
- argos/tui_models.py +466 -0
- argos/tui_path.py +155 -0
- argos/tui_widgets.py +482 -0
- argos/version.py +3 -0
- argos_cli-0.3.1.dist-info/METADATA +570 -0
- argos_cli-0.3.1.dist-info/RECORD +96 -0
- argos_cli-0.3.1.dist-info/WHEEL +5 -0
- argos_cli-0.3.1.dist-info/entry_points.txt +2 -0
- argos_cli-0.3.1.dist-info/top_level.txt +1 -0
argos/__init__.py
ADDED
argos/__main__.py
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"""Adaptadores de I/O do Argos: formatos externos e conversões determinísticas.
|
|
2
|
+
|
|
3
|
+
Os adaptadores isolam dependências opcionais (LibreOffice, LimeSurvey, XLSX)
|
|
4
|
+
e mantêm o núcleo do domínio sem conhecer detalhes de formatos de arquivo.
|
|
5
|
+
"""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
__all__ = ["docx_pdf"]
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"""Worker isolado que atualiza campos DOCX pela API UNO do LibreOffice."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import json
|
|
6
|
+
import subprocess
|
|
7
|
+
import sys
|
|
8
|
+
import time
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
def _property(uno, name: str, value):
|
|
12
|
+
item = uno.createUnoStruct("com.sun.star.beans.PropertyValue")
|
|
13
|
+
item.Name = name
|
|
14
|
+
item.Value = value
|
|
15
|
+
return item
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
def main() -> int:
|
|
19
|
+
import uno
|
|
20
|
+
|
|
21
|
+
executable, document_path, profile_uri, port, timeout = sys.argv[1:]
|
|
22
|
+
address = f"socket,host=127.0.0.1,port={port};urp;StarOffice.ServiceManager"
|
|
23
|
+
command = [
|
|
24
|
+
executable,
|
|
25
|
+
"--headless",
|
|
26
|
+
"--norestore",
|
|
27
|
+
"--nodefault",
|
|
28
|
+
"--nofirststartwizard",
|
|
29
|
+
f"-env:UserInstallation={profile_uri}",
|
|
30
|
+
f"--accept={address}",
|
|
31
|
+
]
|
|
32
|
+
process = subprocess.Popen(command, stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
|
|
33
|
+
desktop = None
|
|
34
|
+
document = None
|
|
35
|
+
try:
|
|
36
|
+
local_context = uno.getComponentContext()
|
|
37
|
+
resolver = local_context.ServiceManager.createInstanceWithContext(
|
|
38
|
+
"com.sun.star.bridge.UnoUrlResolver", local_context
|
|
39
|
+
)
|
|
40
|
+
deadline = time.monotonic() + float(timeout)
|
|
41
|
+
remote_context = None
|
|
42
|
+
last_error = None
|
|
43
|
+
while time.monotonic() < deadline:
|
|
44
|
+
try:
|
|
45
|
+
remote_context = resolver.resolve(
|
|
46
|
+
f"uno:socket,host=127.0.0.1,port={port};urp;StarOffice.ComponentContext"
|
|
47
|
+
)
|
|
48
|
+
break
|
|
49
|
+
except Exception as exc: # pyuno expõe exceções dinâmicas
|
|
50
|
+
last_error = exc
|
|
51
|
+
if process.poll() is not None:
|
|
52
|
+
break
|
|
53
|
+
time.sleep(0.1)
|
|
54
|
+
if remote_context is None:
|
|
55
|
+
raise RuntimeError("Não foi possível conectar ao LibreOffice para atualizar o sumário.") from last_error
|
|
56
|
+
|
|
57
|
+
desktop = remote_context.ServiceManager.createInstanceWithContext(
|
|
58
|
+
"com.sun.star.frame.Desktop", remote_context
|
|
59
|
+
)
|
|
60
|
+
document = desktop.loadComponentFromURL(
|
|
61
|
+
uno.systemPathToFileUrl(document_path),
|
|
62
|
+
"_blank",
|
|
63
|
+
0,
|
|
64
|
+
(
|
|
65
|
+
_property(uno, "Hidden", True),
|
|
66
|
+
_property(uno, "UpdateDocMode", 3),
|
|
67
|
+
_property(uno, "ReadOnly", False),
|
|
68
|
+
),
|
|
69
|
+
)
|
|
70
|
+
if document is None:
|
|
71
|
+
raise RuntimeError("O LibreOffice não conseguiu abrir o DOCX temporário.")
|
|
72
|
+
indexes = document.getDocumentIndexes()
|
|
73
|
+
count = indexes.getCount()
|
|
74
|
+
if count < 1:
|
|
75
|
+
raise RuntimeError("Nenhum campo de sumário foi reconhecido no DOCX.")
|
|
76
|
+
text_fields = document.getTextFields()
|
|
77
|
+
text_fields.refresh()
|
|
78
|
+
for index in range(count):
|
|
79
|
+
indexes.getByIndex(index).update()
|
|
80
|
+
text_fields.refresh()
|
|
81
|
+
document.store()
|
|
82
|
+
document.close(True)
|
|
83
|
+
document = None
|
|
84
|
+
print(json.dumps({"ok": True, "indexes": count}, ensure_ascii=False))
|
|
85
|
+
return 0
|
|
86
|
+
finally:
|
|
87
|
+
if document is not None:
|
|
88
|
+
try:
|
|
89
|
+
document.close(True)
|
|
90
|
+
except Exception:
|
|
91
|
+
pass
|
|
92
|
+
if desktop is not None:
|
|
93
|
+
try:
|
|
94
|
+
desktop.terminate()
|
|
95
|
+
except Exception:
|
|
96
|
+
pass
|
|
97
|
+
if process.poll() is None:
|
|
98
|
+
process.terminate()
|
|
99
|
+
try:
|
|
100
|
+
process.wait(timeout=5)
|
|
101
|
+
except subprocess.TimeoutExpired:
|
|
102
|
+
process.kill()
|
|
103
|
+
process.wait(timeout=5)
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
if __name__ == "__main__":
|
|
107
|
+
try:
|
|
108
|
+
raise SystemExit(main())
|
|
109
|
+
except Exception as exc:
|
|
110
|
+
print(f"Falha na atualização de campos via LibreOffice: {exc}", file=sys.stderr)
|
|
111
|
+
raise SystemExit(1) from exc
|