diffact 0.1.0 → 0.2.0

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.
Files changed (52) hide show
  1. package/dist/cli.mjs +2 -0
  2. package/dist/index-node-bKTmbwGt.mjs +1 -0
  3. package/dist/src-CPKE75x0.mjs +11 -0
  4. package/dist/src-Ceryd8j5.mjs +1 -0
  5. package/package.json +4 -5
  6. package/web/dist/assets/{code-block-37QAKDTI-C97XC0lL.js → code-block-37QAKDTI-yDNOZoY4.js} +1 -1
  7. package/web/dist/assets/{index-DWCfDth4.js → index-BlaXWu6U.js} +30 -30
  8. package/web/dist/assets/index-DMEToi1s.css +1 -0
  9. package/web/dist/index.html +2 -2
  10. package/dist/agent-manager.d.ts +0 -32
  11. package/dist/agent-manager.js +0 -502
  12. package/dist/app-server-client.d.ts +0 -38
  13. package/dist/app-server-client.js +0 -249
  14. package/dist/capabilities.d.ts +0 -2
  15. package/dist/capabilities.js +0 -27
  16. package/dist/cli.d.ts +0 -6
  17. package/dist/cli.js +0 -13
  18. package/dist/command-runner.d.ts +0 -83
  19. package/dist/command-runner.js +0 -427
  20. package/dist/editors.d.ts +0 -26
  21. package/dist/editors.js +0 -144
  22. package/dist/gh.d.ts +0 -61
  23. package/dist/gh.js +0 -185
  24. package/dist/git.d.ts +0 -57
  25. package/dist/git.js +0 -482
  26. package/dist/http.d.ts +0 -7
  27. package/dist/http.js +0 -98
  28. package/dist/index-node.d.ts +0 -5
  29. package/dist/index-node.js +0 -51
  30. package/dist/index.d.ts +0 -6
  31. package/dist/index.js +0 -1011
  32. package/dist/list-directories.d.ts +0 -8
  33. package/dist/list-directories.js +0 -32
  34. package/dist/log.d.ts +0 -2
  35. package/dist/log.js +0 -2
  36. package/dist/open-browser.d.ts +0 -5
  37. package/dist/open-browser.js +0 -23
  38. package/dist/project-commands.d.ts +0 -17
  39. package/dist/project-commands.js +0 -152
  40. package/dist/project-path.d.ts +0 -5
  41. package/dist/project-path.js +0 -33
  42. package/dist/runtime.d.ts +0 -65
  43. package/dist/runtime.js +0 -235
  44. package/dist/static.d.ts +0 -10
  45. package/dist/static.js +0 -127
  46. package/dist/types.d.ts +0 -17
  47. package/dist/types.js +0 -1
  48. package/dist/utils.d.ts +0 -3
  49. package/dist/utils.js +0 -26
  50. package/dist/ws-hub.d.ts +0 -20
  51. package/dist/ws-hub.js +0 -123
  52. package/web/dist/assets/index-CRDz04kv.css +0 -1
