repowisestage 0.0.1-staging.13 → 0.0.1-staging.14
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 +17 -16
- package/package.json +1 -1
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";
|
|
@@ -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) {
|
|
@@ -834,8 +834,9 @@ async function installUpdate(currentVersion, packageName, targetVersion) {
|
|
|
834
834
|
return { updated: false };
|
|
835
835
|
if (!isNewer(targetVersion, currentVersion))
|
|
836
836
|
return { updated: false };
|
|
837
|
+
const npmBin = join9(dirname3(process.execPath), "npm");
|
|
837
838
|
try {
|
|
838
|
-
const { stdout: prefix } = await execFileAsync2(
|
|
839
|
+
const { stdout: prefix } = await execFileAsync2(npmBin, ["prefix", "-g"], { timeout: 1e4 });
|
|
839
840
|
const npmDir = join9(prefix.trim(), "lib", "node_modules");
|
|
840
841
|
const checkDir = process.platform === "win32" ? prefix.trim() : npmDir;
|
|
841
842
|
await access2(checkDir, constants.W_OK);
|
|
@@ -845,7 +846,7 @@ async function installUpdate(currentVersion, packageName, targetVersion) {
|
|
|
845
846
|
}
|
|
846
847
|
console.log(`[auto-update] Updating ${packageName} from ${currentVersion} to ${targetVersion}...`);
|
|
847
848
|
try {
|
|
848
|
-
await execFileAsync2(
|
|
849
|
+
await execFileAsync2(npmBin, ["install", "-g", `${packageName}@${targetVersion}`], {
|
|
849
850
|
timeout: 6e4
|
|
850
851
|
});
|
|
851
852
|
console.log(`[auto-update] Successfully updated to ${targetVersion}`);
|
|
@@ -1489,8 +1490,8 @@ async function startListener() {
|
|
|
1489
1490
|
const packageName = true ? "repowisestage" : "repowise";
|
|
1490
1491
|
let currentVersion = "";
|
|
1491
1492
|
try {
|
|
1492
|
-
const selfDir =
|
|
1493
|
-
const pkgJsonPath = join12(selfDir, "..", "package.json");
|
|
1493
|
+
const selfDir = dirname4(fileURLToPath2(import.meta.url));
|
|
1494
|
+
const pkgJsonPath = join12(selfDir, "..", "..", "package.json");
|
|
1494
1495
|
const pkgJson = JSON.parse(await readFile5(pkgJsonPath, "utf-8"));
|
|
1495
1496
|
currentVersion = pkgJson.version;
|
|
1496
1497
|
} catch {
|
|
@@ -1876,7 +1877,7 @@ async function showWelcome(currentVersion) {
|
|
|
1876
1877
|
|
|
1877
1878
|
// src/commands/create.ts
|
|
1878
1879
|
import { mkdirSync, writeFileSync as writeFileSync2 } from "fs";
|
|
1879
|
-
import { dirname as
|
|
1880
|
+
import { dirname as dirname6, join as join18 } from "path";
|
|
1880
1881
|
import chalk5 from "chalk";
|
|
1881
1882
|
import ora from "ora";
|
|
1882
1883
|
|
|
@@ -2261,7 +2262,7 @@ async function selectAiTools() {
|
|
|
2261
2262
|
|
|
2262
2263
|
// src/lib/ai-tools.ts
|
|
2263
2264
|
import { readFile as readFile8, writeFile as writeFile10, mkdir as mkdir10, readdir } from "fs/promises";
|
|
2264
|
-
import { join as join16, dirname as
|
|
2265
|
+
import { join as join16, dirname as dirname5 } from "path";
|
|
2265
2266
|
var AI_TOOL_CONFIG = {
|
|
2266
2267
|
cursor: {
|
|
2267
2268
|
label: "Cursor",
|
|
@@ -2391,7 +2392,7 @@ function generateReference(tool, repoName, contextFolder, contextFiles) {
|
|
|
2391
2392
|
async function updateToolConfig(repoRoot, tool, repoName, contextFolder, contextFiles) {
|
|
2392
2393
|
const config2 = AI_TOOL_CONFIG[tool];
|
|
2393
2394
|
const fullPath = join16(repoRoot, config2.filePath);
|
|
2394
|
-
const dir =
|
|
2395
|
+
const dir = dirname5(fullPath);
|
|
2395
2396
|
if (dir !== repoRoot) {
|
|
2396
2397
|
await mkdir10(dir, { recursive: true });
|
|
2397
2398
|
}
|
|
@@ -3133,7 +3134,7 @@ async function create() {
|
|
|
3133
3134
|
if (response.ok) {
|
|
3134
3135
|
const content = await response.text();
|
|
3135
3136
|
const filePath = join18(contextDir, file.fileName);
|
|
3136
|
-
mkdirSync(
|
|
3137
|
+
mkdirSync(dirname6(filePath), { recursive: true });
|
|
3137
3138
|
writeFileSync2(filePath, content, "utf-8");
|
|
3138
3139
|
downloadedCount++;
|
|
3139
3140
|
} else {
|
|
@@ -3253,7 +3254,7 @@ Files are stored on our servers (not in git). Retry when online.`
|
|
|
3253
3254
|
|
|
3254
3255
|
// src/commands/member.ts
|
|
3255
3256
|
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
3256
|
-
import { dirname as
|
|
3257
|
+
import { dirname as dirname7, join as join19 } from "path";
|
|
3257
3258
|
import chalk6 from "chalk";
|
|
3258
3259
|
import ora2 from "ora";
|
|
3259
3260
|
var DEFAULT_CONTEXT_FOLDER2 = "repowise-context";
|
|
@@ -3393,7 +3394,7 @@ async function member() {
|
|
|
3393
3394
|
if (response.ok) {
|
|
3394
3395
|
const content = await response.text();
|
|
3395
3396
|
const filePath = join19(contextDir, file.fileName);
|
|
3396
|
-
mkdirSync2(
|
|
3397
|
+
mkdirSync2(dirname7(filePath), { recursive: true });
|
|
3397
3398
|
writeFileSync3(filePath, content, "utf-8");
|
|
3398
3399
|
downloadedCount++;
|
|
3399
3400
|
} else {
|
|
@@ -3613,7 +3614,7 @@ async function status() {
|
|
|
3613
3614
|
|
|
3614
3615
|
// src/commands/sync.ts
|
|
3615
3616
|
import { mkdirSync as mkdirSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
3616
|
-
import { dirname as
|
|
3617
|
+
import { dirname as dirname8, join as join21 } from "path";
|
|
3617
3618
|
import chalk9 from "chalk";
|
|
3618
3619
|
import ora4 from "ora";
|
|
3619
3620
|
var POLL_INTERVAL_MS2 = 3e3;
|
|
@@ -3771,7 +3772,7 @@ async function sync() {
|
|
|
3771
3772
|
if (response.ok) {
|
|
3772
3773
|
const content = await response.text();
|
|
3773
3774
|
const filePath = join21(contextDir, file.fileName);
|
|
3774
|
-
mkdirSync3(
|
|
3775
|
+
mkdirSync3(dirname8(filePath), { recursive: true });
|
|
3775
3776
|
writeFileSync4(filePath, content, "utf-8");
|
|
3776
3777
|
downloadedCount++;
|
|
3777
3778
|
} else {
|
|
@@ -3989,7 +3990,7 @@ async function config() {
|
|
|
3989
3990
|
|
|
3990
3991
|
// bin/repowise.ts
|
|
3991
3992
|
var __filename = fileURLToPath3(import.meta.url);
|
|
3992
|
-
var __dirname =
|
|
3993
|
+
var __dirname = dirname9(__filename);
|
|
3993
3994
|
var pkg = JSON.parse(readFileSync2(join22(__dirname, "..", "..", "package.json"), "utf-8"));
|
|
3994
3995
|
var program = new Command();
|
|
3995
3996
|
program.name(getPackageName()).description("AI-optimized codebase context generator").version(pkg.version).hook("preAction", async () => {
|