@theokit/sdk-tools 0.24.0 → 0.25.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.
- package/dist/index.cjs +8 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +8 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -863,9 +863,7 @@ function createGitStatusTool(opts) {
|
|
|
863
863
|
}
|
|
864
864
|
const scopeCheck = checkPathScope(path, projectRoot);
|
|
865
865
|
if (scopeCheck !== null) return scopeCheck;
|
|
866
|
-
const args =
|
|
867
|
-
if (opts.includeBranch !== false) args.push("-b");
|
|
868
|
-
if (path !== void 0 && path !== "") args.push("--", path);
|
|
866
|
+
const args = montarArgs(path, opts.includeBranch !== false);
|
|
869
867
|
if (opts.sandbox !== void 0) {
|
|
870
868
|
return statusViaSandbox(opts.sandbox, ctx, args, timeoutMs);
|
|
871
869
|
}
|
|
@@ -874,6 +872,12 @@ function createGitStatusTool(opts) {
|
|
|
874
872
|
}
|
|
875
873
|
});
|
|
876
874
|
}
|
|
875
|
+
function montarArgs(path, comBranch) {
|
|
876
|
+
const args = ["status", "--porcelain=v1"];
|
|
877
|
+
if (comBranch) args.push("-b");
|
|
878
|
+
if (path !== void 0 && path !== "") args.push("--", path);
|
|
879
|
+
return args;
|
|
880
|
+
}
|
|
877
881
|
async function statusViaSandbox(sandbox, ctx, args, timeoutMs) {
|
|
878
882
|
const command = ["git", ...args].map(shq).join(" ");
|
|
879
883
|
const backend = await resolveSandbox(sandbox, ctx ?? {});
|
|
@@ -1794,19 +1798,11 @@ function createQuestionTool(opts) {
|
|
|
1794
1798
|
}
|
|
1795
1799
|
var MAX_FILE_SIZE = 5 * 1024 * 1024;
|
|
1796
1800
|
var BINARY_PROBE_BYTES = 8 * 1024;
|
|
1797
|
-
var SENSITIVE_SEGMENTS = /* @__PURE__ */ new Set([".env", ".git", "node_modules", ".theo"]);
|
|
1798
|
-
function isForbiddenAtAnyDepth(path) {
|
|
1799
|
-
const segs = path.replace(/\\/g, "/").split("/").filter(Boolean);
|
|
1800
|
-
return segs.some((s) => {
|
|
1801
|
-
if (s === ".env.example") return false;
|
|
1802
|
-
return SENSITIVE_SEGMENTS.has(s) || /^\.env\./.test(s);
|
|
1803
|
-
});
|
|
1804
|
-
}
|
|
1805
1801
|
function forbiddenReadError(path, allowAbsolute) {
|
|
1806
1802
|
if (isForbiddenPath(path)) {
|
|
1807
1803
|
return JSON.stringify({ ok: false, error: "forbidden_path", path });
|
|
1808
1804
|
}
|
|
1809
|
-
if (allowAbsolute && isAbsolute(path) &&
|
|
1805
|
+
if (allowAbsolute && isAbsolute(path) && ehProibidoEmQualquerProfundidade(path)) {
|
|
1810
1806
|
return JSON.stringify({ ok: false, error: "forbidden_path", path });
|
|
1811
1807
|
}
|
|
1812
1808
|
return null;
|