"Auto-commit via make git"
Some checks are pending
Build NFDOS ISO / build (push) Waiting to run

This commit is contained in:
neo.webmaster.2@gmail.com 2025-11-29 13:12:54 +01:00
parent eb291d7a53
commit 708f5fa249
8 changed files with 322 additions and 56 deletions

View File

@ -10,21 +10,288 @@ nl -ba Makefile | sed -n '770,790p'
grep -n "^[ ]" Makefile | head
hmmm 😏
voltei a retirar as extensoes. ele cria uma pasta com um index.html. se seguimos depois quebra no gitea. o copilot criou uma nav no mkdocs.yml.
apenas precisamos ajustar com as nossas paginas:
ok tambem esta tratado. agora precisamos tratar desse ponto:
```
docs_dir: docs/wiki
site_name: Documentação NFDOS
nav:
- Home: index.md
- Guia de Início Rápido: quickstart.md
- Documentação:
- Instalação: installation.md
- Uso Básico: basic_usage.md
- Ferramentas de Linha de Comando: cli_tools.md
- Desenvolvimento: development.md
- FAQ: faq.md
- Changelog: changelog.md
theme:
name: material
### ✔ Branding estável
`NFDOS v0.1 — inicializador` (sem “dirty”)
```
o makefile atual:
```
SUBDIRS = src
# ===========================
# Configurações de Git
# ===========================
GIT_USER ?= "neo.webmaster.2@gmail.com"
GIT_EMAIL ?= "neo.webmaster.2@gmail.com"
GIT_REMOTE ?= "origin"
GIT_BRANCH ?= "main"
COMMIT_MSG ?= "Auto-commit via make git"
GIT_VER := $(shell git describe --tags --always --dirty 2>/dev/null || echo "0.1-dev")
NEUROTRON_DIR ?= $(top_srcdir)/src/_nfdos/kernel/neurotron
NEUROTRON_REMOTE ?= origin
NEUROTRON_BRANCH ?= main
# ===========================
# Caminhos e artefactos
# ===========================
DIST_DIR ?= $(top_builddir)/dist
BUILD_DIR ?= $(top_builddir)/build
ISO_DIR ?= $(DIST_DIR)/iso/boot/grub
ISO_FILE ?= $(DIST_DIR)/nfdos-$(GIT_VER).iso
SRC_TAR ?= $(DIST_DIR)/nfdos-$(GIT_VER)-src.tar.gz
KERNEL = $(top_builddir)/src/_nfdos/kernel/linux/arch/x86/boot/bzImage
INITRAMFS = $(top_builddir)/src/_nfdos/initramfs.cpio.gz
WIKI_SRC = $(top_srcdir)/src/docs/wiki
WIKI_REPO = ssh://git@gitea.neoricalex.com:2222/neo/nfdos.wiki.git
WIKI_TMP = $(top_srcdir)/src/tmp/nfdos-wiki-sync
.PHONY: iso qemu tarball git release clean-local check-remote
# ===========================
# Criação da ISO
# ===========================
iso: $(ISO_FILE)
$(ISO_FILE):
@echo "[ISO] Criando estrutura de diretórios..."
mkdir -p $(DIST_DIR)/iso/boot
mkdir -p $(ISO_DIR)
@echo "[ISO] Copiando Kernel e Initramfs..."
cp $(KERNEL) $(DIST_DIR)/iso/boot/
cp $(INITRAMFS) $(DIST_DIR)/iso/boot/
@echo "[ISO] Gerando grub.cfg..."
@printf "set timeout=3\nset default=0\n\nmenuentry 'NFDOS Linux' {\n\tlinux /boot/bzImage console=ttyS0 root=/dev/ram0 loglevel=8\n\tinitrd /boot/initramfs.cpio.gz\n}\n" > $(ISO_DIR)/grub.cfg
@echo "[ISO] Gerando imagem ISO..."
grub-mkrescue -o $(ISO_FILE) $(DIST_DIR)/iso --compress=xz -V NFDOS
@echo "[✔] ISO criada em $(ISO_FILE)"
# ===========================
# Teste no QEMU
# ===========================
qemu: $(ISO_FILE)
@echo "[QEMU] Iniciando NFDOS ISO..."
qemu-system-x86_64 -cdrom $(ISO_FILE) -m 1024 -nographic -serial mon:stdio -no-reboot
# ===========================
# Empacotamento do código-fonte
# ===========================
tarball: $(SRC_TAR)
$(SRC_TAR):
@echo "[TAR] Empacotando código-fonte..."
mkdir -p $(DIST_DIR)
cd $(top_srcdir) && tar \
--exclude="$(notdir $(SRC_TAR))" \
--exclude="$(DIST_DIR)" \
--exclude="$(BUILD_DIR)" \
--exclude='*/__pycache__' \
--exclude='*/.venv' \
--exclude='*/venv' \
--exclude='*.pyc' \
--exclude='*.pyo' \
--exclude='*.o' \
--exclude='*.a' \
--exclude='*.so' \
--exclude='*.iso' \
--exclude='*.img' \
--exclude='*.cpio*' \
--exclude='*/linux' \
--exclude='*/busybox' \
--exclude='*/cpython' \
-czf $(SRC_TAR) .
@echo "[✔] Tarball gerado em $(SRC_TAR)"
# ===========================
# Git (commit + push)
# ===========================
git: check-remote
@echo "📦 Commit automático → Gitea (NFDOS)"
@git config user.name $(GIT_USER)
@git config user.email $(GIT_EMAIL)
@git rev-parse --abbrev-ref HEAD >/dev/null 2>&1 || true
@git add -A
@git commit -m "$$(echo '$(COMMIT_MSG)')" || echo "Nenhuma modificação para commitar."
@git push $(GIT_REMOTE) $(GIT_BRANCH)
$(MAKE) sync-neurotron
@$(MAKE) wiki
# ===========================
# Git Remote (HTTPS → SSH Auto-Fix)
# ===========================
check-remote:
@REMOTE_URL=$$(git remote get-url $(GIT_REMOTE)); \
if echo $$REMOTE_URL | grep -q '^https://gitea\.neoricalex\.com'; then \
echo "⚠️ Repositório configurado com HTTPS:"; \
echo " $$REMOTE_URL"; \
echo "🔄 Convertendo para SSH (porta 2222)..."; \
SSH_URL=$$(echo $$REMOTE_URL | sed -E 's|https://gitea\.neoricalex\.com[:/]+|ssh://git@gitea.neoricalex.com:2222/|'); \
git remote set-url $(GIT_REMOTE) $$SSH_URL; \
echo "✅ Remote atualizado para:"; \
git remote -v; \
else \
echo "✅ Remote SSH já configurado:"; \
git remote -v | grep $(GIT_REMOTE); \
fi; \
echo "🔍 Testando conectividade SSH com Gitea..."; \
if ssh -T git@gitea.neoricalex.com -p 2222 2>&1 | grep -q "successfully authenticated"; then \
echo "✅ Conexão SSH funcional com Gitea."; \
else \
echo "❌ Falha na autenticação SSH com Gitea."; \
echo " Verifique a chave em ~/.ssh/id_ed25519.pub e nas SSH Keys do Gitea."; \
exit 1; \
fi
# ===========================
# Sincronizar Neurotron (SSH auto-fix + push)
# ===========================
sync-neurotron:
@echo ""
@echo "🧠 Sincronizando Neurotron…"
@if [ ! -d "$(NEUROTRON_DIR)/.git" ]; then \
echo "⚠️ Neurotron não é um repositório git — ignorado."; \
exit 0; \
fi
@cd $(NEUROTRON_DIR) && \
REMOTE_URL=$$(git remote get-url $(NEUROTRON_REMOTE)); \
echo "🔍 Remote atual do Neurotron: $$REMOTE_URL"; \
\
if echo $$REMOTE_URL | grep -q '^https://gitea\.neoricalex\.com'; then \
echo "⚠️ Neurotron ainda está em HTTPS. Convertendo para SSH:2222…"; \
SSH_URL=$$(echo $$REMOTE_URL | sed -E 's|https://gitea\.neoricalex\.com[:/]+|ssh://git@gitea.neoricalex.com:2222/|'); \
git remote set-url $(NEUROTRON_REMOTE) $$SSH_URL; \
echo "✅ Remote atualizado: $$SSH_URL"; \
fi; \
\
if echo $$REMOTE_URL | grep -q '^ssh://git@gitea\.neoricalex\.com/'; then \
echo "⚠️ SSH sem porta detectado. Ajustando porta 2222…"; \
SSH_URL=$$(echo $$REMOTE_URL | sed -E 's|ssh://git@gitea.neoricalex.com/|ssh://git@gitea.neoricalex.com:2222/|'); \
git remote set-url $(NEUROTRON_REMOTE) $$SSH_URL; \
echo "✅ Remote atualizado: $$SSH_URL"; \
fi
@if ssh -T git@gitea.neoricalex.com -p 2222 2>&1 | grep -q "successfully authenticated"; then \
echo "🔐 SSH OK para Neurotron."; \
else \
echo "❌ Falha de autenticação SSH para Neurotron."; \
exit 1; \
fi
@cd $(NEUROTRON_DIR) && \
git add -A && \
git commit -m "Auto-commit via make git (triggered by NFDOS)" || echo "Nenhuma modificação no Neurotron."; \
git push $(NEUROTRON_REMOTE) $(NEUROTRON_BRANCH); \
echo "✔ Neurotron sincronizado."
# ===========================
# Sync Wiki (Markdown → Gitea Wiki)
# ===========================
wiki:
@echo "📚 Sincronizando Wiki…"
@if [ ! -d "$(WIKI_SRC)" ]; then \
echo "⚠️ Nenhuma documentação encontrada em $(WIKI_SRC)"; \
exit 0; \
fi
@if [ ! -d "$(WIKI_TMP)/.git" ]; then \
echo "🔄 Clonando wiki…"; \
rm -rf "$(WIKI_TMP)"; \
git clone "$(WIKI_REPO)" "$(WIKI_TMP)"; \
else \
echo "🔄 Atualizando wiki…"; \
cd "$(WIKI_TMP)" && git pull; \
fi
@echo "📁 Atualizando páginas…"
@rsync -av --delete --exclude='.git' "$(WIKI_SRC)/" "$(WIKI_TMP)/"
@echo "📤 Enviando alterações para o repositório da wiki…"
@cd "$(WIKI_TMP)" && \
git add -A && \
git commit -m "Auto-update wiki via make" || echo "Nenhuma modificação." && \
git push
@echo "✅ Wiki sincronizada!"
# ===========================
# Release (ISO + Tarball)
# ===========================
release: iso tarball
@# --- Proteção: evitar builds "dirty" ---
@if ! git diff --quiet || ! git diff --cached --quiet; then \
echo "❌ Existem alterações não commitadas. Faça commit antes de gerar a release."; \
git status -s; \
exit 1; \
fi
@echo "🚀 Publicando build em dist/releases (versão: $(GIT_VER))"
@mkdir -p $(DIST_DIR)/releases
@if ls $(DIST_DIR)/nfdos-*.iso >/dev/null 2>&1; then \
cp $(DIST_DIR)/nfdos-*.iso $(DIST_DIR)/releases/; \
else \
echo "⚠️ Nenhuma ISO encontrada. Execute 'make iso' primeiro."; \
fi
@if ls $(DIST_DIR)/nfdos-*.tar.gz >/dev/null 2>&1; then \
cp $(DIST_DIR)/nfdos-*.tar.gz $(DIST_DIR)/releases/; \
else \
echo "⚠️ Nenhum tarball encontrado. Execute 'make tarball' primeiro."; \
fi
@git add $(DIST_DIR)/releases/
@git commit -m "Build automático: release $(GIT_VER)" || echo "Nenhum ficheiro novo para commitar."
@git push origin main
# ===========================
# Limpeza
# ===========================
clean-local:
@echo "[CLEAN] Removendo diretórios temporários..."
rm -rf $(BUILD_DIR)
find $(DIST_DIR) -type f ! -path "$(DIST_DIR)/releases/*" -delete
@echo "[CLEAN] Limpando build interno do Neurotron..."
@if [ -d "$(top_srcdir)/src/_nfdos/kernel/neurotron" ]; then \
$(MAKE) -C $(top_srcdir)/src/_nfdos/kernel/neurotron clean || true; \
fi
@echo "[✔] Limpeza concluída (releases preservadas)"
```
e o configure.ac:
```
# ===========================
# Versão dinâmica (Git)
# ===========================
m4_define([NEO_VERSION],
m4_esyscmd_s([git describe --tags --always --dirty 2>/dev/null || echo "0.1-dev"]))
AC_INIT([NFDOS], m4_defn([NEO_VERSION]), [https://gitea.neoricalex.com/neo/nfdos.git])
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])
AM_PATH_PYTHON([2.5])
# Diretórios base (para substituição automática)
AC_SUBST([BUILD_DIR], [$PWD/build])
AC_SUBST([DIST_DIR], [$PWD/dist])
AC_SUBST([ISO_DIR], [$PWD/dist/iso/boot/grub])
AC_SUBST([ISO_FILE], [$PWD/dist/nfdos-${PACKAGE_VERSION}.iso])
AC_SUBST([SRC_TAR], [$PWD/dist/nfdos-${PACKAGE_VERSION}-src.tar.gz])
AC_SUBST([NEO_VERSION])
AM_MAKEFLAGS = '-j1'
AC_SUBST([AM_MAKEFLAGS])
# força exportação explícita de $(MAKE)
MAKE=${MAKE-make}
AC_SUBST([MAKE])
AC_CONFIG_FILES([
Makefile
src/Makefile
])
AC_OUTPUT
```

