infiniloom-node 0.1.0 → 0.3.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 CHANGED
@@ -1,4 +1,4 @@
1
- # @infiniloom/node
1
+ # infiniloom-node
2
2
 
3
3
  Node.js bindings for Infiniloom - Repository context engine for LLMs.
4
4
 
@@ -13,15 +13,25 @@ Node.js bindings for Infiniloom - Repository context engine for LLMs.
13
13
 
14
14
  ## Installation
15
15
 
16
- Phase 2 (not implemented intentionally): `npm install @infiniloom/node` (npm release).
17
- For now, build from source in this repository.
16
+ ```bash
17
+ npm install infiniloom-node
18
+ ```
19
+
20
+ ### Building from Source
21
+
22
+ ```bash
23
+ git clone https://github.com/Topos-Labs/infiniloom.git
24
+ cd infiniloom/bindings/node
25
+ npm install
26
+ npm run build
27
+ ```
18
28
 
19
29
  ## Quick Start
20
30
 
21
31
  ### Simple Packing
22
32
 
23
33
  ```javascript
24
- const { pack } = require('@infiniloom/node');
34
+ const { pack } = require('infiniloom-node');
25
35
 
26
36
  // Pack a repository with default settings
27
37
  const context = pack('./my-repo');
@@ -31,12 +41,12 @@ console.log(context);
31
41
  ### With Options
32
42
 
33
43
  ```javascript
34
- const { pack } = require('@infiniloom/node');
44
+ const { pack } = require('infiniloom-node');
35
45
 
