Skip to content

Commit e1568f7

Browse files
committed
no-mistakes(test): Name api-docs generator entry in Java/Kotlin Not-there line
1 parent 1dc57c4 commit e1568f7

8 files changed

Lines changed: 40 additions & 7 deletions

File tree

‎agent-context/servers/csharp.meta.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"codegenCommand": "dotnet meta gen",
55
"docsCommand": "dotnet meta docs",
66
"docsCondition": "",
7+
"docsMissing": "",
78
"apiSubDir": "api/csharp"
89
}

‎agent-context/servers/java.meta.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"codegenCommand": "mvn metaobjects:generate",
55
"docsCommand": "mvn metaobjects:generate",
66
"docsCondition": " (when the project's generator list declares the api-docs generator)",
7+
"docsMissing": "Declare `com.metaobjects.generator.apidocs.JavaApiDocsGenerator` as a `<generator>` entry in the pom's `<generators>` if it is missing",
78
"apiSubDir": "api/java"
89
}

‎agent-context/servers/kotlin.meta.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"codegenCommand": "mvn metaobjects:generate",
55
"docsCommand": "mvn metaobjects:generate",
66
"docsCondition": " (when the project's generator list declares the api-docs generator)",
7+
"docsMissing": "Declare `com.metaobjects.generator.kotlin.apidocs.KotlinApiDocsGenerator` as a `<generator>` entry in the pom's `<generators>` if it is missing",
78
"apiSubDir": "api/kotlin"
89
}

‎agent-context/servers/python.meta.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"codegenCommand": "metaobjects gen",
55
"docsCommand": "metaobjects docs",
66
"docsCondition": "",
7+
"docsMissing": "",
78
"apiSubDir": "api/python"
89
}

‎agent-context/servers/typescript.meta.json‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,6 @@
44
"codegenCommand": "npx meta gen",
55
"docsCommand": "npx meta docs",
66
"docsCondition": "",
7+
"docsMissing": "",
78
"apiSubDir": "api"
89
}

‎agent-context/templates/always-on.md.mustache‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ inferring the answer from generated code, which is the disposable half.
3737
- **`{{apiSubDir}}/AGENT-API.md`** — before calling generated code. The types, endpoints and
3838
filter operators the generators actually emitted.
3939

40-
Not there? Run `{{docsCommand}}`{{docsCondition}}.
40+
Not there? {{docsMissingAction}} `{{docsCommand}}`.
4141

