playlist-admin 2.15.67 → 2.15.68

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 (2) hide show
  1. package/cli/index.js +38 -1
  2. package/package.json +1 -1
package/cli/index.js CHANGED
@@ -32,6 +32,8 @@ Usage:
32
32
  playlist-admin skill list List bundled opencode skills
33
33
  playlist-admin skill install [name] [--dir X] Install skill(s) to opencode (~/.config/opencode/skills)
34
34
  playlist-admin skill path [name] Print installed path of a skill
35
+ playlist-admin doctor [--fast] [--verbose] [--no-stt]
36
+ 音訊庫健康檢查(覆蓋率/損毀/品質/語言/額度)
35
37
  `;
36
38
 
37
39
  function projectRoot() {
@@ -44,9 +46,40 @@ function projectRoot() {
44
46
  while (true) {
45
47
  if (fs.existsSync(path.join(dir, 'pubspec.yaml'))) return dir;
46
48
  const parent = path.dirname(dir);
47
- if (parent === dir) return null;
49
+ if (parent === dir) break;
48
50
  dir = parent;
49
51
  }
52
+ // 從 npm 全域包呼叫時 cwd 向上找不到 pubspec.yaml(npm 包不含 Dart 引擎),
53
+ // 這時要找 GUI 的安裝目錄——它才是真正持有 playlist-admin.exe 的地方。
54
+ // 沒有這段 fallback 的話,使用者每次都得手動設 PA_ROOT 才能跑任何命令。
55
+ return installedRoot();
56
+ }
57
+
58
+ /// GUI 安裝目錄候選(依序找第一個真的持有 exe 的)。
59
+ ///
60
+ /// 安裝版(Inno Setup)的 exe 在**目錄根層**,開發版在 build/windows/...,
61
+ /// 兩種都要認,否則只有開發者能從 npm 呼叫 CLI。
62
+ function installedRoot() {
63
+ const home = process.env.USERPROFILE || process.env.HOME || '';
64
+ const localAppData = process.env.LOCALAPPDATA || '';
65
+ const programFiles = process.env.ProgramFiles || 'C:\\Program Files';
66
+ const programFilesX86 =
67
+ process.env['ProgramFiles(x86)'] || 'C:\\Program Files (x86)';
68
+ const dirs = [];
69
+ if (localAppData) {
70
+ dirs.push(path.join(localAppData, 'Programs', 'playlist-admin'));
71
+ dirs.push(path.join(localAppData, 'playlist-admin'));
72
+ }
73
+ if (home) {
74
+ dirs.push(path.join(home, 'playlist-admin'));
75
+ dirs.push(path.join(home, 'Desktop', 'playlist-admin'));
76
+ }
77
+ dirs.push(path.join(programFiles, 'playlist-admin'));
78
+ dirs.push(path.join(programFilesX86, 'playlist-admin'));
79
+ for (const d of dirs) {
80
+ if (exePath(d)) return d;
81
+ }
82
+ return null;
50
83
  }
51
84
 
52
85
  /// npm 包自身目錄(全域 npm i -g 時,cwd 向上找不到 pubspec,
@@ -60,7 +93,11 @@ function packageRoot() {
60
93
  }
61
94
 
62
95
  function exePath(root) {
96
+ if (!root) return null;
63
97
  const candidates = [
98
+ // 安裝版(Inno Setup 打包):exe 直接在安裝目錄根層
99
+ path.join(root, 'playlist-admin.exe'),
100
+ // 開發版:flutter build windows --release 的輸出
64
101
  path.join(root, 'build', 'windows', 'x64', 'runner', 'Release', 'playlist-admin.exe'),
65
102
  path.join(root, 'build', 'windows', 'x64', 'runner', 'Debug', 'playlist-admin.exe'),
66
103
  path.join(root, 'build', 'windows', 'arm64', 'runner', 'Release', 'playlist-admin.exe'),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "playlist-admin",
3
- "version": "2.15.67",
3
+ "version": "2.15.68",
4
4
  "description": "playlist-admin CLI - pipeline, podcast, music + podcast RAG + study RAG (PDF 試題/課本)",
5
5
  "type": "module",
6
6
  "bin": {