All files / core/blong-kukum/primitives index.ts

92.3% Statements 60/65
100% Branches 3/3
50% Functions 1/2
92.3% Lines 60/65

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 661x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 89x 89x 1x 1x 1x            
import type {PrimitiveContext, PrimitiveDescriptor, PrimitiveFile} from '../engine.ts';
import adapter from './adapter.ts';
import component from './component.ts';
import error from './error.ts';
import gateway from './gateway.ts';
import handler from './handler.ts';
import layer from './layer.ts';
import library from './library.ts';
import lukaot from './lukaot.ts';
import model from './model.ts';
import orchestrator from './orchestrator.ts';
import realm from './realm.ts';
import schema from './schema.ts';
import seed from './seed.ts';
import storybook from './storybook.ts';
import suite from './suite.ts';
import test from './test.ts';
 
/**
 * The primitive catalogue.
 *
 * Every primitive is declarative data: a list of target paths plus the template
 * source for each. The API surface (`kukum.<primitive>.<predicate>`) is derived
 * from this list, and each descriptor names the skill that owns its prose, so
 * an agent can be pointed at the right guidance without the skill pasting file
 * recipes.
 *
 * One descriptor per file: a descriptor is data plus pure template functions, so
 * they stay plain modules rather than `library()` handlers, and a new primitive
 * is a new file plus one line here.
 */
 
/** The catalogue, in the order the API advertises it. */
export const PRIMITIVES: PrimitiveDescriptor[] = [
    realm,
    suite,
    layer,
    handler,
    library,
    orchestrator,
    adapter,
    error,
    lukaot,
    schema,
    seed,
    model,
    test,
    gateway,
    component,
    storybook,
];
 
export const PRIMITIVE_IDS: string[] = PRIMITIVES.map(primitive => primitive.id);
 
export function getPrimitive(id: string): PrimitiveDescriptor | undefined {
    return PRIMITIVES.find(primitive => primitive.id === id);
}
 
/** Root-relative file list a primitive would produce, for `get`/`find` output. */
export function previewFiles(
    descriptor: PrimitiveDescriptor,
    ctx: PrimitiveContext,
): PrimitiveFile[] {
    return descriptor.files(ctx);
}