@wrongstack/requirement-intake 0.299.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.
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Requirements Intake — deterministic input validation.
3
+ *
4
+ * User-provided text is untrusted data. It is validated for shape and size
5
+ * only; it is never executed or interpreted as instructions. Prompt-injection
6
+ * text such as "ignore all previous instructions" passes validation unchanged
7
+ * and is stored as ordinary request content.
8
+ */
9
+ import { z } from 'zod';
10
+ import { type IntakeFieldSource, type RequestType } from './constants.js';
11
+ import type { AddAnswerInput, AttachResourceInput, CreateIntakeInput, IntakeAttachmentInput, IntakeQuestionTemplateInput, RelatedResourceInput, UpdateIntakeInput } from './types.js';
12
+ export declare const requestTypeSchema: z.ZodEnum<{
13
+ api_change: "api_change";
14
+ bug_fix: "bug_fix";
15
+ documentation: "documentation";
16
+ feature: "feature";
17
+ infrastructure: "infrastructure";
18
+ maintenance: "maintenance";
19
+ migration: "migration";
20
+ other: "other";
21
+ performance: "performance";
22
+ refactor: "refactor";
23
+ security: "security";
24
+ testing: "testing";
25
+ ui_change: "ui_change";
26
+ unspecified: "unspecified";
27
+ }>;
28
+ export declare const prioritySchema: z.ZodEnum<{
29
+ critical: "critical";
30
+ high: "high";
31
+ low: "low";
32
+ medium: "medium";
33
+ unspecified: "unspecified";
34
+ }>;
35
+ export declare const intakeQuestionStatusSchema: z.ZodEnum<{
36
+ answered: "answered";
37
+ skipped: "skipped";
38
+ unanswered: "unanswered";
39
+ }>;
40
+ export declare const fieldSourceSchema: z.ZodEnum<{
41
+ deterministic: "deterministic";
42
+ llm: "llm";
43
+ system: "system";
44
+ user: "user";
45
+ }>;
46
+ export declare const attachmentInputSchema: z.ZodObject<{
47
+ name: z.ZodString;
48
+ kind: z.ZodEnum<{
49
+ document: "document";
50
+ file: "file";
51
+ image: "image";
52
+ link: "link";
53
+ other: "other";
54
+ }>;
55
+ path: z.ZodOptional<z.ZodString>;
56
+ url: z.ZodOptional<z.ZodString>;
57
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
58
+ mimeType: z.ZodOptional<z.ZodString>;
59
+ }, z.core.$strip>;
60
+ export declare const relatedResourceInputSchema: z.ZodObject<{
61
+ kind: z.ZodEnum<{
62
+ doc: "doc";
63
+ issue: "issue";
64
+ other: "other";
65
+ pr: "pr";
66
+ spec: "spec";
67
+ url: "url";
68
+ }>;
69
+ reference: z.ZodString;
70
+ title: z.ZodOptional<z.ZodString>;
71
+ }, z.core.$strip>;
72
+ export declare const questionTemplateInputSchema: z.ZodObject<{
73
+ field: z.ZodString;
74
+ question: z.ZodString;
75
+ required: z.ZodOptional<z.ZodBoolean>;
76
+ }, z.core.$strip>;
77
+ export declare const metadataSchema: z.ZodRecord<z.ZodString, z.ZodUnknown>;
78
+ export declare const createIntakeSchema: z.ZodObject<{
79
+ projectId: z.ZodString;
80
+ originalRequest: z.ZodString;
81
+ title: z.ZodOptional<z.ZodString>;
82
+ requestType: z.ZodOptional<z.ZodString>;
83
+ priority: z.ZodOptional<z.ZodEnum<{
84
+ critical: "critical";
85
+ high: "high";
86
+ low: "low";
87
+ medium: "medium";
88
+ unspecified: "unspecified";
89
+ }>>;
90
+ requestedBy: z.ZodString;
91
+ businessGoal: z.ZodOptional<z.ZodString>;
92
+ targetUsers: z.ZodOptional<z.ZodArray<z.ZodString>>;
93
+ expectedOutcome: z.ZodOptional<z.ZodString>;
94
+ scopeNotes: z.ZodOptional<z.ZodString>;
95
+ constraints: z.ZodOptional<z.ZodArray<z.ZodString>>;
96
+ providedContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
97
+ attachments: z.ZodOptional<z.ZodArray<z.ZodObject<{
98
+ name: z.ZodString;
99
+ kind: z.ZodEnum<{
100
+ document: "document";
101
+ file: "file";
102
+ image: "image";
103
+ link: "link";
104
+ other: "other";
105
+ }>;
106
+ path: z.ZodOptional<z.ZodString>;
107
+ url: z.ZodOptional<z.ZodString>;
108
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
109
+ mimeType: z.ZodOptional<z.ZodString>;
110
+ }, z.core.$strip>>>;
111
+ relatedResources: z.ZodOptional<z.ZodArray<z.ZodObject<{
112
+ kind: z.ZodEnum<{
113
+ doc: "doc";
114
+ issue: "issue";
115
+ other: "other";
116
+ pr: "pr";
117
+ spec: "spec";
118
+ url: "url";
119
+ }>;
120
+ reference: z.ZodString;
121
+ title: z.ZodOptional<z.ZodString>;
122
+ }, z.core.$strip>>>;
123
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
124
+ idempotencyKey: z.ZodOptional<z.ZodString>;
125
+ knownFields: z.ZodOptional<z.ZodArray<z.ZodString>>;
126
+ questions: z.ZodOptional<z.ZodArray<z.ZodObject<{
127
+ field: z.ZodString;
128
+ question: z.ZodString;
129
+ required: z.ZodOptional<z.ZodBoolean>;
130
+ }, z.core.$strip>>>;
131
+ }, z.core.$strict>;
132
+ export declare const updateIntakeSchema: z.ZodObject<{
133
+ title: z.ZodOptional<z.ZodString>;
134
+ requestType: z.ZodOptional<z.ZodString>;
135
+ priority: z.ZodOptional<z.ZodEnum<{
136
+ critical: "critical";
137
+ high: "high";
138
+ low: "low";
139
+ medium: "medium";
140
+ unspecified: "unspecified";
141
+ }>>;
142
+ businessGoal: z.ZodOptional<z.ZodString>;
143
+ targetUsers: z.ZodOptional<z.ZodArray<z.ZodString>>;
144
+ expectedOutcome: z.ZodOptional<z.ZodString>;
145
+ scopeNotes: z.ZodOptional<z.ZodString>;
146
+ constraints: z.ZodOptional<z.ZodArray<z.ZodString>>;
147
+ providedContext: z.ZodOptional<z.ZodArray<z.ZodString>>;
148
+ metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
149
+ }, z.core.$strict>;
150
+ export declare const answerInputSchema: z.ZodObject<{
151
+ field: z.ZodString;
152
+ answer: z.ZodString;
153
+ question: z.ZodOptional<z.ZodString>;
154
+ }, z.core.$strip>;
155
+ export declare const attachResourceInputSchema: z.ZodObject<{
156
+ attachment: z.ZodOptional<z.ZodObject<{
157
+ name: z.ZodString;
158
+ kind: z.ZodEnum<{
159
+ document: "document";
160
+ file: "file";
161
+ image: "image";
162
+ link: "link";
163
+ other: "other";
164
+ }>;
165
+ path: z.ZodOptional<z.ZodString>;
166
+ url: z.ZodOptional<z.ZodString>;
167
+ sizeBytes: z.ZodOptional<z.ZodNumber>;
168
+ mimeType: z.ZodOptional<z.ZodString>;
169
+ }, z.core.$strip>>;
170
+ relatedResource: z.ZodOptional<z.ZodObject<{
171
+ kind: z.ZodEnum<{
172
+ doc: "doc";
173
+ issue: "issue";
174
+ other: "other";
175
+ pr: "pr";
176
+ spec: "spec";
177
+ url: "url";
178
+ }>;
179
+ reference: z.ZodString;
180
+ title: z.ZodOptional<z.ZodString>;
181
+ }, z.core.$strip>>;
182
+ }, z.core.$strip>;
183
+ /**
184
+ * Normalize a request-type candidate to the authoritative enum.
185
+ * Unknown/unsupported values map to `other`; missing/non-string values map
186
+ * to `unspecified`. Uncontrolled strings are never persisted.
187
+ */
188
+ export declare function normalizeRequestType(value: unknown): RequestType;
189
+ /** True when a string is empty or whitespace-only. */
190
+ export declare function isBlank(value: string): boolean;
191
+ /**
192
+ * Parse unknown input against a zod schema and throw a field-level
193
+ * `IntakeValidationError` on failure.
194
+ */
195
+ export declare function parseWithIssues<T>(schema: z.ZodType<T>, data: unknown, scope: string): T;
196
+ /** Validate a create payload. Returns the normalized (still untrusted-free) input. */
197
+ export declare function validateCreateInput(data: unknown): CreateIntakeInput;
198
+ export declare function validateUpdateInput(data: unknown): UpdateIntakeInput;
199
+ export declare function validateAnswerInput(data: unknown): AddAnswerInput;
200
+ export declare function validateAttachResourceInput(data: unknown): AttachResourceInput;
201
+ export declare function validateAttachmentInput(data: unknown): IntakeAttachmentInput;
202
+ export declare function validateRelatedResourceInput(data: unknown): RelatedResourceInput;
203
+ export declare function validateQuestionTemplateInput(data: unknown): IntakeQuestionTemplateInput;
204
+ export declare function validateFieldSource(value: unknown): IntakeFieldSource;
205
+ /** Deterministic fallback summary derived from the original request. */
206
+ export declare function deterministicSummary(originalRequest: string, maxLength?: number): string;
207
+ /** Deterministic fallback title derived from the original request. */
208
+ export declare function deterministicTitle(originalRequest: string, maxLength?: number): string;
209
+ //# sourceMappingURL=validation.d.ts.map
package/package.json ADDED
@@ -0,0 +1,46 @@
1
+ {
2
+ "name": "@wrongstack/requirement-intake",
3
+ "version": "0.299.0",
4
+ "license": "MIT",
5
+ "description": "WrongStack Requirements Intake — collect, preserve, validate, normalize, and submit unstructured software development requests as structured intake records. Upstream of spec-driven development: it never plans, specifies, or implements.",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/WrongStack/WrongStack.git",
9
+ "directory": "packages/requirement-intake"
10
+ },
11
+ "homepage": "https://github.com/WrongStack/WrongStack#readme",
12
+ "bugs": "https://github.com/WrongStack/WrongStack/issues",
13
+ "author": "ECOSTACK TECHNOLOGY OÜ",
14
+ "type": "module",
15
+ "main": "./dist/index.js",
16
+ "types": "./dist/index.d.ts",
17
+ "sideEffects": false,
18
+ "exports": {
19
+ ".": {
20
+ "types": "./dist/index.d.ts",
21
+ "import": "./dist/index.js",
22
+ "default": "./dist/index.js"
23
+ }
24
+ },
25
+ "files": [
26
+ "dist",
27
+ "!dist/**/*.map"
28
+ ],
29
+ "dependencies": {
30
+ "zod": "4.4.3",
31
+ "@wrongstack/core": "0.299.0"
32
+ },
33
+ "devDependencies": {
34
+ "@types/node": "^26.1.2",
35
+ "typescript": "^7.0.2"
36
+ },
37
+ "publishConfig": {
38
+ "access": "public"
39
+ },
40
+ "scripts": {
41
+ "build": "node ../../scripts/build-package.mjs",
42
+ "typecheck": "tsc --noEmit",
43
+ "test": "vitest run",
44
+ "clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true})\""
45
+ }
46
+ }