mongo.do 0.1.0 → 0.1.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/dist/cli/index.d.ts +1 -15
- package/dist/cli/index.js +4083 -196
- package/dist/cli/index.js.map +1 -1
- package/dist/index.d.ts +2740 -20
- package/dist/index.js +9375 -27
- package/dist/index.js.map +1 -1
- package/dist/worker-entrypoint-BEW23Gmp.d.ts +1331 -0
- package/dist/worker.d.ts +6 -5
- package/dist/worker.js +5477 -18
- package/dist/worker.js.map +1 -1
- package/package.json +3 -2
- package/dist/agentfs/adapters/anthropic.d.ts +0 -176
- package/dist/agentfs/adapters/anthropic.d.ts.map +0 -1
- package/dist/agentfs/adapters/anthropic.js +0 -629
- package/dist/agentfs/adapters/anthropic.js.map +0 -1
- package/dist/agentfs/adapters/index.d.ts +0 -21
- package/dist/agentfs/adapters/index.d.ts.map +0 -1
- package/dist/agentfs/adapters/index.js +0 -23
- package/dist/agentfs/adapters/index.js.map +0 -1
- package/dist/agentfs/adapters/vercel.d.ts +0 -260
- package/dist/agentfs/adapters/vercel.d.ts.map +0 -1
- package/dist/agentfs/adapters/vercel.js +0 -288
- package/dist/agentfs/adapters/vercel.js.map +0 -1
- package/dist/agentfs/glob.d.ts +0 -116
- package/dist/agentfs/glob.d.ts.map +0 -1
- package/dist/agentfs/glob.js +0 -270
- package/dist/agentfs/glob.js.map +0 -1
- package/dist/agentfs/grep.d.ts +0 -83
- package/dist/agentfs/grep.d.ts.map +0 -1
- package/dist/agentfs/grep.js +0 -193
- package/dist/agentfs/grep.js.map +0 -1
- package/dist/agentfs/index.d.ts +0 -22
- package/dist/agentfs/index.d.ts.map +0 -1
- package/dist/agentfs/index.js +0 -18
- package/dist/agentfs/index.js.map +0 -1
- package/dist/agentfs/kv-store.d.ts +0 -128
- package/dist/agentfs/kv-store.d.ts.map +0 -1
- package/dist/agentfs/kv-store.js +0 -227
- package/dist/agentfs/kv-store.js.map +0 -1
- package/dist/agentfs/mondo-agent.d.ts +0 -255
- package/dist/agentfs/mondo-agent.d.ts.map +0 -1
- package/dist/agentfs/mondo-agent.js +0 -879
- package/dist/agentfs/mondo-agent.js.map +0 -1
- package/dist/agentfs/toolcalls.d.ts +0 -130
- package/dist/agentfs/toolcalls.d.ts.map +0 -1
- package/dist/agentfs/toolcalls.js +0 -178
- package/dist/agentfs/toolcalls.js.map +0 -1
- package/dist/agentfs/types.d.ts +0 -171
- package/dist/agentfs/types.d.ts.map +0 -1
- package/dist/agentfs/types.js +0 -7
- package/dist/agentfs/types.js.map +0 -1
- package/dist/agentfs/vfs.d.ts +0 -249
- package/dist/agentfs/vfs.d.ts.map +0 -1
- package/dist/agentfs/vfs.js +0 -469
- package/dist/agentfs/vfs.js.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/mcp.d.ts +0 -119
- package/dist/cli/mcp.d.ts.map +0 -1
- package/dist/cli/mcp.js +0 -418
- package/dist/cli/mcp.js.map +0 -1
- package/dist/cli/server.d.ts +0 -179
- package/dist/cli/server.d.ts.map +0 -1
- package/dist/cli/server.js +0 -441
- package/dist/cli/server.js.map +0 -1
- package/dist/client/Collection.d.ts +0 -199
- package/dist/client/Collection.d.ts.map +0 -1
- package/dist/client/Collection.js +0 -256
- package/dist/client/Collection.js.map +0 -1
- package/dist/client/Database.d.ts +0 -68
- package/dist/client/Database.d.ts.map +0 -1
- package/dist/client/Database.js +0 -105
- package/dist/client/Database.js.map +0 -1
- package/dist/client/MongoClient.d.ts +0 -165
- package/dist/client/MongoClient.d.ts.map +0 -1
- package/dist/client/MongoClient.js +0 -307
- package/dist/client/MongoClient.js.map +0 -1
- package/dist/client/aggregation-cursor.d.ts +0 -210
- package/dist/client/aggregation-cursor.d.ts.map +0 -1
- package/dist/client/aggregation-cursor.js +0 -509
- package/dist/client/aggregation-cursor.js.map +0 -1
- package/dist/client/bulk-write.d.ts +0 -216
- package/dist/client/bulk-write.d.ts.map +0 -1
- package/dist/client/bulk-write.js +0 -63
- package/dist/client/bulk-write.js.map +0 -1
- package/dist/client/change-stream.d.ts +0 -245
- package/dist/client/change-stream.d.ts.map +0 -1
- package/dist/client/change-stream.js +0 -429
- package/dist/client/change-stream.js.map +0 -1
- package/dist/client/cursor.d.ts +0 -85
- package/dist/client/cursor.d.ts.map +0 -1
- package/dist/client/cursor.js +0 -156
- package/dist/client/cursor.js.map +0 -1
- package/dist/client/http-cursor.d.ts +0 -233
- package/dist/client/http-cursor.d.ts.map +0 -1
- package/dist/client/http-cursor.js +0 -496
- package/dist/client/http-cursor.js.map +0 -1
- package/dist/client/index.d.ts +0 -18
- package/dist/client/index.d.ts.map +0 -1
- package/dist/client/index.js +0 -24
- package/dist/client/index.js.map +0 -1
- package/dist/client/mongo-client.d.ts +0 -60
- package/dist/client/mongo-client.d.ts.map +0 -1
- package/dist/client/mongo-client.js +0 -190
- package/dist/client/mongo-client.js.map +0 -1
- package/dist/client/mongo-collection.d.ts +0 -359
- package/dist/client/mongo-collection.d.ts.map +0 -1
- package/dist/client/mongo-collection.js +0 -1641
- package/dist/client/mongo-collection.js.map +0 -1
- package/dist/client/mongo-cursor.d.ts +0 -257
- package/dist/client/mongo-cursor.d.ts.map +0 -1
- package/dist/client/mongo-cursor.js +0 -621
- package/dist/client/mongo-cursor.js.map +0 -1
- package/dist/client/mongo-database.d.ts +0 -88
- package/dist/client/mongo-database.d.ts.map +0 -1
- package/dist/client/mongo-database.js +0 -139
- package/dist/client/mongo-database.js.map +0 -1
- package/dist/client/session.d.ts +0 -210
- package/dist/client/session.d.ts.map +0 -1
- package/dist/client/session.js +0 -326
- package/dist/client/session.js.map +0 -1
- package/dist/durable-object/index-manager.d.ts +0 -173
- package/dist/durable-object/index-manager.d.ts.map +0 -1
- package/dist/durable-object/index-manager.js +0 -764
- package/dist/durable-object/index-manager.js.map +0 -1
- package/dist/durable-object/index.d.ts +0 -12
- package/dist/durable-object/index.d.ts.map +0 -1
- package/dist/durable-object/index.js +0 -8
- package/dist/durable-object/index.js.map +0 -1
- package/dist/durable-object/mcp-handler.d.ts +0 -52
- package/dist/durable-object/mcp-handler.d.ts.map +0 -1
- package/dist/durable-object/mcp-handler.js +0 -186
- package/dist/durable-object/mcp-handler.js.map +0 -1
- package/dist/durable-object/migrations.d.ts +0 -40
- package/dist/durable-object/migrations.d.ts.map +0 -1
- package/dist/durable-object/migrations.js +0 -121
- package/dist/durable-object/migrations.js.map +0 -1
- package/dist/durable-object/mondo-database.d.ts +0 -148
- package/dist/durable-object/mondo-database.d.ts.map +0 -1
- package/dist/durable-object/mondo-database.js +0 -621
- package/dist/durable-object/mondo-database.js.map +0 -1
- package/dist/durable-object/schema.d.ts +0 -192
- package/dist/durable-object/schema.d.ts.map +0 -1
- package/dist/durable-object/schema.js +0 -186
- package/dist/durable-object/schema.js.map +0 -1
- package/dist/embedding/document-serializer.d.ts +0 -118
- package/dist/embedding/document-serializer.d.ts.map +0 -1
- package/dist/embedding/document-serializer.js +0 -339
- package/dist/embedding/document-serializer.js.map +0 -1
- package/dist/embedding/embedding-manager.d.ts +0 -136
- package/dist/embedding/embedding-manager.d.ts.map +0 -1
- package/dist/embedding/embedding-manager.js +0 -176
- package/dist/embedding/embedding-manager.js.map +0 -1
- package/dist/embedding/index.d.ts +0 -9
- package/dist/embedding/index.d.ts.map +0 -1
- package/dist/embedding/index.js +0 -9
- package/dist/embedding/index.js.map +0 -1
- package/dist/executor/aggregation-executor.d.ts +0 -93
- package/dist/executor/aggregation-executor.d.ts.map +0 -1
- package/dist/executor/aggregation-executor.js +0 -275
- package/dist/executor/aggregation-executor.js.map +0 -1
- package/dist/executor/function-executor.d.ts +0 -39
- package/dist/executor/function-executor.d.ts.map +0 -1
- package/dist/executor/function-executor.js +0 -168
- package/dist/executor/function-executor.js.map +0 -1
- package/dist/executor/index.d.ts +0 -4
- package/dist/executor/index.d.ts.map +0 -1
- package/dist/executor/index.js +0 -4
- package/dist/executor/index.js.map +0 -1
- package/dist/executor/vector-search-executor.d.ts +0 -71
- package/dist/executor/vector-search-executor.d.ts.map +0 -1
- package/dist/executor/vector-search-executor.js +0 -113
- package/dist/executor/vector-search-executor.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/mcp/adapters/anthropic-adapter.d.ts +0 -256
- package/dist/mcp/adapters/anthropic-adapter.d.ts.map +0 -1
- package/dist/mcp/adapters/anthropic-adapter.js +0 -409
- package/dist/mcp/adapters/anthropic-adapter.js.map +0 -1
- package/dist/mcp/adapters/base-adapter.d.ts +0 -164
- package/dist/mcp/adapters/base-adapter.d.ts.map +0 -1
- package/dist/mcp/adapters/base-adapter.js +0 -277
- package/dist/mcp/adapters/base-adapter.js.map +0 -1
- package/dist/mcp/adapters/errors.d.ts +0 -173
- package/dist/mcp/adapters/errors.d.ts.map +0 -1
- package/dist/mcp/adapters/errors.js +0 -305
- package/dist/mcp/adapters/errors.js.map +0 -1
- package/dist/mcp/adapters/index.d.ts +0 -65
- package/dist/mcp/adapters/index.d.ts.map +0 -1
- package/dist/mcp/adapters/index.js +0 -92
- package/dist/mcp/adapters/index.js.map +0 -1
- package/dist/mcp/adapters/streaming.d.ts +0 -200
- package/dist/mcp/adapters/streaming.d.ts.map +0 -1
- package/dist/mcp/adapters/streaming.js +0 -381
- package/dist/mcp/adapters/streaming.js.map +0 -1
- package/dist/mcp/adapters/vercel-adapter.d.ts +0 -321
- package/dist/mcp/adapters/vercel-adapter.d.ts.map +0 -1
- package/dist/mcp/adapters/vercel-adapter.js +0 -487
- package/dist/mcp/adapters/vercel-adapter.js.map +0 -1
- package/dist/mcp/agent.d.ts +0 -192
- package/dist/mcp/agent.d.ts.map +0 -1
- package/dist/mcp/agent.js +0 -338
- package/dist/mcp/agent.js.map +0 -1
- package/dist/mcp/cli.d.ts +0 -71
- package/dist/mcp/cli.d.ts.map +0 -1
- package/dist/mcp/cli.js +0 -218
- package/dist/mcp/cli.js.map +0 -1
- package/dist/mcp/index.d.ts +0 -15
- package/dist/mcp/index.d.ts.map +0 -1
- package/dist/mcp/index.js +0 -20
- package/dist/mcp/index.js.map +0 -1
- package/dist/mcp/sandbox/database-proxy.d.ts +0 -118
- package/dist/mcp/sandbox/database-proxy.d.ts.map +0 -1
- package/dist/mcp/sandbox/database-proxy.js +0 -154
- package/dist/mcp/sandbox/database-proxy.js.map +0 -1
- package/dist/mcp/sandbox/index.d.ts +0 -8
- package/dist/mcp/sandbox/index.d.ts.map +0 -1
- package/dist/mcp/sandbox/index.js +0 -7
- package/dist/mcp/sandbox/index.js.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts +0 -72
- package/dist/mcp/sandbox/miniflare-evaluator.d.ts.map +0 -1
- package/dist/mcp/sandbox/miniflare-evaluator.js +0 -379
- package/dist/mcp/sandbox/miniflare-evaluator.js.map +0 -1
- package/dist/mcp/sandbox/template.d.ts +0 -48
- package/dist/mcp/sandbox/template.d.ts.map +0 -1
- package/dist/mcp/sandbox/template.js +0 -147
- package/dist/mcp/sandbox/template.js.map +0 -1
- package/dist/mcp/sandbox/worker-evaluator.d.ts +0 -160
- package/dist/mcp/sandbox/worker-evaluator.d.ts.map +0 -1
- package/dist/mcp/sandbox/worker-evaluator.js +0 -217
- package/dist/mcp/sandbox/worker-evaluator.js.map +0 -1
- package/dist/mcp/server.d.ts +0 -75
- package/dist/mcp/server.d.ts.map +0 -1
- package/dist/mcp/server.js +0 -278
- package/dist/mcp/server.js.map +0 -1
- package/dist/mcp/tool-call-auditor.d.ts +0 -188
- package/dist/mcp/tool-call-auditor.d.ts.map +0 -1
- package/dist/mcp/tool-call-auditor.js +0 -198
- package/dist/mcp/tool-call-auditor.js.map +0 -1
- package/dist/mcp/tools/do.d.ts +0 -51
- package/dist/mcp/tools/do.d.ts.map +0 -1
- package/dist/mcp/tools/do.js +0 -113
- package/dist/mcp/tools/do.js.map +0 -1
- package/dist/mcp/tools/fetch.d.ts +0 -43
- package/dist/mcp/tools/fetch.d.ts.map +0 -1
- package/dist/mcp/tools/fetch.js +0 -127
- package/dist/mcp/tools/fetch.js.map +0 -1
- package/dist/mcp/tools/index.d.ts +0 -9
- package/dist/mcp/tools/index.d.ts.map +0 -1
- package/dist/mcp/tools/index.js +0 -9
- package/dist/mcp/tools/index.js.map +0 -1
- package/dist/mcp/tools/search.d.ts +0 -60
- package/dist/mcp/tools/search.d.ts.map +0 -1
- package/dist/mcp/tools/search.js +0 -278
- package/dist/mcp/tools/search.js.map +0 -1
- package/dist/mcp/transport/http.d.ts +0 -144
- package/dist/mcp/transport/http.d.ts.map +0 -1
- package/dist/mcp/transport/http.js +0 -545
- package/dist/mcp/transport/http.js.map +0 -1
- package/dist/mcp/transport/index.d.ts +0 -10
- package/dist/mcp/transport/index.d.ts.map +0 -1
- package/dist/mcp/transport/index.js +0 -12
- package/dist/mcp/transport/index.js.map +0 -1
- package/dist/mcp/transport/stdio.d.ts +0 -132
- package/dist/mcp/transport/stdio.d.ts.map +0 -1
- package/dist/mcp/transport/stdio.js +0 -466
- package/dist/mcp/transport/stdio.js.map +0 -1
- package/dist/mcp/types.d.ts +0 -476
- package/dist/mcp/types.d.ts.map +0 -1
- package/dist/mcp/types.js +0 -178
- package/dist/mcp/types.js.map +0 -1
- package/dist/olap/cdc/cdc-buffer.d.ts +0 -92
- package/dist/olap/cdc/cdc-buffer.d.ts.map +0 -1
- package/dist/olap/cdc/cdc-buffer.js +0 -146
- package/dist/olap/cdc/cdc-buffer.js.map +0 -1
- package/dist/olap/cdc/cdc-emitter.d.ts +0 -118
- package/dist/olap/cdc/cdc-emitter.d.ts.map +0 -1
- package/dist/olap/cdc/cdc-emitter.js +0 -217
- package/dist/olap/cdc/cdc-emitter.js.map +0 -1
- package/dist/olap/cdc/cdc-schema.d.ts +0 -119
- package/dist/olap/cdc/cdc-schema.d.ts.map +0 -1
- package/dist/olap/cdc/cdc-schema.js +0 -253
- package/dist/olap/cdc/cdc-schema.js.map +0 -1
- package/dist/olap/cdc/index.d.ts +0 -10
- package/dist/olap/cdc/index.d.ts.map +0 -1
- package/dist/olap/cdc/index.js +0 -10
- package/dist/olap/cdc/index.js.map +0 -1
- package/dist/olap/clickhouse/iceberg.d.ts +0 -164
- package/dist/olap/clickhouse/iceberg.d.ts.map +0 -1
- package/dist/olap/clickhouse/iceberg.js +0 -138
- package/dist/olap/clickhouse/iceberg.js.map +0 -1
- package/dist/olap/clickhouse/index.d.ts +0 -14
- package/dist/olap/clickhouse/index.d.ts.map +0 -1
- package/dist/olap/clickhouse/index.js +0 -14
- package/dist/olap/clickhouse/index.js.map +0 -1
- package/dist/olap/clickhouse/mapper.d.ts +0 -170
- package/dist/olap/clickhouse/mapper.d.ts.map +0 -1
- package/dist/olap/clickhouse/mapper.js +0 -654
- package/dist/olap/clickhouse/mapper.js.map +0 -1
- package/dist/olap/clickhouse/olap-backend.d.ts +0 -181
- package/dist/olap/clickhouse/olap-backend.d.ts.map +0 -1
- package/dist/olap/clickhouse/olap-backend.js +0 -1083
- package/dist/olap/clickhouse/olap-backend.js.map +0 -1
- package/dist/olap/clickhouse/query-executor.d.ts +0 -163
- package/dist/olap/clickhouse/query-executor.d.ts.map +0 -1
- package/dist/olap/clickhouse/query-executor.js +0 -560
- package/dist/olap/clickhouse/query-executor.js.map +0 -1
- package/dist/olap/clickhouse/query.d.ts +0 -134
- package/dist/olap/clickhouse/query.d.ts.map +0 -1
- package/dist/olap/clickhouse/query.js +0 -512
- package/dist/olap/clickhouse/query.js.map +0 -1
- package/dist/olap/stage/index.d.ts +0 -6
- package/dist/olap/stage/index.d.ts.map +0 -1
- package/dist/olap/stage/index.js +0 -6
- package/dist/olap/stage/index.js.map +0 -1
- package/dist/olap/stage/parser.d.ts +0 -68
- package/dist/olap/stage/parser.d.ts.map +0 -1
- package/dist/olap/stage/parser.js +0 -293
- package/dist/olap/stage/parser.js.map +0 -1
- package/dist/olap/stage/router.d.ts +0 -94
- package/dist/olap/stage/router.d.ts.map +0 -1
- package/dist/olap/stage/router.js +0 -390
- package/dist/olap/stage/router.js.map +0 -1
- package/dist/rpc/endpoint.d.ts +0 -52
- package/dist/rpc/endpoint.d.ts.map +0 -1
- package/dist/rpc/endpoint.js +0 -734
- package/dist/rpc/endpoint.js.map +0 -1
- package/dist/rpc/index.d.ts +0 -34
- package/dist/rpc/index.d.ts.map +0 -1
- package/dist/rpc/index.js +0 -45
- package/dist/rpc/index.js.map +0 -1
- package/dist/rpc/rpc-client.d.ts +0 -275
- package/dist/rpc/rpc-client.d.ts.map +0 -1
- package/dist/rpc/rpc-client.js +0 -735
- package/dist/rpc/rpc-client.js.map +0 -1
- package/dist/rpc/rpc-target.d.ts +0 -220
- package/dist/rpc/rpc-target.d.ts.map +0 -1
- package/dist/rpc/rpc-target.js +0 -500
- package/dist/rpc/rpc-target.js.map +0 -1
- package/dist/rpc/worker-entrypoint.d.ts +0 -159
- package/dist/rpc/worker-entrypoint.d.ts.map +0 -1
- package/dist/rpc/worker-entrypoint.js +0 -212
- package/dist/rpc/worker-entrypoint.js.map +0 -1
- package/dist/server.d.ts +0 -18
- package/dist/server.d.ts.map +0 -1
- package/dist/server.js +0 -129
- package/dist/server.js.map +0 -1
- package/dist/studio/components/browser/CollectionItem.d.ts +0 -26
- package/dist/studio/components/browser/CollectionItem.d.ts.map +0 -1
- package/dist/studio/components/browser/CollectionItem.js +0 -143
- package/dist/studio/components/browser/CollectionItem.js.map +0 -1
- package/dist/studio/components/browser/CollectionTree.d.ts +0 -45
- package/dist/studio/components/browser/CollectionTree.d.ts.map +0 -1
- package/dist/studio/components/browser/CollectionTree.js +0 -207
- package/dist/studio/components/browser/CollectionTree.js.map +0 -1
- package/dist/studio/components/browser/ConnectedDatabaseBrowser.d.ts +0 -51
- package/dist/studio/components/browser/ConnectedDatabaseBrowser.d.ts.map +0 -1
- package/dist/studio/components/browser/ConnectedDatabaseBrowser.js +0 -185
- package/dist/studio/components/browser/ConnectedDatabaseBrowser.js.map +0 -1
- package/dist/studio/components/browser/DatabaseBrowser.d.ts +0 -46
- package/dist/studio/components/browser/DatabaseBrowser.d.ts.map +0 -1
- package/dist/studio/components/browser/DatabaseBrowser.js +0 -304
- package/dist/studio/components/browser/DatabaseBrowser.js.map +0 -1
- package/dist/studio/components/browser/__tests__/CollectionItem.test.d.ts +0 -5
- package/dist/studio/components/browser/__tests__/CollectionItem.test.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/CollectionItem.test.js +0 -169
- package/dist/studio/components/browser/__tests__/CollectionItem.test.js.map +0 -1
- package/dist/studio/components/browser/__tests__/CollectionTree.test.d.ts +0 -5
- package/dist/studio/components/browser/__tests__/CollectionTree.test.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/CollectionTree.test.js +0 -203
- package/dist/studio/components/browser/__tests__/CollectionTree.test.js.map +0 -1
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.e2e.test.d.ts +0 -8
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.e2e.test.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.e2e.test.js +0 -522
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.e2e.test.js.map +0 -1
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.test.d.ts +0 -5
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.test.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.test.js +0 -518
- package/dist/studio/components/browser/__tests__/DatabaseBrowser.test.js.map +0 -1
- package/dist/studio/components/browser/__tests__/setup.d.ts +0 -5
- package/dist/studio/components/browser/__tests__/setup.d.ts.map +0 -1
- package/dist/studio/components/browser/__tests__/setup.js +0 -22
- package/dist/studio/components/browser/__tests__/setup.js.map +0 -1
- package/dist/studio/components/browser/index.d.ts +0 -15
- package/dist/studio/components/browser/index.d.ts.map +0 -1
- package/dist/studio/components/browser/index.js +0 -10
- package/dist/studio/components/browser/index.js.map +0 -1
- package/dist/studio/components/browser/types.d.ts +0 -33
- package/dist/studio/components/browser/types.d.ts.map +0 -1
- package/dist/studio/components/browser/types.js +0 -5
- package/dist/studio/components/browser/types.js.map +0 -1
- package/dist/studio/components/connection/ConnectionForm.d.ts +0 -59
- package/dist/studio/components/connection/ConnectionForm.d.ts.map +0 -1
- package/dist/studio/components/connection/ConnectionForm.js +0 -274
- package/dist/studio/components/connection/ConnectionForm.js.map +0 -1
- package/dist/studio/components/connection/ConnectionList.d.ts +0 -59
- package/dist/studio/components/connection/ConnectionList.d.ts.map +0 -1
- package/dist/studio/components/connection/ConnectionList.js +0 -286
- package/dist/studio/components/connection/ConnectionList.js.map +0 -1
- package/dist/studio/components/connection/ConnectionPanel.d.ts +0 -132
- package/dist/studio/components/connection/ConnectionPanel.d.ts.map +0 -1
- package/dist/studio/components/connection/ConnectionPanel.js +0 -293
- package/dist/studio/components/connection/ConnectionPanel.js.map +0 -1
- package/dist/studio/components/connection/__tests__/ConnectionPanel.test.d.ts +0 -8
- package/dist/studio/components/connection/__tests__/ConnectionPanel.test.d.ts.map +0 -1
- package/dist/studio/components/connection/__tests__/ConnectionPanel.test.js +0 -632
- package/dist/studio/components/connection/__tests__/ConnectionPanel.test.js.map +0 -1
- package/dist/studio/components/connection/__tests__/setup.d.ts +0 -5
- package/dist/studio/components/connection/__tests__/setup.d.ts.map +0 -1
- package/dist/studio/components/connection/__tests__/setup.js +0 -11
- package/dist/studio/components/connection/__tests__/setup.js.map +0 -1
- package/dist/studio/components/connection/index.d.ts +0 -10
- package/dist/studio/components/connection/index.d.ts.map +0 -1
- package/dist/studio/components/connection/index.js +0 -7
- package/dist/studio/components/connection/index.js.map +0 -1
- package/dist/studio/components/crud/DeleteDocumentDialog.d.ts +0 -91
- package/dist/studio/components/crud/DeleteDocumentDialog.d.ts.map +0 -1
- package/dist/studio/components/crud/DeleteDocumentDialog.js +0 -273
- package/dist/studio/components/crud/DeleteDocumentDialog.js.map +0 -1
- package/dist/studio/components/crud/DocumentEditor.d.ts +0 -32
- package/dist/studio/components/crud/DocumentEditor.d.ts.map +0 -1
- package/dist/studio/components/crud/DocumentEditor.js +0 -546
- package/dist/studio/components/crud/DocumentEditor.js.map +0 -1
- package/dist/studio/components/crud/InsertDocumentDialog.d.ts +0 -78
- package/dist/studio/components/crud/InsertDocumentDialog.d.ts.map +0 -1
- package/dist/studio/components/crud/InsertDocumentDialog.js +0 -323
- package/dist/studio/components/crud/InsertDocumentDialog.js.map +0 -1
- package/dist/studio/components/crud/__tests__/DeleteDocumentDialog.test.d.ts +0 -5
- package/dist/studio/components/crud/__tests__/DeleteDocumentDialog.test.d.ts.map +0 -1
- package/dist/studio/components/crud/__tests__/DeleteDocumentDialog.test.js +0 -298
- package/dist/studio/components/crud/__tests__/DeleteDocumentDialog.test.js.map +0 -1
- package/dist/studio/components/crud/__tests__/DocumentEditor.test.d.ts +0 -8
- package/dist/studio/components/crud/__tests__/DocumentEditor.test.d.ts.map +0 -1
- package/dist/studio/components/crud/__tests__/DocumentEditor.test.js +0 -368
- package/dist/studio/components/crud/__tests__/DocumentEditor.test.js.map +0 -1
- package/dist/studio/components/crud/__tests__/InsertDocumentDialog.test.d.ts +0 -2
- package/dist/studio/components/crud/__tests__/InsertDocumentDialog.test.d.ts.map +0 -1
- package/dist/studio/components/crud/__tests__/InsertDocumentDialog.test.js +0 -352
- package/dist/studio/components/crud/__tests__/InsertDocumentDialog.test.js.map +0 -1
- package/dist/studio/components/crud/__tests__/setup.d.ts +0 -5
- package/dist/studio/components/crud/__tests__/setup.d.ts.map +0 -1
- package/dist/studio/components/crud/__tests__/setup.js +0 -22
- package/dist/studio/components/crud/__tests__/setup.js.map +0 -1
- package/dist/studio/components/crud/index.d.ts +0 -12
- package/dist/studio/components/crud/index.d.ts.map +0 -1
- package/dist/studio/components/crud/index.js +0 -11
- package/dist/studio/components/crud/index.js.map +0 -1
- package/dist/studio/hooks/useConnection.d.ts +0 -127
- package/dist/studio/hooks/useConnection.d.ts.map +0 -1
- package/dist/studio/hooks/useConnection.js +0 -414
- package/dist/studio/hooks/useConnection.js.map +0 -1
- package/dist/studio/hooks/useDatabaseBrowser.d.ts +0 -107
- package/dist/studio/hooks/useDatabaseBrowser.d.ts.map +0 -1
- package/dist/studio/hooks/useDatabaseBrowser.js +0 -294
- package/dist/studio/hooks/useDatabaseBrowser.js.map +0 -1
- package/dist/studio/index.d.ts +0 -16
- package/dist/studio/index.d.ts.map +0 -1
- package/dist/studio/index.js +0 -14
- package/dist/studio/index.js.map +0 -1
- package/dist/studio/types/connection.d.ts +0 -266
- package/dist/studio/types/connection.d.ts.map +0 -1
- package/dist/studio/types/connection.js +0 -159
- package/dist/studio/types/connection.js.map +0 -1
- package/dist/studio/vitest.config.d.ts +0 -3
- package/dist/studio/vitest.config.d.ts.map +0 -1
- package/dist/studio/vitest.config.js +0 -33
- package/dist/studio/vitest.config.js.map +0 -1
- package/dist/translator/aggregation-translator.d.ts +0 -51
- package/dist/translator/aggregation-translator.d.ts.map +0 -1
- package/dist/translator/aggregation-translator.js +0 -324
- package/dist/translator/aggregation-translator.js.map +0 -1
- package/dist/translator/dialect.d.ts +0 -131
- package/dist/translator/dialect.d.ts.map +0 -1
- package/dist/translator/dialect.js +0 -276
- package/dist/translator/dialect.js.map +0 -1
- package/dist/translator/geo-translator.d.ts +0 -91
- package/dist/translator/geo-translator.d.ts.map +0 -1
- package/dist/translator/geo-translator.js +0 -587
- package/dist/translator/geo-translator.js.map +0 -1
- package/dist/translator/hybrid-translator.d.ts +0 -70
- package/dist/translator/hybrid-translator.d.ts.map +0 -1
- package/dist/translator/hybrid-translator.js +0 -193
- package/dist/translator/hybrid-translator.js.map +0 -1
- package/dist/translator/index.d.ts +0 -13
- package/dist/translator/index.d.ts.map +0 -1
- package/dist/translator/index.js +0 -11
- package/dist/translator/index.js.map +0 -1
- package/dist/translator/query-translator.d.ts +0 -211
- package/dist/translator/query-translator.d.ts.map +0 -1
- package/dist/translator/query-translator.js +0 -1276
- package/dist/translator/query-translator.js.map +0 -1
- package/dist/translator/search-highlight.d.ts +0 -83
- package/dist/translator/search-highlight.d.ts.map +0 -1
- package/dist/translator/search-highlight.js +0 -83
- package/dist/translator/search-highlight.js.map +0 -1
- package/dist/translator/search-translator.d.ts +0 -155
- package/dist/translator/search-translator.d.ts.map +0 -1
- package/dist/translator/search-translator.js +0 -241
- package/dist/translator/search-translator.js.map +0 -1
- package/dist/translator/stages/add-fields-stage.d.ts +0 -7
- package/dist/translator/stages/add-fields-stage.d.ts.map +0 -1
- package/dist/translator/stages/add-fields-stage.js +0 -72
- package/dist/translator/stages/add-fields-stage.js.map +0 -1
- package/dist/translator/stages/bucket-stage.d.ts +0 -7
- package/dist/translator/stages/bucket-stage.d.ts.map +0 -1
- package/dist/translator/stages/bucket-stage.js +0 -87
- package/dist/translator/stages/bucket-stage.js.map +0 -1
- package/dist/translator/stages/count-stage.d.ts +0 -7
- package/dist/translator/stages/count-stage.d.ts.map +0 -1
- package/dist/translator/stages/count-stage.js +0 -12
- package/dist/translator/stages/count-stage.js.map +0 -1
- package/dist/translator/stages/expression-translator.d.ts +0 -68
- package/dist/translator/stages/expression-translator.d.ts.map +0 -1
- package/dist/translator/stages/expression-translator.js +0 -467
- package/dist/translator/stages/expression-translator.js.map +0 -1
- package/dist/translator/stages/facet-stage.d.ts +0 -13
- package/dist/translator/stages/facet-stage.d.ts.map +0 -1
- package/dist/translator/stages/facet-stage.js +0 -26
- package/dist/translator/stages/facet-stage.js.map +0 -1
- package/dist/translator/stages/fusion-stages.d.ts +0 -118
- package/dist/translator/stages/fusion-stages.d.ts.map +0 -1
- package/dist/translator/stages/fusion-stages.js +0 -201
- package/dist/translator/stages/fusion-stages.js.map +0 -1
- package/dist/translator/stages/group-stage.d.ts +0 -8
- package/dist/translator/stages/group-stage.d.ts.map +0 -1
- package/dist/translator/stages/group-stage.js +0 -123
- package/dist/translator/stages/group-stage.js.map +0 -1
- package/dist/translator/stages/index.d.ts +0 -24
- package/dist/translator/stages/index.d.ts.map +0 -1
- package/dist/translator/stages/index.js +0 -24
- package/dist/translator/stages/index.js.map +0 -1
- package/dist/translator/stages/join-optimizer.d.ts +0 -37
- package/dist/translator/stages/join-optimizer.d.ts.map +0 -1
- package/dist/translator/stages/join-optimizer.js +0 -93
- package/dist/translator/stages/join-optimizer.js.map +0 -1
- package/dist/translator/stages/limit-stage.d.ts +0 -7
- package/dist/translator/stages/limit-stage.d.ts.map +0 -1
- package/dist/translator/stages/limit-stage.js +0 -11
- package/dist/translator/stages/limit-stage.js.map +0 -1
- package/dist/translator/stages/lookup-stage.d.ts +0 -7
- package/dist/translator/stages/lookup-stage.d.ts.map +0 -1
- package/dist/translator/stages/lookup-stage.js +0 -73
- package/dist/translator/stages/lookup-stage.js.map +0 -1
- package/dist/translator/stages/match-stage.d.ts +0 -7
- package/dist/translator/stages/match-stage.d.ts.map +0 -1
- package/dist/translator/stages/match-stage.js +0 -14
- package/dist/translator/stages/match-stage.js.map +0 -1
- package/dist/translator/stages/optimizer.d.ts +0 -15
- package/dist/translator/stages/optimizer.d.ts.map +0 -1
- package/dist/translator/stages/optimizer.js +0 -249
- package/dist/translator/stages/optimizer.js.map +0 -1
- package/dist/translator/stages/parallel-facet.d.ts +0 -47
- package/dist/translator/stages/parallel-facet.d.ts.map +0 -1
- package/dist/translator/stages/parallel-facet.js +0 -57
- package/dist/translator/stages/parallel-facet.js.map +0 -1
- package/dist/translator/stages/project-stage.d.ts +0 -8
- package/dist/translator/stages/project-stage.d.ts.map +0 -1
- package/dist/translator/stages/project-stage.js +0 -145
- package/dist/translator/stages/project-stage.js.map +0 -1
- package/dist/translator/stages/search-stage.d.ts +0 -60
- package/dist/translator/stages/search-stage.d.ts.map +0 -1
- package/dist/translator/stages/search-stage.js +0 -89
- package/dist/translator/stages/search-stage.js.map +0 -1
- package/dist/translator/stages/skip-stage.d.ts +0 -7
- package/dist/translator/stages/skip-stage.d.ts.map +0 -1
- package/dist/translator/stages/skip-stage.js +0 -11
- package/dist/translator/stages/skip-stage.js.map +0 -1
- package/dist/translator/stages/sort-stage.d.ts +0 -7
- package/dist/translator/stages/sort-stage.d.ts.map +0 -1
- package/dist/translator/stages/sort-stage.js +0 -21
- package/dist/translator/stages/sort-stage.js.map +0 -1
- package/dist/translator/stages/types.d.ts +0 -136
- package/dist/translator/stages/types.d.ts.map +0 -1
- package/dist/translator/stages/types.js +0 -5
- package/dist/translator/stages/types.js.map +0 -1
- package/dist/translator/stages/unwind-stage.d.ts +0 -7
- package/dist/translator/stages/unwind-stage.d.ts.map +0 -1
- package/dist/translator/stages/unwind-stage.js +0 -61
- package/dist/translator/stages/unwind-stage.js.map +0 -1
- package/dist/translator/stages/vector-search-stage.d.ts +0 -53
- package/dist/translator/stages/vector-search-stage.d.ts.map +0 -1
- package/dist/translator/stages/vector-search-stage.js +0 -62
- package/dist/translator/stages/vector-search-stage.js.map +0 -1
- package/dist/translator/update-translator.d.ts +0 -148
- package/dist/translator/update-translator.d.ts.map +0 -1
- package/dist/translator/update-translator.js +0 -819
- package/dist/translator/update-translator.js.map +0 -1
- package/dist/translator/vector-translator.d.ts +0 -89
- package/dist/translator/vector-translator.d.ts.map +0 -1
- package/dist/translator/vector-translator.js +0 -106
- package/dist/translator/vector-translator.js.map +0 -1
- package/dist/types/env.d.ts +0 -31
- package/dist/types/env.d.ts.map +0 -1
- package/dist/types/env.js +0 -5
- package/dist/types/env.js.map +0 -1
- package/dist/types/function.d.ts +0 -65
- package/dist/types/function.d.ts.map +0 -1
- package/dist/types/function.js +0 -5
- package/dist/types/function.js.map +0 -1
- package/dist/types/index.d.ts +0 -137
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/index.js +0 -13
- package/dist/types/index.js.map +0 -1
- package/dist/types/mongodb.d.ts +0 -258
- package/dist/types/mongodb.d.ts.map +0 -1
- package/dist/types/mongodb.js +0 -5
- package/dist/types/mongodb.js.map +0 -1
- package/dist/types/objectid.d.ts +0 -130
- package/dist/types/objectid.d.ts.map +0 -1
- package/dist/types/objectid.js +0 -314
- package/dist/types/objectid.js.map +0 -1
- package/dist/types/rpc.d.ts +0 -313
- package/dist/types/rpc.d.ts.map +0 -1
- package/dist/types/rpc.js +0 -136
- package/dist/types/rpc.js.map +0 -1
- package/dist/types/vectorize.d.ts +0 -136
- package/dist/types/vectorize.d.ts.map +0 -1
- package/dist/types/vectorize.js +0 -8
- package/dist/types/vectorize.js.map +0 -1
- package/dist/utils/sql-safety.d.ts +0 -64
- package/dist/utils/sql-safety.d.ts.map +0 -1
- package/dist/utils/sql-safety.js +0 -112
- package/dist/utils/sql-safety.js.map +0 -1
- package/dist/validation/document-validator.d.ts +0 -195
- package/dist/validation/document-validator.d.ts.map +0 -1
- package/dist/validation/document-validator.js +0 -529
- package/dist/validation/document-validator.js.map +0 -1
- package/dist/vectorize/document-serializer.d.ts +0 -119
- package/dist/vectorize/document-serializer.d.ts.map +0 -1
- package/dist/vectorize/document-serializer.js +0 -320
- package/dist/vectorize/document-serializer.js.map +0 -1
- package/dist/wire/auth/index.d.ts +0 -5
- package/dist/wire/auth/index.d.ts.map +0 -1
- package/dist/wire/auth/index.js +0 -5
- package/dist/wire/auth/index.js.map +0 -1
- package/dist/wire/auth/scram.d.ts +0 -160
- package/dist/wire/auth/scram.d.ts.map +0 -1
- package/dist/wire/auth/scram.js +0 -425
- package/dist/wire/auth/scram.js.map +0 -1
- package/dist/wire/backend/interface.d.ts +0 -168
- package/dist/wire/backend/interface.d.ts.map +0 -1
- package/dist/wire/backend/interface.js +0 -10
- package/dist/wire/backend/interface.js.map +0 -1
- package/dist/wire/backend/local-sqlite.d.ts +0 -89
- package/dist/wire/backend/local-sqlite.d.ts.map +0 -1
- package/dist/wire/backend/local-sqlite.js +0 -1002
- package/dist/wire/backend/local-sqlite.js.map +0 -1
- package/dist/wire/backend/query-router.d.ts +0 -197
- package/dist/wire/backend/query-router.d.ts.map +0 -1
- package/dist/wire/backend/query-router.js +0 -590
- package/dist/wire/backend/query-router.js.map +0 -1
- package/dist/wire/backend/validation.d.ts +0 -26
- package/dist/wire/backend/validation.d.ts.map +0 -1
- package/dist/wire/backend/validation.js +0 -79
- package/dist/wire/backend/validation.js.map +0 -1
- package/dist/wire/backend/workers-proxy.d.ts +0 -95
- package/dist/wire/backend/workers-proxy.d.ts.map +0 -1
- package/dist/wire/backend/workers-proxy.js +0 -429
- package/dist/wire/backend/workers-proxy.js.map +0 -1
- package/dist/wire/commands/admin.d.ts +0 -49
- package/dist/wire/commands/admin.d.ts.map +0 -1
- package/dist/wire/commands/admin.js +0 -272
- package/dist/wire/commands/admin.js.map +0 -1
- package/dist/wire/commands/aggregate.d.ts +0 -15
- package/dist/wire/commands/aggregate.d.ts.map +0 -1
- package/dist/wire/commands/aggregate.js +0 -98
- package/dist/wire/commands/aggregate.js.map +0 -1
- package/dist/wire/commands/auth.d.ts +0 -58
- package/dist/wire/commands/auth.d.ts.map +0 -1
- package/dist/wire/commands/auth.js +0 -158
- package/dist/wire/commands/auth.js.map +0 -1
- package/dist/wire/commands/crud.d.ts +0 -49
- package/dist/wire/commands/crud.d.ts.map +0 -1
- package/dist/wire/commands/crud.js +0 -336
- package/dist/wire/commands/crud.js.map +0 -1
- package/dist/wire/commands/hello.d.ts +0 -35
- package/dist/wire/commands/hello.d.ts.map +0 -1
- package/dist/wire/commands/hello.js +0 -204
- package/dist/wire/commands/hello.js.map +0 -1
- package/dist/wire/commands/index.d.ts +0 -24
- package/dist/wire/commands/index.d.ts.map +0 -1
- package/dist/wire/commands/index.js +0 -145
- package/dist/wire/commands/index.js.map +0 -1
- package/dist/wire/commands/router.d.ts +0 -46
- package/dist/wire/commands/router.d.ts.map +0 -1
- package/dist/wire/commands/router.js +0 -151
- package/dist/wire/commands/router.js.map +0 -1
- package/dist/wire/commands/types.d.ts +0 -51
- package/dist/wire/commands/types.d.ts.map +0 -1
- package/dist/wire/commands/types.js +0 -15
- package/dist/wire/commands/types.js.map +0 -1
- package/dist/wire/index.d.ts +0 -15
- package/dist/wire/index.d.ts.map +0 -1
- package/dist/wire/index.js +0 -19
- package/dist/wire/index.js.map +0 -1
- package/dist/wire/message.d.ts +0 -49
- package/dist/wire/message.d.ts.map +0 -1
- package/dist/wire/message.js +0 -299
- package/dist/wire/message.js.map +0 -1
- package/dist/wire/server.d.ts +0 -145
- package/dist/wire/server.d.ts.map +0 -1
- package/dist/wire/server.js +0 -284
- package/dist/wire/server.js.map +0 -1
- package/dist/wire/types.d.ts +0 -140
- package/dist/wire/types.d.ts.map +0 -1
- package/dist/wire/types.js +0 -64
- package/dist/wire/types.js.map +0 -1
- package/dist/worker.d.ts.map +0 -1
package/dist/agentfs/glob.d.ts
DELETED
|
@@ -1,116 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Glob Pattern Matching for AgentFS
|
|
3
|
-
*
|
|
4
|
-
* Implements glob pattern matching functionality for file/path matching.
|
|
5
|
-
* Supports standard glob patterns including:
|
|
6
|
-
* - * : matches any sequence of characters except /
|
|
7
|
-
* - ** : matches any sequence including /
|
|
8
|
-
* - ? : matches any single character except /
|
|
9
|
-
* - [abc] : matches any character in the set
|
|
10
|
-
* - [a-z] : matches any character in the range
|
|
11
|
-
* - [!abc] or [^abc] : matches any character NOT in the set
|
|
12
|
-
* - {a,b,c} : matches any of the alternatives
|
|
13
|
-
*/
|
|
14
|
-
import type { GlobOptions } from './types';
|
|
15
|
-
/**
|
|
16
|
-
* Result of glob pattern matching
|
|
17
|
-
*/
|
|
18
|
-
export interface GlobMatchResult {
|
|
19
|
-
/** Whether the path matches the pattern */
|
|
20
|
-
matched: boolean;
|
|
21
|
-
/** The matched path segments (useful for captures) */
|
|
22
|
-
captures?: string[];
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Compiled glob pattern for efficient repeated matching
|
|
26
|
-
*/
|
|
27
|
-
export interface CompiledGlob {
|
|
28
|
-
/** Original pattern string */
|
|
29
|
-
pattern: string;
|
|
30
|
-
/** Compiled regex for matching */
|
|
31
|
-
regex: RegExp;
|
|
32
|
-
/** Whether pattern is negated (starts with !) */
|
|
33
|
-
negated: boolean;
|
|
34
|
-
/** Match a path against this pattern */
|
|
35
|
-
match(path: string): boolean;
|
|
36
|
-
}
|
|
37
|
-
/**
|
|
38
|
-
* Convert a glob pattern to a regular expression
|
|
39
|
-
*
|
|
40
|
-
* @param pattern - Glob pattern to convert
|
|
41
|
-
* @param options - Glob options (nocase, dot)
|
|
42
|
-
* @returns Compiled regex and metadata
|
|
43
|
-
*/
|
|
44
|
-
export declare function globToRegex(pattern: string, options?: Pick<GlobOptions, 'nocase' | 'dot'>): {
|
|
45
|
-
regex: RegExp;
|
|
46
|
-
negated: boolean;
|
|
47
|
-
};
|
|
48
|
-
/**
|
|
49
|
-
* Compile a glob pattern for efficient repeated matching
|
|
50
|
-
*
|
|
51
|
-
* @param pattern - Glob pattern to compile
|
|
52
|
-
* @param options - Glob options
|
|
53
|
-
* @returns Compiled glob object
|
|
54
|
-
*/
|
|
55
|
-
export declare function compileGlob(pattern: string, options?: Pick<GlobOptions, 'nocase' | 'dot'>): CompiledGlob;
|
|
56
|
-
/**
|
|
57
|
-
* Test if a path matches a glob pattern
|
|
58
|
-
*
|
|
59
|
-
* @param pattern - Glob pattern
|
|
60
|
-
* @param path - Path to test
|
|
61
|
-
* @param options - Glob options
|
|
62
|
-
* @returns True if path matches pattern
|
|
63
|
-
*/
|
|
64
|
-
export declare function matchGlob(pattern: string, path: string, options?: Pick<GlobOptions, 'nocase' | 'dot'>): boolean;
|
|
65
|
-
/**
|
|
66
|
-
* Test if a path matches any of the given glob patterns
|
|
67
|
-
*
|
|
68
|
-
* @param patterns - Array of glob patterns
|
|
69
|
-
* @param path - Path to test
|
|
70
|
-
* @param options - Glob options
|
|
71
|
-
* @returns True if path matches any pattern
|
|
72
|
-
*/
|
|
73
|
-
export declare function matchAnyGlob(patterns: string[], path: string, options?: Pick<GlobOptions, 'nocase' | 'dot'>): boolean;
|
|
74
|
-
/**
|
|
75
|
-
* Filter paths that match a glob pattern
|
|
76
|
-
*
|
|
77
|
-
* @param pattern - Glob pattern
|
|
78
|
-
* @param paths - Array of paths to filter
|
|
79
|
-
* @param options - Glob options
|
|
80
|
-
* @returns Paths that match the pattern
|
|
81
|
-
*/
|
|
82
|
-
export declare function filterGlob(pattern: string, paths: string[], options?: Pick<GlobOptions, 'nocase' | 'dot'>): string[];
|
|
83
|
-
/**
|
|
84
|
-
* GlobMatcher class for matching paths against multiple patterns
|
|
85
|
-
*/
|
|
86
|
-
export declare class GlobMatcher {
|
|
87
|
-
private includePatterns;
|
|
88
|
-
private excludePatterns;
|
|
89
|
-
readonly options: Pick<GlobOptions, 'nocase' | 'dot'>;
|
|
90
|
-
constructor(patterns: string | string[], options?: Pick<GlobOptions, 'nocase' | 'dot'>);
|
|
91
|
-
/**
|
|
92
|
-
* Test if a path matches the patterns
|
|
93
|
-
*/
|
|
94
|
-
match(path: string): boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Filter paths that match the patterns
|
|
97
|
-
*/
|
|
98
|
-
filter(paths: string[]): string[];
|
|
99
|
-
}
|
|
100
|
-
/**
|
|
101
|
-
* Normalize a path for glob matching
|
|
102
|
-
* - Removes trailing slashes
|
|
103
|
-
* - Normalizes multiple slashes
|
|
104
|
-
* - Handles relative paths with cwd
|
|
105
|
-
*/
|
|
106
|
-
export declare function normalizePath(path: string, cwd?: string): string;
|
|
107
|
-
/**
|
|
108
|
-
* Get the base directory from a glob pattern
|
|
109
|
-
* Returns the longest non-glob prefix path
|
|
110
|
-
*/
|
|
111
|
-
export declare function getGlobBase(pattern: string): string;
|
|
112
|
-
/**
|
|
113
|
-
* Check if a pattern contains glob special characters
|
|
114
|
-
*/
|
|
115
|
-
export declare function isGlobPattern(pattern: string): boolean;
|
|
116
|
-
//# sourceMappingURL=glob.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob.d.ts","sourceRoot":"","sources":["../../src/agentfs/glob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAA;AAE1C;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,2CAA2C;IAC3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BAAa,WAAW;IACtB,OAAO,CAAC,eAAe,CAAqB;IAC5C,OAAO,CAAC,eAAe,CAAqB;IAC5C,QAAQ,CAAC,OAAO,EAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,KAAK,CAAC,CAAA;gBAGnD,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,EAC3B,OAAO,GAAE,IAAI,CAAC,WAAW,EAAE,QAAQ,GAAG,KAAK,CAAM;IAenD;;OAEG;IACH,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO;IAY5B;;OAEG;IACH,MAAM,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE;CAGlC;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM,CAgBhE;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAYnD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEtD"}
|
package/dist/agentfs/glob.js
DELETED
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Glob Pattern Matching for AgentFS
|
|
3
|
-
*
|
|
4
|
-
* Implements glob pattern matching functionality for file/path matching.
|
|
5
|
-
* Supports standard glob patterns including:
|
|
6
|
-
* - * : matches any sequence of characters except /
|
|
7
|
-
* - ** : matches any sequence including /
|
|
8
|
-
* - ? : matches any single character except /
|
|
9
|
-
* - [abc] : matches any character in the set
|
|
10
|
-
* - [a-z] : matches any character in the range
|
|
11
|
-
* - [!abc] or [^abc] : matches any character NOT in the set
|
|
12
|
-
* - {a,b,c} : matches any of the alternatives
|
|
13
|
-
*/
|
|
14
|
-
/**
|
|
15
|
-
* Escape special regex characters in a string
|
|
16
|
-
*/
|
|
17
|
-
function escapeRegex(str) {
|
|
18
|
-
return str.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Convert a glob pattern to a regular expression
|
|
22
|
-
*
|
|
23
|
-
* @param pattern - Glob pattern to convert
|
|
24
|
-
* @param options - Glob options (nocase, dot)
|
|
25
|
-
* @returns Compiled regex and metadata
|
|
26
|
-
*/
|
|
27
|
-
export function globToRegex(pattern, options = {}) {
|
|
28
|
-
const { nocase = false, dot = false } = options;
|
|
29
|
-
// Handle negation
|
|
30
|
-
let negated = false;
|
|
31
|
-
let workingPattern = pattern;
|
|
32
|
-
if (workingPattern.startsWith('!')) {
|
|
33
|
-
negated = true;
|
|
34
|
-
workingPattern = workingPattern.slice(1);
|
|
35
|
-
}
|
|
36
|
-
// Build regex pattern
|
|
37
|
-
let regexStr = '';
|
|
38
|
-
let i = 0;
|
|
39
|
-
const len = workingPattern.length;
|
|
40
|
-
// Pattern that matches any character except path separator
|
|
41
|
-
const notSlash = '[^/]';
|
|
42
|
-
// Pattern for matching dotfiles (if not dot option, exclude leading dots)
|
|
43
|
-
const notDot = dot ? '' : '(?!\\.)';
|
|
44
|
-
while (i < len) {
|
|
45
|
-
const char = workingPattern[i];
|
|
46
|
-
const nextChar = workingPattern[i + 1];
|
|
47
|
-
if (char === '*') {
|
|
48
|
-
if (nextChar === '*') {
|
|
49
|
-
// ** globstar - matches any path segment including /
|
|
50
|
-
const afterStar = workingPattern[i + 2];
|
|
51
|
-
if (afterStar === '/' || afterStar === undefined) {
|
|
52
|
-
// **/ or ** at end
|
|
53
|
-
if (afterStar === '/') {
|
|
54
|
-
// Match zero or more path segments
|
|
55
|
-
regexStr += `(?:${notDot}${notSlash}*(?:/${notDot}${notSlash}*)*)?/?`;
|
|
56
|
-
i += 3;
|
|
57
|
-
}
|
|
58
|
-
else {
|
|
59
|
-
// ** at end - match everything remaining
|
|
60
|
-
regexStr += `(?:${notDot}${notSlash}*(?:/${notDot}${notSlash}*)*)?`;
|
|
61
|
-
i += 2;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
else {
|
|
65
|
-
// ** not followed by / - treat as two single *
|
|
66
|
-
regexStr += `${notDot}${notSlash}*${notSlash}*`;
|
|
67
|
-
i += 2;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
else {
|
|
71
|
-
// Single * - match any sequence except /
|
|
72
|
-
regexStr += `${notDot}${notSlash}*`;
|
|
73
|
-
i++;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
else if (char === '?') {
|
|
77
|
-
// ? matches any single character except /
|
|
78
|
-
regexStr += `${notDot}${notSlash}`;
|
|
79
|
-
i++;
|
|
80
|
-
}
|
|
81
|
-
else if (char === '[') {
|
|
82
|
-
// Character class
|
|
83
|
-
let classEnd = workingPattern.indexOf(']', i + 1);
|
|
84
|
-
if (classEnd === -1) {
|
|
85
|
-
// No closing bracket - treat as literal
|
|
86
|
-
regexStr += escapeRegex(char);
|
|
87
|
-
i++;
|
|
88
|
-
}
|
|
89
|
-
else {
|
|
90
|
-
let classContent = workingPattern.slice(i + 1, classEnd);
|
|
91
|
-
// Handle negation [!...] or [^...]
|
|
92
|
-
if (classContent.startsWith('!') || classContent.startsWith('^')) {
|
|
93
|
-
classContent = '^' + classContent.slice(1);
|
|
94
|
-
}
|
|
95
|
-
// Escape special regex chars within class but preserve ranges
|
|
96
|
-
classContent = classContent.replace(/([\\])/g, '\\$1');
|
|
97
|
-
regexStr += `[${classContent}]`;
|
|
98
|
-
i = classEnd + 1;
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
else if (char === '{') {
|
|
102
|
-
// Brace expansion {a,b,c}
|
|
103
|
-
let braceEnd = workingPattern.indexOf('}', i + 1);
|
|
104
|
-
if (braceEnd === -1) {
|
|
105
|
-
// No closing brace - treat as literal
|
|
106
|
-
regexStr += escapeRegex(char);
|
|
107
|
-
i++;
|
|
108
|
-
}
|
|
109
|
-
else {
|
|
110
|
-
const alternatives = workingPattern.slice(i + 1, braceEnd).split(',');
|
|
111
|
-
const altPatterns = alternatives.map((alt) => {
|
|
112
|
-
// Recursively convert each alternative (but without anchors)
|
|
113
|
-
const { regex } = globToRegex(alt, options);
|
|
114
|
-
// Extract the pattern without anchors
|
|
115
|
-
return regex.source.replace(/^\^/, '').replace(/\$$/, '');
|
|
116
|
-
});
|
|
117
|
-
regexStr += `(?:${altPatterns.join('|')})`;
|
|
118
|
-
i = braceEnd + 1;
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else if (char === '/') {
|
|
122
|
-
regexStr += '/';
|
|
123
|
-
i++;
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
// Literal character
|
|
127
|
-
regexStr += escapeRegex(char);
|
|
128
|
-
i++;
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
// Anchor pattern to full string
|
|
132
|
-
const flags = nocase ? 'i' : '';
|
|
133
|
-
const regex = new RegExp(`^${regexStr}$`, flags);
|
|
134
|
-
return { regex, negated };
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* Compile a glob pattern for efficient repeated matching
|
|
138
|
-
*
|
|
139
|
-
* @param pattern - Glob pattern to compile
|
|
140
|
-
* @param options - Glob options
|
|
141
|
-
* @returns Compiled glob object
|
|
142
|
-
*/
|
|
143
|
-
export function compileGlob(pattern, options = {}) {
|
|
144
|
-
const { regex, negated } = globToRegex(pattern, options);
|
|
145
|
-
return {
|
|
146
|
-
pattern,
|
|
147
|
-
regex,
|
|
148
|
-
negated,
|
|
149
|
-
match(path) {
|
|
150
|
-
const matches = regex.test(path);
|
|
151
|
-
return negated ? !matches : matches;
|
|
152
|
-
},
|
|
153
|
-
};
|
|
154
|
-
}
|
|
155
|
-
/**
|
|
156
|
-
* Test if a path matches a glob pattern
|
|
157
|
-
*
|
|
158
|
-
* @param pattern - Glob pattern
|
|
159
|
-
* @param path - Path to test
|
|
160
|
-
* @param options - Glob options
|
|
161
|
-
* @returns True if path matches pattern
|
|
162
|
-
*/
|
|
163
|
-
export function matchGlob(pattern, path, options = {}) {
|
|
164
|
-
const compiled = compileGlob(pattern, options);
|
|
165
|
-
return compiled.match(path);
|
|
166
|
-
}
|
|
167
|
-
/**
|
|
168
|
-
* Test if a path matches any of the given glob patterns
|
|
169
|
-
*
|
|
170
|
-
* @param patterns - Array of glob patterns
|
|
171
|
-
* @param path - Path to test
|
|
172
|
-
* @param options - Glob options
|
|
173
|
-
* @returns True if path matches any pattern
|
|
174
|
-
*/
|
|
175
|
-
export function matchAnyGlob(patterns, path, options = {}) {
|
|
176
|
-
return patterns.some((pattern) => matchGlob(pattern, path, options));
|
|
177
|
-
}
|
|
178
|
-
/**
|
|
179
|
-
* Filter paths that match a glob pattern
|
|
180
|
-
*
|
|
181
|
-
* @param pattern - Glob pattern
|
|
182
|
-
* @param paths - Array of paths to filter
|
|
183
|
-
* @param options - Glob options
|
|
184
|
-
* @returns Paths that match the pattern
|
|
185
|
-
*/
|
|
186
|
-
export function filterGlob(pattern, paths, options = {}) {
|
|
187
|
-
const compiled = compileGlob(pattern, options);
|
|
188
|
-
return paths.filter((path) => compiled.match(path));
|
|
189
|
-
}
|
|
190
|
-
/**
|
|
191
|
-
* GlobMatcher class for matching paths against multiple patterns
|
|
192
|
-
*/
|
|
193
|
-
export class GlobMatcher {
|
|
194
|
-
includePatterns = [];
|
|
195
|
-
excludePatterns = [];
|
|
196
|
-
options;
|
|
197
|
-
constructor(patterns, options = {}) {
|
|
198
|
-
this.options = options;
|
|
199
|
-
const patternArray = Array.isArray(patterns) ? patterns : [patterns];
|
|
200
|
-
for (const pattern of patternArray) {
|
|
201
|
-
const compiled = compileGlob(pattern, options);
|
|
202
|
-
if (compiled.negated) {
|
|
203
|
-
this.excludePatterns.push(compiled);
|
|
204
|
-
}
|
|
205
|
-
else {
|
|
206
|
-
this.includePatterns.push(compiled);
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Test if a path matches the patterns
|
|
212
|
-
*/
|
|
213
|
-
match(path) {
|
|
214
|
-
// Must match at least one include pattern
|
|
215
|
-
const included = this.includePatterns.length === 0 ||
|
|
216
|
-
this.includePatterns.some((p) => p.regex.test(path));
|
|
217
|
-
if (!included)
|
|
218
|
-
return false;
|
|
219
|
-
// Must not match any exclude pattern
|
|
220
|
-
return !this.excludePatterns.some((p) => p.regex.test(path));
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Filter paths that match the patterns
|
|
224
|
-
*/
|
|
225
|
-
filter(paths) {
|
|
226
|
-
return paths.filter((path) => this.match(path));
|
|
227
|
-
}
|
|
228
|
-
}
|
|
229
|
-
/**
|
|
230
|
-
* Normalize a path for glob matching
|
|
231
|
-
* - Removes trailing slashes
|
|
232
|
-
* - Normalizes multiple slashes
|
|
233
|
-
* - Handles relative paths with cwd
|
|
234
|
-
*/
|
|
235
|
-
export function normalizePath(path, cwd) {
|
|
236
|
-
// Normalize multiple slashes
|
|
237
|
-
let normalized = path.replace(/\/+/g, '/');
|
|
238
|
-
// Remove trailing slash unless root
|
|
239
|
-
if (normalized.length > 1 && normalized.endsWith('/')) {
|
|
240
|
-
normalized = normalized.slice(0, -1);
|
|
241
|
-
}
|
|
242
|
-
// Handle relative paths with cwd
|
|
243
|
-
if (cwd && !normalized.startsWith('/')) {
|
|
244
|
-
const normalizedCwd = cwd.endsWith('/') ? cwd.slice(0, -1) : cwd;
|
|
245
|
-
normalized = `${normalizedCwd}/${normalized}`;
|
|
246
|
-
}
|
|
247
|
-
return normalized;
|
|
248
|
-
}
|
|
249
|
-
/**
|
|
250
|
-
* Get the base directory from a glob pattern
|
|
251
|
-
* Returns the longest non-glob prefix path
|
|
252
|
-
*/
|
|
253
|
-
export function getGlobBase(pattern) {
|
|
254
|
-
const parts = pattern.split('/');
|
|
255
|
-
const baseParts = [];
|
|
256
|
-
for (const part of parts) {
|
|
257
|
-
if (part.includes('*') || part.includes('?') || part.includes('[') || part.includes('{')) {
|
|
258
|
-
break;
|
|
259
|
-
}
|
|
260
|
-
baseParts.push(part);
|
|
261
|
-
}
|
|
262
|
-
return baseParts.join('/') || '/';
|
|
263
|
-
}
|
|
264
|
-
/**
|
|
265
|
-
* Check if a pattern contains glob special characters
|
|
266
|
-
*/
|
|
267
|
-
export function isGlobPattern(pattern) {
|
|
268
|
-
return /[*?[\]{}!]/.test(pattern);
|
|
269
|
-
}
|
|
270
|
-
//# sourceMappingURL=glob.js.map
|
package/dist/agentfs/glob.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"glob.js","sourceRoot":"","sources":["../../src/agentfs/glob.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AA4BH;;GAEG;AACH,SAAS,WAAW,CAAC,GAAW;IAC9B,OAAO,GAAG,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAA;AACnD,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CACzB,OAAe,EACf,UAA+C,EAAE;IAEjD,MAAM,EAAE,MAAM,GAAG,KAAK,EAAE,GAAG,GAAG,KAAK,EAAE,GAAG,OAAO,CAAA;IAE/C,kBAAkB;IAClB,IAAI,OAAO,GAAG,KAAK,CAAA;IACnB,IAAI,cAAc,GAAG,OAAO,CAAA;IAC5B,IAAI,cAAc,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,OAAO,GAAG,IAAI,CAAA;QACd,cAAc,GAAG,cAAc,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IAC1C,CAAC;IAED,sBAAsB;IACtB,IAAI,QAAQ,GAAG,EAAE,CAAA;IACjB,IAAI,CAAC,GAAG,CAAC,CAAA;IACT,MAAM,GAAG,GAAG,cAAc,CAAC,MAAM,CAAA;IAEjC,2DAA2D;IAC3D,MAAM,QAAQ,GAAG,MAAM,CAAA;IACvB,0EAA0E;IAC1E,MAAM,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;IAEnC,O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CAAC,EAAE,CAAC,CAAC,CAAC,CAAA;IACtC,CAAC;IAED,iCAAiC;IACjC,IAAI,GAAG,IAAI,CAAC,UAAU,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,CAAC;QACvC,MAAM,aAAa,GAAG,GAAG,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAA;QAChE,UAAU,GAAG,GAAG,aAAa,IAAI,UAAU,EAAE,CAAA;IAC/C,CAAC;IAED,OAAO,UAAU,CAAA;AACnB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,WAAW,CAAC,OAAe;IACzC,MAAM,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;IAChC,MAAM,SAAS,GAAa,EAAE,CAAA;IAE9B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACzF,MAAK;QACP,CAAC;QACD,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IACtB,CAAC;IAED,OAAO,SAAS,CAAC,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAA;AACnC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,OAAO,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,CAAA;AACnC,CAAC"}
|
package/dist/agentfs/grep.d.ts
DELETED
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AgentFS Grep - Content Search Implementation
|
|
3
|
-
*
|
|
4
|
-
* Provides grep-like content search functionality for the AgentFS system.
|
|
5
|
-
* Searches through files in the virtual filesystem using regex patterns.
|
|
6
|
-
*/
|
|
7
|
-
import type { FileSystem, GrepOptions, GrepMatch } from './types';
|
|
8
|
-
/**
|
|
9
|
-
* Interface for glob pattern matching functionality
|
|
10
|
-
*/
|
|
11
|
-
export interface GlobMatcher {
|
|
12
|
-
glob(pattern: string): Promise<string[]>;
|
|
13
|
-
}
|
|
14
|
-
/**
|
|
15
|
-
* AgentGrep provides content search across the AgentFS filesystem.
|
|
16
|
-
* Supports regex patterns, case-insensitive search, context lines, and file filtering.
|
|
17
|
-
*/
|
|
18
|
-
export declare class AgentGrep {
|
|
19
|
-
private fs;
|
|
20
|
-
private globMatcher;
|
|
21
|
-
/**
|
|
22
|
-
* Creates a new AgentGrep instance.
|
|
23
|
-
* @param fs - FileSystem implementation for reading files
|
|
24
|
-
* @param globMatcher - Optional glob matcher (defaults to fs.glob)
|
|
25
|
-
*/
|
|
26
|
-
constructor(fs: FileSystem, globMatcher?: GlobMatcher);
|
|
27
|
-
/**
|
|
28
|
-
* Search for a pattern in files matching the specified criteria.
|
|
29
|
-
*
|
|
30
|
-
* @param pattern - Regular expression pattern to search for
|
|
31
|
-
* @param options - Search options including file filter, case sensitivity, etc.
|
|
32
|
-
* @returns Array of GrepMatch objects representing found matches
|
|
33
|
-
*
|
|
34
|
-
* @example
|
|
35
|
-
* ```typescript
|
|
36
|
-
* const grep = new AgentGrep(fs);
|
|
37
|
-
* const matches = await grep.grep('function\\s+\\w+', {
|
|
38
|
-
* glob: '**\/*.ts',
|
|
39
|
-
* caseInsensitive: false,
|
|
40
|
-
* maxResults: 100
|
|
41
|
-
* });
|
|
42
|
-
* ```
|
|
43
|
-
*/
|
|
44
|
-
grep(pattern: string, options?: Omit<GrepOptions, 'pattern'>): Promise<GrepMatch[]>;
|
|
45
|
-
/**
|
|
46
|
-
* Search and return only file paths containing matches.
|
|
47
|
-
*
|
|
48
|
-
* @param pattern - Regular expression pattern to search for
|
|
49
|
-
* @param options - Search options
|
|
50
|
-
* @returns Array of unique file paths containing matches
|
|
51
|
-
*/
|
|
52
|
-
grepFiles(pattern: string, options?: Omit<GrepOptions, 'pattern'>): Promise<string[]>;
|
|
53
|
-
/**
|
|
54
|
-
* Count matches per file.
|
|
55
|
-
*
|
|
56
|
-
* @param pattern - Regular expression pattern to search for
|
|
57
|
-
* @param options - Search options
|
|
58
|
-
* @returns Map of file path to match count
|
|
59
|
-
*/
|
|
60
|
-
grepCount(pattern: string, options?: Omit<GrepOptions, 'pattern'>): Promise<Map<string, number>>;
|
|
61
|
-
/**
|
|
62
|
-
* Search for multiple patterns and return matches for any of them.
|
|
63
|
-
*
|
|
64
|
-
* @param patterns - Array of regex patterns to search for
|
|
65
|
-
* @param options - Search options
|
|
66
|
-
* @returns Array of GrepMatch objects
|
|
67
|
-
*/
|
|
68
|
-
grepAny(patterns: string[], options?: Omit<GrepOptions, 'pattern'>): Promise<GrepMatch[]>;
|
|
69
|
-
/**
|
|
70
|
-
* Search with a callback for each match (useful for streaming results).
|
|
71
|
-
*
|
|
72
|
-
* @param pattern - Regular expression pattern to search for
|
|
73
|
-
* @param options - Search options
|
|
74
|
-
* @param callback - Function to call for each match
|
|
75
|
-
*/
|
|
76
|
-
grepStream(pattern: string, options: Omit<GrepOptions, 'pattern'> | undefined, callback: (match: GrepMatch) => void | Promise<void>): Promise<void>;
|
|
77
|
-
}
|
|
78
|
-
/**
|
|
79
|
-
* Create a grep instance from a FileSystem.
|
|
80
|
-
* Convenience factory function.
|
|
81
|
-
*/
|
|
82
|
-
export declare function createGrep(fs: FileSystem, globMatcher?: GlobMatcher): AgentGrep;
|
|
83
|
-
//# sourceMappingURL=grep.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"grep.d.ts","sourceRoot":"","sources":["../../src/agentfs/grep.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,SAAS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UAAU,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,SAAS,CAE/E"}
|
package/dist/agentfs/grep.js
DELETED
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AgentFS Grep - Content Search Implementation
|
|
3
|
-
*
|
|
4
|
-
* Provides grep-like content search functionality for the AgentFS system.
|
|
5
|
-
* Searches through files in the virtual filesystem using regex patterns.
|
|
6
|
-
*/
|
|
7
|
-
/**
|
|
8
|
-
* AgentGrep provides content search across the AgentFS filesystem.
|
|
9
|
-
* Supports regex patterns, case-insensitive search, context lines, and file filtering.
|
|
10
|
-
*/
|
|
11
|
-
export class AgentGrep {
|
|
12
|
-
fs;
|
|
13
|
-
globMatcher;
|
|
14
|
-
/**
|
|
15
|
-
* Creates a new AgentGrep instance.
|
|
16
|
-
* @param fs - FileSystem implementation for reading files
|
|
17
|
-
* @param globMatcher - Optional glob matcher (defaults to fs.glob)
|
|
18
|
-
*/
|
|
19
|
-
constructor(fs, globMatcher) {
|
|
20
|
-
this.fs = fs;
|
|
21
|
-
this.globMatcher = globMatcher ?? fs;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Search for a pattern in files matching the specified criteria.
|
|
25
|
-
*
|
|
26
|
-
* @param pattern - Regular expression pattern to search for
|
|
27
|
-
* @param options - Search options including file filter, case sensitivity, etc.
|
|
28
|
-
* @returns Array of GrepMatch objects representing found matches
|
|
29
|
-
*
|
|
30
|
-
* @example
|
|
31
|
-
* ```typescript
|
|
32
|
-
* const grep = new AgentGrep(fs);
|
|
33
|
-
* const matches = await grep.grep('function\\s+\\w+', {
|
|
34
|
-
* glob: '**\/*.ts',
|
|
35
|
-
* caseInsensitive: false,
|
|
36
|
-
* maxResults: 100
|
|
37
|
-
* });
|
|
38
|
-
* ```
|
|
39
|
-
*/
|
|
40
|
-
async grep(pattern, options) {
|
|
41
|
-
const flags = options?.caseInsensitive ? 'gi' : 'g';
|
|
42
|
-
const regex = new RegExp(pattern, flags);
|
|
43
|
-
const contextLines = options?.contextLines ?? 0;
|
|
44
|
-
const maxResults = options?.maxResults ?? Infinity;
|
|
45
|
-
// Get files to search using glob pattern or default to all files
|
|
46
|
-
const filePattern = options?.glob ?? '**/*';
|
|
47
|
-
const files = await this.globMatcher.glob(filePattern);
|
|
48
|
-
const results = [];
|
|
49
|
-
for (const file of files) {
|
|
50
|
-
if (results.length >= maxResults)
|
|
51
|
-
break;
|
|
52
|
-
try {
|
|
53
|
-
const content = await this.fs.readFile(file);
|
|
54
|
-
if (!content)
|
|
55
|
-
continue;
|
|
56
|
-
const lines = content.split('\n');
|
|
57
|
-
for (let i = 0; i < lines.length; i++) {
|
|
58
|
-
const line = lines[i];
|
|
59
|
-
if (line === undefined)
|
|
60
|
-
continue;
|
|
61
|
-
// Reset regex lastIndex for global flag
|
|
62
|
-
regex.lastIndex = 0;
|
|
63
|
-
const match = regex.exec(line);
|
|
64
|
-
if (match) {
|
|
65
|
-
const result = {
|
|
66
|
-
file,
|
|
67
|
-
line: i + 1, // 1-indexed
|
|
68
|
-
column: match.index + 1, // 1-indexed
|
|
69
|
-
content: line,
|
|
70
|
-
};
|
|
71
|
-
// Add context if requested
|
|
72
|
-
if (contextLines > 0) {
|
|
73
|
-
result.context = {
|
|
74
|
-
before: lines.slice(Math.max(0, i - contextLines), i),
|
|
75
|
-
after: lines.slice(i + 1, i + 1 + contextLines),
|
|
76
|
-
};
|
|
77
|
-
}
|
|
78
|
-
results.push(result);
|
|
79
|
-
if (results.length >= maxResults)
|
|
80
|
-
break;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
catch {
|
|
85
|
-
// Skip files that can't be read (e.g., directories, binary files)
|
|
86
|
-
continue;
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
return results;
|
|
90
|
-
}
|
|
91
|
-
/**
|
|
92
|
-
* Search and return only file paths containing matches.
|
|
93
|
-
*
|
|
94
|
-
* @param pattern - Regular expression pattern to search for
|
|
95
|
-
* @param options - Search options
|
|
96
|
-
* @returns Array of unique file paths containing matches
|
|
97
|
-
*/
|
|
98
|
-
async grepFiles(pattern, options) {
|
|
99
|
-
const matches = await this.grep(pattern, options);
|
|
100
|
-
const uniqueFiles = new Set(matches.map((m) => m.file));
|
|
101
|
-
return Array.from(uniqueFiles);
|
|
102
|
-
}
|
|
103
|
-
/**
|
|
104
|
-
* Count matches per file.
|
|
105
|
-
*
|
|
106
|
-
* @param pattern - Regular expression pattern to search for
|
|
107
|
-
* @param options - Search options
|
|
108
|
-
* @returns Map of file path to match count
|
|
109
|
-
*/
|
|
110
|
-
async grepCount(pattern, options) {
|
|
111
|
-
const { maxResults: _maxResults, ...optionsWithoutLimit } = options ?? {};
|
|
112
|
-
const matches = await this.grep(pattern, optionsWithoutLimit);
|
|
113
|
-
const counts = new Map();
|
|
114
|
-
for (const match of matches) {
|
|
115
|
-
counts.set(match.file, (counts.get(match.file) ?? 0) + 1);
|
|
116
|
-
}
|
|
117
|
-
return counts;
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Search for multiple patterns and return matches for any of them.
|
|
121
|
-
*
|
|
122
|
-
* @param patterns - Array of regex patterns to search for
|
|
123
|
-
* @param options - Search options
|
|
124
|
-
* @returns Array of GrepMatch objects
|
|
125
|
-
*/
|
|
126
|
-
async grepAny(patterns, options) {
|
|
127
|
-
// Combine patterns with OR
|
|
128
|
-
const combinedPattern = patterns.map((p) => `(${p})`).join('|');
|
|
129
|
-
return this.grep(combinedPattern, options);
|
|
130
|
-
}
|
|
131
|
-
/**
|
|
132
|
-
* Search with a callback for each match (useful for streaming results).
|
|
133
|
-
*
|
|
134
|
-
* @param pattern - Regular expression pattern to search for
|
|
135
|
-
* @param options - Search options
|
|
136
|
-
* @param callback - Function to call for each match
|
|
137
|
-
*/
|
|
138
|
-
async grepStream(pattern, options, callback) {
|
|
139
|
-
const flags = options?.caseInsensitive ? 'gi' : 'g';
|
|
140
|
-
const regex = new RegExp(pattern, flags);
|
|
141
|
-
const contextLines = options?.contextLines ?? 0;
|
|
142
|
-
const maxResults = options?.maxResults ?? Infinity;
|
|
143
|
-
const filePattern = options?.glob ?? '**/*';
|
|
144
|
-
const files = await this.globMatcher.glob(filePattern);
|
|
145
|
-
let count = 0;
|
|
146
|
-
for (const file of files) {
|
|
147
|
-
if (count >= maxResults)
|
|
148
|
-
break;
|
|
149
|
-
try {
|
|
150
|
-
const content = await this.fs.readFile(file);
|
|
151
|
-
if (!content)
|
|
152
|
-
continue;
|
|
153
|
-
const lines = content.split('\n');
|
|
154
|
-
for (let i = 0; i < lines.length; i++) {
|
|
155
|
-
const line = lines[i];
|
|
156
|
-
if (line === undefined)
|
|
157
|
-
continue;
|
|
158
|
-
regex.lastIndex = 0;
|
|
159
|
-
const match = regex.exec(line);
|
|
160
|
-
if (match) {
|
|
161
|
-
const result = {
|
|
162
|
-
file,
|
|
163
|
-
line: i + 1,
|
|
164
|
-
column: match.index + 1,
|
|
165
|
-
content: line,
|
|
166
|
-
};
|
|
167
|
-
if (contextLines > 0) {
|
|
168
|
-
result.context = {
|
|
169
|
-
before: lines.slice(Math.max(0, i - contextLines), i),
|
|
170
|
-
after: lines.slice(i + 1, i + 1 + contextLines),
|
|
171
|
-
};
|
|
172
|
-
}
|
|
173
|
-
await callback(result);
|
|
174
|
-
count++;
|
|
175
|
-
if (count >= maxResults)
|
|
176
|
-
break;
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
catch {
|
|
181
|
-
continue;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Create a grep instance from a FileSystem.
|
|
188
|
-
* Convenience factory function.
|
|
189
|
-
*/
|
|
190
|
-
export function createGrep(fs, globMatcher) {
|
|
191
|
-
return new AgentGrep(fs, globMatcher);
|
|
192
|
-
}
|
|
193
|
-
//# sourceMappingURL=grep.js.map
|