@zinn-dev/cli 0.0.1 → 0.0.3

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 (3) hide show
  1. package/index.ts +50 -15
  2. package/package.json +6 -8
  3. package/README.md +0 -21
package/index.ts CHANGED
@@ -1,15 +1,50 @@
1
- #!/usr/bin/env bun
2
- import { createCliRenderer, Box, Text } from "@opentui/core";
3
-
4
- const renderer = await createCliRenderer({
5
- exitOnCtrlC: true,
6
- });
7
-
8
- renderer.root.add(
9
- Box(
10
- { borderStyle: "rounded", padding: 1, flexDirection: "column", gap: 1 },
11
- Text({ content: "zinn", fg: "#00a6ffff" }),
12
- Text({ content: "A kanban workflow for your terminal. Built on OpenTUI.", fg: "#00c8ffff" }),
13
- Text({ content: "Press Ctrl+C to exit" }),
14
- ),
15
- );
1
+ const args = process.argv.slice(2);
2
+ const FLAG = {
3
+ help: ["-h", "--help"],
4
+ project: ["project"],
5
+ create: ["create"],
6
+ };
7
+
8
+ const MESSAGE = {
9
+ displayUnknownCommand: (cmd: string) =>
10
+ `Unrecognized command "${cmd}". Please run \`zinn --help\` for a list of available commands`,
11
+ };
12
+
13
+ if (args.length === 0) {
14
+ if (!!process.stdout.isTTY) {
15
+ const tui = await import("@zinn-dev/tui");
16
+ tui.launch();
17
+ } else {
18
+ console.error("Direct launch in a non-TTY environment is not supported.");
19
+ process.exit(1);
20
+ }
21
+ } else {
22
+ // TODO: isTTY check for human readable colored and structured formatting like tables
23
+ const firstArg = args[0]!;
24
+ if (FLAG.help.includes(firstArg)) {
25
+ console.log(`ZINN - A kanban workflow in the terminal
26
+
27
+ usage: zinn [options]
28
+ -h, --help For help using Zinn`);
29
+ } else {
30
+ const { createProject } = await import("@zinn-dev/core");
31
+
32
+ if (FLAG.project.includes(firstArg)) {
33
+ const secondArg = args[1];
34
+ if (secondArg == null) {
35
+ // TODO: implement `zinn project --help` for better guiding
36
+ console.error(
37
+ `The command "${firstArg}" requires a secondary command: zinn ${firstArg} <command>`,
38
+ );
39
+ process.exit(1);
40
+ } else if (FLAG.create.includes(secondArg)) {
41
+ createProject();
42
+ } else {
43
+ console.error(MESSAGE.displayUnknownCommand(`${firstArg} ${secondArg}`));
44
+ }
45
+ } else {
46
+ console.error(MESSAGE.displayUnknownCommand(firstArg));
47
+ process.exit(1);
48
+ }
49
+ }
50
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zinn-dev/cli",
3
- "version": "0.0.1",
3
+ "version": "0.0.3",
4
4
  "description": "A kanban workflow for your terminal. Built on OpenTUI.",
5
5
  "license": "MIT",
6
6
  "bugs": {
@@ -31,19 +31,17 @@
31
31
  }
32
32
  },
33
33
  "files": [
34
- "index.ts",
35
- "README.md"
34
+ "index.ts"
36
35
  ],
37
36
  "type": "module",
38
37
  "bin": {
39
38
  "zinn": "./index.ts"
40
39
  },
41
- "private": false,
42
- "devDependencies": {
43
- "@types/bun": "latest",
44
- "typescript": "^5"
40
+ "publishConfig": {
41
+ "access": "public"
45
42
  },
46
43
  "dependencies": {
47
- "@opentui/core": "^0.4.5"
44
+ "@zinn-dev/core": "0.0.1",
45
+ "@zinn-dev/tui": "0.0.1"
48
46
  }
49
47
  }
package/README.md DELETED
@@ -1,21 +0,0 @@
1
- # zinn
2
-
3
- A kanban workflow for your terminal. Built on OpenTUI.
4
-
5
- ## Install
6
-
7
- ```bash
8
- bun add -g @zinn-dev/cli
9
- ```
10
-
11
- OpenTUI is based on Bun, so Bun is the recommended runtime.
12
-
13
- ## Usage
14
-
15
- ```bash
16
- zinn
17
- ```
18
-
19
- ## License
20
-
21
- MIT