structured-context 0.13.0 → 0.13.1
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.
- package/dist/api.d.ts +17 -17
- package/dist/api.js +12 -12
- package/dist/config.d.ts +1 -1
- package/dist/config.js +4 -4
- package/dist/index.d.ts +1 -1
- package/dist/index.js +17 -17
- package/dist/judge/context.d.ts +1 -1
- package/dist/judge/factory.d.ts +1 -1
- package/dist/judge/factory.js +1 -1
- package/dist/judge/index.d.ts +1 -1
- package/dist/judge/judge-node.d.ts +1 -1
- package/dist/judge/prompt.d.ts +1 -1
- package/dist/judge/trim.d.ts +1 -1
- package/dist/judge/verdicts.d.ts +1 -1
- package/dist/load-space-graph.d.ts +3 -3
- package/dist/load-space-graph.js +4 -4
- package/dist/plugins/loader.js +1 -1
- package/dist/plugins/markdown/render-directory.js +1 -1
- package/dist/plugins/markdown/util.d.ts +1 -1
- package/dist/render/render.d.ts +1 -1
- package/dist/render/render.js +1 -1
- package/dist/space-context.d.ts +2 -2
- package/dist/space-context.js +3 -3
- package/dist/space-graph.d.ts +1 -1
- package/dist/testing.d.ts +1 -1
- package/dist/types.d.ts +4 -4
- package/dist/validate.d.ts +5 -5
- package/dist/validate.js +8 -8
- package/package.json +5 -5
package/dist/api.d.ts
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Import from this module to use structured-context as a library:
|
|
5
5
|
*
|
|
6
|
-
* import { loadConfig, loadSpaceGraph, validateSpace, validateFile } from '
|
|
7
|
-
* import type { StructuredContextPlugin, PluginContext, ParseResult } from '
|
|
6
|
+
* import { loadConfig, loadSpaceGraph, validateSpace, validateFile } from 'structured-context/api';
|
|
7
|
+
* import type { StructuredContextPlugin, PluginContext, ParseResult } from 'structured-context/api';
|
|
8
8
|
*
|
|
9
9
|
* Common patterns:
|
|
10
10
|
*
|
|
@@ -18,18 +18,18 @@
|
|
|
18
18
|
* const validation = await validateSpace(ctx, { readResult });
|
|
19
19
|
*/
|
|
20
20
|
export type { AnySchemaObject, SchemaObject, ValidateFunction } from 'ajv';
|
|
21
|
-
export type { Config, SpaceConfig } from './config
|
|
22
|
-
export { loadConfig, resolveSchema, resolveSchemaPath, setConfigPath } from './config
|
|
23
|
-
export { PLUGIN_PREFIX } from './constants
|
|
24
|
-
export { assembleSpaceGraph, loadSpaceGraph } from './load-space-graph
|
|
25
|
-
export type { ParseHook, ParseResult, PluginContext, RenderFileOutput, RenderFormat, RenderHook, RenderMultiFileOutput, RenderOptions, RenderResult, StructuredContextPlugin, TemplateSyncHook, TemplateSyncOptions, } from './plugins/util
|
|
26
|
-
export { isRenderMultiFileOutput, resolvePluginDir, resolvePluginSchemasDir, resolveSpacePluginSchemas, } from './plugins/util
|
|
27
|
-
export { readSpace } from './read/read-space
|
|
28
|
-
export { buildTargetIndex, formatWikilink, type ParsedWikilink, parseWikilink, wikilinkToTarget, } from './read/wikilink-utils
|
|
29
|
-
export type { SharedEmbeddingFields } from './schema/metadata-contract
|
|
30
|
-
export { bundledSchemasDir, loadSchema, type PluginSchemaSource, setBundledSchemasDir } from './schema/schema
|
|
31
|
-
export { createSpaceContext, SpaceNotFoundError } from './space-context
|
|
32
|
-
export { buildSpaceGraph, type SpaceGraph } from './space-graph
|
|
33
|
-
export type { BaseNode, ContentLink, EdgeDefinition, FileNotInSpaceResult, FileValidationIssue, FileValidationResult, Hierarchy, HierarchyLevel, ParseIssue, ReadSpaceResult, Relationship, ResolvedContentLink, RuleCategory, RuleSeverity, RuleViolation, SchemaMetadata, SchemaWithMetadata, SourceLocation, SpaceContext, SpaceNode, UnresolvedRef, ValidateFileOutput, } from './types
|
|
34
|
-
export type { ValidationResult } from './validate
|
|
35
|
-
export { validateFile, validateSpace } from './validate
|
|
21
|
+
export type { Config, SpaceConfig } from './config';
|
|
22
|
+
export { loadConfig, resolveSchema, resolveSchemaPath, setConfigPath } from './config';
|
|
23
|
+
export { PLUGIN_PREFIX } from './constants';
|
|
24
|
+
export { assembleSpaceGraph, loadSpaceGraph } from './load-space-graph';
|
|
25
|
+
export type { ParseHook, ParseResult, PluginContext, RenderFileOutput, RenderFormat, RenderHook, RenderMultiFileOutput, RenderOptions, RenderResult, StructuredContextPlugin, TemplateSyncHook, TemplateSyncOptions, } from './plugins/util';
|
|
26
|
+
export { isRenderMultiFileOutput, resolvePluginDir, resolvePluginSchemasDir, resolveSpacePluginSchemas, } from './plugins/util';
|
|
27
|
+
export { readSpace } from './read/read-space';
|
|
28
|
+
export { buildTargetIndex, formatWikilink, type ParsedWikilink, parseWikilink, wikilinkToTarget, } from './read/wikilink-utils';
|
|
29
|
+
export type { SharedEmbeddingFields } from './schema/metadata-contract';
|
|
30
|
+
export { bundledSchemasDir, loadSchema, type PluginSchemaSource, setBundledSchemasDir } from './schema/schema';
|
|
31
|
+
export { createSpaceContext, SpaceNotFoundError } from './space-context';
|
|
32
|
+
export { buildSpaceGraph, type SpaceGraph } from './space-graph';
|
|
33
|
+
export type { BaseNode, ContentLink, EdgeDefinition, FileNotInSpaceResult, FileValidationIssue, FileValidationResult, Hierarchy, HierarchyLevel, ParseIssue, ReadSpaceResult, Relationship, ResolvedContentLink, RuleCategory, RuleSeverity, RuleViolation, SchemaMetadata, SchemaWithMetadata, SourceLocation, SpaceContext, SpaceNode, UnresolvedRef, ValidateFileOutput, } from './types';
|
|
34
|
+
export type { ValidationResult } from './validate';
|
|
35
|
+
export { validateFile, validateSpace } from './validate';
|
package/dist/api.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*
|
|
4
4
|
* Import from this module to use structured-context as a library:
|
|
5
5
|
*
|
|
6
|
-
* import { loadConfig, loadSpaceGraph, validateSpace, validateFile } from '
|
|
7
|
-
* import type { StructuredContextPlugin, PluginContext, ParseResult } from '
|
|
6
|
+
* import { loadConfig, loadSpaceGraph, validateSpace, validateFile } from 'structured-context/api';
|
|
7
|
+
* import type { StructuredContextPlugin, PluginContext, ParseResult } from 'structured-context/api';
|
|
8
8
|
*
|
|
9
9
|
* Common patterns:
|
|
10
10
|
*
|
|
@@ -17,13 +17,13 @@
|
|
|
17
17
|
* const graph = await assembleSpaceGraph(ctx, { readResult });
|
|
18
18
|
* const validation = await validateSpace(ctx, { readResult });
|
|
19
19
|
*/
|
|
20
|
-
export { loadConfig, resolveSchema, resolveSchemaPath, setConfigPath } from './config
|
|
21
|
-
export { PLUGIN_PREFIX } from './constants
|
|
22
|
-
export { assembleSpaceGraph, loadSpaceGraph } from './load-space-graph
|
|
23
|
-
export { isRenderMultiFileOutput, resolvePluginDir, resolvePluginSchemasDir, resolveSpacePluginSchemas, } from './plugins/util
|
|
24
|
-
export { readSpace } from './read/read-space
|
|
25
|
-
export { buildTargetIndex, formatWikilink, parseWikilink, wikilinkToTarget, } from './read/wikilink-utils
|
|
26
|
-
export { bundledSchemasDir, loadSchema, setBundledSchemasDir } from './schema/schema
|
|
27
|
-
export { createSpaceContext, SpaceNotFoundError } from './space-context
|
|
28
|
-
export { buildSpaceGraph } from './space-graph
|
|
29
|
-
export { validateFile, validateSpace } from './validate
|
|
20
|
+
export { loadConfig, resolveSchema, resolveSchemaPath, setConfigPath } from './config';
|
|
21
|
+
export { PLUGIN_PREFIX } from './constants';
|
|
22
|
+
export { assembleSpaceGraph, loadSpaceGraph } from './load-space-graph';
|
|
23
|
+
export { isRenderMultiFileOutput, resolvePluginDir, resolvePluginSchemasDir, resolveSpacePluginSchemas, } from './plugins/util';
|
|
24
|
+
export { readSpace } from './read/read-space';
|
|
25
|
+
export { buildTargetIndex, formatWikilink, parseWikilink, wikilinkToTarget, } from './read/wikilink-utils';
|
|
26
|
+
export { bundledSchemasDir, loadSchema, setBundledSchemasDir } from './schema/schema';
|
|
27
|
+
export { createSpaceContext, SpaceNotFoundError } from './space-context';
|
|
28
|
+
export { buildSpaceGraph } from './space-graph';
|
|
29
|
+
export { validateFile, validateSpace } from './validate';
|
package/dist/config.d.ts
CHANGED
package/dist/config.js
CHANGED
|
@@ -3,10 +3,10 @@ import { homedir } from 'node:os';
|
|
|
3
3
|
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
4
4
|
import Ajv2020 from 'ajv/dist/2020';
|
|
5
5
|
import JSON5 from 'json5';
|
|
6
|
-
import { ENV_CONFIG_VAR, XDG_CONFIG_DIR } from './constants
|
|
7
|
-
import { MODEL_PROVIDER_APIS } from './judge/types
|
|
8
|
-
import { normalizePluginName, resolvePluginSchemasDir, resolveSpacePluginSchemas, shortenPluginName, } from './plugins/util
|
|
9
|
-
import { bundledSchemasDir } from './schema/schema
|
|
6
|
+
import { ENV_CONFIG_VAR, XDG_CONFIG_DIR } from './constants';
|
|
7
|
+
import { MODEL_PROVIDER_APIS } from './judge/types';
|
|
8
|
+
import { normalizePluginName, resolvePluginSchemasDir, resolveSpacePluginSchemas, shortenPluginName, } from './plugins/util';
|
|
9
|
+
import { bundledSchemasDir } from './schema/schema';
|
|
10
10
|
const MODEL_PROVIDER_SCHEMA = {
|
|
11
11
|
type: 'object',
|
|
12
12
|
properties: {
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -2,22 +2,22 @@
|
|
|
2
2
|
import { createRequire } from 'node:module';
|
|
3
3
|
import { format } from 'node:util';
|
|
4
4
|
import { Command } from 'commander';
|
|
5
|
-
import { diagram } from './commands/diagram
|
|
6
|
-
import { docs } from './commands/docs
|
|
7
|
-
import { dump } from './commands/dump
|
|
8
|
-
import { miroSyncCommand } from './commands/miro-sync
|
|
9
|
-
import { listPlugins } from './commands/plugins
|
|
10
|
-
import { render, renderList } from './commands/render
|
|
11
|
-
import { listSchemas, showSchema } from './commands/schemas
|
|
12
|
-
import { show } from './commands/show
|
|
13
|
-
import { listSpaces } from './commands/spaces
|
|
14
|
-
import { templateSync } from './commands/template-sync
|
|
15
|
-
import { validate, watchValidate } from './commands/validate
|
|
16
|
-
import { validateFileCommand } from './commands/validate-file
|
|
17
|
-
import { loadConfig, setConfigPath } from './config
|
|
18
|
-
import { CLI_NAME } from './constants
|
|
19
|
-
import { JudgeConfigError } from './judge/factory
|
|
20
|
-
import { createSpaceContext, SpaceNotFoundError } from './space-context
|
|
5
|
+
import { diagram } from './commands/diagram';
|
|
6
|
+
import { docs } from './commands/docs';
|
|
7
|
+
import { dump } from './commands/dump';
|
|
8
|
+
import { miroSyncCommand } from './commands/miro-sync';
|
|
9
|
+
import { listPlugins } from './commands/plugins';
|
|
10
|
+
import { render, renderList } from './commands/render';
|
|
11
|
+
import { listSchemas, showSchema } from './commands/schemas';
|
|
12
|
+
import { show } from './commands/show';
|
|
13
|
+
import { listSpaces } from './commands/spaces';
|
|
14
|
+
import { templateSync } from './commands/template-sync';
|
|
15
|
+
import { validate, watchValidate } from './commands/validate';
|
|
16
|
+
import { validateFileCommand } from './commands/validate-file';
|
|
17
|
+
import { loadConfig, setConfigPath } from './config';
|
|
18
|
+
import { CLI_NAME } from './constants';
|
|
19
|
+
import { JudgeConfigError } from './judge/factory';
|
|
20
|
+
import { createSpaceContext, SpaceNotFoundError } from './space-context';
|
|
21
21
|
// Once node:process is loaded (vfile, via unified, loads it), Bun's console.log drops piped output
|
|
22
22
|
// past 64KB when the reader is slow. process.stdout.write delivers all of it before exit.
|
|
23
23
|
console.log = (...args) => {
|
|
@@ -157,7 +157,7 @@ providersCmd
|
|
|
157
157
|
.description('List bundled and configured model providers; keys are never shown')
|
|
158
158
|
.option('--json', 'Output as JSON')
|
|
159
159
|
.action(async (options) => {
|
|
160
|
-
const { listProviders } = await import('./commands/providers
|
|
160
|
+
const { listProviders } = await import('./commands/providers');
|
|
161
161
|
listProviders(options);
|
|
162
162
|
});
|
|
163
163
|
program.addCommand(providersCmd);
|
package/dist/judge/context.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SEMANTIC_SCOPES } from '../schema/metadata-contract';
|
|
2
2
|
import type { SpaceGraph } from '../space-graph';
|
|
3
3
|
import type { Rule, SpaceNode } from '../types';
|
|
4
|
-
import type { RelatedNode, SemanticJudgeInput } from '
|
|
4
|
+
import type { RelatedNode, SemanticJudgeInput } from './types';
|
|
5
5
|
export type SemanticScope = Exclude<(typeof SEMANTIC_SCOPES)[number], 'branch'>;
|
|
6
6
|
export type ContentMode = 'none' | 'nodeOnly' | 'fullScope';
|
|
7
7
|
/** What a rule asks to send besides the evaluated node's data. */
|
package/dist/judge/factory.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type HydratedProvider, type ModelProviderConfig, type SemanticJudgeProvider } from '
|
|
1
|
+
import { type HydratedProvider, type ModelProviderConfig, type SemanticJudgeProvider } from './types';
|
|
2
2
|
type Env = Record<string, string | undefined>;
|
|
3
3
|
/**
|
|
4
4
|
* Bundled providers: usable as a judge by name, without a `modelProviders` entry. A user entry of the
|
package/dist/judge/factory.js
CHANGED
|
@@ -3,7 +3,7 @@ import { FakeJudgeProvider } from './provider/fake';
|
|
|
3
3
|
import { JEV_LATEST, JevJudgeProvider } from './provider/jev';
|
|
4
4
|
import { OpenAIJudgeProvider, RECOMMENDED_OPENAI_MODEL } from './provider/openai';
|
|
5
5
|
import { OpenAIDecisionsJudgeProvider, RECOMMENDED_OPENAI_DECISIONS_MODEL } from './provider/openai-decisions';
|
|
6
|
-
import { MODEL_PROVIDER_APIS, } from '
|
|
6
|
+
import { MODEL_PROVIDER_APIS, } from './types';
|
|
7
7
|
const OPENROUTER_COMPLETIONS_ENDPOINT = 'https://openrouter.ai/api/v1';
|
|
8
8
|
const RECOMMENDED_OPENROUTER_OPENAI_DECISIONS_MODEL = `openai/${RECOMMENDED_OPENAI_DECISIONS_MODEL}-decisions`;
|
|
9
9
|
const RECOMMENDED_OPENROUTER_OPENAI_MODEL = `openai/${RECOMMENDED_OPENAI_MODEL}`;
|
package/dist/judge/index.d.ts
CHANGED
|
@@ -9,5 +9,5 @@ export { JevJudgeProvider } from './provider/jev';
|
|
|
9
9
|
export type { OpenAIJudgeProviderOptions } from './provider/openai';
|
|
10
10
|
export { OpenAIJudgeProvider } from './provider/openai';
|
|
11
11
|
export { PerRuleJudgeProvider } from './provider/per-rule';
|
|
12
|
-
export type { JudgeConfig, ModelProviderConfig, SemanticJudgeInput, SemanticJudgeProvider, SemanticJudgeResult, SemanticJudgeVerdict, SemanticRuleSpec, } from '
|
|
12
|
+
export type { JudgeConfig, ModelProviderConfig, SemanticJudgeInput, SemanticJudgeProvider, SemanticJudgeResult, SemanticJudgeVerdict, SemanticRuleSpec, } from './types';
|
|
13
13
|
export { DEFAULT_VERDICTS, isJudgeError, semanticRuleSpec } from './verdicts';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { SpaceGraph } from '../space-graph';
|
|
2
2
|
import type { Rule, RuleSeverity, SpaceNode } from '../types';
|
|
3
3
|
import { type TrimReport } from './trim';
|
|
4
|
-
import type { SemanticJudgeProvider } from '
|
|
4
|
+
import type { SemanticJudgeProvider } from './types';
|
|
5
5
|
export type NodeJudgement = {
|
|
6
6
|
rule: Rule;
|
|
7
7
|
/** True when the verdict fails the rule (it has a severity), or the provider errored. */
|
package/dist/judge/prompt.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SemanticJudgeInput, SemanticJudgeResult, SemanticRuleSpec } from '
|
|
1
|
+
import type { SemanticJudgeInput, SemanticJudgeResult, SemanticRuleSpec } from './types';
|
|
2
2
|
/** System prompt: a strict judge that answers with one verdict from a closed set, as JSON. */
|
|
3
3
|
export declare function buildJudgeSystemPrompt(): string;
|
|
4
4
|
/** User prompt for one rule on one node. */
|
package/dist/judge/trim.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { SemanticJudgeInput } from '
|
|
1
|
+
import type { SemanticJudgeInput } from './types';
|
|
2
2
|
/** The per-node input cap: estimated tokens of one node's input (the node and its related nodes), the same for every provider. */
|
|
3
3
|
export declare const PER_NODE_INPUT_CAP_TOKENS = 32000;
|
|
4
4
|
/** Estimated tokens of a value: its JSON length divided by 4. Provider-independent, and roughly right is enough. */
|
package/dist/judge/verdicts.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { Rule, RuleSeverity } from '../types';
|
|
2
|
-
import type { SemanticJudgeResult, SemanticRuleSpec } from '
|
|
2
|
+
import type { SemanticJudgeResult, SemanticRuleSpec } from './types';
|
|
3
3
|
/** Verdicts for a semantic rule that declares none. */
|
|
4
4
|
export declare const DEFAULT_VERDICTS: Record<string, string>;
|
|
5
5
|
/** A semantic rule resolved for evaluation: what the judge sees, and what each verdict means for the user. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { Config } from './config
|
|
2
|
-
import { type SpaceGraph } from './space-graph
|
|
3
|
-
import type { ReadSpaceResult, SpaceContext } from './types
|
|
1
|
+
import type { Config } from './config';
|
|
2
|
+
import { type SpaceGraph } from './space-graph';
|
|
3
|
+
import type { ReadSpaceResult, SpaceContext } from './types';
|
|
4
4
|
export interface AssembleSpaceGraphOptions {
|
|
5
5
|
/** Named view (resolved via space.views) or a raw filter DSL expression. */
|
|
6
6
|
filter?: string;
|
package/dist/load-space-graph.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { filterNodes } from './filter/filter-nodes
|
|
2
|
-
import { readSpace } from './read/read-space
|
|
3
|
-
import { createSpaceContext } from './space-context
|
|
4
|
-
import { buildSpaceGraph } from './space-graph
|
|
1
|
+
import { filterNodes } from './filter/filter-nodes';
|
|
2
|
+
import { readSpace } from './read/read-space';
|
|
3
|
+
import { createSpaceContext } from './space-context';
|
|
4
|
+
import { buildSpaceGraph } from './space-graph';
|
|
5
5
|
/**
|
|
6
6
|
* Assemble a SpaceGraph from a space context: read the space, drop nodes that
|
|
7
7
|
* fail schema validation, build the graph for the selected hierarchy (the main
|
package/dist/plugins/loader.js
CHANGED
|
@@ -2,7 +2,7 @@ import { existsSync, readdirSync } from 'node:fs';
|
|
|
2
2
|
import { dirname, isAbsolute, join, resolve } from 'node:path';
|
|
3
3
|
import Ajv2020 from 'ajv/dist/2020';
|
|
4
4
|
import { getConfigSourceFiles } from '../config';
|
|
5
|
-
import { builtinPlugins } from '
|
|
5
|
+
import { builtinPlugins } from '.';
|
|
6
6
|
import { CONFIG_PLUGINS_DIR, normalizePluginName, PLUGIN_PREFIX, shortenPluginName, } from './util';
|
|
7
7
|
/**
|
|
8
8
|
* Walk a plugin's configSchema and resolve any string fields annotated with
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { posix } from 'node:path';
|
|
2
2
|
import matter from 'gray-matter';
|
|
3
|
-
import { getMarkdownConfig } from '
|
|
3
|
+
import { getMarkdownConfig } from './index';
|
|
4
4
|
import { invertFieldMap, MATTER_OPTIONS } from './util';
|
|
5
5
|
/**
|
|
6
6
|
* Sanitize a node title into a valid filesystem filename.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { type DumpOptions, type Schema } from 'js-yaml';
|
|
2
|
-
import type { TypeInferenceConfig } from '
|
|
2
|
+
import type { TypeInferenceConfig } from '.';
|
|
3
3
|
export declare function inferTypeFromPath(filePath: string, config: TypeInferenceConfig, knownTypes: Set<string>, typeAliases: Record<string, string> | undefined): string | undefined;
|
|
4
4
|
/**
|
|
5
5
|
* YAML schema for frontmatter and embedded YAML blocks: YAML 1.2 Core schema extended with
|
package/dist/render/render.d.ts
CHANGED
package/dist/render/render.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { shortenPluginName } from '../plugins/util.js';
|
|
2
1
|
import { updateSpaceField } from '../config';
|
|
3
2
|
import { assembleSpaceGraph } from '../load-space-graph';
|
|
4
3
|
import { loadPlugins } from '../plugins/loader';
|
|
4
|
+
import { shortenPluginName } from '../plugins/util';
|
|
5
5
|
import { buildFormatRegistry } from './registry';
|
|
6
6
|
export async function executeRender(formatName, context, options) {
|
|
7
7
|
const pluginMap = context.space?.plugins ?? {};
|
package/dist/space-context.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { type Config } from './config
|
|
2
|
-
import type { SpaceContext } from './types
|
|
1
|
+
import { type Config } from './config';
|
|
2
|
+
import type { SpaceContext } from './types';
|
|
3
3
|
/** Thrown by createSpaceContext when no space matches the given name. */
|
|
4
4
|
export declare class SpaceNotFoundError extends Error {
|
|
5
5
|
readonly spaceName: string;
|
package/dist/space-context.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { resolveSchema } from './config
|
|
2
|
-
import { resolveSpacePluginSchemas } from './plugins/util
|
|
3
|
-
import { loadSchema } from './schema/schema
|
|
1
|
+
import { resolveSchema } from './config';
|
|
2
|
+
import { resolveSpacePluginSchemas } from './plugins/util';
|
|
3
|
+
import { loadSchema } from './schema/schema';
|
|
4
4
|
/** Thrown by createSpaceContext when no space matches the given name. */
|
|
5
5
|
export class SpaceNotFoundError extends Error {
|
|
6
6
|
spaceName;
|
package/dist/space-graph.d.ts
CHANGED
package/dist/testing.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { BaseNode, Hierarchy, HierarchyLevel, Relationship, ResolvedParentRef, SpaceNode } from './types
|
|
1
|
+
import type { BaseNode, Hierarchy, HierarchyLevel, Relationship, ResolvedParentRef, SpaceNode } from './types';
|
|
2
2
|
/**
|
|
3
3
|
* Creates a ResolvedParentRef with sensible defaults for use in tests.
|
|
4
4
|
* Override any field to represent specific edge contexts.
|
package/dist/types.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AnySchemaObject, SchemaObject, ValidateFunction } from 'ajv';
|
|
2
|
-
import type { Config, SpaceConfig } from './config
|
|
3
|
-
import type { MetadataContractHierarchyLevel, MetadataContractRelationship, Rule, SharedEdgeFields } from './schema/metadata-contract
|
|
2
|
+
import type { Config, SpaceConfig } from './config';
|
|
3
|
+
import type { MetadataContractHierarchyLevel, MetadataContractRelationship, Rule, SharedEdgeFields } from './schema/metadata-contract';
|
|
4
4
|
/**
|
|
5
5
|
* Minimal normalized edge for graph resolution.
|
|
6
6
|
* Derives routing fields from SharedEdgeFields to stay in sync with the schema.
|
|
@@ -171,8 +171,8 @@ export type RuleCategory = 'validation' | 'coherence' | 'workflow' | 'best-pract
|
|
|
171
171
|
* A rule's severity defaults from its category and may be overridden per rule.
|
|
172
172
|
*/
|
|
173
173
|
export type RuleSeverity = 'error' | 'warning' | 'info';
|
|
174
|
-
export type { CoverageGate, GatingSeed } from './schema/gating
|
|
175
|
-
export type { Rule } from './schema/metadata-contract
|
|
174
|
+
export type { CoverageGate, GatingSeed } from './schema/gating';
|
|
175
|
+
export type { Rule } from './schema/metadata-contract';
|
|
176
176
|
export type RuleViolation = {
|
|
177
177
|
/** Node label, or empty string for global-scope rules. */
|
|
178
178
|
file: string;
|
package/dist/validate.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import type { ErrorObject } from 'ajv';
|
|
2
|
-
import type { Config, SpaceConfig } from './config
|
|
3
|
-
import type { SemanticJudgeProvider } from './judge/types
|
|
4
|
-
import { type RuleFilter } from './schema/rule-filter
|
|
5
|
-
import { extractEntityInfo } from './schema/schema
|
|
6
|
-
import type { CoverageGate, FileNotInSpaceResult, FileValidationResult, GraphViolation, ParseIssue, ReadSpaceResult, RuleViolation, SchemaWithMetadata, SpaceContext, SpaceNode, ValidateFileOutput } from './types
|
|
2
|
+
import type { Config, SpaceConfig } from './config';
|
|
3
|
+
import type { SemanticJudgeProvider } from './judge/types';
|
|
4
|
+
import { type RuleFilter } from './schema/rule-filter';
|
|
5
|
+
import { extractEntityInfo } from './schema/schema';
|
|
6
|
+
import type { CoverageGate, FileNotInSpaceResult, FileValidationResult, GraphViolation, ParseIssue, ReadSpaceResult, RuleViolation, SchemaWithMetadata, SpaceContext, SpaceNode, ValidateFileOutput } from './types';
|
|
7
7
|
export interface FormattedError {
|
|
8
8
|
message: string;
|
|
9
9
|
dedupeKey: string;
|
package/dist/validate.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { isAbsolute, relative, resolve } from 'node:path';
|
|
2
|
-
import { readSpace } from './read/read-space
|
|
3
|
-
import { computeHierarchyDepths, evaluateRulesWithGating } from './schema/gating
|
|
4
|
-
import { filterRules } from './schema/rule-filter
|
|
5
|
-
import { extractEntityInfo } from './schema/schema
|
|
6
|
-
import { validateGraph } from './schema/validate-graph
|
|
7
|
-
import { validateRules } from './schema/validate-rules
|
|
8
|
-
import { createSpaceContext } from './space-context
|
|
9
|
-
import { buildSpaceGraph } from './space-graph
|
|
2
|
+
import { readSpace } from './read/read-space';
|
|
3
|
+
import { computeHierarchyDepths, evaluateRulesWithGating } from './schema/gating';
|
|
4
|
+
import { filterRules } from './schema/rule-filter';
|
|
5
|
+
import { extractEntityInfo } from './schema/schema';
|
|
6
|
+
import { validateGraph } from './schema/validate-graph';
|
|
7
|
+
import { validateRules } from './schema/validate-rules';
|
|
8
|
+
import { createSpaceContext } from './space-context';
|
|
9
|
+
import { buildSpaceGraph } from './space-graph';
|
|
10
10
|
/**
|
|
11
11
|
* Format AJV errors for better readability.
|
|
12
12
|
* Groups related errors and extracts helpful context like allowed values.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "structured-context",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.1",
|
|
4
4
|
"description": "Keep your content clean and your thinking clear with assistive tools for structured knowledge",
|
|
5
5
|
"module": "./dist/index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -35,12 +35,13 @@
|
|
|
35
35
|
"clean": "rm -rf dist",
|
|
36
36
|
"generate:schema-meta": "bun run scripts/generate-schema-meta.ts",
|
|
37
37
|
"typecheck": "tsc --noEmit",
|
|
38
|
-
"build": "bun run clean && bun run generate:schema-meta && tsc -p tsconfig.build.json &&
|
|
38
|
+
"build": "bun run clean && bun run generate:schema-meta && tsc -p tsconfig.build.json && cp -r schemas dist/ && chmod +x dist/index.js",
|
|
39
39
|
"prepublishOnly": "bun run build",
|
|
40
40
|
"validate": "bun run src/index.ts validate",
|
|
41
41
|
"diagram": "bun run src/index.ts diagram",
|
|
42
42
|
"test": "bun test tests/",
|
|
43
43
|
"test:smoke": "bun test smoke/",
|
|
44
|
+
"test:package": "bash scripts/test-package.sh",
|
|
44
45
|
"test:judge": "SCTX_LIVE_JUDGE_TESTS=1 bun test tests/judge/live.test.ts",
|
|
45
46
|
"test:models": "SCTX_MODEL_VALIDATION=1 bun test tests/judge/model-validation.test.ts",
|
|
46
47
|
"test:hook": "bun test hook-test/unit/",
|
|
@@ -48,7 +49,7 @@
|
|
|
48
49
|
"test:all": "bun test",
|
|
49
50
|
"lint": "biome check",
|
|
50
51
|
"lint:fix": "biome check --write",
|
|
51
|
-
"preversion": "bun run generate:schema-meta && bun run lint:fix && bun run test",
|
|
52
|
+
"preversion": "bun run generate:schema-meta && bun run lint:fix && bun run test && bun run test:package",
|
|
52
53
|
"version": "bun run generate:schema-meta --release && git add -A",
|
|
53
54
|
"postversion": "git push --follow-tags"
|
|
54
55
|
},
|
|
@@ -57,8 +58,7 @@
|
|
|
57
58
|
"@biomejs/biome": "^2.5.15",
|
|
58
59
|
"@types/bun": "latest",
|
|
59
60
|
"json-schema-to-ts": "^3.1.1",
|
|
60
|
-
"lefthook": "^2.1.9"
|
|
61
|
-
"tsc-alias": "^1.9.1"
|
|
61
|
+
"lefthook": "^2.1.9"
|
|
62
62
|
},
|
|
63
63
|
"peerDependencies": {
|
|
64
64
|
"typescript": "^5"
|