@idea1/cli 1.11.0 → 1.11.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 (43) hide show
  1. package/README.md +48 -29
  2. package/dist/commands/help.d.ts.map +1 -1
  3. package/dist/commands/help.js +20 -14
  4. package/dist/commands/help.js.map +1 -1
  5. package/dist/commands/release.d.ts +7 -3
  6. package/dist/commands/release.d.ts.map +1 -1
  7. package/dist/commands/release.js +51 -26
  8. package/dist/commands/release.js.map +1 -1
  9. package/dist/lib/settings.d.ts +18 -3
  10. package/dist/lib/settings.d.ts.map +1 -1
  11. package/dist/lib/settings.js +14 -1
  12. package/dist/lib/settings.js.map +1 -1
  13. package/dist/services/github.d.ts +21 -19
  14. package/dist/services/github.d.ts.map +1 -1
  15. package/dist/services/github.js +56 -64
  16. package/dist/services/github.js.map +1 -1
  17. package/dist/services/platform-auth.d.ts +3 -2
  18. package/dist/services/platform-auth.d.ts.map +1 -1
  19. package/dist/services/platform-auth.js +105 -9
  20. package/dist/services/platform-auth.js.map +1 -1
  21. package/dist/services/platform.d.ts +52 -2
  22. package/dist/services/platform.d.ts.map +1 -1
  23. package/dist/services/platform.js +66 -1
  24. package/dist/services/platform.js.map +1 -1
  25. package/dist/types/index.d.ts +16 -0
  26. package/dist/types/index.d.ts.map +1 -1
  27. package/dist/workflow/engine/approval-flow.d.ts +28 -11
  28. package/dist/workflow/engine/approval-flow.d.ts.map +1 -1
  29. package/dist/workflow/engine/approval-flow.js +52 -17
  30. package/dist/workflow/engine/approval-flow.js.map +1 -1
  31. package/dist/workflow/engine/handlers/approve-pr.d.ts +10 -9
  32. package/dist/workflow/engine/handlers/approve-pr.d.ts.map +1 -1
  33. package/dist/workflow/engine/handlers/approve-pr.js +24 -17
  34. package/dist/workflow/engine/handlers/approve-pr.js.map +1 -1
  35. package/dist/workflow/engine/release-engine.d.ts +84 -56
  36. package/dist/workflow/engine/release-engine.d.ts.map +1 -1
  37. package/dist/workflow/engine/release-engine.js +281 -157
  38. package/dist/workflow/engine/release-engine.js.map +1 -1
  39. package/dist/workflow/engine/workflow-engine.d.ts +9 -2
  40. package/dist/workflow/engine/workflow-engine.d.ts.map +1 -1
  41. package/dist/workflow/engine/workflow-engine.js +20 -2
  42. package/dist/workflow/engine/workflow-engine.js.map +1 -1
  43. package/package.json +1 -1
@@ -1,22 +1,23 @@
1
1
  import { logger } from '../../../lib/logger.js';
2
2
  import * as git from '../../../services/git.js';
3
3
  import * as github from '../../../services/github.js';
4
+ import * as platform from '../../../services/platform.js';
4
5
  import { WorkflowBranchState } from '../../data/workflow-context.js';
5
6
  import { WorkflowStates } from '../../data/workflow-states.js';