View File

@ -59,14 +59,6 @@ Ou seja, o sistema inteiro nasce com a mente já embutida — *o primeiro SO ver
Antes de crescermos mais:
### ✔ Hippocampus → só stdlib JSON
(evtl. compressão futura tipo `.jsonl.gz`)
### ✔ TUI ajustada com menu_docs
(“compilar doc” + “ver doc”)
### ✔ Branding estável
`NFDOS v0.1 — inicializador` (sem “dirty”)
@ -97,6 +89,18 @@ O Neurotron agora **tem corpo e ciclo estável**, então:
**Isto permite o TRM operar com dados reais.**
### preparar o “modo futuro”: .jsonl.gz
Quando quiseres, podemos adicionar:
```
import gzip
with gzip.open("events.jsonl.gz", "at", encoding="utf-8") as f:
```
Assim o Neurotron pode ter:
* compressão automática
* rotação diária
* replay ultra rápido
---
# 🧬 **3. TRM (Tiny Recursive Model) — A EVOLUÇÃO NATURAL DO NEUROTRON**

View File

@ -8,7 +8,7 @@ GIT_EMAIL ?= "neo.webmaster.2@gmail.com"
GIT_REMOTE ?= "origin"
GIT_BRANCH ?= "main"
COMMIT_MSG ?= "Auto-commit via make git"
GIT_VER := $(shell git describe --tags --always --dirty 2>/dev/null || echo "0.1-dev")
GIT_VER := $(shell git describe --tags --always --abbrev=7 2>/dev/null || echo "0.1-dev")
NEUROTRON_DIR ?= $(top_srcdir)/src/_nfdos/kernel/neurotron
NEUROTRON_REMOTE ?= origin

