@theokit/sdk-tools 0.26.2 → 0.26.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.
- package/CHANGELOG.md +20 -0
- package/dist/index.cjs +11 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +11 -11
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.26.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 8790f70: Refuse a `workspace:` range before it can reach npm.
|
|
8
|
+
|
|
9
|
+
Five of this repo's twelve publishable packages declare internal dependencies as `workspace:^`, which
|
|
10
|
+
is correct on disk and becomes an unrecoverable defect if the publish goes out through a tool that
|
|
11
|
+
does not rewrite it: `pnpm` resolves the protocol while packing, `npm` ships the manifest verbatim.
|
|
12
|
+
A version published that way fails to install for everyone and cannot be corrected — only
|
|
13
|
+
deprecated.
|
|
14
|
+
|
|
15
|
+
Every publishable package now runs the guard in `prepublishOnly`, so it fires whichever way the
|
|
16
|
+
publish is invoked, and `pnpm release` runs it once across the repo before `changeset publish`.
|
|
17
|
+
|
|
18
|
+
Note for anyone reading a published manifest: the `prepublishOnly` entry points at a path inside
|
|
19
|
+
this repository. It never runs for a consumer — the hook only fires when the package itself is
|
|
20
|
+
published — and guarding the entry point that a hand-run `npm publish` actually uses was worth the
|
|
21
|
+
cosmetic wart of shipping the line.
|
|
22
|
+
|
|
3
23
|
## 0.26.2
|
|
4
24
|
|
|
5
25
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
|
@@ -793,12 +793,12 @@ function checkPathScope(path, projectRoot) {
|
|
|
793
793
|
throw err;
|
|
794
794
|
}
|
|
795
795
|
}
|
|
796
|
-
var
|
|
797
|
-
function
|
|
796
|
+
var SENSITIVE_SEGMENTS = /* @__PURE__ */ new Set([".env", ".git", "node_modules", ".theo"]);
|
|
797
|
+
function isForbiddenAtAnyDepth(path) {
|
|
798
798
|
const segs = path.replace(/\\/g, "/").split("/").filter(Boolean);
|
|
799
799
|
return segs.some((s) => {
|
|
800
800
|
if (s === ".env.example") return false;
|
|
801
|
-
return
|
|
801
|
+
return SENSITIVE_SEGMENTS.has(s) || /^\.env\./.test(s);
|
|
802
802
|
});
|
|
803
803
|
}
|
|
804
804
|
|
|
@@ -1586,7 +1586,7 @@ function createListDirTool(opts) {
|
|
|
1586
1586
|
}),
|
|
1587
1587
|
handler: async ({ path }, ctx) => {
|
|
1588
1588
|
const relative3 = path === "" || path === "." ? "." : path;
|
|
1589
|
-
const verdict =
|
|
1589
|
+
const verdict = decideScope(relative3, path, opts.allowAbsolute === true);
|
|
1590
1590
|
if (verdict.error !== void 0) return verdict.error;
|
|
1591
1591
|
if (verdict.absoluteRoot !== void 0) {
|
|
1592
1592
|
return listViaLocalFs(verdict.absoluteRoot, ".", path, max);
|
|
@@ -1599,14 +1599,14 @@ function createListDirTool(opts) {
|
|
|
1599
1599
|
}
|
|
1600
1600
|
});
|
|
1601
1601
|
}
|
|
1602
|
-
function
|
|
1602
|
+
function decideScope(relative3, original, allowAbsolute) {
|
|
1603
1603
|
const refuse = (error) => ({
|
|
1604
1604
|
error: JSON.stringify({ ok: false, error, path: original })
|
|
1605
1605
|
});
|
|
1606
1606
|
if (relative3 !== "." && pathSafety.isForbiddenPath(relative3)) return refuse("forbidden_path");
|
|
1607
1607
|
if (!path.isAbsolute(relative3)) return {};
|
|
1608
1608
|
if (!allowAbsolute) return refuse("path_traversal");
|
|
1609
|
-
if (
|
|
1609
|
+
if (isForbiddenAtAnyDepth(relative3)) return refuse("forbidden_path");
|
|
1610
1610
|
return { absoluteRoot: relative3 };
|
|
1611
1611
|
}
|
|
1612
1612
|
async function listViaLocalFs(projectRoot, relative3, originalPath, max) {
|
|
@@ -1769,10 +1769,10 @@ function createPlanModeTool(options) {
|
|
|
1769
1769
|
}
|
|
1770
1770
|
|
|
1771
1771
|
// src/question.ts
|
|
1772
|
-
function
|
|
1772
|
+
function askerFromContext(context) {
|
|
1773
1773
|
if (typeof context !== "object" || context === null) return void 0;
|
|
1774
|
-
const
|
|
1775
|
-
return typeof
|
|
1774
|
+
const candidate = context.askUser;
|
|
1775
|
+
return typeof candidate === "function" ? candidate : void 0;
|
|
1776
1776
|
}
|
|
1777
1777
|
function createQuestionTool(opts) {
|
|
1778
1778
|
const timeoutMs = opts.timeoutMs ?? 3e5;
|
|
@@ -1787,7 +1787,7 @@ function createQuestionTool(opts) {
|
|
|
1787
1787
|
required: ["question"]
|
|
1788
1788
|
},
|
|
1789
1789
|
handler: async (input, ctx) => {
|
|
1790
|
-
const askUser =
|
|
1790
|
+
const askUser = askerFromContext(ctx?.context) ?? opts.askUser;
|
|
1791
1791
|
if (askUser === void 0) {
|
|
1792
1792
|
return JSON.stringify({
|
|
1793
1793
|
ok: false,
|
|
@@ -1824,7 +1824,7 @@ function forbiddenReadError(path$1, allowAbsolute) {
|
|
|
1824
1824
|
if (pathSafety.isForbiddenPath(path$1)) {
|
|
1825
1825
|
return JSON.stringify({ ok: false, error: "forbidden_path", path: path$1 });
|
|
1826
1826
|
}
|
|
1827
|
-
if (allowAbsolute && path.isAbsolute(path$1) &&
|
|
1827
|
+
if (allowAbsolute && path.isAbsolute(path$1) && isForbiddenAtAnyDepth(path$1)) {
|
|
1828
1828
|
return JSON.stringify({ ok: false, error: "forbidden_path", path: path$1 });
|
|
1829
1829
|
}
|
|
1830
1830
|
return null;
|