-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmissing-items.ts
More file actions
334 lines (326 loc) · 7.51 KB
/
Copy pathmissing-items.ts
File metadata and controls
334 lines (326 loc) · 7.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
import type { CategoryId, MissingItem, ProjectType } from "./types";
import { getProjectType } from "./project-types";
import { hasAny, findQuantity } from "./text-utils";
interface MissingItemDef {
id: string;
label: string;
defaultSeverity: "high" | "medium" | "low";
category: CategoryId;
patterns: string[];
guidance: string;
primaryNouns?: string[];
}
const MISSING_ITEM_DEFS: MissingItemDef[] = [
{
id: "final-deliverables",
label: "Final deliverables",
defaultSeverity: "high",
category: "deliverables",
patterns: [
"deliverable",
"deliverables",
"final design",
"final files",
"handoff",
"hand-off",
"hand-over",
"file delivery",
"source files",
],
guidance:
"Clearly list what will be delivered at project completion (e.g., source files, exported assets, documentation).",
primaryNouns: [
"page",
"pages",
"screen",
"screens",
"post",
"posts",
"feature",
"features",
"website",
"site",
"app",
"application",
],
},
{
id: "timeline-deadline",
label: "Timeline / deadline",
defaultSeverity: "high",
category: "timeline",
patterns: [
"timeline",
"deadline",
"start date",
"launch date",
"go-live",
"go live",
"completion date",
"duration",
"weeks",
"months",
],
guidance:
"Define a clear timeline with milestones and a final delivery date.",
},
{
id: "quantified-deliverables",
label: "Number of pages/screens/posts/features",
defaultSeverity: "medium",
category: "deliverables",
patterns: [
"pages",
"page",
"screens",
"screen",
"posts",
"features",
"sections",
"modules",
"views",
],
guidance:
"Specify the exact quantity of deliverables (e.g., 5 pages, 3 screens, 8 posts per month).",
},
{
id: "revision-limits",
label: "Revision limits",
defaultSeverity: "high",
category: "revisions",
patterns: [
"revision",
"revisions",
"round",
"rounds",
"iteration",
"feedback cycle",
"amendments",
],
guidance:
"State how many revision rounds are included and what happens beyond that limit.",
},
{
id: "payment-milestones",
label: "Payment milestones",
defaultSeverity: "high",
category: "payment",
patterns: [
"payment",
"milestone",
"deposit",
"invoice",
"retainer",
"%",
"upon signing",
"upon completion",
"net",
],
guidance:
"Define payment milestones (e.g., 50% upfront, 50% on delivery) with clear triggers.",
},
{
id: "content-responsibility",
label: "Content responsibility",
defaultSeverity: "medium",
category: "client",
patterns: [
"content",
"copy",
"copywriting",
"who provides",
"client provides",
"provided by client",
"text",
],
guidance:
"Clarify who is responsible for providing content (text, images, copy) and by when.",
},
{
id: "brand-assets-responsibility",
label: "Brand/assets responsibility",
defaultSeverity: "medium",
category: "client",
patterns: [
"brand",
"logo",
"assets",
"brand guidelines",
"style guide",
"brand kit",
"images",
"photos",
],
guidance:
"Specify who provides brand assets (logo, fonts, color codes) and in what format.",
},
{
id: "hosting-domain-responsibility",
label: "Hosting/domain responsibility",
defaultSeverity: "medium",
category: "technical",
patterns: [
"hosting",
"domain",
"server",
"ssl",
"cdn",
"dns",
"deployment",
],
guidance:
"Clarify who manages hosting, domain registration, SSL certificates, and related costs.",
},
{
id: "third-party-responsibility",
label: "Third-party tool/subscription responsibility",
defaultSeverity: "medium",
category: "technical",
patterns: [
"third-party",
"third party",
"plugin",
"license",
"subscription",
"api key",
"external service",
],
guidance:
"List all third-party tools/services needed and clarify who pays for and manages each.",
},
{
id: "support-period",
label: "Support period",
defaultSeverity: "medium",
category: "maintenance",
patterns: [
"support",
"post-launch",
"post launch",
"warranty",
"bug fix",
"bug fixes",
],
guidance:
"Define the post-launch support period, response times, and what's covered.",
},
{
id: "maintenance-terms",
label: "Maintenance terms",
defaultSeverity: "medium",
category: "maintenance",
patterns: [
"maintenance",
"retainer",
"ongoing support",
"monthly support",
"updates",
],
guidance:
"Outline maintenance terms: scope, frequency, cost, and what's included vs. extra.",
},
{
id: "acceptance-criteria",
label: "Acceptance criteria",
defaultSeverity: "medium",
category: "acceptance",
patterns: [
"acceptance",
"sign-off",
"sign off",
"approval",
"handover",
"uat",
"go-live criteria",
"testing",
],
guidance:
"Define clear acceptance criteria so both parties know when the project is complete.",
},
{
id: "out-of-scope",
label: "Out-of-scope items",
defaultSeverity: "medium",
category: "exclusions",
patterns: [
"out of scope",
"excluded",
"exclusions",
"not included",
"scope creep",
"beyond scope",
],
guidance:
"Explicitly list what is NOT included to prevent scope creep and disputes.",
},
{
id: "change-request-process",
label: "Change request process",
defaultSeverity: "low",
category: "exclusions",
patterns: [
"change request",
"additional work",
"extra work",
"additional cost",
"scope change",
"amendment",
],
guidance:
"Define the process for handling change requests (approval, pricing, timeline impact).",
},
{
id: "communication-channel",
label: "Communication channel",
defaultSeverity: "low",
category: "client",
patterns: [
"communication",
"meeting",
"meetings",
"check-in",
"check in",
"standup",
"stand-up",
"update",
"updates",
"email",
"slack",
],
guidance:
"Agree on communication channels, meeting frequency, and response time expectations.",
},
];
export function detectMissingItems(
text: string,
projectType: ProjectType,
): MissingItem[] {
const ptMeta = getProjectType(projectType);
const missing: MissingItem[] = [];
for (const def of MISSING_ITEM_DEFS) {
let found = hasAny(text, def.patterns);
if (!found && def.id === "final-deliverables" && def.primaryNouns) {
const quantity = findQuantity(text, def.primaryNouns);
if (quantity !== null) {
found = true;
}
if (!found) {
found = hasAny(text, def.primaryNouns);
}
}
if (!found) {
let severity = def.defaultSeverity;
const catWeight = ptMeta.weights[def.category];
if (catWeight >= 1.3 && severity === "medium") {
severity = "high";
}
missing.push({
id: def.id,
label: def.label,
severity,
guidance: def.guidance,
});
}
}
return missing;
}