@mrclrchtr/supi-claude-md 1.6.0 → 1.7.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.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-core",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "SuPi core — shared infrastructure for SuPi extensions (XML context tags, config system)",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -20,7 +20,8 @@
20
20
  ],
21
21
  "peerDependencies": {
22
22
  "@earendil-works/pi-coding-agent": "*",
23
- "@earendil-works/pi-tui": "*"
23
+ "@earendil-works/pi-tui": "*",
24
+ "typebox": "*"
24
25
  },
25
26
  "peerDependenciesMeta": {
26
27
  "@earendil-works/pi-coding-agent": {
@@ -28,6 +29,9 @@
28
29
  },
29
30
  "@earendil-works/pi-tui": {
30
31
  "optional": true
32
+ },
33
+ "typebox": {
34
+ "optional": true
31
35
  }
32
36
  },
33
37
  "main": "src/api.ts",
@@ -1,11 +1,12 @@
1
1
  // supi-core — shared infrastructure for SuPi extensions.
2
2
  // Provides XML context tag wrapping, unified config system, context-message utilities,
3
- // and settings registry for supi-wide TUI settings.
3
+ // settings registry for supi-wide TUI settings, and a shared tool-spec/registration framework.
4
4
 
5
5
  export type { SupiConfigLocation, SupiConfigOptions } from "./config/config.ts";
6
6
  export {
7
7
  loadSupiConfig,
8
8
  loadSupiConfigForScope,
9
+ readJsonFile,
9
10
  removeSupiConfigKey,
10
11
  writeSupiConfig,
11
12
  } from "./config/config.ts";
@@ -83,3 +84,13 @@ export {
83
84
  signalWaiting,
84
85
  WAITING_SYMBOL,
85
86
  } from "./terminal.ts";
87
+ export type { SuiPiToolPromptSurface, SuiPiToolSpec, ToolExecuteFn } from "./tool-framework.ts";
88
+ export {
89
+ CharacterParam,
90
+ derivePromptSurface,
91
+ FileParam,
92
+ LineParam,
93
+ MaxResultsParam,
94
+ registerSuiPiTools,
95
+ SymbolParam,
96
+ } from "./tool-framework.ts";
@@ -20,7 +20,7 @@ function getProjectConfigPath(cwd: string): string {
20
20
  return path.join(cwd, PROJECT_CONFIG_DIR, CONFIG_FILE);
21
21
  }
22
22
 