6
- import { cleanUpMergedBranch, mergeAsApprover, mergeConfirmationOption } from '../approval-flow.js';
7
- import { confirmApproverIdentity } from '../release-engine.js';
8
- import { isWorkMerged, requireContext, requireLiveContext } from '../workflow-engine.js';
7
+ import { cleanUpMergedBranch, mergeAsApprover, mergeConfirmationOption, requireSignedInAssignee } from '../approval-flow.js';
8
+ import { RECORDED_BY_PLATFORM, isWorkMerged, requireContext, requireLiveContext } from '../workflow-engine.js';
9
9
  /**
10
- * Entering "Approved and Merged": merge the PR. The merge IS the approval - it is performed by
11
- * the PR's assignee, and GitHub records it as `merged_by` with a timestamp and merge commit
12
- * (change-management-policy.md, "Approval and release gates", stage 1). The merge waits for the required CI/CD checks
13
- * and there is no override at this stage: a red or unfinished suite stops it. A repository with no
14
- * CI/CD configured has no suite to wait for, so its PR merges straight away.
10
+ * Entering "Approved and Merged": the PR's assignee approves it, which merges it
11
+ * (change-management-policy.md, "Approval and release gates", stage 1). The approval waits for the
12
+ * required CI/CD checks and there is no override at this stage: a red or unfinished suite stops it.
13
+ * A repository with no CI/CD configured has no suite to wait for, so its PR is approved straight
14
+ * away.
15
15
  *
16
- * The branch is merged as it stands, so the checks waited for are the checks of what merges.
17
- * Afterwards the branch and any worktree are cleaned up; the platform records the branch as merged
18
- * when GitHub reports its deletion. A context whose branch is already merged has all the pull
19
- * request work done, so re-entering this state leaves it as it is.
16
+ * Once the checks pass the item is moved into this state on the platform, which records the
17
+ * signed-in user's approval on the PR, merges it as the Idea1 GitHub App and records the state, all
18
+ * in that one transition. The branch is merged as it stands, so the checks waited for are the checks
19
+ * of what merges. Afterwards the branch and any worktree are cleaned up. A context whose branch is
20
+ * already merged has all the pull request work done, so re-entering this state leaves it as it is.
20
21
  */
