ask-marcel-office-cli 1.4.0 → 1.5.1

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 (107) hide show
  1. package/CHANGELOG.md +78 -0
  2. package/README.md +68 -24
  3. package/dist/cli.js +7641 -90932
  4. package/dist/commands.json +1230 -70
  5. package/dist/composition/build-deps.d.ts +13 -0
  6. package/dist/composition/cli.d.ts +8 -0
  7. package/dist/domain/iso-datetime.d.ts +1 -1
  8. package/dist/domain/utilities/archive-status.d.ts +18 -0
  9. package/dist/domain/utilities/site-url-classifier.d.ts +15 -0
  10. package/dist/index.js +10431 -93852
  11. package/dist/infra/auth.d.ts +27 -3
  12. package/dist/infra/browser-auth.d.ts +25 -0
  13. package/dist/infra/graph-client.d.ts +3 -1
  14. package/dist/infra/legacy-doc-extractor.d.ts +14 -0
  15. package/dist/infra/msg-reader-adapter.d.ts +83 -0
  16. package/dist/infra/network-error.d.ts +1 -1
  17. package/dist/infra/ooxml-media-extractor.d.ts +27 -0
  18. package/dist/infra/ooxml-zip-adapter.d.ts +28 -0
  19. package/dist/infra/pdf-image-extractor.d.ts +18 -0
  20. package/dist/infra/pdf-text-extractor.d.ts +41 -0
  21. package/dist/infra/png-encode.d.ts +15 -0
  22. package/dist/infra/sheetjs-adapter.d.ts +1 -1
  23. package/dist/infra/system-browser-auth.d.ts +35 -0
  24. package/dist/infra/system-browser-loader.d.ts +3 -0
  25. package/dist/infra/token-callback-server.d.ts +31 -0
  26. package/dist/infra/zip-reader.d.ts +32 -0
  27. package/dist/presenter/error-hints.d.ts +2 -2
  28. package/dist/presenter/output.d.ts +1 -1
  29. package/dist/use-cases/commands/build-command.d.ts +1 -1
  30. package/dist/use-cases/commands/command-types.d.ts +42 -1
  31. package/dist/use-cases/commands/convert-calendar-event-attachment-to-markdown.d.ts +15 -0
  32. package/dist/use-cases/commands/convert-calendar-event-attachment-to-pdf.d.ts +11 -0
  33. package/dist/use-cases/commands/convert-drive-item-zip.d.ts +26 -0
  34. package/dist/use-cases/commands/convert-local-file.d.ts +37 -0
  35. package/dist/use-cases/commands/convert-mail-attachment-to-markdown.d.ts +7 -1
  36. package/dist/use-cases/commands/convert-mail-attachment-to-pdf.d.ts +2 -1
  37. package/dist/use-cases/commands/convert-mail-attachment-zip.d.ts +24 -0
  38. package/dist/use-cases/commands/convert-mail-to-markdown.d.ts +4 -0
  39. package/dist/use-cases/commands/create-mail-draft.d.ts +22 -0
  40. package/dist/use-cases/commands/doc-to-markdown.d.ts +14 -0
  41. package/dist/use-cases/commands/docs-render.d.ts +3 -0
  42. package/dist/use-cases/commands/docs.d.ts +1 -1
  43. package/dist/use-cases/commands/docx-comment-anchors.d.ts +22 -0
  44. package/dist/use-cases/commands/docx-metadata-to-markdown.d.ts +3 -0
  45. package/dist/use-cases/commands/docx-metadata.d.ts +69 -0
  46. package/dist/use-cases/commands/docx-to-markdown.d.ts +8 -3
  47. package/dist/use-cases/commands/download-drive-item-as-markdown.d.ts +9 -0
  48. package/dist/use-cases/commands/download-drive-item-version.d.ts +4 -0
  49. package/dist/use-cases/commands/extract-drive-item-images.d.ts +11 -0
  50. package/dist/use-cases/commands/extract-local-file-images.d.ts +21 -0
  51. package/dist/use-cases/commands/extract-mail-attachment-images.d.ts +11 -0
  52. package/dist/use-cases/commands/extract-sharepoint-links-in-documents.d.ts +33 -0
  53. package/dist/use-cases/commands/extract-sharepoint-links-in-mail.d.ts +1 -8
  54. package/dist/use-cases/commands/fetch-raw-bytes.d.ts +1 -0
  55. package/dist/use-cases/commands/file-counts.d.ts +7 -0
  56. package/dist/use-cases/commands/filter-archived-sites.d.ts +17 -0
  57. package/dist/use-cases/commands/first-sentence.d.ts +12 -0
  58. package/dist/use-cases/commands/get-excel-chart-image.d.ts +20 -0
  59. package/dist/use-cases/commands/get-onenote-page-as-markdown.d.ts +8 -0
  60. package/dist/use-cases/commands/get-todo-task.d.ts +9 -2
  61. package/dist/use-cases/commands/image-extraction.d.ts +10 -0
  62. package/dist/use-cases/commands/iso-datetime-schema.d.ts +1 -1
  63. package/dist/use-cases/commands/list-accessible-drives.d.ts +14 -0
  64. package/dist/use-cases/commands/list-calendar-event-attachments.d.ts +14 -0
  65. package/dist/use-cases/commands/mail-quote-stripper.d.ts +25 -0
  66. package/dist/use-cases/commands/markdown-dispatch.d.ts +29 -0
  67. package/dist/use-cases/commands/markdown-pipeline.d.ts +6 -2
  68. package/dist/use-cases/commands/media-files.d.ts +20 -0
  69. package/dist/use-cases/commands/msg-to-markdown.d.ts +28 -0
  70. package/dist/use-cases/commands/odf-content-to-markdown.d.ts +5 -0
  71. package/dist/use-cases/commands/odf-metadata-to-markdown.d.ts +3 -0
  72. package/dist/use-cases/commands/odf-metadata.d.ts +26 -0
  73. package/dist/use-cases/commands/odf-to-markdown.d.ts +17 -0
  74. package/dist/use-cases/commands/office-extensions.d.ts +13 -0
  75. package/dist/use-cases/commands/office-to-markdown.d.ts +6 -2
  76. package/dist/use-cases/commands/onenote-metadata.d.ts +21 -0
  77. package/dist/use-cases/commands/onenote-resource-embedder.d.ts +3 -0
  78. package/dist/use-cases/commands/ooxml-metadata-to-markdown.d.ts +16 -0
  79. package/dist/use-cases/commands/ooxml-metadata.d.ts +23 -0
  80. package/dist/use-cases/commands/ooxml-xml-walker.d.ts +36 -0
  81. package/dist/use-cases/commands/option-descriptions.d.ts +5 -0
  82. package/dist/use-cases/commands/output-path.d.ts +23 -0
  83. package/dist/use-cases/commands/pdf-to-markdown.d.ts +19 -0
  84. package/dist/use-cases/commands/pptx-comments.d.ts +24 -0
  85. package/dist/use-cases/commands/pptx-metadata-to-markdown.d.ts +3 -0
  86. package/dist/use-cases/commands/pptx-metadata.d.ts +33 -0
  87. package/dist/use-cases/commands/pptx-slides.d.ts +17 -0
  88. package/dist/use-cases/commands/pptx-to-markdown.d.ts +7 -0
  89. package/dist/use-cases/commands/read-mail-attachment.d.ts +15 -0
  90. package/dist/use-cases/commands/search-all-accessible-sites.d.ts +12 -0
  91. package/dist/use-cases/commands/search-index-total.d.ts +3 -0
  92. package/dist/use-cases/commands/search-sharepoint-sites-by-name.d.ts +3 -2
  93. package/dist/use-cases/commands/sharepoint-link-extractor.d.ts +17 -12
  94. package/dist/use-cases/commands/text-passthrough.d.ts +15 -2
  95. package/dist/use-cases/commands/todo-parse-uri-rewrite.d.ts +7 -0
  96. package/dist/use-cases/commands/update-mail-draft.d.ts +22 -0
  97. package/dist/use-cases/commands/xlsx-comments.d.ts +29 -0
  98. package/dist/use-cases/commands/xlsx-metadata-to-markdown.d.ts +3 -0
  99. package/dist/use-cases/commands/xlsx-metadata.d.ts +39 -0
  100. package/dist/use-cases/commands/xlsx-to-markdown.d.ts +9 -2
  101. package/dist/use-cases/commands/zip-archive-to-markdown.d.ts +30 -0
  102. package/dist/use-cases/ports/filesystem.d.ts +10 -0
  103. package/docs/COMMANDS.md +34 -18
  104. package/docs/USAGE.md +25 -8
  105. package/docs/commands.json +1230 -70
  106. package/package.json +14 -8
  107. /package/dist/use-cases/commands/{download-onedrive-file-content.d.ts → download-drive-item-content.d.ts} +0 -0
