@mrclrchtr/supi-tree-sitter 4.7.0 → 4.9.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.
Files changed (67) hide show
  1. package/node_modules/@mrclrchtr/supi-code-runtime/README.md +1 -1
  2. package/node_modules/@mrclrchtr/supi-code-runtime/package.json +1 -15
  3. package/node_modules/@mrclrchtr/supi-code-runtime/src/api.ts +1 -6
  4. package/node_modules/@mrclrchtr/supi-core/README.md +29 -35
  5. package/node_modules/@mrclrchtr/supi-core/package.json +4 -7
  6. package/node_modules/@mrclrchtr/supi-core/src/api.ts +4 -6
  7. package/node_modules/@mrclrchtr/supi-core/src/config/config.ts +0 -20
  8. package/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +7 -1
  9. package/node_modules/@mrclrchtr/supi-core/src/config.ts +0 -1
  10. package/node_modules/@mrclrchtr/supi-core/src/context.ts +1 -9
  11. package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +8 -0
  12. package/node_modules/@mrclrchtr/supi-core/src/debug-timing.ts +107 -0
  13. package/node_modules/@mrclrchtr/supi-core/src/index.ts +4 -6
  14. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +54 -28
  15. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +91 -125
  16. package/node_modules/@mrclrchtr/supi-core/src/settings.ts +10 -7
  17. package/package.json +3 -3
  18. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +0 -120
  19. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +0 -75
  20. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/api.ts +0 -42
  21. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config.ts +0 -221
  22. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/prompt-surface.ts +0 -357
  23. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +0 -11
  24. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context/context-messages.ts +0 -119
  25. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context/context-provider-registry.ts +0 -36
  26. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context/context-tag.ts +0 -31
  27. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/context.ts +0 -16
  28. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -287
  29. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/evidence-badge.ts +0 -41
  30. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/footer-registry.ts +0 -57
  31. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/index.ts +0 -36
  32. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/llm.ts +0 -201
  33. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/model-selection.ts +0 -134
  34. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/path-utils.ts +0 -44
  35. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/path.ts +0 -2
  36. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/progress-widget.ts +0 -189
  37. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/project-roots.ts +0 -170
  38. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/project.ts +0 -15
  39. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/prompt-surface.ts +0 -4
  40. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/registry-utils.ts +0 -93
  41. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/report.ts +0 -121
  42. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/session-utils.ts +0 -71
  43. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/session.ts +0 -8
  44. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +0 -373
  45. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +0 -102
  46. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +0 -15
  47. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +0 -76
  48. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +0 -487
  49. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +0 -141
  50. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +0 -118
  51. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +0 -3
  52. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +0 -33
  53. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/spinner-frames.ts +0 -11
  54. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/status-spinner.ts +0 -68
  55. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/terminal.ts +0 -60
  56. package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +0 -192
  57. package/node_modules/@mrclrchtr/supi-code-runtime/src/index.ts +0 -42
  58. package/node_modules/@mrclrchtr/supi-code-runtime/src/workspace/context.ts +0 -45
  59. package/node_modules/@mrclrchtr/supi-core/src/context/context-messages.ts +0 -119
  60. package/node_modules/@mrclrchtr/supi-core/src/progress-widget.ts +0 -189
  61. package/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +0 -373
  62. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +0 -102
  63. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-command.ts +0 -15
  64. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +0 -141
  65. package/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +0 -118
  66. package/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +0 -3
  67. package/node_modules/@mrclrchtr/supi-core/src/tool-framework.ts +0 -192
@@ -1,26 +1,19 @@
1
- // Declarative settings schema for SuPi extensions.
1
+ // Fixed SuPi-config adapter for the canonical settings module interface.
2
2
  //
3
- // Replaces the imperative config-backed buildItems/persistChange contribution
4
- // with a declarative field descriptor model. The shared settings module owns
5
- // scope inheritance, source-state resolution, value rendering, persistence,
6
- // and Inherit/Reset-to-default actions.
3
+ // Declarative field descriptors let the adapter own scope inheritance,
4
+ // source-state resolution, value rendering, persistence, and Unset actions.
7
5
  //