21
22
  export const approvePrHandler = {
22
23
  state: WorkflowStates.ApprovedAndMerged,
@@ -43,14 +44,20 @@ export const approvePrHandler = {
43
44
  context.branchState = WorkflowBranchState.Merged;
44
45
  return;
45
46
  }
46
- await confirmApproverIdentity(context.branchName);
47
- await mergeAsApprover({
47
+ await requireSignedInAssignee(context.branchName, context.baseBranch);
48
+ const expectedStatus = transition.currentState ?? '';
49
+ const recorded = await mergeAsApprover({
48
50
  branchName: context.branchName,
49
51
  baseBranch: context.baseBranch,
50
52
  prNumber: prInfo.number,
51
- confirmed: transition.options[mergeConfirmationOption.longName] === 'true'
53
+ confirmed: transition.options[mergeConfirmationOption.longName] === 'true',
54
+ approveOnPlatform: async () => (await platform.transitionWorkflow(transition.projectItemUrl, expectedStatus, WorkflowStates.ApprovedAndMerged)).workflowContext
52
55
  });
53
- context.branchState = WorkflowBranchState.Merged;
56
+ if (recorded.branchState !== WorkflowBranchState.Merged) {
57
+ throw new Error(`idea1.ai moved ${transition.projectItemUrl} to "${recorded.workflowStatus}" without merging PR #${prInfo.number}.`);
58
+ }
59
+ Object.assign(context, recorded);
60
+ return RECORDED_BY_PLATFORM;
54
61
  },
55
62
  async complete(transition) {
56
63
  const context = requireContext(transition);
@@ -62,7 +69,7 @@ export const approvePrHandler = {
62
69
  logger.newline();
63
70
  logger.success('Workflow complete!');
64
71
  logger.newline();
65
- logger.hint(`PR merged into ${context.baseBranch} - the merge is the recorded approval`);
72
+ logger.hint(`PR merged into ${context.baseBranch}, with your approval recorded on it`);
66
73
  logger.hint(`Project item: ${transition.projectItemUrl}`);
67
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;QACjC,OAAO,oBAAoB,CAAC;IAC9B,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,UAAU;QACvB,MAAM,OAAO,GAAG,cAAc,CAAC,UAAU,CAAC,CAAC;QAC3C,MAAM,mBAAmB,CAAC;YACxB,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,UAAU,EAAE,OAAO,CAAC,UAAU;YAC9B,WAAW,EAAE,UAAU,CAAC,WAAW;SACpC,CAAC,CAAC;QAEH,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,CAAC,OAAO,CAAC,oBAAoB,CAAC,CAAC;QACrC,MAAM,CAAC,OAAO,EAAE,CAAC;QACjB,MAAM,CAAC,IAAI,CAAC,kBAAkB,OAAO,CAAC,UAAU,qCAAqC,CAAC,CAAC;QACvF,MAAM,CAAC,IAAI,CAAC,iBAAiB,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC;IAC5D,CAAC;CACF,CAAC"}
@@ -1,25 +1,36 @@
1
1
  import type { CommandOption, VersionedPackage } from '../../types/index.js';
2
+ import * as github from '../../services/github.js';
2
3
  /**
3
4
  * The release engine: the gated PR sequence, a PR whose body is the approval chain of the changes it carries, assigned
4
5
  * to its approver, merged only once the required CI/CD checks have passed. `idea1 release` runs the
5
- * whole sequence here for both kinds of release into main: a planned release from the base branch,
6
- * whose changes were each approved on their own PR, and a hotfix release from the hotfix branch,
7
- * whose directly pushed commits are reviewed and approved in the release PR itself. That includes
8
- * the one sanctioned admin override (change-management-policy.md, "The automated gate"), recorded
9
- * on the PR before any merge happens. `idea1 ready-for-approval` opens a stage-1 change PR with the
10
- * same kind of body for a branch that has no project item (see approval-flow.ts).
6
+ * whole sequence here for the three kinds of release into main: a planned release from the base
7
+ * branch, whose changes were each approved on their own PR, a hotfix release from the hotfix branch,
8
+ * whose directly pushed commits are reviewed and approved in the release PR itself, and a content
9
+ * release from the content release branch (`release.contentRelease`), which carries no version bumps
10
+ * and changes only content. Once the checks pass, the Idea1 platform merges the release as the Idea1
11
+ * GitHub App, after recording the releaser's approval on the PR; the one sanctioned admin override
12
+ * (change-management-policy.md, "The automated gate") is the only merge made here, recorded on the
13
+ * PR before it happens. `idea1 ready-for-approval` opens a stage-1 change PR with the same kind of
14
+ * body for a branch that has no project item (see approval-flow.ts).
15
+ *
16
+ * Who may release is the repository's release roles: the members of the GitHub team
17
+ * `release.releaserTeam` release the base and hotfix branches, and the members of
18
+ * `release.contentRelease.releaserTeam` approve changes into the content release branch and release
19
+ * it. The CLI refuses anyone else before anything is committed or merged; the platform checks again.
11
20
  *
12
21
  * A release's version bumps land on the release branch before its PR is opened, so the PR's head,
13
22
  * and the one CI/CD run the release is gated on, already carry them. The packages that changed since
14
- * the last release are detected here, and this engine makes the bump itself: it edits each package's
15
- * `package.json` and the lockfiles above it in the local checkout, commits the edit as one
16
- * `chore: bump ...` commit, and pushes it. The repository only declares which folders are candidates
17
- * (`release.versionedPackages` in `.idea1/settings.json`); no script or workflow is involved.
23
+ * the last release are detected here, and this engine computes the bump from the local checkout: the
24
+ * new `version` of each package's `package.json` and of the lockfiles above it. The platform commits
25
+ * it onto the release branch as one `chore: bump ...` commit as the Idea1 GitHub App, accepting
26
+ * only those version edits, since a releaser need not be able to push to the release branch. The
27
+ * repository only declares which folders are candidates (`release.versionedPackages` in
28
+ * `.idea1/settings.json`); no script or workflow is involved.
18
29
  *
19
30
  * The platform's `ReleaseEngine` (backend-core/applicationlayer/workflow) runs the same release
20
31
  * sequence from the web app and writes the same PR and the same bump commit, by making the same edits
21
- * to the same files and committing them through the GitHub API instead of a local checkout, so a
22
- * release cut on either side reads the same. Both refuse a release the same way: when the releaser
32
+ * to the same files through the GitHub API, so a release cut on either side reads the same. Both
33
+ * refuse a release the same way: when the releaser
23
34
  * lacks the access a release needs (here the person running the command, there the GitHub App),
24
35
  * and when an open PR from the release branch into its target does not follow the release workflow;
25
36
  * and both refuse a planned release that carries a direct push, which only the CLI can release, once
@@ -27,6 +38,13 @@ import type { CommandOption, VersionedPackage } from '../../types/index.js';
27
38
  * `direct-allowed` in `.idea1/settings.json` accepts changes made directly on its release branch
28
39
  * instead: neither engine refuses such a release, and its PR lists the direct commits for its
29
40
  * assignee to review. Keep the two in step.
41
+ *
42
+ * A release PR lists every change it contains, including those that land on its branch after it is
43
+ * opened: the approval chain is a delimited section of the body, and before anything merges the PR
44
+ * the section is re-rendered from the branch as it stands, leaving the rest of the body as it is.
45
+ * Both engines render the same section for the same branch, and the platform also re-renders it on
46
+ * every push to the branch. A merge whose re-render fails goes ahead only when the branch has not
47
+ * moved since the section was rendered.
30
48
  */
31
49
  /** Which command opened the PR; shapes the PR body and the override record. */
32
50
  export interface GatedPrKind {
@@ -49,13 +67,15 @@ export interface GatedPrKind {
49
67
  }
50
68
  export declare const RELEASE_KIND: GatedPrKind;
51
69
  export declare const HOTFIX_RELEASE_KIND: GatedPrKind;
70
+ export declare const CONTENT_RELEASE_KIND: GatedPrKind;
52
71
  export declare const CHANGE_KIND: GatedPrKind;
53
72
  export type PrMode = 'create' | 'merge';
54
73
  /**
55
74
  * The `--pr-mode` option of `idea1 release`. `create` is the default: the PR is opened and the
56
75
  * approver merges it in GitHub once the required checks are green - that merge is the approval of
57
- * record, exactly as in `merge` mode, where the CLI turns on GitHub's auto-merge on the approver's
58
- * behalf (or, where GitHub can't auto-merge, waits for the checks and merges here).
76
+ * record. In `merge` mode the CLI waits for the checks and has the Idea1 platform merge the PR as
77
+ * the approver's recorded approval, exactly as `idea1 release --approve` does. A content release is
78
+ * always merged the second way.
59
79
  */
60
80
  export declare const PR_MODE_OPTION: CommandOption;
61
81
  /** The first line of the comment that records an admin override; the evidence script keys on it. */
@@ -112,9 +132,11 @@ export interface CommitVersionBumpsOptions {
112
132
  bumps: Record<string, VersionBumpType>;
113
133
  }
114
134
  /**
115
- * Bump the versions of the pending packages in one commit on the release branch and push it, so
116
- * the release PR opens against a branch that already carries them. The commit is `chore: bump
117
- * <package> <version>, ...` and is made as whoever runs the command.
135
+ * Bump the versions of the pending packages in one commit on the release branch, so the release PR
136
+ * opens against a branch that already carries them. The bump is computed from the checkout, which is
137
+ * level with origin, and the Idea1 platform commits it onto the branch as the Idea1 GitHub App -
138
+ * `chore: bump <package> <version>, ...`, naming the releaser - only while the branch is still at the
139
+ * checkout's tip. The checkout is then fast-forwarded to the bump.
118
140
  */
119
141
  export declare function commitVersionBumps(options: CommitVersionBumpsOptions): Promise<void>;
120
142
  interface BranchCommit {
@@ -137,15 +159,19 @@ export interface ApprovalChain {
137
159
  directPushRecord: DirectPushRecord | null;
138
160
  }
139
161
  /**
140
- * The PR body, written as the approval record for everything the PR carries.
141
- *
142
- * SOC2 change management asks who approved a change and when. Each change on the source branch
143
- * was already approved by its assignee, who merged its PR into that branch. Listing those merges
144
- * here makes this PR self-contained evidence: the whole chain is readable from the one PR an
145
- * auditor lands on. Commits are attributed to PRs through GitHub's own association, so squash and
146
- * rebase merges are covered, and a commit with no PR is shown rather than silently dropped.
162
+ * The body of a new gated PR, written as the approval record for everything the PR carries: its
163
+ * opening line, then the approval chain section. A direct push it carries with no recorded reason
164
+ * is refused unless a repository admin records why; that record is returned for posting on the PR.
147
165
  */
148
166
  export declare function buildApprovalChain(sourceBranch: string, targetBranch: string, kind: GatedPrKind): Promise<ApprovalChain>;
167
+ /**
168
+ * Re-render the approval chain section of an open gated PR from the source branch as it stands on
169
+ * origin now, and write it to the PR when it differs; the rest of the body stays as it is. Returns
170
+ * whether the body changed. The direct pushes already recorded on the PR stay accounted for; one
171
+ * that landed with no recorded reason is resolved as when the PR was opened - a repository admin
172
+ * records why, on the PR - or refused.
173
+ */
174
+ export declare function refreshApprovalChain(pr: github.OpenPr, sourceBranch: string, targetBranch: string, kind: GatedPrKind): Promise<boolean>;
149
175
  export interface CreateGatedPrOptions {
150
176
  sourceBranch: string;
151
177
  targetBranch: string;
@@ -159,40 +185,40 @@ export interface CreateGatedPrOptions {
159
185
  */
160
186
  export declare function createGatedPr(options: CreateGatedPrOptions): Promise<string>;
161
187
  /**
162
- * The PR's assignee is its approver of record, and GitHub records whoever merges as `merged_by`.
163
- * The two must be the same person for the record to name the right approver: no assignee means
164
- * no approver, and a different merger is an exception the evidence report calls out - so it
165
- * takes an explicit, eyes-open confirmation.
188
+ * The signed-in Idea1 user's linked GitHub login: the identity the platform records an approval
189
+ * under, checks against a PR's assignees and checks a release role for.
166
190
  */
167
- export declare function confirmApproverIdentity(branchName: string): Promise<void>;
191
+ export declare function signedInGitHubLogin(): Promise<string>;
168
192
  /**
169
- * Merge the PR once the required checks pass. Checks that fail, never start or never finish stop
170
- * the merge; a repository with no CI/CD configured has nothing to wait for and merges straight
171
- * away. The one sanctioned admin override remains: it needs an explicit confirmation, a stated
172
- * reason, and the exception must be recorded as a comment on the PR *before* the merge - if the
173
- * comment cannot be posted, nothing is merged.
193
+ * Refuse `login` a release role they lack: only the members of `team`, a GitHub team of the
194
+ * repository's organization named by `setting` in `.idea1/settings.json`, may `action`. A repository
195
+ * that names no team for the role leaves it to anyone the release workflow admits. The platform
196
+ * checks the same role again before it merges or commits anything.
174
197
  */
175
- export declare function mergeWithCheckGate(branchName: string, kind: GatedPrKind): Promise<void>;
176
- /** What `enableAutoMergeOrPoll` left the PR as. */
177
- export type AutoMergeOutcome = 'auto-merge-enabled' | 'merged';
198
+ export declare function requireReleaseRole(team: string | null, setting: string, login: string, action: string): Promise<void>;
178
199
  /**
179
- * Merge the PR the way that records the person running this as `merged_by`, without them having to
180
- * wait: GitHub's auto-merge, which merges once the required checks pass. Where GitHub can't
181
- * auto-merge (the PR is already mergeable, or the repository doesn't allow auto-merge), it falls
182
- * back to waiting for the checks here and merging (`mergeWithCheckGate`, with its admin-override
183
- * path). Any other refusal throws.
200
+ * Refuse a release by anyone outside the release role for its kind: `release.releaserTeam` for a
201
+ * planned or hotfix release, `release.contentRelease.releaserTeam` for a content release. Returns
202
+ * the releaser's linked GitHub login.
184
203
  */
185
- export declare function enableAutoMergeOrPoll(branchName: string, kind: GatedPrKind): Promise<AutoMergeOutcome>;
204
+ export declare function requireReleaser(kind: GatedPrKind, sourceBranch: string): Promise<string>;
205
+ /**
206
+ * Merge the release PR once the required checks pass: the Idea1 platform records the releaser's
207
+ * approval on the PR and merges it as the Idea1 GitHub App, after the PR's change list is brought up
208
+ * to date with what landed on the branch while the checks ran. Checks that fail, never start or
209
+ * never finish stop the merge; a repository with no CI/CD configured has nothing to wait for. The one
210
+ * sanctioned admin override remains, merged here as the admin: it needs an explicit confirmation, a
211
+ * stated reason, and the exception must be recorded as a comment on the PR *before* the merge - if
212
+ * the comment cannot be posted, nothing is merged.
213
+ */
214
+ export declare function mergeWithCheckGate(branchName: string, targetBranch: string, kind: GatedPrKind): Promise<void>;
186
215
  export interface RunPrModeOptions {
187
216
  mode: PrMode;
188
217
  sourceBranch: string;
189
218
  targetBranch: string;
190
219
  prUrl: string;
191
220
  kind: GatedPrKind;
192
- /**
193
- * Open the Actions page after a merge made here - the merge to main triggers the production
194
- * deploy. An auto-merge GitHub performs later opens nothing.
195
- */
221
+ /** Open the Actions page once the release has merged - the merge to main triggers the production deploy. */
196
222
  openActionsAfterMerge: boolean;
197
223
  /** The approver already said to merge (`--yes`), so the merge is not confirmed again. */
198
224
  confirmed: boolean;
@@ -200,9 +226,9 @@ export interface RunPrModeOptions {
200
226
  /**
201
227
  * Finish the sequence in the chosen mode. Either way the merge is the approval of record: in
202
228
  * `create` mode the approver performs it in GitHub once the checks are green; in `merge` mode the
203
- * CLI turns on GitHub's auto-merge as the approver, so GitHub merges once the checks pass and
204
- * records the approver as the merger - or, where GitHub can't auto-merge, waits for the checks and
205
- * merges here.
229
+ * CLI waits for the checks and the Idea1 platform merges it as the approver's recorded approval. A
230
+ * content release is merged only the second way, since its releaser cannot merge into the release
231
+ * target in GitHub, so `create` mode leaves it for `idea1 release --approve`.
206
232
  */
207
233
  export declare function runPrMode(options: RunPrModeOptions): Promise<void>;
208
234
  /**
@@ -213,12 +239,14 @@ export declare function runPrMode(options: RunPrModeOptions): Promise<void>;
213
239
  */
214
240
  export declare function ensureReleasable(sourceBranch: string, targetBranch: string): Promise<void>;
215
241
  /**
216
- * `idea1 release --approve`: approve and merge the open release PR from the source branch into the
217
- * target, as its approver. Only a PR that follows the release workflow is approved, and only by one
218
- * of its assignees, its approvers of record, exactly as the Idea1 web app approves it. With every
219
- * check passed it merges now; with checks still running it turns on auto-merge (or waits and merges
220
- * where GitHub can't auto-merge); with a failed check it goes to the gate's admin-override path,
221
- * which refuses unless the override is confirmed, reasoned and recorded.
242
+ * `idea1 release --approve`: approve the open release PR from the source branch into the target, as
243
+ * its approver, and have the Idea1 platform merge it. Only a PR that follows the release workflow is
244
+ * approved, and only by one of its assignees, its approvers of record, who holds the release role for
245
+ * its kind of release - the platform checks both again. The CLI waits for the required checks, and
246
+ * the platform records the approval on the PR and merges it as the Idea1 GitHub App; with a failed
247
+ * check it goes to the gate's admin-override path, which refuses unless the override is confirmed,
248
+ * reasoned and recorded. Before any of that, the PR's change list is brought up to date with what
249
+ * landed on the branch since it was opened.
222
250
  */
223
251
  export declare function approveRelease(sourceBranch: string, targetBranch: string, kind: GatedPrKind): Promise<void>;
224
252
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"release-engine.d.ts","sourceRoot":"","sources":["../../../src/workflow/engine/release-engine.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAQ5E;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAEH,+EAA+E;AAC/E,MAAM,WAAW,WAAW;IAC1B,+DAA+D;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,kDAAkD;IAClD,KAAK,EAAE,MAAM,CAAC;IACd;;;;;;;;OAQG;IACH,sBAAsB,EAAE,OAAO,CAAC;IAChC,oFAAoF;IACpF,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,YAAY,EAAE,WAM1B,CAAC;AACF,eAAO,MAAM,mBAAmB,EAAE,WAMjC,CAAC;AACF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