project map script | semantic parcer

This commit is contained in:
2026-01-01 16:58:21 +03:00
parent a747a163c8
commit 4c6fc8256d
84 changed files with 10178 additions and 537 deletions

View File

@@ -8,11 +8,10 @@ import { PUBLIC_WS_URL } from '$env/static/public';
const API_BASE_URL = '/api';
/**
* Returns the WebSocket URL for a specific task, with fallback logic.
* @param {string} taskId
* @returns {string}
*/
// [DEF:getWsUrl:Function]
// @PURPOSE: Returns the WebSocket URL for a specific task, with fallback logic.
// @PARAM: taskId (string) - The ID of the task.
// @RETURN: string - The WebSocket URL.
export const getWsUrl = (taskId) => {
let baseUrl = PUBLIC_WS_URL;
if (!baseUrl) {
@@ -22,6 +21,7 @@ export const getWsUrl = (taskId) => {
}
return `${baseUrl}/ws/logs/${taskId}`;
};
// [/DEF:getWsUrl:Function]
// [DEF:fetchApi:Function]
// @PURPOSE: Generic GET request wrapper.
@@ -41,7 +41,7 @@ async function fetchApi(endpoint) {
throw error;
}
}
// [/DEF:fetchApi]
// [/DEF:fetchApi:Function]
// [DEF:postApi:Function]
// @PURPOSE: Generic POST request wrapper.
@@ -68,7 +68,7 @@ async function postApi(endpoint, body) {
throw error;
}
}
// [/DEF:postApi]
// [/DEF:postApi:Function]
// [DEF:requestApi:Function]
// @PURPOSE: Generic request wrapper.
@@ -96,6 +96,7 @@ async function requestApi(endpoint, method = 'GET', body = null) {
throw error;
}
}
// [/DEF:requestApi:Function]
// [DEF:api:Data]
// @PURPOSE: API client object with specific methods.
@@ -116,7 +117,9 @@ export const api = {
updateEnvironmentSchedule: (id, schedule) => requestApi(`/environments/${id}/schedule`, 'PUT', schedule),
getEnvironmentsList: () => fetchApi('/environments'),
};
// [/DEF:api_module]
// [/DEF:api:Data]
// [/DEF:api_module:Module]
// Export individual functions for easier use in components
export const getPlugins = api.getPlugins;

View File

@@ -9,26 +9,32 @@ import { api } from './api.js';
// [DEF:plugins:Data]
// @PURPOSE: Store for the list of available plugins.
export const plugins = writable([]);
// [/DEF:plugins:Data]
// [DEF:tasks:Data]
// @PURPOSE: Store for the list of tasks.
export const tasks = writable([]);
// [/DEF:tasks:Data]
// [DEF:selectedPlugin:Data]
// @PURPOSE: Store for the currently selected plugin.
export const selectedPlugin = writable(null);
// [/DEF:selectedPlugin:Data]
// [DEF:selectedTask:Data]
// @PURPOSE: Store for the currently selected task.
export const selectedTask = writable(null);
// [/DEF:selectedTask:Data]
// [DEF:currentPage:Data]
// @PURPOSE: Store for the current page.
export const currentPage = writable('dashboard');
// [/DEF:currentPage:Data]
// [DEF:taskLogs:Data]
// @PURPOSE: Store for the logs of the currently selected task.
export const taskLogs = writable([]);
// [/DEF:taskLogs:Data]
// [DEF:fetchPlugins:Function]
// @PURPOSE: Fetches plugins from the API and updates the plugins store.
@@ -42,7 +48,7 @@ export async function fetchPlugins() {
console.error(`[stores.fetchPlugins][Coherence:Failed] Error fetching plugins context={{'error': '${error}'}}`);
}
}
// [/DEF:fetchPlugins]
// [/DEF:fetchPlugins:Function]
// [DEF:fetchTasks:Function]
// @PURPOSE: Fetches tasks from the API and updates the tasks store.
@@ -56,5 +62,5 @@ export async function fetchTasks() {
console.error(`[stores.fetchTasks][Coherence:Failed] Error fetching tasks context={{'error': '${error}'}}`);
}
}
// [/DEF:fetchTasks]
// [/DEF:stores_module]
// [/DEF:fetchTasks:Function]
// [/DEF:stores_module:Module]

View File

@@ -8,6 +8,7 @@ import { writable } from 'svelte/store';
// [DEF:toasts:Data]
// @PURPOSE: Writable store containing the list of active toasts.
export const toasts = writable([]);
// [/DEF:toasts:Data]
// [DEF:addToast:Function]
// @PURPOSE: Adds a new toast message.
@@ -20,7 +21,7 @@ export function addToast(message, type = 'info', duration = 3000) {
toasts.update(all => [...all, { id, message, type }]);
setTimeout(() => removeToast(id), duration);
}
// [/DEF:addToast]
// [/DEF:addToast:Function]
// [DEF:removeToast:Function]
// @PURPOSE: Removes a toast message by ID.
@@ -29,5 +30,5 @@ function removeToast(id) {
console.log(`[toasts.removeToast][Action] Removing toast context={{'id': '${id}'}}`);
toasts.update(all => all.filter(t => t.id !== id));
}
// [/DEF:removeToast]
// [/DEF:toasts_module]
// [/DEF:removeToast:Function]
// [/DEF:toasts_module:Module]