@ivorycanvas/qamap 0.3.5 → 0.4.1

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.
Files changed (49) hide show
  1. package/CHANGELOG.md +49 -0
  2. package/README.md +37 -23
  3. package/dist/agent-init.js +2 -2
  4. package/dist/agent-init.js.map +1 -1
  5. package/dist/behavior-intent.d.ts +6 -0
  6. package/dist/behavior-intent.js +183 -0
  7. package/dist/behavior-intent.js.map +1 -0
  8. package/dist/behavior-manifest.d.ts +6 -0
  9. package/dist/behavior-manifest.js +221 -0
  10. package/dist/behavior-manifest.js.map +1 -0
  11. package/dist/behavior.d.ts +151 -0
  12. package/dist/behavior.js +458 -0
  13. package/dist/behavior.js.map +1 -0
  14. package/dist/change-intent.d.ts +81 -0
  15. package/dist/change-intent.js +884 -0
  16. package/dist/change-intent.js.map +1 -0
  17. package/dist/cli.js +13 -8
  18. package/dist/cli.js.map +1 -1
  19. package/dist/e2e.d.ts +16 -1
  20. package/dist/e2e.js +290 -25
  21. package/dist/e2e.js.map +1 -1
  22. package/dist/index.d.ts +11 -3
  23. package/dist/index.js +5 -1
  24. package/dist/index.js.map +1 -1
  25. package/dist/qa.d.ts +1 -0
  26. package/dist/qa.js +293 -88
  27. package/dist/qa.js.map +1 -1
  28. package/dist/terminal.js +1 -1
  29. package/dist/terminal.js.map +1 -1
  30. package/dist/test-plan.d.ts +18 -0
  31. package/dist/test-plan.js +123 -13
  32. package/dist/test-plan.js.map +1 -1
  33. package/dist/version.d.ts +1 -1
  34. package/dist/version.js +1 -1
  35. package/docs/adoption.md +11 -10
  36. package/docs/agent-format.md +16 -10
  37. package/docs/agent-skill.md +8 -5
  38. package/docs/architecture.md +131 -0
  39. package/docs/benchmarking.md +23 -4
  40. package/docs/commands.md +13 -7
  41. package/docs/e2e-output-examples.md +29 -28
  42. package/docs/quickstart-demo.md +29 -17
  43. package/docs/release-validation.md +49 -6
  44. package/docs/releasing.md +26 -3
  45. package/docs/roadmap.md +20 -10
  46. package/package.json +4 -2
  47. package/schema/qamap-agent.schema.json +122 -3
  48. package/schema/qamap-behavior.schema.json +339 -0
  49. package/skills/qamap-pr-qa/SKILL.md +20 -14
