@lssm/bundle.contractspec-workspace 0.0.0-canary-20251217052941 → 0.0.0-canary-20251217060804
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/dist/adapters/ai.d.ts +11 -0
- package/dist/adapters/factory.d.ts +28 -0
- package/dist/adapters/fs.d.ts +10 -0
- package/dist/adapters/git.d.ts +10 -0
- package/dist/adapters/index.d.ts +7 -0
- package/dist/adapters/logger.d.ts +17 -0
- package/dist/adapters/watcher.d.ts +10 -0
- package/dist/adapters/workspace.d.ts +93 -0
- package/dist/ai/agents/claude-code-agent.d.ts +21 -0
- package/dist/ai/agents/cursor-agent.d.ts +67 -0
- package/dist/ai/agents/openai-codex-agent.d.ts +21 -0
- package/dist/ai/agents/orchestrator.d.ts +49 -0
- package/dist/ai/agents/simple-agent.d.ts +16 -0
- package/dist/ai/agents/types.d.ts +35 -0
- package/dist/ai/client.d.ts +82 -0
- package/dist/ai/index.d.ts +16 -0
- package/dist/ai/prompts/code-generation.d.ts +25 -0
- package/dist/ai/prompts/index.d.ts +9 -0
- package/dist/ai/prompts/spec-creation.d.ts +28 -0
- package/dist/ai/providers.d.ts +28 -0
- package/dist/formatters/index.d.ts +10 -0
- package/dist/formatters/json.d.ts +88 -0
- package/dist/formatters/sarif.d.ts +100 -0
- package/dist/formatters/text.d.ts +34 -0
- package/dist/index.d.ts +69 -0
- package/dist/ports/ai.d.ts +58 -0
- package/dist/ports/fs.d.ts +80 -0
- package/dist/ports/git.d.ts +32 -0
- package/dist/ports/index.d.ts +5 -0
- package/dist/ports/logger.d.ts +87 -0
- package/dist/ports/watcher.d.ts +51 -0
- package/dist/services/agent-guide/adapters/claude-code.d.ts +34 -0
- package/dist/services/agent-guide/adapters/cursor-cli.d.ts +38 -0
- package/dist/services/agent-guide/adapters/generic-mcp.d.ts +52 -0
- package/dist/services/agent-guide/adapters/index.d.ts +22 -0
- package/dist/services/agent-guide/agent-guide-service.d.ts +55 -0
- package/dist/services/agent-guide/index.d.ts +6 -0
- package/dist/services/agent-guide/types.d.ts +57 -0
- package/dist/services/build.d.ts +58 -0
- package/dist/services/ci-check/ci-check-service.d.ts +15 -0
- package/dist/services/ci-check/index.d.ts +2 -0
- package/dist/services/ci-check/types.d.ts +142 -0
- package/dist/services/clean.d.ts +40 -0
- package/dist/services/config.d.ts +25 -0
- package/dist/services/deps.d.ts +52 -0
- package/dist/services/diff.d.ts +33 -0
- package/dist/services/doctor/doctor-service.d.ts +23 -0
- package/dist/services/doctor/index.d.ts +2 -0
- package/dist/services/doctor/types.d.ts +117 -0
- package/dist/services/implementation/discovery.d.ts +29 -0
- package/dist/services/implementation/index.d.ts +3 -0
- package/dist/services/implementation/resolver.d.ts +43 -0
- package/dist/services/implementation/types.d.ts +78 -0
- package/dist/services/index.d.ts +56 -0
- package/dist/services/integrity-diagram.d.ts +35 -0
- package/dist/services/integrity.d.ts +133 -0
- package/dist/services/list.d.ts +30 -0
- package/dist/services/openapi/export-service.d.ts +52 -0
- package/dist/services/openapi/import-service.d.ts +15 -0
- package/dist/services/openapi/index.d.ts +5 -0
- package/dist/services/openapi/sync-service.d.ts +18 -0
- package/dist/services/openapi/types.d.ts +184 -0
- package/dist/services/openapi/validate-service.d.ts +15 -0
- package/dist/services/regenerator.d.ts +17 -0
- package/dist/services/registry.d.ts +52 -0
- package/dist/services/setup/config-generators.d.ts +41 -0
- package/dist/services/setup/file-merger.d.ts +26 -0
- package/dist/services/setup/setup-service.d.ts +11 -0
- package/dist/services/setup/types.d.ts +84 -0
- package/dist/services/sync.d.ts +40 -0
- package/dist/services/test.d.ts +14 -0
- package/dist/services/validate-implementation.d.ts +31 -0
- package/dist/services/validate.d.ts +40 -0
- package/dist/services/verification-cache/adapters/filesystem.d.ts +45 -0
- package/dist/services/verification-cache/adapters/in-memory.d.ts +26 -0
- package/dist/services/verification-cache/adapters/index.d.ts +3 -0
- package/dist/services/verification-cache/adapters/workspace-state.d.ts +48 -0
- package/dist/services/verification-cache/cache-service.d.ts +69 -0
- package/dist/services/verification-cache/index.d.ts +6 -0
- package/dist/services/verification-cache/types.d.ts +123 -0
- package/dist/services/verify/ai-verifier.d.ts +24 -0
- package/dist/services/verify/behavior-verifier.d.ts +11 -0
- package/dist/services/verify/index.d.ts +5 -0
- package/dist/services/verify/structure-verifier.d.ts +11 -0
- package/dist/services/verify/types.d.ts +136 -0
- package/dist/services/verify/verify-service.d.ts +59 -0
- package/dist/services/watch.d.ts +24 -0
- package/dist/services/workspace-info.d.ts +61 -0
- package/dist/templates/app-config.template.d.ts +6 -0
- package/dist/templates/data-view.template.d.ts +6 -0
- package/dist/templates/event.template.d.ts +10 -0
- package/dist/templates/experiment.template.d.ts +6 -0
- package/dist/templates/handler.template.d.ts +15 -0
- package/dist/templates/index.d.ts +20 -0
- package/dist/templates/integration.template.d.ts +6 -0
- package/dist/templates/knowledge.template.d.ts +6 -0
- package/dist/templates/migration.template.d.ts +6 -0
- package/dist/templates/operation.template.d.ts +10 -0
- package/dist/templates/presentation.template.d.ts +10 -0
- package/dist/templates/telemetry.template.d.ts +6 -0
- package/dist/templates/workflow-runner.template.d.ts +15 -0
- package/dist/templates/workflow.template.d.ts +6 -0
- package/dist/types/config.d.ts +33 -0
- package/dist/types.d.ts +323 -0
- package/package.json +10 -10
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AiAdapter } from "../ports/ai.js";
|
|
2
|
+
import { WorkspaceConfig } from "@lssm/module.contractspec-workspace";
|
|
3
|
+
|
|
4
|
+
//#region src/adapters/ai.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Create a Node.js AI adapter using Vercel AI SDK.
|
|
8
|
+
*/
|
|
9
|
+
declare function createNodeAiAdapter(config: WorkspaceConfig): AiAdapter;
|
|
10
|
+
//#endregion
|
|
11
|
+
export { createNodeAiAdapter };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { WorkspaceAdapters } from "../ports/logger.js";
|
|
2
|
+
import { WorkspaceConfig } from "@lssm/module.contractspec-workspace";
|
|
3
|
+
|
|
4
|
+
//#region src/adapters/factory.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Options for creating adapters.
|
|
8
|
+
*/
|
|
9
|
+
interface CreateAdaptersOptions {
|
|
10
|
+
/**
|
|
11
|
+
* Working directory for file operations.
|
|
12
|
+
*/
|
|
13
|
+
cwd?: string;
|
|
14
|
+
/**
|
|
15
|
+
* Workspace configuration for AI.
|
|
16
|
+
*/
|
|
17
|
+
config?: WorkspaceConfig;
|
|
18
|
+
/**
|
|
19
|
+
* Use no-op logger (for testing).
|
|
20
|
+
*/
|
|
21
|
+
silent?: boolean;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Create all Node.js adapters with default configuration.
|
|
25
|
+
*/
|
|
26
|
+
declare function createNodeAdapters(options?: CreateAdaptersOptions): WorkspaceAdapters;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { CreateAdaptersOptions, createNodeAdapters };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { createNodeFsAdapter } from "./fs.js";
|
|
2
|
+
import { createNodeGitAdapter } from "./git.js";
|
|
3
|
+
import { createNodeWatcherAdapter } from "./watcher.js";
|
|
4
|
+
import { createNodeAiAdapter } from "./ai.js";
|
|
5
|
+
import { createConsoleLoggerAdapter, createNoopLoggerAdapter } from "./logger.js";
|
|
6
|
+
import { CreateAdaptersOptions, createNodeAdapters } from "./factory.js";
|
|
7
|
+
import { PackageManager, WorkspaceInfo, detectPackageManager, findPackageRoot, findWorkspaceRoot, getExecCommand, getInstallCommand, getPackageName, getRunCommand, getWorkspaceInfo, getWorkspacePackages, isMonorepo } from "./workspace.js";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { LoggerAdapter } from "../ports/logger.js";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/logger.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Create a console-based logger adapter.
|
|
7
|
+
* This is a basic implementation - CLI apps should inject their own
|
|
8
|
+
* logger with chalk/ora for better terminal output.
|
|
9
|
+
*/
|
|
10
|
+
declare function createConsoleLoggerAdapter(): LoggerAdapter;
|
|
11
|
+
/**
|
|
12
|
+
* Create a no-op logger adapter.
|
|
13
|
+
* Useful for testing or when logging is not desired.
|
|
14
|
+
*/
|
|
15
|
+
declare function createNoopLoggerAdapter(): LoggerAdapter;
|
|
16
|
+
//#endregion
|
|
17
|
+
export { createConsoleLoggerAdapter, createNoopLoggerAdapter };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { WatcherAdapter } from "../ports/watcher.js";
|
|
2
|
+
|
|
3
|
+
//#region src/adapters/watcher.d.ts
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Create a Node.js file watcher adapter using chokidar.
|
|
7
|
+
*/
|
|
8
|
+
declare function createNodeWatcherAdapter(cwd?: string): WatcherAdapter;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { createNodeWatcherAdapter };
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
//#region src/adapters/workspace.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Workspace and monorepo detection utilities.
|
|
4
|
+
*
|
|
5
|
+
* Provides utilities for detecting workspace roots, package managers,
|
|
6
|
+
* and monorepo configurations across Bun, pnpm, Yarn, and npm.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Supported package managers.
|
|
10
|
+
*/
|
|
11
|
+
type PackageManager = 'bun' | 'pnpm' | 'yarn' | 'npm';
|
|
12
|
+
/**
|
|
13
|
+
* Workspace detection result.
|
|
14
|
+
*/
|
|
15
|
+
interface WorkspaceInfo {
|
|
16
|
+
/**
|
|
17
|
+
* The detected package manager.
|
|
18
|
+
*/
|
|
19
|
+
packageManager: PackageManager;
|
|
20
|
+
/**
|
|
21
|
+
* Root of the workspace (monorepo root or single package root).
|
|
22
|
+
*/
|
|
23
|
+
workspaceRoot: string;
|
|
24
|
+
/**
|
|
25
|
+
* Root of the current package (may differ from workspaceRoot in monorepos).
|
|
26
|
+
*/
|
|
27
|
+
packageRoot: string;
|
|
28
|
+
/**
|
|
29
|
+
* Whether this is a monorepo.
|
|
30
|
+
*/
|
|
31
|
+
isMonorepo: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* List of package paths in monorepo (relative to workspaceRoot).
|
|
34
|
+
*/
|
|
35
|
+
packages?: string[];
|
|
36
|
+
/**
|
|
37
|
+
* Name of the current package (from package.json).
|
|
38
|
+
*/
|
|
39
|
+
packageName?: string;
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Find the nearest directory containing a package.json.
|
|
43
|
+
*/
|
|
44
|
+
declare function findPackageRoot(startDir?: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Find the workspace root (monorepo root or single package root).
|
|
47
|
+
*
|
|
48
|
+
* Walks up the directory tree looking for:
|
|
49
|
+
* 1. pnpm-workspace.yaml (pnpm monorepo)
|
|
50
|
+
* 2. package.json with "workspaces" field (yarn/npm/bun monorepo)
|
|
51
|
+
* 3. Lock files (bun.lockb, pnpm-lock.yaml, yarn.lock, package-lock.json)
|
|
52
|
+
*/
|
|
53
|
+
declare function findWorkspaceRoot(startDir?: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Detect the package manager in use.
|
|
56
|
+
*
|
|
57
|
+
* Priority:
|
|
58
|
+
* 1. Lock file presence (most reliable)
|
|
59
|
+
* 2. packageManager field in package.json
|
|
60
|
+
* 3. COREPACK_ROOT environment variable
|
|
61
|
+
* 4. Default to npm
|
|
62
|
+
*/
|
|
63
|
+
declare function detectPackageManager(workspaceRoot?: string): PackageManager;
|
|
64
|
+
/**
|
|
65
|
+
* Check if the workspace is a monorepo.
|
|
66
|
+
*/
|
|
67
|
+
declare function isMonorepo(workspaceRoot?: string): boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Get workspace package patterns from package.json or pnpm-workspace.yaml.
|
|
70
|
+
*/
|
|
71
|
+
declare function getWorkspacePackages(workspaceRoot: string): string[] | undefined;
|
|
72
|
+
/**
|
|
73
|
+
* Get package name from package.json.
|
|
74
|
+
*/
|
|
75
|
+
declare function getPackageName(packageRoot: string): string | undefined;
|
|
76
|
+
/**
|
|
77
|
+
* Get complete workspace information.
|
|
78
|
+
*/
|
|
79
|
+
declare function getWorkspaceInfo(startDir?: string): WorkspaceInfo;
|
|
80
|
+
/**
|
|
81
|
+
* Get the run command for the detected package manager.
|
|
82
|
+
*/
|
|
83
|
+
declare function getRunCommand(packageManager: PackageManager, script: string): string;
|
|
84
|
+
/**
|
|
85
|
+
* Get the exec command for the detected package manager.
|
|
86
|
+
*/
|
|
87
|
+
declare function getExecCommand(packageManager: PackageManager, command: string): string;
|
|
88
|
+
/**
|
|
89
|
+
* Get the install command for the detected package manager.
|
|
90
|
+
*/
|
|
91
|
+
declare function getInstallCommand(packageManager: PackageManager, isDev?: boolean): string;
|
|
92
|
+
//#endregion
|
|
93
|
+
export { PackageManager, WorkspaceInfo, detectPackageManager, findPackageRoot, findWorkspaceRoot, getExecCommand, getInstallCommand, getPackageName, getRunCommand, getWorkspaceInfo, getWorkspacePackages, isMonorepo };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AgentProvider, AgentResult, AgentTask } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/ai/agents/claude-code-agent.d.ts
|
|
4
|
+
|
|
5
|
+
declare class ClaudeCodeAgent implements AgentProvider {
|
|
6
|
+
name: "claude-code";
|
|
7
|
+
private apiKey;
|
|
8
|
+
constructor();
|
|
9
|
+
canHandle(task: AgentTask): boolean;
|
|
10
|
+
generate(task: AgentTask): Promise<AgentResult>;
|
|
11
|
+
validate(task: AgentTask): Promise<AgentResult>;
|
|
12
|
+
private buildSystemPrompt;
|
|
13
|
+
private buildUserPrompt;
|
|
14
|
+
private extractCode;
|
|
15
|
+
private detectIssues;
|
|
16
|
+
private extractErrors;
|
|
17
|
+
private extractWarnings;
|
|
18
|
+
private extractSuggestions;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { ClaudeCodeAgent };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AgentProvider, AgentResult, AgentTask } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/ai/agents/cursor-agent.d.ts
|
|
4
|
+
|
|
5
|
+
declare class CursorAgent implements AgentProvider {
|
|
6
|
+
name: "cursor";
|
|
7
|
+
private cursorPath;
|
|
8
|
+
private isWindsurf;
|
|
9
|
+
private composerPort;
|
|
10
|
+
constructor();
|
|
11
|
+
canHandle(task: AgentTask): boolean;
|
|
12
|
+
generate(task: AgentTask): Promise<AgentResult>;
|
|
13
|
+
validate(task: AgentTask): Promise<AgentResult>;
|
|
14
|
+
/**
|
|
15
|
+
* Detect if running in Cursor/Windsurf environment
|
|
16
|
+
*/
|
|
17
|
+
private detectEnvironment;
|
|
18
|
+
/**
|
|
19
|
+
* Execute task using the best available method
|
|
20
|
+
*/
|
|
21
|
+
private executeWithBestMethod;
|
|
22
|
+
/**
|
|
23
|
+
* Use Windsurf's native API
|
|
24
|
+
*/
|
|
25
|
+
/**
|
|
26
|
+
* Use Cursor Composer API
|
|
27
|
+
*/
|
|
28
|
+
/**
|
|
29
|
+
* Use Cursor CLI directly
|
|
30
|
+
*/
|
|
31
|
+
private useCursorCLI;
|
|
32
|
+
/**
|
|
33
|
+
* File-based approach - create workspace and instructions for manual completion
|
|
34
|
+
*/
|
|
35
|
+
private useFileBasedApproach;
|
|
36
|
+
/**
|
|
37
|
+
* Setup workspace for validation
|
|
38
|
+
*/
|
|
39
|
+
private setupValidationWorkspace;
|
|
40
|
+
/**
|
|
41
|
+
* Prepare files for API submission
|
|
42
|
+
*/
|
|
43
|
+
private prepareFilesForAPI;
|
|
44
|
+
/**
|
|
45
|
+
* Build detailed prompt for cursor
|
|
46
|
+
*/
|
|
47
|
+
private buildDetailedPrompt;
|
|
48
|
+
/**
|
|
49
|
+
* Build validation-specific prompt
|
|
50
|
+
*/
|
|
51
|
+
private buildValidationPrompt;
|
|
52
|
+
/**
|
|
53
|
+
* Generate basic template for task
|
|
54
|
+
*/
|
|
55
|
+
private generateTemplate;
|
|
56
|
+
/**
|
|
57
|
+
* Cleanup temporary work directory
|
|
58
|
+
*/
|
|
59
|
+
private cleanupWorkDir;
|
|
60
|
+
private isCursorAvailable;
|
|
61
|
+
/**
|
|
62
|
+
* Check if Cursor Composer API might be available
|
|
63
|
+
*/
|
|
64
|
+
private hasComposerAPI;
|
|
65
|
+
}
|
|
66
|
+
//#endregion
|
|
67
|
+
export { CursorAgent };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AgentProvider, AgentResult, AgentTask } from "./types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/ai/agents/openai-codex-agent.d.ts
|
|
4
|
+
|
|
5
|
+
declare class OpenAICodexAgent implements AgentProvider {
|
|
6
|
+
name: "openai-codex";
|
|
7
|
+
private apiKey;
|
|
8
|
+
constructor();
|
|
9
|
+
canHandle(task: AgentTask): boolean;
|
|
10
|
+
generate(task: AgentTask): Promise<AgentResult>;
|
|
11
|
+
validate(task: AgentTask): Promise<AgentResult>;
|
|
12
|
+
private isComplexTask;
|
|
13
|
+
private buildSystemPrompt;
|
|
14
|
+
private buildUserPrompt;
|
|
15
|
+
private extractCode;
|
|
16
|
+
private detectIssues;
|
|
17
|
+
private extractErrors;
|
|
18
|
+
private extractWarnings;
|
|
19
|
+
}
|
|
20
|
+
//#endregion
|
|
21
|
+
export { OpenAICodexAgent };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Config } from "../../types/config.js";
|
|
2
|
+
import { AgentMode, AgentResult, AgentTask } from "./types.js";
|
|
3
|
+
|
|
4
|
+
//#region src/ai/agents/orchestrator.d.ts
|
|
5
|
+
|
|
6
|
+
declare class AgentOrchestrator {
|
|
7
|
+
private config;
|
|
8
|
+
private agents;
|
|
9
|
+
private defaultAgent;
|
|
10
|
+
constructor(config: Config);
|
|
11
|
+
/**
|
|
12
|
+
* Execute a task using the configured agent with fallback support
|
|
13
|
+
*/
|
|
14
|
+
executeTask(task: AgentTask): Promise<AgentResult>;
|
|
15
|
+
/**
|
|
16
|
+
* Generate code from specification
|
|
17
|
+
*/
|
|
18
|
+
generate(specCode: string, targetPath?: string): Promise<AgentResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Generate tests for implementation
|
|
21
|
+
*/
|
|
22
|
+
generateTests(specCode: string, implementationCode: string): Promise<AgentResult>;
|
|
23
|
+
/**
|
|
24
|
+
* Validate implementation against specification
|
|
25
|
+
*/
|
|
26
|
+
validate(specCode: string, implementationCode: string): Promise<AgentResult>;
|
|
27
|
+
/**
|
|
28
|
+
* Refactor existing code
|
|
29
|
+
*/
|
|
30
|
+
refactor(specCode: string, existingCode: string): Promise<AgentResult>;
|
|
31
|
+
/**
|
|
32
|
+
* List available agents and their status
|
|
33
|
+
*/
|
|
34
|
+
getAvailableAgents(): Promise<{
|
|
35
|
+
mode: AgentMode;
|
|
36
|
+
available: boolean;
|
|
37
|
+
reason?: string;
|
|
38
|
+
}[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Get the configured agent mode
|
|
41
|
+
*/
|
|
42
|
+
private getAgentMode;
|
|
43
|
+
/**
|
|
44
|
+
* Get fallback mode for an agent
|
|
45
|
+
*/
|
|
46
|
+
private getFallbackMode;
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { AgentOrchestrator };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Config } from "../../types/config.js";
|
|
2
|
+
import { AgentProvider, AgentResult, AgentTask } from "./types.js";
|
|
3
|
+
|
|
4
|
+
//#region src/ai/agents/simple-agent.d.ts
|
|
5
|
+
|
|
6
|
+
declare class SimpleAgent implements AgentProvider {
|
|
7
|
+
private config;
|
|
8
|
+
name: "simple";
|
|
9
|
+
constructor(config: Config);
|
|
10
|
+
canHandle(task: AgentTask): boolean;
|
|
11
|
+
generate(task: AgentTask): Promise<AgentResult>;
|
|
12
|
+
validate(task: AgentTask): Promise<AgentResult>;
|
|
13
|
+
private buildPrompt;
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { SimpleAgent };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
//#region src/ai/agents/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Agent types and interfaces for code generation and validation
|
|
4
|
+
*/
|
|
5
|
+
type AgentMode = 'simple' | 'cursor' | 'claude-code' | 'openai-codex';
|
|
6
|
+
interface AgentTask {
|
|
7
|
+
type: 'generate' | 'validate' | 'refactor' | 'test';
|
|
8
|
+
specCode: string;
|
|
9
|
+
existingCode?: string;
|
|
10
|
+
targetPath?: string;
|
|
11
|
+
options?: Record<string, unknown>;
|
|
12
|
+
}
|
|
13
|
+
interface AgentResult {
|
|
14
|
+
success: boolean;
|
|
15
|
+
code?: string;
|
|
16
|
+
errors?: string[];
|
|
17
|
+
warnings?: string[];
|
|
18
|
+
suggestions?: string[];
|
|
19
|
+
metadata?: Record<string, unknown>;
|
|
20
|
+
}
|
|
21
|
+
interface AgentProvider {
|
|
22
|
+
name: AgentMode;
|
|
23
|
+
generate(task: AgentTask): Promise<AgentResult>;
|
|
24
|
+
validate(task: AgentTask): Promise<AgentResult>;
|
|
25
|
+
canHandle(task: AgentTask): boolean;
|
|
26
|
+
}
|
|
27
|
+
interface AgentConfig {
|
|
28
|
+
mode: AgentMode;
|
|
29
|
+
fallbackMode?: AgentMode;
|
|
30
|
+
timeout?: number;
|
|
31
|
+
retries?: number;
|
|
32
|
+
options?: Record<string, unknown>;
|
|
33
|
+
}
|
|
34
|
+
//#endregion
|
|
35
|
+
export { AgentConfig, AgentMode, AgentProvider, AgentResult, AgentTask };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { Config } from "../types/config.js";
|
|
2
|
+
import { OpKind, PresentationKind } from "../types.js";
|
|
3
|
+
|
|
4
|
+
//#region src/ai/client.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* AI Client for spec creation and code generation
|
|
8
|
+
*/
|
|
9
|
+
declare class AIClient {
|
|
10
|
+
private config;
|
|
11
|
+
constructor(config: Config);
|
|
12
|
+
/**
|
|
13
|
+
* Generate operation spec from natural language description
|
|
14
|
+
*/
|
|
15
|
+
generateOperationSpec(description: string, kind: OpKind): Promise<{
|
|
16
|
+
name: string;
|
|
17
|
+
version: number;
|
|
18
|
+
description: string;
|
|
19
|
+
goal: string;
|
|
20
|
+
context: string;
|
|
21
|
+
stability: "experimental" | "beta" | "stable" | "deprecated";
|
|
22
|
+
owners: string[];
|
|
23
|
+
tags: string[];
|
|
24
|
+
auth: "anonymous" | "user" | "admin";
|
|
25
|
+
inputShape: string;
|
|
26
|
+
outputShape: string;
|
|
27
|
+
flags: string[];
|
|
28
|
+
possibleEvents: string[];
|
|
29
|
+
analytics: string[];
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Generate event spec from description
|
|
33
|
+
*/
|
|
34
|
+
generateEventSpec(description: string): Promise<{
|
|
35
|
+
name: string;
|
|
36
|
+
version: number;
|
|
37
|
+
description: string;
|
|
38
|
+
stability: "experimental" | "beta" | "stable" | "deprecated";
|
|
39
|
+
owners: string[];
|
|
40
|
+
tags: string[];
|
|
41
|
+
payloadShape: string;
|
|
42
|
+
piiFields: string[];
|
|
43
|
+
}>;
|
|
44
|
+
/**
|
|
45
|
+
* Generate presentation spec from description
|
|
46
|
+
*/
|
|
47
|
+
generatePresentationSpec(description: string, kind: PresentationKind): Promise<{
|
|
48
|
+
name: string;
|
|
49
|
+
version: number;
|
|
50
|
+
description: string;
|
|
51
|
+
stability: "experimental" | "beta" | "stable" | "deprecated";
|
|
52
|
+
owners: string[];
|
|
53
|
+
tags: string[];
|
|
54
|
+
componentKey?: string | undefined;
|
|
55
|
+
propsShape?: string | undefined;
|
|
56
|
+
content?: string | undefined;
|
|
57
|
+
mimeType?: string | undefined;
|
|
58
|
+
dataShape?: string | undefined;
|
|
59
|
+
}>;
|
|
60
|
+
/**
|
|
61
|
+
* Generate handler implementation from spec
|
|
62
|
+
*/
|
|
63
|
+
generateHandler(specCode: string): Promise<string>;
|
|
64
|
+
/**
|
|
65
|
+
* Generate React component from presentation spec
|
|
66
|
+
*/
|
|
67
|
+
generateComponent(specCode: string): Promise<string>;
|
|
68
|
+
/**
|
|
69
|
+
* Generate form component from form spec
|
|
70
|
+
*/
|
|
71
|
+
generateForm(specCode: string): Promise<string>;
|
|
72
|
+
/**
|
|
73
|
+
* Generate tests for implementation
|
|
74
|
+
*/
|
|
75
|
+
generateTests(specCode: string, implementationCode: string, testType: 'handler' | 'component'): Promise<string>;
|
|
76
|
+
/**
|
|
77
|
+
* Stream code generation for better UX
|
|
78
|
+
*/
|
|
79
|
+
streamCodeGeneration(prompt: string, onChunk: (text: string) => void): Promise<string>;
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { AIClient };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { AIClient } from "./client.js";
|
|
2
|
+
import { getAIProvider, getRecommendedModels, validateProvider } from "./providers.js";
|
|
3
|
+
import { AgentConfig, AgentMode, AgentProvider, AgentResult, AgentTask } from "./agents/types.js";
|
|
4
|
+
import { AgentOrchestrator } from "./agents/orchestrator.js";
|
|
5
|
+
import { SimpleAgent } from "./agents/simple-agent.js";
|
|
6
|
+
import { CursorAgent } from "./agents/cursor-agent.js";
|
|
7
|
+
import { ClaudeCodeAgent } from "./agents/claude-code-agent.js";
|
|
8
|
+
import { OpenAICodexAgent } from "./agents/openai-codex-agent.js";
|
|
9
|
+
import { index_d_exports as index_d_exports$1 } from "./prompts/index.js";
|
|
10
|
+
|
|
11
|
+
//#region src/ai/index.d.ts
|
|
12
|
+
declare namespace index_d_exports {
|
|
13
|
+
export { AIClient, AgentConfig, AgentMode, AgentOrchestrator, AgentProvider, AgentResult, AgentTask, ClaudeCodeAgent, CursorAgent, OpenAICodexAgent, SimpleAgent, getAIProvider, getRecommendedModels, index_d_exports$1 as prompts, validateProvider };
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { index_d_exports };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
declare namespace code_generation_d_exports {
|
|
2
|
+
export { buildComponentPrompt, buildFormPrompt, buildHandlerPrompt, buildTestPrompt, getCodeGenSystemPrompt };
|
|
3
|
+
}
|
|
4
|
+
/**
|
|
5
|
+
* Build prompt for generating handler implementation
|
|
6
|
+
*/
|
|
7
|
+
declare function buildHandlerPrompt(specCode: string): string;
|
|
8
|
+
/**
|
|
9
|
+
* Build prompt for generating React component from presentation spec
|
|
10
|
+
*/
|
|
11
|
+
declare function buildComponentPrompt(specCode: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Build prompt for generating form component
|
|
14
|
+
*/
|
|
15
|
+
declare function buildFormPrompt(specCode: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Build prompt for generating tests
|
|
18
|
+
*/
|
|
19
|
+
declare function buildTestPrompt(specCode: string, implementationCode: string, testType: 'handler' | 'component'): string;
|
|
20
|
+
/**
|
|
21
|
+
* System prompt for code generation
|
|
22
|
+
*/
|
|
23
|
+
declare function getCodeGenSystemPrompt(): string;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { code_generation_d_exports };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { code_generation_d_exports } from "./code-generation.js";
|
|
2
|
+
import { spec_creation_d_exports } from "./spec-creation.js";
|
|
3
|
+
|
|
4
|
+
//#region src/ai/prompts/index.d.ts
|
|
5
|
+
declare namespace index_d_exports {
|
|
6
|
+
export { code_generation_d_exports as codeGeneration, spec_creation_d_exports as specCreation };
|
|
7
|
+
}
|
|
8
|
+
//#endregion
|
|
9
|
+
export { index_d_exports };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { OpKind, PresentationKind } from "../../types.js";
|
|
2
|
+
|
|
3
|
+
//#region src/ai/prompts/spec-creation.d.ts
|
|
4
|
+
declare namespace spec_creation_d_exports {
|
|
5
|
+
export { addExampleContext, buildEventSpecPrompt, buildOperationSpecPrompt, buildPresentationSpecPrompt, getSystemPrompt };
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* Build prompt for creating operation spec from description
|
|
9
|
+
*/
|
|
10
|
+
declare function buildOperationSpecPrompt(description: string, kind: OpKind): string;
|
|
11
|
+
/**
|
|
12
|
+
* Build prompt for creating event spec from description
|
|
13
|
+
*/
|
|
14
|
+
declare function buildEventSpecPrompt(description: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* Build prompt for creating presentation spec from description
|
|
17
|
+
*/
|
|
18
|
+
declare function buildPresentationSpecPrompt(description: string, kind: PresentationKind): string;
|
|
19
|
+
/**
|
|
20
|
+
* Build system prompt for all spec generation
|
|
21
|
+
*/
|
|
22
|
+
declare function getSystemPrompt(): string;
|
|
23
|
+
/**
|
|
24
|
+
* Create example-based prompt for better results
|
|
25
|
+
*/
|
|
26
|
+
declare function addExampleContext(basePrompt: string, examples: string[]): string;
|
|
27
|
+
//#endregion
|
|
28
|
+
export { spec_creation_d_exports };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Config } from "../types/config.js";
|
|
2
|
+
import { LanguageModel } from "ai";
|
|
3
|
+
|
|
4
|
+
//#region src/ai/providers.d.ts
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Initialize AI provider based on configuration
|
|
8
|
+
*
|
|
9
|
+
* @deprecated Use createProvider() from @lssm/lib.ai-providers instead
|
|
10
|
+
*/
|
|
11
|
+
declare function getAIProvider(config: Config): LanguageModel;
|
|
12
|
+
/**
|
|
13
|
+
* Validate that the provider is accessible and working
|
|
14
|
+
*
|
|
15
|
+
* @deprecated Use validateProvider() from @lssm/lib.ai-providers instead
|
|
16
|
+
*/
|
|
17
|
+
declare function validateProvider(config: Config): Promise<{
|
|
18
|
+
success: boolean;
|
|
19
|
+
error?: string;
|
|
20
|
+
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Get recommended models for each provider
|
|
23
|
+
*
|
|
24
|
+
* @deprecated Use getModelsForProvider() from @lssm/lib.ai-providers instead
|
|
25
|
+
*/
|
|
26
|
+
declare function getRecommendedModels(provider: Config['aiProvider']): string[];
|
|
27
|
+
//#endregion
|
|
28
|
+
export { getAIProvider, getRecommendedModels, validateProvider };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { SarifFormatOptions, SarifOutput, formatAsSarif, sarifToJson } from "./sarif.js";
|
|
2
|
+
import { JsonCompactOutput, JsonFormatOptions, JsonFullOutput, JsonIssueCompact, formatAsJson, formatAsJsonCompact, formatAsJsonFull } from "./json.js";
|
|
3
|
+
import { TextFormatOptions, TextLine, formatAsText, formatAsTextLines } from "./text.js";
|
|
4
|
+
|
|
5
|
+
//#region src/formatters/index.d.ts
|
|
6
|
+
declare namespace index_d_exports {
|
|
7
|
+
export { JsonCompactOutput, JsonFormatOptions, JsonFullOutput, JsonIssueCompact, SarifFormatOptions, SarifOutput, TextFormatOptions, TextLine, formatAsJson, formatAsJsonCompact, formatAsJsonFull, formatAsSarif, formatAsText, formatAsTextLines, sarifToJson };
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { index_d_exports };
|