taiwan-invoice-skill 2.5.1 → 2.5.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/README.md +8 -8
  2. package/dist/index.js +75 -257
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -105,18 +105,18 @@ taiwan-invoice init --ai antigravity --global # ~/.gemini/antigravity/global_sk
105
105
  |------|------|----------|
106
106
  | **Claude Code** | Anthropic 官方 CLI | `/taiwan-invoice` |
107
107
  | **Cursor** | AI 程式編輯器 | `/taiwan-invoice` |
108
- | **Windsurf** | Codeium 編輯器 | `/taiwan-invoice` |
108
+ | **Windsurf** | Codeium 編輯器 | 自動 |
109
109
  | **Copilot** | GitHub Copilot | `/taiwan-invoice` |
110
110
  | **Antigravity** | Google AI 助手 | `/taiwan-invoice` |
111
111
  | **Kiro** | AWS AI 助手 | `/taiwan-invoice` |
112
- | **Codex** | OpenAI CLI | `/taiwan-invoice` |
113
- | **Qoder** | Qodo AI 助手 | `/taiwan-invoice` |
112
+ | **Codex** | OpenAI CLI | 自動 |
113
+ | **Qoder** | Qodo AI 助手 | 自動 |
114
114
  | **RooCode** | VSCode 擴充 | `/taiwan-invoice` |
115
- | **Gemini CLI** | Google Gemini | `/taiwan-invoice` |
116
- | **Trae** | ByteDance AI | `/taiwan-invoice` |
117
- | **OpenCode** | 開源 AI 助手 | `/taiwan-invoice` |
118
- | **Continue** | 開源 AI 助手 | `/taiwan-invoice` |
119
- | **CodeBuddy** | Tencent AI | `/taiwan-invoice` |
115
+ | **Gemini CLI** | Google Gemini | 自動 |
116
+ | **Trae** | ByteDance AI | 自動 |
117
+ | **OpenCode** | 開源 AI 助手 | 自動 |
118
+ | **Continue** | 開源 AI 助手 | 自動 |
119
+ | **CodeBuddy** | Tencent AI | 自動 |
120
120
 
121
121
  ---
122
122
 
