genaicode 0.6.1 → 0.8.0
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/README.md +0 -2
- package/dist/ai-service/ai-studio.js +7 -1
- package/dist/ai-service/ai-studio.js.map +1 -1
- package/dist/ai-service/anthropic.js +49 -19
- package/dist/ai-service/anthropic.js.map +1 -1
- package/dist/ai-service/chat-gpt.js +28 -11
- package/dist/ai-service/chat-gpt.js.map +1 -1
- package/dist/ai-service/common.d.ts +5 -4
- package/dist/ai-service/common.js +3 -4
- package/dist/ai-service/common.js.map +1 -1
- package/dist/ai-service/common.test.js +1 -1
- package/dist/ai-service/vertex-ai-claude.js +1 -1
- package/dist/ai-service/vertex-ai-claude.js.map +1 -1
- package/dist/ai-service/vertex-ai.js +7 -1
- package/dist/ai-service/vertex-ai.js.map +1 -1
- package/dist/cli/cli-options.js +0 -12
- package/dist/cli/cli-options.js.map +1 -1
- package/dist/cli/cli-params.d.ts +1 -4
- package/dist/cli/cli-params.js +1 -10
- package/dist/cli/cli-params.js.map +1 -1
- package/dist/cli/validate-cli-params.js +1 -7
- package/dist/cli/validate-cli-params.js.map +1 -1
- package/dist/cli/validate-cli-params.test.js +1 -1
- package/dist/cli/validate-cli-params.test.js.map +1 -1
- package/dist/eval/codegen-summary.test.d.ts +1 -0
- package/dist/eval/codegen-summary.test.js +93 -0
- package/dist/eval/codegen-summary.test.js.map +1 -0
- package/dist/eval/current-prompt-plugin.d.ts +3 -0
- package/dist/eval/current-prompt-plugin.js +10 -0
- package/dist/eval/current-prompt-plugin.js.map +1 -0
- package/dist/eval/data/current-prompt.d.ts +34 -0
- package/dist/eval/data/current-prompt.js +59 -0
- package/dist/eval/data/current-prompt.js.map +1 -0
- package/dist/eval/data/prompt-assistant-image.d.ts +49 -0
- package/dist/eval/data/prompt-assistant-image.js +67 -0
- package/dist/eval/data/prompt-assistant-image.js.map +1 -0
- package/dist/eval/data/prompt3.d.ts +34 -0
- package/dist/eval/data/prompt3.js +71 -0
- package/dist/eval/data/prompt3.js.map +1 -0
- package/dist/eval/prompt-debug.test.d.ts +1 -0
- package/dist/eval/prompt-debug.test.js +76 -0
- package/dist/eval/prompt-debug.test.js.map +1 -0
- package/dist/eval/prompt2.d.ts +34 -0
- package/dist/eval/prompt2.js +125 -0
- package/dist/eval/prompt2.js.map +1 -0
- package/dist/files/read-files.d.ts +29 -6
- package/dist/files/read-files.js +31 -10
- package/dist/files/read-files.js.map +1 -1
- package/dist/files/read-files.test.js +15 -9
- package/dist/files/read-files.test.js.map +1 -1
- package/dist/files/source-code-tree.d.ts +17 -0
- package/dist/files/source-code-tree.js +70 -0
- package/dist/files/source-code-tree.js.map +1 -0
- package/dist/main/codegen-types.d.ts +8 -5
- package/dist/main/codegen.ai-services.test.d.ts +3 -0
- package/dist/main/codegen.ai-services.test.js +198 -0
- package/dist/main/codegen.ai-services.test.js.map +1 -0
- package/dist/main/codegen.cli-options.test.d.ts +3 -0
- package/dist/main/codegen.cli-options.test.js +171 -0
- package/dist/main/codegen.cli-options.test.js.map +1 -0
- package/dist/main/codegen.image-generation.test.d.ts +3 -0
- package/dist/main/codegen.image-generation.test.js +187 -0
- package/dist/main/codegen.image-generation.test.js.map +1 -0
- package/dist/main/codegen.js +2 -5
- package/dist/main/codegen.js.map +1 -1
- package/dist/main/codegen.test-utils.d.ts +81 -0
- package/dist/main/codegen.test-utils.js +88 -0
- package/dist/main/codegen.test-utils.js.map +1 -0
- package/dist/main/codegen.test.js +47 -28
- package/dist/main/codegen.test.js.map +1 -1
- package/dist/main/common/content-bus-types.d.ts +6 -0
- package/dist/main/common/content-bus.d.ts +2 -2
- package/dist/main/common/content-bus.js +3 -1
- package/dist/main/common/content-bus.js.map +1 -1
- package/dist/main/common/user-actions.d.ts +8 -2
- package/dist/main/common/user-actions.js.map +1 -1
- package/dist/main/config-lib.js +20 -2
- package/dist/main/config-lib.js.map +1 -1
- package/dist/main/config.js +4 -28
- package/dist/main/config.js.map +1 -1
- package/dist/main/interactive/codegen-interactive.js +0 -4
- package/dist/main/interactive/codegen-interactive.js.map +1 -1
- package/dist/main/interactive/codegen-interactive.test.js +1 -7
- package/dist/main/interactive/codegen-interactive.test.js.map +1 -1
- package/dist/main/interactive/common.d.ts +1 -1
- package/dist/main/interactive/common.js +0 -2
- package/dist/main/interactive/common.js.map +1 -1
- package/dist/main/interactive/configure.js +0 -2
- package/dist/main/interactive/configure.js.map +1 -1
- package/dist/main/interactive/help.js +0 -2
- package/dist/main/interactive/help.js.map +1 -1
- package/dist/main/interactive/task-file.js +1 -1
- package/dist/main/interactive/task-file.js.map +1 -1
- package/dist/main/interactive/text-prompt.js +1 -1
- package/dist/main/interactive/text-prompt.js.map +1 -1
- package/dist/main/interactive/user-action-handlers.js +4 -2
- package/dist/main/interactive/user-action-handlers.js.map +1 -1
- package/dist/main/plugin-loader.d.ts +7 -1
- package/dist/main/plugin-loader.js +61 -0
- package/dist/main/plugin-loader.js.map +1 -1
- package/dist/main/ui/backend/api.js +9 -3
- package/dist/main/ui/backend/api.js.map +1 -1
- package/dist/main/ui/backend/service.d.ts +2 -1
- package/dist/main/ui/backend/service.js +6 -3
- package/dist/main/ui/backend/service.js.map +1 -1
- package/dist/main/ui/frontend/assets/index-QOcNx5ac.js +812 -0
- package/dist/main/ui/frontend/index.html +1 -1
- package/dist/main/ui/user-action-handlers.js +1 -1
- package/dist/main/ui/user-action-handlers.js.map +1 -1
- package/dist/project-profiles/detection.d.ts +40 -0
- package/dist/project-profiles/detection.js +131 -0
- package/dist/project-profiles/detection.js.map +1 -0
- package/dist/project-profiles/index.d.ts +35 -0
- package/dist/project-profiles/index.js +72 -0
- package/dist/project-profiles/index.js.map +1 -0
- package/dist/project-profiles/profiles/golang.d.ts +65 -0
- package/dist/project-profiles/profiles/golang.js +208 -0
- package/dist/project-profiles/profiles/golang.js.map +1 -0
- package/dist/project-profiles/profiles/java-maven.d.ts +80 -0
- package/dist/project-profiles/profiles/java-maven.js +165 -0
- package/dist/project-profiles/profiles/java-maven.js.map +1 -0
- package/dist/project-profiles/profiles/javascript-npm.d.ts +40 -0
- package/dist/project-profiles/profiles/javascript-npm.js +118 -0
- package/dist/project-profiles/profiles/javascript-npm.js.map +1 -0
- package/dist/project-profiles/profiles/javascript-react.d.ts +46 -0
- package/dist/project-profiles/profiles/javascript-react.js +147 -0
- package/dist/project-profiles/profiles/javascript-react.js.map +1 -0
- package/dist/project-profiles/profiles/python-django.d.ts +58 -0
- package/dist/project-profiles/profiles/python-django.js +200 -0
- package/dist/project-profiles/profiles/python-django.js.map +1 -0
- package/dist/project-profiles/types.d.ts +122 -0
- package/dist/project-profiles/types.js +77 -0
- package/dist/project-profiles/types.js.map +1 -0
- package/dist/prompt/function-calling.js +8 -3
- package/dist/prompt/function-calling.js.map +1 -1
- package/dist/prompt/function-defs/ask-question.d.ts +5 -0
- package/dist/prompt/function-defs/ask-question.js +140 -60
- package/dist/prompt/function-defs/ask-question.js.map +1 -1
- package/dist/prompt/function-defs/codegen-planning.d.ts +8 -0
- package/dist/prompt/function-defs/codegen-planning.js +50 -0
- package/dist/prompt/function-defs/codegen-planning.js.map +1 -0
- package/dist/prompt/function-defs/codegen-summary.js +2 -2
- package/dist/prompt/function-defs/codegen-summary.js.map +1 -1
- package/dist/prompt/function-defs/get-source-code.js +32 -2
- package/dist/prompt/function-defs/get-source-code.js.map +1 -1
- package/dist/prompt/function-defs/optimize-context.js +35 -12
- package/dist/prompt/function-defs/optimize-context.js.map +1 -1
- package/dist/prompt/function-defs/set-summaries.js +20 -1
- package/dist/prompt/function-defs/set-summaries.js.map +1 -1
- package/dist/prompt/limits.js +2 -2
- package/dist/prompt/limits.js.map +1 -1
- package/dist/prompt/limits.test.js +3 -3
- package/dist/prompt/limits.test.js.map +1 -1
- package/dist/prompt/prompt-codegen.js +7 -79
- package/dist/prompt/prompt-codegen.js.map +1 -1
- package/dist/prompt/prompt-codegen.test.js +8 -14
- package/dist/prompt/prompt-codegen.test.js.map +1 -1
- package/dist/prompt/prompt-service-ask-question.test.js +27 -80
- package/dist/prompt/prompt-service-ask-question.test.js.map +1 -1
- package/dist/prompt/prompt-service.ai-services.test.d.ts +1 -0
- package/dist/prompt/prompt-service.ai-services.test.js +149 -0
- package/dist/prompt/prompt-service.ai-services.test.js.map +1 -0
- package/dist/prompt/prompt-service.context-optimization.test.d.ts +1 -0
- package/dist/prompt/prompt-service.context-optimization.test.js +212 -0
- package/dist/prompt/prompt-service.context-optimization.test.js.map +1 -0
- package/dist/prompt/prompt-service.image-handling.test.d.ts +1 -0
- package/dist/prompt/prompt-service.image-handling.test.js +212 -0
- package/dist/prompt/prompt-service.image-handling.test.js.map +1 -0
- package/dist/prompt/prompt-service.js +41 -127
- package/dist/prompt/prompt-service.js.map +1 -1
- package/dist/prompt/prompt-service.test-utils.d.ts +66 -0
- package/dist/prompt/prompt-service.test-utils.js +169 -0
- package/dist/prompt/prompt-service.test-utils.js.map +1 -0
- package/dist/prompt/prompt-service.test.js +96 -20
- package/dist/prompt/prompt-service.test.js.map +1 -1
- package/dist/prompt/prompt-service.validation-recovery.test.d.ts +1 -0
- package/dist/prompt/prompt-service.validation-recovery.test.js +263 -0
- package/dist/prompt/prompt-service.validation-recovery.test.js.map +1 -0
- package/dist/prompt/static-prompts.d.ts +16 -0
- package/dist/prompt/static-prompts.js +22 -0
- package/dist/prompt/static-prompts.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js +1 -3
- package/dist/prompt/steps/step-ask-question/handlers/cancel-code-generation.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.js +58 -0
- package/dist/prompt/steps/step-ask-question/handlers/code-generation.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.d.ts +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js +8 -7
- package/dist/prompt/steps/step-ask-question/handlers/confirm-code-generation.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js +6 -6
- package/dist/prompt/steps/step-ask-question/handlers/context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/default-action.js +1 -4
- package/dist/prompt/steps/step-ask-question/handlers/default-action.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.js +86 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-request-answer-with-image.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.js +97 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message-with-image.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.d.ts +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js +20 -0
- package/dist/prompt/steps/step-ask-question/handlers/handle-send-message.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/handler-utils.d.ts +0 -0
- package/dist/prompt/steps/step-ask-question/handlers/handler-utils.js +2 -0
- package/dist/prompt/steps/step-ask-question/handlers/handler-utils.js.map +1 -0
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.d.ts +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js +57 -15
- package/dist/prompt/steps/step-ask-question/handlers/remove-files-from-context.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.d.ts +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js +109 -12
- package/dist/prompt/steps/step-ask-question/handlers/request-files-content.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.d.ts +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js +48 -26
- package/dist/prompt/steps/step-ask-question/handlers/request-permissions.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js +1 -1
- package/dist/prompt/steps/step-ask-question/handlers/start-code-generation.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js +1 -0
- package/dist/prompt/steps/step-ask-question/step-ask-question-reflect.js.map +1 -1
- package/dist/prompt/steps/step-ask-question/step-ask-question-types.d.ts +25 -21
- package/dist/prompt/steps/step-ask-question/step-ask-question.d.ts +2 -5
- package/dist/prompt/steps/step-ask-question/step-ask-question.js +36 -33
- package/dist/prompt/steps/step-ask-question/step-ask-question.js.map +1 -1
- package/dist/prompt/steps/step-codegen-planning.d.ts +10 -0
- package/dist/prompt/steps/step-codegen-planning.js +69 -0
- package/dist/prompt/steps/step-codegen-planning.js.map +1 -0
- package/dist/prompt/steps/step-codegen-summary.d.ts +7 -0
- package/dist/prompt/steps/step-codegen-summary.js +106 -0
- package/dist/prompt/steps/step-codegen-summary.js.map +1 -0
- package/dist/prompt/steps/step-codegen-summary.test.d.ts +1 -0
- package/dist/prompt/steps/step-codegen-summary.test.js +136 -0
- package/dist/prompt/steps/step-codegen-summary.test.js.map +1 -0
- package/dist/prompt/steps/step-context-optimization.js +243 -126
- package/dist/prompt/steps/step-context-optimization.js.map +1 -1
- package/dist/prompt/steps/step-context-optimization.test.d.ts +2 -0
- package/dist/prompt/steps/step-context-optimization.test.js +475 -0
- package/dist/prompt/steps/step-context-optimization.test.js.map +1 -0
- package/dist/prompt/steps/step-ensure-context.d.ts +15 -0
- package/dist/prompt/steps/step-ensure-context.js +102 -0
- package/dist/prompt/steps/step-ensure-context.js.map +1 -0
- package/dist/prompt/steps/step-ensure-context.test.d.ts +1 -0
- package/dist/prompt/steps/step-ensure-context.test.js +242 -0
- package/dist/prompt/steps/step-ensure-context.test.js.map +1 -0
- package/dist/prompt/steps/step-generate-image.d.ts +8 -1
- package/dist/prompt/steps/step-generate-image.js +1 -0
- package/dist/prompt/steps/step-generate-image.js.map +1 -1
- package/dist/prompt/steps/step-summarization.d.ts +2 -2
- package/dist/prompt/steps/step-summarization.js +45 -9
- package/dist/prompt/steps/step-summarization.js.map +1 -1
- package/dist/prompt/steps/step-validate-recover.js +24 -15
- package/dist/prompt/steps/step-validate-recover.js.map +1 -1
- package/dist/prompt/steps/steps-types.d.ts +2 -0
- package/dist/prompt/steps/steps-types.js.map +1 -1
- package/dist/prompt/systemprompt.d.ts +2 -2
- package/dist/prompt/systemprompt.js +74 -176
- package/dist/prompt/systemprompt.js.map +1 -1
- package/dist/prompt/systemprompt.test.js +4 -5
- package/dist/prompt/systemprompt.test.js.map +1 -1
- package/dist/vite-genaicode/vite-genaicode-plugin.js +0 -2
- package/dist/vite-genaicode/vite-genaicode-plugin.js.map +1 -1
- package/package.json +6 -2
- package/dist/main/ui/frontend/assets/index-Dk_qaEQg.js +0 -782
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Django Project Profile
|
|
3
|
+
*
|
|
4
|
+
* This profile handles Django web applications, supporting both
|
|
5
|
+
* traditional Django projects and Django REST framework applications.
|
|
6
|
+
* It includes detection for common Django patterns and tools.
|
|
7
|
+
*/
|
|
8
|
+
import { ProjectProfile } from '../types.js';
|
|
9
|
+
/**
|
|
10
|
+
* Different types of Django projects we can detect
|
|
11
|
+
*/
|
|
12
|
+
declare const DJANGO_PROJECT_TYPES: {
|
|
13
|
+
readonly STANDARD: "standard";
|
|
14
|
+
readonly DRF: "rest-framework";
|
|
15
|
+
readonly CHANNELS: "channels";
|
|
16
|
+
readonly WAGTAIL: "wagtail";
|
|
17
|
+
};
|
|
18
|
+
type DjangoProjectType = (typeof DJANGO_PROJECT_TYPES)[keyof typeof DJANGO_PROJECT_TYPES];
|
|
19
|
+
/**
|
|
20
|
+
* Parse requirements.txt or pyproject.toml to extract dependencies
|
|
21
|
+
*/
|
|
22
|
+
declare function parsePythonDependencies(rootDir: string): Promise<string[]>;
|
|
23
|
+
/**
|
|
24
|
+
* Check if manage.py is a Django management script
|
|
25
|
+
*/
|
|
26
|
+
declare function isDjangoManagePy(filePath: string): Promise<boolean>;
|
|
27
|
+
/**
|
|
28
|
+
* Detect specific Django project type
|
|
29
|
+
*/
|
|
30
|
+
declare function detectDjangoProjectType(rootDir: string): Promise<{
|
|
31
|
+
type: DjangoProjectType;
|
|
32
|
+
weight: number;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Detect virtual environment location
|
|
36
|
+
*/
|
|
37
|
+
declare function detectVirtualEnv(rootDir: string): Promise<string | null>;
|
|
38
|
+
/**
|
|
39
|
+
* Get appropriate lint command based on project configuration
|
|
40
|
+
*/
|
|
41
|
+
declare function detectLintCommand(rootDir: string): Promise<string | undefined>;
|
|
42
|
+
/**
|
|
43
|
+
* Get Django-specific ignore paths
|
|
44
|
+
*/
|
|
45
|
+
declare function getDjangoIgnorePaths(rootDir: string, projectType: DjangoProjectType): Promise<string[]>;
|
|
46
|
+
/**
|
|
47
|
+
* Django project profile
|
|
48
|
+
*/
|
|
49
|
+
export declare const djangoProfile: ProjectProfile;
|
|
50
|
+
export declare const djangoUtils: {
|
|
51
|
+
parsePythonDependencies: typeof parsePythonDependencies;
|
|
52
|
+
isDjangoManagePy: typeof isDjangoManagePy;
|
|
53
|
+
detectDjangoProjectType: typeof detectDjangoProjectType;
|
|
54
|
+
detectVirtualEnv: typeof detectVirtualEnv;
|
|
55
|
+
detectLintCommand: typeof detectLintCommand;
|
|
56
|
+
getDjangoIgnorePaths: typeof getDjangoIgnorePaths;
|
|
57
|
+
};
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Django Project Profile
|
|
3
|
+
*
|
|
4
|
+
* This profile handles Django web applications, supporting both
|
|
5
|
+
* traditional Django projects and Django REST framework applications.
|
|
6
|
+
* It includes detection for common Django patterns and tools.
|
|
7
|
+
*/
|
|
8
|
+
import path from 'path';
|
|
9
|
+
import fs from 'fs';
|
|
10
|
+
import { PROJECT_FILE_PATTERNS, DETECTION_WEIGHTS, DEFAULT_EXTENSIONS, DEFAULT_IGNORE_PATHS, } from '../types.js';
|
|
11
|
+
import { profileUtils } from '../detection.js';
|
|
12
|
+
/**
|
|
13
|
+
* Different types of Django projects we can detect
|
|
14
|
+
*/
|
|
15
|
+
const DJANGO_PROJECT_TYPES = {
|
|
16
|
+
STANDARD: 'standard',
|
|
17
|
+
DRF: 'rest-framework',
|
|
18
|
+
CHANNELS: 'channels',
|
|
19
|
+
WAGTAIL: 'wagtail',
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Parse requirements.txt or pyproject.toml to extract dependencies
|
|
23
|
+
*/
|
|
24
|
+
async function parsePythonDependencies(rootDir) {
|
|
25
|
+
const dependencies = [];
|
|
26
|
+
// Try reading requirements.txt
|
|
27
|
+
try {
|
|
28
|
+
const requirementsPath = path.join(rootDir, PROJECT_FILE_PATTERNS.PYTHON.REQUIREMENTS);
|
|
29
|
+
const content = await fs.promises.readFile(requirementsPath, 'utf-8');
|
|
30
|
+
dependencies.push(...content
|
|
31
|
+
.split('\n')
|
|
32
|
+
.map((line) => line.trim())
|
|
33
|
+
.filter((line) => line && !line.startsWith('#'))
|
|
34
|
+
.map((line) => line.split('==')[0].split('>=')[0].trim()));
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
// Requirements.txt not found, try pyproject.toml
|
|
38
|
+
try {
|
|
39
|
+
const pyprojectPath = path.join(rootDir, PROJECT_FILE_PATTERNS.PYTHON.POETRY);
|
|
40
|
+
const content = await fs.promises.readFile(pyprojectPath, 'utf-8');
|
|
41
|
+
// Basic TOML parsing for dependencies
|
|
42
|
+
const dependencySection = content.split('[tool.poetry.dependencies]')[1]?.split('[')[0];
|
|
43
|
+
if (dependencySection) {
|
|
44
|
+
dependencies.push(...dependencySection
|
|
45
|
+
.split('\n')
|
|
46
|
+
.map((line) => line.trim())
|
|
47
|
+
.filter((line) => line && !line.startsWith('#'))
|
|
48
|
+
.map((line) => line.split('=')[0].trim()));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
catch {
|
|
52
|
+
// Neither file found
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
return dependencies;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Check if manage.py is a Django management script
|
|
59
|
+
*/
|
|
60
|
+
async function isDjangoManagePy(filePath) {
|
|
61
|
+
try {
|
|
62
|
+
const content = await fs.promises.readFile(filePath, 'utf-8');
|
|
63
|
+
return content.includes('django.core.management');
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return false;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Detect specific Django project type
|
|
71
|
+
*/
|
|
72
|
+
async function detectDjangoProjectType(rootDir) {
|
|
73
|
+
const dependencies = await parsePythonDependencies(rootDir);
|
|
74
|
+
// Check for DRF (Django REST framework)
|
|
75
|
+
if (dependencies.some((dep) => dep === 'djangorestframework')) {
|
|
76
|
+
return { type: DJANGO_PROJECT_TYPES.DRF, weight: DETECTION_WEIGHTS.FRAMEWORK.DJANGO + 1 };
|
|
77
|
+
}
|
|
78
|
+
// Check for Django Channels
|
|
79
|
+
if (dependencies.some((dep) => dep === 'channels')) {
|
|
80
|
+
return { type: DJANGO_PROJECT_TYPES.CHANNELS, weight: DETECTION_WEIGHTS.FRAMEWORK.DJANGO + 1 };
|
|
81
|
+
}
|
|
82
|
+
// Check for Wagtail CMS
|
|
83
|
+
if (dependencies.some((dep) => dep === 'wagtail')) {
|
|
84
|
+
return { type: DJANGO_PROJECT_TYPES.WAGTAIL, weight: DETECTION_WEIGHTS.FRAMEWORK.DJANGO + 1 };
|
|
85
|
+
}
|
|
86
|
+
return { type: DJANGO_PROJECT_TYPES.STANDARD, weight: DETECTION_WEIGHTS.FRAMEWORK.DJANGO };
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Detect virtual environment location
|
|
90
|
+
*/
|
|
91
|
+
async function detectVirtualEnv(rootDir) {
|
|
92
|
+
const commonVenvPaths = ['venv', '.venv', 'env', '.env'];
|
|
93
|
+
for (const venvPath of commonVenvPaths) {
|
|
94
|
+
const fullPath = path.join(rootDir, venvPath);
|
|
95
|
+
const activatePath = path.join(fullPath, 'bin', 'activate');
|
|
96
|
+
if ((await profileUtils.fileExists(rootDir, fullPath)) && (await profileUtils.fileExists(rootDir, activatePath))) {
|
|
97
|
+
return venvPath;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get appropriate lint command based on project configuration
|
|
104
|
+
*/
|
|
105
|
+
async function detectLintCommand(rootDir) {
|
|
106
|
+
const dependencies = await parsePythonDependencies(rootDir);
|
|
107
|
+
const venvPath = await detectVirtualEnv(rootDir);
|
|
108
|
+
const venvPrefix = venvPath ? `source ${venvPath}/bin/activate && ` : '';
|
|
109
|
+
// Check for various linting tools in order of preference
|
|
110
|
+
if (dependencies.includes('ruff')) {
|
|
111
|
+
return `${venvPrefix}ruff check .`;
|
|
112
|
+
}
|
|
113
|
+
if (dependencies.includes('pylint-django')) {
|
|
114
|
+
return `${venvPrefix}pylint --load-plugins pylint_django **/*.py`;
|
|
115
|
+
}
|
|
116
|
+
if (dependencies.includes('pylint')) {
|
|
117
|
+
return `${venvPrefix}pylint **/*.py`;
|
|
118
|
+
}
|
|
119
|
+
if (dependencies.includes('flake8')) {
|
|
120
|
+
return `${venvPrefix}flake8 .`;
|
|
121
|
+
}
|
|
122
|
+
// Default to Django's built-in checks
|
|
123
|
+
return `${venvPrefix}python manage.py check --deploy`;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get Django-specific ignore paths
|
|
127
|
+
*/
|
|
128
|
+
async function getDjangoIgnorePaths(rootDir, projectType) {
|
|
129
|
+
const baseIgnorePaths = [...DEFAULT_IGNORE_PATHS.PYTHON];
|
|
130
|
+
// Add Django-specific paths
|
|
131
|
+
baseIgnorePaths.push('static', 'media', 'staticfiles', '*.sqlite3', 'local_settings.py');
|
|
132
|
+
// Add virtual environment if detected
|
|
133
|
+
const venvPath = await detectVirtualEnv(rootDir);
|
|
134
|
+
if (venvPath) {
|
|
135
|
+
baseIgnorePaths.push(venvPath);
|
|
136
|
+
}
|
|
137
|
+
// Add project type specific paths
|
|
138
|
+
switch (projectType) {
|
|
139
|
+
case DJANGO_PROJECT_TYPES.WAGTAIL:
|
|
140
|
+
baseIgnorePaths.push('media/images', 'media/documents');
|
|
141
|
+
break;
|
|
142
|
+
case DJANGO_PROJECT_TYPES.CHANNELS:
|
|
143
|
+
baseIgnorePaths.push('dumps');
|
|
144
|
+
break;
|
|
145
|
+
}
|
|
146
|
+
return baseIgnorePaths;
|
|
147
|
+
}
|
|
148
|
+
/**
|
|
149
|
+
* Django project profile
|
|
150
|
+
*/
|
|
151
|
+
export const djangoProfile = {
|
|
152
|
+
id: 'python-django',
|
|
153
|
+
name: 'Django',
|
|
154
|
+
extensions: [...DEFAULT_EXTENSIONS.PYTHON],
|
|
155
|
+
ignorePaths: [...DEFAULT_IGNORE_PATHS.PYTHON],
|
|
156
|
+
detectionWeight: DETECTION_WEIGHTS.FRAMEWORK.DJANGO,
|
|
157
|
+
/**
|
|
158
|
+
* Detect if this is a Django project
|
|
159
|
+
*/
|
|
160
|
+
async detect(rootDir) {
|
|
161
|
+
// Check for manage.py
|
|
162
|
+
const managePyPath = path.join(rootDir, PROJECT_FILE_PATTERNS.PYTHON.DJANGO);
|
|
163
|
+
const hasManagePy = await profileUtils.fileExists(rootDir, managePyPath);
|
|
164
|
+
if (!hasManagePy)
|
|
165
|
+
return false;
|
|
166
|
+
// Verify it's a Django manage.py
|
|
167
|
+
const isDjango = await isDjangoManagePy(managePyPath);
|
|
168
|
+
if (!isDjango)
|
|
169
|
+
return false;
|
|
170
|
+
// Check for Django in dependencies
|
|
171
|
+
const dependencies = await parsePythonDependencies(rootDir);
|
|
172
|
+
return dependencies.includes('django');
|
|
173
|
+
},
|
|
174
|
+
/**
|
|
175
|
+
* Initialize Django-specific configuration
|
|
176
|
+
*/
|
|
177
|
+
async initialize(rootDir) {
|
|
178
|
+
// Detect Django project type
|
|
179
|
+
const { type: projectType } = await detectDjangoProjectType(rootDir);
|
|
180
|
+
// Set Django-specific ignore paths
|
|
181
|
+
this.ignorePaths = await getDjangoIgnorePaths(rootDir, projectType);
|
|
182
|
+
// Set appropriate lint command
|
|
183
|
+
this.lintCommand = await detectLintCommand(rootDir);
|
|
184
|
+
// Add Python extensions
|
|
185
|
+
this.extensions = [...DEFAULT_EXTENSIONS.PYTHON];
|
|
186
|
+
// Add template extensions
|
|
187
|
+
this.extensions.push('.html', '.jinja', '.jinja2');
|
|
188
|
+
console.log(`Initialized Django profile (${projectType})`);
|
|
189
|
+
},
|
|
190
|
+
};
|
|
191
|
+
// Export utilities for other profiles that might extend Django
|
|
192
|
+
export const djangoUtils = {
|
|
193
|
+
parsePythonDependencies,
|
|
194
|
+
isDjangoManagePy,
|
|
195
|
+
detectDjangoProjectType,
|
|
196
|
+
detectVirtualEnv,
|
|
197
|
+
detectLintCommand,
|
|
198
|
+
getDjangoIgnorePaths,
|
|
199
|
+
};
|
|
200
|
+
//# sourceMappingURL=python-django.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"python-django.js","sourceRoot":"","sources":["../../../src/project-profiles/profiles/python-django.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,EAEL,qBAAqB,EACrB,iBAAiB,EACjB,kBAAkB,EAClB,oBAAoB,GACrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;GAEG;AACH,MAAM,oBAAoB,GAAG;IAC3B,QAAQ,EAAE,UAAU;IACpB,GAAG,EAAE,gBAAgB;IACrB,QAAQ,EAAE,UAAU;IACpB,OAAO,EAAE,SAA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O,CAAC,CAAC;QAErE,mCAAmC;QACnC,IAAI,CAAC,WAAW,GAAG,MAAM,oBAAoB,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAEpE,+BAA+B;QAC/B,IAAI,CAAC,WAAW,GAAG,MAAM,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAEpD,wBAAwB;QACxB,IAAI,CAAC,UAAU,GAAG,CAAC,GAAG,kBAAkB,CAAC,MAAM,CAAC,CAAC;QAEjD,0BAA0B;QAC1B,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC,OAAO,EAAE,QAAQ,EAAE,SAAS,CAAC,CAAC;QAEnD,OAAO,CAAC,GAAG,CAAC,+BAA+B,WAAW,GAAG,CAAC,CAAC;IAC7D,CAAC;CACF,CAAC;AAEF,+DAA+D;AAC/D,MAAM,CAAC,MAAM,WAAW,GAAG;IACzB,uBAAuB;IACvB,gBAAgB;IAChB,uBAAuB;IACvB,gBAAgB;IAChB,iBAAiB;IACjB,oBAAoB;CACrB,CAAC"}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types for the project profiles system.
|
|
3
|
+
* This module contains all the type definitions needed for project type detection,
|
|
4
|
+
* configuration, and plugin integration.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Represents a project profile with its configuration and detection logic.
|
|
8
|
+
*/
|
|
9
|
+
export interface ProjectProfile {
|
|
10
|
+
/** Unique identifier for the profile */
|
|
11
|
+
id: string;
|
|
12
|
+
/** Display name for the profile */
|
|
13
|
+
name: string;
|
|
14
|
+
/** File extensions this profile should consider */
|
|
15
|
+
extensions: string[];
|
|
16
|
+
/** Paths that should be ignored */
|
|
17
|
+
ignorePaths: string[];
|
|
18
|
+
/** Default lint command for this project type */
|
|
19
|
+
lintCommand?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Weight for detection priority. Higher weights indicate more specific profiles.
|
|
22
|
+
* Default profiles use weights 1-10.
|
|
23
|
+
* Plugin profiles should use weights > 10 to override defaults.
|
|
24
|
+
*/
|
|
25
|
+
detectionWeight: number;
|
|
26
|
+
/**
|
|
27
|
+
* Async function to detect if this profile matches the project.
|
|
28
|
+
* Should return true if the profile matches, false otherwise.
|
|
29
|
+
*/
|
|
30
|
+
detect: (rootDir: string) => Promise<boolean>;
|
|
31
|
+
/** Optional initialization function called when profile is selected */
|
|
32
|
+
initialize?: (rootDir: string) => Promise<void>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Result of project profile detection
|
|
36
|
+
*/
|
|
37
|
+
export interface ProfileDetectionResult {
|
|
38
|
+
/** The detected profile, if any */
|
|
39
|
+
profile: ProjectProfile | null;
|
|
40
|
+
/** Weight of the detection match */
|
|
41
|
+
weight: number;
|
|
42
|
+
/** Any additional metadata from detection */
|
|
43
|
+
metadata?: Record<string, unknown>;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Plugin interface for project profiles
|
|
47
|
+
*/
|
|
48
|
+
export interface ProjectProfilePlugin {
|
|
49
|
+
/** Array of profiles provided by this plugin */
|
|
50
|
+
profiles: ProjectProfile[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Common project file patterns used for detection
|
|
54
|
+
*/
|
|
55
|
+
export declare const PROJECT_FILE_PATTERNS: {
|
|
56
|
+
/** JavaScript/TypeScript patterns */
|
|
57
|
+
readonly JS: {
|
|
58
|
+
readonly NPM: "package.json";
|
|
59
|
+
readonly YARN: "yarn.lock";
|
|
60
|
+
readonly PNPM: "pnpm-lock.yaml";
|
|
61
|
+
readonly REACT: readonly ["src/App.tsx", "src/App.jsx", "src/app.tsx", "src/app.jsx"];
|
|
62
|
+
readonly NEXT: "next.config.js";
|
|
63
|
+
readonly VITE: "vite.config.ts";
|
|
64
|
+
};
|
|
65
|
+
/** Java patterns */
|
|
66
|
+
readonly JAVA: {
|
|
67
|
+
readonly MAVEN: "pom.xml";
|
|
68
|
+
readonly GRADLE: "build.gradle";
|
|
69
|
+
readonly SPRING: "application.properties";
|
|
70
|
+
};
|
|
71
|
+
/** Python patterns */
|
|
72
|
+
readonly PYTHON: {
|
|
73
|
+
readonly DJANGO: "manage.py";
|
|
74
|
+
readonly FLASK: readonly ["app.py", "wsgi.py"];
|
|
75
|
+
readonly REQUIREMENTS: "requirements.txt";
|
|
76
|
+
readonly POETRY: "pyproject.toml";
|
|
77
|
+
};
|
|
78
|
+
/** Go patterns */
|
|
79
|
+
readonly GO: {
|
|
80
|
+
readonly MOD: "go.mod";
|
|
81
|
+
readonly WORK: "go.work";
|
|
82
|
+
};
|
|
83
|
+
};
|
|
84
|
+
/**
|
|
85
|
+
* Detection weights for different profile types
|
|
86
|
+
*/
|
|
87
|
+
export declare const DETECTION_WEIGHTS: {
|
|
88
|
+
/** Base framework weights */
|
|
89
|
+
readonly BASE: {
|
|
90
|
+
readonly JS_NPM: 1;
|
|
91
|
+
readonly JAVA_BASE: 1;
|
|
92
|
+
readonly PYTHON_BASE: 1;
|
|
93
|
+
readonly GO_BASE: 1;
|
|
94
|
+
};
|
|
95
|
+
/** Framework-specific weights */
|
|
96
|
+
readonly FRAMEWORK: {
|
|
97
|
+
readonly REACT: 2;
|
|
98
|
+
readonly NEXT: 3;
|
|
99
|
+
readonly SPRING: 2;
|
|
100
|
+
readonly DJANGO: 2;
|
|
101
|
+
};
|
|
102
|
+
/** Plugin weights should be > 10 */
|
|
103
|
+
readonly PLUGIN_MIN_WEIGHT: 10;
|
|
104
|
+
};
|
|
105
|
+
/**
|
|
106
|
+
* Default extensions for common project types
|
|
107
|
+
*/
|
|
108
|
+
export declare const DEFAULT_EXTENSIONS: {
|
|
109
|
+
readonly JS: readonly [".js", ".ts", ".jsx", ".tsx", ".mjs", ".cjs", ".json", ".md"];
|
|
110
|
+
readonly JAVA: readonly [".java", ".xml", ".properties", ".md"];
|
|
111
|
+
readonly PYTHON: readonly [".py", ".pyi", ".pyw", ".md"];
|
|
112
|
+
readonly GO: readonly [".go", ".mod", ".sum", ".md"];
|
|
113
|
+
};
|
|
114
|
+
/**
|
|
115
|
+
* Default ignore paths for common project types
|
|
116
|
+
*/
|
|
117
|
+
export declare const DEFAULT_IGNORE_PATHS: {
|
|
118
|
+
readonly JS: readonly ["node_modules", "build", "dist", "coverage", ".next", ".cache"];
|
|
119
|
+
readonly JAVA: readonly ["target", "build", "out", ".gradle", ".mvn", ".settings"];
|
|
120
|
+
readonly PYTHON: readonly ["__pycache__", "*.pyc", ".pytest_cache", "venv", ".venv", "dist"];
|
|
121
|
+
readonly GO: readonly ["vendor", "bin", "dist"];
|
|
122
|
+
};
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core types for the project profiles system.
|
|
3
|
+
* This module contains all the type definitions needed for project type detection,
|
|
4
|
+
* configuration, and plugin integration.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Common project file patterns used for detection
|
|
8
|
+
*/
|
|
9
|
+
export const PROJECT_FILE_PATTERNS = {
|
|
10
|
+
/** JavaScript/TypeScript patterns */
|
|
11
|
+
JS: {
|
|
12
|
+
NPM: 'package.json',
|
|
13
|
+
YARN: 'yarn.lock',
|
|
14
|
+
PNPM: 'pnpm-lock.yaml',
|
|
15
|
+
REACT: ['src/App.tsx', 'src/App.jsx', 'src/app.tsx', 'src/app.jsx'],
|
|
16
|
+
NEXT: 'next.config.js',
|
|
17
|
+
VITE: 'vite.config.ts',
|
|
18
|
+
},
|
|
19
|
+
/** Java patterns */
|
|
20
|
+
JAVA: {
|
|
21
|
+
MAVEN: 'pom.xml',
|
|
22
|
+
GRADLE: 'build.gradle',
|
|
23
|
+
SPRING: 'application.properties',
|
|
24
|
+
},
|
|
25
|
+
/** Python patterns */
|
|
26
|
+
PYTHON: {
|
|
27
|
+
DJANGO: 'manage.py',
|
|
28
|
+
FLASK: ['app.py', 'wsgi.py'],
|
|
29
|
+
REQUIREMENTS: 'requirements.txt',
|
|
30
|
+
POETRY: 'pyproject.toml',
|
|
31
|
+
},
|
|
32
|
+
/** Go patterns */
|
|
33
|
+
GO: {
|
|
34
|
+
MOD: 'go.mod',
|
|
35
|
+
WORK: 'go.work',
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Detection weights for different profile types
|
|
40
|
+
*/
|
|
41
|
+
export const DETECTION_WEIGHTS = {
|
|
42
|
+
/** Base framework weights */
|
|
43
|
+
BASE: {
|
|
44
|
+
JS_NPM: 1,
|
|
45
|
+
JAVA_BASE: 1,
|
|
46
|
+
PYTHON_BASE: 1,
|
|
47
|
+
GO_BASE: 1,
|
|
48
|
+
},
|
|
49
|
+
/** Framework-specific weights */
|
|
50
|
+
FRAMEWORK: {
|
|
51
|
+
REACT: 2,
|
|
52
|
+
NEXT: 3,
|
|
53
|
+
SPRING: 2,
|
|
54
|
+
DJANGO: 2,
|
|
55
|
+
},
|
|
56
|
+
/** Plugin weights should be > 10 */
|
|
57
|
+
PLUGIN_MIN_WEIGHT: 10,
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Default extensions for common project types
|
|
61
|
+
*/
|
|
62
|
+
export const DEFAULT_EXTENSIONS = {
|
|
63
|
+
JS: ['.js', '.ts', '.jsx', '.tsx', '.mjs', '.cjs', '.json', '.md'],
|
|
64
|
+
JAVA: ['.java', '.xml', '.properties', '.md'],
|
|
65
|
+
PYTHON: ['.py', '.pyi', '.pyw', '.md'],
|
|
66
|
+
GO: ['.go', '.mod', '.sum', '.md'],
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Default ignore paths for common project types
|
|
70
|
+
*/
|
|
71
|
+
export const DEFAULT_IGNORE_PATHS = {
|
|
72
|
+
JS: ['node_modules', 'build', 'dist', 'coverage', '.next', '.cache'],
|
|
73
|
+
JAVA: ['target', 'build', 'out', '.gradle', '.mvn', '.settings'],
|
|
74
|
+
PYTHON: ['__pycache__', '*.pyc', '.pytest_cache', 'venv', '.venv', 'dist'],
|
|
75
|
+
GO: ['vendor', 'bin', 'dist'],
|
|
76
|
+
};
|
|
77
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/project-profiles/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AA4DH;;GAEG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG;IACnC,qCAAqC;IACrC,EAAE,EAAE;QACF,GAAG,EAAE,cAAc;QACnB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,CAAC,aAAa,EAAE,aAAa,EAAE,aAAa,EAAE,aAAa,CAAC;QACnE,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,gBAAgB;KACvB;IACD,oBAAoB;IACpB,IAAI,EAAE;QACJ,KAAK,EAAE,SAAS;QAChB,MAAM,EAAE,cAAc;QACtB,MAAM,EAAE,wBAAwB;KACjC;IACD,sBAAsB;IACtB,MAAM,EAAE;QACN,MAAM,EAAE,WAAW;QACnB,KAAK,EAAE,CAAC,QAAQ,EAAE,SAAS,CAAC;QAC5B,YAAY,EAAE,kBAAkB;QAChC,MAAM,EAAE,gBAAgB;KACzB;IACD,kBAAkB;IAClB,EAAE,EAAE;QACF,GAAG,EAAE,QAAQ;QACb,IAAI,EAAE,SAAS;KAChB;CACO,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,6BAA6B;IAC7B,IAAI,EAAE;QACJ,MAAM,EAAE,CAAC;QACT,SAAS,EAAE,CAAC;QACZ,WAAW,EAAE,CAAC;QACd,OAAO,EAAE,CAAC;KACX;IACD,iCAAiC;IACjC,SAAS,EAAE;QACT,KAAK,EAAE,CAAC;QACR,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,MAAM,EAAE,CAAC;KACV;IACD,oCAAoC;IACpC,iBAAiB,EAAE,EAAE;CACb,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,CAAC;IAClE,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,aAAa,EAAE,KAAK,CAAC;IAC7C,MAAM,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;IACtC,EAAE,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,CAAC;CAC1B,CAAC;AAEX;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,EAAE,EAAE,CAAC,cAAc,EAAE,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,OAAO,EAAE,QAAQ,CAAC;IACpE,IAAI,EAAE,CAAC,QAAQ,EAAE,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,EAAE,WAAW,CAAC;IAChE,MAAM,EAAE,CAAC,aAAa,EAAE,OAAO,EAAE,eAAe,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC;IAC1E,EAAE,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,MAAM,CAAC;CACrB,CAAC"}
|
|
@@ -4,13 +4,13 @@ import { getImageAssets } from './function-defs/get-image-assets.js';
|
|
|
4
4
|
import { getCodegenSummaryDef } from './function-defs/codegen-summary.js';
|
|
5
5
|
import { explanation } from './function-defs/explanation.js';
|
|
6
6
|
import { generateImage } from './function-defs/generate-image.js';
|
|
7
|
-
import { getAskQuestionDef } from './function-defs/ask-question.js';
|
|
7
|
+
import { getAskQuestionDef, sendMessageWithImage, requestPermissions, requestFilesContent, removeFilesFromContext, contextOptimization, } from './function-defs/ask-question.js';
|
|
8
8
|
import { optimizeContext } from './function-defs/optimize-context.js';
|
|
9
9
|
import { setSummaries } from './function-defs/set-summaries.js';
|
|
10
10
|
import { updateHistory } from './function-defs/update-history.js';
|
|
11
11
|
import { readHistory } from './function-defs/read-history.js';
|
|
12
|
-
import { askQuestionReflect } from './function-defs/ask-question-reflect.js';
|
|
13
12
|
import { getOperationDefs } from '../operations/operations-index.js';
|
|
13
|
+
import { getCodegenPlanningDef } from './function-defs/codegen-planning.js';
|
|
14
14
|
/**
|
|
15
15
|
* Function definitions for function calling feature
|
|
16
16
|
*/
|
|
@@ -19,14 +19,19 @@ export function getFunctionDefs() {
|
|
|
19
19
|
getSourceCode,
|
|
20
20
|
getImageAssets,
|
|
21
21
|
getCodegenSummaryDef(),
|
|
22
|
+
getCodegenPlanningDef(),
|
|
22
23
|
explanation,
|
|
23
24
|
generateImage,
|
|
24
25
|
getAskQuestionDef(),
|
|
26
|
+
sendMessageWithImage,
|
|
27
|
+
requestPermissions,
|
|
28
|
+
requestFilesContent,
|
|
29
|
+
removeFilesFromContext,
|
|
30
|
+
contextOptimization,
|
|
25
31
|
optimizeContext,
|
|
26
32
|
setSummaries,
|
|
27
33
|
updateHistory,
|
|
28
34
|
readHistory,
|
|
29
|
-
askQuestionReflect,
|
|
30
35
|
...getOperationDefs(),
|
|
31
36
|
].map((fd) => {
|
|
32
37
|
if (!disableExplanations &&
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"function-calling.js","sourceRoot":"","sources":["../../src/prompt/function-calling.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAE3D,OAAO,EAAE,aAAa,EAAE,MAAM,oCAAoC,CAAC;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,qCAAqC,CAAC;AACrE,OAAO,EAAE,oBAAoB,EAAE,MAAM,oCAAoC,CAAC;AAC1E,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,mCAAmC,CAAC;AAClE,OAAO,
|
|
1
|
+
{"version":3,"file":"function-calling.js","sourceRoot":"","sources":["../../src/prompt/function-calling.ts"],"names":[],"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aAAa,CAAC,EAC/C,CAAC;YACD,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,OAAO,CAAC,aAAa,CAAC,CAAC;QAChD,CAAC;aAAM,IAAI,mBAAmB,EAAE,CAAC;YAC/B,OAAO,EAAE,CAAC,UAAU,CAAC,UAAU,CAAC,WAAW,CAAC;QAC9C,CAAC;QAED,OAAO,EAAE,CAAC;IACZ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -6,3 +6,8 @@ import { FunctionDef } from '../../ai-service/common';
|
|
|
6
6
|
* Each actionType serves a specific purpose, ensuring clarity and proper task execution.
|
|
7
7
|
*/
|
|
8
8
|
export declare const getAskQuestionDef: () => FunctionDef;
|
|
9
|
+
export declare const requestFilesContent: FunctionDef;
|
|
10
|
+
export declare const sendMessageWithImage: FunctionDef;
|
|
11
|
+
export declare const removeFilesFromContext: FunctionDef;
|
|
12
|
+
export declare const contextOptimization: FunctionDef;
|
|
13
|
+
export declare const requestPermissions: FunctionDef;
|