@contractspec/lib.evolution 3.7.6 → 3.7.7
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/README.md +44 -32
- package/dist/analyzer/spec-analyzer.d.ts +1 -1
- package/dist/generator/ai-spec-generator.d.ts +1 -1
- package/dist/generator/spec-generator.d.ts +1 -1
- package/dist/index.d.ts +4 -4
- package/dist/index.js +827 -827
- package/dist/node/index.js +827 -827
- package/dist/types.d.ts +1 -1
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -1,53 +1,65 @@
|
|
|
1
1
|
# @contractspec/lib.evolution
|
|
2
2
|
|
|
3
|
-
Website: https://contractspec.io
|
|
3
|
+
Website: https://contractspec.io
|
|
4
4
|
|
|
5
|
+
**AI-powered contract evolution engine.**
|
|
5
6
|
|
|
6
|
-
|
|
7
|
+
## What It Provides
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
- **Layer**: lib.
|
|
10
|
+
- **Consumers**: example-shared-ui, bundles.
|
|
11
|
+
- **Key dependencies**: ai-agent, contracts-spec, lifecycle, observability, schema.
|
|
12
|
+
- Related ContractSpec packages include `@contractspec/lib.ai-agent`, `@contractspec/lib.ai-providers`, `@contractspec/lib.contracts-integrations`, `@contractspec/lib.contracts-spec`, `@contractspec/lib.lifecycle`, `@contractspec/lib.observability`, ...
|
|
9
13
|
|
|
10
|
-
##
|
|
11
|
-
|
|
12
|
-
- Analyze telemetry to find anomalous specs
|
|
13
|
-
- Convert detected intent into spec suggestions
|
|
14
|
-
- Route suggestions through the AI approval workflow
|
|
15
|
-
- Persist approved specs back into the codebase
|
|
16
|
-
|
|
17
|
-
> Phase 3 anchor library – pairs with `@contractspec/lib.observability` and `@contractspec/lib.growth`.
|
|
18
|
-
|
|
19
|
-
## Usage
|
|
20
|
-
|
|
21
|
-
```ts
|
|
22
|
-
import {
|
|
23
|
-
SpecAnalyzer,
|
|
24
|
-
SpecGenerator,
|
|
25
|
-
SpecSuggestionOrchestrator,
|
|
26
|
-
} from '@contractspec/lib.evolution';
|
|
27
|
-
|
|
28
|
-
const analyzer = new SpecAnalyzer();
|
|
29
|
-
const stats = analyzer.analyzeSpecUsage(samples);
|
|
30
|
-
const anomalies = analyzer.detectAnomalies(stats);
|
|
31
|
-
|
|
32
|
-
const generator = new SpecGenerator({ getSpec });
|
|
33
|
-
const suggestion = generator.generateFromIntent(anomalies[0]);
|
|
34
|
-
|
|
35
|
-
await orchestrator.submit(suggestion, { agent: 'auto-evolve' });
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
See `app/docs/libraries/evolution` in `@contractspec/app.web-contractspec-landing` for full docs.
|
|
14
|
+
## Installation
|
|
39
15
|
|
|
16
|
+
`npm install @contractspec/lib.evolution`
|
|
40
17
|
|
|
18
|
+
or
|
|
41
19
|
|
|
20
|
+
`bun add @contractspec/lib.evolution`
|
|
42
21
|
|
|
22
|
+
## Usage
|
|
43
23
|
|
|
24
|
+
Import the root entrypoint from `@contractspec/lib.evolution`, or choose a documented subpath when you only need one part of the package surface.
|
|
44
25
|
|
|
26
|
+
## Architecture
|
|
45
27
|
|
|
28
|
+
- `src/analyzer` is part of the package's public or composition surface.
|
|
29
|
+
- `src/approval` is part of the package's public or composition surface.
|
|
30
|
+
- `src/generator` is part of the package's public or composition surface.
|
|
31
|
+
- `src/index.ts` is the root public barrel and package entrypoint.
|
|
32
|
+
- `src/types.ts` is shared public type definitions.
|
|
46
33
|
|
|
34
|
+
## Public Entry Points
|
|
47
35
|
|
|
36
|
+
- Export `.` resolves through `./src/index.ts`.
|
|
48
37
|
|
|
38
|
+
## Local Commands
|
|
49
39
|
|
|
40
|
+
- `bun run dev` — contractspec-bun-build dev
|
|
41
|
+
- `bun run build` — bun run prebuild && bun run build:bundle && bun run build:types
|
|
42
|
+
- `bun run test` — bun test --pass-with-no-tests
|
|
43
|
+
- `bun run lint` — bun lint:fix
|
|
44
|
+
- `bun run lint:check` — biome check .
|
|
45
|
+
- `bun run lint:fix` — biome check --write --unsafe --only=nursery/useSortedClasses . && biome check --write .
|
|
46
|
+
- `bun run typecheck` — tsc --noEmit
|
|
47
|
+
- `bun run publish:pkg` — bun publish --tolerate-republish --ignore-scripts --verbose
|
|
48
|
+
- `bun run publish:pkg:canary` — bun publish:pkg --tag canary
|
|
49
|
+
- `bun run clean` — rimraf dist .turbo
|
|
50
|
+
- `bun run build:bundle` — contractspec-bun-build transpile
|
|
51
|
+
- `bun run build:types` — contractspec-bun-build types
|
|
52
|
+
- `bun run prebuild` — contractspec-bun-build prebuild
|
|
50
53
|
|
|
54
|
+
## Recent Updates
|
|
51
55
|
|
|
56
|
+
- Replace eslint+prettier by biomejs to optimize speed.
|
|
57
|
+
- Add changesets and apply pending fixes.
|
|
58
|
+
- Resolve lint, build, and type errors across nine packages.
|
|
59
|
+
- Add AI provider ranking system with ranking-driven model selection.
|
|
52
60
|
|
|
61
|
+
## Notes
|
|
53
62
|
|
|
63
|
+
- Evolution strategies affect contract migration paths; changes can break existing migrations.
|
|
64
|
+
- Depends on multiple core libs — verify compatibility when updating any dependency.
|
|
65
|
+
- Strategy selection logic must remain deterministic and auditable.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { Logger } from '@contractspec/lib.observability';
|
|
2
1
|
import { LifecycleStage } from '@contractspec/lib.lifecycle';
|
|
2
|
+
import { Logger } from '@contractspec/lib.observability';
|
|
3
3
|
import { type IntentPattern, type OperationMetricSample, type OptimizationHint, type SpecAnomaly, type SpecUsageStats } from '../types';
|
|
4
4
|
export interface SpecAnalyzerOptions {
|
|
5
5
|
logger?: Logger;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
+
import type { ModelSelectionContext, ModelSelector } from '@contractspec/lib.ai-providers/selector-types';
|
|
1
2
|
import type { LanguageModel } from 'ai';
|
|
2
|
-
import type { ModelSelector, ModelSelectionContext } from '@contractspec/lib.ai-providers/selector-types';
|
|
3
3
|
import type { EvolutionConfig, IntentPattern, SpecSuggestion } from '../types';
|
|
4
4
|
/**
|
|
5
5
|
* Configuration for the AI-powered spec generator.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { AnyOperationSpec, OperationSpec, ResourceRefDescriptor } from '@contractspec/lib.contracts-spec';
|
|
2
|
-
import type { AnySchemaModel } from '@contractspec/lib.schema';
|
|
3
2
|
import { Logger } from '@contractspec/lib.observability';
|
|
3
|
+
import type { AnySchemaModel } from '@contractspec/lib.schema';
|
|
4
4
|
import { type EvolutionConfig, type IntentPattern, type OperationCoordinate, type SpecSuggestion, type SpecSuggestionProposal, type SuggestionStatus } from '../types';
|
|
5
5
|
export interface SpecGeneratorOptions {
|
|
6
6
|
config?: EvolutionConfig;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export * from './types';
|
|
2
|
-
export * from './analyzer/spec-analyzer';
|
|
3
1
|
export * from './analyzer/posthog-telemetry-reader';
|
|
4
|
-
export * from './
|
|
5
|
-
export * from './generator/ai-spec-generator';
|
|
2
|
+
export * from './analyzer/spec-analyzer';
|
|
6
3
|
export * from './approval/integration';
|
|
4
|
+
export * from './generator/ai-spec-generator';
|
|
5
|
+
export * from './generator/spec-generator';
|
|
6
|
+
export * from './types';
|