alimberdi 0.1.0 → 0.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 CHANGED
@@ -2,6 +2,9 @@
2
2
 
3
3
  An interactive personal terminal application for Adilkhan Alimberdi.
4
4
 
5
+ The default command opens a centered full-screen terminal interface. Navigate
6
+ with the arrow keys, select with Enter, go back with Escape, and quit with Q.
7
+
5
8
  ## Run
6
9
 
7
10
  ```bash
@@ -17,6 +20,15 @@ npx alimberdi play rock
17
20
  npx alimberdi help
18
21
  ```
19
22
 
23
+ ## Controls
24
+
25
+ | Key | Action |
26
+ | --- | --- |
27
+ | `↑` / `↓` | Move between actions |
28
+ | `Enter` | Select |
29
+ | `Esc` / `←` | Go back |
30
+ | `Q` | Exit and restore the terminal |
31
+
20
32
  ## Local development
21
33
 
22
34
  Requires Node.js 22 or newer.
@@ -37,3 +49,16 @@ npm test
37
49
  ## License
38
50
 
39
51
  MIT
52
+
53
+ ## Release
54
+
55
+ Releases are published through GitHub Actions and npm Trusted Publishing. The
56
+ tag must match the version in `package.json`.
57
+
58
+ ```bash
59
+ npm test
60
+ npm version patch
61
+ git push origin master --follow-tags
62
+ ```
63
+
64
+ Use `minor` or `major` instead of `patch` when the semantic version requires it.
@@ -0,0 +1,19 @@
1
+ export declare class InteractiveApp {
2
+ private readonly input;
3
+ private readonly output;
4
+ private screen;
5
+ private selectedIndex;
6
+ private gameResult;
7
+ private resolve;
8
+ constructor(input: NodeJS.ReadStream, output: NodeJS.WriteStream);
9
+ run(): Promise<void>;
10
+ private readonly onKeypress;
11
+ private readonly render;
12
+ private content;
13
+ private actions;
14
+ private goTo;
15
+ private play;
16
+ private exit;
17
+ }
18
+ export declare function runInteractiveApp(input: NodeJS.ReadStream, output: NodeJS.WriteStream): Promise<void>;
19
+ //# sourceMappingURL=interactive-app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive-app.d.ts","sourceRoot":"","sources":["../../src/app/interactive-app.ts"],"names":[],"mappings":"AAwCA,qBAAa,cAAc;IAOvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,MAAM;IAPzB,OAAO,CAAC,MAAM,CAAkB;IAChC,OAAO,CAAC,aAAa,CAAK;IAC1B,OAAO,CAAC,UAAU,CAAqB;IACvC,OAAO,CAAC,OAAO,CAA2B;gBAGvB,KAAK,EAAE,MAAM,CAAC,UAAU,EACxB,MAAM,EAAE,MAAM,CAAC,WAAW;IAGtC,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;IAa3B,OAAO,CAAC,QAAQ,CAAC,UAAU,CA0BzB;IAEF,OAAO,CAAC,QAAQ,CAAC,MAAM,CAerB;IAEF,OAAO,CAAC,OAAO;IAyDf,OAAO,CAAC,OAAO;IA+Df,OAAO,CAAC,IAAI;IAMZ,OAAO,CAAC,IAAI;IAYZ,OAAO,CAAC,IAAI;CASb;AAED,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,MAAM,CAAC,UAAU,EACxB,MAAM,EAAE,MAAM,CAAC,WAAW,GACzB,OAAO,CAAC,IAAI,CAAC,CAEf"}
@@ -0,0 +1,231 @@
1
+ import { spawn } from "node:child_process";
2
+ import readline from "node:readline";
3
+ import { profile } from "../domain/profile.js";
4
+ import { color, control } from "../ui/ansi.js";
5
+ import { centerInTerminal, renderFrame } from "../ui/frame.js";
6
+ const winningMove = {
7
+ rock: "scissors",
8
+ paper: "rock",
9
+ scissors: "paper",
10
+ };
11
+ function openExternal(url) {
12
+ const command = process.platform === "win32"
13
+ ? { file: "cmd.exe", args: ["/d", "/s", "/c", "start", "", url] }
14
+ : process.platform === "darwin"
15
+ ? { file: "open", args: [url] }
16
+ : { file: "xdg-open", args: [url] };
17
+ spawn(command.file, command.args, {
18
+ detached: true,
19
+ stdio: "ignore",
20
+ windowsHide: true,
21
+ }).unref();
22
+ }
23
+ export class InteractiveApp {
24
+ input;
25
+ output;
26
+ screen = "home";
27
+ selectedIndex = 0;
28
+ gameResult;
29
+ resolve;
30
+ constructor(input, output) {
31
+ this.input = input;
32
+ this.output = output;
33
+ }
34
+ run() {
35
+ return new Promise((resolve) => {
36
+ this.resolve = resolve;
37
+ readline.emitKeypressEvents(this.input);
38
+ this.input.setRawMode?.(true);
39
+ this.input.resume();
40
+ this.input.on("keypress", this.onKeypress);
41
+ this.output.on("resize", this.render);
42
+ this.output.write(`${control.alternateScreen}${control.hideCursor}${control.clear}`);
43
+ this.render();
44
+ });
45
+ }
46
+ onKeypress = (_input, key) => {
47
+ if ((key.ctrl === true && key.name === "c") || key.name === "q") {
48
+ this.exit();
49
+ return;
50
+ }
51
+ if (key.name === "escape" || key.name === "left" || key.name === "backspace") {
52
+ if (this.screen === "home") {
53
+ this.exit();
54
+ }
55
+ else {
56
+ this.goTo("home");
57
+ }
58
+ return;
59
+ }
60
+ const actions = this.actions();
61
+ if (key.name === "up" || key.name === "k") {
62
+ this.selectedIndex = (this.selectedIndex - 1 + actions.length) % actions.length;
63
+ this.render();
64
+ }
65
+ else if (key.name === "down" || key.name === "j") {
66
+ this.selectedIndex = (this.selectedIndex + 1) % actions.length;
67
+ this.render();
68
+ }
69
+ else if (key.name === "return" || key.name === "enter" || key.name === "right") {
70
+ actions[this.selectedIndex]?.run();
71
+ this.render();
72
+ }
73
+ };
74
+ render = () => {
75
+ const columns = Math.max(48, this.output.columns ?? 80);
76
+ const rows = Math.max(20, this.output.rows ?? 24);
77
+ const width = Math.min(76, columns - 4);
78
+ const actions = this.actions();
79
+ const frame = renderFrame({
80
+ ...this.content(),
81
+ menu: actions.map((action) => action.row),
82
+ selectedIndex: this.selectedIndex,
83
+ }, width);
84
+ this.output.write(`${control.clear}${centerInTerminal(frame, columns, rows)}`);
85
+ };
86
+ content() {
87
+ switch (this.screen) {
88
+ case "about":
89
+ return {
90
+ title: "About me",
91
+ subtitle: `@${profile.handle}`,
92
+ body: [
93
+ ...profile.bio,
94
+ "",
95
+ `${color.gray("FOCUS")} software · tools · experiments`,
96
+ `${color.gray("NOW")} building one useful thing at a time`,
97
+ ],
98
+ };
99
+ case "projects":
100
+ return {
101
+ title: "Projects",
102
+ subtitle: "ideas becoming software",
103
+ body: [
104
+ `${color.cyan("alimberdi-cli")} personal terminal experience`,
105
+ `${color.gray("status")} v0.2 · open source soon`,
106
+ "",
107
+ "More projects are on the way.",
108
+ ],
109
+ };
110
+ case "contact":
111
+ return {
112
+ title: "Let's connect",
113
+ subtitle: "the internet is one click away",
114
+ body: [
115
+ `${color.gray("GitHub")} github.com/adilkhanalimberdi`,
116
+ `${color.gray("Telegram")} t.me/adilkhanalimberdi`,
117
+ "",
118
+ color.dim("Select a link and press Enter to open it."),
119
+ ],
120
+ };
121
+ case "play":
122
+ return {
123
+ title: "Rock · Paper · Scissors",
124
+ subtitle: "pick your move",
125
+ body: [
126
+ "A tiny game living inside the terminal.",
127
+ ...(this.gameResult === undefined ? [] : ["", color.yellow(this.gameResult)]),
128
+ ],
129
+ };
130
+ case "home":
131
+ return {
132
+ title: profile.displayName,
133
+ subtitle: profile.tagline,
134
+ body: [
135
+ "Welcome to my corner of the terminal.",
136
+ "Explore, connect, or stay for a tiny game.",
137
+ ],
138
+ footer: "↑↓ navigate enter select q quit",
139
+ };
140
+ }
141
+ }
142
+ actions() {
143
+ const back = {
144
+ row: { label: "Back", description: "Return to the main screen" },
145
+ run: () => this.goTo("home"),
146
+ };
147
+ switch (this.screen) {
148
+ case "about":
149
+ return [back];
150
+ case "projects":
151
+ return [
152
+ {
153
+ row: { label: "GitHub", description: "Open my repositories" },
154
+ run: () => openExternal(profile.links.github),
155
+ },
156
+ back,
157
+ ];
158
+ case "contact":
159
+ return [
160
+ {
161
+ row: { label: "GitHub", description: "Open my profile" },
162
+ run: () => openExternal(profile.links.github),
163
+ },
164
+ {
165
+ row: { label: "Telegram", description: "Start a conversation" },
166
+ run: () => openExternal(profile.links.telegram),
167
+ },
168
+ back,
169
+ ];
170
+ case "play":
171
+ return [
172
+ ...["rock", "paper", "scissors"].map((move) => ({
173
+ row: { label: move[0]?.toUpperCase() + move.slice(1), description: "Choose this move" },
174
+ run: () => this.play(move),
175
+ })),
176
+ back,
177
+ ];
178
+ case "home":
179
+ return [
180
+ {
181
+ row: { label: "About", description: "A little context about me" },
182
+ run: () => this.goTo("about"),
183
+ },
184
+ {
185
+ row: { label: "Projects", description: "Things I am building" },
186
+ run: () => this.goTo("projects"),
187
+ },
188
+ {
189
+ row: { label: "Contact", description: "Find me online" },
190
+ run: () => this.goTo("contact"),
191
+ },
192
+ {
193
+ row: { label: "Play", description: "Rock, paper, scissors" },
194
+ run: () => this.goTo("play"),
195
+ },
196
+ {
197
+ row: { label: "Exit", description: "Return to your terminal" },
198
+ run: () => this.exit(),
199
+ },
200
+ ];
201
+ }
202
+ }
203
+ goTo(screen) {
204
+ this.screen = screen;
205
+ this.selectedIndex = 0;
206
+ this.gameResult = undefined;
207
+ }
208
+ play(move) {
209
+ const moves = ["rock", "paper", "scissors"];
210
+ const computer = moves[Math.floor(Math.random() * moves.length)] ?? "rock";
211
+ const outcome = move === computer
212
+ ? "Draw. Great minds think alike."
213
+ : winningMove[move] === computer
214
+ ? "You win. The terminal accepts defeat."
215
+ : "Computer wins. Rematch?";
216
+ this.gameResult = `You: ${move} · CPU: ${computer} — ${outcome}`;
217
+ }
218
+ exit() {
219
+ this.input.off("keypress", this.onKeypress);
220
+ this.output.off("resize", this.render);
221
+ this.input.setRawMode?.(false);
222
+ this.input.pause();
223
+ this.input.unref?.();
224
+ this.output.write(`${control.showCursor}${control.mainScreen}`);
225
+ this.resolve?.();
226
+ }
227
+ }
228
+ export async function runInteractiveApp(input, output) {
229
+ await new InteractiveApp(input, output).run();
230
+ }
231
+ //# sourceMappingURL=interactive-app.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interactive-app.js","sourceRoot":"","sources":["../../src/app/interactive-app.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AA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AAK,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC;QAC/B,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;QAClB,IAAI,CAAC,KAAoD,CAAC,KAAK,EAAE,EAAE,CAAC;QACrE,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC;QAChE,IAAI,CAAC,OAAO,EAAE,EAAE,CAAC;IACnB,CAAC;CACF;AAED,MAAM,CAAC,KAAK,UAAU,iBAAiB,CACrC,KAAwB,EACxB,MAA0B;IAE1B,MAAM,IAAI,cAAc,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC;AAChD,CAAC"}
@@ -1,4 +1,3 @@
1
- import type { Writable } from "node:stream";
2
1
  export declare function execute(args: readonly string[]): string;