23
- function readJsonFile(filePath: string): Record<string, unknown> | null {
23
+ export function readJsonFile(filePath: string): Record<string, unknown> | null {
24
24
  let content: string;
25
25
  try {
26
26
  content = fs.readFileSync(filePath, "utf-8");
@@ -1,11 +1,12 @@
1
1
  // supi-core — shared infrastructure for SuPi extensions.
2
2
  // Provides XML context tag wrapping, unified config system, context-message utilities,
3
- // and settings registry for supi-wide TUI settings.
3
+ // settings registry for supi-wide TUI settings, and a shared tool-spec/registration framework.
4
4
 
5
5
  export type { SupiConfigLocation, SupiConfigOptions } from "./config/config.ts";
6
6
  export {
7
7
  loadSupiConfig,
8
8
  loadSupiConfigForScope,
9
+ readJsonFile,
9
10
  removeSupiConfigKey,
10
11
  writeSupiConfig,
11
12
  } from "./config/config.ts";
@@ -83,3 +84,13 @@ export {
83
84
  signalWaiting,
84
85
  WAITING_SYMBOL,
85
86
  } from "./terminal.ts";
87
+ export type { SuiPiToolPromptSurface, SuiPiToolSpec, ToolExecuteFn } from "./tool-framework.ts";
88
+ export {
89
+ CharacterParam,
90
+ derivePromptSurface,
91
+ FileParam,
92
+ LineParam,
93
+ MaxResultsParam,
94
+ registerSuiPiTools,
95
+ SymbolParam,
96
+ } from "./tool-framework.ts";
@@ -0,0 +1,116 @@
1
+ // Shared tool framework for SuPi extensions.
2
+ //
3
+ // Provides a standard ToolSpec→PromptSurface→registerTool pipeline so
4
+ // individual packages do not duplicate spec interfaces, guidance derivation,
5
+ // registration loops, or common TypeBox parameter schemas.
6
+
7
+ import type {
8
+ AgentToolResult,
9
+ AgentToolUpdateCallback,
10
+ ExtensionAPI,
11
+ ExtensionContext,
12
+ } from "@earendil-works/pi-coding-agent";
13
+ import { type TSchema, Type } from "typebox";
14
+
15
+ // ---------------------------------------------------------------------------
16
+ // Types
17
+ // ---------------------------------------------------------------------------
18
+
19
+ /** Minimum contract for a SuPi tool definition. */
20
+ export interface SuiPiToolSpec {
21
+ name: string;
22
+ label: string;
23
+ description: string;
24
+ promptSnippet: string;
25
+ promptGuidelines: string[];
26
+ parameters: TSchema;
27
+ }
28
+
29
+ /** Derived prompt surface — what pi flattens into the system prompt. */
30
+ export interface SuiPiToolPromptSurface {
31
+ description: string;
32
+ promptSnippet: string;
33
+ promptGuidelines: string[];
34
+ }
35
+
36
+ // ---------------------------------------------------------------------------
37
+ // Guidance derivation
38
+ // ---------------------------------------------------------------------------
39
+
40
+ /**
41
+ * Static derivation: copies spec fields into a prompt surface.
42
+ *
43
+ * Packages that need dynamic guidance (e.g. server-coverage injection) should
44
+ * build their own surfaces, optionally starting from the output of this helper.
45
+ */
46
+ export function derivePromptSurface(spec: SuiPiToolSpec): SuiPiToolPromptSurface {
47
+ return {
48
+ description: spec.description,
49
+ promptSnippet: spec.promptSnippet,
50
+ promptGuidelines: [...spec.promptGuidelines],
51
+ };
52
+ }
53
+
54
+ // ---------------------------------------------------------------------------
55
+ // Registration
56
+ // ---------------------------------------------------------------------------
57
+
58
+ // biome-ignore lint/complexity/useMaxParams: matches pi ToolDefinition.execute signature
59
+ export type ToolExecuteFn = (
60
+ toolCallId: string,
61
+ params: unknown,
62
+ signal: AbortSignal | undefined,
63
+ onUpdate: AgentToolUpdateCallback<Record<string, unknown>> | undefined,
64
+ ctx: ExtensionContext,
65
+ ) => Promise<AgentToolResult<Record<string, unknown>>>;
66
+
67
+ /**
68
+ * Register a set of tools from specs + pre-derived surfaces.
69
+ *
70
+ * `createExecute` receives the spec and returns a pi-compatible execute
71
+ * function. This keeps execute-logic package-local while the framework owns
72
+ * the declarative surface and registration boilerplate.
73
+ */
74
+ export function registerSuiPiTools(
75
+ pi: ExtensionAPI,
76
+ specs: readonly SuiPiToolSpec[],
77
+ surfaces: Record<string, SuiPiToolPromptSurface>,
78
+ createExecute: (spec: SuiPiToolSpec) => ToolExecuteFn,
79
+ ): void {
80
+ for (const spec of specs) {
81
+ const surface = surfaces[spec.name];
82
+ pi.registerTool({
83
+ name: spec.name,
84
+ label: spec.label,
85
+ description: surface?.description ?? spec.description,
86
+ promptSnippet: surface?.promptSnippet ?? spec.promptSnippet,
87
+ promptGuidelines: surface?.promptGuidelines ?? [...spec.promptGuidelines],
88
+ parameters: spec.parameters,
89
+ execute: createExecute(spec),
90
+ });
91
+ }
92
+ }
93
+
94
+ // ---------------------------------------------------------------------------
95
+ // Shared parameter builders
96
+ // ---------------------------------------------------------------------------
97
+
98
+ /** File path (relative or absolute). */
99
+ export const FileParam = Type.String({ description: "File path (relative or absolute)" });
100
+
101
+ /** 1-based line number. */
102
+ export const LineParam = Type.Number({ description: "1-based line number", minimum: 1 });
103
+
104
+ /** 1-based character column (UTF-16). */
105
+ export const CharacterParam = Type.Number({
106
+ description: "1-based column number (UTF-16)",
107
+ minimum: 1,
108
+ });
109
+
110
+ /** Symbol name for discovery-based resolution. */
111
+ export const SymbolParam = Type.String({
112
+ description: "Symbol name for discovery-based resolution",
113
+ });
114
+
115
+ /** Maximum results to return. */
116
+ export const MaxResultsParam = Type.Number({ description: "Maximum results to return" });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-claude-md",
3
- "version": "1.6.0",
3
+ "version": "1.7.0",
4
4
  "description": "SuPi claude-md extension — automatic subdirectory context injection for pi",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -21,7 +21,7 @@
21
21
  "!__tests__"
22
22
  ],
23
23
  "dependencies": {
24
- "@mrclrchtr/supi-core": "1.6.0"
24
+ "@mrclrchtr/supi-core": "1.7.0"
25
25
  },
26
26
  "bundledDependencies": [
27
27
  "@mrclrchtr/supi-core"
@@ -88,7 +88,7 @@
88
88
 
89
89
  ### 7. Auto-Delivered Overlap (10 points)
90
90
 
91
- Score this criterion after a **context baseline review**: compare the CLAUDE.md against what a SuPi-enabled PI session likely already has from `code_intel brief` and other known injected context.
91
+ Score this criterion after a **context baseline review**: compare the CLAUDE.md against what a SuPi-enabled PI session likely already has from `code_brief` and other known injected context.
92
92
 
93
93
  **10 points**: Almost no overlap. Any overlap is tiny and clearly justified by human-only reasoning.
94
94
 
@@ -100,15 +100,15 @@ Score this criterion after a **context baseline review**: compare the CLAUDE.md
100
100
 
101
101
  **What is NOT overlap:** Gotchas specific to a package's behavior; cross-package patterns that aren't discoverable from manifests; commands and workflows; human-curated "Start Here" guidance with reasoning; concise structure notes that explain boundaries, ownership, initialization order, or important exceptions; and sections classified as **unique** during the baseline review.
102
102
 
103
- **What IS overlap:** Monorepo package tables where every row is `{name, description, path}`; root-level "Modules" or "Packages" sections with >5 entries; the **fully redundant** portion of a section during baseline review; root `## Project structure` / `## Architecture` trees that mostly restate folders, packages, or module layout already visible from `code_intel brief`; high-level architecture overviews that don't add relationships, gotchas, conventions, or exceptions beyond what's in `package.json`; and dependency graphs that could be generated from `pnpm-workspace.yaml`.
103
+ **What IS overlap:** Monorepo package tables where every row is `{name, description, path}`; root-level "Modules" or "Packages" sections with >5 entries; the **fully redundant** portion of a section during baseline review; root `## Project structure` / `## Architecture` trees that mostly restate folders, packages, or module layout already visible from `code_brief`; high-level architecture overviews that don't add relationships, gotchas, conventions, or exceptions beyond what's in `package.json`; and dependency graphs that could be generated from `pnpm-workspace.yaml`.
104
104
 
105
105
  ## Assessment Process
106
106
 
107
107
  1. Read the CLAUDE.md file completely.
108
- 2. If SuPi is active, perform a **context baseline review** first: compare against `code_intel brief` and other known injected context, then classify sections as **fully redundant**, **partially redundant**, or **unique**.
108
+ 2. If SuPi is active, perform a **context baseline review** first: compare against `code_brief` and other known injected context, then classify sections as **fully redundant**, **partially redundant**, or **unique**.
109
109
  3. Cross-reference with the actual codebase: run documented commands (mentally or actually), check that referenced files exist, and verify architecture descriptions.
110
110
  4. Score each criterion, calculate the total, assign the grade, list the specific issues, and propose concrete improvements.
111
111
 
112
112
  ## Red Flags
113
113
 
114
- Watch for commands that would fail (wrong paths, missing deps), references to deleted files or folders, outdated tech versions, template copy without customization, generic advice, stale `TODO` items, duplicate info across multiple CLAUDE.md files, sections that duplicate `code_intel brief` output, and structure sections where the redundant tree/inventory portion should be separated from the unique guidance portion.
114
+ Watch for commands that would fail (wrong paths, missing deps), references to deleted files or folders, outdated tech versions, template copy without customization, generic advice, stale `TODO` items, duplicate info across multiple CLAUDE.md files, sections that duplicate `code_brief` output, and structure sections where the redundant tree/inventory portion should be separated from the unique guidance portion.
@@ -241,7 +241,7 @@ For packages within a monorepo or distinct modules.
241
241
  - <generation/sync pattern>
242
242
  ```
243
243
 
244
- > ⚠️ **When SuPi is active:** The `## Packages` table in this template is auto-generated by `code_intel brief` on the first turn. Consider omitting it or replacing it with `## Start Here` and `## Cross-Package Patterns` sections that capture conventions not visible in manifests.
244
+ > ⚠️ **When SuPi is active:** The `## Packages` table in this template is auto-generated by `code_brief` on the first turn. Consider omitting it or replacing it with `## Start Here` and `## Cross-Package Patterns` sections that capture conventions not visible in manifests.
245
245
 
246
246
  ---
247
247
 
@@ -282,7 +282,7 @@ For projects using SuPi extensions (`code-intelligence`, `claude-md`). Omits sec
282
282
  ```
283
283
 
284
284
  **What's intentionally absent:**
285
- - `## Modules` / `## Packages` — `code_intel brief` generates this
285
+ - `## Modules` / `## Packages` — `code_brief` generates this
286
286
  - Large root `## Project structure` / `## Architecture` directory trees that just restate the workspace layout
287
287
  - `## Dependencies` table — derivable from `package.json`
288
288
 
@@ -71,13 +71,13 @@ When auditing or updating CLAUDE.md in a project using SuPi extensions, these se
71
71
  | `supi-claude-md` | Subdirectory `CLAUDE.md` files wrapped in `<extension-context>` | On `read`/`edit`/`lsp`/`tree_sitter` to subdirectories |
72
72
  | `supi-core` | `findProjectRoot`, `walkProject`, XML `<extension-context>` tagging | Available to all extensions |
73
73
 
74
- **Implication:** A root CLAUDE.md doesn't need to document what `code_intel brief` would say. Focus instead on:
74
+ **Implication:** A root CLAUDE.md doesn't need to document what `code_brief` would say. Focus instead on:
75
75
  - Commands and workflows
76
76
  - Cross-package conventions and patterns
77
77
  - Gotchas that aren't in code
78
78
  - Human-curated guidance ("start here for X")
79
79
 
80
- When SuPi is active, do a quick baseline review first: compare the CLAUDE.md against `code_intel brief` and other known injected context, then separate each section into overlap vs unique value. If a root `## Project structure` / `## Architecture` section mostly restates the workspace tree, treat that portion as redundant and keep only the orientation, boundary rules, or exceptions that the generated overview cannot supply.
80
+ When SuPi is active, do a quick baseline review first: compare the CLAUDE.md against `code_brief` and other known injected context, then separate each section into overlap vs unique value. If a root `## Project structure` / `## Architecture` section mostly restates the workspace tree, treat that portion as redundant and keep only the orientation, boundary rules, or exceptions that the generated overview cannot supply.
81
81
 
82
82
  ## What NOT to Add
83
83
 
@@ -180,7 +180,7 @@ Bad:
180
180
  - `api` depends on `db`, `auth`
181
181
  - `web` depends on `api`
182
182
 
183
- Better: Skip — `code_intel brief` shows this live.
183
+ Better: Skip — `code_brief` shows this live.
184
184
  ```
185
185
 
186
186
  **Partially redundant: Root project structure section with both overlap and unique value**
@@ -88,7 +88,7 @@
88
88
 
89
89
  ### 7. Auto-Delivered Overlap (10 points)
90
90
 
91
- Score this criterion after a **context baseline review**: compare the CLAUDE.md against what a SuPi-enabled PI session likely already has from `code_intel brief` and other known injected context.
91
+ Score this criterion after a **context baseline review**: compare the CLAUDE.md against what a SuPi-enabled PI session likely already has from `code_brief` and other known injected context.
92
92
 
93
93
  **10 points**: Almost no overlap. Any overlap is tiny and clearly justified by human-only reasoning.
94
94
 
@@ -100,15 +100,15 @@ Score this criterion after a **context baseline review**: compare the CLAUDE.md
100
100
 
101
101
  **What is NOT overlap:** Gotchas specific to a package's behavior; cross-package patterns that aren't discoverable from manifests; commands and workflows; human-curated "Start Here" guidance with reasoning; concise structure notes that explain boundaries, ownership, initialization order, or important exceptions; and sections classified as **unique** during the baseline review.
102
102
 
103
- **What IS overlap:** Monorepo package tables where every row is `{name, description, path}`; root-level "Modules" or "Packages" sections with >5 entries; the **fully redundant** portion of a section during baseline review; root `## Project structure` / `## Architecture` trees that mostly restate folders, packages, or module layout already visible from `code_intel brief`; high-level architecture overviews that don't add relationships, gotchas, conventions, or exceptions beyond what's in `package.json`; and dependency graphs that could be generated from `pnpm-workspace.yaml`.
103
+ **What IS overlap:** Monorepo package tables where every row is `{name, description, path}`; root-level "Modules" or "Packages" sections with >5 entries; the **fully redundant** portion of a section during baseline review; root `## Project structure` / `## Architecture` trees that mostly restate folders, packages, or module layout already visible from `code_brief`; high-level architecture overviews that don't add relationships, gotchas, conventions, or exceptions beyond what's in `package.json`; and dependency graphs that could be generated from `pnpm-workspace.yaml`.
104
104
 
105
105
  ## Assessment Process
106
106
 
107
107
  1. Read the CLAUDE.md file completely.
108
- 2. If SuPi is active, perform a **context baseline review** first: compare against `code_intel brief` and other known injected context, then classify sections as **fully redundant**, **partially redundant**, or **unique**.
108
+ 2. If SuPi is active, perform a **context baseline review** first: compare against `code_brief` and other known injected context, then classify sections as **fully redundant**, **partially redundant**, or **unique**.
109
109
  3. Cross-reference with the actual codebase: run documented commands (mentally or actually), check that referenced files exist, and verify architecture descriptions.
110
110
  4. Score each criterion, calculate the total, assign the grade, list the specific issues, and propose concrete improvements.
111
111
 
112
112
  ## Red Flags
113
113
 
114
- Watch for commands that would fail (wrong paths, missing deps), references to deleted files or folders, outdated tech versions, template copy without customization, generic advice, stale `TODO` items, duplicate info across multiple CLAUDE.md files, sections that duplicate `code_intel brief` output, and structure sections where the redundant tree/inventory portion should be separated from the unique guidance portion.
114
+ Watch for commands that would fail (wrong paths, missing deps), references to deleted files or folders, outdated tech versions, template copy without customization, generic advice, stale `TODO` items, duplicate info across multiple CLAUDE.md files, sections that duplicate `code_brief` output, and structure sections where the redundant tree/inventory portion should be separated from the unique guidance portion.
@@ -241,7 +241,7 @@ For packages within a monorepo or distinct modules.
241
241
  - <generation/sync pattern>
242
242
  ```
243
243
 
244
- > ⚠️ **When SuPi is active:** The `## Packages` table in this template is auto-generated by `code_intel brief` on the first turn. Consider omitting it or replacing it with `## Start Here` and `## Cross-Package Patterns` sections that capture conventions not visible in manifests.
244
+ > ⚠️ **When SuPi is active:** The `## Packages` table in this template is auto-generated by `code_brief` on the first turn. Consider omitting it or replacing it with `## Start Here` and `## Cross-Package Patterns` sections that capture conventions not visible in manifests.
245
245
 
246
246
  ---
247
247
 
@@ -282,7 +282,7 @@ For projects using SuPi extensions (`code-intelligence`, `claude-md`). Omits sec
282
282
  ```
283
283
 
284
284
  **What's intentionally absent:**
285
- - `## Modules` / `## Packages` — `code_intel brief` generates this
285
+ - `## Modules` / `## Packages` — `code_brief` generates this
286
286
  - Large root `## Project structure` / `## Architecture` directory trees that just restate the workspace layout
287
287
  - `## Dependencies` table — derivable from `package.json`
288
288
 
@@ -71,13 +71,13 @@ When auditing or updating CLAUDE.md in a project using SuPi extensions, these se
71
71
  | `supi-claude-md` | Subdirectory `CLAUDE.md` files wrapped in `<extension-context>` | On `read`/`edit`/`lsp`/`tree_sitter` to subdirectories |
72
72
  | `supi-core` | `findProjectRoot`, `walkProject`, XML `<extension-context>` tagging | Available to all extensions |
73
73
 
74
- **Implication:** A root CLAUDE.md doesn't need to document what `code_intel brief` would say. Focus instead on:
74
+ **Implication:** A root CLAUDE.md doesn't need to document what `code_brief` would say. Focus instead on:
75
75
  - Commands and workflows
76
76
  - Cross-package conventions and patterns
77
77
  - Gotchas that aren't in code
78
78
  - Human-curated guidance ("start here for X")
79
79
 
80
- When SuPi is active, do a quick baseline review first: compare the CLAUDE.md against `code_intel brief` and other known injected context, then separate each section into overlap vs unique value. If a root `## Project structure` / `## Architecture` section mostly restates the workspace tree, treat that portion as redundant and keep only the orientation, boundary rules, or exceptions that the generated overview cannot supply.
80
+ When SuPi is active, do a quick baseline review first: compare the CLAUDE.md against `code_brief` and other known injected context, then separate each section into overlap vs unique value. If a root `## Project structure` / `## Architecture` section mostly restates the workspace tree, treat that portion as redundant and keep only the orientation, boundary rules, or exceptions that the generated overview cannot supply.
81
81
 
82
82
  ## What NOT to Add
83
83
 
@@ -180,7 +180,7 @@ Bad:
180
180
  - `api` depends on `db`, `auth`
181
181
  - `web` depends on `api`
182
182
 
183
- Better: Skip — `code_intel brief` shows this live.
183
+ Better: Skip — `code_brief` shows this live.
184
184
  ```
185
185
 
186
186
  **Partially redundant: Root project structure section with both overlap and unique value**