-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathschemas.py
More file actions
97 lines (73 loc) · 3.92 KB
/
Copy pathschemas.py
File metadata and controls
97 lines (73 loc) · 3.92 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# schemas.py — shared across code-extract.py, code-ingest.py, code-watch.py
"""
Shared Pydantic schemas for Knowledge Tree — Code-Wiki.
Importable without external deps for type checking (pydantic is the only dependency).
"""
from __future__ import annotations
from typing import Literal
from pydantic import BaseModel
class RepoConfig(BaseModel):
name: str # human name, e.g. "demand-ai"
owner: str # GitHub owner, e.g. "inform-group"
repo: str # GitHub repo name, e.g. "demand-ai"
branch: str = "main"
language: str = "" # e.g. "python" or "python,typescript"
ticket_pattern: str = r'[A-Z]+-\d+|#\d+' # regex for ticket refs
privacy: Literal["internal", "personal", "public"] = "internal"
code_wiki_path: str = "" # relative to vault root, auto-derived if empty
class ManualConfig(BaseModel):
"""Optionaler Override für ein einzelnes Manual.
Ohne Eintrag wird der Slug automatisch aus dem Dateinamen abgeleitet und
`ManualsWatchConfig.default_max_level` verwendet. Diese Klasse erlaubt
abweichende Slugs (z.B. `addone-bo-admin` statt `administratorhandbuch-...`)
oder File-spezifisches `max_level` / `skip_images`.
"""
file: str # exakter Dateiname in watch_dir
product: str # gewünschter Produkt-Slug
max_level: int = 2 # TOC-Tiefe
skip_images: bool = False
class ManualsWatchConfig(BaseModel):
watch_dir: str = "raw/manuals" # relativ zu VAULT_ROOT
default_max_level: int = 2 # für alle nicht-overrideten PDFs
skip_images: bool = False
products: list[ManualConfig] = [] # Overrides — alle PDFs im watch_dir werden
# automatisch erfasst, auch wenn nicht gelistet
class WatchConfig(BaseModel):
github_token: str
repos: list[RepoConfig]
poll_interval_minutes: int = 15
last_poll_state_file: str = ".code-watch-state.json"
manuals: ManualsWatchConfig | None = None
class TicketRef(BaseModel):
id: str # e.g. "DAI-123", "#42"
source: str # "commit_message" | "branch_name" | "pr_title"
confidence: float = 1.0
class FileChange(BaseModel):
path: str
change_type: Literal["added", "modified", "deleted", "renamed"]
module: str # LLM-inferred module/domain this file belongs to
class CommitDigest(BaseModel):
sha: str
author: str
timestamp: str # ISO 8601
original_message: str
semantic_summary: str # LLM: what was done semantically (1-3 sentences)
ticket_refs: list[TicketRef]
impact_areas: list[str] # affected modules/domains
files_changed: list[FileChange]
complexity: Literal["small", "medium", "large", "refactor"]
shared_concept: str | None # generalizable pattern? None if not
repo_name: str # which repo this came from
repo_owner: str
class PMUpdate(BaseModel):
ticket_id: str | None = None # primary ticket if any
repo_name: str
one_liner: str # for pm-overview.md: "DAI-123: Added retry logic to forecasting engine"
class CodeWikiPage(BaseModel):
path: str # relativ zu code-wiki/<projekt>/
action: Literal["create", "update"]
content: str
class CodeIngestResponse(BaseModel):
code_pages: list[CodeWikiPage] # → code-wiki/<projekt>/
wiki_concepts: list[CodeWikiPage] = [] # → wiki/concepts/ (kein Code, nur Semantik)
pm_update: PMUpdate