3
- export declare function runCli(args: readonly string[], output: Writable): void;
2
+ export declare function runCli(args: readonly string[], input: NodeJS.ReadStream, output: NodeJS.WriteStream): Promise<void>;
4
3
  //# sourceMappingURL=run-cli.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-cli.d.ts","sourceRoot":"","sources":["../../src/app/run-cli.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAkB5C,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAavD;AAED,wBAAgB,MAAM,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,MAAM,EAAE,QAAQ,GAAG,IAAI,CAEtE"}
1
+ {"version":3,"file":"run-cli.d.ts","sourceRoot":"","sources":["../../src/app/run-cli.ts"],"names":[],"mappings":"AAkBA,wBAAgB,OAAO,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,GAAG,MAAM,CAavD;AAED,wBAAsB,MAAM,CAC1B,IAAI,EAAE,SAAS,MAAM,EAAE,EACvB,KAAK,EAAE,MAAM,CAAC,UAAU,EACxB,MAAM,EAAE,MAAM,CAAC,WAAW,GACzB,OAAO,CAAC,IAAI,CAAC,CAOf"}
@@ -3,6 +3,7 @@ import { renderHelp } from "../commands/help.js";
3
3
  import { renderHome } from "../commands/home.js";
4
4
  import { renderPlay } from "../commands/play.js";
