@mcampa/ai-context-cli 0.0.1-beta.c518c19

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.
@@ -0,0 +1,78 @@
1
+ /**
2
+ * Configuration for OpenAI embedding provider
3
+ */
4
+ export interface OpenAIEmbeddingConfig {
5
+ /** The embedding model to use (e.g., "text-embedding-3-small") */
6
+ model: string;
7
+ /** Your OpenAI API key */
8
+ apiKey: string;
9
+ /** Optional custom base URL for OpenAI-compatible APIs */
10
+ baseURL?: string;
11
+ }
12
+ /**
13
+ * Configuration for Milvus vector database
14
+ */
15
+ export interface MilvusConfig {
16
+ /** Milvus server address (e.g., "localhost:19530") */
17
+ address?: string;
18
+ /** Authentication token (for Zilliz Cloud) */
19
+ token?: string;
20
+ /** Username for authentication */
21
+ username?: string;
22
+ /** Password for authentication */
23
+ password?: string;
24
+ /** Whether to use SSL connection */
25
+ ssl?: boolean;
26
+ }
27
+ /**
28
+ * Main configuration interface for ai-context.config.ts/js
29
+ */
30
+ export interface ContextConfig {
31
+ /** Name identifier for this context (used in collection naming) */
32
+ name?: string;
33
+ /** OpenAI embedding configuration */
34
+ embeddingConfig?: OpenAIEmbeddingConfig;
35
+ /** Milvus vector database configuration */
36
+ vectorDatabaseConfig?: MilvusConfig;
37
+ /**
38
+ * Supported file extensions for indexing
39
+ * If provided, replaces the default extensions
40
+ */
41
+ supportedExtensions?: string[];
42
+ /**
43
+ * Patterns to ignore during indexing
44
+ * If provided, replaces the default ignore patterns
45
+ */
46
+ ignorePatterns?: string[];
47
+ /**
48
+ * Additional file extensions to include beyond defaults
49
+ * Merged with default or provided supportedExtensions
50
+ */
51
+ customExtensions?: string[];
52
+ /**
53
+ * Additional patterns to ignore beyond defaults
54
+ * Merged with default or provided ignorePatterns
55
+ */
56
+ customIgnorePatterns?: string[];
57
+ }
58
+ /**
59
+ * CLI options parsed from command line arguments
60
+ */
61
+ export interface CLIOptions {
62
+ /** Path to config file (optional, defaults to ai-context.config.ts/js in cwd) */
63
+ config?: string;
64
+ /** Force reindex even if collection exists */
65
+ force?: boolean;
66
+ }
67
+ /**
68
+ * Result of a successful index operation
69
+ */
70
+ export interface IndexResult {
71
+ /** Number of files indexed */
72
+ indexedFiles: number;
73
+ /** Total number of chunks created */
74
+ totalChunks: number;
75
+ /** Status of the indexing operation */
76
+ status: "completed" | "limit_reached";
77
+ }
78
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACpC,kEAAkE;IAClE,KAAK,EAAE,MAAM,CAAC;IACd,0BAA0B;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,0DAA0D;IAC1D,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,sDAAsD;IACtD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,kCAAkC;IAClC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,oCAAoC;IACpC,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,mEAAmE;IACnE,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,eAAe,CAAC,EAAE,qBAAqB,CAAC;IACxC,2CAA2C;IAC3C,oBAAoB,CAAC,EAAE,YAAY,CAAC;IACpC;;;OAGG;IACH,mBAAmB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC/B;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,EAAE,CAAC;IAC1B;;;OAGG;IACH,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B;;;OAGG;IACH,oBAAoB,CAAC,EAAE,MAAM,EAAE,CAAC;CACjC;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,iFAAiF;IACjF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8CAA8C;IAC9C,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,8BAA8B;IAC9B,YAAY,EAAE,MAAM,CAAC;IACrB,qCAAqC;IACrC,WAAW,EAAE,MAAM,CAAC;IACpB,uCAAuC;IACvC,MAAM,EAAE,WAAW,GAAG,eAAe,CAAC;CACvC"}
package/dist/types.js ADDED
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=types.test.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.test.d.ts","sourceRoot":"","sources":["../src/types.test.ts"],"names":[],"mappings":""}
@@ -0,0 +1,137 @@
1
+ import { describe, it, expect } from "vitest";
2
+ describe("Types", () => {
3
+ describe("ContextConfig", () => {
4
+ it("should allow a minimal valid config", () => {
5
+ const config = {
6
+ embeddingConfig: {
7
+ apiKey: "test-key",
8
+ model: "text-embedding-3-small",
9
+ },
10
+ vectorDatabaseConfig: {
11
+ address: "localhost:19530",
12
+ },
13
+ };
14
+ expect(config.embeddingConfig?.apiKey).toBe("test-key");
15
+ expect(config.embeddingConfig?.model).toBe("text-embedding-3-small");
16
+ expect(config.vectorDatabaseConfig?.address).toBe("localhost:19530");
17
+ });
18
+ it("should allow all optional fields", () => {
19
+ const config = {
20
+ name: "my-project",
21
+ embeddingConfig: {
22
+ apiKey: "test-key",
23
+ model: "text-embedding-3-small",
24
+ baseURL: "https://custom.api.com",
25
+ },
26
+ vectorDatabaseConfig: {
27
+ address: "localhost:19530",
28
+ token: "token",
29
+ username: "user",
30
+ password: "pass",
31
+ ssl: true,
32
+ },
33
+ supportedExtensions: [".ts", ".js"],
34
+ ignorePatterns: ["node_modules/**"],
35
+ customExtensions: [".vue"],
36
+ customIgnorePatterns: ["*.test.ts"],
37
+ };
38
+ expect(config.name).toBe("my-project");
39
+ expect(config.embeddingConfig?.baseURL).toBe("https://custom.api.com");
40
+ expect(config.vectorDatabaseConfig?.ssl).toBe(true);
41
+ expect(config.supportedExtensions).toHaveLength(2);
42
+ expect(config.customExtensions).toContain(".vue");
43
+ });
44
+ it("should allow config with only token for vector database", () => {
45
+ const config = {
46
+ embeddingConfig: {
47
+ apiKey: "test-key",
48
+ model: "text-embedding-3-small",
49
+ },
50
+ vectorDatabaseConfig: {
51
+ token: "zilliz-cloud-token",
52
+ },
53
+ };
54
+ expect(config.vectorDatabaseConfig?.token).toBe("zilliz-cloud-token");
55
+ expect(config.vectorDatabaseConfig?.address).toBeUndefined();
56
+ });
57
+ });
58
+ describe("OpenAIEmbeddingConfig", () => {
59
+ it("should require apiKey and model", () => {
60
+ const config = {
61
+ apiKey: "sk-test",
62
+ model: "text-embedding-3-small",
63
+ };
64
+ expect(config.apiKey).toBe("sk-test");
65
+ expect(config.model).toBe("text-embedding-3-small");
66
+ });
67
+ it("should allow optional baseURL", () => {
68
+ const config = {
69
+ apiKey: "sk-test",
70
+ model: "text-embedding-3-small",
71
+ baseURL: "https://api.example.com/v1",
72
+ };
73
+ expect(config.baseURL).toBe("https://api.example.com/v1");
74
+ });
75
+ });
76
+ describe("MilvusConfig", () => {
77
+ it("should allow address-based config", () => {
78
+ const config = {
79
+ address: "localhost:19530",
80
+ };
81
+ expect(config.address).toBe("localhost:19530");
82
+ });
83
+ it("should allow token-based config", () => {
84
+ const config = {
85
+ token: "my-token",
86
+ ssl: true,
87
+ };
88
+ expect(config.token).toBe("my-token");
89
+ expect(config.ssl).toBe(true);
90
+ });
91
+ it("should allow username/password config", () => {
92
+ const config = {
93
+ address: "localhost:19530",
94
+ username: "root",
95
+ password: "milvus",
96
+ };
97
+ expect(config.username).toBe("root");
98
+ expect(config.password).toBe("milvus");
99
+ });
100
+ });
101
+ describe("CLIOptions", () => {
102
+ it("should allow empty options", () => {
103
+ const options = {};
104
+ expect(options.config).toBeUndefined();
105
+ expect(options.force).toBeUndefined();
106
+ });
107
+ it("should allow all options", () => {
108
+ const options = {
109
+ config: "./custom-config.ts",
110
+ force: true,
111
+ };
112
+ expect(options.config).toBe("./custom-config.ts");
113
+ expect(options.force).toBe(true);
114
+ });
115
+ });
116
+ describe("IndexResult", () => {
117
+ it("should represent completed indexing", () => {
118
+ const result = {
119
+ indexedFiles: 100,
120
+ totalChunks: 500,
121
+ status: "completed",
122
+ };
123
+ expect(result.indexedFiles).toBe(100);
124
+ expect(result.totalChunks).toBe(500);
125
+ expect(result.status).toBe("completed");
126
+ });
127
+ it("should represent limit_reached status", () => {
128
+ const result = {
129
+ indexedFiles: 50,
130
+ totalChunks: 450000,
131
+ status: "limit_reached",
132
+ };
133
+ expect(result.status).toBe("limit_reached");
134
+ });
135
+ });
136
+ });
137
+ //# sourceMappingURL=types.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.test.js","sourceRoot":"","sources":["../src/types.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAS9C,QAAQ,CAAC,OAAO,EAAE,GAAG,EAAE;IACrB,QAAQ,CAAC,eAAe,EAAE,GAAG,EAAE;QAC7B,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;YAC7C,MAAM,MAAM,GAAkB;gBAC5B,eAAe,EAAE;oBACf,MAAM,EAAE,UAAU;oBAClB,KAAK,EAAE,wBAAwB;iBAChC;gBACD,oBAAoB,EAAE;oBACpB,OAAO,EAAE,iBAAiB;iBAC3B;aACF,CAAC;YAEF,MAAM,CAAC,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,CAAC,IAAI,CAAC,UAA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CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,oBAAoB,CAAC,CAAC;YAClD,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;IAEH,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3B,EAAE,CAAC,qCAAqC,EAAE,GAAG,EAAE;YAC7C,MAAM,MAAM,GAAgB;gBAC1B,YAAY,EAAE,GAAG;gBACjB,WAAW,EAAE,GAAG;gBAChB,MAAM,EAAE,WAAW;aACpB,CAAC;YAEF,MAAM,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACtC,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACrC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,uCAAuC,EAAE,GAAG,EAAE;YAC/C,MAAM,MAAM,GAAgB;gBAC1B,YAAY,EAAE,EAAE;gBAChB,WAAW,EAAE,MAAM;gBACnB,MAAM,EAAE,eAAe;aACxB,CAAC;YAEF,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC;QAC9C,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,50 @@
1
+ {
2
+ "name": "@mcampa/ai-context-cli",
3
+ "version": "0.0.1-beta.c518c19",
4
+ "description": "CLI tool for indexing codebases with AI Context",
5
+ "type": "module",
6
+ "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "bin": {
9
+ "ai-context-index": "./bin/ai-context-index.js"
10
+ },
11
+ "dependencies": {
12
+ "@mcampa/ai-context-core": "0.0.1-beta.c518c19",
13
+ "commander": "^12.1.0",
14
+ "tsx": "^4.19.4"
15
+ },
16
+ "devDependencies": {
17
+ "@types/node": "^20.0.0",
18
+ "typescript": "^5.0.0",
19
+ "vitest": "^2.1.0"
20
+ },
21
+ "files": [
22
+ "dist",
23
+ "bin",
24
+ "README.md"
25
+ ],
26
+ "repository": {
27
+ "type": "git",
28
+ "url": "https://github.com/mcampa/claude-context.git",
29
+ "directory": "packages/cli"
30
+ },
31
+ "license": "MIT",
32
+ "publishConfig": {
33
+ "access": "public"
34
+ },
35
+ "engines": {
36
+ "node": ">=20.0.0"
37
+ },
38
+ "scripts": {
39
+ "build": "pnpm clean && tsc --build --force",
40
+ "dev": "tsx --watch src/index.ts",
41
+ "clean": "rimraf dist",
42
+ "lint": "eslint src",
43
+ "lint:fix": "eslint src --fix",
44
+ "typecheck": "tsc --noEmit",
45
+ "test": "vitest run",
46
+ "test:watch": "vitest",
47
+ "test:coverage": "vitest run --coverage",
48
+ "start": "tsx src/index.ts"
49
+ }
50
+ }