@equinor/fusion-framework-cli-plugin-ai-base 1.0.5 → 2.0.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/CHANGELOG.md +37 -1
- package/README.md +141 -51
- package/dist/esm/config.js.map +1 -1
- package/dist/esm/options/index.js +11 -0
- package/dist/esm/options/index.js.map +1 -1
- package/dist/esm/options/options.js +49 -19
- package/dist/esm/options/options.js.map +1 -1
- package/dist/esm/options/schema.js +5 -0
- package/dist/esm/options/schema.js.map +1 -1
- package/dist/esm/options/types.js +9 -0
- package/dist/esm/options/types.js.map +1 -1
- package/dist/esm/options/with-options.js +4 -4
- package/dist/esm/options/with-options.js.map +1 -1
- package/dist/esm/register.js +11 -12
- package/dist/esm/register.js.map +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/types/config.d.ts +12 -3
- package/dist/types/options/index.d.ts +11 -0
- package/dist/types/options/options.d.ts +49 -19
- package/dist/types/options/schema.d.ts +5 -0
- package/dist/types/options/types.d.ts +9 -0
- package/dist/types/register.d.ts +11 -12
- package/dist/types/version.d.ts +1 -1
- package/package.json +9 -8
- package/src/config.ts +12 -3
- package/src/options/index.ts +12 -0
- package/src/options/options.ts +49 -19
- package/src/options/schema.ts +6 -0
- package/src/options/types.ts +10 -0
- package/src/options/with-options.ts +6 -4
- package/src/register.ts +12 -12
- package/src/version.ts +1 -1
- package/tsconfig.json +3 -0
package/dist/types/config.d.ts
CHANGED
|
@@ -30,12 +30,21 @@ export interface FusionAIConfig {
|
|
|
30
30
|
*/
|
|
31
31
|
export declare const configureFusionAI: <T extends FusionAIConfig>(fn: () => Promise<T> | T) => () => Promise<T> | T;
|
|
32
32
|
/**
|
|
33
|
-
* Options
|
|
33
|
+
* Options controlling how {@link loadFusionAIConfig} resolves and imports the
|
|
34
|
+
* Fusion AI configuration file.
|
|
34
35
|
*/
|
|
35
36
|
export interface LoadFusionAIConfigOptions {
|
|
36
|
-
/**
|
|
37
|
+
/**
|
|
38
|
+
* Base directory used to resolve the config file path.
|
|
39
|
+
*
|
|
40
|
+
* @defaultValue `process.cwd()`
|
|
41
|
+
*/
|
|
37
42
|
baseDir?: string;
|
|
38
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* File extensions tried (in order) when locating the config file.
|
|
45
|
+
*
|
|
46
|
+
* @defaultValue `['.ts', '.mjs', '.js', '.json']`
|
|
47
|
+
*/
|
|
39
48
|
extensions?: string[];
|
|
40
49
|
}
|
|
41
50
|
/**
|
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI command-option utilities for Fusion Framework CLI plugins.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This entry point provides Commander option definitions, a Zod validation schema,
|
|
6
|
+
* and the {@link withOptions} helper that wires options and pre-action validation
|
|
7
|
+
* into any Commander command. Import from
|
|
8
|
+
* `@equinor/fusion-framework-cli-plugin-ai-base/command-options`.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
1
12
|
export { default as options } from './options.js';
|
|
2
13
|
export { withOptions } from './with-options.js';
|
|
3
14
|
export { AiOptionsSchema, type AiOptionsType } from './schema.js';
|
|
@@ -1,48 +1,78 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
3
|
-
*
|
|
2
|
+
* Commander option for the Azure OpenAI API key (`--openai-api-key`).
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Required for all Azure OpenAI operations. Falls back to the
|
|
6
|
+
* `AZURE_OPENAI_API_KEY` environment variable when the flag is omitted.
|
|
4
7
|
*/
|
|
5
8
|
export declare const apiKeyOption: import("commander").Option;
|
|
6
9
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
10
|
+
* Commander option for the Azure OpenAI API version (`--openai-api-version`).
|
|
11
|
+
*
|
|
12
|
+
* @remarks
|
|
13
|
+
* Defaults to `2024-02-15-preview`. Falls back to the
|
|
14
|
+
* `AZURE_OPENAI_API_VERSION` environment variable when the flag is omitted.
|
|
9
15
|
*/
|
|
10
16
|
export declare const apiVersionOption: import("commander").Option;
|
|
11
17
|
/**
|
|
12
|
-
*
|
|
13
|
-
*
|
|
18
|
+
* Commander option for the Azure OpenAI instance name (`--openai-instance`).
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* Required for constructing the Azure OpenAI service endpoint. Falls back to
|
|
22
|
+
* the `AZURE_OPENAI_INSTANCE_NAME` environment variable when the flag is omitted.
|
|
14
23
|
*/
|
|
15
24
|
export declare const apiInstanceOption: import("commander").Option;
|
|
16
25
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
26
|
+
* Commander option for the Azure OpenAI chat deployment (`--openai-chat-deployment`).
|
|
27
|
+
*
|
|
28
|
+
* @remarks
|
|
29
|
+
* Required for chat-completion operations. Falls back to the
|
|
30
|
+
* `AZURE_OPENAI_CHAT_DEPLOYMENT_NAME` environment variable when the flag is omitted.
|
|
31
|
+
* Only added to a command when `withOptions` is called with `includeChat: true`.
|
|
19
32
|
*/
|
|
20
33
|
export declare const chatDeploymentOption: import("commander").Option;
|
|
21
34
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
35
|
+
* Commander option for the Azure OpenAI embedding deployment (`--openai-embedding-deployment`).
|
|
36
|
+
*
|
|
37
|
+
* @remarks
|
|
38
|
+
* Required for embedding and vector-search operations. Falls back to the
|
|
39
|
+
* `AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME` environment variable when the flag is omitted.
|
|
40
|
+
* Only added to a command when `withOptions` is called with `includeEmbedding: true`.
|
|
24
41
|
*/
|
|
25
42
|
export declare const embeddingDeploymentOption: import("commander").Option;
|
|
26
43
|
/**
|
|
27
|
-
*
|
|
28
|
-
*
|
|
44
|
+
* Commander option for the Azure Cognitive Search endpoint (`--azure-search-endpoint`).
|
|
45
|
+
*
|
|
46
|
+
* @remarks
|
|
47
|
+
* Required for vector-search operations. Falls back to the
|
|
48
|
+
* `AZURE_SEARCH_ENDPOINT` environment variable when the flag is omitted.
|
|
49
|
+
* Only added to a command when `withOptions` is called with `includeSearch: true`.
|
|
29
50
|
*/
|
|
30
51
|
export declare const azureSearchEndpointOption: import("commander").Option;
|
|
31
52
|
/**
|
|
32
|
-
*
|
|
33
|
-
*
|
|
53
|
+
* Commander option for the Azure Cognitive Search API key (`--azure-search-api-key`).
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* Required for authenticating with Azure Cognitive Search. Falls back to the
|
|
57
|
+
* `AZURE_SEARCH_API_KEY` environment variable when the flag is omitted.
|
|
58
|
+
* Only added to a command when `withOptions` is called with `includeSearch: true`.
|
|
34
59
|
*/
|
|
35
60
|
export declare const azureSearchApiKeyOption: import("commander").Option;
|
|
36
61
|
/**
|
|
37
|
-
*
|
|
38
|
-
*
|
|
62
|
+
* Commander option for the Azure Cognitive Search index name (`--azure-search-index-name`).
|
|
63
|
+
*
|
|
64
|
+
* @remarks
|
|
65
|
+
* Identifies the target search index to query or write to. Falls back to the
|
|
66
|
+
* `AZURE_SEARCH_INDEX_NAME` environment variable when the flag is omitted.
|
|
67
|
+
* Only added to a command when `withOptions` is called with `includeSearch: true`.
|
|
39
68
|
*/
|
|
40
69
|
export declare const azureSearchIndexNameOption: import("commander").Option;
|
|
41
70
|
/**
|
|
42
|
-
*
|
|
71
|
+
* All AI-related Commander option definitions as a single object.
|
|
43
72
|
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
73
|
+
* @remarks
|
|
74
|
+
* Use this default export for convenient bulk access when you need every option.
|
|
75
|
+
* For selective inclusion prefer importing the named constants directly.
|
|
46
76
|
*/
|
|
47
77
|
declare const _default: {
|
|
48
78
|
apiKeyOption: import("commander").Option;
|
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-authored TypeScript interface for AI CLI command options.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Use {@link AiOptions} when you need a lightweight type without pulling in Zod.
|
|
6
|
+
* For runtime validation prefer {@link AiOptionsSchema} from the schema module.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
1
10
|
/**
|
|
2
11
|
* Configuration options for AI-related CLI commands.
|
|
3
12
|
*
|
package/dist/types/register.d.ts
CHANGED
|
@@ -2,23 +2,22 @@ import type { Command } from 'commander';
|
|
|
2
2
|
/**
|
|
3
3
|
* Registers an AI plugin command with the CLI program.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
* their commands under a common namespace.
|
|
5
|
+
* Ensures the `ai` command group exists and attaches the provided command
|
|
6
|
+
* as a direct subcommand. Each plugin is responsible for structuring its
|
|
7
|
+
* own subcommands internally.
|
|
9
8
|
*
|
|
10
|
-
* @param program - The Commander program instance to register commands with
|
|
11
|
-
* @param command - The command to add
|
|
12
|
-
* @returns void
|
|
9
|
+
* @param program - The Commander program instance to register commands with.
|
|
10
|
+
* @param command - The command to add under the `ai` command group.
|
|
13
11
|
*
|
|
14
12
|
* @example
|
|
15
13
|
* ```ts
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
14
|
+
* // Register a command under `ai`:
|
|
15
|
+
* registerAiPlugin(program, chatCommand);
|
|
16
|
+
* // Results in: ffc ai chat
|
|
19
17
|
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
18
|
+
* // Register a command that has its own subcommands:
|
|
19
|
+
* registerAiPlugin(program, indexCommand);
|
|
20
|
+
* // Results in: ffc ai index embeddings, ffc ai index delete, etc.
|
|
22
21
|
* ```
|
|
23
22
|
*/
|
|
24
23
|
export declare function registerAiPlugin(program: Command, command: Command): void;
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "
|
|
1
|
+
export declare const version = "2.0.0";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@equinor/fusion-framework-cli-plugin-ai-base",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"description": "Base AI plugin package for Fusion Framework CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/esm/index.js",
|
|
@@ -44,17 +44,18 @@
|
|
|
44
44
|
},
|
|
45
45
|
"dependencies": {
|
|
46
46
|
"commander": "^14.0.1",
|
|
47
|
-
"zod": "^4.3.
|
|
48
|
-
"@equinor/fusion-framework-module": "
|
|
49
|
-
"@equinor/fusion-
|
|
50
|
-
"@equinor/fusion-
|
|
47
|
+
"zod": "^4.3.6",
|
|
48
|
+
"@equinor/fusion-framework-module": "6.0.0",
|
|
49
|
+
"@equinor/fusion-framework-module-ai": "3.0.0",
|
|
50
|
+
"@equinor/fusion-imports": "2.0.0"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@equinor/fusion-framework-cli": "^
|
|
53
|
+
"@equinor/fusion-framework-cli": "^14.0.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
|
-
"typescript": "^5.
|
|
57
|
-
"vitest": "^
|
|
56
|
+
"typescript": "^5.9.3",
|
|
57
|
+
"vitest": "^4.1.0",
|
|
58
|
+
"@equinor/fusion-framework-cli": "^14.0.0"
|
|
58
59
|
},
|
|
59
60
|
"scripts": {
|
|
60
61
|
"build": "tsc -b",
|
package/src/config.ts
CHANGED
|
@@ -34,12 +34,21 @@ export interface FusionAIConfig {
|
|
|
34
34
|
export const configureFusionAI = <T extends FusionAIConfig>(fn: () => Promise<T> | T) => fn;
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
|
-
* Options
|
|
37
|
+
* Options controlling how {@link loadFusionAIConfig} resolves and imports the
|
|
38
|
+
* Fusion AI configuration file.
|
|
38
39
|
*/
|
|
39
40
|
export interface LoadFusionAIConfigOptions {
|
|
40
|
-
/**
|
|
41
|
+
/**
|
|
42
|
+
* Base directory used to resolve the config file path.
|
|
43
|
+
*
|
|
44
|
+
* @defaultValue `process.cwd()`
|
|
45
|
+
*/
|
|
41
46
|
baseDir?: string;
|
|
42
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* File extensions tried (in order) when locating the config file.
|
|
49
|
+
*
|
|
50
|
+
* @defaultValue `['.ts', '.mjs', '.js', '.json']`
|
|
51
|
+
*/
|
|
43
52
|
extensions?: string[];
|
|
44
53
|
}
|
|
45
54
|
|
package/src/options/index.ts
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AI command-option utilities for Fusion Framework CLI plugins.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* This entry point provides Commander option definitions, a Zod validation schema,
|
|
6
|
+
* and the {@link withOptions} helper that wires options and pre-action validation
|
|
7
|
+
* into any Commander command. Import from
|
|
8
|
+
* `@equinor/fusion-framework-cli-plugin-ai-base/command-options`.
|
|
9
|
+
*
|
|
10
|
+
* @packageDocumentation
|
|
11
|
+
*/
|
|
12
|
+
|
|
1
13
|
export { default as options } from './options.js';
|
|
2
14
|
export { withOptions } from './with-options.js';
|
|
3
15
|
export { AiOptionsSchema, type AiOptionsType } from './schema.js';
|
package/src/options/options.ts
CHANGED
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { createOption } from 'commander';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
5
|
-
*
|
|
4
|
+
* Commander option for the Azure OpenAI API key (`--openai-api-key`).
|
|
5
|
+
*
|
|
6
|
+
* @remarks
|
|
7
|
+
* Required for all Azure OpenAI operations. Falls back to the
|
|
8
|
+
* `AZURE_OPENAI_API_KEY` environment variable when the flag is omitted.
|
|
6
9
|
*/
|
|
7
10
|
export const apiKeyOption = createOption(
|
|
8
11
|
'--openai-api-key <key>',
|
|
@@ -10,8 +13,11 @@ export const apiKeyOption = createOption(
|
|
|
10
13
|
).env('AZURE_OPENAI_API_KEY');
|
|
11
14
|
|
|
12
15
|
/**
|
|
13
|
-
*
|
|
14
|
-
*
|
|
16
|
+
* Commander option for the Azure OpenAI API version (`--openai-api-version`).
|
|
17
|
+
*
|
|
18
|
+
* @remarks
|
|
19
|
+
* Defaults to `2024-02-15-preview`. Falls back to the
|
|
20
|
+
* `AZURE_OPENAI_API_VERSION` environment variable when the flag is omitted.
|
|
15
21
|
*/
|
|
16
22
|
export const apiVersionOption = createOption(
|
|
17
23
|
'--openai-api-version <version>',
|
|
@@ -21,8 +27,11 @@ export const apiVersionOption = createOption(
|
|
|
21
27
|
.default('2024-02-15-preview');
|
|
22
28
|
|
|
23
29
|
/**
|
|
24
|
-
*
|
|
25
|
-
*
|
|
30
|
+
* Commander option for the Azure OpenAI instance name (`--openai-instance`).
|
|
31
|
+
*
|
|
32
|
+
* @remarks
|
|
33
|
+
* Required for constructing the Azure OpenAI service endpoint. Falls back to
|
|
34
|
+
* the `AZURE_OPENAI_INSTANCE_NAME` environment variable when the flag is omitted.
|
|
26
35
|
*/
|
|
27
36
|
export const apiInstanceOption = createOption(
|
|
28
37
|
'--openai-instance <name>',
|
|
@@ -30,8 +39,12 @@ export const apiInstanceOption = createOption(
|
|
|
30
39
|
).env('AZURE_OPENAI_INSTANCE_NAME');
|
|
31
40
|
|
|
32
41
|
/**
|
|
33
|
-
*
|
|
34
|
-
*
|
|
42
|
+
* Commander option for the Azure OpenAI chat deployment (`--openai-chat-deployment`).
|
|
43
|
+
*
|
|
44
|
+
* @remarks
|
|
45
|
+
* Required for chat-completion operations. Falls back to the
|
|
46
|
+
* `AZURE_OPENAI_CHAT_DEPLOYMENT_NAME` environment variable when the flag is omitted.
|
|
47
|
+
* Only added to a command when `withOptions` is called with `includeChat: true`.
|
|
35
48
|
*/
|
|
36
49
|
export const chatDeploymentOption = createOption(
|
|
37
50
|
'--openai-chat-deployment <name>',
|
|
@@ -39,8 +52,12 @@ export const chatDeploymentOption = createOption(
|
|
|
39
52
|
).env('AZURE_OPENAI_CHAT_DEPLOYMENT_NAME');
|
|
40
53
|
|
|
41
54
|
/**
|
|
42
|
-
*
|
|
43
|
-
*
|
|
55
|
+
* Commander option for the Azure OpenAI embedding deployment (`--openai-embedding-deployment`).
|
|
56
|
+
*
|
|
57
|
+
* @remarks
|
|
58
|
+
* Required for embedding and vector-search operations. Falls back to the
|
|
59
|
+
* `AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME` environment variable when the flag is omitted.
|
|
60
|
+
* Only added to a command when `withOptions` is called with `includeEmbedding: true`.
|
|
44
61
|
*/
|
|
45
62
|
export const embeddingDeploymentOption = createOption(
|
|
46
63
|
'--openai-embedding-deployment <name>',
|
|
@@ -48,8 +65,12 @@ export const embeddingDeploymentOption = createOption(
|
|
|
48
65
|
).env('AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME');
|
|
49
66
|
|
|
50
67
|
/**
|
|
51
|
-
*
|
|
52
|
-
*
|
|
68
|
+
* Commander option for the Azure Cognitive Search endpoint (`--azure-search-endpoint`).
|
|
69
|
+
*
|
|
70
|
+
* @remarks
|
|
71
|
+
* Required for vector-search operations. Falls back to the
|
|
72
|
+
* `AZURE_SEARCH_ENDPOINT` environment variable when the flag is omitted.
|
|
73
|
+
* Only added to a command when `withOptions` is called with `includeSearch: true`.
|
|
53
74
|
*/
|
|
54
75
|
export const azureSearchEndpointOption = createOption(
|
|
55
76
|
'--azure-search-endpoint <url>',
|
|
@@ -57,8 +78,12 @@ export const azureSearchEndpointOption = createOption(
|
|
|
57
78
|
).env('AZURE_SEARCH_ENDPOINT');
|
|
58
79
|
|
|
59
80
|
/**
|
|
60
|
-
*
|
|
61
|
-
*
|
|
81
|
+
* Commander option for the Azure Cognitive Search API key (`--azure-search-api-key`).
|
|
82
|
+
*
|
|
83
|
+
* @remarks
|
|
84
|
+
* Required for authenticating with Azure Cognitive Search. Falls back to the
|
|
85
|
+
* `AZURE_SEARCH_API_KEY` environment variable when the flag is omitted.
|
|
86
|
+
* Only added to a command when `withOptions` is called with `includeSearch: true`.
|
|
62
87
|
*/
|
|
63
88
|
export const azureSearchApiKeyOption = createOption(
|
|
64
89
|
'--azure-search-api-key <key>',
|
|
@@ -66,8 +91,12 @@ export const azureSearchApiKeyOption = createOption(
|
|
|
66
91
|
).env('AZURE_SEARCH_API_KEY');
|
|
67
92
|
|
|
68
93
|
/**
|
|
69
|
-
*
|
|
70
|
-
*
|
|
94
|
+
* Commander option for the Azure Cognitive Search index name (`--azure-search-index-name`).
|
|
95
|
+
*
|
|
96
|
+
* @remarks
|
|
97
|
+
* Identifies the target search index to query or write to. Falls back to the
|
|
98
|
+
* `AZURE_SEARCH_INDEX_NAME` environment variable when the flag is omitted.
|
|
99
|
+
* Only added to a command when `withOptions` is called with `includeSearch: true`.
|
|
71
100
|
*/
|
|
72
101
|
export const azureSearchIndexNameOption = createOption(
|
|
73
102
|
'--azure-search-index-name <name>',
|
|
@@ -75,10 +104,11 @@ export const azureSearchIndexNameOption = createOption(
|
|
|
75
104
|
).env('AZURE_SEARCH_INDEX_NAME');
|
|
76
105
|
|
|
77
106
|
/**
|
|
78
|
-
*
|
|
107
|
+
* All AI-related Commander option definitions as a single object.
|
|
79
108
|
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
109
|
+
* @remarks
|
|
110
|
+
* Use this default export for convenient bulk access when you need every option.
|
|
111
|
+
* For selective inclusion prefer importing the named constants directly.
|
|
82
112
|
*/
|
|
83
113
|
export default {
|
|
84
114
|
apiKeyOption,
|
package/src/options/schema.ts
CHANGED
package/src/options/types.ts
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hand-authored TypeScript interface for AI CLI command options.
|
|
3
|
+
*
|
|
4
|
+
* @remarks
|
|
5
|
+
* Use {@link AiOptions} when you need a lightweight type without pulling in Zod.
|
|
6
|
+
* For runtime validation prefer {@link AiOptionsSchema} from the schema module.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
10
|
+
|
|
1
11
|
/**
|
|
2
12
|
* Configuration options for AI-related CLI commands.
|
|
3
13
|
*
|
|
@@ -79,7 +79,9 @@ export const withOptions = (
|
|
|
79
79
|
typeof options.openaiApiKey !== 'string' ||
|
|
80
80
|
options.openaiApiKey.trim() === ''
|
|
81
81
|
) {
|
|
82
|
-
throw new InvalidOptionArgumentError(
|
|
82
|
+
throw new InvalidOptionArgumentError(
|
|
83
|
+
'Azure OpenAI API key is required. Provide it via --openai-api-key option or AZURE_OPENAI_API_KEY environment variable.',
|
|
84
|
+
);
|
|
83
85
|
}
|
|
84
86
|
|
|
85
87
|
// Validate API version
|
|
@@ -94,7 +96,7 @@ export const withOptions = (
|
|
|
94
96
|
options.openaiInstance.trim() === ''
|
|
95
97
|
) {
|
|
96
98
|
throw new InvalidOptionArgumentError(
|
|
97
|
-
'
|
|
99
|
+
'Azure OpenAI instance name is required. Provide it via --openai-instance option or AZURE_OPENAI_INSTANCE_NAME environment variable.',
|
|
98
100
|
);
|
|
99
101
|
}
|
|
100
102
|
|
|
@@ -117,7 +119,7 @@ export const withOptions = (
|
|
|
117
119
|
options.openaiEmbeddingDeployment.trim() === ''
|
|
118
120
|
) {
|
|
119
121
|
throw new InvalidOptionArgumentError(
|
|
120
|
-
'
|
|
122
|
+
'Azure OpenAI embedding deployment name is required. Provide it via --openai-embedding-deployment option or AZURE_OPENAI_EMBEDDING_DEPLOYMENT_NAME environment variable.',
|
|
121
123
|
);
|
|
122
124
|
}
|
|
123
125
|
}
|
|
@@ -139,7 +141,7 @@ export const withOptions = (
|
|
|
139
141
|
options.azureSearchApiKey.trim() === ''
|
|
140
142
|
) {
|
|
141
143
|
throw new InvalidOptionArgumentError(
|
|
142
|
-
'Azure Search API key is required
|
|
144
|
+
'Azure Search API key is required. Provide it via --azure-search-api-key option or AZURE_SEARCH_API_KEY environment variable.',
|
|
143
145
|
);
|
|
144
146
|
}
|
|
145
147
|
|
package/src/register.ts
CHANGED
|
@@ -4,23 +4,22 @@ import { createCommand } from 'commander';
|
|
|
4
4
|
/**
|
|
5
5
|
* Registers an AI plugin command with the CLI program.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* their commands under a common namespace.
|
|
7
|
+
* Ensures the `ai` command group exists and attaches the provided command
|
|
8
|
+
* as a direct subcommand. Each plugin is responsible for structuring its
|
|
9
|
+
* own subcommands internally.
|
|
11
10
|
*
|
|
12
|
-
* @param program - The Commander program instance to register commands with
|
|
13
|
-
* @param command - The command to add
|
|
14
|
-
* @returns void
|
|
11
|
+
* @param program - The Commander program instance to register commands with.
|
|
12
|
+
* @param command - The command to add under the `ai` command group.
|
|
15
13
|
*
|
|
16
14
|
* @example
|
|
17
15
|
* ```ts
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
16
|
+
* // Register a command under `ai`:
|
|
17
|
+
* registerAiPlugin(program, chatCommand);
|
|
18
|
+
* // Results in: ffc ai chat
|
|
21
19
|
*
|
|
22
|
-
*
|
|
23
|
-
*
|
|
20
|
+
* // Register a command that has its own subcommands:
|
|
21
|
+
* registerAiPlugin(program, indexCommand);
|
|
22
|
+
* // Results in: ffc ai index embeddings, ffc ai index delete, etc.
|
|
24
23
|
* ```
|
|
25
24
|
*/
|
|
26
25
|
export function registerAiPlugin(program: Command, command: Command): void {
|
|
@@ -32,6 +31,7 @@ export function registerAiPlugin(program: Command, command: Command): void {
|
|
|
32
31
|
);
|
|
33
32
|
program.addCommand(aiCommand);
|
|
34
33
|
}
|
|
34
|
+
|
|
35
35
|
aiCommand.addCommand(command);
|
|
36
36
|
}
|
|
37
37
|
|
package/src/version.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by genversion.
|
|
2
|
-
export const version = '
|
|
2
|
+
export const version = '2.0.0';
|