@phuetz/code-buddy 0.1.0 → 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.codebuddy/skills/bundled/brave-search/SKILL.md +490 -0
- package/.codebuddy/skills/bundled/exa-search/SKILL.md +1122 -0
- package/.codebuddy/skills/bundled/perplexity/SKILL.md +748 -0
- package/.codebuddy/skills/bundled/playwright/SKILL.md +520 -0
- package/.codebuddy/skills/bundled/puppeteer/SKILL.md +708 -0
- package/.codebuddy/skills/bundled/web-fetch/SKILL.md +1003 -0
- package/README.md +56 -0
- package/dist/agent/agent-state.d.ts +3 -3
- package/dist/agent/agent-state.js +6 -6
- package/dist/agent/agent-state.js.map +1 -1
- package/dist/agent/base-agent.d.ts +4 -4
- package/dist/agent/base-agent.js +22 -9
- package/dist/agent/base-agent.js.map +1 -1
- package/dist/agent/cache-trace.d.ts +56 -0
- package/dist/agent/cache-trace.js +98 -0
- package/dist/agent/cache-trace.js.map +1 -0
- package/dist/agent/codebuddy-agent.js +4 -2
- package/dist/agent/codebuddy-agent.js.map +1 -1
- package/dist/agent/execution/agent-executor.d.ts +4 -4
- package/dist/agent/execution/agent-executor.js +46 -14
- package/dist/agent/execution/agent-executor.js.map +1 -1
- package/dist/agent/facades/agent-context-facade.js +1 -3
- package/dist/agent/facades/agent-context-facade.js.map +1 -1
- package/dist/agent/facades/message-history-manager.js +14 -12
- package/dist/agent/facades/message-history-manager.js.map +1 -1
- package/dist/agent/facades/session-facade.d.ts +3 -3
- package/dist/agent/facades/session-facade.js +6 -6
- package/dist/agent/facades/session-facade.js.map +1 -1
- package/dist/agent/history-repair.d.ts +37 -0
- package/dist/agent/history-repair.js +124 -0
- package/dist/agent/history-repair.js.map +1 -0
- package/dist/agent/index.d.ts +3 -3
- package/dist/agent/index.js +3 -3
- package/dist/agent/index.js.map +1 -1
- package/dist/agent/isolation/agent-workspace.d.ts +1 -0
- package/dist/agent/isolation/agent-workspace.js +10 -0
- package/dist/agent/isolation/agent-workspace.js.map +1 -1
- package/dist/agent/specialized/archive-agent.d.ts +3 -0
- package/dist/agent/specialized/archive-agent.js +71 -31
- package/dist/agent/specialized/archive-agent.js.map +1 -1
- package/dist/agent/specialized/index.d.ts +9 -8
- package/dist/agent/specialized/index.js +16 -8
- package/dist/agent/specialized/index.js.map +1 -1
- package/dist/agent/specialized/security-review/agent.js +19 -8
- package/dist/agent/specialized/security-review/agent.js.map +1 -1
- package/dist/agent/tool-executor.js +5 -0
- package/dist/agent/tool-executor.js.map +1 -1
- package/dist/agent/turn-diff-tracker.d.ts +79 -0
- package/dist/agent/turn-diff-tracker.js +195 -0
- package/dist/agent/turn-diff-tracker.js.map +1 -0
- package/dist/browser/controller.js +8 -4
- package/dist/browser/controller.js.map +1 -1
- package/dist/browser-automation/browser-manager.js +8 -1
- package/dist/browser-automation/browser-manager.js.map +1 -1
- package/dist/checkpoints/checkpoint-versioning.js +78 -20
- package/dist/checkpoints/checkpoint-versioning.js.map +1 -1
- package/dist/cli/config-loader.js +2 -4
- package/dist/cli/config-loader.js.map +1 -1
- package/dist/codebuddy/client.js +70 -11
- package/dist/codebuddy/client.js.map +1 -1
- package/dist/codebuddy/tools.d.ts +1 -7
- package/dist/codebuddy/tools.js +2 -30
- package/dist/codebuddy/tools.js.map +1 -1
- package/dist/commands/cli/daemon-commands.d.ts +14 -0
- package/dist/commands/cli/daemon-commands.js +166 -0
- package/dist/commands/cli/daemon-commands.js.map +1 -0
- package/dist/commands/cli/speak-command.d.ts +10 -0
- package/dist/commands/cli/speak-command.js +97 -0
- package/dist/commands/cli/speak-command.js.map +1 -0
- package/dist/commands/cli/utility-commands.d.ts +10 -0
- package/dist/commands/cli/utility-commands.js +88 -0
- package/dist/commands/cli/utility-commands.js.map +1 -0
- package/dist/commands/handlers/fcs-handlers.js +1 -1
- package/dist/commands/handlers/fcs-handlers.js.map +1 -1
- package/dist/commands/handlers/memory-handlers.js +2 -1
- package/dist/commands/handlers/memory-handlers.js.map +1 -1
- package/dist/commands/handlers/vibe-handlers.js +0 -1
- package/dist/commands/handlers/vibe-handlers.js.map +1 -1
- package/dist/commands/handlers/worktree-handlers.js +11 -0
- package/dist/commands/handlers/worktree-handlers.js.map +1 -1
- package/dist/commands/index.d.ts +8 -7
- package/dist/commands/index.js +10 -8
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/mcp.d.ts +1 -0
- package/dist/commands/mcp.js +66 -7
- package/dist/commands/mcp.js.map +1 -1
- package/dist/commands/pipeline.js +25 -13
- package/dist/commands/pipeline.js.map +1 -1
- package/dist/config/hot-reload/watcher.js +4 -4
- package/dist/config/hot-reload/watcher.js.map +1 -1
- package/dist/config/model-tools.d.ts +41 -0
- package/dist/config/model-tools.js +194 -0
- package/dist/config/model-tools.js.map +1 -0
- package/dist/context/context-manager-v2.d.ts +2 -1
- package/dist/context/context-manager-v2.js +34 -5
- package/dist/context/context-manager-v2.js.map +1 -1
- package/dist/context/index.d.ts +12 -12
- package/dist/context/index.js +25 -12
- package/dist/context/index.js.map +1 -1
- package/dist/daemon/daemon-manager.js +23 -19
- package/dist/daemon/daemon-manager.js.map +1 -1
- package/dist/database/database-manager.d.ts +4 -0
- package/dist/database/database-manager.js +16 -7
- package/dist/database/database-manager.js.map +1 -1
- package/dist/desktop-automation/nutjs-provider.js +89 -0
- package/dist/desktop-automation/nutjs-provider.js.map +1 -1
- package/dist/errors/index.d.ts +4 -4
- package/dist/errors/index.js +8 -4
- package/dist/errors/index.js.map +1 -1
- package/dist/fcs/builtins.d.ts +2 -6
- package/dist/fcs/builtins.js +2 -568
- package/dist/fcs/builtins.js.map +1 -1
- package/dist/fcs/codebuddy-bindings.d.ts +3 -43
- package/dist/fcs/codebuddy-bindings.js +2 -606
- package/dist/fcs/codebuddy-bindings.js.map +1 -1
- package/dist/fcs/index.d.ts +2 -27
- package/dist/fcs/index.js +2 -53
- package/dist/fcs/index.js.map +1 -1
- package/dist/fcs/lexer.d.ts +2 -37
- package/dist/fcs/lexer.js +2 -459
- package/dist/fcs/lexer.js.map +1 -1
- package/dist/fcs/parser.d.ts +2 -68
- package/dist/fcs/parser.js +2 -893
- package/dist/fcs/parser.js.map +1 -1
- package/dist/fcs/runtime.d.ts +2 -59
- package/dist/fcs/runtime.js +2 -623
- package/dist/fcs/runtime.js.map +1 -1
- package/dist/fcs/script-registry.d.ts +3 -69
- package/dist/fcs/script-registry.js +2 -219
- package/dist/fcs/script-registry.js.map +1 -1
- package/dist/fcs/sync-bindings.d.ts +3 -101
- package/dist/fcs/sync-bindings.js +2 -410
- package/dist/fcs/sync-bindings.js.map +1 -1
- package/dist/fcs/types.d.ts +2 -285
- package/dist/fcs/types.js +2 -103
- package/dist/fcs/types.js.map +1 -1
- package/dist/hooks/index.d.ts +4 -4
- package/dist/hooks/index.js +4 -4
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/use-input-handler.d.ts +1 -1
- package/dist/index.js +20 -330
- package/dist/index.js.map +1 -1
- package/dist/input/voice-control.js +11 -5
- package/dist/input/voice-control.js.map +1 -1
- package/dist/integrations/json-rpc/server.d.ts +9 -0
- package/dist/integrations/json-rpc/server.js +43 -13
- package/dist/integrations/json-rpc/server.js.map +1 -1
- package/dist/integrations/mcp/mcp-server.js +1 -1
- package/dist/integrations/mcp/mcp-server.js.map +1 -1
- package/dist/integrations/notification-integrations.d.ts +1 -0
- package/dist/integrations/notification-integrations.js +6 -1
- package/dist/integrations/notification-integrations.js.map +1 -1
- package/dist/mcp/client.js +2 -1
- package/dist/mcp/client.js.map +1 -1
- package/dist/mcp/config.js +89 -5
- package/dist/mcp/config.js.map +1 -1
- package/dist/mcp/mcp-client.js +65 -14
- package/dist/mcp/mcp-client.js.map +1 -1
- package/dist/mcp/transports.d.ts +0 -1
- package/dist/mcp/transports.js +1 -5
- package/dist/mcp/transports.js.map +1 -1
- package/dist/mcp/types.d.ts +2 -0
- package/dist/memory/index.d.ts +2 -2
- package/dist/memory/index.js +2 -2
- package/dist/memory/index.js.map +1 -1
- package/dist/persistence/session-lock.d.ts +42 -0
- package/dist/persistence/session-lock.js +165 -0
- package/dist/persistence/session-lock.js.map +1 -0
- package/dist/persistence/session-store.d.ts +18 -3
- package/dist/persistence/session-store.js +90 -21
- package/dist/persistence/session-store.js.map +1 -1
- package/dist/plugins/conflict-detection.js +2 -1
- package/dist/plugins/conflict-detection.js.map +1 -1
- package/dist/plugins/index.d.ts +3 -3
- package/dist/plugins/index.js +3 -3
- package/dist/plugins/index.js.map +1 -1
- package/dist/plugins/isolated-plugin-runner.d.ts +6 -0
- package/dist/plugins/isolated-plugin-runner.js +19 -1
- package/dist/plugins/isolated-plugin-runner.js.map +1 -1
- package/dist/providers/local-llm-provider.js +28 -8
- package/dist/providers/local-llm-provider.js.map +1 -1
- package/dist/sandbox/docker-sandbox.js +7 -4
- package/dist/sandbox/docker-sandbox.js.map +1 -1
- package/dist/scripting/builtins.d.ts +8 -3
- package/dist/scripting/builtins.js +506 -355
- package/dist/scripting/builtins.js.map +1 -1
- package/dist/scripting/codebuddy-bindings.d.ts +47 -0
- package/dist/scripting/codebuddy-bindings.js +488 -0
- package/dist/scripting/codebuddy-bindings.js.map +1 -0
- package/dist/scripting/index.d.ts +33 -30
- package/dist/scripting/index.js +41 -36
- package/dist/scripting/index.js.map +1 -1
- package/dist/scripting/lexer.d.ts +31 -13
- package/dist/scripting/lexer.js +379 -292
- package/dist/scripting/lexer.js.map +1 -1
- package/dist/scripting/parser.d.ts +63 -44
- package/dist/scripting/parser.js +700 -473
- package/dist/scripting/parser.js.map +1 -1
- package/dist/scripting/runtime.d.ts +55 -24
- package/dist/scripting/runtime.js +600 -288
- package/dist/scripting/runtime.js.map +1 -1
- package/dist/scripting/script-registry.d.ts +54 -0
- package/dist/scripting/script-registry.js +202 -0
- package/dist/scripting/script-registry.js.map +1 -0
- package/dist/scripting/sync-bindings.d.ts +105 -0
- package/dist/scripting/sync-bindings.js +353 -0
- package/dist/scripting/sync-bindings.js.map +1 -0
- package/dist/scripting/types.d.ts +297 -199
- package/dist/scripting/types.js +86 -60
- package/dist/scripting/types.js.map +1 -1
- package/dist/search/usearch-index.js +42 -7
- package/dist/search/usearch-index.js.map +1 -1
- package/dist/security/bash-parser.d.ts +51 -0
- package/dist/security/bash-parser.js +327 -0
- package/dist/security/bash-parser.js.map +1 -0
- package/dist/security/index.d.ts +7 -5
- package/dist/security/index.js +8 -7
- package/dist/security/index.js.map +1 -1
- package/dist/security/skill-scanner.d.ts +36 -0
- package/dist/security/skill-scanner.js +149 -0
- package/dist/security/skill-scanner.js.map +1 -0
- package/dist/security/trust-folders.d.ts +1 -0
- package/dist/security/trust-folders.js +19 -1
- package/dist/security/trust-folders.js.map +1 -1
- package/dist/server/auth/index.d.ts +2 -2
- package/dist/server/auth/index.js +2 -2
- package/dist/server/auth/index.js.map +1 -1
- package/dist/server/middleware/index.d.ts +5 -5
- package/dist/server/middleware/index.js +5 -5
- package/dist/server/middleware/index.js.map +1 -1
- package/dist/server/middleware/rate-limit.js +15 -3
- package/dist/server/middleware/rate-limit.js.map +1 -1
- package/dist/server/websocket/handler.js +54 -6
- package/dist/server/websocket/handler.js.map +1 -1
- package/dist/skills/eligibility.js +26 -4
- package/dist/skills/eligibility.js.map +1 -1
- package/dist/tasks/background-tasks.js +5 -1
- package/dist/tasks/background-tasks.js.map +1 -1
- package/dist/tools/apply-patch.d.ts +55 -0
- package/dist/tools/apply-patch.js +273 -0
- package/dist/tools/apply-patch.js.map +1 -0
- package/dist/tools/hooks/default-hooks.d.ts +1 -1
- package/dist/tools/hooks/default-hooks.js +2 -1
- package/dist/tools/hooks/default-hooks.js.map +1 -1
- package/dist/tools/index.d.ts +10 -10
- package/dist/tools/index.js +11 -11
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/registry/bash-tools.js +6 -3
- package/dist/tools/registry/bash-tools.js.map +1 -1
- package/dist/tools/registry/misc-tools.js +1 -2
- package/dist/tools/registry/misc-tools.js.map +1 -1
- package/dist/tools/registry/search-tools.js +1 -1
- package/dist/tools/registry/search-tools.js.map +1 -1
- package/dist/tools/registry/text-editor-tools.js +1 -1
- package/dist/tools/registry/text-editor-tools.js.map +1 -1
- package/dist/tools/registry/todo-tools.js +37 -5
- package/dist/tools/registry/todo-tools.js.map +1 -1
- package/dist/tools/registry/tool-registry.js +5 -4
- package/dist/tools/registry/tool-registry.js.map +1 -1
- package/dist/tools/registry/web-tools.d.ts +1 -1
- package/dist/tools/registry/web-tools.js +28 -8
- package/dist/tools/registry/web-tools.js.map +1 -1
- package/dist/tools/text-editor.d.ts +1 -1
- package/dist/tools/text-editor.js +23 -5
- package/dist/tools/text-editor.js.map +1 -1
- package/dist/tools/web-search.d.ts +52 -37
- package/dist/tools/web-search.js +368 -163
- package/dist/tools/web-search.js.map +1 -1
- package/dist/types/errors.d.ts +1 -1
- package/dist/types/errors.js +2 -8
- package/dist/types/errors.js.map +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/index.js +1 -2
- package/dist/types/index.js.map +1 -1
- package/dist/ui/components/ChatInterface.d.ts +1 -1
- package/dist/ui/index.d.ts +17 -21
- package/dist/ui/index.js +25 -22
- package/dist/ui/index.js.map +1 -1
- package/dist/utils/config-validation/schema.d.ts +15 -15
- package/dist/utils/head-tail-truncation.d.ts +34 -0
- package/dist/utils/head-tail-truncation.js +98 -0
- package/dist/utils/head-tail-truncation.js.map +1 -0
- package/dist/utils/logger.js +3 -9
- package/dist/utils/logger.js.map +1 -1
- package/dist/utils/sanitize.d.ts +5 -0
- package/dist/utils/sanitize.js +19 -0
- package/dist/utils/sanitize.js.map +1 -1
- package/dist/utils/settings-manager.js +4 -4
- package/dist/utils/settings-manager.js.map +1 -1
- package/dist/workflows/index.d.ts +4 -279
- package/dist/workflows/index.js +8 -822
- package/dist/workflows/index.js.map +1 -1
- package/dist/workflows/state-manager.d.ts +77 -0
- package/dist/workflows/state-manager.js +198 -0
- package/dist/workflows/state-manager.js.map +1 -0
- package/dist/workflows/step-manager.d.ts +39 -0
- package/dist/workflows/step-manager.js +196 -0
- package/dist/workflows/step-manager.js.map +1 -0
- package/dist/workflows/types.d.ts +87 -0
- package/dist/workflows/types.js +5 -0
- package/dist/workflows/types.js.map +1 -0
- package/dist/workflows/workflow-engine.d.ts +34 -0
- package/dist/workflows/workflow-engine.js +354 -0
- package/dist/workflows/workflow-engine.js.map +1 -0
- package/package.json +5 -1
|
@@ -1,71 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Provides discovery and management of FCS script templates.
|
|
2
|
+
* @deprecated Use src/scripting/script-registry.ts instead. This file re-exports for backward compatibility.
|
|
5
3
|
*/
|
|
6
|
-
export
|
|
7
|
-
|
|
8
|
-
path: string;
|
|
9
|
-
category: string;
|
|
10
|
-
description: string;
|
|
11
|
-
usage?: string;
|
|
12
|
-
envVars?: string[];
|
|
13
|
-
}
|
|
14
|
-
export interface ScriptCategory {
|
|
15
|
-
name: string;
|
|
16
|
-
description: string;
|
|
17
|
-
scripts: ScriptTemplate[];
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Registry of available FCS script templates
|
|
21
|
-
*/
|
|
22
|
-
export declare class ScriptRegistry {
|
|
23
|
-
private templates;
|
|
24
|
-
private categories;
|
|
25
|
-
private templatesDir;
|
|
26
|
-
constructor(templatesDir?: string);
|
|
27
|
-
/**
|
|
28
|
-
* Load all templates from the templates directory
|
|
29
|
-
*/
|
|
30
|
-
loadTemplates(): Promise<void>;
|
|
31
|
-
/**
|
|
32
|
-
* Load scripts from a category directory
|
|
33
|
-
*/
|
|
34
|
-
private loadCategoryScripts;
|
|
35
|
-
/**
|
|
36
|
-
* Parse a template file to extract metadata
|
|
37
|
-
*/
|
|
38
|
-
private parseTemplate;
|
|
39
|
-
/**
|
|
40
|
-
* Get all templates
|
|
41
|
-
*/
|
|
42
|
-
getTemplates(): ScriptTemplate[];
|
|
43
|
-
/**
|
|
44
|
-
* Get templates by category
|
|
45
|
-
*/
|
|
46
|
-
getTemplatesByCategory(category: string): ScriptTemplate[];
|
|
47
|
-
/**
|
|
48
|
-
* Get all categories
|
|
49
|
-
*/
|
|
50
|
-
getCategories(): ScriptCategory[];
|
|
51
|
-
/**
|
|
52
|
-
* Get a specific template by name
|
|
53
|
-
*/
|
|
54
|
-
getTemplate(name: string): ScriptTemplate | undefined;
|
|
55
|
-
/**
|
|
56
|
-
* Search templates by keyword
|
|
57
|
-
*/
|
|
58
|
-
searchTemplates(keyword: string): ScriptTemplate[];
|
|
59
|
-
/**
|
|
60
|
-
* Format templates as a readable list
|
|
61
|
-
*/
|
|
62
|
-
formatTemplateList(): string;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Get the script registry instance
|
|
66
|
-
*/
|
|
67
|
-
export declare function getScriptRegistry(): ScriptRegistry;
|
|
68
|
-
/**
|
|
69
|
-
* Initialize and load the script registry
|
|
70
|
-
*/
|
|
71
|
-
export declare function initScriptRegistry(templatesDir?: string): Promise<ScriptRegistry>;
|
|
4
|
+
export { ScriptRegistry, getScriptRegistry, initScriptRegistry, } from '../scripting/script-registry.js';
|
|
5
|
+
export type { ScriptTemplate, ScriptCategory, } from '../scripting/script-registry.js';
|
|
@@ -1,222 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Provides discovery and management of FCS script templates.
|
|
2
|
+
* @deprecated Use src/scripting/script-registry.ts instead. This file re-exports for backward compatibility.
|
|
5
3
|
*/
|
|
6
|
-
|
|
7
|
-
import * as path from 'path';
|
|
8
|
-
/**
|
|
9
|
-
* Registry of available FCS script templates
|
|
10
|
-
*/
|
|
11
|
-
export class ScriptRegistry {
|
|
12
|
-
templates = new Map();
|
|
13
|
-
categories = new Map();
|
|
14
|
-
templatesDir;
|
|
15
|
-
constructor(templatesDir) {
|
|
16
|
-
// Default to scripts/templates relative to current working directory
|
|
17
|
-
this.templatesDir = templatesDir || path.join(process.cwd(), 'scripts/templates');
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Load all templates from the templates directory
|
|
21
|
-
*/
|
|
22
|
-
async loadTemplates() {
|
|
23
|
-
this.templates.clear();
|
|
24
|
-
this.categories.clear();
|
|
25
|
-
if (!fs.existsSync(this.templatesDir)) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
// Define known categories
|
|
29
|
-
const categoryDescriptions = {
|
|
30
|
-
refactoring: 'Scripts for code refactoring operations',
|
|
31
|
-
testing: 'Scripts for test generation and execution',
|
|
32
|
-
documentation: 'Scripts for documentation generation',
|
|
33
|
-
utilities: 'General utility scripts'
|
|
34
|
-
};
|
|
35
|
-
// Scan directory for categories
|
|
36
|
-
const entries = fs.readdirSync(this.templatesDir, { withFileTypes: true });
|
|
37
|
-
for (const entry of entries) {
|
|
38
|
-
if (entry.isDirectory()) {
|
|
39
|
-
const categoryName = entry.name;
|
|
40
|
-
const categoryPath = path.join(this.templatesDir, categoryName);
|
|
41
|
-
const scripts = await this.loadCategoryScripts(categoryName, categoryPath);
|
|
42
|
-
if (scripts.length > 0) {
|
|
43
|
-
this.categories.set(categoryName, {
|
|
44
|
-
name: categoryName,
|
|
45
|
-
description: categoryDescriptions[categoryName] || `${categoryName} scripts`,
|
|
46
|
-
scripts
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
else if (entry.name.endsWith('.fcs')) {
|
|
51
|
-
// Root-level scripts
|
|
52
|
-
const template = await this.parseTemplate(entry.name, this.templatesDir, 'general');
|
|
53
|
-
if (template) {
|
|
54
|
-
this.templates.set(template.name, template);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Load scripts from a category directory
|
|
61
|
-
*/
|
|
62
|
-
async loadCategoryScripts(category, categoryPath) {
|
|
63
|
-
const scripts = [];
|
|
64
|
-
if (!fs.existsSync(categoryPath)) {
|
|
65
|
-
return scripts;
|
|
66
|
-
}
|
|
67
|
-
const files = fs.readdirSync(categoryPath);
|
|
68
|
-
for (const file of files) {
|
|
69
|
-
if (file.endsWith('.fcs')) {
|
|
70
|
-
const template = await this.parseTemplate(file, categoryPath, category);
|
|
71
|
-
if (template) {
|
|
72
|
-
scripts.push(template);
|
|
73
|
-
this.templates.set(template.name, template);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
return scripts;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Parse a template file to extract metadata
|
|
81
|
-
*/
|
|
82
|
-
async parseTemplate(filename, dir, category) {
|
|
83
|
-
const filePath = path.join(dir, filename);
|
|
84
|
-
try {
|
|
85
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
86
|
-
const lines = content.split('\n');
|
|
87
|
-
// Extract description from first comment block
|
|
88
|
-
let description = '';
|
|
89
|
-
let usage = '';
|
|
90
|
-
const envVars = [];
|
|
91
|
-
let inHeader = true;
|
|
92
|
-
for (const line of lines) {
|
|
93
|
-
const trimmed = line.trim();
|
|
94
|
-
// Extract env vars from all lines (they appear in code, not comments)
|
|
95
|
-
const envMatch = line.match(/env\("([A-Z_]+)"/g);
|
|
96
|
-
if (envMatch) {
|
|
97
|
-
for (const match of envMatch) {
|
|
98
|
-
const varName = match.match(/env\("([A-Z_]+)"/)?.[1];
|
|
99
|
-
if (varName && !envVars.includes(varName)) {
|
|
100
|
-
envVars.push(varName);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
if (!trimmed.startsWith('//')) {
|
|
105
|
-
inHeader = false;
|
|
106
|
-
continue;
|
|
107
|
-
}
|
|
108
|
-
if (!inHeader)
|
|
109
|
-
continue;
|
|
110
|
-
const commentContent = trimmed.substring(2).trim();
|
|
111
|
-
if (commentContent.startsWith('Usage:')) {
|
|
112
|
-
usage = commentContent.substring(6).trim();
|
|
113
|
-
}
|
|
114
|
-
else if (description === '' && commentContent) {
|
|
115
|
-
// Handle "filename.fcs - Description" format
|
|
116
|
-
if (commentContent.includes(' - ')) {
|
|
117
|
-
const parts = commentContent.split(' - ');
|
|
118
|
-
if (parts.length > 1) {
|
|
119
|
-
description = parts.slice(1).join(' - ').trim();
|
|
120
|
-
}
|
|
121
|
-
}
|
|
122
|
-
else if (!commentContent.includes('.fcs')) {
|
|
123
|
-
description = commentContent;
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return {
|
|
128
|
-
name: filename.replace('.fcs', ''),
|
|
129
|
-
path: filePath,
|
|
130
|
-
category,
|
|
131
|
-
description: description || `${filename} script`,
|
|
132
|
-
usage: usage || undefined,
|
|
133
|
-
envVars: envVars.length > 0 ? envVars : undefined
|
|
134
|
-
};
|
|
135
|
-
}
|
|
136
|
-
catch {
|
|
137
|
-
return null;
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
/**
|
|
141
|
-
* Get all templates
|
|
142
|
-
*/
|
|
143
|
-
getTemplates() {
|
|
144
|
-
return Array.from(this.templates.values());
|
|
145
|
-
}
|
|
146
|
-
/**
|
|
147
|
-
* Get templates by category
|
|
148
|
-
*/
|
|
149
|
-
getTemplatesByCategory(category) {
|
|
150
|
-
return this.getTemplates().filter(t => t.category === category);
|
|
151
|
-
}
|
|
152
|
-
/**
|
|
153
|
-
* Get all categories
|
|
154
|
-
*/
|
|
155
|
-
getCategories() {
|
|
156
|
-
return Array.from(this.categories.values());
|
|
157
|
-
}
|
|
158
|
-
/**
|
|
159
|
-
* Get a specific template by name
|
|
160
|
-
*/
|
|
161
|
-
getTemplate(name) {
|
|
162
|
-
return this.templates.get(name);
|
|
163
|
-
}
|
|
164
|
-
/**
|
|
165
|
-
* Search templates by keyword
|
|
166
|
-
*/
|
|
167
|
-
searchTemplates(keyword) {
|
|
168
|
-
const lowerKeyword = keyword.toLowerCase();
|
|
169
|
-
return this.getTemplates().filter(t => t.name.toLowerCase().includes(lowerKeyword) ||
|
|
170
|
-
t.description.toLowerCase().includes(lowerKeyword) ||
|
|
171
|
-
t.category.toLowerCase().includes(lowerKeyword));
|
|
172
|
-
}
|
|
173
|
-
/**
|
|
174
|
-
* Format templates as a readable list
|
|
175
|
-
*/
|
|
176
|
-
formatTemplateList() {
|
|
177
|
-
const lines = [
|
|
178
|
-
'FCS Script Templates',
|
|
179
|
-
'='.repeat(50),
|
|
180
|
-
''
|
|
181
|
-
];
|
|
182
|
-
for (const category of this.getCategories()) {
|
|
183
|
-
lines.push(`## ${category.name.charAt(0).toUpperCase() + category.name.slice(1)}`);
|
|
184
|
-
lines.push(category.description);
|
|
185
|
-
lines.push('');
|
|
186
|
-
for (const script of category.scripts) {
|
|
187
|
-
lines.push(` ${script.name}`);
|
|
188
|
-
lines.push(` ${script.description}`);
|
|
189
|
-
if (script.usage) {
|
|
190
|
-
lines.push(` Usage: ${script.usage}`);
|
|
191
|
-
}
|
|
192
|
-
lines.push('');
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
lines.push('-'.repeat(50));
|
|
196
|
-
lines.push(`Total: ${this.templates.size} templates in ${this.categories.size} categories`);
|
|
197
|
-
return lines.join('\n');
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
/**
|
|
201
|
-
* Singleton instance
|
|
202
|
-
*/
|
|
203
|
-
let registryInstance = null;
|
|
204
|
-
/**
|
|
205
|
-
* Get the script registry instance
|
|
206
|
-
*/
|
|
207
|
-
export function getScriptRegistry() {
|
|
208
|
-
if (!registryInstance) {
|
|
209
|
-
registryInstance = new ScriptRegistry();
|
|
210
|
-
}
|
|
211
|
-
return registryInstance;
|
|
212
|
-
}
|
|
213
|
-
/**
|
|
214
|
-
* Initialize and load the script registry
|
|
215
|
-
*/
|
|
216
|
-
export async function initScriptRegistry(templatesDir) {
|
|
217
|
-
const registry = new ScriptRegistry(templatesDir);
|
|
218
|
-
await registry.loadTemplates();
|
|
219
|
-
registryInstance = registry;
|
|
220
|
-
return registry;
|
|
221
|
-
}
|
|
4
|
+
export { ScriptRegistry, getScriptRegistry, initScriptRegistry, } from '../scripting/script-registry.js';
|
|
222
5
|
//# sourceMappingURL=script-registry.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"script-registry.js","sourceRoot":"","sources":["../../src/fcs/script-registry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"script-registry.js","sourceRoot":"","sources":["../../src/fcs/script-registry.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,iCAAiC,CAAC"}
|
|
@@ -1,103 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
4
|
-
* Provides FCS functions for cross-session synchronization:
|
|
5
|
-
* - sync.status() - Get current sync status
|
|
6
|
-
* - sync.push() - Push local changes
|
|
7
|
-
* - sync.pull() - Pull remote changes
|
|
8
|
-
* - sync.diff() - Show pending changes
|
|
9
|
-
* - sync.resolve() - Resolve conflicts
|
|
10
|
-
* - sync.snapshot() - Create workspace snapshot
|
|
11
|
-
* - sync.restore() - Restore from snapshot
|
|
2
|
+
* @deprecated Use src/scripting/sync-bindings.ts instead. This file re-exports for backward compatibility.
|
|
12
3
|
*/
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
export interface WorkspaceSnapshot {
|
|
16
|
-
id: string;
|
|
17
|
-
timestamp: number;
|
|
18
|
-
files: Map<string, FileState>;
|
|
19
|
-
context: SessionContext;
|
|
20
|
-
metadata: SnapshotMetadata;
|
|
21
|
-
}
|
|
22
|
-
export interface FileState {
|
|
23
|
-
path: string;
|
|
24
|
-
content: string;
|
|
25
|
-
hash: string;
|
|
26
|
-
lastModified: number;
|
|
27
|
-
isOpen: boolean;
|
|
28
|
-
isDirty: boolean;
|
|
29
|
-
}
|
|
30
|
-
export interface SessionContext {
|
|
31
|
-
sessionId: string;
|
|
32
|
-
agentMode: string;
|
|
33
|
-
toolsUsed: string[];
|
|
34
|
-
conversationLength: number;
|
|
35
|
-
startTime: number;
|
|
36
|
-
}
|
|
37
|
-
export interface SnapshotMetadata {
|
|
38
|
-
name?: string;
|
|
39
|
-
description?: string;
|
|
40
|
-
tags?: string[];
|
|
41
|
-
createdBy: string;
|
|
42
|
-
}
|
|
43
|
-
export interface SyncBindingsConfig extends Partial<FCSConfig> {
|
|
44
|
-
sessionId?: string;
|
|
45
|
-
nodeId?: string;
|
|
46
|
-
onConflict?: (conflict: SyncConflict) => void;
|
|
47
|
-
}
|
|
48
|
-
export declare class WorkspaceStateTracker {
|
|
49
|
-
private files;
|
|
50
|
-
private sessionContext;
|
|
51
|
-
private syncManager;
|
|
52
|
-
private snapshots;
|
|
53
|
-
constructor(sessionId: string, nodeId?: string);
|
|
54
|
-
initialize(): Promise<void>;
|
|
55
|
-
private restoreSnapshotFromData;
|
|
56
|
-
trackFile(path: string, content: string, isOpen?: boolean): void;
|
|
57
|
-
untrackFile(path: string): void;
|
|
58
|
-
markFileDirty(path: string): void;
|
|
59
|
-
markFileClean(path: string): void;
|
|
60
|
-
getTrackedFiles(): FileState[];
|
|
61
|
-
getDirtyFiles(): FileState[];
|
|
62
|
-
updateContext(updates: Partial<SessionContext>): void;
|
|
63
|
-
recordToolUsage(toolName: string): void;
|
|
64
|
-
incrementConversation(): void;
|
|
65
|
-
getContext(): SessionContext;
|
|
66
|
-
createSnapshot(metadata?: Partial<SnapshotMetadata>): WorkspaceSnapshot;
|
|
67
|
-
getSnapshot(id: string): WorkspaceSnapshot | undefined;
|
|
68
|
-
listSnapshots(): WorkspaceSnapshot[];
|
|
69
|
-
restoreSnapshot(id: string): boolean;
|
|
70
|
-
getSyncManager(): SyncManager<WorkspaceSnapshot>;
|
|
71
|
-
getSyncStatus(): SyncStatus;
|
|
72
|
-
pushChanges(): Promise<{
|
|
73
|
-
success: boolean;
|
|
74
|
-
snapshot: WorkspaceSnapshot;
|
|
75
|
-
}>;
|
|
76
|
-
pullChanges(remoteSnapshots: WorkspaceSnapshot[]): Promise<{
|
|
77
|
-
success: boolean;
|
|
78
|
-
conflicts: SyncConflict<WorkspaceSnapshot>[];
|
|
79
|
-
applied: number;
|
|
80
|
-
}>;
|
|
81
|
-
diffWith(other: WorkspaceSnapshot): FileDiff[];
|
|
82
|
-
private computeHash;
|
|
83
|
-
dispose(): void;
|
|
84
|
-
}
|
|
85
|
-
export interface FileDiff {
|
|
86
|
-
path: string;
|
|
87
|
-
type: 'added' | 'deleted' | 'modified';
|
|
88
|
-
local?: string;
|
|
89
|
-
remote?: string;
|
|
90
|
-
}
|
|
91
|
-
export declare function getWorkspaceTracker(sessionId?: string): Promise<WorkspaceStateTracker>;
|
|
92
|
-
export declare function resetWorkspaceTracker(): void;
|
|
93
|
-
/**
|
|
94
|
-
* Create sync bindings for FCS runtime
|
|
95
|
-
*/
|
|
96
|
-
export declare function createSyncBindings(config: SyncBindingsConfig, print: (msg: string) => void): Promise<Record<string, FCSValue>>;
|
|
97
|
-
declare const _default: {
|
|
98
|
-
createSyncBindings: typeof createSyncBindings;
|
|
99
|
-
getWorkspaceTracker: typeof getWorkspaceTracker;
|
|
100
|
-
resetWorkspaceTracker: typeof resetWorkspaceTracker;
|
|
101
|
-
WorkspaceStateTracker: typeof WorkspaceStateTracker;
|
|
102
|
-
};
|
|
103
|
-
export default _default;
|
|
4
|
+
export { createSyncBindings, getWorkspaceTracker, resetWorkspaceTracker, WorkspaceStateTracker, } from '../scripting/sync-bindings.js';
|
|
5
|
+
export type { WorkspaceSnapshot, FileState, SessionContext, FileDiff, SyncBindingsConfig, } from '../scripting/sync-bindings.js';
|