chia-explorer 0.1.6 → 0.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +151 -7
- package/dist/chips/index.d.ts +76 -0
- package/dist/chips/index.js +288 -0
- package/dist/chips/index.js.map +1 -0
- package/dist/chips/parser.d.ts +30 -0
- package/dist/chips/parser.js +208 -0
- package/dist/chips/parser.js.map +1 -0
- package/dist/chips/readme-index.d.ts +12 -0
- package/dist/chips/readme-index.js +82 -0
- package/dist/chips/readme-index.js.map +1 -0
- package/dist/github/cache.d.ts +3 -0
- package/dist/github/cache.js +18 -0
- package/dist/github/cache.js.map +1 -0
- package/dist/github/client.d.ts +5 -0
- package/dist/github/client.js +68 -0
- package/dist/github/client.js.map +1 -0
- package/dist/schemas/chips.d.ts +8 -0
- package/dist/schemas/chips.js +39 -0
- package/dist/schemas/chips.js.map +1 -0
- package/dist/server.js +12 -2
- package/dist/server.js.map +1 -1
- package/dist/tools/chips/get-chip.d.ts +2 -0
- package/dist/tools/chips/get-chip.js +30 -0
- package/dist/tools/chips/get-chip.js.map +1 -0
- package/dist/tools/chips/list-chip-drafts.d.ts +2 -0
- package/dist/tools/chips/list-chip-drafts.js +19 -0
- package/dist/tools/chips/list-chip-drafts.js.map +1 -0
- package/dist/tools/chips/list-chips.d.ts +2 -0
- package/dist/tools/chips/list-chips.js +33 -0
- package/dist/tools/chips/list-chips.js.map +1 -0
- package/dist/tools/chips/search-chips.d.ts +2 -0
- package/dist/tools/chips/search-chips.js +31 -0
- package/dist/tools/chips/search-chips.js.map +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -20,25 +20,48 @@ Backed by the public [coinset.org](https://www.coinset.org) full-node API for ch
|
|
|
20
20
|
|
|
21
21
|
## Install
|
|
22
22
|
|
|
23
|
+
The server is a single npm package. No global install needed — every config below uses `npx` so it stays up to date.
|
|
24
|
+
|
|
23
25
|
```bash
|
|
24
|
-
|
|
26
|
+
npx chia-explorer
|
|
25
27
|
```
|
|
26
28
|
|
|
27
|
-
|
|
29
|
+
If you want it on your PATH:
|
|
28
30
|
|
|
29
31
|
```bash
|
|
30
|
-
|
|
32
|
+
npm install -g chia-explorer
|
|
31
33
|
```
|
|
32
34
|
|
|
33
|
-
|
|
35
|
+
Requires Node.js 20+.
|
|
36
|
+
|
|
37
|
+
## Use it with your AI client
|
|
38
|
+
|
|
39
|
+
### Claude Code
|
|
34
40
|
|
|
35
41
|
```bash
|
|
36
42
|
claude mcp add chia-explorer -- npx chia-explorer
|
|
37
43
|
```
|
|
38
44
|
|
|
39
|
-
|
|
45
|
+
### Claude Desktop
|
|
46
|
+
|
|
47
|
+
Edit `claude_desktop_config.json` (Settings → Developer → Edit Config):
|
|
48
|
+
|
|
49
|
+
```json
|
|
50
|
+
{
|
|
51
|
+
"mcpServers": {
|
|
52
|
+
"chia-explorer": {
|
|
53
|
+
"command": "npx",
|
|
54
|
+
"args": ["chia-explorer"]
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Restart Claude Desktop.
|
|
40
61
|
|
|
41
|
-
|
|
62
|
+
### Cursor
|
|
63
|
+
|
|
64
|
+
Create or edit `~/.cursor/mcp.json` (global) or `.cursor/mcp.json` inside a project:
|
|
42
65
|
|
|
43
66
|
```json
|
|
44
67
|
{
|
|
@@ -51,6 +74,122 @@ Add to your `claude_desktop_config.json`:
|
|
|
51
74
|
}
|
|
52
75
|
```
|
|
53
76
|
|
|
77
|
+
Restart Cursor and enable the server under Settings → MCP.
|
|
78
|
+
|
|
79
|
+
### Codex CLI
|
|
80
|
+
|
|
81
|
+
Edit `~/.codex/config.toml`:
|
|
82
|
+
|
|
83
|
+
```toml
|
|
84
|
+
[mcp_servers.chia-explorer]
|
|
85
|
+
command = "npx"
|
|
86
|
+
args = ["chia-explorer"]
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
### VS Code (native MCP)
|
|
90
|
+
|
|
91
|
+
Create `.vscode/mcp.json` in your workspace:
|
|
92
|
+
|
|
93
|
+
```json
|
|
94
|
+
{
|
|
95
|
+
"servers": {
|
|
96
|
+
"chia-explorer": {
|
|
97
|
+
"command": "npx",
|
|
98
|
+
"args": ["chia-explorer"]
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
### Windsurf
|
|
105
|
+
|
|
106
|
+
Edit `~/.codeium/windsurf/mcp_config.json`:
|
|
107
|
+
|
|
108
|
+
```json
|
|
109
|
+
{
|
|
110
|
+
"mcpServers": {
|
|
111
|
+
"chia-explorer": {
|
|
112
|
+
"command": "npx",
|
|
113
|
+
"args": ["chia-explorer"]
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
### Anything else that speaks MCP
|
|
120
|
+
|
|
121
|
+
It's a standard stdio MCP server. The recipe is always the same: `command = npx`, `args = ["chia-explorer"]`. Set `COINGECKO_API_KEY` as an env var if you have one.
|
|
122
|
+
|
|
123
|
+
## Example prompts
|
|
124
|
+
|
|
125
|
+
Drop these into a chat once the server is wired up.
|
|
126
|
+
|
|
127
|
+
**Offers**
|
|
128
|
+
|
|
129
|
+
> Decode this offer and tell me what's being traded: `offer1qqr83wcuu2rykcmqvpsxgfgqmqys...`
|
|
130
|
+
|
|
131
|
+
> I just got sent this `offer1...` string in Discord. Is it safe to take? What do I give and what do I get?
|
|
132
|
+
|
|
133
|
+
**Smart-coin inspection**
|
|
134
|
+
|
|
135
|
+
> What kind of coin is `0xabc...123`? Pull its puzzle reveal at height 6500000 and tell me if it's a CAT, NFT, DID, or plain XCH.
|
|
136
|
+
|
|
137
|
+
> Walk the children of coin `0xabc...` for two hops. Classify each child.
|
|
138
|
+
|
|
139
|
+
**Mempool and fees**
|
|
140
|
+
|
|
141
|
+
> Is `0xdeadbeef...` (my tx) currently in the mempool?
|
|
142
|
+
|
|
143
|
+
> How many transactions are pending right now? What does the fee market look like for inclusion in the next minute?
|
|
144
|
+
|
|
145
|
+
> What fee should I attach to a take_offer spend to get included in the next 5 minutes?
|
|
146
|
+
|
|
147
|
+
**Balances and pricing**
|
|
148
|
+
|
|
149
|
+
> What's the XCH balance of `xch1yxqsmyuyjdlgxw4sqjg4vqlqv5ms2qzex00586nu643jqemmarwslh08yl`? How much is that in USD and EUR right now?
|
|
150
|
+
|
|
151
|
+
> Convert 1.5 XCH to GBP, EUR, BTC, and SAT.
|
|
152
|
+
|
|
153
|
+
**Chain state**
|
|
154
|
+
|
|
155
|
+
> What block was Chia at one hour ago — height, header hash, transaction count?
|
|
156
|
+
|
|
157
|
+
> Is the network synced? What's the current netspace in EiB?
|
|
158
|
+
|
|
159
|
+
**Strategic reserve**
|
|
160
|
+
|
|
161
|
+
> How much of the 21M XCH strategic reserve has been spent? Where did the most recent five outflows go — partners, market makers, or exchanges?
|
|
162
|
+
|
|
163
|
+
> Show me every spend from the Swiss cold wallet, with the destination labelled.
|
|
164
|
+
|
|
165
|
+
**Identifier glue**
|
|
166
|
+
|
|
167
|
+
> Convert this puzzle hash to a mainnet address: `4bf5122f344554c53bde2ebb8cd2b7e3d1600ad631c385a5d7cce23c7785459a`.
|
|
168
|
+
|
|
169
|
+
> What's the coin name for parent `0xaaa...`, puzzle hash `0xbbb...`, amount 1000000000000?
|
|
170
|
+
|
|
171
|
+
## Pre-built workflows: chia-skills
|
|
172
|
+
|
|
173
|
+
[**chia-skills**](https://github.com/Spacetime-Technology/chia-skills) is a companion package of Claude Code skills built on top of this MCP. It turns the read-only tools below into finished workflows you can actually schedule and get notified about: deposit alerts, price triggers, offer safety checks, NFT provenance, invoice watching.
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
npx chia-skills install
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
What's in the box:
|
|
180
|
+
|
|
181
|
+
- `watch-address` — push notification when XCH, a CAT, or an NFT lands at (or leaves) an address
|
|
182
|
+
- `watch-tx-confirmation` — ping when a specific tx_id moves from mempool to confirmed
|
|
183
|
+
- `watch-xch-price` — alert when XCH crosses a threshold in any CoinGecko currency
|
|
184
|
+
- `watch-fee-market` — catch cheap fee windows to broadcast
|
|
185
|
+
- `watch-prefarm-spend` — flag new strategic-reserve outflows with destinations labelled
|
|
186
|
+
- `address-daily-digest` — daily summary of one or more addresses with USD values
|
|
187
|
+
- `offer-safety-check` — decode an `offer1...` and check both sides against market prices
|
|
188
|
+
- `coin-lineage` / `nft-provenance` — walk coin or NFT history N hops in either direction
|
|
189
|
+
- `invoice-watch` — generate an invoice, watch for the matching deposit, emit a paid receipt
|
|
190
|
+
|
|
191
|
+
Skills are read-only and idempotent, persist state between runs, and accept structured inputs so other skills or agents can chain them. If you want to see what's possible with chia-explorer beyond ad-hoc prompts, start there. If you want to write your own, the skills repo is the reference.
|
|
192
|
+
|
|
54
193
|
## Tools
|
|
55
194
|
|
|
56
195
|
| Tool | What it does |
|
|
@@ -81,12 +220,17 @@ Add to your `claude_desktop_config.json`:
|
|
|
81
220
|
| `get_prefarm_status` | Live per-wallet balances of the 21M XCH strategic reserve, plus total spent |
|
|
82
221
|
| `get_prefarm_spends` | Outflows from the reserve, with destinations labelled when known (partners / market makers / exchanges). Filter by wallet, height, or count |
|
|
83
222
|
| `list_prefarm_addresses` | The hardcoded registry: custody wallets and known destination addresses. No network call |
|
|
223
|
+
| `list_chips` | All Chia Improvement Proposals from the canonical README index in `Chia-Network/chips`, across every status (Living, Draft, Review, Final, Stagnant, Withdrawn, Obsolete, Grandfathered). Draft and Review entries link to open PRs; Final entries link to merged files. Status comes from the README; front matter is enriched in. Filter by status or category |
|
|
224
|
+
| `get_chip` | One CHIP by number. Returns the merged version (if any), any open PR drafts proposing the same number, and optionally the full markdown |
|
|
225
|
+
| `list_chip_drafts` | Open PRs against `Chia-Network/chips` that add or modify a CHIP, with parsed front matter and PR context (author, reviewers, draft flag) |
|
|
226
|
+
| `search_chips` | Keyword search across merged CHIPs and open PR drafts (title, description, abstract, authors) |
|
|
84
227
|
|
|
85
|
-
Blockchain tools take an optional `network: "mainnet" | "testnet11"` (default `mainnet`). The price tools take no network arg. The prefarm tools are mainnet only.
|
|
228
|
+
Blockchain tools take an optional `network: "mainnet" | "testnet11"` (default `mainnet`). The price and CHIPs tools take no network arg. The prefarm tools are mainnet only.
|
|
86
229
|
|
|
87
230
|
## Optional config
|
|
88
231
|
|
|
89
232
|
- `COINGECKO_API_KEY` — if set, sent as `x-cg-demo-api-key` to lift the free-tier rate limit. The price tools work without it.
|
|
233
|
+
- `GITHUB_TOKEN` — if set, sent as `Authorization: Bearer …` to the GitHub API. Lifts the unauthenticated 60/hr limit to 5000/hr for CHIPs listings. Raw file fetches don't need it. The CHIPs tools work without it.
|
|
90
234
|
|
|
91
235
|
## Prompts
|
|
92
236
|
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { type AuthorRef } from './parser.js';
|
|
2
|
+
export interface ChipSummary {
|
|
3
|
+
number: number | null;
|
|
4
|
+
title: string | null;
|
|
5
|
+
status: string | null;
|
|
6
|
+
category: string | null;
|
|
7
|
+
sub_category: string | null;
|
|
8
|
+
type: string | null;
|
|
9
|
+
authors: AuthorRef[];
|
|
10
|
+
editors: AuthorRef[];
|
|
11
|
+
description: string | null;
|
|
12
|
+
abstract: string | null;
|
|
13
|
+
created: string | null;
|
|
14
|
+
updated: string | null;
|
|
15
|
+
comments_uri: string | null;
|
|
16
|
+
requires: string | null;
|
|
17
|
+
replaces: string | null;
|
|
18
|
+
superseded_by: string | null;
|
|
19
|
+
source_url: string;
|
|
20
|
+
filename: string | null;
|
|
21
|
+
}
|
|
22
|
+
export interface MergedChip extends ChipSummary {
|
|
23
|
+
source: 'merged';
|
|
24
|
+
ref: 'main';
|
|
25
|
+
body?: string;
|
|
26
|
+
}
|
|
27
|
+
export interface DraftChip extends ChipSummary {
|
|
28
|
+
source: 'draft';
|
|
29
|
+
ref: string;
|
|
30
|
+
pr: PrContext;
|
|
31
|
+
modifies_existing: boolean;
|
|
32
|
+
body?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface ChipIndexEntry extends ChipSummary {
|
|
35
|
+
kind: 'file' | 'pr' | 'external';
|
|
36
|
+
pr: PrContext | null;
|
|
37
|
+
ref: string | null;
|
|
38
|
+
}
|
|
39
|
+
export interface PrContext {
|
|
40
|
+
number: number;
|
|
41
|
+
url: string;
|
|
42
|
+
title: string;
|
|
43
|
+
state: string;
|
|
44
|
+
draft: boolean;
|
|
45
|
+
author: string | null;
|
|
46
|
+
requested_reviewers: string[];
|
|
47
|
+
created_at: string;
|
|
48
|
+
updated_at: string;
|
|
49
|
+
head_sha: string;
|
|
50
|
+
head_ref: string;
|
|
51
|
+
base_ref: string;
|
|
52
|
+
}
|
|
53
|
+
export declare function getMergedChip(number: number, options?: {
|
|
54
|
+
includeBody?: boolean;
|
|
55
|
+
}): Promise<MergedChip | null>;
|
|
56
|
+
export declare function listChipDrafts(): Promise<DraftChip[]>;
|
|
57
|
+
export declare function getChipFromPr(prNumber: number, options?: {
|
|
58
|
+
includeBody?: boolean;
|
|
59
|
+
}): Promise<DraftChip | null>;
|
|
60
|
+
export declare function findChipByNumber(number: number, options?: {
|
|
61
|
+
includeBody?: boolean;
|
|
62
|
+
}): Promise<{
|
|
63
|
+
merged: MergedChip | null;
|
|
64
|
+
drafts: DraftChip[];
|
|
65
|
+
}>;
|
|
66
|
+
export declare function listChipsFromReadme(): Promise<ChipIndexEntry[]>;
|
|
67
|
+
export interface SearchOptions {
|
|
68
|
+
status?: string;
|
|
69
|
+
source?: 'merged' | 'draft' | 'both';
|
|
70
|
+
limit?: number;
|
|
71
|
+
}
|
|
72
|
+
export interface SearchMatch extends ChipIndexEntry {
|
|
73
|
+
source: 'merged' | 'draft';
|
|
74
|
+
}
|
|
75
|
+
export declare function searchChips(query: string, options?: SearchOptions): Promise<SearchMatch[]>;
|
|
76
|
+
export { resetCache } from '../github/cache.js';
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
import { FileNotFoundError, fetchRawFile, githubApi } from '../github/client.js';
|
|
2
|
+
import { getCached } from '../github/cache.js';
|
|
3
|
+
import { buildChipFileName, extractAbstract, extractChipPathInfo, parseChipFrontMatter, } from './parser.js';
|
|
4
|
+
import { getChipReadmeIndex } from './readme-index.js';
|
|
5
|
+
const REPO = 'Chia-Network/chips';
|
|
6
|
+
const DEFAULT_REF = 'main';
|
|
7
|
+
const CONTENT_TTL_MS = 10 * 60_000;
|
|
8
|
+
const PR_LIST_TTL_MS = 2 * 60_000;
|
|
9
|
+
function summarize(fm, body, ref, filename) {
|
|
10
|
+
return {
|
|
11
|
+
number: fm.number,
|
|
12
|
+
title: fm.title,
|
|
13
|
+
status: fm.status,
|
|
14
|
+
category: fm.category,
|
|
15
|
+
sub_category: fm.sub_category,
|
|
16
|
+
type: fm.type,
|
|
17
|
+
authors: fm.authors,
|
|
18
|
+
editors: fm.editors,
|
|
19
|
+
description: fm.description,
|
|
20
|
+
abstract: extractAbstract(body),
|
|
21
|
+
created: fm.created,
|
|
22
|
+
updated: fm.updated,
|
|
23
|
+
comments_uri: fm.comments_uri,
|
|
24
|
+
requires: fm.requires,
|
|
25
|
+
replaces: fm.replaces,
|
|
26
|
+
superseded_by: fm.superseded_by,
|
|
27
|
+
source_url: `https://github.com/${REPO}/blob/${ref}/${filename}`,
|
|
28
|
+
filename,
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
async function fetchChipFile(ref, path) {
|
|
32
|
+
return getCached(`chips:raw:${ref}:${path}`, () => fetchRawFile(REPO, ref, path), CONTENT_TTL_MS);
|
|
33
|
+
}
|
|
34
|
+
export async function getMergedChip(number, options = {}) {
|
|
35
|
+
const filename = `CHIPs/${buildChipFileName(number)}`;
|
|
36
|
+
try {
|
|
37
|
+
const body = await fetchChipFile(DEFAULT_REF, filename);
|
|
38
|
+
const fm = parseChipFrontMatter(body);
|
|
39
|
+
const summary = summarize(fm, body, DEFAULT_REF, filename);
|
|
40
|
+
const chip = {
|
|
41
|
+
...summary,
|
|
42
|
+
source: 'merged',
|
|
43
|
+
ref: 'main',
|
|
44
|
+
};
|
|
45
|
+
if (options.includeBody)
|
|
46
|
+
chip.body = body;
|
|
47
|
+
return chip;
|
|
48
|
+
}
|
|
49
|
+
catch (err) {
|
|
50
|
+
if (err instanceof FileNotFoundError)
|
|
51
|
+
return null;
|
|
52
|
+
throw err;
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
async function listOpenChipPrs() {
|
|
56
|
+
return getCached(`chips:prs:open`, () => githubApi(`/repos/${REPO}/pulls?state=open&per_page=100&sort=updated&direction=desc`), PR_LIST_TTL_MS);
|
|
57
|
+
}
|
|
58
|
+
async function listPrChipFiles(prNumber) {
|
|
59
|
+
return getCached(`chips:pr-files:${prNumber}`, () => githubApi(`/repos/${REPO}/pulls/${prNumber}/files?per_page=100`), PR_LIST_TTL_MS);
|
|
60
|
+
}
|
|
61
|
+
function prContext(pr) {
|
|
62
|
+
return {
|
|
63
|
+
number: pr.number,
|
|
64
|
+
url: pr.html_url,
|
|
65
|
+
title: pr.title,
|
|
66
|
+
state: pr.state,
|
|
67
|
+
draft: pr.draft,
|
|
68
|
+
author: pr.user?.login ?? null,
|
|
69
|
+
requested_reviewers: pr.requested_reviewers.map((r) => r.login),
|
|
70
|
+
created_at: pr.created_at,
|
|
71
|
+
updated_at: pr.updated_at,
|
|
72
|
+
head_sha: pr.head.sha,
|
|
73
|
+
head_ref: pr.head.ref,
|
|
74
|
+
base_ref: pr.base.ref,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
async function buildDraftFromPr(pr, file, options = {}) {
|
|
78
|
+
if (file.status === 'removed')
|
|
79
|
+
return null;
|
|
80
|
+
const info = extractChipPathInfo(file.filename);
|
|
81
|
+
if (!info)
|
|
82
|
+
return null;
|
|
83
|
+
let body;
|
|
84
|
+
try {
|
|
85
|
+
body = await fetchChipFile(pr.head.sha, file.filename);
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
if (err instanceof FileNotFoundError)
|
|
89
|
+
return null;
|
|
90
|
+
throw err;
|
|
91
|
+
}
|
|
92
|
+
const fm = parseChipFrontMatter(body);
|
|
93
|
+
const summary = summarize(fm, body, pr.head.sha, file.filename);
|
|
94
|
+
if (summary.number == null)
|
|
95
|
+
summary.number = info.number;
|
|
96
|
+
const draft = {
|
|
97
|
+
...summary,
|
|
98
|
+
source: 'draft',
|
|
99
|
+
ref: pr.head.sha,
|
|
100
|
+
pr: prContext(pr),
|
|
101
|
+
modifies_existing: file.status === 'modified' || file.status === 'renamed',
|
|
102
|
+
};
|
|
103
|
+
if (options.includeBody)
|
|
104
|
+
draft.body = body;
|
|
105
|
+
return draft;
|
|
106
|
+
}
|
|
107
|
+
export async function listChipDrafts() {
|
|
108
|
+
const prs = await listOpenChipPrs();
|
|
109
|
+
const results = [];
|
|
110
|
+
for (const pr of prs) {
|
|
111
|
+
const files = await listPrChipFiles(pr.number).catch(() => []);
|
|
112
|
+
const chipFiles = files.filter((f) => extractChipPathInfo(f.filename));
|
|
113
|
+
for (const file of chipFiles) {
|
|
114
|
+
const draft = await buildDraftFromPr(pr, file).catch(() => null);
|
|
115
|
+
if (draft)
|
|
116
|
+
results.push(draft);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return results;
|
|
120
|
+
}
|
|
121
|
+
export async function getChipFromPr(prNumber, options = {}) {
|
|
122
|
+
const prs = await listOpenChipPrs();
|
|
123
|
+
const pr = prs.find((p) => p.number === prNumber);
|
|
124
|
+
if (!pr)
|
|
125
|
+
return null;
|
|
126
|
+
const files = await listPrChipFiles(prNumber);
|
|
127
|
+
for (const file of files) {
|
|
128
|
+
if (!extractChipPathInfo(file.filename))
|
|
129
|
+
continue;
|
|
130
|
+
const draft = await buildDraftFromPr(pr, file, options);
|
|
131
|
+
if (draft)
|
|
132
|
+
return draft;
|
|
133
|
+
}
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
export async function findChipByNumber(number, options = {}) {
|
|
137
|
+
const merged = await getMergedChip(number, options);
|
|
138
|
+
const allDrafts = await listChipDrafts();
|
|
139
|
+
const drafts = [];
|
|
140
|
+
for (const d of allDrafts) {
|
|
141
|
+
if (d.number !== number)
|
|
142
|
+
continue;
|
|
143
|
+
if (options.includeBody) {
|
|
144
|
+
const full = await getChipFromPr(d.pr.number, { includeBody: true });
|
|
145
|
+
if (full)
|
|
146
|
+
drafts.push(full);
|
|
147
|
+
else
|
|
148
|
+
drafts.push(d);
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
drafts.push(d);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
return { merged, drafts };
|
|
155
|
+
}
|
|
156
|
+
function sparseEntry(idx) {
|
|
157
|
+
return {
|
|
158
|
+
number: idx.number,
|
|
159
|
+
title: idx.title,
|
|
160
|
+
status: idx.status,
|
|
161
|
+
category: null,
|
|
162
|
+
sub_category: null,
|
|
163
|
+
type: null,
|
|
164
|
+
authors: [],
|
|
165
|
+
editors: [],
|
|
166
|
+
description: null,
|
|
167
|
+
abstract: null,
|
|
168
|
+
created: null,
|
|
169
|
+
updated: null,
|
|
170
|
+
comments_uri: null,
|
|
171
|
+
requires: null,
|
|
172
|
+
replaces: null,
|
|
173
|
+
superseded_by: null,
|
|
174
|
+
source_url: idx.url,
|
|
175
|
+
filename: idx.filename,
|
|
176
|
+
kind: idx.kind,
|
|
177
|
+
pr: null,
|
|
178
|
+
ref: null,
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
async function buildIndexEntry(idx, openPrs) {
|
|
182
|
+
if (idx.kind === 'file' && idx.filename) {
|
|
183
|
+
try {
|
|
184
|
+
const body = await fetchChipFile(DEFAULT_REF, idx.filename);
|
|
185
|
+
const fm = parseChipFrontMatter(body);
|
|
186
|
+
const summary = summarize(fm, body, DEFAULT_REF, idx.filename);
|
|
187
|
+
return {
|
|
188
|
+
...summary,
|
|
189
|
+
number: idx.number ?? summary.number,
|
|
190
|
+
title: summary.title ?? idx.title,
|
|
191
|
+
status: idx.status,
|
|
192
|
+
source_url: idx.url,
|
|
193
|
+
kind: 'file',
|
|
194
|
+
pr: null,
|
|
195
|
+
ref: DEFAULT_REF,
|
|
196
|
+
};
|
|
197
|
+
}
|
|
198
|
+
catch (err) {
|
|
199
|
+
if (err instanceof FileNotFoundError)
|
|
200
|
+
return sparseEntry(idx);
|
|
201
|
+
throw err;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
if (idx.kind === 'pr' && idx.prNumber != null) {
|
|
205
|
+
const pr = openPrs.get(idx.prNumber);
|
|
206
|
+
if (pr) {
|
|
207
|
+
const files = await listPrChipFiles(pr.number).catch(() => []);
|
|
208
|
+
const chipFiles = files.filter((f) => f.status !== 'removed' && extractChipPathInfo(f.filename));
|
|
209
|
+
let chipFile;
|
|
210
|
+
if (idx.number != null) {
|
|
211
|
+
const target = buildChipFileName(idx.number);
|
|
212
|
+
chipFile = chipFiles.find((f) => f.filename.toLowerCase().endsWith(target.toLowerCase()));
|
|
213
|
+
}
|
|
214
|
+
if (!chipFile)
|
|
215
|
+
chipFile = chipFiles[0];
|
|
216
|
+
if (chipFile) {
|
|
217
|
+
const body = await fetchChipFile(pr.head.sha, chipFile.filename).catch(() => null);
|
|
218
|
+
if (body) {
|
|
219
|
+
const fm = parseChipFrontMatter(body);
|
|
220
|
+
const summary = summarize(fm, body, pr.head.sha, chipFile.filename);
|
|
221
|
+
return {
|
|
222
|
+
...summary,
|
|
223
|
+
number: idx.number ?? summary.number,
|
|
224
|
+
title: summary.title ?? idx.title,
|
|
225
|
+
status: idx.status,
|
|
226
|
+
source_url: idx.url,
|
|
227
|
+
kind: 'pr',
|
|
228
|
+
pr: prContext(pr),
|
|
229
|
+
ref: pr.head.sha,
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
return sparseEntry(idx);
|
|
235
|
+
}
|
|
236
|
+
return sparseEntry(idx);
|
|
237
|
+
}
|
|
238
|
+
export async function listChipsFromReadme() {
|
|
239
|
+
const [index, openPrsList] = await Promise.all([getChipReadmeIndex(), listOpenChipPrs()]);
|
|
240
|
+
const openPrs = new Map(openPrsList.map((pr) => [pr.number, pr]));
|
|
241
|
+
const entries = await Promise.all(index.map((idx) => buildIndexEntry(idx, openPrs)));
|
|
242
|
+
entries.sort((a, b) => {
|
|
243
|
+
if (a.number == null && b.number == null)
|
|
244
|
+
return 0;
|
|
245
|
+
if (a.number == null)
|
|
246
|
+
return 1;
|
|
247
|
+
if (b.number == null)
|
|
248
|
+
return -1;
|
|
249
|
+
return a.number - b.number;
|
|
250
|
+
});
|
|
251
|
+
return entries;
|
|
252
|
+
}
|
|
253
|
+
function matchesQuery(s, q) {
|
|
254
|
+
const needle = q.toLowerCase();
|
|
255
|
+
const haystacks = [];
|
|
256
|
+
if (s.title)
|
|
257
|
+
haystacks.push(s.title);
|
|
258
|
+
if (s.description)
|
|
259
|
+
haystacks.push(s.description);
|
|
260
|
+
if (s.abstract)
|
|
261
|
+
haystacks.push(s.abstract);
|
|
262
|
+
for (const a of s.authors)
|
|
263
|
+
haystacks.push(a.name);
|
|
264
|
+
if (s.number != null)
|
|
265
|
+
haystacks.push(String(s.number));
|
|
266
|
+
return haystacks.some((h) => h.toLowerCase().includes(needle));
|
|
267
|
+
}
|
|
268
|
+
function kindToSource(kind) {
|
|
269
|
+
return kind === 'pr' ? 'draft' : 'merged';
|
|
270
|
+
}
|
|
271
|
+
export async function searchChips(query, options = {}) {
|
|
272
|
+
const source = options.source ?? 'both';
|
|
273
|
+
const limit = options.limit ?? 20;
|
|
274
|
+
const statusFilter = options.status?.toLowerCase();
|
|
275
|
+
const entries = await listChipsFromReadme();
|
|
276
|
+
const filtered = entries
|
|
277
|
+
.map((e) => ({ ...e, source: kindToSource(e.kind) }))
|
|
278
|
+
.filter((e) => {
|
|
279
|
+
if (source !== 'both' && e.source !== source)
|
|
280
|
+
return false;
|
|
281
|
+
if (statusFilter && (e.status?.toLowerCase() ?? '') !== statusFilter)
|
|
282
|
+
return false;
|
|
283
|
+
return matchesQuery(e, query);
|
|
284
|
+
});
|
|
285
|
+
return filtered.slice(0, limit);
|
|
286
|
+
}
|
|
287
|
+
export { resetCache } from '../github/cache.js';
|
|
288
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/chips/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AACjF,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EACL,iBAAiB,EACjB,eAAe,EACf,mBAAmB,EACnB,oBAAoB,GAGrB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,kBAAkB,EAAwB,MAAM,mBAAmB,CAAC;AAE7E,MAAM,IAAI,GAAG,oBAAoB,CAAC;AAClC,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,cAAc,GAAG,EAAE,GAAG,MAAM,CAAC;AACnC,MAAM,cAAc,GAAG,CAAC,GAAG,MAAM,CAAC;AA8ElC,SAAS,SAAS,CAAC,EAAmB,EAAE,IAAY,EAAE,GAAW,EAAE,QAAgB;IACjF,OAAO;QACL,MAAM,EAAE,EAAE,CAAC,MAAM;QACjB,KAAK,EAAE,EAAE,CAAC,KAAK;QACf,MAAM,EAAE,EAAE,CAAC,MAAM;QACjB,QAAQ,EAAE,EAAE,CAAC,QAAQ;QACrB,YAAY,EAAE,EAAE,CAAC,YAAY;QAC7B,IAAI,EAAE,EAAE,CAAC,IAAI;QACb,OAAO,EAAE,EAAE,CAAC,OAAO;QACnB,OAAO,EAAE,EAAE,CAAC,OAAO;QACnB,WAAW,EAAE,EAAE,CAAC,WAAW;QAC3B,QAAQ,EAAE,eAAe,CAAC,IAAI,CAAC;QAC/B,OAAO,EAAE,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EAAE,YAAY,CAAC,CAAC,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;SACjE,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE;QACZ,IAAI,MAAM,KAAK,MAAM,IAAI,CAAC,CAAC,MAAM,KAAK,MAAM;YAAE,OAAO,KAAK,CAAC;QAC3D,IAAI,YAAY,IAAI,CAAC,CAAC,CAAC,MAAM,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,KAAK,YAAY;YAAE,OAAO,KAAK,CAAC;QACnF,OAAO,YAAY,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;IAEL,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC;AAClC,CAAC;AAED,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface AuthorRef {
|
|
2
|
+
name: string;
|
|
3
|
+
url: string | null;
|
|
4
|
+
}
|
|
5
|
+
export interface ChipFrontMatter {
|
|
6
|
+
number: number | null;
|
|
7
|
+
title: string | null;
|
|
8
|
+
description: string | null;
|
|
9
|
+
authors: AuthorRef[];
|
|
10
|
+
editors: AuthorRef[];
|
|
11
|
+
comments_uri: string | null;
|
|
12
|
+
status: string | null;
|
|
13
|
+
category: string | null;
|
|
14
|
+
sub_category: string | null;
|
|
15
|
+
type: string | null;
|
|
16
|
+
created: string | null;
|
|
17
|
+
updated: string | null;
|
|
18
|
+
requires: string | null;
|
|
19
|
+
replaces: string | null;
|
|
20
|
+
superseded_by: string | null;
|
|
21
|
+
extra: Record<string, string>;
|
|
22
|
+
}
|
|
23
|
+
export declare function parseAuthors(raw: string): AuthorRef[];
|
|
24
|
+
export declare function parseChipFrontMatter(markdown: string): ChipFrontMatter;
|
|
25
|
+
export declare function extractAbstract(markdown: string): string | null;
|
|
26
|
+
export declare function buildChipFileName(number: number): string;
|
|
27
|
+
export declare function extractChipPathInfo(path: string): {
|
|
28
|
+
number: number;
|
|
29
|
+
filename: string;
|
|
30
|
+
} | null;
|