5
5
  import { renderProjects } from "../commands/projects.js";
6
+ import { runInteractiveApp } from "./interactive-app.js";
6
7
  const commands = {
7
8
  contact: () => renderContact(),
8
9
  help: () => renderHelp(),
@@ -22,7 +23,11 @@ export function execute(args) {
22
23
  }
23
24
  return renderer(commandArgs);
24
25
  }
25
- export function runCli(args, output) {
26
+ export async function runCli(args, input, output) {
27
+ if (args.length === 0 && input.isTTY === true && output.isTTY === true) {
28
+ await runInteractiveApp(input, output);
29
+ return;
30
+ }
26
31
  output.write(`${execute(args)}\n`);
27
32
  }
28
33
  //# sourceMappingURL=run-cli.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"run-cli.js","sourceRoot":"","sources":["../../src/app/run-cli.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAIzD,MAAM,QAAQ,GAAuC;IACnD,OAAO,EAAE,GAAG,EAAE,CAAC,aAAa,EAAE;IAC9B,IAAI,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE;IACxB,IAAI,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IACnC,QAAQ,EAAE,GAAG,EAAE,CAAC,cAAc,EAAE;IAChC,QAAQ,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE;IAC5B,IAAI,EAAE,GA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Ac,EAAE;IAChC,QAAQ,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE;IAC5B,IAAI,EAAE,GAAG,EAAE,CAAC,UAAU,EAAE;CACzB,CAAC;AAEF,MAAM,UAAU,OAAO,CAAC,IAAuB;IAC7C,MAAM,CAAC,OAAO,EAAE,GAAG,WAAW,CAAC,GAAG,IAAI,CAAC;IAEvC,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,UAAU,EAAE,CAAC;IACtB,CAAC;IAED,MAAM,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,CAAC;IACnC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QAC3B,OAAO,oBAAoB,OAAO,OAAO,UAAU,EAAE,EAAE,CAAC;IAC1D,CAAC;IAED,OAAO,QAAQ,CAAC,WAAW,CAAC,CAAC;AAC/B,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,MAAM,CAC1B,IAAuB,EACvB,KAAwB,EACxB,MAA0B;IAE1B,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC,KAAK,KAAK,IAAI,IAAI,MAAM,CAAC,KAAK,KAAK,IAAI,EAAE,CAAC;QACvE,MAAM,iBAAiB,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;QACvC,OAAO;IACT,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC"}
package/dist/cli.js CHANGED
@@ -1,4 +1,4 @@
1
1
  #!/usr/bin/env node
2
2
  import { runCli } from "./app/run-cli.js";
3
- runCli(process.argv.slice(2), process.stdout);
3
+ await runCli(process.argv.slice(2), process.stdin, process.stdout);
4
4
  //# sourceMappingURL=cli.js.map
package/dist/cli.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC"}
1
+ {"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,MAAM,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC"}
@@ -1,6 +1,8 @@
1
1
  export interface Profile {
2
2
  readonly displayName: string;
3
+ readonly handle: string;
3
4
  readonly tagline: string;
5
+ readonly bio: readonly string[];
4
6
  readonly links: {
5
7
  readonly github: string;
6
8
  readonly telegram: string;
@@ -1 +1 @@
1
- {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/domain/profile.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH;AAED,eAAO,MAAM,OAAO,EAAE,OAOrB,CAAC"}
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/domain/profile.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,GAAG,EAAE,SAAS,MAAM,EAAE,CAAC;IAChC,QAAQ,CAAC,KAAK,EAAE;QACd,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;QACxB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;KAC3B,CAAC;CACH;AAED,eAAO,MAAM,OAAO,EAAE,OAYrB,CAAC"}
@@ -1,6 +1,11 @@
1
1
  export const profile = {
2
2
  displayName: "Adilkhan Alimberdi",
3
- tagline: "Developer · Building useful things",
3
+ handle: "alimberdi",
4
+ tagline: "Developer · Builder · Curious mind",
5
+ bio: [
6
+ "I build useful software, explore new ideas,",
7
+ "and turn curiosity into working projects.",
8
+ ],
4
9
  links: {
5
10
  github: "https://github.com/adilkhanalimberdi",
6
11
  telegram: "https://t.me/adilkhanalimberdi",
@@ -1 +1 @@
1
- {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/domain/profile.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,MAAM,OAAO,GAAY;IAC9B,WAAW,EAAE,oBAAoB;IACjC,OAAO,EAAE,oCAAoC;IAC7C,KAAK,EAAE;QACL,MAAM,EAAE,sCAAsC;QAC9C,QAAQ,EAAE,gCAAgC;KAC3C;CACF,CAAC"}
1
+ {"version":3,"file":"profile.js","sourceRoot":"","sources":["../../src/domain/profile.ts"],"names":[],"mappings":"AAWA,MAAM,CAAC,MAAM,OAAO,GAAY;IAC9B,WAAW,EAAE,oBAAoB;IACjC,MAAM,EAAE,WAAW;IACnB,OAAO,EAAE,oCAAoC;IAC7C,GAAG,EAAE;QACH,6CAA6C;QAC7C,2CAA2C;KAC5C;IACD,KAAK,EAAE;QACL,MAAM,EAAE,sCAAsC;QAC9C,QAAQ,EAAE,gCAAgC;KAC3C;CACF,CAAC"}
@@ -0,0 +1,20 @@
1
+ export declare const control: {
2
+ readonly alternateScreen: "\u001B[?1049h";
3
+ readonly mainScreen: "\u001B[?1049l";
4
+ readonly clear: "\u001B[2J\u001B[H";
5
+ readonly hideCursor: "\u001B[?25l";
6
+ readonly showCursor: "\u001B[?25h";
7
+ };
8
+ export declare const color: {
9
+ readonly bold: (value: string) => string;
10
+ readonly dim: (value: string) => string;
11
+ readonly cyan: (value: string) => string;
12
+ readonly magenta: (value: string) => string;
13
+ readonly yellow: (value: string) => string;
14
+ readonly white: (value: string) => string;
15
+ readonly gray: (value: string) => string;
16
+ readonly selected: (value: string) => string;
17
+ };
18
+ export declare function stripAnsi(value: string): string;
19
+ export declare function visibleLength(value: string): number;
20
+ //# sourceMappingURL=ansi.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ansi.d.ts","sourceRoot":"","sources":["../../src/ui/ansi.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO;;;;;;CAMV,CAAC;AAmBX,eAAO,MAAM,KAAK;2BACF,MAAM,KAAG,MAAM;0BAChB,MAAM,KAAG,MAAM;2BACd,MAAM,KAAG,MAAM;8BACZ,MAAM,KAAG,MAAM;6BAChB,MAAM,KAAG,MAAM;4BAChB,MAAM,KAAG,MAAM;2BAChB,MAAM,KAAG,MAAM;+BACX,MAAM,KAAG,MAAM;CAEzB,CAAC;AAEX,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAEnD"}
@@ -0,0 +1,39 @@
1
+ export const control = {
2
+ alternateScreen: "\u001B[?1049h",
3
+ mainScreen: "\u001B[?1049l",
4
+ clear: "\u001B[2J\u001B[H",
5
+ hideCursor: "\u001B[?25l",
6
+ showCursor: "\u001B[?25h",
7
+ };
8
+ const codes = {
9
+ reset: 0,
10
+ bold: 1,
11
+ dim: 2,
12
+ cyan: 36,
13
+ magenta: 35,
14
+ yellow: 33,
15
+ white: 97,
16
+ gray: 90,
17
+ cyanBackground: 46,
18
+ black: 30,
19
+ };
20
+ function style(code, value) {
21
+ return `\u001B[${code}m${value}\u001B[0m`;
22
+ }
23
+ export const color = {
24
+ bold: (value) => style(codes.bold, value),
25
+ dim: (value) => style(codes.dim, value),
26
+ cyan: (value) => style(codes.cyan, value),
27
+ magenta: (value) => style(codes.magenta, value),
28
+ yellow: (value) => style(codes.yellow, value),
29
+ white: (value) => style(codes.white, value),
30
+ gray: (value) => style(codes.gray, value),
31
+ selected: (value) => `\u001B[${codes.cyanBackground};${codes.black};${codes.bold}m${value}\u001B[0m`,
32
+ };
33
+ export function stripAnsi(value) {
34
+ return value.replace(/\u001B\[[0-?]*[ -/]*[@-~]/g, "");
35
+ }
36
+ export function visibleLength(value) {
37
+ return [...stripAnsi(value)].length;
38
+ }
39
+ //# sourceMappingURL=ansi.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ansi.js","sourceRoot":"","sources":["../../src/ui/ansi.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG;IACrB,eAAe,EAAE,eAAe;IAChC,UAAU,EAAE,eAAe;IAC3B,KAAK,EAAE,mBAAmB;IAC1B,UAAU,EAAE,aAAa;IACzB,UAAU,EAAE,aAAa;CACjB,CAAC;AAEX,MAAM,KAAK,GAAG;IACZ,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,GAAG,EAAE,CAAC;IACN,IAAI,EAAE,EAAE;IACR,OAAO,EAAE,EAAE;IACX,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,EAAE;IACT,IAAI,EAAE,EAAE;IACR,cAAc,EAAE,EAAE;IAClB,KAAK,EAAE,EAAE;CACD,CAAC;AAEX,SAAS,KAAK,CAAC,IAAY,EAAE,KAAa;IACxC,OAAO,UAAU,IAAI,IAAI,KAAK,WAAW,CAAC;AAC5C,CAAC;AAED,MAAM,CAAC,MAAM,KAAK,GAAG;IACnB,IAAI,EAAE,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;IACzD,GAAG,EAAE,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC;IACvD,IAAI,EAAE,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;IACzD,OAAO,EAAE,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,OAAO,EAAE,KAAK,CAAC;IAC/D,MAAM,EAAE,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC;IAC7D,KAAK,EAAE,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,EAAE,KAAK,CAAC;IAC3D,IAAI,EAAE,CAAC,KAAa,EAAU,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC;IACzD,QAAQ,EAAE,CAAC,KAAa,EAAU,EAAE,CAClC,UAAU,KAAK,CAAC,cAAc,IAAI,KAAK,CAAC,KAAK,IAAI,KAAK,CAAC,IAAI,IAAI,KAAK,WAAW;CACzE,CAAC;AAEX,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,OAAO,KAAK,CAAC,OAAO,CAAC,4BAA4B,EAAE,EAAE,CAAC,CAAC;AACzD,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,KAAa;IACzC,OAAO,CAAC,GAAG,SAAS,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;AACtC,CAAC"}
@@ -0,0 +1,17 @@
1
+ export interface MenuRow {
2
+ readonly label: string;
3
+ readonly description: string;
4
+ }
5
+ export interface FrameOptions {
6
+ readonly brand?: string;
7
+ readonly title: string;
8
+ readonly subtitle?: string;
9
+ readonly body?: readonly string[];
10
+ readonly menu?: readonly MenuRow[];
11
+ readonly selectedIndex?: number;
12
+ readonly notice?: string;
13
+ readonly footer?: string;
14
+ }
15
+ export declare function renderFrame(options: FrameOptions, width: number): readonly string[];
16
+ export declare function centerInTerminal(lines: readonly string[], columns: number, rows: number): string;
17
+ //# sourceMappingURL=frame.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frame.d.ts","sourceRoot":"","sources":["../../src/ui/frame.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,OAAO;IACtB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAClC,QAAQ,CAAC,IAAI,CAAC,EAAE,SAAS,OAAO,EAAE,CAAC;IACnC,QAAQ,CAAC,aAAa,CAAC,EAAE,MAAM,CAAC;IAChC,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,CAAC;CAC1B;AAqBD,wBAAgB,WAAW,CAAC,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,CA8CnF;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE,MAAM,EACf,IAAI,EAAE,MAAM,GACX,MAAM,CAMR"}
@@ -0,0 +1,60 @@
1
+ import { color, visibleLength } from "./ansi.js";
2
+ function pad(value, width) {
3
+ return `${value}${" ".repeat(Math.max(0, width - visibleLength(value)))}`;
4
+ }
5
+ function center(value, width) {
6
+ const remaining = Math.max(0, width - visibleLength(value));
7
+ const left = Math.floor(remaining / 2);
8
+ return `${" ".repeat(left)}${value}${" ".repeat(remaining - left)}`;
9
+ }
10
+ function fit(value, width) {
11
+ if (visibleLength(value) <= width) {
12
+ return value;
13
+ }
14
+ const plain = [...value];
15
+ return `${plain.slice(0, Math.max(0, width - 1)).join("")}…`;
16
+ }
17
+ export function renderFrame(options, width) {
18
+ const innerWidth = Math.max(42, width - 2);
19
+ const top = color.cyan(`╭${"─".repeat(innerWidth)}╮`);
20
+ const bottom = color.magenta(`╰${"─".repeat(innerWidth)}╯`);
21
+ const border = (content = "") => `${color.cyan("│")}${pad(fit(content, innerWidth), innerWidth)}${color.magenta("│")}`;
22
+ const divider = border(color.gray(` ${"─".repeat(Math.max(0, innerWidth - 4))} `));
23
+ const lines = [top];
24
+ lines.push(border(` ${color.bold(color.cyan("◆"))} ${color.bold(options.brand ?? "ALIMBERDI")} ${color.gray("/ terminal profile")}`));
25
+ lines.push(border());
26
+ lines.push(border(center(color.bold(color.white(options.title.toUpperCase())), innerWidth)));
27
+ if (options.subtitle !== undefined) {
28
+ lines.push(border(center(color.magenta(options.subtitle), innerWidth)));
29
+ }
30
+ lines.push(border());
31
+ lines.push(divider);
32
+ lines.push(border());
33
+ for (const bodyLine of options.body ?? []) {
34
+ lines.push(border(` ${bodyLine}`));
35
+ }
36
+ if ((options.body?.length ?? 0) > 0 && (options.menu?.length ?? 0) > 0) {
37
+ lines.push(border());
38
+ }
39
+ options.menu?.forEach((item, index) => {
40
+ const label = item.label.padEnd(12);
41
+ const content = ` ${index === options.selectedIndex ? "›" : " "} ${label} ${item.description}`;
42
+ lines.push(border(index === options.selectedIndex ? color.selected(content) : content));
43
+ });
44
+ if (options.notice !== undefined) {
45
+ lines.push(border());
46
+ lines.push(border(center(color.yellow(options.notice), innerWidth)));
47
+ }
48
+ lines.push(border());
49
+ lines.push(divider);
50
+ lines.push(border(center(color.gray(options.footer ?? "↑↓ navigate enter select esc back q quit"), innerWidth)));
51
+ lines.push(bottom);
52
+ return lines;
53
+ }
54
+ export function centerInTerminal(lines, columns, rows) {
55
+ const contentWidth = Math.max(...lines.map(visibleLength));
56
+ const left = " ".repeat(Math.max(0, Math.floor((columns - contentWidth) / 2)));
57
+ const top = "\n".repeat(Math.max(0, Math.floor((rows - lines.length) / 2)));
58
+ return `${top}${lines.map((line) => `${left}${line}`).join("\n")}`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,GAAG,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC;AACrE,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "alimberdi",
3
- "version": "0.1.0",
3
+ "version": "0.2.1",
4
4
  "description": "Adilkhan Alimberdi's interactive personal CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -13,7 +13,7 @@
13
13
  "build": "tsc -p tsconfig.build.json",
14
14
  "dev": "tsx src/cli.ts",
15
15
  "start": "node dist/cli.js",
16
- "test": "tsx --test src/app/run-cli.test.ts",
16
+ "test": "tsx --test src/app/run-cli.test.ts src/ui/frame.test.ts",
17
17
  "check": "tsc -p tsconfig.json --noEmit",
18
18
  "prepack": "npm run build"
19
19
  },