opencode-codeops 2.2.1 → 2.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/CHANGELOG.md +38 -0
- package/README.md +53 -0
- package/_shared/discovery.md +92 -0
- package/_shared/zero-ambiguity-gate.md +4 -0
- package/bin/lib/discovery-rules.d.mts +228 -0
- package/bin/lib/discovery-rules.mjs +1213 -0
- package/bin/lib/discovery-server.d.mts +62 -0
- package/bin/lib/discovery-server.mjs +755 -0
- package/bin/lib/discovery-store.d.mts +224 -0
- package/bin/lib/discovery-store.mjs +1189 -0
- package/bin/lib/discovery-tools.d.mts +66 -0
- package/bin/lib/discovery-tools.mjs +540 -0
- package/discovery-ui/dist/assets/app.js +107 -0
- package/discovery-ui/dist/index.html +17 -0
- package/package.json +14 -2
- package/plugin/index.ts +45 -4
- package/schemas/codeops-config.schema.json +8 -0
- package/scripts/__pycache__/codeops_plan.cpython-314.pyc +0 -0
- package/scripts/__pycache__/install_agents.cpython-314.pyc +0 -0
- package/scripts/build-discovery-ui.mjs +59 -0
- package/skills/analyze-project/SKILL.md +19 -0
- package/skills/make-plan/SKILL.md +7 -1
- package/skills/preflight/SKILL.md +4 -0
- package/skills/preflight/report-format.md +4 -0
- package/scripts/__pycache__/codeops_plan.cpython-312.pyc +0 -0
- package/scripts/__pycache__/install_agents.cpython-312.pyc +0 -0
|
@@ -0,0 +1,224 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type declarations for the CodeOps Discovery store.
|
|
3
|
+
*
|
|
4
|
+
* The store is plain JavaScript so `node --test` can exercise it directly;
|
|
5
|
+
* these declarations give the TypeScript plugin entry point typed access.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import type { Answer, Defer, Missing, PlanCounts, Question } from "./discovery-rules.mjs"
|
|
9
|
+
|
|
10
|
+
/** A refusal to read or write Discovery data. */
|
|
11
|
+
export declare class DiscoveryDataError extends Error {
|
|
12
|
+
readonly code: "newer-version" | "unreadable"
|
|
13
|
+
constructor(code: "newer-version" | "unreadable", message: string)
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/** Resolve the Discovery data directory. */
|
|
17
|
+
export declare function resolveDataDir(
|
|
18
|
+
env?: Record<string, string | undefined>,
|
|
19
|
+
home?: string
|
|
20
|
+
): string
|
|
21
|
+
|
|
22
|
+
/** One checkout registered with Discovery. */
|
|
23
|
+
export interface ProjectRecord {
|
|
24
|
+
schemaVersion: number
|
|
25
|
+
slug: string
|
|
26
|
+
directory: string
|
|
27
|
+
name: string
|
|
28
|
+
branch: string | null
|
|
29
|
+
repository: { id: string; canonical: string; name: string }
|
|
30
|
+
createdAt: string
|
|
31
|
+
updatedAt: string
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
/** Aggregated question counts across a project's plans. */
|
|
35
|
+
export interface ProjectCounts extends PlanCounts {
|
|
36
|
+
plans: number
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/** A project with its aggregated counts. */
|
|
40
|
+
export interface ProjectSummary extends ProjectRecord {
|
|
41
|
+
counts: ProjectCounts
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/** The mutable state of one stored question. */
|
|
45
|
+
export interface StoredQuestionState {
|
|
46
|
+
answer: Answer | null
|
|
47
|
+
notes: string
|
|
48
|
+
defer: Defer | null
|
|
49
|
+
needsDiscussion: boolean
|
|
50
|
+
proposalDismissed: boolean
|
|
51
|
+
status: "open" | "submitted" | "recorded" | "retired"
|
|
52
|
+
changed: boolean
|
|
53
|
+
recordedAs: string | null
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** A stored question: the published content plus fingerprint and state. */
|
|
57
|
+
export interface StoredQuestion extends Question {
|
|
58
|
+
fingerprint: string
|
|
59
|
+
revisedAt: number
|
|
60
|
+
state: StoredQuestionState
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/** One answer captured in a submission. */
|
|
64
|
+
export interface SubmittedAnswer {
|
|
65
|
+
key: string
|
|
66
|
+
title: string
|
|
67
|
+
answer: Answer | null
|
|
68
|
+
source: "user" | "implied" | null
|
|
69
|
+
impliedBy: string[]
|
|
70
|
+
overridesImplied: boolean
|
|
71
|
+
notes: string
|
|
72
|
+
defer: Defer | null
|
|
73
|
+
needsDiscussion: false
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** A submitted group batch. */
|
|
77
|
+
export interface Submission {
|
|
78
|
+
id: number
|
|
79
|
+
at: string
|
|
80
|
+
groups: string[]
|
|
81
|
+
questions: SubmittedAnswer[]
|
|
82
|
+
claimedBy: { pid: number; at: string } | null
|
|
83
|
+
deliveredAt: string | null
|
|
84
|
+
deliveredTo: string | null
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
/** A stored group. */
|
|
88
|
+
export interface StoredGroup {
|
|
89
|
+
key: string
|
|
90
|
+
title: string
|
|
91
|
+
description?: string
|
|
92
|
+
dependsOn: string[]
|
|
93
|
+
submittedAt: string | null
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** A full plan record. */
|
|
97
|
+
export interface PlanRecord {
|
|
98
|
+
schemaVersion: number
|
|
99
|
+
slug: string
|
|
100
|
+
key: string
|
|
101
|
+
kind: string
|
|
102
|
+
artifact: string
|
|
103
|
+
title: string
|
|
104
|
+
owner: { sessionID: string } | null
|
|
105
|
+
orphaned: boolean
|
|
106
|
+
archived: boolean
|
|
107
|
+
unarchivedAt: string | null
|
|
108
|
+
revision: number
|
|
109
|
+
createdAt: string
|
|
110
|
+
updatedAt: string
|
|
111
|
+
groups: StoredGroup[]
|
|
112
|
+
questions: StoredQuestion[]
|
|
113
|
+
submissions: Submission[]
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** A plan summary for list views. */
|
|
117
|
+
export interface PlanSummary {
|
|
118
|
+
slug: string
|
|
119
|
+
kind: string
|
|
120
|
+
artifact: string
|
|
121
|
+
title: string
|
|
122
|
+
revision: number
|
|
123
|
+
archived: boolean
|
|
124
|
+
orphaned: boolean
|
|
125
|
+
updatedAt: string
|
|
126
|
+
counts: PlanCounts
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/** Pending delivery work for one plan. */
|
|
130
|
+
export interface PendingDeliveries {
|
|
131
|
+
planSlug: string
|
|
132
|
+
submissions: Submission[]
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
/** The store API. */
|
|
136
|
+
export interface DiscoveryStore {
|
|
137
|
+
registerProject(input: {
|
|
138
|
+
directory: string
|
|
139
|
+
branch: string | null
|
|
140
|
+
repository: { id: string; canonical: string }
|
|
141
|
+
}): Promise<ProjectRecord>
|
|
142
|
+
listProjects(): Promise<ProjectSummary[]>
|
|
143
|
+
getProject(slug: string): Promise<ProjectRecord | null>
|
|
144
|
+
findProjectByDirectory(directory: string): Promise<ProjectRecord | null>
|
|
145
|
+
listPlans(projectSlug: string): Promise<PlanSummary[]>
|
|
146
|
+
getPlan(projectSlug: string, planSlug: string): Promise<PlanRecord | null>
|
|
147
|
+
findPlan(projectSlug: string, kind: string, artifact: string): Promise<PlanRecord | null>
|
|
148
|
+
publish(
|
|
149
|
+
projectSlug: string,
|
|
150
|
+
payload: unknown,
|
|
151
|
+
sessionID: string
|
|
152
|
+
): Promise<
|
|
153
|
+
| { ok: true; plan: PlanRecord; warnings: string[] }
|
|
154
|
+
| { ok: false; reason: "invalid"; errors: string[] }
|
|
155
|
+
| { ok: false; reason: "owned"; owner: string }
|
|
156
|
+
>
|
|
157
|
+
saveAnswer(
|
|
158
|
+
projectSlug: string,
|
|
159
|
+
planSlug: string,
|
|
160
|
+
key: string,
|
|
161
|
+
patch: {
|
|
162
|
+
answer?: Answer | null
|
|
163
|
+
notes?: string
|
|
164
|
+
defer?: Defer | null
|
|
165
|
+
needsDiscussion?: boolean
|
|
166
|
+
reconfirm?: true
|
|
167
|
+
confirmProposal?: true
|
|
168
|
+
dismissProposal?: true
|
|
169
|
+
},
|
|
170
|
+
baseRevision: number
|
|
171
|
+
): Promise<
|
|
172
|
+
| { ok: true; plan: PlanRecord }
|
|
173
|
+
| { ok: false; reason: "not-found" | "read-only" | "locked" | "stale" | "invalid"; message: string }
|
|
174
|
+
>
|
|
175
|
+
submit(
|
|
176
|
+
projectSlug: string,
|
|
177
|
+
planSlug: string,
|
|
178
|
+
group: string | null,
|
|
179
|
+
baseRevision: number | null
|
|
180
|
+
): Promise<
|
|
181
|
+
| { ok: true; submission: Submission; skipped: { group: string; missing: Missing[] }[] }
|
|
182
|
+
| { ok: false; reason: "not-found" | "not-ready" | "nothing-ready" | "stale"; missing?: Missing[] }
|
|
183
|
+
>
|
|
184
|
+
pendingDeliveries(projectSlug: string): Promise<PendingDeliveries[]>
|
|
185
|
+
claimDelivery(
|
|
186
|
+
projectSlug: string,
|
|
187
|
+
planSlug: string,
|
|
188
|
+
submissionId: number,
|
|
189
|
+
sessionID: string
|
|
190
|
+
): Promise<boolean>
|
|
191
|
+
releaseDelivery(projectSlug: string, planSlug: string, submissionId: number): Promise<void>
|
|
192
|
+
markDelivered(
|
|
193
|
+
projectSlug: string,
|
|
194
|
+
planSlug: string,
|
|
195
|
+
submissionIds: number[],
|
|
196
|
+
sessionID: string
|
|
197
|
+
): Promise<number>
|
|
198
|
+
readAnswers(
|
|
199
|
+
projectSlug: string,
|
|
200
|
+
planSlug: string,
|
|
201
|
+
sessionID: string
|
|
202
|
+
): Promise<
|
|
203
|
+
| { ok: true; plan: PlanRecord; submissions: Submission[] }
|
|
204
|
+
| { ok: false; reason: "owned" | "not-found"; owner?: string }
|
|
205
|
+
>
|
|
206
|
+
resolve(
|
|
207
|
+
projectSlug: string,
|
|
208
|
+
planSlug: string,
|
|
209
|
+
sessionID: string,
|
|
210
|
+
input: { recorded?: { key: string; as: string }[]; retire?: string[] }
|
|
211
|
+
): Promise<
|
|
212
|
+
| { ok: true; recorded: number; retired: number }
|
|
213
|
+
| { ok: false; reason: "owned" | "invalid" | "not-found"; owner?: string; errors?: string[] }
|
|
214
|
+
>
|
|
215
|
+
markOrphaned(projectSlug: string, sessionID: string): Promise<number>
|
|
216
|
+
setArchived(projectSlug: string, planSlug: string, archived: boolean): Promise<boolean>
|
|
217
|
+
deletePlan(projectSlug: string, planSlug: string): Promise<boolean>
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
/** Create a store over one data directory. */
|
|
221
|
+
export declare function createDiscoveryStore(options: {
|
|
222
|
+
dataDir: string
|
|
223
|
+
now?: () => Date
|
|
224
|
+
}): DiscoveryStore
|