Commit graph

98 commits

Author SHA1 Message Date
0c278aefbf chore: hide UUID id column from all index/list views
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 09:04:39 +00:00
c8865e0187 fix: raise PHP-FPM pool to 30 workers to prevent SSE starvation
SSE connections hold a worker for up to 90 s each; the default of 5
children meant the admin UI became unresponsive under normal use.
Mount zzz-pool.conf (loaded after zz-docker.conf) to override only the
pm.* settings without touching daemonize/listen.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 09:02:34 +00:00
cfb5cc4ad0 feat: replace Mistral web_search with Tavily for specs research
- Add WebSearchInterface + TavilyWebSearch (POST /search, max 5 results)
- SpecsResearchAgent now fetches search results first, injects them as
  {{searchResults}} context into the prompt, then calls plain generate()
  — no dependency on model-specific web_search tool support
- Update specs_research prompt template (PHP default + DB migration) to
  use the new {{searchResults}} variable
- Wire TAVILY_API_KEY env var; register TavilyWebSearch in services.yaml

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 08:35:52 +00:00
00dc232426 fix: fall back to plain generate() when web_search tool returns HTTP error
mistral-large-latest may not support the web_search tool type on all API
tiers; catch the exception and retry without web search so the pipeline
does not crash with needs_review.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 08:18:54 +00:00
4739a0b1fe fix: allow Re-run AI for NeedsReview — pipeline may be stuck mid-step
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 08:15:40 +00:00
6eeffadee9 fix: hide Re-run AI for NeedsReview articles — manual review required
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:57:31 +00:00
ef29c3c47f feat: disable Re-run AI when pipeline job is already active
Add hasActiveJobForArticle() to check for queued/processing jobs.
The displayIf closure hides the action while a job is running.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:56:00 +00:00
3928d29420 fix: use askConfirmation instead of setConfirmation (correct EasyAdmin API)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:54:32 +00:00
ec159d7b3a feat: DB-backed translations editable in admin
- Add Translation entity (locale/domain/key/value, unique on all three)
- Add TranslationRepositoryInterface + DoctrineTranslationRepository
- Add DatabaseTranslator decorator (#[AsDecorator]) that checks DB first
  and falls back to YAML files; clears per-request cache on setLocale()
- Add TranslationCrudController with locale/domain filters and read-only
  key/locale/domain on edit to prevent accidental renames
- Add "Übersetzungen / Translations" menu entry in DashboardController
- Migration 20260520000000: create app.translations table
- Migration 20260520010000: seed from admin.en.yaml + admin.de.yaml (204 rows)
- Flatten admin.de.yaml to dot-notation; add new keys for translation CRUD

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:53:52 +00:00
a3984adbed feat: full DE/EN i18n with browser language detection and confirmation dialogs
- Add LocaleSubscriber: detects browser language, honours session override (priority 20)
- Add LocaleSwitchController: stores locale in session, linked from user menu
- Add admin.en.yaml / admin.de.yaml translation files (95 keys each)
- Wire translation fallback to EN in config/packages/translation.yaml
- Replace all hard-coded strings in CRUD controllers with TranslatableMessage
- Inject TranslatorInterface into DashboardController, ArticleCrudController,
  AIPipelineJobCrudController and PipelineStreamController; add locale switcher
  links (English / Deutsch) to the user menu
- Add confirmation dialog to "Re-run AI" and "Retry" pipeline actions

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:48:26 +00:00
4c16f8cd68 feat: live pipeline status notifications via SSE
Adds real-time toast notifications to all admin pages for AI pipeline
job progress. The browser subscribes to an SSE endpoint
(GET /admin/pipeline/events) which polls the DB every 2 seconds and
emits events whenever a job's step or status changes.

- AIPipelineJob gains updatedAt (migration 20260519020000), bumped on
  every state-change method, with an index for efficient polling
- AIPipelineJobRepositoryInterface/Doctrine get findUpdatedSince()
- PipelineStreamController streams SSE with per-connection dedup and
  auto-reconnect (retry: 3000); streams for 90 s then signals reconnect
- pipeline-notifications.js handles EventSource, shows colour-coded
  toasts (queued/processing/completed/failed/needs_review) and is loaded
  globally via DashboardController::configureAssets()

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:36:03 +00:00
a38fe7e72d fix: use web search in SpecsResearchAgent to prevent spec hallucination
The agent was calling generate() — pure model memory — which caused Mistral
to hallucinate specs for older devices (e.g. i5-1135G7 instead of i3-3120M).
generateWithWebSearch() is now used so Mistral queries live sources.

OllamaClientInterface gains generateWithWebSearch(); OllamaClient falls back
to generate() since Ollama has no built-in search tool.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:28:21 +00:00
d5a1353a8b feat: seed default AI prompt templates into database
Inserts the five built-in prompts (specs_research, ebay_title,
ebay_description, vision_analyze, json_coding) so they appear in the
admin editor immediately. The service still falls back to hardcoded
defaults if a row is deleted.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:23:56 +00:00
10862426c1 chore: disable OPcache for dev and mount php.ini as volume
opcache.validate_timestamps=0 caused stale bytecode after code changes —
containers needed a full restart to pick up edits. For dev, OPcache is now
disabled entirely. php.ini is mounted as a volume in all app services so
config changes take effect with a simple `docker compose up -d`, no rebuild.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:22:48 +00:00
8a22be7ba5 fix: record json_coding step and forward serialNumber in JsonCodingHandler
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:19:13 +00:00
49e36a0a06 feat: editable AI prompt templates and articleType context in specs research
All agent prompts are now stored in app.prompt_templates (migration 20260519000000)
and editable by admins via the new AI Prompts CRUD page. If no DB entry exists
for a key the hardcoded default is used automatically as fallback.

PromptTemplateService renders templates with {{variable}} substitution.
All four agents (SpecsResearch, JsonCoding, EbayText, OllamaVision) use the service.

SpecsResearchAgent now receives the articleType name (e.g. "Laptop") so the
specs prompt is scoped to the correct device category instead of being generic.
SpecsResearchHandler loads the ArticleType from the repository for this purpose.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:19:02 +00:00
d667db7b7d chore: switch default AI backend to Mistral and support .env.local override
AI_TEXT_MODEL and AI_VISION_MODEL now point to the Mistral vars by default.
SERP_API_KEY removed. All docker-compose services load .env.local as an
optional overlay so local credentials don't have to go into .env.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:18:53 +00:00
b9907d6c63 feat: replace SerpApi web search with Mistral native web_search tool
MistralClient gains generateWithWebSearch() which uses Mistral's built-in
web_search tool, handling the multi-turn tool-call loop server-side.
SerpApiWebSearch and WebSearchInterface are removed — no longer needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:18:49 +00:00
f3b018e048 feat: enhance Article and ArticleType admin CRUD
- ArticleCrudController: shows manufacturer, model number, photos, pipeline status;
  adds re-run pipeline action and inline attribute editing
- ArticleTypeCrudController: formatValue for required/optional attribute lists on detail page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:18:44 +00:00
020a5ddbc8 feat: add manual ingest form, AI status page and pipeline archive
- ManualIngestController: photo upload form that starts a new pipeline job
- AiStatusController: shows active backend config and runs live connectivity tests
- PipelineArchiveCrudController: read-only view of completed/failed jobs
- ManualIngestType / AttributeValueFormType: form types for ingest and attribute editing
- AiConfigService: encapsulates backend info and test methods for the status page

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:18:39 +00:00
740c9a4e08 feat: enhance pipeline job admin with retry action and step detail view
- Retry button on index and detail pages for failed/needs-review/processing jobs
- Shows inventory number, current step, attempt count, created-at on index
- Detail page renders full AI step output (vision, specs, attributes)
- Filters active jobs by non-completed status via custom query builder

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:18:33 +00:00
6d8a06f151 feat: add step tracking, retry and article lookup to AIPipelineJob
- currentStep column (migration 20260517230000) written per pipeline stage
- recordStep() stores per-step output data and updates currentStep
- resetForRetry() requeues a failed/needs-review job
- getInventoryNumber() / getStatusLabel() helpers for admin display
- markCompleted() now merges rather than replacing outputData
- findByArticleId() added to repository for re-run lookups

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:18:29 +00:00
9e59123683 feat: add manufacturer/model fields to Article and propagate through pipeline
- Article entity gets manufacturer and modelNumber columns (migration 20260517240000)
- Vision output (manufacturer/model) is written to the article in DraftArticleHandler
- manufacturer is forwarded through SpecsResearchMessage so the specs prompt can use it
- serialNumber is now threaded through JsonCodingMessage and ValidationMessage
- EbayTextHandler pulls specsText from the job's stored output data
- DraftArticleHandler supports re-run mode (existing article reuse) and sets Draft status
- ArticleType and AttributeValue get __toString() for form/display use
- ArticleService exposes reserveInventoryNumber() publicly

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-18 07:18:24 +00:00
f55e96b094 chore: add tooling config, test bootstrap, env templates and docs
PHPUnit config (phpunit.dist.xml, bin/phpunit, bootstrap.php), PHP CS
Fixer config, .editorconfig. Separate .env.dev/.env.test templates.
Ollama tunnel setup script. Architecture and plan docs. Updated
application-layer unit tests to match current service signatures.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 22:44:16 +00:00
2cfc5e8f17 feat: add console commands, remaining migrations and config wiring
Console commands: CreateUser (interactive), BackupCommand, RotateLogsCommand.
Migrations 20260514: initial schema for app/logs schemas.
Config: register new bundles, Doctrine schema filter, Kernel micro-kernel
adjustments, deleted unused api.yaml route file and www.conf override.
Application service and API controller updates for the full article lifecycle.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 22:44:11 +00:00
f310643064 feat: add EasyAdmin CRUD controllers, security controller and templates
CRUD controllers for Article, ArticleType, AttributeDefinition,
ArticleTypeAttribute, AIPipelineJob, Order, Customer, Invoice, User
and LogEntry. SecurityController handles login/logout; TotpSetupController
manages 2FA enrollment. API controllers for pipeline and orders.

Admin dashboard template and Twig base layout included.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 22:44:03 +00:00
487c7f8da1 feat: add security layer, domain repositories and infrastructure services
ApiKeyAuthenticator, PermissionVoter and UserProvider implement
Symfony Security for the API (Bearer token) and admin (session) flows.
Domain repository interfaces added for ApiKey, User, AIPipelineJob and
Invoice; Doctrine implementations provided.

Also adds DatabaseLogHandler for structured DB logging, SerpApiWebSearch,
and the LogEntry domain entity.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 22:43:58 +00:00
46cff4553f feat: add eBay and Frappe channel adapters with order infrastructure
eBay adapter covers OAuth, inventory API, fulfillment API, taxonomy
service and webhook signature verification. Frappe ERP adapter wraps
the Frappe HTTP client for order/invoice sync.

Includes CustomerResolver, InvoiceMailer, and the EbayWebhookController
for inbound eBay marketplace notifications.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 22:43:52 +00:00
fddfd920f5 feat: add Symfony Messenger pipeline with AI agents and handlers
Messages and handlers for the full AI pipeline:
DraftArticle → Validation → SpecsResearch → PhotoUpload → EbayText →
JsonCoding → PublishToChannel / DeactivateListingMessage / TrackingPush /
UpdateStockOnChannels / OrderReceived.

OllamaClient and OllamaClientInterface provide the base LLM backend.
AI agents (EbayTextAgent, JsonCodingAgent, OllamaVisionAgent,
SpecsResearchAgent) wrap the client with task-specific prompts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 22:43:47 +00:00
838b96eb14 feat: required/optional attribute sections in ArticleType form
Promote article_type_attributes join table to ArticleTypeAttribute entity
with a required boolean flag. ArticleType gains virtual form properties
(requiredAttributeDefs / optionalAttributeDefs) reconciled via
applyAttributeAssignments() on persist/update.

Admin form shows two Tom Select multi-selects; a small JS module
(article-type-attr-sync.js) listens for ea.autocomplete.connect events
and keeps the two lists mutually exclusive in real time.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 22:43:42 +00:00
f915bba966 feat: admin panel, Mistral client, attribute management, API key command
- Fix EasyAdmin 5 routing: #[AdminDashboard] attribute + easyadmin.routes loader
- Fix login: _username/_password field names, CSRF stateless token config,
  sessions directory, Opcache reload after cache:clear
- Add MistralClient behind OllamaClientInterface — switchable via services.yaml alias
- Add Attribute CRUD with EnumType form + ChoiceField display (enum-safe rendering)
- Add Article Type CRUD with AssociationField for attribute assignments
- Add app:api-keys:create console command (bcrypt-hashed, never stored as plaintext)
- Add redis ext to Docker image + symfony/redis-messenger, start workers
- Translate all UI strings to English
- Add tests: MistralClient, ApiKey, CreateApiKeyCommand, StringArrayType,
  ArticleTypeCrudController, AttributeDefinitionCrudController (82 tests total)
- Update design doc: tech stack, AI backend switching guide, ops section

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 20:15:13 +00:00
edc0cdfd5d fix: rename login field from 'email' to '_username'
Symfony FormLoginAuthenticator expects _username by default.
The field used name="email" which caused 400 Bad Request on submit.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 18:42:32 +00:00
0706fdad58 feat: add self-service password change page at /account/password
Validates current password, enforces 8-char minimum, links from
EasyAdmin user menu. Also fixes route loader (attribute scan instead
of broken easyadmin.routes type).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 18:41:45 +00:00
2914d76b05 fix: revert to FastCGI TCP — Unix socket requires root on FPM master
Unix socket volume was root-owned, FPM running as uid 1000 couldn't
create the socket. TCP app:9000 works without privilege changes and
has negligible performance difference in a local Docker network.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 18:03:06 +00:00
7c402b5c38 feat: configure Caddy for ss3k.schaunwama.de via PHP-FPM Unix socket
Replaces TCP app:9000 with a shared Unix socket volume, adds domain
with automatic Let's Encrypt TLS, and exposes ports 80/443 on Caddy.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 17:58:56 +00:00
d51efa057b feat: add MistralClient as switchable alternative to OllamaClient
Implements OllamaClientInterface against the Mistral Cloud API
(/v1/chat/completions). Switch by toggling the alias in services.yaml
and pointing AI_TEXT_MODEL / AI_VISION_MODEL env vars at the MISTRAL_*
or OLLAMA_* counterparts.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-17 16:03:16 +00:00
6bf001b0c0 feat: implement Plan 2 — Article Management API
- 6 new domain repository interfaces (StoragePath, ArticlePhoto, AttributeValue, ChannelField, ArticleTypePlatformConfig, AttributeMapping)
- 6 Doctrine repository implementations
- StorageManager with multi-path quota-aware file storage (LocalStorageManager)
- Application services: ArticleTypeService, ArticleService, ArticleValidator, PhotoService, PlatformService, MappingService
- REST controllers: ArticleType, Article, Photo, Platform, Mapping (all under /api prefix)
- inventory_number sequence migration
- 22 unit tests passing, PHPStan level 9 clean, CS Fixer clean
- Fixed phpdoc_to_comment CS Fixer rule (disabled) to preserve @var type annotations
- Fixed PHPStan: User::getUserIdentifier non-empty-string, AIPipelineJob nullable missingFields

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-14 05:19:20 +00:00
eafdba10f5 feat: add initial migration — app/logs/logs_archive schemas with all base tables and GIN fulltext index 2026-05-14 04:34:32 +00:00
a9c377789e feat: add Doctrine repository implementations and wire interfaces in services.yaml 2026-05-14 04:31:33 +00:00
047c3e2588 feat: add repository interfaces (ports) for Article, ArticleType, Platform, Customer, Order 2026-05-14 04:30:42 +00:00
e8fb01f707 feat: add Order, Pipeline, Auth domain entities (Customer with matching-key, Order, Invoice, AIPipelineJob, User, ApiKey) 2026-05-14 04:30:12 +00:00
11c894b8a4 feat: add Channel domain cluster (Platform, ChannelField, ArticleTypePlatformConfig, AttributeMapping) 2026-05-14 04:28:41 +00:00
3cc8f57f11 feat: add Article domain cluster (ArticleType, AttributeDefinition, Article, AttributeValue, ArticlePhoto, StoragePath) 2026-05-14 04:28:06 +00:00
6e8a2e070f feat: add domain enums (ArticleStatus with transitions, ArticleCondition, AttributeType, OrderStatus, AIPipelineJob enums) 2026-05-14 04:26:50 +00:00
f4eb39b52a feat: add Gitea Actions CI (CS Fixer, PHPStan, Pest + migrations) 2026-05-14 04:25:50 +00:00
f204233509 feat: add PHPStan level 9, PHP CS Fixer, Pest; fix docker user=1000 to avoid root-owned files 2026-05-14 04:25:30 +00:00
e249c3d80f feat: install Symfony 7 skeleton with Doctrine, Messenger, UID, Security 2026-05-14 04:21:34 +00:00
2a47979e34 feat: add Docker Compose environment with Caddy, PostgreSQL 17, Redis, PHP-FPM workers 2026-05-14 04:14:55 +00:00