semantic update

This commit is contained in:
2026-01-28 16:57:19 +03:00
parent 18b42f8dd0
commit 0e0e26e2f7
18 changed files with 11792 additions and 1427 deletions

1
.gitignore vendored
View File

@@ -68,3 +68,4 @@ backend/mappings.db
backend/tasks.db
backend/logs
backend/auth.db
semantics/reports

View File

@@ -1,5 +1,6 @@
# [DEF:backend.src.api.routes.admin:Module]
#
# @TIER: STANDARD
# @SEMANTICS: api, admin, users, roles, permissions
# @PURPOSE: Admin API endpoints for user and role management.
# @LAYER: API

View File

@@ -1,5 +1,6 @@
# [DEF:backend.src.api.routes.git_schemas:Module]
#
# @TIER: STANDARD
# @SEMANTICS: git, schemas, pydantic, api, contracts
# @PURPOSE: Defines Pydantic models for the Git integration API layer.
# @LAYER: API
@@ -14,6 +15,7 @@ from uuid import UUID
from src.models.git import GitProvider, GitStatus, SyncStatus
# [DEF:GitServerConfigBase:Class]
# @TIER: TRIVIAL
# @PURPOSE: Base schema for Git server configuration attributes.
class GitServerConfigBase(BaseModel):
name: str = Field(..., description="Display name for the Git server")

View File

@@ -1,5 +1,6 @@
# [DEF:backend.src.models.auth:Module]
#
# @TIER: STANDARD
# @SEMANTICS: auth, models, user, role, permission, sqlalchemy
# @PURPOSE: SQLAlchemy models for multi-user authentication and authorization.
# @LAYER: Domain

View File

@@ -1,4 +1,5 @@
# [DEF:backend.src.models.dashboard:Module]
# @TIER: STANDARD
# @SEMANTICS: dashboard, model, metadata, migration
# @PURPOSE: Defines data models for dashboard metadata and selection.
# @LAYER: Model
@@ -8,6 +9,7 @@ from pydantic import BaseModel
from typing import List
# [DEF:DashboardMetadata:Class]
# @TIER: TRIVIAL
# @PURPOSE: Represents a dashboard available for migration.
class DashboardMetadata(BaseModel):
id: int
@@ -17,6 +19,7 @@ class DashboardMetadata(BaseModel):
# [/DEF:DashboardMetadata:Class]
# [DEF:DashboardSelection:Class]
# @TIER: TRIVIAL
# @PURPOSE: Represents the user's selection of dashboards to migrate.
class DashboardSelection(BaseModel):
selected_ids: List[int]

View File

@@ -1,5 +1,6 @@
# [DEF:backend.src.models.mapping:Module]
#
# @TIER: STANDARD
# @SEMANTICS: database, mapping, environment, migration, sqlalchemy, sqlite
# @PURPOSE: Defines the database schema for environment metadata and database mappings using SQLAlchemy.
# @LAYER: Domain
@@ -19,6 +20,7 @@ import enum
Base = declarative_base()
# [DEF:MigrationStatus:Class]
# @TIER: TRIVIAL
# @PURPOSE: Enumeration of possible migration job statuses.
class MigrationStatus(enum.Enum):
PENDING = "PENDING"
@@ -29,6 +31,7 @@ class MigrationStatus(enum.Enum):
# [/DEF:MigrationStatus:Class]
# [DEF:Environment:Class]
# @TIER: STANDARD
# @PURPOSE: Represents a Superset instance environment.
class Environment(Base):
__tablename__ = "environments"
@@ -40,6 +43,7 @@ class Environment(Base):
# [/DEF:Environment:Class]
# [DEF:DatabaseMapping:Class]
# @TIER: STANDARD
# @PURPOSE: Represents a mapping between source and target databases.
class DatabaseMapping(Base):
__tablename__ = "database_mappings"

View File

@@ -1,5 +1,6 @@
# [DEF:backend.src.schemas.auth:Module]
#
# @TIER: STANDARD
# @SEMANTICS: auth, schemas, pydantic, user, token
# @PURPOSE: Pydantic schemas for authentication requests and responses.
# @LAYER: API
@@ -14,6 +15,7 @@ from datetime import datetime
# [/SECTION]
# [DEF:Token:Class]
# @TIER: TRIVIAL
# @PURPOSE: Represents a JWT access token response.
class Token(BaseModel):
access_token: str
@@ -21,6 +23,7 @@ class Token(BaseModel):
# [/DEF:Token:Class]
# [DEF:TokenData:Class]
# @TIER: TRIVIAL
# @PURPOSE: Represents the data encoded in a JWT token.
class TokenData(BaseModel):
username: Optional[str] = None
@@ -28,6 +31,7 @@ class TokenData(BaseModel):
# [/DEF:TokenData:Class]
# [DEF:PermissionSchema:Class]
# @TIER: TRIVIAL
# @PURPOSE: Represents a permission in API responses.
class PermissionSchema(BaseModel):
id: Optional[str] = None

