ek9_query_module
Answers first: status, module, constructCount, constructNames, then constructs[] with kind, member counts and quality metrics (complexity, coupling, cohesion).
When to use it
'What does this module declare - classes, functions, constants, their sizes' is one call with file:'any.ek9' in it; scope:'module' unions all its files.
When not to use it
- the whole workspace, or a module by NAME (use
ek9_query_workspacewith moduleFilter) - ONE specific construct's details, not the whole module (use
ek9_query_construct) - the cross-module dependency graph or fan-in/fan-out (use
ek9_query_module_dependencies; fanIn/fanOut are not emitted here) - the exact symbol at a cursor (use
ek9_inspect_symbol_at_cursor)
Details
A multi-file module has one ModuleScope per file, so the default scope:'file' can report 'no constants' when they live in a sibling file — use scope:'module' when deciding local variable vs named constant. An unknown kind is rejected, not ignored. A path in no compiled module returns status:'not-found' rather than an error; per-construct 'coupling' may be fractional (by-trait-delegation discount); per-construct sourceFile, files[] and metrics.fanIn/fanOut are deferred.
Arguments
| Argument | Type | Required | What it is |
|---|---|---|---|
file | string | yes | Any .ek9 file inside the module of interest (workspace-relative; absolute inside the workspace accepted) |
kinds | array of string: application | class | component | constant | enumeration | function | program | record | service | text | trait | type | Optional filter, e.g. ['constant'] or ['class','component']. Omit for everything. EK9 has no module-scoped variables — only constants are per-module values, everything else is a type — so 'constant' is just one kind here. | |
scope | string: file | module | 'file' (default) lists what THIS source file declares; 'module' lists what the whole module declares across ALL its files, adding a 'file' field per construct. A multi-file module has one scope per file, so the two differ: a constant declared in a sibling file is absent from the 'file' view. |
Recorded calls
Real calls, recorded against small projects and checked on every build - a changed answer fails it.
Module shape
Request
{
"file" : "MyRecord.ek9"
}
Response
{
"constructCount" : 1,
"constructNames" : [ "MyRecord" ],
"constructs" : [ {
"category" : "TYPE",
"cohesion" : 1,
"column" : 4,
"complexity" : 1,
"coupling" : 0,
"fieldCount" : 1,
"genus" : "RECORD",
"isOpen" : false,
"line" : 5,
"memberCount" : 27,
"methodCount" : 13,
"modifiers" : [ ],
"name" : "MyRecord",
"operatorCount" : 13
} ],
"meta" : {
"serverMs" : "<timing>"
},
"metrics" : {
"averageMembersPerConstruct" : 27.0
...
Cut short here: 4 more lines. The whole recorded call.
Module scope constants
Request
{
"file" : "orders.ek9",
"kinds" : [ "constant" ],
"scope" : "module"
}
Response
{
"constructCount" : 2,
"constructNames" : [ "SERVICE_NAME", "MAX_RETRIES" ],
"constructs" : [ {
"category" : "VARIABLE",
"column" : 4,
"file" : "constants.ek9",
"genus" : "VALUE",
"line" : 5,
"name" : "SERVICE_NAME"
}, {
"category" : "VARIABLE",
"column" : 4,
"file" : "constants.ek9",
"genus" : "VALUE",
"line" : 6,
"name" : "MAX_RETRIES"
} ],
"kinds" : [ "constant" ],
"meta" : {
"serverMs" : "<timing>"
},
"metrics" : {
"averageMembersPerConstruct" : 0.0
...
Cut short here: 6 more lines. The whole recorded call.