View File

@ -2,7 +2,7 @@
# Versão dinâmica (Git)
# ===========================
m4_define([NEO_VERSION],
m4_esyscmd_s([git describe --tags --always --dirty 2>/dev/null || echo "0.1-dev"]))
m4_esyscmd_s([git describe --tags --always --abbrev=7 2>/dev/null || echo "0.1-dev"]))
AC_INIT([NFDOS], m4_defn([NEO_VERSION]), [https://gitea.neoricalex.com/neo/nfdos.git])
AM_INIT_AUTOMAKE([foreign dist-bzip2 no-dist-gzip])

View File

@ -1,15 +1,12 @@
from pathlib import Path
from datetime import datetime
try:
import orjson as json
except Exception:
import json # type: ignore
import json
class Hippocampus:
"""
Memória contextual simples (JSON Lines): append-only.
Guarda perceções, decisões e ações para replays futuros.
Apenas stdlib JSON 100% compatível com Python estático.
"""
def __init__(self, log_dir: Path):
@ -25,15 +22,11 @@ class Hippocampus:
}
try:
# Compatível com orjson e stdlib json
blob = json.dumps(rec)
if isinstance(blob, str):
blob = blob.encode("utf-8")
with self.events_file.open("ab") as f:
f.write(blob)
f.write(b"\n")
# stdlib json → sempre string
blob = json.dumps(rec, separators=(",", ":")) # compacto
with self.events_file.open("a", encoding="utf-8") as f:
f.write(blob + "\n")
except Exception:
# Evitar crash em early boot ou IO quebrado
# nunca crashar o Neurotron por logs
pass

View File

@ -1,15 +1,12 @@
from pathlib import Path
from datetime import datetime
try:
import orjson as json
except Exception:
import json # type: ignore
import json
class Hippocampus:
"""
Memória contextual simples (JSON Lines): append-only.
Guarda perceções, decisões e ações para replays futuros.
Apenas stdlib JSON 100% compatível com Python estático.
"""
def __init__(self, log_dir: Path):
@ -25,15 +22,11 @@ class Hippocampus:
}
try:
# Compatível com orjson e stdlib json
blob = json.dumps(rec)
if isinstance(blob, str):
blob = blob.encode("utf-8")
with self.events_file.open("ab") as f:
f.write(blob)
f.write(b"\n")
# stdlib json → sempre string
blob = json.dumps(rec, separators=(",", ":")) # compacto
with self.events_file.open("a", encoding="utf-8") as f:
f.write(blob + "\n")
except Exception:
# Evitar crash em early boot ou IO quebrado
# nunca crashar o Neurotron por logs
pass

