team-toon-tack 1.0.9 → 1.0.11

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.
@@ -1,15 +1,13 @@
1
- #!/usr/bin/env bun
2
- import { resolve } from 'node:path';
3
- import { readFileSync } from 'node:fs';
4
-
5
- // Read version from package.json
6
- const pkgPath = new URL('../package.json', import.meta.url).pathname;
7
- const pkg = JSON.parse(readFileSync(pkgPath, 'utf-8'));
8
- const VERSION = pkg.version;
9
-
10
- const COMMANDS = ['init', 'sync', 'work-on', 'done', 'help', 'version'] as const;
11
- type Command = typeof COMMANDS[number];
12
-
1
+ #!/usr/bin/env node
2
+ import {
3
+ __require,
4
+ __toESM
5
+ } from "../cli-pyanjjwn.js";
6
+
7
+ // bin/cli.ts
8
+ import { resolve } from "node:path";
9
+ var VERSION = "1.0.11";
10
+ var COMMANDS = ["init", "sync", "work-on", "done", "help", "version"];
13
11
  function printHelp() {
14
12
  console.log(`
15
13
  team-toon-tack (ttt) - Linear task sync & management CLI
@@ -46,72 +44,57 @@ ENVIRONMENT:
46
44
  More info: https://github.com/wayne930242/team-toon-tack
47
45
  `);
48
46
  }
49
-
50
47
  function printVersion() {
51
48
  console.log(`team-toon-tack v${VERSION}`);
52
49
  }
53
-
54
- function parseGlobalArgs(args: string[]): { dir: string; commandArgs: string[] } {
55
- let dir = process.env.TOON_DIR || resolve(process.cwd(), '.ttt');
56
- const commandArgs: string[] = [];
57
-
58
- for (let i = 0; i < args.length; i++) {
50
+ function parseGlobalArgs(args) {
51
+ let dir = process.env.TOON_DIR || resolve(process.cwd(), ".ttt");
52
+ const commandArgs = [];
53
+ for (let i = 0;i < args.length; i++) {
59
54
  const arg = args[i];
60
- if (arg === '-d' || arg === '--dir') {
61
- dir = resolve(args[++i] || '.');
55
+ if (arg === "-d" || arg === "--dir") {
56
+ dir = resolve(args[++i] || ".");
62
57
  } else {
63
58
  commandArgs.push(arg);
64
59
  }
65
60
  }
66
-
67
61
  return { dir, commandArgs };
68
62
  }
69
-
70
63
  async function main() {
71
64
  const args = process.argv.slice(2);
72
-
73
- if (args.length === 0 || args[0] === 'help' || args[0] === '-h' || args[0] === '--help') {
65
+ if (args.length === 0 || args[0] === "help" || args[0] === "-h" || args[0] === "--help") {
74
66
  printHelp();
75
67
  process.exit(0);
76
68
  }
77
-
78
- if (args[0] === 'version' || args[0] === '-v' || args[0] === '--version') {
69
+ if (args[0] === "version" || args[0] === "-v" || args[0] === "--version") {
79
70
  printVersion();
80
71
  process.exit(0);
81
72
  }
82
-
83
- const command = args[0] as Command;
73
+ const command = args[0];
84
74
  const restArgs = args.slice(1);
85
75
  const { dir, commandArgs } = parseGlobalArgs(restArgs);
86
-
87
- // Set TOON_DIR for scripts to use
88
76
  process.env.TOON_DIR = dir;
89
-
90
77
  if (!COMMANDS.includes(command)) {
91
78
  console.error(`Unknown command: ${command}`);
92
79
  console.error(`Run 'ttt help' for usage.`);
93
80
  process.exit(1);
94
81
  }
95
-
96
- // Import and run the appropriate script
97
- const scriptDir = new URL('../scripts/', import.meta.url).pathname;
98
-
99
82
  try {
100
83
  switch (command) {
101
- case 'init':
102
- process.argv = ['bun', 'init.ts', ...commandArgs];
103
- await import(`${scriptDir}init.ts`);
84
+ case "init":
85
+ process.argv = ["node", "init.js", ...commandArgs];
86
+ await import("../scripts/init.js");
104
87
  break;
105
- case 'sync':
106
- await import(`${scriptDir}sync.ts`);
88
+ case "sync":
89
+ await import("../scripts/sync.js");
107
90
  break;
108
- case 'work-on':
109
- process.argv = ['bun', 'work-on.ts', ...commandArgs];
110
- await import(`${scriptDir}work-on.ts`);
91
+ case "work-on":
92
+ process.argv = ["node", "work-on.js", ...commandArgs];
93
+ await import("../scripts/work-on.js");
111
94
  break;
112
- case 'done':
113
- process.argv = ['bun', 'done-job.ts', ...commandArgs];
114
- await import(`${scriptDir}done-job.ts`);
95
+ case "done":
96
+ process.argv = ["node", "done-job.js", ...commandArgs];
97
+ await import("../scripts/done-job.js");
115
98
  break;
116
99
  }
117
100
  } catch (error) {
@@ -121,5 +104,4 @@ async function main() {
121
104
  process.exit(1);
122
105
  }
123
106
  }
124
-
125
107
  main();