package/dist/gh.js DELETED
@@ -1,185 +0,0 @@
1
- import { execFile } from "node:child_process";
2
- import { promisify } from "node:util";
3
- import { log } from "./log.js";
4
- import { runtime } from "./runtime.js";
5
- const execFileAsync = promisify(execFile);
6
- const MAX_BUFFER = 1024 * 1024 * 20;
7
- const DEFAULT_PAGE_SIZE = 30;
8
- export async function ghListPullRequests(cwd, options = {}) {
9
- const ghPath = runtime.which("gh");
10
- if (!ghPath) {
11
- log.warn({ cwd }, "gh CLI not found");
12
- return {
13
- available: false,
14
- items: [],
15
- hasMore: false,
16
- nextCursor: null,
17
- error: "GitHub CLI (gh) not found. Please install it.",
18
- };
19
- }
20
- const limit = options.limit ?? DEFAULT_PAGE_SIZE;
21
- // gh pr list doesn't support cursor, use limit+1 to detect hasMore
22
- const fetchLimit = limit + 1;
23
- try {
24
- const args = [
25
- "pr",
26
- "list",
27
- "--state",
28
- "open",
29
- "--limit",
30
- String(fetchLimit),
31
- "--json",
32
- "number,title,headRefName,updatedAt,author,url",
33
- ];
34
- if (options.search) {
35
- args.push("--search", options.search);
36
- }
37
- const { stdout } = await execFileAsync(ghPath, args, {
38
- cwd,
39
- maxBuffer: MAX_BUFFER,
40
- });
41
- const parsed = JSON.parse(stdout);
42
- const allItems = Array.isArray(parsed)
43
- ? parsed.map((item) => ({
44
- number: Number(item.number),
45
- title: String(item.title || ""),
46
- headRefName: String(item.headRefName || ""),
47
- updatedAt: String(item.updatedAt || ""),
48
- author: item.author &&
49
- typeof item.author === "object" &&
50
- "login" in item.author
51
- ? String(item.author.login || "")
52
- : undefined,
53
- url: item.url ? String(item.url) : undefined,
54
- }))
55
- : [];
56
- const hasMore = allItems.length > limit;
57
- const items = hasMore ? allItems.slice(0, limit) : allItems;
58
- const nextCursor = hasMore ? String(items[items.length - 1]?.number) : null;
59
- return { available: true, items, hasMore, nextCursor };
60
- }
61
- catch (error) {
62
- log.error({ err: error, cwd }, "ghListPullRequests failed");
63
- const stderr = error && typeof error === "object" && "stderr" in error
64
- ? String(error.stderr).trim()
65
- : "";
66
- return {
67
- available: false,
68
- items: [],
69
- hasMore: false,
70
- nextCursor: null,
71
- error: stderr || "Failed to list pull requests",
72
- };
73
- }
74
- }
75
- export async function ghListIssues(cwd, options = {}) {
76
- const ghPath = runtime.which("gh");
77
- if (!ghPath) {
78
- return {
79
- available: false,
80
- items: [],
81
- hasMore: false,
82
- nextCursor: null,
83
- error: "GitHub CLI (gh) not found. Please install it.",
84
- };
85
- }
86
- const limit = options.limit ?? DEFAULT_PAGE_SIZE;
87
- const fetchLimit = limit + 1;
88
- const state = options.state ?? "open";
89
- try {
90
- const args = [
91
- "issue",
92
- "list",
93
- "--state",
94
- state,
95
- "--limit",
96
- String(fetchLimit),
97
- "--json",
98
- "number,title,state,updatedAt,author,url,labels",
99
- ];
100
- if (options.search) {
101
- args.push("--search", options.search);
102
- }
103
- const { stdout } = await execFileAsync(ghPath, args, {
104
- cwd,
105
- maxBuffer: MAX_BUFFER,
106
- });
107
- const parsed = JSON.parse(stdout);
108
- const allItems = Array.isArray(parsed)
109
- ? parsed.map((item) => ({
110
- number: Number(item.number),
111
- title: String(item.title || ""),
112
- state: (item.state === "CLOSED" ? "closed" : "open"),
113
- updatedAt: String(item.updatedAt || ""),
114
- author: item.author &&
115
- typeof item.author === "object" &&
116
- "login" in item.author
117
- ? String(item.author.login || "")
118
- : undefined,
119
- url: item.url ? String(item.url) : undefined,
120
- labels: Array.isArray(item.labels)
121
- ? item.labels.map((l) => ({
122
- name: String(l.name || ""),
123
- color: String(l.color || ""),
124
- }))
125
- : [],
126
- }))
127
- : [];
128
- const hasMore = allItems.length > limit;
129
- const items = hasMore ? allItems.slice(0, limit) : allItems;
130
- const nextCursor = hasMore ? String(items[items.length - 1]?.number) : null;
131
- return { available: true, items, hasMore, nextCursor };
132
- }
133
- catch (error) {
134
- log.error({ err: error, cwd }, "ghListIssues failed");
135
- const stderr = error && typeof error === "object" && "stderr" in error
136
- ? String(error.stderr).trim()
137
- : "";
138
- return {
139
- available: false,
140
- items: [],
141
- hasMore: false,
142
- nextCursor: null,
143
- error: stderr || "Failed to list issues",
144
- };
145
- }
146
- }
147
- export async function ghGetIssueDetail(cwd, issueNumber) {
148
- const ghPath = runtime.which("gh");
149
- if (!ghPath) {
150
- return null;
151
- }
152
- try {
153
- const { stdout } = await execFileAsync(ghPath, [
154
- "issue",
155
- "view",
156
- String(issueNumber),
157
- "--json",
158
- "number,title,body,state,author,url,labels,createdAt,updatedAt,comments",
159
- ], { cwd, maxBuffer: MAX_BUFFER });
160
- const item = JSON.parse(stdout);
161
- return {
162
- number: Number(item.number),
163
- title: String(item.title || ""),
164
- body: String(item.body || ""),
165
- state: (item.state === "CLOSED" ? "closed" : "open"),
166
- author: item.author && typeof item.author === "object" && "login" in item.author
167
- ? String(item.author.login || "")
168
- : undefined,
169
- url: item.url ? String(item.url) : undefined,
170
- labels: Array.isArray(item.labels)
171
- ? item.labels.map((l) => ({
172
- name: String(l.name || ""),
173
- color: String(l.color || ""),
174
- }))
175
- : [],
176
- createdAt: String(item.createdAt || ""),
177
- updatedAt: String(item.updatedAt || ""),
178
- commentsCount: Array.isArray(item.comments) ? item.comments.length : 0,
179
- };
180
- }
181
- catch (error) {
182
- log.error({ err: error, cwd, issueNumber }, "ghGetIssueDetail failed");
183
- return null;
184
- }
185
- }
package/dist/git.d.ts DELETED
@@ -1,57 +0,0 @@
1
- export declare function gitDiff(cwd: string, args?: string[], paths?: string[]): Promise<string>;
2
- export declare function gitListStagedFiles(cwd: string): Promise<string[]>;
3
- export declare function gitStagePaths(cwd: string, paths: string[]): Promise<void>;
4
- export declare function gitUnstagePaths(cwd: string, paths: string[]): Promise<void>;
5
- export declare function gitShowFile(cwd: string, ref: string, filePath: string): Promise<string>;
6
- export type GitCommitEntry = {
7
- sha: string;
8
- shortSha: string;
9
- subject: string;
10
- description: string;
11
- authorName: string;
12
- authoredAt: string;
13
- };
14
- export type GitHistoryPage = {
15
- items: GitCommitEntry[];
16
- hasMore: boolean;
17
- nextSkip: number;
18
- };
19
- export declare function gitLog(cwd: string, skip?: number, limit?: number): Promise<GitHistoryPage>;
20
- export declare function gitCommitDiff(cwd: string, sha: string): Promise<string>;
21
- export declare function gitCommitDiffStream(cwd: string, sha: string): ReadableStream<Uint8Array>;
22
- export type GitCommitFileEntry = {
23
- path: string;
24
- status: string;
25
- previousPath?: string;
26
- };
27
- export declare function gitCommitFiles(cwd: string, sha: string): Promise<GitCommitFileEntry[]>;
28
- export declare function gitCommitDiffLineEstimate(cwd: string, sha: string): Promise<number | null>;
29
- export type GitFileTreeEntry = {
30
- name: string;
31
- path: string;
32
- type: "file" | "folder";
33
- children?: GitFileTreeEntry[];
34
- };
35
- export declare function gitListFileTree(cwd: string): Promise<GitFileTreeEntry[]>;
36
- export type GitBranchInfo = {
37
- name: string;
38
- updatedAt: string | null;
39
- };
40
- export type GitBranchListing = {
41
- current: string;
42
- defaultBranch: string;
43
- branches: GitBranchInfo[];
44
- hasMore: boolean;
45
- nextCursor: string | null;
46
- };
47
- export type ListBranchesOptions = {
48
- limit?: number;
49
- cursor?: string | null;
50
- filter?: string | null;
51
- };
52
- export declare function gitListBranches(cwd: string, options?: ListBranchesOptions): Promise<GitBranchInfo[]>;
53
- export declare function gitListBranchesPaginated(cwd: string, options?: ListBranchesOptions): Promise<GitBranchListing>;
54
- export declare function gitCurrentBranch(cwd: string): Promise<string>;
55
- export declare function gitDefaultBranch(cwd: string, branches: GitBranchInfo[], currentBranch: string): Promise<string>;
56
- export declare function gitCheckoutBranch(cwd: string, name: string): Promise<void>;
57
- export declare function gitCreateBranch(cwd: string, name: string): Promise<void>;