@@ -0,0 +1,37 @@
1
+ import { z } from 'zod';
2
+ import type { Result } from '../../domain/result.js';
3
+ import type { GraphClient, GraphError } from '../../infra/graph-client.js';
4
+ import type { FileSystem } from '../ports/filesystem.js';
5
+ import type { CommandMeta } from './command-types.js';
6
+ /**
7
+ * Convert a file ON DISK to markdown through the same `bytesToMarkdown`
8
+ * dispatch every Graph-backed markdown command uses — the only command whose
9
+ * input never touches Microsoft Graph (works offline, no login). The fetch
10
+ * step was always the Graph-bound part; conversion is pure bytes-in/markdown-out.
11
+ *
12
+ * A `.zip` routes through the shared archive core (each entry converted, GBK
13
+ * entry names decoded); everything else goes through the single-file dispatch.
14
+ * What it can NOT do locally: `format=pdf` conversions (Graph renders those
15
+ * server-side) and Loop/Fluid/Whiteboard (`format=html`, same reason).
16
+ *
17
+ * This is the one registry command executed via `executeLocal(fs, params)` —
18
+ * the CLI wires its FileSystem in automatically (see `cli.ts`). The Graph-shaped
19
+ * `execute` exists because the public `commands` registry type requires it; it
20
+ * redirects library consumers to `executeLocal`.
21
+ */
22
+ declare const schema: z.ZodObject<{
23
+ path: z.ZodString;
24
+ includeMetadata: z.ZodOptional<z.ZodEnum<{
25
+ true: "true";
26
+ false: "false";
27
+ }>>;
28
+ inlineImages: z.ZodOptional<z.ZodEnum<{
29
+ true: "true";
30
+ false: "false";
31
+ }>>;
32
+ maxCells: z.ZodOptional<z.ZodString>;
33
+ }, z.core.$strip>;
34
+ declare const executeLocal: (fs: FileSystem, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
35
+ declare const execute: (_graph: GraphClient, _params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
36
+ declare const meta: CommandMeta;
37
+ export { execute, executeLocal, meta, schema };
@@ -5,7 +5,13 @@ import type { CommandMeta } from './command-types.js';
5
5
  declare const schema: z.ZodObject<{
6
6
  messageId: z.ZodString;
7
7
  attachmentId: z.ZodString;
8
+ includeMetadata: z.ZodOptional<z.ZodEnum<{
9
+ true: "true";
10
+ false: "false";
11
+ }>>;
8
12
  }, z.core.$strip>;
13
+ declare const convertFetchedAttachment: (graph: GraphClient, a: Record<string, unknown>, includeMetadata: boolean) => Promise<Result<unknown, GraphError>> | Result<unknown, GraphError>;
14
+ declare const convertAttachmentToMarkdown: (graph: GraphClient, attachmentPath: string, includeMetadata: boolean) => Promise<Result<unknown, GraphError>>;
9
15
  declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
10
16
  declare const meta: CommandMeta;
11
- export { execute, meta, schema };
17
+ export { convertAttachmentToMarkdown, convertFetchedAttachment, execute, meta, schema };
@@ -6,6 +6,7 @@ declare const schema: z.ZodObject<{
6
6
  messageId: z.ZodString;
7
7
  attachmentId: z.ZodString;
8
8
  }, z.core.$strip>;
9
+ declare const convertAttachmentToPdf: (graph: GraphClient, attachmentPath: string) => Promise<Result<unknown, GraphError>>;
9
10
  declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
10
11
  declare const meta: CommandMeta;
11
- export { execute, meta, schema };
12
+ export { convertAttachmentToPdf, execute, meta, schema };
@@ -0,0 +1,24 @@
1
+ import { z } from 'zod';
2
+ import type { Result } from '../../domain/result.js';
3
+ import type { GraphClient, GraphError } from '../../infra/graph-client.js';
4
+ import type { CommandMeta } from './command-types.js';
5
+ /**
6
+ * Unzips a `.zip` Outlook mail attachment and converts every contained file in one
7
+ * call — the mail-side mirror of `convert-drive-item-zip`. Without it, reading a
8
+ * zipped vendor deck meant: `get-mail-attachment --output-path x.zip` → manual
9
+ * `unzip` (with `-O GBK` for Chinese names) → convert each file. This collapses all
10
+ * of that into one command: it pulls the fileAttachment bytes, unzips them (legacy
11
+ * GBK / CP437 entry names are decoded, not mojibaked, in the shared zip reader), and
12
+ * runs each entry through the same conversion dispatch the markdown commands use.
13
+ */
14
+ declare const schema: z.ZodObject<{
15
+ messageId: z.ZodString;
16
+ attachmentId: z.ZodString;
17
+ includeMetadata: z.ZodOptional<z.ZodEnum<{
18
+ true: "true";
19
+ false: "false";
20
+ }>>;
21
+ }, z.core.$strip>;
22
+ declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
23
+ declare const meta: CommandMeta;
24
+ export { execute, meta, schema };
@@ -8,6 +8,10 @@ declare const schema: z.ZodObject<{
8
8
  true: "true";
9
9
  false: "false";
10
10
  }>>;
11
+ keepQuoted: z.ZodOptional<z.ZodEnum<{
12
+ true: "true";
13
+ false: "false";
14
+ }>>;
11
15
  }, z.core.$strip>;
12
16
  declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
13
17
  declare const meta: CommandMeta;
@@ -0,0 +1,22 @@
1
+ import { z } from 'zod';
2
+ import type { Command, CommandMeta } from './command-types.js';
3
+ declare const schema: z.ZodObject<{
4
+ subject: z.ZodString;
5
+ bodyContent: z.ZodString;
6
+ bodyContentType: z.ZodOptional<z.ZodEnum<{
7
+ Text: "Text";
8
+ HTML: "HTML";
9
+ }>>;
10
+ toRecipients: z.ZodString;
11
+ ccRecipients: z.ZodOptional<z.ZodString>;
12
+ bccRecipients: z.ZodOptional<z.ZodString>;
13
+ importance: z.ZodOptional<z.ZodEnum<{
14
+ Low: "Low";
15
+ Normal: "Normal";
16
+ High: "High";
17
+ }>>;
18
+ mailFolderId: z.ZodOptional<z.ZodString>;
19
+ }, z.core.$strip>;
20
+ declare const execute: Command['execute'];
21
+ declare const meta: CommandMeta;
22
+ export { execute, meta, schema };
@@ -0,0 +1,14 @@
1
+ import type { Result } from '../../domain/result.js';
2
+ import type { GraphError } from '../../infra/graph-client.js';
3
+ type DocTextEnvelope = {
4
+ readonly contentType: 'text/plain';
5
+ readonly size: number;
6
+ readonly text: string;
7
+ };
8
+ /**
9
+ * Convert a legacy Word .doc to a plain-text envelope by extracting its body text
10
+ * (via word-extractor). Output is text/plain, not markdown — legacy .doc carries
11
+ * no structure this CLI recovers. A parse failure propagates as the infra api_error.
12
+ */
13
+ declare const docToMarkdown: (bytes: Uint8Array) => Promise<Result<DocTextEnvelope, GraphError>>;
14
+ export { docToMarkdown };
@@ -3,6 +3,7 @@ export type CommandManifestEntry = {
3
3
  readonly name: string;
4
4
  readonly summary: string;
5
5
  readonly category: CommandCategory;
6
+ readonly commandAliases?: CommandMeta['commandAliases'];
6
7
  readonly graphMethod: CommandMeta['graphMethod'];
7
8
  readonly graphPathTemplate: string;
8
9
  readonly graphDocsUrl: string;
@@ -16,6 +17,8 @@ export type CommandManifestEntry = {
16
17
  readonly scopesRequired?: CommandMeta['scopesRequired'];
17
18
  readonly needsElevatedToken?: CommandMeta['needsElevatedToken'];
18
19
  readonly producesBytes?: CommandMeta['producesBytes'];
20
+ readonly producesMedia?: CommandMeta['producesMedia'];
21
+ readonly mutates?: CommandMeta['mutates'];
19
22
  readonly stability?: CommandMeta['stability'];
20
23
  };
21
24
  export declare const paginationHintFor: (strategy: PaginationStrategy | undefined) => string;
@@ -13,7 +13,7 @@ export type DocsError = {
13
13
  * `scopesRequired` — everything the LLM only needs once it's already decided
14
14
  * to invoke. `stability` is kept (it's a discovery-time concern: LLMs prefer
15
15
  * stable siblings when they exist, so they need to see the tag at discovery
16
- * time, not after a second full-manifest fetch). Audit Hervé-session §B/§6.
16
+ * time, not after a second full-manifest fetch). Audit Jane-session §B/§6.
17
17
  */
18
18
  export type TerseManifestEntry = {
19
19
  readonly name: string;
@@ -0,0 +1,22 @@
1
+ /**
2
+ * Correlates each docx comment to the body text it annotates. In
3
+ * `word/document.xml` a comment's anchored span is bracketed by empty marker
4
+ * elements `<w:commentRangeStart w:id="N"/> …runs… <w:commentRangeEnd w:id="N"/>`,
5
+ * keyed by the same `w:id` the comment in `word/comments.xml` carries. mammoth
6
+ * strips those markers from its HTML, so to fold the comment's context into the
7
+ * markdown we read document.xml directly.
8
+ *
9
+ * The shared walker (ooxml-xml-walker) groups same-named siblings and loses
10
+ * cross-element order, which would scramble which runs fall inside a range. So,
11
+ * like odf-content-to-markdown, this parses with `preserveOrder` and walks the
12
+ * ordered tree, tracking the set of currently-open comment ids and appending
13
+ * each `<w:t>` run's text to every open range. Handles overlapping / nested
14
+ * ranges (more than one open at once). Pure (string → Map); no IO.
15
+ */
16
+ type Node = Record<string, unknown>;
17
+ declare const tagOf: (node: Node) => string | undefined;
18
+ declare const attr: (node: Node, name: string) => string;
19
+ declare const leafText: (children: ReadonlyArray<Node>) => string;
20
+ declare const clamp: (span: string) => string;
21
+ declare const extractCommentAnchors: (documentXml: string | undefined) => ReadonlyMap<string, string>;
22
+ export { attr, clamp, extractCommentAnchors, leafText, tagOf };
@@ -0,0 +1,3 @@
1
+ import type { DocxMetadata } from './docx-metadata.js';
2
+ declare const formatDocxMetadata: (meta: DocxMetadata) => string;
3
+ export { formatDocxMetadata };
@@ -0,0 +1,69 @@
1
+ import type { Result } from '../../domain/result.js';
2
+ import type { GraphError } from '../../infra/graph-client.js';
3
+ import type { CustomProp, ExternalRel } from './ooxml-metadata.js';
4
+ /**
5
+ * Pulls the side-channel content out of a .docx zip — every text-bearing
6
+ * surface mammoth drops on the floor: core / app / custom doc properties,
7
+ * people registry, external hyperlinks, comments, tracked changes (ins + del),
8
+ * hidden text (w:vanish), text-box / shape text (w:txbxContent), header/footer
9
+ * body prose, field instructions (MERGEFIELD / HYPERLINK / DOCVARIABLE), bookmarks.
10
+ *
11
+ * The package-level parts (docProps/*, every *.rels) come from the shared
12
+ * ooxml-metadata module; this file owns only the docx-body-specific parts.
13
+ *
14
+ * Pure use-case logic — no IO. The zip is opened upstream via the infra
15
+ * adapter; this module just walks parsed XML trees. Try/catch lives in
16
+ * the infra adapter, not here.
17
+ */
18
+ type CoreProps = Readonly<Record<string, string>>;
19
+ type AppProps = Readonly<Record<string, string>>;
20
+ type Person = {
21
+ readonly author: string;
22
+ readonly providerId: string;
23
+ readonly userId: string;
24
+ };
25
+ type Comment = {
26
+ readonly id: string;
27
+ readonly author: string;
28
+ readonly initials: string;
29
+ readonly date: string;
30
+ readonly text: string;
31
+ readonly anchor?: string;
32
+ };
33
+ type TrackedChange = {
34
+ readonly id: string;
35
+ readonly author: string;
36
+ readonly date: string;
37
+ readonly text: string;
38
+ };
39
+ type Field = {
40
+ readonly source: string;
41
+ readonly instruction: string;
42
+ };
43
+ type Bookmark = {
44
+ readonly id: string;
45
+ readonly name: string;
46
+ };
47
+ type HeaderFooter = {
48
+ readonly part: string;
49
+ readonly text: string;
50
+ };
51
+ type DocxMetadata = {
52
+ readonly core: CoreProps;
53
+ readonly app: AppProps;
54
+ readonly custom: ReadonlyArray<CustomProp>;
55
+ readonly people: ReadonlyArray<Person>;
56
+ readonly externalRels: ReadonlyArray<ExternalRel>;
57
+ readonly comments: ReadonlyArray<Comment>;
58
+ readonly insertions: ReadonlyArray<TrackedChange>;
59
+ readonly deletions: ReadonlyArray<TrackedChange>;
60
+ readonly hiddenText: ReadonlyArray<string>;
61
+ readonly textBoxes: ReadonlyArray<string>;
62
+ readonly headersFooters: ReadonlyArray<HeaderFooter>;
63
+ readonly fields: ReadonlyArray<Field>;
64
+ readonly bookmarks: ReadonlyArray<Bookmark>;
65
+ readonly macros: ReadonlyArray<string>;
66
+ };
67
+ declare const extractDocxMetadata: (bytes: Uint8Array) => Promise<Result<DocxMetadata, GraphError>>;
68
+ export { extractDocxMetadata };
69
+ export type { Bookmark, Comment, CustomProp, DocxMetadata, ExternalRel, Field, HeaderFooter, Person, TrackedChange };
@@ -5,7 +5,12 @@ type MarkdownEnvelope = {
5
5
  readonly size: number;
6
6
  readonly text: string;
7
7
  };
8
+ type DocxToMarkdownOptions = {
9
+ readonly includeMetadata?: boolean;
10
+ readonly inlineImages?: boolean;
11
+ };
12
+ declare const stripInlineImages: (markdown: string) => string;
8
13
  declare const promoteFirstRowToThead: (html: string) => string;
9
- declare const docxToMarkdown: (bytes: Uint8Array) => Promise<Result<MarkdownEnvelope, GraphError>>;
10
- export { docxToMarkdown, promoteFirstRowToThead };
11
- export type { MarkdownEnvelope };
14
+ declare const docxToMarkdown: (bytes: Uint8Array, opts?: DocxToMarkdownOptions) => Promise<Result<MarkdownEnvelope, GraphError>>;
15
+ export { docxToMarkdown, promoteFirstRowToThead, stripInlineImages };
16
+ export type { DocxToMarkdownOptions, MarkdownEnvelope };
@@ -5,6 +5,15 @@ import type { CommandMeta } from './command-types.js';
5
5
  declare const schema: z.ZodObject<{
6
6
  driveId: z.ZodString;
7
7
  itemId: z.ZodString;
8
+ includeMetadata: z.ZodOptional<z.ZodEnum<{
9
+ true: "true";
10
+ false: "false";
11
+ }>>;
12
+ inlineImages: z.ZodOptional<z.ZodEnum<{
13
+ true: "true";
14
+ false: "false";
15
+ }>>;
16
+ maxCells: z.ZodOptional<z.ZodString>;
8
17
  }, z.core.$strip>;
9
18
  declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
10
19
  declare const meta: CommandMeta;
@@ -11,6 +11,10 @@ declare const schema: z.ZodObject<{
11
11
  pdf: "pdf";
12
12
  original: "original";
13
13
  }>>;
14
+ includeMetadata: z.ZodOptional<z.ZodEnum<{
15
+ true: "true";
16
+ false: "false";
17
+ }>>;
14
18
  }, z.core.$strip>;
15
19
  declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
16
20
  declare const meta: CommandMeta;
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import type { Result } from '../../domain/result.js';
3
+ import type { GraphClient, GraphError } from '../../infra/graph-client.js';
4
+ import type { CommandMeta } from './command-types.js';
5
+ declare const schema: z.ZodObject<{
6
+ driveId: z.ZodString;
7
+ itemId: z.ZodString;
8
+ }, z.core.$strip>;
9
+ declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
10
+ declare const meta: CommandMeta;
11
+ export { execute, meta, schema };
@@ -0,0 +1,21 @@
1
+ import { z } from 'zod';
2
+ import type { Result } from '../../domain/result.js';
3
+ import type { GraphClient, GraphError } from '../../infra/graph-client.js';
4
+ import type { FileSystem } from '../ports/filesystem.js';
5
+ import type { CommandMeta } from './command-types.js';
6
+ /**
7
+ * Extract embedded images from a file ON DISK — the local sibling of
8
+ * `extract-drive-item-images`, sharing its `extractImagesFromBytes` dispatch
9
+ * (OOXML media parts / unpdf page walk). It completes two flows the drive
10
+ * command cannot reach: a Graph-rendered PDF saved with the global
11
+ * output-path flag (the legacy-.ppt route), and Office files unpacked from a
12
+ * local archive. Like `convert-local-file`, it never touches Graph and is
13
+ * executed via `executeLocal(fs, params)`.
14
+ */
15
+ declare const schema: z.ZodObject<{
16
+ path: z.ZodString;
17
+ }, z.core.$strip>;
18
+ declare const executeLocal: (fs: FileSystem, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
19
+ declare const execute: (_graph: GraphClient, _params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
20
+ declare const meta: CommandMeta;
21
+ export { execute, executeLocal, meta, schema };
@@ -0,0 +1,11 @@
1
+ import { z } from 'zod';
2
+ import type { Result } from '../../domain/result.js';
3
+ import type { GraphClient, GraphError } from '../../infra/graph-client.js';
4
+ import type { CommandMeta } from './command-types.js';
5
+ declare const schema: z.ZodObject<{
6
+ messageId: z.ZodString;
7
+ attachmentId: z.ZodString;
8
+ }, z.core.$strip>;
9
+ declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
10
+ declare const meta: CommandMeta;
11
+ export { execute, meta, schema };
@@ -0,0 +1,33 @@
1
+ import { z } from 'zod';
2
+ import type { Result } from '../../domain/result.js';
3
+ import type { GraphClient, GraphError } from '../../infra/graph-client.js';
4
+ import type { CommandMeta } from './command-types.js';
5
+ import type { ResolvedLink } from './sharepoint-link-extractor.js';
6
+ /**
7
+ * The document-side sibling of `extract-sharepoint-links-in-mail`: pulls a
8
+ * docx/xlsx/pptx from a OneDrive / SharePoint item and finds every
9
+ * `*.sharepoint.com` URL embedded in it, resolving each to its driveItem so an
10
+ * agent can follow references out of a document the same way it follows them
11
+ * out of an email. Read-only — no conversion happens here.
12
+ *
13
+ * In OOXML, external hyperlinks live in the `_rels/*.rels` parts as
14
+ * `<Relationship Target="…" TargetMode="External"/>`. `extractExternalRels`
15
+ * (shared with the metadata extractors) already surfaces exactly those, so this
16
+ * command is pure composition: fetch bytes → open the package → collect external
17
+ * targets → keep the SharePoint ones → resolve via `/shares/{token}/driveItem`.
18
+ */
19
+ declare const schema: z.ZodObject<{
20
+ driveId: z.ZodString;
21
+ itemId: z.ZodString;
22
+ }, z.core.$strip>;
23
+ type DocumentLinkSummary = {
24
+ readonly driveId: string;
25
+ readonly itemId: string;
26
+ readonly links: ReadonlyArray<ResolvedLink>;
27
+ readonly truncated: boolean;
28
+ readonly skippedCount: number;
29
+ };
30
+ declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<DocumentLinkSummary, GraphError>>;
31
+ declare const meta: CommandMeta;
32
+ export { execute, meta, schema };
33
+ export type { DocumentLinkSummary };
@@ -2,14 +2,7 @@ import { z } from 'zod';
2
2
  import type { Result } from '../../domain/result.js';
3
3
  import type { GraphClient, GraphError } from '../../infra/graph-client.js';
4
4
  import type { CommandMeta } from './command-types.js';
5
- type ResolvedLink = {
6
- readonly url: string;
7
- readonly driveId?: string;
8
- readonly itemId?: string;
9
- readonly name?: string;
10
- readonly webUrl?: string;
11
- readonly error?: string;
12
- };
5
+ import type { ResolvedLink } from './sharepoint-link-extractor.js';
13
6
  type LinkExtractionSummary = {
14
7
  readonly messageId: string;
15
8
  readonly subject?: string;
@@ -34,6 +34,7 @@ export type InlineBinary = {
34
34
  readonly size: number;
35
35
  readonly base64: string;
36
36
  };
37
+ export declare const base64ToBytes: (b64: string) => Uint8Array;
37
38
  export declare const fetchRawBytes: (graph: GraphClient, contentPath: string, opts?: FetchOptions) => Promise<Result<Uint8Array, GraphError>>;
38
39
  export declare const inlineBinary: (graph: GraphClient, contentPath: string, opts?: FetchOptions) => Promise<Result<InlineBinary, GraphError>>;
39
40
  /**
@@ -0,0 +1,7 @@
1
+ import type { GraphClient } from '../../infra/graph-client.js';
2
+ type FileCountOptions = {
3
+ readonly max?: number;
4
+ readonly chunk?: number;
5
+ };
6
+ declare const addEstimatedFileCounts: (graph: GraphClient, entries: ReadonlyArray<unknown>, webUrlOf: (entry: unknown) => string | undefined, options?: FileCountOptions) => Promise<ReadonlyArray<unknown>>;
7
+ export { addEstimatedFileCounts };
@@ -0,0 +1,17 @@
1
+ import type { GraphClient } from '../../infra/graph-client.js';
2
+ declare const ARCHIVE_PROBE_MAX = 250;
3
+ type FilterOptions = {
4
+ readonly probeMax?: number;
5
+ readonly chunkSize?: number;
6
+ };
7
+ type FilterResult = {
8
+ readonly value: ReadonlyArray<unknown>;
9
+ readonly archivedExcluded: number;
10
+ readonly nonNavigableExcluded: number;
11
+ readonly notFoundExcluded: number;
12
+ readonly probeErrors: number;
13
+ readonly probeTruncated: boolean;
14
+ };
15
+ declare const filterOutArchivedSites: (graph: GraphClient, sites: ReadonlyArray<unknown>, options?: FilterOptions) => Promise<FilterResult>;
16
+ export { ARCHIVE_PROBE_MAX, filterOutArchivedSites };
17
+ export type { FilterResult };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Compact a multi-sentence summary to its first sentence — everything up to the
3
+ * first `. ` (period-space) or the first newline, whichever comes first. Returns
4
+ * the full text untouched when no sensible cut-point exists, so the result is
5
+ * never less readable than the original. Keeps the trailing period when cutting
6
+ * on `. ` so the line ends naturally.
7
+ *
8
+ * Shared by the top-level `--help` subcommand listing (composition) and the
9
+ * `help-json --terse` discovery projection (use-cases) so both compact the same
10
+ * way — the terse manifest in particular must stay token-cheap per category.
11
+ */
12
+ export declare const firstSentence: (full: string) => string;
@@ -0,0 +1,20 @@
1
+ import { z } from 'zod';
2
+ import type { Result } from '../../domain/result.js';
3
+ import type { GraphClient, GraphError } from '../../infra/graph-client.js';
4
+ import type { CommandMeta } from './command-types.js';
5
+ /**
6
+ * Renders an Excel chart to a PNG via Graph's chart `Image()` function. Unlike
7
+ * the rest of the conversion surface, this endpoint returns the bytes as a
8
+ * base64 string in the JSON `value` field (NOT a 302 redirect), so a plain
9
+ * `graph.get` is enough. `width=0,height=0` = the chart's natural size;
10
+ * `fittingMode='Fit'` preserves aspect ratio.
11
+ */
12
+ declare const schema: z.ZodObject<{
13
+ driveId: z.ZodString;
14
+ itemId: z.ZodString;
15
+ worksheetId: z.ZodString;
16
+ chartId: z.ZodString;
17
+ }, z.core.$strip>;
18
+ declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
19
+ declare const meta: CommandMeta;
20
+ export { execute, meta, schema };
@@ -4,6 +4,14 @@ import type { GraphClient, GraphError } from '../../infra/graph-client.js';
4
4
  import type { CommandMeta } from './command-types.js';
5
5
  declare const schema: z.ZodObject<{
6
6
  onenotePageId: z.ZodString;
7
+ inlineImages: z.ZodOptional<z.ZodEnum<{
8
+ true: "true";
9
+ false: "false";
10
+ }>>;
11
+ includeMetadata: z.ZodOptional<z.ZodEnum<{
12
+ true: "true";
13
+ false: "false";
14
+ }>>;
7
15
  }, z.core.$strip>;
8
16
  declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
9
17
  declare const meta: CommandMeta;
@@ -1,4 +1,11 @@
1
- import type { CommandMeta } from './command-types.js';
2
- declare const execute: import("./command-types.js").CommandExecute, schema: import("./command-types.js").CommandSchema;
1
+ import { z } from 'zod';
2
+ import type { Command, CommandMeta } from './command-types.js';
3
+ declare const schema: z.ZodObject<{
4
+ todoTaskListId: z.ZodString;
5
+ todoTaskId: z.ZodString;
6
+ select: z.ZodOptional<z.ZodString>;
7
+ expand: z.ZodOptional<z.ZodString>;
8
+ }, z.core.$strip>;
9
+ declare const execute: Command['execute'];
3
10
  declare const meta: CommandMeta;
4
11
  export { execute, meta, schema };
@@ -0,0 +1,10 @@
1
+ import type { Result } from '../../domain/result.js';
2
+ import type { GraphError } from '../../infra/graph-client.js';
3
+ /**
4
+ * Shared by extract-drive-item-images and extract-mail-attachment-images: pick the
5
+ * extractor for the file's extension and run it, or return a 415 whose tail
6
+ * (`fetchHint`) names the caller's raw-bytes route. Both commands fetch / decode the
7
+ * bytes first, then hand them here, so the dispatch + media envelope live in one place.
8
+ */
9
+ declare const extractImagesFromBytes: (bytes: Uint8Array, name: string, fetchHint: string) => Promise<Result<unknown, GraphError>>;
10
+ export { extractImagesFromBytes };
@@ -6,7 +6,7 @@ import { z } from 'zod';
6
6
  * compose this into their schemas in place of `z.string().min(1)`; the
7
7
  * URL-builder sees the already-resolved canonical ISO form.
8
8
  *
9
- * Audit Hervé-session §C: removes the manual ISO arithmetic an LLM had to do
9
+ * Audit Jane-session §C: removes the manual ISO arithmetic an LLM had to do
10
10
  * to ask "what changed this week" against `list-calendar-view`. Type
11
11
  * inference is left to Zod so the calendar commands' shape signatures stay
12
12
  * compatible with `buildListCommand`'s `ZodRawShape` constraint.
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import type { Result } from '../../domain/result.js';
3
+ import type { GraphClient, GraphError } from '../../infra/graph-client.js';
4
+ import type { CommandMeta } from './command-types.js';
5
+ declare const schema: z.ZodObject<{
6
+ maxGroups: z.ZodOptional<z.ZodString>;
7
+ countFiles: z.ZodOptional<z.ZodEnum<{
8
+ true: "true";
9
+ false: "false";
10
+ }>>;
11
+ }, z.core.$strip>;
12
+ declare const execute: (graph: GraphClient, params: Record<string, string>) => Promise<Result<unknown, GraphError>>;
13
+ declare const meta: CommandMeta;
14
+ export { execute, meta, schema };
@@ -0,0 +1,14 @@
1
+ import { z } from 'zod';
2
+ import type { Command, CommandMeta } from './command-types.js';
3
+ declare const schema: z.ZodObject<{
4
+ eventId: z.ZodString;
5
+ top: z.ZodOptional<z.ZodString>;
6
+ skip: z.ZodOptional<z.ZodString>;
7
+ select: z.ZodOptional<z.ZodString>;
8
+ filter: z.ZodOptional<z.ZodString>;
9
+ orderby: z.ZodOptional<z.ZodString>;
10
+ expand: z.ZodOptional<z.ZodString>;
11
+ }, z.core.$strip>;
12
+ declare const execute: Command['execute'];
13
+ declare const meta: CommandMeta;
14
+ export { execute, meta, schema };
@@ -0,0 +1,25 @@
1
+ /**
2
+ * Strips quoted reply chains / forwarded-message blocks from an Outlook or
3
+ * Gmail HTML email body so long threads don't duplicate quoted content into the
4
+ * model's context. Conservative: truncates the body at the EARLIEST well-known
5
+ * reply/forward boundary marker and replaces the tail with a single visible
6
+ * placeholder — nothing is removed silently, and `--keep-quoted true` on
7
+ * `convert-mail-to-markdown` restores the full body. Pure string transform.
8
+ *
9
+ * Only structural, vendor-specific markers are matched (never a bare
10
+ * `<blockquote>`, which legitimate content uses too):
11
+ * - Outlook desktop / OWA reply+forward header block: `<div id="divRplyFwdMsg">`
12
+ * - Outlook "type above this line" boundary: `<div id="appendonsend">`
13
+ * - Outlook mobile reference container: `<div id="mail-editor-reference-message-container">`
14
+ * - Outlook classic separator: `<hr id="stopSpelling">`
15
+ * - Gmail quote container: `<div class="gmail_quote">` / `<blockquote class="gmail_quote">`
16
+ */
17
+ declare const stripQuotedReplies: (html: string) => {
18
+ readonly html: string;
19
+ readonly stripped: boolean;
20
+ };
21
+ declare const stripQuotedPlainText: (text: string) => {
22
+ readonly text: string;
23
+ readonly stripped: boolean;
24
+ };
25
+ export { stripQuotedPlainText, stripQuotedReplies };
@@ -0,0 +1,29 @@
1
+ import type { Result } from '../../domain/result.js';
2
+ import type { GraphError } from '../../infra/graph-client.js';
3
+ declare const IMAGE_EXTENSIONS: ReadonlySet<string>;
4
+ type ConversionHints = {
5
+ readonly pdfNoText: string;
6
+ readonly legacyPpt: string;
7
+ readonly image: (ext: string) => string;
8
+ readonly generic: (ext: string) => string;
9
+ };
10
+ type BytesToMarkdownOptions = {
11
+ readonly includeMetadata?: boolean;
12
+ readonly maxCells?: number;
13
+ readonly inlineImages?: boolean;
14
+ readonly depth?: number;
15
+ };
16
+ declare const NESTED_HINTS: ConversionHints;
17
+ /**
18
+ * The single extension→converter dispatch for every markdown command, operating on
19
+ * bytes already in hand: download-drive-item-as-markdown fetches them, convert-mail
20
+ * decodes the attachment, convert-drive-item-zip unpacks the entry. Loop/Fluid/
21
+ * Whiteboard (`?format=html`) need a Graph round-trip and are handled by the drive
22
+ * caller BEFORE this — they never reach here. An Outlook `.msg` is rendered to markdown
23
+ * (headers + body) with each of its own attachments recursed through this dispatch.
24
+ * `hints` carry the caller-specific messages; a non-text result is an `err` the caller
25
+ * surfaces (a 415, or a zip note).
26
+ */
27
+ declare const bytesToMarkdown: (bytes: Uint8Array, filename: string, opts: BytesToMarkdownOptions, hints: ConversionHints) => Promise<Result<unknown, GraphError>>;
28
+ export { bytesToMarkdown, IMAGE_EXTENSIONS, NESTED_HINTS };
29
+ export type { BytesToMarkdownOptions, ConversionHints };
@@ -18,6 +18,10 @@ type MarkdownEnvelope = {
18
18
  readonly size: number;
19
19
  readonly text: string;
20
20
  };
21
- declare const convertToMarkdown: (graph: GraphClient, contentPath: string, inlineAttachments?: ReadonlyArray<InlineAttachment>) => Promise<Result<MarkdownEnvelope, GraphError>>;
21
+ type ConvertOptions = {
22
+ readonly inlineAttachments?: ReadonlyArray<InlineAttachment>;
23
+ readonly htmlTransform?: (html: string) => Promise<string>;
24
+ };
25
+ declare const convertToMarkdown: (graph: GraphClient, contentPath: string, options?: ConvertOptions) => Promise<Result<MarkdownEnvelope, GraphError>>;
22
26
  export { convertToMarkdown };
23
- export type { MarkdownEnvelope };
27
+ export type { ConvertOptions, MarkdownEnvelope };