@digi4care/omo-slim-decision-layer 0.2.2 → 0.3.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/README.md +12 -4
- package/dist/index.d.ts +3 -2
- package/dist/index.js +53 -2
- package/dist/v2/setup.d.ts +27 -0
- package/package.json +3 -2
- package/dist/src/config.d.ts +0 -6
- package/dist/src/hooks/interview-inject.d.ts +0 -2
- package/dist/src/index.d.ts +0 -6
- package/dist/src/model/record.d.ts +0 -320
- package/dist/src/prompts/decision-discipline.d.ts +0 -1
- package/dist/src/register/register.d.ts +0 -144
- package/dist/src/schema/generate.d.ts +0 -1
- package/dist/src/tools/index.d.ts +0 -4
- package/dist/src/tools/paths.d.ts +0 -16
package/README.md
CHANGED
|
@@ -27,6 +27,16 @@ Built as a companion plugin for
|
|
|
27
27
|
- **Traceability** — typed links (`refines`, `depends_on`, `constrains`,
|
|
28
28
|
`relates_to`) between records, with queries for orphans and reverse lookup.
|
|
29
29
|
|
|
30
|
+
## Compatibility
|
|
31
|
+
|
|
32
|
+
One package, two registration paths, sharing the same register and tool logic:
|
|
33
|
+
|
|
34
|
+
- **v1** (`@opencode-ai/plugin` 1.x): the default export provides a v1 `server`
|
|
35
|
+
that registers the nine tools and the `command.execute.before` hook.
|
|
36
|
+
- **v2** (`@opencode/plugin` 2.x): the same default export also provides a v2
|
|
37
|
+
`setup` that registers the tools via `ctx.tool.transform` and injects the
|
|
38
|
+
prompt via `ctx.session.hook('prompt')`.
|
|
39
|
+
|
|
30
40
|
## Agent tools
|
|
31
41
|
|
|
32
42
|
| Tool | Purpose |
|
|
@@ -54,10 +64,8 @@ Add the plugin to your OpenCode config:
|
|
|
54
64
|
OpenCode installs the plugin automatically from npm on the next start. To pin
|
|
55
65
|
a version, replace `@latest` with a specific version (e.g. `@0.2.1`).
|
|
56
66
|
|
|
57
|
-
**Local development
|
|
58
|
-
|
|
59
|
-
that exist on npm; for a local or private build, reference the built file
|
|
60
|
-
directly instead:
|
|
67
|
+
**Local development.** For a local or private build, reference the built file
|
|
68
|
+
directly instead of a package name:
|
|
61
69
|
|
|
62
70
|
```jsonc
|
|
63
71
|
{
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Plugin } from '@opencode-ai/plugin';
|
|
2
|
-
declare const
|
|
2
|
+
declare const pluginModule: {
|
|
3
3
|
id: string;
|
|
4
4
|
server: Plugin;
|
|
5
|
+
setup: (ctx: import("./v2/setup").V2Context) => Promise<void>;
|
|
5
6
|
};
|
|
6
|
-
export default
|
|
7
|
+
export default pluginModule;
|
package/dist/index.js
CHANGED
|
@@ -4307,6 +4307,55 @@ function createDecisionTools() {
|
|
|
4307
4307
|
};
|
|
4308
4308
|
}
|
|
4309
4309
|
|
|
4310
|
+
// src/v2/setup.ts
|
|
4311
|
+
import { z as z5 } from "zod";
|
|
4312
|
+
var INTERVIEW_MARKER = "You are running an interview q&a session for the user inside their repository";
|
|
4313
|
+
var SENTINEL2 = "<!-- decision-layer:inject v1 -->";
|
|
4314
|
+
function isRecord(value) {
|
|
4315
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
4316
|
+
}
|
|
4317
|
+
function createV2Setup() {
|
|
4318
|
+
return async (ctx) => {
|
|
4319
|
+
const projectDir = ctx.location.directory;
|
|
4320
|
+
const tools = createDecisionTools();
|
|
4321
|
+
await ctx.tool.transform((editor) => {
|
|
4322
|
+
for (const [name, definition] of Object.entries(tools)) {
|
|
4323
|
+
editor.add({
|
|
4324
|
+
name,
|
|
4325
|
+
description: definition.description,
|
|
4326
|
+
input: z5.object(definition.args),
|
|
4327
|
+
execute: async (input, toolContext) => {
|
|
4328
|
+
const v1Context = {
|
|
4329
|
+
...isRecord(toolContext) ? toolContext : {},
|
|
4330
|
+
worktree: projectDir,
|
|
4331
|
+
directory: projectDir
|
|
4332
|
+
};
|
|
4333
|
+
const result = await definition.execute(input, v1Context);
|
|
4334
|
+
return { content: result };
|
|
4335
|
+
}
|
|
4336
|
+
});
|
|
4337
|
+
}
|
|
4338
|
+
});
|
|
4339
|
+
await ctx.session.hook("prompt", async (event) => {
|
|
4340
|
+
try {
|
|
4341
|
+
if (!isRecord(event))
|
|
4342
|
+
return;
|
|
4343
|
+
const prompt = event.prompt;
|
|
4344
|
+
if (!isRecord(prompt) || typeof prompt.text !== "string")
|
|
4345
|
+
return;
|
|
4346
|
+
if (!prompt.text.includes(INTERVIEW_MARKER))
|
|
4347
|
+
return;
|
|
4348
|
+
if (prompt.text.includes(SENTINEL2))
|
|
4349
|
+
return;
|
|
4350
|
+
prompt.text = `${prompt.text}
|
|
4351
|
+
|
|
4352
|
+
${SENTINEL2}
|
|
4353
|
+
${DECISION_DISCIPLINE_PROMPT}`;
|
|
4354
|
+
} catch {}
|
|
4355
|
+
});
|
|
4356
|
+
};
|
|
4357
|
+
}
|
|
4358
|
+
|
|
4310
4359
|
// src/index.ts
|
|
4311
4360
|
var DecisionLayer = async () => {
|
|
4312
4361
|
const hooks = {
|
|
@@ -4315,10 +4364,12 @@ var DecisionLayer = async () => {
|
|
|
4315
4364
|
};
|
|
4316
4365
|
return hooks;
|
|
4317
4366
|
};
|
|
4318
|
-
var
|
|
4367
|
+
var pluginModule = {
|
|
4319
4368
|
id: "omo-slim-decision-layer",
|
|
4320
|
-
server: DecisionLayer
|
|
4369
|
+
server: DecisionLayer,
|
|
4370
|
+
setup: createV2Setup()
|
|
4321
4371
|
};
|
|
4372
|
+
var src_default = pluginModule;
|
|
4322
4373
|
export {
|
|
4323
4374
|
src_default as default
|
|
4324
4375
|
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* v2 registration path, next to the v1 `server` export.
|
|
3
|
+
*
|
|
4
|
+
* Differences that matter for v2 (verified against @opencode/plugin 2.0.29):
|
|
5
|
+
* - tools are registered via `ctx.tool.transform` with a full input schema
|
|
6
|
+
* (zod object) instead of a raw args shape;
|
|
7
|
+
* - the tool context has no `worktree`/`directory`, so the project root is
|
|
8
|
+
* captured from `ctx.location.directory` at setup time and closed over;
|
|
9
|
+
* - the interview injection uses `ctx.session.hook('prompt')` and mutates the
|
|
10
|
+
* outgoing prompt instead of appending to `command.execute.before` parts.
|
|
11
|
+
*/
|
|
12
|
+
interface V2TransformEditor {
|
|
13
|
+
add: (tool: unknown) => void;
|
|
14
|
+
}
|
|
15
|
+
export interface V2Context {
|
|
16
|
+
location: {
|
|
17
|
+
directory: string;
|
|
18
|
+
};
|
|
19
|
+
tool: {
|
|
20
|
+
transform: (callback: (editor: V2TransformEditor) => void) => Promise<unknown>;
|
|
21
|
+
};
|
|
22
|
+
session: {
|
|
23
|
+
hook: (name: string, callback: (event: unknown) => Promise<void> | void) => Promise<unknown>;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export declare function createV2Setup(): (ctx: V2Context) => Promise<void>;
|
|
27
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@digi4care/omo-slim-decision-layer",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Git-native decision register for OpenCode: typed records (REQ/CONSTRAINT/ASSUMPTION/DEC), owner ratification and traceability, as a companion plugin for oh-my-opencode-slim",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
"README.md"
|
|
46
46
|
],
|
|
47
47
|
"scripts": {
|
|
48
|
-
"build": "bun build src/index.ts --outdir dist --target node --format esm --external @opencode-ai/plugin --external zod && tsc --emitDeclarationOnly",
|
|
48
|
+
"build": "rm -rf dist && bun build src/index.ts --outdir dist --target node --format esm --external @opencode-ai/plugin --external zod && tsc --emitDeclarationOnly",
|
|
49
49
|
"test": "bun test",
|
|
50
50
|
"typecheck": "tsc --noEmit",
|
|
51
51
|
"lint": "biome lint .",
|
|
@@ -64,6 +64,7 @@
|
|
|
64
64
|
"devDependencies": {
|
|
65
65
|
"@biomejs/biome": "2.5.15",
|
|
66
66
|
"@opencode-ai/plugin": "1.18.35",
|
|
67
|
+
"@opencode/plugin": "^2.0.29",
|
|
67
68
|
"bun-types": "^1.4.2",
|
|
68
69
|
"typescript": "^7.0.2"
|
|
69
70
|
},
|
package/dist/src/config.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const ConfigSchema: z.ZodObject<{
|
|
3
|
-
registerPath: z.ZodDefault<z.ZodString>;
|
|
4
|
-
}, z.core.$strip>;
|
|
5
|
-
export type DecisionLayerConfig = z.infer<typeof ConfigSchema>;
|
|
6
|
-
export declare function loadConfig(worktree: string): DecisionLayerConfig;
|
package/dist/src/index.d.ts
DELETED
|
@@ -1,320 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
export declare const RecordTypes: readonly ['REQ', 'CONSTRAINT', 'ASSUMPTION', 'DEC'];
|
|
3
|
-
export type RecordType = (typeof RecordTypes)[number];
|
|
4
|
-
export declare const RecordStatuses: readonly ['proposed', 'accepted', 'rejected', 'superseded'];
|
|
5
|
-
export type RecordStatus = (typeof RecordStatuses)[number];
|
|
6
|
-
export declare const LinkRelations: readonly ['refines', 'depends_on', 'constrains', 'relates_to'];
|
|
7
|
-
export type LinkRelation = (typeof LinkRelations)[number];
|
|
8
|
-
export declare function recordIdPattern(type: RecordType): RegExp;
|
|
9
|
-
export declare const RecordId: z.ZodString;
|
|
10
|
-
export type RecordId = z.infer<typeof RecordId>;
|
|
11
|
-
export declare const LinkSchema: z.ZodObject<{
|
|
12
|
-
type: z.ZodEnum<{
|
|
13
|
-
constrains: "constrains";
|
|
14
|
-
depends_on: "depends_on";
|
|
15
|
-
refines: "refines";
|
|
16
|
-
relates_to: "relates_to";
|
|
17
|
-
}>;
|
|
18
|
-
target: z.ZodString;
|
|
19
|
-
rationale: z.ZodString;
|
|
20
|
-
}, z.core.$strip>;
|
|
21
|
-
export type Link = z.infer<typeof LinkSchema>;
|
|
22
|
-
export declare const ReqRecordSchema: z.ZodObject<{
|
|
23
|
-
schema_version: z.ZodLiteral<"1.0">;
|
|
24
|
-
title: z.ZodString;
|
|
25
|
-
status: z.ZodEnum<{
|
|
26
|
-
accepted: "accepted";
|
|
27
|
-
proposed: "proposed";
|
|
28
|
-
rejected: "rejected";
|
|
29
|
-
superseded: "superseded";
|
|
30
|
-
}>;
|
|
31
|
-
owner: z.ZodString;
|
|
32
|
-
change_authority: z.ZodString;
|
|
33
|
-
supersedes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
34
|
-
status_reason: z.ZodOptional<z.ZodString>;
|
|
35
|
-
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
36
|
-
type: z.ZodEnum<{
|
|
37
|
-
constrains: "constrains";
|
|
38
|
-
depends_on: "depends_on";
|
|
39
|
-
refines: "refines";
|
|
40
|
-
relates_to: "relates_to";
|
|
41
|
-
}>;
|
|
42
|
-
target: z.ZodString;
|
|
43
|
-
rationale: z.ZodString;
|
|
44
|
-
}, z.core.$strip>>>;
|
|
45
|
-
type: z.ZodLiteral<"REQ">;
|
|
46
|
-
id: z.ZodString;
|
|
47
|
-
}, z.core.$strip>;
|
|
48
|
-
export declare const ConstraintRecordSchema: z.ZodObject<{
|
|
49
|
-
schema_version: z.ZodLiteral<"1.0">;
|
|
50
|
-
title: z.ZodString;
|
|
51
|
-
status: z.ZodEnum<{
|
|
52
|
-
accepted: "accepted";
|
|
53
|
-
proposed: "proposed";
|
|
54
|
-
rejected: "rejected";
|
|
55
|
-
superseded: "superseded";
|
|
56
|
-
}>;
|
|
57
|
-
owner: z.ZodString;
|
|
58
|
-
change_authority: z.ZodString;
|
|
59
|
-
supersedes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
60
|
-
status_reason: z.ZodOptional<z.ZodString>;
|
|
61
|
-
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
62
|
-
type: z.ZodEnum<{
|
|
63
|
-
constrains: "constrains";
|
|
64
|
-
depends_on: "depends_on";
|
|
65
|
-
refines: "refines";
|
|
66
|
-
relates_to: "relates_to";
|
|
67
|
-
}>;
|
|
68
|
-
target: z.ZodString;
|
|
69
|
-
rationale: z.ZodString;
|
|
70
|
-
}, z.core.$strip>>>;
|
|
71
|
-
type: z.ZodLiteral<"CONSTRAINT">;
|
|
72
|
-
id: z.ZodString;
|
|
73
|
-
}, z.core.$strip>;
|
|
74
|
-
export declare const AssumptionRecordSchema: z.ZodObject<{
|
|
75
|
-
schema_version: z.ZodLiteral<"1.0">;
|
|
76
|
-
title: z.ZodString;
|
|
77
|
-
status: z.ZodEnum<{
|
|
78
|
-
accepted: "accepted";
|
|
79
|
-
proposed: "proposed";
|
|
80
|
-
rejected: "rejected";
|
|
81
|
-
superseded: "superseded";
|
|
82
|
-
}>;
|
|
83
|
-
owner: z.ZodString;
|
|
84
|
-
change_authority: z.ZodString;
|
|
85
|
-
supersedes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
86
|
-
status_reason: z.ZodOptional<z.ZodString>;
|
|
87
|
-
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
88
|
-
type: z.ZodEnum<{
|
|
89
|
-
constrains: "constrains";
|
|
90
|
-
depends_on: "depends_on";
|
|
91
|
-
refines: "refines";
|
|
92
|
-
relates_to: "relates_to";
|
|
93
|
-
}>;
|
|
94
|
-
target: z.ZodString;
|
|
95
|
-
rationale: z.ZodString;
|
|
96
|
-
}, z.core.$strip>>>;
|
|
97
|
-
type: z.ZodLiteral<"ASSUMPTION">;
|
|
98
|
-
id: z.ZodString;
|
|
99
|
-
needed_to_close: z.ZodString;
|
|
100
|
-
}, z.core.$strip>;
|
|
101
|
-
export declare const DecRecordSchema: z.ZodObject<{
|
|
102
|
-
schema_version: z.ZodLiteral<"1.0">;
|
|
103
|
-
title: z.ZodString;
|
|
104
|
-
status: z.ZodEnum<{
|
|
105
|
-
accepted: "accepted";
|
|
106
|
-
proposed: "proposed";
|
|
107
|
-
rejected: "rejected";
|
|
108
|
-
superseded: "superseded";
|
|
109
|
-
}>;
|
|
110
|
-
owner: z.ZodString;
|
|
111
|
-
change_authority: z.ZodString;
|
|
112
|
-
supersedes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
113
|
-
status_reason: z.ZodOptional<z.ZodString>;
|
|
114
|
-
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
115
|
-
type: z.ZodEnum<{
|
|
116
|
-
constrains: "constrains";
|
|
117
|
-
depends_on: "depends_on";
|
|
118
|
-
refines: "refines";
|
|
119
|
-
relates_to: "relates_to";
|
|
120
|
-
}>;
|
|
121
|
-
target: z.ZodString;
|
|
122
|
-
rationale: z.ZodString;
|
|
123
|
-
}, z.core.$strip>>>;
|
|
124
|
-
type: z.ZodLiteral<"DEC">;
|
|
125
|
-
id: z.ZodString;
|
|
126
|
-
decision: z.ZodString;
|
|
127
|
-
alternatives_rejected: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
128
|
-
alternative: z.ZodString;
|
|
129
|
-
rejected_because: z.ZodString;
|
|
130
|
-
}, z.core.$strip>>>;
|
|
131
|
-
consequences: z.ZodString;
|
|
132
|
-
}, z.core.$strip>;
|
|
133
|
-
export declare const RecordSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
134
|
-
schema_version: z.ZodLiteral<"1.0">;
|
|
135
|
-
title: z.ZodString;
|
|
136
|
-
status: z.ZodEnum<{
|
|
137
|
-
accepted: "accepted";
|
|
138
|
-
proposed: "proposed";
|
|
139
|
-
rejected: "rejected";
|
|
140
|
-
superseded: "superseded";
|
|
141
|
-
}>;
|
|
142
|
-
owner: z.ZodString;
|
|
143
|
-
change_authority: z.ZodString;
|
|
144
|
-
supersedes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
145
|
-
status_reason: z.ZodOptional<z.ZodString>;
|
|
146
|
-
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
147
|
-
type: z.ZodEnum<{
|
|
148
|
-
constrains: "constrains";
|
|
149
|
-
depends_on: "depends_on";
|
|
150
|
-
refines: "refines";
|
|
151
|
-
relates_to: "relates_to";
|
|
152
|
-
}>;
|
|
153
|
-
target: z.ZodString;
|
|
154
|
-
rationale: z.ZodString;
|
|
155
|
-
}, z.core.$strip>>>;
|
|
156
|
-
type: z.ZodLiteral<"REQ">;
|
|
157
|
-
id: z.ZodString;
|
|
158
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
159
|
-
schema_version: z.ZodLiteral<"1.0">;
|
|
160
|
-
title: z.ZodString;
|
|
161
|
-
status: z.ZodEnum<{
|
|
162
|
-
accepted: "accepted";
|
|
163
|
-
proposed: "proposed";
|
|
164
|
-
rejected: "rejected";
|
|
165
|
-
superseded: "superseded";
|
|
166
|
-
}>;
|
|
167
|
-
owner: z.ZodString;
|
|
168
|
-
change_authority: z.ZodString;
|
|
169
|
-
supersedes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
170
|
-
status_reason: z.ZodOptional<z.ZodString>;
|
|
171
|
-
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
172
|
-
type: z.ZodEnum<{
|
|
173
|
-
constrains: "constrains";
|
|
174
|
-
depends_on: "depends_on";
|
|
175
|
-
refines: "refines";
|
|
176
|
-
relates_to: "relates_to";
|
|
177
|
-
}>;
|
|
178
|
-
target: z.ZodString;
|
|
179
|
-
rationale: z.ZodString;
|
|
180
|
-
}, z.core.$strip>>>;
|
|
181
|
-
type: z.ZodLiteral<"CONSTRAINT">;
|
|
182
|
-
id: z.ZodString;
|
|
183
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
184
|
-
schema_version: z.ZodLiteral<"1.0">;
|
|
185
|
-
title: z.ZodString;
|
|
186
|
-
status: z.ZodEnum<{
|
|
187
|
-
accepted: "accepted";
|
|
188
|
-
proposed: "proposed";
|
|
189
|
-
rejected: "rejected";
|
|
190
|
-
superseded: "superseded";
|
|
191
|
-
}>;
|
|
192
|
-
owner: z.ZodString;
|
|
193
|
-
change_authority: z.ZodString;
|
|
194
|
-
supersedes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
195
|
-
status_reason: z.ZodOptional<z.ZodString>;
|
|
196
|
-
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
197
|
-
type: z.ZodEnum<{
|
|
198
|
-
constrains: "constrains";
|
|
199
|
-
depends_on: "depends_on";
|
|
200
|
-
refines: "refines";
|
|
201
|
-
relates_to: "relates_to";
|
|
202
|
-
}>;
|
|
203
|
-
target: z.ZodString;
|
|
204
|
-
rationale: z.ZodString;
|
|
205
|
-
}, z.core.$strip>>>;
|
|
206
|
-
type: z.ZodLiteral<"ASSUMPTION">;
|
|
207
|
-
id: z.ZodString;
|
|
208
|
-
needed_to_close: z.ZodString;
|
|
209
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
210
|
-
schema_version: z.ZodLiteral<"1.0">;
|
|
211
|
-
title: z.ZodString;
|
|
212
|
-
status: z.ZodEnum<{
|
|
213
|
-
accepted: "accepted";
|
|
214
|
-
proposed: "proposed";
|
|
215
|
-
rejected: "rejected";
|
|
216
|
-
superseded: "superseded";
|
|
217
|
-
}>;
|
|
218
|
-
owner: z.ZodString;
|
|
219
|
-
change_authority: z.ZodString;
|
|
220
|
-
supersedes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
221
|
-
status_reason: z.ZodOptional<z.ZodString>;
|
|
222
|
-
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
223
|
-
type: z.ZodEnum<{
|
|
224
|
-
constrains: "constrains";
|
|
225
|
-
depends_on: "depends_on";
|
|
226
|
-
refines: "refines";
|
|
227
|
-
relates_to: "relates_to";
|
|
228
|
-
}>;
|
|
229
|
-
target: z.ZodString;
|
|
230
|
-
rationale: z.ZodString;
|
|
231
|
-
}, z.core.$strip>>>;
|
|
232
|
-
type: z.ZodLiteral<"DEC">;
|
|
233
|
-
id: z.ZodString;
|
|
234
|
-
decision: z.ZodString;
|
|
235
|
-
alternatives_rejected: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
236
|
-
alternative: z.ZodString;
|
|
237
|
-
rejected_because: z.ZodString;
|
|
238
|
-
}, z.core.$strip>>>;
|
|
239
|
-
consequences: z.ZodString;
|
|
240
|
-
}, z.core.$strip>], "type">;
|
|
241
|
-
export type ReqRecord = z.infer<typeof ReqRecordSchema>;
|
|
242
|
-
export type ConstraintRecord = z.infer<typeof ConstraintRecordSchema>;
|
|
243
|
-
export type AssumptionRecord = z.infer<typeof AssumptionRecordSchema>;
|
|
244
|
-
export type DecRecord = z.infer<typeof DecRecordSchema>;
|
|
245
|
-
export type DecisionRecord = z.infer<typeof RecordSchema>;
|
|
246
|
-
export declare const AddRecordInputSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
247
|
-
title: z.ZodString;
|
|
248
|
-
owner: z.ZodOptional<z.ZodString>;
|
|
249
|
-
change_authority: z.ZodOptional<z.ZodString>;
|
|
250
|
-
supersedes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
251
|
-
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
252
|
-
type: z.ZodEnum<{
|
|
253
|
-
constrains: "constrains";
|
|
254
|
-
depends_on: "depends_on";
|
|
255
|
-
refines: "refines";
|
|
256
|
-
relates_to: "relates_to";
|
|
257
|
-
}>;
|
|
258
|
-
target: z.ZodString;
|
|
259
|
-
rationale: z.ZodString;
|
|
260
|
-
}, z.core.$strip>>>;
|
|
261
|
-
type: z.ZodLiteral<"REQ">;
|
|
262
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
263
|
-
title: z.ZodString;
|
|
264
|
-
owner: z.ZodOptional<z.ZodString>;
|
|
265
|
-
change_authority: z.ZodOptional<z.ZodString>;
|
|
266
|
-
supersedes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
267
|
-
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
268
|
-
type: z.ZodEnum<{
|
|
269
|
-
constrains: "constrains";
|
|
270
|
-
depends_on: "depends_on";
|
|
271
|
-
refines: "refines";
|
|
272
|
-
relates_to: "relates_to";
|
|
273
|
-
}>;
|
|
274
|
-
target: z.ZodString;
|
|
275
|
-
rationale: z.ZodString;
|
|
276
|
-
}, z.core.$strip>>>;
|
|
277
|
-
type: z.ZodLiteral<"CONSTRAINT">;
|
|
278
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
279
|
-
title: z.ZodString;
|
|
280
|
-
owner: z.ZodOptional<z.ZodString>;
|
|
281
|
-
change_authority: z.ZodOptional<z.ZodString>;
|
|
282
|
-
supersedes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
283
|
-
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
284
|
-
type: z.ZodEnum<{
|
|
285
|
-
constrains: "constrains";
|
|
286
|
-
depends_on: "depends_on";
|
|
287
|
-
refines: "refines";
|
|
288
|
-
relates_to: "relates_to";
|
|
289
|
-
}>;
|
|
290
|
-
target: z.ZodString;
|
|
291
|
-
rationale: z.ZodString;
|
|
292
|
-
}, z.core.$strip>>>;
|
|
293
|
-
type: z.ZodLiteral<"ASSUMPTION">;
|
|
294
|
-
needed_to_close: z.ZodString;
|
|
295
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
296
|
-
title: z.ZodString;
|
|
297
|
-
owner: z.ZodOptional<z.ZodString>;
|
|
298
|
-
change_authority: z.ZodOptional<z.ZodString>;
|
|
299
|
-
supersedes: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
300
|
-
links: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
301
|
-
type: z.ZodEnum<{
|
|
302
|
-
constrains: "constrains";
|
|
303
|
-
depends_on: "depends_on";
|
|
304
|
-
refines: "refines";
|
|
305
|
-
relates_to: "relates_to";
|
|
306
|
-
}>;
|
|
307
|
-
target: z.ZodString;
|
|
308
|
-
rationale: z.ZodString;
|
|
309
|
-
}, z.core.$strip>>>;
|
|
310
|
-
type: z.ZodLiteral<"DEC">;
|
|
311
|
-
decision: z.ZodString;
|
|
312
|
-
alternatives_rejected: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
313
|
-
alternative: z.ZodString;
|
|
314
|
-
rejected_because: z.ZodString;
|
|
315
|
-
}, z.core.$strip>>>;
|
|
316
|
-
consequences: z.ZodString;
|
|
317
|
-
}, z.core.$strip>], "type">;
|
|
318
|
-
export type AddRecordInput = z.infer<typeof AddRecordInputSchema>;
|
|
319
|
-
export declare function sortRecords(records: DecisionRecord[]): DecisionRecord[];
|
|
320
|
-
export declare function recordType(id: string): RecordType | undefined;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const DECISION_DISCIPLINE_PROMPT = "At the end of this interview, the outcome is not yet a decision. Record it in the decision register.\n\nRecord in `.decisions/register.yaml` (following `schema/register.schema.json`):\n- the problem as a requirement record;\n- what is fixed and non-negotiable as a constraint record;\n- every assumption you could not verify as an assumption record, with `needed_to_close`;\n- the decision itself as a decision record, with rejected alternatives and consequences.\n\n`.decisions/register.yaml` is the single source of truth. You call `decision-add` yourself to add records; do not write a second set of files next to the register. Always run `decision-validate` after writing. Only ratify (`decision-ratify`) when the user explicitly asks you to.";
|
|
@@ -1,144 +0,0 @@
|
|
|
1
|
-
import { z } from 'zod';
|
|
2
|
-
import { type AddRecordInput, type DecisionRecord } from '../model/record.js';
|
|
3
|
-
export interface Workspace {
|
|
4
|
-
id: string;
|
|
5
|
-
title: string;
|
|
6
|
-
owner: string;
|
|
7
|
-
change_authority: string;
|
|
8
|
-
}
|
|
9
|
-
export interface Register {
|
|
10
|
-
schema_version: '1.0';
|
|
11
|
-
workspace: Workspace;
|
|
12
|
-
records: DecisionRecord[];
|
|
13
|
-
}
|
|
14
|
-
export declare const WorkspaceSchema: z.ZodObject<{
|
|
15
|
-
id: z.ZodString;
|
|
16
|
-
title: z.ZodString;
|
|
17
|
-
owner: z.ZodString;
|
|
18
|
-
change_authority: z.ZodString;
|
|
19
|
-
}, z.core.$strip>;
|
|
20
|
-
export declare const RegisterSchema: z.ZodObject<{
|
|
21
|
-
schema_version: z.ZodLiteral<"1.0">;
|
|
22
|
-
workspace: z.ZodObject<{
|
|
23
|
-
id: z.ZodString;
|
|
24
|
-
title: z.ZodString;
|
|
25
|
-
owner: z.ZodString;
|
|
26
|
-
change_authority: z.ZodString;
|
|
27
|
-
}, z.core.$strip>;
|
|
28
|
-
records: z.ZodArray<z.ZodDiscriminatedUnion<[z.ZodObject<{
|
|
29
|
-
schema_version: z.ZodLiteral<"1.0">;
|
|
30
|
-
title: z.ZodString;
|
|
31
|
-
status: z.ZodEnum<{
|
|
32
|
-
accepted: "accepted";
|
|
33
|
-
proposed: "proposed";
|
|
34
|
-
rejected: "rejected";
|
|
35
|
-
superseded: "superseded";
|
|
36
|
-
}>;
|
|
37
|
-
owner: z.ZodString;
|
|
38
|
-
change_authority: z.ZodString;
|
|
39
|
-
supersedes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
40
|
-
status_reason: z.ZodOptional<z.ZodString>;
|
|
41
|
-
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
42
|
-
type: z.ZodEnum<{
|
|
43
|
-
constrains: "constrains";
|
|
44
|
-
depends_on: "depends_on";
|
|
45
|
-
refines: "refines";
|
|
46
|
-
relates_to: "relates_to";
|
|
47
|
-
}>;
|
|
48
|
-
target: z.ZodString;
|
|
49
|
-
rationale: z.ZodString;
|
|
50
|
-
}, z.core.$strip>>>;
|
|
51
|
-
type: z.ZodLiteral<"REQ">;
|
|
52
|
-
id: z.ZodString;
|
|
53
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
54
|
-
schema_version: z.ZodLiteral<"1.0">;
|
|
55
|
-
title: z.ZodString;
|
|
56
|
-
status: z.ZodEnum<{
|
|
57
|
-
accepted: "accepted";
|
|
58
|
-
proposed: "proposed";
|
|
59
|
-
rejected: "rejected";
|
|
60
|
-
superseded: "superseded";
|
|
61
|
-
}>;
|
|
62
|
-
owner: z.ZodString;
|
|
63
|
-
change_authority: z.ZodString;
|
|
64
|
-
supersedes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
65
|
-
status_reason: z.ZodOptional<z.ZodString>;
|
|
66
|
-
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
67
|
-
type: z.ZodEnum<{
|
|
68
|
-
constrains: "constrains";
|
|
69
|
-
depends_on: "depends_on";
|
|
70
|
-
refines: "refines";
|
|
71
|
-
relates_to: "relates_to";
|
|
72
|
-
}>;
|
|
73
|
-
target: z.ZodString;
|
|
74
|
-
rationale: z.ZodString;
|
|
75
|
-
}, z.core.$strip>>>;
|
|
76
|
-
type: z.ZodLiteral<"CONSTRAINT">;
|
|
77
|
-
id: z.ZodString;
|
|
78
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
79
|
-
schema_version: z.ZodLiteral<"1.0">;
|
|
80
|
-
title: z.ZodString;
|
|
81
|
-
status: z.ZodEnum<{
|
|
82
|
-
accepted: "accepted";
|
|
83
|
-
proposed: "proposed";
|
|
84
|
-
rejected: "rejected";
|
|
85
|
-
superseded: "superseded";
|
|
86
|
-
}>;
|
|
87
|
-
owner: z.ZodString;
|
|
88
|
-
change_authority: z.ZodString;
|
|
89
|
-
supersedes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
90
|
-
status_reason: z.ZodOptional<z.ZodString>;
|
|
91
|
-
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
92
|
-
type: z.ZodEnum<{
|
|
93
|
-
constrains: "constrains";
|
|
94
|
-
depends_on: "depends_on";
|
|
95
|
-
refines: "refines";
|
|
96
|
-
relates_to: "relates_to";
|
|
97
|
-
}>;
|
|
98
|
-
target: z.ZodString;
|
|
99
|
-
rationale: z.ZodString;
|
|
100
|
-
}, z.core.$strip>>>;
|
|
101
|
-
type: z.ZodLiteral<"ASSUMPTION">;
|
|
102
|
-
id: z.ZodString;
|
|
103
|
-
needed_to_close: z.ZodString;
|
|
104
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
105
|
-
schema_version: z.ZodLiteral<"1.0">;
|
|
106
|
-
title: z.ZodString;
|
|
107
|
-
status: z.ZodEnum<{
|
|
108
|
-
accepted: "accepted";
|
|
109
|
-
proposed: "proposed";
|
|
110
|
-
rejected: "rejected";
|
|
111
|
-
superseded: "superseded";
|
|
112
|
-
}>;
|
|
113
|
-
owner: z.ZodString;
|
|
114
|
-
change_authority: z.ZodString;
|
|
115
|
-
supersedes: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
116
|
-
status_reason: z.ZodOptional<z.ZodString>;
|
|
117
|
-
links: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
118
|
-
type: z.ZodEnum<{
|
|
119
|
-
constrains: "constrains";
|
|
120
|
-
depends_on: "depends_on";
|
|
121
|
-
refines: "refines";
|
|
122
|
-
relates_to: "relates_to";
|
|
123
|
-
}>;
|
|
124
|
-
target: z.ZodString;
|
|
125
|
-
rationale: z.ZodString;
|
|
126
|
-
}, z.core.$strip>>>;
|
|
127
|
-
type: z.ZodLiteral<"DEC">;
|
|
128
|
-
id: z.ZodString;
|
|
129
|
-
decision: z.ZodString;
|
|
130
|
-
alternatives_rejected: z.ZodDefault<z.ZodArray<z.ZodObject<{
|
|
131
|
-
alternative: z.ZodString;
|
|
132
|
-
rejected_because: z.ZodString;
|
|
133
|
-
}, z.core.$strip>>>;
|
|
134
|
-
consequences: z.ZodString;
|
|
135
|
-
}, z.core.$strip>], "type">>;
|
|
136
|
-
}, z.core.$strip>;
|
|
137
|
-
export declare function readRegister(filePath: string): Register;
|
|
138
|
-
export declare function validateRegisterFile(filePath: string): void;
|
|
139
|
-
export declare function writeRegister(filePath: string, register: Register): void;
|
|
140
|
-
export declare function initRegister(filePath: string, workspace: Workspace): void;
|
|
141
|
-
export declare function addRecord(filePath: string, input: AddRecordInput): DecisionRecord;
|
|
142
|
-
export declare function ratifyRecord(filePath: string, id: string): DecisionRecord;
|
|
143
|
-
export declare function rejectRecord(filePath: string, id: string, reason?: string): DecisionRecord;
|
|
144
|
-
export declare function supersedeRecord(filePath: string, oldId: string, newRecordInput: AddRecordInput, reason?: string): DecisionRecord;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
export interface ProjectRootContext {
|
|
2
|
-
worktree?: string;
|
|
3
|
-
directory?: string;
|
|
4
|
-
}
|
|
5
|
-
/**
|
|
6
|
-
* Resolve the project root for all decision tools.
|
|
7
|
-
*
|
|
8
|
-
* Prefers `ctx.worktree` when it is a non-empty string, is not "/" (after
|
|
9
|
-
* resolution) and actually exists on disk; otherwise falls back to
|
|
10
|
-
* `ctx.directory`. Throws when no usable root exists so no tool ever reads or
|
|
11
|
-
* writes the register at "/" or at an empty path (SEC-001).
|
|
12
|
-
*/
|
|
13
|
-
export declare function resolveProjectRoot(ctx: ProjectRootContext): string;
|
|
14
|
-
export declare function withinWorktree(root: string, target: string): boolean;
|
|
15
|
-
export declare function resolveRegisterPath(root: string): string;
|
|
16
|
-
export declare function resolveToolPath(root: string, filePath: string): string;
|