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
|
@@ -2,6 +2,8 @@ import { NodeServices } from "@effect/platform-node";
|
|
|
2
2
|
import { expect, it } from "@effect/vitest";
|
|
3
3
|
import { Effect, FileSystem, Path, pipe, Queue, Schema as S, Stream } from "effect";
|
|
4
4
|
import { ChildProcess, ChildProcessSpawner } from "effect/process";
|
|
5
|
+
import { CheckTraits } from "../toolkit/CheckTraits.js";
|
|
6
|
+
import { DeriveTrait } from "../toolkit/DeriveTrait.js";
|
|
5
7
|
const effectUrl = new URL("../../node_modules/effect/dist/index.js", import.meta.url).href;
|
|
6
8
|
const server = new URL("../main.ts", import.meta.url).pathname;
|
|
7
9
|
for (const fixture of [
|
|
@@ -85,24 +87,18 @@ for (const fixture of [
|
|
|
85
87
|
yield* Queue.offer(requests, `${JSON.stringify({ jsonrpc: "2.0", method: "notifications/initialized" })}\n`);
|
|
86
88
|
const listed = yield* request(2, "tools/list");
|
|
87
89
|
expect(listed).toMatchObject({
|
|
88
|
-
tools:
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
])
|
|
93
|
-
: [
|
|
94
|
-
expect.objectContaining({
|
|
95
|
-
name: "traits_configuration_error",
|
|
96
|
-
description: expect.stringContaining("restart")
|
|
97
|
-
})
|
|
98
|
-
]
|
|
90
|
+
tools: expect.arrayContaining([
|
|
91
|
+
expect.objectContaining({ name: "check_traits", description: CheckTraits.description }),
|
|
92
|
+
expect.objectContaining({ name: "derive_trait", description: DeriveTrait.description })
|
|
93
|
+
])
|
|
99
94
|
});
|
|
100
95
|
for (const index of [3, 4]) {
|
|
101
|
-
const tool =
|
|
102
|
-
?
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
96
|
+
const tool = index === 3
|
|
97
|
+
? { name: "check_traits", arguments: { include: [] } }
|
|
98
|
+
: {
|
|
99
|
+
name: "derive_trait",
|
|
100
|
+
arguments: { name: "example", proposedTrait: "Example rule", applicability: {} }
|
|
101
|
+
};
|
|
106
102
|
const result = yield* request(index, "tools/call", tool);
|
|
107
103
|
expect(result).toMatchObject({
|
|
108
104
|
isError: true,
|
|
@@ -114,6 +110,10 @@ for (const fixture of [
|
|
|
114
110
|
}
|
|
115
111
|
else {
|
|
116
112
|
expect(JSON.stringify(result)).toContain("restart the Traits MCP server");
|
|
113
|
+
if (tool.name === "derive_trait") {
|
|
114
|
+
expect(JSON.stringify(result)).toContain("retry the same trait derivation with the identical arguments");
|
|
115
|
+
expect(JSON.stringify(result)).toContain("No trait was saved");
|
|
116
|
+
}
|
|
117
117
|
}
|
|
118
118
|
}
|
|
119
119
|
if ("trait" in fixture) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TraitsInitialization.test.js","sourceRoot":"","sources":["../../test/TraitsInitialization.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAA;AACpD,OAAO,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,gBAAgB,CAAA;AAC3C,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAA;AACnF,OAAO,EAAE,YAAY,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAElE,MAAM,SAAS,GAAG,IAAI,GAAG,CAAC,yCAAyC,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAA;AAC1F,MAAM,MAAM,GAAG,IAAI,GAAG,CAAC,YAAY,EAAE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,QAAQ,CAAA;AAE9D,KAAK,MAAM,OAAO,IAAI;IACpB,EAAE,IAAI,E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C,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,8DAA8D,CAAC,CAAA;oBACxG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC,oBAAoB,CAAC,CAAA;gBAChE,CAAC;YACH,CAAC;QACH,CAAC;QACD,IAAI,OAAO,IAAI,OAAO,EAAE,CAAC;YACvB,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,SAAS,CAAC,CAAA;YACrD,MAAM,CAAC,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAA;YACrC,KAAK,CAAC,CAAC,EAAE,CAAC,eAAe,CAAC,SAAS,EAAE,mDAAmD,CAAC,CAAA;YACzF,MAAM,SAAS,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,YAAY,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,SAAS,EAAE,EAAE,OAAO,EAAE,EAAE,EAAE,EAAE,CAAC,CAAA;YACvG,MAAM,CAAC,SAAS,CAAC,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,CAAC,CAAA;QACrD,CAAC;QACD,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,MAAM,CAAC,CAAA;QACtC,MAAM,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;IAC1B,CAAC,EAAE,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,CAAC,EACtC,EAAE,OAAO,EAAE,KAAK,EAAE,CACnB,CAAA;AACH,CAAC"}
|
|
@@ -9,14 +9,17 @@ export declare const CheckTraits: Tool.Tool<"check_traits", {
|
|
|
9
9
|
readonly traitNames: S.optional<S.$Array<S.brand<S.String, "traits/TraitName">>>;
|
|
10
10
|
}>;
|
|
11
11
|
readonly success: S.$Array<S.Struct<{
|
|
12
|
-
readonly trait: S.
|
|
12
|
+
readonly trait: S.Struct<{
|
|
13
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
13
14
|
readonly body: S.String;
|
|
14
15
|
readonly diff: S.optional<S.String>;
|
|
15
|
-
readonly
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
readonly applicability: S.Struct<{
|
|
17
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
18
|
+
readonly skip: S.optional<S.String>;
|
|
19
|
+
readonly when: S.optional<S.String>;
|
|
20
|
+
}>;
|
|
21
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
22
|
+
}>;
|
|
20
23
|
readonly source: S.Struct<{
|
|
21
24
|
readonly text: S.String;
|
|
22
25
|
readonly location: S.optional<S.TaggedUnion<{
|
|
@@ -87,14 +90,17 @@ export declare const toolkit: Toolkit.Toolkit<{
|
|
|
87
90
|
readonly traitNames: S.optional<S.$Array<S.brand<S.String, "traits/TraitName">>>;
|
|
88
91
|
}>;
|
|
89
92
|
readonly success: S.$Array<S.Struct<{
|
|
90
|
-
readonly trait: S.
|
|
93
|
+
readonly trait: S.Struct<{
|
|
94
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
91
95
|
readonly body: S.String;
|
|
92
96
|
readonly diff: S.optional<S.String>;
|
|
93
|
-
readonly
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
97
|
+
readonly applicability: S.Struct<{
|
|
98
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
99
|
+
readonly skip: S.optional<S.String>;
|
|
100
|
+
readonly when: S.optional<S.String>;
|
|
101
|
+
}>;
|
|
102
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
103
|
+
}>;
|
|
98
104
|
readonly source: S.Struct<{
|
|
99
105
|
readonly text: S.String;
|
|
100
106
|
readonly location: S.optional<S.TaggedUnion<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CheckTraits.d.ts","sourceRoot":"","sources":["../../toolkit/CheckTraits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAQ,IAAI,EAAQ,MAAM,IAAI,CAAC,EAAU,MAAM,QAAQ,CAAA;AACzF,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAOpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAmB,MAAM,kBAAkB,CAAA;AAE9D,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"CheckTraits.d.ts","sourceRoot":"","sources":["../../toolkit/CheckTraits.ts"],"names":[],"mappings":"AAAA,OAAO,EAAiB,UAAU,EAAQ,IAAI,EAAQ,MAAM,IAAI,CAAC,EAAU,MAAM,QAAQ,CAAA;AACzF,OAAO,EAAE,aAAa,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACxD,OAAO,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAA;AAOpD,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAmB,MAAM,kBAAkB,CAAA;AAE9D,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0IA2DY,CAAA;AAEpC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4B,CAAA;AAEhD,eAAO,MAAM,KAAK,0EAyDhB,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurationError.d.ts","sourceRoot":"","sources":["../../toolkit/ConfigurationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAU,KAAK,EAAe,MAAM,QAAQ,CAAA;
|
|
1
|
+
{"version":3,"file":"ConfigurationError.d.ts","sourceRoot":"","sources":["../../toolkit/ConfigurationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAU,KAAK,EAAe,MAAM,QAAQ,CAAA;AAuB1D,eAAO,MAAM,KAAK,UAAW,KAAK,CAAC,KAAK,CAAC,OAAO,CAAC,qCAgB1C,CAAA"}
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { Cause, Effect, Layer, Schema as S } from "effect";
|
|
2
2
|
import { McpServer, Tool, Toolkit } from "effect/ai";
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
import { CheckTraits } from "./CheckTraits.js";
|
|
4
|
+
import { DeriveTrait } from "./DeriveTrait.js";
|
|
5
|
+
const toolkit = Toolkit.make(Tool.make("derive_trait", {
|
|
6
|
+
description: DeriveTrait.description,
|
|
7
|
+
parameters: DeriveTrait.parametersSchema,
|
|
8
|
+
success: S.Never,
|
|
9
|
+
failure: S.String,
|
|
10
|
+
failureMode: "return"
|
|
11
|
+
}).annotate(Tool.Readonly, true), Tool.make("check_traits", {
|
|
12
|
+
description: CheckTraits.description,
|
|
13
|
+
parameters: CheckTraits.parametersSchema,
|
|
6
14
|
success: S.Never,
|
|
7
15
|
failure: S.String,
|
|
8
16
|
failureMode: "return"
|
|
@@ -10,6 +18,7 @@ const toolkit = Toolkit.make(Tool.make("traits_configuration_error", {
|
|
|
10
18
|
export const layer = (cause) => Cause.hasInterruptsOnly(cause)
|
|
11
19
|
? Layer.effectDiscard(Effect.interrupt)
|
|
12
20
|
: McpServer.toolkit(toolkit).pipe(Layer.provide(toolkit.toLayer({
|
|
13
|
-
|
|
21
|
+
derive_trait: () => Effect.fail(`${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.`),
|
|
22
|
+
check_traits: () => Effect.fail(`${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.`)
|
|
14
23
|
})));
|
|
15
24
|
//# sourceMappingURL=ConfigurationError.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfigurationError.js","sourceRoot":"","sources":["../../toolkit/ConfigurationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEpD,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAC1B,IAAI,CAAC,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"ConfigurationError.js","sourceRoot":"","sources":["../../toolkit/ConfigurationError.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC,EAAE,MAAM,QAAQ,CAAA;AAC1D,OAAO,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEpD,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE9C,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAC1B,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;IACxB,WAAW,EAAE,WAAW,CAAC,WAAW;IACpC,UAAU,EAAE,WAAW,CAAC,gBAAgB;IACxC,OAAO,EAAE,CAAC,CAAC,KAAK;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM;IACjB,WAAW,EAAE,QAAQ;CACtB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,EAChC,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE;IACxB,WAAW,EAAE,WAAW,CAAC,WAAW;IACpC,UAAU,EAAE,WAAW,CAAC,gBAAgB;IACxC,OAAO,EAAE,CAAC,CAAC,KAAK;IAChB,OAAO,EAAE,CAAC,CAAC,MAAM;IACjB,WAAW,EAAE,QAAQ;CACtB,CAAC,CAAC,QAAQ,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,CACjC,CAAA;AAED,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,KAA2B,EAAE,EAAE,CACnD,KAAK,CAAC,iBAAiB,CAAC,KAAK,CAAC;IAC5B,CAAC,CAAC,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,SAAS,CAAC;IACvC,CAAC,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,IAAI,CAC7B,KAAK,CAAC,OAAO,CACX,OAAO,CAAC,OAAO,CAAC;QACd,YAAY,EAAE,GAAG,EAAE,CACjB,MAAM,CAAC,IAAI,CACT,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,iSAAiS,CACxT;QACH,YAAY,EAAE,GAAG,EAAE,CACjB,MAAM,CAAC,IAAI,CACT,GAAG,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,6MAA6M,CACpO;KACJ,CAAC,CACH,CACF,CAAA"}
|
|
@@ -4,70 +4,93 @@ import { TraitsContext } from "../TraitsContext.ts";
|
|
|
4
4
|
import { TraitStore } from "../TraitStore.ts";
|
|
5
5
|
export declare const DeriveTrait: Tool.Tool<"derive_trait", {
|
|
6
6
|
readonly parameters: S.Struct<{
|
|
7
|
+
readonly applicability: S.Struct<{
|
|
8
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
9
|
+
readonly skip: S.optional<S.String>;
|
|
10
|
+
readonly when: S.optional<S.String>;
|
|
11
|
+
}>;
|
|
7
12
|
readonly diff: S.optional<S.String>;
|
|
8
13
|
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
9
14
|
readonly proposedTrait: S.String;
|
|
10
15
|
readonly approved: S.optional<S.Boolean>;
|
|
11
16
|
}>;
|
|
12
17
|
readonly success: S.toTaggedUnion<"_tag", readonly [S.TaggedStruct<"Created", {
|
|
13
|
-
readonly trait: S.
|
|
18
|
+
readonly trait: S.Struct<{
|
|
19
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
14
20
|
readonly body: S.String;
|
|
15
21
|
readonly diff: S.optional<S.String>;
|
|
16
|
-
readonly
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
readonly applicability: S.Struct<{
|
|
23
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
24
|
+
readonly skip: S.optional<S.String>;
|
|
25
|
+
readonly when: S.optional<S.String>;
|
|
26
|
+
}>;
|
|
27
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
28
|
+
}>;
|
|
21
29
|
}>, S.TaggedStruct<"Covered", {
|
|
22
|
-
readonly traits: S.$Array<S.
|
|
30
|
+
readonly traits: S.$Array<S.Struct<{
|
|
31
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
23
32
|
readonly body: S.String;
|
|
24
33
|
readonly diff: S.optional<S.String>;
|
|
25
|
-
readonly
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
34
|
+
readonly applicability: S.Struct<{
|
|
35
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
36
|
+
readonly skip: S.optional<S.String>;
|
|
37
|
+
readonly when: S.optional<S.String>;
|
|
38
|
+
}>;
|
|
39
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
40
|
+
}>>;
|
|
30
41
|
}>, S.TaggedStruct<"Clarification", {
|
|
31
|
-
readonly traits: S.$Array<S.
|
|
42
|
+
readonly traits: S.$Array<S.Struct<{
|
|
43
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
32
44
|
readonly body: S.String;
|
|
33
45
|
readonly diff: S.optional<S.String>;
|
|
34
|
-
readonly
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
46
|
+
readonly applicability: S.Struct<{
|
|
47
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
48
|
+
readonly skip: S.optional<S.String>;
|
|
49
|
+
readonly when: S.optional<S.String>;
|
|
50
|
+
}>;
|
|
51
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
52
|
+
}>>;
|
|
39
53
|
readonly proposedTrait: S.String;
|
|
40
54
|
}>, S.TaggedStruct<"Inconclusive", {
|
|
41
55
|
readonly findings: S.$Array<S.TaggedStruct<"Fail", {
|
|
42
|
-
readonly existing: S.
|
|
56
|
+
readonly existing: S.Struct<{
|
|
57
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
43
58
|
readonly body: S.String;
|
|
44
59
|
readonly diff: S.optional<S.String>;
|
|
45
|
-
readonly
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
60
|
+
readonly applicability: S.Struct<{
|
|
61
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
62
|
+
readonly skip: S.optional<S.String>;
|
|
63
|
+
readonly when: S.optional<S.String>;
|
|
64
|
+
}>;
|
|
65
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
66
|
+
}>;
|
|
50
67
|
readonly proposed: S.String;
|
|
51
68
|
readonly reason: S.Literals<readonly ["conflict", "coverage_gap", "inconclusive"]>;
|
|
52
69
|
}>>;
|
|
53
70
|
}>, S.TaggedStruct<"Updated", {
|
|
54
|
-
readonly trait: S.
|
|
71
|
+
readonly trait: S.Struct<{
|
|
72
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
55
73
|
readonly body: S.String;
|
|
56
74
|
readonly diff: S.optional<S.String>;
|
|
57
|
-
readonly
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
75
|
+
readonly applicability: S.Struct<{
|
|
76
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
77
|
+
readonly skip: S.optional<S.String>;
|
|
78
|
+
readonly when: S.optional<S.String>;
|
|
79
|
+
}>;
|
|
80
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
81
|
+
}>;
|
|
62
82
|
}>, S.TaggedStruct<"Resolved", {
|
|
63
|
-
readonly traits: S.$Array<S.
|
|
83
|
+
readonly traits: S.$Array<S.Struct<{
|
|
84
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
64
85
|
readonly body: S.String;
|
|
65
86
|
readonly diff: S.optional<S.String>;
|
|
66
|
-
readonly
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
87
|
+
readonly applicability: S.Struct<{
|
|
88
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
89
|
+
readonly skip: S.optional<S.String>;
|
|
90
|
+
readonly when: S.optional<S.String>;
|
|
91
|
+
}>;
|
|
92
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
93
|
+
}>>;
|
|
71
94
|
}>, S.TaggedStruct<"ApprovalRequired", {
|
|
72
95
|
readonly message: S.String;
|
|
73
96
|
}>, S.TaggedStruct<"RevisionRequired", {
|
|
@@ -101,70 +124,93 @@ export declare const DeriveTrait: Tool.Tool<"derive_trait", {
|
|
|
101
124
|
export declare const toolkit: Toolkit.Toolkit<{
|
|
102
125
|
readonly derive_trait: Tool.Tool<"derive_trait", {
|
|
103
126
|
readonly parameters: S.Struct<{
|
|
127
|
+
readonly applicability: S.Struct<{
|
|
128
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
129
|
+
readonly skip: S.optional<S.String>;
|
|
130
|
+
readonly when: S.optional<S.String>;
|
|
131
|
+
}>;
|
|
104
132
|
readonly diff: S.optional<S.String>;
|
|
105
133
|
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
106
134
|
readonly proposedTrait: S.String;
|
|
107
135
|
readonly approved: S.optional<S.Boolean>;
|
|
108
136
|
}>;
|
|
109
137
|
readonly success: S.toTaggedUnion<"_tag", readonly [S.TaggedStruct<"Created", {
|
|
110
|
-
readonly trait: S.
|
|
138
|
+
readonly trait: S.Struct<{
|
|
139
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
111
140
|
readonly body: S.String;
|
|
112
141
|
readonly diff: S.optional<S.String>;
|
|
113
|
-
readonly
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
142
|
+
readonly applicability: S.Struct<{
|
|
143
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
144
|
+
readonly skip: S.optional<S.String>;
|
|
145
|
+
readonly when: S.optional<S.String>;
|
|
146
|
+
}>;
|
|
147
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
148
|
+
}>;
|
|
118
149
|
}>, S.TaggedStruct<"Covered", {
|
|
119
|
-
readonly traits: S.$Array<S.
|
|
150
|
+
readonly traits: S.$Array<S.Struct<{
|
|
151
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
120
152
|
readonly body: S.String;
|
|
121
153
|
readonly diff: S.optional<S.String>;
|
|
122
|
-
readonly
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
154
|
+
readonly applicability: S.Struct<{
|
|
155
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
156
|
+
readonly skip: S.optional<S.String>;
|
|
157
|
+
readonly when: S.optional<S.String>;
|
|
158
|
+
}>;
|
|
159
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
160
|
+
}>>;
|
|
127
161
|
}>, S.TaggedStruct<"Clarification", {
|
|
128
|
-
readonly traits: S.$Array<S.
|
|
162
|
+
readonly traits: S.$Array<S.Struct<{
|
|
163
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
129
164
|
readonly body: S.String;
|
|
130
165
|
readonly diff: S.optional<S.String>;
|
|
131
|
-
readonly
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
166
|
+
readonly applicability: S.Struct<{
|
|
167
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
168
|
+
readonly skip: S.optional<S.String>;
|
|
169
|
+
readonly when: S.optional<S.String>;
|
|
170
|
+
}>;
|
|
171
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
172
|
+
}>>;
|
|
136
173
|
readonly proposedTrait: S.String;
|
|
137
174
|
}>, S.TaggedStruct<"Inconclusive", {
|
|
138
175
|
readonly findings: S.$Array<S.TaggedStruct<"Fail", {
|
|
139
|
-
readonly existing: S.
|
|
176
|
+
readonly existing: S.Struct<{
|
|
177
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
140
178
|
readonly body: S.String;
|
|
141
179
|
readonly diff: S.optional<S.String>;
|
|
142
|
-
readonly
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
180
|
+
readonly applicability: S.Struct<{
|
|
181
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
182
|
+
readonly skip: S.optional<S.String>;
|
|
183
|
+
readonly when: S.optional<S.String>;
|
|
184
|
+
}>;
|
|
185
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
186
|
+
}>;
|
|
147
187
|
readonly proposed: S.String;
|
|
148
188
|
readonly reason: S.Literals<readonly ["conflict", "coverage_gap", "inconclusive"]>;
|
|
149
189
|
}>>;
|
|
150
190
|
}>, S.TaggedStruct<"Updated", {
|
|
151
|
-
readonly trait: S.
|
|
191
|
+
readonly trait: S.Struct<{
|
|
192
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
152
193
|
readonly body: S.String;
|
|
153
194
|
readonly diff: S.optional<S.String>;
|
|
154
|
-
readonly
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
195
|
+
readonly applicability: S.Struct<{
|
|
196
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
197
|
+
readonly skip: S.optional<S.String>;
|
|
198
|
+
readonly when: S.optional<S.String>;
|
|
199
|
+
}>;
|
|
200
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
201
|
+
}>;
|
|
159
202
|
}>, S.TaggedStruct<"Resolved", {
|
|
160
|
-
readonly traits: S.$Array<S.
|
|
203
|
+
readonly traits: S.$Array<S.Struct<{
|
|
204
|
+
readonly name: S.brand<S.String, "traits/TraitName">;
|
|
161
205
|
readonly body: S.String;
|
|
162
206
|
readonly diff: S.optional<S.String>;
|
|
163
|
-
readonly
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
207
|
+
readonly applicability: S.Struct<{
|
|
208
|
+
readonly mime: S.optional<S.Union<readonly [S.String, S.$Array<S.String>]>>;
|
|
209
|
+
readonly skip: S.optional<S.String>;
|
|
210
|
+
readonly when: S.optional<S.String>;
|
|
211
|
+
}>;
|
|
212
|
+
readonly extensionMetadata: S.$Record<S.String, S.Codec<S.Json, S.Json, never, never>>;
|
|
213
|
+
}>>;
|
|
168
214
|
}>, S.TaggedStruct<"ApprovalRequired", {
|
|
169
215
|
readonly message: S.String;
|
|
170
216
|
}>, S.TaggedStruct<"RevisionRequired", {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeriveTrait.d.ts","sourceRoot":"","sources":["../../toolkit/DeriveTrait.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAU,MAAM,QAAQ,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAIlF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAmB,MAAM,kBAAkB,CAAA;AAE9D,eAAO,MAAM,WAAW
|
|
1
|
+
{"version":3,"file":"DeriveTrait.d.ts","sourceRoot":"","sources":["../../toolkit/DeriveTrait.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,IAAI,CAAC,EAAU,MAAM,QAAQ,CAAA;AAC5C,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,SAAS,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAIlF,OAAO,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAA;AACnD,OAAO,EAAE,UAAU,EAAmB,MAAM,kBAAkB,CAAA;AAE9D,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;0FA8DW,CAAA;AAEnC,eAAO,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAA4B,CAAA;AAEhD,eAAO,MAAM,KAAK,0EAEhB,CAAA"}
|
|
@@ -20,7 +20,8 @@ export const DeriveTrait = Tool.make("derive_trait", {
|
|
|
20
20
|
| 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.
|
|
21
21
|
| 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.
|
|
22
22
|
| Avoid repeated requirements and duplicate traits. Keep bodies standalone; do not strip essential scope or exceptions just to shorten them.
|
|
23
|
-
|
|
|
23
|
+
| 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.
|
|
24
|
+
| On clarification, supply the complete replacement applicability; omitted fields remove old restrictions. Approval and retries cover the exact metadata too.
|
|
24
25
|
| Write when values without a leading When, for example when: editing React state.
|
|
25
26
|
| Compare against all stored traits. Only a distinct proposal is saved as a new trait.
|
|
26
27
|
| Inconclusive returns relationship findings and blocks all writes; clarify ambiguity or revise the proposal before retrying.
|
|
@@ -40,6 +41,9 @@ export const DeriveTrait = Tool.make("derive_trait", {
|
|
|
40
41
|
| Then call check_traits on relevant TypeScript files, using returned trait names for focused reviews when appropriate.
|
|
41
42
|
`),
|
|
42
43
|
parameters: S.Struct({
|
|
44
|
+
applicability: Trait.Applicability.annotate({
|
|
45
|
+
description: "Complete applicability metadata: when, mime, and skip. Use {} for unrestricted applicability. On clarification this replaces all previous applicability conditions."
|
|
46
|
+
}),
|
|
43
47
|
diff: Trait.TraitDiff.pipe(S.optional),
|
|
44
48
|
name: Trait.TraitName.annotate({
|
|
45
49
|
description: "Unique descriptive kebab-case identity and Markdown filename stem without a redundant trait- prefix for a newly created trait. Existing names are preserved on clarification."
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DeriveTrait.js","sourceRoot":"","sources":["../../toolkit/DeriveTrait.ts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|
export declare const traitIgnores: (text: string) => ReadonlySet<string>;
|
|
3
3
|
/** References match unique trait names exactly. */
|
|
4
4
|
export declare const excludeIgnored: (text: string) => (self: Iterable<{
|
|
5
|
-
readonly
|
|
5
|
+
readonly name: string & import("effect/Brand").Brand<"traits/TraitName">;
|
|
6
6
|
readonly body: string;
|
|
7
7
|
readonly diff?: string | undefined;
|
|
8
|
-
readonly
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
readonly applicability: {
|
|
9
|
+
readonly mime?: string | readonly string[] | undefined;
|
|
10
|
+
readonly skip?: string | undefined;
|
|
11
|
+
readonly when?: string | undefined;
|
|
12
|
+
};
|
|
13
|
+
readonly extensionMetadata: {
|
|
14
|
+
readonly [x: string]: import("effect/Schema").Json;
|
|
15
|
+
};
|
|
12
16
|
}>) => {
|
|
13
|
-
readonly
|
|
17
|
+
readonly name: string & import("effect/Brand").Brand<"traits/TraitName">;
|
|
14
18
|
readonly body: string;
|
|
15
19
|
readonly diff?: string | undefined;
|
|
16
|
-
readonly
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
+
readonly applicability: {
|
|
21
|
+
readonly mime?: string | readonly string[] | undefined;
|
|
22
|
+
readonly skip?: string | undefined;
|
|
23
|
+
readonly when?: string | undefined;
|
|
24
|
+
};
|
|
25
|
+
readonly extensionMetadata: {
|
|
26
|
+
readonly [x: string]: import("effect/Schema").Json;
|
|
27
|
+
};
|
|
20
28
|
}[];
|
|
21
29
|
//# sourceMappingURL=traitIgnores.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traitIgnores.d.ts","sourceRoot":"","sources":["../traitIgnores.ts"],"names":[],"mappings":"AAIA,kGAAkG;AAClG,eAAO,MAAM,YAAY,SAAU,MAAM,KAAG,WAAW,CAAC,MAAM,CAW7D,CAAA;AAED,mDAAmD;AACnD,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"traitIgnores.d.ts","sourceRoot":"","sources":["../traitIgnores.ts"],"names":[],"mappings":"AAIA,kGAAkG;AAClG,eAAO,MAAM,YAAY,SAAU,MAAM,KAAG,WAAW,CAAC,MAAM,CAW7D,CAAA;AAED,mDAAmD;AACnD,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;GAE1B,CAAA"}
|
package/main.ts
CHANGED
|
@@ -54,7 +54,8 @@ Command.make("traits", {
|
|
|
54
54
|
| Read existing trait files before drafting. Keep each trait concise and independently applicable, preserving scope and exceptions.
|
|
55
55
|
| Keep frontmatter complementary: mime restricts file types, when defines positive semantic scope, and skip is only an independent exception within that scope. Omit redundant fields; never repeat when's negation as skip. Keep bodies standalone without repeated requirements or duplicate traits.
|
|
56
56
|
| Write when values as conditions without a redundant leading When, for example when: editing React state.
|
|
57
|
-
| Call derive_trait with the drafted body as proposedTrait. It saves only distinct rules; Covered means reuse an existing trait.
|
|
57
|
+
| Call derive_trait with the drafted body as proposedTrait and an applicability object containing relevant when, mime, and skip fields ({} when unrestricted). These are persisted directly without a separate generation call. It saves only distinct rules; Covered means reuse an existing trait.
|
|
58
|
+
| Supply complete replacement applicability on clarification; omitted fields remove old restrictions. Approval and retries cover the exact metadata too.
|
|
58
59
|
| A single clarification candidate is selected automatically and shown for approval; supply a complete replacement preserving the existing rule.
|
|
59
60
|
| Multiple candidates return Clarification entries without writing: refine the proposal or clarify intent. Do not supply a clarification target.
|
|
60
61
|
| After fallback approval, retry with the same name, proposedTrait and approved: true; Updated preserves the selected existing name.
|
package/package.json
CHANGED
package/skills/traits/SKILL.md
CHANGED
|
@@ -44,6 +44,15 @@ body concise and standalone, preserving essential scope and exceptions without
|
|
|
44
44
|
repeated restatements. Reuse existing traits that already cover the same rule
|
|
45
45
|
rather than creating duplicates.
|
|
46
46
|
|
|
47
|
+
Pass `applicability: { when, mime, skip }` to `derive_trait` alongside
|
|
48
|
+
`proposedTrait`, omitting unnecessary fields inside the object; use `{}` when
|
|
49
|
+
unrestricted. The server persists it without another model call. On
|
|
50
|
+
clarification this object replaces all previous applicability conditions.
|
|
51
|
+
Approval and retries cover the exact metadata too. Domain traits group these
|
|
52
|
+
conditions under `applicability` and additional metadata under
|
|
53
|
+
`extensionMetadata`; only Markdown frontmatter flattens those objects into
|
|
54
|
+
top-level fields.
|
|
55
|
+
|
|
47
56
|
## Capture a reusable insight
|
|
48
57
|
|
|
49
58
|
### Required pre-response preference check
|
|
@@ -125,9 +134,9 @@ authenticated consent token.
|
|
|
125
134
|
3. Draft the complete rule as `proposedTrait`. Preserve essential requirements,
|
|
126
135
|
scopes, and exceptions. Keep independently applicable rules separate; omit
|
|
127
136
|
headings, repetition, and unnecessary explanation or examples.
|
|
128
|
-
4. Call `derive_trait({ name, proposedTrait })` first, without a
|
|
129
|
-
approval prompt. This checks existing traits and writes only when
|
|
130
|
-
proposal is distinct from all of them. It does not independently decide
|
|
137
|
+
4. Call `derive_trait({ name, proposedTrait, applicability })` first, without a
|
|
138
|
+
separate approval prompt. This checks existing traits and writes only when
|
|
139
|
+
the proposal is distinct from all of them. It does not independently decide
|
|
131
140
|
whether the conversation contains a generalizable insight.
|
|
132
141
|
5. `Created` means the trait was saved and includes its body and unique name. Do
|
|
133
142
|
not submit it again. Use that name for focused checks when needed.
|
|
@@ -334,14 +343,9 @@ simultaneous installations in the same worktree. During development, use
|
|
|
334
343
|
`node traits/bin.ts` with a Node version supporting native TypeScript execution;
|
|
335
344
|
pass server flags after the filename.
|
|
336
345
|
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
reported error, then restart the Traits MCP server. Diagnostics include the full
|
|
341
|
-
Effect cause and may contain sensitive values embedded in errors. Never ask for
|
|
342
|
-
credentials in chat. Expected tool failures use MCP error results; unexpected
|
|
343
|
-
runtime defects receive a generic internal error rather than implementation
|
|
344
|
-
details.
|
|
346
|
+
Surface tool failures; never treat a failed operation as a successful save or
|
|
347
|
+
review. Error diagnostics may contain sensitive information. Never ask for
|
|
348
|
+
credentials in chat.
|
|
345
349
|
|
|
346
350
|
Stored trait parsing failures return `TraitParseError` with the file path,
|
|
347
351
|
original diagnostic, and migration guidance. Update all stored traits to the
|