8
6
  // Custom fields remain for nested or unusual config; they report the same
9
7
  // source state as declarative flat fields.
10
8
 
11
- import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
9
+ import type { ExtensionContext } from "@earendil-works/pi-coding-agent";
12
10
  import type { Component } from "@earendil-works/pi-tui";
13
11
  import {
14
12
  loadSupiConfigSectionForScope,
15
13
  removeSupiConfigKey,
16
14
  writeSupiConfig,
17
15
  } from "../config/config.ts";
18
- import {
19
- isSettingsContributionCollector,
20
- type SettingsScope,
21
- type SettingsSection,
22
- SUPI_SETTINGS_COLLECT_EVENT,
23
- } from "./settings-registry.ts";
16
+ import type { SettingsApplyResult, SettingsModule, SettingsScope } from "./settings-registry.ts";
24
17
 
25
18
  // ── Types ──────────────────────────────────────────────────────────────────
26
19
 
@@ -52,10 +45,7 @@ export interface ConfigHelpers {
52
45
  // ── Field actions ─────────────────────────────────────────────────────────
53
46
 
54
47
  /** A user-initiated action on a settings row. */
55
- export type SettingsFieldAction =
56
- | { kind: "set"; value: string }
57
- | { kind: "inherit" }
58
- | { kind: "resetToDefault" };
48
+ export type SettingsAction = { kind: "set"; value: string } | { kind: "unset" };
59
49
 
60
50
  // ── Field descriptors ─────────────────────────────────────────────────────
61
51
 
@@ -153,15 +143,15 @@ export interface CustomField extends BaseField {
153
143
  ctx?: ExtensionContext,
154
144
  ) => Component;
155
145
  /**
156
- * Persist handler called on set/inherit/resetToDefault actions.
146
+ * Persist handler called on set or unset actions.
157
147
  * Required for custom fields so they can write their nested config.
158
148
  */
159
149
  persist: (
160
150
  scope: SettingsScope,
161
151
  cwd: string,
162
- action: SettingsFieldAction,
152
+ action: SettingsAction,
163
153
  helpers: ConfigHelpers,
164
- ) => void;
154
+ ) => void | Promise<void>;
165
155
  }
166
156
 
167
157
  /** Union of all supported field kinds. */
@@ -176,8 +166,8 @@ export type SettingsField =
176
166
 
177
167
  // ── Contribution options ──────────────────────────────────────────────────
178
168
 
