openhome-cli 0.1.15 → 0.1.16

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/dist/cli.js CHANGED
@@ -878,6 +878,27 @@ async function deployCommand(pathArg, opts = {}) {
878
878
  });
879
879
  handleCancel(mode);
880
880
  if (mode === "zip") {
881
+ let scanForZips2 = function(dir, depth = 0) {
882
+ if (!existsSync2(dir)) return;
883
+ try {
884
+ const entries = readdirSync2(dir, { withFileTypes: true });
885
+ for (const entry of entries) {
886
+ const full = join2(dir, entry.name);
887
+ if (entry.isFile() && entry.name.endsWith(".zip") && !seen.has(full)) {
888
+ seen.add(full);
889
+ const shortDir = dir.startsWith(home) ? `~${dir.slice(home.length)}` : dir;
890
+ foundZips.push({
891
+ path: full,
892
+ label: `${entry.name} (${shortDir})`
893
+ });
894
+ } else if (entry.isDirectory() && depth < 2 && !entry.name.startsWith(".")) {
895
+ scanForZips2(full, depth + 1);
896
+ }
897
+ }
898
+ } catch {
899
+ }
900
+ };
901
+ var scanForZips = scanForZips2;
881
902
  const home = homedir();
882
903
  const scanDirs = [
883
904
  process.cwd(),
@@ -886,18 +907,9 @@ async function deployCommand(pathArg, opts = {}) {
886
907
  join2(home, "Documents")
887
908
  ];
888
909
  const foundZips = [];
910
+ const seen = /* @__PURE__ */ new Set();
889
911
  for (const dir of scanDirs) {
890
- if (!existsSync2(dir)) continue;
891
- try {
892
- for (const file of readdirSync2(dir)) {
893
- if (file.endsWith(".zip")) {
894
- const full = join2(dir, file);
895
- const shortDir = dir.startsWith(home) ? `~${dir.slice(home.length)}` : dir;
896
- foundZips.push({ path: full, label: `${file} (${shortDir})` });
897
- }
898
- }
899
- } catch {
900
- }
912
+ scanForZips2(dir);
901
913
  }
902
914
  let zipPath;
903
915
  if (foundZips.length > 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "openhome-cli",
3
- "version": "0.1.15",
3
+ "version": "0.1.16",
4
4
  "description": "CLI for managing OpenHome voice AI abilities",
5
5
  "type": "module",
6
6
  "bin": {
@@ -157,16 +157,33 @@ export async function deployCommand(
157
157
  ];
158
158
 
159
159
  const foundZips: { path: string; label: string }[] = [];
160
- for (const dir of scanDirs) {
161
- if (!existsSync(dir)) continue;
160
+ const seen = new Set<string>();
161
+
162
+ function scanForZips(dir: string, depth = 0): void {
163
+ if (!existsSync(dir)) return;
162
164
  try {
163
- for (const file of readdirSync(dir)) {
164
- if (file.endsWith(".zip")) {
165
- const full = join(dir, file);
165
+ const entries = readdirSync(dir, { withFileTypes: true });
166
+ for (const entry of entries) {
167
+ const full = join(dir, entry.name);
168
+ if (
169
+ entry.isFile() &&
170
+ entry.name.endsWith(".zip") &&
171
+ !seen.has(full)
172
+ ) {
173
+ seen.add(full);
166
174
  const shortDir = dir.startsWith(home)
167
175
  ? `~${dir.slice(home.length)}`
168
176
  : dir;
169
- foundZips.push({ path: full, label: `${file} (${shortDir})` });
177
+ foundZips.push({
178
+ path: full,
179
+ label: `${entry.name} (${shortDir})`,
180
+ });
181
+ } else if (
182
+ entry.isDirectory() &&
183
+ depth < 2 &&
184
+ !entry.name.startsWith(".")
185
+ ) {
186
+ scanForZips(full, depth + 1);
170
187
  }
171
188
  }
172
189
  } catch {
@@ -174,6 +191,10 @@ export async function deployCommand(
174
191
  }
175
192
  }
176
193
 
194
+ for (const dir of scanDirs) {
195
+ scanForZips(dir);
196
+ }
197
+
177
198
  let zipPath: string;
178
199
 
179
200
  if (foundZips.length > 0) {