opencrush 0.3.3 → 0.3.4

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/dist/index.js +19 -9
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -245550,7 +245550,7 @@ async function runSetupWizard() {
245550
245550
  }
245551
245551
  function getCharacterPreview(name) {
245552
245552
  var _a3, _b2;
245553
- const identityPath = (0, import_path14.join)(getCharsDirResolved(), name, "IDENTITY.md");
245553
+ const identityPath = (0, import_path14.join)(findCharDir(name), "IDENTITY.md");
245554
245554
  if (!(0, import_fs20.existsSync)(identityPath)) return "";
245555
245555
  try {
245556
245556
  const { readFileSync: readFileSync8 } = require("fs");
@@ -245565,7 +245565,7 @@ function getCharacterPreview(name) {
245565
245565
  }
245566
245566
  }
245567
245567
  function maybeOpenCard(name) {
245568
- const cardPath = (0, import_path14.join)(getCharsDirResolved(), name, "card.png");
245568
+ const cardPath = (0, import_path14.join)(findCharDir(name), "card.png");
245569
245569
  if (!(0, import_fs20.existsSync)(cardPath)) return;
245570
245570
  const opener = process.platform === "darwin" ? "open" : process.platform === "win32" ? "start" : "xdg-open";
245571
245571
  (0, import_child_process5.exec)(`${opener} "${cardPath}"`);
@@ -245573,15 +245573,25 @@ function maybeOpenCard(name) {
245573
245573
  function getCharsDirResolved() {
245574
245574
  return (0, import_path14.join)(ROOT_DIR4, "characters");
245575
245575
  }
245576
+ function getAllCharsDirs() {
245577
+ return [.../* @__PURE__ */ new Set([getCharsDirResolved(), getCharactersDir()])];
245578
+ }
245579
+ function findCharDir(name) {
245580
+ for (const dir of getAllCharsDirs()) {
245581
+ if ((0, import_fs20.existsSync)((0, import_path14.join)(dir, name))) return (0, import_path14.join)(dir, name);
245582
+ }
245583
+ return (0, import_path14.join)(getCharsDirResolved(), name);
245584
+ }
245576
245585
  function getExistingCharacters() {
245577
- const charactersDir = getCharsDirResolved();
245578
- if (!(0, import_fs20.existsSync)(charactersDir)) return [];
245579
- try {
245580
- return (0, import_fs20.readdirSync)(charactersDir, { withFileTypes: true }).filter((d2) => d2.isDirectory() && d2.name !== "example").map((d2) => d2.name);
245581
- } catch (err) {
245582
- console.warn("[Setup] Failed to list characters:", err.message);
245583
- return [];
245586
+ const names = /* @__PURE__ */ new Set();
245587
+ for (const dir of getAllCharsDirs()) {
245588
+ if (!(0, import_fs20.existsSync)(dir)) continue;
245589
+ try {
245590
+ (0, import_fs20.readdirSync)(dir, { withFileTypes: true }).filter((d2) => d2.isDirectory() && d2.name !== "example").forEach((d2) => names.add(d2.name));
245591
+ } catch {
245592
+ }
245584
245593
  }
245594
+ return [...names];
245585
245595
  }
245586
245596
  function generateEnvFile(values) {
245587
245597
  const sections = {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "opencrush",
3
- "version": "0.3.3",
3
+ "version": "0.3.4",
4
4
  "description": "Your AI companion lives on your device. She watches dramas, listens to music, and thinks of you.",
5
5
  "bin": {
6
6
  "opencrush": "dist/index.js"