traits 0.5.3 → 0.5.5
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/Trait.ts +34 -25
- package/TraitConflict.ts +2 -2
- package/TraitDerivation.ts +30 -35
- package/dist/Trait.d.ts +33 -16
- package/dist/Trait.d.ts.map +1 -1
- package/dist/Trait.js +29 -16
- package/dist/Trait.js.map +1 -1
- package/dist/TraitConflict.d.ts +63 -38
- package/dist/TraitConflict.d.ts.map +1 -1
- package/dist/TraitConflict.js +2 -2
- package/dist/TraitDerivation.d.ts +112 -68
- package/dist/TraitDerivation.d.ts.map +1 -1
- package/dist/TraitDerivation.js +24 -28
- package/dist/TraitDerivation.js.map +1 -1
- package/dist/TraitEvaluation.d.ts +27 -16
- package/dist/TraitEvaluation.d.ts.map +1 -1
- package/dist/main.js +2 -1
- package/dist/main.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/test/Trait.test.js +61 -17
- package/dist/test/Trait.test.js.map +1 -1
- package/dist/test/TraitDerivation.test.js +75 -38
- package/dist/test/TraitDerivation.test.js.map +1 -1
- package/dist/test/TraitEvaluation.test.js +6 -3
- package/dist/test/TraitEvaluation.test.js.map +1 -1
- package/dist/test/TraitIgnores.test.js +12 -2
- package/dist/test/TraitIgnores.test.js.map +1 -1
- package/dist/test/TraitStore.test.js +19 -7
- package/dist/test/TraitStore.test.js.map +1 -1
- package/dist/test/TraitsInitialization.test.js +16 -16
- package/dist/test/TraitsInitialization.test.js.map +1 -1
- package/dist/toolkit/CheckTraits.d.ts +18 -12
- package/dist/toolkit/CheckTraits.d.ts.map +1 -1
- package/dist/toolkit/ConfigurationError.d.ts.map +1 -1
- package/dist/toolkit/ConfigurationError.js +13 -4
- package/dist/toolkit/ConfigurationError.js.map +1 -1
- package/dist/toolkit/DeriveTrait.d.ts +118 -72
- package/dist/toolkit/DeriveTrait.d.ts.map +1 -1
- package/dist/toolkit/DeriveTrait.js +5 -1
- package/dist/toolkit/DeriveTrait.js.map +1 -1
- package/dist/traitIgnores.d.ts +18 -10
- package/dist/traitIgnores.d.ts.map +1 -1
- package/main.ts +2 -1
- package/package.json +1 -1
- package/skills/traits/SKILL.md +15 -11
- package/toolkit/ConfigurationError.ts +19 -6
- package/toolkit/DeriveTrait.ts +6 -1
|
@@ -1,11 +1,20 @@
|
|
|
1
1
|
import { Cause, Effect, Layer, Schema as S } from "effect"
|
|
2
2
|
import { McpServer, Tool, Toolkit } from "effect/ai"
|
|
3
3
|
|
|
4
|
+
import { CheckTraits } from "./CheckTraits.ts"
|
|
5
|
+
import { DeriveTrait } from "./DeriveTrait.ts"
|
|
6
|
+
|
|
4
7
|
const toolkit = Toolkit.make(
|
|
5
|
-
Tool.make("
|
|
6
|
-
description:
|
|
7
|
-
|
|
8
|
-
|
|
8
|
+
Tool.make("derive_trait", {
|
|
9
|
+
description: DeriveTrait.description,
|
|
10
|
+
parameters: DeriveTrait.parametersSchema,
|
|
11
|
+
success: S.Never,
|
|
12
|
+
failure: S.String,
|
|
13
|
+
failureMode: "return"
|
|
14
|
+
}).annotate(Tool.Readonly, true),
|
|
15
|
+
Tool.make("check_traits", {
|
|
16
|
+
description: CheckTraits.description,
|
|
17
|
+
parameters: CheckTraits.parametersSchema,
|
|
9
18
|
success: S.Never,
|
|
10
19
|
failure: S.String,
|
|
11
20
|
failureMode: "return"
|
|
@@ -18,9 +27,13 @@ export const layer = (cause: Cause.Cause<unknown>) =>
|
|
|
18
27
|
: McpServer.toolkit(toolkit).pipe(
|
|
19
28
|
Layer.provide(
|
|
20
29
|
toolkit.toLayer({
|
|
21
|
-
|
|
30
|
+
derive_trait: () =>
|
|
31
|
+
Effect.fail(
|
|
32
|
+
`${Cause.pretty(cause)}\n\nSurface this configuration failure to the user. Fix the reported error, then restart the Traits MCP server and retry the same trait derivation with the identical arguments. No trait was saved; keep the proposal pending until the error is resolved. Do not paste credentials into chat.`
|
|
33
|
+
),
|
|
34
|
+
check_traits: () =>
|
|
22
35
|
Effect.fail(
|
|
23
|
-
`${Cause.pretty(cause)}\n\
|
|
36
|
+
`${Cause.pretty(cause)}\n\nSurface this configuration failure to the user. Fix the reported error, then restart the Traits MCP server and retry the same check. No trait review was performed. Do not paste credentials into chat.`
|
|
24
37
|
)
|
|
25
38
|
})
|
|
26
39
|
)
|
package/toolkit/DeriveTrait.ts
CHANGED
|
@@ -22,7 +22,8 @@ export const DeriveTrait = Tool.make("derive_trait", {
|
|
|
22
22
|
| Include a separate diff showing BAD (-) versus GOOD (+) code whenever a useful example applies. Omit it only when a code example is not meaningful. Approval covers the exact diff as well as the body.
|
|
23
23
|
| Supply a unique descriptive kebab-case name without a redundant trait- prefix for a newly created trait; it is the canonical identity, frontmatter name, and Markdown filename stem. Duplicate names are rejected.
|
|
24
24
|
| Avoid repeated requirements and duplicate traits. Keep bodies standalone; do not strip essential scope or exceptions just to shorten them.
|
|
25
|
-
|
|
|
25
|
+
| Supply mime, when, and skip inside applicability; use {} when unrestricted. The server persists this object without a separate generation call. Let mime restrict file types and when define positive semantic scope. Include skip only for an independent exception within that scope, never its negation or a repetition of another field.
|
|
26
|
+
| On clarification, supply the complete replacement applicability; omitted fields remove old restrictions. Approval and retries cover the exact metadata too.
|
|
26
27
|
| Write when values without a leading When, for example when: editing React state.
|
|
27
28
|
| Compare against all stored traits. Only a distinct proposal is saved as a new trait.
|
|
28
29
|
| Inconclusive returns relationship findings and blocks all writes; clarify ambiguity or revise the proposal before retrying.
|
|
@@ -42,6 +43,10 @@ export const DeriveTrait = Tool.make("derive_trait", {
|
|
|
42
43
|
| Then call check_traits on relevant TypeScript files, using returned trait names for focused reviews when appropriate.
|
|
43
44
|
`),
|
|
44
45
|
parameters: S.Struct({
|
|
46
|
+
applicability: Trait.Applicability.annotate({
|
|
47
|
+
description:
|
|
48
|
+
"Complete applicability metadata: when, mime, and skip. Use {} for unrestricted applicability. On clarification this replaces all previous applicability conditions."
|
|
49
|
+
}),
|
|
45
50
|
diff: Trait.TraitDiff.pipe(S.optional),
|
|
46
51
|
name: Trait.TraitName.annotate({
|
|
47
52
|
description:
|