@soederpop/luca 0.1.2 → 0.2.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.
- package/.github/workflows/release.yaml +167 -0
- package/CLAUDE.md +2 -0
- package/README.md +3 -0
- package/assistants/codingAssistant/ABOUT.md +3 -0
- package/assistants/codingAssistant/CORE.md +22 -17
- package/assistants/codingAssistant/hooks.ts +17 -4
- package/assistants/codingAssistant/tools.ts +1 -106
- package/assistants/inkbot/ABOUT.md +5 -0
- package/assistants/inkbot/CORE.md +71 -0
- package/assistants/inkbot/hooks.ts +14 -0
- package/assistants/inkbot/tools.ts +47 -0
- package/bun.lock +20 -4
- package/commands/inkbot.ts +353 -0
- package/commands/release.ts +75 -181
- 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/docs/ideas/assistant-factory-pattern.md +142 -0
- package/package.json +74 -21
- package/src/agi/container.server.ts +10 -0
- package/src/agi/feature.ts +13 -0
- package/src/agi/features/agent-memory.ts +694 -0
- package/src/agi/features/assistant.ts +37 -26
- package/src/agi/features/assistants-manager.ts +95 -5
- package/src/agi/features/autonomous-assistant.ts +1 -5
- package/src/agi/features/browser-use.ts +32 -2
- package/src/agi/features/claude-code.ts +165 -1
- package/src/agi/features/coding-tools.ts +175 -0
- 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 +35 -28
- 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 +111 -13
- 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/clients/voicebox/index.ts +300 -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 +3012 -1356
- package/src/introspection/generated.node.ts +179 -33
- 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 +57 -30
- 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 +51 -18
- 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/assistant.test.ts +14 -5
- package/test/conversation.test.ts +220 -0
- package/test-integration/memory.test.ts +204 -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,168 @@
|
|
|
1
|
+
import { Feature } from '../feature.js';
|
|
2
|
+
import os from 'os';
|
|
3
|
+
/** Information about a connected display. */
|
|
4
|
+
export interface DisplayInfo {
|
|
5
|
+
name: string;
|
|
6
|
+
resolution: {
|
|
7
|
+
width: number;
|
|
8
|
+
height: number;
|
|
9
|
+
};
|
|
10
|
+
retina: boolean;
|
|
11
|
+
main: boolean;
|
|
12
|
+
refreshRate?: number;
|
|
13
|
+
connectionType?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* The OS feature provides access to operating system utilities and information.
|
|
17
|
+
*
|
|
18
|
+
* This feature wraps Node.js's built-in `os` module and provides convenient
|
|
19
|
+
* getters for system information like architecture, platform, directories,
|
|
20
|
+
* network interfaces, and hardware details.
|
|
21
|
+
*
|
|
22
|
+
* @example
|
|
23
|
+
* ```typescript
|
|
24
|
+
* const osInfo = container.feature('os')
|
|
25
|
+
*
|
|
26
|
+
* console.log(`Platform: ${osInfo.platform}`)
|
|
27
|
+
* console.log(`Architecture: ${osInfo.arch}`)
|
|
28
|
+
* console.log(`CPU cores: ${osInfo.cpuCount}`)
|
|
29
|
+
* console.log(`Home directory: ${osInfo.homedir}`)
|
|
30
|
+
* ```
|
|
31
|
+
*
|
|
32
|
+
* @extends Feature
|
|
33
|
+
*/
|
|
34
|
+
export declare class OS extends Feature {
|
|
35
|
+
static shortcut: "features.os";
|
|
36
|
+
static stateSchema: import("zod").ZodObject<{
|
|
37
|
+
enabled: import("zod").ZodDefault<import("zod").ZodBoolean>;
|
|
38
|
+
}, import("zod/v4/core").$loose>;
|
|
39
|
+
static optionsSchema: import("zod").ZodObject<{
|
|
40
|
+
name: import("zod").ZodOptional<import("zod").ZodString>;
|
|
41
|
+
_cacheKey: import("zod").ZodOptional<import("zod").ZodString>;
|
|
42
|
+
cached: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
43
|
+
enable: import("zod").ZodOptional<import("zod").ZodBoolean>;
|
|
44
|
+
}, import("zod/v4/core").$strip>;
|
|
45
|
+
/**
|
|
46
|
+
* Gets the operating system CPU architecture.
|
|
47
|
+
*
|
|
48
|
+
* @returns {string} The CPU architecture (e.g., 'x64', 'arm64', 'arm', 'ia32')
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const arch = os.arch
|
|
53
|
+
* console.log(`Running on ${arch} architecture`)
|
|
54
|
+
* ```
|
|
55
|
+
*/
|
|
56
|
+
get arch(): string;
|
|
57
|
+
/**
|
|
58
|
+
* Gets the operating system's default directory for temporary files.
|
|
59
|
+
*
|
|
60
|
+
* @returns {string} The path to the temporary directory
|
|
61
|
+
*
|
|
62
|
+
* @example
|
|
63
|
+
* ```typescript
|
|
64
|
+
* const tempDir = os.tmpdir
|
|
65
|
+
* console.log(`Temp directory: ${tempDir}`)
|
|
66
|
+
* ```
|
|
67
|
+
*/
|
|
68
|
+
get tmpdir(): string;
|
|
69
|
+
/**
|
|
70
|
+
* Gets the current user's home directory path.
|
|
71
|
+
*
|
|
72
|
+
* @returns {string} The path to the user's home directory
|
|
73
|
+
*
|
|
74
|
+
* @example
|
|
75
|
+
* ```typescript
|
|
76
|
+
* const home = os.homedir
|
|
77
|
+
* console.log(`User home: ${home}`)
|
|
78
|
+
* ```
|
|
79
|
+
*/
|
|
80
|
+
get homedir(): string;
|
|
81
|
+
/**
|
|
82
|
+
* Gets the number of logical CPU cores available on the system.
|
|
83
|
+
*
|
|
84
|
+
* @returns {number} The number of CPU cores
|
|
85
|
+
*
|
|
86
|
+
* @example
|
|
87
|
+
* ```typescript
|
|
88
|
+
* const cores = os.cpuCount
|
|
89
|
+
* console.log(`System has ${cores} CPU cores`)
|
|
90
|
+
* ```
|
|
91
|
+
*/
|
|
92
|
+
get cpuCount(): number;
|
|
93
|
+
/**
|
|
94
|
+
* Gets the hostname of the operating system.
|
|
95
|
+
*
|
|
96
|
+
* @returns {string} The system hostname
|
|
97
|
+
*
|
|
98
|
+
* @example
|
|
99
|
+
* ```typescript
|
|
100
|
+
* const hostname = os.hostname
|
|
101
|
+
* console.log(`Hostname: ${hostname}`)
|
|
102
|
+
* ```
|
|
103
|
+
*/
|
|
104
|
+
get hostname(): string;
|
|
105
|
+
/**
|
|
106
|
+
* Gets the operating system platform.
|
|
107
|
+
*
|
|
108
|
+
* @returns {string} The platform identifier (e.g., 'darwin', 'linux', 'win32')
|
|
109
|
+
*
|
|
110
|
+
* @example
|
|
111
|
+
* ```typescript
|
|
112
|
+
* const platform = os.platform
|
|
113
|
+
* if (platform === 'darwin') {
|
|
114
|
+
* console.log('Running on macOS')
|
|
115
|
+
* }
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
get platform(): string;
|
|
119
|
+
/**
|
|
120
|
+
* Gets information about the system's network interfaces.
|
|
121
|
+
*
|
|
122
|
+
* @returns {NodeJS.Dict<os.NetworkInterfaceInfo[]>} Object containing network interface details
|
|
123
|
+
*
|
|
124
|
+
* @example
|
|
125
|
+
* ```typescript
|
|
126
|
+
* const interfaces = os.networkInterfaces
|
|
127
|
+
* Object.keys(interfaces).forEach(name => {
|
|
128
|
+
* console.log(`Interface ${name}:`, interfaces[name])
|
|
129
|
+
* })
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
get networkInterfaces(): NodeJS.Dict<os.NetworkInterfaceInfo[]>;
|
|
133
|
+
/**
|
|
134
|
+
* Gets an array of MAC addresses for non-internal IPv4 network interfaces.
|
|
135
|
+
*
|
|
136
|
+
* This filters the network interfaces to only include external IPv4 interfaces
|
|
137
|
+
* and returns their MAC addresses, which can be useful for system identification.
|
|
138
|
+
*
|
|
139
|
+
* @returns {string[]} Array of MAC addresses for external IPv4 interfaces
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const macAddresses = os.macAddresses
|
|
144
|
+
* console.log(`External MAC addresses: ${macAddresses.join(', ')}`)
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
get macAddresses(): string[];
|
|
148
|
+
/**
|
|
149
|
+
* Gets information about all connected displays.
|
|
150
|
+
*
|
|
151
|
+
* Platform-specific: currently implemented for macOS (darwin).
|
|
152
|
+
* Linux and Windows will throw with a clear "not yet implemented" message.
|
|
153
|
+
*
|
|
154
|
+
* @returns {DisplayInfo[]} Array of display information objects
|
|
155
|
+
*
|
|
156
|
+
* @example
|
|
157
|
+
* ```typescript
|
|
158
|
+
* const displays = os.getDisplayInfo()
|
|
159
|
+
* displays.forEach(d => {
|
|
160
|
+
* console.log(`${d.name}: ${d.resolution.width}x${d.resolution.height}${d.retina ? ' (Retina)' : ''}`)
|
|
161
|
+
* })
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
getDisplayInfo(): DisplayInfo[];
|
|
165
|
+
private _displayHandlers;
|
|
166
|
+
}
|
|
167
|
+
export default OS;
|
|
168
|
+
//# sourceMappingURL=os.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"os.d.ts","sourceRoot":"","sources":["../../../src/node/features/os.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAA;AAEvC,OAAO,EAAE,MAAM,IAAI,CAAA;AAEnB,6CAA6C;AAC7C,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAA;IAC7C,MAAM,EAAE,OAAO,CAAA;IACf,IAAI,EAAE,OAAO,CAAA;IACb,WAAW,CAAC,EAAE,MAAM,CAAA;IACpB,cAAc,CAAC,EAAE,MAAM,CAAA;CACxB;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,EAAG,SAAQ,OAAO;IAC7B,OAAgB,QAAQ,EAAG,aAAa,CAAS;IACjD,OAAgB,WAAW;;qCAAqB;IAChD,OAAgB,aAAa;;;;;qCAAuB;IAGpD;;;;;;;;;;OAUG;IACH,IAAI,IAAI,IAAI,MAAM,CAEjB;IAED;;;;;;;;;;OAUG;IACH,IAAI,MAAM,IAAI,MAAM,CAEnB;IAED;;;;;;;;;;OAUG;IACH,IAAI,OAAO,IAAI,MAAM,CAEpB;IAED;;;;;;;;;;OAUG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;;;;;;;;;OAUG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;;;;;;;;;;;OAYG;IACH,IAAI,QAAQ,IAAI,MAAM,CAErB;IAED;;;;;;;;;;;;OAYG;IACH,IAAI,iBAAiB,IAAI,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,oBAAoB,EAAE,CAAC,CAE9D;IAED;;;;;;;;;;;;;OAaG;IACH,IAAI,YAAY,IAAK,MAAM,EAAE,CAE5B;IAED;;;;;;;;;;;;;;;OAeG;IACH,cAAc,IAAI,WAAW,EAAE;IAW/B,OAAO,CAAC,gBAAgB,CAqCvB;CACF;AAED,eAAe,EAAE,CAAA"}
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { Feature } from "../feature.js";
|
|
3
|
+
/**
|
|
4
|
+
* Index mapping package names to arrays of package manifests with their file paths.
|
|
5
|
+
* Used for efficient lookup and duplicate detection.
|
|
6
|
+
*
|
|
7
|
+
* @type PackageIndex
|
|
8
|
+
*/
|
|
9
|
+
type PackageIndex = {
|
|
10
|
+
[name: string]: Array<PartialManifest & {
|
|
11
|
+
/** The file system path to the package.json file */
|
|
12
|
+
__path: string;
|
|
13
|
+
}>;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Zod schema for the PackageFinder feature state.
|
|
17
|
+
* Tracks the initialization status of the package scanning process.
|
|
18
|
+
*/
|
|
19
|
+
export declare const PackageFinderStateSchema: z.ZodObject<{
|
|
20
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
21
|
+
started: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
}, z.core.$loose>;
|
|
23
|
+
export type PackageFinderState = z.infer<typeof PackageFinderStateSchema>;
|
|
24
|
+
/**
|
|
25
|
+
* Zod schema for the PackageFinder feature options.
|
|
26
|
+
*/
|
|
27
|
+
export declare const PackageFinderOptionsSchema: z.ZodObject<{
|
|
28
|
+
name: z.ZodOptional<z.ZodString>;
|
|
29
|
+
_cacheKey: z.ZodOptional<z.ZodString>;
|
|
30
|
+
cached: z.ZodOptional<z.ZodBoolean>;
|
|
31
|
+
enable: z.ZodOptional<z.ZodBoolean>;
|
|
32
|
+
option: z.ZodOptional<z.ZodString>;
|
|
33
|
+
}, z.core.$strip>;
|
|
34
|
+
export type PackageFinderOptions = z.infer<typeof PackageFinderOptionsSchema>;
|
|
35
|
+
/**
|
|
36
|
+
* Partial representation of a package.json manifest file.
|
|
37
|
+
* Contains the most commonly used fields for package analysis and dependency management.
|
|
38
|
+
*
|
|
39
|
+
* @type PartialManifest
|
|
40
|
+
*/
|
|
41
|
+
export type PartialManifest = {
|
|
42
|
+
/** The package name (e.g., 'lodash', '@types/node') */
|
|
43
|
+
name: string;
|
|
44
|
+
/** The package version (e.g., '1.0.0', '^2.1.3') */
|
|
45
|
+
version: string;
|
|
46
|
+
/** Optional package description */
|
|
47
|
+
description?: string;
|
|
48
|
+
/** Runtime dependencies with version constraints */
|
|
49
|
+
dependencies?: Record<string, Record<string, string>>;
|
|
50
|
+
/** Development dependencies with version constraints */
|
|
51
|
+
devDependencies?: Record<string, Record<string, string>>;
|
|
52
|
+
/** Peer dependencies with version constraints */
|
|
53
|
+
peerDependencies?: Record<string, Record<string, string>>;
|
|
54
|
+
/** Optional dependencies with version constraints */
|
|
55
|
+
optionalDependencies?: Record<string, Record<string, string>>;
|
|
56
|
+
};
|
|
57
|
+
/**
|
|
58
|
+
* PackageFinder Feature - Comprehensive package discovery and analysis tool
|
|
59
|
+
*
|
|
60
|
+
* This feature provides powerful capabilities for discovering, indexing, and analyzing
|
|
61
|
+
* npm packages across the entire project workspace. It recursively scans all node_modules
|
|
62
|
+
* directories and builds a comprehensive index of packages, enabling:
|
|
63
|
+
*
|
|
64
|
+
* **Core Functionality:**
|
|
65
|
+
* - Recursive node_modules scanning across the workspace
|
|
66
|
+
* - Package manifest parsing and indexing
|
|
67
|
+
* - Duplicate package detection and analysis
|
|
68
|
+
* - Dependency relationship mapping
|
|
69
|
+
* - Scoped package organization (@scope/package)
|
|
70
|
+
* - Package count and statistics
|
|
71
|
+
*
|
|
72
|
+
* **Use Cases:**
|
|
73
|
+
* - Dependency auditing and analysis
|
|
74
|
+
* - Duplicate package identification
|
|
75
|
+
* - Package version conflict detection
|
|
76
|
+
* - Dependency tree analysis
|
|
77
|
+
* - Workspace package inventory
|
|
78
|
+
*
|
|
79
|
+
* **Performance Features:**
|
|
80
|
+
* - Parallel manifest reading for fast scanning
|
|
81
|
+
* - Efficient duplicate detection using unique paths
|
|
82
|
+
* - Lazy initialization - only scans when started
|
|
83
|
+
* - In-memory indexing for fast queries
|
|
84
|
+
*
|
|
85
|
+
* **Usage Example:**
|
|
86
|
+
* ```typescript
|
|
87
|
+
* const finder = container.feature('packageFinder');
|
|
88
|
+
* await finder.start();
|
|
89
|
+
*
|
|
90
|
+
* // Find duplicates
|
|
91
|
+
* console.log('Duplicate packages:', finder.duplicates);
|
|
92
|
+
*
|
|
93
|
+
* // Find package by name
|
|
94
|
+
* const lodash = finder.findByName('lodash');
|
|
95
|
+
*
|
|
96
|
+
* // Find dependents of a package
|
|
97
|
+
* const dependents = finder.findDependentsOf('react');
|
|
98
|
+
* ```
|
|
99
|
+
*
|
|
100
|
+
* @template T - The state type, defaults to PackageFinderState
|
|
101
|
+
* @template K - The options type, defaults to PackageFinderOptions
|
|
102
|
+
* @extends {Feature<T, K>}
|
|
103
|
+
*/
|
|
104
|
+
export declare class PackageFinder<T extends PackageFinderState = PackageFinderState, K extends PackageFinderOptions = PackageFinderOptions> extends Feature<T, K> {
|
|
105
|
+
/** The shortcut path for accessing this feature */
|
|
106
|
+
static shortcut: "features.packageFinder";
|
|
107
|
+
static stateSchema: z.ZodObject<{
|
|
108
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
109
|
+
started: z.ZodOptional<z.ZodBoolean>;
|
|
110
|
+
}, z.core.$loose>;
|
|
111
|
+
static optionsSchema: z.ZodObject<{
|
|
112
|
+
name: z.ZodOptional<z.ZodString>;
|
|
113
|
+
_cacheKey: z.ZodOptional<z.ZodString>;
|
|
114
|
+
cached: z.ZodOptional<z.ZodBoolean>;
|
|
115
|
+
enable: z.ZodOptional<z.ZodBoolean>;
|
|
116
|
+
option: z.ZodOptional<z.ZodString>;
|
|
117
|
+
}, z.core.$strip>;
|
|
118
|
+
/** Internal package index mapping names to manifest arrays */
|
|
119
|
+
packages: PackageIndex;
|
|
120
|
+
/**
|
|
121
|
+
* Initializes the feature state after construction.
|
|
122
|
+
* Sets the started flag to false, indicating the initial scan hasn't completed.
|
|
123
|
+
*/
|
|
124
|
+
afterInitialize(): void;
|
|
125
|
+
/**
|
|
126
|
+
* Adds a package manifest to the internal index.
|
|
127
|
+
*
|
|
128
|
+
* This method ensures uniqueness based on file path and maintains an array
|
|
129
|
+
* of all versions/instances of each package found across the workspace.
|
|
130
|
+
* Packages with the same name but different paths (versions) are tracked separately.
|
|
131
|
+
*
|
|
132
|
+
* @param manifest - The package manifest data from package.json
|
|
133
|
+
* @param path - The file system path to the package.json file
|
|
134
|
+
*
|
|
135
|
+
* @example
|
|
136
|
+
* ```typescript
|
|
137
|
+
* finder.addPackage({
|
|
138
|
+
* name: 'lodash',
|
|
139
|
+
* version: '4.17.21',
|
|
140
|
+
* description: 'A modern JavaScript utility library'
|
|
141
|
+
* }, '/project/node_modules/lodash/package.json');
|
|
142
|
+
* ```
|
|
143
|
+
*/
|
|
144
|
+
addPackage(manifest: PartialManifest, path: string): void;
|
|
145
|
+
/**
|
|
146
|
+
* Gets a list of package names that have multiple versions/instances installed.
|
|
147
|
+
*
|
|
148
|
+
* This is useful for identifying potential dependency conflicts or
|
|
149
|
+
* opportunities for deduplication in the project.
|
|
150
|
+
*
|
|
151
|
+
* @returns Array of package names that appear multiple times in the workspace
|
|
152
|
+
*
|
|
153
|
+
* @example
|
|
154
|
+
* ```typescript
|
|
155
|
+
* const duplicates = finder.duplicates;
|
|
156
|
+
* // ['lodash', 'react', '@types/node'] - packages with multiple versions
|
|
157
|
+
*
|
|
158
|
+
* duplicates.forEach(name => {
|
|
159
|
+
* console.log(`${name} has ${finder.packages[name].length} versions`);
|
|
160
|
+
* });
|
|
161
|
+
* ```
|
|
162
|
+
*/
|
|
163
|
+
get duplicates(): string[];
|
|
164
|
+
/**
|
|
165
|
+
* Starts the package finder and performs the initial workspace scan.
|
|
166
|
+
*
|
|
167
|
+
* This method is idempotent - calling it multiple times will not re-scan
|
|
168
|
+
* if already started. It triggers the complete workspace scanning process.
|
|
169
|
+
*
|
|
170
|
+
* @returns Promise resolving to this instance for method chaining
|
|
171
|
+
*
|
|
172
|
+
* @example
|
|
173
|
+
* ```typescript
|
|
174
|
+
* await finder.start();
|
|
175
|
+
* console.log(`Found ${finder.packageNames.length} unique packages`);
|
|
176
|
+
* ```
|
|
177
|
+
*/
|
|
178
|
+
start(): Promise<this | undefined>;
|
|
179
|
+
/**
|
|
180
|
+
* Performs a comprehensive scan of all node_modules directories in the workspace.
|
|
181
|
+
*
|
|
182
|
+
* This method orchestrates the complete scanning process:
|
|
183
|
+
* 1. Discovers all node_modules directories recursively
|
|
184
|
+
* 2. Finds all package directories (including scoped packages)
|
|
185
|
+
* 3. Reads and parses all package.json files in parallel
|
|
186
|
+
* 4. Indexes all packages for fast querying
|
|
187
|
+
*
|
|
188
|
+
* The scan is performed in parallel for optimal performance, reading multiple
|
|
189
|
+
* package.json files simultaneously.
|
|
190
|
+
*
|
|
191
|
+
* @param options - Scanning options (currently unused)
|
|
192
|
+
* @param options.exclude - Optional exclusion patterns (not implemented)
|
|
193
|
+
* @returns Promise resolving to this instance for method chaining
|
|
194
|
+
*
|
|
195
|
+
* @example
|
|
196
|
+
* ```typescript
|
|
197
|
+
* // Manual scan (usually called automatically by start())
|
|
198
|
+
* await finder.scan();
|
|
199
|
+
*
|
|
200
|
+
* // Check results
|
|
201
|
+
* console.log(`Scanned ${finder.manifests.length} packages`);
|
|
202
|
+
* ```
|
|
203
|
+
*/
|
|
204
|
+
scan(options?: {
|
|
205
|
+
exclude?: string | string[];
|
|
206
|
+
}): Promise<this>;
|
|
207
|
+
/**
|
|
208
|
+
* Checks if the package finder has completed its initial scan.
|
|
209
|
+
*
|
|
210
|
+
* @returns True if the finder has been started and scanning is complete
|
|
211
|
+
*/
|
|
212
|
+
get isStarted(): boolean;
|
|
213
|
+
/**
|
|
214
|
+
* Gets an array of all unique package names discovered in the workspace.
|
|
215
|
+
*
|
|
216
|
+
* @returns Array of package names (e.g., ['lodash', 'react', '@types/node'])
|
|
217
|
+
*
|
|
218
|
+
* @example
|
|
219
|
+
* ```typescript
|
|
220
|
+
* const names = finder.packageNames;
|
|
221
|
+
* console.log(`Found ${names.length} unique packages`);
|
|
222
|
+
* ```
|
|
223
|
+
*/
|
|
224
|
+
get packageNames(): string[];
|
|
225
|
+
/**
|
|
226
|
+
* Gets an array of all scoped package prefixes found in the workspace.
|
|
227
|
+
*
|
|
228
|
+
* Scoped packages are those starting with '@' (e.g., @types/node, @babel/core).
|
|
229
|
+
* This returns just the scope part (e.g., '@types', '@babel').
|
|
230
|
+
*
|
|
231
|
+
* @returns Array of unique scope names without duplicates
|
|
232
|
+
*
|
|
233
|
+
* @example
|
|
234
|
+
* ```typescript
|
|
235
|
+
* const scopes = finder.scopes;
|
|
236
|
+
* // ['@types', '@babel', '@angular'] - all scopes in use
|
|
237
|
+
*
|
|
238
|
+
* scopes.forEach(scope => {
|
|
239
|
+
* const scopedPackages = finder.packageNames.filter(name => name.startsWith(scope));
|
|
240
|
+
* console.log(`${scope}: ${scopedPackages.length} packages`);
|
|
241
|
+
* });
|
|
242
|
+
* ```
|
|
243
|
+
*/
|
|
244
|
+
get scopes(): string[];
|
|
245
|
+
/**
|
|
246
|
+
* Finds the first package manifest matching the given name.
|
|
247
|
+
*
|
|
248
|
+
* If multiple versions of the package exist, returns the first one found.
|
|
249
|
+
* Use the packages property directly if you need all versions.
|
|
250
|
+
*
|
|
251
|
+
* @param name - The exact package name to search for
|
|
252
|
+
* @returns The first matching package manifest, or undefined if not found
|
|
253
|
+
*
|
|
254
|
+
* @example
|
|
255
|
+
* ```typescript
|
|
256
|
+
* const lodash = finder.findByName('lodash');
|
|
257
|
+
* if (lodash) {
|
|
258
|
+
* console.log(`Found lodash version ${lodash.version}`);
|
|
259
|
+
* }
|
|
260
|
+
* ```
|
|
261
|
+
*/
|
|
262
|
+
findByName(name: string): PartialManifest | undefined;
|
|
263
|
+
/**
|
|
264
|
+
* Finds all packages that declare the specified package as a dependency.
|
|
265
|
+
*
|
|
266
|
+
* Searches through dependencies and devDependencies of all packages
|
|
267
|
+
* to find which ones depend on the target package. Useful for impact
|
|
268
|
+
* analysis when considering package updates or removals.
|
|
269
|
+
*
|
|
270
|
+
* @param packageName - The name of the package to find dependents for
|
|
271
|
+
* @returns Array of package manifests that depend on the specified package
|
|
272
|
+
*
|
|
273
|
+
* @example
|
|
274
|
+
* ```typescript
|
|
275
|
+
* const reactDependents = finder.findDependentsOf('react');
|
|
276
|
+
* console.log(`${reactDependents.length} packages depend on React:`);
|
|
277
|
+
* reactDependents.forEach(pkg => {
|
|
278
|
+
* console.log(`- ${pkg.name}@${pkg.version}`);
|
|
279
|
+
* });
|
|
280
|
+
* ```
|
|
281
|
+
*/
|
|
282
|
+
findDependentsOf(packageName: string): PartialManifest[];
|
|
283
|
+
/**
|
|
284
|
+
* Finds the first package manifest matching the provided filter function.
|
|
285
|
+
*
|
|
286
|
+
* @param filter - Function that returns true for matching packages
|
|
287
|
+
* @returns The first matching package manifest, or undefined if none found
|
|
288
|
+
*
|
|
289
|
+
* @example
|
|
290
|
+
* ```typescript
|
|
291
|
+
* // Find a package with specific version
|
|
292
|
+
* const specific = finder.find(pkg => pkg.name === 'lodash' && pkg.version.startsWith('4.'));
|
|
293
|
+
*
|
|
294
|
+
* // Find a package with description containing keyword
|
|
295
|
+
* const utility = finder.find(pkg => pkg.description?.includes('utility'));
|
|
296
|
+
* ```
|
|
297
|
+
*/
|
|
298
|
+
find(filter: (manifest: PartialManifest) => boolean): PartialManifest | undefined;
|
|
299
|
+
/**
|
|
300
|
+
* Finds all package manifests matching the provided filter function.
|
|
301
|
+
*
|
|
302
|
+
* @param filter - Function that returns true for matching packages
|
|
303
|
+
* @returns Array of matching package manifests
|
|
304
|
+
*
|
|
305
|
+
* @example
|
|
306
|
+
* ```typescript
|
|
307
|
+
* // Find all packages with 'babel' in the name
|
|
308
|
+
* const babelPackages = finder.filter(pkg => pkg.name.includes('babel'));
|
|
309
|
+
*
|
|
310
|
+
* // Find all packages with no description
|
|
311
|
+
* const undocumented = finder.filter(pkg => !pkg.description);
|
|
312
|
+
*
|
|
313
|
+
* // Find all scoped packages
|
|
314
|
+
* const scoped = finder.filter(pkg => pkg.name.startsWith('@'));
|
|
315
|
+
* ```
|
|
316
|
+
*/
|
|
317
|
+
filter(filter: (manifest: PartialManifest) => boolean): PartialManifest[];
|
|
318
|
+
/**
|
|
319
|
+
* Returns all packages that do NOT match the provided filter function.
|
|
320
|
+
*
|
|
321
|
+
* This is the inverse of filter() - returns packages where filter returns false.
|
|
322
|
+
*
|
|
323
|
+
* @param filter - Function that returns true for packages to exclude
|
|
324
|
+
* @returns Array of package manifests that don't match the filter
|
|
325
|
+
*
|
|
326
|
+
* @example
|
|
327
|
+
* ```typescript
|
|
328
|
+
* // Get all non-development packages (those not in devDependencies)
|
|
329
|
+
* const prodPackages = finder.exclude(pkg => isDevDependency(pkg.name));
|
|
330
|
+
*
|
|
331
|
+
* // Get all non-scoped packages
|
|
332
|
+
* const unscoped = finder.exclude(pkg => pkg.name.startsWith('@'));
|
|
333
|
+
* ```
|
|
334
|
+
*/
|
|
335
|
+
exclude(filter: (manifest: PartialManifest) => boolean): PartialManifest[];
|
|
336
|
+
/**
|
|
337
|
+
* Gets a flat array of all package manifests found in the workspace.
|
|
338
|
+
*
|
|
339
|
+
* This includes all versions/instances of packages, unlike packageNames
|
|
340
|
+
* which returns unique names only.
|
|
341
|
+
*
|
|
342
|
+
* @returns Array of all package manifests with their metadata
|
|
343
|
+
*
|
|
344
|
+
* @example
|
|
345
|
+
* ```typescript
|
|
346
|
+
* const all = finder.manifests;
|
|
347
|
+
* console.log(`Total package instances: ${all.length}`);
|
|
348
|
+
*
|
|
349
|
+
* // Group by name to see duplicates
|
|
350
|
+
* const grouped = all.reduce((acc, pkg) => {
|
|
351
|
+
* acc[pkg.name] = (acc[pkg.name] || 0) + 1;
|
|
352
|
+
* return acc;
|
|
353
|
+
* }, {});
|
|
354
|
+
* ```
|
|
355
|
+
*/
|
|
356
|
+
get manifests(): (PartialManifest & {
|
|
357
|
+
__path: string;
|
|
358
|
+
})[];
|
|
359
|
+
/**
|
|
360
|
+
* Gets a count of instances for each package name.
|
|
361
|
+
*
|
|
362
|
+
* Useful for quickly identifying which packages have multiple versions
|
|
363
|
+
* and how many instances of each exist.
|
|
364
|
+
*
|
|
365
|
+
* @returns Object mapping package names to their instance counts
|
|
366
|
+
*
|
|
367
|
+
* @example
|
|
368
|
+
* ```typescript
|
|
369
|
+
* const counts = finder.counts;
|
|
370
|
+
* // { 'lodash': 3, 'react': 2, 'express': 1 }
|
|
371
|
+
*
|
|
372
|
+
* Object.entries(counts)
|
|
373
|
+
* .filter(([name, count]) => count > 1)
|
|
374
|
+
* .forEach(([name, count]) => {
|
|
375
|
+
* console.log(`${name}: ${count} versions installed`);
|
|
376
|
+
* });
|
|
377
|
+
* ```
|
|
378
|
+
*/
|
|
379
|
+
get counts(): Record<string, number>;
|
|
380
|
+
/**
|
|
381
|
+
* Discovers all package directories within a specific node_modules directory.
|
|
382
|
+
*
|
|
383
|
+
* Handles both regular packages and scoped packages (@scope/package).
|
|
384
|
+
* Scoped packages require additional directory traversal as they are nested
|
|
385
|
+
* under scope directories.
|
|
386
|
+
*
|
|
387
|
+
* @param nodeModulesPath - Path to a node_modules directory to scan
|
|
388
|
+
* @returns Promise resolving to array of package directory paths
|
|
389
|
+
*
|
|
390
|
+
* @private
|
|
391
|
+
*/
|
|
392
|
+
private findPackageFolders;
|
|
393
|
+
findLocalPackageFolders(): Promise<string[]>;
|
|
394
|
+
/**
|
|
395
|
+
* Discovers all package directories across all node_modules in the workspace.
|
|
396
|
+
*
|
|
397
|
+
* Combines results from all discovered node_modules directories to provide
|
|
398
|
+
* a comprehensive list of all package installations.
|
|
399
|
+
*
|
|
400
|
+
* @returns Promise resolving to array of all package directory paths
|
|
401
|
+
*
|
|
402
|
+
* @private
|
|
403
|
+
*/
|
|
404
|
+
private findAllPackageFolders;
|
|
405
|
+
/**
|
|
406
|
+
* Discovers all node_modules directories in the workspace hierarchy.
|
|
407
|
+
*
|
|
408
|
+
* Uses the container's file system utilities to recursively search upward
|
|
409
|
+
* from the current working directory to find all node_modules directories.
|
|
410
|
+
* This supports monorepos and nested project structures.
|
|
411
|
+
*
|
|
412
|
+
* @returns Promise resolving to array of node_modules directory paths
|
|
413
|
+
*
|
|
414
|
+
* @private
|
|
415
|
+
*/
|
|
416
|
+
private findNodeModulesFolders;
|
|
417
|
+
}
|
|
418
|
+
export default PackageFinder;
|
|
419
|
+
//# sourceMappingURL=package-finder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-finder.d.ts","sourceRoot":"","sources":["../../../src/node/features/package-finder.ts"],"names":[],"mappings":"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"}
|