Skip to main content
Version: 1.x

Class: CapabilityRegistry

Defined in: src/ai/capability-registry.ts:59

Queryable registry of Praman API capabilities for AI agents.

Intent

Expose Praman API surface to LLMs for test generation.

Capability

AI context building, capability discovery.

Example

const registry = new CapabilityRegistry();
const tableCaps = registry.byCategory('table');
const aiContext = registry.forAI();

Constructors

Constructor

new CapabilityRegistry(): CapabilityRegistry

Defined in: src/ai/capability-registry.ts:80

Constructs a registry pre-seeded from the generated capability list.

Returns

CapabilityRegistry

Example

const registry = new CapabilityRegistry();
logger.info(registry.list().length);

Properties

registryVersion

readonly static registryVersion: 1 = 1

Defined in: src/ai/capability-registry.ts:67

Registry schema version.

Remarks

Bumped when the entry shape changes. Consumers can use this to detect incompatible generated files at runtime.

Methods

byCategory()

byCategory(category): object[]

Defined in: src/ai/capability-registry.ts:113

Returns capabilities matching the given category.

Parameters

category

Category to filter by.

"ui5" | "auth" | "navigate" | "table" | "dialog" | "date" | "odata" | "fe" | "intent" | "flp" | "shell" | "footer" | "ai" | "data" | "assert"

Returns

Entries whose category matches exactly.

Example

const navCaps = registry.byCategory('navigate');

byNamespace()

byNamespace(namespace): object[]

Defined in: src/ai/capability-registry.ts:128

Returns capabilities matching the given namespace prefix.

Parameters

namespace

string

Dot-separated namespace prefix, e.g. 'ui5.table'.

Returns

Entries whose qualifiedName starts with the namespace.

Example

const tableCaps = registry.byNamespace('ui5.table');

find()

find(query): object[]

Defined in: src/ai/capability-registry.ts:163

Searches capabilities by partial match against name or description.

Parameters

query

string

Substring to search for.

Returns

Entries whose name or description contains the query.

Remarks

Case-insensitive substring match. For semantic search, feed the result list into an embedding model or pass forAI() output to an LLM.

Example

const clickCaps = registry.find('click');

findByName()

findByName(name): { async?: boolean; category: "ui5" | "auth" | "navigate" | "table" | "dialog" | "date" | "odata" | "fe" | "intent" | "flp" | "shell" | "footer" | "ai" | "data" | "assert"; controlTypes?: string[]; description: string; id: string; intent?: string; name: string; priority: "fixture" | "namespace" | "implementation"; qualifiedName: string; registryVersion: 1; sapModule?: string; usageExample: string; } | undefined

Defined in: src/ai/capability-registry.ts:187

Returns the first capability entry matching the given name, or undefined.

Parameters

name

string

Human-readable capability name to look up (case-sensitive).

Returns

{ async?: boolean; category: "ui5" | "auth" | "navigate" | "table" | "dialog" | "date" | "odata" | "fe" | "intent" | "flp" | "shell" | "footer" | "ai" | "data" | "assert"; controlTypes?: string[]; description: string; id: string; intent?: string; name: string; priority: "fixture" | "namespace" | "implementation"; qualifiedName: string; registryVersion: 1; sapModule?: string; usageExample: string; }

async?

optional async: boolean

Whether this is an async method.

category

category: "ui5" | "auth" | "navigate" | "table" | "dialog" | "date" | "odata" | "fe" | "intent" | "flp" | "shell" | "footer" | "ai" | "data" | "assert" = CapabilityCategorySchema

Logical grouping for filtering.

controlTypes?

optional controlTypes: string[]

UI5 control types this capability works with.

description

description: string

One-sentence description of what this capability does.

id

id: string

Unique identifier in UI5-PREFIX-NNN format.

intent?

optional intent: string

Optional intent tag.

name

name: string

Human-readable function or method name.

priority

priority: "fixture" | "namespace" | "implementation" = CapabilityPrioritySchema

REQUIRED priority tier.

qualifiedName

qualifiedName: string

Dot-separated agent-friendly name, e.g. 'ui5.table.getRows'.

registryVersion

registryVersion: 1

Registry schema version for forward compatibility.

sapModule?

optional sapModule: string

Optional SAP UI5 module tag.

usageExample

usageExample: string

Ready-to-run usage example string.

undefined

The matching entry, or undefined if not found.

Remarks

Searches by human-readable name (not id). For exact ID lookup use get().

Example

const cap = registry.findByName('clickButton');
if (cap !== undefined) {
logger.info(cap.usageExample);
}

forAI()

forAI(): CapabilitiesJSON

Defined in: src/ai/capability-registry.ts:263

Returns the full registry as structured JSON optimised for AI agent consumption.

Returns

CapabilitiesJSON

Structured JSON snapshot of the entire registry.

Remarks

Currently an alias for toJSON(). Future releases may apply provider-specific formatting or token-budget-aware truncation.

Example

const aiContext = registry.forAI();
const prompt = JSON.stringify(aiContext);

forProvider()

forProvider(provider): string

Defined in: src/ai/capability-registry.ts:287

Returns capabilities formatted for a specific AI provider.

Parameters

provider

AiProviderName

Target AI provider name.

Returns

string

Formatted capability descriptions as a string.

Remarks

Each provider receives a format optimised for its native consumption pattern:

  • 'claude' — XML-structured {@literal <capability>} elements with attributes
  • 'openai' — JSON array of function-calling tool schemas
  • 'gemini' — Plain text listing with name, description, and example

Example

const registry = new CapabilityRegistry();
const claudeContext = registry.forProvider('claude');
const openaiTools = registry.forProvider('openai');
const geminiText = registry.forProvider('gemini');

