swarmlancer-cli 0.6.0 → 0.6.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.
@@ -3,11 +3,11 @@ import type { TUI } from "@mariozechner/pi-tui";
3
3
  export declare class NameEditorScreen implements Component {
4
4
  private tui;
5
5
  private container;
6
- private editor;
6
+ private input;
7
7
  private cachedLines?;
8
8
  onSave?: (name: string) => void;
9
9
  onCancel?: () => void;
10
- constructor(tui: TUI, currentName: string, title?: string);
10
+ constructor(tui: TUI, currentValue: string, title?: string);
11
11
  handleInput(data: string): void;
12
12
  render(width: number): string[];
13
13
  invalidate(): void;
@@ -1,42 +1,32 @@
1
- import { Container, Editor, matchesKey, Key, } from "@mariozechner/pi-tui";
1
+ import { Container, Input, matchesKey, Key, } from "@mariozechner/pi-tui";
2
2
  import { colors } from "../theme.js";
3
3
  import { BannerComponent } from "./banner.js";
4
- const EDITOR_THEME = {
5
- borderColor: (s) => colors.lime(s),
6
- selectList: {
7
- selectedPrefix: (t) => colors.lime(t),
8
- selectedText: (t) => colors.lime(t),
9
- description: (t) => colors.gray(t),
10
- scrollInfo: (t) => colors.gray(t),
11
- noMatch: (t) => colors.gray(t),
12
- },
13
- };
14
4
  export class NameEditorScreen {
15
5
  tui;
16
6
  container;
17
- editor;
7
+ input;
18
8
  cachedLines;
19
9
  onSave;
20
10
  onCancel;
21
- constructor(tui, currentName, title = "Rename") {
11
+ constructor(tui, currentValue, title = "Rename") {
22
12
  this.tui = tui;
23
13
  this.container = new Container();
24
14
  this.container.addChild(new BannerComponent(title));
25
- this.editor = new Editor(tui, EDITOR_THEME, { paddingX: 1 });
26
- this.editor.setText(currentName);
27
- this.editor.disableSubmit = false;
28
- this.editor.onSubmit = (text) => {
29
- const trimmed = text.trim();
30
- if (trimmed.length > 0)
31
- this.onSave?.(trimmed);
32
- };
15
+ this.input = new Input();
16
+ this.input.setValue(currentValue);
33
17
  }
34
18
  handleInput(data) {
35
19
  if (matchesKey(data, Key.escape)) {
36
20
  this.onCancel?.();
37
21
  return;
38
22
  }
39
- this.editor.handleInput(data);
23
+ if (matchesKey(data, Key.enter)) {
24
+ const trimmed = this.input.getValue().trim();
25
+ if (trimmed.length > 0)
26
+ this.onSave?.(trimmed);
27
+ return;
28
+ }
29
+ this.input.handleInput(data);
40
30
  this.cachedLines = undefined;
41
31
  this.tui.requestRender();
42
32
  }
@@ -44,8 +34,11 @@ export class NameEditorScreen {
44
34
  if (this.cachedLines)
45
35
  return this.cachedLines;
46
36
  const lines = this.container.render(width);
47
- for (const line of this.editor.render(width))
48
- lines.push(line);
37
+ // Render the input with a prompt
38
+ const inputLines = this.input.render(width - 4);
39
+ for (const line of inputLines) {
40
+ lines.push(` ${colors.lime("▸")} ${line}`);
41
+ }
49
42
  lines.push("");
50
43
  lines.push(colors.gray(" enter save • esc cancel"));
51
44
  this.cachedLines = lines;
@@ -53,6 +46,5 @@ export class NameEditorScreen {
53
46
  }
54
47
  invalidate() {
55
48
  this.cachedLines = undefined;
56
- this.editor.invalidate();
57
49
  }
58
50
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "swarmlancer-cli",
3
- "version": "0.6.0",
3
+ "version": "0.6.1",
4
4
  "description": "Swarmlancer CLI — let the swarm begin. Connect your AI agent to a network of other agents.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",