@mrclrchtr/supi-code-intelligence 2.1.0 → 2.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 +17 -3
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +9 -8
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +13 -7
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +50 -309
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +17 -1
- package/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-core/README.md +9 -8
- package/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +13 -7
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +50 -309
- package/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-core/src/settings.ts +17 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +9 -8
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +13 -7
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +50 -309
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +17 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/README.md +9 -8
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +13 -7
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +50 -309
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/settings.ts +17 -1
- package/node_modules/@mrclrchtr/supi-lsp/package.json +3 -3
- package/node_modules/@mrclrchtr/supi-lsp/src/client/client.ts +49 -12
- package/node_modules/@mrclrchtr/supi-lsp/src/config/lsp-settings.ts +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/README.md +9 -8
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +13 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +50 -309
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/settings.ts +17 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/package.json +2 -2
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/README.md +9 -8
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/package.json +1 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config.ts +2 -3
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/debug-registry.ts +0 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/scoped-settings-list.ts +372 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-action-menu.ts +101 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-registry.ts +13 -7
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-schema.ts +464 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-submenus.ts +124 -0
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings/settings-ui.ts +50 -309
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings-ui.ts +2 -5
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings.ts +17 -1
- package/node_modules/@mrclrchtr/supi-tree-sitter/package.json +3 -3
- package/package.json +5 -5
- package/src/analysis/instruction-files.ts +194 -0
- package/src/app/app.ts +6 -1
- package/src/config.ts +42 -0
- package/src/extension.ts +27 -0
- package/src/session/session.ts +67 -0
- package/src/substrate/lsp/diagnostic-injection.ts +0 -15
- package/src/substrate/lsp/settings.ts +101 -179
- package/src/tool/guidance.ts +27 -38
- package/src/tool/orientation/mode.ts +53 -2
- package/src/tool/result/types.ts +3 -0
- package/src/tool/schemas.ts +22 -32
- package/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -207
- package/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -207
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -207
- package/node_modules/@mrclrchtr/supi-lsp/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -207
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-code-runtime/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -207
- package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/config/config-settings.ts +0 -207
|
@@ -1,79 +1,21 @@
|
|
|
1
|
-
//
|
|
1
|
+
// Declarative settings overlay for SuPi extensions.
|
|
2
2
|
//
|
|
3
|
-
//
|
|
4
|
-
//
|
|
3
|
+
// Thin orchestration layer that collects settings contributions and opens the
|
|
4
|
+
// scoped settings list inside a pi-tui custom component overlay.
|
|
5
5
|
|
|
6
6
|
import type { ExtensionAPI, ExtensionContext } from "@earendil-works/pi-coding-agent";
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
|
|
10
|
-
Input,
|
|
11
|
-
Key,
|
|
12
|
-
matchesKey,
|
|
13
|
-
type SelectItem,
|
|
14
|
-
SelectList,
|
|
15
|
-
type SelectListTheme,
|
|
16
|
-
type SettingItem,
|
|
17
|
-
SettingsList,
|
|
18
|
-
Text,
|
|
19
|
-
} from "@earendil-works/pi-tui";
|
|
20
|
-
import { getSelectableModels } from "../model-selection.ts";
|
|
7
|
+
import { Container, Key, matchesKey, Text } from "@earendil-works/pi-tui";
|
|
8
|
+
import { ScopedSettingsList } from "./scoped-settings-list.ts";
|
|
9
|
+
import type { SettingsCollectionDiagnostic, SettingsScope } from "./settings-registry.ts";
|
|
21
10
|
import {
|
|
22
11
|
createSettingsContributionCollector,
|
|
23
|
-
type SettingsCollectionDiagnostic,
|
|
24
|
-
type SettingsScope,
|
|
25
|
-
type SettingsSection,
|
|
26
12
|
SUPI_SETTINGS_COLLECT_EVENT,
|
|
27
13
|
} from "./settings-registry.ts";
|
|
28
14
|
|
|
29
|
-
//
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Creates a pi-tui Input-backed submenu component with enter-to-confirm
|
|
33
|
-
* and escape-to-cancel handling.
|
|
34
|
-
*
|
|
35
|
-
* @param currentValue - Initial value for the text input.
|
|
36
|
-
* @param label - Label text displayed above the input.
|
|
37
|
-
* @param done - Callback invoked with the confirmed value, or undefined on cancel.
|
|
38
|
-
*/
|
|
39
|
-
export function createInputSubmenu(
|
|
40
|
-
currentValue: string,
|
|
41
|
-
label: string,
|
|
42
|
-
done: (selectedValue?: string) => void,
|
|
43
|
-
): {
|
|
44
|
-
render: (width: number) => string[];
|
|
45
|
-
invalidate: () => void;
|
|
46
|
-
handleInput: (data: string) => boolean;
|
|
47
|
-
} {
|
|
48
|
-
const input = new Input();
|
|
49
|
-
input.setValue(currentValue);
|
|
50
|
-
|
|
51
|
-
return {
|
|
52
|
-
render: (_width: number) => {
|
|
53
|
-
const lines = [` ${label}`];
|
|
54
|
-
lines.push(...input.render(_width));
|
|
55
|
-
lines.push(" enter confirm • esc cancel");
|
|
56
|
-
return lines;
|
|
57
|
-
},
|
|
58
|
-
invalidate: () => {
|
|
59
|
-
input.invalidate();
|
|
60
|
-
},
|
|
61
|
-
handleInput: (data: string) => {
|
|
62
|
-
if (matchesKey(data, Key.escape)) {
|
|
63
|
-
done();
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
if (matchesKey(data, Key.enter)) {
|
|
67
|
-
done(input.getValue());
|
|
68
|
-
return true;
|
|
69
|
-
}
|
|
70
|
-
input.handleInput(data);
|
|
71
|
-
return true;
|
|
72
|
-
},
|
|
73
|
-
};
|
|
74
|
-
}
|
|
15
|
+
// Re-export submenu helpers
|
|
16
|
+
export { createInputSubmenu, createModelPickerSubmenu } from "./settings-submenus.ts";
|
|
75
17
|
|
|
76
|
-
// ──
|
|
18
|
+
// ── Overlay ────────────────────────────────────────────────────────────────
|
|
77
19
|
|
|
78
20
|
interface OverlayStatus {
|
|
79
21
|
kind: "warning" | "error";
|
|
@@ -86,45 +28,10 @@ interface OverlayState {
|
|
|
86
28
|
status?: OverlayStatus;
|
|
87
29
|
}
|
|
88
30
|
|
|
89
|
-
// ── Pure helpers ─────────────────────────────────────────────
|
|
90
|
-
|
|
91
31
|
function getScopeLabel(scope: SettingsScope): string {
|
|
92
32
|
return scope === "project" ? "Project" : "Global";
|
|
93
33
|
}
|
|
94
34
|
|
|
95
|
-
function buildFlatItems(
|
|
96
|
-
sections: SettingsSection[],
|
|
97
|
-
scope: SettingsScope,
|
|
98
|
-
cwd: string,
|
|
99
|
-
ctx?: ExtensionContext,
|
|
100
|
-
): SettingItem[] {
|
|
101
|
-
const items: SettingItem[] = [];
|
|
102
|
-
for (const section of sections) {
|
|
103
|
-
const sectionItems = section.loadValues(scope, cwd, ctx);
|
|
104
|
-
for (const item of sectionItems) {
|
|
105
|
-
items.push({
|
|
106
|
-
...item,
|
|
107
|
-
id: `${section.id}.${item.id}`,
|
|
108
|
-
label: `${section.label}: ${item.label}`,
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
return items;
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function findSectionAndId(
|
|
116
|
-
sections: SettingsSection[],
|
|
117
|
-
flatId: string,
|
|
118
|
-
): { section: SettingsSection; itemId: string } | null {
|
|
119
|
-
const dotIndex = flatId.indexOf(".");
|
|
120
|
-
if (dotIndex === -1) return null;
|
|
121
|
-
const sectionId = flatId.slice(0, dotIndex);
|
|
122
|
-
const itemId = flatId.slice(dotIndex + 1);
|
|
123
|
-
const section = sections.find((s) => s.id === sectionId);
|
|
124
|
-
if (!section) return null;
|
|
125
|
-
return { section, itemId };
|
|
126
|
-
}
|
|
127
|
-
|
|
128
35
|
function collectSettingsSections(pi: ExtensionAPI) {
|
|
129
36
|
const collector = createSettingsContributionCollector();
|
|
130
37
|
pi.events.emit(SUPI_SETTINGS_COLLECT_EVENT, collector);
|
|
@@ -136,199 +43,6 @@ function latestStatus(diagnostics: SettingsCollectionDiagnostic[]): OverlayStatu
|
|
|
136
43
|
return latest ? { kind: latest.kind, message: latest.message } : undefined;
|
|
137
44
|
}
|
|
138
45
|
|
|
139
|
-
function formatSettingsError(settingId: string, error: unknown): string {
|
|
140
|
-
const message = error instanceof Error ? error.message : String(error);
|
|
141
|
-
return `Could not save SuPi setting "${settingId}": ${message}`;
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// ── Component ────────────────────────────────────────────────
|
|
145
|
-
|
|
146
|
-
interface SettingsOverlayDeps {
|
|
147
|
-
ctx: ExtensionContext;
|
|
148
|
-
sections: SettingsSection[];
|
|
149
|
-
state: OverlayState;
|
|
150
|
-
container: Container;
|
|
151
|
-
settingsList: SettingsList | null;
|
|
152
|
-
tui: Parameters<Parameters<ExtensionContext["ui"]["custom"]>[0]>[0];
|
|
153
|
-
theme: Parameters<Parameters<ExtensionContext["ui"]["custom"]>[0]>[1];
|
|
154
|
-
done: () => void;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function createSettingsList(deps: SettingsOverlayDeps): SettingsList {
|
|
158
|
-
const items = buildFlatItems(deps.sections, deps.state.scope, deps.state.cwd, deps.ctx);
|
|
159
|
-
const onChange = (flatId: string, newValue: string) => {
|
|
160
|
-
const found = findSectionAndId(deps.sections, flatId);
|
|
161
|
-
try {
|
|
162
|
-
if (found) {
|
|
163
|
-
found.section.persistChange(deps.state.scope, deps.state.cwd, found.itemId, newValue);
|
|
164
|
-
deps.state.status = undefined;
|
|
165
|
-
}
|
|
166
|
-
} catch (error) {
|
|
167
|
-
deps.state.status = {
|
|
168
|
-
kind: "error",
|
|
169
|
-
message: formatSettingsError(found?.itemId ?? flatId, error),
|
|
170
|
-
};
|
|
171
|
-
}
|
|
172
|
-
// Re-read all values to reflect persisted changes, but keep the list
|
|
173
|
-
// instance (and its selectedIndex) intact.
|
|
174
|
-
const updatedItems = buildFlatItems(deps.sections, deps.state.scope, deps.state.cwd, deps.ctx);
|
|
175
|
-
for (const updated of updatedItems) {
|
|
176
|
-
const existing = items.find((i) => i.id === updated.id);
|
|
177
|
-
if (existing && existing.currentValue !== updated.currentValue) {
|
|
178
|
-
settingsList.updateValue(updated.id, updated.currentValue);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
deps.tui.requestRender();
|
|
182
|
-
};
|
|
183
|
-
const settingsList = new SettingsList(
|
|
184
|
-
items,
|
|
185
|
-
Math.min(items.length + 4, 20),
|
|
186
|
-
getSettingsListTheme(),
|
|
187
|
-
onChange,
|
|
188
|
-
() => deps.done(),
|
|
189
|
-
{ enableSearch: true },
|
|
190
|
-
);
|
|
191
|
-
return settingsList;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
function rebuildSettingsList(deps: SettingsOverlayDeps): SettingsList {
|
|
195
|
-
const settingsList = createSettingsList(deps);
|
|
196
|
-
deps.settingsList = settingsList;
|
|
197
|
-
|
|
198
|
-
deps.container.clear();
|
|
199
|
-
deps.container.addChild(createHeaderComponent(deps));
|
|
200
|
-
deps.container.addChild(createStatusComponent(deps));
|
|
201
|
-
deps.container.addChild(settingsList);
|
|
202
|
-
|
|
203
|
-
return settingsList;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
function createHeaderComponent(deps: SettingsOverlayDeps): Text {
|
|
207
|
-
const { theme, state } = deps;
|
|
208
|
-
const scopeLabel = getScopeLabel(state.scope);
|
|
209
|
-
const otherScope = state.scope === "project" ? "Global" : "Project";
|
|
210
|
-
const headerText = new Text(
|
|
211
|
-
`${theme.fg("accent", theme.bold("SuPi Settings"))} ${theme.fg("text", `Scope: ${scopeLabel}`)} ${theme.fg("dim", `(tab → ${otherScope})`)}`,
|
|
212
|
-
0,
|
|
213
|
-
0,
|
|
214
|
-
);
|
|
215
|
-
return headerText;
|
|
216
|
-
}
|
|
217
|
-
|
|
218
|
-
function createStatusComponent(deps: SettingsOverlayDeps): {
|
|
219
|
-
render: () => string[];
|
|
220
|
-
invalidate: () => void;
|
|
221
|
-
} {
|
|
222
|
-
return {
|
|
223
|
-
render: () => {
|
|
224
|
-
const status = deps.state.status;
|
|
225
|
-
if (!status) return [];
|
|
226
|
-
return [deps.theme.fg(status.kind, status.message)];
|
|
227
|
-
},
|
|
228
|
-
invalidate: () => {},
|
|
229
|
-
};
|
|
230
|
-
}
|
|
231
|
-
|
|
232
|
-
function handleScopeToggle(deps: SettingsOverlayDeps): void {
|
|
233
|
-
deps.state.scope = deps.state.scope === "project" ? "global" : "project";
|
|
234
|
-
rebuildSettingsList(deps);
|
|
235
|
-
deps.tui.requestRender();
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
/** Minimal SelectList theme — uses identity so the parent SettingsList provides styling context. */
|
|
239
|
-
const PASSTHROUGH_THEME: SelectListTheme = {
|
|
240
|
-
selectedPrefix: (text) => `› ${text}`,
|
|
241
|
-
selectedText: (text) => text,
|
|
242
|
-
description: (text) => text,
|
|
243
|
-
scrollInfo: (text) => text,
|
|
244
|
-
noMatch: (text) => text,
|
|
245
|
-
};
|
|
246
|
-
|
|
247
|
-
/**
|
|
248
|
-
* Create a model picker submenu for settings.
|
|
249
|
-
*
|
|
250
|
-
* Shows a scrollable list of selectable models from the scoped model set,
|
|
251
|
-
* with the current session model annotated `[current]`. The first entry is
|
|
252
|
-
* always `"disabled"`.
|
|
253
|
-
*
|
|
254
|
-
* @param currentValue - Currently configured canonical model id or `"disabled"`.
|
|
255
|
-
* @param done - Callback invoked with the selected value, or undefined on cancel.
|
|
256
|
-
* @param ctx - Extension context for model listing. When undefined, only
|
|
257
|
-
* `"disabled"` is offered.
|
|
258
|
-
*/
|
|
259
|
-
export function createModelPickerSubmenu(
|
|
260
|
-
currentValue: string,
|
|
261
|
-
done: (selectedValue?: string) => void,
|
|
262
|
-
ctx?: ExtensionContext,
|
|
263
|
-
): {
|
|
264
|
-
render: (width: number) => string[];
|
|
265
|
-
invalidate: () => void;
|
|
266
|
-
handleInput: (data: string) => boolean;
|
|
267
|
-
} {
|
|
268
|
-
const items = buildModelItems(ctx);
|
|
269
|
-
|
|
270
|
-
const initialIndex =
|
|
271
|
-
currentValue === "disabled"
|
|
272
|
-
? 0
|
|
273
|
-
: Math.max(
|
|
274
|
-
0,
|
|
275
|
-
items.findIndex((item) => item.value === currentValue),
|
|
276
|
-
);
|
|
277
|
-
|
|
278
|
-
const container = new Container();
|
|
279
|
-
container.addChild(new Text(" Select suggestion model", 1, 0));
|
|
280
|
-
container.addChild(new Text("", 1, 0));
|
|
281
|
-
|
|
282
|
-
const selectList = new SelectList(items, Math.min(items.length, 15), PASSTHROUGH_THEME);
|
|
283
|
-
|
|
284
|
-
if (initialIndex >= 0) {
|
|
285
|
-
selectList.setSelectedIndex(initialIndex);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
selectList.onSelect = (item) => done(item.value);
|
|
289
|
-
selectList.onCancel = () => done();
|
|
290
|
-
|
|
291
|
-
container.addChild(selectList);
|
|
292
|
-
container.addChild(new Text(" ↑↓ navigate • enter select • esc cancel", 1, 0));
|
|
293
|
-
|
|
294
|
-
return {
|
|
295
|
-
render: (width: number) => container.render(width),
|
|
296
|
-
invalidate: () => container.invalidate(),
|
|
297
|
-
handleInput: (data: string) => {
|
|
298
|
-
selectList.handleInput(data);
|
|
299
|
-
return true;
|
|
300
|
-
},
|
|
301
|
-
};
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
/** Build selectable model items with "disabled" first. */
|
|
305
|
-
function buildModelItems(ctx?: ExtensionContext): SelectItem[] {
|
|
306
|
-
const items: SelectItem[] = [
|
|
307
|
-
{
|
|
308
|
-
value: "disabled",
|
|
309
|
-
label: "disabled",
|
|
310
|
-
description: "No prompt suggestions",
|
|
311
|
-
},
|
|
312
|
-
];
|
|
313
|
-
|
|
314
|
-
if (!ctx) return items;
|
|
315
|
-
|
|
316
|
-
const models = getSelectableModels(ctx);
|
|
317
|
-
|
|
318
|
-
for (const model of models) {
|
|
319
|
-
const suffix = model.isCurrent ? " [current]" : "";
|
|
320
|
-
items.push({
|
|
321
|
-
value: model.canonicalId,
|
|
322
|
-
label: `${model.canonicalId}${suffix}`,
|
|
323
|
-
description: model.label !== model.canonicalId ? model.label : undefined,
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
|
|
327
|
-
return items;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
// ── Entry point ──────────────────────────────────────────────
|
|
331
|
-
|
|
332
46
|
export function openSettingsOverlay(pi: ExtensionAPI, ctx: ExtensionContext): void {
|
|
333
47
|
const collection = collectSettingsSections(pi);
|
|
334
48
|
if (collection.sections.length === 0) {
|
|
@@ -342,32 +56,59 @@ export function openSettingsOverlay(pi: ExtensionAPI, ctx: ExtensionContext): vo
|
|
|
342
56
|
cwd: ctx.cwd,
|
|
343
57
|
status: latestStatus(collection.diagnostics),
|
|
344
58
|
};
|
|
345
|
-
const container = new Container();
|
|
346
59
|
|
|
347
|
-
const
|
|
60
|
+
const container = new Container();
|
|
61
|
+
const scopedList = new ScopedSettingsList(
|
|
62
|
+
collection.sections,
|
|
63
|
+
state.scope,
|
|
64
|
+
state.cwd,
|
|
348
65
|
ctx,
|
|
349
|
-
sections: collection.sections,
|
|
350
|
-
state,
|
|
351
|
-
container,
|
|
352
|
-
settingsList: null,
|
|
353
|
-
tui,
|
|
354
66
|
theme,
|
|
67
|
+
tui,
|
|
355
68
|
done,
|
|
69
|
+
(message) => {
|
|
70
|
+
state.status = { kind: "error", message };
|
|
71
|
+
rebuildOverlay();
|
|
72
|
+
tui.requestRender();
|
|
73
|
+
},
|
|
74
|
+
);
|
|
75
|
+
scopedList.enableSearch();
|
|
76
|
+
|
|
77
|
+
const rebuildOverlay = () => {
|
|
78
|
+
container.clear();
|
|
79
|
+
const scopeLabel = getScopeLabel(state.scope);
|
|
80
|
+
const otherScope = state.scope === "project" ? "Global" : "Project";
|
|
81
|
+
container.addChild(
|
|
82
|
+
new Text(
|
|
83
|
+
`${theme.fg("accent", theme.bold("SuPi Settings"))} ${theme.fg("text", `Scope: ${scopeLabel}`)} ${theme.fg("dim", `(tab → ${otherScope})`)}`,
|
|
84
|
+
0,
|
|
85
|
+
0,
|
|
86
|
+
),
|
|
87
|
+
);
|
|
88
|
+
if (state.status) {
|
|
89
|
+
container.addChild(new Text(theme.fg(state.status.kind, state.status.message), 0, 0));
|
|
90
|
+
}
|
|
356
91
|
};
|
|
357
92
|
|
|
358
|
-
|
|
93
|
+
rebuildOverlay();
|
|
359
94
|
|
|
360
95
|
const component = {
|
|
361
|
-
render: (width: number) => container.render(width),
|
|
362
|
-
invalidate: () =>
|
|
96
|
+
render: (width: number) => [...container.render(width), ...scopedList.render(width)],
|
|
97
|
+
invalidate: () => {
|
|
98
|
+
container.invalidate();
|
|
99
|
+
scopedList.invalidate();
|
|
100
|
+
},
|
|
363
101
|
handleInput: (data: string) => {
|
|
364
102
|
if (matchesKey(data, Key.tab)) {
|
|
365
|
-
|
|
103
|
+
state.scope = state.scope === "project" ? "global" : "project";
|
|
104
|
+
state.status = undefined;
|
|
105
|
+
scopedList.reload(state.scope, state.cwd, ctx);
|
|
106
|
+
rebuildOverlay();
|
|
107
|
+
tui.requestRender();
|
|
366
108
|
return true;
|
|
367
109
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
deps.tui.requestRender();
|
|
110
|
+
scopedList.handleInput(data);
|
|
111
|
+
tui.requestRender();
|
|
371
112
|
return true;
|
|
372
113
|
},
|
|
373
114
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
// supi-core settings-ui domain — settings TUI components (imports pi-tui at runtime, heavy).
|
|
2
|
-
export {
|
|
3
|
-
|
|
4
|
-
createModelPickerSubmenu,
|
|
5
|
-
openSettingsOverlay,
|
|
6
|
-
} from "./settings/settings-ui.ts";
|
|
2
|
+
export { createInputSubmenu, createModelPickerSubmenu } from "./settings/settings-submenus.ts";
|
|
3
|
+
export { openSettingsOverlay } from "./settings/settings-ui.ts";
|
package/node_modules/@mrclrchtr/supi-tree-sitter/node_modules/@mrclrchtr/supi-core/src/settings.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// supi-core settings domain — event-backed settings
|
|
1
|
+
// supi-core settings domain — event-backed declarative settings contributions and command wiring.
|
|
2
2
|
|
|
3
3
|
export { registerSettingsCommand } from "./settings/settings-command.ts";
|
|
4
4
|
export type {
|
|
@@ -13,3 +13,19 @@ export {
|
|
|
13
13
|
isSettingsContributionCollector,
|
|
14
14
|
SUPI_SETTINGS_COLLECT_EVENT,
|
|
15
15
|
} from "./settings/settings-registry.ts";
|
|
16
|
+
export type {
|
|
17
|
+
BoolField,
|
|
18
|
+
ConfigHelpers,
|
|
19
|
+
CustomField,
|
|
20
|
+
DeclarativeSettingsOptions,
|
|
21
|
+
EnumField,
|
|
22
|
+
ModelPickerField,
|
|
23
|
+
NumberField,
|
|
24
|
+
ScopedFieldValue,
|
|
25
|
+
SettingsField,
|
|
26
|
+
SettingsFieldAction,
|
|
27
|
+
SettingsPersistedChange,
|
|
28
|
+
StringListField,
|
|
29
|
+
ValueSource,
|
|
30
|
+
} from "./settings/settings-schema.ts";
|
|
31
|
+
export { registerDeclarativeSettings } from "./settings/settings-schema.ts";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-tree-sitter",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "SuPi Tree-sitter extension — structural AST analysis for pi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -35,8 +35,8 @@
|
|
|
35
35
|
],
|
|
36
36
|
"dependencies": {
|
|
37
37
|
"web-tree-sitter": "^0.26.8",
|
|
38
|
-
"@mrclrchtr/supi-code-runtime": "2.1
|
|
39
|
-
"@mrclrchtr/supi-core": "2.1
|
|
38
|
+
"@mrclrchtr/supi-code-runtime": "2.2.1",
|
|
39
|
+
"@mrclrchtr/supi-core": "2.2.1"
|
|
40
40
|
},
|
|
41
41
|
"bundledDependencies": [
|
|
42
42
|
"@mrclrchtr/supi-code-runtime",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mrclrchtr/supi-code-intelligence",
|
|
3
|
-
"version": "2.1
|
|
3
|
+
"version": "2.2.1",
|
|
4
4
|
"description": "SuPi Code Intelligence extension — architecture briefs, caller/callee analysis, impact assessment, and pattern search for pi",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -34,10 +34,10 @@
|
|
|
34
34
|
],
|
|
35
35
|
"dependencies": {
|
|
36
36
|
"ts-pattern": "^5.9.0",
|
|
37
|
-
"@mrclrchtr/supi-code-runtime": "2.1
|
|
38
|
-
"@mrclrchtr/supi-core": "2.1
|
|
39
|
-
"@mrclrchtr/supi-
|
|
40
|
-
"@mrclrchtr/supi-
|
|
37
|
+
"@mrclrchtr/supi-code-runtime": "2.2.1",
|
|
38
|
+
"@mrclrchtr/supi-core": "2.2.1",
|
|
39
|
+
"@mrclrchtr/supi-tree-sitter": "2.2.1",
|
|
40
|
+
"@mrclrchtr/supi-lsp": "2.2.1"
|
|
41
41
|
},
|
|
42
42
|
"bundledDependencies": [
|
|
43
43
|
"@mrclrchtr/supi-code-runtime",
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
// Directory-local instruction file discovery and rendering for code_orientation.
|
|
2
|
+
|
|
3
|
+
import { readFileSync, statSync } from "node:fs";
|
|
4
|
+
import * as path from "node:path";
|
|
5
|
+
import { isWithinOrEqual } from "@mrclrchtr/supi-core/project";
|
|
6
|
+
|
|
7
|
+
export const INSTRUCTION_FILE_LINE_LIMIT = 200;
|
|
8
|
+
|
|
9
|
+
/** Directory-local instruction file selected for orientation output. */
|
|
10
|
+
export interface InstructionFileMatch {
|
|
11
|
+
/** Absolute file path. */
|
|
12
|
+
absolutePath: string;
|
|
13
|
+
/** Workspace-relative file path. */
|
|
14
|
+
relativePath: string;
|
|
15
|
+
/** Absolute containing directory. */
|
|
16
|
+
directory: string;
|
|
17
|
+
/** Workspace-relative containing directory. */
|
|
18
|
+
relativeDirectory: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/** Agent-visible instruction file snippet plus metadata for details. */
|
|
22
|
+
export interface RenderedInstructionFile {
|
|
23
|
+
path: string;
|
|
24
|
+
directory: string;
|
|
25
|
+
shownLines: number;
|
|
26
|
+
totalLines: number;
|
|
27
|
+
truncated: boolean;
|
|
28
|
+
content: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/** Structured metadata stored in code_orientation details. */
|
|
32
|
+
export interface InstructionFilesMetadata {
|
|
33
|
+
files: Array<Omit<RenderedInstructionFile, "content">>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Find configured instruction files for a directory focus.
|
|
38
|
+
*
|
|
39
|
+
* Walks from cwd to the focused directory (shallowest first, deepest last),
|
|
40
|
+
* selecting the first configured file name that exists in each directory.
|
|
41
|
+
*/
|
|
42
|
+
export function findInstructionFilesForDirectory(options: {
|
|
43
|
+
directory: string;
|
|
44
|
+
cwd: string;
|
|
45
|
+
fileNames: string[];
|
|
46
|
+
nativeContextPaths: Set<string>;
|
|
47
|
+
surfacedDirectories: Set<string>;
|
|
48
|
+
}): InstructionFileMatch[] {
|
|
49
|
+
const cwd = path.resolve(options.cwd);
|
|
50
|
+
const directory = path.resolve(options.directory);
|
|
51
|
+
const fileNames = options.fileNames.filter((name) => name.trim().length > 0);
|
|
52
|
+
if (fileNames.length === 0) return [];
|
|
53
|
+
if (!isDirectoryWithinCwd(directory, cwd)) return [];
|
|
54
|
+
|
|
55
|
+
const dirs = collectDirsShallowestFirst(directory, cwd);
|
|
56
|
+
const matches: InstructionFileMatch[] = [];
|
|
57
|
+
|
|
58
|
+
for (const dir of dirs) {
|
|
59
|
+
if (options.surfacedDirectories.has(dir)) continue;
|
|
60
|
+
const match = findFirstInstructionFile(dir, cwd, fileNames);
|
|
61
|
+
if (!match) continue;
|
|
62
|
+
if (options.nativeContextPaths.has(match.absolutePath)) continue;
|
|
63
|
+
matches.push(match);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
return matches;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function isDirectoryWithinCwd(directory: string, cwd: string): boolean {
|
|
70
|
+
try {
|
|
71
|
+
return statSync(directory).isDirectory() && isWithinOrEqual(cwd, directory);
|
|
72
|
+
} catch {
|
|
73
|
+
return false;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
function collectDirsShallowestFirst(directory: string, cwd: string): string[] {
|
|
78
|
+
const dirs: string[] = [];
|
|
79
|
+
let current = directory;
|
|
80
|
+
|
|
81
|
+
while (isWithinOrEqual(cwd, current)) {
|
|
82
|
+
dirs.push(current);
|
|
83
|
+
if (current === cwd) break;
|
|
84
|
+
const parent = path.dirname(current);
|
|
85
|
+
if (parent === current) break;
|
|
86
|
+
current = parent;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return dirs.reverse();
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
function findFirstInstructionFile(
|
|
93
|
+
dir: string,
|
|
94
|
+
cwd: string,
|
|
95
|
+
fileNames: string[],
|
|
96
|
+
): InstructionFileMatch | null {
|
|
97
|
+
for (const fileName of fileNames) {
|
|
98
|
+
const candidate = path.join(dir, fileName);
|
|
99
|
+
if (!isFile(candidate)) continue;
|
|
100
|
+
return {
|
|
101
|
+
absolutePath: candidate,
|
|
102
|
+
relativePath: path.relative(cwd, candidate),
|
|
103
|
+
directory: dir,
|
|
104
|
+
relativeDirectory: path.relative(cwd, dir) || ".",
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
return null;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
/** Render instruction files as a markdown section and structured metadata. */
|
|
111
|
+
export function renderInstructionFiles(
|
|
112
|
+
files: InstructionFileMatch[],
|
|
113
|
+
lineLimit = INSTRUCTION_FILE_LINE_LIMIT,
|
|
114
|
+
): { markdown: string; metadata: InstructionFilesMetadata } | null {
|
|
115
|
+
const rendered = files.map((file) => renderInstructionFile(file, lineLimit)).filter(isRendered);
|
|
116
|
+
if (rendered.length === 0) return null;
|
|
117
|
+
|
|
118
|
+
const lines: string[] = [];
|
|
119
|
+
lines.push("## Instructions");
|
|
120
|
+
lines.push("");
|
|
121
|
+
for (const file of rendered) {
|
|
122
|
+
lines.push(`### ${file.path}`);
|
|
123
|
+
lines.push("");
|
|
124
|
+
lines.push(file.content);
|
|
125
|
+
if (file.truncated) {
|
|
126
|
+
lines.push("");
|
|
127
|
+
lines.push(
|
|
128
|
+
`_Instruction file truncated to ${file.shownLines} of ${file.totalLines} lines. Use \`read\` on \`${file.path}\` for the full file._`,
|
|
129
|
+
);
|
|
130
|
+
}
|
|
131
|
+
lines.push("");
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
return {
|
|
135
|
+
markdown: lines.join("\n").trimEnd(),
|
|
136
|
+
metadata: {
|
|
137
|
+
files: rendered.map(({ content: _content, ...metadata }) => metadata),
|
|
138
|
+
},
|
|
139
|
+
};
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
function isFile(candidate: string): boolean {
|
|
143
|
+
try {
|
|
144
|
+
return statSync(candidate).isFile();
|
|
145
|
+
} catch {
|
|
146
|
+
return false;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
function renderInstructionFile(
|
|
151
|
+
file: InstructionFileMatch,
|
|
152
|
+
lineLimit: number,
|
|
153
|
+
): RenderedInstructionFile | null {
|
|
154
|
+
try {
|
|
155
|
+
const content = readFileSync(file.absolutePath, "utf-8").trim();
|
|
156
|
+
if (!content) return null;
|
|
157
|
+
|
|
158
|
+
const lines = content.split("\n");
|
|
159
|
+
const shown = lines.slice(0, lineLimit);
|
|
160
|
+
return {
|
|
161
|
+
path: file.relativePath,
|
|
162
|
+
directory: file.relativeDirectory,
|
|
163
|
+
shownLines: shown.length,
|
|
164
|
+
totalLines: lines.length,
|
|
165
|
+
truncated: lines.length > shown.length,
|
|
166
|
+
content: shown.join("\n"),
|
|
167
|
+
};
|
|
168
|
+
} catch {
|
|
169
|
+
return null;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
function isRendered(value: RenderedInstructionFile | null): value is RenderedInstructionFile {
|
|
174
|
+
return value !== null;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/** Insert instruction markdown after the opening title/summary block of a brief. */
|
|
178
|
+
export function insertInstructionsNearTop(content: string, instructionsMarkdown: string): string {
|
|
179
|
+
const lines = content.split("\n");
|
|
180
|
+
const insertAt = findFirstSectionIndexAfterTitle(lines);
|
|
181
|
+
const before = lines.slice(0, insertAt).join("\n").trimEnd();
|
|
182
|
+
const after = lines.slice(insertAt).join("\n").trimStart();
|
|
183
|
+
|
|
184
|
+
if (!before) return `${instructionsMarkdown}\n\n${after}`.trimEnd();
|
|
185
|
+
if (!after) return `${before}\n\n${instructionsMarkdown}`.trimEnd();
|
|
186
|
+
return `${before}\n\n${instructionsMarkdown}\n\n${after}`.trimEnd();
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function findFirstSectionIndexAfterTitle(lines: string[]): number {
|
|
190
|
+
for (let i = 1; i < lines.length; i++) {
|
|
191
|
+
if (lines[i].startsWith("## ")) return i;
|
|
192
|
+
}
|
|
193
|
+
return lines.length;
|
|
194
|
+
}
|