View File

@ -4,9 +4,18 @@ PYTHON="/usr/bin/python3"
NEUROTRON_HOME="/opt/kernel/neurotron"
SRC="$NEUROTRON_HOME/src"
# Garante diretórios básicos
mkdir -p /proc /sys /dev
# Montar proc, sysfs e devtmpfs (idempotente, falha silenciosa se já montado)
mount -t proc proc /proc 2>/dev/null || true
mount -t sysfs sys /sys 2>/dev/null || true
mount -t devtmpfs devtmpfs /dev 2>/dev/null || true
# Ambiente Python minimalista
export PYTHONHOME="/usr"
export PYTHONPATH="$SRC:/usr/lib/python3.13:/usr/lib/python3.13/site-packages"
export PATH="/sbin:/bin:/usr/sbin:/usr/bin:$PATH"
# Arrancar o cérebro principal como módulo do package
exec "$PYTHON" -m neurotron "$@"
exec "$PYTHON" -m neurotron "$@"

View File

@ -6,6 +6,6 @@ sys.path.insert(1, '/usr/local/local/lib/python3.12/dist-packages')
from bootstrap import Application
if __name__ == "__main__":
app = Application(package="nfdos", version="5281bb3-dirty")
app = Application(package="nfdos", version="eb291d7")
app.run()