@equinor/fusion-framework-cli 13.0.0-cli-search-index.4 → 13.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.
Files changed (53) hide show
  1. package/CHANGELOG.md +125 -56
  2. package/README.md +24 -0
  3. package/bin/build/bin.mjs +1 -1
  4. package/bin/build/cli.mjs +6 -6
  5. package/dist/esm/lib/dev-server.js +1 -0
  6. package/dist/esm/lib/dev-server.js.map +1 -1
  7. package/dist/esm/lib/fusion-cli-config.js +21 -0
  8. package/dist/esm/lib/fusion-cli-config.js.map +1 -0
  9. package/dist/esm/lib/index.js +1 -0
  10. package/dist/esm/lib/index.js.map +1 -1
  11. package/dist/esm/version.js +1 -1
  12. package/dist/types/cli/commands/create/_helpers/cleanup-template-files.d.ts +4 -2
  13. package/dist/types/cli/commands/create/_helpers/open-in-ide.d.ts +3 -2
  14. package/dist/types/cli/commands/create/_helpers/select-git-protocol.d.ts +7 -2
  15. package/dist/types/cli/commands/create/_helpers/setup-repository.d.ts +6 -2
  16. package/dist/types/cli/commands/create/app.d.ts +4 -1
  17. package/dist/types/cli/commands/index.d.ts +1 -1
  18. package/dist/types/cli/plugins/loader.d.ts +2 -0
  19. package/dist/types/lib/dev-server.d.ts +1 -0
  20. package/dist/types/lib/fusion-cli-config.d.ts +84 -0
  21. package/dist/types/lib/index.d.ts +1 -0
  22. package/dist/types/version.d.ts +1 -1
  23. package/docs/ai-commands.md +28 -24
  24. package/package.json +12 -33
  25. package/dist/esm/lib/ai/fusion-ai.js +0 -2
  26. package/dist/esm/lib/ai/fusion-ai.js.map +0 -1
  27. package/dist/esm/lib/ai/index.js +0 -2
  28. package/dist/esm/lib/ai/index.js.map +0 -1
  29. package/dist/types/cli/commands/ai/chat.d.ts +0 -2
  30. package/dist/types/cli/commands/ai/embeddings.d.ts +0 -2
  31. package/dist/types/cli/commands/ai/index.d.ts +0 -30
  32. package/dist/types/cli/commands/ai/search.d.ts +0 -48
  33. package/dist/types/cli/commands/ai/utils/generate-cunk-id.d.ts +0 -8
  34. package/dist/types/cli/commands/ai/utils/git/file-changes.d.ts +0 -21
  35. package/dist/types/cli/commands/ai/utils/git/git-client.d.ts +0 -17
  36. package/dist/types/cli/commands/ai/utils/git/index.d.ts +0 -5
  37. package/dist/types/cli/commands/ai/utils/git/metadata.d.ts +0 -7
  38. package/dist/types/cli/commands/ai/utils/git/status.d.ts +0 -12
  39. package/dist/types/cli/commands/ai/utils/git/types.d.ts +0 -33
  40. package/dist/types/cli/commands/ai/utils/markdown/index.d.ts +0 -2
  41. package/dist/types/cli/commands/ai/utils/markdown/parser.d.ts +0 -21
  42. package/dist/types/cli/commands/ai/utils/markdown/types.d.ts +0 -11
  43. package/dist/types/cli/commands/ai/utils/setup-framework.d.ts +0 -10
  44. package/dist/types/cli/commands/ai/utils/ts-doc/constants.d.ts +0 -5
  45. package/dist/types/cli/commands/ai/utils/ts-doc/extractors.d.ts +0 -28
  46. package/dist/types/cli/commands/ai/utils/ts-doc/index.d.ts +0 -2
  47. package/dist/types/cli/commands/ai/utils/ts-doc/parser.d.ts +0 -23
  48. package/dist/types/cli/commands/ai/utils/ts-doc/types.d.ts +0 -20
  49. package/dist/types/cli/commands/ai/utils/types.d.ts +0 -7
  50. package/dist/types/cli/commands/create/_helpers/start-dev-server.d.ts +0 -17
  51. package/dist/types/cli/options/ai.d.ts +0 -105
  52. package/dist/types/lib/ai/fusion-ai.d.ts +0 -20
  53. package/dist/types/lib/ai/index.d.ts +0 -1
