@vibe-validate/cli 0.17.6 → 0.18.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.
Files changed (88) hide show
  1. package/dist/bin/vibe-validate +4 -0
  2. package/dist/bin/vibe-validate.js +4 -0
  3. package/dist/bin/vibe-validate.js.map +1 -1
  4. package/dist/bin/vv +4 -0
  5. package/dist/bin.js +12 -4
  6. package/dist/bin.js.map +1 -1
  7. package/dist/commands/cleanup.d.ts +4 -1
  8. package/dist/commands/cleanup.d.ts.map +1 -1
  9. package/dist/commands/cleanup.js +168 -122
  10. package/dist/commands/cleanup.js.map +1 -1
  11. package/dist/commands/config.d.ts.map +1 -1
  12. package/dist/commands/config.js +35 -21
  13. package/dist/commands/config.js.map +1 -1
  14. package/dist/commands/create-extractor.d.ts.map +1 -1
  15. package/dist/commands/create-extractor.js +29 -14
  16. package/dist/commands/create-extractor.js.map +1 -1
  17. package/dist/commands/doctor.d.ts.map +1 -1
  18. package/dist/commands/doctor.js +12 -23
  19. package/dist/commands/doctor.js.map +1 -1
  20. package/dist/commands/generate-workflow.d.ts.map +1 -1
  21. package/dist/commands/generate-workflow.js +6 -2
  22. package/dist/commands/generate-workflow.js.map +1 -1
  23. package/dist/commands/history.d.ts.map +1 -1
  24. package/dist/commands/history.js +19 -9
  25. package/dist/commands/history.js.map +1 -1
  26. package/dist/commands/init.d.ts.map +1 -1
  27. package/dist/commands/init.js +3 -1
  28. package/dist/commands/init.js.map +1 -1
  29. package/dist/commands/pre-commit.d.ts.map +1 -1
  30. package/dist/commands/pre-commit.js +3 -1
  31. package/dist/commands/pre-commit.js.map +1 -1
  32. package/dist/commands/run.d.ts.map +1 -1
  33. package/dist/commands/run.js +21 -13
  34. package/dist/commands/run.js.map +1 -1
  35. package/dist/commands/state.d.ts.map +1 -1
  36. package/dist/commands/state.js +11 -6
  37. package/dist/commands/state.js.map +1 -1
  38. package/dist/commands/watch-pr.d.ts +16 -0
  39. package/dist/commands/watch-pr.d.ts.map +1 -1
  40. package/dist/commands/watch-pr.js +574 -320
  41. package/dist/commands/watch-pr.js.map +1 -1
  42. package/dist/schemas/watch-pr-result.schema.d.ts +2071 -0
  43. package/dist/schemas/watch-pr-result.schema.d.ts.map +1 -0
  44. package/dist/schemas/watch-pr-result.schema.js +346 -0
  45. package/dist/schemas/watch-pr-result.schema.js.map +1 -0
  46. package/dist/schemas/watch-pr-schema.d.ts +6 -6
  47. package/dist/services/cache-manager.d.ts +113 -0
  48. package/dist/services/cache-manager.d.ts.map +1 -0
  49. package/dist/services/cache-manager.js +211 -0
  50. package/dist/services/cache-manager.js.map +1 -0
  51. package/dist/services/ci-providers/github-actions.d.ts.map +1 -1
  52. package/dist/services/ci-providers/github-actions.js +10 -16
  53. package/dist/services/ci-providers/github-actions.js.map +1 -1
  54. package/dist/services/external-check-extractor.d.ts +66 -0
  55. package/dist/services/external-check-extractor.d.ts.map +1 -0
  56. package/dist/services/external-check-extractor.js +114 -0
  57. package/dist/services/external-check-extractor.js.map +1 -0
  58. package/dist/services/extraction-mode-detector.d.ts +85 -0
  59. package/dist/services/extraction-mode-detector.d.ts.map +1 -0
  60. package/dist/services/extraction-mode-detector.js +200 -0
  61. package/dist/services/extraction-mode-detector.js.map +1 -0
  62. package/dist/services/github-fetcher.d.ts +234 -0
  63. package/dist/services/github-fetcher.d.ts.map +1 -0
  64. package/dist/services/github-fetcher.js +441 -0
  65. package/dist/services/github-fetcher.js.map +1 -0
  66. package/dist/services/history-summary-builder.d.ts +74 -0
  67. package/dist/services/history-summary-builder.d.ts.map +1 -0
  68. package/dist/services/history-summary-builder.js +199 -0
  69. package/dist/services/history-summary-builder.js.map +1 -0
  70. package/dist/services/watch-pr-orchestrator.d.ts +132 -0
  71. package/dist/services/watch-pr-orchestrator.d.ts.map +1 -0
  72. package/dist/services/watch-pr-orchestrator.js +451 -0
  73. package/dist/services/watch-pr-orchestrator.js.map +1 -0
  74. package/dist/utils/command-name.d.ts +21 -0
  75. package/dist/utils/command-name.d.ts.map +1 -0
  76. package/dist/utils/command-name.js +45 -0
  77. package/dist/utils/command-name.js.map +1 -0
  78. package/dist/utils/pid-lock.d.ts.map +1 -1
  79. package/dist/utils/pid-lock.js +3 -3
  80. package/dist/utils/pid-lock.js.map +1 -1
  81. package/dist/utils/secret-scanning.d.ts.map +1 -1
  82. package/dist/utils/secret-scanning.js +45 -17
  83. package/dist/utils/secret-scanning.js.map +1 -1
  84. package/dist/utils/temp-files.d.ts +1 -2
  85. package/dist/utils/temp-files.d.ts.map +1 -1
  86. package/dist/utils/temp-files.js +4 -4
  87. package/dist/utils/temp-files.js.map +1 -1
  88. package/package.json +8 -8
