feat: attention-optimized semantic protocol v2.7

Core changes:
- Add @defgroup/@ingroup to 1791 C2+ contracts (555 files) for HCA 128× pre-training DSA grouping
- Add §0.1 Pre-Training Frequency matrix to semantics-core
- Add §VIII Attention Architecture rules (ATTN_1-4) with MLA/CSA/HCA/DSA mechanics
- Add @defgroup/@ingroup to canonical syntax (§II) and all contract examples

Agent prompts (5 files):
- Add ZERO-STATE RATIONALE with MLA/CSA/HCA/DSA compression mechanics
- Add pre-training note: @RATIONALE/@REJECTED are in-context learned tags
- svelte-coder: add missing #region contract, fix Svelte rule violations
- python-coder/fullstack-coder: honor function contracts from speckit plan
- qa-tester: add attention compliance audit (P3 ATTN_1-4 checks)

Skills (6 files):
- Translate all axiom_config descriptions to English
- Fix doc_dirs to index .opencode/ and .specify/
- Deduplicate 5× complexity_rules → single global_tags catalog
- Reduce semantics-svelte 591→485 lines (remove duplicate code blocks)
- Fix semantics-testing: 'Short IDs' → 'Short hierarchical IDs'
- Fix all examples: flat IDs → hierarchical Domain.Name format
- Fix Svelte examples: replace raw Tailwind + <button> with semantic tokens + /ui

Speckit workflow (commands + templates):
- speckit.plan: add Function-Level Contracts for C3+ with @PRE/@POST/@TEST_EDGE
- speckit.plan: add Attention Compliance Gate (ATTN_1-4 before contract generation)
- speckit.tasks: add function contract inlining format (constraints in task description)
- speckit.specify: load semantics-core for spec density rules
- spec-template: add #region contract, @SEMANTICS grouping, hierarchical IDs
- ux-reference-template: add #region wrapper
- plan-template: add attention gate, @defgroup/@ingroup guidance
- tasks-template: add attention audit + rebuild + orphan check tasks
- constitution.md: translate to English, add Principle VIII (attention-optimized contracts)

Reference modules rewritten (hierarchical IDs + full contracts):
- Auth.Jwt: 6 child contracts with @RATIONALE/@REJECTED/@TEST_EDGE
- Api.Auth: 5 endpoints with @TEST_EDGE + molecular CoT markers
- Migration.Model: @defgroup Migration with 18 @ACTION + 6 @INVARIANT

Scripts:
- add_defgroup_ingroup.py: zero-risk additive @ingroup migration (1791 insertions)
- migrate_hierarchical.py: flat→hierarchical ID dry-run analysis (792 contracts)
- merge_prompts.py: merge all prompts/skills/commands into one review file

Config:
- axiom_config.yaml: 749→395 lines (-47%), English, doc_dirs include prompts
- Fix test_datasets.py import collision (rename → test_datasets_routes.py)
- Fix test_preview.py: SupersetClient→get_superset_client, AsyncMock, logger f-string
This commit is contained in:
2026-06-08 16:30:59 +03:00
parent 73e809e189
commit 8e8a3c3235
562 changed files with 2523 additions and 244 deletions

View File

@@ -1,4 +1,5 @@
# #region GitPackage [C:5] [TYPE Module] [SEMANTICS git, api, package, sync]
# @defgroup Api Module group.
# @BRIEF Package root for decomposed git routes. Re-exports all public symbols from submodules.
# @LAYER API
# @RELATION CALLS -> [GitPackage]

View File

