@agi-cli/sdk 0.1.56 → 0.1.58
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/package.json
CHANGED
|
@@ -38,7 +38,14 @@ export function buildGitTools(
|
|
|
38
38
|
description: GIT_STATUS_DESCRIPTION,
|
|
39
39
|
inputSchema: z.object({}).optional(),
|
|
40
40
|
async execute() {
|
|
41
|
-
if (!(await inRepo()))
|
|
41
|
+
if (!(await inRepo())) {
|
|
42
|
+
return {
|
|
43
|
+
error: 'Not a git repository',
|
|
44
|
+
staged: 0,
|
|
45
|
+
unstaged: 0,
|
|
46
|
+
raw: [],
|
|
47
|
+
};
|
|
48
|
+
}
|
|
42
49
|
const gitRoot = await findGitRoot();
|
|
43
50
|
const { stdout } = await execAsync(
|
|
44
51
|
`git -C "${gitRoot}" status --porcelain=v1`,
|
|
@@ -67,7 +74,9 @@ export function buildGitTools(
|
|
|
67
74
|
description: GIT_DIFF_DESCRIPTION,
|
|
68
75
|
inputSchema: z.object({ all: z.boolean().optional().default(false) }),
|
|
69
76
|
async execute({ all }: { all?: boolean }) {
|
|
70
|
-
if (!(await inRepo()))
|
|
77
|
+
if (!(await inRepo())) {
|
|
78
|
+
return { error: 'Not a git repository', all: !!all, patch: '' };
|
|
79
|
+
}
|
|
71
80
|
const gitRoot = await findGitRoot();
|
|
72
81
|
// When all=true, show full working tree diff relative to HEAD
|
|
73
82
|
// so both staged and unstaged changes are included. Otherwise,
|
|
@@ -97,7 +106,9 @@ export function buildGitTools(
|
|
|
97
106
|
amend?: boolean;
|
|
98
107
|
signoff?: boolean;
|
|
99
108
|
}) {
|
|
100
|
-
if (!(await inRepo()))
|
|
109
|
+
if (!(await inRepo())) {
|
|
110
|
+
return { success: false, error: 'Not a git repository' };
|
|
111
|
+
}
|
|
101
112
|
const gitRoot = await findGitRoot();
|
|
102
113
|
const args = [
|
|
103
114
|
'git',
|