@@ -0,0 +1,200 @@
1
+ /**
2
+ * ExtractionModeDetector - Detect and extract errors from GitHub Actions logs
3
+ *
4
+ * Supports two modes:
5
+ * 1. Matrix mode: Validate YAML output with extraction field (pass through faithfully)
6
+ * 2. Non-matrix mode: Raw test output (detect extractor and extract errors)
7
+ *
8
+ * Try matrix first, fall back to non-matrix if YAML not found.
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ import { autoDetectAndExtract } from '@vibe-validate/extractors';
13
+ import YAML from 'yaml';
14
+ /**
15
+ * ExtractionModeDetector - Detect extraction mode and extract errors
16
+ *
17
+ * Tries matrix mode first (YAML with extraction field), falls back to non-matrix mode.
18
+ */
19
+ export class ExtractionModeDetector {
20
+ /**
21
+ * Detect extraction mode and extract errors
22
+ *
23
+ * @param check - GitHub Actions check
24
+ * @param logs - Raw log output
25
+ * @returns ErrorExtractorResult or null if extraction failed
26
+ */
27
+ async detectAndExtract(check, logs) {
28
+ // Handle empty logs
29
+ if (!logs || logs.trim().length === 0) {
30
+ return null;
31
+ }
32
+ // Try matrix mode first
33
+ const matrixResult = await this.extractFromMatrixMode(logs);
34
+ if (matrixResult) {
35
+ return matrixResult;
36
+ }
37
+ // Fall back to non-matrix mode
38
+ return await this.extractFromNonMatrixMode(check.name, logs);
39
+ }
40
+ /**
41
+ * Extract from matrix mode (validate YAML output)
42
+ *
43
+ * Looks for YAML markers (---...---) and extracts the "extraction" field.
44
+ *
45
+ * @param logs - Raw log output
46
+ * @returns ErrorExtractorResult or null if not matrix mode
47
+ */
48
+ async extractFromMatrixMode(logs) {
49
+ try {
50
+ // Strip GitHub Actions log prefixes from each line
51
+ // Format: <job-name>\t<step-name>\t[BOM]<timestamp> <content>
52
+ // Where BOM is optional UTF-8 BOM (U+FEFF)
53
+ const cleanedLogs = logs
54
+ .split('\n')
55
+ .map((line) => this.stripLogPrefix(line))
56
+ .join('\n');
57
+ // Find YAML document between --- markers (using RegExp.exec for sonarjs compliance)
58
+ // eslint-disable-next-line sonarjs/slow-regex -- NOSONAR: False positive - regex is safe for YAML markers
59
+ const yamlRegex = /^---\s*\n([\s\S]*?)\n---\s*$/m;
60
+ const yamlMatch = yamlRegex.exec(cleanedLogs);
61
+ if (!yamlMatch) {
62
+ return null;
63
+ }
64
+ // Parse and extract from YAML
65
+ const yamlContent = yamlMatch[1];
66
+ const parsed = YAML.parse(yamlContent);
67
+ if (!parsed || typeof parsed !== 'object') {
68
+ return null;
69
+ }
70
+ // Try extracting from root level first, then nested
71
+ return this.extractFromYAML(parsed);
72
+ }
73
+ catch {
74
+ // YAML parsing failed - not matrix mode
75
+ return null;
76
+ }
77
+ }
78
+ /**
79
+ * Extract from non-matrix mode (raw test output)
80
+ *
81
+ * Detects extractor from check name or logs, then runs extraction.
82
+ *
83
+ * @param _checkName - Check name (unused - autoDetectAndExtract handles detection)
84
+ * @param logs - Raw log output
85
+ * @returns ErrorExtractorResult or null if extraction failed
86
+ */
87
+ async extractFromNonMatrixMode(_checkName, logs) {
88
+ try {
89
+ // Strip GitHub Actions log prefixes (same cleaning as matrix mode)
90
+ const cleanedLogs = logs
91
+ .split('\n')
92
+ .map((line) => this.stripLogPrefix(line))
93
+ .join('\n');
94
+ // Use autoDetectAndExtract from @vibe-validate/extractors
95
+ // It handles extractor detection and extraction automatically
96
+ return autoDetectAndExtract(cleanedLogs);
97
+ }
98
+ catch {
99
+ // Extraction failed
100
+ return null;
101
+ }
102
+ }
103
+ /**
104
+ * Strip GitHub Actions log prefix from a single line
105
+ *
106
+ * @param line - Log line
107
+ * @returns Cleaned line
108
+ */
109
+ stripLogPrefix(line) {
110
+ // Match GitHub Actions log prefix (job name + step name + timestamp with optional BOM)
111
+ // Example: "Run job\tStep name\t2025-12-16T16:33:10.1212265Z content"
112
+ const githubActionsRegex = /^[^\t]+\t[^\t]+\t\uFEFF?\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z\s(.*)$/;
113
+ const githubMatch = githubActionsRegex.exec(line);
114
+ if (githubMatch) {
115
+ return githubMatch[1]; // Return content after prefix
116
+ }
117
+ // Fall back to simple timestamp stripping (for non-GitHub Actions logs)
118
+ const timestampRegex = /^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}\.\d+Z\s(.*)$/;
119
+ const timestampMatch = timestampRegex.exec(line);
120
+ if (timestampMatch) {
121
+ return timestampMatch[1]; // Return content after timestamp and space
122
+ }
123
+ return line; // Return line as-is if no prefix matched
124
+ }
125
+ /**
126
+ * Extract ErrorExtractorResult from parsed YAML
127
+ *
128
+ * Tries root level first (vibe-validate run output), then nested (vibe-validate validate output)
129
+ *
130
+ * @param parsed - Parsed YAML object
131
+ * @returns ErrorExtractorResult or null
132
+ */
133
+ extractFromYAML(parsed) {
134
+ // Check if extraction field exists at root (vibe-validate run output)
135
+ if ('extraction' in parsed) {
136
+ const extraction = this.validateExtraction(parsed.extraction);
137
+ if (extraction) {
138
+ return extraction;
139
+ }
140
+ }
141
+ // Check if extraction is nested in phases/steps (vibe-validate validate output)
142
+ if ('phases' in parsed && Array.isArray(parsed.phases)) {
143
+ return this.extractFromPhases(parsed.phases);
144
+ }
145
+ return null;
146
+ }
147
+ /**
148
+ * Extract ErrorExtractorResult from phases array (validate output)
149
+ *
150
+ * @param phases - Phases array
151
+ * @returns ErrorExtractorResult or null
152
+ */
153
+ extractFromPhases(phases) {
154
+ for (const phase of phases) {
155
+ const extraction = this.extractFromPhaseSteps(phase);
156
+ if (extraction) {
157
+ return extraction;
158
+ }
159
+ }
160
+ return null;
161
+ }
162
+ /**
163
+ * Extract ErrorExtractorResult from a single phase's steps
164
+ *
165
+ * @param phase - Phase object
166
+ * @returns ErrorExtractorResult or null
167
+ */
168
+ extractFromPhaseSteps(phase) {
169
+ if (!phase || typeof phase !== 'object' || !('steps' in phase) || !Array.isArray(phase.steps)) {
170
+ return null;
171
+ }
172
+ for (const step of phase.steps) {
173
+ if (step && typeof step === 'object' && 'extraction' in step) {
174
+ const extraction = this.validateExtraction(step.extraction);
175
+ if (extraction) {
176
+ // Return first extraction found (usually the failed step)
177
+ return extraction;
178
+ }
179
+ }
180
+ }
181
+ return null;
182
+ }
183
+ /**
184
+ * Validate extraction structure
185
+ *
186
+ * @param extraction - Extraction object
187
+ * @returns ErrorExtractorResult or null
188
+ */
189
+ validateExtraction(extraction) {
190
+ if (extraction &&
191
+ typeof extraction === 'object' &&
192
+ 'summary' in extraction &&
193
+ 'totalErrors' in extraction &&
194
+ 'errors' in extraction) {
195
+ return extraction;
196
+ }
197
+ return null;
198
+ }
199
+ }
200
+ //# sourceMappingURL=extraction-mode-detector.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"extraction-mode-detector.js","sourceRoot":"","sources":["../../src/services/extraction-mode-detector.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAEjE,OAAO,IAAI,MAAM,MAAM,CAAC;AAIxB;;;;GAIG;AACH,MAAM,OAAO,sBAAsB;IACjC;;;;;;OAMG;IACH,KAAK,CAAC,gBAAgB,CAAC,KAAwB,EAAE,IAAY;QAC3D,oBAAoB;QACpB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACtC,OAAO,IAAI,CAAC;Q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,UAAU;YAC3B,QAAQ,IAAI,UAAU,EACtB,CAAC;YACD,OAAO,UAAkC,CAAC;QAC5C,CAAC;QACD,OAAO,IAAI,CAAC;IACd,CAAC;CAEF"}
@@ -0,0 +1,234 @@
1
+ /**
2
+ * GitHubFetcher - Fetch PR metadata and check results from GitHub API
3
+ *
4
+ * Uses `gh` CLI to fetch:
5
+ * - Complete PR metadata (title, author, labels, linked issues, etc.)
6
+ * - Check results (GitHub Actions + external status checks)
7
+ * - Run logs from GitHub Actions
8
+ * - File changes from git diff
9
+ *
10
+ * @packageDocumentation
11
+ */
12
+ import { type GitHubJob } from '@vibe-validate/git';
13
+ import type { ChangesContext, CheckConclusion, CheckStatus, PRMetadata } from '../schemas/watch-pr-result.schema.js';
14
+ /**
15
+ * Check result (internal type for classification)
16
+ */
17
+ export interface CheckResult {
18
+ /** Check type (github_action or external) */
19
+ type: 'github_action' | 'external';
20
+ /** Check name */
21
+ name: string;
22
+ /** Check status */
23
+ status: CheckStatus;
24
+ /** Check conclusion (if completed) */
25
+ conclusion?: CheckConclusion;
26
+ /** GitHub run ID (for GitHub Actions) */
27
+ run_id?: number;
28
+ /** GitHub job ID (for matrix strategy jobs) */
29
+ job_id?: number;
30
+ /** Workflow name (for GitHub Actions) */
31
+ workflow?: string;
32
+ /** Started at (ISO 8601) */
33
+ started_at?: string;
34
+ /** Duration (human-readable) */
35
+ duration?: string;
36
+ /** URL (for external checks) */
37
+ url?: string;
38
+ /** Provider name (for external checks) */
39
+ provider?: string;
40
+ }
41
+ /**
42
+ * Run details (returned by fetchRunDetails)
43
+ */
44
+ export interface RunDetails {
45
+ /** GitHub run ID */
46
+ run_id: number;
47
+ /** Check/job name */
48
+ name: string;
49
+ /** Workflow name */
50
+ workflow: string;
51
+ /** Run status */
52
+ status: CheckStatus;
53
+ /** Run conclusion (if completed) */
54
+ conclusion?: CheckConclusion;
55
+ /** Started at (ISO 8601) */
56
+ started_at: string;
57
+ /** Duration (human-readable) */
58
+ duration: string;
59
+ /** Run URL */
60
+ url: string;
61
+ }
62
+ /**
63
+ * GitHubFetcher - Fetch PR data from GitHub API via gh CLI
64
+ */
65
+ export declare class GitHubFetcher {
66
+ private readonly owner?;
67
+ private readonly repo?;
68
+ /**
69
+ * Create GitHubFetcher
70
+ *
71
+ * @param owner - Repository owner (optional, defaults to current repo)
72
+ * @param repo - Repository name (optional, defaults to current repo)
73
+ */
74
+ constructor(owner?: string, repo?: string);
75
+ /**
76
+ * Fetch complete PR metadata
77
+ *
78
+ * @param prNumber - PR number
79
+ * @returns PR metadata
80
+ */
81
+ fetchPRDetails(prNumber: number): Promise<PRMetadata>;
82
+ /**
83
+ * Fetch check results (GitHub Actions + external)
84
+ *
85
+ * @param prNumber - PR number
86
+ * @returns Check results
87
+ */
88
+ fetchChecks(prNumber: number): Promise<CheckResult[]>;
89
+ /**
90
+ * Fetch run logs for a GitHub Actions run
91
+ *
92
+ * @param runId - GitHub run ID
93
+ * @param jobId - GitHub job ID (optional, for matrix strategy jobs)
94
+ * @returns Raw log output
95
+ *
96
+ * When jobId is provided, fetches logs for a specific job within the run.
97
+ * This is critical for matrix strategy builds where extraction needs job-specific logs.
98
+ */
99
+ fetchRunLogs(runId: number, jobId?: number): Promise<string>;
100
+ /**
101
+ * Fetch details for a specific GitHub Actions run
102
+ *
103
+ * Useful for watching specific failed runs to test extraction.
104
+ *
105
+ * @param runId - GitHub run ID
106
+ * @returns Run details
107
+ */
108
+ fetchRunDetails(runId: number): Promise<RunDetails>;
109
+ /**
110
+ * Fetch jobs for a workflow run
111
+ *
112
+ * @param runId - Run ID
113
+ * @returns List of jobs for the run
114
+ */
115
+ fetchRunJobs(runId: number): Promise<GitHubJob[]>;
116
+ /**
117
+ * Fetch all workflow runs for a PR
118
+ *
119
+ * @param prNumber - PR number
120
+ * @returns List of workflow runs
121
+ */
122
+ fetchRunsForPR(prNumber: number): Promise<Array<{
123
+ run_id: number;
124
+ workflow_name: string;
125
+ status: string;
126
+ conclusion: string | null;
127
+ started_at: string;
128
+ }>>;
129
+ /**
130
+ * Fetch file changes for a PR
131
+ *
132
+ * Uses git diff --numstat to get file change statistics.
133
+ *
134
+ * @param _prNumber - PR number (unused - we use git diff from current branch)
135
+ * @returns File change context
136
+ */
137
+ fetchFileChanges(_prNumber: number): Promise<ChangesContext>;
138
+ /**
139
+ * Classify check type
140
+ *
141
+ * @param check - Check object from GitHub API
142
+ * @returns 'CheckRun' or 'StatusContext'
143
+ */
144
+ private classifyCheck;
145
+ /**
146
+ * Map CheckRun to internal CheckResult
147
+ *
148
+ * @param check - CheckRun from GitHub API
149
+ * @returns CheckResult
150
+ */
151
+ private mapCheckRun;
152
+ /**
153
+ * Map StatusContext to internal CheckResult
154
+ *
155
+ * @param check - StatusContext from GitHub API
156
+ * @returns CheckResult
157
+ */
158
+ private mapStatusContext;
159
+ /**
160
+ * Extract run ID from GitHub Actions URL
161
+ *
162
+ * @param url - GitHub Actions URL
163
+ * @returns Run ID or null
164
+ */
165
+ private extractRunId;
166
+ /**
167
+ * Extract job ID from GitHub Actions URL
168
+ *
169
+ * Matrix strategy jobs have URLs like:
170
+ * https://github.com/owner/repo/actions/runs/12345/job/67890
171
+ *
172
+ * @param url - GitHub Actions URL
173
+ * @returns Job ID or null
174
+ */
175
+ private extractJobId;
176
+ /**
177
+ * Extract workflow name from check name
178
+ *
179
+ * @param checkName - Check name (e.g., "CI / Build")
180
+ * @returns Workflow name
181
+ */
182
+ private extractWorkflowName;
183
+ /**
184
+ * Calculate duration between two timestamps
185
+ *
186
+ * @param start - Start time (ISO 8601)
187
+ * @param end - End time (ISO 8601, optional - defaults to now)
188
+ * @returns Human-readable duration (e.g., "2m30s")
189
+ */
190
+ private calculateDuration;
191
+ /**
192
+ * Normalize GitHub status to CheckStatus
193
+ *
194
+ * @param status - GitHub status
195
+ * @returns CheckStatus
196
+ */
197
+ private normalizeStatus;
198
+ /**
199
+ * Normalize GitHub conclusion to CheckConclusion
200
+ *
201
+ * @param conclusion - GitHub conclusion
202
+ * @returns CheckConclusion
203
+ */
204
+ private normalizeConclusion;
205
+ /**
206
+ * Normalize StatusContext state to CheckConclusion
207
+ *
208
+ * @param state - StatusContext state
209
+ * @returns CheckConclusion
210
+ */
211
+ private normalizeStatusContextState;
212
+ /**
213
+ * Normalize merge state status
214
+ *
215
+ * @param status - GitHub merge state status
216
+ * @returns MergeStateStatus
217
+ */
218
+ private normalizeMergeStateStatus;
219
+ /**
220
+ * Extract linked issues from closing issues references
221
+ *
222
+ * @param closingIssuesReferences - Closing issues references from GitHub API
223
+ * @returns Linked issues
224
+ */
225
+ private extractLinkedIssues;
226
+ /**
227
+ * Detect provider from check name
228
+ *
229
+ * @param checkName - Check name
230
+ * @returns Provider name
231
+ */
232
+ private detectProvider;
233
+ }
234
+ //# sourceMappingURL=github-fetcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"github-fetcher.d.ts","sourceRoot":"","sources":["../../src/services/github-fetcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EASL,KAAK,SAAS,EACf,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EACV,cAAc,EACd,eAAe,EACf,WAAW,EAIX,UAAU,EACX,MAAM,sCAAsC,CAAC;AAE9C;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,6CAA6C;IAC7C,IAAI,EAAE,eAAe,GAAG,UAAU,CAAC;IAEnC,iBAAiB;IACjB,IAAI,EAAE,MAAM,CAAC;IAEb,mBAAmB;IACnB,MAAM,EAAE,WAAW,CAAC;IAEpB,sCAAsC;IACtC,UAAU,CAAC,EAAE,eAAe,CAAC;IAE7B,yCAAyC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,4BAA4B;IAC5B,UAAU,CAAC,EAAE,MAAM,CAAC;IAEpB,gCAAgC;IAChC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