@intentius/chant 0.88.0 → 0.89.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.
@@ -1 +1 @@
1
- {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/serve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAMtE;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAMtE;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAM1E"}
1
+ {"version":3,"file":"serve.d.ts","sourceRoot":"","sources":["../../../src/cli/handlers/serve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAMtE;AAED,wBAAsB,WAAW,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAetE;AAED,wBAAsB,eAAe,CAAC,GAAG,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAM1E"}
@@ -1 +1 @@
1
- {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAMA,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAkG9E;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CA8cpD;AA6mBD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBzE;AAID;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,UAAU,EA8HvC,CAAC;AAiKF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB5E"}
1
+ {"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../src/cli/main.ts"],"names":[],"mappings":";AAMA,OAAO,EAAkB,KAAK,UAAU,EAAE,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAqG9E;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,UAAU,CAgdpD;AAooBD;;;;;;;;;;GAUG;AACH,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,MAAM,CAAC,CAuBzE;AAID;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,EAAE,UAAU,EA8HvC,CAAC;AA4KF;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,MAAM,CAAC,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAuB5E"}
@@ -54,7 +54,16 @@ export declare class McpServer {
54
54
  private toolHandlers;
55
55
  private pluginResources;
56
56
  private plugins;
57
- constructor(plugins?: LexiconPlugin[]);
57
+ private instructions;
58
+ /**
59
+ * `options.instructions` is sent as the `initialize` result's
60
+ * `instructions`, the text a client may give its model about this server.
61
+ * Only a workspace root with no lexicon of its own sets it (#2700), to say
62
+ * which members' lexicons were loaded.
63
+ */
64
+ constructor(plugins?: LexiconPlugin[], options?: {
65
+ instructions?: string;
66
+ });
58
67
  /**
59
68
  * Register tools contributed by a plugin, namespaced as `lexicon:toolName`.
60
69
  *
@@ -1 +1 @@
1
- {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/cli/mcp/server.ts"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;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KG;gBACS,OAAO,CAAC,EAAE,aAAa,EAAE,EAAE,OAAO,GAAE;QAAE,YAAY,CAAC,EAAE,MAAM,CAAA;KAAO;IAkC9E;;;;;;;;;;OAUG;IACH,OAAO,CAAC,mBAAmB;IAc3B;;;OAGG;IACH,OAAO,CAAC,uBAAuB;IAgB/B;;OAEG;IACH,OAAO,CAAC,YAAY;IAQpB;;;;;;;OAOG;IACG,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG;QAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,WAAW,CAAC;IAClF,aAAa,CAAC,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC;IAwBrE;;OAEG;IACH,OAAO,CAAC,qBAAqB;IAW7B;;OAEG;YACW,QAAQ;IAiCtB;;OAEG;YACW,eAAe;IAyC7B;;OAEG;IACG,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC;CAsC7B;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,IAAI,CAAC,CAYpD"}
@@ -0,0 +1,40 @@
1
+ /**
2
+ * #2700 — the lexicons `chant serve mcp` loads at the root of a declared
3
+ * workspace that has no lexicon of its own.
4
+ *
5
+ * Such a root (a generated chud repo, say, whose lexicons are all in
6
+ * `delivery/`) used to refuse with "No lexicon detected", so an agent started
7
+ * there got none of chant's tools. The server now starts with core's tools and
8
+ * resources, and with the lexicons of the workspace's members of kind chant,
9
+ * each read from that member's own config the way `chant build` in the
10
+ * member's directory reads it.
11
+ *
12
+ * Loading is best effort, one member and one lexicon at a time: a member whose
13
+ * config does not load, or a lexicon this chant cannot import, is left out and
14
+ * named in the server's `instructions`, and the rest are served. Nothing here
15
+ * fails the server; with nothing loaded it serves core alone and says so.
16
+ */
17
+ import type { LexiconPlugin } from "../../lexicon.js";
18
+ /** One member of kind chant, and what came of reading its lexicons. */
19
+ export interface MemberLexicons {
20
+ member: string;
21
+ dir: string;
22
+ /** The lexicon names its config declares or its source imports, or null when they could not be read. */
23
+ lexicons: string[] | null;
24
+ /** Why they could not be read. */
25
+ error?: string;
26
+ }
27
+ export interface WorkspacePlugins {
28
+ plugins: LexiconPlugin[];
29
+ members: MemberLexicons[];
30
+ /** Lexicons named by a member that did not load, with the reason. */
31
+ failed: {
32
+ lexicon: string;
33
+ error: string;
34
+ }[];
35
+ /** The text the MCP server gives as its `instructions`. */
36
+ instructions: string;
37
+ }
38
+ /** Load the lexicons of the chant members of the workspace declared at `root`. */
39
+ export declare function loadWorkspacePlugins(root: string): Promise<WorkspacePlugins>;
40
+ //# sourceMappingURL=workspace-plugins.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workspace-plugins.d.ts","sourceRoot":"","sources":["../../../src/cli/mcp/workspace-plugins.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAIH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,uEAAuE;AACvE,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;IACZ,wGAAwG;IACxG,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAAC;IAC1B,kCAAkC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,gBAAgB;IAC/B,OAAO,EAAE,aAAa,EAAE,CAAC;IACzB,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,qEAAqE;IACrE,MAAM,EAAE;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC7C,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;CACtB;AAOD,kFAAkF;AAClF,wBAAsB,oBAAoB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA+ClF"}
@@ -17,6 +17,8 @@ export interface ParsedArgs {
17
17
  watch: boolean;
18
18
  verbose: boolean;
19
19
  help: boolean;
20
+ /** `--version` / `-V` (#2701): print the installed chant's version. */
21
+ version?: boolean;
20
22
  report?: boolean;
21
23
  /** `chant run` — force the local in-process executor (the default). */
22
24
  local?: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/cli/registry.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,GAAG,EAAE,OAAO,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,IAAI,EAAE,OAAO,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,uEAAuE;IACvE,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;;;;;OAMG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,uEAAuE;IACvE,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;;;;;;;;;OAYG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;;;;;;;;;;OAYG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,IAAI,EAAE,OAAO,CAAC;IACd,uDAAuD;IACvD,WAAW,CAA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O,CAAC;CACnB;AAWD,wBAAgB,cAAc,CAAC,IAAI,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,GAAG,eAAe,GAAG,IAAI,CAiB/F"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@intentius/chant",
3
- "version": "0.88.0",
3
+ "version": "0.89.0",
4
4
  "description": "Declarative infrastructure-as-code toolkit — TypeScript on Node.js",
5
5
  "license": "Apache-2.0",
6
6
  "homepage": "https://intentius.io/chant",
@@ -11,7 +11,16 @@ export async function runServeLsp(ctx: CommandContext): Promise<number> {
11
11
 
12
12
  export async function runServeMcp(ctx: CommandContext): Promise<number> {
13
13
  const { McpServer } = await import("../mcp/server");
14
- const server = new McpServer(ctx.plugins);
14
+ // #2700 — main() hands over no plugins only at a workspace root with no
15
+ // lexicon of its own (anywhere else it refuses first). There the lexicons
16
+ // are the chant members', and the server says which loaded.
17
+ let plugins = ctx.plugins;
18
+ let instructions: string | undefined;
19
+ if (plugins.length === 0) {
20
+ const { loadWorkspacePlugins } = await import("../mcp/workspace-plugins");
21
+ ({ plugins, instructions } = await loadWorkspacePlugins(process.cwd()));
22
+ }
23
+ const server = new McpServer(plugins, { instructions });
15
24
  await server.start();
16
25
  await new Promise(() => {});
17
26
  return 0; // unreachable
@@ -71,6 +71,13 @@ describe("parseArgs", () => {
71
71
  expect(result.help).toBe(true);
72
72
  });
73
73
 
74
+ test("parses --version and -V (#2701)", () => {
75
+ expect(parseArgs(["--version"]).version).toBe(true);
76
+ expect(parseArgs(["-V"]).version).toBe(true);
77
+ expect(parseArgs(["build"]).version).toBeUndefined();
78
+ expect(() => parseArgs(["--version=1"])).toThrow();
79
+ });
80
+
74
81
  test("parses --output with value", () => {
75
82
  const result = parseArgs(["build", "--output", "stack.json"]);
76
83
  expect(result.output).toBe("stack.json");
package/src/cli/main.ts CHANGED
@@ -7,6 +7,8 @@ import { loadPlugins, resolveProjectLexicons } from "./plugins";
7
7
  import { resolveCommand, type CommandDef, type ParsedArgs } from "./registry";
8
8
  import { loadChantConfigUpward } from "../config";
9
9
  import { findProjectRoot, findWorkspaceRoot } from "../project-root";
10
+ import { isNoLexiconDetected } from "../detectLexicon";
11
+ import { CHANT_VERSION } from "./version";
10
12
  import { validateLexiconConfig, formatLexiconConfigProblems } from "../lexicon-config";
11
13
  import { armSandboxConfigEvaluation } from "../config-sandbox";
12
14
  import { armSandboxPolicyExecution } from "../lint/policy-import";
@@ -52,6 +54,7 @@ import type { LexiconPlugin } from "../lexicon";
52
54
  */
53
55
  const BOOLEAN_FLAGS = new Set([
54
56
  "--help",
57
+ "--version",
55
58
  "--agents",
56
59
  "--agent",
57
60
  "--all-projects",
@@ -167,6 +170,8 @@ export function parseArgs(args: string[]): ParsedArgs {
167
170
 
168
171
  if (arg === "--help" || arg === "-h") {
169
172
  result.help = true;
173
+ } else if (arg === "--version" || arg === "-V") {
174
+ result.version = true;
170
175
  } else if (arg === "--output" || arg === "-o") {
171
176
  result.output = args[++i];
172
177
  } else if (arg === "--format" || arg === "-f") {
@@ -971,6 +976,7 @@ Options:
971
976
  resolved build parameter and per-file fold decision
972
977
  instead of the one-line summaries
973
978
  -h, --help Show this help message
979
+ -V, --version Print the installed chant's version
974
980
  --on <lexicon> Which runtime hosts the run: a configured lexicon with
975
981
  an opRuntime, or the built-in local runtime when
976
982
  omitted (every run subcommand; #2121)
@@ -1183,6 +1189,28 @@ async function loadPluginsOrExit(path: string): Promise<import("../lexicon").Lex
1183
1189
  return plugins;
1184
1190
  }
1185
1191
 
1192
+ /**
1193
+ * #2700 — whether `path` is the root of a declared workspace and holds no
1194
+ * lexicon of its own: no `lexicons` in a root config, and no lexicon import in
1195
+ * the root's source, which leaves the members' directories out (#2527). A
1196
+ * generated chud repo is this shape: its lexicons are all in `delivery/`.
1197
+ * `chant serve mcp` starts there instead of refusing with "No lexicon
1198
+ * detected", and serves core with the chant members' lexicons.
1199
+ *
1200
+ * A directory with no workspace declaration costs only `findWorkspaceRoot`'s
1201
+ * existence checks, so a level-0 project reaches `loadPluginsOrExit` as before.
1202
+ */
1203
+ async function isLexiconlessWorkspaceRoot(path: string): Promise<boolean> {
1204
+ const target = resolve(path);
1205
+ if (findWorkspaceRoot(target)?.dir !== target) return false;
1206
+ try {
1207
+ await resolveProjectLexicons(target);
1208
+ return false;
1209
+ } catch (error) {
1210
+ return isNoLexiconDetected(error);
1211
+ }
1212
+ }
1213
+
1186
1214
  /** Whether `def` must run without evaluating the project's `chant.config.ts` (chant#2591). */
1187
1215
  function commandRunsNoConfig(def: CommandDef, args: ParsedArgs): boolean {
1188
1216
  return typeof def.runsNoConfig === "function" ? def.runsNoConfig(args) : def.runsNoConfig === true;
@@ -1388,6 +1416,15 @@ async function main(): Promise<void> {
1388
1416
  throw err;
1389
1417
  }
1390
1418
 
1419
+ // #2701 — `chant --version` / `-V` prints the installed chant's version, the
1420
+ // one the MCP server reports (./version.ts). With a command word it answers
1421
+ // only for one of core's own commands; a lexicon-mounted verb keeps the flag.
1422
+ if (args.version && (!args.command || resolveCommand(args, commandRegistry))) {
1423
+ console.log(CHANT_VERSION);
1424
+ await flushAndExit(0);
1425
+ return;
1426
+ }
1427
+
1391
1428
  if (args.help || !args.command) {
1392
1429
  const groups = await loadPluginsBestEffort().then(collectCommandGroups).catch(() => []);
1393
1430
  printHelp(groups);
@@ -1515,7 +1552,9 @@ async function main(): Promise<void> {
1515
1552
  const plugins = match.def.requiresPlugins
1516
1553
  ? isGenerateComponents || isComponentsStatus || isEmulator || isFanOutFromFile
1517
1554
  ? await loadPlugins(await resolveProjectLexicons(resolve(projectPath)).catch(() => [])).catch(() => [])
1518
- : await loadPluginsOrExit(projectPath)
1555
+ : match.def.name === "serve mcp" && (await isLexiconlessWorkspaceRoot(projectPath))
1556
+ ? [] // #2700 — runServeMcp loads the chant members' lexicons itself.
1557
+ : await loadPluginsOrExit(projectPath)
1519
1558
  : [];
1520
1559
  const serializers = plugins.map((p) => p.serializer);
1521
1560
  const ctx = { args, plugins, serializers };
@@ -93,9 +93,17 @@ export class McpServer {
93
93
  private toolHandlers: Map<string, ToolHandler> = new Map();
94
94
  private pluginResources: Map<string, { definition: ResourceDefinition; handler: () => Promise<string> }> = new Map();
95
95
  private plugins: LexiconPlugin[];
96
+ private instructions: string | undefined;
96
97
 
97
- constructor(plugins?: LexiconPlugin[]) {
98
+ /**
99
+ * `options.instructions` is sent as the `initialize` result's
100
+ * `instructions`, the text a client may give its model about this server.
101
+ * Only a workspace root with no lexicon of its own sets it (#2700), to say
102
+ * which members' lexicons were loaded.
103
+ */
104
+ constructor(plugins?: LexiconPlugin[], options: { instructions?: string } = {}) {
98
105
  this.plugins = plugins ?? [];
106
+ this.instructions = options.instructions;
99
107
  // Register core tools
100
108
  this.registerTool(buildTool, handleBuild);
101
109
  this.registerTool(lintTool, handleLint);
@@ -226,6 +234,7 @@ export class McpServer {
226
234
  capabilities: { tools: {}, resources: {} },
227
235
  // The installed chant's version, so a client can tell which chant it talks to (#2689).
228
236
  serverInfo: { name: "chant", version: CHANT_VERSION },
237
+ ...(this.instructions ? { instructions: this.instructions } : {}),
229
238
  };
230
239
  }
231
240
 
@@ -0,0 +1,123 @@
1
+ /**
2
+ * #2700 — the lexicons `chant serve mcp` loads at the root of a declared
3
+ * workspace that has no lexicon of its own.
4
+ *
5
+ * Such a root (a generated chud repo, say, whose lexicons are all in
6
+ * `delivery/`) used to refuse with "No lexicon detected", so an agent started
7
+ * there got none of chant's tools. The server now starts with core's tools and
8
+ * resources, and with the lexicons of the workspace's members of kind chant,
9
+ * each read from that member's own config the way `chant build` in the
10
+ * member's directory reads it.
11
+ *
12
+ * Loading is best effort, one member and one lexicon at a time: a member whose
13
+ * config does not load, or a lexicon this chant cannot import, is left out and
14
+ * named in the server's `instructions`, and the rest are served. Nothing here
15
+ * fails the server; with nothing loaded it serves core alone and says so.
16
+ */
17
+
18
+ import { existsSync } from "node:fs";
19
+ import { join } from "node:path";
20
+ import type { LexiconPlugin } from "../../lexicon";
21
+
22
+ /** One member of kind chant, and what came of reading its lexicons. */
23
+ export interface MemberLexicons {
24
+ member: string;
25
+ dir: string;
26
+ /** The lexicon names its config declares or its source imports, or null when they could not be read. */
27
+ lexicons: string[] | null;
28
+ /** Why they could not be read. */
29
+ error?: string;
30
+ }
31
+
32
+ export interface WorkspacePlugins {
33
+ plugins: LexiconPlugin[];
34
+ members: MemberLexicons[];
35
+ /** Lexicons named by a member that did not load, with the reason. */
36
+ failed: { lexicon: string; error: string }[];
37
+ /** The text the MCP server gives as its `instructions`. */
38
+ instructions: string;
39
+ }
40
+
41
+ function message(error: unknown): string {
42
+ const text = error instanceof Error ? error.message : String(error);
43
+ return text.split("\n")[0];
44
+ }
45
+
46
+ /** Load the lexicons of the chant members of the workspace declared at `root`. */
47
+ export async function loadWorkspacePlugins(root: string): Promise<WorkspacePlugins> {
48
+ const [{ readDeclaration }, { workingTree }, { resolveProjectLexicons, loadPlugins }] = await Promise.all([
49
+ import("../../workspace/declaration"),
50
+ import("../../workspace/tree"),
51
+ import("../plugins"),
52
+ ]);
53
+
54
+ const members: MemberLexicons[] = [];
55
+ let workspaceName: string | undefined;
56
+ let declarationError: string | undefined;
57
+ try {
58
+ const declaration = readDeclaration(workingTree(root));
59
+ workspaceName = declaration.name;
60
+ for (const m of declaration.members) {
61
+ // The root member is the directory this server already found no lexicon in.
62
+ if (m.kind !== "chant" || m.dir === ".") continue;
63
+ const abs = join(root, m.dir);
64
+ if (!existsSync(abs)) {
65
+ members.push({ member: m.name, dir: m.dir, lexicons: null, error: "its directory does not exist" });
66
+ continue;
67
+ }
68
+ try {
69
+ members.push({ member: m.name, dir: m.dir, lexicons: await resolveProjectLexicons(abs) });
70
+ } catch (error) {
71
+ members.push({ member: m.name, dir: m.dir, lexicons: null, error: message(error) });
72
+ }
73
+ }
74
+ } catch (error) {
75
+ declarationError = message(error);
76
+ }
77
+
78
+ const plugins: LexiconPlugin[] = [];
79
+ const failed: { lexicon: string; error: string }[] = [];
80
+ const seen = new Set<string>();
81
+ for (const m of members) {
82
+ for (const name of m.lexicons ?? []) {
83
+ if (seen.has(name)) continue;
84
+ seen.add(name);
85
+ try {
86
+ plugins.push(...(await loadPlugins([name])));
87
+ } catch (error) {
88
+ failed.push({ lexicon: name, error: message(error) });
89
+ }
90
+ }
91
+ }
92
+
93
+ return { plugins, members, failed, instructions: describe(workspaceName, members, plugins, failed, declarationError) };
94
+ }
95
+
96
+ function describe(
97
+ name: string | undefined,
98
+ members: MemberLexicons[],
99
+ plugins: LexiconPlugin[],
100
+ failed: { lexicon: string; error: string }[],
101
+ declarationError: string | undefined,
102
+ ): string {
103
+ const lines: string[] = [];
104
+ lines.push(
105
+ `This chant MCP server runs at the root of the workspace ${name ? `"${name}" ` : ""}(chant.workspace.json), which has no lexicon of its own. ` +
106
+ "Core tools and resources are served as in any project. The tools that take a path (build, lint, explain) work on a project directory, so pass a member's directory.",
107
+ );
108
+ if (declarationError) lines.push(`The workspace declaration could not be read: ${declarationError}.`);
109
+ for (const m of members) {
110
+ lines.push(
111
+ m.lexicons
112
+ ? `Member ${m.member} (${m.dir}/) declares ${m.lexicons.length ? m.lexicons.join(", ") : "no lexicon"}.`
113
+ : `Member ${m.member} (${m.dir}/) was not read: ${m.error}.`,
114
+ );
115
+ }
116
+ for (const f of failed) lines.push(`Lexicon ${f.lexicon} did not load: ${f.error}.`);
117
+ lines.push(
118
+ plugins.length > 0
119
+ ? `Lexicon tools and resources served: ${plugins.map((p) => p.name).join(", ")}.`
120
+ : "No member lexicon loaded, so only chant's core tools and resources are served.",
121
+ );
122
+ return lines.join("\n");
123
+ }
@@ -18,6 +18,8 @@ export interface ParsedArgs {
18
18
  watch: boolean;
19
19
  verbose: boolean;
20
20
  help: boolean;
21
+ /** `--version` / `-V` (#2701): print the installed chant's version. */
22
+ version?: boolean;
21
23
  report?: boolean;
22
24
  /** `chant run` — force the local in-process executor (the default). */
23
25
  local?: boolean;
@@ -0,0 +1,142 @@
1
+ import { describe, test, expect, beforeAll, afterAll } from "vitest";
2
+ import { spawnSync } from "node:child_process";
3
+ import { mkdtempSync, mkdirSync, writeFileSync, rmSync, readFileSync, realpathSync } from "node:fs";
4
+ import { join, resolve } from "node:path";
5
+ import { tmpdir } from "node:os";
6
+ import { pathToFileURL } from "node:url";
7
+
8
+ /**
9
+ * #2700 — `chant serve mcp` at a workspace root whose lexicons all live in
10
+ * members starts, with core's tools and the chant members' lexicons, instead
11
+ * of refusing with "No lexicon detected". A project with no workspace and no
12
+ * lexicon still refuses.
13
+ *
14
+ * #2701 — `chant --version` and `-V` print the installed version.
15
+ */
16
+
17
+ const repoRoot = resolve(import.meta.dirname, "../../../..");
18
+ const mainTs = join(repoRoot, "packages/core/src/cli/main.ts");
19
+ const tsxLoader = pathToFileURL(join(repoRoot, "node_modules/tsx/dist/loader.mjs")).href;
20
+ const TIMEOUT = 90_000;
21
+
22
+ function chant(cwd: string, args: string[], input?: string) {
23
+ return spawnSync(process.execPath, ["--import", tsxLoader, mainTs, ...args], {
24
+ cwd,
25
+ input,
26
+ encoding: "utf-8",
27
+ timeout: 60_000,
28
+ env: { ...process.env, NO_COLOR: "1" },
29
+ });
30
+ }
31
+
32
+ interface InitializeResult {
33
+ serverInfo: { name: string; version: string };
34
+ instructions?: string;
35
+ }
36
+
37
+ /** Send initialize and tools/list over stdio; stdin closing ends the server. */
38
+ function initializeAndList(cwd: string): { status: number | null; stderr: string; init: InitializeResult; tools: string[] } {
39
+ const input = [
40
+ { jsonrpc: "2.0", id: 1, method: "initialize", params: { protocolVersion: "2024-11-05", clientInfo: { name: "test" } } },
41
+ { jsonrpc: "2.0", method: "notifications/initialized" },
42
+ { jsonrpc: "2.0", id: 2, method: "tools/list", params: {} },
43
+ ].map((m) => JSON.stringify(m)).join("\n") + "\n";
44
+ const run = chant(cwd, ["serve", "mcp"], input);
45
+ const responses = run.stdout.trim().split("\n").filter(Boolean).map((l) => JSON.parse(l));
46
+ const byId = (id: number) => responses.find((r) => r.id === id);
47
+ return {
48
+ status: run.status,
49
+ stderr: run.stderr,
50
+ init: byId(1)?.result,
51
+ tools: (byId(2)?.result?.tools ?? []).map((t: { name: string }) => t.name),
52
+ };
53
+ }
54
+
55
+ const CORE_TOOLS = ["composites", "search", "build", "lint", "explain", "op-list", "op-run", "op-status", "op-approve", "op-report"];
56
+
57
+ describe("chant serve mcp at a workspace root with no lexicon of its own (#2700)", () => {
58
+ let scratch: string;
59
+
60
+ beforeAll(() => {
61
+ scratch = realpathSync(mkdtempSync(join(tmpdir(), "chant-serve-mcp-ws-")));
62
+ });
63
+ afterAll(() => {
64
+ rmSync(scratch, { recursive: true, force: true });
65
+ });
66
+
67
+ test("the reference workspace root answers initialize and lists core tools with the delivery member's lexicon", () => {
68
+ const { status, stderr, init, tools } = initializeAndList(join(repoRoot, "reference-workspace"));
69
+ expect(status, stderr).toBe(0);
70
+ expect(init.serverInfo.name).toBe("chant");
71
+ for (const name of CORE_TOOLS) expect(tools).toContain(name);
72
+ expect(tools).toContain("docker:diff");
73
+ expect(init.instructions).toContain("Member delivery (delivery/) declares docker.");
74
+ }, TIMEOUT);
75
+
76
+ test("a chud-shaped root, lexicons only in a member, serves core and the lexicons that load", () => {
77
+ const root = join(scratch, "chud-shaped");
78
+ mkdirSync(join(root, ".git"), { recursive: true });
79
+ mkdirSync(join(root, "delivery"), { recursive: true });
80
+ mkdirSync(join(root, "app"), { recursive: true });
81
+ writeFileSync(join(root, "chant.workspace.json"), JSON.stringify({
82
+ name: "t",
83
+ schema: 1,
84
+ members: [
85
+ { name: "app", dir: "app", kind: "other", because: "an app" },
86
+ { name: "delivery", dir: "delivery", kind: "chant" },
87
+ ],
88
+ pins: [],
89
+ }));
90
+ // `chud` is not installed here, as it would not be for a chant without
91
+ // @intentius/chud: it is named as not loaded and the rest is served.
92
+ writeFileSync(join(root, "delivery", "chant.config.ts"), 'export default { lexicons: ["docker", "chud"] };\n');
93
+ writeFileSync(join(root, "app", "server.js"), "// not chant\n");
94
+
95
+ const { status, stderr, init, tools } = initializeAndList(root);
96
+ expect(status, stderr).toBe(0);
97
+ for (const name of CORE_TOOLS) expect(tools).toContain(name);
98
+ expect(tools).toContain("docker:diff");
99
+ expect(init.instructions).toContain('workspace "t"');
100
+ expect(init.instructions).toContain("Lexicon chud did not load");
101
+ expect(init.instructions).toContain("Lexicon tools and resources served: docker.");
102
+ }, TIMEOUT);
103
+
104
+ test("a workspace root whose members' lexicons all fail to load serves core alone and says so", () => {
105
+ const root = join(scratch, "core-only");
106
+ mkdirSync(join(root, ".git"), { recursive: true });
107
+ mkdirSync(join(root, "delivery"), { recursive: true });
108
+ writeFileSync(join(root, "chant.workspace.json"), JSON.stringify({
109
+ name: "core-only",
110
+ schema: 1,
111
+ members: [{ name: "delivery", dir: "delivery", kind: "chant" }],
112
+ pins: [],
113
+ }));
114
+ writeFileSync(join(root, "delivery", "chant.config.ts"), 'export default { lexicons: ["no-such-lexicon"] };\n');
115
+
116
+ const { status, stderr, init, tools } = initializeAndList(root);
117
+ expect(status, stderr).toBe(0);
118
+ for (const name of CORE_TOOLS) expect(tools).toContain(name);
119
+ expect(tools.filter((t) => t.includes(":"))).toEqual([]);
120
+ expect(init.instructions).toContain("only chant's core tools and resources are served");
121
+ }, TIMEOUT);
122
+
123
+ test("a project with no workspace and no lexicon still refuses", () => {
124
+ const root = join(scratch, "plain");
125
+ mkdirSync(join(root, ".git"), { recursive: true });
126
+ writeFileSync(join(root, "index.ts"), "export const x = 1;\n");
127
+ const run = chant(root, ["serve", "mcp"], "");
128
+ expect(run.status).toBe(1);
129
+ expect(run.stderr).toContain("No lexicon detected");
130
+ expect(run.stdout).toBe("");
131
+ }, TIMEOUT);
132
+ });
133
+
134
+ describe("chant --version (#2701)", () => {
135
+ const version = (JSON.parse(readFileSync(join(repoRoot, "packages/core/package.json"), "utf-8")) as { version: string }).version;
136
+
137
+ test.each([["--version"], ["-V"]])("%s prints the package version and exits 0", (flag) => {
138
+ const run = chant(repoRoot, [flag]);
139
+ expect(run.status, run.stderr).toBe(0);
140
+ expect(run.stdout.trim()).toBe(version);
141
+ }, TIMEOUT);
142
+ });