package/dist/index.js CHANGED
@@ -921,8 +921,8 @@ var require_command = __commonJS({
921
921
  "node_modules/commander/lib/command.js"(exports2) {
922
922
  var EventEmitter = require("events").EventEmitter;
923
923
  var childProcess = require("child_process");
924
- var path3 = require("path");
925
- var fs3 = require("fs");
924
+ var path = require("path");
925
+ var fs = require("fs");
926
926
  var process2 = require("process");
927
927
  var { Argument: Argument2, humanReadableArgName } = require_argument();
928
928
  var { CommanderError: CommanderError2 } = require_error();
@@ -1745,10 +1745,10 @@ Expecting one of '${allowedValues.join("', '")}'`);
1745
1745
  let launchWithNode = false;
1746
1746
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
1747
1747
  function findFile(baseDir, baseName) {
1748
- const localBin = path3.resolve(baseDir, baseName);
1749
- if (fs3.existsSync(localBin)) return localBin;
1750
- if (sourceExt.includes(path3.extname(baseName))) return void 0;
1751
- const foundExt = sourceExt.find((ext) => fs3.existsSync(`${localBin}${ext}`));
1748
+ const localBin = path.resolve(baseDir, baseName);
1749
+ if (fs.existsSync(localBin)) return localBin;
1750
+ if (sourceExt.includes(path.extname(baseName))) return void 0;
1751
+ const foundExt = sourceExt.find((ext) => fs.existsSync(`${localBin}${ext}`));
1752
1752
  if (foundExt) return `${localBin}${foundExt}`;
1753
1753
  return void 0;
1754
1754
  }
@@ -1759,23 +1759,23 @@ Expecting one of '${allowedValues.join("', '")}'`);
1759
1759
  if (this._scriptPath) {
1760
1760
  let resolvedScriptPath;
1761
1761
  try {
1762
- resolvedScriptPath = fs3.realpathSync(this._scriptPath);
1762
+ resolvedScriptPath = fs.realpathSync(this._scriptPath);
1763
1763
  } catch (err) {
1764
1764
  resolvedScriptPath = this._scriptPath;
1765
1765
  }
1766
- executableDir = path3.resolve(path3.dirname(resolvedScriptPath), executableDir);
1766
+ executableDir = path.resolve(path.dirname(resolvedScriptPath), executableDir);
1767
1767
  }
1768
1768
  if (executableDir) {
1769
1769
  let localFile = findFile(executableDir, executableFile);
1770
1770
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
1771
- const legacyName = path3.basename(this._scriptPath, path3.extname(this._scriptPath));
1771
+ const legacyName = path.basename(this._scriptPath, path.extname(this._scriptPath));
1772
1772
  if (legacyName !== this._name) {
1773
1773
  localFile = findFile(executableDir, `${legacyName}-${subcommand._name}`);
1774
1774
  }
1775
1775
  }
1776
1776
  executableFile = localFile || executableFile;
1777
1777
  }
1778
- launchWithNode = sourceExt.includes(path3.extname(executableFile));
1778
+ launchWithNode = sourceExt.includes(path.extname(executableFile));
1779
1779
  let proc;
1780
1780
  if (process2.platform !== "win32") {
1781
1781
  if (launchWithNode) {
@@ -2558,7 +2558,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2558
2558
  * @return {Command}
2559
2559
  */
2560
2560
  nameFromFilename(filename) {
2561
- this._name = path3.basename(filename, path3.extname(filename));
2561
+ this._name = path.basename(filename, path.extname(filename));
2562
2562
  return this;
2563
2563
  }
2564
2564
  /**
@@ -2572,9 +2572,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2572
2572
  * @param {string} [path]
2573
2573
  * @return {string|null|Command}
2574
2574
  */
2575
- executableDir(path4) {
2576
- if (path4 === void 0) return this._executableDir;
2577
- this._executableDir = path4;
2575
+ executableDir(path2) {
2576
+ if (path2 === void 0) return this._executableDir;
2577
+ this._executableDir = path2;
2578
2578
  return this;
2579
2579
  }
2580
2580
  /**
@@ -3634,15 +3634,15 @@ var require_route = __commonJS({
3634
3634
  };
3635
3635
  }
3636
3636
  function wrapConversion(toModel, graph) {
3637
- const path3 = [graph[toModel].parent, toModel];
3637
+ const path = [graph[toModel].parent, toModel];
3638
3638
  let fn = conversions[graph[toModel].parent][toModel];
3639
3639
  let cur = graph[toModel].parent;
3640
3640
  while (graph[cur].parent) {
3641
- path3.unshift(graph[cur].parent);
3641
+ path.unshift(graph[cur].parent);
3642
3642
  fn = link(conversions[graph[cur].parent][cur], fn);
3643
3643
  cur = graph[cur].parent;
3644
3644
  }
3645
- fn.conversion = path3;
3645
+ fn.conversion = path;
3646
3646
  return fn;
3647
3647
  }
3648
3648
  module2.exports = function(fromModel) {
@@ -12498,7 +12498,7 @@ var require_buffer_list = __commonJS({
12498
12498
  }
12499
12499
  }, {
12500
12500
  key: "join",
12501
- value: function join5(s) {
12501
+ value: function join3(s) {
12502
12502
  if (this.length === 0) return "";
12503
12503
  var p = this.head;
12504
12504
  var ret = "" + p.data;
@@ -14521,7 +14521,7 @@ var require_stream_readable = __commonJS({
14521
14521
  if (readable === src) {
14522
14522
  if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
14523
14523
  unpipeInfo.hasUnpiped = true;
14524
- cleanup2();
14524
+ cleanup();
14525
14525
  }
14526
14526
  }
14527
14527
  }
@@ -14532,7 +14532,7 @@ var require_stream_readable = __commonJS({
14532
14532
  var ondrain = pipeOnDrain(src);
14533
14533
  dest.on("drain", ondrain);
14534
14534
  var cleanedUp = false;
14535
- function cleanup2() {
14535
+ function cleanup() {
14536
14536
  debug("cleanup");
14537
14537
  dest.removeListener("close", onclose);
14538
14538
  dest.removeListener("finish", onfinish);
@@ -15812,7 +15812,6 @@ var {
15812
15812
  // src/commands/init.ts
15813
15813
  var import_chalk3 = __toESM(require_source());
15814
15814
  var import_prompts = __toESM(require_prompts3());
15815
- var path2 = __toESM(require("path"));
15816
15815
  var os = __toESM(require("os"));
15817
15816
 
15818
15817
  // src/types/index.ts
@@ -15833,22 +15832,6 @@ var AI_TYPES = [
15833
15832
  "codebuddy",
15834
15833
  "all"
15835
15834
  ];
15836
- var AI_FOLDERS = {
15837
- claude: [".claude"],
15838
- cursor: [".cursor"],
15839
- windsurf: [".windsurf"],
15840
- antigravity: [".agent"],
15841
- copilot: [".github"],
15842
- kiro: [".kiro"],
15843
- codex: [".codex"],
15844
- qoder: [".qoder"],
15845
- roocode: [".roo"],
15846
- gemini: [".gemini"],
15847
- trae: [".trae"],
15848
- opencode: [".opencode"],
15849
- continue: [".continue"],
15850
- codebuddy: [".codebuddy"]
15851
- };
15852
15835
 
15853
15836
  // src/utils/template.ts
15854
15837
  var import_promises = require("node:fs/promises");
@@ -15872,9 +15855,9 @@ var AI_TO_PLATFORM = {
15872
15855
  continue: "continue",
15873
15856
  codebuddy: "codebuddy"
15874
15857
  };
15875
- async function exists(path3) {
15858
+ async function exists(path) {
15876
15859
  try {
15877
- await (0, import_promises.access)(path3);
15860
+ await (0, import_promises.access)(path);
15878
15861
  return true;
15879
15862
  } catch {
15880
15863
  return false;
@@ -16081,156 +16064,6 @@ ${msg}
16081
16064
  dim: (msg) => console.log(import_chalk.default.dim(msg))
16082
16065
  };
16083
16066
 
16084
- // src/utils/github.ts
16085
- var https = __toESM(require("https"));
16086
- var fs = __toESM(require("fs"));
16087
- var REPO_OWNER = "Moksa1123";
16088
- var REPO_NAME = "taiwan-invoice";
16089
- async function fetchReleases() {
16090
- return new Promise((resolve, reject) => {
16091
- const options = {
16092
- hostname: "api.github.com",
16093
- path: `/repos/${REPO_OWNER}/${REPO_NAME}/releases`,
16094
- headers: {
16095
- "User-Agent": "taiwan-invoice-skill-cli",
16096
- "Accept": "application/vnd.github.v3+json"
16097
- }
16098
- };
16099
- https.get(options, (res) => {
16100
- let data = "";
16101
- res.on("data", (chunk) => data += chunk);
16102
- res.on("end", () => {
16103
- if (res.statusCode === 200) {
16104
- try {
16105
- resolve(JSON.parse(data));
16106
- } catch (e) {
16107
- reject(new Error("Failed to parse GitHub response"));
16108
- }
16109
- } else if (res.statusCode === 404) {
16110
- resolve([]);
16111
- } else {
16112
- reject(new Error(`GitHub API error: ${res.statusCode}`));
16113
- }
16114
- });
16115
- }).on("error", reject);
16116
- });
16117
- }
16118
- async function getLatestRelease() {
16119
- const releases = await fetchReleases();
16120
- return releases.length > 0 ? releases[0] : null;
16121
- }
16122
- async function downloadRelease(url, dest) {
16123
- return new Promise((resolve, reject) => {
16124
- const file = fs.createWriteStream(dest);
16125
- const request = (downloadUrl) => {
16126
- https.get(downloadUrl, {
16127
- headers: {
16128
- "User-Agent": "taiwan-invoice-skill-cli",
16129
- "Accept": "application/octet-stream"
16130
- }
16131
- }, (res) => {
16132
- if (res.statusCode === 302 || res.statusCode === 301) {
16133
- const redirectUrl = res.headers.location;
16134
- if (redirectUrl) {
16135
- request(redirectUrl);
16136
- return;
16137
- }
16138
- }
16139
- if (res.statusCode !== 200) {
16140
- file.close();
16141
- fs.unlinkSync(dest);
16142
- reject(new Error(`Download failed: ${res.statusCode}`));
16143
- return;
16144
- }
16145
- res.pipe(file);
16146
- file.on("finish", () => {
16147
- file.close();
16148
- resolve();
16149
- });
16150
- }).on("error", (err) => {
16151
- file.close();
16152
- fs.unlinkSync(dest);
16153
- reject(err);
16154
- });
16155
- };
16156
- request(url);
16157
- });
16158
- }
16159
- function getSourceZipUrl(release) {
16160
- return `https://github.com/${REPO_OWNER}/${REPO_NAME}/archive/refs/tags/${release.tag_name}.zip`;
16161
- }
16162
-
16163
- // src/utils/extract.ts
16164
- var fs2 = __toESM(require("fs"));
16165
- var path = __toESM(require("path"));
16166
- var import_child_process = require("child_process");
16167
- async function extractZip(zipPath, destDir) {
16168
- if (!fs2.existsSync(destDir)) {
16169
- fs2.mkdirSync(destDir, { recursive: true });
16170
- }
16171
- const isWindows = process.platform === "win32";
16172
- if (isWindows) {
16173
- const psCommand = `Expand-Archive -Path "${zipPath}" -DestinationPath "${destDir}" -Force`;
16174
- (0, import_child_process.execSync)(`powershell -Command "${psCommand}"`, { stdio: "pipe" });
16175
- } else {
16176
- (0, import_child_process.execSync)(`unzip -o "${zipPath}" -d "${destDir}"`, { stdio: "pipe" });
16177
- }
16178
- }
16179
- async function copyFolders(sourceDir, targetDir, aiType) {
16180
- const copiedFolders = [];
16181
- const foldersToCheck = AI_FOLDERS[aiType];
16182
- for (const folder of foldersToCheck) {
16183
- const sourcePath = path.join(sourceDir, folder);
16184
- const targetPath = path.join(targetDir, folder);
16185
- if (fs2.existsSync(sourcePath)) {
16186
- copyDirRecursive(sourcePath, targetPath);
16187
- copiedFolders.push(folder);
16188
- }
16189
- }
16190
- return copiedFolders;
16191
- }
16192
- function copyDirRecursive(src, dest) {
16193
- if (!fs2.existsSync(dest)) {
16194
- fs2.mkdirSync(dest, { recursive: true });
16195
- }
16196
- const entries = fs2.readdirSync(src, { withFileTypes: true });
16197
- for (const entry of entries) {
16198
- const srcPath = path.join(src, entry.name);
16199
- const destPath = path.join(dest, entry.name);
16200
- if (entry.isDirectory()) {
16201
- copyDirRecursive(srcPath, destPath);
16202
- } else {
16203
- fs2.copyFileSync(srcPath, destPath);
16204
- }
16205
- }
16206
- }
16207
- function findExtractedFolder(destDir) {
16208
- const entries = fs2.readdirSync(destDir, { withFileTypes: true });
16209
- const dirs = entries.filter((e) => e.isDirectory());
16210
- const releaseDir = dirs.find(
16211
- (d) => d.name.includes("taiwan-invoice") || d.name.startsWith("taiwan-invoice")
16212
- );
16213
- return releaseDir ? path.join(destDir, releaseDir.name) : null;
16214
- }
16215
- async function installFromZip(zipPath, targetDir, aiType) {
16216
- const tempDir = path.join(path.dirname(zipPath), "taiwan-invoice-extracted");
16217
- if (fs2.existsSync(tempDir)) {
16218
- fs2.rmSync(tempDir, { recursive: true, force: true });
16219
- }
16220
- await extractZip(zipPath, tempDir);
16221
- const extractedDir = findExtractedFolder(tempDir) || tempDir;
16222
- const copiedFolders = await copyFolders(extractedDir, targetDir, aiType);
16223
- return { copiedFolders, tempDir };
16224
- }
16225
- function cleanup(tempDir, zipPath) {
16226
- if (tempDir && fs2.existsSync(tempDir)) {
16227
- fs2.rmSync(tempDir, { recursive: true, force: true });
16228
- }
16229
- if (zipPath && fs2.existsSync(zipPath)) {
16230
- fs2.unlinkSync(zipPath);
16231
- }
16232
- }
16233
-
16234
16067
  // src/utils/progress.ts
16235
16068
  var import_cli_progress = __toESM(require_cli_progress());
16236
16069
  var import_chalk2 = __toESM(require_source());
@@ -16300,41 +16133,6 @@ async function animatedDelay(ms) {
16300
16133
  }
16301
16134
 
16302
16135
  // src/commands/init.ts
16303
- async function tryGitHubDownload(aiType, targetDir, progress) {
16304
- try {
16305
- const release = await getLatestRelease();
16306
- if (!release) {
16307
- return { success: false, folders: [] };
16308
- }
16309
- progress.nextStep(`Found ${release.tag_name}`);
16310
- await animatedDelay(200);
16311
- const zipUrl = getSourceZipUrl(release);
16312
- const tempDir = os.tmpdir();
16313
- const zipPath = path2.join(tempDir, `taiwan-invoice-${release.tag_name}.zip`);
16314
- await downloadRelease(zipUrl, zipPath);
16315
- progress.nextStep();
16316
- await animatedDelay(200);
16317
- const { copiedFolders, tempDir: extractedDir } = await installFromZip(zipPath, targetDir, aiType);
16318
- progress.nextStep();
16319
- await animatedDelay(200);
16320
- cleanup(extractedDir, zipPath);
16321
- if (copiedFolders.length > 0) {
16322
- progress.nextStep();
16323
- await animatedDelay(150);
16324
- progress.nextStep();
16325
- await animatedDelay(150);
16326
- progress.nextStep();
16327
- await animatedDelay(150);
16328
- progress.nextStep();
16329
- await animatedDelay(150);
16330
- return { success: true, folders: copiedFolders };
16331
- } else {
16332
- return { success: false, folders: [] };
16333
- }
16334
- } catch {
16335
- return { success: false, folders: [] };
16336
- }
16337
- }
16338
16136
  async function initCommand(options) {
16339
16137
  logger.title("Taiwan Invoice Skill Installer");
16340
16138
  let aiType = options.ai;
@@ -16376,41 +16174,25 @@ async function initCommand(options) {
16376
16174
  }
16377
16175
  logger.info(`Installing for: ${import_chalk3.default.cyan(getAITypeDescription(aiType))}${options.global ? " (global)" : ""}`);
16378
16176
  let copiedFolders = [];
16379
- let usedGitHub = false;
16380
16177
  try {
16381
- if (!options.offline && aiType !== "all") {
16382
- const progress = new InstallProgress(INSTALL_STEPS);
16383
- progress.start();
16384
- const result = await tryGitHubDownload(aiType, targetDir, progress);
16385
- if (result.success) {
16386
- copiedFolders = result.folders;
16387
- usedGitHub = true;
16388
- progress.complete();
16389
- } else {
16390
- progress.fail("GitHub unavailable, switching to offline mode...");
16391
- await animatedDelay(500);
16392
- }
16393
- }
16394
- if (!usedGitHub) {
16395
- const progress = new InstallProgress(OFFLINE_STEPS);
16396
- progress.start();
16397
- await animatedDelay(300);
16398
- progress.nextStep();
16399
- if (aiType === "all") {
16400
- copiedFolders = await generateAllPlatformFiles(targetDir);
16401
- } else {
16402
- copiedFolders = await generatePlatformFiles(targetDir, aiType, options.global);
16403
- }
16404
- progress.nextStep();
16405
- await animatedDelay(200);
16406
- progress.nextStep();
16407
- await animatedDelay(150);
16408
- progress.nextStep();
16409
- await animatedDelay(150);
16410
- progress.nextStep();
16411
- await animatedDelay(150);
16412
- progress.complete();
16178
+ const progress = new InstallProgress(OFFLINE_STEPS);
16179
+ progress.start();
16180
+ await animatedDelay(300);
16181
+ progress.nextStep();
16182
+ if (aiType === "all") {
16183
+ copiedFolders = await generateAllPlatformFiles(targetDir);
16184
+ } else {
16185
+ copiedFolders = await generatePlatformFiles(targetDir, aiType, options.global);
16413
16186
  }
16187
+ progress.nextStep();
16188
+ await animatedDelay(200);
16189
+ progress.nextStep();
16190
+ await animatedDelay(150);
16191
+ progress.nextStep();
16192
+ await animatedDelay(150);
16193
+ progress.nextStep();
16194
+ await animatedDelay(150);
16195
+ progress.complete();
16414
16196
  console.log();
16415
16197
  logger.info("Installed folders:");
16416
16198
  copiedFolders.forEach((folder) => {
@@ -16498,6 +16280,42 @@ async function infoCommand() {
16498
16280
  // src/commands/versions.ts
16499
16281
  var import_chalk6 = __toESM(require_source());
16500
16282
  var import_ora = __toESM(require_ora());
16283
+
16284
+ // src/utils/github.ts
16285
+ var https = __toESM(require("https"));
16286
+ var REPO_OWNER = "Moksa1123";
16287
+ var REPO_NAME = "taiwan-invoice";
16288
+ async function fetchReleases() {
16289
+ return new Promise((resolve, reject) => {
16290
+ const options = {
16291
+ hostname: "api.github.com",
16292
+ path: `/repos/${REPO_OWNER}/${REPO_NAME}/releases`,
16293
+ headers: {
16294
+ "User-Agent": "taiwan-invoice-skill-cli",
16295
+ "Accept": "application/vnd.github.v3+json"
16296
+ }
16297
+ };
16298
+ https.get(options, (res) => {
16299
+ let data = "";
16300
+ res.on("data", (chunk) => data += chunk);
16301
+ res.on("end", () => {
16302
+ if (res.statusCode === 200) {
16303
+ try {
16304
+ resolve(JSON.parse(data));
16305
+ } catch (e) {
16306
+ reject(new Error("Failed to parse GitHub response"));
16307
+ }
16308
+ } else if (res.statusCode === 404) {
16309
+ resolve([]);
16310
+ } else {
16311
+ reject(new Error(`GitHub API error: ${res.statusCode}`));
16312
+ }
16313
+ });
16314
+ }).on("error", reject);
16315
+ });
16316
+ }
16317
+
16318
+ // src/commands/versions.ts
16501
16319
  var VERSION2 = "2.0.0";
16502
16320
  async function versionsCommand() {
16503
16321
  logger.title("Taiwan Invoice Skill - Available Versions");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taiwan-invoice-skill",
3
- "version": "2.5.1",
3
+ "version": "2.5.3",
4
4
  "description": "CLI to install Taiwan E-Invoice skill for AI coding assistants",
5
5
  "bin": {
6
6
  "taiwan-invoice": "./dist/index.js"