@@ -1,33 +0,0 @@
1
- /**
2
- * Git metadata extracted from repository
3
- */
4
- export type GitMetadata = Partial<{
5
- git_remote_url: string;
6
- git_commit_hash: string;
7
- git_commit_date: string;
8
- git_link: string;
9
- }>;
10
- /**
11
- * Git diff options for filtering changed files
12
- */
13
- export interface GitDiffOptions {
14
- /** Enable diff-based file filtering */
15
- diff: boolean;
16
- /** Git reference to compare against (default: HEAD~1) */
17
- baseRef?: string;
18
- /** Working directory for git operations */
19
- cwd?: string;
20
- }
21
- /**
22
- * File change status
23
- */
24
- export type FileChangeStatus = 'new' | 'modified' | 'removed';
25
- /**
26
- * Changed file information
27
- */
28
- export interface ChangedFile {
29
- /** Absolute file path */
30
- filepath: string;
31
- /** Change status: new, modified, or removed */
32
- status: FileChangeStatus;
33
- }
@@ -1,2 +0,0 @@
1
- export type { MarkdownMetadata, MarkdownDocument } from './types.js';
2
- export { isMarkdownFile, parseMarkdown, parseMarkdownFile } from './parser.js';
@@ -1,21 +0,0 @@
1
- import type { SourceFile } from '../types.js';
2
- import type { MarkdownDocument } from './types.js';
3
- /**
4
- * Check if a file is a markdown file
5
- * @param filePath - File path to check
6
- * @returns True if file has .md extension
7
- */
8
- export declare const isMarkdownFile: (filePath: string) => boolean;
9
- /**
10
- * Parse markdown content into document chunks
11
- * @param content - Markdown content string
12
- * @param source - Source file path
13
- * @returns Array of markdown documents
14
- */
15
- export declare const parseMarkdown: <T extends Record<string, unknown> = Record<string, unknown>>(content: string, source: string) => Promise<MarkdownDocument<T>[]>;
16
- /**
17
- * Parse a markdown file into document chunks
18
- * @param file - Source file object
19
- * @returns Array of markdown documents with root path metadata
20
- */
21
- export declare const parseMarkdownFile: <T extends Record<string, unknown> = Record<string, unknown>>(file: SourceFile) => Promise<MarkdownDocument<T>[]>;
@@ -1,11 +0,0 @@
1
- import type { VectorStoreDocument, VectorStoreDocumentMetadata } from '@equinor/fusion-framework-module-ai/lib';
2
- /**
3
- * Markdown document metadata
4
- */
5
- export type MarkdownMetadata<T extends Record<string, unknown> = Record<string, unknown>> = VectorStoreDocumentMetadata<T & {
6
- type: 'markdown';
7
- }>;
8
- /**
9
- * Markdown document
10
- */
11
- export type MarkdownDocument<T extends Record<string, unknown> = Record<string, unknown>> = VectorStoreDocument<MarkdownMetadata<T>>;
@@ -1,10 +0,0 @@
1
- import { type AIModule } from '@equinor/fusion-framework-module-ai';
2
- import type { AiOptions } from '../../../options/ai.js';
3
- import { type ModulesInstance } from '@equinor/fusion-framework-module';
4
- /**
5
- * Initializes and configures the Fusion Framework with AI module capabilities
6
- * @param options - AI configuration options including API keys, deployments, and vector store settings
7
- * @returns Promise resolving to an initialized framework instance with AI module
8
- * @throws {Error} If embedding deployment is required but not provided when configuring vector store
9
- */
10
- export declare const setupFramework: (options: AiOptions) => Promise<ModulesInstance<[AIModule]>>;
@@ -1,5 +0,0 @@
1
- import { SyntaxKind } from 'ts-morph';
2
- /**
3
- * Supported TSDoc node kinds for top-level processing
4
- */
5
- export declare const nodeKinds: SyntaxKind[];
@@ -1,28 +0,0 @@
1
- import { type SourceFile as ProjectSourceFile, Node, type ClassDeclaration } from 'ts-morph';
2
- import type { TypescriptDocument, ParseTsDocOptions } from './types.js';
3
- /**
4
- * Extracts a TSDoc document from a class node, including TSDoc, constructor, and public member signatures.
5
- * @param classNode - The ClassDeclaration node to process.
6
- * @param sourceFile - The source file containing the node.
7
- * @param options - Optional parsing configuration.
8
- * @returns A TypeScript document with TSDoc and class interface, or null if no TSDoc is found.
9
- */
10
- export declare const extractDocumentFromClassNode: (classNode: ClassDeclaration, sourceFile: ProjectSourceFile, _options?: ParseTsDocOptions) => TypescriptDocument | null;
11
- /**
12
- * Extracts a TSDoc document from a single node.
13
- * @param node - The TypeScript node to process.
14
- * @param sourceFile - The source file containing the node.
15
- * @param options - Optional parsing configuration.
16
- * @param nodeOptions - Optional node-specific configuration (e.g., skipKindCheck for VariableStatement).
17
- * @returns A TypeScript document with TSDoc metadata, or null if no TSDoc is found.
18
- */
19
- export declare const extractDocumentFromNode: (node: Node, sourceFile: ProjectSourceFile, options?: ParseTsDocOptions, nodeOptions?: {
20
- skipKindCheck?: boolean;
21
- }) => TypescriptDocument | null;
22
- /**
23
- * Processes a TypeScript source file to extract TSDoc documents.
24
- * @param sourceFile - The source file to process.
25
- * @param options - Optional parsing configuration.
26
- * @returns An array of TypeScript documents with TSDoc metadata.
27
- */
28
- export declare const processSourceFile: (sourceFile: ProjectSourceFile, options?: ParseTsDocOptions) => TypescriptDocument[];
@@ -1,2 +0,0 @@
1
- export type { TypescriptMetadata, TypescriptDocument, ParseTsDocOptions } from './types.js';
2
- export { isTypescriptFile, parseTsDocSync, parseTsDocFromFileSync } from './parser.js';
@@ -1,23 +0,0 @@
1
- import type { SourceFile } from '../types.js';
2
- import type { TypescriptDocument, ParseTsDocOptions } from './types.js';
3
- /**
4
- * Checks if a file is a TypeScript or TSX file based on its extension.
5
- * @param filePath - The path to the file.
6
- * @returns True if the file ends with .ts or .tsx, false otherwise.
7
- */
8
- export declare const isTypescriptFile: (filePath: string) => boolean;
9
- /**
10
- * Parses TSDoc from a string of TypeScript code.
11
- * @param content - The TypeScript code content.
12
- * @param options - Optional parsing configuration.
13
- * @returns An array of TypeScript documents with TSDoc metadata.
14
- */
15
- export declare const parseTsDocSync: (content: string, options?: ParseTsDocOptions) => TypescriptDocument[];
16
- /**
17
- * Parses TSDoc from a TypeScript file by path.
18
- * @param file - The source file object.
19
- * @param options - Optional parsing configuration.
20
- * @returns An array of TypeScript documents with TSDoc metadata.
21
- * @throws If the file is not a TypeScript file.
22
- */
23
- export declare const parseTsDocFromFileSync: (file: SourceFile, options?: ParseTsDocOptions) => TypescriptDocument[];
@@ -1,20 +0,0 @@
1
- import type { VectorStoreDocument, VectorStoreDocumentMetadata } from '@equinor/fusion-framework-module-ai/lib';
2
- /**
3
- * TypeScript document metadata
4
- */
5
- export type TypescriptMetadata = VectorStoreDocumentMetadata<{
6
- type: 'tsdoc';
7
- ts_kind: string;
8
- ts_name: string;
9
- }>;
10
- /**
11
- * TypeScript document with TSDoc metadata
12
- */
13
- export type TypescriptDocument = VectorStoreDocument<TypescriptMetadata>;
14
- /**
15
- * Options for parsing TypeScript documents
16
- */
17
- export interface ParseTsDocOptions {
18
- /** The project root path for generating relative paths */
19
- projectRoot?: string;
20
- }
@@ -1,7 +0,0 @@
1
- export type FileStatus = 'new' | 'modified' | 'removed';
2
- export type SourceFile = {
3
- path: string;
4
- projectRoot?: string;
5
- relativePath?: string;
6
- status: FileStatus;
7
- };
@@ -1,17 +0,0 @@
1
- import type { ConsoleLogger } from '@equinor/fusion-framework-cli/bin';
2
- /**
3
- * Prompts the user to start the development server after project creation.
4
- *
5
- * Offers the user the option to immediately start the development server
6
- * using their selected package manager. The server runs in the foreground
7
- * and can be stopped with Ctrl+C. When persistent mode is enabled, the server
8
- * will run indefinitely until manually terminated by the user.
9
- *
10
- * @param targetDir - Absolute path to the project directory where dev server should start
11
- * @param packageManager - Package manager command to use (e.g., 'pnpm', 'npm')
12
- * @param logger - Console logger for displaying prompts and server status
13
- * @param persistent - If true, runs the dev server indefinitely without timeout (default: false)
14
- * @returns Promise resolving to true if dev server was started, false if user skipped
15
- */
16
- export declare function startDevServer(targetDir: string, packageManager: string, logger: ConsoleLogger, persistent?: boolean): Promise<boolean>;
17
- export default startDevServer;
@@ -1,105 +0,0 @@
1
- import { type Command } from 'commander';
2
- /**
3
- * Interface representing the AI-related options available in CLI commands.
4
- * This interface defines the structure of options that can be passed to AI commands.
5
- */
6
- export interface AiOptions {
7
- /** Azure OpenAI API key for authentication */
8
- openaiApiKey: string;
9
- /** Azure OpenAI API version */
10
- openaiApiVersion: string;
11
- /** Azure OpenAI instance name */
12
- openaiInstance: string;
13
- /** Azure OpenAI chat deployment name (optional) */
14
- openaiChatDeployment?: string;
15
- /** Azure OpenAI embedding deployment name (optional) */
16
- openaiEmbeddingDeployment?: string;
17
- /** Azure Search endpoint URL (optional) */
18
- azureSearchEndpoint?: string;
19
- /** Azure Search API key (optional) */
20
- azureSearchApiKey?: string;
21
- /** Azure Search index name (optional) */
22
- azureSearchIndexName?: string;
23
- }
24
- /**
25
- * Option for specifying the Azure OpenAI API key.
26
- * Required for authentication with Azure OpenAI services.
27
- */
28
- export declare const apiKeyOption: import("commander").Option;
29
- /**
30
- * Option for specifying the Azure OpenAI API version.
31
- * Defaults to the latest stable version if not provided.
32
- */
33
- export declare const apiVersionOption: import("commander").Option;
34
- /**
35
- * Option for specifying the Azure OpenAI instance name.
36
- * Required for Azure OpenAI service endpoint construction.
37
- */
38
- export declare const apiInstanceOption: import("commander").Option;
39
- /**
40
- * Option for specifying the Azure OpenAI deployment name for chat models.
41
- * Required for chat completions API calls.
42
- */
43
- export declare const chatDeploymentOption: import("commander").Option;
44
- /**
45
- * Option for specifying the Azure OpenAI deployment name for embedding models.
46
- * Required for embeddings API calls.
47
- */
48
- export declare const embeddingDeploymentOption: import("commander").Option;
49
- /**
50
- * Option for specifying the Azure Search endpoint URL.
51
- * Required for Azure Cognitive Search operations.
52
- */
53
- export declare const azureSearchEndpointOption: import("commander").Option;
54
- /**
55
- * Option for specifying the Azure Search API key.
56
- * Required for authentication with Azure Cognitive Search.
57
- */
58
- export declare const azureSearchApiKeyOption: import("commander").Option;
59
- /**
60
- * Option for specifying the Azure Search index name.
61
- * Required for search operations on a specific index.
62
- */
63
- export declare const azureSearchIndexNameOption: import("commander").Option;
64
- /**
65
- * Enhances a given command with AI-related options.
66
- *
67
- * This function adds the following options to the provided command:
68
- * - `openaiApiKey`: Azure OpenAI API key
69
- * - `openaiApiVersion`: Azure OpenAI API version
70
- * - `openaiInstance`: Azure OpenAI instance name
71
- * - `openaiChatDeployment`: Chat model deployment name
72
- * - `openaiEmbeddingDeployment`: Embedding model deployment name (if includeEmbedding is true)
73
- * - `azureSearchEndpoint`: Azure Search endpoint URL (if includeSearch is true)
74
- * - `azureSearchApiKey`: Azure Search API key (if includeSearch is true)
75
- * - `azureSearchIndexName`: Azure Search index name (if includeSearch is true)
76
- *
77
- * @param command - The command to which AI options will be added
78
- * @param args - Optional configuration for which options to include
79
- * @param args.includeEmbedding - Whether to include embedding deployment option
80
- * @param args.includeChat - Whether to include chat deployment option (defaults to true)
81
- * @param args.includeSearch - Whether to include Azure Search options (defaults to false)
82
- * @returns The enhanced command with AI options
83
- *
84
- * @example
85
- * ```ts
86
- * import { createCommand } from 'commander';
87
- * import { withAiOptions } from './path/to/this/file';
88
- *
89
- * const command = withAiOptions(
90
- * createCommand('ai-chat')
91
- * .description('Chat with AI models')
92
- * .action((options) => {
93
- * console.log('API Key:', options.openaiApiKey);
94
- * console.log('Instance:', options.openaiInstance);
95
- * console.log('Chat Deployment:', options.openaiChatDeployment);
96
- * })
97
- * );
98
- * ```
99
- */
100
- export declare const withAiOptions: (command: Command, args?: Partial<{
101
- includeEmbedding: boolean;
102
- includeChat: boolean;
103
- includeSearch: boolean;
104
- }>) => Command;
105
- export default withAiOptions;
@@ -1,20 +0,0 @@
1
- import type { VectorStoreDocument } from '@equinor/fusion-framework-module-ai/lib';
2
- /**
3
- * Configuration interface for Fusion AI operations
4
- */
5
- export interface FusionAIConfig {
6
- patterns?: string[];
7
- /** Metadata processing configuration */
8
- metadata?: {
9
- /** Custom metadata processors to transform metadata before embedding */
10
- attributeProcessor?: (metadata: Record<string, any>, document: VectorStoreDocument) => Record<string, any>;
11
- };
12
- /** Embedding generation configuration */
13
- embedding?: {
14
- /** Size of text chunks for embedding */
15
- chunkSize?: number;
16
- /** Overlap between chunks */
17
- chunkOverlap?: number;
18
- };
19
- }
20
- export declare const configureFusionAI: (fn: () => Promise<FusionAIConfig> | FusionAIConfig) => () => Promise<FusionAIConfig> | FusionAIConfig;
@@ -1 +0,0 @@
1
- export { configureFusionAI, type FusionAIConfig } from './fusion-ai.js';