View File

@@ -1,8 +1,9 @@
<!-- [DEF:FileList:Component] -->
<!--
@TIER: STANDARD
@SEMANTICS: storage, files, list, table
@PURPOSE: Displays a table of files with metadata and actions.
@LAYER: Component
@LAYER: UI
@RELATION: DEPENDS_ON -> storageService
@PROPS: files (Array) - List of StoredFile objects.
@@ -22,10 +23,13 @@
// [DEF:isDirectory:Function]
/**
* @purpose Checks if a file object represents a directory.
* @pre file object has mime_type property.
* @post Returns boolean.
* @param {Object} file - The file object to check.
* @return {boolean} True if it's a directory, false otherwise.
*/
function isDirectory(file) {
console.log("[isDirectory][Action] Checking file type");
return file.mime_type === 'directory';
}
// [/DEF:isDirectory:Function]
@@ -33,10 +37,13 @@
// [DEF:formatSize:Function]
/**
* @purpose Formats file size in bytes into a human-readable string.
* @pre bytes is a number.
* @post Returns formatted string.
* @param {number} bytes - The size in bytes.
* @return {string} Formatted size (e.g., "1.2 MB").
*/
function formatSize(bytes) {
console.log(`[formatSize][Action] Formatting ${bytes} bytes`);
if (bytes === 0) return '0 B';
const k = 1024;
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
@@ -48,10 +55,13 @@
// [DEF:formatDate:Function]
/**
* @purpose Formats an ISO date string into a localized readable format.
* @pre dateStr is a valid date string.
* @post Returns localized string.
* @param {string} dateStr - The date string to format.
* @return {string} Localized date and time.
*/
function formatDate(dateStr) {
console.log("[formatDate][Action] Formatting date string");
return new Date(dateStr).toLocaleString();
}
// [/DEF:formatDate:Function]

View File

@@ -1,8 +1,9 @@
<!-- [DEF:FileUpload:Component] -->
<!--
@TIER: STANDARD
@SEMANTICS: storage, upload, files
@PURPOSE: Provides a form for uploading files to a specific category.
@LAYER: Component
@LAYER: UI
@RELATION: DEPENDS_ON -> storageService
@PROPS: None

View File

@@ -1,8 +1,9 @@
<!-- [DEF:AdminRolesPage:Component] -->
<!--
@TIER: STANDARD
@SEMANTICS: admin, role-management, rbac
@PURPOSE: UI for managing system roles and their permissions.
@LAYER: Feature
@LAYER: Domain
@RELATION: DEPENDS_ON -> frontend.src.services.adminService
@RELATION: DEPENDS_ON -> frontend.src.components.auth.ProtectedRoute
@@ -56,7 +57,13 @@
// [/DEF:loadData:Function]
// [DEF:openCreateModal:Function]
/**
* @purpose Initializes state for creating a new role.
* @pre None.
* @post showModal is true, roleForm is reset.
*/
function openCreateModal() {
console.log("[openCreateModal][Action] Opening create modal");
isEditing = false;
currentRoleId = null;
roleForm = { name: '', description: '', permissions: [] };
@@ -65,7 +72,13 @@
// [/DEF:openCreateModal:Function]
// [DEF:openEditModal:Function]
/**
* @purpose Initializes state for editing an existing role.
* @pre role object is provided.
* @post showModal is true, roleForm is populated.
*/
function openEditModal(role) {
console.log(`[openEditModal][Action] Opening edit modal for role ${role.id}`);
isEditing = true;
currentRoleId = role.id;
roleForm = {
@@ -80,6 +93,8 @@
// [DEF:handleSaveRole:Function]
/**
* @purpose Submits role data (create or update).
* @pre roleForm contains valid data.
* @post Role is saved, modal closed, data reloaded.
*/
async function handleSaveRole() {
console.log('[AdminRolesPage][handleSaveRole][Entry]');
@@ -100,6 +115,11 @@
// [/DEF:handleSaveRole:Function]
// [DEF:handleDeleteRole:Function]
/**
* @purpose Deletes a role after confirmation.
* @pre role object is provided.
* @post Role is deleted if confirmed, data reloaded.
*/
async function handleDeleteRole(role) {
if (!confirm($t.admin.roles.confirm_delete.replace('{name}', role.name))) return;

View File

@@ -1,8 +1,9 @@
<!-- [DEF:LoginPage:Component] -->
<!--
@TIER: STANDARD
@SEMANTICS: login, auth, ui, form
@PURPOSE: Provides the user interface for local and ADFS authentication.
@LAYER: Feature
@LAYER: UI
@RELATION: USES -> authStore
@RELATION: CALLS -> api.auth.login

View File

@@ -303,7 +303,7 @@
/>
</div>
<!-- [DEF:DashboardSelectionSection] -->
<!-- [DEF:DashboardSelectionSection:Component] -->
<div class="mb-8">
<h2 class="text-lg font-medium mb-4">Select Dashboards</h2>
@@ -316,7 +316,7 @@
<p class="text-gray-500 italic">Select a source environment to view dashboards.</p>
{/if}
</div>
<!-- [/DEF:DashboardSelectionSection] -->
<!-- [/DEF:DashboardSelectionSection:Component] -->
<div class="flex items-center mb-4">

View File

@@ -1,8 +1,9 @@
<!-- [DEF:StoragePage:Component] -->
<!--
@TIER: STANDARD
@SEMANTICS: storage, files, management
@PURPOSE: Main page for file storage management.
@LAYER: Feature
@LAYER: UI
@RELATION: DEPENDS_ON -> storageService
@RELATION: CONTAINS -> FileList
@RELATION: CONTAINS -> FileUpload

View File

@@ -1,5 +1,6 @@
// [DEF:adminService:Module]
//
// @TIER: STANDARD
// @SEMANTICS: admin, users, roles, ad-mappings, api
// @PURPOSE: Service for Admin-related API calls (User and Role management).
// @LAYER: Service

View File

@@ -324,7 +324,7 @@ def get_patterns(lang: str) -> Dict[str, Pattern]:
if lang == "python":
return {
"anchor_start": re.compile(r"#\s*\[DEF:(?P<name>[\w\.]+):(?P<type>\w+)\]"),
"anchor_end": re.compile(r"#\s*\[/DEF:(?P<name>[\w\.]+)\]"),
"anchor_end": re.compile(r"#\s*\[/DEF:(?P<name>[\w\.]+)(?::\w+)?\]"),
"tag": re.compile(r"#\s*@(?P<tag>[A-Z_]+):\s*(?P<value>.*)"),
"relation": re.compile(r"#\s*@RELATION:\s*(?P<type>\w+)\s*->\s*(?P<target>.*)"),
"func_def": re.compile(r"^\s*(async\s+)?def\s+(?P<name>\w+)"),
@@ -333,9 +333,9 @@ def get_patterns(lang: str) -> Dict[str, Pattern]:
else:
return {
"html_anchor_start": re.compile(r"<!--\s*\[DEF:(?P<name>[\w\.]+):(?P<type>\w+)\]\s*-->"),
"html_anchor_end": re.compile(r"<!--\s*\[/DEF:(?P<name>[\w\.]+)\]\s*-->"),
"html_anchor_end": re.compile(r"<!--\s*\[/DEF:(?P<name>[\w\.]+)(?::\w+)?\]\s*-->"),
"js_anchor_start": re.compile(r"//\s*\[DEF:(?P<name>[\w\.]+):(?P<type>\w+)\]"),
"js_anchor_end": re.compile(r"//\s*\[/DEF:(?P<name>[\w\.]+)\]"),
"js_anchor_end": re.compile(r"//\s*\[/DEF:(?P<name>[\w\.]+)(?::\w+)?\]"),
"html_tag": re.compile(r"@(?P<tag>[A-Z_]+):\s*(?P<value>.*)"),
"jsdoc_tag": re.compile(r"\*\s*@(?P<tag>[a-zA-Z]+)\s+(?P<value>.*)"),
"relation": re.compile(r"//\s*@RELATION:\s*(?P<type>\w+)\s*->\s*(?P<target>.*)"),

View File

@@ -12,7 +12,7 @@ I. ЗАКОН (АКСИОМЫ)
II. СИНТАКСИС (ЖЕСТКИЙ ФОРМАТ)
ЯКОРЬ (Контейнер):
Начало: `# [DEF:id:Type]` (Python) | `<!-- [DEF:id:Type] -->` (Svelte)
Конец: `# [/DEF:id]` (ОБЯЗАТЕЛЬНО для аккумуляции)
Конец: `# [/DEF:id:Type]` (Python) | `<!-- [/DEF:id:Type] -->` (Svelte) (ОБЯЗАТЕЛЬНО для аккумуляции)
Типы: Module, Class, Function, Component, Store.
ТЕГ (Метаданные):

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff