specweave 0.17.15 → 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 (166) hide show
  1. package/CLAUDE.md +405 -2495
  2. package/README.md +92 -2
  3. package/dist/plugins/specweave/lib/hooks/sync-living-docs.d.ts.map +1 -1
  4. package/dist/plugins/specweave/lib/hooks/sync-living-docs.js +188 -36
  5. package/dist/plugins/specweave/lib/hooks/sync-living-docs.js.map +1 -1
  6. package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts +54 -0
  7. package/dist/plugins/specweave-ado/lib/ado-status-sync.d.ts.map +1 -0
  8. package/dist/plugins/specweave-ado/lib/ado-status-sync.js +86 -0
  9. package/dist/plugins/specweave-ado/lib/ado-status-sync.js.map +1 -0
  10. package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts +139 -0
  11. package/dist/plugins/specweave-github/lib/duplicate-detector.d.ts.map +1 -0
  12. package/dist/plugins/specweave-github/lib/duplicate-detector.js +389 -0
  13. package/dist/plugins/specweave-github/lib/duplicate-detector.js.map +1 -0
  14. package/dist/plugins/specweave-github/lib/enhanced-github-sync.d.ts +26 -0
  15. package/dist/plugins/specweave-github/lib/enhanced-github-sync.d.ts.map +1 -0
  16. package/dist/plugins/specweave-github/lib/enhanced-github-sync.js +249 -0
  17. package/dist/plugins/specweave-github/lib/enhanced-github-sync.js.map +1 -0
  18. package/dist/plugins/specweave-github/lib/github-client.d.ts +1 -1
  19. package/dist/plugins/specweave-github/lib/github-client.d.ts.map +1 -1
  20. package/dist/plugins/specweave-github/lib/github-client.js +25 -13
  21. package/dist/plugins/specweave-github/lib/github-client.js.map +1 -1
  22. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts +83 -0
  23. package/dist/plugins/specweave-github/lib/github-epic-sync.d.ts.map +1 -0
  24. package/dist/plugins/specweave-github/lib/github-epic-sync.js +451 -0
  25. package/dist/plugins/specweave-github/lib/github-epic-sync.js.map +1 -0
  26. package/dist/plugins/specweave-github/lib/github-status-sync.d.ts +43 -0
  27. package/dist/plugins/specweave-github/lib/github-status-sync.d.ts.map +1 -0
  28. package/dist/plugins/specweave-github/lib/github-status-sync.js +82 -0
  29. package/dist/plugins/specweave-github/lib/github-status-sync.js.map +1 -0
  30. package/dist/plugins/specweave-github/lib/task-sync.d.ts +5 -0
  31. package/dist/plugins/specweave-github/lib/task-sync.d.ts.map +1 -1
  32. package/dist/plugins/specweave-github/lib/task-sync.js +38 -2
  33. package/dist/plugins/specweave-github/lib/task-sync.js.map +1 -1
  34. package/dist/plugins/specweave-jira/lib/jira-epic-sync.d.ts +66 -0
  35. package/dist/plugins/specweave-jira/lib/jira-epic-sync.d.ts.map +1 -0
  36. package/dist/plugins/specweave-jira/lib/jira-epic-sync.js +274 -0
  37. package/dist/plugins/specweave-jira/lib/jira-epic-sync.js.map +1 -0
  38. package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts +56 -0
  39. package/dist/plugins/specweave-jira/lib/jira-status-sync.d.ts.map +1 -0
  40. package/dist/plugins/specweave-jira/lib/jira-status-sync.js +93 -0
  41. package/dist/plugins/specweave-jira/lib/jira-status-sync.js.map +1 -0
  42. package/dist/src/cli/helpers/issue-tracker/index.d.ts.map +1 -1
  43. package/dist/src/cli/helpers/issue-tracker/index.js +48 -3
  44. package/dist/src/cli/helpers/issue-tracker/index.js.map +1 -1
  45. package/dist/src/core/living-docs/hierarchy-mapper.d.ts +142 -0
  46. package/dist/src/core/living-docs/hierarchy-mapper.d.ts.map +1 -0
  47. package/dist/src/core/living-docs/hierarchy-mapper.js +453 -0
  48. package/dist/src/core/living-docs/hierarchy-mapper.js.map +1 -0
  49. package/dist/src/core/living-docs/index.d.ts +10 -84
  50. package/dist/src/core/living-docs/index.d.ts.map +1 -1
  51. package/dist/src/core/living-docs/index.js +10 -164
  52. package/dist/src/core/living-docs/index.js.map +1 -1
  53. package/dist/src/core/living-docs/spec-distributor.d.ts +106 -0
  54. package/dist/src/core/living-docs/spec-distributor.d.ts.map +1 -0
  55. package/dist/src/core/living-docs/spec-distributor.js +823 -0
  56. package/dist/src/core/living-docs/spec-distributor.js.map +1 -0
  57. package/dist/src/core/living-docs/types.d.ts +201 -0
  58. package/dist/src/core/living-docs/types.d.ts.map +1 -0
  59. package/dist/src/core/living-docs/types.js +15 -0
  60. package/dist/src/core/living-docs/types.js.map +1 -0
  61. package/dist/src/core/logging/prompt-logger.d.ts +70 -0
  62. package/dist/src/core/logging/prompt-logger.d.ts.map +1 -0
  63. package/dist/src/core/logging/prompt-logger.js +247 -0
  64. package/dist/src/core/logging/prompt-logger.js.map +1 -0
  65. package/dist/src/core/status-line/status-line-manager.d.ts +15 -24
  66. package/dist/src/core/status-line/status-line-manager.d.ts.map +1 -1
  67. package/dist/src/core/status-line/status-line-manager.js +33 -70
  68. package/dist/src/core/status-line/status-line-manager.js.map +1 -1
  69. package/dist/src/core/status-line/types.d.ts +19 -31
  70. package/dist/src/core/status-line/types.d.ts.map +1 -1
  71. package/dist/src/core/status-line/types.js +5 -9
  72. package/dist/src/core/status-line/types.js.map +1 -1
  73. package/dist/src/core/sync/conflict-resolver.d.ts +66 -0
  74. package/dist/src/core/sync/conflict-resolver.d.ts.map +1 -0
  75. package/dist/src/core/sync/conflict-resolver.js +108 -0
  76. package/dist/src/core/sync/conflict-resolver.js.map +1 -0
  77. package/dist/src/core/sync/enhanced-content-builder.d.ts +77 -0
  78. package/dist/src/core/sync/enhanced-content-builder.d.ts.map +1 -0
  79. package/dist/src/core/sync/enhanced-content-builder.js +199 -0
  80. package/dist/src/core/sync/enhanced-content-builder.js.map +1 -0
  81. package/dist/src/core/sync/label-detector.d.ts +66 -0
  82. package/dist/src/core/sync/label-detector.d.ts.map +1 -0
  83. package/dist/src/core/sync/label-detector.js +211 -0
  84. package/dist/src/core/sync/label-detector.js.map +1 -0
  85. package/dist/src/core/sync/retry-logic.d.ts +64 -0
  86. package/dist/src/core/sync/retry-logic.d.ts.map +1 -0
  87. package/dist/src/core/sync/retry-logic.js +165 -0
  88. package/dist/src/core/sync/retry-logic.js.map +1 -0
  89. package/dist/src/core/sync/spec-increment-mapper.d.ts +100 -0
  90. package/dist/src/core/sync/spec-increment-mapper.d.ts.map +1 -0
  91. package/dist/src/core/sync/spec-increment-mapper.js +424 -0
  92. package/dist/src/core/sync/spec-increment-mapper.js.map +1 -0
  93. package/dist/src/core/sync/status-cache.d.ts +91 -0
  94. package/dist/src/core/sync/status-cache.d.ts.map +1 -0
  95. package/dist/src/core/sync/status-cache.js +140 -0
  96. package/dist/src/core/sync/status-cache.js.map +1 -0
  97. package/dist/src/core/sync/status-mapper.d.ts +69 -0
  98. package/dist/src/core/sync/status-mapper.d.ts.map +1 -0
  99. package/dist/src/core/sync/status-mapper.js +90 -0
  100. package/dist/src/core/sync/status-mapper.js.map +1 -0
  101. package/dist/src/core/sync/status-sync-engine.d.ts +162 -0
  102. package/dist/src/core/sync/status-sync-engine.d.ts.map +1 -0
  103. package/dist/src/core/sync/status-sync-engine.js +347 -0
  104. package/dist/src/core/sync/status-sync-engine.js.map +1 -0
  105. package/dist/src/core/sync/sync-event-logger.d.ts +99 -0
  106. package/dist/src/core/sync/sync-event-logger.d.ts.map +1 -0
  107. package/dist/src/core/sync/sync-event-logger.js +103 -0
  108. package/dist/src/core/sync/sync-event-logger.js.map +1 -0
  109. package/dist/src/core/sync/workflow-detector.d.ts +95 -0
  110. package/dist/src/core/sync/workflow-detector.d.ts.map +1 -0
  111. package/dist/src/core/sync/workflow-detector.js +175 -0
  112. package/dist/src/core/sync/workflow-detector.js.map +1 -0
  113. package/dist/src/core/types/config.d.ts.map +1 -1
  114. package/dist/src/core/types/config.js +31 -0
  115. package/dist/src/core/types/config.js.map +1 -1
  116. package/dist/src/utils/github-url.d.ts +53 -0
  117. package/dist/src/utils/github-url.d.ts.map +1 -0
  118. package/dist/src/utils/github-url.js +90 -0
  119. package/dist/src/utils/github-url.js.map +1 -0
  120. package/dist/src/utils/plugin-validator.d.ts +9 -0
  121. package/dist/src/utils/plugin-validator.d.ts.map +1 -1
  122. package/dist/src/utils/plugin-validator.js +86 -19
  123. package/dist/src/utils/plugin-validator.js.map +1 -1
  124. package/dist/src/utils/spec-parser.d.ts +145 -0
  125. package/dist/src/utils/spec-parser.d.ts.map +1 -0
  126. package/dist/src/utils/spec-parser.js +640 -0
  127. package/dist/src/utils/spec-parser.js.map +1 -0
  128. package/package.json +1 -1
  129. package/plugins/specweave/agents/pm/AGENT.md +1 -1
  130. package/plugins/specweave/agents/pm/templates/increment-spec.md +158 -0
  131. package/plugins/specweave/agents/pm/templates/living-docs-spec.md +113 -0
  132. package/plugins/specweave/commands/specweave-done.md +163 -0
  133. package/plugins/specweave/hooks/lib/update-status-line.sh +79 -111
  134. package/plugins/specweave/hooks/post-increment-planning.sh +107 -35
  135. package/plugins/specweave/lib/hooks/sync-living-docs.js +139 -34
  136. package/plugins/specweave/lib/hooks/sync-living-docs.ts +234 -38
  137. package/plugins/specweave/skills/SKILLS-INDEX.md +4 -24
  138. package/plugins/specweave/skills/increment-planner/SKILL.md +94 -0
  139. package/plugins/specweave/skills/increment-work-router/SKILL.md +466 -0
  140. package/plugins/specweave/skills/plugin-validator/SKILL.md +16 -13
  141. package/plugins/specweave-ado/lib/ado-status-sync.js +80 -0
  142. package/plugins/specweave-ado/lib/ado-status-sync.ts +121 -0
  143. package/plugins/specweave-github/commands/specweave-github-cleanup-duplicates.md +205 -0
  144. package/plugins/specweave-github/commands/specweave-github-sync-epic.md +248 -0
  145. package/plugins/specweave-github/lib/duplicate-detector.js +370 -0
  146. package/plugins/specweave-github/lib/duplicate-detector.ts +525 -0
  147. package/plugins/specweave-github/lib/enhanced-github-sync.js +220 -0
  148. package/plugins/specweave-github/lib/enhanced-github-sync.ts +322 -0
  149. package/plugins/specweave-github/lib/github-client.js +21 -10
  150. package/plugins/specweave-github/lib/github-client.ts +27 -16
  151. package/plugins/specweave-github/lib/github-epic-sync.js +489 -0
  152. package/plugins/specweave-github/lib/github-epic-sync.ts +690 -0
  153. package/plugins/specweave-github/lib/github-status-sync.js +71 -0
  154. package/plugins/specweave-github/lib/github-status-sync.ts +107 -0
  155. package/plugins/specweave-github/lib/task-sync.js +33 -2
  156. package/plugins/specweave-github/lib/task-sync.ts +44 -2
  157. package/plugins/specweave-jira/commands/specweave-jira-sync-epic.md +267 -0
  158. package/plugins/specweave-jira/lib/enhanced-jira-sync.ts.disabled +222 -0
  159. package/plugins/specweave-jira/lib/jira-epic-sync.js +304 -0
  160. package/plugins/specweave-jira/lib/jira-epic-sync.ts +459 -0
  161. package/plugins/specweave-jira/lib/jira-status-sync.js +79 -0
  162. package/plugins/specweave-jira/lib/jira-status-sync.ts +139 -0
  163. package/src/templates/AGENTS.md.template +88 -1
  164. package/src/templates/CLAUDE.md.template +49 -0
  165. package/plugins/specweave/skills/increment-quality-judge/SKILL.md +0 -524
  166. package/plugins/specweave/skills/plugin-installer/SKILL.md +0 -353
@@ -0,0 +1,165 @@
1
+ /**
2
+ * Retry Logic
3
+ *
4
+ * Provides retry functionality with exponential backoff.
5
+ * Handles transient errors (network, rate limits, timeouts).
6
+ *
7
+ * Retry Strategy:
8
+ * - Max 3 retries
9
+ * - Exponential backoff: 1s, 2s, 4s
10
+ * - Special handling for rate limits (wait and retry)
11
+ *
12
+ * @module retry-logic
13
+ */
14
+ /**
15
+ * Check if error is retryable
16
+ *
17
+ * @param error - Error to check
18
+ * @returns True if error is retryable
19
+ */
20
+ export function isRetryableError(error) {
21
+ const message = error.message.toLowerCase();
22
+ // Network errors
23
+ if (message.includes('network') ||
24
+ message.includes('timeout') ||
25
+ message.includes('econnreset') ||
26
+ message.includes('enotfound') ||
27
+ message.includes('econnrefused')) {
28
+ return true;
29
+ }
30
+ // Rate limit errors
31
+ if (message.includes('rate limit') ||
32
+ message.includes('429') ||
33
+ message.includes('too many requests')) {
34
+ return true;
35
+ }
36
+ // Temporary server errors
37
+ if (message.includes('500') ||
38
+ message.includes('502') ||
39
+ message.includes('503') ||
40
+ message.includes('504')) {
41
+ return true;
42
+ }
43
+ return false;
44
+ }
45
+ /**
46
+ * Extract rate limit wait time from error
47
+ *
48
+ * @param error - Error that may contain rate limit info
49
+ * @returns Wait time in milliseconds, or null if not rate limit error
50
+ */
51
+ export function extractRateLimitWaitTime(error) {
52
+ const message = error.message;
53
+ // GitHub: "Rate limit exceeded. Retry after 60 seconds."
54
+ const githubMatch = message.match(/retry after (\d+) seconds/i);
55
+ if (githubMatch) {
56
+ return parseInt(githubMatch[1]) * 1000;
57
+ }
58
+ // JIRA/ADO: "Rate limit exceeded. Retry-After: 120"
59
+ const retryAfterMatch = message.match(/retry-after:\s*(\d+)/i);
60
+ if (retryAfterMatch) {
61
+ return parseInt(retryAfterMatch[1]) * 1000;
62
+ }
63
+ // Generic rate limit: default wait 60 seconds
64
+ if (message.toLowerCase().includes('rate limit')) {
65
+ return 60 * 1000;
66
+ }
67
+ return null;
68
+ }
69
+ /**
70
+ * Retry function with exponential backoff
71
+ *
72
+ * @param fn - Function to retry
73
+ * @param options - Retry options
74
+ * @returns Retry result
75
+ */
76
+ export async function retryWithBackoff(fn, options) {
77
+ const maxRetries = options?.maxRetries || 3;
78
+ const initialDelay = options?.initialDelayMs || 1000;
79
+ const maxDelay = options?.maxDelayMs || 8000;
80
+ let lastError;
81
+ let totalDelay = 0;
82
+ for (let attempt = 1; attempt <= maxRetries + 1; attempt++) {
83
+ try {
84
+ const result = await fn();
85
+ return {
86
+ success: true,
87
+ result,
88
+ attempts: attempt,
89
+ totalDelayMs: totalDelay
90
+ };
91
+ }
92
+ catch (error) {
93
+ lastError = error instanceof Error ? error : new Error(String(error));
94
+ // If this is the last attempt, don't retry
95
+ if (attempt > maxRetries) {
96
+ break;
97
+ }
98
+ // Check if error is retryable
99
+ if (!isRetryableError(lastError)) {
100
+ // Non-retryable error - fail immediately
101
+ return {
102
+ success: false,
103
+ error: lastError,
104
+ attempts: attempt,
105
+ totalDelayMs: totalDelay
106
+ };
107
+ }
108
+ // Calculate delay
109
+ let delay = initialDelay * Math.pow(2, attempt - 1);
110
+ // Check for rate limit wait time
111
+ const rateLimitWait = extractRateLimitWaitTime(lastError);
112
+ if (rateLimitWait) {
113
+ delay = Math.min(rateLimitWait, maxDelay);
114
+ }
115
+ else {
116
+ delay = Math.min(delay, maxDelay);
117
+ }
118
+ totalDelay += delay;
119
+ // Wait before retry
120
+ await new Promise(resolve => setTimeout(resolve, delay));
121
+ }
122
+ }
123
+ return {
124
+ success: false,
125
+ error: lastError,
126
+ attempts: maxRetries + 1,
127
+ totalDelayMs: totalDelay
128
+ };
129
+ }
130
+ /**
131
+ * Create error message with retry information
132
+ *
133
+ * @param error - Original error
134
+ * @param attempts - Number of attempts made
135
+ * @returns Enhanced error message
136
+ */
137
+ export function createRetryErrorMessage(error, attempts) {
138
+ return `${error.message} (failed after ${attempts} attempts)`;
139
+ }
140
+ /**
141
+ * Check if error is permanent (not worth retrying)
142
+ *
143
+ * @param error - Error to check
144
+ * @returns True if error is permanent
145
+ */
146
+ export function isPermanentError(error) {
147
+ const message = error.message.toLowerCase();
148
+ // Authentication/Authorization errors
149
+ if (message.includes('401') ||
150
+ message.includes('403') ||
151
+ message.includes('unauthorized') ||
152
+ message.includes('forbidden')) {
153
+ return true;
154
+ }
155
+ // Not found errors
156
+ if (message.includes('404') || message.includes('not found')) {
157
+ return true;
158
+ }
159
+ // Bad request errors
160
+ if (message.includes('400') || message.includes('bad request')) {
161
+ return true;
162
+ }
163
+ return false;
164
+ }
165
+ //# sourceMappingURL=retry-logic.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"retry-logic.js","sourceRoot":"","sources":["../../../../src/core/sync/retry-logic.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAiBH;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,KAAY;IAC3C,MAAM,OAAO,GAAG,KAAK,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC;IAE5C,iBAAiB;IACjB,IACE,OAAO,CAAC,QAAQ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CAAC;IAED,mBAAmB;IACnB,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QAC7D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,qBAAqB;IACrB,IAAI,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAC,EAAE,CAAC;QAC/D,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC"}
@@ -0,0 +1,100 @@
1
+ /**
2
+ * Spec-to-Increment Mapper
3
+ *
4
+ * Maps permanent living docs specs to specific increment tasks.
5
+ * Enables traceability: "Which increment implemented US-001?"
6
+ */
7
+ export interface TaskInfo {
8
+ id: string;
9
+ title: string;
10
+ incrementId: string;
11
+ userStories: string[];
12
+ githubIssue?: number;
13
+ status?: 'pending' | 'in-progress' | 'completed';
14
+ }
15
+ export interface IncrementInfo {
16
+ id: string;
17
+ tasks: TaskInfo[];
18
+ specId?: string;
19
+ }
20
+ export interface SpecIncrementMapping {
21
+ specId: string;
22
+ increments: IncrementInfo[];
23
+ userStoryMappings: Record<string, TaskInfo[]>;
24
+ }
25
+ export interface TraceabilityReport {
26
+ specId: string;
27
+ totalUserStories: number;
28
+ totalIncrements: number;
29
+ totalTasks: number;
30
+ coverage: number;
31
+ unmappedUserStories: string[];
32
+ mappingDetails: Record<string, {
33
+ incrementId: string;
34
+ taskIds: string[];
35
+ }[]>;
36
+ }
37
+ export declare class SpecIncrementMapper {
38
+ private rootDir;
39
+ constructor(rootDir?: string);
40
+ /**
41
+ * Map a spec to all increments that implement it
42
+ */
43
+ mapSpecToIncrements(specId: string): Promise<SpecIncrementMapping>;
44
+ /**
45
+ * Find all increments that implement a specific user story
46
+ */
47
+ findIncrementsByUserStory(userStoryId: string): Promise<IncrementInfo[]>;
48
+ /**
49
+ * Get all tasks that implement a specific user story
50
+ */
51
+ getTasksForUserStory(userStoryId: string): Promise<TaskInfo[]>;
52
+ /**
53
+ * Update spec with increment links in frontmatter (Forward link)
54
+ */
55
+ updateSpecWithIncrementLinks(specId: string, incrementId: string): Promise<boolean>;
56
+ /**
57
+ * Update increment with spec link in frontmatter (Backward link)
58
+ */
59
+ updateIncrementWithSpecLink(incrementId: string, specId: string): Promise<boolean>;
60
+ /**
61
+ * Create bidirectional link between spec and increment (atomic operation)
62
+ */
63
+ createBidirectionalLink(specId: string, incrementId: string): Promise<{
64
+ success: boolean;
65
+ forwardLink: boolean;
66
+ backwardLink: boolean;
67
+ }>;
68
+ /**
69
+ * Get spec for a given increment (reverse lookup)
70
+ */
71
+ getSpecForIncrement(incrementId: string): Promise<string | null>;
72
+ /**
73
+ * Validate bidirectional links and detect broken references
74
+ */
75
+ validateLinks(): Promise<{
76
+ valid: boolean;
77
+ brokenForwardLinks: {
78
+ specId: string;
79
+ incrementId: string;
80
+ }[];
81
+ brokenBackwardLinks: {
82
+ incrementId: string;
83
+ specId: string;
84
+ }[];
85
+ orphanedIncrements: string[];
86
+ }>;
87
+ /**
88
+ * Build complete traceability report for a spec
89
+ */
90
+ buildTraceabilityReport(specId: string): Promise<TraceabilityReport>;
91
+ private findIncrementsForSpec;
92
+ private getTasksFromIncrement;
93
+ private extractTaskSection;
94
+ private extractUserStoriesFromTask;
95
+ private extractGithubIssue;
96
+ private extractTaskStatus;
97
+ private findSpecPath;
98
+ private getUserStoriesFromSpec;
99
+ }
100
+ //# sourceMappingURL=spec-increment-mapper.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"spec-increment-mapper.d.ts","sourceRoot":"","sources":["../../../../src/core/sync/spec-increment-mapper.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,EAAE,CAAC;IACt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