specweave 0.23.18 → 0.24.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.
- package/.claude-plugin/marketplace.json +93 -49
- package/CLAUDE.md +137 -4
- package/dist/src/cli/helpers/ado-area-path-mapper.d.ts +89 -0
- package/dist/src/cli/helpers/ado-area-path-mapper.d.ts.map +1 -0
- package/dist/src/cli/helpers/ado-area-path-mapper.js +213 -0
- package/dist/src/cli/helpers/ado-area-path-mapper.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.d.ts +29 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.d.ts.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.js +109 -0
- package/dist/src/cli/helpers/issue-tracker/ado-auto-discover.js.map +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado.d.ts +1 -0
- package/dist/src/cli/helpers/issue-tracker/ado.d.ts.map +1 -1
- package/dist/src/cli/helpers/issue-tracker/ado.js +2 -0
- package/dist/src/cli/helpers/issue-tracker/ado.js.map +1 -1
- package/dist/src/cli/helpers/smart-filter.d.ts +83 -0
- package/dist/src/cli/helpers/smart-filter.d.ts.map +1 -0
- package/dist/src/cli/helpers/smart-filter.js +265 -0
- package/dist/src/cli/helpers/smart-filter.js.map +1 -0
- package/dist/src/core/qa/quality-gate-decider.d.ts +1 -1
- package/dist/src/core/qa/quality-gate-decider.js +2 -2
- package/dist/src/core/qa/quality-gate-decider.js.map +1 -1
- package/dist/src/core/qa/risk-calculator.d.ts +2 -2
- package/dist/src/core/qa/risk-calculator.js +2 -2
- package/dist/src/core/validators/ac-presence-validator.d.ts +56 -0
- package/dist/src/core/validators/ac-presence-validator.d.ts.map +1 -0
- package/dist/src/core/validators/ac-presence-validator.js +149 -0
- package/dist/src/core/validators/ac-presence-validator.js.map +1 -0
- package/dist/src/integrations/ado/area-path-mapper.d.ts +137 -0
- package/dist/src/integrations/ado/area-path-mapper.d.ts.map +1 -0
- package/dist/src/integrations/ado/area-path-mapper.js +267 -0
- package/dist/src/integrations/ado/area-path-mapper.js.map +1 -0
- package/dist/src/integrations/jira/filter-processor.d.ts +126 -0
- package/dist/src/integrations/jira/filter-processor.d.ts.map +1 -0
- package/dist/src/integrations/jira/filter-processor.js +207 -0
- package/dist/src/integrations/jira/filter-processor.js.map +1 -0
- package/dist/src/integrations/jira/jira-client.d.ts +13 -0
- package/dist/src/integrations/jira/jira-client.d.ts.map +1 -1
- package/dist/src/integrations/jira/jira-client.js +33 -0
- package/dist/src/integrations/jira/jira-client.js.map +1 -1
- package/dist/src/utils/ac-embedder.d.ts +63 -0
- package/dist/src/utils/ac-embedder.d.ts.map +1 -0
- package/dist/src/utils/ac-embedder.js +217 -0
- package/dist/src/utils/ac-embedder.js.map +1 -0
- package/dist/src/utils/env-manager.d.ts +86 -0
- package/dist/src/utils/env-manager.d.ts.map +1 -0
- package/dist/src/utils/env-manager.js +188 -0
- package/dist/src/utils/env-manager.js.map +1 -0
- package/package.json +1 -1
- package/plugins/specweave/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave/agents/AGENTS-INDEX.md +1 -1
- package/plugins/specweave/agents/increment-quality-judge-v2/AGENT.md +9 -9
- package/plugins/specweave/commands/specweave-do.md +37 -0
- package/plugins/specweave/commands/specweave-done.md +159 -0
- package/plugins/specweave/commands/specweave-embed-acs.md +446 -0
- package/plugins/specweave/commands/specweave-next.md +148 -3
- package/plugins/specweave/commands/specweave-qa.md +2 -2
- package/plugins/specweave/hooks/pre-increment-start.sh +168 -0
- package/plugins/specweave/skills/SKILLS-INDEX.md +1 -1
- package/plugins/specweave-ado/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-ado/commands/specweave-ado-import-projects.md +331 -0
- package/plugins/specweave-alternatives/.claude-plugin/plugin.json +10 -0
- package/plugins/specweave-alternatives/commands/alternatives-analyze.md +336 -0
- package/plugins/specweave-alternatives/skills/architecture-alternatives/SKILL.md +651 -0
- package/plugins/specweave-alternatives/skills/bmad-method/SKILL.md +420 -0
- package/plugins/specweave-alternatives/skills/spec-kit-expert/SKILL.md +487 -0
- package/plugins/specweave-backend/commands/api-scaffold.md +80 -0
- package/plugins/specweave-backend/commands/crud-generate.md +109 -0
- package/plugins/specweave-backend/commands/migration-generate.md +139 -0
- package/plugins/specweave-confluent/commands/connector-deploy.md +154 -0
- package/plugins/specweave-confluent/commands/ksqldb-query.md +179 -0
- package/plugins/specweave-confluent/commands/schema-register.md +123 -0
- package/plugins/specweave-core/.claude-plugin/plugin.json +21 -0
- package/plugins/specweave-core/commands/architecture-review.md +288 -0
- package/plugins/specweave-core/commands/code-review.md +213 -0
- package/plugins/specweave-core/commands/refactor-plan.md +249 -0
- package/plugins/specweave-core/skills/code-quality/SKILL.md +157 -0
- package/plugins/specweave-core/skills/design-patterns/SKILL.md +244 -0
- package/plugins/specweave-core/skills/software-architecture/SKILL.md +83 -0
- package/plugins/specweave-cost-optimizer/.claude-plugin/plugin.json +22 -0
- package/plugins/specweave-cost-optimizer/commands/cost-analyze.md +360 -0
- package/plugins/specweave-cost-optimizer/commands/cost-optimize.md +480 -0
- package/plugins/specweave-cost-optimizer/skills/aws-cost-expert/SKILL.md +416 -0
- package/plugins/specweave-cost-optimizer/skills/cloud-pricing/SKILL.md +325 -0
- package/plugins/specweave-cost-optimizer/skills/cost-optimization/SKILL.md +337 -0
- package/plugins/specweave-diagrams/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-diagrams/commands/diagrams-generate.md +168 -0
- package/plugins/specweave-docs/.claude-plugin/plugin.json +10 -0
- package/plugins/specweave-docs/commands/docs-generate.md +441 -0
- package/plugins/specweave-docs/commands/docs-init.md +334 -0
- package/plugins/specweave-docs/skills/docusaurus/SKILL.md +581 -0
- package/plugins/specweave-docs/skills/spec-driven-brainstorming/SKILL.md +689 -0
- package/plugins/specweave-docs/skills/technical-writing/SKILL.md +1039 -0
- package/plugins/specweave-docs-preview/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-figma/.claude-plugin/plugin.json +23 -0
- package/plugins/specweave-figma/commands/figma-import.md +690 -0
- package/plugins/specweave-figma/commands/figma-to-react.md +834 -0
- package/plugins/specweave-figma/commands/figma-tokens.md +815 -0
- package/plugins/specweave-frontend/.claude-plugin/plugin.json +21 -0
- package/plugins/specweave-frontend/agents/frontend-architect/AGENT.md +387 -0
- package/plugins/specweave-frontend/agents/frontend-architect/README.md +385 -0
- package/plugins/specweave-frontend/agents/frontend-architect/examples.md +590 -0
- package/plugins/specweave-frontend/agents/frontend-architect/templates/component-template.tsx +152 -0
- package/plugins/specweave-frontend/agents/frontend-architect/templates/hook-template.ts +311 -0
- package/plugins/specweave-frontend/agents/frontend-architect/templates/page-template.tsx +228 -0
- package/plugins/specweave-frontend/commands/component-generate.md +510 -0
- package/plugins/specweave-frontend/commands/design-system-init.md +494 -0
- package/plugins/specweave-frontend/commands/frontend-scaffold.md +207 -0
- package/plugins/specweave-frontend/commands/nextjs-setup.md +396 -0
- package/plugins/specweave-frontend/skills/design-system-architect/SKILL.md +278 -0
- package/plugins/specweave-frontend/skills/frontend/SKILL.md +420 -0
- package/plugins/specweave-frontend/skills/nextjs/SKILL.md +546 -0
- package/plugins/specweave-github/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-github/hooks/.specweave/logs/hooks-debug.log +194 -0
- package/plugins/specweave-infrastructure/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-jira/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-jira/commands/import-projects.js +183 -0
- package/plugins/specweave-jira/commands/import-projects.md +97 -0
- package/plugins/specweave-jira/commands/import-projects.ts +288 -0
- package/plugins/specweave-jira/commands/specweave-jira-import-projects.md +298 -0
- package/plugins/specweave-kafka/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-kafka-streams/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-kubernetes/commands/cluster-setup.md +262 -0
- package/plugins/specweave-kubernetes/commands/deployment-generate.md +242 -0
- package/plugins/specweave-kubernetes/commands/helm-scaffold.md +333 -0
- package/plugins/specweave-ml/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-mobile/commands/app-scaffold.md +233 -0
- package/plugins/specweave-mobile/commands/build-config.md +256 -0
- package/plugins/specweave-mobile/commands/screen-generate.md +289 -0
- package/plugins/specweave-n8n/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-plugin-dev/.claude-plugin/plugin.json +13 -12
- package/plugins/specweave-plugin-dev/commands/plugin-create.md +333 -0
- package/plugins/specweave-plugin-dev/commands/plugin-publish.md +339 -0
- package/plugins/specweave-plugin-dev/commands/plugin-test.md +293 -0
- package/plugins/specweave-plugin-dev/skills/claude-sdk/SKILL.md +162 -0
- package/plugins/specweave-plugin-dev/skills/marketplace-publishing/SKILL.md +263 -0
- package/plugins/specweave-plugin-dev/skills/plugin-development/SKILL.md +316 -0
- package/plugins/specweave-release/.claude-plugin/plugin.json +1 -1
- package/plugins/specweave-release/commands/specweave-release-npm.md +110 -0
- package/plugins/specweave-release/hooks/.specweave/logs/dora-tracking.log +168 -0
- package/plugins/specweave-testing/.claude-plugin/plugin.json +21 -0
- package/plugins/specweave-testing/agents/qa-engineer/AGENT.md +797 -0
- package/plugins/specweave-testing/agents/qa-engineer/README.md +443 -0
- package/plugins/specweave-testing/agents/qa-engineer/templates/playwright-e2e-test.ts +470 -0
- package/plugins/specweave-testing/agents/qa-engineer/templates/test-data-factory.ts +507 -0
- package/plugins/specweave-testing/agents/qa-engineer/templates/vitest-unit-test.ts +400 -0
- package/plugins/specweave-testing/agents/qa-engineer/test-strategies.md +726 -0
- package/plugins/specweave-testing/commands/e2e-setup.md +1081 -0
- package/plugins/specweave-testing/commands/test-coverage.md +979 -0
- package/plugins/specweave-testing/commands/test-generate.md +1156 -0
- package/plugins/specweave-testing/commands/test-init.md +409 -0
- package/plugins/specweave-testing/skills/e2e-playwright/SKILL.md +769 -0
- package/plugins/specweave-testing/skills/tdd-expert/SKILL.md +934 -0
- package/plugins/specweave-testing/skills/unit-testing-expert/SKILL.md +1011 -0
- package/plugins/specweave-tooling/.claude-plugin/plugin.json +22 -0
- package/plugins/specweave-tooling/commands/specweave-tooling-skill-create.md +691 -0
- package/plugins/specweave-tooling/commands/specweave-tooling-skill-package.md +751 -0
- package/plugins/specweave-tooling/commands/specweave-tooling-skill-validate.md +858 -0
- package/plugins/specweave-ui/.claude-plugin/plugin.json +10 -0
- package/plugins/specweave-ui/commands/ui-automate.md +199 -0
- package/plugins/specweave-ui/commands/ui-inspect.md +70 -0
- package/plugins/specweave-ui/skills/browser-automation/SKILL.md +314 -0
- package/plugins/specweave-ui/skills/ui-testing/SKILL.md +716 -0
- package/plugins/specweave-ui/skills/visual-regression/SKILL.md +728 -0
- package/plugins/specweave/commands/check-hooks.md +0 -257
- package/plugins/specweave/commands/specweave-archive-increments.md +0 -82
- package/plugins/specweave-plugin-dev/skills/plugin-expert/SKILL.md +0 -1231
- /package/plugins/specweave/{agents/code-reviewer.md → skills/code-reviewer/SKILL.md} +0 -0
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Azure DevOps Area Path Mapper
|
|
3
|
+
*
|
|
4
|
+
* Fetches, parses, and maps ADO area paths to SpecWeave project IDs.
|
|
5
|
+
* Supports hierarchical area paths with granularity selection:
|
|
6
|
+
* - Top-level only (e.g., Backend, Frontend)
|
|
7
|
+
* - Two-level (e.g., Backend-API, Backend-Database)
|
|
8
|
+
* - Full tree (all levels)
|
|
9
|
+
*
|
|
10
|
+
* NEW (v0.24.0): Enables multi-project organization in ADO
|
|
11
|
+
*
|
|
12
|
+
* @module integrations/ado/area-path-mapper
|
|
13
|
+
*/
|
|
14
|
+
import type { Logger } from '../../utils/logger.js';
|
|
15
|
+
export interface AreaPathNode {
|
|
16
|
+
id: string;
|
|
17
|
+
name: string;
|
|
18
|
+
path: string;
|
|
19
|
+
level: number;
|
|
20
|
+
parentPath?: string;
|
|
21
|
+
children?: AreaPathNode[];
|
|
22
|
+
hasChildren: boolean;
|
|
23
|
+
}
|
|
24
|
+
export interface AdoCredentials {
|
|
25
|
+
organization: string;
|
|
26
|
+
pat: string;
|
|
27
|
+
}
|
|
28
|
+
export type AreaPathGranularity = 'top-level' | 'two-level' | 'full-tree';
|
|
29
|
+
export interface AreaPathMapperOptions {
|
|
30
|
+
credentials: AdoCredentials;
|
|
31
|
+
project: string;
|
|
32
|
+
logger?: Logger;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* Area Path Mapper for Azure DevOps
|
|
36
|
+
*
|
|
37
|
+
* Fetches hierarchical area path structures and maps them to SpecWeave project IDs.
|
|
38
|
+
*/
|
|
39
|
+
export declare class AreaPathMapper {
|
|
40
|
+
private credentials;
|
|
41
|
+
private project;
|
|
42
|
+
private logger;
|
|
43
|
+
private apiVersion;
|
|
44
|
+
constructor(options: AreaPathMapperOptions);
|
|
45
|
+
/**
|
|
46
|
+
* Fetch area path tree from ADO
|
|
47
|
+
*
|
|
48
|
+
* Fetches the full hierarchical area path structure for the project.
|
|
49
|
+
* Uses $depth=10 to get deep hierarchies.
|
|
50
|
+
*
|
|
51
|
+
* @returns Root area path node with children
|
|
52
|
+
*/
|
|
53
|
+
fetchAreaPaths(): Promise<AreaPathNode>;
|
|
54
|
+
/**
|
|
55
|
+
* Parse area path tree recursively
|
|
56
|
+
*
|
|
57
|
+
* Converts ADO API response to normalized AreaPathNode tree structure.
|
|
58
|
+
*
|
|
59
|
+
* @param node - Raw ADO API node
|
|
60
|
+
* @param level - Current depth level (0 = root)
|
|
61
|
+
* @param parentPath - Parent area path
|
|
62
|
+
* @returns Parsed area path node
|
|
63
|
+
*/
|
|
64
|
+
parseAreaPathTree(node: any, level: number, parentPath: string): AreaPathNode;
|
|
65
|
+
/**
|
|
66
|
+
* Map area path to SpecWeave project ID
|
|
67
|
+
*
|
|
68
|
+
* Converts hierarchical area path to kebab-case project ID.
|
|
69
|
+
* Excludes root project name.
|
|
70
|
+
*
|
|
71
|
+
* Examples:
|
|
72
|
+
* - "Platform/Backend/API" → "backend-api"
|
|
73
|
+
* - "Platform/Frontend" → "frontend"
|
|
74
|
+
* - "Platform" → "platform"
|
|
75
|
+
*
|
|
76
|
+
* @param areaPath - Full area path (e.g., "Platform/Backend/API")
|
|
77
|
+
* @returns Kebab-case project ID
|
|
78
|
+
*/
|
|
79
|
+
mapToProjectId(areaPath: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* Convert string to kebab-case
|
|
82
|
+
*
|
|
83
|
+
* @param str - Input string
|
|
84
|
+
* @returns Kebab-case string
|
|
85
|
+
*/
|
|
86
|
+
private toKebabCase;
|
|
87
|
+
/**
|
|
88
|
+
* Flatten area paths with granularity selection
|
|
89
|
+
*
|
|
90
|
+
* Extracts nodes at specific level(s) from the tree.
|
|
91
|
+
*
|
|
92
|
+
* @param root - Root area path node
|
|
93
|
+
* @param granularity - Desired granularity level
|
|
94
|
+
* @returns Flattened array of nodes
|
|
95
|
+
*/
|
|
96
|
+
flattenAreaPaths(root: AreaPathNode, granularity: AreaPathGranularity): AreaPathNode[];
|
|
97
|
+
/**
|
|
98
|
+
* Get nodes at specific level
|
|
99
|
+
*
|
|
100
|
+
* Recursively collects nodes at the target depth level.
|
|
101
|
+
* If a branch doesn't reach the target level, includes the deepest node in that branch.
|
|
102
|
+
*
|
|
103
|
+
* @param node - Current node
|
|
104
|
+
* @param targetLevel - Target depth level
|
|
105
|
+
* @returns Nodes at target level (or deepest available)
|
|
106
|
+
*/
|
|
107
|
+
private getNodesByLevel;
|
|
108
|
+
/**
|
|
109
|
+
* Get all nodes (flatten entire tree)
|
|
110
|
+
*
|
|
111
|
+
* @param node - Root node
|
|
112
|
+
* @returns All nodes in tree
|
|
113
|
+
*/
|
|
114
|
+
private getAllNodes;
|
|
115
|
+
/**
|
|
116
|
+
* Prompt user for granularity selection
|
|
117
|
+
*
|
|
118
|
+
* Interactive CLI prompt to select area path granularity.
|
|
119
|
+
*
|
|
120
|
+
* @param areaPathTree - Area path tree for preview
|
|
121
|
+
* @returns Selected granularity
|
|
122
|
+
*/
|
|
123
|
+
promptAreaPathGranularity(areaPathTree: AreaPathNode): Promise<AreaPathGranularity>;
|
|
124
|
+
/**
|
|
125
|
+
* Get area path suggestions for project
|
|
126
|
+
*
|
|
127
|
+
* Analyzes area path tree and suggests best granularity based on structure.
|
|
128
|
+
*
|
|
129
|
+
* @param areaPathTree - Area path tree
|
|
130
|
+
* @returns Suggested granularity with reasoning
|
|
131
|
+
*/
|
|
132
|
+
suggestGranularity(areaPathTree: AreaPathNode): {
|
|
133
|
+
suggested: AreaPathGranularity;
|
|
134
|
+
reasoning: string;
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
//# sourceMappingURL=area-path-mapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"area-path-mapper.d.ts","sourceRoot":"","sources":["../../../../src/integrations/ado/area-path-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,MAAM,WAAW,YAAY;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,EAAE,YAAY,EAAE,CAAC;IAC1B,WAAW,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,cAAc;IAC7B,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,MAAM,CAAC;CACb;AAED,MAAM,MAAM,mBAAmB,GAAG,WAAW,GAAG,WAAW,GAAG,WAAW,CAAC;AAE1E,MAAM,WAAW,qBAAqB;IACpC,WAAW,EAAE,cAAc,CAAC;IAC5B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;;;GAIG;AACH,qBAAa,cAAc;IACzB,OAAO,CAAC,WAAW,CAAiB;IACpC,OAAO,CAAC,OAAO,CAAS;IACxB,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,UAAU,CAAS;gBAEf,OAAO,EAAE,qBAAqB;IAM1C;;;;;;;OAOG;IACG,cAAc,IAAI,OAAO,CAAC,YAAY,CAAC;IA6B7C;;;;;;;;;OASG;IACH,iBAAiB,CACf,IAAI,EAAE,GAAG,EACT,KAAK,EAAE,MAAM,EACb,UAAU,EAAE,MAAM,GACjB,YAAY;IAsBf;;;;;;;;;;;;;OAaG;IACH,cAAc,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM;IAaxC;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAQnB;;;;;;;;OAQG;IACH,gBAAgB,CACd,IAAI,EAAE,YAAY,EAClB,WAAW,EAAE,mBAAmB,GAC/B,YAAY,EAAE;IAgBjB;;;;;;;;;OASG;IACH,OAAO,CAAC,eAAe;IA4BvB;;;;;OAKG;IACH,OAAO,CAAC,WAAW;IAYnB;;;;;;;OAOG;IACG,yBAAyB,CAC7B,YAAY,EAAE,YAAY,GACzB,OAAO,CAAC,mBAAmB,CAAC;IAkC/B;;;;;;;OAOG;IACH,kBAAkB,CAAC,YAAY,EAAE,YAAY,GAAG;QAC9C,SAAS,EAAE,mBAAmB,CAAC;QAC/B,SAAS,EAAE,MAAM,CAAC;KACnB;CAiCF"}
|
|
@@ -0,0 +1,267 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Azure DevOps Area Path Mapper
|
|
3
|
+
*
|
|
4
|
+
* Fetches, parses, and maps ADO area paths to SpecWeave project IDs.
|
|
5
|
+
* Supports hierarchical area paths with granularity selection:
|
|
6
|
+
* - Top-level only (e.g., Backend, Frontend)
|
|
7
|
+
* - Two-level (e.g., Backend-API, Backend-Database)
|
|
8
|
+
* - Full tree (all levels)
|
|
9
|
+
*
|
|
10
|
+
* NEW (v0.24.0): Enables multi-project organization in ADO
|
|
11
|
+
*
|
|
12
|
+
* @module integrations/ado/area-path-mapper
|
|
13
|
+
*/
|
|
14
|
+
import { consoleLogger } from '../../utils/logger.js';
|
|
15
|
+
/**
|
|
16
|
+
* Area Path Mapper for Azure DevOps
|
|
17
|
+
*
|
|
18
|
+
* Fetches hierarchical area path structures and maps them to SpecWeave project IDs.
|
|
19
|
+
*/
|
|
20
|
+
export class AreaPathMapper {
|
|
21
|
+
constructor(options) {
|
|
22
|
+
this.apiVersion = '7.0'; // ADO API version
|
|
23
|
+
this.credentials = options.credentials;
|
|
24
|
+
this.project = options.project;
|
|
25
|
+
this.logger = options.logger ?? consoleLogger;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Fetch area path tree from ADO
|
|
29
|
+
*
|
|
30
|
+
* Fetches the full hierarchical area path structure for the project.
|
|
31
|
+
* Uses $depth=10 to get deep hierarchies.
|
|
32
|
+
*
|
|
33
|
+
* @returns Root area path node with children
|
|
34
|
+
*/
|
|
35
|
+
async fetchAreaPaths() {
|
|
36
|
+
try {
|
|
37
|
+
const url = `https://dev.azure.com/${this.credentials.organization}/${this.project}/_apis/wit/classificationnodes/areas?$depth=10&api-version=${this.apiVersion}`;
|
|
38
|
+
const auth = Buffer.from(`:${this.credentials.pat}`).toString('base64');
|
|
39
|
+
const response = await fetch(url, {
|
|
40
|
+
headers: {
|
|
41
|
+
'Authorization': `Basic ${auth}`,
|
|
42
|
+
'Accept': 'application/json'
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
if (!response.ok) {
|
|
46
|
+
const errorText = await response.text();
|
|
47
|
+
throw new Error(`ADO API error (${response.status}): ${errorText}`);
|
|
48
|
+
}
|
|
49
|
+
const data = await response.json();
|
|
50
|
+
// Parse the tree structure
|
|
51
|
+
return this.parseAreaPathTree(data, 0, '');
|
|
52
|
+
}
|
|
53
|
+
catch (error) {
|
|
54
|
+
this.logger.error(`❌ Failed to fetch area paths: ${error.message}`);
|
|
55
|
+
throw error;
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Parse area path tree recursively
|
|
60
|
+
*
|
|
61
|
+
* Converts ADO API response to normalized AreaPathNode tree structure.
|
|
62
|
+
*
|
|
63
|
+
* @param node - Raw ADO API node
|
|
64
|
+
* @param level - Current depth level (0 = root)
|
|
65
|
+
* @param parentPath - Parent area path
|
|
66
|
+
* @returns Parsed area path node
|
|
67
|
+
*/
|
|
68
|
+
parseAreaPathTree(node, level, parentPath) {
|
|
69
|
+
const path = parentPath ? `${parentPath}/${node.name}` : node.name;
|
|
70
|
+
const parsed = {
|
|
71
|
+
id: node.id?.toString() || '',
|
|
72
|
+
name: node.name,
|
|
73
|
+
path,
|
|
74
|
+
level,
|
|
75
|
+
parentPath: parentPath || undefined,
|
|
76
|
+
hasChildren: Boolean(node.hasChildren === true || (node.children && node.children.length > 0))
|
|
77
|
+
};
|
|
78
|
+
// Recursively parse children
|
|
79
|
+
if (node.children && Array.isArray(node.children) && node.children.length > 0) {
|
|
80
|
+
parsed.children = node.children.map((child) => this.parseAreaPathTree(child, level + 1, path));
|
|
81
|
+
}
|
|
82
|
+
return parsed;
|
|
83
|
+
}
|
|
84
|
+
/**
|
|
85
|
+
* Map area path to SpecWeave project ID
|
|
86
|
+
*
|
|
87
|
+
* Converts hierarchical area path to kebab-case project ID.
|
|
88
|
+
* Excludes root project name.
|
|
89
|
+
*
|
|
90
|
+
* Examples:
|
|
91
|
+
* - "Platform/Backend/API" → "backend-api"
|
|
92
|
+
* - "Platform/Frontend" → "frontend"
|
|
93
|
+
* - "Platform" → "platform"
|
|
94
|
+
*
|
|
95
|
+
* @param areaPath - Full area path (e.g., "Platform/Backend/API")
|
|
96
|
+
* @returns Kebab-case project ID
|
|
97
|
+
*/
|
|
98
|
+
mapToProjectId(areaPath) {
|
|
99
|
+
const parts = areaPath.split('/').filter(Boolean);
|
|
100
|
+
// If root only, return root in kebab-case
|
|
101
|
+
if (parts.length === 1) {
|
|
102
|
+
return this.toKebabCase(parts[0]);
|
|
103
|
+
}
|
|
104
|
+
// Exclude root, join remaining parts with dash
|
|
105
|
+
const relevantParts = parts.slice(1);
|
|
106
|
+
return relevantParts.map(p => this.toKebabCase(p)).join('-');
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Convert string to kebab-case
|
|
110
|
+
*
|
|
111
|
+
* @param str - Input string
|
|
112
|
+
* @returns Kebab-case string
|
|
113
|
+
*/
|
|
114
|
+
toKebabCase(str) {
|
|
115
|
+
return str
|
|
116
|
+
.trim()
|
|
117
|
+
.toLowerCase()
|
|
118
|
+
.replace(/[^a-z0-9]+/g, '-') // Replace non-alphanumeric with dash
|
|
119
|
+
.replace(/^-+|-+$/g, ''); // Trim leading/trailing dashes
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Flatten area paths with granularity selection
|
|
123
|
+
*
|
|
124
|
+
* Extracts nodes at specific level(s) from the tree.
|
|
125
|
+
*
|
|
126
|
+
* @param root - Root area path node
|
|
127
|
+
* @param granularity - Desired granularity level
|
|
128
|
+
* @returns Flattened array of nodes
|
|
129
|
+
*/
|
|
130
|
+
flattenAreaPaths(root, granularity) {
|
|
131
|
+
switch (granularity) {
|
|
132
|
+
case 'top-level':
|
|
133
|
+
return this.getNodesByLevel(root, 1);
|
|
134
|
+
case 'two-level':
|
|
135
|
+
return this.getNodesByLevel(root, 2);
|
|
136
|
+
case 'full-tree':
|
|
137
|
+
return this.getAllNodes(root);
|
|
138
|
+
default:
|
|
139
|
+
throw new Error(`Invalid granularity: ${granularity}`);
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Get nodes at specific level
|
|
144
|
+
*
|
|
145
|
+
* Recursively collects nodes at the target depth level.
|
|
146
|
+
* If a branch doesn't reach the target level, includes the deepest node in that branch.
|
|
147
|
+
*
|
|
148
|
+
* @param node - Current node
|
|
149
|
+
* @param targetLevel - Target depth level
|
|
150
|
+
* @returns Nodes at target level (or deepest available)
|
|
151
|
+
*/
|
|
152
|
+
getNodesByLevel(node, targetLevel) {
|
|
153
|
+
const results = [];
|
|
154
|
+
if (node.level === targetLevel) {
|
|
155
|
+
results.push(node);
|
|
156
|
+
return results;
|
|
157
|
+
}
|
|
158
|
+
// If node is at a level before target and has no children, include it
|
|
159
|
+
// (handles branches that don't reach target depth)
|
|
160
|
+
if (node.level < targetLevel && !node.children) {
|
|
161
|
+
results.push(node);
|
|
162
|
+
return results;
|
|
163
|
+
}
|
|
164
|
+
// Recurse into children
|
|
165
|
+
if (node.children) {
|
|
166
|
+
for (const child of node.children) {
|
|
167
|
+
results.push(...this.getNodesByLevel(child, targetLevel));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return results;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Get all nodes (flatten entire tree)
|
|
174
|
+
*
|
|
175
|
+
* @param node - Root node
|
|
176
|
+
* @returns All nodes in tree
|
|
177
|
+
*/
|
|
178
|
+
getAllNodes(node) {
|
|
179
|
+
const results = [node];
|
|
180
|
+
if (node.children) {
|
|
181
|
+
for (const child of node.children) {
|
|
182
|
+
results.push(...this.getAllNodes(child));
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
return results;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Prompt user for granularity selection
|
|
189
|
+
*
|
|
190
|
+
* Interactive CLI prompt to select area path granularity.
|
|
191
|
+
*
|
|
192
|
+
* @param areaPathTree - Area path tree for preview
|
|
193
|
+
* @returns Selected granularity
|
|
194
|
+
*/
|
|
195
|
+
async promptAreaPathGranularity(areaPathTree) {
|
|
196
|
+
const inquirer = (await import('inquirer')).default;
|
|
197
|
+
// Calculate counts for each granularity
|
|
198
|
+
const topLevelCount = this.getNodesByLevel(areaPathTree, 1).length;
|
|
199
|
+
const twoLevelCount = this.getNodesByLevel(areaPathTree, 2).length;
|
|
200
|
+
const fullTreeCount = this.getAllNodes(areaPathTree).length;
|
|
201
|
+
const { granularity } = await inquirer.prompt([
|
|
202
|
+
{
|
|
203
|
+
type: 'list',
|
|
204
|
+
name: 'granularity',
|
|
205
|
+
message: 'Select area path granularity for project organization:',
|
|
206
|
+
choices: [
|
|
207
|
+
{
|
|
208
|
+
name: `Top-level only (${topLevelCount} projects) - e.g., Backend, Frontend`,
|
|
209
|
+
value: 'top-level'
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
name: `Two-level (${twoLevelCount} projects) - e.g., Backend-API, Backend-Database`,
|
|
213
|
+
value: 'two-level'
|
|
214
|
+
},
|
|
215
|
+
{
|
|
216
|
+
name: `Full tree (${fullTreeCount} projects) - All levels`,
|
|
217
|
+
value: 'full-tree'
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
default: 'two-level' // Most common use case
|
|
221
|
+
}
|
|
222
|
+
]);
|
|
223
|
+
return granularity;
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* Get area path suggestions for project
|
|
227
|
+
*
|
|
228
|
+
* Analyzes area path tree and suggests best granularity based on structure.
|
|
229
|
+
*
|
|
230
|
+
* @param areaPathTree - Area path tree
|
|
231
|
+
* @returns Suggested granularity with reasoning
|
|
232
|
+
*/
|
|
233
|
+
suggestGranularity(areaPathTree) {
|
|
234
|
+
const topLevelCount = this.getNodesByLevel(areaPathTree, 1).length;
|
|
235
|
+
const twoLevelCount = this.getNodesByLevel(areaPathTree, 2).length;
|
|
236
|
+
const fullTreeCount = this.getAllNodes(areaPathTree).length;
|
|
237
|
+
// Decision logic
|
|
238
|
+
if (topLevelCount <= 5) {
|
|
239
|
+
// Small tree: use top-level
|
|
240
|
+
return {
|
|
241
|
+
suggested: 'top-level',
|
|
242
|
+
reasoning: `Small hierarchy (${topLevelCount} top-level areas). Top-level is sufficient.`
|
|
243
|
+
};
|
|
244
|
+
}
|
|
245
|
+
else if (twoLevelCount <= 20) {
|
|
246
|
+
// Medium tree: use two-level
|
|
247
|
+
return {
|
|
248
|
+
suggested: 'two-level',
|
|
249
|
+
reasoning: `Balanced hierarchy (${twoLevelCount} two-level areas). Recommended granularity.`
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
else {
|
|
253
|
+
// Large/deep tree: might need two-level or top-level
|
|
254
|
+
if (fullTreeCount > 50) {
|
|
255
|
+
return {
|
|
256
|
+
suggested: 'top-level',
|
|
257
|
+
reasoning: `Large hierarchy (${fullTreeCount} total areas). Top-level keeps projects manageable.`
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
return {
|
|
261
|
+
suggested: 'two-level',
|
|
262
|
+
reasoning: `Complex hierarchy (${twoLevelCount} two-level areas). Two-level balances detail and simplicity.`
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
//# sourceMappingURL=area-path-mapper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"area-path-mapper.js","sourceRoot":"","sources":["../../../../src/integrations/ado/area-path-mapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAGH,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAyBtD;;;;GAIG;AACH,MAAM,OAAO,cAAc;IAMzB,YAAY,OAA8B;QAFlC,eAAU,GAAG,KAAK,CAAC,CAAC,kBAAkB;QAG5C,IAAI,CAAC,WAAW,GAAG,OAAO,CAAC,WAAW,CAAC;QACvC,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QAC/B,IAAI,CAAC,MAAM,GAAG,OAAO,CAAC,MAAM,IAAI,aAAa,CAAC;IAChD,CAAC;IAED;;;;;;;OAOG;IACH,KAAK,CAAC,cAAc;QAClB,IAAI,CAAC;YACH,MAAM,GAAG,GAAG,yBAAyB,IAAI,CAAC,WAAW,CAAC,YAAY,IAAI,IAAI,CAAC,OAAO,8DAA8D,IAAI,CAAC,UAAU,EAAE,CAAC;YAElK,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,I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kBAAkB,CAAC,YAA0B;QAI3C,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QACnE,MAAM,aAAa,GAAG,IAAI,CAAC,eAAe,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC;QACnE,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,YAAY,CAAC,CAAC,MAAM,CAAC;QAE5D,iBAAiB;QACjB,IAAI,aAAa,IAAI,CAAC,EAAE,CAAC;YACvB,4BAA4B;YAC5B,OAAO;gBACL,SAAS,EAAE,WAAW;gBACtB,SAAS,EAAE,oBAAoB,aAAa,6CAA6C;aAC1F,CAAC;QACJ,CAAC;aAAM,IAAI,aAAa,IAAI,EAAE,EAAE,CAAC;YAC/B,6BAA6B;YAC7B,OAAO;gBACL,SAAS,EAAE,WAAW;gBACtB,SAAS,EAAE,uBAAuB,aAAa,6CAA6C;aAC7F,CAAC;QACJ,CAAC;aAAM,CAAC;YACN,qDAAqD;YACrD,IAAI,aAAa,GAAG,EAAE,EAAE,CAAC;gBACvB,OAAO;oBACL,SAAS,EAAE,WAAW;oBACtB,SAAS,EAAE,oBAAoB,aAAa,qDAAqD;iBAClG,CAAC;YACJ,CAAC;YAED,OAAO;gBACL,SAAS,EAAE,WAAW;gBACtB,SAAS,EAAE,sBAAsB,aAAa,8DAA8D;aAC7G,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JIRA Filter Processor
|
|
3
|
+
*
|
|
4
|
+
* Smart filtering for JIRA projects with active/archived, type, lead, and JQL support.
|
|
5
|
+
*
|
|
6
|
+
* NEW (v0.24.0): Enables selective project imports with filter presets
|
|
7
|
+
*
|
|
8
|
+
* @module integrations/jira/filter-processor
|
|
9
|
+
*/
|
|
10
|
+
import { JiraClient } from './jira-client.js';
|
|
11
|
+
import type { Logger } from '../../utils/logger.js';
|
|
12
|
+
export interface FilterOptions {
|
|
13
|
+
active?: boolean;
|
|
14
|
+
types?: string[];
|
|
15
|
+
lead?: string;
|
|
16
|
+
jql?: string;
|
|
17
|
+
excludeArchived?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export interface FilterPreset {
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
filters: FilterOptions;
|
|
23
|
+
}
|
|
24
|
+
export interface JiraProject {
|
|
25
|
+
id: string;
|
|
26
|
+
key: string;
|
|
27
|
+
name: string;
|
|
28
|
+
projectTypeKey?: string;
|
|
29
|
+
lead?: {
|
|
30
|
+
displayName: string;
|
|
31
|
+
emailAddress: string;
|
|
32
|
+
};
|
|
33
|
+
archived?: boolean;
|
|
34
|
+
[key: string]: any;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Filter processor for JIRA projects
|
|
38
|
+
*/
|
|
39
|
+
export declare class FilterProcessor {
|
|
40
|
+
private client;
|
|
41
|
+
private logger;
|
|
42
|
+
private presets;
|
|
43
|
+
constructor(client: JiraClient, options?: {
|
|
44
|
+
logger?: Logger;
|
|
45
|
+
});
|
|
46
|
+
/**
|
|
47
|
+
* Initialize default filter presets
|
|
48
|
+
*/
|
|
49
|
+
private initializeDefaultPresets;
|
|
50
|
+
/**
|
|
51
|
+
* Add custom filter preset
|
|
52
|
+
*/
|
|
53
|
+
addPreset(preset: FilterPreset): void;
|
|
54
|
+
/**
|
|
55
|
+
* Get filter preset by name
|
|
56
|
+
*/
|
|
57
|
+
getPreset(name: string): FilterPreset | undefined;
|
|
58
|
+
/**
|
|
59
|
+
* List all available presets
|
|
60
|
+
*/
|
|
61
|
+
listPresets(): FilterPreset[];
|
|
62
|
+
/**
|
|
63
|
+
* Apply filters to project list
|
|
64
|
+
*
|
|
65
|
+
* @param projects - List of JIRA projects
|
|
66
|
+
* @param options - Filter options
|
|
67
|
+
* @returns Filtered project list
|
|
68
|
+
*/
|
|
69
|
+
applyFilters(projects: JiraProject[], options: FilterOptions): Promise<JiraProject[]>;
|
|
70
|
+
/**
|
|
71
|
+
* Filter active/archived projects
|
|
72
|
+
*
|
|
73
|
+
* @param projects - Project list
|
|
74
|
+
* @param activeOnly - If true, return only active projects
|
|
75
|
+
* @returns Filtered projects
|
|
76
|
+
*/
|
|
77
|
+
filterActive(projects: JiraProject[], activeOnly?: boolean): JiraProject[];
|
|
78
|
+
/**
|
|
79
|
+
* Filter by project type
|
|
80
|
+
*
|
|
81
|
+
* @param projects - Project list
|
|
82
|
+
* @param types - Allowed types (e.g., 'software', 'business', 'service_desk')
|
|
83
|
+
* @returns Filtered projects
|
|
84
|
+
*/
|
|
85
|
+
filterByType(projects: JiraProject[], types: string[]): JiraProject[];
|
|
86
|
+
/**
|
|
87
|
+
* Filter by project lead
|
|
88
|
+
*
|
|
89
|
+
* @param projects - Project list
|
|
90
|
+
* @param leadEmail - Lead email or display name
|
|
91
|
+
* @returns Filtered projects
|
|
92
|
+
*/
|
|
93
|
+
filterByLead(projects: JiraProject[], leadEmail: string): JiraProject[];
|
|
94
|
+
/**
|
|
95
|
+
* Filter by custom JQL
|
|
96
|
+
*
|
|
97
|
+
* Uses JIRA Search API to execute JQL query
|
|
98
|
+
*
|
|
99
|
+
* @param projects - Original project list
|
|
100
|
+
* @param jql - JQL query string
|
|
101
|
+
* @returns Projects matching JQL
|
|
102
|
+
*/
|
|
103
|
+
filterByJql(projects: JiraProject[], jql: string): Promise<JiraProject[]>;
|
|
104
|
+
/**
|
|
105
|
+
* Preview filter results
|
|
106
|
+
*
|
|
107
|
+
* @param projects - Project list
|
|
108
|
+
* @param options - Filter options
|
|
109
|
+
* @returns Preview summary
|
|
110
|
+
*/
|
|
111
|
+
previewFilters(projects: JiraProject[], options: FilterOptions): Promise<{
|
|
112
|
+
original: number;
|
|
113
|
+
filtered: number;
|
|
114
|
+
reduction: number;
|
|
115
|
+
preview: string;
|
|
116
|
+
}>;
|
|
117
|
+
/**
|
|
118
|
+
* Load preset and apply filters
|
|
119
|
+
*
|
|
120
|
+
* @param projects - Project list
|
|
121
|
+
* @param presetName - Preset name
|
|
122
|
+
* @returns Filtered projects
|
|
123
|
+
*/
|
|
124
|
+
applyPreset(projects: JiraProject[], presetName: string): Promise<JiraProject[]>;
|
|
125
|
+
}
|
|
126
|
+
//# sourceMappingURL=filter-processor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"filter-processor.d.ts","sourceRoot":"","sources":["../../../../src/integrations/jira/filter-processor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAGpD,MAAM,WAAW,aAAa;IAC5B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,aAAa,CAAC;CACxB;AAED,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,IAAI,CAAC,EAAE;QACL,WAAW,EAAE,MAAM,CAAC;QACpB,YAAY,EAAE,MAAM,CAAC;KACtB,CAAC;IACF,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAa;IAC3B,OAAO,CAAC,MAAM,CAAS;IACvB,O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