36
46
  const context = pack('./my-repo', {
37
- format: 'xml', // Output format: 'xml', 'markdown', 'json', or 'yaml'
38
- model: 'claude', // Target model: 'claude', 'gpt-5.2', 'o3', 'gpt-4o', 'gemini', 'llama', etc.
39
- compression: 'balanced', // Compression: 'none', 'minimal', 'balanced', 'aggressive', 'extreme'
47
+ format: 'xml', // Output format: 'xml', 'markdown', 'json', 'yaml', 'toon', or 'plain'
48
+ model: 'claude', // Target model: 'gpt-5.2', 'gpt-5.1', 'gpt-5', 'o3', 'gpt-4o', 'claude', 'gemini', 'llama', etc.
49
+ compression: 'balanced', // Compression: 'none', 'minimal', 'balanced', 'aggressive', 'extreme', 'focused', 'semantic'
40
50
  mapBudget: 2000, // Token budget for repository map
41
51
  maxSymbols: 50, // Maximum symbols to include in map
42
52
  skipSecurity: false, // Skip security scanning
@@ -48,7 +58,7 @@ const context = pack('./my-repo', {
48
58
  ### Repository Scanning
49
59
 
50
60
  ```javascript
51
- const { scan } = require('@infiniloom/node');
61
+ const { scan } = require('infiniloom-node');
52
62
 
53
63
  const stats = scan('./my-repo', 'claude');
54
64
  console.log(`Repository: ${stats.name}`);
@@ -62,7 +72,7 @@ console.log(`Languages:`, stats.languages);
62
72
  ### Token Counting
63
73
 
64
74
  ```javascript
65
- const { countTokens } = require('@infiniloom/node');
75
+ const { countTokens } = require('infiniloom-node');
66
76
 
67
77
  const count = countTokens('Hello, world!', 'claude');
68
78
  console.log(`Tokens: ${count}`);
@@ -71,7 +81,7 @@ console.log(`Tokens: ${count}`);
71
81
  ### Semantic Compression
72
82
 
73
83
  ```javascript
74
- const { semanticCompress } = require('@infiniloom/node');
84
+ const { semanticCompress } = require('infiniloom-node');
75
85
 
76
86
  // Compress text while preserving important content
77
87
  const longText = '... your long text content ...';
@@ -86,7 +96,7 @@ console.log(compressed);
86
96
  ### Advanced Usage with Infiniloom Class
87
97
 
88
98
  ```javascript
89
- const { Infiniloom } = require('@infiniloom/node');
99
+ const { Infiniloom } = require('infiniloom-node');
90
100
 
91
101
  // Create an Infiniloom instance
92
102
  const loom = new Infiniloom('./my-repo', 'claude');
@@ -159,6 +169,41 @@ Compress text using semantic compression while preserving important content.
159
169
 
160
170
  **Returns:** Compressed text
161
171
 
172
+ #### `scanSecurity(path: string): SecurityFinding[]`
173
+
174
+ Scan a repository for security issues (hardcoded secrets, API keys, etc.).
175
+
176
+ **Parameters:**
177
+ - `path` - Path to repository root
178
+
179
+ **Returns:** Array of security findings
180
+
181
+ ```javascript
182
+ const { scanSecurity } = require('infiniloom-node');
183
+
184
+ const findings = scanSecurity('./my-repo');
185
+ for (const finding of findings) {
186
+ console.log(`${finding.severity}: ${finding.kind} in ${finding.file}:${finding.line}`);
187
+ }
188
+ ```
189
+
190
+ #### `isGitRepo(path: string): boolean`
191
+
192
+ Check if a path is a git repository.
193
+
194
+ **Parameters:**
195
+ - `path` - Path to check
196
+
197
+ **Returns:** `true` if path is a git repository, `false` otherwise
198
+
199
+ ```javascript
200
+ const { isGitRepo } = require('infiniloom-node');
201
+
202
+ if (isGitRepo('./my-project')) {
203
+ console.log('This is a git repository');
204
+ }
205
+ ```
206
+
162
207
  ### Types
163
208
 
164
209
  #### `PackOptions`
@@ -166,7 +211,7 @@ Compress text using semantic compression while preserving important content.
166
211
  ```typescript
167
212
  interface PackOptions {
168
213
  format?: string; // "xml", "markdown", "json", "yaml", "toon", or "plain"
169
- model?: string; // "claude", "gpt-4o", "gpt-4", "gemini", "llama", etc.
214
+ model?: string; // "gpt-5.2", "gpt-5.1", "gpt-5", "o3", "gpt-4o", "claude", "gemini", "llama", etc.
170
215
  compression?: string; // "none", "minimal", "balanced", "aggressive", "extreme", "focused", "semantic"
171
216
  mapBudget?: number; // Token budget for repository map
172
217
  maxSymbols?: number; // Maximum number of symbols in map
@@ -201,6 +246,64 @@ interface LanguageStat {
201
246
  }
202
247
  ```
203
248
 
249
+ #### `SecurityFinding`
250
+
251
+ ```typescript
252
+ interface SecurityFinding {
253
+ file: string; // File where the finding was detected
254
+ line: number; // Line number (1-indexed)
255
+ severity: string; // "Critical", "High", "Medium", "Low", "Info"
256
+ kind: string; // Type of finding (e.g., "aws_access_key", "github_token")
257
+ pattern: string; // The matched pattern
258
+ }
259
+ ```
260
+
261
+ #### `GitCommit`
262
+
263
+ ```typescript
264
+ interface GitCommit {
265
+ hash: string; // Full commit hash (40 characters)
266
+ shortHash: string; // Short commit hash (7 characters)
267
+ author: string; // Author name
268
+ email: string; // Author email
269
+ date: string; // Commit date (ISO 8601 format)
270
+ message: string; // Commit message (first line)
271
+ }
272
+ ```
273
+
274
+ #### `GitFileStatus`
275
+
276
+ ```typescript
277
+ interface GitFileStatus {
278
+ path: string; // File path
279
+ oldPath?: string; // Old path (for renames)
280
+ status: string; // "Added", "Modified", "Deleted", "Renamed", "Copied", "Unknown"
281
+ }
282
+ ```
283
+
284
+ #### `GitChangedFile`
285
+
286
+ ```typescript
287
+ interface GitChangedFile {
288
+ path: string; // File path
289
+ oldPath?: string; // Old path (for renames)
290
+ status: string; // "Added", "Modified", "Deleted", "Renamed", "Copied"
291
+ additions: number; // Number of lines added
292
+ deletions: number; // Number of lines deleted
293
+ }
294
+ ```
295
+
296
+ #### `GitBlameLine`
297
+
298
+ ```typescript
299
+ interface GitBlameLine {
300
+ commit: string; // Commit hash that introduced the line
301
+ author: string; // Author who wrote the line
302
+ date: string; // Date when line was written
303
+ lineNumber: number; // Line number (1-indexed)
304
+ }
305
+ ```
306
+
204
307
  ### Infiniloom Class
205
308
 
206
309
  #### `new Infiniloom(path: string, model?: string)`
@@ -223,13 +326,192 @@ Pack repository with specific options.
223
326
 
224
327
  Check for security issues and return findings.
225
328
 
329
+ ### GitRepo Class
330
+
331
+ Git repository wrapper for accessing git operations like status, diff, log, and blame.
332
+
333
+ #### `new GitRepo(path: string)`
334
+
335
+ Open a git repository.
336
+
337
+ **Parameters:**
338
+ - `path` - Path to the repository
339
+
340
+ **Throws:** Error if path is not a git repository
341
+
342
+ #### `currentBranch(): string`
343
+
344
+ Get the current branch name.
345
+
346
+ **Returns:** Current branch name (e.g., "main", "feature/xyz")
347
+
348
+ #### `currentCommit(): string`
349
+
350
+ Get the current commit hash.
351
+
352
+ **Returns:** Full SHA-1 hash of HEAD commit (40 characters)
353
+
354
+ #### `status(): GitFileStatus[]`
355
+
356
+ Get working tree status (both staged and unstaged changes).
357
+
358
+ **Returns:** Array of file status objects
359
+
360
+ #### `log(count?: number): GitCommit[]`
361
+
362
+ Get recent commits.
363
+
364
+ **Parameters:**
365
+ - `count` - Maximum number of commits to return (default: 10)
366
+
367
+ **Returns:** Array of commit objects
368
+
369
+ #### `fileLog(path: string, count?: number): GitCommit[]`
370
+
371
+ Get commits that modified a specific file.
372
+
373
+ **Parameters:**
374
+ - `path` - File path relative to repo root
375
+ - `count` - Maximum number of commits (default: 10)
376
+
377
+ **Returns:** Array of commits that modified the file
378
+
379
+ #### `blame(path: string): GitBlameLine[]`
380
+
381
+ Get blame information for a file.
382
+
383
+ **Parameters:**
384
+ - `path` - File path relative to repo root
385
+
386
+ **Returns:** Array of blame line objects
387
+
388
+ #### `lsFiles(): string[]`
389
+
390
+ Get list of files tracked by git.
391
+
392
+ **Returns:** Array of file paths
393
+
394
+ #### `diffFiles(fromRef: string, toRef: string): GitChangedFile[]`
395
+
396
+ Get files changed between two commits.
397
+
398
+ **Parameters:**
399
+ - `fromRef` - Starting commit/branch/tag
400
+ - `toRef` - Ending commit/branch/tag
401
+
402
+ **Returns:** Array of changed files with diff stats
403
+
404
+ #### `uncommittedDiff(path: string): string`
405
+
406
+ Get diff content for uncommitted changes in a file.
407
+
408
+ **Parameters:**
409
+ - `path` - File path relative to repo root
410
+
411
+ **Returns:** Unified diff content
412
+
413
+ #### `allUncommittedDiffs(): string`
414
+
415
+ Get diff for all uncommitted changes.
416
+
417
+ **Returns:** Combined unified diff for all changed files
418
+
419
+ #### `hasChanges(path: string): boolean`
420
+
421
+ Check if a file has uncommitted changes.
422
+
423
+ **Parameters:**
424
+ - `path` - File path relative to repo root
425
+
426
+ **Returns:** `true` if file has changes
427
+
428
+ #### `lastModifiedCommit(path: string): GitCommit`
429
+
430
+ Get the last commit that modified a file.
431
+
432
+ **Parameters:**
433
+ - `path` - File path relative to repo root
434
+
435
+ **Returns:** Commit information object
436
+
437
+ #### `fileChangeFrequency(path: string, days?: number): number`
438
+
439
+ Get file change frequency in recent days.
440
+
441
+ **Parameters:**
442
+ - `path` - File path relative to repo root
443
+ - `days` - Number of days to look back (default: 30)
444
+
445
+ **Returns:** Number of commits that modified the file in the period
446
+
447
+ **Example:**
448
+
449
+ ```javascript
450
+ const { GitRepo, isGitRepo } = require('infiniloom-node');
451
+
452
+ // Check if path is a git repo first
453
+ if (isGitRepo('./my-project')) {
454
+ const repo = new GitRepo('./my-project');
455
+
456
+ // Get current state
457
+ console.log(`Branch: ${repo.currentBranch()}`);
458
+ console.log(`Commit: ${repo.currentCommit()}`);
459
+
460
+ // Get recent commits
461
+ for (const commit of repo.log(5)) {
462
+ console.log(`${commit.shortHash}: ${commit.message}`);
463
+ }
464
+
465
+ // Get file history
466
+ for (const commit of repo.fileLog('src/index.js', 3)) {
467
+ console.log(`${commit.date}: ${commit.message}`);
468
+ }
469
+
470
+ // Get blame information
471
+ for (const line of repo.blame('src/index.js').slice(0, 10)) {
472
+ console.log(`Line ${line.lineNumber}: ${line.author}`);
473
+ }
474
+
475
+ // Check for uncommitted changes
476
+ if (repo.hasChanges('src/index.js')) {
477
+ const diff = repo.uncommittedDiff('src/index.js');
478
+ console.log(diff);
479
+ }
480
+
481
+ // Compare branches
482
+ const changes = repo.diffFiles('main', 'feature');
483
+ for (const file of changes) {
484
+ console.log(`${file.status}: ${file.path} (+${file.additions}/-${file.deletions})`);
485
+ }
486
+ }
487
+ ```
488
+
226
489
  ## Supported Models
227
490
 
228
- - **Claude** - Anthropic's Claude models
229
- - **GPT-4o** - OpenAI's GPT-4o
230
- - **GPT-4** - OpenAI's GPT-4
491
+ ### OpenAI GPT-5.x Series (Latest)
492
+ - **GPT-5.2** / **GPT-5.2-Pro** - Latest GPT-5.2 models (o200k_base tokenizer)
493
+ - **GPT-5.1** / **GPT-5.1-Mini** / **GPT-5.1-Codex** - GPT-5.1 series
494
+ - **GPT-5** / **GPT-5-Mini** / **GPT-5-Nano** - GPT-5 base series
495
+
496
+ ### OpenAI O-Series (Reasoning Models)
497
+ - **O4-mini** - Latest O4 reasoning model
498
+ - **O3** / **O3-mini** - O3 reasoning models
499
+ - **O1** / **O1-mini** / **O1-preview** - O1 reasoning models
500
+
501
+ ### OpenAI GPT-4 Series
502
+ - **GPT-4o** / **GPT-4o-mini** - GPT-4o models (o200k_base tokenizer)
503
+ - **GPT-4** - GPT-4 (cl100k_base tokenizer)
504
+ - **GPT-3.5-turbo** - GPT-3.5
505
+
506
+ ### Other Providers
507
+ - **Claude** - Anthropic's Claude models (default)
231
508
  - **Gemini** - Google's Gemini
232
- - **Llama** - Meta's Llama
509
+ - **Llama** / **CodeLlama** - Meta's Llama models
510
+ - **Mistral** - Mistral AI
511
+ - **DeepSeek** - DeepSeek
512
+ - **Qwen** - Alibaba Qwen
513
+ - **Cohere** - Cohere Command R+
514
+ - **Grok** - xAI Grok
233
515
 
234
516
  ## Compression Levels
235
517
 
@@ -289,5 +571,5 @@ MIT
289
571
  ## Links
290
572
 
291
573
  - [GitHub Repository](https://github.com/Topos-Labs/infiniloom)
292
- - [Documentation](https://infiniloom.dev/docs)
293
- - [npm Package](https://www.npmjs.com/package/@infiniloom/node)
574
+ - [Documentation](https://toposlabs.ai/infiniloom/)
575
+ - [npm Package](https://www.npmjs.com/package/infiniloom-node)
package/index.d.ts CHANGED
@@ -3,11 +3,44 @@
3
3
 
4
4
  /* auto-generated by NAPI-RS */
5
5
 
6
+ /** Security finding information */
7
+ export interface SecurityFinding {
8
+ /** File where the finding was detected */
9
+ file: string
10
+ /** Line number (1-indexed) */
11
+ line: number
12
+ /** Severity level: "Critical", "High", "Medium", "Low", "Info" */
13
+ severity: string
14
+ /** Type of finding */
15
+ kind: string
16
+ /** Matched pattern */
17
+ pattern: string
18
+ }
19
+ /**
20
+ * Scan a repository for security issues
21
+ *
22
+ * # Arguments
23
+ * * `path` - Path to repository root
24
+ *
25
+ * # Returns
26
+ * Array of security findings
27
+ *
28
+ * # Example
29
+ * ```javascript
30
+ * const { scanSecurity } = require('infiniloom-node');
31
+ *
32
+ * const findings = scanSecurity('./my-repo');
33
+ * for (const finding of findings) {
34
+ * console.log(`${finding.severity}: ${finding.kind} in ${finding.file}:${finding.line}`);
35
+ * }
36
+ * ```
37
+ */
38
+ export declare function scanSecurity(path: string): Array<SecurityFinding>
6
39
  /** Options for packing a repository */
7
40
  export interface PackOptions {
8
- /** Output format: "xml", "markdown", "json", or "yaml" */
41
+ /** Output format: "xml", "markdown", "json", "yaml", "toon", or "plain" */
9
42
  format?: string
10
- /** Target model: "claude", "gpt-4o", "gpt-4", "gemini", or "llama" */
43
+ /** Target model: "claude", "gpt-5.2", "gpt-5.1", "gpt-5", "o4-mini", "o3", "o1", "gpt-4o", "gpt-4", "gemini", "llama", "mistral", "deepseek", "qwen", "cohere", "grok" */
11
44
  model?: string
12
45
  /** Compression level: "none", "minimal", "balanced", "aggressive", "extreme", "focused", "semantic" */
13
46
  compression?: string
package/index.js CHANGED
@@ -310,7 +310,7 @@ if (!nativeBinding) {
310
310
  throw new Error(`Failed to load native binding`)
311
311
  }
312
312
 
313
- const { pack, scan, countTokens, Infiniloom, semanticCompress, isGitRepo, GitRepo } = nativeBinding
313
+ const { pack, scan, countTokens, Infiniloom, semanticCompress, isGitRepo, GitRepo, scanSecurity } = nativeBinding
314
314
 
315
315
  module.exports.pack = pack
316
316
  module.exports.scan = scan
@@ -319,3 +319,4 @@ module.exports.Infiniloom = Infiniloom
319
319
  module.exports.semanticCompress = semanticCompress
320
320
  module.exports.isGitRepo = isGitRepo
321
321
  module.exports.GitRepo = GitRepo
322
+ module.exports.scanSecurity = scanSecurity
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "infiniloom-node",
3
- "version": "0.1.0",
3
+ "version": "0.3.0",
4
4
  "description": "Node.js bindings for infiniloom - Repository context engine for LLMs",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
@@ -62,5 +62,5 @@
62
62
  "bugs": {
63
63
  "url": "https://github.com/Topos-Labs/infiniloom/issues"
64
64
  },
65
- "homepage": "https://github.com/Topos-Labs/infiniloom#readme"
65
+ "homepage": "https://toposlabs.ai/infiniloom/"
66
66
  }