repowise 0.1.7 → 0.1.8

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.
@@ -866,7 +866,7 @@ var init_progress_renderer = __esm({
866
866
  }
867
867
  });
868
868
 
869
- // ../listener/src/service-installer.ts
869
+ // ../listener/dist/service-installer.js
870
870
  var service_installer_exports = {};
871
871
  __export(service_installer_exports, {
872
872
  install: () => install,
@@ -1086,7 +1086,7 @@ async function isInstalled() {
1086
1086
  }
1087
1087
  var PLIST_LABEL, SYSTEMD_SERVICE, TASK_NAME;
1088
1088
  var init_service_installer = __esm({
1089
- "../listener/src/service-installer.ts"() {
1089
+ "../listener/dist/service-installer.js"() {
1090
1090
  "use strict";
1091
1091
  PLIST_LABEL = "com.repowise.listener";
1092
1092
  SYSTEMD_SERVICE = "repowise-listener";
@@ -1094,7 +1094,7 @@ var init_service_installer = __esm({
1094
1094
  }
1095
1095
  });
1096
1096
 
1097
- // ../listener/src/process-manager.ts
1097
+ // ../listener/dist/process-manager.js
1098
1098
  var process_manager_exports = {};
1099
1099
  __export(process_manager_exports, {
1100
1100
  getStatus: () => getStatus,
@@ -1118,7 +1118,8 @@ async function readPid() {
1118
1118
  const pid = parseInt(content.trim(), 10);
1119
1119
  return Number.isNaN(pid) ? null : pid;
1120
1120
  } catch (err) {
1121
- if (err.code === "ENOENT") return null;
1121
+ if (err.code === "ENOENT")
1122
+ return null;
1122
1123
  throw err;
1123
1124
  }
1124
1125
  }
@@ -1145,13 +1146,15 @@ async function startBackground() {
1145
1146
  closeSync(stdoutFd);
1146
1147
  closeSync(stderrFd);
1147
1148
  const pid = child.pid;
1148
- if (!pid) throw new Error("Failed to spawn listener process");
1149
+ if (!pid)
1150
+ throw new Error("Failed to spawn listener process");
1149
1151
  await writeFile5(PID_PATH, String(pid));
1150
1152
  return pid;
1151
1153
  }
1152
1154
  async function stopProcess() {
1153
1155
  const pid = await readPid();
1154
- if (pid === null) return;
1156
+ if (pid === null)
1157
+ return;
1155
1158
  if (!isAlive(pid)) {
1156
1159
  await removePidFile();
1157
1160
  return;
@@ -1174,12 +1177,14 @@ async function stopProcess() {
1174
1177
  }
1175
1178
  async function isRunning() {
1176
1179
  const pid = await readPid();
1177
- if (pid === null) return false;
1180
+ if (pid === null)
1181
+ return false;
1178
1182
  return isAlive(pid);
1179
1183
  }
1180
1184
  async function getStatus() {
1181
1185
  const pid = await readPid();
1182
- if (pid === null) return { running: false, pid: null };
1186
+ if (pid === null)
1187
+ return { running: false, pid: null };
1183
1188
  const alive = isAlive(pid);
1184
1189
  return { running: alive, pid: alive ? pid : null };
1185
1190
  }
@@ -1191,7 +1196,7 @@ async function removePidFile() {
1191
1196
  }
1192
1197
  var REPOWISE_DIR, PID_PATH, LOG_DIR;
1193
1198
  var init_process_manager = __esm({
1194
- "../listener/src/process-manager.ts"() {
1199
+ "../listener/dist/process-manager.js"() {
1195
1200
  "use strict";
1196
1201
  REPOWISE_DIR = join5(homedir4(), ".repowise");
1197
1202
  PID_PATH = join5(REPOWISE_DIR, "listener.pid");
@@ -1613,7 +1618,7 @@ var init_sync = __esm({
1613
1618
  }
1614
1619
  });
1615
1620
 
1616
- // ../listener/src/lib/config.ts
1621
+ // ../listener/dist/lib/config.js
1617
1622
  import { readFile as readFile6 } from "fs/promises";
1618
1623
  import { homedir as homedir6 } from "os";
1619
1624
  import { join as join7 } from "path";
@@ -1622,9 +1627,7 @@ async function getListenerConfig() {
1622
1627
  try {
1623
1628
  const data = await readFile6(CONFIG_PATH2, "utf-8");
1624
1629
  const raw = JSON.parse(data);
1625
- const validRepos = (raw.repos ?? []).filter(
1626
- (r) => typeof r === "object" && r !== null && typeof r.repoId === "string" && typeof r.localPath === "string"
1627
- );
1630
+ const validRepos = (raw.repos ?? []).filter((r) => typeof r === "object" && r !== null && typeof r.repoId === "string" && typeof r.localPath === "string");
1628
1631
  return {
1629
1632
  apiUrl: raw.apiUrl ?? apiUrl,
1630
1633
  repos: validRepos
@@ -1635,7 +1638,7 @@ async function getListenerConfig() {
1635
1638
  }
1636
1639
  var CONFIG_DIR3, CONFIG_PATH2, DEFAULT_API_URL;
1637
1640
  var init_config2 = __esm({
1638
- "../listener/src/lib/config.ts"() {
1641
+ "../listener/dist/lib/config.js"() {
1639
1642
  "use strict";
1640
1643
  CONFIG_DIR3 = join7(homedir6(), ".repowise");
1641
1644
  CONFIG_PATH2 = join7(CONFIG_DIR3, "config.json");
@@ -1643,7 +1646,7 @@ var init_config2 = __esm({
1643
1646
  }
1644
1647
  });
1645
1648
 
1646
- // ../listener/src/lib/state.ts
1649
+ // ../listener/dist/lib/state.js
1647
1650
  import { readFile as readFile7, writeFile as writeFile6, mkdir as mkdir6, chmod as chmod2 } from "fs/promises";
1648
1651
  import { homedir as homedir7 } from "os";
1649
1652
  import { join as join8 } from "path";
@@ -1668,14 +1671,14 @@ async function saveState(state) {
1668
1671
  }
1669
1672
  var CONFIG_DIR4, STATE_PATH2;
1670
1673
  var init_state = __esm({
1671
- "../listener/src/lib/state.ts"() {
1674
+ "../listener/dist/lib/state.js"() {
1672
1675
  "use strict";
1673
1676
  CONFIG_DIR4 = join8(homedir7(), ".repowise");
1674
1677
  STATE_PATH2 = join8(CONFIG_DIR4, "listener-state.json");
1675
1678
  }
1676
1679
  });
1677
1680
 
1678
- // ../listener/src/lib/auth.ts
1681
+ // ../listener/dist/lib/auth.js
1679
1682
  import { readFile as readFile8, writeFile as writeFile7, mkdir as mkdir7, chmod as chmod3 } from "fs/promises";
1680
1683
  import { homedir as homedir8 } from "os";
1681
1684
  import { join as join9 } from "path";
@@ -1729,7 +1732,8 @@ async function storeCredentials2(credentials) {
1729
1732
  }
1730
1733
  async function getValidCredentials2() {
1731
1734
  const creds = await getStoredCredentials2();
1732
- if (!creds) return null;
1735
+ if (!creds)
1736
+ return null;
1733
1737
  if (Date.now() > creds.expiresAt - 5 * 60 * 1e3) {
1734
1738
  try {
1735
1739
  const refreshed = await refreshTokens2(creds.refreshToken);
@@ -1743,17 +1747,17 @@ async function getValidCredentials2() {
1743
1747
  }
1744
1748
  var CONFIG_DIR5, CREDENTIALS_PATH2;
1745
1749
  var init_auth2 = __esm({
1746
- "../listener/src/lib/auth.ts"() {
1750
+ "../listener/dist/lib/auth.js"() {
1747
1751
  "use strict";
1748
1752
  CONFIG_DIR5 = join9(homedir8(), ".repowise");
1749
1753
  CREDENTIALS_PATH2 = join9(CONFIG_DIR5, "credentials.json");
1750
1754
  }
1751
1755
  });
1752
1756
 
1753
- // ../listener/src/poll-client.ts
1757
+ // ../listener/dist/poll-client.js
1754
1758
  var POLL_TIMEOUT_MS, AuthError, PollClient;
1755
1759
  var init_poll_client = __esm({
1756
- "../listener/src/poll-client.ts"() {
1760
+ "../listener/dist/poll-client.js"() {
1757
1761
  "use strict";
1758
1762
  init_auth2();
1759
1763
  POLL_TIMEOUT_MS = 3e4;
@@ -1803,10 +1807,10 @@ var init_poll_client = __esm({
1803
1807
  }
1804
1808
  });
1805
1809
 
1806
- // ../listener/src/reconnection.ts
1810
+ // ../listener/dist/reconnection.js
1807
1811
  var DEFAULT_CONFIG, BackoffCalculator;
1808
1812
  var init_reconnection = __esm({
1809
- "../listener/src/reconnection.ts"() {
1813
+ "../listener/dist/reconnection.js"() {
1810
1814
  "use strict";
1811
1815
  DEFAULT_CONFIG = {
1812
1816
  initialDelay: 1e3,
@@ -1820,10 +1824,7 @@ var init_reconnection = __esm({
1820
1824
  this.config = { ...DEFAULT_CONFIG, ...config2 };
1821
1825
  }
1822
1826
  nextDelay() {
1823
- const baseDelay = Math.min(
1824
- this.config.initialDelay * Math.pow(2, this.attempt),
1825
- this.config.maxDelay
1826
- );
1827
+ const baseDelay = Math.min(this.config.initialDelay * Math.pow(2, this.attempt), this.config.maxDelay);
1827
1828
  const jitter = Math.random() * this.config.jitterMax;
1828
1829
  this.attempt++;
1829
1830
  return baseDelay + jitter;
@@ -1838,7 +1839,7 @@ var init_reconnection = __esm({
1838
1839
  }
1839
1840
  });
1840
1841
 
1841
- // ../listener/src/notification.ts
1842
+ // ../listener/dist/notification.js
1842
1843
  import notifier from "node-notifier";
1843
1844
  function notifyConnectionLost() {
1844
1845
  try {
@@ -1869,14 +1870,14 @@ function notifyContextUpdated(repoId, fileCount) {
1869
1870
  }
1870
1871
  var TITLE, notify;
1871
1872
  var init_notification = __esm({
1872
- "../listener/src/notification.ts"() {
1873
+ "../listener/dist/notification.js"() {
1873
1874
  "use strict";
1874
1875
  TITLE = "RepoWise";
1875
1876
  notify = notifier.notify.bind(notifier);
1876
1877
  }
1877
1878
  });
1878
1879
 
1879
- // ../listener/src/file-writer.ts
1880
+ // ../listener/dist/file-writer.js
1880
1881
  import { access } from "fs/promises";
1881
1882
  import { join as join10 } from "path";
1882
1883
  async function verifyContextFolder(localPath) {
@@ -1888,12 +1889,12 @@ async function verifyContextFolder(localPath) {
1888
1889
  }
1889
1890
  }
1890
1891
  var init_file_writer = __esm({
1891
- "../listener/src/file-writer.ts"() {
1892
+ "../listener/dist/file-writer.js"() {
1892
1893
  "use strict";
1893
1894
  }
1894
1895
  });
1895
1896
 
1896
- // ../listener/src/context-fetcher.ts
1897
+ // ../listener/dist/context-fetcher.js
1897
1898
  import { execFile as execFile2 } from "child_process";
1898
1899
  import { promisify } from "util";
1899
1900
  async function fetchContextUpdates(localPath) {
@@ -1935,14 +1936,14 @@ async function fetchContextUpdates(localPath) {
1935
1936
  }
1936
1937
  var execFileAsync;
1937
1938
  var init_context_fetcher = __esm({
1938
- "../listener/src/context-fetcher.ts"() {
1939
+ "../listener/dist/context-fetcher.js"() {
1939
1940
  "use strict";
1940
1941
  init_file_writer();
1941
1942
  execFileAsync = promisify(execFile2);
1942
1943
  }
1943
1944
  });
1944
1945
 
1945
- // ../listener/src/main.ts
1946
+ // ../listener/dist/main.js
1946
1947
  var main_exports = {};
1947
1948
  __export(main_exports, {
1948
1949
  startListener: () => startListener,
@@ -1968,9 +1969,7 @@ async function handleStalePid() {
1968
1969
  if (!Number.isNaN(pid) && pid !== process.pid) {
1969
1970
  try {
1970
1971
  process.kill(pid, 0);
1971
- console.error(
1972
- `Listener already running (PID: ${pid}). Stop it first with \`repowise stop\`.`
1973
- );
1972
+ console.error(`Listener already running (PID: ${pid}). Stop it first with \`repowise stop\`.`);
1974
1973
  process.exitCode = 1;
1975
1974
  return true;
1976
1975
  } catch {
@@ -1994,7 +1993,8 @@ function sleep(ms) {
1994
1993
  sleepResolve = null;
1995
1994
  resolve();
1996
1995
  }, ms);
1997
- if (typeof timer === "object" && "unref" in timer) timer.unref();
1996
+ if (typeof timer === "object" && "unref" in timer)
1997
+ timer.unref();
1998
1998
  });
1999
1999
  }
2000
2000
  async function processNotifications(notifications, state, repoLocalPaths) {
@@ -2018,13 +2018,15 @@ async function processNotifications(notifications, state, repoLocalPaths) {
2018
2018
  return updateCount;
2019
2019
  }
2020
2020
  async function handleCatchUp(offlineState, pollClient, repoIds, state, repoLocalPaths) {
2021
- if (!offlineState.offlineSince) return;
2021
+ if (!offlineState.offlineSince)
2022
+ return;
2022
2023
  const offlineDuration = Date.now() - new Date(offlineState.offlineSince).getTime();
2023
2024
  if (offlineDuration >= TWENTY_FOUR_HOURS_MS) {
2024
2025
  let syncCount = 0;
2025
2026
  for (const [, localPath] of repoLocalPaths) {
2026
2027
  const result = await fetchContextUpdates(localPath);
2027
- if (result.success) syncCount++;
2028
+ if (result.success)
2029
+ syncCount++;
2028
2030
  }
2029
2031
  notifyBackOnline(syncCount);
2030
2032
  } else {
@@ -2038,7 +2040,8 @@ async function handleCatchUp(offlineState, pollClient, repoIds, state, repoLocal
2038
2040
  async function startListener() {
2039
2041
  running = true;
2040
2042
  const alreadyRunning = await handleStalePid();
2041
- if (alreadyRunning) return;
2043
+ if (alreadyRunning)
2044
+ return;
2042
2045
  await writePidFile();
2043
2046
  const config2 = await getListenerConfig();
2044
2047
  if (config2.repos.length === 0) {
@@ -2098,7 +2101,8 @@ async function startListener() {
2098
2101
  pollIntervalMs = response.pollIntervalMs;
2099
2102
  await sleep(pollIntervalMs);
2100
2103
  } catch (err) {
2101
- if (!running) break;
2104
+ if (!running)
2105
+ break;
2102
2106
  if (err instanceof AuthError) {
2103
2107
  console.error(err.message);
2104
2108
  process.exitCode = 1;
@@ -2113,9 +2117,7 @@ async function startListener() {
2113
2117
  offlineState.attemptCount++;
2114
2118
  const delay = backoff.nextDelay();
2115
2119
  const message = err instanceof Error ? err.message : "Unknown error";
2116
- console.error(
2117
- `Poll failed (attempt ${offlineState.attemptCount}): ${message}. Retrying in ${Math.round(delay / 1e3)}s`
2118
- );
2120
+ console.error(`Poll failed (attempt ${offlineState.attemptCount}): ${message}. Retrying in ${Math.round(delay / 1e3)}s`);
2119
2121
  await sleep(delay);
2120
2122
  }
2121
2123
  }
@@ -2123,7 +2125,7 @@ async function startListener() {
2123
2125
  }
2124
2126
  var TWENTY_FOUR_HOURS_MS, PID_PATH2, running, sleepResolve, isDirectRun;
2125
2127
  var init_main = __esm({
2126
- "../listener/src/main.ts"() {
2128
+ "../listener/dist/main.js"() {
2127
2129
  "use strict";
2128
2130
  init_config2();
2129
2131
  init_state();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "repowise",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "type": "module",
5
5
  "description": "AI-optimized codebase context generator",
6
6
  "bin": {