@@ -1,4 +1,5 @@
# #region GitConfigRoutes [C:2] [TYPE Module] [SEMANTICS fastapi, git, api, search, connection]
# @defgroup Api Module group.
# @BRIEF FastAPI endpoints for Git server configuration CRUD and connection testing.
# @LAYER API
@@ -21,6 +22,7 @@ from ._router import router
# #region get_git_configs [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF List all configured Git servers.
@router.get("/config", response_model=list[GitServerConfigSchema])
async def get_git_configs(
@@ -39,6 +41,7 @@ async def get_git_configs(
# #region create_git_config [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Register a new Git server configuration.
@router.post("/config", response_model=GitServerConfigSchema)
async def create_git_config(
@@ -57,6 +60,7 @@ async def create_git_config(
# #region update_git_config [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Update an existing Git server configuration.
@router.put("/config/{config_id}", response_model=GitServerConfigSchema)
async def update_git_config(
@@ -89,6 +93,7 @@ async def update_git_config(
# #region delete_git_config [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Remove a Git server configuration.
@router.delete("/config/{config_id}")
async def delete_git_config(
@@ -110,6 +115,7 @@ async def delete_git_config(
# #region test_git_config [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Validate connection to a Git server using provided credentials.
@router.post("/config/test")
async def test_git_config(

View File

@@ -1,4 +1,5 @@
# #region GitEnvironmentRoutes [C:2] [TYPE Module] [SEMANTICS fastapi, git, environment, api]
# @defgroup Api Module group.
# @BRIEF FastAPI endpoint for listing deployment environments.
# @LAYER API
@@ -13,6 +14,7 @@ from ._router import router
# #region get_environments [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF List all deployment environments.
@router.get("/environments", response_model=list[DeploymentEnvironmentSchema])
async def get_environments(

View File

@@ -1,4 +1,5 @@
# #region GitGiteaRoutes [C:2] [TYPE Module] [SEMANTICS fastapi, git, gitea, api]
# @defgroup Api Module group.
# @BRIEF FastAPI endpoints for Gitea-specific repository operations.
# @LAYER API
@@ -23,6 +24,7 @@ from ._router import router
# #region list_gitea_repositories [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF List repositories in Gitea for a saved Gitea config.
@router.get("/config/{config_id}/gitea/repos", response_model=list[GiteaRepoSchema])
async def list_gitea_repositories(
@@ -54,6 +56,7 @@ async def list_gitea_repositories(
# #region create_gitea_repository [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Create a repository in Gitea for a saved Gitea config.
@router.post("/config/{config_id}/gitea/repos", response_model=GiteaRepoSchema)
async def create_gitea_repository(
@@ -91,6 +94,7 @@ async def create_gitea_repository(
# #region delete_gitea_repository [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Delete repository in Gitea for a saved Gitea config.
@router.delete("/config/{config_id}/gitea/repos/{owner}/{repo_name}")
async def delete_gitea_repository(
@@ -118,6 +122,7 @@ async def delete_gitea_repository(
# #region create_remote_repository [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Create repository on remote Git server using selected provider config.
@router.post("/config/{config_id}/repositories", response_model=RemoteRepoSchema)
async def create_remote_repository(

View File

@@ -1,4 +1,5 @@
# #region GitHelpers [C:3] [TYPE Module] [SEMANTICS fastapi, git, api]
# @defgroup Api Module group.
# @BRIEF Shared helper functions for Git route modules.
# @LAYER API
# @RELATION CALLS -> [GitDeps]

View File

@@ -1,4 +1,5 @@
# #region GitMergeRoutes [C:3] [TYPE Module] [SEMANTICS fastapi, git, api]
# @defgroup Api Module group.
# @BRIEF FastAPI endpoints for merge operations (status, conflicts, resolve, abort, continue).
# @LAYER API
@@ -22,6 +23,7 @@ from ._router import router
# #region get_merge_status [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Return unfinished-merge status for repository (web-only recovery support).
@router.get(
"/repositories/{dashboard_ref}/merge/status", response_model=MergeStatusSchema
@@ -49,6 +51,7 @@ async def get_merge_status(
# #region get_merge_conflicts [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Return conflicted files with mine/theirs previews for web conflict resolver.
@router.get(
"/repositories/{dashboard_ref}/merge/conflicts",
@@ -77,6 +80,7 @@ async def get_merge_conflicts(
# #region resolve_merge_conflicts [C:3] [TYPE Function]
# @ingroup Api
# @BRIEF Apply mine/theirs/manual conflict resolutions from WebUI and stage files.
# @RELATION CALLS -> [GitService]
@router.post("/repositories/{dashboard_ref}/merge/resolve")
@@ -108,6 +112,7 @@ async def resolve_merge_conflicts(
# #region abort_merge [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Abort unfinished merge from WebUI flow.
@router.post("/repositories/{dashboard_ref}/merge/abort")
async def abort_merge(
@@ -133,6 +138,7 @@ async def abort_merge(
# #region continue_merge [C:3] [TYPE Function]
# @ingroup Api
# @BRIEF Finalize unfinished merge from WebUI flow.
# @RELATION CALLS -> [GitService]
@router.post("/repositories/{dashboard_ref}/merge/continue")

View File

@@ -1,4 +1,5 @@
# #region GitRepoLifecycleRoutes [C:3] [TYPE Module] [SEMANTICS fastapi, git, api, sync, deploy]
# @defgroup Api Module group.
# @BRIEF FastAPI endpoints for Git lifecycle operations (sync, promote, deploy).
# @LAYER API
@@ -27,6 +28,7 @@ from ._router import router
# #region sync_dashboard [C:3] [TYPE Function]
# @ingroup Api
# @BRIEF Sync dashboard state from Superset to Git using the GitPlugin.
# @RELATION CALLS -> [GitPlugin]
@router.post("/repositories/{dashboard_ref}/sync")
@@ -62,6 +64,7 @@ async def sync_dashboard(
# #region promote_dashboard [C:3] [TYPE Function]
# @ingroup Api
# @BRIEF Promote changes between branches via MR or direct merge.
# @RELATION CALLS -> [GitPlugin]
@router.post("/repositories/{dashboard_ref}/promote", response_model=PromoteResponse)
@@ -185,6 +188,7 @@ async def promote_dashboard(
# #region deploy_dashboard [C:3] [TYPE Function]
# @ingroup Api
# @BRIEF Deploy dashboard from Git to a target environment.
# @RELATION CALLS -> [GitPlugin]
@router.post("/repositories/{dashboard_ref}/deploy")

View File

@@ -1,4 +1,5 @@
# #region GitRepoOperationsRoutes [C:3] [TYPE Module] [SEMANTICS fastapi, git, api, history, diff]
# @defgroup Api Module group.
# @BRIEF FastAPI endpoints for Git repository operations (commit, push, pull, status, diff, history).
# @LAYER API
@@ -29,6 +30,7 @@ from ._router import router
# #region commit_changes [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Stage and commit changes in the dashboard's repository.
@router.post("/repositories/{dashboard_ref}/commit")
async def commit_changes(
@@ -61,6 +63,7 @@ async def commit_changes(
# #region push_changes [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Push local commits to the remote repository.
@router.post("/repositories/{dashboard_ref}/push")
async def push_changes(
@@ -87,6 +90,7 @@ async def push_changes(
# #region pull_changes [C:3] [TYPE Function]
# @ingroup Api
# @BRIEF Pull changes from the remote repository.
# @RELATION CALLS -> [GitService]
@router.post("/repositories/{dashboard_ref}/pull")
@@ -149,6 +153,7 @@ async def pull_changes(
# #region get_repository_status [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Get current Git status for a dashboard repository.
@router.get("/repositories/{dashboard_ref}/status")
async def get_repository_status(
@@ -173,6 +178,7 @@ async def get_repository_status(
# #region get_repository_status_batch [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Get Git statuses for multiple dashboard repositories in one request.
@router.post("/repositories/status/batch", response_model=RepoStatusBatchResponse)
async def get_repository_status_batch(
@@ -212,6 +218,7 @@ async def get_repository_status_batch(
# #region get_repository_diff [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Get Git diff for a dashboard repository.
@router.get("/repositories/{dashboard_ref}/diff")
async def get_repository_diff(
@@ -239,6 +246,7 @@ async def get_repository_diff(
# #region get_history [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF View commit history for a dashboard's repository.
@router.get("/repositories/{dashboard_ref}/history", response_model=list[CommitSchema])
async def get_history(
@@ -265,6 +273,7 @@ async def get_history(
# #region generate_commit_message [C:3] [TYPE Function]
# @ingroup Api
# @BRIEF Generate a suggested commit message using LLM.
# @RELATION CALLS -> [GitService]
@router.post("/repositories/{dashboard_ref}/generate-message")

View File

@@ -1,4 +1,5 @@
# #region GitRepoRoutes [C:3] [TYPE Module] [SEMANTICS fastapi, git, api, search]
# @defgroup Api Module group.
# @BRIEF FastAPI endpoints for core Git repository operations (init, binding, branches, checkout).
# @LAYER API
@@ -29,6 +30,7 @@ from ._router import router
# #region init_repository [C:3] [TYPE Function]
# @ingroup Api
# @BRIEF Link a dashboard to a Git repository and perform initial clone/init.
# @RELATION CALLS -> [GitService]
@router.post("/repositories/{dashboard_ref}/init")
@@ -109,6 +111,7 @@ async def init_repository(
# #region get_repository_binding [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Return repository binding with provider metadata for selected dashboard.
@router.get("/repositories/{dashboard_ref}", response_model=RepositoryBindingSchema)
async def get_repository_binding(
@@ -150,6 +153,7 @@ async def get_repository_binding(
# #region delete_repository [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Delete local repository workspace and DB binding for selected dashboard.
@router.delete("/repositories/{dashboard_ref}")
async def delete_repository(
@@ -176,6 +180,7 @@ async def delete_repository(
# #region get_branches [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF List all branches for a dashboard's repository.
@router.get("/repositories/{dashboard_ref}/branches", response_model=list[BranchSchema])
async def get_branches(
@@ -201,6 +206,7 @@ async def get_branches(
# #region create_branch [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Create a new branch in the dashboard's repository.
@router.post("/repositories/{dashboard_ref}/branches")
async def create_branch(
@@ -233,6 +239,7 @@ async def create_branch(
# #region checkout_branch [C:2] [TYPE Function]
# @ingroup Api
# @BRIEF Switch the dashboard's repository to a specific branch.
@router.post("/repositories/{dashboard_ref}/checkout")
async def checkout_branch(