@plures/praxis 1.3.0 → 1.4.0
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/node/chunk-2IUFZBH3.js +87 -0
- package/dist/node/{chunk-WZ6B3LZ6.js → chunk-7CSWBDFL.js} +3 -56
- package/dist/node/{chunk-5JQJZADT.js → chunk-7M3HV4XR.js} +3 -3
- package/dist/node/{chunk-PTH6MD6P.js → chunk-FWOXU4MM.js} +1 -1
- package/dist/node/chunk-PGVSB6NR.js +59 -0
- package/dist/node/cli/index.cjs +1078 -211
- package/dist/node/cli/index.js +21 -2
- package/dist/node/index.cjs +1111 -0
- package/dist/node/index.d.cts +499 -1
- package/dist/node/index.d.ts +499 -1
- package/dist/node/index.js +1092 -78
- package/dist/node/integrations/svelte.js +2 -2
- package/dist/node/{reverse-W7THPV45.js → reverse-YD3CWIGM.js} +3 -2
- package/dist/node/rules-4DAJ4Z4N.js +7 -0
- package/dist/node/server-SYZPDULV.js +361 -0
- package/dist/node/{validate-EN3M4FUR.js → validate-TQGVIG7G.js} +4 -3
- package/package.json +28 -2
- package/src/__tests__/expectations.test.ts +364 -0
- package/src/__tests__/factory.test.ts +426 -0
- package/src/__tests__/mcp-server.test.ts +310 -0
- package/src/__tests__/project.test.ts +396 -0
- package/src/cli/index.ts +28 -0
- package/src/expectations/expectations.ts +471 -0
- package/src/expectations/index.ts +29 -0
- package/src/expectations/types.ts +95 -0
- package/src/factory/factory.ts +634 -0
- package/src/factory/index.ts +27 -0
- package/src/factory/types.ts +64 -0
- package/src/index.ts +57 -0
- package/src/mcp/index.ts +33 -0
- package/src/mcp/server.ts +485 -0
- package/src/mcp/types.ts +161 -0
- package/src/project/index.ts +31 -0
- package/src/project/project.ts +423 -0
- package/src/project/types.ts +87 -0
- /package/dist/node/{chunk-R2PSBPKQ.js → chunk-TEMFJOIH.js} +0 -0
package/dist/node/index.d.ts
CHANGED
|
@@ -3619,4 +3619,502 @@ declare function auditCompleteness(manifest: {
|
|
|
3619
3619
|
*/
|
|
3620
3620
|
declare function formatReport(report: CompletenessReport): string;
|
|
3621
3621
|
|
|
3622
|
-
|
|
3622
|
+
/**
|
|
3623
|
+
* Expectations DSL — Types
|
|
3624
|
+
*
|
|
3625
|
+
* Types for declaring behavioral expectations about rules.
|
|
3626
|
+
* Expectations replace traditional tests with behavioral declarations.
|
|
3627
|
+
*/
|
|
3628
|
+
/** A condition under which a behavior should or should not occur. */
|
|
3629
|
+
interface ExpectationCondition {
|
|
3630
|
+
/** Human-readable condition description */
|
|
3631
|
+
description: string;
|
|
3632
|
+
/** Type of expectation */
|
|
3633
|
+
type: 'onlyWhen' | 'never' | 'always';
|
|
3634
|
+
}
|
|
3635
|
+
/** Verification status for a single expectation condition. */
|
|
3636
|
+
type ConditionStatus = 'satisfied' | 'violated' | 'unverifiable';
|
|
3637
|
+
/** Detailed result for a single condition check. */
|
|
3638
|
+
interface ConditionResult {
|
|
3639
|
+
condition: ExpectationCondition;
|
|
3640
|
+
status: ConditionStatus;
|
|
3641
|
+
/** Explanation of how the condition was verified or why it couldn't be */
|
|
3642
|
+
explanation: string;
|
|
3643
|
+
/** Related rule IDs that informed this check */
|
|
3644
|
+
relatedRules: string[];
|
|
3645
|
+
}
|
|
3646
|
+
/** Verification result for a single Expectation. */
|
|
3647
|
+
interface ExpectationResult {
|
|
3648
|
+
/** The expectation name/ID */
|
|
3649
|
+
name: string;
|
|
3650
|
+
/** Overall status: satisfied if ALL conditions pass */
|
|
3651
|
+
status: 'satisfied' | 'violated' | 'partial';
|
|
3652
|
+
/** Per-condition results */
|
|
3653
|
+
conditions: ConditionResult[];
|
|
3654
|
+
/** Edge cases discovered */
|
|
3655
|
+
edgeCases: string[];
|
|
3656
|
+
/** Suggested mitigations for violated/partial expectations */
|
|
3657
|
+
mitigations: string[];
|
|
3658
|
+
}
|
|
3659
|
+
/** Full verification report for an ExpectationSet. */
|
|
3660
|
+
interface VerificationReport {
|
|
3661
|
+
/** Set name */
|
|
3662
|
+
setName: string;
|
|
3663
|
+
/** Timestamp of verification */
|
|
3664
|
+
timestamp: string;
|
|
3665
|
+
/** Overall status: satisfied if ALL expectations are satisfied */
|
|
3666
|
+
status: 'satisfied' | 'violated' | 'partial';
|
|
3667
|
+
/** Per-expectation results */
|
|
3668
|
+
expectations: ExpectationResult[];
|
|
3669
|
+
/** Summary stats */
|
|
3670
|
+
summary: {
|
|
3671
|
+
total: number;
|
|
3672
|
+
satisfied: number;
|
|
3673
|
+
violated: number;
|
|
3674
|
+
partial: number;
|
|
3675
|
+
};
|
|
3676
|
+
/** All edge cases found across all expectations */
|
|
3677
|
+
allEdgeCases: string[];
|
|
3678
|
+
/** All mitigations suggested */
|
|
3679
|
+
allMitigations: string[];
|
|
3680
|
+
}
|
|
3681
|
+
/** Options for creating an ExpectationSet */
|
|
3682
|
+
interface ExpectationSetOptions {
|
|
3683
|
+
/** Name/domain for this set of expectations */
|
|
3684
|
+
name: string;
|
|
3685
|
+
/** Optional description */
|
|
3686
|
+
description?: string;
|
|
3687
|
+
}
|
|
3688
|
+
/** Interface describing a rule or constraint for verification */
|
|
3689
|
+
interface VerifiableDescriptor {
|
|
3690
|
+
id: string;
|
|
3691
|
+
description: string;
|
|
3692
|
+
eventTypes?: string | string[];
|
|
3693
|
+
contract?: {
|
|
3694
|
+
behavior: string;
|
|
3695
|
+
examples: Array<{
|
|
3696
|
+
given: string;
|
|
3697
|
+
when: string;
|
|
3698
|
+
then: string;
|
|
3699
|
+
}>;
|
|
3700
|
+
invariants: string[];
|
|
3701
|
+
ruleId: string;
|
|
3702
|
+
};
|
|
3703
|
+
}
|
|
3704
|
+
/** Registry-like interface for verification */
|
|
3705
|
+
interface VerifiableRegistry {
|
|
3706
|
+
getAllRules(): VerifiableDescriptor[];
|
|
3707
|
+
getAllConstraints(): VerifiableDescriptor[];
|
|
3708
|
+
getRuleIds(): string[];
|
|
3709
|
+
getConstraintIds(): string[];
|
|
3710
|
+
}
|
|
3711
|
+
|
|
3712
|
+
/**
|
|
3713
|
+
* Expectations DSL — Core
|
|
3714
|
+
*
|
|
3715
|
+
* Behavioral declarations for Praxis rules. Instead of writing test
|
|
3716
|
+
* assertions, you declare what behaviors you expect from your system.
|
|
3717
|
+
*
|
|
3718
|
+
* @example
|
|
3719
|
+
* ```ts
|
|
3720
|
+
* import { expectBehavior, ExpectationSet, verify } from '@plures/praxis/expectations';
|
|
3721
|
+
*
|
|
3722
|
+
* const expectations = new ExpectationSet({ name: 'settings' });
|
|
3723
|
+
*
|
|
3724
|
+
* expectations.add(
|
|
3725
|
+
* expectBehavior('settings-saved-toast')
|
|
3726
|
+
* .onlyWhen('settings.diff is non-empty')
|
|
3727
|
+
* .never('when settings panel opens without changes')
|
|
3728
|
+
* .never('when save fails')
|
|
3729
|
+
* .always('includes which settings changed')
|
|
3730
|
+
* );
|
|
3731
|
+
*
|
|
3732
|
+
* const report = verify(registry, expectations);
|
|
3733
|
+
* ```
|
|
3734
|
+
*/
|
|
3735
|
+
|
|
3736
|
+
/**
|
|
3737
|
+
* A behavioral expectation declaration.
|
|
3738
|
+
*
|
|
3739
|
+
* Chainable API for declaring conditions under which a behavior
|
|
3740
|
+
* should or should not occur.
|
|
3741
|
+
*/
|
|
3742
|
+
declare class Expectation {
|
|
3743
|
+
readonly name: string;
|
|
3744
|
+
private _conditions;
|
|
3745
|
+
constructor(name: string);
|
|
3746
|
+
/**
|
|
3747
|
+
* Declare that this behavior should ONLY occur when a condition is true.
|
|
3748
|
+
* If the condition is false, the behavior should NOT occur.
|
|
3749
|
+
*/
|
|
3750
|
+
onlyWhen(condition: string): this;
|
|
3751
|
+
/**
|
|
3752
|
+
* Declare that this behavior should NEVER occur under a given condition.
|
|
3753
|
+
*/
|
|
3754
|
+
never(condition: string): this;
|
|
3755
|
+
/**
|
|
3756
|
+
* Declare that this behavior should ALWAYS have a certain property.
|
|
3757
|
+
*/
|
|
3758
|
+
always(condition: string): this;
|
|
3759
|
+
/** Get all declared conditions. */
|
|
3760
|
+
get conditions(): ReadonlyArray<ExpectationCondition>;
|
|
3761
|
+
}
|
|
3762
|
+
/**
|
|
3763
|
+
* A collection of expectations for a specific domain.
|
|
3764
|
+
*/
|
|
3765
|
+
declare class ExpectationSet {
|
|
3766
|
+
readonly name: string;
|
|
3767
|
+
readonly description: string;
|
|
3768
|
+
private _expectations;
|
|
3769
|
+
constructor(options: ExpectationSetOptions);
|
|
3770
|
+
/** Add an expectation to the set. */
|
|
3771
|
+
add(expectation: Expectation): this;
|
|
3772
|
+
/** Get all expectations in this set. */
|
|
3773
|
+
get expectations(): ReadonlyArray<Expectation>;
|
|
3774
|
+
/** Number of expectations. */
|
|
3775
|
+
get size(): number;
|
|
3776
|
+
}
|
|
3777
|
+
/**
|
|
3778
|
+
* Create a new behavioral expectation.
|
|
3779
|
+
*
|
|
3780
|
+
* @example
|
|
3781
|
+
* ```ts
|
|
3782
|
+
* expectBehavior('settings-saved-toast')
|
|
3783
|
+
* .onlyWhen('settings.diff is non-empty')
|
|
3784
|
+
* .never('when save fails')
|
|
3785
|
+
* .always('includes which settings changed');
|
|
3786
|
+
* ```
|
|
3787
|
+
*/
|
|
3788
|
+
declare function expectBehavior(name: string): Expectation;
|
|
3789
|
+
/**
|
|
3790
|
+
* Verify expectations against a rule registry.
|
|
3791
|
+
*
|
|
3792
|
+
* Walks the rule graph to determine if expectations are satisfied,
|
|
3793
|
+
* violated, or unverifiable given the registered rules and contracts.
|
|
3794
|
+
*/
|
|
3795
|
+
declare function verify(registry: VerifiableRegistry, expectations: ExpectationSet): VerificationReport;
|
|
3796
|
+
/**
|
|
3797
|
+
* Format a verification report as human-readable text.
|
|
3798
|
+
*/
|
|
3799
|
+
declare function formatVerificationReport(report: VerificationReport): string;
|
|
3800
|
+
|
|
3801
|
+
/**
|
|
3802
|
+
* Praxis Rules Factory — Types
|
|
3803
|
+
*
|
|
3804
|
+
* Configuration types for predefined rule module factories.
|
|
3805
|
+
*/
|
|
3806
|
+
type SanitizationType = 'sql-injection' | 'xss' | 'path-traversal' | 'command-injection';
|
|
3807
|
+
interface InputRulesConfig {
|
|
3808
|
+
/** Sanitization checks to apply */
|
|
3809
|
+
sanitize?: SanitizationType[];
|
|
3810
|
+
/** Maximum input length (0 = unlimited) */
|
|
3811
|
+
maxLength?: number;
|
|
3812
|
+
/** Whether the input is required (non-empty) */
|
|
3813
|
+
required?: boolean;
|
|
3814
|
+
/** Custom field name for facts/events (default: 'input') */
|
|
3815
|
+
fieldName?: string;
|
|
3816
|
+
}
|
|
3817
|
+
interface ToastRulesConfig {
|
|
3818
|
+
/** Only show toast if there's a meaningful diff */
|
|
3819
|
+
requireDiff?: boolean;
|
|
3820
|
+
/** Auto-dismiss after N milliseconds (0 = no auto-dismiss) */
|
|
3821
|
+
autoDismissMs?: number;
|
|
3822
|
+
/** Prevent duplicate toasts with same message */
|
|
3823
|
+
deduplicate?: boolean;
|
|
3824
|
+
}
|
|
3825
|
+
interface FormRulesConfig {
|
|
3826
|
+
/** Validate fields on blur */
|
|
3827
|
+
validateOnBlur?: boolean;
|
|
3828
|
+
/** Gate form submission on validation passing */
|
|
3829
|
+
submitGate?: boolean;
|
|
3830
|
+
/** Custom form name for namespacing facts */
|
|
3831
|
+
formName?: string;
|
|
3832
|
+
}
|
|
3833
|
+
interface NavigationRulesConfig {
|
|
3834
|
+
/** Warn/block navigation when form has unsaved changes */
|
|
3835
|
+
dirtyGuard?: boolean;
|
|
3836
|
+
/** Require authentication for navigation */
|
|
3837
|
+
authRequired?: boolean;
|
|
3838
|
+
}
|
|
3839
|
+
interface DataRulesConfig {
|
|
3840
|
+
/** Enable optimistic UI updates */
|
|
3841
|
+
optimisticUpdate?: boolean;
|
|
3842
|
+
/** Rollback optimistic updates on error */
|
|
3843
|
+
rollbackOnError?: boolean;
|
|
3844
|
+
/** Invalidate relevant caches on data change */
|
|
3845
|
+
cacheInvalidation?: boolean;
|
|
3846
|
+
/** Custom entity name for facts */
|
|
3847
|
+
entityName?: string;
|
|
3848
|
+
}
|
|
3849
|
+
|
|
3850
|
+
/**
|
|
3851
|
+
* Praxis Rules Factory
|
|
3852
|
+
*
|
|
3853
|
+
* Predefined rule modules for common application patterns.
|
|
3854
|
+
* Each factory returns a PraxisModule with rules, constraints, and contracts.
|
|
3855
|
+
*
|
|
3856
|
+
* @example
|
|
3857
|
+
* ```ts
|
|
3858
|
+
* import { inputRules, toastRules, formRules } from '@plures/praxis/factory';
|
|
3859
|
+
*
|
|
3860
|
+
* const registry = new PraxisRegistry();
|
|
3861
|
+
* registry.registerModule(inputRules({ sanitize: ['xss', 'sql-injection'], required: true }));
|
|
3862
|
+
* registry.registerModule(toastRules({ requireDiff: true, deduplicate: true }));
|
|
3863
|
+
* registry.registerModule(formRules({ validateOnBlur: true, submitGate: true }));
|
|
3864
|
+
* ```
|
|
3865
|
+
*/
|
|
3866
|
+
|
|
3867
|
+
/** Context type for input rules. */
|
|
3868
|
+
interface InputContext {
|
|
3869
|
+
input?: {
|
|
3870
|
+
value?: string;
|
|
3871
|
+
field?: string;
|
|
3872
|
+
};
|
|
3873
|
+
}
|
|
3874
|
+
/**
|
|
3875
|
+
* Create input validation rules module.
|
|
3876
|
+
*
|
|
3877
|
+
* Generates rules for sanitizing user input, enforcing length limits,
|
|
3878
|
+
* and requiring non-empty values.
|
|
3879
|
+
*/
|
|
3880
|
+
declare function inputRules(config?: InputRulesConfig): PraxisModule<InputContext>;
|
|
3881
|
+
/** Context type for toast rules. */
|
|
3882
|
+
interface ToastContext {
|
|
3883
|
+
diff?: Record<string, unknown> | null;
|
|
3884
|
+
toasts?: Array<{
|
|
3885
|
+
message: string;
|
|
3886
|
+
id: string;
|
|
3887
|
+
}>;
|
|
3888
|
+
}
|
|
3889
|
+
/**
|
|
3890
|
+
* Create truthful toast notification rules.
|
|
3891
|
+
*
|
|
3892
|
+
* Generates rules that ensure toasts only appear with meaningful content,
|
|
3893
|
+
* auto-dismiss after a timeout, and avoid duplicates.
|
|
3894
|
+
*/
|
|
3895
|
+
declare function toastRules(config?: ToastRulesConfig): PraxisModule<ToastContext>;
|
|
3896
|
+
/** Context type for form rules. */
|
|
3897
|
+
interface FormContext {
|
|
3898
|
+
form?: {
|
|
3899
|
+
fields?: Record<string, {
|
|
3900
|
+
value: unknown;
|
|
3901
|
+
error?: string;
|
|
3902
|
+
touched?: boolean;
|
|
3903
|
+
}>;
|
|
3904
|
+
valid?: boolean;
|
|
3905
|
+
dirty?: boolean;
|
|
3906
|
+
submitting?: boolean;
|
|
3907
|
+
};
|
|
3908
|
+
}
|
|
3909
|
+
/**
|
|
3910
|
+
* Create form lifecycle rules.
|
|
3911
|
+
*
|
|
3912
|
+
* Generates rules for field validation on blur, submit gating,
|
|
3913
|
+
* and form state management.
|
|
3914
|
+
*/
|
|
3915
|
+
declare function formRules(config?: FormRulesConfig): PraxisModule<FormContext>;
|
|
3916
|
+
/** Context type for navigation rules. */
|
|
3917
|
+
interface NavigationContext {
|
|
3918
|
+
dirty?: boolean;
|
|
3919
|
+
authenticated?: boolean;
|
|
3920
|
+
route?: string;
|
|
3921
|
+
}
|
|
3922
|
+
/**
|
|
3923
|
+
* Create route protection rules.
|
|
3924
|
+
*
|
|
3925
|
+
* Generates rules for dirty-data navigation guards and
|
|
3926
|
+
* authentication-required route protection.
|
|
3927
|
+
*/
|
|
3928
|
+
declare function navigationRules(config?: NavigationRulesConfig): PraxisModule<NavigationContext>;
|
|
3929
|
+
/** Context type for data rules. */
|
|
3930
|
+
interface DataContext {
|
|
3931
|
+
pending?: Record<string, {
|
|
3932
|
+
original: unknown;
|
|
3933
|
+
optimistic: unknown;
|
|
3934
|
+
}>;
|
|
3935
|
+
cache?: Record<string, {
|
|
3936
|
+
data: unknown;
|
|
3937
|
+
timestamp: number;
|
|
3938
|
+
}>;
|
|
3939
|
+
}
|
|
3940
|
+
/**
|
|
3941
|
+
* Create data lifecycle rules.
|
|
3942
|
+
*
|
|
3943
|
+
* Generates rules for optimistic updates, error rollback, and cache invalidation.
|
|
3944
|
+
*/
|
|
3945
|
+
declare function dataRules(config?: DataRulesConfig): PraxisModule<DataContext>;
|
|
3946
|
+
|
|
3947
|
+
/**
|
|
3948
|
+
* Praxis Project Logic — Types
|
|
3949
|
+
*
|
|
3950
|
+
* Types for developer workflow rules: gates, semver contracts,
|
|
3951
|
+
* commit generation, and branch management.
|
|
3952
|
+
*/
|
|
3953
|
+
type GateStatus = 'open' | 'closed' | 'blocked';
|
|
3954
|
+
interface GateConfig {
|
|
3955
|
+
/** Expectations that must be satisfied for the gate to open */
|
|
3956
|
+
expects: string[];
|
|
3957
|
+
/** Action when gate is satisfied */
|
|
3958
|
+
onSatisfied?: string;
|
|
3959
|
+
/** Action when gate is violated */
|
|
3960
|
+
onViolation?: string;
|
|
3961
|
+
}
|
|
3962
|
+
interface GateState {
|
|
3963
|
+
name: string;
|
|
3964
|
+
status: GateStatus;
|
|
3965
|
+
/** Which expectations are satisfied */
|
|
3966
|
+
satisfied: string[];
|
|
3967
|
+
/** Which expectations are not satisfied */
|
|
3968
|
+
unsatisfied: string[];
|
|
3969
|
+
/** Timestamp of last status change */
|
|
3970
|
+
lastChanged: number;
|
|
3971
|
+
}
|
|
3972
|
+
interface SemverContractConfig {
|
|
3973
|
+
/** Files/sources that contain version strings */
|
|
3974
|
+
sources: string[];
|
|
3975
|
+
/** Invariants about version consistency */
|
|
3976
|
+
invariants: string[];
|
|
3977
|
+
}
|
|
3978
|
+
interface SemverReport {
|
|
3979
|
+
/** Whether all sources have consistent versions */
|
|
3980
|
+
consistent: boolean;
|
|
3981
|
+
/** Version found in each source */
|
|
3982
|
+
versions: Record<string, string>;
|
|
3983
|
+
/** Invariant violations */
|
|
3984
|
+
violations: string[];
|
|
3985
|
+
}
|
|
3986
|
+
interface PraxisDiff {
|
|
3987
|
+
/** Rules added since last commit */
|
|
3988
|
+
rulesAdded: string[];
|
|
3989
|
+
/** Rules removed */
|
|
3990
|
+
rulesRemoved: string[];
|
|
3991
|
+
/** Rules modified */
|
|
3992
|
+
rulesModified: string[];
|
|
3993
|
+
/** Contracts added */
|
|
3994
|
+
contractsAdded: string[];
|
|
3995
|
+
/** Contracts removed */
|
|
3996
|
+
contractsRemoved: string[];
|
|
3997
|
+
/** Expectations added */
|
|
3998
|
+
expectationsAdded: string[];
|
|
3999
|
+
/** Expectations removed */
|
|
4000
|
+
expectationsRemoved: string[];
|
|
4001
|
+
/** Gate state changes */
|
|
4002
|
+
gateChanges: Array<{
|
|
4003
|
+
gate: string;
|
|
4004
|
+
from: GateStatus;
|
|
4005
|
+
to: GateStatus;
|
|
4006
|
+
}>;
|
|
4007
|
+
}
|
|
4008
|
+
interface BranchRulesConfig {
|
|
4009
|
+
/** Naming convention pattern (e.g., 'feat/{name}', 'fix/{issue}') */
|
|
4010
|
+
naming: string;
|
|
4011
|
+
/** Conditions required for merge */
|
|
4012
|
+
mergeConditions: string[];
|
|
4013
|
+
}
|
|
4014
|
+
interface PredefinedGateConfig {
|
|
4015
|
+
/** Whether to enable this gate */
|
|
4016
|
+
enabled?: boolean;
|
|
4017
|
+
/** Custom expectations to add */
|
|
4018
|
+
additionalExpects?: string[];
|
|
4019
|
+
}
|
|
4020
|
+
|
|
4021
|
+
/**
|
|
4022
|
+
* Praxis Project Logic
|
|
4023
|
+
*
|
|
4024
|
+
* Developer workflow rules: gates, semver contracts, commit message
|
|
4025
|
+
* generation from behavioral deltas, and branch management.
|
|
4026
|
+
*
|
|
4027
|
+
* @example
|
|
4028
|
+
* ```ts
|
|
4029
|
+
* import { defineGate, semverContract, commitFromState } from '@plures/praxis/project';
|
|
4030
|
+
*
|
|
4031
|
+
* const testGate = defineGate('test', {
|
|
4032
|
+
* expects: ['all-tests-pass', 'no-type-errors'],
|
|
4033
|
+
* onSatisfied: 'merge-allowed',
|
|
4034
|
+
* onViolation: 'merge-blocked',
|
|
4035
|
+
* });
|
|
4036
|
+
*
|
|
4037
|
+
* const diff = { rulesAdded: ['auth/login'], ... };
|
|
4038
|
+
* const message = commitFromState(diff);
|
|
4039
|
+
* // → "feat(rules): add auth/login rule"
|
|
4040
|
+
* ```
|
|
4041
|
+
*/
|
|
4042
|
+
|
|
4043
|
+
/**
|
|
4044
|
+
* Context type for gates. Apps extend their context with gate state.
|
|
4045
|
+
*/
|
|
4046
|
+
interface GateContext {
|
|
4047
|
+
gates?: Record<string, GateState>;
|
|
4048
|
+
expectations?: Record<string, boolean>;
|
|
4049
|
+
}
|
|
4050
|
+
/**
|
|
4051
|
+
* Define a feature gate — a condition that must be satisfied before
|
|
4052
|
+
* proceeding with a workflow step (deploy, merge, release, etc.).
|
|
4053
|
+
*
|
|
4054
|
+
* @example
|
|
4055
|
+
* ```ts
|
|
4056
|
+
* const testGate = defineGate('test', {
|
|
4057
|
+
* expects: ['all-tests-pass', 'no-type-errors'],
|
|
4058
|
+
* onSatisfied: 'deploy-allowed',
|
|
4059
|
+
* onViolation: 'deploy-blocked',
|
|
4060
|
+
* });
|
|
4061
|
+
* registry.registerModule(testGate);
|
|
4062
|
+
* ```
|
|
4063
|
+
*/
|
|
4064
|
+
declare function defineGate(name: string, config: GateConfig): PraxisModule<GateContext>;
|
|
4065
|
+
/**
|
|
4066
|
+
* Create a semver contract module that checks version consistency
|
|
4067
|
+
* across multiple sources (package.json, Cargo.toml, etc.).
|
|
4068
|
+
*
|
|
4069
|
+
* @example
|
|
4070
|
+
* ```ts
|
|
4071
|
+
* const version = semverContract({
|
|
4072
|
+
* sources: ['package.json', 'src/version.ts', 'README.md'],
|
|
4073
|
+
* invariants: ['All sources must have the same version'],
|
|
4074
|
+
* });
|
|
4075
|
+
* ```
|
|
4076
|
+
*/
|
|
4077
|
+
declare function semverContract(config: SemverContractConfig): PraxisModule;
|
|
4078
|
+
/**
|
|
4079
|
+
* Generate a conventional commit message from a behavioral delta.
|
|
4080
|
+
*
|
|
4081
|
+
* Unlike file-based commit messages, this describes WHAT behavioral
|
|
4082
|
+
* changes occurred — rule additions, contract changes, expectation shifts.
|
|
4083
|
+
*
|
|
4084
|
+
* @example
|
|
4085
|
+
* ```ts
|
|
4086
|
+
* const msg = commitFromState({
|
|
4087
|
+
* rulesAdded: ['auth/login', 'auth/logout'],
|
|
4088
|
+
* contractsAdded: ['auth/login'],
|
|
4089
|
+
* ...empty
|
|
4090
|
+
* });
|
|
4091
|
+
* // → "feat(rules): add auth/login, auth/logout\n\nContracts added: auth/login"
|
|
4092
|
+
* ```
|
|
4093
|
+
*/
|
|
4094
|
+
declare function commitFromState(diff: PraxisDiff): string;
|
|
4095
|
+
/**
|
|
4096
|
+
* Create branch management rules.
|
|
4097
|
+
*
|
|
4098
|
+
* @example
|
|
4099
|
+
* ```ts
|
|
4100
|
+
* const branches = branchRules({
|
|
4101
|
+
* naming: 'feat/{name}',
|
|
4102
|
+
* mergeConditions: ['tests-pass', 'review-approved'],
|
|
4103
|
+
* });
|
|
4104
|
+
* ```
|
|
4105
|
+
*/
|
|
4106
|
+
declare function branchRules(config: BranchRulesConfig): PraxisModule;
|
|
4107
|
+
/**
|
|
4108
|
+
* Create a lint gate — blocks workflow until linting passes.
|
|
4109
|
+
*/
|
|
4110
|
+
declare function lintGate(config?: PredefinedGateConfig): PraxisModule<GateContext>;
|
|
4111
|
+
/**
|
|
4112
|
+
* Create a format gate — blocks workflow until formatting is correct.
|
|
4113
|
+
*/
|
|
4114
|
+
declare function formatGate(config?: PredefinedGateConfig): PraxisModule<GateContext>;
|
|
4115
|
+
/**
|
|
4116
|
+
* Create an expectation gate — blocks workflow until expectations are verified.
|
|
4117
|
+
*/
|
|
4118
|
+
declare function expectationGate(config?: PredefinedGateConfig): PraxisModule<GateContext>;
|
|
4119
|
+
|
|
4120
|
+
export { AcknowledgeContractGap, type ActivityState, type Actor, ActorManager, Assumption, BehaviorLedger, type BranchRulesConfig, CHRONICLE_PATHS, type CanvasDocument, type CanvasEdge, type CanvasEdgeStyle, type CanvasEditorConfig, type CanvasNode, type CanvasNodeStyle, type Chronicle, ChronicleContext, type ChronicleEdge, type ChronicleEvent, type ChronicleNode, type ChronicleSpan, type ChronosMcpTools, type ChronosSearchParams, type ChronosTraceParams, type CompletenessConfig, type CompletenessReport, ComponentDefinition, type ConditionResult, type ConditionStatus, ConstraintDescriptor, ConstraintFn, type ConstraintNode, type ConstraintSchema, Contract, ContractAdded, ContractGapAcknowledged, ContractMissing, ContractUpdated, ContractValidated, type DataRulesConfig, type DefineConstraintOptions, type DefineModuleOptions, type DefineRuleOptions, type EdgeType, type EventDefinition, type EventStreamEntry, Expectation, type ExpectationCondition, type ExpectationResult, ExpectationSet, type ExpectationSetOptions, type FactDefinition, type FormRulesConfig, ReactiveLogicEngine as FrameworkAgnosticReactiveEngine, type ReactiveEngineOptions as FrameworkAgnosticReactiveEngineOptions, type GateConfig, type GateState, type GateStatus, type GeneratedDoc, type GeneratedPluresDBFile, type GraphEdge, type GuardianError, type GuardianResult, type GuardianWarning, type InputRulesConfig, type LedgerEntry, type LedgerEntryStatus, type LifecycleState, type LoaderOptions, type LoaderResult, type LogicBranch, LogicDefinition, LogicEngine, type McpToolResult, MissingArtifact, ModelDefinition, type NavigationRulesConfig, PRAXIS_PATHS, type PluresDBAdapter, type PluresDBAdapterOptions, PluresDBGenerator, type PluresDBGeneratorOptions, PluresDbChronicle, PraxisDB, PraxisDBStore, type PraxisDBStoreOptions, type PraxisDiff, PraxisEvent, PraxisFact, PraxisModule, PraxisRegistry, PraxisSchema, PraxisSchemaRegistry, PraxisState, type PredefinedGateConfig, type RegistryGraph, RegistryIntrospector, type RegistrySchema, type RegistryStats, RuleDescriptor, RuleFn, type RuleNode, type RuleSchema, type SanitizationType, type SemverContractConfig, type SemverReport, Severity, type StateChangeCallback, type StateDoc, type StateDocsConfig, StateDocsGenerator, type StateField, type StateMachineDoc, type StateTransition, type StoredSchema, type TauriAppConfig, type TauriBridge, type TauriCommand, type TauriEvent, type TauriFS, type TauriFileEntry, type TauriMenuItem, type TauriNotification, type TauriNotificationOptions, type TauriPlugin, type TauriPraxisAdapter, type TauriSecurityConfig, type TauriTray, type TauriUpdateConfig, type TauriUpdateInfo, type TauriWindowConfig, type ToastRulesConfig, type TraceDirection, type TransitionDoc, type UIContext, type UnifiedApp, type UnifiedAppConfig, UnsubscribeFn$1 as UnsubscribeFn, type UnumAdapter, type UnumAdapterConfig, type UnumChannel, type UnumIdentity, type UnumMessage, type UnumStore, ValidateContracts, type ValidateOptions, ValidationReport, ValidationResult, type VerifiableDescriptor, type VerifiableRegistry, type VerificationReport, attachAllIntegrations, attachTauriToEngine, attachToEngine, attachUnumToEngine, auditCompleteness, branchRules, canvasToMermaid, canvasToSchema, canvasToYaml, commitFromState, createBehaviorLedger, createCanvasEditor, createChronicle, createChronosMcpTools, createReactiveEngine as createFrameworkAgnosticReactiveEngine, createIntrospector, createMockTauriBridge, createPluresDBAdapter, createPluresDBGenerator, createPraxisDBStore, createSchemaRegistry, createStateDocsGenerator, createTauriPraxisAdapter, createTimerActor, createUIModule, createUnifiedApp, createUnumAdapter, dataRules, defineConstraint, defineEvent, defineFact, defineGate, defineModule, defineRule, dirtyGuardRule, errorDisplayRule, expectBehavior, expectationGate, filterEvents, filterFacts, findEvent, findFact, formRules, formatGate, formatReport, formatValidationReport, formatValidationReportJSON, formatValidationReportSARIF, formatVerificationReport, generateDocs, generateId, generateTauriConfig, getEventPath, getFactPath, getSchemaPath, initGateRule, inputRules, lintGate, loadSchema, loadSchemaFromFile, loadSchemaFromJson, loadSchemaFromYaml, loadingGateRule, mustBeInitializedConstraint, navigationRequest, navigationRules, noInteractionWhileLoadingConstraint, offlineIndicatorRule, registerSchema, resizeEvent, schemaToCanvas, semverContract, toastRules, uiModule, uiStateChanged, validateContracts, validateForGeneration, validateWithGuardian, verify, viewportRule };
|