@planu/cli 0.68.0 → 0.70.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/config/discovery-queries.json +267 -0
- package/dist/config/license-plans.json +1 -0
- package/dist/engine/discovery/registry-search.d.ts +4 -0
- package/dist/engine/discovery/registry-search.d.ts.map +1 -0
- package/dist/engine/discovery/registry-search.js +82 -0
- package/dist/engine/discovery/registry-search.js.map +1 -0
- package/dist/engine/discovery/result-ranker.d.ts +8 -0
- package/dist/engine/discovery/result-ranker.d.ts.map +1 -0
- package/dist/engine/discovery/result-ranker.js +46 -0
- package/dist/engine/discovery/result-ranker.js.map +1 -0
- package/dist/engine/discovery/tech-discovery.d.ts +4 -0
- package/dist/engine/discovery/tech-discovery.d.ts.map +1 -0
- package/dist/engine/discovery/tech-discovery.js +83 -0
- package/dist/engine/discovery/tech-discovery.js.map +1 -0
- package/dist/engine/token-optimizer/analytics.d.ts +10 -0
- package/dist/engine/token-optimizer/analytics.d.ts.map +1 -0
- package/dist/engine/token-optimizer/analytics.js +362 -0
- package/dist/engine/token-optimizer/analytics.js.map +1 -0
- package/dist/engine/token-optimizer/index.d.ts +2 -0
- package/dist/engine/token-optimizer/index.d.ts.map +1 -1
- package/dist/engine/token-optimizer/index.js +1 -0
- package/dist/engine/token-optimizer/index.js.map +1 -1
- package/dist/engine/token-optimizer/reconciler.d.ts +22 -0
- package/dist/engine/token-optimizer/reconciler.d.ts.map +1 -0
- package/dist/engine/token-optimizer/reconciler.js +215 -0
- package/dist/engine/token-optimizer/reconciler.js.map +1 -0
- package/dist/storage/token-ledger-store.d.ts +26 -0
- package/dist/storage/token-ledger-store.d.ts.map +1 -0
- package/dist/storage/token-ledger-store.js +354 -0
- package/dist/storage/token-ledger-store.js.map +1 -0
- package/dist/tools/register-token-tools.d.ts.map +1 -1
- package/dist/tools/register-token-tools.js +21 -0
- package/dist/tools/register-token-tools.js.map +1 -1
- package/dist/tools/schemas/index.d.ts +1 -0
- package/dist/tools/schemas/index.d.ts.map +1 -1
- package/dist/tools/schemas/index.js +1 -0
- package/dist/tools/schemas/index.js.map +1 -1
- package/dist/tools/schemas/token-intelligence.d.ts +21 -0
- package/dist/tools/schemas/token-intelligence.d.ts.map +1 -0
- package/dist/tools/schemas/token-intelligence.js +18 -0
- package/dist/tools/schemas/token-intelligence.js.map +1 -0
- package/dist/tools/suggest-tooling/handler.d.ts.map +1 -1
- package/dist/tools/suggest-tooling/handler.js +39 -1
- package/dist/tools/suggest-tooling/handler.js.map +1 -1
- package/dist/tools/token-intelligence-handler.d.ts +8 -0
- package/dist/tools/token-intelligence-handler.d.ts.map +1 -0
- package/dist/tools/token-intelligence-handler.js +413 -0
- package/dist/tools/token-intelligence-handler.js.map +1 -0
- package/dist/types/discovery.d.ts +22 -0
- package/dist/types/discovery.d.ts.map +1 -0
- package/dist/types/discovery.js +3 -0
- package/dist/types/discovery.js.map +1 -0
- package/dist/types/index.d.ts +2 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/dist/types/token-ledger.d.ts +195 -0
- package/dist/types/token-ledger.d.ts.map +1 -0
- package/dist/types/token-ledger.js +3 -0
- package/dist/types/token-ledger.js.map +1 -0
- package/package.json +1 -1
- package/src/config/discovery-queries.json +267 -0
- package/src/config/license-plans.json +1 -0
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
{
|
|
2
|
+
"local-first": {
|
|
3
|
+
"npm": ["crdt", "offline-first", "local-first-database", "realtime-sync"],
|
|
4
|
+
"github_topics": ["crdt", "local-first", "offline-first", "sync-engine"],
|
|
5
|
+
"description": "Local-first data sync and offline capabilities"
|
|
6
|
+
},
|
|
7
|
+
"event-driven": {
|
|
8
|
+
"npm": ["event-sourcing", "cqrs", "message-queue", "event-bus"],
|
|
9
|
+
"github_topics": ["event-sourcing", "message-broker", "event-driven"],
|
|
10
|
+
"description": "Event-driven architecture patterns"
|
|
11
|
+
},
|
|
12
|
+
"realtime": {
|
|
13
|
+
"npm": ["realtime-database", "multiplayer", "collaborative-editing", "websocket-server"],
|
|
14
|
+
"github_topics": ["realtime", "multiplayer", "collaborative", "websocket"],
|
|
15
|
+
"description": "Real-time sync and multiplayer capabilities"
|
|
16
|
+
},
|
|
17
|
+
"ai-native": {
|
|
18
|
+
"npm": ["llm-orchestration", "rag-framework", "vector-database", "ai-agent"],
|
|
19
|
+
"github_topics": ["llm", "rag", "ai-agent", "vector-database"],
|
|
20
|
+
"description": "AI/LLM native application patterns"
|
|
21
|
+
},
|
|
22
|
+
"serverless": {
|
|
23
|
+
"npm": ["serverless-framework", "edge-function", "serverless-database"],
|
|
24
|
+
"github_topics": ["serverless", "edge-computing", "faas"],
|
|
25
|
+
"description": "Serverless and edge computing"
|
|
26
|
+
},
|
|
27
|
+
"microservices": {
|
|
28
|
+
"npm": ["service-mesh", "api-gateway", "service-discovery", "distributed-tracing"],
|
|
29
|
+
"github_topics": ["microservices", "service-mesh", "api-gateway"],
|
|
30
|
+
"description": "Microservices architecture"
|
|
31
|
+
},
|
|
32
|
+
"testing-advanced": {
|
|
33
|
+
"npm": ["property-based-testing", "mutation-testing", "chaos-engineering", "contract-testing"],
|
|
34
|
+
"github_topics": ["property-testing", "mutation-testing", "chaos-engineering"],
|
|
35
|
+
"description": "Advanced testing patterns"
|
|
36
|
+
},
|
|
37
|
+
"observability": {
|
|
38
|
+
"npm": ["opentelemetry", "distributed-tracing", "log-aggregation", "metrics-collection"],
|
|
39
|
+
"github_topics": ["observability", "tracing", "monitoring"],
|
|
40
|
+
"description": "Observability and monitoring stack"
|
|
41
|
+
},
|
|
42
|
+
"mobile-cross-platform": {
|
|
43
|
+
"npm": ["react-native", "flutter", "capacitor", "expo"],
|
|
44
|
+
"github_topics": ["react-native", "flutter", "cross-platform-mobile"],
|
|
45
|
+
"description": "Cross-platform mobile development"
|
|
46
|
+
},
|
|
47
|
+
"security": {
|
|
48
|
+
"npm": ["oauth2-server", "jwt-authentication", "rbac", "rate-limiter"],
|
|
49
|
+
"github_topics": ["authentication", "authorization", "security"],
|
|
50
|
+
"description": "Security and authentication patterns"
|
|
51
|
+
},
|
|
52
|
+
"ci-cd": {
|
|
53
|
+
"npm": ["github-actions", "ci-cd", "deployment-automation"],
|
|
54
|
+
"github_topics": ["ci-cd", "devops", "deployment"],
|
|
55
|
+
"description": "CI/CD and deployment automation"
|
|
56
|
+
},
|
|
57
|
+
"database-modern": {
|
|
58
|
+
"npm": ["edge-database", "serverless-database", "vector-store", "graph-database"],
|
|
59
|
+
"github_topics": ["database", "serverless-database", "vector-database"],
|
|
60
|
+
"description": "Modern database solutions"
|
|
61
|
+
},
|
|
62
|
+
"actor-model": {
|
|
63
|
+
"npm": ["actor-framework", "akka", "nact", "comedy"],
|
|
64
|
+
"github_topics": ["actor-model", "actor-framework", "concurrent-programming"],
|
|
65
|
+
"description": "Actor model concurrency patterns"
|
|
66
|
+
},
|
|
67
|
+
"temporal": {
|
|
68
|
+
"npm": ["temporalio", "workflow-orchestration", "durable-execution"],
|
|
69
|
+
"github_topics": ["temporal", "workflow-engine", "durable-workflow"],
|
|
70
|
+
"description": "Temporal workflow orchestration"
|
|
71
|
+
},
|
|
72
|
+
"cell-based": {
|
|
73
|
+
"npm": ["cell-architecture", "blast-radius", "fault-isolation"],
|
|
74
|
+
"github_topics": ["cell-based-architecture", "availability-zones", "fault-isolation"],
|
|
75
|
+
"description": "Cell-based architecture for fault isolation"
|
|
76
|
+
},
|
|
77
|
+
"data-mesh": {
|
|
78
|
+
"npm": ["data-mesh", "data-product", "data-catalog", "data-contract"],
|
|
79
|
+
"github_topics": ["data-mesh", "data-product", "data-governance"],
|
|
80
|
+
"description": "Data mesh and data product patterns"
|
|
81
|
+
},
|
|
82
|
+
"bff": {
|
|
83
|
+
"npm": ["backend-for-frontend", "api-composition", "graphql-gateway"],
|
|
84
|
+
"github_topics": ["bff", "backend-for-frontend", "api-gateway"],
|
|
85
|
+
"description": "Backend for Frontend pattern"
|
|
86
|
+
},
|
|
87
|
+
"modular-monolith": {
|
|
88
|
+
"npm": ["module-boundaries", "nx-module", "vertical-slice"],
|
|
89
|
+
"github_topics": ["modular-monolith", "vertical-slice-architecture", "clean-architecture"],
|
|
90
|
+
"description": "Modular monolith architecture"
|
|
91
|
+
},
|
|
92
|
+
"composable": {
|
|
93
|
+
"npm": ["composable-architecture", "headless-commerce", "mach-architecture"],
|
|
94
|
+
"github_topics": ["composable-architecture", "headless-cms", "mach"],
|
|
95
|
+
"description": "Composable and MACH architecture"
|
|
96
|
+
},
|
|
97
|
+
"ddd": {
|
|
98
|
+
"npm": ["domain-driven-design", "aggregate-root", "bounded-context", "domain-events"],
|
|
99
|
+
"github_topics": ["ddd", "domain-driven-design", "bounded-context"],
|
|
100
|
+
"description": "Domain-Driven Design patterns"
|
|
101
|
+
},
|
|
102
|
+
"wasm": {
|
|
103
|
+
"npm": ["webassembly", "wasm-pack", "assemblyscript", "emscripten"],
|
|
104
|
+
"github_topics": ["webassembly", "wasm", "assemblyscript"],
|
|
105
|
+
"description": "WebAssembly toolchain and targets"
|
|
106
|
+
},
|
|
107
|
+
"gitops": {
|
|
108
|
+
"npm": ["flux", "argocd", "gitops-operator"],
|
|
109
|
+
"github_topics": ["gitops", "flux", "argocd"],
|
|
110
|
+
"description": "GitOps deployment patterns"
|
|
111
|
+
},
|
|
112
|
+
"micro-frontend": {
|
|
113
|
+
"npm": ["module-federation", "single-spa", "micro-frontend", "webpack-federation"],
|
|
114
|
+
"github_topics": ["micro-frontends", "module-federation", "single-spa"],
|
|
115
|
+
"description": "Micro-frontend architecture"
|
|
116
|
+
},
|
|
117
|
+
"vector-db": {
|
|
118
|
+
"npm": ["pinecone", "weaviate", "qdrant", "chroma", "pgvector"],
|
|
119
|
+
"github_topics": ["vector-database", "embedding-search", "semantic-search"],
|
|
120
|
+
"description": "Vector database and embedding storage"
|
|
121
|
+
},
|
|
122
|
+
"graph-db": {
|
|
123
|
+
"npm": ["neo4j", "tigergraph", "dgraph", "arangodb"],
|
|
124
|
+
"github_topics": ["graph-database", "knowledge-graph", "neo4j"],
|
|
125
|
+
"description": "Graph database patterns"
|
|
126
|
+
},
|
|
127
|
+
"timeseries-db": {
|
|
128
|
+
"npm": ["influxdb", "timescaledb", "questdb", "prometheus"],
|
|
129
|
+
"github_topics": ["time-series-database", "timescaledb", "influxdb"],
|
|
130
|
+
"description": "Time-series data storage and analytics"
|
|
131
|
+
},
|
|
132
|
+
"cache-db": {
|
|
133
|
+
"npm": ["redis", "memcached", "keyv", "cache-manager"],
|
|
134
|
+
"github_topics": ["caching", "redis", "distributed-cache"],
|
|
135
|
+
"description": "Caching and in-memory data stores"
|
|
136
|
+
},
|
|
137
|
+
"newsql": {
|
|
138
|
+
"npm": ["cockroachdb", "yugabyte", "vitess", "tidb"],
|
|
139
|
+
"github_topics": ["newsql", "distributed-sql", "cockroachdb"],
|
|
140
|
+
"description": "NewSQL distributed relational databases"
|
|
141
|
+
},
|
|
142
|
+
"wide-column-db": {
|
|
143
|
+
"npm": ["cassandra", "scylladb", "bigtable", "hbase"],
|
|
144
|
+
"github_topics": ["wide-column-store", "cassandra", "distributed-database"],
|
|
145
|
+
"description": "Wide-column NoSQL databases"
|
|
146
|
+
},
|
|
147
|
+
"monitoring": {
|
|
148
|
+
"npm": ["prometheus", "grafana", "datadog", "newrelic"],
|
|
149
|
+
"github_topics": ["monitoring", "alerting", "metrics"],
|
|
150
|
+
"description": "Application monitoring and alerting"
|
|
151
|
+
},
|
|
152
|
+
"supply-chain": {
|
|
153
|
+
"npm": ["sbom", "dependency-check", "syft", "grype"],
|
|
154
|
+
"github_topics": ["supply-chain-security", "sbom", "dependency-scanning"],
|
|
155
|
+
"description": "Software supply chain security"
|
|
156
|
+
},
|
|
157
|
+
"finops": {
|
|
158
|
+
"npm": ["cloud-cost", "infracost", "opencost"],
|
|
159
|
+
"github_topics": ["finops", "cloud-cost-optimization", "infracost"],
|
|
160
|
+
"description": "Cloud cost optimization and FinOps"
|
|
161
|
+
},
|
|
162
|
+
"hypermedia": {
|
|
163
|
+
"npm": ["htmx", "hyperscript", "hypermedia-api", "hateoas"],
|
|
164
|
+
"github_topics": ["htmx", "hypermedia", "hateoas"],
|
|
165
|
+
"description": "Hypermedia-driven API patterns"
|
|
166
|
+
},
|
|
167
|
+
"search-engine": {
|
|
168
|
+
"npm": ["elasticsearch", "meilisearch", "typesense", "algolia"],
|
|
169
|
+
"github_topics": ["search-engine", "full-text-search", "meilisearch"],
|
|
170
|
+
"description": "Full-text and vector search engines"
|
|
171
|
+
},
|
|
172
|
+
"idp": {
|
|
173
|
+
"npm": ["backstage", "port", "cortex", "internal-developer-portal"],
|
|
174
|
+
"github_topics": ["internal-developer-portal", "backstage", "platform-engineering"],
|
|
175
|
+
"description": "Internal Developer Platform patterns"
|
|
176
|
+
},
|
|
177
|
+
"nomad": {
|
|
178
|
+
"npm": ["nomad", "hashicorp-nomad"],
|
|
179
|
+
"github_topics": ["nomad", "hashicorp-nomad", "workload-orchestration"],
|
|
180
|
+
"description": "HashiCorp Nomad workload orchestration"
|
|
181
|
+
},
|
|
182
|
+
"k3s": {
|
|
183
|
+
"npm": ["k3s", "lightweight-kubernetes"],
|
|
184
|
+
"github_topics": ["k3s", "lightweight-kubernetes", "edge-kubernetes"],
|
|
185
|
+
"description": "Lightweight Kubernetes distributions"
|
|
186
|
+
},
|
|
187
|
+
"agent-framework": {
|
|
188
|
+
"npm": ["langchain-agent", "autogen", "crewai", "langgraph"],
|
|
189
|
+
"github_topics": ["ai-agents", "multi-agent", "autogen"],
|
|
190
|
+
"description": "AI agent frameworks and orchestration"
|
|
191
|
+
},
|
|
192
|
+
"platform-specialty": {
|
|
193
|
+
"npm": ["cloudflare-workers", "aws-lambda", "vercel-edge", "deno-deploy"],
|
|
194
|
+
"github_topics": ["edge-runtime", "cloudflare-workers", "serverless-functions"],
|
|
195
|
+
"description": "Specialty platform and edge runtimes"
|
|
196
|
+
},
|
|
197
|
+
"frontend-perf": {
|
|
198
|
+
"npm": ["web-vitals", "lighthouse", "bundle-analyzer", "lazy-loading"],
|
|
199
|
+
"github_topics": ["core-web-vitals", "performance-optimization", "web-performance"],
|
|
200
|
+
"description": "Frontend performance optimization"
|
|
201
|
+
},
|
|
202
|
+
"template-engine": {
|
|
203
|
+
"npm": ["handlebars", "nunjucks", "pug", "ejs"],
|
|
204
|
+
"github_topics": ["template-engine", "server-side-rendering", "templating"],
|
|
205
|
+
"description": "Server-side template engines"
|
|
206
|
+
},
|
|
207
|
+
"resilience": {
|
|
208
|
+
"npm": ["circuit-breaker", "retry-logic", "bulkhead", "timeout-handler"],
|
|
209
|
+
"github_topics": ["resilience", "circuit-breaker", "fault-tolerance"],
|
|
210
|
+
"description": "Resilience and fault tolerance patterns"
|
|
211
|
+
},
|
|
212
|
+
"mcp-candidate": {
|
|
213
|
+
"npm": ["mcp-server", "model-context-protocol", "claude-mcp"],
|
|
214
|
+
"github_topics": ["model-context-protocol", "mcp-server", "claude-tools"],
|
|
215
|
+
"description": "Model Context Protocol server candidates"
|
|
216
|
+
},
|
|
217
|
+
"multi-tenancy": {
|
|
218
|
+
"npm": ["multi-tenant", "tenant-isolation", "saas-framework"],
|
|
219
|
+
"github_topics": ["multi-tenancy", "saas", "tenant-isolation"],
|
|
220
|
+
"description": "Multi-tenancy SaaS patterns"
|
|
221
|
+
},
|
|
222
|
+
"analytics": {
|
|
223
|
+
"npm": ["segment", "mixpanel", "posthog", "amplitude"],
|
|
224
|
+
"github_topics": ["product-analytics", "event-tracking", "analytics"],
|
|
225
|
+
"description": "Product analytics and event tracking"
|
|
226
|
+
},
|
|
227
|
+
"desktop": {
|
|
228
|
+
"npm": ["electron", "tauri", "neutralino", "nw.js"],
|
|
229
|
+
"github_topics": ["desktop-app", "electron", "tauri"],
|
|
230
|
+
"description": "Desktop application frameworks"
|
|
231
|
+
},
|
|
232
|
+
"pii": {
|
|
233
|
+
"npm": ["pii-detection", "data-masking", "gdpr-compliance"],
|
|
234
|
+
"github_topics": ["pii-detection", "data-privacy", "gdpr"],
|
|
235
|
+
"description": "PII detection and data privacy"
|
|
236
|
+
},
|
|
237
|
+
"eu-ai-act": {
|
|
238
|
+
"npm": ["ai-compliance", "model-card", "fairness-indicators"],
|
|
239
|
+
"github_topics": ["eu-ai-act", "ai-compliance", "responsible-ai"],
|
|
240
|
+
"description": "EU AI Act compliance tooling"
|
|
241
|
+
},
|
|
242
|
+
"otel-ecosystem": {
|
|
243
|
+
"npm": ["opentelemetry-sdk", "otel-exporter", "otel-collector"],
|
|
244
|
+
"github_topics": ["opentelemetry", "otel", "observability"],
|
|
245
|
+
"description": "OpenTelemetry ecosystem integrations"
|
|
246
|
+
},
|
|
247
|
+
"llm-provider": {
|
|
248
|
+
"npm": ["openai", "anthropic", "azure-openai", "google-ai"],
|
|
249
|
+
"github_topics": ["llm", "language-model", "generative-ai"],
|
|
250
|
+
"description": "LLM provider SDKs and integrations"
|
|
251
|
+
},
|
|
252
|
+
"cicd": {
|
|
253
|
+
"npm": ["jest-ci", "semantic-release", "release-it", "changesets"],
|
|
254
|
+
"github_topics": ["continuous-integration", "continuous-deployment", "release-automation"],
|
|
255
|
+
"description": "CI/CD pipeline tooling and release automation"
|
|
256
|
+
},
|
|
257
|
+
"cloud-db": {
|
|
258
|
+
"npm": ["supabase", "firebase", "planetscale", "neon"],
|
|
259
|
+
"github_topics": ["cloud-database", "serverless-postgres", "firebase"],
|
|
260
|
+
"description": "Managed cloud database services"
|
|
261
|
+
},
|
|
262
|
+
"monorepo": {
|
|
263
|
+
"npm": ["nx", "turborepo", "lerna", "pnpm-workspace"],
|
|
264
|
+
"github_topics": ["monorepo", "nx", "turborepo"],
|
|
265
|
+
"description": "Monorepo tooling and management"
|
|
266
|
+
}
|
|
267
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { DiscoveredTool } from './result-ranker.js';
|
|
2
|
+
export declare function searchNpmRegistry(keywords: string[]): Promise<DiscoveredTool[]>;
|
|
3
|
+
export declare function searchGitHubTopics(topics: string[]): Promise<DiscoveredTool[]>;
|
|
4
|
+
//# sourceMappingURL=registry-search.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-search.d.ts","sourceRoot":"","sources":["../../../src/engine/discovery/registry-search.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAqCzD,wBAAsB,iBAAiB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAuCrF;AAED,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,cAAc,EAAE,CAAC,CAoCpF"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
const NPM_SEARCH_URL = 'https://registry.npmjs.org/-/v1/search';
|
|
2
|
+
const NPM_DOWNLOADS_URL = 'https://api.npmjs.org/downloads/point/last-week';
|
|
3
|
+
const GITHUB_SEARCH_URL = 'https://api.github.com/search/repositories';
|
|
4
|
+
const TIMEOUT_MS = 5000;
|
|
5
|
+
function withTimeout(promise, ms) {
|
|
6
|
+
return Promise.race([
|
|
7
|
+
promise,
|
|
8
|
+
new Promise((_, reject) => setTimeout(() => {
|
|
9
|
+
reject(new Error('timeout'));
|
|
10
|
+
}, ms)),
|
|
11
|
+
]);
|
|
12
|
+
}
|
|
13
|
+
async function fetchJson(url) {
|
|
14
|
+
const response = await withTimeout(fetch(url), TIMEOUT_MS);
|
|
15
|
+
if (!response.ok) {
|
|
16
|
+
throw new Error(`HTTP ${response.status}`);
|
|
17
|
+
}
|
|
18
|
+
return response.json();
|
|
19
|
+
}
|
|
20
|
+
async function getWeeklyDownloads(name) {
|
|
21
|
+
try {
|
|
22
|
+
const data = (await fetchJson(`${NPM_DOWNLOADS_URL}/${encodeURIComponent(name)}`));
|
|
23
|
+
return data.downloads;
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return undefined;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
export async function searchNpmRegistry(keywords) {
|
|
30
|
+
const targets = keywords.slice(0, 3);
|
|
31
|
+
const results = [];
|
|
32
|
+
for (const keyword of targets) {
|
|
33
|
+
try {
|
|
34
|
+
const url = `${NPM_SEARCH_URL}?text=keywords:${encodeURIComponent(keyword)}&size=5`;
|
|
35
|
+
const data = (await fetchJson(url));
|
|
36
|
+
const packages = data.objects ?? [];
|
|
37
|
+
for (const obj of packages) {
|
|
38
|
+
const pkg = obj.package;
|
|
39
|
+
const downloads = await getWeeklyDownloads(pkg.name);
|
|
40
|
+
results.push({
|
|
41
|
+
name: pkg.name,
|
|
42
|
+
description: pkg.description ?? '',
|
|
43
|
+
url: pkg.links?.npm ?? `https://www.npmjs.com/package/${pkg.name}`,
|
|
44
|
+
source: 'npm',
|
|
45
|
+
publishedAt: pkg.date,
|
|
46
|
+
weeklyDownloads: downloads,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
catch {
|
|
51
|
+
// best-effort: skip failed keyword
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
return results;
|
|
55
|
+
}
|
|
56
|
+
export async function searchGitHubTopics(topics) {
|
|
57
|
+
const targets = topics.slice(0, 2);
|
|
58
|
+
const results = [];
|
|
59
|
+
for (const topic of targets) {
|
|
60
|
+
try {
|
|
61
|
+
const query = `topic:${encodeURIComponent(topic)}+stars:>500`;
|
|
62
|
+
const url = `${GITHUB_SEARCH_URL}?q=${query}&sort=stars&per_page=5`;
|
|
63
|
+
const data = (await fetchJson(url));
|
|
64
|
+
const items = data.items ?? [];
|
|
65
|
+
for (const item of items) {
|
|
66
|
+
results.push({
|
|
67
|
+
name: item.full_name,
|
|
68
|
+
description: item.description ?? '',
|
|
69
|
+
url: item.html_url,
|
|
70
|
+
source: 'github',
|
|
71
|
+
stars: item.stargazers_count,
|
|
72
|
+
pushedAt: item.pushed_at,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
// best-effort: skip failed topic
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
return results;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=registry-search.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry-search.js","sourceRoot":"","sources":["../../../src/engine/discovery/registry-search.ts"],"names":[],"mappings":"AAEA,MAAM,cAAc,GAAG,wCAAwC,CAAC;AAChE,MAAM,iBAAiB,GAAG,iDAAiD,CAAC;AAC5E,MAAM,iBAAiB,GAAG,4CAA4C,CAAC;AACvE,MAAM,UAAU,GAAG,IAAI,CAAC;AAExB,SAAS,WAAW,CAAI,OAAmB,EAAE,EAAU;IACrD,OAAO,OAAO,CAAC,IAAI,CAAC;QAClB,OAAO;QACP,IAAI,OAAO,CAAI,CAAC,CAAC,EAAE,MAAM,EAAE,EAAE,CAC3B,UAAU,CAAC,GAAG,EAAE;YACd,MAAM,CAAC,IAAI,KAAK,CAAC,SAAS,CAAC,CAAC,CAAC;QAC/B,CAAC,EAAE,EAAE,CAAC,CACP;KACF,CAAC,CAAC;AACL,CAAC;AAED,KAAK,UAAU,SAAS,CAAC,GAAW;IAClC,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,UAAU,CAAC,CAAC;IAC3D,IAAI,CAAC,QAAQ,CAAC,EAAE,EAAE,CAAC;QACjB,MAAM,IAAI,KAAK,CAAC,QAAQ,QAAQ,CAAC,MAAM,EAAE,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,QAAQ,CAAC,IAAI,EAAE,CAAC;AACzB,CAAC;AAED,KAAK,UAAU,kBAAkB,CAAC,IAAY;IAC5C,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,CAAC,MAAM,SAAS,CAAC,GAAG,iBAAiB,IAAI,kBAAkB,CAAC,IAAI,CAAC,EAAE,CAAC,CAEhF,CAAC;QACF,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M,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;IACnC,MAAM,OAAO,GAAqB,EAAE,CAAC;IAErC,KAAK,MAAM,KAAK,IAAI,OAAO,EAAE,CAAC;QAC5B,IAAI,CAAC;YACH,MAAM,KAAK,GAAG,SAAS,kBAAkB,CAAC,KAAK,CAAC,aAAa,CAAC;YAC9D,MAAM,GAAG,GAAG,GAAG,iBAAiB,MAAM,KAAK,wBAAwB,CAAC;YACpE,MAAM,IAAI,GAAG,CAAC,MAAM,SAAS,CAAC,GAAG,CAAC,CAQjC,CAAC;YAEF,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YAE/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,OAAO,CAAC,IAAI,CAAC;oBACX,IAAI,EAAE,IAAI,CAAC,SAAS;oBACpB,WAAW,EAAE,IAAI,CAAC,WAAW,IAAI,EAAE;oBACnC,GAAG,EAAE,IAAI,CAAC,QAAQ;oBAClB,MAAM,EAAE,QAAQ;oBAChB,KAAK,EAAE,IAAI,CAAC,gBAAgB;oBAC5B,QAAQ,EAAE,IAAI,CAAC,SAAS;iBACzB,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAAC,MAAM,CAAC;YACP,iCAAiC;QACnC,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { DiscoveredTool } from '../../types/index.js';
|
|
2
|
+
export type { DiscoveredTool };
|
|
3
|
+
/**
|
|
4
|
+
* Ranks npm and GitHub discovery results by popularity and stack relevance.
|
|
5
|
+
* Deduplicates by name (case-insensitive), returns top 10 sorted descending by score.
|
|
6
|
+
*/
|
|
7
|
+
export declare function rankResults(npmResults: DiscoveredTool[], githubResults: DiscoveredTool[], stackLanguage: string): DiscoveredTool[];
|
|
8
|
+
//# sourceMappingURL=result-ranker.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-ranker.d.ts","sourceRoot":"","sources":["../../../src/engine/discovery/result-ranker.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAE3D,YAAY,EAAE,cAAc,EAAE,CAAC;AAiC/B;;;GAGG;AACH,wBAAgB,WAAW,CACzB,UAAU,EAAE,cAAc,EAAE,EAC5B,aAAa,EAAE,cAAc,EAAE,EAC/B,aAAa,EAAE,MAAM,GACpB,cAAc,EAAE,CAclB"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
// engine/discovery/result-ranker.ts — SPEC-181
|
|
2
|
+
// Ranks and deduplicates npm + GitHub discovery results by popularity and stack relevance.
|
|
3
|
+
const MAX_RESULTS = 10;
|
|
4
|
+
const MAX_SCORE = 50;
|
|
5
|
+
function scoreNpm(tool) {
|
|
6
|
+
if (!tool.weeklyDownloads || tool.weeklyDownloads <= 0) {
|
|
7
|
+
return 0;
|
|
8
|
+
}
|
|
9
|
+
return Math.min(Math.log10(tool.weeklyDownloads) * 10, MAX_SCORE);
|
|
10
|
+
}
|
|
11
|
+
function scoreGithub(tool) {
|
|
12
|
+
if (!tool.stars || tool.stars <= 0) {
|
|
13
|
+
return 0;
|
|
14
|
+
}
|
|
15
|
+
return Math.min(Math.log10(tool.stars) * 15, MAX_SCORE);
|
|
16
|
+
}
|
|
17
|
+
function stackBonus(tool, stackLanguage) {
|
|
18
|
+
if (!stackLanguage) {
|
|
19
|
+
return 0;
|
|
20
|
+
}
|
|
21
|
+
const lang = stackLanguage.toLowerCase();
|
|
22
|
+
const text = `${tool.name} ${tool.description}`.toLowerCase();
|
|
23
|
+
return text.includes(lang) ? 10 : 0;
|
|
24
|
+
}
|
|
25
|
+
function computeScore(tool, stackLanguage) {
|
|
26
|
+
const base = tool.source === 'npm' ? scoreNpm(tool) : scoreGithub(tool);
|
|
27
|
+
return base + stackBonus(tool, stackLanguage);
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Ranks npm and GitHub discovery results by popularity and stack relevance.
|
|
31
|
+
* Deduplicates by name (case-insensitive), returns top 10 sorted descending by score.
|
|
32
|
+
*/
|
|
33
|
+
export function rankResults(npmResults, githubResults, stackLanguage) {
|
|
34
|
+
const seen = new Map();
|
|
35
|
+
for (const tool of [...npmResults, ...githubResults]) {
|
|
36
|
+
const key = tool.name.toLowerCase();
|
|
37
|
+
const computedScore = computeScore(tool, stackLanguage);
|
|
38
|
+
const scored = { ...tool, score: computedScore };
|
|
39
|
+
const existing = seen.get(key);
|
|
40
|
+
if (!existing || computedScore > (existing.score ?? 0)) {
|
|
41
|
+
seen.set(key, scored);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return [...seen.values()].sort((a, b) => (b.score ?? 0) - (a.score ?? 0)).slice(0, MAX_RESULTS);
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=result-ranker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"result-ranker.js","sourceRoot":"","sources":["../../../src/engine/discovery/result-ranker.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,2FAA2F;AAM3F,MAAM,WAAW,GAAG,EAAE,CAAC;AACvB,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB,SAAS,QAAQ,CAAC,IAAoB;IACpC,IAAI,CAAC,IAAI,CAAC,eAAe,IAAI,IAAI,CAAC,eAAe,IAAI,CAAC,EAAE,CAAC;QACvD,OAAO,CAAC,CAAC;IACX,CAAC;IACD,OAAO,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,EAAE,EAAE,SAAS,CAAC,CAAC;AACpE,CAAC;AAED,SAAS,WAAW,CAAC,IAAoB;IACvC,IAAI,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,KAAK,IAAI,CAAC,EAAE,CAAC;QACnC,OAAO,CAAC,CAAC;IACX,CAAC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,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QAC/B,IAAI,CAAC,QAAQ,IAAI,aAAa,GAAG,CAAC,QAAQ,CAAC,KAAK,IAAI,CAAC,CAAC,EAAE,CAAC;YACvD,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC;AAClG,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tech-discovery.d.ts","sourceRoot":"","sources":["../../../src/engine/discovery/tech-discovery.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACV,cAAc,EAIf,MAAM,0BAA0B,CAAC;AAElC,YAAY,EAAE,cAAc,EAAE,CAAC;AAwD/B,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAAE,EAClB,cAAc,EAAE,MAAM,EACtB,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,cAAc,EAAE,CAAC,CAwC3B"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
// tech-discovery.ts — Main orchestrator for tool discovery across npm and GitHub registries
|
|
2
|
+
import { readFileSync } from 'node:fs';
|
|
3
|
+
import { readFile, writeFile, mkdir } from 'node:fs/promises';
|
|
4
|
+
import { join, dirname } from 'node:path';
|
|
5
|
+
import { fileURLToPath } from 'node:url';
|
|
6
|
+
import { searchNpmRegistry, searchGitHubTopics } from './registry-search.js';
|
|
7
|
+
import { rankResults } from './result-ranker.js';
|
|
8
|
+
// --- config (loaded once at module init) ---
|
|
9
|
+
const CONFIG_PATH = join(dirname(fileURLToPath(import.meta.url)), '../../config/discovery-queries.json');
|
|
10
|
+
let queryMapping = null;
|
|
11
|
+
function loadDiscoveryQueryMapping() {
|
|
12
|
+
if (queryMapping !== null) {
|
|
13
|
+
return queryMapping;
|
|
14
|
+
}
|
|
15
|
+
try {
|
|
16
|
+
queryMapping = JSON.parse(readFileSync(CONFIG_PATH, 'utf-8'));
|
|
17
|
+
}
|
|
18
|
+
catch {
|
|
19
|
+
queryMapping = {};
|
|
20
|
+
}
|
|
21
|
+
return queryMapping;
|
|
22
|
+
}
|
|
23
|
+
// --- cache helpers ---
|
|
24
|
+
const CACHE_TTL_MS = 7 * 24 * 60 * 60 * 1000; // 7 days
|
|
25
|
+
function cacheFile(dataDir) {
|
|
26
|
+
return join(dataDir, 'discovery-cache.json');
|
|
27
|
+
}
|
|
28
|
+
async function readCache(dataDir) {
|
|
29
|
+
try {
|
|
30
|
+
const raw = await readFile(cacheFile(dataDir), 'utf-8');
|
|
31
|
+
return JSON.parse(raw);
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
return {};
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async function writeCache(dataDir, cache) {
|
|
38
|
+
try {
|
|
39
|
+
const path = cacheFile(dataDir);
|
|
40
|
+
await mkdir(dirname(path), { recursive: true });
|
|
41
|
+
await writeFile(path, JSON.stringify(cache, null, 2), 'utf-8');
|
|
42
|
+
}
|
|
43
|
+
catch {
|
|
44
|
+
// best-effort — never fail the caller
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
function isFresh(entry) {
|
|
48
|
+
return Date.now() - new Date(entry.cachedAt).getTime() < CACHE_TTL_MS;
|
|
49
|
+
}
|
|
50
|
+
// --- main export ---
|
|
51
|
+
export async function discoverTools(patterns, _stackLanguage, dataDir) {
|
|
52
|
+
const mapping = loadDiscoveryQueryMapping();
|
|
53
|
+
const cache = await readCache(dataDir);
|
|
54
|
+
const cacheUpdated = { ...cache };
|
|
55
|
+
const allResults = await Promise.all(patterns.map(async (pattern) => {
|
|
56
|
+
const cached = cache[pattern];
|
|
57
|
+
if (cached && isFresh(cached)) {
|
|
58
|
+
return cached.results;
|
|
59
|
+
}
|
|
60
|
+
const config = mapping[pattern];
|
|
61
|
+
const keywords = config?.npm_keywords ?? [pattern];
|
|
62
|
+
const topics = config?.github_topics ?? [pattern];
|
|
63
|
+
const [npmResults, ghResults] = await Promise.all([
|
|
64
|
+
searchNpmRegistry(keywords),
|
|
65
|
+
searchGitHubTopics(topics),
|
|
66
|
+
]);
|
|
67
|
+
const ranked = rankResults(npmResults, ghResults, _stackLanguage);
|
|
68
|
+
cacheUpdated[pattern] = { results: ranked, cachedAt: new Date().toISOString() };
|
|
69
|
+
return ranked;
|
|
70
|
+
}));
|
|
71
|
+
await writeCache(dataDir, cacheUpdated);
|
|
72
|
+
const merged = allResults.flat();
|
|
73
|
+
const seen = new Set();
|
|
74
|
+
const deduped = merged.filter((tool) => {
|
|
75
|
+
if (seen.has(tool.name)) {
|
|
76
|
+
return false;
|
|
77
|
+
}
|
|
78
|
+
seen.add(tool.name);
|
|
79
|
+
return true;
|
|
80
|
+
});
|
|
81
|
+
return rankResults(deduped, [], _stackLanguage);
|
|
82
|
+
}
|
|
83
|
+
//# sourceMappingURL=tech-discovery.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tech-discovery.js","sourceRoot":"","sources":["../../../src/engine/discovery/tech-discovery.ts"],"names":[],"mappings":"AAAA,4FAA4F;AAC5F,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,iBAAiB,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC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AC;SAC3B,CAAC,CAAC;QAEH,MAAM,MAAM,GAAG,WAAW,CAAC,UAAU,EAAE,SAAS,EAAE,cAAc,CAAC,CAAC;QAClE,YAAY,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,CAAC;QAChF,OAAO,MAAM,CAAC;IAChB,CAAC,CAAC,CACH,CAAC;IAEF,MAAM,UAAU,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAExC,MAAM,MAAM,GAAG,UAAU,CAAC,IAAI,EAAE,CAAC;IACjC,MAAM,IAAI,GAAG,IAAI,GAAG,EAAU,CAAC;IAC/B,MAAM,OAAO,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE;QACrC,IAAI,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC;QACf,CAAC;QACD,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACpB,OAAO,IAAI,CAAC;IACd,CAAC,CAAC,CAAC;IAEH,OAAO,WAAW,CAAC,OAAO,EAAE,EAAE,EAAE,cAAc,CAAC,CAAC;AAClD,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { LedgerEntry, LedgerAggregation, BudgetConfig, LedgerBudgetStatus, DailyBreakdown, TrendResult, Anomaly, TopConsumer, OptimizationSavings } from '../../types/index.js';
|
|
2
|
+
export type { DailyBreakdown, TrendResult, Anomaly, TopConsumer, OptimizationSavings };
|
|
3
|
+
export declare function aggregateEntries(entries: LedgerEntry[]): LedgerAggregation;
|
|
4
|
+
export declare function computeDailyBreakdown(entries: LedgerEntry[]): DailyBreakdown[];
|
|
5
|
+
export declare function detectTrend(dailyBreakdown: DailyBreakdown[]): TrendResult;
|
|
6
|
+
export declare function detectAnomalies(entries: LedgerEntry[], dailyBreakdown: DailyBreakdown[]): Anomaly[];
|
|
7
|
+
export declare function computeBudgetStatus(entries: LedgerEntry[], config: BudgetConfig): LedgerBudgetStatus;
|
|
8
|
+
export declare function getTopConsumers(entries: LedgerEntry[], limit?: number): TopConsumer[];
|
|
9
|
+
export declare function computeOptimizationSavings(entries: LedgerEntry[]): OptimizationSavings;
|
|
10
|
+
//# sourceMappingURL=analytics.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../../src/engine/token-optimizer/analytics.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,WAAW,EACX,iBAAiB,EACjB,YAAY,EACZ,kBAAkB,EAClB,cAAc,EACd,WAAW,EACX,OAAO,EACP,WAAW,EACX,mBAAmB,EACpB,MAAM,kBAAkB,CAAC;AAE1B,YAAY,EAAE,cAAc,EAAE,WAAW,EAAE,OAAO,EAAE,WAAW,EAAE,mBAAmB,EAAE,CAAC;AAoGvF,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,iBAAiB,CAuE1E;AAMD,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,cAAc,EAAE,CA2B9E;AAMD,wBAAgB,WAAW,CAAC,cAAc,EAAE,cAAc,EAAE,GAAG,WAAW,CAuCzE;AAMD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EAAE,EACtB,cAAc,EAAE,cAAc,EAAE,GAC/B,OAAO,EAAE,CAyDX;AAMD,wBAAgB,mBAAmB,CACjC,OAAO,EAAE,WAAW,EAAE,EACtB,MAAM,EAAE,YAAY,GACnB,kBAAkB,CAgDpB;AAMD,wBAAgB,eAAe,CAC7B,OAAO,EAAE,WAAW,EAAE,EACtB,KAAK,GAAE,MAAoC,GAC1C,WAAW,EAAE,CAsBf;AAMD,wBAAgB,0BAA0B,CAAC,OAAO,EAAE,WAAW,EAAE,GAAG,mBAAmB,CAkCtF"}
|