4242
The other three pages of that reference — `agent/schema.md` (persistence), `agent/ui.md`
4343
(forms and grids) and `agent/requirements.md` (what is already claimed, and what was

‎server/typescript/packages/sdk/src/agent-context/assemble.ts‎

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,12 @@ interface ServerMeta {
3737
* goal writes them only when the pom's generator list declares the api-docs generator,
3838
* and a pointer that omits that sends a reader to run a command that writes nothing. */
3939
docsCondition: string;
40+
/** What to do before running `docsCommand` when the api pages are missing, with no
41+
* trailing punctuation, or `""` when running it is the whole remedy. A Maven pom writes
42+
* them only once it declares the api-docs generator, and a missing entry is the usual
43+
* reason the file is absent, so the Not-there line names that entry instead of only the
44+
* command. */
45+
docsMissing: string;
4046
/** The docs-root-relative directory THIS port's docs command writes its api pages into.
4147
* It is NOT `api` outside TypeScript — Python defaults to `api/python`, C# to
4248
* `api/csharp`, the Maven plugin to `api/<lang>` — so a pointer naming `api/AGENT-API.md`
@@ -54,7 +60,14 @@ function readServerMeta(contentRoot: string, server: string): ServerMeta | undef
5460
function stackLine(
5561
contentRoot: string,
5662
stack: Stack,
57-
): { line: string; codegenCommand: string; docsCommand: string; docsCondition: string; apiSubDir: string } {
63+
): {
64+
line: string;
65+
codegenCommand: string;
66+
docsCommand: string;
67+
docsCondition: string;
68+
docsMissing: string;
69+
apiSubDir: string;
70+
} {
5871
const primary = stack.servers[0];
5972
const meta = primary ? readServerMeta(contentRoot, primary) : undefined;
6073
const serverPart = stack.servers.length ? stack.servers.join(", ") + " server" : "no server";
@@ -69,6 +82,7 @@ function stackLine(
6982
codegenCommand: meta ? meta.codegenCommand : "meta gen",
7083
docsCommand: meta ? meta.docsCommand : "meta docs",
7184
docsCondition: meta ? meta.docsCondition : "",
85+
docsMissing: meta ? meta.docsMissing : "",
7286
apiSubDir: meta ? meta.apiSubDir : "api",
7387
};
7488
}
@@ -143,10 +157,14 @@ export function assemble(opts: { contentRoot: string; stack: Stack }): Assembled
143157

144158
// 1. Always-on (AGENTS.md + CLAUDE.md, identical contents).
145159
const tpl = readFileSync(join(contentRoot, "templates", "always-on.md.mustache"), "utf8");
146-
const { line, codegenCommand, docsCommand, docsCondition, apiSubDir } = stackLine(contentRoot, stack);
160+
const { line, codegenCommand, docsCommand, docsCondition, docsMissing, apiSubDir } = stackLine(
161+
contentRoot,
162+
stack,
163+
);
164+
const docsMissingAction = docsMissing === "" ? "Run" : `${docsMissing}, then run`;
147165
const alwaysOn = applyTemplate(
148166
tpl,
149-
{ stackLine: line, codegenCommand, docsCommand, docsCondition, apiSubDir },
167+
{ stackLine: line, codegenCommand, docsCommand, docsCondition, docsMissingAction, apiSubDir },
150168
{ nodeDocsSurface: hasNodeDocsSurface(stack) },
151169
);
152170
out.push({ path: ".metaobjects/AGENTS.md", contents: alwaysOn });

‎server/typescript/packages/sdk/test/agent-context/assemble.test.ts‎

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,19 @@ describe("assemble", () => {
5656
"`mvn metaobjects:generate` writes ONE reference file under this project's docs output " +
5757
"directory (when the project's generator list declares the api-docs generator).",
5858
);
59+
// A missing api-docs entry is the usual reason the page is absent, so the Not-there line
60+
// names the entry to declare before the command, rather than repeating the condition.
5961
expect(java).toContain(
60-
"Not there? Run `mvn metaobjects:generate` (when the project's generator list declares " +
61-
"the api-docs generator).",
62+
"Not there? Declare `com.metaobjects.generator.apidocs.JavaApiDocsGenerator` as a " +
63+
"`<generator>` entry in the pom's `<generators>` if it is missing, then run " +
64+
"`mvn metaobjects:generate`.",
65+
);
66+
const kotlin = assemble({ contentRoot: CONTENT_ROOT, stack: makeStack(["kotlin"], []) })
67+
.find((f) => f.path === ".metaobjects/AGENTS.md")!.contents;
68+
expect(kotlin).toContain(
69+
"Not there? Declare `com.metaobjects.generator.kotlin.apidocs.KotlinApiDocsGenerator` as a " +
70+
"`<generator>` entry in the pom's `<generators>` if it is missing, then run " +
71+
"`mvn metaobjects:generate`.",
6272
);
6373

6474
// A Java backend serving React DOES run `meta gen`, so it gets the full pointer.
@@ -67,7 +77,7 @@ describe("assemble", () => {
6777
expect(javaReact).toContain("`meta docs` writes four reference files");
6878

6979
// No section tag survives substitution on any of them.
70-
for (const c of [node, python, java, javaReact]) {
80+
for (const c of [node, python, java, kotlin, javaReact]) {
7181
expect(c).not.toContain("{{#");
7282
expect(c).not.toContain("{{^");
7383
expect(c).not.toContain("{{/");

0 commit comments

Comments
 (0)