repowisestage 0.0.1-staging.9 → 0.0.17
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/bin/repowise.js +59 -30
- package/package.json +2 -2
package/dist/bin/repowise.js
CHANGED
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
// bin/repowise.ts
|
|
4
4
|
import { readFileSync as readFileSync2 } from "fs";
|
|
5
5
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
6
|
-
import { dirname as
|
|
6
|
+
import { dirname as dirname9, join as join22 } from "path";
|
|
7
7
|
import { Command } from "commander";
|
|
8
8
|
|
|
9
9
|
// ../listener/dist/main.js
|
|
10
10
|
import { readFile as readFile5, writeFile as writeFile7, mkdir as mkdir7 } from "fs/promises";
|
|
11
11
|
import { execFile as execFile4 } from "child_process";
|
|
12
|
-
import { join as join12, dirname as
|
|
12
|
+
import { join as join12, dirname as dirname4 } from "path";
|
|
13
13
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
14
14
|
import { promisify as promisify3 } from "util";
|
|
15
15
|
import lockfile2 from "proper-lockfile";
|
|
@@ -18,7 +18,7 @@ import lockfile2 from "proper-lockfile";
|
|
|
18
18
|
import { homedir } from "os";
|
|
19
19
|
import { join } from "path";
|
|
20
20
|
function getConfigDir() {
|
|
21
|
-
const isStaging = true ?
|
|
21
|
+
const isStaging = true ? true : false;
|
|
22
22
|
return join(homedir(), isStaging ? ".repowise-staging" : ".repowise");
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -113,7 +113,7 @@ var ROLE_PRIORITY = [
|
|
|
113
113
|
import { readFile, writeFile, rename, unlink, mkdir, chmod } from "fs/promises";
|
|
114
114
|
import { join as join2 } from "path";
|
|
115
115
|
import lockfile from "proper-lockfile";
|
|
116
|
-
var DEFAULT_API_URL =
|
|
116
|
+
var DEFAULT_API_URL = true ? "https://staging-api.repowise.ai" : "https://api.repowise.ai";
|
|
117
117
|
async function getListenerConfig() {
|
|
118
118
|
const configDir = getConfigDir();
|
|
119
119
|
const configPath = join2(configDir, "config.json");
|
|
@@ -824,7 +824,7 @@ async function removePidFile() {
|
|
|
824
824
|
// ../listener/dist/lib/auto-updater.js
|
|
825
825
|
import { execFile as execFile2 } from "child_process";
|
|
826
826
|
import { access as access2, constants } from "fs/promises";
|
|
827
|
-
import { join as join9 } from "path";
|
|
827
|
+
import { dirname as dirname3, join as join9 } from "path";
|
|
828
828
|
import { promisify as promisify2 } from "util";
|
|
829
829
|
var execFileAsync2 = promisify2(execFile2);
|
|
830
830
|
async function installUpdate(currentVersion, packageName, targetVersion) {
|
|
@@ -832,22 +832,24 @@ async function installUpdate(currentVersion, packageName, targetVersion) {
|
|
|
832
832
|
return { updated: false };
|
|
833
833
|
if (!/^\d+\.\d+\.\d+/.test(targetVersion))
|
|
834
834
|
return { updated: false };
|
|
835
|
-
if (!isNewer(targetVersion, currentVersion))
|
|
835
|
+
if (!isNewer(targetVersion, currentVersion)) {
|
|
836
|
+
console.log(`[auto-update] ${targetVersion} is not newer than ${currentVersion} \u2014 skipping`);
|
|
836
837
|
return { updated: false };
|
|
838
|
+
}
|
|
839
|
+
const npmBin = join9(dirname3(process.execPath), "npm");
|
|
837
840
|
try {
|
|
838
|
-
const { stdout: prefix } = await execFileAsync2(
|
|
841
|
+
const { stdout: prefix } = await execFileAsync2(npmBin, ["prefix", "-g"], { timeout: 1e4 });
|
|
839
842
|
const npmDir = join9(prefix.trim(), "lib", "node_modules");
|
|
840
843
|
const checkDir = process.platform === "win32" ? prefix.trim() : npmDir;
|
|
841
844
|
await access2(checkDir, constants.W_OK);
|
|
842
|
-
} catch {
|
|
843
|
-
|
|
845
|
+
} catch (err) {
|
|
846
|
+
const msg = err instanceof Error ? err.message : String(err);
|
|
847
|
+
console.log(`[auto-update] npm global prefix not writable \u2014 skipping update (${msg})`);
|
|
844
848
|
return { updated: false };
|
|
845
849
|
}
|
|
846
850
|
console.log(`[auto-update] Updating ${packageName} from ${currentVersion} to ${targetVersion}...`);
|
|
847
851
|
try {
|
|
848
|
-
await execFileAsync2(
|
|
849
|
-
timeout: 6e4
|
|
850
|
-
});
|
|
852
|
+
await execFileAsync2(npmBin, ["install", "-g", "--ignore-scripts", `${packageName}@${targetVersion}`], { timeout: 6e4 });
|
|
851
853
|
console.log(`[auto-update] Successfully updated to ${targetVersion}`);
|
|
852
854
|
return { updated: true, latestVersion: targetVersion };
|
|
853
855
|
} catch (err) {
|
|
@@ -875,9 +877,35 @@ function isNewer(a, b) {
|
|
|
875
877
|
if (vb.pre && !va.pre)
|
|
876
878
|
return true;
|
|
877
879
|
if (va.pre && vb.pre)
|
|
878
|
-
return va.pre
|
|
880
|
+
return comparePrerelease(va.pre, vb.pre) > 0;
|
|
879
881
|
return false;
|
|
880
882
|
}
|
|
883
|
+
function comparePrerelease(a, b) {
|
|
884
|
+
const aParts = a.split(".");
|
|
885
|
+
const bParts = b.split(".");
|
|
886
|
+
for (let i = 0; i < Math.max(aParts.length, bParts.length); i++) {
|
|
887
|
+
const ap = aParts[i];
|
|
888
|
+
const bp = bParts[i];
|
|
889
|
+
if (ap === void 0)
|
|
890
|
+
return -1;
|
|
891
|
+
if (bp === void 0)
|
|
892
|
+
return 1;
|
|
893
|
+
const aNum = /^\d+$/.test(ap) ? parseInt(ap, 10) : NaN;
|
|
894
|
+
const bNum = /^\d+$/.test(bp) ? parseInt(bp, 10) : NaN;
|
|
895
|
+
if (!isNaN(aNum) && !isNaN(bNum)) {
|
|
896
|
+
if (aNum > bNum)
|
|
897
|
+
return 1;
|
|
898
|
+
if (aNum < bNum)
|
|
899
|
+
return -1;
|
|
900
|
+
} else {
|
|
901
|
+
if (ap > bp)
|
|
902
|
+
return 1;
|
|
903
|
+
if (ap < bp)
|
|
904
|
+
return -1;
|
|
905
|
+
}
|
|
906
|
+
}
|
|
907
|
+
return 0;
|
|
908
|
+
}
|
|
881
909
|
|
|
882
910
|
// ../listener/dist/lifecycle.js
|
|
883
911
|
import { unlink as unlink5 } from "fs/promises";
|
|
@@ -888,7 +916,7 @@ import { execFile as execFile3 } from "child_process";
|
|
|
888
916
|
import { writeFile as writeFile6, mkdir as mkdir6, unlink as unlink4 } from "fs/promises";
|
|
889
917
|
import { homedir as homedir3 } from "os";
|
|
890
918
|
import { join as join10 } from "path";
|
|
891
|
-
var IS_STAGING = true ?
|
|
919
|
+
var IS_STAGING = true ? true : false;
|
|
892
920
|
function exec(cmd, args) {
|
|
893
921
|
return new Promise((resolve, reject) => {
|
|
894
922
|
execFile3(cmd, args, (err, stdout) => {
|
|
@@ -1400,7 +1428,7 @@ async function startListener() {
|
|
|
1400
1428
|
try {
|
|
1401
1429
|
releaseLock = await lockfile2.lock(lockPath, { stale: 3e4, realpath: false });
|
|
1402
1430
|
} catch {
|
|
1403
|
-
console.error(`Listener already running. Stop it first with \`${true ? "
|
|
1431
|
+
console.error(`Listener already running. Stop it first with \`${true ? "repowisestage" : "repowise"} stop\`.`);
|
|
1404
1432
|
process.exitCode = 1;
|
|
1405
1433
|
return;
|
|
1406
1434
|
}
|
|
@@ -1486,14 +1514,15 @@ async function startListener() {
|
|
|
1486
1514
|
}
|
|
1487
1515
|
}
|
|
1488
1516
|
await saveState(state);
|
|
1489
|
-
const packageName = true ? "
|
|
1517
|
+
const packageName = true ? "repowisestage" : "repowise";
|
|
1490
1518
|
let currentVersion = "";
|
|
1491
1519
|
try {
|
|
1492
|
-
const selfDir =
|
|
1493
|
-
const pkgJsonPath = join12(selfDir, "..", "package.json");
|
|
1520
|
+
const selfDir = dirname4(fileURLToPath2(import.meta.url));
|
|
1521
|
+
const pkgJsonPath = join12(selfDir, "..", "..", "package.json");
|
|
1494
1522
|
const pkgJson = JSON.parse(await readFile5(pkgJsonPath, "utf-8"));
|
|
1495
1523
|
currentVersion = pkgJson.version;
|
|
1496
|
-
} catch {
|
|
1524
|
+
} catch (err) {
|
|
1525
|
+
console.log(`[auto-update] Version detection failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
1497
1526
|
}
|
|
1498
1527
|
let pollIntervalMs = 5e3;
|
|
1499
1528
|
let pollCycleCount = 0;
|
|
@@ -1747,7 +1776,7 @@ if (isDirectRun) {
|
|
|
1747
1776
|
// src/lib/env.ts
|
|
1748
1777
|
import { homedir as homedir4 } from "os";
|
|
1749
1778
|
import { join as join13 } from "path";
|
|
1750
|
-
var IS_STAGING2 = true ?
|
|
1779
|
+
var IS_STAGING2 = true ? true : false;
|
|
1751
1780
|
var PRODUCTION = {
|
|
1752
1781
|
apiUrl: "https://api.repowise.ai",
|
|
1753
1782
|
cognitoDomain: "auth.repowise.ai",
|
|
@@ -1769,7 +1798,7 @@ function getConfigDir2() {
|
|
|
1769
1798
|
return join13(homedir4(), IS_STAGING2 ? ".repowise-staging" : ".repowise");
|
|
1770
1799
|
}
|
|
1771
1800
|
function getPackageName() {
|
|
1772
|
-
return true ? "
|
|
1801
|
+
return true ? "repowisestage" : "repowise";
|
|
1773
1802
|
}
|
|
1774
1803
|
|
|
1775
1804
|
// src/lib/welcome.ts
|
|
@@ -1876,7 +1905,7 @@ async function showWelcome(currentVersion) {
|
|
|
1876
1905
|
|
|
1877
1906
|
// src/commands/create.ts
|
|
1878
1907
|
import { mkdirSync, writeFileSync as writeFileSync2 } from "fs";
|
|
1879
|
-
import { dirname as
|
|
1908
|
+
import { dirname as dirname6, join as join18 } from "path";
|
|
1880
1909
|
import chalk5 from "chalk";
|
|
1881
1910
|
import ora from "ora";
|
|
1882
1911
|
|
|
@@ -2261,7 +2290,7 @@ async function selectAiTools() {
|
|
|
2261
2290
|
|
|
2262
2291
|
// src/lib/ai-tools.ts
|
|
2263
2292
|
import { readFile as readFile8, writeFile as writeFile10, mkdir as mkdir10, readdir } from "fs/promises";
|
|
2264
|
-
import { join as join16, dirname as
|
|
2293
|
+
import { join as join16, dirname as dirname5 } from "path";
|
|
2265
2294
|
var AI_TOOL_CONFIG = {
|
|
2266
2295
|
cursor: {
|
|
2267
2296
|
label: "Cursor",
|
|
@@ -2391,7 +2420,7 @@ function generateReference(tool, repoName, contextFolder, contextFiles) {
|
|
|
2391
2420
|
async function updateToolConfig(repoRoot, tool, repoName, contextFolder, contextFiles) {
|
|
2392
2421
|
const config2 = AI_TOOL_CONFIG[tool];
|
|
2393
2422
|
const fullPath = join16(repoRoot, config2.filePath);
|
|
2394
|
-
const dir =
|
|
2423
|
+
const dir = dirname5(fullPath);
|
|
2395
2424
|
if (dir !== repoRoot) {
|
|
2396
2425
|
await mkdir10(dir, { recursive: true });
|
|
2397
2426
|
}
|
|
@@ -3133,7 +3162,7 @@ async function create() {
|
|
|
3133
3162
|
if (response.ok) {
|
|
3134
3163
|
const content = await response.text();
|
|
3135
3164
|
const filePath = join18(contextDir, file.fileName);
|
|
3136
|
-
mkdirSync(
|
|
3165
|
+
mkdirSync(dirname6(filePath), { recursive: true });
|
|
3137
3166
|
writeFileSync2(filePath, content, "utf-8");
|
|
3138
3167
|
downloadedCount++;
|
|
3139
3168
|
} else {
|
|
@@ -3253,7 +3282,7 @@ Files are stored on our servers (not in git). Retry when online.`
|
|
|
3253
3282
|
|
|
3254
3283
|
// src/commands/member.ts
|
|
3255
3284
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
3256
|
-
import { dirname as
|
|
3285
|
+
import { dirname as dirname7, join as join19 } from "path";
|
|
3257
3286
|
import chalk6 from "chalk";
|
|
3258
3287
|
import ora2 from "ora";
|
|
3259
3288
|
var DEFAULT_CONTEXT_FOLDER2 = "repowise-context";
|
|
@@ -3393,7 +3422,7 @@ async function member() {
|
|
|
3393
3422
|
if (response.ok) {
|
|
3394
3423
|
const content = await response.text();
|
|
3395
3424
|
const filePath = join19(contextDir, file.fileName);
|
|
3396
|
-
mkdirSync2(
|
|
3425
|
+
mkdirSync2(dirname7(filePath), { recursive: true });
|
|
3397
3426
|
writeFileSync3(filePath, content, "utf-8");
|
|
3398
3427
|
downloadedCount++;
|
|
3399
3428
|
} else {
|
|
@@ -3613,7 +3642,7 @@ async function status() {
|
|
|
3613
3642
|
|
|
3614
3643
|
// src/commands/sync.ts
|
|
3615
3644
|
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
3616
|
-
import { dirname as
|
|
3645
|
+
import { dirname as dirname8, join as join21 } from "path";
|
|
3617
3646
|
import chalk9 from "chalk";
|
|
3618
3647
|
import ora4 from "ora";
|
|
3619
3648
|
var POLL_INTERVAL_MS2 = 3e3;
|
|
@@ -3771,7 +3800,7 @@ async function sync() {
|
|
|
3771
3800
|
if (response.ok) {
|
|
3772
3801
|
const content = await response.text();
|
|
3773
3802
|
const filePath = join21(contextDir, file.fileName);
|
|
3774
|
-
mkdirSync3(
|
|
3803
|
+
mkdirSync3(dirname8(filePath), { recursive: true });
|
|
3775
3804
|
writeFileSync4(filePath, content, "utf-8");
|
|
3776
3805
|
downloadedCount++;
|
|
3777
3806
|
} else {
|
|
@@ -3989,7 +4018,7 @@ async function config() {
|
|
|
3989
4018
|
|
|
3990
4019
|
// bin/repowise.ts
|
|
3991
4020
|
var __filename = fileURLToPath3(import.meta.url);
|
|
3992
|
-
var __dirname =
|
|
4021
|
+
var __dirname = dirname9(__filename);
|
|
3993
4022
|
var pkg = JSON.parse(readFileSync2(join22(__dirname, "..", "..", "package.json"), "utf-8"));
|
|
3994
4023
|
var program = new Command();
|
|
3995
4024
|
program.name(getPackageName()).description("AI-optimized codebase context generator").version(pkg.version).hook("preAction", async () => {
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "repowisestage",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.17",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "AI-optimized codebase context generator",
|
|
6
6
|
"bin": {
|
|
7
|
-
"
|
|
7
|
+
"repowisestage": "dist/bin/repowise.js"
|
|
8
8
|
},
|
|
9
9
|
"files": [
|
|
10
10
|
"dist/bin"
|