@cesarandreslopez/occ 0.6.1 → 0.6.2

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,116 @@
1
+ import { writeFile } from 'node:fs/promises';
2
+ import path from 'node:path';
3
+ import { z } from 'zod';
4
+ import { analyzeWorkspace } from './analyze.js';
5
+ import { inspectWorkspaceDocumentSet } from './documents.js';
6
+ import { writeStream } from '../utils.js';
7
+ const WorkspaceCommandOptionsSchema = z.object({
8
+ format: z.string().optional(),
9
+ output: z.string().optional(),
10
+ excludeDir: z.string().optional(),
11
+ largeFileLimit: z.string().optional(),
12
+ gitignore: z.boolean().optional(),
13
+ code: z.boolean().optional(),
14
+ documents: z.boolean().optional(),
15
+ structures: z.boolean().optional(),
16
+ maxFiles: z.string().optional(),
17
+ maxReferenceFiles: z.string().optional(),
18
+ includeMarkdown: z.boolean().optional(),
19
+ }).passthrough();
20
+ function getOptions(command) {
21
+ return WorkspaceCommandOptionsSchema.parse(command.optsWithGlobals());
22
+ }
23
+ async function emit(output, options) {
24
+ if (options.output) {
25
+ await writeFile(options.output, output);
26
+ return;
27
+ }
28
+ await writeStream(process.stdout, output);
29
+ }
30
+ function parsePositiveInt(value, fallback) {
31
+ const parsed = Number.parseInt(value ?? '', 10);
32
+ return Number.isFinite(parsed) && parsed > 0 ? parsed : fallback;
33
+ }
34
+ function formatWorkspaceAnalysis(result) {
35
+ const lines = [];
36
+ lines.push(`Workspace: ${result.rootDir}`);
37
+ lines.push(`Elapsed: ${result.summary.elapsedMs}ms`);
38
+ if (result.code) {
39
+ lines.push(`Code: ${result.summary.code?.totalFiles ?? 0} files, ${result.summary.code?.totalLines ?? 0} lines, ${result.code.languages.length} language rows`);
40
+ }
41
+ if (result.documents) {
42
+ lines.push(`Documents: ${result.documents.aggregates.totals.files} files, ${result.documents.aggregates.totals.words} words`);
43
+ }
44
+ lines.push(`Structures: ${result.structures.length}`);
45
+ if (result.skipped.length > 0)
46
+ lines.push(`Skipped: ${result.skipped.length}`);
47
+ if (result.errors.length > 0)
48
+ lines.push(`Errors: ${result.errors.length}`);
49
+ return lines.join('\n');
50
+ }
51
+ function formatWorkspaceDocumentSet(result) {
52
+ const lines = [];
53
+ lines.push(`Workspace: ${result.rootDir}`);
54
+ lines.push(`Documents: ${result.documents.length}`);
55
+ lines.push(`Cross references: ${result.crossReferences.length}`);
56
+ lines.push(`Unresolved mentions: ${result.unresolvedMentions.length}`);
57
+ if (result.skipped.length > 0)
58
+ lines.push(`Skipped: ${result.skipped.length}`);
59
+ if (result.errors.length > 0)
60
+ lines.push(`Errors: ${result.errors.length}`);
61
+ return lines.join('\n');
62
+ }
63
+ export function registerWorkspaceCommands(program) {
64
+ const workspace = program.command('workspace').description('Workspace-level analysis and document context helpers');
65
+ const analyze = workspace.command('analyze [rootDir]').description('Analyze workspace code, documents, and structures with a versioned JSON contract');
66
+ analyze
67
+ .option('--format <type>', 'output format: tabular or json', 'json')
68
+ .option('-o, --output <file>', 'write output to file')
69
+ .option('--exclude-dir <dirs>', 'directories to skip (comma-separated)', 'node_modules,.git,dist,vendor,build,coverage,target')
70
+ .option('--large-file-limit <mb>', 'skip files over this size in MB', '50')
71
+ .option('--no-gitignore', 'disable .gitignore respect')
72
+ .option('--no-code', 'skip code analysis')
73
+ .option('--no-documents', 'skip document analysis')
74
+ .option('--no-structures', 'skip structure extraction');
75
+ analyze.action(async (rootDir, _opts, command) => {
76
+ const options = getOptions(command);
77
+ const result = await analyzeWorkspace(path.resolve(rootDir ?? process.cwd()), {
78
+ excludeDir: options.excludeDir?.split(',').map((item) => item.trim()).filter(Boolean),
79
+ noGitignore: options.gitignore === false,
80
+ largeFileLimitMb: parsePositiveInt(options.largeFileLimit, 50),
81
+ includeCode: options.code !== false,
82
+ includeDocuments: options.documents !== false,
83
+ includeStructures: options.structures !== false,
84
+ });
85
+ const output = options.format === 'tabular'
86
+ ? formatWorkspaceAnalysis(result)
87
+ : JSON.stringify(result, null, 2);
88
+ await emit(output.endsWith('\n') ? output : `${output}\n`, options);
89
+ });
90
+ const documents = workspace.command('documents [rootDir]').description('Inspect workspace document summaries and cross-document references');
91
+ documents
92
+ .option('--format <type>', 'output format: tabular or json', 'json')
93
+ .option('-o, --output <file>', 'write output to file')
94
+ .option('--exclude-dir <dirs>', 'directories to skip (comma-separated)', 'node_modules,.git,dist,vendor,build,coverage,target')
95
+ .option('--large-file-limit <mb>', 'skip files over this size in MB', '50')
96
+ .option('--no-gitignore', 'disable .gitignore respect')
97
+ .option('--max-files <n>', 'maximum documents to inspect', '50')
98
+ .option('--max-reference-files <n>', 'maximum documents to convert for cross-reference detection', '20')
99
+ .option('--include-markdown', 'include markdown content in per-document summaries');
100
+ documents.action(async (rootDir, _opts, command) => {
101
+ const options = getOptions(command);
102
+ const result = await inspectWorkspaceDocumentSet(path.resolve(rootDir ?? process.cwd()), {
103
+ excludeDir: options.excludeDir?.split(',').map((item) => item.trim()).filter(Boolean),
104
+ noGitignore: options.gitignore === false,
105
+ largeFileLimitMb: parsePositiveInt(options.largeFileLimit, 50),
106
+ maxFiles: parsePositiveInt(options.maxFiles, 50),
107
+ maxReferenceFiles: parsePositiveInt(options.maxReferenceFiles, 20),
108
+ includeMarkdown: options.includeMarkdown === true,
109
+ });
110
+ const output = options.format === 'tabular'
111
+ ? formatWorkspaceDocumentSet(result)
112
+ : JSON.stringify(result, null, 2);
113
+ await emit(output.endsWith('\n') ? output : `${output}\n`, options);
114
+ });
115
+ }
116
+ //# sourceMappingURL=command.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"command.js","sourceRoot":"","sources":["../../../src/workspace/command.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAC7C,OAAO,IAAI,MAAM,WAAW,CAAC;AAE7B,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,E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YACrF,WAAW,EAAE,OAAO,CAAC,SAAS,KAAK,KAAK;YACxC,gBAAgB,EAAE,gBAAgB,CAAC,OAAO,CAAC,cAAc,EAAE,EAAE,CAAC;YAC9D,QAAQ,EAAE,gBAAgB,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC;YAChD,iBAAiB,EAAE,gBAAgB,CAAC,OAAO,CAAC,iBAAiB,EAAE,EAAE,CAAC;YAClE,eAAe,EAAE,OAAO,CAAC,eAAe,KAAK,IAAI;SAClD,CAAC,CAAC;QACH,MAAM,MAAM,GAAG,OAAO,CAAC,MAAM,KAAK,SAAS;YACzC,CAAC,CAAC,0BAA0B,CAAC,MAAM,CAAC;YACpC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC;QACpC,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,IAAI,EAAE,OAAO,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { WorkspaceDocumentSet } from './types.js';
2
+ export interface InspectWorkspaceDocumentSetOptions {
3
+ excludeDir?: string[];
4
+ noGitignore?: boolean;
5
+ largeFileLimitMb?: number;
6
+ maxFiles?: number;
7
+ maxReferenceFiles?: number;
8
+ includeMarkdown?: boolean;
9
+ }
10
+ export declare function inspectWorkspaceDocumentSet(rootDir: string, options?: InspectWorkspaceDocumentSetOptions): Promise<WorkspaceDocumentSet>;
@@ -0,0 +1,68 @@
1
+ import path from 'node:path';
2
+ import { findFiles } from '../walker.js';
3
+ import { getExtension } from '../utils.js';
4
+ import { documentToMarkdown } from '../markdown/convert.js';
5
+ import { detectCrossReferences } from '../doc/references.js';
6
+ import { inspectDocumentSummary } from '../doc/batch.js';
7
+ const DOCUMENT_FORMATS = new Set(['docx', 'pdf', 'pptx', 'xlsx', 'odt', 'ods', 'odp']);
8
+ export async function inspectWorkspaceDocumentSet(rootDir, options = {}) {
9
+ const resolvedRoot = path.resolve(rootDir);
10
+ const excludeDir = options.excludeDir ?? ['node_modules', '.git', 'dist', 'vendor', 'build', 'coverage', 'target'];
11
+ const discovery = await findFiles([resolvedRoot], {
12
+ excludeDir,
13
+ noGitignore: options.noGitignore,
14
+ largeFileLimit: options.largeFileLimitMb ?? 50,
15
+ });
16
+ const maxFiles = options.maxFiles ?? 50;
17
+ const includeMarkdown = options.includeMarkdown ?? false;
18
+ const maxReferenceFiles = options.maxReferenceFiles ?? 20;
19
+ const errors = [];
20
+ const documents = [];
21
+ const markdownByPath = new Map();
22
+ const discovered = discovery.files
23
+ .filter((file) => DOCUMENT_FORMATS.has(getExtension(file.path)))
24
+ .slice(0, maxFiles);
25
+ for (const file of discovered) {
26
+ const relativePath = path.relative(resolvedRoot, file.path).split(path.sep).join('/');
27
+ const format = getExtension(file.path);
28
+ const result = await inspectDocumentSummary(file.path, relativePath, format, { includeMarkdown });
29
+ documents.push(result.summary);
30
+ if (result.markdownContent) {
31
+ markdownByPath.set(file.path, result.markdownContent);
32
+ }
33
+ if (result.error) {
34
+ errors.push({
35
+ path: file.path,
36
+ message: result.error,
37
+ });
38
+ }
39
+ }
40
+ const docsWithContent = [];
41
+ for (const doc of documents.slice(0, maxReferenceFiles)) {
42
+ try {
43
+ const content = doc.markdownContent ?? markdownByPath.get(doc.filePath) ?? await documentToMarkdown(doc.filePath);
44
+ if (content)
45
+ docsWithContent.push({ filePath: doc.filePath, content });
46
+ }
47
+ catch (err) {
48
+ const error = err;
49
+ errors.push({
50
+ path: doc.filePath,
51
+ message: error.message,
52
+ });
53
+ }
54
+ }
55
+ const references = docsWithContent.length >= 2
56
+ ? detectCrossReferences(docsWithContent)
57
+ : { references: [], unresolvedMentions: [] };
58
+ return {
59
+ schemaVersion: 1,
60
+ rootDir: resolvedRoot,
61
+ documents,
62
+ crossReferences: references.references,
63
+ unresolvedMentions: references.unresolvedMentions,
64
+ skipped: discovery.skipped,
65
+ errors,
66
+ };
67
+ }
68
+ //# sourceMappingURL=documents.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"documents.js","sourceRoot":"","sources":["../../../src/workspace/documents.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzC,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,sBAAsB,EAAE,MAAM,iBAAiB,CAAC;AAGzD,MAAM,gBAAgB,GAAG,IAAI,GAAG,CAAC,CAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,CAAC,CAAC;AAWvF,MAAM,CAAC,KAAK,UAAU,2BAA2B,CAC/C,OAAe,EACf,UAA8C,EAAE;IAEhD,MAAM,YAAY,GAAG,IAAI,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IAC3C,MAAM,UAAU,GAAG,OAAO,CAAC,UAAU,IAAI,CAAC,cAAc,EAAE,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,QAAQ,CAAC,CAAC;IACnH,MAAM,SAAS,GAAG,MAAM,SAAS,CAAC,CAAC,YAAY,CAAC,EAAE;QAChD,UAAU;QACV,WAAW,EAAE,OAAO,CAAC,WAAW;QAChC,cAAc,EAAE,OAAO,CAAC,gBAAgB,IAAI,EAAE;KAC/C,CAAC,CAAC;IACH,MAAM,QAAQ,GAAG,OAAO,CAAC,QAAQ,IAAI,EAAE,CAAC;IACxC,MAAM,eAAe,GAAG,OAAO,CAAC,eAAe,IAAI,KAAK,CAAC;IACzD,MAAM,iBAAiB,GA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IAAI,SAAS,CAAC,KAAK,CAAC,CAAC,EAAE,iBAAiB,CAAC,EAAE,CAAC;QACxD,IAAI,CAAC;YACH,MAAM,OAAO,GAAG,GAAG,CAAC,eAAe,IAAI,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,QAAQ,CAAC,IAAI,MAAM,kBAAkB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;YAClH,IAAI,OAAO;gBAAE,eAAe,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,CAAC,CAAC;QACzE,CAAC;QAAC,OAAO,GAAY,EAAE,CAAC;YACtB,MAAM,KAAK,GAAG,GAAY,CAAC;YAC3B,MAAM,CAAC,IAAI,CAAC;gBACV,IAAI,EAAE,GAAG,CAAC,QAAQ;gBAClB,OAAO,EAAE,KAAK,CAAC,OAAO;aACvB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IAED,MAAM,UAAU,GAAG,eAAe,CAAC,MAAM,IAAI,CAAC;QAC5C,CAAC,CAAC,qBAAqB,CAAC,eAAe,CAAC;QACxC,CAAC,CAAC,EAAE,UAAU,EAAE,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE,CAAC;IAE/C,OAAO;QACL,aAAa,EAAE,CAAC;QAChB,OAAO,EAAE,YAAY;QACrB,SAAS;QACT,eAAe,EAAE,UAAU,CAAC,UAAU;QACtC,kBAAkB,EAAE,UAAU,CAAC,kBAAkB;QACjD,OAAO,EAAE,SAAS,CAAC,OAAO;QAC1B,MAAM;KACP,CAAC;AACJ,CAAC"}
@@ -0,0 +1,307 @@
1
+ import { z } from 'zod';
2
+ export declare const WorkspaceScopeSchema: z.ZodEnum<{
3
+ code: "code";
4
+ structure: "structure";
5
+ document: "document";
6
+ reference: "reference";
7
+ }>;
8
+ export type WorkspaceScope = z.infer<typeof WorkspaceScopeSchema>;
9
+ export declare const WorkspaceErrorSchema: z.ZodObject<{
10
+ scope: z.ZodEnum<{
11
+ code: "code";
12
+ structure: "structure";
13
+ document: "document";
14
+ reference: "reference";
15
+ }>;
16
+ path: z.ZodOptional<z.ZodString>;
17
+ message: z.ZodString;
18
+ }, z.core.$strip>;
19
+ export type WorkspaceError = z.infer<typeof WorkspaceErrorSchema>;
20
+ export declare const WorkspaceDocumentAggregateEntrySchema: z.ZodObject<{
21
+ type: z.ZodString;
22
+ count: z.ZodNumber;
23
+ words: z.ZodNumber;
24
+ pages: z.ZodNumber;
25
+ paragraphs: z.ZodNumber;
26
+ sheets: z.ZodNumber;
27
+ rows: z.ZodNumber;
28
+ cells: z.ZodNumber;
29
+ slides: z.ZodNumber;
30
+ size: z.ZodNumber;
31
+ }, z.core.$strip>;
32
+ export type WorkspaceDocumentAggregateEntry = z.infer<typeof WorkspaceDocumentAggregateEntrySchema>;
33
+ export declare const WorkspaceDocumentTotalsSchema: z.ZodObject<{
34
+ files: z.ZodNumber;
35
+ words: z.ZodNumber;
36
+ pages: z.ZodNumber;
37
+ paragraphs: z.ZodNumber;
38
+ sheets: z.ZodNumber;
39
+ rows: z.ZodNumber;
40
+ cells: z.ZodNumber;
41
+ slides: z.ZodNumber;
42
+ size: z.ZodNumber;
43
+ }, z.core.$strip>;
44
+ export type WorkspaceDocumentTotals = z.infer<typeof WorkspaceDocumentTotalsSchema>;
45
+ export declare const WorkspaceDocumentAggregatesSchema: z.ZodObject<{
46
+ files: z.ZodArray<z.ZodObject<{
47
+ type: z.ZodString;
48
+ count: z.ZodNumber;
49
+ words: z.ZodNumber;
50
+ pages: z.ZodNumber;
51
+ paragraphs: z.ZodNumber;
52
+ sheets: z.ZodNumber;
53
+ rows: z.ZodNumber;
54
+ cells: z.ZodNumber;
55
+ slides: z.ZodNumber;
56
+ size: z.ZodNumber;
57
+ }, z.core.$strip>>;
58
+ totals: z.ZodObject<{
59
+ files: z.ZodNumber;
60
+ words: z.ZodNumber;
61
+ pages: z.ZodNumber;
62
+ paragraphs: z.ZodNumber;
63
+ sheets: z.ZodNumber;
64
+ rows: z.ZodNumber;
65
+ cells: z.ZodNumber;
66
+ slides: z.ZodNumber;
67
+ size: z.ZodNumber;
68
+ }, z.core.$strip>;
69
+ }, z.core.$strip>;
70
+ export type WorkspaceDocumentAggregates = z.infer<typeof WorkspaceDocumentAggregatesSchema>;
71
+ export declare const WorkspaceCodeTotalsSchema: z.ZodObject<{
72
+ totalFiles: z.ZodNumber;
73
+ totalLines: z.ZodNumber;
74
+ totalCode: z.ZodNumber;
75
+ totalComment: z.ZodNumber;
76
+ totalBlank: z.ZodNumber;
77
+ }, z.core.$strip>;
78
+ export type WorkspaceCodeTotals = z.infer<typeof WorkspaceCodeTotalsSchema>;
79
+ export declare const WorkspaceCodeAnalysisSchema: z.ZodObject<{
80
+ languages: z.ZodArray<z.ZodObject<{
81
+ Name: z.ZodString;
82
+ Count: z.ZodNumber;
83
+ Lines: z.ZodNumber;
84
+ Blank: z.ZodNumber;
85
+ Comment: z.ZodNumber;
86
+ Code: z.ZodNumber;
87
+ Files: z.ZodOptional<z.ZodArray<z.ZodObject<{
88
+ Filename: z.ZodOptional<z.ZodString>;
89
+ Location: z.ZodOptional<z.ZodString>;
90
+ Lines: z.ZodNumber;
91
+ Blank: z.ZodNumber;
92
+ Comment: z.ZodNumber;
93
+ Code: z.ZodNumber;
94
+ }, z.core.$loose>>>;
95
+ }, z.core.$loose>>;
96
+ totals: z.ZodObject<{
97
+ totalFiles: z.ZodNumber;
98
+ totalLines: z.ZodNumber;
99
+ totalCode: z.ZodNumber;
100
+ totalComment: z.ZodNumber;
101
+ totalBlank: z.ZodNumber;
102
+ }, z.core.$strip>;
103
+ }, z.core.$strip>;
104
+ export type WorkspaceCodeAnalysis = z.infer<typeof WorkspaceCodeAnalysisSchema>;
105
+ export declare const WorkspaceStructureEntrySchema: z.ZodObject<{
106
+ file: z.ZodString;
107
+ totalNodes: z.ZodNumber;
108
+ maxDepth: z.ZodNumber;
109
+ nodes: z.ZodArray<z.ZodType<import("../structure/types.js").StructureNode, unknown, z.core.$ZodTypeInternals<import("../structure/types.js").StructureNode, unknown>>>;
110
+ }, z.core.$strip>;
111
+ export type WorkspaceStructureEntry = z.infer<typeof WorkspaceStructureEntrySchema>;
112
+ export declare const WorkspaceAnalysisSummarySchema: z.ZodObject<{
113
+ elapsedMs: z.ZodNumber;
114
+ code: z.ZodNullable<z.ZodObject<{
115
+ totalFiles: z.ZodNumber;
116
+ totalLines: z.ZodNumber;
117
+ totalCode: z.ZodNumber;
118
+ totalComment: z.ZodNumber;
119
+ totalBlank: z.ZodNumber;
120
+ }, z.core.$strip>>;
121
+ documents: z.ZodNullable<z.ZodObject<{
122
+ files: z.ZodNumber;
123
+ words: z.ZodNumber;
124
+ pages: z.ZodNumber;
125
+ paragraphs: z.ZodNumber;
126
+ sheets: z.ZodNumber;
127
+ rows: z.ZodNumber;
128
+ cells: z.ZodNumber;
129
+ slides: z.ZodNumber;
130
+ size: z.ZodNumber;
131
+ }, z.core.$strip>>;
132
+ structures: z.ZodNumber;
133
+ }, z.core.$strip>;
134
+ export type WorkspaceAnalysisSummary = z.infer<typeof WorkspaceAnalysisSummarySchema>;
135
+ export declare const WorkspaceAnalysisSchema: z.ZodObject<{
136
+ schemaVersion: z.ZodLiteral<1>;
137
+ rootDir: z.ZodString;
138
+ summary: z.ZodObject<{
139
+ elapsedMs: z.ZodNumber;
140
+ code: z.ZodNullable<z.ZodObject<{
141
+ totalFiles: z.ZodNumber;
142
+ totalLines: z.ZodNumber;
143
+ totalCode: z.ZodNumber;
144
+ totalComment: z.ZodNumber;
145
+ totalBlank: z.ZodNumber;
146
+ }, z.core.$strip>>;
147
+ documents: z.ZodNullable<z.ZodObject<{
148
+ files: z.ZodNumber;
149
+ words: z.ZodNumber;
150
+ pages: z.ZodNumber;
151
+ paragraphs: z.ZodNumber;
152
+ sheets: z.ZodNumber;
153
+ rows: z.ZodNumber;
154
+ cells: z.ZodNumber;
155
+ slides: z.ZodNumber;
156
+ size: z.ZodNumber;
157
+ }, z.core.$strip>>;
158
+ structures: z.ZodNumber;
159
+ }, z.core.$strip>;
160
+ code: z.ZodNullable<z.ZodObject<{
161
+ languages: z.ZodArray<z.ZodObject<{
162
+ Name: z.ZodString;
163
+ Count: z.ZodNumber;
164
+ Lines: z.ZodNumber;
165
+ Blank: z.ZodNumber;
166
+ Comment: z.ZodNumber;
167
+ Code: z.ZodNumber;
168
+ Files: z.ZodOptional<z.ZodArray<z.ZodObject<{
169
+ Filename: z.ZodOptional<z.ZodString>;
170
+ Location: z.ZodOptional<z.ZodString>;
171
+ Lines: z.ZodNumber;
172
+ Blank: z.ZodNumber;
173
+ Comment: z.ZodNumber;
174
+ Code: z.ZodNumber;
175
+ }, z.core.$loose>>>;
176
+ }, z.core.$loose>>;
177
+ totals: z.ZodObject<{
178
+ totalFiles: z.ZodNumber;
179
+ totalLines: z.ZodNumber;
180
+ totalCode: z.ZodNumber;
181
+ totalComment: z.ZodNumber;
182
+ totalBlank: z.ZodNumber;
183
+ }, z.core.$strip>;
184
+ }, z.core.$strip>>;
185
+ documents: z.ZodNullable<z.ZodObject<{
186
+ aggregates: z.ZodObject<{
187
+ files: z.ZodArray<z.ZodObject<{
188
+ type: z.ZodString;
189
+ count: z.ZodNumber;
190
+ words: z.ZodNumber;
191
+ pages: z.ZodNumber;
192
+ paragraphs: z.ZodNumber;
193
+ sheets: z.ZodNumber;
194
+ rows: z.ZodNumber;
195
+ cells: z.ZodNumber;
196
+ slides: z.ZodNumber;
197
+ size: z.ZodNumber;
198
+ }, z.core.$strip>>;
199
+ totals: z.ZodObject<{
200
+ files: z.ZodNumber;
201
+ words: z.ZodNumber;
202
+ pages: z.ZodNumber;
203
+ paragraphs: z.ZodNumber;
204
+ sheets: z.ZodNumber;
205
+ rows: z.ZodNumber;
206
+ cells: z.ZodNumber;
207
+ slides: z.ZodNumber;
208
+ size: z.ZodNumber;
209
+ }, z.core.$strip>;
210
+ }, z.core.$strip>;
211
+ }, z.core.$strip>>;
212
+ structures: z.ZodArray<z.ZodObject<{
213
+ file: z.ZodString;
214
+ totalNodes: z.ZodNumber;
215
+ maxDepth: z.ZodNumber;
216
+ nodes: z.ZodArray<z.ZodType<import("../structure/types.js").StructureNode, unknown, z.core.$ZodTypeInternals<import("../structure/types.js").StructureNode, unknown>>>;
217
+ }, z.core.$strip>>;
218
+ skipped: z.ZodArray<z.ZodObject<{
219
+ path: z.ZodString;
220
+ reason: z.ZodString;
221
+ size: z.ZodNumber;
222
+ }, z.core.$strip>>;
223
+ errors: z.ZodArray<z.ZodObject<{
224
+ scope: z.ZodEnum<{
225
+ code: "code";
226
+ structure: "structure";
227
+ document: "document";
228
+ reference: "reference";
229
+ }>;
230
+ path: z.ZodOptional<z.ZodString>;
231
+ message: z.ZodString;
232
+ }, z.core.$strip>>;
233
+ }, z.core.$strip>;
234
+ export type WorkspaceAnalysis = z.infer<typeof WorkspaceAnalysisSchema>;
235
+ export declare const WorkspaceDocumentSummarySchema: z.ZodObject<{
236
+ filePath: z.ZodString;
237
+ relativePath: z.ZodString;
238
+ format: z.ZodString;
239
+ title: z.ZodOptional<z.ZodString>;
240
+ words: z.ZodNumber;
241
+ pages: z.ZodNumber;
242
+ tokenEstimate: z.ZodNumber;
243
+ headingCount: z.ZodNumber;
244
+ topLevelSections: z.ZodArray<z.ZodString>;
245
+ markdownContent: z.ZodOptional<z.ZodString>;
246
+ }, z.core.$strip>;
247
+ export type WorkspaceDocumentSummary = z.infer<typeof WorkspaceDocumentSummarySchema>;
248
+ export declare const WorkspaceCrossReferenceSchema: z.ZodObject<{
249
+ sourceFile: z.ZodString;
250
+ targetFile: z.ZodString;
251
+ referenceType: z.ZodEnum<{
252
+ "filename-mention": "filename-mention";
253
+ hyperlink: "hyperlink";
254
+ citation: "citation";
255
+ }>;
256
+ context: z.ZodString;
257
+ line: z.ZodOptional<z.ZodNumber>;
258
+ }, z.core.$strip>;
259
+ export type WorkspaceCrossReference = z.infer<typeof WorkspaceCrossReferenceSchema>;
260
+ export declare const WorkspaceUnresolvedMentionSchema: z.ZodObject<{
261
+ sourceFile: z.ZodString;
262
+ mention: z.ZodString;
263
+ context: z.ZodString;
264
+ }, z.core.$strip>;
265
+ export type WorkspaceUnresolvedMention = z.infer<typeof WorkspaceUnresolvedMentionSchema>;
266
+ export declare const WorkspaceDocumentSetSchema: z.ZodObject<{
267
+ schemaVersion: z.ZodLiteral<1>;
268
+ rootDir: z.ZodString;
269
+ documents: z.ZodArray<z.ZodObject<{
270
+ filePath: z.ZodString;
271
+ relativePath: z.ZodString;
272
+ format: z.ZodString;
273
+ title: z.ZodOptional<z.ZodString>;
274
+ words: z.ZodNumber;
275
+ pages: z.ZodNumber;
276
+ tokenEstimate: z.ZodNumber;
277
+ headingCount: z.ZodNumber;
278
+ topLevelSections: z.ZodArray<z.ZodString>;
279
+ markdownContent: z.ZodOptional<z.ZodString>;
280
+ }, z.core.$strip>>;
281
+ crossReferences: z.ZodArray<z.ZodObject<{
282
+ sourceFile: z.ZodString;
283
+ targetFile: z.ZodString;
284
+ referenceType: z.ZodEnum<{
285
+ "filename-mention": "filename-mention";
286
+ hyperlink: "hyperlink";
287
+ citation: "citation";
288
+ }>;
289
+ context: z.ZodString;
290
+ line: z.ZodOptional<z.ZodNumber>;
291
+ }, z.core.$strip>>;
292
+ unresolvedMentions: z.ZodArray<z.ZodObject<{
293
+ sourceFile: z.ZodString;
294
+ mention: z.ZodString;
295
+ context: z.ZodString;
296
+ }, z.core.$strip>>;
297
+ skipped: z.ZodArray<z.ZodObject<{
298
+ path: z.ZodString;
299
+ reason: z.ZodString;
300
+ size: z.ZodNumber;
301
+ }, z.core.$strip>>;
302
+ errors: z.ZodArray<z.ZodObject<{
303
+ path: z.ZodOptional<z.ZodString>;
304
+ message: z.ZodString;
305
+ }, z.core.$strip>>;
306
+ }, z.core.$strip>;
307
+ export type WorkspaceDocumentSet = z.infer<typeof WorkspaceDocumentSetSchema>;
@@ -0,0 +1,109 @@
1
+ import { z } from 'zod';
2
+ import { SccLanguageSchema } from '../scc.js';
3
+ import { SkippedEntrySchema } from '../types.js';
4
+ import { StructureNodeSchema } from '../structure/types.js';
5
+ export const WorkspaceScopeSchema = z.enum(['code', 'document', 'structure', 'reference']);
6
+ export const WorkspaceErrorSchema = z.object({
7
+ scope: WorkspaceScopeSchema,
8
+ path: z.string().optional(),
9
+ message: z.string(),
10
+ });
11
+ export const WorkspaceDocumentAggregateEntrySchema = z.object({
12
+ type: z.string(),
13
+ count: z.number(),
14
+ words: z.number(),
15
+ pages: z.number(),
16
+ paragraphs: z.number(),
17
+ sheets: z.number(),
18
+ rows: z.number(),
19
+ cells: z.number(),
20
+ slides: z.number(),
21
+ size: z.number(),
22
+ });
23
+ export const WorkspaceDocumentTotalsSchema = z.object({
24
+ files: z.number(),
25
+ words: z.number(),
26
+ pages: z.number(),
27
+ paragraphs: z.number(),
28
+ sheets: z.number(),
29
+ rows: z.number(),
30
+ cells: z.number(),
31
+ slides: z.number(),
32
+ size: z.number(),
33
+ });
34
+ export const WorkspaceDocumentAggregatesSchema = z.object({
35
+ files: z.array(WorkspaceDocumentAggregateEntrySchema),
36
+ totals: WorkspaceDocumentTotalsSchema,
37
+ });
38
+ export const WorkspaceCodeTotalsSchema = z.object({
39
+ totalFiles: z.number(),
40
+ totalLines: z.number(),
41
+ totalCode: z.number(),
42
+ totalComment: z.number(),
43
+ totalBlank: z.number(),
44
+ });
45
+ export const WorkspaceCodeAnalysisSchema = z.object({
46
+ languages: z.array(SccLanguageSchema),
47
+ totals: WorkspaceCodeTotalsSchema,
48
+ });
49
+ export const WorkspaceStructureEntrySchema = z.object({
50
+ file: z.string(),
51
+ totalNodes: z.number(),
52
+ maxDepth: z.number(),
53
+ nodes: z.array(StructureNodeSchema),
54
+ });
55
+ export const WorkspaceAnalysisSummarySchema = z.object({
56
+ elapsedMs: z.number(),
57
+ code: WorkspaceCodeTotalsSchema.nullable(),
58
+ documents: WorkspaceDocumentTotalsSchema.nullable(),
59
+ structures: z.number(),
60
+ });
61
+ export const WorkspaceAnalysisSchema = z.object({
62
+ schemaVersion: z.literal(1),
63
+ rootDir: z.string(),
64
+ summary: WorkspaceAnalysisSummarySchema,
65
+ code: WorkspaceCodeAnalysisSchema.nullable(),
66
+ documents: z.object({
67
+ aggregates: WorkspaceDocumentAggregatesSchema,
68
+ }).nullable(),
69
+ structures: z.array(WorkspaceStructureEntrySchema),
70
+ skipped: z.array(SkippedEntrySchema),
71
+ errors: z.array(WorkspaceErrorSchema),
72
+ });
73
+ export const WorkspaceDocumentSummarySchema = z.object({
74
+ filePath: z.string(),
75
+ relativePath: z.string(),
76
+ format: z.string(),
77
+ title: z.string().optional(),
78
+ words: z.number(),
79
+ pages: z.number(),
80
+ tokenEstimate: z.number(),
81
+ headingCount: z.number(),
82
+ topLevelSections: z.array(z.string()),
83
+ markdownContent: z.string().optional(),
84
+ });
85
+ export const WorkspaceCrossReferenceSchema = z.object({
86
+ sourceFile: z.string(),
87
+ targetFile: z.string(),
88
+ referenceType: z.enum(['filename-mention', 'hyperlink', 'citation']),
89
+ context: z.string(),
90
+ line: z.number().optional(),
91
+ });
92
+ export const WorkspaceUnresolvedMentionSchema = z.object({
93
+ sourceFile: z.string(),
94
+ mention: z.string(),
95
+ context: z.string(),
96
+ });
97
+ export const WorkspaceDocumentSetSchema = z.object({
98
+ schemaVersion: z.literal(1),
99
+ rootDir: z.string(),
100
+ documents: z.array(WorkspaceDocumentSummarySchema),
101
+ crossReferences: z.array(WorkspaceCrossReferenceSchema),
102
+ unresolvedMentions: z.array(WorkspaceUnresolvedMentionSchema),
103
+ skipped: z.array(SkippedEntrySchema),
104
+ errors: z.array(z.object({
105
+ path: z.string().optional(),
106
+ message: z.string(),
107
+ })),
108
+ });
109
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/workspace/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,WAA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