feat: adding in repository location so we dont lose it
All checks were successful
Dependabot Auto-Merge / dependabot (pull_request) Has been skipped
Dependabot Auto-Merge / devopsbot (pull_request) Has been skipped
Dependabot Auto-Merge / rennovatebot (pull_request) Has been skipped
COMMIT LINT / commitlint (pull_request) Successful in 38s
Unit Tests / unittest (pull_request) Successful in 1m19s

This commit is contained in:
2026-06-14 19:31:41 +00:00
parent a80af12191
commit 58800a5443
3 changed files with 62 additions and 32776 deletions

View File

@@ -3,6 +3,7 @@ const assert = require("node:assert/strict");
const {
buildRequestPayload,
buildStoreText,
getConfig,
main,
sanitizeDocumentId,
@@ -35,7 +36,22 @@ test("sanitizeDocumentId removes special characters and preserves periods", () =
);
});
test("buildRequestPayload sends the full document in store_text and an empty embed_text", () => {
test("buildStoreText prefixes repository metadata before the markdown content", () => {
const content = "# Title\n\n## First\nalpha\n\n## Second\nbeta\n";
const storeText = buildStoreText({
owner: "acme",
repo: "docs-repo",
file: "guides/setup.md",
content,
});
assert.equal(
storeText,
"repo_name: docs-repo\nrepo_owner: acme\npath: guides/setup.md\n\n# Title\n\n## First\nalpha\n\n## Second\nbeta\n",
);
});
test("buildRequestPayload sends metadata-prefixed store_text and an empty embed_text", () => {
const content = "# Title\n\n## First\nalpha\n\n## Second\nbeta\n";
const payload = buildRequestPayload({
route: "agent-lake",
@@ -48,7 +64,10 @@ test("buildRequestPayload sends the full document in store_text and an empty emb
});
assert.equal(payload.inputs.inputs.embed_text, "");
assert.equal(payload.inputs.inputs.store_text, content);
assert.equal(
payload.inputs.inputs.store_text,
"repo_name: docs-repo\nrepo_owner: acme\npath: guides/setup.md\n\n# Title\n\n## First\nalpha\n\n## Second\nbeta\n",
);
assert.equal(
payload.inputs.inputs.document_id,
"acme.docsrepo.guidessetup.md",
@@ -117,7 +136,10 @@ test("main sends one request per file even when the document contains multiple s
assert.equal(calls.length, 1);
assert.equal(calls[0].url, "https://agents.example/api");
assert.equal(calls[0].body.inputs.inputs.embed_text, "");
assert.equal(calls[0].body.inputs.inputs.store_text, content);
assert.equal(
calls[0].body.inputs.inputs.store_text,
"repo_name: docs-repo\nrepo_owner: acme\npath: README.md\n\n# Title\n\n## First\nalpha\n\n## Second\nbeta\n",
);
assert.equal(
calls[0].body.inputs.inputs.document_id,
"acme.docsrepo.README.md",