@usegraft/compiler 0.2.0 → 1.0.0-beta.1

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/README.md CHANGED
@@ -41,4 +41,4 @@ Set `export const mdxTrust = "full"` in `graft.config.ts` to allow full MDX. Tha
41
41
 
42
42
  ---
43
43
 
44
- MIT. [Repository](https://github.com/AndersonDesign1/graft) · [Changelog](https://github.com/AndersonDesign1/graft/blob/feat/core/packages/compiler/CHANGELOG.md)
44
+ MIT. [Repository](https://github.com/AndersonDesign1/graft) · [Changelog](https://github.com/AndersonDesign1/graft/blob/main/packages/compiler/CHANGELOG.md)
package/dist/index.d.ts CHANGED
@@ -142,8 +142,18 @@ declare function resolveGitSha(cwd: string): string | null;
142
142
  * a Studio or MCP write served from one fails deep inside fs with an opaque
143
143
  * errno; authored content being files is the whole model, so the fix is to run
144
144
  * the writing surface where the checkout is writable.
145
+ *
146
+ * Takes a root and a relative path rather than a resolved one, and contains it
147
+ * here, because this sink previously trusted whatever path it was handed and
148
+ * `.greptile/rules.md` told reviewers that every sink in this package did its
149
+ * own containment. Studio resolved carefully; MCP's `write_content` did not,
150
+ * and a slug of `"../../escaped"` wrote outside the content tree — the exact
151
+ * bug the rule claimed was impossible. A guarantee that lives in each caller is
152
+ * one a new caller does not inherit.
153
+ *
154
+ * Returns the resolved path, so a caller that needs it does not re-derive it.
145
155
  */
146
- declare function writeDocumentFile(fullPath: string, raw: string): void;
156
+ declare function writeDocumentFile(root: string, sourcePath: string, raw: string): string;
147
157
  /**
148
158
  * The bytes to write for a document.
149
159
  *
package/dist/index.js CHANGED
@@ -310,10 +310,12 @@ import { dirname } from "path";
310
310
  import { GraftError as GraftError5 } from "@usegraft/contracts";
311
311
  import matter2 from "gray-matter";
312
312
  var READ_ONLY_CODES = /* @__PURE__ */ new Set(["EROFS", "EACCES", "EPERM"]);
313
- function writeDocumentFile(fullPath, raw) {
313
+ function writeDocumentFile(root, sourcePath, raw) {
314
+ const fullPath = resolveContained(root, sourcePath, { label: "document" });
314
315
  try {
315
316
  mkdirSync(dirname(fullPath), { recursive: true });
316
317
  writeFileSync(fullPath, raw);
318
+ return fullPath;
317
319
  } catch (error) {
318
320
  const code = error.code ?? "";
319
321
  if (!READ_ONLY_CODES.has(code)) throw error;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@usegraft/compiler",
3
- "version": "0.2.0",
3
+ "version": "1.0.0-beta.1",
4
4
  "description": "Validate authored MDX against your collections and project it into the content index.",
5
5
  "keywords": [
6
6
  "agent",
@@ -39,10 +39,10 @@
39
39
  "access": "public"
40
40
  },
41
41
  "dependencies": {
42
- "@usegraft/contracts": "0.2.0",
43
- "@usegraft/core": "0.2.0",
44
- "@usegraft/db": "0.2.0",
45
- "@usegraft/mdx-safety": "0.2.0",
42
+ "@usegraft/contracts": "1.0.0-beta.1",
43
+ "@usegraft/core": "1.0.0-beta.1",
44
+ "@usegraft/db": "1.0.0-beta.1",
45
+ "@usegraft/mdx-safety": "1.0.0-beta.1",
46
46
  "gray-matter": "^4.0.3"
47
47
  },
48
48
  "engines": {