@momentiq/dark-factory-cli 0.1.0-alpha.4
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/LICENSE +201 -0
- package/README.md +150 -0
- package/dist/adapters/_shared.d.ts +45 -0
- package/dist/adapters/_shared.d.ts.map +1 -0
- package/dist/adapters/_shared.js +200 -0
- package/dist/adapters/_shared.js.map +1 -0
- package/dist/adapters/codex-sdk.d.ts +279 -0
- package/dist/adapters/codex-sdk.d.ts.map +1 -0
- package/dist/adapters/codex-sdk.js +930 -0
- package/dist/adapters/codex-sdk.js.map +1 -0
- package/dist/adapters/critic-result-schema.d.ts +215 -0
- package/dist/adapters/critic-result-schema.d.ts.map +1 -0
- package/dist/adapters/critic-result-schema.js +153 -0
- package/dist/adapters/critic-result-schema.js.map +1 -0
- package/dist/adapters/critic.d.ts +62 -0
- package/dist/adapters/critic.d.ts.map +1 -0
- package/dist/adapters/critic.js +79 -0
- package/dist/adapters/critic.js.map +1 -0
- package/dist/adapters/cursor-sdk.d.ts +153 -0
- package/dist/adapters/cursor-sdk.d.ts.map +1 -0
- package/dist/adapters/cursor-sdk.js +818 -0
- package/dist/adapters/cursor-sdk.js.map +1 -0
- package/dist/adapters/gemini-sdk.d.ts +113 -0
- package/dist/adapters/gemini-sdk.d.ts.map +1 -0
- package/dist/adapters/gemini-sdk.js +532 -0
- package/dist/adapters/gemini-sdk.js.map +1 -0
- package/dist/adapters/grok-direct-sdk.d.ts +148 -0
- package/dist/adapters/grok-direct-sdk.d.ts.map +1 -0
- package/dist/adapters/grok-direct-sdk.js +694 -0
- package/dist/adapters/grok-direct-sdk.js.map +1 -0
- package/dist/branch-protection/audit_branch_protection.py +759 -0
- package/dist/branch-protection/index.d.ts +25 -0
- package/dist/branch-protection/index.d.ts.map +1 -0
- package/dist/branch-protection/index.js +70 -0
- package/dist/branch-protection/index.js.map +1 -0
- package/dist/branch-protection/spec-default.yaml +314 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +581 -0
- package/dist/cli.js.map +1 -0
- package/dist/cycle-doc-validator/index.d.ts +43 -0
- package/dist/cycle-doc-validator/index.d.ts.map +1 -0
- package/dist/cycle-doc-validator/index.js +69 -0
- package/dist/cycle-doc-validator/index.js.map +1 -0
- package/dist/cycle-doc-validator/validate_cycle_doc.py +1260 -0
- package/dist/cycle-tracker-sync/attribute_pr_cycle_ref.py +384 -0
- package/dist/cycle-tracker-sync/index.d.ts +20 -0
- package/dist/cycle-tracker-sync/index.d.ts.map +1 -0
- package/dist/cycle-tracker-sync/index.js +71 -0
- package/dist/cycle-tracker-sync/index.js.map +1 -0
- package/dist/cycle-tracker-sync/sync_cycle_trackers.py +1093 -0
- package/dist/evidence/audit-trail.d.ts +59 -0
- package/dist/evidence/audit-trail.d.ts.map +1 -0
- package/dist/evidence/audit-trail.js +283 -0
- package/dist/evidence/audit-trail.js.map +1 -0
- package/dist/evidence/index.d.ts +4 -0
- package/dist/evidence/index.d.ts.map +1 -0
- package/dist/evidence/index.js +29 -0
- package/dist/evidence/index.js.map +1 -0
- package/dist/evidence/per-sha.d.ts +13 -0
- package/dist/evidence/per-sha.d.ts.map +1 -0
- package/dist/evidence/per-sha.js +97 -0
- package/dist/evidence/per-sha.js.map +1 -0
- package/dist/evidence/quality-gates.d.ts +19 -0
- package/dist/evidence/quality-gates.d.ts.map +1 -0
- package/dist/evidence/quality-gates.js +212 -0
- package/dist/evidence/quality-gates.js.map +1 -0
- package/dist/git.d.ts +40 -0
- package/dist/git.d.ts.map +1 -0
- package/dist/git.js +414 -0
- package/dist/git.js.map +1 -0
- package/dist/glob.d.ts +4 -0
- package/dist/glob.d.ts.map +1 -0
- package/dist/glob.js +99 -0
- package/dist/glob.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/paths.d.ts +12 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.js +42 -0
- package/dist/paths.js.map +1 -0
- package/dist/policy/baseline.d.ts +15 -0
- package/dist/policy/baseline.d.ts.map +1 -0
- package/dist/policy/baseline.js +115 -0
- package/dist/policy/baseline.js.map +1 -0
- package/dist/policy/config.d.ts +64 -0
- package/dist/policy/config.d.ts.map +1 -0
- package/dist/policy/config.js +363 -0
- package/dist/policy/config.js.map +1 -0
- package/dist/policy/gate.d.ts +80 -0
- package/dist/policy/gate.d.ts.map +1 -0
- package/dist/policy/gate.js +1019 -0
- package/dist/policy/gate.js.map +1 -0
- package/dist/policy/index.d.ts +7 -0
- package/dist/policy/index.d.ts.map +1 -0
- package/dist/policy/index.js +14 -0
- package/dist/policy/index.js.map +1 -0
- package/dist/policy/merge-queue.d.ts +183 -0
- package/dist/policy/merge-queue.d.ts.map +1 -0
- package/dist/policy/merge-queue.js +310 -0
- package/dist/policy/merge-queue.js.map +1 -0
- package/dist/policy/profile.d.ts +98 -0
- package/dist/policy/profile.d.ts.map +1 -0
- package/dist/policy/profile.js +156 -0
- package/dist/policy/profile.js.map +1 -0
- package/dist/policy/tdd-classifier.d.ts +18 -0
- package/dist/policy/tdd-classifier.d.ts.map +1 -0
- package/dist/policy/tdd-classifier.js +79 -0
- package/dist/policy/tdd-classifier.js.map +1 -0
- package/dist/prompt.d.ts +13 -0
- package/dist/prompt.d.ts.map +1 -0
- package/dist/prompt.js +175 -0
- package/dist/prompt.js.map +1 -0
- package/dist/report.d.ts +88 -0
- package/dist/report.d.ts.map +1 -0
- package/dist/report.js +376 -0
- package/dist/report.js.map +1 -0
- package/dist/runner.d.ts +30 -0
- package/dist/runner.d.ts.map +1 -0
- package/dist/runner.js +456 -0
- package/dist/runner.js.map +1 -0
- package/dist/security.d.ts +2 -0
- package/dist/security.d.ts.map +1 -0
- package/dist/security.js +19 -0
- package/dist/security.js.map +1 -0
- package/dist/trusted-surface/rebind.d.ts +10 -0
- package/dist/trusted-surface/rebind.d.ts.map +1 -0
- package/dist/trusted-surface/rebind.js +154 -0
- package/dist/trusted-surface/rebind.js.map +1 -0
- package/package.json +78 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Momentiq AI
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# @momentiq/dark-factory-cli
|
|
2
|
+
|
|
3
|
+
Dark Factory OSS CLI — multi-vendor adversarial critic orchestration.
|
|
4
|
+
|
|
5
|
+
## What this package gives you
|
|
6
|
+
|
|
7
|
+
All nine Dark Factory services extracted from sage3c, today consumable as a
|
|
8
|
+
TypeScript library and (for the Python-backed and Phase D services) as `df`
|
|
9
|
+
subcommands:
|
|
10
|
+
|
|
11
|
+
1. **Critic Orchestrator** (`./adapters/*`) — vendor-neutral adapter contract
|
|
12
|
+
(`CriticAdapter`) with concrete adapters for Cursor SDK, OpenAI Codex SDK,
|
|
13
|
+
Google Gemini, and Grok (xAI via OpenAI-compatible API).
|
|
14
|
+
2. **Policy Engine** (`./policy/*`) — gate evaluation, min-complete-quorum
|
|
15
|
+
aggregation, TDD classifier, finding-rubric strip, verification routes,
|
|
16
|
+
profile resolution, and config loading.
|
|
17
|
+
3. **Trusted-Surface Rebind** (`./trusted-surface/*`) — when a commit modifies
|
|
18
|
+
the trusted policy surface (config + guidance files + prompt fragments),
|
|
19
|
+
the rebind reads those inputs from the parent ref so the commit is reviewed
|
|
20
|
+
against the prior baseline (self-modification guard).
|
|
21
|
+
4. **Per-SHA Evidence Store** (`./evidence/*`) — canonical per-SHA quality-gate
|
|
22
|
+
evidence path layout + runner that writes/reads evidence files atomically.
|
|
23
|
+
5. **Cycle-Doc Trailer Validator** (`./cycle-doc-validator/*` + `df validate-cycle-doc`)
|
|
24
|
+
— enforces per-PR `Cycle:` / `Issue:` / `ProjectItem:` trailer rules.
|
|
25
|
+
6. **Merge Queue Admission Policy** (`./policy/merge-queue.ts` + `df admit-pr`) —
|
|
26
|
+
plan-vs-code PR classifier (the same heuristic sage3c's plan-PR review gate
|
|
27
|
+
uses) + the typed ruleset shape (`defaultMainRulesetShape`,
|
|
28
|
+
`defaultCeReviewRulesetShape`, `defaultMergeQueueRule`) that consumers
|
|
29
|
+
declare so the branch-protection auditor can detect drift against it.
|
|
30
|
+
7. **Branch-Protection Drift Detector** (`./branch-protection/*` + `df audit-branch-protection`)
|
|
31
|
+
— compares a declarative `spec.yaml` against the live GitHub ruleset.
|
|
32
|
+
8. **Audit / Compliance Trail** (`./evidence/audit-trail.ts` + `df audit stats`) —
|
|
33
|
+
the `_runs.ndjson` NDJSON sink + read/summarize/agreement-rate/quorum-stats
|
|
34
|
+
helpers behind the legacy `make agent-review-stats`. Every critic run,
|
|
35
|
+
every gate verdict, every bypass invocation appends here.
|
|
36
|
+
9. **Cycle Tracker Sync + PR Attribution** (`./cycle-tracker-sync/*` + `df sync-trackers` + `df attribute-pr`)
|
|
37
|
+
— reconciles GitHub tracker issues with cycle docs + writes the
|
|
38
|
+
`Cycle Ref` custom field on PR project items.
|
|
39
|
+
|
|
40
|
+
After Phase D all nine services are present in the package. Phase E adds the
|
|
41
|
+
reusable GitHub workflows that consumers wire up via `uses:`, plus stub
|
|
42
|
+
subcommands (`status-check`, `critic`) so those workflows can satisfy the
|
|
43
|
+
five required-status-check contexts in dark-factory's own ruleset while real
|
|
44
|
+
critic / aggregator logic lands in Phase F.
|
|
45
|
+
|
|
46
|
+
## Status
|
|
47
|
+
|
|
48
|
+
`0.1.0-alpha.3` — extracted from `momentiq-ai/sage3c:tools/agent-review/` +
|
|
49
|
+
`scripts/ci/` per cycle 331.1 Phases B, C, D, and E. Library API is stable;
|
|
50
|
+
the binary's `review`/`gate`/`doctor` subcommands are still stubs (Phase F);
|
|
51
|
+
the Phase E stubs (`status-check`, `critic`) intentionally exit 0 so the
|
|
52
|
+
reusable workflow shapes can break the dogfood chicken-and-egg.
|
|
53
|
+
|
|
54
|
+
## Install
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
npm install @momentiq/dark-factory-cli
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Library usage
|
|
61
|
+
|
|
62
|
+
```ts
|
|
63
|
+
import {
|
|
64
|
+
runReview,
|
|
65
|
+
evaluateCommitGate,
|
|
66
|
+
buildReviewPacket,
|
|
67
|
+
loadAgentReviewConfig,
|
|
68
|
+
runValidateCycleDoc,
|
|
69
|
+
runAuditBranchProtection,
|
|
70
|
+
runSyncCycleTrackers,
|
|
71
|
+
runAttributePrCycleRef,
|
|
72
|
+
} from "@momentiq/dark-factory-cli";
|
|
73
|
+
|
|
74
|
+
const loaded = await loadAgentReviewConfig(repoRoot);
|
|
75
|
+
const outcome = await runReview({ loaded, /* ... */ });
|
|
76
|
+
|
|
77
|
+
// Service #5 — validate a PR's cycle/issue trailers (subprocess-wraps the
|
|
78
|
+
// bundled Python script). Inherits stdio by default.
|
|
79
|
+
await runValidateCycleDoc({
|
|
80
|
+
env: { PR_NUMBER: "1234", PR_TITLE: "feat: ...", PR_BODY: "..." },
|
|
81
|
+
});
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
## CLI
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
df --help
|
|
88
|
+
df --version
|
|
89
|
+
|
|
90
|
+
# Phase C subcommands — each forwards remaining argv to the bundled Python
|
|
91
|
+
# script verbatim, so `df <sub> --help` returns the Python argparse banner.
|
|
92
|
+
df validate-cycle-doc --help
|
|
93
|
+
df audit-branch-protection --use-bundled-default-spec --repo owner/repo
|
|
94
|
+
df sync-trackers --dry-run
|
|
95
|
+
df attribute-pr # env-driven; needs PR_NUMBER, PR_NODE_ID, PR_BODY_FILE, PROJECT_TOKEN
|
|
96
|
+
|
|
97
|
+
# Phase D subcommands — pure-TS, parse flags directly.
|
|
98
|
+
df audit stats --path .git/agent-reviews/_runs.ndjson
|
|
99
|
+
df admit-pr --files-stdin # newline-separated file paths on stdin
|
|
100
|
+
df admit-pr --files docs/roadmap/cycles/cycle331.md,packages/cli/src/cli.ts
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
> **Note on `--use-bundled-default-spec`**: the bundled `spec-default.yaml`
|
|
104
|
+
> mirrors the sage3c-shaped branch-protection posture (e.g., asserts the
|
|
105
|
+
> `agent-critic` and `cycle-doc-validation` required contexts). It exists
|
|
106
|
+
> as a working starting point for first-run audits and the standalone
|
|
107
|
+
> repo's own dogfood gate. Consumers SHOULD author their own `spec.yaml`
|
|
108
|
+
> matching their repo's actual posture — running the bundled default
|
|
109
|
+
> against an arbitrary repo will surface drift against contexts that
|
|
110
|
+
> don't exist there.
|
|
111
|
+
|
|
112
|
+
The Phase F subcommands (`review`, `gate`, `doctor`) are stubbed and exit 2
|
|
113
|
+
with a "not implemented" message pointing at the library API. The Phase E
|
|
114
|
+
stubs (`status-check`, `critic`) intentionally exit 0 so the five reusable
|
|
115
|
+
workflows can satisfy dark-factory's own ruleset while real critic
|
|
116
|
+
orchestration lands in Phase F.
|
|
117
|
+
|
|
118
|
+
## System requirements
|
|
119
|
+
|
|
120
|
+
- **Node.js >=20**
|
|
121
|
+
- **Python 3.11+** — required for services #5, #7, #9. The Phase C extraction
|
|
122
|
+
bundles the original Python scripts (`validate_cycle_doc.py`,
|
|
123
|
+
`audit_branch_protection.py`, `sync_cycle_trackers.py`,
|
|
124
|
+
`attribute_pr_cycle_ref.py`) and wraps each in a TypeScript subprocess
|
|
125
|
+
spawn. The pure-TS rewrite is tracked as Phase C-PORT follow-up and will
|
|
126
|
+
eliminate this dependency in a future release.
|
|
127
|
+
- **`gh` CLI** (authenticated) — all four Python scripts shell out to `gh api`
|
|
128
|
+
for GitHub queries. CI invocations provide `GH_TOKEN` / `PROJECT_TOKEN`
|
|
129
|
+
via environment.
|
|
130
|
+
- **`git`** on `PATH` — the rebind + config-from-ref code paths shell out
|
|
131
|
+
to git, and the Python scripts use `git rev-parse --show-toplevel` to
|
|
132
|
+
discover the consumer repo root.
|
|
133
|
+
|
|
134
|
+
### Repo root detection for Python-backed services
|
|
135
|
+
|
|
136
|
+
The bundled Python scripts resolve the consumer repo root in this order:
|
|
137
|
+
|
|
138
|
+
1. `$DF_REPO_ROOT` environment variable (explicit override).
|
|
139
|
+
2. `git rev-parse --show-toplevel` from the current working directory.
|
|
140
|
+
3. Legacy `__file__`-relative fallback (preserved for in-tree dev-mode
|
|
141
|
+
pytest runs).
|
|
142
|
+
|
|
143
|
+
The TypeScript wrappers set `DF_REPO_ROOT` automatically when a `repoRoot`
|
|
144
|
+
option is supplied — pass it when invoking outside a git worktree.
|
|
145
|
+
|
|
146
|
+
## License
|
|
147
|
+
|
|
148
|
+
Apache-2.0. The OSS critic surface is a public artifact. Calibrated prompts
|
|
149
|
+
and the App's calibrated bypass-classifier are out-of-scope here and live in
|
|
150
|
+
private repos (see [parent cycle 331](https://github.com/momentiq-ai/sage3c/blob/main/docs/roadmap/cycles/cycle331-dark-factory-platformization.md)).
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { type CriticConfig, type CriticResult, type ModelConfig } from "@momentiq/dark-factory-schemas";
|
|
2
|
+
export interface ParseAssistantJsonOk {
|
|
3
|
+
ok: true;
|
|
4
|
+
value: unknown;
|
|
5
|
+
}
|
|
6
|
+
export interface ParseAssistantJsonFail {
|
|
7
|
+
ok: false;
|
|
8
|
+
message: string;
|
|
9
|
+
}
|
|
10
|
+
export type ParseAssistantJsonResult = ParseAssistantJsonOk | ParseAssistantJsonFail;
|
|
11
|
+
export declare function parseAssistantJson(text: string): ParseAssistantJsonResult;
|
|
12
|
+
export interface BuildErrorResultArgs {
|
|
13
|
+
critic: CriticConfig;
|
|
14
|
+
message: string;
|
|
15
|
+
retryable: boolean;
|
|
16
|
+
rawSamplePath?: string;
|
|
17
|
+
agentId?: string;
|
|
18
|
+
runId?: string;
|
|
19
|
+
code?: string;
|
|
20
|
+
retryCount?: number;
|
|
21
|
+
}
|
|
22
|
+
export declare function buildErrorResult(args: BuildErrorResultArgs): CriticResult;
|
|
23
|
+
export interface MergeAdapterMetadataArgs {
|
|
24
|
+
critic: CriticConfig;
|
|
25
|
+
runtimeModel?: ModelConfig | {
|
|
26
|
+
id: string;
|
|
27
|
+
params?: Array<{
|
|
28
|
+
id: string;
|
|
29
|
+
value: string;
|
|
30
|
+
}>;
|
|
31
|
+
};
|
|
32
|
+
agentId?: string;
|
|
33
|
+
runId?: string;
|
|
34
|
+
}
|
|
35
|
+
export declare function mergeAdapterMetadata(raw: unknown, args: MergeAdapterMetadataArgs): unknown;
|
|
36
|
+
export declare function normalizeCriticEcho(raw: unknown): unknown;
|
|
37
|
+
export interface WriteRedactedDiagnosticArgs {
|
|
38
|
+
diagnosticsDir: string | undefined;
|
|
39
|
+
criticId: string;
|
|
40
|
+
commit: string;
|
|
41
|
+
rawText: string;
|
|
42
|
+
}
|
|
43
|
+
export declare function writeRedactedDiagnostic(args: WriteRedactedDiagnosticArgs): string | undefined;
|
|
44
|
+
export declare function shouldEnableCursorSandbox(env?: NodeJS.ProcessEnv): boolean;
|
|
45
|
+
//# sourceMappingURL=_shared.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_shared.d.ts","sourceRoot":"","sources":["../../src/adapters/_shared.ts"],"names":[],"mappings":"AAgCA,OAAO,EAEL,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,WAAW,EACjB,MAAM,gCAAgC,CAAC;AAkBxC,MAAM,WAAW,oBAAoB;IACnC,EAAE,EAAE,IAAI,CAAC;IACT,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,MAAM,WAAW,sBAAsB;IACrC,EAAE,EAAE,KAAK,CAAC;IACV,OAAO,EAAE,MAAM,CAA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G,SAAS,CAa7F;AA8BD,wBAAgB,yBAAyB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,OAAO,CAGvF"}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
// Cycle 322.2 — adapter helpers shared across all critic adapters
|
|
2
|
+
// (Cursor, Gemini, and future Grok). The helpers here centralize the
|
|
3
|
+
// security-critical paths — evidence-redaction at the diagnostic boundary
|
|
4
|
+
// and JSON-parse-fallback for assistant responses — so a new adapter
|
|
5
|
+
// cannot accidentally drift from the contract by reimplementing the
|
|
6
|
+
// pattern locally.
|
|
7
|
+
// Touched (comment-only, no semantic change) for issue #1434 dogfood —
|
|
8
|
+
// validates that a trusted-surface no-op PR produces a real agent-critic
|
|
9
|
+
// verdict in CI under the new parent-baseline rebind. Remove this line in
|
|
10
|
+
// the next cleanup pass if it bothers you.
|
|
11
|
+
//
|
|
12
|
+
// Each helper is pure (or pure-with-narrow-IO for the redaction writer)
|
|
13
|
+
// and unit-tested in `tests/shared-helpers.test.ts` (parseAssistantJson,
|
|
14
|
+
// buildErrorResult, mergeAdapterMetadata, writeRedactedDiagnostic) and
|
|
15
|
+
// `tests/normalize-echo-shared.test.ts` (normalizeCriticEcho — added in
|
|
16
|
+
// issue #1484 when this helper was hoisted from cursor-sdk.ts). A
|
|
17
|
+
// separate boundary test (`tests/shared-boundary.test.ts`) statically
|
|
18
|
+
// scans every adapter file under this directory for direct
|
|
19
|
+
// `writeFileSync` calls — if a future adapter sidesteps
|
|
20
|
+
// `writeRedactedDiagnostic`, the test fails the suite (the lightweight
|
|
21
|
+
// equivalent of the custom ESLint rule the cycle 322.2 plan called for;
|
|
22
|
+
// the project does not currently use ESLint).
|
|
23
|
+
//
|
|
24
|
+
// Usage discipline: adapters MUST import these helpers from `_shared.ts`,
|
|
25
|
+
// not duplicate the patterns. The `criticId` tag (Phase F) is woven through
|
|
26
|
+
// the `mergeAdapterMetadata` and `buildErrorResult` shapes so per-critic
|
|
27
|
+
// telemetry segmentation works for every adapter without per-adapter glue.
|
|
28
|
+
import { mkdirSync, writeFileSync } from "node:fs";
|
|
29
|
+
import { resolve } from "node:path";
|
|
30
|
+
import { redactSecrets } from "../security.js";
|
|
31
|
+
import { parseQualityGateResult, } from "@momentiq/dark-factory-schemas";
|
|
32
|
+
export function parseAssistantJson(text) {
|
|
33
|
+
if (!text.trim())
|
|
34
|
+
return { ok: false, message: "assistant response was empty" };
|
|
35
|
+
let candidate = text.trim();
|
|
36
|
+
const fence = candidate.match(/^```(?:json)?\s*([\s\S]*?)```\s*$/);
|
|
37
|
+
if (fence)
|
|
38
|
+
candidate = (fence[1] ?? "").trim();
|
|
39
|
+
try {
|
|
40
|
+
return { ok: true, value: JSON.parse(candidate) };
|
|
41
|
+
}
|
|
42
|
+
catch {
|
|
43
|
+
const start = candidate.indexOf("{");
|
|
44
|
+
const end = candidate.lastIndexOf("}");
|
|
45
|
+
if (start === -1 || end === -1 || end <= start) {
|
|
46
|
+
return { ok: false, message: "no JSON object found" };
|
|
47
|
+
}
|
|
48
|
+
try {
|
|
49
|
+
return { ok: true, value: JSON.parse(candidate.slice(start, end + 1)) };
|
|
50
|
+
}
|
|
51
|
+
catch (err) {
|
|
52
|
+
return { ok: false, message: err.message };
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
export function buildErrorResult(args) {
|
|
57
|
+
return {
|
|
58
|
+
criticId: args.critic.id,
|
|
59
|
+
status: "error",
|
|
60
|
+
requiresHumanJudgment: false,
|
|
61
|
+
reviewer: {
|
|
62
|
+
name: args.critic.name,
|
|
63
|
+
adapter: args.critic.adapter,
|
|
64
|
+
model: args.critic.model,
|
|
65
|
+
runtime: args.critic.runtime,
|
|
66
|
+
...(args.agentId !== undefined ? { agentId: args.agentId } : {}),
|
|
67
|
+
...(args.runId !== undefined ? { runId: args.runId } : {}),
|
|
68
|
+
},
|
|
69
|
+
summary: args.message,
|
|
70
|
+
findings: [],
|
|
71
|
+
validation: { qualityGateResults: [], qualityGatesMissing: [] },
|
|
72
|
+
confidence: "unknown",
|
|
73
|
+
error: {
|
|
74
|
+
message: args.message,
|
|
75
|
+
retryable: args.retryable,
|
|
76
|
+
...(args.rawSamplePath !== undefined ? { rawSamplePath: args.rawSamplePath } : {}),
|
|
77
|
+
...(args.code !== undefined ? { code: args.code } : {}),
|
|
78
|
+
...(args.retryCount !== undefined ? { retryCount: args.retryCount } : {}),
|
|
79
|
+
},
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
export function mergeAdapterMetadata(raw, args) {
|
|
83
|
+
if (typeof raw !== "object" || raw === null)
|
|
84
|
+
return raw;
|
|
85
|
+
const obj = { ...raw };
|
|
86
|
+
obj["criticId"] = args.critic.id;
|
|
87
|
+
const reviewerRaw = obj["reviewer"];
|
|
88
|
+
const reviewer = reviewerRaw && typeof reviewerRaw === "object"
|
|
89
|
+
? { ...reviewerRaw }
|
|
90
|
+
: {};
|
|
91
|
+
reviewer["name"] = reviewer["name"] ?? args.critic.name;
|
|
92
|
+
reviewer["adapter"] = args.critic.adapter;
|
|
93
|
+
reviewer["runtime"] = reviewer["runtime"] ?? args.critic.runtime;
|
|
94
|
+
// Echo what the SDK actually resolved to, falling back to config only
|
|
95
|
+
// when the SDK doesn't expose its resolved model selection. Operators
|
|
96
|
+
// reading the artifact rely on this echo as the proof signal that the
|
|
97
|
+
// configured tier engaged.
|
|
98
|
+
reviewer["model"] = args.runtimeModel ?? args.critic.model;
|
|
99
|
+
if (args.agentId !== undefined)
|
|
100
|
+
reviewer["agentId"] = args.agentId;
|
|
101
|
+
if (args.runId !== undefined)
|
|
102
|
+
reviewer["runId"] = args.runId;
|
|
103
|
+
obj["reviewer"] = reviewer;
|
|
104
|
+
return obj;
|
|
105
|
+
}
|
|
106
|
+
// ---------------------------------------------------------------------------
|
|
107
|
+
// normalizeCriticEcho — strip schema-invalid entries from the critic's
|
|
108
|
+
// echoed `validation.qualityGateResults[]` BEFORE strict schema validation.
|
|
109
|
+
//
|
|
110
|
+
// Why this lives here (issue #1484): the critic's validation block is
|
|
111
|
+
// informational only — the adapter overwrites it with deterministic packet
|
|
112
|
+
// evidence after parsing. But strict `parseCriticResult` rejects the entire
|
|
113
|
+
// run when any echoed entry is misshapen (e.g. model emits `gate` instead of
|
|
114
|
+
// the schema-required `command` field). Cursor's first-party model happens
|
|
115
|
+
// to converge on the right field names; Gemini, Grok, and Codex sometimes
|
|
116
|
+
// guess `gate`/`name`/`step` and trip the schema. The fix is to drop the
|
|
117
|
+
// malformed entries at the adapter boundary so the high-value payload
|
|
118
|
+
// (findings, verdict, summary) is preserved.
|
|
119
|
+
//
|
|
120
|
+
// Uses `parseQualityGateResult` itself as the predicate — that is the
|
|
121
|
+
// single source of truth for "well-formed", so this normalizer cannot drift
|
|
122
|
+
// from it. The downstream `parseCriticResult` will overwrite the validation
|
|
123
|
+
// block anyway with the deterministic packet evidence, so any well-formed
|
|
124
|
+
// entry that survives normalization is also discarded — the survivors only
|
|
125
|
+
// exist to keep the strict parse happy.
|
|
126
|
+
//
|
|
127
|
+
// Originally introduced in `cursor-sdk.ts` (cycle 322.1) but moved here
|
|
128
|
+
// in #1484 so every adapter routes through one source of truth instead of
|
|
129
|
+
// each adapter duplicating the pattern.
|
|
130
|
+
export function normalizeCriticEcho(raw) {
|
|
131
|
+
if (typeof raw !== "object" || raw === null)
|
|
132
|
+
return raw;
|
|
133
|
+
const obj = raw;
|
|
134
|
+
const validation = obj["validation"];
|
|
135
|
+
if (typeof validation !== "object" || validation === null)
|
|
136
|
+
return raw;
|
|
137
|
+
const v = validation;
|
|
138
|
+
const list = v["qualityGateResults"];
|
|
139
|
+
if (!Array.isArray(list))
|
|
140
|
+
return raw;
|
|
141
|
+
const cleaned = list.filter((entry, i) => {
|
|
142
|
+
try {
|
|
143
|
+
parseQualityGateResult(entry, `$.validation.qualityGateResults[${i}]`);
|
|
144
|
+
return true;
|
|
145
|
+
}
|
|
146
|
+
catch {
|
|
147
|
+
return false;
|
|
148
|
+
}
|
|
149
|
+
});
|
|
150
|
+
return {
|
|
151
|
+
...obj,
|
|
152
|
+
validation: { ...v, qualityGateResults: cleaned },
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
export function writeRedactedDiagnostic(args) {
|
|
156
|
+
if (!args.diagnosticsDir)
|
|
157
|
+
return undefined;
|
|
158
|
+
try {
|
|
159
|
+
mkdirSync(args.diagnosticsDir, { recursive: true });
|
|
160
|
+
const path = resolve(args.diagnosticsDir, `${args.commit}-${args.criticId}-${Date.now()}.txt`);
|
|
161
|
+
writeFileSync(path, redactSecrets(args.rawText), "utf8");
|
|
162
|
+
return path;
|
|
163
|
+
}
|
|
164
|
+
catch {
|
|
165
|
+
return undefined;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
// dogfood: trusted-surface no-op to validate #1549 fix end-to-end in CI agent-critic
|
|
169
|
+
// ---------------------------------------------------------------------------
|
|
170
|
+
// shouldEnableCursorSandbox — environment-aware sandbox toggle for the
|
|
171
|
+
// Cursor SDK's `local.sandboxOptions.enabled` flag.
|
|
172
|
+
//
|
|
173
|
+
// On local dev workstations we ENABLE the SDK's defense-in-depth sandbox so
|
|
174
|
+
// the critic process can't write outside its sandbox even if a malicious diff
|
|
175
|
+
// convinces the model to try. On GitHub Actions runners the SDK's sandbox
|
|
176
|
+
// primitive is unavailable and the SDK fails the run permanently with:
|
|
177
|
+
//
|
|
178
|
+
// "Local SDK sandboxing was requested, but sandboxing is not supported
|
|
179
|
+
// in this environment. Disable local.sandboxOptions.enabled or remove
|
|
180
|
+
// ~/.cursor/sandbox.json to run without sandboxing."
|
|
181
|
+
//
|
|
182
|
+
// (Tracked at #1577.) Detecting CI and flipping the flag off keeps the
|
|
183
|
+
// local defense in place while letting the CI replay actually run.
|
|
184
|
+
//
|
|
185
|
+
// Both `cursor-sdk.ts` (production critic adapter) and `spike.ts` (empirical
|
|
186
|
+
// SDK fixture generator) call this helper so the two paths can NEVER drift
|
|
187
|
+
// — the spike's comment explicitly says "Match the production adapter's
|
|
188
|
+
// local options exactly; defenses must be identical." A single source of
|
|
189
|
+
// truth enforces that invariant.
|
|
190
|
+
//
|
|
191
|
+
// `CI` is set by GitHub Actions, GitLab, CircleCI, Travis, and most other
|
|
192
|
+
// CI systems. `GITHUB_ACTIONS` is GHA-specific and covers the case where
|
|
193
|
+
// `CI` was somehow unset. The check is conservative: if either signals CI,
|
|
194
|
+
// disable the sandbox. Locally neither is normally set, so the default
|
|
195
|
+
// (sandbox enabled) holds.
|
|
196
|
+
export function shouldEnableCursorSandbox(env = process.env) {
|
|
197
|
+
const isCI = env["CI"] === "true" || env["GITHUB_ACTIONS"] === "true";
|
|
198
|
+
return !isCI;
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=_shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_shared.js","sourceRoot":"","sources":["../../src/adapters/_shared.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,qEAAqE;AACrE,0EAA0E;AAC1E,qEAAqE;AACrE,oEAAoE;AACpE,mBAAmB;AACnB,uEAAuE;AACvE,yEAAyE;AACzE,0EAA0E;AAC1E,2CAA2C;AAC3C,EAAE;AACF,wEAAwE;AACxE,yEAAyE;AACzE,uEAAuE;AACvE,wEAAwE;AACxE,kEAAkE;AAClE,sEAAsE;AACtE,2DAA2D;AAC3D,wDAAwD;AACxD,uEAAuE;AACvE,wEAAwE;AACxE,8CAA8C;AAC9C,EAAE;AACF,0EAA0E;AAC1E,4EAA4E;AAC5E,yEAAyE;AACzE,2EAA2E;AAE3E,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EACL,sBAAsB,GAIvB,MAAM,gCAAgC,CAAC;AA8BxC,MAAM,UAAU,kBAAkB,CAAC,IAAY;IAC7C,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