ask-marcel-office-cli 1.4.0 → 1.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 (107) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/README.md +68 -24
  3. package/dist/cli.js +7631 -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 +10421 -93852
  11. package/dist/infra/auth.d.ts +26 -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
@@ -1,4 +1,5 @@
1
1
  import type { AuthManager } from '../infra/auth.js';
2
+ import { createAuthManager } from '../infra/auth.js';
2
3
  import type { GraphClient } from '../infra/graph-client.js';
3
4
  import type { FileSystem } from '../use-cases/ports/filesystem.js';
4
5
  import type { Logger } from '../use-cases/ports/logger.js';
@@ -9,12 +10,24 @@ export type BuildDepsConfig = {
9
10
  readonly home?: string;
10
11
  readonly fs?: FileSystem;
11
12
  readonly processRunner?: ProcessRunner;
13
+ readonly createAuth?: typeof createAuthManager;
12
14
  };
15
+ /**
16
+ * Builds an AuthManager configured for an interactive `login` run. The login
17
+ * command varies the browser strategy at runtime (`--use-extension`), so the
18
+ * composition root hands the CLI a factory rather than a single pre-built
19
+ * manager — keeping the concrete `createAuthManager` wiring (cache path, env)
20
+ * out of `cli.ts` and the action testable with an injected fake.
21
+ */
22
+ export type LoginAuthFactory = (opts: {
23
+ readonly useExtension: boolean;
24
+ }) => AuthManager;
13
25
  export type BuiltDeps = Readonly<{
14
26
  logger: Logger;
15
27
  auth: AuthManager;
16
28
  graph: GraphClient;
17
29
  processRunner: ProcessRunner;
18
30
  fs: FileSystem;
31
+ makeLoginAuth: LoginAuthFactory;
19
32
  }>;
20
33
  export declare const buildDeps: (config?: BuildDepsConfig) => BuiltDeps;
@@ -4,6 +4,7 @@ import type { GraphClient } from '../infra/graph-client.js';
4
4
  import type { FileSystem } from '../use-cases/ports/filesystem.js';
5
5
  import type { Logger } from '../use-cases/ports/logger.js';
6
6
  import type { ProcessRunner } from '../use-cases/ports/process-runner.js';
7
+ import type { LoginAuthFactory } from './build-deps.js';
7
8
  type BuildCliDeps = {
8
9
  readonly auth: AuthManager;
9
10
  readonly graph: GraphClient;
@@ -13,6 +14,13 @@ type BuildCliDeps = {
13
14
  readonly version?: string;
14
15
  readonly packageManager?: 'npm' | 'bun';
15
16
  readonly onCommandError?: () => void;
17
+ /**
18
+ * Builds the AuthManager for an interactive `login` run from the `--use-extension`
19
+ * flag. Supplied by the composition root (`build-deps.ts`); when omitted (tests),
20
+ * the login action falls back to the injected `auth`, so a single fake drives both
21
+ * `login.execute` and `getLastElevatedOutcome`.
22
+ */
23
+ readonly makeLoginAuth?: LoginAuthFactory;
16
24
  };
17
25
  declare const buildCli: (deps: BuildCliDeps) => Command;
18
26
  export { buildCli };
@@ -5,7 +5,7 @@ import type { Result } from './result.js';
5
5
  * built from a calendar-window parameter accepts this type so an unvalidated
6
6
  * `string` can't slip through.
7
7
  *
8
- * Audit Hervé-session §C: the previous calendar commands accepted any
8
+ * Audit Jane-session §C: the previous calendar commands accepted any
9
9
  * `z.string().min(1)`, so the LLM had to compute "last week" → ISO by hand.
10
10
  * `parseIsoDateTime` turns "7d" / "monday" / "today" / "2026-04-01" / a strict
11
11
  * ISO timestamp into the canonical ISO form, so the URL builders stay
@@ -0,0 +1,18 @@
1
+ /**
2
+ * Archive detection for Microsoft Graph `site` resources. A site collection can
3
+ * be archived two ways the CLI must recognise:
4
+ * 1. Graph returns the site with `siteCollection.archivalDetails.archiveStatus`
5
+ * set (the documented v1.0 mechanism for admin-archived team sites).
6
+ * 2. Graph fails the metadata call itself — auto-archived OneDrives (unlicensed
7
+ * ≥93 days) come back as `423 resourceLocked` ("Access to this site has been
8
+ * blocked"), the same signal `list-accessible-drives` already treats as an
9
+ * unreachable, drop-silently site.
10
+ */
11
+ declare const archiveStatusOf: (resource: unknown) => string | undefined;
12
+ declare const isArchivedSite: (resource: unknown) => boolean;
13
+ declare const errorIndicatesArchived: (e: {
14
+ readonly status?: number;
15
+ readonly code?: string;
16
+ readonly message?: string;
17
+ }) => boolean;
18
+ export { archiveStatusOf, errorIndicatesArchived, isArchivedSite };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Classify a SharePoint `webUrl` the Microsoft Search index returns but which is
3
+ * NOT a navigable site collection — fetching it 404s. Three families show up:
4
+ * 1. SharePoint Add-in (app) webs — isolated `<tenant>-<hex>.sharepoint.com`
5
+ * hosts. Add-ins are deprecated; the site redirects to
6
+ * `/_layouts/15/AddinDeprecationAnnoucement.aspx`.
7
+ * 2. SharePoint Embedded containers — `/contentstorage/...`, backing storage
8
+ * for apps (Loop / Designer / Copilot), never a navigable site collection.
9
+ * 3. System pages — any `/_layouts/...` URL is a page, not a site root.
10
+ *
11
+ * Detection is by URL shape alone (no Graph call), so these are dropped from the
12
+ * site listing before the per-site archive probe even runs.
13
+ */
14
+ declare const isNonNavigableSiteUrl: (webUrl: string) => boolean;
15
+ export { isNonNavigableSiteUrl };