repowise 0.1.69 → 0.1.70
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 +40 -14
- package/package.json +1 -1
package/dist/bin/repowise.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
3
|
// bin/repowise.ts
|
|
4
|
-
import { readFileSync } from "fs";
|
|
4
|
+
import { readFileSync as readFileSync2 } from "fs";
|
|
5
5
|
import { fileURLToPath as fileURLToPath3 } from "url";
|
|
6
|
-
import { dirname as dirname3, join as
|
|
6
|
+
import { dirname as dirname3, join as join16 } from "path";
|
|
7
7
|
import { Command } from "commander";
|
|
8
8
|
|
|
9
9
|
// ../listener/dist/main.js
|
|
@@ -916,8 +916,8 @@ async function showWelcome(currentVersion) {
|
|
|
916
916
|
|
|
917
917
|
// src/commands/create.ts
|
|
918
918
|
import { execSync } from "child_process";
|
|
919
|
-
import { mkdirSync, writeFileSync } from "fs";
|
|
920
|
-
import { join as
|
|
919
|
+
import { mkdirSync, writeFileSync as writeFileSync2 } from "fs";
|
|
920
|
+
import { join as join13 } from "path";
|
|
921
921
|
|
|
922
922
|
// ../listener/dist/process-manager.js
|
|
923
923
|
import { spawn } from "child_process";
|
|
@@ -1787,6 +1787,24 @@ async function scanLocalContextFiles(repoRoot, contextFolder) {
|
|
|
1787
1787
|
}
|
|
1788
1788
|
}
|
|
1789
1789
|
|
|
1790
|
+
// src/lib/gitignore.ts
|
|
1791
|
+
import { readFileSync, writeFileSync, existsSync } from "fs";
|
|
1792
|
+
import { join as join12 } from "path";
|
|
1793
|
+
function ensureGitignore(repoRoot, entry) {
|
|
1794
|
+
const gitignorePath = join12(repoRoot, ".gitignore");
|
|
1795
|
+
if (existsSync(gitignorePath)) {
|
|
1796
|
+
const content = readFileSync(gitignorePath, "utf-8");
|
|
1797
|
+
const lines = content.split("\n").map((l) => l.trim());
|
|
1798
|
+
if (lines.includes(entry) || lines.includes(entry + "/")) {
|
|
1799
|
+
return;
|
|
1800
|
+
}
|
|
1801
|
+
const separator = content.endsWith("\n") ? "" : "\n";
|
|
1802
|
+
writeFileSync(gitignorePath, content + separator + entry + "\n", "utf-8");
|
|
1803
|
+
} else {
|
|
1804
|
+
writeFileSync(gitignorePath, entry + "\n", "utf-8");
|
|
1805
|
+
}
|
|
1806
|
+
}
|
|
1807
|
+
|
|
1790
1808
|
// src/lib/interview-handler.ts
|
|
1791
1809
|
import chalk3 from "chalk";
|
|
1792
1810
|
import { input } from "@inquirer/prompts";
|
|
@@ -2450,7 +2468,7 @@ async function create() {
|
|
|
2450
2468
|
const listResult = await apiRequest(`/v1/repos/${repoId}/context`);
|
|
2451
2469
|
const files = listResult.data?.files ?? listResult.files ?? [];
|
|
2452
2470
|
if (files.length > 0) {
|
|
2453
|
-
const contextDir =
|
|
2471
|
+
const contextDir = join13(repoRoot, DEFAULT_CONTEXT_FOLDER);
|
|
2454
2472
|
mkdirSync(contextDir, { recursive: true });
|
|
2455
2473
|
let downloadedCount = 0;
|
|
2456
2474
|
let failedCount = 0;
|
|
@@ -2464,7 +2482,7 @@ async function create() {
|
|
|
2464
2482
|
const response = await fetch(presignedUrl);
|
|
2465
2483
|
if (response.ok) {
|
|
2466
2484
|
const content = await response.text();
|
|
2467
|
-
|
|
2485
|
+
writeFileSync2(join13(contextDir, file.fileName), content, "utf-8");
|
|
2468
2486
|
downloadedCount++;
|
|
2469
2487
|
} else {
|
|
2470
2488
|
failedCount++;
|
|
@@ -2477,6 +2495,10 @@ async function create() {
|
|
|
2477
2495
|
} else {
|
|
2478
2496
|
spinner.succeed(`Context files downloaded to ./${DEFAULT_CONTEXT_FOLDER}/`);
|
|
2479
2497
|
}
|
|
2498
|
+
try {
|
|
2499
|
+
ensureGitignore(repoRoot, DEFAULT_CONTEXT_FOLDER);
|
|
2500
|
+
} catch {
|
|
2501
|
+
}
|
|
2480
2502
|
} else {
|
|
2481
2503
|
spinner.warn("No context files found on server");
|
|
2482
2504
|
}
|
|
@@ -2650,9 +2672,9 @@ async function logout() {
|
|
|
2650
2672
|
// src/commands/status.ts
|
|
2651
2673
|
import { readFile as readFile9 } from "fs/promises";
|
|
2652
2674
|
import { homedir as homedir9 } from "os";
|
|
2653
|
-
import { basename as basename2, join as
|
|
2654
|
-
var STATE_PATH2 =
|
|
2655
|
-
var CONFIG_PATH3 =
|
|
2675
|
+
import { basename as basename2, join as join14 } from "path";
|
|
2676
|
+
var STATE_PATH2 = join14(homedir9(), ".repowise", "listener-state.json");
|
|
2677
|
+
var CONFIG_PATH3 = join14(homedir9(), ".repowise", "config.json");
|
|
2656
2678
|
async function status() {
|
|
2657
2679
|
let state = null;
|
|
2658
2680
|
try {
|
|
@@ -2711,8 +2733,8 @@ async function status() {
|
|
|
2711
2733
|
|
|
2712
2734
|
// src/commands/sync.ts
|
|
2713
2735
|
import { execSync as execSync2 } from "child_process";
|
|
2714
|
-
import { mkdirSync as mkdirSync2, writeFileSync as
|
|
2715
|
-
import { join as
|
|
2736
|
+
import { mkdirSync as mkdirSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
2737
|
+
import { join as join15 } from "path";
|
|
2716
2738
|
import chalk8 from "chalk";
|
|
2717
2739
|
import ora3 from "ora";
|
|
2718
2740
|
var POLL_INTERVAL_MS2 = 3e3;
|
|
@@ -2862,7 +2884,7 @@ async function sync() {
|
|
|
2862
2884
|
const listResult = await apiRequest(`/v1/repos/${repoId}/context`);
|
|
2863
2885
|
const files = listResult.data?.files ?? listResult.files ?? [];
|
|
2864
2886
|
if (files.length > 0) {
|
|
2865
|
-
const contextDir =
|
|
2887
|
+
const contextDir = join15(repoRoot, DEFAULT_CONTEXT_FOLDER2);
|
|
2866
2888
|
mkdirSync2(contextDir, { recursive: true });
|
|
2867
2889
|
let downloadedCount = 0;
|
|
2868
2890
|
let failedCount = 0;
|
|
@@ -2876,7 +2898,7 @@ async function sync() {
|
|
|
2876
2898
|
const response = await fetch(presignedUrl);
|
|
2877
2899
|
if (response.ok) {
|
|
2878
2900
|
const content = await response.text();
|
|
2879
|
-
|
|
2901
|
+
writeFileSync3(join15(contextDir, file.fileName), content, "utf-8");
|
|
2880
2902
|
downloadedCount++;
|
|
2881
2903
|
} else {
|
|
2882
2904
|
failedCount++;
|
|
@@ -2889,6 +2911,10 @@ async function sync() {
|
|
|
2889
2911
|
} else {
|
|
2890
2912
|
spinner.succeed(`Context files downloaded to ./${DEFAULT_CONTEXT_FOLDER2}/`);
|
|
2891
2913
|
}
|
|
2914
|
+
try {
|
|
2915
|
+
ensureGitignore(repoRoot, DEFAULT_CONTEXT_FOLDER2);
|
|
2916
|
+
} catch {
|
|
2917
|
+
}
|
|
2892
2918
|
} else {
|
|
2893
2919
|
spinner.info("No context files found on server");
|
|
2894
2920
|
}
|
|
@@ -3091,7 +3117,7 @@ async function config() {
|
|
|
3091
3117
|
// bin/repowise.ts
|
|
3092
3118
|
var __filename = fileURLToPath3(import.meta.url);
|
|
3093
3119
|
var __dirname = dirname3(__filename);
|
|
3094
|
-
var pkg = JSON.parse(
|
|
3120
|
+
var pkg = JSON.parse(readFileSync2(join16(__dirname, "..", "..", "package.json"), "utf-8"));
|
|
3095
3121
|
var program = new Command();
|
|
3096
3122
|
program.name("repowise").description("AI-optimized codebase context generator").version(pkg.version).option("--staging", "Use the staging environment").hook("preAction", async () => {
|
|
3097
3123
|
if (program.opts()["staging"]) {
|