@formspec/analysis 0.1.0-alpha.20 → 0.1.0-alpha.21

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.
@@ -1,123 +1,18 @@
1
- import { AnnotationNode } from '@formspec/core';
2
- import { BuiltinConstraintBroadeningRegistration } from '@formspec/core';
3
- import { ConstraintNode } from '@formspec/core';
4
- import { ConstraintTagRegistration } from '@formspec/core';
5
- import { CustomConstraintRegistration } from '@formspec/core';
6
- import { ExtensionDefinition } from '@formspec/core';
7
- import type { JsonValue } from '@formspec/core';
8
1
  import type { PathTarget } from '@formspec/core';
9
- import { Provenance } from '@formspec/core';
10
- import * as ts from 'typescript';
11
- import { TypeNode } from '@formspec/core';
12
-
13
- export declare interface AnalysisTypeDefinition {
14
- readonly name: string;
15
- readonly type: TypeNode;
16
- readonly constraints?: readonly ConstraintNode[];
17
- readonly annotations?: readonly AnnotationNode[];
18
- readonly provenance: Provenance;
19
- }
20
-
21
- export declare type AnalysisTypeRegistry = Record<string, AnalysisTypeDefinition>;
22
-
23
- /**
24
- * Resolves targeted constraints against a field type, producing effective
25
- * target states plus semantic diagnostics such as contradictions, unknown
26
- * paths, and type mismatches.
27
- */
28
- export declare function analyzeConstraintTargets(fieldName: string, fieldType: TypeNode, constraints: readonly ConstraintNode[], typeRegistry: AnalysisTypeRegistry, options?: {
29
- readonly extensionRegistry?: ConstraintRegistryLike;
30
- }): ConstraintTargetAnalysisResult;
31
-
32
- export declare function buildConstraintTargetStates(fieldName: string, fieldType: TypeNode, constraints: readonly ConstraintNode[], typeRegistry: AnalysisTypeRegistry): readonly ResolvedTargetState[];
33
-
34
- /**
35
- * Builds a transport-safe snapshot of every FormSpec-bearing doc comment in a
36
- * source file, including semantic hover/completion context and file-local
37
- * diagnostics.
38
- */
39
- export declare function buildFormSpecAnalysisFileSnapshot(sourceFile: ts.SourceFile, options: BuildFormSpecAnalysisFileSnapshotOptions): FormSpecAnalysisFileSnapshot;
40
-
41
- /**
42
- * Options used when building a serializable, editor-oriented snapshot for a
43
- * TypeScript source file.
44
- */
45
- export declare interface BuildFormSpecAnalysisFileSnapshotOptions {
46
- readonly checker: ts.TypeChecker;
47
- readonly extensions?: readonly ExtensionTagSource[];
48
- }
49
-
50
- /**
51
- * Builds the synthetic helper declarations used to validate FormSpec tag
52
- * applications through the TypeScript checker.
53
- *
54
- * The returned string is a virtual `.d.ts`-style prelude that declares the
55
- * `__formspec.*` helper namespace together with context, path, member, and
56
- * variant helper types. It is intended to be embedded into an in-memory
57
- * TypeScript program, never emitted to disk.
58
- */
59
- export declare function buildSyntheticHelperPrelude(extensions?: readonly ExtensionTagSource[]): string;
60
-
61
- /**
62
- * Runs the TypeScript checker against a lowered synthetic tag application.
63
- *
64
- * This is the compiler-backed validation entrypoint used by FormSpec analysis
65
- * to verify placement, target binding, and argument compatibility without
66
- * requiring comment tags themselves to be valid TypeScript syntax.
67
- */
68
- export declare function checkSyntheticTagApplication(options: CheckSyntheticTagApplicationOptions): SyntheticTagCheckResult;
69
-
70
- /**
71
- * Options for running the TypeScript checker against a synthetic tag call.
72
- */
73
- export declare interface CheckSyntheticTagApplicationOptions extends LowerSyntheticTagApplicationOptions {
74
- readonly supportingDeclarations?: readonly string[];
75
- }
76
-
77
- export declare function collectCompatiblePathTargets(type: ts.Type, checker: ts.TypeChecker, capability: SemanticCapability): readonly string[];
78
2
 
