@agent-teams/engineering-foundation 0.1.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/LICENSE +201 -0
- package/README.md +32 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +173 -0
- package/dist/cli.js.map +1 -0
- package/dist/config.d.ts +18 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +106 -0
- package/dist/config.js.map +1 -0
- package/dist/errors.d.ts +6 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.js +9 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -0
- package/dist/local-mode/consumer-policy.d.ts +13 -0
- package/dist/local-mode/consumer-policy.d.ts.map +1 -0
- package/dist/local-mode/consumer-policy.js +227 -0
- package/dist/local-mode/consumer-policy.js.map +1 -0
- package/dist/local-mode/index.d.ts +7 -0
- package/dist/local-mode/index.d.ts.map +1 -0
- package/dist/local-mode/index.js +5 -0
- package/dist/local-mode/index.js.map +1 -0
- package/dist/local-mode/inspection.d.ts +7 -0
- package/dist/local-mode/inspection.d.ts.map +1 -0
- package/dist/local-mode/inspection.js +224 -0
- package/dist/local-mode/inspection.js.map +1 -0
- package/dist/local-mode/process-runner.d.ts +5 -0
- package/dist/local-mode/process-runner.d.ts.map +1 -0
- package/dist/local-mode/process-runner.js +20 -0
- package/dist/local-mode/process-runner.js.map +1 -0
- package/dist/local-mode/service.d.ts +16 -0
- package/dist/local-mode/service.d.ts.map +1 -0
- package/dist/local-mode/service.js +503 -0
- package/dist/local-mode/service.js.map +1 -0
- package/dist/local-mode/types.d.ts +62 -0
- package/dist/local-mode/types.d.ts.map +1 -0
- package/dist/local-mode/types.js +7 -0
- package/dist/local-mode/types.js.map +1 -0
- package/dist/package-self-check.d.ts +15 -0
- package/dist/package-self-check.d.ts.map +1 -0
- package/dist/package-self-check.js +172 -0
- package/dist/package-self-check.js.map +1 -0
- package/package.json +56 -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 reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and 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 Additional Liability. 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 additional liability.
|
|
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 [yyyy] [name of copyright owner]
|
|
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,32 @@
|
|
|
1
|
+
# @agent-teams/engineering-foundation
|
|
2
|
+
|
|
3
|
+
Development-only engineering foundation for Agent Teams repositories.
|
|
4
|
+
|
|
5
|
+
The package exposes a typed consumer configuration and explicit local versus
|
|
6
|
+
registry lifecycle tooling. It is not a production runtime dependency.
|
|
7
|
+
|
|
8
|
+
Consumer CI should run both policy gates:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
agent-teams-foundation assert-dev-only
|
|
12
|
+
agent-teams-foundation assert-registry
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Local attach accepts only a built target whose versioned local-mode protocol,
|
|
16
|
+
exports, runtime dependencies, and real CLI self-check agree with its package
|
|
17
|
+
metadata.
|
|
18
|
+
|
|
19
|
+
```ts
|
|
20
|
+
import { defineFoundationConfig } from "@agent-teams/engineering-foundation";
|
|
21
|
+
|
|
22
|
+
export default defineFoundationConfig({
|
|
23
|
+
schemaVersion: 1,
|
|
24
|
+
projectId: "agent-teams-orchestrator",
|
|
25
|
+
projectKind: "service",
|
|
26
|
+
capabilities: {
|
|
27
|
+
architecture: { enabled: true, configPath: "architecture/package-catalog.yaml" },
|
|
28
|
+
documentation: { enabled: true, configPath: "docs/metadata.schema.json" },
|
|
29
|
+
lint: { enabled: true }
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
```
|
package/dist/cli.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":""}
|
package/dist/cli.js
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { readFile } from "node:fs/promises";
|
|
3
|
+
import { dirname, resolve } from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { FoundationError } from "./errors.js";
|
|
6
|
+
import { NodeProcessRunner } from "./local-mode/process-runner.js";
|
|
7
|
+
import { FoundationLocalModeService } from "./local-mode/service.js";
|
|
8
|
+
import { inspectFoundationPackage } from "./package-self-check.js";
|
|
9
|
+
function parseArguments(args) {
|
|
10
|
+
const positional = [];
|
|
11
|
+
let consumerRoot = process.cwd();
|
|
12
|
+
let json = false;
|
|
13
|
+
for (let index = 1; index < args.length; index += 1) {
|
|
14
|
+
const value = args[index];
|
|
15
|
+
if (value === "--consumer") {
|
|
16
|
+
const candidate = args[index + 1];
|
|
17
|
+
if (candidate === undefined) {
|
|
18
|
+
throw new FoundationError("CONSUMER_INVALID", "--consumer requires a path.");
|
|
19
|
+
}
|
|
20
|
+
consumerRoot = resolve(candidate);
|
|
21
|
+
index += 1;
|
|
22
|
+
}
|
|
23
|
+
else if (value === "--json") {
|
|
24
|
+
json = true;
|
|
25
|
+
}
|
|
26
|
+
else if (value !== undefined) {
|
|
27
|
+
positional.push(value);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return {
|
|
31
|
+
command: args[0] ?? "help",
|
|
32
|
+
positional,
|
|
33
|
+
consumerRoot,
|
|
34
|
+
json
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function printStatus(status, json) {
|
|
38
|
+
if (json) {
|
|
39
|
+
process.stdout.write(`${JSON.stringify(status, null, 2)}\n`);
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
process.stdout.write(`Foundation mode: ${status.mode}\n`);
|
|
43
|
+
process.stdout.write(`Consumer: ${status.consumerRoot}\n`);
|
|
44
|
+
if (status.dependencySpec !== undefined) {
|
|
45
|
+
process.stdout.write(`Declared version: ${status.dependencySpec}\n`);
|
|
46
|
+
}
|
|
47
|
+
if (status.installedVersion !== undefined) {
|
|
48
|
+
process.stdout.write(`Installed version: ${status.installedVersion}\n`);
|
|
49
|
+
}
|
|
50
|
+
if (status.installedPackageRoot !== undefined) {
|
|
51
|
+
process.stdout.write(`Installed path: ${status.installedPackageRoot}\n`);
|
|
52
|
+
}
|
|
53
|
+
if (status.lockfilePath !== undefined) {
|
|
54
|
+
process.stdout.write(`Lockfile: ${status.lockfilePath}\n`);
|
|
55
|
+
}
|
|
56
|
+
if (status.lockfilePackageKey !== undefined) {
|
|
57
|
+
process.stdout.write(`Locked package: ${status.lockfilePackageKey}\n`);
|
|
58
|
+
}
|
|
59
|
+
if (status.linkState !== undefined) {
|
|
60
|
+
process.stdout.write(`Attached commit: ${status.linkState.gitCommit}\n`);
|
|
61
|
+
process.stdout.write(`Attached dirty: ${status.linkState.gitDirty ? "yes" : "no"}\n`);
|
|
62
|
+
}
|
|
63
|
+
if (status.sourceGitCommit !== undefined) {
|
|
64
|
+
process.stdout.write(`Current commit: ${status.sourceGitCommit}\n`);
|
|
65
|
+
}
|
|
66
|
+
if (status.sourceGitDirty !== undefined) {
|
|
67
|
+
process.stdout.write(`Current dirty: ${status.sourceGitDirty ? "yes" : "no"}\n`);
|
|
68
|
+
}
|
|
69
|
+
for (const issue of status.issues) {
|
|
70
|
+
process.stdout.write(`Issue: ${issue}\n`);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function printDevOnlyStatus(status, json) {
|
|
74
|
+
if (json) {
|
|
75
|
+
process.stdout.write(`${JSON.stringify(status, null, 2)}\n`);
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
process.stdout.write("Foundation dependency policy: DEV_ONLY\n");
|
|
79
|
+
process.stdout.write(`Consumer: ${status.consumerRoot}\n`);
|
|
80
|
+
if (status.dependencySpec !== undefined) {
|
|
81
|
+
process.stdout.write(`Declared version: ${status.dependencySpec}\n`);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
function printHelp() {
|
|
85
|
+
process.stdout.write(`Usage:
|
|
86
|
+
agent-teams-foundation attach <path> [--consumer <path>]
|
|
87
|
+
agent-teams-foundation status [--consumer <path>] [--json]
|
|
88
|
+
agent-teams-foundation detach [--consumer <path>] [--json]
|
|
89
|
+
agent-teams-foundation assert-dev-only [--consumer <path>] [--json]
|
|
90
|
+
agent-teams-foundation assert-registry [--consumer <path>] [--json]
|
|
91
|
+
agent-teams-foundation self-check [--json]
|
|
92
|
+
agent-teams-foundation version
|
|
93
|
+
`);
|
|
94
|
+
}
|
|
95
|
+
async function packageVersion() {
|
|
96
|
+
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
97
|
+
const manifest = JSON.parse(await readFile(resolve(packageRoot, "package.json"), "utf8"));
|
|
98
|
+
if (typeof manifest.version !== "string") {
|
|
99
|
+
throw new FoundationError("PACKAGE_INVALID", "Foundation package version is unavailable.");
|
|
100
|
+
}
|
|
101
|
+
return manifest.version;
|
|
102
|
+
}
|
|
103
|
+
async function main() {
|
|
104
|
+
const parsed = parseArguments(process.argv.slice(2));
|
|
105
|
+
const service = new FoundationLocalModeService({
|
|
106
|
+
runner: new NodeProcessRunner()
|
|
107
|
+
});
|
|
108
|
+
switch (parsed.command) {
|
|
109
|
+
case "attach": {
|
|
110
|
+
const target = parsed.positional[0];
|
|
111
|
+
if (target === undefined) {
|
|
112
|
+
throw new FoundationError("PACKAGE_INVALID", "attach requires a foundation repository or package path.");
|
|
113
|
+
}
|
|
114
|
+
const result = await service.attach(parsed.consumerRoot, target);
|
|
115
|
+
printStatus(result.status, parsed.json);
|
|
116
|
+
break;
|
|
117
|
+
}
|
|
118
|
+
case "assert-dev-only": {
|
|
119
|
+
printDevOnlyStatus(await service.assertDevOnly(parsed.consumerRoot), parsed.json);
|
|
120
|
+
break;
|
|
121
|
+
}
|
|
122
|
+
case "assert-registry": {
|
|
123
|
+
printStatus(await service.assertRegistry(parsed.consumerRoot), parsed.json);
|
|
124
|
+
break;
|
|
125
|
+
}
|
|
126
|
+
case "detach": {
|
|
127
|
+
printStatus(await service.detach(parsed.consumerRoot), parsed.json);
|
|
128
|
+
break;
|
|
129
|
+
}
|
|
130
|
+
case "help":
|
|
131
|
+
case "--help":
|
|
132
|
+
case "-h": {
|
|
133
|
+
printHelp();
|
|
134
|
+
break;
|
|
135
|
+
}
|
|
136
|
+
case "status": {
|
|
137
|
+
const status = await service.status(parsed.consumerRoot);
|
|
138
|
+
printStatus(status, parsed.json);
|
|
139
|
+
if (status.mode === "INVALID") {
|
|
140
|
+
process.exitCode = 1;
|
|
141
|
+
}
|
|
142
|
+
break;
|
|
143
|
+
}
|
|
144
|
+
case "self-check": {
|
|
145
|
+
const packageRoot = dirname(dirname(fileURLToPath(import.meta.url)));
|
|
146
|
+
const result = await inspectFoundationPackage(packageRoot);
|
|
147
|
+
process.stdout.write(`${JSON.stringify(result, null, 2)}\n`);
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
case "version":
|
|
151
|
+
case "--version":
|
|
152
|
+
case "-v": {
|
|
153
|
+
process.stdout.write(`${await packageVersion()}\n`);
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
default: {
|
|
157
|
+
throw new FoundationError("CONSUMER_INVALID", `Unknown command: ${parsed.command}.`);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
try {
|
|
162
|
+
await main();
|
|
163
|
+
}
|
|
164
|
+
catch (error) {
|
|
165
|
+
if (error instanceof FoundationError) {
|
|
166
|
+
process.stderr.write(`${error.code}: ${error.message}\n`);
|
|
167
|
+
}
|
|
168
|
+
else {
|
|
169
|
+
process.stderr.write(`UNEXPECTED: ${error instanceof Error ? error.message : String(error)}\n`);
|
|
170
|
+
}
|
|
171
|
+
process.exitCode = 1;
|
|
172
|
+
}
|
|
173
|
+
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AACnE,OAAO,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAKrE,OAAO,EAAE,wBAAwB,EAAE,MAAM,yBAAyB,CAAC;AASnE,SAAS,cAAc,CAAC,IAAuB;IAC7C,MAAM,UAAU,GAAa,EAAE,CAAC;IAChC,IAAI,YAAY,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC;IACjC,IAAI,IAAI,GAAG,KAAK,CAAC;IAEjB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,IAAI,CAAC,MAAM,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QACpD,MAAM,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC;QAC1B,IAAI,KAAK,KAAK,YAAY,EAAE,CAAC;YAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;YAClC,IAAI,SAAS,KAAK,SAAS,EAAE,CAAC;gBAC5B,MAAM,IAAI,eAAe,CACvB,kBAAkB,EAClB,6BAA6B,CAC9B,CAAC;YACJ,CAAC;YACD,YAAY,GAAG,OAAO,CAAC,SAAS,CAAC,CAAC;YAClC,KAAK,IAAI,CAAC,CAAC;QACb,CAAC;aAAM,IA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ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare const FOUNDATION_CONFIG_SCHEMA_VERSION: 1;
|
|
2
|
+
export declare const FOUNDATION_CAPABILITIES: readonly ["architecture", "documentation", "lint", "reliability", "security"];
|
|
3
|
+
export declare const FOUNDATION_PROJECT_KINDS: readonly ["client", "runtime", "service", "tooling"];
|
|
4
|
+
export type FoundationCapabilityName = (typeof FOUNDATION_CAPABILITIES)[number];
|
|
5
|
+
export type FoundationProjectKind = (typeof FOUNDATION_PROJECT_KINDS)[number];
|
|
6
|
+
export interface FoundationCapabilityConfig {
|
|
7
|
+
readonly enabled: boolean;
|
|
8
|
+
readonly configPath?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface FoundationConfig {
|
|
11
|
+
readonly schemaVersion: typeof FOUNDATION_CONFIG_SCHEMA_VERSION;
|
|
12
|
+
readonly projectId: string;
|
|
13
|
+
readonly projectKind: FoundationProjectKind;
|
|
14
|
+
readonly capabilities: Readonly<Partial<Record<FoundationCapabilityName, FoundationCapabilityConfig>>>;
|
|
15
|
+
}
|
|
16
|
+
export declare function parseFoundationConfig(input: unknown): FoundationConfig;
|
|
17
|
+
export declare function defineFoundationConfig(input: FoundationConfig): FoundationConfig;
|
|
18
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAIA,eAAO,MAAM,gCAAgC,EAAG,CAAU,CAAC;AAE3D,eAAO,MAAM,uBAAuB,YAClC,cAAc,EACd,eAAe,EACf,MAAM,EACN,aAAa,EACb,UAAU,CACF,CAAC;AAEX,eAAO,MAAM,wBAAwB,YACnC,QAAQ,EACR,SAAS,EACT,SAAS,EACT,SAAS,CACD,CAAC;AAEX,MAAM,MAAM,wBAAwB,GAAG,CAAC,OAAO,uBAAuB,CAAC,CAAC,MAAM,CAAC,CAAC;AAChF,MAAM,MAAM,qBAAqB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE9E,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,aAAa,EAAE,OAAO,gCAAgC,CAAC;IAChE,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,WAAW,EAAE,qBAAqB,CAAC;IAC5C,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAC7B,OAAO,CAAC,MAAM,CAAC,wBAAwB,EAAE,0BAA0B,CAAC,CAAC,CACtE,CAAC;CACH;AAiGD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,OAAO,GAAG,gBAAgB,CAkDtE;AAED,wBAAgB,sBAAsB,CACpC,KAAK,EAAE,gBAAgB,GACtB,gBAAgB,CAElB"}
|
package/dist/config.js
ADDED
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { isAbsolute, normalize, sep } from "node:path";
|
|
2
|
+
import { FoundationError } from "./errors.js";
|
|
3
|
+
export const FOUNDATION_CONFIG_SCHEMA_VERSION = 1;
|
|
4
|
+
export const FOUNDATION_CAPABILITIES = [
|
|
5
|
+
"architecture",
|
|
6
|
+
"documentation",
|
|
7
|
+
"lint",
|
|
8
|
+
"reliability",
|
|
9
|
+
"security"
|
|
10
|
+
];
|
|
11
|
+
export const FOUNDATION_PROJECT_KINDS = [
|
|
12
|
+
"client",
|
|
13
|
+
"runtime",
|
|
14
|
+
"service",
|
|
15
|
+
"tooling"
|
|
16
|
+
];
|
|
17
|
+
const PROJECT_ID_PATTERN = /^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?$/;
|
|
18
|
+
function isRecord(value) {
|
|
19
|
+
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
20
|
+
}
|
|
21
|
+
function isProjectKind(value) {
|
|
22
|
+
return (typeof value === "string" &&
|
|
23
|
+
FOUNDATION_PROJECT_KINDS.some((candidate) => candidate === value));
|
|
24
|
+
}
|
|
25
|
+
function isCapabilityName(value) {
|
|
26
|
+
return FOUNDATION_CAPABILITIES.some((candidate) => candidate === value);
|
|
27
|
+
}
|
|
28
|
+
function validateConfigPath(value, capability) {
|
|
29
|
+
if (value === undefined) {
|
|
30
|
+
return undefined;
|
|
31
|
+
}
|
|
32
|
+
if (typeof value !== "string" || value.length === 0) {
|
|
33
|
+
throw new FoundationError("CONFIG_INVALID", `Capability ${capability} configPath must be a non-empty relative path.`);
|
|
34
|
+
}
|
|
35
|
+
const normalized = normalize(value);
|
|
36
|
+
if (isAbsolute(value) ||
|
|
37
|
+
normalized === ".." ||
|
|
38
|
+
normalized.startsWith(`..${sep}`)) {
|
|
39
|
+
throw new FoundationError("CONFIG_INVALID", `Capability ${capability} configPath cannot escape the consumer repository.`);
|
|
40
|
+
}
|
|
41
|
+
return value;
|
|
42
|
+
}
|
|
43
|
+
function parseCapabilities(value) {
|
|
44
|
+
if (!isRecord(value)) {
|
|
45
|
+
throw new FoundationError("CONFIG_INVALID", "Foundation capabilities must be an object.");
|
|
46
|
+
}
|
|
47
|
+
const entries = Object.entries(value);
|
|
48
|
+
if (entries.length === 0) {
|
|
49
|
+
throw new FoundationError("CONFIG_INVALID", "At least one foundation capability must be declared.");
|
|
50
|
+
}
|
|
51
|
+
const parsed = {};
|
|
52
|
+
for (const [name, candidate] of entries) {
|
|
53
|
+
if (!isCapabilityName(name)) {
|
|
54
|
+
throw new FoundationError("CONFIG_INVALID", `Unknown foundation capability: ${name}.`);
|
|
55
|
+
}
|
|
56
|
+
if (!isRecord(candidate) || typeof candidate.enabled !== "boolean") {
|
|
57
|
+
throw new FoundationError("CONFIG_INVALID", `Capability ${name} must declare an enabled boolean.`);
|
|
58
|
+
}
|
|
59
|
+
const allowedKeys = new Set(["configPath", "enabled"]);
|
|
60
|
+
const unknownKey = Object.keys(candidate).find((key) => !allowedKeys.has(key));
|
|
61
|
+
if (unknownKey !== undefined) {
|
|
62
|
+
throw new FoundationError("CONFIG_INVALID", `Capability ${name} contains unknown field: ${unknownKey}.`);
|
|
63
|
+
}
|
|
64
|
+
const configPath = validateConfigPath(candidate.configPath, name);
|
|
65
|
+
parsed[name] = Object.freeze({
|
|
66
|
+
enabled: candidate.enabled,
|
|
67
|
+
...(configPath === undefined ? {} : { configPath })
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
return Object.freeze(parsed);
|
|
71
|
+
}
|
|
72
|
+
export function parseFoundationConfig(input) {
|
|
73
|
+
if (!isRecord(input)) {
|
|
74
|
+
throw new FoundationError("CONFIG_INVALID", "Foundation configuration must be an object.");
|
|
75
|
+
}
|
|
76
|
+
const allowedKeys = new Set([
|
|
77
|
+
"capabilities",
|
|
78
|
+
"projectId",
|
|
79
|
+
"projectKind",
|
|
80
|
+
"schemaVersion"
|
|
81
|
+
]);
|
|
82
|
+
const unknownKey = Object.keys(input).find((key) => !allowedKeys.has(key));
|
|
83
|
+
if (unknownKey !== undefined) {
|
|
84
|
+
throw new FoundationError("CONFIG_INVALID", `Foundation configuration contains unknown field: ${unknownKey}.`);
|
|
85
|
+
}
|
|
86
|
+
if (input.schemaVersion !== FOUNDATION_CONFIG_SCHEMA_VERSION) {
|
|
87
|
+
throw new FoundationError("CONFIG_INVALID", `Unsupported foundation schemaVersion: ${String(input.schemaVersion)}.`);
|
|
88
|
+
}
|
|
89
|
+
if (typeof input.projectId !== "string" ||
|
|
90
|
+
!PROJECT_ID_PATTERN.test(input.projectId)) {
|
|
91
|
+
throw new FoundationError("CONFIG_INVALID", "projectId must be a lowercase kebab-case identifier up to 63 characters.");
|
|
92
|
+
}
|
|
93
|
+
if (!isProjectKind(input.projectKind)) {
|
|
94
|
+
throw new FoundationError("CONFIG_INVALID", `Unknown projectKind: ${String(input.projectKind)}.`);
|
|
95
|
+
}
|
|
96
|
+
return Object.freeze({
|
|
97
|
+
schemaVersion: FOUNDATION_CONFIG_SCHEMA_VERSION,
|
|
98
|
+
projectId: input.projectId,
|
|
99
|
+
projectKind: input.projectKind,
|
|
100
|
+
capabilities: parseCapabilities(input.capabilities)
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
export function defineFoundationConfig(input) {
|
|
104
|
+
return parseFoundationConfig(input);
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEvD,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,MAAM,CAAC,MAAM,gCAAgC,GAAG,CAAU,CAAC;AAE3D,MAAM,CAAC,MAAM,uBAAuB,GAAG;IACrC,cAAc;IACd,eAAe;IACf,MAAM;IACN,aAAa;IACb,UAAU;CACF,CAAC;AAEX,MAAM,CAAC,MAAM,wBAAwB,GAAG;IACtC,QAAQ;IACR,SAAS;IACT,SAAS;IACT,SAAS;CACD,CAAC;AAmBX,MAAM,kBAAkB,GAAG,wCAAwC,CAAC;AAEpE,SAAS,QAAQ,CAAC,KAAc;IAC9B,OAAO,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,KAAK,IAAI,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AAC9E,CAAC;AAED,SAAS,aAAa,CAAC,KAAc;IACnC,OAAO,CACL,OAAO,KAAK,KAAK,QAAQ;QACzB,wBAAwB,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,KAAK,KAAK,CAAC,CAClE,CAAC;AACJ,CAAC;AAED,SAAS,gBAAgB,CAAC,KAAa;IACrC,OAAO,uBAAuB,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,K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
|
|
|
1
|
+
export type FoundationErrorCode = "CONFIG_INVALID" | "CONSUMER_INVALID" | "LOCAL_STATE_INVALID" | "PACKAGE_INVALID" | "PROCESS_FAILED" | "REGISTRY_MODE_REQUIRED";
|
|
2
|
+
export declare class FoundationError extends Error {
|
|
3
|
+
readonly code: FoundationErrorCode;
|
|
4
|
+
constructor(code: FoundationErrorCode, message: string, options?: ErrorOptions);
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mBAAmB,GAC3B,gBAAgB,GAChB,kBAAkB,GAClB,qBAAqB,GACrB,iBAAiB,GACjB,gBAAgB,GAChB,wBAAwB,CAAC;AAE7B,qBAAa,eAAgB,SAAQ,KAAK;IACxC,QAAQ,CAAC,IAAI,EAAE,mBAAmB,CAAC;IAEnC,YAAY,IAAI,EAAE,mBAAmB,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,YAAY,EAI7E;CACF"}
|
package/dist/errors.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAQA,MAAM,OAAO,eAAgB,SAAQ,KAAK;IAC/B,IAAI,CAAsB;IAEnC,YAAY,IAAyB,EAAE,OAAe,EAAE,OAAsB;QAC5E,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;QAC9B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { FOUNDATION_CAPABILITIES, FOUNDATION_CONFIG_SCHEMA_VERSION, FOUNDATION_PROJECT_KINDS, defineFoundationConfig, parseFoundationConfig } from "./config.js";
|
|
2
|
+
export type { FoundationCapabilityConfig, FoundationCapabilityName, FoundationConfig, FoundationProjectKind } from "./config.js";
|
|
3
|
+
export { FOUNDATION_METADATA_SCHEMA_VERSION, inspectFoundationPackage, parseFoundationPackageSelfCheck } from "./package-self-check.js";
|
|
4
|
+
export type { FoundationPackageSelfCheck } from "./package-self-check.js";
|
|
5
|
+
export { FoundationError } from "./errors.js";
|
|
6
|
+
export type { FoundationErrorCode } from "./errors.js";
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,gCAAgC,EAChC,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,YAAY,EACV,0BAA0B,EAC1B,wBAAwB,EACxB,gBAAgB,EAChB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AACrB,OAAO,EACL,kCAAkC,EAClC,wBAAwB,EACxB,+BAA+B,EAChC,MAAM,yBAAyB,CAAC;AACjC,YAAY,EAAE,0BAA0B,EAAE,MAAM,yBAAyB,CAAC;AAC1E,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,YAAY,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { FOUNDATION_CAPABILITIES, FOUNDATION_CONFIG_SCHEMA_VERSION, FOUNDATION_PROJECT_KINDS, defineFoundationConfig, parseFoundationConfig } from "./config.js";
|
|
2
|
+
export { FOUNDATION_METADATA_SCHEMA_VERSION, inspectFoundationPackage, parseFoundationPackageSelfCheck } from "./package-self-check.js";
|
|
3
|
+
export { FoundationError } from "./errors.js";
|
|
4
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,uBAAuB,EACvB,gCAAgC,EAChC,wBAAwB,EACxB,sBAAsB,EACtB,qBAAqB,EACtB,MAAM,aAAa,CAAC;AAOrB,OAAO,EACL,kCAAkC,EAClC,wBAAwB,EACxB,+BAA+B,EAChC,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FoundationDevOnlyStatus, FoundationRegistryProvenance } from "./types.js";
|
|
2
|
+
interface ConsumerPolicyInspection extends FoundationDevOnlyStatus {
|
|
3
|
+
readonly packageManager?: string;
|
|
4
|
+
}
|
|
5
|
+
interface RegistryProvenanceInspection {
|
|
6
|
+
readonly provenance?: FoundationRegistryProvenance;
|
|
7
|
+
readonly issues: readonly string[];
|
|
8
|
+
}
|
|
9
|
+
export declare function isExactVersion(value: string): boolean;
|
|
10
|
+
export declare function inspectFoundationDevOnly(consumerRoot: string): Promise<ConsumerPolicyInspection>;
|
|
11
|
+
export declare function inspectFoundationRegistryProvenance(consumerRoot: string, dependencySpec: string | undefined): Promise<RegistryProvenanceInspection>;
|
|
12
|
+
export {};
|
|
13
|
+
//# sourceMappingURL=consumer-policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"consumer-policy.d.ts","sourceRoot":"","sources":["../../src/local-mode/consumer-policy.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,uBAAuB,EACvB,4BAA4B,EAC7B,MAAM,YAAY,CAAC;AAGpB,UAAU,wBAAyB,SAAQ,uBAAuB;IAChE,QAAQ,CAAC,cAAc,CAAC,EAAE,MAAM,CAAC;CAClC;AAED,UAAU,4BAA4B;IACpC,QAAQ,CAAC,UAAU,CAAC,EAAE,4BAA4B,CAAC;IACnD,QAAQ,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAAC;CACpC;AAwCD,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAErD;AAED,wBAAsB,wBAAwB,CAC5C,YAAY,EAAE,MAAM,GACnB,OAAO,CAAC,wBAAwB,CAAC,CAwEnC;AAgBD,wBAAsB,mCAAmC,CACvD,YAAY,EAAE,MAAM,EACpB,cAAc,EAAE,MAAM,GAAG,SAAS,GACjC,OAAO,CAAC,4BAA4B,CAAC,CAkLvC"}
|