@rayburst/cli 0.2.2 → 0.2.3

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.
@@ -8,6 +8,25 @@ import crypto from "crypto";
8
8
  // src/git-utils.ts
9
9
  import { execSync } from "child_process";
10
10
  import path from "path";
11
+ function getUncommittedChanges(projectPath) {
12
+ try {
13
+ if (!isGitRepository(projectPath)) {
14
+ return [];
15
+ }
16
+ const command = "git diff --name-only HEAD && git diff --name-only --cached";
17
+ const output = execSync(command, {
18
+ cwd: projectPath,
19
+ encoding: "utf8",
20
+ stdio: ["pipe", "pipe", "ignore"]
21
+ // Ignore stderr
22
+ });
23
+ const files = output.split("\n").filter(Boolean).map((file) => path.resolve(projectPath, file.trim()));
24
+ return [...new Set(files)];
25
+ } catch (error) {
26
+ console.error("Failed to get git diff:", error.message);
27
+ return [];
28
+ }
29
+ }
11
30
  function isGitRepository(projectPath) {
12
31
  try {
13
32
  execSync("git rev-parse --is-inside-work-tree", {
@@ -20,6 +39,27 @@ function isGitRepository(projectPath) {
20
39
  return false;
21
40
  }
22
41
  }
42
+ function getUntrackedFiles(projectPath) {
43
+ try {
44
+ if (!isGitRepository(projectPath)) {
45
+ return [];
46
+ }
47
+ const output = execSync("git ls-files --others --exclude-standard", {
48
+ cwd: projectPath,
49
+ encoding: "utf8",
50
+ stdio: ["pipe", "pipe", "ignore"]
51
+ });
52
+ return output.split("\n").filter(Boolean).map((file) => path.resolve(projectPath, file.trim()));
53
+ } catch (error) {
54
+ console.error("Failed to get untracked files:", error.message);
55
+ return [];
56
+ }
57
+ }
58
+ function getAllChangedFiles(projectPath) {
59
+ const uncommitted = getUncommittedChanges(projectPath);
60
+ const untracked = getUntrackedFiles(projectPath);
61
+ return [.../* @__PURE__ */ new Set([...uncommitted, ...untracked])];
62
+ }
23
63
  function getChangedFilesVsRemote(projectPath, remoteBranch = void 0) {
24
64
  try {
25
65
  if (!isGitRepository(projectPath)) {
@@ -74,7 +114,9 @@ function getChangedFilesVsRemote(projectPath, remoteBranch = void 0) {
74
114
  encoding: "utf8",
75
115
  stdio: ["pipe", "pipe", "ignore"]
76
116
  });
77
- return output.split("\n").filter(Boolean).map((file) => path.resolve(projectPath, file.trim()));
117
+ const committedChanges = output.split("\n").filter(Boolean).map((file) => path.resolve(projectPath, file.trim()));
118
+ const uncommittedChanges = getAllChangedFiles(projectPath);
119
+ return [.../* @__PURE__ */ new Set([...committedChanges, ...uncommittedChanges])];
78
120
  } catch (error) {
79
121
  console.warn("Failed to get changed files vs remote:", error.message);
80
122
  return [];
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import {
9
9
  readLocalMeta,
10
10
  writeLocalAnalysis,
11
11
  writeLocalMeta
12
- } from "./chunk-ZAT3D23Y.js";
12
+ } from "./chunk-2VW2AH2U.js";
13
13
  export {
14
14
  addGitignoreEntry,
15
15
  analyzeProject,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  rayburstPlugin
3
- } from "./chunk-ZAT3D23Y.js";
3
+ } from "./chunk-2VW2AH2U.js";
4
4
  export {
5
5
  rayburstPlugin
6
6
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rayburst/cli",
3
- "version": "0.2.2",
3
+ "version": "0.2.3",
4
4
  "description": "Rayburst - Automatic code analysis for TypeScript/JavaScript projects via Vite plugin",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",