From 9d4d395881a811182b71e349ed9477e271c2e769 Mon Sep 17 00:00:00 2001 From: WanderMotta Date: Fri, 24 Jul 2026 23:55:21 -0300 Subject: [PATCH] Commit inicial - upload de todos os arquivos da pasta --- .claude/commands/opsx/apply.md | 156 ++++ .claude/commands/opsx/archive.md | 161 ++++ .claude/commands/opsx/continue.md | 118 +++ .claude/commands/opsx/explore.md | 175 ++++ .claude/commands/opsx/new.md | 72 ++ .claude/commands/opsx/onboard.md | 551 +++++++++++ .claude/commands/opsx/propose.md | 110 +++ .claude/commands/opsx/sync.md | 144 +++ .claude/commands/opsx/verify.md | 168 ++++ .claude/scheduled_tasks.lock | 1 + .claude/skills/openspec-apply-change/SKILL.md | 160 ++++ .../skills/openspec-archive-change/SKILL.md | 118 +++ .../skills/openspec-continue-change/SKILL.md | 122 +++ .claude/skills/openspec-explore/SKILL.md | 290 ++++++ .claude/skills/openspec-new-change/SKILL.md | 77 ++ .claude/skills/openspec-onboard/SKILL.md | 555 +++++++++++ .claude/skills/openspec-onboard/leiame.md | 65 ++ .claude/skills/openspec-propose/SKILL.md | 114 +++ .claude/skills/openspec-sync-specs/SKILL.md | 148 +++ .../skills/openspec-verify-change/SKILL.md | 172 ++++ .env.example | 24 + .gitignore | 23 + DEPLOY.md | 100 ++ Dockerfile | 39 + README.md | 69 ++ Skill/dados/lernotafiscal.db | Bin 0 -> 16384 bytes app.py | 16 + app/__init__.py | 3 + app/ai_extraction.py | 187 ++++ app/auth.py | 90 ++ app/categorization.py | 130 +++ app/config.py | 97 ++ app/database.py | 876 ++++++++++++++++++ app/dates.py | 74 ++ app/ingestion.py | 65 ++ app/main.py | 91 ++ app/routes/__init__.py | 0 app/routes/auth_routes.py | 45 + app/routes/categoria_routes.py | 99 ++ app/routes/dashboard_routes.py | 48 + app/routes/documents_routes.py | 263 ++++++ app/routes/files_routes.py | 39 + app/routes/upload_routes.py | 203 ++++ app/static/app.js | 59 ++ app/static/styles.css | 223 +++++ app/storage.py | 33 + app/templates/base.html | 62 ++ app/templates/categoria_form.html | 32 + app/templates/categorias_list.html | 45 + app/templates/dashboard.html | 132 +++ app/templates/document_form.html | 56 ++ app/templates/documents_list.html | 144 +++ app/templates/login.html | 23 + app/templates/staging.html | 105 +++ app/templating.py | 45 + deploy/lernotafiscal.service | 21 + deploy/nginx.conf | 21 + docker-compose.yml | 44 + github.bat | 32 + lernotafiscal/__init__.py | 2 + lernotafiscal/db.py | 317 +++++++ lernotafiscal/extraction.py | 392 ++++++++ openspec/changes/ajuste-1/.openspec.yaml | 2 + openspec/changes/ajuste-1/design.md | 33 + openspec/changes/ajuste-1/proposal.md | 26 + .../specs/document-categorization/spec.md | 19 + .../document-listing-category-column/spec.md | 23 + openspec/changes/ajuste-1/tasks.md | 34 + .../2026-07-24-competencia/.openspec.yaml | 2 + .../archive/2026-07-24-competencia/design.md | 75 ++ .../2026-07-24-competencia/proposal.md | 36 + .../specs/document-competencia/spec.md | 81 ++ .../archive/2026-07-24-competencia/tasks.md | 65 ++ openspec/changes/categoria/.openspec.yaml | 2 + openspec/changes/categoria/design.md | 81 ++ openspec/changes/categoria/proposal.md | 37 + .../categorization-safety-limits/spec.md | 40 + .../specs/expense-categorization/spec.md | 113 +++ openspec/changes/categoria/tasks.md | 44 + openspec/config.yaml | 20 + openspec/specs/document-competencia/spec.md | 87 ++ requirements.txt | 15 + scripts/migrate_notas.py | 82 ++ subir_servidor.bat | 29 + tests/__init__.py | 1 + tests/test_app.py | 157 ++++ tests/test_categorization.py | 420 +++++++++ tests/test_ingestion.py | 114 +++ 88 files changed, 9484 insertions(+) create mode 100644 .claude/commands/opsx/apply.md create mode 100644 .claude/commands/opsx/archive.md create mode 100644 .claude/commands/opsx/continue.md create mode 100644 .claude/commands/opsx/explore.md create mode 100644 .claude/commands/opsx/new.md create mode 100644 .claude/commands/opsx/onboard.md create mode 100644 .claude/commands/opsx/propose.md create mode 100644 .claude/commands/opsx/sync.md create mode 100644 .claude/commands/opsx/verify.md create mode 100644 .claude/scheduled_tasks.lock create mode 100644 .claude/skills/openspec-apply-change/SKILL.md create mode 100644 .claude/skills/openspec-archive-change/SKILL.md create mode 100644 .claude/skills/openspec-continue-change/SKILL.md create mode 100644 .claude/skills/openspec-explore/SKILL.md create mode 100644 .claude/skills/openspec-new-change/SKILL.md create mode 100644 .claude/skills/openspec-onboard/SKILL.md create mode 100644 .claude/skills/openspec-onboard/leiame.md create mode 100644 .claude/skills/openspec-propose/SKILL.md create mode 100644 .claude/skills/openspec-sync-specs/SKILL.md create mode 100644 .claude/skills/openspec-verify-change/SKILL.md create mode 100644 .env.example create mode 100644 .gitignore create mode 100644 DEPLOY.md create mode 100644 Dockerfile create mode 100644 README.md create mode 100644 Skill/dados/lernotafiscal.db create mode 100644 app.py create mode 100644 app/__init__.py create mode 100644 app/ai_extraction.py create mode 100644 app/auth.py create mode 100644 app/categorization.py create mode 100644 app/config.py create mode 100644 app/database.py create mode 100644 app/dates.py create mode 100644 app/ingestion.py create mode 100644 app/main.py create mode 100644 app/routes/__init__.py create mode 100644 app/routes/auth_routes.py create mode 100644 app/routes/categoria_routes.py create mode 100644 app/routes/dashboard_routes.py create mode 100644 app/routes/documents_routes.py create mode 100644 app/routes/files_routes.py create mode 100644 app/routes/upload_routes.py create mode 100644 app/static/app.js create mode 100644 app/static/styles.css create mode 100644 app/storage.py create mode 100644 app/templates/base.html create mode 100644 app/templates/categoria_form.html create mode 100644 app/templates/categorias_list.html create mode 100644 app/templates/dashboard.html create mode 100644 app/templates/document_form.html create mode 100644 app/templates/documents_list.html create mode 100644 app/templates/login.html create mode 100644 app/templates/staging.html create mode 100644 app/templating.py create mode 100644 deploy/lernotafiscal.service create mode 100644 deploy/nginx.conf create mode 100644 docker-compose.yml create mode 100644 github.bat create mode 100644 lernotafiscal/__init__.py create mode 100644 lernotafiscal/db.py create mode 100644 lernotafiscal/extraction.py create mode 100644 openspec/changes/ajuste-1/.openspec.yaml create mode 100644 openspec/changes/ajuste-1/design.md create mode 100644 openspec/changes/ajuste-1/proposal.md create mode 100644 openspec/changes/ajuste-1/specs/document-categorization/spec.md create mode 100644 openspec/changes/ajuste-1/specs/document-listing-category-column/spec.md create mode 100644 openspec/changes/ajuste-1/tasks.md create mode 100644 openspec/changes/archive/2026-07-24-competencia/.openspec.yaml create mode 100644 openspec/changes/archive/2026-07-24-competencia/design.md create mode 100644 openspec/changes/archive/2026-07-24-competencia/proposal.md create mode 100644 openspec/changes/archive/2026-07-24-competencia/specs/document-competencia/spec.md create mode 100644 openspec/changes/archive/2026-07-24-competencia/tasks.md create mode 100644 openspec/changes/categoria/.openspec.yaml create mode 100644 openspec/changes/categoria/design.md create mode 100644 openspec/changes/categoria/proposal.md create mode 100644 openspec/changes/categoria/specs/categorization-safety-limits/spec.md create mode 100644 openspec/changes/categoria/specs/expense-categorization/spec.md create mode 100644 openspec/changes/categoria/tasks.md create mode 100644 openspec/config.yaml create mode 100644 openspec/specs/document-competencia/spec.md create mode 100644 requirements.txt create mode 100644 scripts/migrate_notas.py create mode 100644 subir_servidor.bat create mode 100644 tests/__init__.py create mode 100644 tests/test_app.py create mode 100644 tests/test_categorization.py create mode 100644 tests/test_ingestion.py diff --git a/.claude/commands/opsx/apply.md b/.claude/commands/opsx/apply.md new file mode 100644 index 0000000..c6cb9b6 --- /dev/null +++ b/.claude/commands/opsx/apply.md @@ -0,0 +1,156 @@ +--- +name: "OPSX: Apply" +description: Implement tasks from an OpenSpec change (Experimental) +allowed-tools: Bash(openspec:*) +category: Workflow +tags: [workflow, artifacts, experimental] +--- + +Implement tasks from an OpenSpec change. + +**Store selection:** If the user names a store (a store is a standalone OpenSpec repo registered on this machine) or the work lives in one, run `openspec store list --json` to discover registered store ids, then pass `--store ` on the commands that read or write specs and changes (`new change`, `status`, `instructions`, `list`, `show`, `validate`, `archive`, `doctor`, `context`). Other commands do not take the flag. Hints printed by commands already carry the flag; keep it on follow-ups. Without a store, commands act on the nearest local `openspec/` root. + +**Input**: Optionally specify a change name (e.g., `/opsx:apply add-auth`). If omitted, check if it can be inferred from conversation context. If vague or ambiguous you MUST prompt for available changes. + +**Steps** + +1. **Select the change** + + If a name is provided, use it. Otherwise: + - Infer from conversation context if the user mentioned a change + - Auto-select if only one active change exists + - If ambiguous, run `openspec list --json` to get available changes and use the **AskUserQuestion tool** to let the user select + + Always announce: "Using change: " and how to override (e.g., `/opsx:apply `). + +2. **Check status to understand the schema** + ```bash + openspec status --change "" --json + ``` + Parse the JSON to understand: + - `schemaName`: The workflow being used (e.g., "spec-driven") + - `planningHome`, `changeRoot`, and `actionContext`: planning scope and edit constraints + - Which artifact contains the tasks (typically "tasks" for spec-driven, check status for others) + +3. **Get apply instructions** + + ```bash + openspec instructions apply --change "" --json + ``` + + This returns: + - `contextFiles`: artifact ID -> array of concrete file paths (varies by schema) + - Progress (total, complete, remaining) + - Task list with status + - Dynamic instruction based on current state + + **Handle states:** + - If `state: "blocked"` (missing artifacts): show message, suggest using `/opsx:continue` + - If `state: "all_done"`: congratulate, suggest archive + - Otherwise: proceed to implementation + +4. **Read context files** + + Read every file path listed under `contextFiles` from the apply instructions output. + The files depend on the schema being used: + - **spec-driven**: proposal, specs, design, tasks + - Other schemas: follow the contextFiles from CLI output + +5. **Show current progress** + + Display: + - Schema being used + - Progress: "N/M tasks complete" + - Remaining tasks overview + - Dynamic instruction from CLI + +6. **Implement tasks (loop until done or blocked)** + + For each pending task: + - Show which task is being worked on + - Make the code changes required + - Keep changes minimal and focused + - Mark task complete in the tasks file: `- [ ]` → `- [x]` + - Continue to next task + + **Pause if:** + - Task is unclear → ask for clarification + - Implementation reveals a design issue → suggest updating artifacts + - Error or blocker encountered → report and wait for guidance + - User interrupts + +7. **On completion or pause, show status** + + Display: + - Tasks completed this session + - Overall progress: "N/M tasks complete" + - If all done: suggest archive + - If paused: explain why and wait for guidance + +**Output During Implementation** + +``` +## Implementing: (schema: ) + +Working on task 3/7: +[...implementation happening...] +✓ Task complete + +Working on task 4/7: +[...implementation happening...] +✓ Task complete +``` + +**Output On Completion** + +``` +## Implementation Complete + +**Change:** +**Schema:** +**Progress:** 7/7 tasks complete ✓ + +### Completed This Session +- [x] Task 1 +- [x] Task 2 +... + +All tasks complete! You can archive this change with `/opsx:archive`. +``` + +**Output On Pause (Issue Encountered)** + +``` +## Implementation Paused + +**Change:** +**Schema:** +**Progress:** 4/7 tasks complete + +### Issue Encountered + + +**Options:** +1.