@handamade/psi-mcp 0.24.0 → 0.25.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/index.d.ts CHANGED
@@ -2,7 +2,7 @@ import type { PsiIndex } from "./types.js";
2
2
  export type { PsiIndex, ComponentEntry, TokenEntry, PropDoc, PatternEntry, PatternNode, PatternParameter, } from "./types.js";
3
3
  export { buildIndex, GETTING_STARTED } from "./index-builder.js";
4
4
  export { createStore } from "./store.js";
5
- export type { Store, Brief, Detail } from "./store.js";
5
+ export type { Store, Brief, OverviewPatternBrief, SearchBrief, Detail } from "./store.js";
6
6
  export { createPsiServer } from "./server.js";
7
7
  /** Loads the index baked next to the compiled module at publish time. */
8
8
  export declare function loadIndex(): Promise<PsiIndex>;
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "0.24.0",
2
+ "version": "0.25.0",
3
3
  "themes": [
4
4
  "light",
5
5
  "dark",
package/dist/store.d.ts CHANGED
@@ -5,6 +5,14 @@ export interface Brief {
5
5
  title: string;
6
6
  summary: string;
7
7
  }
8
+ /** A pattern row in the empty-query overview: a `Brief` without `title`,
9
+ * which for a pattern only repeats the id after `pattern:` (D100). At the
10
+ * derived intro cap of 0 the title was a quarter of the row, and the row is
11
+ * all the overview can no longer shorten. */
12
+ export type OverviewPatternBrief = Omit<Brief, "title">;
13
+ /** What `search()` returns: stored briefs for a keyword query; for the empty
14
+ * query, the overview, where pattern rows are `OverviewPatternBrief`. */
15
+ export type SearchBrief = Brief | OverviewPatternBrief;
8
16
  export type Detail = ({
9
17
  kind: "component";
10
18
  } & ComponentEntry) | ({
@@ -17,7 +25,7 @@ export type Detail = ({
17
25
  content: unknown;
18
26
  };
19
27
  export interface Store {
20
- search(query: string): Brief[];
28
+ search(query: string): SearchBrief[];
21
29
  get(id: string): Detail | null;
22
30
  }
23
31
  export declare function createStore(index: PsiIndex): Store;
package/dist/store.js CHANGED
@@ -93,24 +93,26 @@ function overviewPatternSummary(p, limit) {
93
93
  const intro = truncateAtWord(`${p.intent} — ${p.match.join(", ")}, ${p.parameters.length} parameters`, limit);
94
94
  return p.blocked ? `${intro}, blocked (gaps: ${p.gaps.join(", ")})` : intro;
95
95
  }
96
+ const PATTERN_PREFIX = "pattern:";
96
97
  export function createStore(index) {
97
98
  const patternsById = new Map(index.patterns.map((p) => [p.id, p]));
98
99
  /** Overview-only projection: returns `b` unchanged for every kind except
99
100
  * pattern, where it re-derives the summary from the underlying
100
101
  * `PatternEntry` (via `overviewPatternSummary`) rather than slicing the
101
102
  * already-assembled, full-length `Brief.summary` — so the `blocked (gaps:
102
- * …)` tail always survives the overview's trim. Always a shallow copy for
103
- * patterns: the stored brief kept in `briefs` (and used by score()) is
104
- * never mutated. `limit` is derived per-call by the empty-query branch
103
+ * …)` tail always survives the overview's trim. A pattern row is a new
104
+ * `{id, kind, summary}` object with no `title`, which would only repeat
105
+ * the id (D100); the stored brief kept in `briefs` (and used by score())
106
+ * is never mutated. `limit` is derived per-call by the empty-query branch
105
107
  * (D61), not a module constant, so a growing catalog shortens summaries
106
108
  * instead of evicting items. */
107
109
  function overviewBrief(b, limit) {
108
110
  if (b.kind !== "pattern")
109
111
  return b;
110
- const pattern = patternsById.get(b.title);
112
+ const pattern = patternsById.get(b.id.slice(PATTERN_PREFIX.length));
111
113
  if (!pattern)
112
114
  return b;
113
- return { ...b, summary: overviewPatternSummary(pattern, limit) };
115
+ return { id: b.id, kind: b.kind, summary: overviewPatternSummary(pattern, limit) };
114
116
  }
115
117
  const briefs = [
116
118
  ...index.components.map((c) => ({
@@ -120,7 +122,7 @@ export function createStore(index) {
120
122
  summary: componentSummary(c),
121
123
  })),
122
124
  ...index.patterns.map((p) => ({
123
- id: `pattern:${p.id}`,
125
+ id: `${PATTERN_PREFIX}${p.id}`,
124
126
  kind: "pattern",
125
127
  title: p.id,
126
128
  summary: patternSummary(p),
package/llms.txt CHANGED
@@ -1,7 +1,7 @@
1
1
  # @handamade/psi-mcp — MCP access to Psi (Ψ)
2
2
 
3
3
  Two read-only tools over a baked index of the generated artifacts:
4
- - search(query): briefs {id, kind, title, summary}; empty query = overview
4
+ - search(query): briefs {id, kind, title, summary}; empty query = overview, where pattern rows are {id, kind, summary} (the id names the pattern, D100)
5
5
  - get(id): component (props/defaults/a11y doc) | token (formula + OKLCH/hex per theme) | topic (guidance) | pattern (compose tree, clarifying parameters, content, gaps/blocked status, preset JSX)
6
6
  Ids: component:<Name>, token:<name>, topic:<key>, pattern:<id>; bare names resolve case-insensitively.
7
7
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@handamade/psi-mcp",
3
- "version": "0.24.0",
3
+ "version": "0.25.0",
4
4
  "license": "MIT",
5
5
  "description": "MCP server and agent-context generator for the Psi (Ψ) design system",
6
6
  "type": "module",
@@ -33,8 +33,8 @@
33
33
  "tsx": "^4.22.4",
34
34
  "typescript": "^5.7.0",
35
35
  "vitest": "^3.2.6",
36
- "@handamade/psi-tokens": "0.24.0",
37
- "@handamade/psi-react": "0.24.0"
36
+ "@handamade/psi-tokens": "0.25.0",
37
+ "@handamade/psi-react": "0.25.0"
38
38
  },
39
39
  "scripts": {
40
40
  "build": "tsx scripts/build-index.ts && tsc -p tsconfig.build.json"