get()

get(id): { async?: boolean; category: "ui5" | "auth" | "navigate" | "table" | "dialog" | "date" | "odata" | "fe" | "intent" | "flp" | "shell" | "footer" | "ai" | "data" | "assert"; controlTypes?: string[]; description: string; id: string; intent?: string; name: string; priority: "fixture" | "namespace" | "implementation"; qualifiedName: string; registryVersion: 1; sapModule?: string; usageExample: string; } | undefined

Defined in: src/ai/capability-registry.ts:379

Returns the capability entry with the given id, or undefined.

Parameters

id

string

Unique kebab-case capability identifier.

Returns

{ async?: boolean; category: "ui5" | "auth" | "navigate" | "table" | "dialog" | "date" | "odata" | "fe" | "intent" | "flp" | "shell" | "footer" | "ai" | "data" | "assert"; controlTypes?: string[]; description: string; id: string; intent?: string; name: string; priority: "fixture" | "namespace" | "implementation"; qualifiedName: string; registryVersion: 1; sapModule?: string; usageExample: string; }

async?

optional async: boolean

Whether this is an async method.

category

category: "ui5" | "auth" | "navigate" | "table" | "dialog" | "date" | "odata" | "fe" | "intent" | "flp" | "shell" | "footer" | "ai" | "data" | "assert" = CapabilityCategorySchema

Logical grouping for filtering.

controlTypes?

optional controlTypes: string[]

UI5 control types this capability works with.

description

description: string

One-sentence description of what this capability does.

id

id: string

Unique identifier in UI5-PREFIX-NNN format.

intent?

optional intent: string

Optional intent tag.

name

name: string

Human-readable function or method name.

priority

priority: "fixture" | "namespace" | "implementation" = CapabilityPrioritySchema

REQUIRED priority tier.

qualifiedName

qualifiedName: string

Dot-separated agent-friendly name, e.g. 'ui5.table.getRows'.

registryVersion

registryVersion: 1

Registry schema version for forward compatibility.

sapModule?

optional sapModule: string

Optional SAP UI5 module tag.

usageExample

usageExample: string

Ready-to-run usage example string.

undefined

The matching entry, or undefined if not registered.

Example

const cap = registry.get('click-button');
if (cap !== undefined) {
logger.info(cap.usageExample);
}

getStatistics()

getStatistics(): CapabilityStats

Defined in: src/ai/capability-registry.ts:205

Returns a statistical summary of the capability registry.

Returns

CapabilityStats

Statistics including total count, categories, and priority breakdown.

Example

const stats = registry.getStatistics();
logger.info(`Total: ${stats.totalMethods}`);

has()

has(name): boolean

Defined in: src/ai/capability-registry.ts:400

Returns true if a capability with the given name is registered.

Parameters

name

string

Human-readable capability name to look up.

Returns

boolean

true when at least one entry matches.

Remarks

Searches by name (not id). Names are not guaranteed unique but are human-readable and match the TSDoc @capability tag value.

Example

if (registry.has('clickButton')) {
// safe to use
}

list()

list(): object[]

Defined in: src/ai/capability-registry.ts:98

Returns all registered capability entries.

Returns

Shallow copy of the full capability list.

Example

const all = registry.list();
logger.info(all.length);

listByPriority()

listByPriority(priority): object[]

Defined in: src/ai/capability-registry.ts:144

Returns capabilities matching the given priority tier.

Parameters

priority

Priority level to filter by.

"fixture" | "namespace" | "implementation"

Returns

Entries whose priority matches exactly.

Example

const fixtures = registry.listByPriority('fixture');
const handlers = registry.listByPriority('namespace');

register()

register(entry): void

Defined in: src/ai/capability-registry.ts:430

Registers a new capability entry or overwrites an existing one by id.

Parameters

entry

Capability entry to add or replace.

async?

boolean = ...

Whether this is an async method.

category

"ui5" | "auth" | "navigate" | "table" | "dialog" | "date" | "odata" | "fe" | "intent" | "flp" | "shell" | "footer" | "ai" | "data" | "assert" = CapabilityCategorySchema

Logical grouping for filtering.

controlTypes?

string[] = ...

UI5 control types this capability works with.

description

string = ...

One-sentence description of what this capability does.

id

string = ...

Unique identifier in UI5-PREFIX-NNN format.

intent?

string = ...

Optional intent tag.

name

string = ...

Human-readable function or method name.

priority

"fixture" | "namespace" | "implementation" = CapabilityPrioritySchema

REQUIRED priority tier.

qualifiedName

string = ...

Dot-separated agent-friendly name, e.g. 'ui5.table.getRows'.

registryVersion

1 = ...

Registry schema version for forward compatibility.

sapModule?

string = ...

Optional SAP UI5 module tag.

usageExample

string = ...

Ready-to-run usage example string.

Returns

void

Remarks

Intended for use in tests and plugins. The generated file should not call this method — run npm run generate:capabilities instead.

Example

registry.register({
id: 'UI5-UI5-020',
qualifiedName: 'ui5.myCapability',
name: 'myCapability',
description: 'Does something useful for testing.',
category: 'ui5',
priority: 'fixture',
usageExample: 'await ui5.myCapability()',
registryVersion: 1,
});

toJSON()

toJSON(): CapabilitiesJSON

Defined in: src/ai/capability-registry.ts:235

Exports the full registry as a structured JSON object.

Returns

CapabilitiesJSON

Structured JSON snapshot of the entire registry.

Remarks

Fixtures are listed first (Playwright best practice), then all methods.

Example

const json = registry.toJSON();
logger.info(JSON.stringify(json, null, 2));