From c3f59f7b7a70dc8e67bf5f35643e40e0ca12d368 Mon Sep 17 00:00:00 2001 From: kpa39l Date: Sun, 13 Sep 2026 15:58:32 +0000 Subject: [PATCH] =?UTF-8?q?Initial=20import:=20vesti.nixg.ru=20=E2=80=94?= =?UTF-8?q?=20=D0=BD=D0=BE=D0=B2=D0=BE=D1=81=D1=82=D0=BD=D0=BE=D0=B9=20?= =?UTF-8?q?=D0=B0=D0=BF=D1=80=D1=83=D0=B2-=D0=BF=D1=80=D0=BE=D0=B5=D0=BA?= =?UTF-8?q?=D1=82=20(web,=20crawler,=20classifier,=20publisher,=20openspec?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 18 + .gitignore | 13 + .hermes/skills/openspec-apply-change/SKILL.md | 188 ++++++++ .../skills/openspec-archive-change/SKILL.md | 182 ++++++++ .hermes/skills/openspec-explore/SKILL.md | 335 +++++++++++++++ .hermes/skills/openspec-propose/SKILL.md | 153 +++++++ .hermes/skills/openspec-sync-specs/SKILL.md | 262 ++++++++++++ .../skills/openspec-update-change/SKILL.md | 91 ++++ AGENT.MD | 59 +++ PRD.md | 196 +++++++++ STATUS.md | 118 +++++ TODO.md | 56 +++ WALKTHROUGH.md | 403 ++++++++++++++++++ backup.sh | 53 +++ classifier/__init__.py | 0 classifier/classify.py | 232 ++++++++++ classifier/keywords.py | 120 ++++++ config.py | 34 ++ crawler/__init__.py | 0 crawler/auth_telegram.py | 50 +++ crawler/backfill_dedinit.py | 185 ++++++++ crawler/telegram_crawler.py | 370 ++++++++++++++++ openspec/changes/archive/.gitkeep | 0 .../deexternalize-web-assets/.openspec.yaml | 2 + .../deexternalize-web-assets/design.md | 27 ++ .../deexternalize-web-assets/proposal.md | 38 ++ .../changes/deexternalize-web-assets/tasks.md | 18 + .../changes/fix-approve-dirn/.openspec.yaml | 3 + openspec/changes/fix-approve-dirn/design.md | 45 ++ openspec/changes/fix-approve-dirn/proposal.md | 26 ++ openspec/changes/fix-approve-dirn/tasks.md | 8 + .../changes/own-content-hub/.openspec.yaml | 2 + openspec/changes/own-content-hub/design.md | 106 +++++ openspec/changes/own-content-hub/proposal.md | 65 +++ .../own-content-hub/specs/classifier/spec.md | 30 ++ .../own-content-hub/specs/news-store/spec.md | 21 + .../own-content-hub/specs/tg-crawler/spec.md | 32 ++ .../specs/tg-publisher/spec.md | 43 ++ .../own-content-hub/specs/vesti-web/spec.md | 28 ++ openspec/changes/own-content-hub/tasks.md | 60 +++ .../publisher-dry-run-fix/.openspec.yaml | 3 + .../changes/publisher-dry-run-fix/design.md | 32 ++ .../changes/publisher-dry-run-fix/proposal.md | 24 ++ .../changes/publisher-dry-run-fix/tasks.md | 9 + openspec/changes/publisher-service/design.md | 104 +++++ .../changes/publisher-service/proposal.md | 66 +++ .../specs/tg-publisher-service/spec.md | 79 ++++ openspec/changes/publisher-service/tasks.md | 51 +++ .../changes/rich-repost-card/.openspec.yaml | 2 + openspec/changes/rich-repost-card/design.md | 69 +++ openspec/changes/rich-repost-card/proposal.md | 50 +++ .../specs/tg-publisher/spec.md | 120 ++++++ openspec/changes/rich-repost-card/tasks.md | 24 ++ .../.openspec.yaml | 2 + .../tg-crawler-publisher-prototype/design.md | 105 +++++ .../proposal.md | 35 ++ .../specs/classifier/spec.md | 33 ++ .../specs/news-store/spec.md | 33 ++ .../specs/tg-crawler/spec.md | 66 +++ .../specs/tg-publisher/spec.md | 33 ++ .../specs/vesti-web/spec.md | 40 ++ .../tg-crawler-publisher-prototype/tasks.md | 71 +++ .../changes/unify-directions/.openspec.yaml | 3 + openspec/changes/unify-directions/design.md | 51 +++ openspec/changes/unify-directions/proposal.md | 35 ++ openspec/changes/unify-directions/tasks.md | 12 + .../web-format-datetime/.openspec.yaml | 2 + .../changes/web-format-datetime/design.md | 42 ++ .../changes/web-format-datetime/proposal.md | 26 ++ openspec/changes/web-format-datetime/tasks.md | 17 + .../web-list-filter-no-js/.openspec.yaml | 2 + .../changes/web-list-filter-no-js/design.md | 45 ++ .../changes/web-list-filter-no-js/proposal.md | 35 ++ .../changes/web-list-filter-no-js/tasks.md | 17 + .../changes/web-media-preview/.openspec.yaml | 3 + openspec/changes/web-media-preview/design.md | 60 +++ .../changes/web-media-preview/proposal.md | 28 ++ openspec/changes/web-media-preview/tasks.md | 10 + .../web-render-markdown/.openspec.yaml | 2 + .../changes/web-render-markdown/design.md | 61 +++ .../changes/web-render-markdown/proposal.md | 34 ++ openspec/changes/web-render-markdown/tasks.md | 17 + openspec/config.yaml | 26 ++ openspec/specs/.gitkeep | 0 publisher/__init__.py | 0 publisher/bot.py | 104 +++++ publisher/card.py | 81 ++++ requirements.txt | 14 + scripts/crawler-cron.sh | 20 + scripts/vesti-metrics.sh | 140 ++++++ scripts/vesti-watchdog.sh | 40 ++ services/publisher/.env.example | 9 + services/publisher/Dockerfile | 19 + services/publisher/__init__.py | 0 services/publisher/app/__init__.py | 0 services/publisher/app/channels.py | 12 + services/publisher/app/config.py | 44 ++ services/publisher/app/main.py | 119 ++++++ services/publisher/app/telegram.py | 161 +++++++ services/publisher/docker-compose.yml | 26 ++ services/publisher/requirements.txt | 5 + sources/sources.py | 113 +++++ sources/sources.yaml | 99 +++++ web/__init__.py | 0 web/app.py | 296 +++++++++++++ web/publisher_client.py | 40 ++ web/static/bootstrap.min.css | 6 + web/store.py | 243 +++++++++++ web/templates/base.html | 30 ++ web/templates/candidates.html | 97 +++++ web/templates/login.html | 26 ++ web/templates/metrics.html | 27 ++ web/templates/published.html | 43 ++ 113 files changed, 7065 insertions(+) create mode 100644 .env.example create mode 100644 .gitignore create mode 100644 .hermes/skills/openspec-apply-change/SKILL.md create mode 100644 .hermes/skills/openspec-archive-change/SKILL.md create mode 100644 .hermes/skills/openspec-explore/SKILL.md create mode 100644 .hermes/skills/openspec-propose/SKILL.md create mode 100644 .hermes/skills/openspec-sync-specs/SKILL.md create mode 100644 .hermes/skills/openspec-update-change/SKILL.md create mode 100644 AGENT.MD create mode 100644 PRD.md create mode 100644 STATUS.md create mode 100644 TODO.md create mode 100644 WALKTHROUGH.md create mode 100755 backup.sh create mode 100644 classifier/__init__.py create mode 100644 classifier/classify.py create mode 100644 classifier/keywords.py create mode 100644 config.py create mode 100644 crawler/__init__.py create mode 100644 crawler/auth_telegram.py create mode 100644 crawler/backfill_dedinit.py create mode 100644 crawler/telegram_crawler.py create mode 100644 openspec/changes/archive/.gitkeep create mode 100644 openspec/changes/deexternalize-web-assets/.openspec.yaml create mode 100644 openspec/changes/deexternalize-web-assets/design.md create mode 100644 openspec/changes/deexternalize-web-assets/proposal.md create mode 100644 openspec/changes/deexternalize-web-assets/tasks.md create mode 100644 openspec/changes/fix-approve-dirn/.openspec.yaml create mode 100644 openspec/changes/fix-approve-dirn/design.md create mode 100644 openspec/changes/fix-approve-dirn/proposal.md create mode 100644 openspec/changes/fix-approve-dirn/tasks.md create mode 100644 openspec/changes/own-content-hub/.openspec.yaml create mode 100644 openspec/changes/own-content-hub/design.md create mode 100644 openspec/changes/own-content-hub/proposal.md create mode 100644 openspec/changes/own-content-hub/specs/classifier/spec.md create mode 100644 openspec/changes/own-content-hub/specs/news-store/spec.md create mode 100644 openspec/changes/own-content-hub/specs/tg-crawler/spec.md create mode 100644 openspec/changes/own-content-hub/specs/tg-publisher/spec.md create mode 100644 openspec/changes/own-content-hub/specs/vesti-web/spec.md create mode 100644 openspec/changes/own-content-hub/tasks.md create mode 100644 openspec/changes/publisher-dry-run-fix/.openspec.yaml create mode 100644 openspec/changes/publisher-dry-run-fix/design.md create mode 100644 openspec/changes/publisher-dry-run-fix/proposal.md create mode 100644 openspec/changes/publisher-dry-run-fix/tasks.md create mode 100644 openspec/changes/publisher-service/design.md create mode 100644 openspec/changes/publisher-service/proposal.md create mode 100644 openspec/changes/publisher-service/specs/tg-publisher-service/spec.md create mode 100644 openspec/changes/publisher-service/tasks.md create mode 100644 openspec/changes/rich-repost-card/.openspec.yaml create mode 100644 openspec/changes/rich-repost-card/design.md create mode 100644 openspec/changes/rich-repost-card/proposal.md create mode 100644 openspec/changes/rich-repost-card/specs/tg-publisher/spec.md create mode 100644 openspec/changes/rich-repost-card/tasks.md create mode 100644 openspec/changes/tg-crawler-publisher-prototype/.openspec.yaml create mode 100644 openspec/changes/tg-crawler-publisher-prototype/design.md create mode 100644 openspec/changes/tg-crawler-publisher-prototype/proposal.md create mode 100644 openspec/changes/tg-crawler-publisher-prototype/specs/classifier/spec.md create mode 100644 openspec/changes/tg-crawler-publisher-prototype/specs/news-store/spec.md create mode 100644 openspec/changes/tg-crawler-publisher-prototype/specs/tg-crawler/spec.md create mode 100644 openspec/changes/tg-crawler-publisher-prototype/specs/tg-publisher/spec.md create mode 100644 openspec/changes/tg-crawler-publisher-prototype/specs/vesti-web/spec.md create mode 100644 openspec/changes/tg-crawler-publisher-prototype/tasks.md create mode 100644 openspec/changes/unify-directions/.openspec.yaml create mode 100644 openspec/changes/unify-directions/design.md create mode 100644 openspec/changes/unify-directions/proposal.md create mode 100644 openspec/changes/unify-directions/tasks.md create mode 100644 openspec/changes/web-format-datetime/.openspec.yaml create mode 100644 openspec/changes/web-format-datetime/design.md create mode 100644 openspec/changes/web-format-datetime/proposal.md create mode 100644 openspec/changes/web-format-datetime/tasks.md create mode 100644 openspec/changes/web-list-filter-no-js/.openspec.yaml create mode 100644 openspec/changes/web-list-filter-no-js/design.md create mode 100644 openspec/changes/web-list-filter-no-js/proposal.md create mode 100644 openspec/changes/web-list-filter-no-js/tasks.md create mode 100644 openspec/changes/web-media-preview/.openspec.yaml create mode 100644 openspec/changes/web-media-preview/design.md create mode 100644 openspec/changes/web-media-preview/proposal.md create mode 100644 openspec/changes/web-media-preview/tasks.md create mode 100644 openspec/changes/web-render-markdown/.openspec.yaml create mode 100644 openspec/changes/web-render-markdown/design.md create mode 100644 openspec/changes/web-render-markdown/proposal.md create mode 100644 openspec/changes/web-render-markdown/tasks.md create mode 100644 openspec/config.yaml create mode 100644 openspec/specs/.gitkeep create mode 100644 publisher/__init__.py create mode 100644 publisher/bot.py create mode 100644 publisher/card.py create mode 100644 requirements.txt create mode 100755 scripts/crawler-cron.sh create mode 100755 scripts/vesti-metrics.sh create mode 100755 scripts/vesti-watchdog.sh create mode 100644 services/publisher/.env.example create mode 100644 services/publisher/Dockerfile create mode 100644 services/publisher/__init__.py create mode 100644 services/publisher/app/__init__.py create mode 100644 services/publisher/app/channels.py create mode 100644 services/publisher/app/config.py create mode 100644 services/publisher/app/main.py create mode 100644 services/publisher/app/telegram.py create mode 100644 services/publisher/docker-compose.yml create mode 100644 services/publisher/requirements.txt create mode 100644 sources/sources.py create mode 100644 sources/sources.yaml create mode 100644 web/__init__.py create mode 100644 web/app.py create mode 100644 web/publisher_client.py create mode 100644 web/static/bootstrap.min.css create mode 100644 web/store.py create mode 100644 web/templates/base.html create mode 100644 web/templates/candidates.html create mode 100644 web/templates/login.html create mode 100644 web/templates/metrics.html create mode 100644 web/templates/published.html diff --git a/.env.example b/.env.example new file mode 100644 index 0000000..168bf69 --- /dev/null +++ b/.env.example @@ -0,0 +1,18 @@ +# VESTI — секреты и конфигурация (скопируйте в .env, НЕ коммитить) +# Telegram API (переиспользуем из /opt/icq/docker-compose.yml) +TG_API_ID=24276216 +TG_API_HASH=your_api_hash_here +# прокси для Telegram (из РФ заблокирован) +TG_PROXY=socks5://127.0.0.1:1080 +# Telethon-сессия (путь к каталогу сессии) +TG_SESSION_DIR=/opt/vesti/telegram +# Бот-публикатор (токен от @BotFather) +VESTI_BOT_TOKEN=your_bot_token_here +# Канал публикации (шаблон dedinit_vesti___bot) +VESTI_BOT_CHANNEL=@dedinit_vesti_linux_ru_bot +# Веб-админ +ADMIN_USER=admin +ADMIN_PASSWORD=change_me +# Ollama +OLLAMA_URL=http://127.0.0.1:11434 +OLLAMA_MODEL=qwen3:8b-nothink \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..10999fe --- /dev/null +++ b/.gitignore @@ -0,0 +1,13 @@ +.env +.env.bak* +.env.example.bak +db/ +media/ +backups/ +bundles/ +logs/ +__pycache__/ +*.pyc +.venv/ +telegram/*.session +telegram/*.session-journal diff --git a/.hermes/skills/openspec-apply-change/SKILL.md b/.hermes/skills/openspec-apply-change/SKILL.md new file mode 100644 index 0000000..bc316f0 --- /dev/null +++ b/.hermes/skills/openspec-apply-change/SKILL.md @@ -0,0 +1,188 @@ +--- +name: openspec-apply-change +description: Implement tasks from an OpenSpec change. Use when the user wants to start implementing, continue implementation, or work through tasks. +allowed-tools: Bash(openspec:*) +license: MIT +compatibility: Requires openspec CLI. +metadata: + author: openspec + version: "1.0" + generatedBy: "1.12.0" +--- + +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`, `schemas`, `view`). Once selected, treat `--store ` as sticky for the rest of the workflow. Every unscoped example of those commands below is shorthand: before running it, append the flag. For example, run `openspec status --change "" --json --store ""`, not the unscoped form shown below. 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., `/openspec-apply-change 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 ask the user to select one + + Always announce: "Using change: " and how to override (e.g., `/openspec-apply-change `). + +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 - could be proposal/specs/design/tasks or spec/tests/implementation/docs) + - Progress (total, complete, remaining) + - Task list with status + - Dynamic instruction based on current state + - Optional `context`: current required project instruction input from the selected root + - Optional `operationGuidance`: current advisory guidance for apply + + **Handle states:** + - If `state: "blocked"` (missing artifacts): show message, suggest using `/openspec-continue-change` (if it is not installed, run `openspec status --change "" --json` to see the next artifact and `openspec instructions --change "" --json` for how to create it) + - If `state: "all_done"`: congratulate, suggest archive + - Otherwise: proceed to implementation + + Treat `context` as a required prompt-level input. Read and consider it, and + apply relevant project facts, conventions, and constraints while implementing. + Treat `operationGuidance` as optional additive advice. Read and consider every + entry, and follow entries that are applicable and compatible with the built-in + workflow. + + Keep both fields separate from CLI-returned state, missing artifacts, tasks, + progress, `contextFiles`, and the built-in `instruction`. They are not + evidence of task completion, do not replace the built-in instruction, and do + not permit bypassing a blocked state. If context conflicts with the built-in + instruction, an explicit user choice, or a CLI-controlled value, report the + conflict and preserve the controlling value. If guidance is inapplicable or + conflicts with those controlling inputs, do not follow it and explain why. + These are prompt-level behavior contracts, not enforceable checks. + +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 + + Do not copy `context` or `operationGuidance` verbatim into implementation + files or planning artifacts unless the user separately asks for that content. + +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 + - A task needs work beyond what the spec and tasks describe, or you are tempted to drop, narrow, defer, or accept exceptions to specified behavior to make it fit → surface the added scope and ask; do not absorb it silently + - 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 `/openspec-archive-change`. +``` + +**Output On Pause (Issue Encountered)** + +``` +## Implementation Paused + +**Change:** +**Schema:** +**Progress:** 4/7 tasks complete + +### Issue Encountered + + +**Options:** +1.