@@ -0,0 +1,221 @@
1
+ import path from "node:path";
2
+ import { createBehaviorEdge, createBehaviorNodeId, } from "./behavior.js";
3
+ export function createManifestBehaviorAdapter(options) {
4
+ return {
5
+ id: "qamap.verification-manifest",
6
+ version: "1",
7
+ detect: () => ({
8
+ confidence: manifestDetectionConfidence(options.matches),
9
+ reason: options.matches.length > 0
10
+ ? "The repository verification manifest matched this branch and can supply reviewed behavior evidence."
11
+ : "No verification manifest entries matched this branch.",
12
+ evidence: uniqueStrings(options.matches.map((match) => match.manifestPath)).slice(0, 12),
13
+ }),
14
+ analyze: (context) => buildManifestBehaviorFragment(context, options.matches),
15
+ };
16
+ }
17
+ function buildManifestBehaviorFragment(context, matches) {
18
+ const nodes = [];
19
+ const edges = [];
20
+ const changedFiles = new Set(context.changedFiles.map((file) => file.path));
21
+ const flowMatches = new Map(matches.filter((match) => match.kind === "flow").map((match) => [match.id, match]));
22
+ const domainNodes = [];
23
+ const flowNodes = [];
24
+ for (const match of [...matches].sort(compareManifestMatches)) {
25
+ const files = manifestFilesForContext(context, match.matchedFiles);
26
+ const nodeKind = nodeKindForMatch(match);
27
+ const nodeId = manifestNodeId(nodeKind, match.id);
28
+ const impact = manifestImpact(context, files, changedFiles);
29
+ const evidence = manifestEvidence(match, files);
30
+ nodes.push({
31
+ id: nodeId,
32
+ kind: nodeKind,
33
+ label: match.name,
34
+ confidence: match.confidence,
35
+ evidence,
36
+ attributes: manifestAttributes(match),
37
+ impact,
38
+ });
39
+ if (match.kind === "domain") {
40
+ domainNodes.push({ match, nodeId, files });
41
+ }
42
+ else if (match.kind === "flow") {
43
+ flowNodes.push({ match, nodeId, files });
44
+ }
45
+ for (const file of files) {
46
+ const sourceId = createBehaviorNodeId("source", file);
47
+ const direct = changedFiles.has(file);
48
+ nodes.push({
49
+ id: sourceId,
50
+ kind: "source",
51
+ label: file,
52
+ confidence: "high",
53
+ evidence: [
54
+ { kind: direct ? "diff" : "source", value: file, file },
55
+ { kind: "manifest", value: match.manifestPath, file },
56
+ ],
57
+ attributes: { path: file },
58
+ impact: direct ? { kind: "direct", changedFiles: [file] } : undefined,
59
+ });
60
+ edges.push(direct
61
+ ? createBehaviorEdge("impacts", sourceId, nodeId, "high", [{ kind: "manifest", value: match.manifestPath, file }])
62
+ : createBehaviorEdge("implemented-by", nodeId, sourceId, match.confidence, [
63
+ { kind: "manifest", value: match.manifestPath, file },
64
+ ]));
65
+ }
66
+ if (match.kind === "flow" && match.entryRoute) {
67
+ const surfaceId = createBehaviorNodeId("surface", "manifest-route", match.entryRoute, match.id);
68
+ nodes.push({
69
+ id: surfaceId,
70
+ kind: "surface",
71
+ label: `route: ${match.entryRoute}`,
72
+ confidence: match.confidence,
73
+ evidence: [{ kind: "manifest", value: match.manifestPath }],
74
+ attributes: { entrypointKind: "route", value: match.entryRoute, surface: "web", source: "manifest" },
75
+ });
76
+ edges.push(createBehaviorEdge("enters-at", nodeId, surfaceId, match.confidence, evidence));
77
+ }
78
+ if (match.kind === "check") {
79
+ const flowId = parentFlowId(match.id);
80
+ const parentMatch = flowMatches.get(flowId);
81
+ const parentNodeId = manifestNodeId("flow", flowId);
82
+ if (!parentMatch) {
83
+ nodes.push({
84
+ id: parentNodeId,
85
+ kind: "flow",
86
+ label: flowId,
87
+ confidence: match.confidence,
88
+ evidence,
89
+ attributes: { manifestId: flowId, source: "manifest" },
90
+ impact,
91
+ });
92
+ }
93
+ edges.push(createBehaviorEdge("expects", parentNodeId, nodeId, match.confidence, evidence));
94
+ if (match.checkSelector) {
95
+ const locatorId = createBehaviorNodeId("locator", "manifest", match.checkSelector, match.id);
96
+ nodes.push({
97
+ id: locatorId,
98
+ kind: "locator",
99
+ label: `manifest selector: ${match.checkSelector}`,
100
+ confidence: match.confidence,
101
+ evidence: [{ kind: "manifest", value: match.manifestPath }],
102
+ attributes: { value: match.checkSelector, source: "manifest" },
103
+ });
104
+ edges.push(createBehaviorEdge("located-by", nodeId, locatorId, match.confidence, evidence));
105
+ }
106
+ }
107
+ }
108
+ for (const domain of domainNodes) {
109
+ for (const flow of flowNodes) {
110
+ if (!filesOverlap(domain.files, flow.files)) {
111
+ continue;
112
+ }
113
+ edges.push(createBehaviorEdge("contains", domain.nodeId, flow.nodeId, weakerConfidence(domain.match.confidence, flow.match.confidence), [
114
+ { kind: "manifest", value: domain.match.manifestPath },
115
+ { kind: "manifest", value: flow.match.manifestPath },
116
+ ]));
117
+ }
118
+ }
119
+ return { nodes, edges };
120
+ }
121
+ function manifestNodeId(kind, id) {
122
+ return createBehaviorNodeId(kind, "manifest", id);
123
+ }
124
+ function nodeKindForMatch(match) {
125
+ if (match.kind === "domain") {
126
+ return "domain";
127
+ }
128
+ if (match.kind === "flow") {
129
+ return "flow";
130
+ }
131
+ return "assertion";
132
+ }
133
+ function manifestDetectionConfidence(matches) {
134
+ if (matches.some((match) => match.kind === "flow" || match.kind === "check")) {
135
+ return "high";
136
+ }
137
+ return matches.length > 0 ? "medium" : "none";
138
+ }
139
+ function manifestImpact(context, matchedFiles, changedFiles) {
140
+ const directFiles = uniqueStrings(matchedFiles).filter((file) => changedFiles.has(file));
141
+ if (directFiles.length > 0) {
142
+ return { kind: "direct", changedFiles: directFiles };
143
+ }
144
+ const propagatedFiles = context.changedFiles.map((file) => file.path).slice(0, 12);
145
+ return propagatedFiles.length > 0 ? { kind: "propagated", changedFiles: propagatedFiles } : undefined;
146
+ }
147
+ function manifestEvidence(match, files) {
148
+ return [
149
+ { kind: "manifest", value: match.manifestPath },
150
+ ...match.evidenceSources.map((source) => ({ kind: "manifest", value: source })),
151
+ ...files.slice(0, 12).map((file) => ({ kind: "source", value: file, file })),
152
+ ];
153
+ }
154
+ function manifestFilesForContext(context, matchedFiles) {
155
+ const workspaceRoot = context.workspaceRoot ? path.resolve(context.workspaceRoot) : undefined;
156
+ const root = path.resolve(context.root);
157
+ if (!workspaceRoot || workspaceRoot === root) {
158
+ return uniqueStrings(matchedFiles.map(toPosixPath));
159
+ }
160
+ const packagePrefix = toPosixPath(path.relative(workspaceRoot, root)).replace(/^\.\/+|\/+$/g, "");
161
+ if (!packagePrefix || packagePrefix.startsWith("..")) {
162
+ return uniqueStrings(matchedFiles.map(toPosixPath));
163
+ }
164
+ return uniqueStrings(matchedFiles.map((file) => {
165
+ const normalized = toPosixPath(file).replace(/^\.\/+/, "");
166
+ return normalized.startsWith(`${packagePrefix}/`) ? normalized.slice(packagePrefix.length + 1) : normalized;
167
+ }));
168
+ }
169
+ function manifestAttributes(match) {
170
+ const attributes = {
171
+ manifestId: match.id,
172
+ matchKind: match.kind,
173
+ source: "manifest",
174
+ updatePath: match.updatePath,
175
+ };
176
+ if (match.criticality) {
177
+ attributes.criticality = match.criticality;
178
+ }
179
+ if (match.runner) {
180
+ attributes.runner = match.runner;
181
+ }
182
+ if (match.entryRoute) {
183
+ attributes.entryRoute = match.entryRoute;
184
+ }
185
+ if (match.checkType) {
186
+ attributes.checkType = match.checkType;
187
+ }
188
+ if (match.checkSelector) {
189
+ attributes.checkSelector = match.checkSelector;
190
+ }
191
+ if (match.checkValue) {
192
+ attributes.checkValue = match.checkValue;
193
+ }
194
+ if (match.checkSteps && match.checkSteps.length > 0) {
195
+ attributes.checkSteps = match.checkSteps;
196
+ }
197
+ return attributes;
198
+ }
199
+ function parentFlowId(checkId) {
200
+ const parts = checkId.split(".");
201
+ return parts.length > 1 ? parts.slice(0, -1).join(".") : checkId;
202
+ }
203
+ function filesOverlap(left, right) {
204
+ const leftFiles = new Set(left);
205
+ return right.some((file) => leftFiles.has(file));
206
+ }
207
+ function weakerConfidence(left, right) {
208
+ const rank = { low: 1, medium: 2, high: 3 };
209
+ return rank[left] <= rank[right] ? left : right;
210
+ }
211
+ function compareManifestMatches(left, right) {
212
+ const kindRank = { domain: 0, flow: 1, check: 2 };
213
+ return kindRank[left.kind] - kindRank[right.kind] || left.id.localeCompare(right.id);
214
+ }
215
+ function uniqueStrings(items) {
216
+ return [...new Set(items.map((item) => item.trim()).filter(Boolean))];
217
+ }
218
+ function toPosixPath(value) {
219
+ return value.split(path.sep).join("/");
220
+ }
221
+ //# sourceMappingURL=behavior-manifest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"behavior-manifest.js","sourceRoot":"","sources":["../src/behavior-manifest.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EACL,kBAAkB,EAClB,oBAAoB,GAUrB,MAAM,eAAe,CAAC;AAOvB,MAAM,UAAU,6BAA6B,CAAC,OAAuC;IACnF,OAAO;QACL,EAAE,EAAE,6BAA6B;QACjC,OAAO,EAAE,GAAG;QACZ,MAAM,EAAE,GAAG,EAAE,CAAC,CAAC;YACb,UAAU,EAAE,2BAA2B,CAAC,OAAO,CAAC,OAAO,CAAC;YACxD,MAAM,EAAE,OAAO,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC;gBAChC,CAAC,CAAC,qGAAqG;gBACvG,CAAC,CAAC,uDAAuD;YAC3D,QAAQ,EAAE,aAAa,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,EAAE,CAAC;SACzF,CAAC;QACF,OAAO,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,6BAA6B,CAAC,OAAO,EAAE,OAAO,CAAC,OAAO,CAAC;KAC9E,CAAC;AACJ,CAAC;AAED,SAAS,6BAA6B,CACpC,OAAgC,EAChC,OAAoC;IAEpC,MAAM,KAAK,GAAmB,EAAE,CAAC;IACjC,MAAM,KAAK,GAAG,EAAE,CAAC;IACjB,MAAM,YAAY,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,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AC,CAAC;AACnD,CAAC;AAED,SAAS,gBAAgB,CAAC,IAAwB,EAAE,KAAyB;IAC3E,MAAM,IAAI,GAAuC,EAAE,GAAG,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAChF,OAAO,IAAI,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;AAClD,CAAC;AAED,SAAS,sBAAsB,CAAC,IAA+B,EAAE,KAAgC;IAC/F,MAAM,QAAQ,GAAG,EAAE,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAClD,OAAO,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;AACvF,CAAC;AAED,SAAS,aAAa,CAAC,KAAe;IACpC,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AACxE,CAAC;AAED,SAAS,WAAW,CAAC,KAAa;IAChC,OAAO,KAAK,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC"}
@@ -0,0 +1,151 @@
1
+ export declare const behaviorGraphSchemaVersion: 1;
2
+ export declare const behaviorGraphSchemaUrl = "https://raw.githubusercontent.com/IvoryCanvas/qamap/main/schema/qamap-behavior.schema.json";
3
+ export declare const behaviorSurfaceKinds: readonly ["web", "mobile", "api", "cli", "artifact", "unknown"];
4
+ export declare const behaviorNodeKinds: readonly ["domain", "flow", "surface", "action", "state", "effect", "contract", "assertion", "fixture", "locator", "source"];
5
+ export declare const behaviorEdgeKinds: readonly ["contains", "enters-at", "precedes", "expects", "uses-fixture", "located-by", "implemented-by", "impacts"];
6
+ export declare const behaviorEvidenceKinds: readonly ["commit", "diff", "source", "manifest", "selector", "fixture", "test", "inference"];
7
+ export type BehaviorConfidence = "low" | "medium" | "high";
8
+ export type BehaviorAdapterConfidence = "none" | BehaviorConfidence;
9
+ export type BehaviorSurfaceKind = (typeof behaviorSurfaceKinds)[number];
10
+ export type BehaviorNodeKind = (typeof behaviorNodeKinds)[number];
11
+ export type BehaviorEdgeKind = (typeof behaviorEdgeKinds)[number];
12
+ export type BehaviorEvidenceKind = (typeof behaviorEvidenceKinds)[number];
13
+ export type BehaviorImpactKind = "direct" | "propagated";
14
+ export type BehaviorDiagnosticSeverity = "info" | "warning";
15
+ export type BehaviorAttributeValue = string | number | boolean | string[];
16
+ export interface BehaviorEvidence {
17
+ kind: BehaviorEvidenceKind;
18
+ value: string;
19
+ file?: string;
20
+ previousFile?: string;
21
+ symbol?: string;
22
+ commit?: string;
23
+ relation?: "direct" | "supporting" | "contextual";
24
+ side?: "base" | "head";
25
+ startLine?: number;
26
+ endLine?: number;
27
+ hunkHeader?: string;
28
+ }
29
+ export interface BehaviorImpact {
30
+ kind: BehaviorImpactKind;
31
+ changedFiles: string[];
32
+ }
33
+ export interface BehaviorNode {
34
+ id: string;
35
+ kind: BehaviorNodeKind;
36
+ label: string;
37
+ confidence: BehaviorConfidence;
38
+ evidence: BehaviorEvidence[];
39
+ attributes?: Record<string, BehaviorAttributeValue>;
40
+ impact?: BehaviorImpact;
41
+ }
42
+ export interface BehaviorEdge {
43
+ id: string;
44
+ kind: BehaviorEdgeKind;
45
+ from: string;
46
+ to: string;
47
+ confidence: BehaviorConfidence;
48
+ evidence: BehaviorEvidence[];
49
+ }
50
+ export interface BehaviorDiagnostic {
51
+ severity: BehaviorDiagnosticSeverity;
52
+ message: string;
53
+ adapterId?: string;
54
+ }
55
+ export interface BehaviorAdapterDetection {
56
+ confidence: BehaviorAdapterConfidence;
57
+ reason: string;
58
+ evidence: string[];
59
+ }
60
+ export interface BehaviorAdapterRun {
61
+ id: string;
62
+ version: string;
63
+ status: "used" | "skipped" | "failed";
64
+ detection: BehaviorAdapterDetection;
65
+ nodeCount: number;
66
+ edgeCount: number;
67
+ }
68
+ export interface BehaviorGraphSummary {
69
+ nodes: number;
70
+ edges: number;
71
+ impactedNodes: number;
72
+ byKind: Record<BehaviorNodeKind, number>;
73
+ }
74
+ export interface BehaviorGraph {
75
+ $schema?: string;
76
+ schemaVersion: typeof behaviorGraphSchemaVersion;
77
+ root: string;
78
+ workspaceRoot?: string;
79
+ base: string;
80
+ head: string;
81
+ surface: BehaviorSurfaceKind;
82
+ adapters: BehaviorAdapterRun[];
83
+ nodes: BehaviorNode[];
84
+ edges: BehaviorEdge[];
85
+ diagnostics: BehaviorDiagnostic[];
86
+ summary: BehaviorGraphSummary;
87
+ }
88
+ export interface BehaviorChangedFile {
89
+ path: string;
90
+ status: string;
91
+ previousPath?: string;
92
+ }
93
+ export interface BehaviorAnalysisContext {
94
+ root: string;
95
+ workspaceRoot?: string;
96
+ base: string;
97
+ head: string;
98
+ projectType: string;
99
+ surface: BehaviorSurfaceKind;
100
+ runner?: string;
101
+ changedFiles: BehaviorChangedFile[];
102
+ }
103
+ export interface BehaviorGraphFragment {
104
+ nodes: BehaviorNode[];
105
+ edges: BehaviorEdge[];
106
+ diagnostics?: BehaviorDiagnostic[];
107
+ }
108
+ export interface BehaviorAnalyzerAdapter {
109
+ id: string;
110
+ version: string;
111
+ detect(context: BehaviorAnalysisContext): BehaviorAdapterDetection | Promise<BehaviorAdapterDetection>;
112
+ analyze(context: BehaviorAnalysisContext): BehaviorGraphFragment | Promise<BehaviorGraphFragment>;
113
+ }
114
+ export interface InferredBehaviorEntrypoint {
115
+ kind: "route" | "screen" | "command";
116
+ value: string;
117
+ file: string;
118
+ confidence: BehaviorConfidence;
119
+ }
120
+ export interface InferredBehaviorSelector {
121
+ kind: string;
122
+ value: string;
123
+ file: string;
124
+ addedInDiff?: boolean;
125
+ }
126
+ export interface InferredBehaviorCoverage {
127
+ title: string;
128
+ priority: string;
129
+ reason: string;
130
+ checks: string[];
131
+ }
132
+ export interface InferredBehaviorFlow {
133
+ kind: string;
134
+ title: string;
135
+ reason: string;
136
+ files: string[];
137
+ steps: string[];
138
+ entrypoints: InferredBehaviorEntrypoint[];
139
+ selectors: InferredBehaviorSelector[];
140
+ coverage: InferredBehaviorCoverage[];
141
+ fixtureStatus: string;
142
+ fixtureFiles: string[];
143
+ }
144
+ export interface InferredFlowAdapterOptions {
145
+ flows: InferredBehaviorFlow[];
146
+ }
147
+ export declare function analyzeBehaviorGraph(context: BehaviorAnalysisContext, adapters: BehaviorAnalyzerAdapter[]): Promise<BehaviorGraph>;
148
+ export declare function mergeBehaviorGraphFragments(fragments: BehaviorGraphFragment[]): BehaviorGraphFragment;
149
+ export declare function createInferredFlowBehaviorAdapter(options: InferredFlowAdapterOptions): BehaviorAnalyzerAdapter;
150
+ export declare function createBehaviorNodeId(kind: BehaviorNodeKind, ...parts: string[]): string;
151
+ export declare function createBehaviorEdge(kind: BehaviorEdgeKind, from: string, to: string, confidence: BehaviorConfidence, evidence?: BehaviorEvidence[]): BehaviorEdge;