diff --git a/loader.ts b/loader.ts index a3216eb..5a7c9ac 100644 --- a/loader.ts +++ b/loader.ts @@ -40,7 +40,7 @@ let DAEMON_PORT = chooseDaemonPort(); // Removed cache-related code async function fetchScriptList(ref: string = LOADER_REF): Promise { - const apiUrl = `${BASE_API}/contents?ref=${encodeURIComponent(ref)}`; + const apiUrl = `${BASE_API}/contents/scripts?ref=${encodeURIComponent(ref)}`; const response = await fetch(apiUrl); if (!response.ok) { throw new Error(`Failed to fetch scripts (${ref}): ${response.statusText}`); @@ -51,22 +51,6 @@ async function fetchScriptList(ref: string = LOADER_REF): Promise { .map((script: { name: string }) => script.name.replace(/\.ts$/, "")); } -// Function to register autocompletions for available scripts -function registerAutocompletions(scripts: { name: string }[]) { - const completions = scripts.map(script => script.name); - // Logic to register completions in the Deno environment - // This could involve using Deno's built-in completion features or a custom implementation - console.log('Available script completions:', completions); -} - -// Update the existing function to fetch available scripts and register autocompletions -async function _fetchAvailableScripts(ref: string = LOADER_REF) { - const response = await fetch(`${BASE_API}/contents?ref=${encodeURIComponent(ref)}`); - const scripts = await response.json(); - registerAutocompletions(scripts); - return scripts; -} - function _buildRawUrl(cmd: string, ref: string): string { // Heuristic: tags typically start with 'v', otherwise treat as branch const isTag = /^v[0-9]/.test(ref);