opencode-sat 0.0.16-next.0 → 0.0.16-next.2
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 +61 -28
- package/dist/sat.d.ts.map +1 -1
- package/dist/sat.js +71 -20
- package/dist/sat.js.map +1 -1
- package/dist/src/append.d.ts +1 -4
- package/dist/src/append.d.ts.map +1 -1
- package/dist/src/append.js +4 -14
- package/dist/src/append.js.map +1 -1
- package/dist/src/{utils/compare.d.ts → compare.d.ts} +2 -0
- package/dist/src/compare.d.ts.map +1 -0
- package/dist/src/{utils/compare.js → compare.js} +20 -0
- package/dist/src/compare.js.map +1 -0
- package/dist/src/discover.d.ts +1 -1
- package/dist/src/discover.d.ts.map +1 -1
- package/dist/src/discover.js +4 -4
- package/dist/src/discover.js.map +1 -1
- package/dist/src/format-prompt.d.ts.map +1 -1
- package/dist/src/format-prompt.js +6 -2
- package/dist/src/format-prompt.js.map +1 -1
- package/dist/src/opencode/notify.d.ts +9 -0
- package/dist/src/opencode/notify.d.ts.map +1 -0
- package/dist/src/opencode/notify.js +14 -0
- package/dist/src/opencode/notify.js.map +1 -0
- package/dist/src/prompt-schema.d.ts +0 -3
- package/dist/src/prompt-schema.d.ts.map +1 -1
- package/dist/src/prompt-schema.js +0 -3
- package/dist/src/prompt-schema.js.map +1 -1
- package/dist/src/resolve.d.ts +1 -1
- package/dist/src/resolve.d.ts.map +1 -1
- package/dist/src/{process.d.ts → rewrite.d.ts} +3 -6
- package/dist/src/rewrite.d.ts.map +1 -0
- package/dist/src/{process.js → rewrite.js} +4 -8
- package/dist/src/rewrite.js.map +1 -0
- package/dist/src/rule-schema.d.ts +5 -4
- package/dist/src/rule-schema.d.ts.map +1 -1
- package/dist/src/rule-schema.js +107 -8
- package/dist/src/rule-schema.js.map +1 -1
- package/dist/src/safe.d.ts.map +1 -0
- package/dist/src/safe.js.map +1 -0
- package/dist/src/tools/descriptions.d.ts +8 -0
- package/dist/src/tools/descriptions.d.ts.map +1 -0
- package/dist/src/tools/descriptions.js +50 -0
- package/dist/src/tools/descriptions.js.map +1 -0
- package/dist/src/tools/prompts.d.ts +28 -0
- package/dist/src/tools/prompts.d.ts.map +1 -0
- package/dist/src/tools/prompts.js +46 -0
- package/dist/src/tools/prompts.js.map +1 -0
- package/dist/src/{tools.d.ts → tools/rules.d.ts} +28 -21
- package/dist/src/tools/rules.d.ts.map +1 -0
- package/dist/src/tools/rules.js +160 -0
- package/dist/src/tools/rules.js.map +1 -0
- package/dist/src/validate.d.ts.map +1 -0
- package/dist/src/{utils/validate.js → validate.js} +2 -2
- package/dist/src/validate.js.map +1 -0
- package/package.json +1 -1
- package/dist/src/format.d.ts +0 -16
- package/dist/src/format.d.ts.map +0 -1
- package/dist/src/format.js +0 -30
- package/dist/src/format.js.map +0 -1
- package/dist/src/process.d.ts.map +0 -1
- package/dist/src/process.js.map +0 -1
- package/dist/src/tools.d.ts.map +0 -1
- package/dist/src/tools.js +0 -197
- package/dist/src/tools.js.map +0 -1
- package/dist/src/utils/compare.d.ts.map +0 -1
- package/dist/src/utils/compare.js.map +0 -1
- package/dist/src/utils/safe.d.ts.map +0 -1
- package/dist/src/utils/safe.js.map +0 -1
- package/dist/src/utils/validate.d.ts.map +0 -1
- package/dist/src/utils/validate.js.map +0 -1
- /package/dist/src/{utils/safe.d.ts → safe.d.ts} +0 -0
- /package/dist/src/{utils/safe.js → safe.js} +0 -0
- /package/dist/src/{utils/validate.d.ts → validate.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/resolve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/resolve.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AACpD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,WAAW,CAAA;AAGvC,eAAO,MAAM,YAAY,GAAU,WAAW,MAAM,EAAE,WAAW,MAAM,KAAG,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,CAAC,CAiB1G,CAAA"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
+
import { type ComparisonResult } from './compare.ts';
|
|
1
2
|
import type { InstructionFile } from './discover.ts';
|
|
2
|
-
import { type FormatMode } from './format.ts';
|
|
3
|
-
import type { ParsedRule } from './rule-schema.ts';
|
|
4
|
-
import { type ComparisonResult } from './utils/compare.ts';
|
|
5
3
|
type FileResultSuccess = {
|
|
6
4
|
status: 'success';
|
|
7
5
|
path: string;
|
|
@@ -16,9 +14,8 @@ type FileResultError = {
|
|
|
16
14
|
export type FileResult = FileResultSuccess | FileResultError;
|
|
17
15
|
type ProcessFileOptions = {
|
|
18
16
|
file: InstructionFile;
|
|
19
|
-
rules: Array<
|
|
20
|
-
mode: FormatMode;
|
|
17
|
+
rules: Array<string>;
|
|
21
18
|
};
|
|
22
19
|
export declare const processFile: (options: ProcessFileOptions) => Promise<FileResult>;
|
|
23
20
|
export {};
|
|
24
|
-
//# sourceMappingURL=
|
|
21
|
+
//# sourceMappingURL=rewrite.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rewrite.d.ts","sourceRoot":"","sources":["../../src/rewrite.ts"],"names":[],"mappings":"AAEA,OAAO,EAAgB,KAAK,gBAAgB,EAAE,MAAM,cAAc,CAAA;AAClE,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,eAAe,CAAA;AAGpD,KAAK,iBAAiB,GAAG;IACvB,MAAM,EAAE,SAAS,CAAA;IACjB,IAAI,EAAE,MAAM,CAAA;IACZ,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,gBAAgB,CAAA;CAC7B,CAAA;AAED,KAAK,eAAe,GAAG;IACrB,MAAM,EAAE,WAAW,GAAG,YAAY,CAAA;IAClC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;CACd,CAAA;AAED,MAAM,MAAM,UAAU,GAAG,iBAAiB,GAAG,eAAe,CAAA;AAE5D,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,eAAe,CAAA;IACrB,KAAK,EAAE,KAAK,CAAC,MAAM,CAAC,CAAA;CACrB,CAAA;AAED,eAAO,MAAM,WAAW,GAAU,SAAS,kBAAkB,KAAG,OAAO,CAAC,UAAU,CA4BjF,CAAA"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { writeFile } from 'node:fs/promises';
|
|
2
2
|
import { basename } from 'node:path';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import { safeAsync } from "./utils/safe.js";
|
|
3
|
+
import { compareBytes } from "./compare.js";
|
|
4
|
+
import { safeAsync } from "./safe.js";
|
|
6
5
|
export const processFile = async (options) => {
|
|
7
6
|
if (options.file.error) {
|
|
8
7
|
return {
|
|
@@ -11,10 +10,7 @@ export const processFile = async (options) => {
|
|
|
11
10
|
error: options.file.error,
|
|
12
11
|
};
|
|
13
12
|
}
|
|
14
|
-
const content =
|
|
15
|
-
rules: options.rules,
|
|
16
|
-
mode: options.mode,
|
|
17
|
-
});
|
|
13
|
+
const content = options.rules.join('\n\n') + '\n';
|
|
18
14
|
const writeResult = await safeAsync(() => writeFile(options.file.path, content, 'utf-8'));
|
|
19
15
|
if (writeResult.error) {
|
|
20
16
|
return {
|
|
@@ -31,4 +27,4 @@ export const processFile = async (options) => {
|
|
|
31
27
|
comparison,
|
|
32
28
|
};
|
|
33
29
|
};
|
|
34
|
-
//# sourceMappingURL=
|
|
30
|
+
//# sourceMappingURL=rewrite.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rewrite.js","sourceRoot":"","sources":["../../src/rewrite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SA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|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
export declare const StrengthSchema: z.ZodEnum<{
|
|
3
|
+
optional: "optional";
|
|
3
4
|
obligatory: "obligatory";
|
|
4
5
|
permissible: "permissible";
|
|
5
6
|
forbidden: "forbidden";
|
|
6
|
-
optional: "optional";
|
|
7
7
|
supererogatory: "supererogatory";
|
|
8
8
|
indifferent: "indifferent";
|
|
9
9
|
omissible: "omissible";
|
|
@@ -14,10 +14,10 @@ export declare const ContextSchema: z.ZodString;
|
|
|
14
14
|
export declare const ReasonSchema: z.ZodString;
|
|
15
15
|
export declare const ParsedRuleSchema: z.ZodObject<{
|
|
16
16
|
strength: z.ZodEnum<{
|
|
17
|
+
optional: "optional";
|
|
17
18
|
obligatory: "obligatory";
|
|
18
19
|
permissible: "permissible";
|
|
19
20
|
forbidden: "forbidden";
|
|
20
|
-
optional: "optional";
|
|
21
21
|
supererogatory: "supererogatory";
|
|
22
22
|
indifferent: "indifferent";
|
|
23
23
|
omissible: "omissible";
|
|
@@ -30,10 +30,10 @@ export declare const ParsedRuleSchema: z.ZodObject<{
|
|
|
30
30
|
export declare const RuleSchema: z.ZodString;
|
|
31
31
|
export declare const ParsedSchema: z.ZodArray<z.ZodObject<{
|
|
32
32
|
strength: z.ZodEnum<{
|
|
33
|
+
optional: "optional";
|
|
33
34
|
obligatory: "obligatory";
|
|
34
35
|
permissible: "permissible";
|
|
35
36
|
forbidden: "forbidden";
|
|
36
|
-
optional: "optional";
|
|
37
37
|
supererogatory: "supererogatory";
|
|
38
38
|
indifferent: "indifferent";
|
|
39
39
|
omissible: "omissible";
|
|
@@ -46,10 +46,10 @@ export declare const ParsedSchema: z.ZodArray<z.ZodObject<{
|
|
|
46
46
|
export declare const ParseResponseSchema: z.ZodObject<{
|
|
47
47
|
rules: z.ZodArray<z.ZodObject<{
|
|
48
48
|
strength: z.ZodEnum<{
|
|
49
|
+
optional: "optional";
|
|
49
50
|
obligatory: "obligatory";
|
|
50
51
|
permissible: "permissible";
|
|
51
52
|
forbidden: "forbidden";
|
|
52
|
-
optional: "optional";
|
|
53
53
|
supererogatory: "supererogatory";
|
|
54
54
|
indifferent: "indifferent";
|
|
55
55
|
omissible: "omissible";
|
|
@@ -66,4 +66,5 @@ export declare const FormatResponseSchema: z.ZodObject<{
|
|
|
66
66
|
export type Strength = z.infer<typeof StrengthSchema>;
|
|
67
67
|
export type ParsedRule = z.infer<typeof ParsedRuleSchema>;
|
|
68
68
|
export declare const parseSchemaExample: string;
|
|
69
|
+
export declare const formatSchemaExample: string;
|
|
69
70
|
//# sourceMappingURL=rule-schema.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-schema.d.ts","sourceRoot":"","sources":["../../src/rule-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,cAAc;;;;;;;;
|
|
1
|
+
{"version":3,"file":"rule-schema.d.ts","sourceRoot":"","sources":["../../src/rule-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,eAAO,MAAM,cAAc;;;;;;;;EAoBvB,CAAA;AAEJ,eAAO,MAAM,YAAY,aAIrB,CAAA;AAEJ,eAAO,MAAM,YAAY,aAWrB,CAAA;AAEJ,eAAO,MAAM,aAAa,aAWtB,CAAA;AAEJ,eAAO,MAAM,YAAY,aAWrB,CAAA;AAEJ,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;iBA8CzB,CAAA;AAEJ,eAAO,MAAM,UAAU,aAWnB,CAAA;AAEJ,eAAO,MAAM,YAAY;;;;;;;;;;;;;;kBACsB,CAAA;AAE/C,eAAO,MAAM,mBAAmB;;;;;;;;;;;;;;;;iBAE9B,CAAA;AAEF,eAAO,MAAM,oBAAoB;;iBAE/B,CAAA;AAEF,MAAM,MAAM,QAAQ,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAA;AACrD,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAA;AAEzD,eAAO,MAAM,kBAAkB,QAQ7B,CAAA;AAEF,eAAO,MAAM,mBAAmB,QAK9B,CAAA"}
|
package/dist/src/rule-schema.js
CHANGED
|
@@ -8,15 +8,59 @@ export const StrengthSchema = z.enum([
|
|
|
8
8
|
'indifferent',
|
|
9
9
|
'omissible',
|
|
10
10
|
])
|
|
11
|
-
.describe('
|
|
11
|
+
.describe('How strongly this rule should be enforced')
|
|
12
|
+
.meta({
|
|
13
|
+
examples: {
|
|
14
|
+
obligatory: 'must use return await when returning promises',
|
|
15
|
+
permissible: 'may use either grep or find as appropriate',
|
|
16
|
+
forbidden: 'never use type assertions anywhere',
|
|
17
|
+
optional: 'adding commit body is your choice',
|
|
18
|
+
supererogatory: 'comprehensive documentation beyond requirements',
|
|
19
|
+
indifferent: 'choice of variable naming style',
|
|
20
|
+
omissible: 'post-task explanations can be omitted',
|
|
21
|
+
},
|
|
22
|
+
});
|
|
12
23
|
export const ActionSchema = z.string()
|
|
13
|
-
.describe('
|
|
24
|
+
.describe('The action verb that describes what to do')
|
|
25
|
+
.meta({
|
|
26
|
+
examples: ['use', 'avoid', 'format', 'follow', 'keep', 'combine', 'search', 'ask'],
|
|
27
|
+
});
|
|
14
28
|
export const TargetSchema = z.string()
|
|
15
|
-
.describe('
|
|
29
|
+
.describe('What the action applies to - the object of the rule')
|
|
30
|
+
.meta({
|
|
31
|
+
examples: [
|
|
32
|
+
'commit messages',
|
|
33
|
+
'type assertions',
|
|
34
|
+
'command line tools',
|
|
35
|
+
'file operations',
|
|
36
|
+
'code formatting',
|
|
37
|
+
'user instructions',
|
|
38
|
+
],
|
|
39
|
+
});
|
|
16
40
|
export const ContextSchema = z.string()
|
|
17
|
-
.describe('
|
|
41
|
+
.describe('When, where, or under what conditions this rule applies')
|
|
42
|
+
.meta({
|
|
43
|
+
examples: [
|
|
44
|
+
'before removing files',
|
|
45
|
+
'in async functions',
|
|
46
|
+
'when returning promises',
|
|
47
|
+
'for new features',
|
|
48
|
+
'under 50 characters',
|
|
49
|
+
'if unclear',
|
|
50
|
+
],
|
|
51
|
+
});
|
|
18
52
|
export const ReasonSchema = z.string()
|
|
19
|
-
.describe('
|
|
53
|
+
.describe('Why this rule exists - the justification or benefit')
|
|
54
|
+
.meta({
|
|
55
|
+
examples: [
|
|
56
|
+
'prevents data loss',
|
|
57
|
+
'better stack traces',
|
|
58
|
+
'consistent code style',
|
|
59
|
+
'automated tooling',
|
|
60
|
+
'accurate execution',
|
|
61
|
+
'clear completion signal',
|
|
62
|
+
],
|
|
63
|
+
});
|
|
20
64
|
export const ParsedRuleSchema = z.object({
|
|
21
65
|
strength: StrengthSchema,
|
|
22
66
|
action: ActionSchema,
|
|
@@ -24,11 +68,60 @@ export const ParsedRuleSchema = z.object({
|
|
|
24
68
|
context: ContextSchema.optional(),
|
|
25
69
|
reason: ReasonSchema,
|
|
26
70
|
})
|
|
27
|
-
.describe('
|
|
71
|
+
.describe('Structured breakdown of a rule for AI processing')
|
|
72
|
+
.meta({
|
|
73
|
+
examples: [{
|
|
74
|
+
strength: 'obligatory',
|
|
75
|
+
action: 'use',
|
|
76
|
+
target: 'return await',
|
|
77
|
+
context: 'when returning promises from async functions',
|
|
78
|
+
reason: 'better stack traces and error handling',
|
|
79
|
+
}, {
|
|
80
|
+
strength: 'forbidden',
|
|
81
|
+
action: 'use',
|
|
82
|
+
target: 'type assertions',
|
|
83
|
+
context: 'anywhere',
|
|
84
|
+
reason: 'maintains type safety',
|
|
85
|
+
}, {
|
|
86
|
+
strength: 'obligatory',
|
|
87
|
+
action: 'ask',
|
|
88
|
+
target: 'confirmation',
|
|
89
|
+
context: 'before removing files',
|
|
90
|
+
reason: 'prevents accidental data loss',
|
|
91
|
+
}, {
|
|
92
|
+
strength: 'obligatory',
|
|
93
|
+
action: 'follow',
|
|
94
|
+
target: 'user instructions',
|
|
95
|
+
context: 'exactly',
|
|
96
|
+
reason: 'accurate execution',
|
|
97
|
+
}, {
|
|
98
|
+
strength: 'permissible',
|
|
99
|
+
action: 'use',
|
|
100
|
+
target: 'type assertions',
|
|
101
|
+
context: 'when the type system cannot infer the correct type',
|
|
102
|
+
reason: 'sometimes necessary for complex generic patterns',
|
|
103
|
+
}, {
|
|
104
|
+
strength: 'obligatory',
|
|
105
|
+
action: 'reply',
|
|
106
|
+
target: 'Done',
|
|
107
|
+
context: 'after completing tasks',
|
|
108
|
+
reason: 'clear completion signal',
|
|
109
|
+
}],
|
|
110
|
+
});
|
|
28
111
|
export const RuleSchema = z.string()
|
|
29
|
-
.describe('
|
|
112
|
+
.describe('The rule expressed in natural human language')
|
|
113
|
+
.meta({
|
|
114
|
+
examples: [
|
|
115
|
+
'Use return await when returning promises from async functions for better stack traces and error handling',
|
|
116
|
+
'Do not use type assertions anywhere to maintain type safety',
|
|
117
|
+
'Ask for confirmation before removing files to prevent accidental data loss',
|
|
118
|
+
'Follow user instructions exactly for accurate execution',
|
|
119
|
+
'May use type assertions when the type system cannot infer the correct type',
|
|
120
|
+
'Reply "Done" after completing tasks for clear completion signal',
|
|
121
|
+
],
|
|
122
|
+
});
|
|
30
123
|
export const ParsedSchema = z.array(ParsedRuleSchema)
|
|
31
|
-
.describe('Array of parsed rules');
|
|
124
|
+
.describe('Array of structured parsed rules');
|
|
32
125
|
export const ParseResponseSchema = z.object({
|
|
33
126
|
rules: ParsedSchema,
|
|
34
127
|
});
|
|
@@ -44,4 +137,10 @@ export const parseSchemaExample = JSON.stringify({
|
|
|
44
137
|
reason: ReasonSchema.description || 'justification',
|
|
45
138
|
}],
|
|
46
139
|
});
|
|
140
|
+
export const formatSchemaExample = JSON.stringify({
|
|
141
|
+
rules: [
|
|
142
|
+
'Rule: Verb target context.\nReason: Justification.',
|
|
143
|
+
'Rule: Do not verb target context.\nReason: Justification.',
|
|
144
|
+
],
|
|
145
|
+
});
|
|
47
146
|
//# sourceMappingURL=rule-schema.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rule-schema.js","sourceRoot":"","sources":["../../src/rule-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC;IACnC,YAAY;IACZ,aAAa;IACb,WAAW;IACX,UAAU;IACV,gBAAgB;IAChB,aAAa;IACb,WAAW;CACZ,CAAC;KACC,QAAQ,CAAC,
|
|
1
|
+
{"version":3,"file":"rule-schema.js","sourceRoot":"","sources":["../../src/rule-schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAA;AAEvB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,IAAI,CAAC;IACnC,YAAY;IACZ,aAAa;IACb,WAAW;IACX,UAAU;IACV,gBAAgB;IAChB,aAAa;IACb,WAAW;CACZ,CAAC;KACC,QAAQ,CAAC,2CAA2C,CAAC;KACrD,IAAI,CAAC;IACJ,QAAQ,EAAE;QACR,UAAU,EAAE,+CAA+C;QAC3D,WAAW,EAAE,4CAA4C;QACzD,SAAS,EAAE,oCAAoC;QAC/C,QAAQ,EAAE,mCAAmC;QAC7C,cAAc,EAAE,iDAAiD;QACjE,WAAW,EAAE,iCAAiC;QAC9C,SAAS,EAAE,uCAAuC;KACnD;CACF,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE;KACnC,QAAQ,CAAC,2CAA2C,CAAC;KACrD,IAAI,CAAC;IACJ,QAAQ,EAAE,CAAC,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC;CACnF,CAAC,CAAA;AAEJ,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,EAAE;KACnC,QAAQ,CAAC,qDAAqD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Root":"","sources":["../../src/safe.ts"],"names":[],"mappings":"AAcA,MAAM,CAAC,MAAM,IAAI,GAAG,CAAI,EAAW,EAAiB,EAAE;IACpD,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,EAAE,EAAE,CAAA;QACjB,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,IAAI;SACZ,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACjE,CAAA;IACH,CAAC;AACH,CAAC,CAAA;AAED,MAAM,CAAC,MAAM,SAAS,GAAG,KAAK,EAAK,EAAoB,EAA0B,EAAE;IACjF,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,MAAM,EAAE,EAAE,CAAA;QACvB,OAAO;YACL,IAAI;YACJ,KAAK,EAAE,IAAI;SACZ,CAAA;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,OAAO;YACL,IAAI,EAAE,IAAI;YACV,KAAK,EAAE,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;SACjE,CAAA;IACH,CAAC;AACH,CAAC,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export declare const DEONTIC_STRENGTHS: string;
|
|
2
|
+
export declare const NEGATION_SIGNALS: string;
|
|
3
|
+
export declare const MODE_FORMATS: string;
|
|
4
|
+
export declare const PARSE_RULES_PARAM: string;
|
|
5
|
+
export declare const FORMAT_RULES_PARAM: string;
|
|
6
|
+
export declare const MODE_PARAM = "verbose | balanced | concise. Default: balanced.";
|
|
7
|
+
export declare const PARSE_PROMPT_PARAM: string;
|
|
8
|
+
//# sourceMappingURL=descriptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptions.d.ts","sourceRoot":"","sources":["../../../src/tools/descriptions.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,iBAAiB,QAQlB,CAAA;AAKZ,eAAO,MAAM,gBAAgB,QAIjB,CAAA;AAKZ,eAAO,MAAM,YAAY,QAWb,CAAA;AAIZ,eAAO,MAAM,iBAAiB,QAIlB,CAAA;AAEZ,eAAO,MAAM,kBAAkB,QAGnB,CAAA;AAEZ,eAAO,MAAM,UAAU,qDAAqD,CAAA;AAE5E,eAAO,MAAM,kBAAkB,QAGnB,CAAA"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { promptSchemaExample } from "../prompt-schema.js";
|
|
2
|
+
import { formatSchemaExample, parseSchemaExample } from "../rule-schema.js";
|
|
3
|
+
// Deontic logic: the 7 modal strengths and their natural language expression.
|
|
4
|
+
// Defined once, composed into tool descriptions that need them.
|
|
5
|
+
export const DEONTIC_STRENGTHS = [
|
|
6
|
+
'obligatory -> positive imperative: "use consistent whitespace"',
|
|
7
|
+
'forbidden -> negate with "do not": "do not use non-null assertions"',
|
|
8
|
+
'permissible -> prefix with "may": "may use type assertions when necessary"',
|
|
9
|
+
'optional -> prefix with "may choose to": "may choose to add commit body"',
|
|
10
|
+
'supererogatory -> prefix with "ideally": "ideally provide comprehensive documentation"',
|
|
11
|
+
'indifferent -> prefix with "either way is fine": "either way is fine for naming style"',
|
|
12
|
+
'omissible -> prefix with "may omit": "may omit post-task explanations"',
|
|
13
|
+
].join('\n');
|
|
14
|
+
// Speech act detection: how to map natural language directive signals to deontic strength.
|
|
15
|
+
// Used by parse-rules to classify input.
|
|
16
|
+
export const NEGATION_SIGNALS = [
|
|
17
|
+
'"avoid", "never", "do not", "don\'t", "no" -> forbidden',
|
|
18
|
+
'"always", "must", "should", "ensure" -> obligatory',
|
|
19
|
+
'"may", "can", "optionally" -> permissible',
|
|
20
|
+
].join('\n');
|
|
21
|
+
// Mode format templates: what each formatting mode produces.
|
|
22
|
+
// Used by format-rules to know the output shape per mode.
|
|
23
|
+
export const MODE_FORMATS = [
|
|
24
|
+
'verbose: every rule gets Rule + Reason lines.',
|
|
25
|
+
' Rule: <directive>',
|
|
26
|
+
' Reason: <justification>',
|
|
27
|
+
'',
|
|
28
|
+
'balanced (default): include Reason only when non-obvious.',
|
|
29
|
+
' Rule: <directive>',
|
|
30
|
+
' Reason: <justification if needed>',
|
|
31
|
+
'',
|
|
32
|
+
'concise: bullet list, no reasons.',
|
|
33
|
+
' - <directive>',
|
|
34
|
+
].join('\n');
|
|
35
|
+
// Parameter shape descriptions. These describe the JSON value, not the LLM's role.
|
|
36
|
+
export const PARSE_RULES_PARAM = [
|
|
37
|
+
'JSON with "rules" array of parsed rule objects.',
|
|
38
|
+
'Each rule: { strength, action, target, context?, reason }',
|
|
39
|
+
'Example: ' + parseSchemaExample,
|
|
40
|
+
].join('\n');
|
|
41
|
+
export const FORMAT_RULES_PARAM = [
|
|
42
|
+
'JSON with "rules" array of formatted rule strings.',
|
|
43
|
+
'Example: ' + formatSchemaExample,
|
|
44
|
+
].join('\n');
|
|
45
|
+
export const MODE_PARAM = 'verbose | balanced | concise. Default: balanced.';
|
|
46
|
+
export const PARSE_PROMPT_PARAM = [
|
|
47
|
+
'JSON with "tasks" array. Each task: { intent, targets, constraints, context?, subtasks }',
|
|
48
|
+
'Example: ' + promptSchemaExample,
|
|
49
|
+
].join('\n');
|
|
50
|
+
//# sourceMappingURL=descriptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"descriptions.js","sourceRoot":"","sources":["../../../src/tools/descriptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAA;AAE3E,8EAA8E;AAC9E,gEAAgE;AAEhE,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,gEAAgE;IAChE,qEAAqE;IACrE,4EAA4E;IAC5E,0EAA0E;IAC1E,wFAAwF;IACxF,wFAAwF;IACxF,wEAAwE;CACzE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAEZ,2FAA2F;AAC3F,yCAAyC;AAEzC,MAAM,CAAC,MAAM,gBAAgB,GAAG;IAC9B,yDAAyD;IACzD,oDAAoD;IACpD,2CAA2C;CAC5C,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAEZ,6DAA6D;AAC7D,0DAA0D;AAE1D,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,+CAA+C;IAC/C,qBAAqB;IACrB,2BAA2B;IAC3B,EAAE;IACF,2DAA2D;IAC3D,qBAAqB;IACrB,qCAAqC;IACrC,EAAE;IACF,mCAAmC;IACnC,iBAAiB;CAClB,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAEZ,mFAAmF;AAEnF,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,iDAAiD;IACjD,2DAA2D;IAC3D,WAAW,GAAG,kBAAkB;CACjC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAEZ,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,oDAAoD;IACpD,WAAW,GAAG,mBAAmB;CAClC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;AAEZ,MAAM,CAAC,MAAM,UAAU,GAAG,kDAAkD,CAAA;AAE5E,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAChC,0FAA0F;IAC1F,WAAW,GAAG,mBAAmB;CAClC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
2
|
+
type ParsePromptToolOptions = {
|
|
3
|
+
description: string;
|
|
4
|
+
};
|
|
5
|
+
export declare const createParsePromptTool: (options: ParsePromptToolOptions) => {
|
|
6
|
+
description: string;
|
|
7
|
+
args: {
|
|
8
|
+
tasks: import("zod").ZodString;
|
|
9
|
+
};
|
|
10
|
+
execute(args: {
|
|
11
|
+
tasks: string;
|
|
12
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
13
|
+
};
|
|
14
|
+
type FormatPromptToolOptions = {
|
|
15
|
+
client: PluginInput['client'];
|
|
16
|
+
description: string;
|
|
17
|
+
};
|
|
18
|
+
export declare const createFormatPromptTool: (options: FormatPromptToolOptions) => {
|
|
19
|
+
description: string;
|
|
20
|
+
args: {
|
|
21
|
+
tasks: import("zod").ZodString;
|
|
22
|
+
};
|
|
23
|
+
execute(args: {
|
|
24
|
+
tasks: string;
|
|
25
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../../src/tools/prompts.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAUtD,KAAK,sBAAsB,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,SAAS,sBAAsB;;;;;;;;CAepE,CAAA;AAID,KAAK,uBAAuB,GAAG;IAC7B,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,sBAAsB,GAAI,SAAS,uBAAuB;;;;;;;;CA0BtE,CAAA"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { tool } from '@opencode-ai/plugin';
|
|
2
|
+
import { formatPrompt } from "../format-prompt.js";
|
|
3
|
+
import { sendResult } from "../opencode/notify.js";
|
|
4
|
+
import { ParsedPromptSchema } from "../prompt-schema.js";
|
|
5
|
+
import { formatValidationError, validateJson } from "../validate.js";
|
|
6
|
+
import { PARSE_PROMPT_PARAM } from "./descriptions.js";
|
|
7
|
+
export const createParsePromptTool = (options) => {
|
|
8
|
+
return tool({
|
|
9
|
+
description: options.description,
|
|
10
|
+
args: {
|
|
11
|
+
tasks: tool.schema.string().describe(PARSE_PROMPT_PARAM),
|
|
12
|
+
},
|
|
13
|
+
async execute(args) {
|
|
14
|
+
const validated = validateJson(args.tasks, ParsedPromptSchema);
|
|
15
|
+
if (validated.error !== null) {
|
|
16
|
+
return formatValidationError(validated);
|
|
17
|
+
}
|
|
18
|
+
return JSON.stringify(validated.data, null, 2);
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export const createFormatPromptTool = (options) => {
|
|
23
|
+
return tool({
|
|
24
|
+
description: options.description,
|
|
25
|
+
args: {
|
|
26
|
+
tasks: tool.schema.string().describe(PARSE_PROMPT_PARAM),
|
|
27
|
+
},
|
|
28
|
+
async execute(args, context) {
|
|
29
|
+
const validated = validateJson(args.tasks, ParsedPromptSchema);
|
|
30
|
+
if (validated.error !== null) {
|
|
31
|
+
return formatValidationError(validated);
|
|
32
|
+
}
|
|
33
|
+
const formatted = formatPrompt(validated.data);
|
|
34
|
+
if (formatted.length === 0) {
|
|
35
|
+
return 'No tasks found in the parsed input';
|
|
36
|
+
}
|
|
37
|
+
await sendResult({
|
|
38
|
+
client: options.client,
|
|
39
|
+
sessionID: context.sessionID,
|
|
40
|
+
text: formatted,
|
|
41
|
+
});
|
|
42
|
+
return 'Formatted prompt displayed in chat.';
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../../src/tools/prompts.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,IAAI,EAAE,MAAM,qBAAqB,CAAA;AAC1C,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB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I,EAAE,CAAC;gBAC7B,OAAO,qBAAqB,CAAC,SAAS,CAAC,CAAA;YACzC,CAAC;YAED,MAAM,SAAS,GAAG,YAAY,CAAC,SAAS,CAAC,IAAI,CAAC,CAAA;YAC9C,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;gBAC3B,OAAO,oCAAoC,CAAA;YAC7C,CAAC;YAED,MAAM,UAAU,CAAC;gBACf,MAAM,EAAE,OAAO,CAAC,MAAM;gBACtB,SAAS,EAAE,OAAO,CAAC,SAAS;gBAC5B,IAAI,EAAE,SAAS;aAChB,CAAC,CAAA;YAEF,OAAO,qCAAqC,CAAA;QAC9C,CAAC;KACF,CAAC,CAAA;AACJ,CAAC,CAAA"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { PluginInput } from '@opencode-ai/plugin';
|
|
1
2
|
type DiscoverToolOptions = {
|
|
2
3
|
description: string;
|
|
3
4
|
directory: string;
|
|
@@ -12,57 +13,63 @@ export declare const createDiscoverTool: (options: DiscoverToolOptions) => {
|
|
|
12
13
|
files?: string | undefined;
|
|
13
14
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
14
15
|
};
|
|
15
|
-
type
|
|
16
|
+
type ParseRulesToolOptions = {
|
|
16
17
|
description: string;
|
|
17
|
-
directory: string;
|
|
18
|
-
discovered: Set<string>;
|
|
19
18
|
};
|
|
20
|
-
export declare const
|
|
19
|
+
export declare const createParseRulesTool: (options: ParseRulesToolOptions) => {
|
|
20
|
+
description: string;
|
|
21
|
+
args: {
|
|
22
|
+
rules: import("zod").ZodString;
|
|
23
|
+
};
|
|
24
|
+
execute(args: {
|
|
25
|
+
rules: string;
|
|
26
|
+
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
27
|
+
};
|
|
28
|
+
type FormatRulesToolOptions = {
|
|
29
|
+
description: string;
|
|
30
|
+
};
|
|
31
|
+
export declare const createFormatRulesTool: (options: FormatRulesToolOptions) => {
|
|
21
32
|
description: string;
|
|
22
33
|
args: {
|
|
23
34
|
rules: import("zod").ZodString;
|
|
24
35
|
mode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
25
|
-
files: import("zod").ZodOptional<import("zod").ZodString>;
|
|
26
36
|
};
|
|
27
37
|
execute(args: {
|
|
28
38
|
rules: string;
|
|
29
39
|
mode?: string | undefined;
|
|
30
|
-
files?: string | undefined;
|
|
31
40
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
32
41
|
};
|
|
33
|
-
type
|
|
42
|
+
type WriteToolOptions = {
|
|
43
|
+
client: PluginInput['client'];
|
|
34
44
|
description: string;
|
|
35
45
|
directory: string;
|
|
36
46
|
discovered: Set<string>;
|
|
37
47
|
};
|
|
38
|
-
export declare const
|
|
48
|
+
export declare const createRewriteTool: (options: WriteToolOptions) => {
|
|
39
49
|
description: string;
|
|
40
50
|
args: {
|
|
41
|
-
input: import("zod").ZodString;
|
|
42
51
|
rules: import("zod").ZodString;
|
|
43
|
-
|
|
52
|
+
files: import("zod").ZodOptional<import("zod").ZodString>;
|
|
44
53
|
mode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
45
54
|
};
|
|
46
55
|
execute(args: {
|
|
47
|
-
input: string;
|
|
48
56
|
rules: string;
|
|
49
|
-
|
|
57
|
+
files?: string | undefined;
|
|
50
58
|
mode?: string | undefined;
|
|
51
59
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
52
60
|
};
|
|
53
|
-
|
|
54
|
-
description: string;
|
|
55
|
-
};
|
|
56
|
-
export declare const createRefineTool: (options: RefineToolOptions) => {
|
|
61
|
+
export declare const createAddTool: (options: WriteToolOptions) => {
|
|
57
62
|
description: string;
|
|
58
63
|
args: {
|
|
59
|
-
|
|
60
|
-
|
|
64
|
+
rules: import("zod").ZodString;
|
|
65
|
+
file: import("zod").ZodOptional<import("zod").ZodString>;
|
|
66
|
+
mode: import("zod").ZodOptional<import("zod").ZodString>;
|
|
61
67
|
};
|
|
62
68
|
execute(args: {
|
|
63
|
-
|
|
64
|
-
|
|
69
|
+
rules: string;
|
|
70
|
+
file?: string | undefined;
|
|
71
|
+
mode?: string | undefined;
|
|
65
72
|
}, context: import("@opencode-ai/plugin").ToolContext): Promise<string>;
|
|
66
73
|
};
|
|
67
74
|
export {};
|
|
68
|
-
//# sourceMappingURL=
|
|
75
|
+
//# sourceMappingURL=rules.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rules.d.ts","sourceRoot":"","sources":["../../../src/tools/rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AAatD,KAAK,mBAAmB,GAAG;IACzB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,kBAAkB,GAAI,SAAS,mBAAmB;;;;;;;;CAsC9D,CAAA;AAID,KAAK,qBAAqB,GAAG;IAC3B,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,oBAAoB,GAAI,SAAS,qBAAqB;;;;;;;;CAelE,CAAA;AAID,KAAK,sBAAsB,GAAG;IAC5B,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,SAAS,sBAAsB;;;;;;;;;;CAgBpE,CAAA;AAID,KAAK,gBAAgB,GAAG;IACtB,MAAM,EAAE,WAAW,CAAC,QAAQ,CAAC,CAAA;IAC7B,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,UAAU,EAAE,GAAG,CAAC,MAAM,CAAC,CAAA;CACxB,CAAA;AAED,eAAO,MAAM,iBAAiB,GAAI,SAAS,gBAAgB;;;;;;;;;;;;CAmD1D,CAAA;AAID,eAAO,MAAM,aAAa,GAAI,SAAS,gBAAgB;;;;;;;;;;;;CAwDtD,CAAA"}
|