@cesarandreslopez/occ 0.4.1 → 0.5.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 (2) hide show
  1. package/README.md +25 -0
  2. package/package.json +16 -1
package/README.md CHANGED
@@ -231,6 +231,31 @@ Highlights of the current code exploration behavior:
231
231
 
232
232
  All `occ code` commands support `--format tabular|json`. Most symbol-targeted commands also support `--file` for disambiguation, and JSON output includes repository metadata, query metadata, results, repository stats, and per-language capability flags.
233
233
 
234
+ ## Programmatic Usage
235
+
236
+ The code exploration module is available as a library via subpath exports:
237
+
238
+ ```ts
239
+ import { buildCodebaseIndex } from '@cesarandreslopez/occ/code/build';
240
+ import { discoverCodeFiles } from '@cesarandreslopez/occ/code/discover';
241
+ import { findByName, analyzeCalls } from '@cesarandreslopez/occ/code/query';
242
+ import type { CodebaseIndex, CodeNode } from '@cesarandreslopez/occ/code/types';
243
+
244
+ const index = await buildCodebaseIndex({ repoRoot: './my-repo' });
245
+ const results = findByName(index, 'UserService');
246
+ ```
247
+
248
+ Available subpath exports:
249
+
250
+ | Import path | Description |
251
+ |-------------|-------------|
252
+ | `@cesarandreslopez/occ/code/build` | `buildCodebaseIndex` — graph construction |
253
+ | `@cesarandreslopez/occ/code/types` | TypeScript types (`CodebaseIndex`, `CodeNode`, `CodeEdge`, etc.) |
254
+ | `@cesarandreslopez/occ/code/query` | Query functions (`findByName`, `analyzeCalls`, `analyzeDeps`, etc.) |
255
+ | `@cesarandreslopez/occ/code/discover` | `discoverCodeFiles` — file discovery |
256
+
257
+ TypeScript is an optional peer dependency (`>=5.0.0`). If you use the code exploration module programmatically, ensure TypeScript is available in your project.
258
+
234
259
  ## Document Inspection
235
260
 
236
261
  `occ doc inspect` extracts metadata, risk flags, content stats, heading structure, and a content preview from DOCX and ODT documents.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cesarandreslopez/occ",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Office Cloc and Count — scc-style summary tables for office documents",
5
5
  "type": "module",
6
6
  "bin": {
@@ -32,6 +32,13 @@
32
32
  "scc",
33
33
  "cli"
34
34
  ],
35
+ "exports": {
36
+ ".": "./dist/bin/occ.js",
37
+ "./code/build": "./dist/src/code/build.js",
38
+ "./code/types": "./dist/src/code/types.js",
39
+ "./code/query": "./dist/src/code/query.js",
40
+ "./code/discover": "./dist/src/code/discover.js"
41
+ },
35
42
  "files": [
36
43
  "dist/",
37
44
  "scripts/postinstall.js"
@@ -60,6 +67,14 @@
60
67
  "xlsx": "https://cdn.sheetjs.com/xlsx-0.20.3/xlsx-0.20.3.tgz",
61
68
  "zod": "^4.3.6"
62
69
  },
70
+ "peerDependencies": {
71
+ "typescript": ">=5.0.0"
72
+ },
73
+ "peerDependenciesMeta": {
74
+ "typescript": {
75
+ "optional": true
76
+ }
77
+ },
63
78
  "devDependencies": {
64
79
  "@types/node": "^25.3.5",
65
80
  "@types/turndown": "^5.0.6",