pi-braid 0.43.41 → 0.43.43

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/src/loader/api.ts CHANGED
@@ -17,11 +17,8 @@
17
17
  * alone; argument completion and `list` are the places that enumerate what is
18
18
  * accepted.
19
19
  *
20
- * The six command names this file used to register remain as forwarding
21
- * aliases for one release: modules-enable, modules-disable, modules-toggle,
22
- * modules-reset, modules-list, modules-status. Each maps its whole argument
23
- * onto the equivalent argv, so a script written against the old names keeps
24
- * working until it is pointed at `/modules`.
20
+ * The list covers the core manifest only: a contrib extension is toggled
21
+ * through its `braid.contrib.<name>` key in settings, not from this command.
25
22
  */
26
23
 
27
24
  import type { ExtensionAPI, ExtensionCommandContext } from "@earendil-works/pi-coding-agent";
@@ -67,6 +64,10 @@ const USAGE =
67
64
  "Usage: /modules [on|off|toggle|reset|all|list] <ref>\n" +
68
65
  "A ref is an extension id or a module group name. Tab completes both.";
69
66
 
67
+ /** Why a contrib extension is absent from this list, stated where it shows. */
68
+ const CONTRIB_NOTE =
69
+ "Contrib extensions are toggled through braid.contrib in settings, not from this list.";
70
+
70
71
  export default async function modulesApiExtension(pi: ExtensionAPI): Promise<void> {
71
72
  const run = async (argv: string[], ctx: ExtensionCommandContext): Promise<void> => {
72
73
  const notify = (message: string, type: "info" | "warning" | "error" = "info"): void => {
@@ -168,35 +169,7 @@ export default async function modulesApiExtension(pi: ExtensionAPI): Promise<voi
168
169
  handler: (args, ctx) => run(splitArgs(args), ctx),
169
170
  });
170
171
 
171
- pi.registerCommand("modules-enable", {
172
- description: "Alias of /modules on <ref>. Retained for one release.",
173
- getArgumentCompletions: completeRefs("on"),
174
- handler: (args, ctx) => run([...forwarded("on", args)], ctx),
175
- });
176
- pi.registerCommand("modules-disable", {
177
- description: "Alias of /modules off <ref>. Retained for one release.",
178
- getArgumentCompletions: completeRefs("off"),
179
- handler: (args, ctx) => run([...forwarded("off", args)], ctx),
180
- });
181
- pi.registerCommand("modules-toggle", {
182
- description: "Alias of /modules toggle <ref>. Retained for one release.",
183
- getArgumentCompletions: completeRefs("toggle"),
184
- handler: (args, ctx) => run([...forwarded("toggle", args)], ctx),
185
- });
186
- pi.registerCommand("modules-reset", {
187
- description: "Alias of /modules reset. Retained for one release.",
188
- handler: async (_args, ctx) => run(["reset"], ctx),
189
- });
190
- pi.registerCommand("modules-list", {
191
- description: "Alias of /modules list. Retained for one release.",
192
- handler: async (_args, ctx) => run(["list"], ctx),
193
- });
194
- pi.registerCommand("modules-status", {
195
- description: "Alias of /modules list. Retained for one release.",
196
- handler: async (_args, ctx) => run(["list"], ctx),
197
- });
198
-
199
- log.info("Module API registered: /modules (+ six forwarding aliases)");
172
+ log.info("Module API registered: /modules");
200
173
  }
201
174
 
202
175
  // ── Argument parsing ────────────────────────────────────────────────────────
@@ -214,11 +187,6 @@ function splitArgs(args: string | undefined): string[] {
214
187
  return argv;
215
188
  }
216
189
 
217
- /** The argv an old name forwards: its whole argument is the ref. */
218
- function forwarded(verb: string, args: string | undefined): string[] {
219
- return [verb, (args ?? "").trim()];
220
- }
221
-
222
190
  /** Why a reference was refused, naming the rule instead of listing refs. */
223
191
  function refusal(ref: string, verb: string): string {
224
192
  if (!getModuleRefs().includes(ref)) {
@@ -255,16 +223,6 @@ function completeModules(prefix: string): AutocompleteItem[] | null {
255
223
  return null;
256
224
  }
257
225
 
258
- /** Completion for an old name: the whole argument text is the reference. */
259
- function completeRefs(verb: string) {
260
- return (prefix: string): AutocompleteItem[] | null => {
261
- const typed = (prefix ?? "").toLowerCase();
262
- return getModuleRefs()
263
- .filter((ref) => ref.startsWith(typed))
264
- .map((ref) => ({ value: ref, label: ref, description: `Forwarded to /modules ${verb}` }));
265
- };
266
- }
267
-
268
226
  function completeValues(prefix: string, values: string[]): AutocompleteItem[] {
269
227
  const typed = (prefix ?? "").toLowerCase();
270
228
  return values
@@ -296,7 +254,7 @@ function describe(desc: string, origin: ModuleOrigin, enabled: boolean, loaded:
296
254
  /** The rows as text, for RPC mode and the `list` verb. */
297
255
  function renderRows(): string {
298
256
  const { rows, source } = moduleRows();
299
- const lines = [`Extensions (${rows.length}, config: ${source}):`];
257
+ const lines = [`Extensions (${rows.length}, config: ${source}):`, CONTRIB_NOTE];
300
258
  const width = Math.min(28, Math.max(...rows.map((row) => row.id.length)));
301
259
  for (const row of rows) {
302
260
  lines.push(` ${row.value.padEnd(3)} ${row.id.padEnd(width)} ${row.description}`);
@@ -319,7 +277,7 @@ async function openModuleList(ctx: ExtensionCommandContext): Promise<void> {
319
277
  container.addChild(
320
278
  new (class {
321
279
  render(_width: number) {
322
- return [theme.fg("accent", theme.bold("Extensions"))];
280
+ return [theme.fg("accent", theme.bold("Extensions")), theme.fg("muted", CONTRIB_NOTE)];
323
281
  }
324
282
  invalidate() {}
325
283
  })(),
@@ -656,8 +656,3 @@ function topologicalSort(extIds: string[]): string[] {
656
656
  export function getModuleRefs(): string[] {
657
657
  return allConfigRefs();
658
658
  }
659
-
660
- /** @deprecated Use getModuleRefs. Kept as an alias for existing callers. */
661
- export function getAllRefNames(): string[] {
662
- return getModuleRefs();
663
- }