79
- export declare function collectReferencedTypeAnnotations(type: TypeNode, typeRegistry: AnalysisTypeRegistry): readonly AnnotationNode[];
80
-
81
- export declare function collectReferencedTypeConstraints(type: TypeNode, typeRegistry: AnalysisTypeRegistry): readonly ConstraintNode[];
82
-
83
- export declare type CommentCompletionContext = {
84
- readonly kind: "tag-name";
85
- readonly prefix: string;
86
- } | {
87
- readonly kind: "target";
88
- readonly tag: ParsedCommentTag;
89
- } | {
90
- readonly kind: "argument";
91
- readonly tag: ParsedCommentTag;
92
- } | {
93
- readonly kind: "none";
94
- };
95
-
96
- export declare interface CommentCursorTarget {
97
- readonly kind: "tag-name" | "colon" | "target" | "argument";
98
- readonly tag: ParsedCommentTag;
99
- }
100
-
101
- export declare interface CommentHoverInfo {
3
+ declare interface CommentHoverInfo {
102
4
  readonly kind: "tag-name" | "target" | "argument";
103
5
  readonly markdown: string;
104
6
  }
105
7
 
106
- export declare interface CommentSemanticContextOptions {
107
- readonly extensions?: readonly ExtensionTagSource[];
108
- readonly placement?: FormSpecPlacement | null;
109
- readonly checker?: ts.TypeChecker;
110
- readonly subjectType?: ts.Type;
111
- }
112
-
113
- export declare interface CommentSourceSpan {
8
+ declare interface CommentSourceSpan {
114
9
  readonly start: number;
115
10
  readonly end: number;
116
11
  }
117
12
 
118
- export declare type CommentSpan = CommentSourceSpan;
13
+ declare type CommentSpan = CommentSourceSpan;
119
14
 
120
- export declare interface CommentTagSemanticContext {
15
+ declare interface CommentTagSemanticContext {
121
16
  readonly tag: ParsedCommentTag;
122
17
  readonly tagDefinition: TagDefinition | null;
123
18
  readonly placement: FormSpecPlacement | null;
@@ -134,121 +29,21 @@ export declare interface CommentTagSemanticContext {
134
29
  /**
135
30
  * Computes a stable, non-cryptographic hash for document staleness checks
136
31
  * across the plugin/LSP boundary.
32
+ *
33
+ * @public
137
34
  */
138
35
  export declare function computeFormSpecTextHash(text: string): string;
139
36
 
140
- export declare interface ConstraintRegistrationLike {
141
- readonly constraintName: string;
142
- readonly applicableTypes: readonly TypeNode["kind"][] | null;
143
- readonly isApplicableToType?: (type: TypeNode) => boolean;
144
- readonly comparePayloads?: (left: JsonValue, right: JsonValue) => number;
145
- readonly semanticRole?: ConstraintSemanticRoleLike;
146
- }
147
-
148
- export declare interface ConstraintRegistryLike {
149
- findConstraint(constraintId: string): ConstraintRegistrationLike | undefined;
150
- findConstraintTag(tagName: string): {
151
- readonly extensionId: string;
152
- readonly registration: ConstraintTagRegistrationLike;
153
- } | undefined;
154
- }
155
-
156
- export declare interface ConstraintSemanticDiagnostic {
157
- readonly code: string;
158
- readonly message: string;
159
- readonly severity: "error" | "warning";
160
- readonly primaryLocation: Provenance;
161
- readonly relatedLocations: readonly Provenance[];
162
- }
163
-
164
- export declare interface ConstraintSemanticRoleLike {
165
- readonly family: string;
166
- readonly bound: "lower" | "upper" | "exact";
167
- readonly inclusive: boolean;
168
- }
169
-
170
- export declare interface ConstraintTagParseRegistryLike {
171
- readonly extensions: readonly ExtensionDefinition[];
172
- findConstraint(constraintId: string): CustomConstraintRegistration | undefined;
173
- findConstraintTag(tagName: string): {
174
- readonly extensionId: string;
175
- readonly registration: ConstraintTagRegistration;
176
- } | undefined;
177
- findBuiltinConstraintBroadening(typeId: string, tagName: string): {
178
- readonly extensionId: string;
179
- readonly registration: BuiltinConstraintBroadeningRegistration;
180
- } | undefined;
181
- }
182
-
183
- export declare interface ConstraintTagRegistrationLike {
184
- readonly tagName: string;
185
- readonly constraintName: string;
186
- readonly isApplicableToType?: (type: TypeNode) => boolean;
187
- }
188
-
189
- export declare interface ConstraintTargetAnalysisResult {
190
- readonly diagnostics: readonly ConstraintSemanticDiagnostic[];
191
- readonly targetStates: readonly ResolvedTargetState[];
192
- }
193
-
194
- export declare function dereferenceAnalysisType(type: TypeNode, typeRegistry: AnalysisTypeRegistry): TypeNode;
195
-
196
- export declare interface EffectiveTargetState {
197
- readonly fieldName: string;
198
- readonly path: PathTarget | null;
199
- readonly targetName: string;
200
- readonly type: TypeNode;
201
- readonly inheritedConstraints: readonly ConstraintNode[];
202
- readonly inheritedAnnotations: readonly AnnotationNode[];
203
- readonly localConstraints: readonly ConstraintNode[];
204
- readonly effectiveConstraints: readonly ConstraintNode[];
205
- }
206
-
207
- export declare interface EnclosingDocComment {
208
- readonly text: string;
209
- readonly start: number;
210
- readonly end: number;
211
- readonly parsed: ParsedCommentBlock;
212
- }
213
-
214
- export declare interface ExtensionConstraintTagSource {
215
- readonly tagName: string;
216
- }
217
-
218
- export declare interface ExtensionTagSource {
219
- readonly extensionId: string;
220
- readonly constraintTags?: readonly ExtensionConstraintTagSource[];
221
- }
222
-
223
- /**
224
- * Extract a `:foo.bar` path target prefix from raw tag text.
225
- */
226
- export declare function extractPathTarget(text: string): ParsedPathTarget | null;
227
-
228
- export declare function findCommentTagAtOffset(documentText: string, offset: number, options?: {
229
- readonly extensions?: readonly ExtensionTagSource[];
230
- }): ParsedCommentTag | null;
231
-
232
- /**
233
- * Finds the smallest declaration whose leading doc comment contains the given
234
- * source offset.
235
- */
236
- export declare function findDeclarationForCommentOffset(sourceFile: ts.SourceFile, offset: number): ts.Node | null;
237
-
238
- export declare function findEnclosingDocComment(documentText: string, offset: number, options?: {
239
- readonly extensions?: readonly ExtensionTagSource[];
240
- }): EnclosingDocComment | null;
241
-
242
- export declare function formatConstraintTargetName(fieldName: string, path: PathTarget | null): string;
243
-
244
- export declare function formatPathTarget(path: PathTarget | readonly string[]): string;
245
-
37
+ /** @public */
246
38
  export declare const FORMSPEC_ANALYSIS_PROTOCOL_VERSION = 1;
247
39
 
40
+ /** @public */
248
41
  export declare const FORMSPEC_ANALYSIS_SCHEMA_VERSION = 1;
249
42
 
250
43
  /**
251
44
  * Serializable view of one declaration-attached doc comment in a source file.
45
+ *
46
+ * @public
252
47
  */
253
48
  export declare interface FormSpecAnalysisCommentSnapshot {
254
49
  readonly commentSpan: CommentSpan;
@@ -261,6 +56,8 @@ export declare interface FormSpecAnalysisCommentSnapshot {
261
56
 
262
57
  /**
263
58
  * File-local diagnostic derived from comment parsing or semantic analysis.
59
+ *
60
+ * @public
264
61
  */
265
62
  export declare interface FormSpecAnalysisDiagnostic {
266
63
  readonly code: string;
@@ -271,6 +68,8 @@ export declare interface FormSpecAnalysisDiagnostic {
271
68
 
272
69
  /**
273
70
  * Serializable analysis artifact for a single source file.
71
+ *
72
+ * @public
274
73
  */
275
74
  export declare interface FormSpecAnalysisFileSnapshot {
276
75
  readonly filePath: string;
@@ -283,6 +82,8 @@ export declare interface FormSpecAnalysisFileSnapshot {
283
82
  /**
284
83
  * Discovery record written by the tsserver plugin so other FormSpec tooling
285
84
  * can locate and validate the matching semantic service for a workspace.
85
+ *
86
+ * @public
286
87
  */
287
88
  export declare interface FormSpecAnalysisManifest {
288
89
  readonly protocolVersion: typeof FORMSPEC_ANALYSIS_PROTOCOL_VERSION;
@@ -298,6 +99,8 @@ export declare interface FormSpecAnalysisManifest {
298
99
 
299
100
  /**
300
101
  * Serializable view of a single parsed FormSpec tag within a doc comment.
102
+ *
103
+ * @public
301
104
  */
302
105
  export declare interface FormSpecAnalysisTagSnapshot {
303
106
  readonly rawTagName: string;
@@ -315,18 +118,20 @@ export declare interface FormSpecAnalysisTagSnapshot {
315
118
  /**
316
119
  * Cross-process endpoint used by the language server to reach the semantic
317
120
  * tsserver plugin on the current workspace host.
121
+ *
122
+ * @public
318
123
  */
319
124
  export declare interface FormSpecIpcEndpoint {
320
125
  readonly kind: "unix-socket" | "windows-pipe";
321
126
  readonly address: string;
322
127
  }
323
128
 
324
- export declare type FormSpecPlacement = "class" | "class-field" | "class-method" | "interface" | "interface-field" | "type-alias" | "type-alias-field" | "variable" | "function" | "function-parameter" | "method-parameter";
325
-
326
- export declare type FormSpecSemanticCapability = SemanticCapability;
129
+ declare type FormSpecPlacement = "class" | "class-field" | "class-method" | "interface" | "interface-field" | "type-alias" | "type-alias-field" | "variable" | "function" | "function-parameter" | "method-parameter";
327
130
 
328
131
  /**
329
132
  * Query variants supported by the semantic tsserver plugin.
133
+ *
134
+ * @public
330
135
  */
331
136
  export declare type FormSpecSemanticQuery = {
332
137
  readonly protocolVersion: typeof FORMSPEC_ANALYSIS_PROTOCOL_VERSION;
@@ -353,6 +158,8 @@ export declare type FormSpecSemanticQuery = {
353
158
 
354
159
  /**
355
160
  * Response variants returned by the semantic tsserver plugin.
161
+ *
162
+ * @public
356
163
  */
357
164
  export declare type FormSpecSemanticResponse = {
358
165
  readonly protocolVersion: typeof FORMSPEC_ANALYSIS_PROTOCOL_VERSION;
@@ -385,6 +192,8 @@ export declare type FormSpecSemanticResponse = {
385
192
 
386
193
  /**
387
194
  * Serialized representation of a parsed target specifier with exact spans.
195
+ *
196
+ * @public
388
197
  */
389
198
  export declare interface FormSpecSerializedCommentTargetSpecifier {
390
199
  readonly rawText: string;
@@ -398,6 +207,8 @@ export declare interface FormSpecSerializedCommentTargetSpecifier {
398
207
  /**
399
208
  * Cursor-scoped completion context serialized for transport between the
400
209
  * semantic tsserver plugin and the lightweight LSP.
210
+ *
211
+ * @public
401
212
  */
402
213
  export declare type FormSpecSerializedCompletionContext = {
403
214
  readonly kind: "tag-name";
@@ -416,6 +227,8 @@ export declare type FormSpecSerializedCompletionContext = {
416
227
 
417
228
  /**
418
229
  * Hover payload for a single comment token under the cursor.
230
+ *
231
+ * @public
419
232
  */
420
233
  export declare interface FormSpecSerializedHoverInfo {
421
234
  readonly kind: CommentHoverInfo["kind"];
@@ -424,6 +237,8 @@ export declare interface FormSpecSerializedHoverInfo {
424
237
 
425
238
  /**
426
239
  * Serializable subset of tag metadata needed by hover and completion UIs.
240
+ *
241
+ * @public
427
242
  */
428
243
  export declare interface FormSpecSerializedTagDefinition {
429
244
  readonly canonicalName: string;
@@ -433,6 +248,8 @@ export declare interface FormSpecSerializedTagDefinition {
433
248
 
434
249
  /**
435
250
  * Semantic facts about one parsed tag, reduced to JSON-safe data for IPC.
251
+ *
252
+ * @public
436
253
  */
437
254
  export declare interface FormSpecSerializedTagSemanticContext {
438
255
  readonly tagName: string;
@@ -450,182 +267,65 @@ export declare interface FormSpecSerializedTagSemanticContext {
450
267
 
451
268
  /**
452
269
  * Serializable overload/signature summary for one comment tag form.
270
+ *
271
+ * @public
453
272
  */
454
273
  export declare interface FormSpecSerializedTagSignature {
455
274
  readonly label: string;
456
275
  readonly placements: readonly FormSpecPlacement[];
457
276
  }
458
277
 
459
- export declare type FormSpecTagCategory = "constraint" | "annotation" | "structure" | "ecosystem";
460
-
461
- export declare type FormSpecTagDefinition = TagDefinition;
462
-
463
- export declare type FormSpecTagOverload = TagSignature;
278
+ declare type FormSpecTagCategory = "constraint" | "annotation" | "structure" | "ecosystem";
464
279
 
465
- export declare type FormSpecTagParameter = TagSignatureParameter;
280
+ declare type FormSpecTargetKind = "none" | "path" | "member" | "variant";
466
281
 
467
- export declare type FormSpecTargetKind = "none" | "path" | "member" | "variant";
468
-
469
- export declare type FormSpecValueKind = "number" | "integer" | "signedInteger" | "string" | "json" | "boolean" | "condition";
470
-
471
- export declare function getAllTagDefinitions(extensions?: readonly ExtensionTagSource[]): readonly TagDefinition[];
472
-
473
- export declare function getCommentCompletionContextAtOffset(documentText: string, offset: number, options?: {
474
- readonly extensions?: readonly ExtensionTagSource[];
475
- }): CommentCompletionContext;
476
-
477
- export declare function getCommentCursorTargetAtOffset(documentText: string, offset: number, options?: {
478
- readonly extensions?: readonly ExtensionTagSource[];
479
- }): CommentCursorTarget | null;
480
-
481
- /**
482
- * Returns hover information for the comment token under the given document
483
- * offset, including semantic target/argument help when binding data is
484
- * available.
485
- */
486
- export declare function getCommentHoverInfoAtOffset(documentText: string, offset: number, options?: CommentSemanticContextOptions): CommentHoverInfo | null;
487
-
488
- export declare function getCommentTagSemanticContext(tag: ParsedCommentTag, options?: CommentSemanticContextOptions): CommentTagSemanticContext;
489
-
490
- export declare function getConstraintTagDefinitions(extensions?: readonly ExtensionTagSource[]): readonly TagDefinition[];
282
+ declare type FormSpecValueKind = "number" | "integer" | "signedInteger" | "string" | "json" | "boolean" | "condition";
491
283
 
492
284
  /**
493
285
  * Path to the manifest that advertises the local FormSpec semantic service for
494
286
  * a workspace.
287
+ *
288
+ * @public
495
289
  */
496
290
  export declare function getFormSpecManifestPath(workspaceRoot: string): string;
497
291
 
498
292
  /**
499
293
  * Stable workspace-scoped identifier derived from the absolute workspace root.
294
+ *
295
+ * @public
500
296
  */
501
297
  export declare function getFormSpecWorkspaceId(workspaceRoot: string): string;
502
298
 
503
299
  /**
504
300
  * Directory used for machine-generated FormSpec tooling state inside a
505
301
  * workspace.
506
- */
507
- export declare function getFormSpecWorkspaceRuntimeDirectory(workspaceRoot: string): string;
508
-
509
- /**
510
- * Resolves the enclosing host type for declarations nested under a containing
511
- * class, interface, or type literal.
512
- */
513
- export declare function getHostType(node: ts.Node, checker: ts.TypeChecker): ts.Type | undefined;
514
-
515
- /**
516
- * Returns the last leading TSDoc/JSDoc block attached to a declaration node.
517
- */
518
- export declare function getLastLeadingDocCommentRange(node: ts.Node, sourceFile: ts.SourceFile): ts.CommentRange | null;
519
-
520
- /**
521
- * Filters a tag definition's overloads down to the ones that apply to the
522
- * requested placement and synthetic target form.
523
302
  *
524
- * This is the overload-selection primitive used by both the lowering phase
525
- * and cursor-aware tooling that wants to show only the currently-applicable
526
- * signatures for a tag.
527
- */
528
- export declare function getMatchingTagSignatures(definition: TagDefinition, placement: FormSpecPlacement, targetKind: SyntheticTagTargetKind | null): readonly TagSignature[];
529
-
530
- /**
531
- * Resolves the completion context at a document offset, upgrading syntax-only
532
- * results with placement/type-aware semantics when TypeScript binding data is
533
- * available.
303
+ * @public
534
304
  */
535
- export declare function getSemanticCommentCompletionContextAtOffset(documentText: string, offset: number, options?: CommentSemanticContextOptions): SemanticCommentCompletionContext;
536
-
537
- /**
538
- * Resolves the direct subject type for declarations that can carry FormSpec
539
- * comment tags.
540
- */
541
- export declare function getSubjectType(node: ts.Node, checker: ts.TypeChecker): ts.Type | undefined;
542
-
543
- export declare function getTagCompletionPrefixAtOffset(documentText: string, offset: number): string | null;
544
-
545
- export declare function getTagDefinition(rawName: string, extensions?: readonly ExtensionTagSource[]): TagDefinition | null;
546
-
547
- export declare function getTagHoverMarkdown(rawName: string, extensions?: readonly ExtensionTagSource[]): string | null;
548
-
549
- export declare function getTypeSemanticCapabilities(type: ts.Type, checker: ts.TypeChecker): readonly SemanticCapability[];
550
-
551
- export declare function hasTypeSemanticCapability(type: ts.Type, checker: ts.TypeChecker, capability: SemanticCapability): boolean;
305
+ export declare function getFormSpecWorkspaceRuntimeDirectory(workspaceRoot: string): string;
552
306
 
553
307
  /**
554
308
  * Validates an unknown manifest payload from disk before consumers trust it.
309
+ *
310
+ * @public
555
311
  */
556
312
  export declare function isFormSpecAnalysisManifest(value: unknown): value is FormSpecAnalysisManifest;
557
313
 
558
314
  /**
559
315
  * Validates an unknown inbound IPC request before dispatching it.
316
+ *
317
+ * @public
560
318
  */
561
319
  export declare function isFormSpecSemanticQuery(value: unknown): value is FormSpecSemanticQuery;
562
320
 
563
321
  /**
564
322
  * Validates an unknown IPC response before the language server consumes it.
565
- */
566
- export declare function isFormSpecSemanticResponse(value: unknown): value is FormSpecSemanticResponse;
567
-
568
- /**
569
- * Result of lowering a tag application into the synthetic call representation
570
- * used for compiler-backed validation.
571
- */
572
- export declare interface LoweredSyntheticTagApplication {
573
- readonly definition: TagDefinition;
574
- readonly matchingSignatures: readonly TagSignature[];
575
- readonly callExpression: string;
576
- }
577
-
578
- /**
579
- * Inputs required to lower a parsed FormSpec tag into a synthetic TypeScript
580
- * helper call.
581
- *
582
- * `hostType` and `subjectType` are trusted snippets of TypeScript type syntax
583
- * supplied by the caller. They are embedded into an in-memory synthetic source
584
- * file and are never executed.
585
- */
586
- export declare interface LowerSyntheticTagApplicationOptions {
587
- readonly tagName: string;
588
- readonly placement: FormSpecPlacement;
589
- readonly hostType: string;
590
- readonly subjectType: string;
591
- readonly target?: SyntheticTagTargetSpecifier | null;
592
- readonly argumentExpression?: string | null;
593
- readonly extensions?: readonly ExtensionTagSource[];
594
- }
595
-
596
- /**
597
- * Lowers a normalized tag application into a synthetic helper call.
598
323
  *
599
- * The caller is responsible for supplying trusted `hostType` and `subjectType`
600
- * snippets that are valid TypeScript type syntax in the generated synthetic
601
- * program. This function does not sanitize those snippets; it only assembles
602
- * the helper call and selects the matching overload metadata.
324
+ * @public
603
325
  */
604
- export declare function lowerTagApplicationToSyntheticCall(options: LowerSyntheticTagApplicationOptions): LoweredSyntheticTagApplication;
605
-
606
- export declare function normalizeFormSpecTagName(rawName: string): string;
607
-
608
- export declare function parseCommentBlock(commentText: string, options?: ParseCommentSyntaxOptions): ParsedCommentBlock;
609
-
610
- export declare interface ParseCommentSyntaxOptions {
611
- readonly offset?: number;
612
- readonly extensions?: readonly ExtensionTagSource[];
613
- }
614
-
615
- export declare function parseConstraintTagValue(tagName: string, text: string, provenance: Provenance, options?: ParseConstraintTagValueOptions): ConstraintNode | null;
616
-
617
- export declare interface ParseConstraintTagValueOptions {
618
- readonly registry?: ConstraintTagParseRegistryLike;
619
- readonly fieldType?: TypeNode;
620
- }
621
-
622
- export declare interface ParsedCommentBlock {
623
- readonly commentText: string;
624
- readonly offset: number;
625
- readonly tags: readonly ParsedCommentTag[];
626
- }
326
+ export declare function isFormSpecSemanticResponse(value: unknown): value is FormSpecSemanticResponse;
627
327
 
628
- export declare interface ParsedCommentTag {
328
+ declare interface ParsedCommentTag {
629
329
  readonly rawTagName: string;
630
330
  readonly normalizedTagName: string;
631
331
  readonly recognized: boolean;
@@ -638,7 +338,7 @@ export declare interface ParsedCommentTag {
638
338
  readonly argumentText: string;
639
339
  }
640
340
 
641
- export declare interface ParsedCommentTargetSpecifier {
341
+ declare interface ParsedCommentTargetSpecifier {
642
342
  readonly rawText: string;
643
343
  readonly valid: boolean;
644
344
  readonly kind: "path" | "member" | "variant" | "ambiguous";
@@ -648,62 +348,9 @@ export declare interface ParsedCommentTargetSpecifier {
648
348
  readonly path: PathTarget | null;
649
349
  }
650
350
 
651
- export declare function parseDefaultValueTagValue(text: string, provenance: Provenance): AnnotationNode;
652
-
653
- export declare interface ParsedPathTarget {
654
- readonly path: PathTarget;
655
- readonly remainingText: string;
656
- }
657
-
658
- export declare function parseTagSyntax(rawTagName: string, payloadText: string, options?: Omit<ParseCommentSyntaxOptions, "offset">): ParsedCommentTag;
659
-
660
- export declare function resolveConstraintTargetState(fieldName: string, fieldType: TypeNode, path: PathTarget | null, localConstraints: readonly ConstraintNode[], typeRegistry: AnalysisTypeRegistry): ResolvedTargetState;
351
+ declare type SemanticCapability = "numeric-comparable" | "string-like" | "array-like" | "enum-member-addressable" | "json-like" | "condition-like" | "object-like";
661
352
 
662
- export declare function resolveDeclarationPlacement(node: ts.Node): FormSpecPlacement | null;
663
-
664
- /**
665
- * Result of resolving a dotted FormSpec path target through a TypeScript type.
666
- */
667
- export declare type ResolvedPathTargetType = {
668
- readonly kind: "resolved";
669
- readonly type: ts.Type;
670
- } | {
671
- readonly kind: "missing-property";
672
- readonly segment: string;
673
- } | {
674
- readonly kind: "unresolvable";
675
- readonly type: ts.Type;
676
- };
677
-
678
- export declare type ResolvedTargetState = ({
679
- readonly kind: "resolved";
680
- } & EffectiveTargetState) | {
681
- readonly kind: "missing-property";
682
- readonly fieldName: string;
683
- readonly path: PathTarget;
684
- readonly targetName: string;
685
- readonly segment: string;
686
- readonly localConstraints: readonly ConstraintNode[];
687
- } | {
688
- readonly kind: "unresolvable";
689
- readonly fieldName: string;
690
- readonly path: PathTarget;
691
- readonly targetName: string;
692
- readonly type: TypeNode;
693
- readonly localConstraints: readonly ConstraintNode[];
694
- };
695
-
696
- /**
697
- * Resolves a dotted FormSpec path target against a TypeScript type.
698
- *
699
- * Arrays are traversed through their item type so path-targets behave the same
700
- * way they do in the IR validator and cursor-context completion logic.
701
- */
702
- export declare function resolvePathTargetType(type: ts.Type, checker: ts.TypeChecker, segments: readonly string[]): ResolvedPathTargetType;
703
-
704
- export declare type SemanticCapability = "numeric-comparable" | "string-like" | "array-like" | "enum-member-addressable" | "json-like" | "condition-like" | "object-like";
705
-
706
- export declare type SemanticCommentCompletionContext = {
353
+ declare type SemanticCommentCompletionContext = {
707
354
  readonly kind: "tag-name";
708
355
  readonly prefix: string;
709
356
  readonly availableTags: readonly TagDefinition[];
@@ -720,68 +367,40 @@ export declare type SemanticCommentCompletionContext = {
720
367
 
721
368
  /**
722
369
  * Serializes tag-level semantic context for cross-process consumption.
370
+ *
371
+ * @public
723
372
  */
724
373
  export declare function serializeCommentTagSemanticContext(semantic: CommentTagSemanticContext): FormSpecSerializedTagSemanticContext;
725
374
 
726
375
  /**
727
376
  * Converts a parsed target specifier into its transport-safe JSON form.
377
+ *
378
+ * @public
728
379
  */
729
380
  export declare function serializeCommentTargetSpecifier(target: ParsedCommentTargetSpecifier | null): FormSpecSerializedCommentTargetSpecifier | null;
730
381
 
731
382
  /**
732
383
  * Serializes a cursor-scoped completion context for IPC.
384
+ *
385
+ * @public
733
386
  */
734
387
  export declare function serializeCompletionContext(context: SemanticCommentCompletionContext): FormSpecSerializedCompletionContext;
735
388
 
736
389
  /**
737
390
  * Serializes hover information for cross-process transport.
391
+ *
392
+ * @public
738
393
  */
739
394
  export declare function serializeHoverInfo(hover: CommentHoverInfo | null): FormSpecSerializedHoverInfo | null;
740
395
 
741
396
  /**
742
397
  * Serializes a parsed tag plus its semantic context into a file snapshot entry.
743
- */
744
- export declare function serializeParsedCommentTag(tag: ParsedCommentTag, semantic: CommentTagSemanticContext): FormSpecAnalysisTagSnapshot;
745
-
746
- export declare function sliceCommentSpan(commentText: string, span: CommentSpan, options?: {
747
- readonly offset?: number;
748
- }): string;
749
-
750
- /**
751
- * A simplified TypeScript diagnostic surfaced from the synthetic compiler pass.
752
- */
753
- export declare interface SyntheticCompilerDiagnostic {
754
- readonly code: number;
755
- readonly message: string;
756
- }
757
-
758
- /**
759
- * Result of checking a lowered synthetic tag application with the TypeScript
760
- * compiler.
761
- */
762
- export declare interface SyntheticTagCheckResult {
763
- readonly sourceText: string;
764
- readonly diagnostics: readonly SyntheticCompilerDiagnostic[];
765
- }
766
-
767
- /**
768
- * Target kinds that can be represented in a synthetic compiler call.
769
398
  *
770
- * This intentionally excludes `"none"`, because a missing target is modeled by
771
- * omitting the synthetic target argument entirely.
772
- */
773
- export declare type SyntheticTagTargetKind = "path" | "member" | "variant";
774
-
775
- /**
776
- * A normalized target argument that can be lowered into a synthetic helper
777
- * call for compiler-backed validation.
399
+ * @public
778
400
  */
779
- export declare interface SyntheticTagTargetSpecifier {
780
- readonly kind: SyntheticTagTargetKind;
781
- readonly text: string;
782
- }
401
+ export declare function serializeParsedCommentTag(tag: ParsedCommentTag, semantic: CommentTagSemanticContext): FormSpecAnalysisTagSnapshot;
783
402
 
784
- export declare interface TagDefinition {
403
+ declare interface TagDefinition {
785
404
  readonly canonicalName: string;
786
405
  readonly valueKind: FormSpecValueKind | null;
787
406
  readonly requiresArgument: boolean;
@@ -795,13 +414,13 @@ export declare interface TagDefinition {
795
414
  readonly signatures: readonly TagSignature[];
796
415
  }
797
416
 
798
- export declare interface TagSignature {
417
+ declare interface TagSignature {
799
418
  readonly label: string;
800
419
  readonly placements: readonly FormSpecPlacement[];
801
420
  readonly parameters: readonly TagSignatureParameter[];
802
421
  }
803
422
 
804
- export declare interface TagSignatureParameter {
423
+ declare interface TagSignatureParameter {
805
424
  readonly kind: "value" | "target-path" | "target-member" | "target-variant";
806
425
  readonly label: string;
807
426
  readonly optional?: boolean;