179
- /** Options for registerDeclarativeSettings. */
180
- export interface DeclarativeSettingsOptions {
169
+ /** Options for the fixed SuPi-config settings adapter. */
170
+ export interface ConfigSettingsOptions {
181
171
  /** Stable contribution identifier — e.g. "lsp", "claude-md". */
182
172
  id: string;
183
173
  /** Human-readable label shown in the UI. */
@@ -194,7 +184,7 @@ export interface DeclarativeSettingsOptions {
194
184
  homeDir?: string;
195
185
  }
196
186
 
197
- // ── Scoped section interface ─────────────────────────────────────────────
187
+ // ── Source-aware row interface ───────────────────────────────────────────
198
188
 
199
189
  /** Resolved value for one field in one scope. */
200
190
  export interface ScopedFieldValue {
@@ -305,14 +295,14 @@ function createConfigHelpers(
305
295
  };
306
296
  }
307
297
 
308
- // ── Scoped section factory ────────────────────────────────────────────────
298
+ // ── Fixed config adapter ─────────────────────────────────────────────────
309
299
 
310
300
  interface NotifyAfterPersistInput {
311
- options: DeclarativeSettingsOptions;
301
+ options: ConfigSettingsOptions;
312
302
  field: SettingsField;
313
303
  scope: SettingsScope;
314
304
  cwd: string;
315
- action: SettingsFieldAction;
305
+ action: SettingsAction;
316
306
  storedValue: unknown;
317
307
  ctx?: ExtensionContext;
318
308
  }
@@ -354,86 +344,86 @@ function notifyAfterPersist(input: NotifyAfterPersistInput): void {
354
344
  options.afterPersist(change);
355
345
  }
356
346
 
357
- function toDeclarativeSection(options: DeclarativeSettingsOptions): SettingsSection {
347
+ function resolveConfigRows(
348
+ options: ConfigSettingsOptions,
349
+ scope: SettingsScope,
350
+ cwd: string,
351
+ ctx?: ExtensionContext,
352
+ ): ScopedFieldValue[] {
358
353
  const defaults = options.defaults as Record<string, unknown>;
354
+ const projectRaw = loadSupiConfigSectionForScope(options.section, cwd, {
355
+ scope: "project",
356
+ homeDir: options.homeDir,
357
+ });
358
+ const globalRaw = loadSupiConfigSectionForScope(options.section, cwd, {
359
+ scope: "global",
360
+ homeDir: options.homeDir,
361
+ });
362
+
363
+ return options.fields.map((field) => {
364
+ if (field.kind === "custom") {
365
+ const resolved = field.resolve(scope, cwd, ctx);
366
+ return {
367
+ field,
368
+ displayValue: resolved.displayValue
369
+ ? sourceBadge(resolved.displayValue, resolved.source)
370
+ : "",
371
+ editValue: resolved.editValue ?? resolved.displayValue,
372
+ source: resolved.source,
373
+ inheritanceSource: resolved.inheritanceSource,
374
+ };
375
+ }
376
+
377
+ const { value, source } = resolveValue(field.key, defaults, projectRaw, globalRaw, scope);
378
+ const displayValue = formatValue(value, field);
379
+ const inheritanceSource =
380
+ scope === "project" && source === "project"
381
+ ? globalRaw && field.key in globalRaw
382
+ ? "global"
383
+ : "default"
384
+ : undefined;
385
+
386
+ return {
387
+ field,
388
+ displayValue: sourceBadge(displayValue, source),
389
+ editValue: formatEditValue(value, field),
390
+ source,
391
+ inheritanceSource,
392
+ };
393
+ });
394
+ }
395
+
396
+ async function applyConfigAction(
397
+ options: ConfigSettingsOptions,
398
+ request: Parameters<SettingsModule["apply"]>[0],
399
+ ): Promise<SettingsApplyResult> {
400
+ const { scope, cwd, fieldKey, action, ctx } = request;
401
+ const field = options.fields.find((candidate) => candidate.key === fieldKey);
402
+ if (!field) return {};
403
+
404
+ const helpers = createConfigHelpers(options.section, scope, cwd, options.homeDir);
405
+ let storedValue: unknown;
406
+ if (field.kind === "custom") {
407
+ await field.persist(scope, cwd, action, helpers);
408
+ storedValue = action.kind === "set" ? action.value : undefined;
409
+ } else if (action.kind === "set") {
410
+ storedValue = parseTypedValue(action.value, field);
411
+ helpers.set(field.key, storedValue);
412
+ } else {
413
+ helpers.unset(field.key);
414
+ }
415
+ notifyAfterPersist({ options, field, scope, cwd, action, storedValue, ctx });
416
+ return {};
417
+ }
418
+
419
+ /** Adapt one fixed SuPi config section to the canonical settings interface. */
420
+ export function defineConfigSettings(options: ConfigSettingsOptions): SettingsModule {
359
421
  return {
360
422
  id: options.id,
361
423
  label: options.label,
362
- loadValues: (scope, cwd, ctx) => {
363
- // Load raw section data for both scopes (no defaults)
364
- const projectRaw = loadSupiConfigSectionForScope(options.section, cwd, {
365
- scope: "project",
366
- homeDir: options.homeDir,
367
- });
368
- const globalRaw = loadSupiConfigSectionForScope(options.section, cwd, {
369
- scope: "global",
370
- homeDir: options.homeDir,
371
- });
372
-
373
- // biome-ignore lint/complexity/noExcessiveCognitiveComplexity: natural discriminator on field kind and source
374
- return options.fields.map((field) => {
375
- if (field.kind === "custom") {
376
- const resolved = field.resolve(scope, cwd, ctx);
377
- return {
378
- field,
379
- displayValue: resolved.displayValue
380
- ? sourceBadge(resolved.displayValue, resolved.source)
381
- : "",
382
- editValue: resolved.editValue ?? resolved.displayValue,
383
- source: resolved.source,
384
- inheritanceSource: resolved.inheritanceSource,
385
- };
386
- }
387
-
388
- const { value, source } = resolveValue(field.key, defaults, projectRaw, globalRaw, scope);
389
- const displayValue = formatValue(value, field);
390
-
391
- // Compute inheritanceSource for project-scope overrides
392
- let inheritanceSource: "global" | "default" | undefined;
393
- if (scope === "project" && source === "project") {
394
- inheritanceSource = globalRaw && field.key in globalRaw ? "global" : "default";
395
- }
396
-
397
- return {
398
- field,
399
- displayValue: sourceBadge(displayValue, source),
400
- editValue: formatEditValue(value, field),
401
- source,
402
- inheritanceSource,
403
- };
404
- });
405
- },
406
- // biome-ignore lint/complexity/useMaxParams: SettingsSection action handlers receive scope, cwd, field, action, and optional context
407
- handleAction: (scope, cwd, fieldKey, action, ctx) => {
408
- const field = options.fields.find((f) => f.key === fieldKey);
409
- if (!field) return;
410
-
411
- const section = options.section;
412
- const helpers = createConfigHelpers(section, scope, cwd, options.homeDir);
413
- let storedValue: unknown;
414
-
415
- if (field.kind === "custom") {
416
- field.persist(scope, cwd, action, helpers);
417
- storedValue = action.kind === "set" ? action.value : undefined;
418
- notifyAfterPersist({ options, field, scope, cwd, action, storedValue, ctx });
419
- return;
420
- }
421
-
422
- switch (action.kind) {
423
- case "set": {
424
- storedValue = parseTypedValue(action.value, field);
425
- helpers.set(field.key, storedValue);
426
- break;
427
- }
428
- case "inherit":
429
- case "resetToDefault": {
430
- helpers.unset(field.key);
431
- break;
432
- }
433
- }
434
-
435
- notifyAfterPersist({ options, field, scope, cwd, action, storedValue, ctx });
436
- },
424
+ read: ({ scope, cwd, ctx }) =>
425
+ Promise.resolve({ rows: resolveConfigRows(options, scope, cwd, ctx) }),
426
+ apply: (request) => applyConfigAction(options, request),
437
427
  };
438
428
  }
439
429
 
@@ -461,27 +451,3 @@ export function parseTypedValue(value: string, field: SettingsField): unknown {
461
451
  return value;
462
452
  }
463
453
  }
464
-
465
- // ── Registration ──────────────────────────────────────────────────────────
466
-
467
- /**
468
- * Register a declarative settings contribution for `/supi-settings`.
469
- *
470
- * Contributions are collected through PI's process-local event bus. Call this
471
- * during the extension factory function, not in async session handlers.
472
- */
473
- export function registerDeclarativeSettings(
474
- pi: ExtensionAPI,
475
- options: DeclarativeSettingsOptions,
476
- ): void {
477
- const section = toDeclarativeSection(options);
478
- const dispose = pi.events.on(SUPI_SETTINGS_COLLECT_EVENT, (collector) => {
479
- if (isSettingsContributionCollector(collector)) {
480
- collector.add(section);
481
- }
482
- });
483
-
484
- pi.on("session_shutdown", () => {
485
- dispose();
486
- });
487
- }
@@ -1,33 +1,36 @@
1
- // supi-core settings domain — event-backed declarative settings contributions and command wiring.
2
-
3
- export { registerSettingsCommand } from "./settings/settings-command.ts";
1
+ // supi-core settings domain — settings modules and fixed-config adapters.
4
2
  export type {
3
+ SettingsActionRequest,
4
+ SettingsApplyResult,
5
5
  SettingsCollectionDiagnostic,
6
6
  SettingsCollectionResult,
7
+ SettingsContext,
7
8
  SettingsContributionCollector,
9
+ SettingsModule,
8
10
  SettingsScope,
9
- SettingsSection,
11
+ SettingsSnapshot,
10
12
  } from "./settings/settings-registry.ts";
11
13
  export {
12
14
  createSettingsContributionCollector,
13
15
  isSettingsContributionCollector,
16
+ registerSettings,
14
17
  SUPI_SETTINGS_COLLECT_EVENT,
15
18
  } from "./settings/settings-registry.ts";
16
19
  export type {
17
20
  BoolField,
18
21
  ConfigHelpers,
22
+ ConfigSettingsOptions,
19
23
  CustomField,
20
- DeclarativeSettingsOptions,
21
24
  EnumField,
22
25
  ModelPickerField,
23
26
  ModelPickerStaticOption,
24
27
  NumberField,
25
28
  ScopedFieldValue,
29
+ SettingsAction,
26
30
  SettingsField,
27
- SettingsFieldAction,
28
31
  SettingsPersistedChange,
29
32
  StringField,
30
33
  StringListField,
31
34
  ValueSource,
32
35
  } from "./settings/settings-schema.ts";
33
- export { registerDeclarativeSettings } from "./settings/settings-schema.ts";
36
+ export { defineConfigSettings } from "./settings/settings-schema.ts";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mrclrchtr/supi-tree-sitter",
3
- "version": "4.7.0",
3
+ "version": "4.9.0",
4
4
  "description": "Structural AST analysis for SuPi code intelligence",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -34,8 +34,8 @@
34
34
  ],
35
35
  "dependencies": {
36
36
  "web-tree-sitter": "^0.26.8",
37
- "@mrclrchtr/supi-code-runtime": "4.7.0",
38
- "@mrclrchtr/supi-core": "4.7.0"
37
+ "@mrclrchtr/supi-code-runtime": "4.9.0",
38
+ "@mrclrchtr/supi-core": "4.9.0"
39
39
  },
40
40
  "bundledDependencies": [
41
41
  "@mrclrchtr/supi-code-runtime",
@@ -1,120 +0,0 @@
1
- <div align="center">
2
- <a href="https://github.com/mrclrchtr/supi/tree/main/packages/supi-core">
3
- <img src="https://raw.githubusercontent.com/mrclrchtr/supi/main/packages/supi-core/assets/social-preview.png" alt="SuPi Core" width="100%">
4
- </a>
5
- </div>
6
-
7
- # @mrclrchtr/supi-core
8
-
9
- Shared infrastructure for SuPi extensions.
10
-
11
- This is a **pure library** — it does not register any pi commands or tools. The `/supi-settings` command is now available through `@mrclrchtr/supi-settings`.
12
-
13
- ## Install
14
-
15
- ```bash
16
- pnpm add @mrclrchtr/supi-core
17
- ```
18
-
19
- ## Package surfaces
20
-
21
- - `@mrclrchtr/supi-core/api` — reusable helpers for other packages and extensions
22
- - `@mrclrchtr/supi-core/report` — shared text/report rendering helpers for TUI and plain-text summaries
23
-
24
- ## What you get from the API
25
-
26
- ### Config helpers
27
-
28
- - `loadSupiConfig()` — merged config with resolution order `defaults <- global <- project`
29
- - `loadSupiConfigForScope()` — load one scope at a time for settings UIs
30
- - `writeSupiConfig()` — persist values
31
- - `removeSupiConfigKey()` — remove a key or override
32
-
33
- Config file locations:
34
-
35
- - global: `~/.pi/agent/supi/config.json`
36
- - project: `.pi/supi/config.json`
37
-
38
- ### Settings helpers
39
-
40
- - `registerDeclarativeSettings(pi, options)` — contribute a config-backed declarative settings section with source-aware scoped persistence
41
- - `registerSettingsCommand(pi)` — register `/supi-settings` (used by `@mrclrchtr/supi-settings`)
42
- - `openSettingsOverlay(pi, ctx)` — open the shared settings UI directly
43
- - `createInputSubmenu()` — helper for simple text-entry submenus
44
- - `createModelPickerSubmenu()` — helper for scoped model selection submenus, with optional host-owned choices and `disabled` control
45
-
46
- The built-in settings UI supports:
47
-
48
- - project/global scope toggle
49
- - source badges for project, global, and default values
50
- - Inherit/Reset actions that delete scoped config keys
51
- - grouped extension sections
52
- - searchable setting lists
53
-
54
- ### Context helpers
55
-
56
- - `wrapExtensionContext()` — wrap injected text in SuPi's `<extension-context>` tag
57
- - `findLastUserMessageIndex()`
58
- - `getContextToken()`
59
- - `getPromptContent()`
60
- - `pruneAndReorderContextMessages()`
61
- - `restorePromptContent()`
62
-
63
- ### Shared registries
64
-
65
- - context-provider registry for `/supi-context`
66
- - debug-event registry for producers that want shared debug capture
67
- - settings registry used by `/supi-settings`
68
-
69
- ### Project and session helpers
70
-
71
- - project-root detection and directory walking helpers such as `findProjectRoot()` and `walkProject()`
72
- - active-branch session helper: `getActiveBranchEntries()`
73
- - terminal helpers such as `formatTitle()`, `signalWaiting()`, and `signalDone()`
74
-
75
- ### Report helpers
76
-
77
- - `clampReportWidth()` — enforce a minimum readable report width
78
- - `formatReportTitle()` / `formatSectionHeader()` — shared themed headers
79
- - `formatDimLine()` / `formatKeyValueLine()` — common summary rows
80
- - `formatOverflowHint()` — consistent preview-overflow hints
81
- - `wrapReportText()` — ANSI-aware wrapped report blocks with optional indentation
82
-
83
- ## Example
84
-
85
- ```ts
86
- import type { ExtensionAPI } from "@earendil-works/pi-coding-agent";
87
- import { loadSupiConfig, registerDeclarativeSettings, wrapExtensionContext } from "@mrclrchtr/supi-core/api";
88
-
89
- export default function myExtension(pi: ExtensionAPI) {
90
- const defaults = { enabled: true };
91
- const config = loadSupiConfig("my-extension", process.cwd(), defaults);
92
-
93
- registerDeclarativeSettings(pi, {
94
- id: "my-extension",
95
- label: "My Extension",
96
- section: "my-extension",
97
- defaults,
98
- fields: [
99
- {
100
- kind: "boolean" as const,
101
- key: "enabled",
102
- label: "Enabled",
103
- },
104
- ],
105
- });
106
-
107
- const message = wrapExtensionContext("my-extension", "hello", {
108
- enabled: config.enabled,
109
- });
110
- void message;
111
- }
112
- ```
113
-
114
- ## Source
115
-
116
- - `src/api.ts` — exported library surface
117
- - `src/config.ts` — shared config loading and writing
118
- - `src/config-settings.ts` — config-backed settings registration helper
119
- - `src/settings-ui.ts` — shared settings overlay
120
- - `src/report.ts` — shared text/report rendering helpers
@@ -1,75 +0,0 @@
1
- {
2
- "name": "@mrclrchtr/supi-core",
3
- "version": "4.7.0",
4
- "description": "Shared settings, configuration, reporting, and session infrastructure",
5
- "license": "MIT",
6
- "repository": {
7
- "type": "git",
8
- "url": "git+https://github.com/mrclrchtr/supi.git",
9
- "directory": "packages/supi-core"
10
- },
11
- "homepage": "https://github.com/mrclrchtr/supi/tree/main/packages/supi-core#readme",
12
- "bugs": {
13
- "url": "https://github.com/mrclrchtr/supi/issues"
14
- },
15
- "publishConfig": {
16
- "access": "public"
17
- },
18
- "keywords": [
19
- "pi",
20
- "pi-coding-agent",
21
- "supi",
22
- "extension-utils",
23
- "settings",
24
- "configuration"
25
- ],
26
- "type": "module",
27
- "files": [
28
- "src/**/*.ts",
29
- "!__tests__"
30
- ],
31
- "peerDependencies": {
32
- "@earendil-works/pi-ai": "*",
33
- "@earendil-works/pi-coding-agent": "*",
34
- "@earendil-works/pi-tui": "*",
35
- "typebox": "*"
36
- },
37
- "peerDependenciesMeta": {
38
- "@earendil-works/pi-ai": {
39
- "optional": true
40
- },
41
- "@earendil-works/pi-coding-agent": {
42
- "optional": true
43
- },
44
- "@earendil-works/pi-tui": {
45
- "optional": true
46
- },
47
- "typebox": {
48
- "optional": true
49
- }
50
- },
51
- "main": "src/api.ts",
52
- "exports": {
53
- "./api": "./src/api.ts",
54
- "./config": "./src/config.ts",
55
- "./context": "./src/context.ts",
56
- "./debug": "./src/debug-registry.ts",
57
- "./evidence-badge": "./src/evidence-badge.ts",
58
- "./footer-registry": "./src/footer-registry.ts",
59
- "./llm": "./src/llm.ts",
60
- "./model-selection": "./src/model-selection.ts",
61
- "./package.json": "./package.json",
62
- "./path": "./src/path.ts",
63
- "./report": "./src/report.ts",
64
- "./progress-widget": "./src/progress-widget.ts",
65
- "./project": "./src/project.ts",
66
- "./session": "./src/session.ts",
67
- "./settings": "./src/settings.ts",
68
- "./settings-ui": "./src/settings-ui.ts",
69
- "./spinner-frames": "./src/spinner-frames.ts",
70
- "./status-spinner": "./src/status-spinner.ts",
71
- "./terminal": "./src/terminal.ts",
72
- "./tool-framework": "./src/tool-framework.ts",
73
- "./prompt-surface": "./src/prompt-surface.ts"
74
- }
75
- }
@@ -1,42 +0,0 @@
1
- // supi-core — shared infrastructure for SuPi extensions.
2
- // Provides XML context tag wrapping, unified config system, context-message utilities,
3
- // settings registry for supi-wide TUI settings, and a shared tool-spec/registration framework.
4
- //
5
- // Convenience barrel — re-exports all domain entry points.
6
- // For lighter imports, use one of the domain subpaths directly
7
- // (e.g. @mrclrchtr/supi-core/config, @mrclrchtr/supi-core/context).
8
-
9
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
10
- export * from "./config.ts";
11
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
12
- export * from "./context.ts";
13
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
14
- export * from "./debug-registry.ts";
15
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
16
- export * from "./evidence-badge.ts";
17
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
18
- export * from "./footer-registry.ts";
19
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
20
- export * from "./llm.ts";
21
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
22
- export * from "./model-selection.ts";
23
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
24
- export * from "./path.ts";
25
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
26
- export * from "./project.ts";
27
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
28
- export * from "./report.ts";
29
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
30
- export * from "./session.ts";
31
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
32
- export * from "./settings.ts";
33
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
34
- export * from "./settings-ui.ts";
35
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
36
- export * from "./spinner-frames.ts";
37
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
38
- export * from "./status-spinner.ts";
39
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
40
- export * from "./terminal.ts";
41
- // biome-ignore lint/performance/noReExportAll: intentional convenience barrel
42
- export * from "./tool-framework.ts";