ask-marcel-office-cli 2.1.0 → 2.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/CHANGELOG.md +283 -0
- package/README.md +178 -119
- package/dist/cli.js +44725 -27155
- package/dist/commands.json +406 -734
- package/dist/composition/build-deps.d.ts +8 -0
- package/dist/composition/mcp.d.ts +20 -0
- package/dist/composition/run-registry-command.d.ts +43 -0
- package/dist/domain/tenant-id.d.ts +9 -0
- package/dist/domain/utilities/spo-tenant.d.ts +20 -0
- package/dist/index.js +2831 -1833
- package/dist/infra/auth.d.ts +36 -14
- package/dist/infra/browser-auth.d.ts +7 -2
- package/dist/infra/graph-client.d.ts +52 -16
- package/dist/presenter/graph-cursor.d.ts +2 -0
- package/dist/presenter/output.d.ts +2 -2
- package/dist/presenter/render-to-string.d.ts +47 -0
- package/dist/use-cases/commands/build-command.d.ts +19 -2
- package/dist/use-cases/commands/command-types.d.ts +17 -31
- package/dist/use-cases/commands/convert-calendar-event-attachment-to-markdown.d.ts +4 -0
- package/dist/use-cases/commands/{convert-drive-item-zip.d.ts → convert-drive-item-zip-to-markdown.d.ts} +5 -0
- package/dist/use-cases/commands/{convert-local-file.d.ts → convert-local-file-to-markdown.d.ts} +4 -0
- package/dist/use-cases/commands/convert-mail-attachment-to-markdown.d.ts +10 -2
- package/dist/use-cases/commands/{convert-mail-attachment-zip.d.ts → convert-mail-attachment-zip-to-markdown.d.ts} +5 -1
- package/dist/use-cases/commands/convert-mail-to-markdown.d.ts +35 -1
- package/dist/use-cases/commands/create-forward-draft.d.ts +5 -1
- package/dist/use-cases/commands/create-reply-draft.d.ts +9 -1
- package/dist/use-cases/commands/docs-render.d.ts +0 -1
- package/dist/use-cases/commands/download-drive-item-as-markdown.d.ts +7 -2
- package/dist/use-cases/commands/download-drive-item-as-pdf.d.ts +1 -0
- package/dist/use-cases/commands/download-drive-item-content.d.ts +1 -0
- package/dist/use-cases/commands/draft-comment-splicer.d.ts +36 -0
- package/dist/use-cases/commands/draft-dedup.d.ts +18 -0
- package/dist/use-cases/commands/draft-response.d.ts +4 -0
- package/dist/use-cases/commands/extract-drive-item-images.d.ts +1 -0
- package/dist/use-cases/commands/extract-local-file-images.d.ts +1 -1
- package/dist/use-cases/commands/fetch-raw-bytes.d.ts +13 -0
- package/dist/use-cases/commands/find-mail-drafts.d.ts +9 -0
- package/dist/use-cases/commands/get-mail-signature.d.ts +8 -0
- package/dist/use-cases/commands/get-user.d.ts +10 -0
- package/dist/use-cases/commands/inline-image-embedder.d.ts +2 -1
- package/dist/use-cases/commands/list-mail-folder-messages-delta.d.ts +10 -2
- package/dist/use-cases/commands/login-status.d.ts +9 -27
- package/dist/use-cases/commands/login.d.ts +21 -0
- package/dist/use-cases/commands/mail-message-select.d.ts +1 -0
- package/dist/use-cases/commands/mail-quote-stripper.d.ts +16 -15
- package/dist/use-cases/commands/markdown-dispatch.d.ts +2 -1
- package/dist/use-cases/commands/msg-to-markdown.d.ts +10 -1
- package/dist/use-cases/commands/odata-query.d.ts +15 -1
- package/dist/use-cases/commands/office-to-markdown.d.ts +1 -0
- package/dist/use-cases/commands/read-mail-attachment.d.ts +4 -0
- package/dist/use-cases/commands/reject-unknown-params.d.ts +16 -0
- package/dist/use-cases/commands/resolve-command.d.ts +23 -0
- package/dist/use-cases/commands/search-all-files.d.ts +8 -0
- package/dist/use-cases/commands/search-escape.d.ts +23 -0
- package/dist/use-cases/commands/search-onenote-pages.d.ts +1 -1
- package/dist/use-cases/commands/signature-extractor.d.ts +2 -0
- package/dist/use-cases/commands/tenant-option.d.ts +44 -0
- package/dist/use-cases/commands/update-mail-draft.d.ts +5 -0
- package/dist/use-cases/commands/zip-archive-to-markdown.d.ts +10 -5
- package/dist/use-cases/ports/filesystem.d.ts +1 -1
- package/docs/COMMANDS.md +38 -33
- package/docs/USAGE.md +65 -7
- package/package.json +2 -1
|
@@ -11,6 +11,14 @@ export type BuildDepsConfig = {
|
|
|
11
11
|
readonly fs?: FileSystem;
|
|
12
12
|
readonly processRunner?: ProcessRunner;
|
|
13
13
|
readonly createAuth?: typeof createAuthManager;
|
|
14
|
+
/**
|
|
15
|
+
* Whether this is an interactive session (a real TTY with a human present).
|
|
16
|
+
* Defaults to `process.stdin.isTTY`. When true, the command-path auth keeps
|
|
17
|
+
* the first-run auto-launched sign-in browser for the basic token; when false
|
|
18
|
+
* (a headless / piped agent run) that rung fails fast instead of hanging on
|
|
19
|
+
* the interactive-login poll. Injectable so tests pin the behavior.
|
|
20
|
+
*/
|
|
21
|
+
readonly interactive?: boolean;
|
|
14
22
|
};
|
|
15
23
|
/**
|
|
16
24
|
* Builds an AuthManager configured for an interactive `login` run — unlike
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
|
+
import type { AuthManager } from '../infra/auth.js';
|
|
3
|
+
import type { GraphClient } from '../infra/graph-client.js';
|
|
4
|
+
import type { FileSystem } from '../use-cases/ports/filesystem.js';
|
|
5
|
+
import type { LoginAuthFactory } from './build-deps.js';
|
|
6
|
+
type BuildMcpServerDeps = {
|
|
7
|
+
readonly auth: AuthManager;
|
|
8
|
+
readonly graph: GraphClient;
|
|
9
|
+
readonly fs: FileSystem;
|
|
10
|
+
readonly version?: string;
|
|
11
|
+
/**
|
|
12
|
+
* Builds the AuthManager for an interactive `login` run (it may recapture
|
|
13
|
+
* secondary tokens via the browser, unlike the command-path `auth`). Mirrors
|
|
14
|
+
* `cli.ts`: when omitted (tests), the login tool falls back to `auth`.
|
|
15
|
+
*/
|
|
16
|
+
readonly makeLoginAuth?: LoginAuthFactory;
|
|
17
|
+
};
|
|
18
|
+
declare const buildMcpServer: (deps: BuildMcpServerDeps) => McpServer;
|
|
19
|
+
export { buildMcpServer };
|
|
20
|
+
export type { BuildMcpServerDeps };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { GraphClient } from '../infra/graph-client.js';
|
|
2
|
+
import type { ErrorSource } from '../presenter/error-hints.js';
|
|
3
|
+
import type { RenderSurface, SizeHintContext } from '../presenter/render-to-string.js';
|
|
4
|
+
import type { Command } from '../use-cases/commands/command-types.js';
|
|
5
|
+
import type { OutputDirError, OutputPathError } from '../use-cases/commands/output-path.js';
|
|
6
|
+
import type { Result } from '../domain/result.js';
|
|
7
|
+
import type { FileSystem } from '../use-cases/ports/filesystem.js';
|
|
8
|
+
/**
|
|
9
|
+
* The facts the oversized-response banner needs to name a remedy this caller
|
|
10
|
+
* can actually use. Derived from the manifest, so a new command gets an honest
|
|
11
|
+
* banner for free. See `SizeHintContext` in the presenter for the why.
|
|
12
|
+
*/
|
|
13
|
+
declare const buildSizeHintContext: (commandName: string, command: Command, surface: RenderSurface) => SizeHintContext;
|
|
14
|
+
declare const formatOutputPathError: (error: OutputPathError, commandName: string, surface: RenderSurface) => string;
|
|
15
|
+
declare const formatOutputDirError: (error: OutputDirError, commandName: string) => string;
|
|
16
|
+
export type RunRegistryCommandDeps = {
|
|
17
|
+
readonly graph: GraphClient;
|
|
18
|
+
readonly fs: FileSystem;
|
|
19
|
+
};
|
|
20
|
+
export type RunRegistryCommandRequest = {
|
|
21
|
+
/** Canonical registry name — drives the manifest-derived error messages. */
|
|
22
|
+
readonly name: string;
|
|
23
|
+
readonly command: Command;
|
|
24
|
+
/** Raw params, keyed by the canonical camelCase option keys. */
|
|
25
|
+
readonly params: Record<string, string>;
|
|
26
|
+
readonly outputPath?: string;
|
|
27
|
+
readonly outputDir?: string;
|
|
28
|
+
/** Which front end asked. Decides whether a remedy may mention a shell. */
|
|
29
|
+
readonly surface: RenderSurface;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
* `source` / `code` / `retryAfterSeconds` are optional on purpose: the
|
|
33
|
+
* --output-path and --output-dir rejections carry none of them, and stamping a
|
|
34
|
+
* source they never had would change the shipped error envelope.
|
|
35
|
+
*/
|
|
36
|
+
export type RunRegistryCommandFailure = {
|
|
37
|
+
readonly message: string;
|
|
38
|
+
readonly code?: string;
|
|
39
|
+
readonly source?: ErrorSource;
|
|
40
|
+
readonly retryAfterSeconds?: number;
|
|
41
|
+
};
|
|
42
|
+
export declare const runRegistryCommand: (deps: RunRegistryCommandDeps, request: RunRegistryCommandRequest) => Promise<Result<unknown, RunRegistryCommandFailure>>;
|
|
43
|
+
export { buildSizeHintContext, formatOutputDirError, formatOutputPathError };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { Result } from './result.js';
|
|
2
|
+
export type TenantId = string & {
|
|
3
|
+
readonly __brand: 'TenantId';
|
|
4
|
+
};
|
|
5
|
+
export type TenantIdError = {
|
|
6
|
+
type: 'invalid_tenant_id';
|
|
7
|
+
};
|
|
8
|
+
export declare const tenantId: (raw: string) => Result<TenantId, TenantIdError>;
|
|
9
|
+
export declare const tenantIdUnsafe: (raw: string) => TenantId;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps a SharePoint / OneDrive host to the tenant domain that owns it, so a
|
|
3
|
+
* sharing URL alone is enough to discover which tenant to ask for a guest token.
|
|
4
|
+
*
|
|
5
|
+
* A tenant's SharePoint hostname is derived from its initial `*.onmicrosoft.com`
|
|
6
|
+
* domain: `contoso.onmicrosoft.com` serves `contoso.sharepoint.com` for sites and
|
|
7
|
+
* `contoso-my.sharepoint.com` for personal OneDrive. Reversing that gives a
|
|
8
|
+
* domain the Entra OIDC discovery endpoint resolves to a tenant id, with no
|
|
9
|
+
* credentials and no prior knowledge of the tenant.
|
|
10
|
+
*
|
|
11
|
+
* Returns null for anything that is not a tenant SharePoint host — including
|
|
12
|
+
* `1drv.ms`, Microsoft's CONSUMER short-link host, which belongs to no Entra
|
|
13
|
+
* tenant. A null answer means "no guest token applies here", which leaves the
|
|
14
|
+
* caller on its home token: the current behaviour, not a failure.
|
|
15
|
+
*
|
|
16
|
+
* Verified against a real partner tenant 2026-07-16. This mapping is a
|
|
17
|
+
* convention rather than a guarantee, so callers must treat a failed discovery
|
|
18
|
+
* as "cannot cross to this tenant" and surface it, never as a crash.
|
|
19
|
+
*/
|
|
20
|
+
export declare const spoHostToTenantDomain: (host: string) => string | null;
|