@soederpop/luca 0.1.2 → 0.1.3
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/CLAUDE.md +2 -0
- package/assistants/codingAssistant/hooks.ts +1 -5
- package/assistants/inkbot/CORE.md +69 -0
- package/assistants/inkbot/hooks.ts +14 -0
- package/assistants/inkbot/tools.ts +47 -0
- package/commands/inkbot.ts +353 -0
- package/dist/agi/container.server.d.ts +63 -0
- package/dist/agi/container.server.d.ts.map +1 -0
- package/dist/agi/endpoints/ask.d.ts +20 -0
- package/dist/agi/endpoints/ask.d.ts.map +1 -0
- package/dist/agi/endpoints/conversations/[id].d.ts +27 -0
- package/dist/agi/endpoints/conversations/[id].d.ts.map +1 -0
- package/dist/agi/endpoints/conversations.d.ts +18 -0
- package/dist/agi/endpoints/conversations.d.ts.map +1 -0
- package/dist/agi/endpoints/experts.d.ts +8 -0
- package/dist/agi/endpoints/experts.d.ts.map +1 -0
- package/dist/agi/feature.d.ts +9 -0
- package/dist/agi/feature.d.ts.map +1 -0
- package/dist/agi/features/assistant.d.ts +509 -0
- package/dist/agi/features/assistant.d.ts.map +1 -0
- package/dist/agi/features/assistants-manager.d.ts +236 -0
- package/dist/agi/features/assistants-manager.d.ts.map +1 -0
- package/dist/agi/features/autonomous-assistant.d.ts +281 -0
- package/dist/agi/features/autonomous-assistant.d.ts.map +1 -0
- package/dist/agi/features/browser-use.d.ts +479 -0
- package/dist/agi/features/browser-use.d.ts.map +1 -0
- package/dist/agi/features/claude-code.d.ts +824 -0
- package/dist/agi/features/claude-code.d.ts.map +1 -0
- package/dist/agi/features/conversation-history.d.ts +245 -0
- package/dist/agi/features/conversation-history.d.ts.map +1 -0
- package/dist/agi/features/conversation.d.ts +464 -0
- package/dist/agi/features/conversation.d.ts.map +1 -0
- package/dist/agi/features/docs-reader.d.ts +72 -0
- package/dist/agi/features/docs-reader.d.ts.map +1 -0
- package/dist/agi/features/file-tools.d.ts +110 -0
- package/dist/agi/features/file-tools.d.ts.map +1 -0
- package/dist/agi/features/luca-coder.d.ts +323 -0
- package/dist/agi/features/luca-coder.d.ts.map +1 -0
- package/dist/agi/features/openai-codex.d.ts +381 -0
- package/dist/agi/features/openai-codex.d.ts.map +1 -0
- package/dist/agi/features/openapi.d.ts +200 -0
- package/dist/agi/features/openapi.d.ts.map +1 -0
- package/dist/agi/features/skills-library.d.ts +167 -0
- package/dist/agi/features/skills-library.d.ts.map +1 -0
- package/dist/agi/index.d.ts +5 -0
- package/dist/agi/index.d.ts.map +1 -0
- package/dist/agi/lib/interceptor-chain.d.ts +44 -0
- package/dist/agi/lib/interceptor-chain.d.ts.map +1 -0
- package/dist/agi/lib/token-counter.d.ts +13 -0
- package/dist/agi/lib/token-counter.d.ts.map +1 -0
- package/dist/bootstrap/generated.d.ts +5 -0
- package/dist/bootstrap/generated.d.ts.map +1 -0
- package/dist/browser.d.ts +12 -0
- package/dist/browser.d.ts.map +1 -0
- package/dist/bus.d.ts +29 -0
- package/dist/bus.d.ts.map +1 -0
- package/dist/cli/build-info.d.ts +4 -0
- package/dist/cli/build-info.d.ts.map +1 -0
- package/dist/cli/cli.d.ts +3 -0
- package/dist/cli/cli.d.ts.map +1 -0
- package/dist/client.d.ts +60 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/clients/civitai/index.d.ts +472 -0
- package/dist/clients/civitai/index.d.ts.map +1 -0
- package/dist/clients/client-template.d.ts +30 -0
- package/dist/clients/client-template.d.ts.map +1 -0
- package/dist/clients/comfyui/index.d.ts +281 -0
- package/dist/clients/comfyui/index.d.ts.map +1 -0
- package/dist/clients/elevenlabs/index.d.ts +197 -0
- package/dist/clients/elevenlabs/index.d.ts.map +1 -0
- package/dist/clients/graph.d.ts +64 -0
- package/dist/clients/graph.d.ts.map +1 -0
- package/dist/clients/openai/index.d.ts +247 -0
- package/dist/clients/openai/index.d.ts.map +1 -0
- package/dist/clients/rest.d.ts +92 -0
- package/dist/clients/rest.d.ts.map +1 -0
- package/dist/clients/supabase/index.d.ts +176 -0
- package/dist/clients/supabase/index.d.ts.map +1 -0
- package/dist/clients/websocket.d.ts +127 -0
- package/dist/clients/websocket.d.ts.map +1 -0
- package/dist/command.d.ts +163 -0
- package/dist/command.d.ts.map +1 -0
- package/dist/commands/bootstrap.d.ts +20 -0
- package/dist/commands/bootstrap.d.ts.map +1 -0
- package/dist/commands/chat.d.ts +37 -0
- package/dist/commands/chat.d.ts.map +1 -0
- package/dist/commands/code.d.ts +28 -0
- package/dist/commands/code.d.ts.map +1 -0
- package/dist/commands/console.d.ts +22 -0
- package/dist/commands/console.d.ts.map +1 -0
- package/dist/commands/describe.d.ts +50 -0
- package/dist/commands/describe.d.ts.map +1 -0
- package/dist/commands/eval.d.ts +23 -0
- package/dist/commands/eval.d.ts.map +1 -0
- package/dist/commands/help.d.ts +25 -0
- package/dist/commands/help.d.ts.map +1 -0
- package/dist/commands/index.d.ts +18 -0
- package/dist/commands/index.d.ts.map +1 -0
- package/dist/commands/introspect.d.ts +24 -0
- package/dist/commands/introspect.d.ts.map +1 -0
- package/dist/commands/mcp.d.ts +35 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/prompt.d.ts +38 -0
- package/dist/commands/prompt.d.ts.map +1 -0
- package/dist/commands/run.d.ts +24 -0
- package/dist/commands/run.d.ts.map +1 -0
- package/dist/commands/sandbox-mcp.d.ts +34 -0
- package/dist/commands/sandbox-mcp.d.ts.map +1 -0
- package/dist/commands/save-api-docs.d.ts +21 -0
- package/dist/commands/save-api-docs.d.ts.map +1 -0
- package/dist/commands/scaffold.d.ts +24 -0
- package/dist/commands/scaffold.d.ts.map +1 -0
- package/dist/commands/select.d.ts +22 -0
- package/dist/commands/select.d.ts.map +1 -0
- package/dist/commands/serve.d.ts +29 -0
- package/dist/commands/serve.d.ts.map +1 -0
- package/dist/container-describer.d.ts +144 -0
- package/dist/container-describer.d.ts.map +1 -0
- package/dist/container.d.ts +451 -0
- package/dist/container.d.ts.map +1 -0
- package/dist/endpoint.d.ts +113 -0
- package/dist/endpoint.d.ts.map +1 -0
- package/dist/feature.d.ts +47 -0
- package/dist/feature.d.ts.map +1 -0
- package/dist/graft.d.ts +29 -0
- package/dist/graft.d.ts.map +1 -0
- package/dist/hash-object.d.ts +8 -0
- package/dist/hash-object.d.ts.map +1 -0
- package/dist/helper.d.ts +209 -0
- package/dist/helper.d.ts.map +1 -0
- package/dist/introspection/generated.node.d.ts +44623 -0
- package/dist/introspection/generated.node.d.ts.map +1 -0
- package/dist/introspection/generated.web.d.ts +1412 -0
- package/dist/introspection/generated.web.d.ts.map +1 -0
- package/dist/introspection/index.d.ts +156 -0
- package/dist/introspection/index.d.ts.map +1 -0
- package/dist/introspection/scan.d.ts +147 -0
- package/dist/introspection/scan.d.ts.map +1 -0
- package/dist/node/container.d.ts +256 -0
- package/dist/node/container.d.ts.map +1 -0
- package/dist/node/feature.d.ts +9 -0
- package/dist/node/feature.d.ts.map +1 -0
- package/dist/node/features/container-link.d.ts +213 -0
- package/dist/node/features/container-link.d.ts.map +1 -0
- package/dist/node/features/content-db.d.ts +354 -0
- package/dist/node/features/content-db.d.ts.map +1 -0
- package/dist/node/features/disk-cache.d.ts +236 -0
- package/dist/node/features/disk-cache.d.ts.map +1 -0
- package/dist/node/features/dns.d.ts +511 -0
- package/dist/node/features/dns.d.ts.map +1 -0
- package/dist/node/features/docker.d.ts +485 -0
- package/dist/node/features/docker.d.ts.map +1 -0
- package/dist/node/features/downloader.d.ts +73 -0
- package/dist/node/features/downloader.d.ts.map +1 -0
- package/dist/node/features/figlet-fonts.d.ts +4 -0
- package/dist/node/features/figlet-fonts.d.ts.map +1 -0
- package/dist/node/features/file-manager.d.ts +177 -0
- package/dist/node/features/file-manager.d.ts.map +1 -0
- package/dist/node/features/fs.d.ts +635 -0
- package/dist/node/features/fs.d.ts.map +1 -0
- package/dist/node/features/git.d.ts +329 -0
- package/dist/node/features/git.d.ts.map +1 -0
- package/dist/node/features/google-auth.d.ts +200 -0
- package/dist/node/features/google-auth.d.ts.map +1 -0
- package/dist/node/features/google-calendar.d.ts +194 -0
- package/dist/node/features/google-calendar.d.ts.map +1 -0
- package/dist/node/features/google-docs.d.ts +138 -0
- package/dist/node/features/google-docs.d.ts.map +1 -0
- package/dist/node/features/google-drive.d.ts +202 -0
- package/dist/node/features/google-drive.d.ts.map +1 -0
- package/dist/node/features/google-mail.d.ts +221 -0
- package/dist/node/features/google-mail.d.ts.map +1 -0
- package/dist/node/features/google-sheets.d.ts +157 -0
- package/dist/node/features/google-sheets.d.ts.map +1 -0
- package/dist/node/features/grep.d.ts +207 -0
- package/dist/node/features/grep.d.ts.map +1 -0
- package/dist/node/features/helpers.d.ts +236 -0
- package/dist/node/features/helpers.d.ts.map +1 -0
- package/dist/node/features/ink.d.ts +332 -0
- package/dist/node/features/ink.d.ts.map +1 -0
- package/dist/node/features/ipc-socket.d.ts +298 -0
- package/dist/node/features/ipc-socket.d.ts.map +1 -0
- package/dist/node/features/json-tree.d.ts +140 -0
- package/dist/node/features/json-tree.d.ts.map +1 -0
- package/dist/node/features/networking.d.ts +373 -0
- package/dist/node/features/networking.d.ts.map +1 -0
- package/dist/node/features/nlp.d.ts +125 -0
- package/dist/node/features/nlp.d.ts.map +1 -0
- package/dist/node/features/opener.d.ts +93 -0
- package/dist/node/features/opener.d.ts.map +1 -0
- package/dist/node/features/os.d.ts +168 -0
- package/dist/node/features/os.d.ts.map +1 -0
- package/dist/node/features/package-finder.d.ts +419 -0
- package/dist/node/features/package-finder.d.ts.map +1 -0
- package/dist/node/features/postgres.d.ts +173 -0
- package/dist/node/features/postgres.d.ts.map +1 -0
- package/dist/node/features/proc.d.ts +285 -0
- package/dist/node/features/proc.d.ts.map +1 -0
- package/dist/node/features/process-manager.d.ts +427 -0
- package/dist/node/features/process-manager.d.ts.map +1 -0
- package/dist/node/features/python.d.ts +477 -0
- package/dist/node/features/python.d.ts.map +1 -0
- package/dist/node/features/redis.d.ts +247 -0
- package/dist/node/features/redis.d.ts.map +1 -0
- package/dist/node/features/repl.d.ts +84 -0
- package/dist/node/features/repl.d.ts.map +1 -0
- package/dist/node/features/runpod.d.ts +527 -0
- package/dist/node/features/runpod.d.ts.map +1 -0
- package/dist/node/features/secure-shell.d.ts +145 -0
- package/dist/node/features/secure-shell.d.ts.map +1 -0
- package/dist/node/features/semantic-search.d.ts +207 -0
- package/dist/node/features/semantic-search.d.ts.map +1 -0
- package/dist/node/features/sqlite.d.ts +180 -0
- package/dist/node/features/sqlite.d.ts.map +1 -0
- package/dist/node/features/telegram.d.ts +173 -0
- package/dist/node/features/telegram.d.ts.map +1 -0
- package/dist/node/features/transpiler.d.ts +51 -0
- package/dist/node/features/transpiler.d.ts.map +1 -0
- package/dist/node/features/tts.d.ts +108 -0
- package/dist/node/features/tts.d.ts.map +1 -0
- package/dist/node/features/ui.d.ts +562 -0
- package/dist/node/features/ui.d.ts.map +1 -0
- package/dist/node/features/vault.d.ts +90 -0
- package/dist/node/features/vault.d.ts.map +1 -0
- package/dist/node/features/vm.d.ts +285 -0
- package/dist/node/features/vm.d.ts.map +1 -0
- package/dist/node/features/yaml-tree.d.ts +118 -0
- package/dist/node/features/yaml-tree.d.ts.map +1 -0
- package/dist/node/features/yaml.d.ts +127 -0
- package/dist/node/features/yaml.d.ts.map +1 -0
- package/dist/node.d.ts +67 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/python/generated.d.ts +2 -0
- package/dist/python/generated.d.ts.map +1 -0
- package/dist/react/index.d.ts +36 -0
- package/dist/react/index.d.ts.map +1 -0
- package/dist/registry.d.ts +97 -0
- package/dist/registry.d.ts.map +1 -0
- package/dist/scaffolds/generated.d.ts +13 -0
- package/dist/scaffolds/generated.d.ts.map +1 -0
- package/dist/scaffolds/template.d.ts +11 -0
- package/dist/scaffolds/template.d.ts.map +1 -0
- package/dist/schemas/base.d.ts +254 -0
- package/dist/schemas/base.d.ts.map +1 -0
- package/dist/selector.d.ts +130 -0
- package/dist/selector.d.ts.map +1 -0
- package/dist/server.d.ts +89 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/servers/express.d.ts +104 -0
- package/dist/servers/express.d.ts.map +1 -0
- package/dist/servers/mcp.d.ts +201 -0
- package/dist/servers/mcp.d.ts.map +1 -0
- package/dist/servers/socket.d.ts +121 -0
- package/dist/servers/socket.d.ts.map +1 -0
- package/dist/state.d.ts +24 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/web/clients/socket.d.ts +37 -0
- package/dist/web/clients/socket.d.ts.map +1 -0
- package/dist/web/container.d.ts +55 -0
- package/dist/web/container.d.ts.map +1 -0
- package/dist/web/extension.d.ts +4 -0
- package/dist/web/extension.d.ts.map +1 -0
- package/dist/web/feature.d.ts +8 -0
- package/dist/web/feature.d.ts.map +1 -0
- package/dist/web/features/asset-loader.d.ts +35 -0
- package/dist/web/features/asset-loader.d.ts.map +1 -0
- package/dist/web/features/container-link.d.ts +167 -0
- package/dist/web/features/container-link.d.ts.map +1 -0
- package/dist/web/features/esbuild.d.ts +51 -0
- package/dist/web/features/esbuild.d.ts.map +1 -0
- package/dist/web/features/helpers.d.ts +140 -0
- package/dist/web/features/helpers.d.ts.map +1 -0
- package/dist/web/features/network.d.ts +69 -0
- package/dist/web/features/network.d.ts.map +1 -0
- package/dist/web/features/speech.d.ts +71 -0
- package/dist/web/features/speech.d.ts.map +1 -0
- package/dist/web/features/vault.d.ts +62 -0
- package/dist/web/features/vault.d.ts.map +1 -0
- package/dist/web/features/vm.d.ts +48 -0
- package/dist/web/features/vm.d.ts.map +1 -0
- package/dist/web/features/voice-recognition.d.ts +96 -0
- package/dist/web/features/voice-recognition.d.ts.map +1 -0
- package/dist/web/shims/isomorphic-vm.d.ts +22 -0
- package/dist/web/shims/isomorphic-vm.d.ts.map +1 -0
- package/docs/apis/features/agi/assistant.md +1 -0
- package/docs/apis/features/agi/assistants-manager.md +62 -2
- package/docs/apis/features/agi/auto-assistant.md +11 -109
- package/docs/apis/features/agi/claude-code.md +138 -0
- package/docs/apis/features/agi/conversation.md +60 -31
- package/docs/apis/features/agi/luca-coder.md +407 -0
- package/docs/apis/features/agi/openapi.md +2 -2
- package/docs/apis/features/agi/skills-library.md +12 -0
- package/docs/apis/features/node/python.md +81 -11
- package/docs/apis/features/node/transpiler.md +74 -0
- package/docs/apis/features/web/esbuild.md +0 -6
- package/docs/apis/servers/mcp.md +2 -2
- package/docs/examples/entity.md +124 -0
- package/package.json +73 -21
- package/src/agi/feature.ts +13 -0
- package/src/agi/features/assistant.ts +36 -25
- package/src/agi/features/assistants-manager.ts +70 -5
- package/src/agi/features/autonomous-assistant.ts +1 -5
- package/src/agi/features/browser-use.ts +2 -2
- package/src/agi/features/claude-code.ts +165 -1
- package/src/agi/features/conversation-history.ts +2 -6
- package/src/agi/features/conversation.ts +95 -3
- package/src/agi/features/docs-reader.ts +2 -1
- package/src/agi/features/file-tools.ts +2 -2
- package/src/agi/features/luca-coder.ts +1 -5
- package/src/agi/features/openai-codex.ts +1 -1
- package/src/agi/features/openapi.ts +3 -3
- package/src/agi/features/skills-library.ts +87 -6
- package/src/agi/lib/interceptor-chain.ts +10 -0
- package/src/agi/lib/token-counter.ts +1 -1
- package/src/bootstrap/generated.ts +126 -1
- package/src/bus.ts +27 -5
- package/src/cli/build-info.ts +2 -2
- package/src/client.ts +2 -2
- package/src/clients/elevenlabs/index.ts +5 -0
- package/src/commands/bootstrap.ts +2 -1
- package/src/commands/chat.ts +1 -0
- package/src/commands/code.ts +4 -2
- package/src/commands/prompt.ts +34 -34
- package/src/commands/sandbox-mcp.ts +69 -163
- package/src/commands/save-api-docs.ts +10 -8
- package/src/commands/select.ts +8 -3
- package/src/container-describer.ts +70 -84
- package/src/container.ts +93 -3
- package/src/endpoint.ts +1 -1
- package/src/entity.ts +173 -0
- package/src/feature.ts +3 -3
- package/src/helper.ts +8 -4
- package/src/introspection/generated.agi.ts +1246 -798
- package/src/introspection/generated.node.ts +892 -798
- package/src/introspection/generated.web.ts +95 -3
- package/src/introspection/scan.ts +1 -1
- package/src/node/container.ts +1 -1
- package/src/node/features/content-db.ts +3 -3
- package/src/node/features/file-manager.ts +10 -9
- package/src/node/features/git.ts +5 -5
- package/src/node/features/helpers.ts +1 -1
- package/src/node/features/json-tree.ts +1 -1
- package/src/node/features/os.ts +3 -3
- package/src/node/features/package-finder.ts +1 -1
- package/src/node/features/process-manager.ts +1 -1
- package/src/node/features/python.ts +3 -3
- package/src/node/features/redis.ts +1 -1
- package/src/node/features/repl.ts +2 -2
- package/src/node/features/transpiler.ts +2 -2
- package/src/node/features/ui.ts +1 -1
- package/src/node/features/vm.ts +3 -3
- package/src/node/features/yaml-tree.ts +1 -1
- package/src/node.ts +1 -0
- package/src/python/generated.ts +1 -1
- package/src/scaffolds/generated.ts +1 -1
- package/src/selector.ts +74 -4
- package/src/server.ts +2 -2
- package/src/servers/mcp.ts +6 -6
- package/src/web/features/helpers.ts +1 -1
- package/src/web/features/network.ts +1 -0
- package/test/conversation.test.ts +220 -0
- package/tsconfig.build.json +12 -0
- package/tsconfig.json +1 -1
- package/scripts/examples/telegram-ink-ui.ts +0 -302
- package/scripts/examples/using-openai-codex.ts +0 -23
- package/scripts/examples/vm-loading-esm-modules.ts +0 -16
|
@@ -0,0 +1,329 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { State } from '../../state.js';
|
|
3
|
+
import { Feature } from '../feature.js';
|
|
4
|
+
type LsFilesOptions = {
|
|
5
|
+
cached?: boolean;
|
|
6
|
+
deleted?: boolean;
|
|
7
|
+
modified?: boolean;
|
|
8
|
+
others?: boolean;
|
|
9
|
+
ignored?: boolean;
|
|
10
|
+
status?: boolean;
|
|
11
|
+
includeIgnored?: boolean;
|
|
12
|
+
exclude?: string | string[];
|
|
13
|
+
baseDir?: string;
|
|
14
|
+
};
|
|
15
|
+
declare const GitStateSchema: z.ZodObject<{
|
|
16
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
17
|
+
repoRoot: z.ZodOptional<z.ZodString>;
|
|
18
|
+
}, z.core.$loose>;
|
|
19
|
+
type GitState = z.infer<typeof GitStateSchema>;
|
|
20
|
+
/**
|
|
21
|
+
* The Git feature provides utilities for interacting with Git repositories.
|
|
22
|
+
*
|
|
23
|
+
* This feature allows you to check repository status, list files, get branch information,
|
|
24
|
+
* and access Git metadata for projects within a Git repository.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```typescript
|
|
28
|
+
* const git = container.feature('git')
|
|
29
|
+
*
|
|
30
|
+
* if (git.isRepo) {
|
|
31
|
+
* console.log(`Current branch: ${git.branch}`)
|
|
32
|
+
* console.log(`Repository root: ${git.repoRoot}`)
|
|
33
|
+
*
|
|
34
|
+
* const allFiles = await git.lsFiles()
|
|
35
|
+
* const modifiedFiles = await git.lsFiles({ modified: true })
|
|
36
|
+
* }
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* @extends Feature
|
|
40
|
+
*/
|
|
41
|
+
export declare class Git extends Feature {
|
|
42
|
+
static shortcut: "features.git";
|
|
43
|
+
static stateSchema: z.ZodObject<{
|
|
44
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
45
|
+
repoRoot: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, z.core.$loose>;
|
|
47
|
+
static optionsSchema: z.ZodObject<{
|
|
48
|
+
name: z.ZodOptional<z.ZodString>;
|
|
49
|
+
_cacheKey: z.ZodOptional<z.ZodString>;
|
|
50
|
+
cached: z.ZodOptional<z.ZodBoolean>;
|
|
51
|
+
enable: z.ZodOptional<z.ZodBoolean>;
|
|
52
|
+
}, z.core.$strip>;
|
|
53
|
+
state: State<GitState>;
|
|
54
|
+
private _resolvedGitPath;
|
|
55
|
+
/** Resolve the git binary path via `which`, caching the result. */
|
|
56
|
+
get gitPath(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Lists files in the Git repository using git ls-files command.
|
|
59
|
+
*
|
|
60
|
+
* This method provides a flexible interface to the git ls-files command,
|
|
61
|
+
* allowing you to filter files by various criteria such as cached, deleted,
|
|
62
|
+
* modified, untracked, and ignored files.
|
|
63
|
+
*
|
|
64
|
+
* @param {LsFilesOptions} [options={}] - Options to control which files are listed
|
|
65
|
+
* @param {boolean} [options.cached=false] - Show cached/staged files
|
|
66
|
+
* @param {boolean} [options.deleted=false] - Show deleted files
|
|
67
|
+
* @param {boolean} [options.modified=false] - Show modified files
|
|
68
|
+
* @param {boolean} [options.others=false] - Show untracked files
|
|
69
|
+
* @param {boolean} [options.ignored=false] - Show ignored files
|
|
70
|
+
* @param {boolean} [options.status=false] - Show file status information
|
|
71
|
+
* @param {boolean} [options.includeIgnored=false] - Include ignored files when showing others
|
|
72
|
+
* @param {string | string[]} [options.exclude] - Patterns to exclude from results
|
|
73
|
+
* @param {string} [options.baseDir=''] - Base directory to list files from
|
|
74
|
+
* @returns {Promise<string[]>} Promise that resolves to an array of file paths
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* ```typescript
|
|
78
|
+
* // Get all tracked files
|
|
79
|
+
* const allFiles = await git.lsFiles()
|
|
80
|
+
*
|
|
81
|
+
* // Get only modified files
|
|
82
|
+
* const modified = await git.lsFiles({ modified: true })
|
|
83
|
+
*
|
|
84
|
+
* // Get untracked files excluding certain patterns
|
|
85
|
+
* const untracked = await git.lsFiles({
|
|
86
|
+
* others: true,
|
|
87
|
+
* exclude: ['*.log', 'node_modules']
|
|
88
|
+
* })
|
|
89
|
+
* ```
|
|
90
|
+
*/
|
|
91
|
+
lsFiles(options?: LsFilesOptions): Promise<string[]>;
|
|
92
|
+
/**
|
|
93
|
+
* Gets the current Git branch name.
|
|
94
|
+
*
|
|
95
|
+
* @returns {string | null} The current branch name, or null if not in a Git repository
|
|
96
|
+
*
|
|
97
|
+
* @example
|
|
98
|
+
* ```typescript
|
|
99
|
+
* const currentBranch = git.branch
|
|
100
|
+
* if (currentBranch) {
|
|
101
|
+
* console.log(`Currently on branch: ${currentBranch}`)
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
105
|
+
get branch(): string | null;
|
|
106
|
+
/**
|
|
107
|
+
* Gets the current Git commit SHA hash.
|
|
108
|
+
*
|
|
109
|
+
* @returns {string | null} The current commit SHA, or null if not in a Git repository
|
|
110
|
+
*
|
|
111
|
+
* @example
|
|
112
|
+
* ```typescript
|
|
113
|
+
* const commitSha = git.sha
|
|
114
|
+
* if (commitSha) {
|
|
115
|
+
* console.log(`Current commit: ${commitSha}`)
|
|
116
|
+
* }
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
get sha(): string | null;
|
|
120
|
+
/**
|
|
121
|
+
* Checks if the current directory is within a Git repository.
|
|
122
|
+
*
|
|
123
|
+
* @returns {boolean} True if currently in a Git repository, false otherwise
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* if (git.isRepo) {
|
|
128
|
+
* console.log('This is a Git repository!')
|
|
129
|
+
* } else {
|
|
130
|
+
* console.log('Not in a Git repository')
|
|
131
|
+
* }
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
get isRepo(): boolean;
|
|
135
|
+
/**
|
|
136
|
+
* Checks if the current working directory is the root of the Git repository.
|
|
137
|
+
*
|
|
138
|
+
* @returns {boolean} True if currently at the repository root, false otherwise
|
|
139
|
+
*
|
|
140
|
+
* @example
|
|
141
|
+
* ```typescript
|
|
142
|
+
* if (git.isRepoRoot) {
|
|
143
|
+
* console.log('At the repository root')
|
|
144
|
+
* } else {
|
|
145
|
+
* console.log('In a subdirectory of the repository')
|
|
146
|
+
* }
|
|
147
|
+
* ```
|
|
148
|
+
*/
|
|
149
|
+
get isRepoRoot(): boolean;
|
|
150
|
+
/**
|
|
151
|
+
* Gets the absolute path to the Git repository root directory.
|
|
152
|
+
*
|
|
153
|
+
* This method caches the repository root path for performance. It searches upward
|
|
154
|
+
* from the current directory to find the .git directory.
|
|
155
|
+
*
|
|
156
|
+
* @returns {string | null} The absolute path to the repository root, or null if not in a Git repository
|
|
157
|
+
*
|
|
158
|
+
* @example
|
|
159
|
+
* ```typescript
|
|
160
|
+
* const repoRoot = git.repoRoot
|
|
161
|
+
* if (repoRoot) {
|
|
162
|
+
* console.log(`Repository root: ${repoRoot}`)
|
|
163
|
+
* }
|
|
164
|
+
* ```
|
|
165
|
+
*/
|
|
166
|
+
get repoRoot(): string | null;
|
|
167
|
+
/**
|
|
168
|
+
* Gets the latest commits from the repository.
|
|
169
|
+
*
|
|
170
|
+
* Returns an array of commit objects containing the title (first line of commit message),
|
|
171
|
+
* full message body, and author name for each commit.
|
|
172
|
+
*
|
|
173
|
+
* @param {number} [numberOfChanges=10] - The number of recent commits to return
|
|
174
|
+
* @returns {Promise<Array<{ title: string, message: string, author: string }>>} Array of commit objects
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* const changes = await git.getLatestChanges(5)
|
|
179
|
+
* for (const commit of changes) {
|
|
180
|
+
* console.log(`${commit.author}: ${commit.title}`)
|
|
181
|
+
* }
|
|
182
|
+
* ```
|
|
183
|
+
*/
|
|
184
|
+
getLatestChanges(numberOfChanges?: number): Promise<Array<{
|
|
185
|
+
title: string;
|
|
186
|
+
message: string;
|
|
187
|
+
author: string;
|
|
188
|
+
}>>;
|
|
189
|
+
/**
|
|
190
|
+
* Gets a lightweight commit log for one or more files.
|
|
191
|
+
*
|
|
192
|
+
* Returns the SHA and message for each commit that touched the given files,
|
|
193
|
+
* without the per-commit overhead of resolving which specific files matched.
|
|
194
|
+
* For richer per-file matching, see {@link getChangeHistoryForFiles}.
|
|
195
|
+
*
|
|
196
|
+
* @param {...string} files - File paths (absolute or relative to container.cwd)
|
|
197
|
+
* @returns {Array<{ sha: string, message: string }>} Array of commits
|
|
198
|
+
*
|
|
199
|
+
* @example
|
|
200
|
+
* ```typescript
|
|
201
|
+
* const log = git.fileLog('package.json')
|
|
202
|
+
* const log = git.fileLog('src/index.ts', 'src/helper.ts')
|
|
203
|
+
* for (const entry of log) {
|
|
204
|
+
* console.log(`${entry.sha.slice(0, 8)} ${entry.message}`)
|
|
205
|
+
* }
|
|
206
|
+
* ```
|
|
207
|
+
*/
|
|
208
|
+
fileLog(...files: string[]): Array<{
|
|
209
|
+
sha: string;
|
|
210
|
+
message: string;
|
|
211
|
+
}>;
|
|
212
|
+
/**
|
|
213
|
+
* Gets the diff for a file between two refs.
|
|
214
|
+
*
|
|
215
|
+
* By default compares from the current HEAD to the given ref. You can
|
|
216
|
+
* supply both `compareTo` and `compareFrom` to diff between any two commits,
|
|
217
|
+
* branches, or tags.
|
|
218
|
+
*
|
|
219
|
+
* @param {string} file - File path (absolute or relative to container.cwd)
|
|
220
|
+
* @param {string} compareTo - The target ref (commit SHA, branch, tag) to compare to
|
|
221
|
+
* @param {string} [compareFrom] - The base ref to compare from (defaults to current HEAD)
|
|
222
|
+
* @returns {string} The diff output, or an empty string if there are no changes
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```typescript
|
|
226
|
+
* // Diff package.json between HEAD and a specific commit
|
|
227
|
+
* const d = git.diff('package.json', 'abc1234')
|
|
228
|
+
*
|
|
229
|
+
* // Diff between two branches
|
|
230
|
+
* const d = git.diff('src/index.ts', 'feature-branch', 'main')
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
diff(file: string, compareTo: string, compareFrom?: string): string;
|
|
234
|
+
/**
|
|
235
|
+
* Pretty prints a unified diff string to the terminal using colors.
|
|
236
|
+
*
|
|
237
|
+
* Parses the diff output and applies color coding:
|
|
238
|
+
* - File headers (`diff --git`, `---`, `+++`) are rendered bold
|
|
239
|
+
* - Hunk headers (`@@ ... @@`) are rendered in cyan
|
|
240
|
+
* - Added lines (`+`) are rendered in green
|
|
241
|
+
* - Removed lines (`-`) are rendered in red
|
|
242
|
+
* - Context lines are rendered dim
|
|
243
|
+
*
|
|
244
|
+
* Can be called with a raw diff string, or with the same arguments as
|
|
245
|
+
* {@link diff} to fetch and display in one step.
|
|
246
|
+
*
|
|
247
|
+
* @param diffOrFile - A raw diff string, or a file path to pass to {@link diff}
|
|
248
|
+
* @param compareTo - When diffOrFile is a file path, the target ref to compare to
|
|
249
|
+
* @param compareFrom - When diffOrFile is a file path, the base ref to compare from
|
|
250
|
+
* @returns The colorized diff string (also prints to stdout)
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```typescript
|
|
254
|
+
* // Display a pre-fetched diff
|
|
255
|
+
* const raw = git.diff('src/index.ts', 'main')
|
|
256
|
+
* git.displayDiff(raw)
|
|
257
|
+
*
|
|
258
|
+
* // Fetch and display in one call
|
|
259
|
+
* git.displayDiff('src/index.ts', 'abc1234')
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
displayDiff(diffOrFile: string, compareTo?: string, compareFrom?: string): string;
|
|
263
|
+
/**
|
|
264
|
+
* Extracts a folder (or entire repo) from a remote GitHub repository without cloning.
|
|
265
|
+
*
|
|
266
|
+
* Downloads the repo as a tarball and extracts only the specified subfolder,
|
|
267
|
+
* similar to how degit works. No .git history is included — just the files.
|
|
268
|
+
*
|
|
269
|
+
* Supports shorthand (`user/repo/path`), branch refs (`user/repo/path#branch`),
|
|
270
|
+
* and full GitHub URLs (`https://github.com/user/repo/tree/branch/path`).
|
|
271
|
+
*
|
|
272
|
+
* @param {object} options
|
|
273
|
+
* @param {string} options.source - Repository source in degit-style shorthand
|
|
274
|
+
* @param {string} options.destination - Local path to extract files into
|
|
275
|
+
* @param {string} [options.branch] - Branch, tag, or commit ref (overrides ref in source string)
|
|
276
|
+
* @returns {Promise<{ files: string[], source: { user: string, repo: string, ref: string, subdir: string } }>}
|
|
277
|
+
*
|
|
278
|
+
* @example
|
|
279
|
+
* ```typescript
|
|
280
|
+
* // Extract a subfolder
|
|
281
|
+
* await git.extractFolder({ source: 'soederpop/luca/src/assistants', destination: './my-assistants' })
|
|
282
|
+
*
|
|
283
|
+
* // Specific branch
|
|
284
|
+
* await git.extractFolder({ source: 'sveltejs/template', destination: './my-app', branch: 'main' })
|
|
285
|
+
*
|
|
286
|
+
* // Full GitHub URL
|
|
287
|
+
* await git.extractFolder({ source: 'https://github.com/user/repo/tree/main/examples', destination: './examples' })
|
|
288
|
+
* ```
|
|
289
|
+
*/
|
|
290
|
+
extractFolder({ source, destination, branch }: {
|
|
291
|
+
source: string;
|
|
292
|
+
destination: string;
|
|
293
|
+
branch?: string;
|
|
294
|
+
}): Promise<{
|
|
295
|
+
files: string[];
|
|
296
|
+
source: {
|
|
297
|
+
user: string | undefined;
|
|
298
|
+
repo: string | undefined;
|
|
299
|
+
ref: string | undefined;
|
|
300
|
+
subdir: string;
|
|
301
|
+
};
|
|
302
|
+
}>;
|
|
303
|
+
/** Parses degit-style source strings into components. */
|
|
304
|
+
private _parseRemoteSource;
|
|
305
|
+
/**
|
|
306
|
+
* Gets the commit history for a set of files or glob patterns.
|
|
307
|
+
*
|
|
308
|
+
* Accepts absolute paths, relative paths (resolved from container.cwd),
|
|
309
|
+
* or glob patterns. Returns commits that touched any of the matched files,
|
|
310
|
+
* with each entry noting which of your queried files were in that commit.
|
|
311
|
+
*
|
|
312
|
+
* @param {...string} paths - File paths or glob patterns to get history for
|
|
313
|
+
* @returns {Array<{ sha: string, message: string, longMessage: string, filesMatched: string[] }>}
|
|
314
|
+
*
|
|
315
|
+
* @example
|
|
316
|
+
* ```typescript
|
|
317
|
+
* const history = git.getChangeHistoryForFiles('src/container.ts', 'src/helper.ts')
|
|
318
|
+
* const history = git.getChangeHistoryForFiles('src/node/features/*.ts')
|
|
319
|
+
* ```
|
|
320
|
+
*/
|
|
321
|
+
getChangeHistoryForFiles(...paths: string[]): Array<{
|
|
322
|
+
sha: string;
|
|
323
|
+
message: string;
|
|
324
|
+
longMessage: string;
|
|
325
|
+
filesMatched: string[];
|
|
326
|
+
}>;
|
|
327
|
+
}
|
|
328
|
+
export default Git;
|
|
329
|
+
//# sourceMappingURL=git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":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wB,CAAC,GAAG,KAAK,EAAE,MAAM,EAAE,GAAG,KAAK,CAAC;QAAE,GAAG,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,YAAY,EAAE,MAAM,EAAE,CAAA;KAAE,CAAC;CA4DrI;AAED,eAAe,GAAG,CAAA"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Feature } from '../feature.js';
|
|
3
|
+
import { google } from 'googleapis';
|
|
4
|
+
import type { OAuth2Client } from 'google-auth-library';
|
|
5
|
+
export declare const GoogleAuthStateSchema: z.ZodObject<{
|
|
6
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
7
|
+
authMode: z.ZodDefault<z.ZodEnum<{
|
|
8
|
+
oauth2: "oauth2";
|
|
9
|
+
"service-account": "service-account";
|
|
10
|
+
none: "none";
|
|
11
|
+
}>>;
|
|
12
|
+
isAuthenticated: z.ZodDefault<z.ZodBoolean>;
|
|
13
|
+
email: z.ZodOptional<z.ZodString>;
|
|
14
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
15
|
+
tokenExpiry: z.ZodOptional<z.ZodString>;
|
|
16
|
+
lastError: z.ZodOptional<z.ZodString>;
|
|
17
|
+
}, z.core.$loose>;
|
|
18
|
+
export type GoogleAuthState = z.infer<typeof GoogleAuthStateSchema>;
|
|
19
|
+
export declare const GoogleAuthOptionsSchema: z.ZodObject<{
|
|
20
|
+
name: z.ZodOptional<z.ZodString>;
|
|
21
|
+
_cacheKey: z.ZodOptional<z.ZodString>;
|
|
22
|
+
cached: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
enable: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
25
|
+
oauth2: "oauth2";
|
|
26
|
+
"service-account": "service-account";
|
|
27
|
+
}>>;
|
|
28
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
29
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
|
30
|
+
serviceAccountKeyPath: z.ZodOptional<z.ZodString>;
|
|
31
|
+
serviceAccountKey: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
32
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
33
|
+
redirectPort: z.ZodOptional<z.ZodNumber>;
|
|
34
|
+
tokenCacheKey: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>;
|
|
36
|
+
export type GoogleAuthOptions = z.infer<typeof GoogleAuthOptionsSchema>;
|
|
37
|
+
export declare const GoogleAuthEventsSchema: z.ZodObject<{
|
|
38
|
+
stateChange: z.ZodTuple<[z.ZodAny], null>;
|
|
39
|
+
enabled: z.ZodTuple<[], null>;
|
|
40
|
+
authenticated: z.ZodTuple<[z.ZodObject<{
|
|
41
|
+
mode: z.ZodString;
|
|
42
|
+
email: z.ZodOptional<z.ZodString>;
|
|
43
|
+
}, z.core.$strip>], null>;
|
|
44
|
+
tokenRefreshed: z.ZodTuple<[], null>;
|
|
45
|
+
authorizationRequired: z.ZodTuple<[z.ZodString], null>;
|
|
46
|
+
error: z.ZodTuple<[z.ZodAny], null>;
|
|
47
|
+
}, z.core.$strip>;
|
|
48
|
+
/**
|
|
49
|
+
* Google authentication feature supporting OAuth2 browser flow and service account auth.
|
|
50
|
+
*
|
|
51
|
+
* Handles the complete OAuth2 lifecycle: authorization URL generation, local callback server,
|
|
52
|
+
* token exchange, refresh token storage (via diskCache), and automatic token refresh.
|
|
53
|
+
* Also supports non-interactive service account authentication via JSON key files.
|
|
54
|
+
*
|
|
55
|
+
* Other Google features (drive, sheets, calendar, docs) depend on this feature
|
|
56
|
+
* and access it lazily via `container.feature('googleAuth')`.
|
|
57
|
+
*
|
|
58
|
+
* @example
|
|
59
|
+
* ```typescript
|
|
60
|
+
* // OAuth2 flow — opens browser for consent
|
|
61
|
+
* const auth = container.feature('googleAuth', {
|
|
62
|
+
* clientId: 'your-client-id.apps.googleusercontent.com',
|
|
63
|
+
* clientSecret: 'your-secret',
|
|
64
|
+
* scopes: ['https://www.googleapis.com/auth/drive.readonly'],
|
|
65
|
+
* })
|
|
66
|
+
* await auth.authorize()
|
|
67
|
+
*
|
|
68
|
+
* // Service account flow — no browser needed
|
|
69
|
+
* const auth = container.feature('googleAuth', {
|
|
70
|
+
* serviceAccountKeyPath: '/path/to/key.json',
|
|
71
|
+
* scopes: ['https://www.googleapis.com/auth/spreadsheets.readonly'],
|
|
72
|
+
* })
|
|
73
|
+
* await auth.authenticateServiceAccount()
|
|
74
|
+
* ```
|
|
75
|
+
*/
|
|
76
|
+
export declare class GoogleAuth extends Feature<GoogleAuthState, GoogleAuthOptions> {
|
|
77
|
+
static shortcut: "features.googleAuth";
|
|
78
|
+
static envVars: string[];
|
|
79
|
+
static stateSchema: z.ZodObject<{
|
|
80
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
81
|
+
authMode: z.ZodDefault<z.ZodEnum<{
|
|
82
|
+
oauth2: "oauth2";
|
|
83
|
+
"service-account": "service-account";
|
|
84
|
+
none: "none";
|
|
85
|
+
}>>;
|
|
86
|
+
isAuthenticated: z.ZodDefault<z.ZodBoolean>;
|
|
87
|
+
email: z.ZodOptional<z.ZodString>;
|
|
88
|
+
scopes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
89
|
+
tokenExpiry: z.ZodOptional<z.ZodString>;
|
|
90
|
+
lastError: z.ZodOptional<z.ZodString>;
|
|
91
|
+
}, z.core.$loose>;
|
|
92
|
+
static optionsSchema: z.ZodObject<{
|
|
93
|
+
name: z.ZodOptional<z.ZodString>;
|
|
94
|
+
_cacheKey: z.ZodOptional<z.ZodString>;
|
|
95
|
+
cached: z.ZodOptional<z.ZodBoolean>;
|
|
96
|
+
enable: z.ZodOptional<z.ZodBoolean>;
|
|
97
|
+
mode: z.ZodOptional<z.ZodEnum<{
|
|
98
|
+
oauth2: "oauth2";
|
|
99
|
+
"service-account": "service-account";
|
|
100
|
+
}>>;
|
|
101
|
+
clientId: z.ZodOptional<z.ZodString>;
|
|
102
|
+
clientSecret: z.ZodOptional<z.ZodString>;
|
|
103
|
+
serviceAccountKeyPath: z.ZodOptional<z.ZodString>;
|
|
104
|
+
serviceAccountKey: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
105
|
+
scopes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
106
|
+
redirectPort: z.ZodOptional<z.ZodNumber>;
|
|
107
|
+
tokenCacheKey: z.ZodOptional<z.ZodString>;
|
|
108
|
+
}, z.core.$strip>;
|
|
109
|
+
static eventsSchema: z.ZodObject<{
|
|
110
|
+
stateChange: z.ZodTuple<[z.ZodAny], null>;
|
|
111
|
+
enabled: z.ZodTuple<[], null>;
|
|
112
|
+
authenticated: z.ZodTuple<[z.ZodObject<{
|
|
113
|
+
mode: z.ZodString;
|
|
114
|
+
email: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, z.core.$strip>], null>;
|
|
116
|
+
tokenRefreshed: z.ZodTuple<[], null>;
|
|
117
|
+
authorizationRequired: z.ZodTuple<[z.ZodString], null>;
|
|
118
|
+
error: z.ZodTuple<[z.ZodAny], null>;
|
|
119
|
+
}, z.core.$strip>;
|
|
120
|
+
private _oauth2Client?;
|
|
121
|
+
private _redirectUri?;
|
|
122
|
+
get initialState(): GoogleAuthState;
|
|
123
|
+
/** OAuth2 client ID from options or GOOGLE_CLIENT_ID env var. */
|
|
124
|
+
get clientId(): string;
|
|
125
|
+
/** OAuth2 client secret from options or GOOGLE_CLIENT_SECRET env var. */
|
|
126
|
+
get clientSecret(): string;
|
|
127
|
+
/** Resolved authentication mode based on options. */
|
|
128
|
+
get authMode(): 'oauth2' | 'service-account';
|
|
129
|
+
/** Whether valid credentials are currently available. */
|
|
130
|
+
get isAuthenticated(): boolean;
|
|
131
|
+
/** Default scopes covering Drive, Sheets, Calendar, and Docs read access. */
|
|
132
|
+
get defaultScopes(): string[];
|
|
133
|
+
/** Resolved redirect port from options, GOOGLE_OAUTH_REDIRECT_PORT env var, or default 3000. */
|
|
134
|
+
get redirectPort(): number;
|
|
135
|
+
/** DiskCache key used for storing the refresh token. */
|
|
136
|
+
get tokenCacheKey(): string;
|
|
137
|
+
/**
|
|
138
|
+
* Get the OAuth2Client instance, creating it lazily.
|
|
139
|
+
* After authentication, this client has valid credentials set.
|
|
140
|
+
*
|
|
141
|
+
* @returns The OAuth2Client instance
|
|
142
|
+
*/
|
|
143
|
+
getOAuth2Client(): OAuth2Client;
|
|
144
|
+
/**
|
|
145
|
+
* Get the authenticated auth client for passing to googleapis service constructors.
|
|
146
|
+
* Handles token refresh automatically for OAuth2. For service accounts, returns
|
|
147
|
+
* the JWT auth client.
|
|
148
|
+
*
|
|
149
|
+
* @returns An auth client suitable for `google.drive({ version: 'v3', auth })`
|
|
150
|
+
*/
|
|
151
|
+
getAuthClient(): Promise<OAuth2Client | ReturnType<typeof google.auth.fromJSON>>;
|
|
152
|
+
/**
|
|
153
|
+
* Start the OAuth2 authorization flow.
|
|
154
|
+
*
|
|
155
|
+
* 1. Spins up a temporary Express callback server on a free port
|
|
156
|
+
* 2. Generates the Google authorization URL
|
|
157
|
+
* 3. Opens the browser to the consent page
|
|
158
|
+
* 4. Waits for the callback with the authorization code
|
|
159
|
+
* 5. Exchanges the code for access + refresh tokens
|
|
160
|
+
* 6. Stores the refresh token in diskCache
|
|
161
|
+
* 7. Shuts down the callback server
|
|
162
|
+
*
|
|
163
|
+
* @param scopes - OAuth2 scopes to request (defaults to options.scopes or defaultScopes)
|
|
164
|
+
*/
|
|
165
|
+
authorize(scopes?: string[]): Promise<this>;
|
|
166
|
+
/**
|
|
167
|
+
* Authenticate using a service account JSON key file.
|
|
168
|
+
* Reads the key from options.serviceAccountKeyPath, options.serviceAccountKey,
|
|
169
|
+
* or the GOOGLE_SERVICE_ACCOUNT_KEY env var.
|
|
170
|
+
*
|
|
171
|
+
* @returns This feature instance for chaining
|
|
172
|
+
*/
|
|
173
|
+
authenticateServiceAccount(): Promise<this>;
|
|
174
|
+
/**
|
|
175
|
+
* Attempt to restore authentication from a cached refresh token.
|
|
176
|
+
* Called automatically by getAuthClient() if not yet authenticated.
|
|
177
|
+
*
|
|
178
|
+
* @returns true if tokens were restored successfully
|
|
179
|
+
*/
|
|
180
|
+
tryRestoreTokens(): Promise<boolean>;
|
|
181
|
+
/**
|
|
182
|
+
* Revoke the current credentials and clear cached tokens.
|
|
183
|
+
*
|
|
184
|
+
* @returns This feature instance for chaining
|
|
185
|
+
*/
|
|
186
|
+
revoke(): Promise<this>;
|
|
187
|
+
/** Store a refresh token in diskCache. */
|
|
188
|
+
private storeRefreshToken;
|
|
189
|
+
/** Load a refresh token from diskCache. */
|
|
190
|
+
private loadRefreshToken;
|
|
191
|
+
/** Resolve the service account key from options or env var. */
|
|
192
|
+
private getServiceAccountKey;
|
|
193
|
+
}
|
|
194
|
+
declare module '../../feature' {
|
|
195
|
+
interface AvailableFeatures {
|
|
196
|
+
googleAuth: typeof GoogleAuth;
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
export default GoogleAuth;
|
|
200
|
+
//# sourceMappingURL=google-auth.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"google-auth.d.ts","sourceRoot":"","sources":["../../../src/node/features/google-auth.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AACnC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAA;AAEvD,eAAO,MAAM,qBAAqB;;;;;;;;;;;;iBAahC,CAAA;AACF,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAA;AAEnE,eAAO,MAAM,uB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