public-api-finder 0.3.0 → 0.3.2
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/README.md
CHANGED
|
@@ -44,3 +44,7 @@ The skill tells agents to prefer the CLI first, then live-check docs/endpoints b
|
|
|
44
44
|
--json Emit JSON
|
|
45
45
|
--refresh Refresh cache
|
|
46
46
|
```
|
|
47
|
+
|
|
48
|
+
## Release Automation
|
|
49
|
+
|
|
50
|
+
This package is published from GitHub Actions using npm Trusted Publishing with provenance. Releases are built on GitHub-hosted runners and no long-lived npm publish token is required.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "public-api-finder",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "Find free/public APIs for agents and prototypes.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -30,6 +30,10 @@
|
|
|
30
30
|
},
|
|
31
31
|
"repository": {
|
|
32
32
|
"type": "git",
|
|
33
|
-
"url": "git+https://github.com/BuiltByEcho/public-api-finder.git"
|
|
33
|
+
"url": "git+https://github.com/BuiltByEcho/public-api-finder.git",
|
|
34
|
+
"directory": "packages/public-api-finder"
|
|
35
|
+
},
|
|
36
|
+
"publishConfig": {
|
|
37
|
+
"access": "public"
|
|
34
38
|
}
|
|
35
39
|
}
|
|
File without changes
|
package/src/cli.js
CHANGED
|
@@ -14,9 +14,9 @@ const CACHE_TTL_MS = 24 * 60 * 60 * 1000;
|
|
|
14
14
|
const DOMAIN_PROFILES = {
|
|
15
15
|
crypto: {
|
|
16
16
|
triggers: ['crypto', 'cryptocurrency', 'cryptocurrencies', 'bitcoin', 'ethereum', 'solana', 'blockchain', 'defi', 'token', 'tokens', 'coin', 'coins', 'wallet'],
|
|
17
|
-
categoryWeights: { cryptocurrency:
|
|
18
|
-
boostTerms: ['crypto', 'cryptocurrency', 'bitcoin', 'ethereum', 'solana', 'blockchain', 'defi', 'token', 'coin', '
|
|
19
|
-
weakTerms: ['price', 'prices'],
|
|
17
|
+
categoryWeights: { cryptocurrency: 22, 'currency exchange': 3, finance: -4, financial: -4 },
|
|
18
|
+
boostTerms: ['crypto', 'cryptocurrency', 'bitcoin', 'ethereum', 'solana', 'blockchain', 'defi', 'token', 'coin', 'wallet'],
|
|
19
|
+
weakTerms: ['price', 'prices', 'market', 'exchange'],
|
|
20
20
|
},
|
|
21
21
|
finance: {
|
|
22
22
|
triggers: ['stock', 'stocks', 'equity', 'equities', 'market', 'trading', 'ticker', 'tickers', 'quote', 'quotes', 'etf', 'forex', 'portfolio', 'options'],
|
|
@@ -121,7 +121,7 @@ const CURATED_APIS = [
|
|
|
121
121
|
];
|
|
122
122
|
|
|
123
123
|
function compactName(value) { return String(value || '').toLowerCase().replace(/[^a-z0-9]+/g, ''); }
|
|
124
|
-
const KNOWN_BEST_NAMES = new Map(CURATED_APIS.map(api => [compactName(api.name),
|
|
124
|
+
const KNOWN_BEST_NAMES = new Map(CURATED_APIS.map(api => [compactName(api.name), 15]));
|
|
125
125
|
|
|
126
126
|
function detectDomains(queryTokens) {
|
|
127
127
|
return Object.entries(DOMAIN_PROFILES)
|
|
@@ -137,11 +137,12 @@ function domainAdjustment(entry, queryTokens) {
|
|
|
137
137
|
let adjustment = 0;
|
|
138
138
|
for (const domain of domains) {
|
|
139
139
|
const profile = DOMAIN_PROFILES[domain];
|
|
140
|
-
let categoryBoost =
|
|
140
|
+
let categoryBoost = null;
|
|
141
141
|
for (const [category, weight] of Object.entries(profile.categoryWeights || {})) {
|
|
142
|
-
if (cat.includes(category)) categoryBoost = Math.max(categoryBoost, weight);
|
|
142
|
+
if (cat.includes(category)) categoryBoost = categoryBoost === null ? weight : Math.max(categoryBoost, weight);
|
|
143
143
|
}
|
|
144
|
-
|
|
144
|
+
categoryBoost = categoryBoost ?? 0;
|
|
145
|
+
const categoryHit = categoryBoost !== 0;
|
|
145
146
|
const textHit = profile.boostTerms.some(t => text.includes(t));
|
|
146
147
|
if (categoryHit) adjustment += categoryBoost;
|
|
147
148
|
else if (textHit) adjustment += 3;
|
|
@@ -235,7 +236,7 @@ function score(entry, queryTokens) {
|
|
|
235
236
|
if (entry.sources?.length > 1) base += 2;
|
|
236
237
|
if (entry.auth === 'No') base += 1;
|
|
237
238
|
if (entry.https) base += 1;
|
|
238
|
-
if (asciiRatio(entry.name) < 0.7) base -=
|
|
239
|
+
if (asciiRatio(entry.name) < 0.7) base -= 60;
|
|
239
240
|
else if (asciiRatio(`${entry.name || ''} ${entry.description || ''}`) < 0.65) base -= 18;
|
|
240
241
|
const compactEntryName = compactName(entry.name);
|
|
241
242
|
for (const [name, weight] of KNOWN_BEST_NAMES) {
|
|
@@ -438,7 +439,8 @@ function filterEntries(entries, args) {
|
|
|
438
439
|
if (args.openapi && !e.openapiUrl) return [];
|
|
439
440
|
if (args.cors && String(e.cors || '').toLowerCase() !== args.cors.toLowerCase()) return [];
|
|
440
441
|
const matched = q.size ? textScore(e, q) : 1;
|
|
441
|
-
|
|
442
|
+
const domain = q.size ? domainAdjustment(e, q) : 0;
|
|
443
|
+
if (q.size && matched === 0 && domain <= 0) return [];
|
|
442
444
|
const s = q.size ? score(e, q) : 1;
|
|
443
445
|
if (q.size && s <= 0) return [];
|
|
444
446
|
return [{ ...e, score: s + (e.sourceWeight || 0) }];
|