@ai-plugin-marketplace/core 0.2.0 → 0.4.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/dist/core.d.ts +70 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/pipeline/init-template.d.ts +24 -6
- package/dist/pipeline/init-template.d.ts.map +1 -1
- package/dist/pipeline/init-template.js +131 -33
- package/dist/pipeline/init-template.js.map +1 -1
- package/dist/pipeline/init.d.ts +19 -14
- package/dist/pipeline/init.d.ts.map +1 -1
- package/dist/pipeline/init.js +68 -16
- package/dist/pipeline/init.js.map +1 -1
- package/dist/pipeline/operations.d.ts +11 -1
- package/dist/pipeline/operations.d.ts.map +1 -1
- package/dist/pipeline/operations.js +16 -0
- package/dist/pipeline/operations.js.map +1 -1
- package/dist/pipeline/scaffold-refresh.d.ts +80 -0
- package/dist/pipeline/scaffold-refresh.d.ts.map +1 -0
- package/dist/pipeline/scaffold-refresh.js +152 -0
- package/dist/pipeline/scaffold-refresh.js.map +1 -0
- package/dist/pipeline/types.d.ts +57 -1
- package/dist/pipeline/types.d.ts.map +1 -1
- package/dist/pipeline/validate.d.ts +12 -0
- package/dist/pipeline/validate.d.ts.map +1 -1
- package/dist/pipeline/validate.js +103 -1
- package/dist/pipeline/validate.js.map +1 -1
- package/package.json +1 -1
package/dist/core.d.ts
CHANGED
|
@@ -248,9 +248,15 @@ export declare interface Finding {
|
|
|
248
248
|
* host software / the author). Generation refuses to overwrite it rather than clobber repo-root
|
|
249
249
|
* state.
|
|
250
250
|
*
|
|
251
|
+
* `default-marketplace-name` — the repo's effective marketplace `name` (or `owner.name`) is still
|
|
252
|
+
* a template placeholder (e.g. `ai-plugin-marketplace`, `my-ai-plugins`, `Your Name`). Two
|
|
253
|
+
* marketplaces registered under the same name collide on install — the later one shadows/strands
|
|
254
|
+
* the earlier one's plugins — so a placeholder must be renamed to a unique value. Always SOFT: a
|
|
255
|
+
* warning, never a build failure.
|
|
256
|
+
*
|
|
251
257
|
* @public
|
|
252
258
|
*/
|
|
253
|
-
export declare type FindingCode = 'envelope-invalid' | 'repo-config-invalid' | 'envelope-adherence' | 'schema-invalid' | 'name-consistency' | 'mcp-key-sync' | 'marketplace-registration' | 'freshness' | 'single-artifact-host' | 'root-artifact-collision';
|
|
259
|
+
export declare type FindingCode = 'envelope-invalid' | 'repo-config-invalid' | 'envelope-adherence' | 'schema-invalid' | 'name-consistency' | 'mcp-key-sync' | 'marketplace-registration' | 'freshness' | 'single-artifact-host' | 'root-artifact-collision' | 'default-marketplace-name';
|
|
254
260
|
|
|
255
261
|
/**
|
|
256
262
|
* A file produced or verified by the build.
|
|
@@ -287,6 +293,25 @@ export declare interface InitOptions {
|
|
|
287
293
|
* directory.
|
|
288
294
|
*/
|
|
289
295
|
name?: string;
|
|
296
|
+
/**
|
|
297
|
+
* Marketplace name written into the generated repo-root registries' top-level `name` (and used
|
|
298
|
+
* for the registries' `owner.name`). This is the identity host platforms register the
|
|
299
|
+
* marketplace under, and it MUST be unique across marketplaces — two marketplaces sharing a name
|
|
300
|
+
* collide on install, with the later one shadowing/stranding the earlier one's plugins.
|
|
301
|
+
*
|
|
302
|
+
* Distinct from {@link InitOptions.name} (the `package.json` name). When omitted, `runInit`
|
|
303
|
+
* resolves a default at the I/O boundary (`${USER}-ai-plugins`, falling back to `my-ai-plugins`
|
|
304
|
+
* when `USER` is unset). `init-template.ts` is a pure function of its inputs, so the resolved
|
|
305
|
+
* value is passed in rather than read from the environment there.
|
|
306
|
+
*/
|
|
307
|
+
marketplaceName?: string;
|
|
308
|
+
/**
|
|
309
|
+
* Version of `@ai-plugin-marketplace/cli` to pin the generated `package.json`'s `cli`
|
|
310
|
+
* dev dependency to (as `^<cliVersion>`). The cli entrypoint supplies its own version here; cli
|
|
311
|
+
* and core ship independently and may differ (e.g. `cli 0.1.1` ships with `core 0.2.0`). When
|
|
312
|
+
* omitted, falls back to core's own version (the historical lockstep assumption).
|
|
313
|
+
*/
|
|
314
|
+
cliVersion?: string;
|
|
290
315
|
}
|
|
291
316
|
|
|
292
317
|
/**
|
|
@@ -332,6 +357,50 @@ export declare interface MigrateResult {
|
|
|
332
357
|
filesChanged: string[];
|
|
333
358
|
}
|
|
334
359
|
|
|
360
|
+
/**
|
|
361
|
+
* Options for {@link refreshScaffold}.
|
|
362
|
+
*
|
|
363
|
+
* @public
|
|
364
|
+
*/
|
|
365
|
+
export declare interface RefreshOptions {
|
|
366
|
+
/**
|
|
367
|
+
* Overwrite toolkit-owned scaffold files even when their on-disk content has diverged from what
|
|
368
|
+
* the toolkit last wrote (i.e. the user edited them). Without this, diverged files are reported
|
|
369
|
+
* as conflicts and left untouched.
|
|
370
|
+
*/
|
|
371
|
+
force?: boolean;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
/**
|
|
375
|
+
* Per-file outcome of a {@link refreshScaffold} run. Returned (one per managed scaffold file) so
|
|
376
|
+
* the CLI can report what changed without re-deriving it.
|
|
377
|
+
*
|
|
378
|
+
* @public
|
|
379
|
+
*/
|
|
380
|
+
export declare interface RefreshOutcome {
|
|
381
|
+
/** Repo-relative POSIX path of the managed scaffold file. */
|
|
382
|
+
path: string;
|
|
383
|
+
/**
|
|
384
|
+
* - `updated` — content changed and was rewritten (file was pristine or `--force`).
|
|
385
|
+
* - `unchanged` — already matched the current render; nothing written.
|
|
386
|
+
* - `recreated` — file was missing and was written from the render.
|
|
387
|
+
* - `conflict` — on-disk content diverged from the recorded hash; left untouched (no `--force`).
|
|
388
|
+
* - `overwritten` — diverged but rewritten because `--force` was set.
|
|
389
|
+
*/
|
|
390
|
+
status: 'updated' | 'unchanged' | 'recreated' | 'conflict' | 'overwritten';
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Refresh the toolkit-owned scaffold files (CI workflow, `.gitignore`) of an existing marketplace
|
|
395
|
+
* repo at `targetDir` to match the installed tooling — the upgrade path after
|
|
396
|
+
* `pnpm up @ai-plugin-marketplace/*`. Guarded by the `.aipm/scaffold.json` content-hash sidecar:
|
|
397
|
+
* user-modified files are reported as conflicts and left untouched unless `opts.force` is set.
|
|
398
|
+
* Returns one outcome per managed file; never rejects on conflict.
|
|
399
|
+
*
|
|
400
|
+
* @public
|
|
401
|
+
*/
|
|
402
|
+
export declare function refreshScaffold(targetDir: string, opts?: RefreshOptions): Promise<RefreshOutcome[]>;
|
|
403
|
+
|
|
335
404
|
/**
|
|
336
405
|
* Scaffold a new plugin under the cwd's configured plugins root (`<cwd>/plugins/<name>` by
|
|
337
406
|
* default, or the relocated `pluginsRoot` from an `aipm.repo.ts`). The plugins directory is
|
package/dist/index.d.ts
CHANGED
|
@@ -10,6 +10,6 @@
|
|
|
10
10
|
*/
|
|
11
11
|
export { defineConfig, defineRepoConfig, defineWorkspace } from './config.js';
|
|
12
12
|
export type { AipmConfig, AipmConfigInput, AipmRepoConfig, AipmRepoConfigInput, AipmWorkspace, AipmWorkspaceInput, } from './config.js';
|
|
13
|
-
export { build, validate, scaffold, init, migrate, checkSupport, addTarget, listTargets, } from './pipeline/operations.js';
|
|
14
|
-
export type { TargetId, BuildOptions, BuildResult, GeneratedFile, ValidateOptions, ValidationResult, Finding, FindingCode, ScaffoldOptions, InitOptions, MigrateOptions, MigrateResult, SupportReport, } from './pipeline/types.js';
|
|
13
|
+
export { build, validate, scaffold, init, refreshScaffold, migrate, checkSupport, addTarget, listTargets, } from './pipeline/operations.js';
|
|
14
|
+
export type { TargetId, BuildOptions, BuildResult, GeneratedFile, ValidateOptions, ValidationResult, Finding, FindingCode, ScaffoldOptions, InitOptions, RefreshOptions, RefreshOutcome, MigrateOptions, MigrateResult, SupportReport, } from './pipeline/types.js';
|
|
15
15
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9E,YAAY,EACV,UAAU,EACV,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,eAAe,EACf,WAAW,EACX,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,qBAAqB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9E,YAAY,EACV,UAAU,EACV,eAAe,EACf,cAAc,EACd,mBAAmB,EACnB,aAAa,EACb,kBAAkB,GACnB,MAAM,aAAa,CAAC;AAErB,OAAO,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,eAAe,EACf,OAAO,EACP,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,MAAM,0BAA0B,CAAC;AAElC,YAAY,EACV,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,aAAa,EACb,eAAe,EACf,gBAAgB,EAChB,OAAO,EACP,WAAW,EACX,eAAe,EACf,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,EACd,aAAa,EACb,aAAa,GACd,MAAM,qBAAqB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -9,5 +9,5 @@
|
|
|
9
9
|
* @packageDocumentation
|
|
10
10
|
*/
|
|
11
11
|
export { defineConfig, defineRepoConfig, defineWorkspace } from './config.js';
|
|
12
|
-
export { build, validate, scaffold, init, migrate, checkSupport, addTarget, listTargets, } from './pipeline/operations.js';
|
|
12
|
+
export { build, validate, scaffold, init, refreshScaffold, migrate, checkSupport, addTarget, listTargets, } from './pipeline/operations.js';
|
|
13
13
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAU9E,OAAO,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,MAAM,0BAA0B,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAU9E,OAAO,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,eAAe,EACf,OAAO,EACP,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,MAAM,0BAA0B,CAAC"}
|
|
@@ -22,12 +22,30 @@ export interface InitFile {
|
|
|
22
22
|
content: string;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
|
-
*
|
|
26
|
-
*
|
|
25
|
+
* Toolkit-owned **scaffold** files that `aipm init --refresh` keeps in sync with the installed
|
|
26
|
+
* tooling: the CI workflow. It is a pure tooling recipe — its content is independent of the repo
|
|
27
|
+
* name and the pinned toolkit version, so refresh can re-render it with no inputs and compare
|
|
28
|
+
* byte-for-byte. (Files with repo identity or user content — `package.json`, `aipm.workspace.ts`,
|
|
29
|
+
* `README.md`, plugins, `aipm build` output — are deliberately NOT here. `.gitignore` is seeded by
|
|
30
|
+
* `init` but NOT managed, since users extend it freely.)
|
|
27
31
|
*
|
|
28
|
-
*
|
|
29
|
-
* registries, an empty `plugins/` (seeded with `.gitkeep` so the directory is tracked), and the
|
|
30
|
-
* CI workflow. Output is a pure function of the two inputs — stable ordering, no timestamps.
|
|
32
|
+
* Output is deterministic and stably ordered.
|
|
31
33
|
*/
|
|
32
|
-
export declare function
|
|
34
|
+
export declare function buildManagedScaffoldFiles(): InitFile[];
|
|
35
|
+
/**
|
|
36
|
+
* Build the complete, deterministic seed file set for a consumer repo.
|
|
37
|
+
*
|
|
38
|
+
* - `name` — the `package.json` name (repo identity).
|
|
39
|
+
* - `marketplaceName` — the marketplace identity written into both repo-root registries' top-level
|
|
40
|
+
* `name`/`owner.name`. MUST be unique across marketplaces (a shared name collides on install).
|
|
41
|
+
* `runInit` resolves this default (`${USER}-ai-plugins`) at its I/O boundary and passes it in,
|
|
42
|
+
* keeping this function a pure function of its inputs (no environment reads).
|
|
43
|
+
* - `cliVersion`/`coreVersion` — pinned as carets of the respective dev dependencies.
|
|
44
|
+
*
|
|
45
|
+
* The set mirrors §3.2: `package.json`, the seed-only `.gitignore`, the
|
|
46
|
+
* {@link buildManagedScaffoldFiles managed scaffold files} (CI workflow), `README.md`, both
|
|
47
|
+
* named repo-root marketplace registries, and an empty `plugins/` (seeded with `.gitkeep` so the
|
|
48
|
+
* directory is tracked). Output is a pure function of the inputs — stable ordering, no timestamps.
|
|
49
|
+
*/
|
|
50
|
+
export declare function buildInitFiles(name: string, marketplaceName: string, cliVersion: string, coreVersion: string): InitFile[];
|
|
33
51
|
//# sourceMappingURL=init-template.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-template.d.ts","sourceRoot":"","sources":["../../src/pipeline/init-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;
|
|
1
|
+
{"version":3,"file":"init-template.d.ts","sourceRoot":"","sources":["../../src/pipeline/init-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAYH,gGAAgG;AAChG,MAAM,WAAW,QAAQ;IACvB,yDAAyD;IACzD,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,OAAO,EAAE,MAAM,CAAC;CACjB;AAuLD;;;;;;;;;GASG;AACH,wBAAgB,yBAAyB,IAAI,QAAQ,EAAE,CAEtD;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,GAClB,QAAQ,EAAE,CAUZ"}
|
|
@@ -14,46 +14,61 @@
|
|
|
14
14
|
* @see docs/specs/architecture.md §11 (template→toolkit dependency contract)
|
|
15
15
|
* @see docs/specs/architecture.md §10.5 (freshness check the CI workflow runs)
|
|
16
16
|
*/
|
|
17
|
-
const json = String.raw;
|
|
18
17
|
const md = String.raw;
|
|
19
18
|
const yaml = String.raw;
|
|
19
|
+
/**
|
|
20
|
+
* pnpm version pinned in the generated `package.json#packageManager`. The CI workflow reads the
|
|
21
|
+
* pnpm version from this field (it runs `pnpm/action-setup` without a hard-coded version), so the
|
|
22
|
+
* two stay in sync. Bumped deliberately when the recommended pnpm baseline moves.
|
|
23
|
+
*/
|
|
24
|
+
const PACKAGE_MANAGER = 'pnpm@10.30.3';
|
|
20
25
|
/**
|
|
21
26
|
* The `package.json` for a generated consumer repo.
|
|
22
27
|
*
|
|
23
28
|
* - `private: true` — a plugin repo is never published to npm; only its plugins ship to registries.
|
|
24
29
|
* - `type: 'module'` — the toolkit is ESM-only (§8.1), and `aipm.config.ts` files are ESM.
|
|
30
|
+
* - `packageManager` pins pnpm; the CI workflow reads the pnpm version from here.
|
|
25
31
|
* - `scripts` call `aipm` directly (it is on PATH via the dev dependency's bin).
|
|
26
|
-
* -
|
|
27
|
-
*
|
|
32
|
+
* - `cli` provides the `aipm` binary; `core` provides `defineConfig`/`defineWorkspace` for each
|
|
33
|
+
* plugin's `aipm.config.ts` (§6.1). They ship independently and may differ (`cli 0.1.1` ships
|
|
34
|
+
* with `core 0.2.0`), so each is pinned to a caret of its own version; authors upgrade both via
|
|
35
|
+
* `pnpm up` (§11 contract).
|
|
28
36
|
*
|
|
29
37
|
* Emitted as 2-space JSON with a trailing newline to match the repo's formatting conventions.
|
|
30
38
|
*/
|
|
31
|
-
function renderPackageJson(name,
|
|
39
|
+
function renderPackageJson(name, cliVersion, coreVersion) {
|
|
32
40
|
const pkg = {
|
|
33
41
|
name,
|
|
34
42
|
private: true,
|
|
35
43
|
type: 'module',
|
|
44
|
+
packageManager: PACKAGE_MANAGER,
|
|
36
45
|
scripts: {
|
|
37
46
|
build: 'aipm build',
|
|
38
47
|
check: 'aipm validate',
|
|
39
48
|
scaffold: 'aipm scaffold',
|
|
40
49
|
},
|
|
41
50
|
devDependencies: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
// version and upgraded together via `pnpm up`.
|
|
45
|
-
'@ai-plugin-marketplace/cli': `^${toolkitVersion}`,
|
|
46
|
-
'@ai-plugin-marketplace/core': `^${toolkitVersion}`,
|
|
51
|
+
'@ai-plugin-marketplace/cli': `^${cliVersion}`,
|
|
52
|
+
'@ai-plugin-marketplace/core': `^${coreVersion}`,
|
|
47
53
|
},
|
|
48
54
|
};
|
|
49
55
|
return `${JSON.stringify(pkg, null, 2)}\n`;
|
|
50
56
|
}
|
|
51
|
-
/**
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Empty, but NAMED, marketplace registry: `{ "name", "owner": { "name" }, "plugins": [] }`,
|
|
59
|
+
* 2-space JSON + trailing newline (§4.4). The top-level `name` is the identity host platforms
|
|
60
|
+
* register the marketplace under — it MUST be unique across marketplaces, since two marketplaces
|
|
61
|
+
* sharing a name collide on install (the later one shadows/strands the earlier's plugins). The
|
|
62
|
+
* Claude/Cursor marketplace schema is loose, so the extra `name`/`owner` fields are tolerated.
|
|
63
|
+
* The object is JSON-serialized so the marketplace name is safely escaped.
|
|
64
|
+
*/
|
|
65
|
+
function renderEmptyMarketplace(marketplaceName) {
|
|
66
|
+
const registry = {
|
|
67
|
+
name: marketplaceName,
|
|
68
|
+
owner: { name: marketplaceName },
|
|
69
|
+
plugins: [],
|
|
70
|
+
};
|
|
71
|
+
return `${JSON.stringify(registry, null, 2)}\n`;
|
|
57
72
|
}
|
|
58
73
|
/** README pointing authors at the upgrade-via-`pnpm up` workflow (§11). */
|
|
59
74
|
function renderReadme(name) {
|
|
@@ -95,48 +110,131 @@ function renderCiWorkflow() {
|
|
|
95
110
|
|
|
96
111
|
on:
|
|
97
112
|
push:
|
|
113
|
+
branches: [main]
|
|
98
114
|
pull_request:
|
|
115
|
+
branches: [main]
|
|
99
116
|
|
|
100
117
|
jobs:
|
|
101
|
-
|
|
118
|
+
CI:
|
|
102
119
|
runs-on: ubuntu-latest
|
|
120
|
+
env:
|
|
121
|
+
CI: "true"
|
|
103
122
|
steps:
|
|
104
123
|
- uses: actions/checkout@v4
|
|
124
|
+
|
|
105
125
|
- uses: pnpm/action-setup@v4
|
|
126
|
+
# version is read from package.json#packageManager — do not duplicate here
|
|
127
|
+
|
|
106
128
|
- uses: actions/setup-node@v4
|
|
107
129
|
with:
|
|
108
|
-
node-version:
|
|
130
|
+
node-version: 24
|
|
109
131
|
cache: pnpm
|
|
110
|
-
|
|
111
|
-
-
|
|
112
|
-
|
|
132
|
+
|
|
133
|
+
- name: Install dependencies
|
|
134
|
+
run: pnpm install --frozen-lockfile
|
|
135
|
+
|
|
136
|
+
- name: Build plugins
|
|
137
|
+
run: pnpm exec aipm build
|
|
138
|
+
|
|
139
|
+
- name: Verify the tree is clean after build (freshness)
|
|
140
|
+
run: |
|
|
141
|
+
if [ -n "$(git status --porcelain)" ]; then
|
|
142
|
+
echo "::error::Working tree is dirty after 'aipm build'. Run 'aipm build' locally and commit the regenerated artifacts."
|
|
143
|
+
git status --porcelain
|
|
144
|
+
git --no-pager diff
|
|
145
|
+
exit 1
|
|
146
|
+
fi
|
|
147
|
+
|
|
148
|
+
- name: Validate plugins
|
|
149
|
+
run: pnpm exec aipm validate
|
|
113
150
|
`;
|
|
114
151
|
}
|
|
115
|
-
/**
|
|
152
|
+
/**
|
|
153
|
+
* `.gitignore` for a consumer repo. Comprehensive baseline covering dependencies, build
|
|
154
|
+
* intermediates, logs, test coverage, caches, environment/secret files, scratch artifacts, and
|
|
155
|
+
* OS/local cruft. Notably ignores `.env*` so a freshly scaffolded repo cannot accidentally commit
|
|
156
|
+
* secrets.
|
|
157
|
+
*
|
|
158
|
+
* Deliberately does **not** ignore `dist/`: toolkit build output (per-plugin `dist/` bundles and
|
|
159
|
+
* generated hook JSON) is committed and freshness-checked — see `docs/specs/architecture.md` §P5
|
|
160
|
+
* ("Both authored sources and generated outputs are committed") and §10.5 (Freshness check).
|
|
161
|
+
*
|
|
162
|
+
* This is **seed-only**: `aipm init` writes it, but it is intentionally absent from
|
|
163
|
+
* {@link buildManagedScaffoldFiles} so `aipm init --refresh` never clobbers or perpetually flags
|
|
164
|
+
* the user's own additions (`.gitignore` is something users legitimately extend).
|
|
165
|
+
*/
|
|
116
166
|
function renderGitignore() {
|
|
117
|
-
return
|
|
167
|
+
return `# Dependencies
|
|
168
|
+
node_modules/
|
|
169
|
+
|
|
170
|
+
# Build intermediates
|
|
171
|
+
*.tsbuildinfo
|
|
172
|
+
|
|
173
|
+
# Logs
|
|
174
|
+
*.log
|
|
175
|
+
logs/
|
|
176
|
+
|
|
177
|
+
# Test coverage
|
|
178
|
+
coverage/
|
|
179
|
+
*.lcov
|
|
180
|
+
|
|
181
|
+
# Caches
|
|
182
|
+
.cache/
|
|
183
|
+
.eslintcache
|
|
184
|
+
.npm/
|
|
185
|
+
|
|
186
|
+
# Environment / secrets
|
|
187
|
+
.env
|
|
188
|
+
.env.*
|
|
189
|
+
!.env.example
|
|
190
|
+
|
|
191
|
+
# Scratch & manual-test artifacts
|
|
192
|
+
scratch/
|
|
193
|
+
|
|
194
|
+
# OS / editor cruft
|
|
118
195
|
.DS_Store
|
|
196
|
+
|
|
197
|
+
# Local overrides
|
|
119
198
|
*.local.*
|
|
120
|
-
*.tsbuildinfo
|
|
121
199
|
`;
|
|
122
200
|
}
|
|
123
201
|
/**
|
|
124
|
-
*
|
|
125
|
-
*
|
|
202
|
+
* Toolkit-owned **scaffold** files that `aipm init --refresh` keeps in sync with the installed
|
|
203
|
+
* tooling: the CI workflow. It is a pure tooling recipe — its content is independent of the repo
|
|
204
|
+
* name and the pinned toolkit version, so refresh can re-render it with no inputs and compare
|
|
205
|
+
* byte-for-byte. (Files with repo identity or user content — `package.json`, `aipm.workspace.ts`,
|
|
206
|
+
* `README.md`, plugins, `aipm build` output — are deliberately NOT here. `.gitignore` is seeded by
|
|
207
|
+
* `init` but NOT managed, since users extend it freely.)
|
|
208
|
+
*
|
|
209
|
+
* Output is deterministic and stably ordered.
|
|
210
|
+
*/
|
|
211
|
+
export function buildManagedScaffoldFiles() {
|
|
212
|
+
return [{ path: '.github/workflows/ci.yml', content: renderCiWorkflow() }];
|
|
213
|
+
}
|
|
214
|
+
/**
|
|
215
|
+
* Build the complete, deterministic seed file set for a consumer repo.
|
|
216
|
+
*
|
|
217
|
+
* - `name` — the `package.json` name (repo identity).
|
|
218
|
+
* - `marketplaceName` — the marketplace identity written into both repo-root registries' top-level
|
|
219
|
+
* `name`/`owner.name`. MUST be unique across marketplaces (a shared name collides on install).
|
|
220
|
+
* `runInit` resolves this default (`${USER}-ai-plugins`) at its I/O boundary and passes it in,
|
|
221
|
+
* keeping this function a pure function of its inputs (no environment reads).
|
|
222
|
+
* - `cliVersion`/`coreVersion` — pinned as carets of the respective dev dependencies.
|
|
126
223
|
*
|
|
127
|
-
* The set mirrors §3.2: `package.json`, `.gitignore`,
|
|
128
|
-
*
|
|
129
|
-
*
|
|
224
|
+
* The set mirrors §3.2: `package.json`, the seed-only `.gitignore`, the
|
|
225
|
+
* {@link buildManagedScaffoldFiles managed scaffold files} (CI workflow), `README.md`, both
|
|
226
|
+
* named repo-root marketplace registries, and an empty `plugins/` (seeded with `.gitkeep` so the
|
|
227
|
+
* directory is tracked). Output is a pure function of the inputs — stable ordering, no timestamps.
|
|
130
228
|
*/
|
|
131
|
-
export function buildInitFiles(name,
|
|
229
|
+
export function buildInitFiles(name, marketplaceName, cliVersion, coreVersion) {
|
|
132
230
|
return [
|
|
133
|
-
{ path: 'package.json', content: renderPackageJson(name,
|
|
231
|
+
{ path: 'package.json', content: renderPackageJson(name, cliVersion, coreVersion) },
|
|
134
232
|
{ path: '.gitignore', content: renderGitignore() },
|
|
135
233
|
{ path: 'README.md', content: renderReadme(name) },
|
|
136
|
-
{ path: '.claude-plugin/marketplace.json', content: renderEmptyMarketplace() },
|
|
137
|
-
{ path: '.cursor-plugin/marketplace.json', content: renderEmptyMarketplace() },
|
|
234
|
+
{ path: '.claude-plugin/marketplace.json', content: renderEmptyMarketplace(marketplaceName) },
|
|
235
|
+
{ path: '.cursor-plugin/marketplace.json', content: renderEmptyMarketplace(marketplaceName) },
|
|
138
236
|
{ path: 'plugins/.gitkeep', content: '' },
|
|
139
|
-
|
|
237
|
+
...buildManagedScaffoldFiles(),
|
|
140
238
|
];
|
|
141
239
|
}
|
|
142
240
|
//# sourceMappingURL=init-template.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init-template.js","sourceRoot":"","sources":["../../src/pipeline/init-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,
|
|
1
|
+
{"version":3,"file":"init-template.js","sourceRoot":"","sources":["../../src/pipeline/init-template.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,EAAE,GAAG,MAAM,CAAC,GAAG,CAAC;AACtB,MAAM,IAAI,GA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,CAAC;AACF,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,yBAAyB;IACvC,OAAO,CAAC,EAAE,IAAI,EAAE,0BAA0B,EAAE,OAAO,EAAE,gBAAgB,EAAE,EAAE,CAAC,CAAC;AAC7E,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,eAAuB,EACvB,UAAkB,EAClB,WAAmB;IAEnB,OAAO;QACL,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,iBAAiB,CAAC,IAAI,EAAE,UAAU,EAAE,WAAW,CAAC,EAAE;QACnF,EAAE,IAAI,EAAE,YAAY,EAAE,OAAO,EAAE,eAAe,EAAE,EAAE;QAClD,EAAE,IAAI,EAAE,WAAW,EAAE,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC,EAAE;QAClD,EAAE,IAAI,EAAE,iCAAiC,EAAE,OAAO,EAAE,sBAAsB,CAAC,eAAe,CAAC,EAAE;QAC7F,EAAE,IAAI,EAAE,iCAAiC,EAAE,OAAO,EAAE,sBAAsB,CAAC,eAAe,CAAC,EAAE;QAC7F,EAAE,IAAI,EAAE,kBAAkB,EAAE,OAAO,EAAE,EAAE,EAAE;QACzC,GAAG,yBAAyB,EAAE;KAC/B,CAAC;AACJ,CAAC"}
|
package/dist/pipeline/init.d.ts
CHANGED
|
@@ -4,35 +4,40 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This is the filesystem-writing orchestrator behind the public `init` operation and the
|
|
6
6
|
* `aipm init [dir]` CLI surface. The generated file *contents* live in `init-template.ts`; this
|
|
7
|
-
* module is the I/O boundary: it resolves the
|
|
8
|
-
*
|
|
7
|
+
* module is the I/O boundary: it resolves the versions to pin, refuses to clobber a non-empty
|
|
8
|
+
* target, writes the seed tree, and seeds the `.aipm/scaffold.json` refresh sidecar.
|
|
9
9
|
*
|
|
10
|
-
* **Version pinning
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
-
* the
|
|
10
|
+
* **Version pinning.** `cli` and `core` ship independently and may differ (e.g. `cli 0.1.1` ships
|
|
11
|
+
* with `core 0.2.0`), so the generated `package.json` pins each to a caret of its *own* version.
|
|
12
|
+
* `core`'s version is read at runtime from this package's `package.json` (resolved relative to
|
|
13
|
+
* {@link import.meta.url}, exactly as `load-config.ts` resolves the package entrypoint); `cli`'s
|
|
14
|
+
* version is supplied by the cli entrypoint via {@link InitOptions.cliVersion} (it reads its own
|
|
15
|
+
* `package.json`). When `cliVersion` is omitted, it falls back to core's version.
|
|
15
16
|
*
|
|
16
17
|
* @see docs/specs/architecture.md §3.2 (template repo contents)
|
|
17
|
-
* @see docs/specs/architecture.md §9.1 (lockstep release lines)
|
|
18
18
|
* @see docs/specs/architecture.md §11 (template→toolkit dependency contract)
|
|
19
|
+
* @see docs/specs/scaffold-refresh-and-upgrade.md (`aipm init --refresh`)
|
|
19
20
|
*/
|
|
20
21
|
import type { InitOptions } from './types.js';
|
|
21
22
|
/**
|
|
22
23
|
* Scaffold a thin consumer repo at `targetDir` (§3.2).
|
|
23
24
|
*
|
|
24
|
-
* Writes `package.json` (with
|
|
25
|
-
*
|
|
26
|
-
*
|
|
27
|
-
* `aipm build` then `aipm validate` (§10.5 freshness).
|
|
28
|
-
* `
|
|
25
|
+
* Writes `package.json` (with `cli`/`core` dev dependencies pinned to carets of their respective
|
|
26
|
+
* versions), `.gitignore`, `README.md`, both repo-root marketplace registries (each named, empty:
|
|
27
|
+
* `{ "name", "owner": { "name" }, "plugins": [] }`), an empty `plugins/` (tracked via `.gitkeep`),
|
|
28
|
+
* and a CI workflow that runs `aipm build` then `aipm validate` (§10.5 freshness). It also seeds
|
|
29
|
+
* `.aipm/scaffold.json` so a later `aipm init --refresh` can tell pristine toolkit-owned files from
|
|
30
|
+
* user edits. The repo name defaults to `basename(targetDir)` (override with `opts.name`); the
|
|
31
|
+
* marketplace name defaults to `${USER}-ai-plugins` (override with `opts.marketplaceName`).
|
|
29
32
|
*
|
|
30
33
|
* **Refuses to clobber.** If `targetDir` exists and is a non-empty directory (or exists as a
|
|
31
34
|
* non-directory), the function throws and writes nothing. Creating into a fresh or empty directory
|
|
32
35
|
* is fine.
|
|
33
36
|
*
|
|
34
37
|
* @param targetDir - Absolute or relative path to the directory to scaffold into.
|
|
35
|
-
* @param opts - Init options; `name` overrides the derived repo name
|
|
38
|
+
* @param opts - Init options; `name` overrides the derived repo name, `marketplaceName` the
|
|
39
|
+
* default `${USER}-ai-plugins` marketplace name, `cliVersion` the pinned cli dependency version
|
|
40
|
+
* (defaults to core's version).
|
|
36
41
|
* @throws {Error} When `targetDir` exists and is non-empty (or is not a directory).
|
|
37
42
|
*/
|
|
38
43
|
export declare function runInit(targetDir: string, opts?: InitOptions): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/pipeline/init.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../src/pipeline/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAQH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AA+D9C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,wBAAsB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,IAAI,GAAE,WAAgB,GAAG,OAAO,CAAC,IAAI,CAAC,CAmCtF"}
|
package/dist/pipeline/init.js
CHANGED
|
@@ -4,23 +4,25 @@
|
|
|
4
4
|
*
|
|
5
5
|
* This is the filesystem-writing orchestrator behind the public `init` operation and the
|
|
6
6
|
* `aipm init [dir]` CLI surface. The generated file *contents* live in `init-template.ts`; this
|
|
7
|
-
* module is the I/O boundary: it resolves the
|
|
8
|
-
*
|
|
7
|
+
* module is the I/O boundary: it resolves the versions to pin, refuses to clobber a non-empty
|
|
8
|
+
* target, writes the seed tree, and seeds the `.aipm/scaffold.json` refresh sidecar.
|
|
9
9
|
*
|
|
10
|
-
* **Version pinning
|
|
11
|
-
*
|
|
12
|
-
* `
|
|
13
|
-
*
|
|
14
|
-
* the
|
|
10
|
+
* **Version pinning.** `cli` and `core` ship independently and may differ (e.g. `cli 0.1.1` ships
|
|
11
|
+
* with `core 0.2.0`), so the generated `package.json` pins each to a caret of its *own* version.
|
|
12
|
+
* `core`'s version is read at runtime from this package's `package.json` (resolved relative to
|
|
13
|
+
* {@link import.meta.url}, exactly as `load-config.ts` resolves the package entrypoint); `cli`'s
|
|
14
|
+
* version is supplied by the cli entrypoint via {@link InitOptions.cliVersion} (it reads its own
|
|
15
|
+
* `package.json`). When `cliVersion` is omitted, it falls back to core's version.
|
|
15
16
|
*
|
|
16
17
|
* @see docs/specs/architecture.md §3.2 (template repo contents)
|
|
17
|
-
* @see docs/specs/architecture.md §9.1 (lockstep release lines)
|
|
18
18
|
* @see docs/specs/architecture.md §11 (template→toolkit dependency contract)
|
|
19
|
+
* @see docs/specs/scaffold-refresh-and-upgrade.md (`aipm init --refresh`)
|
|
19
20
|
*/
|
|
20
21
|
import * as fs from 'node:fs';
|
|
21
22
|
import * as path from 'node:path';
|
|
22
23
|
import { fileURLToPath } from 'node:url';
|
|
23
24
|
import { buildInitFiles } from './init-template.js';
|
|
25
|
+
import { writeScaffoldSidecar } from './scaffold-refresh.js';
|
|
24
26
|
/**
|
|
25
27
|
* Read this package's `package.json#version`, resolved relative to this module's location.
|
|
26
28
|
*
|
|
@@ -36,6 +38,40 @@ function coreVersion() {
|
|
|
36
38
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
|
|
37
39
|
return pkg.version;
|
|
38
40
|
}
|
|
41
|
+
/**
|
|
42
|
+
* Resolve the default marketplace name from the environment: `${USER}-ai-plugins`. Falls back to
|
|
43
|
+
* `$USERNAME` (set on Windows, where `$USER` is typically absent) before giving up and using the
|
|
44
|
+
* `my-ai-plugins` placeholder — which `aipm validate` deliberately flags via
|
|
45
|
+
* `default-marketplace-name`, nudging the author to pass an explicit `--name`.
|
|
46
|
+
*
|
|
47
|
+
* Resolved here in the I/O boundary (not in the pure `init-template.ts`) so the template stays a
|
|
48
|
+
* pure function of its inputs (§: no env reads / clocks in `init-template.ts`).
|
|
49
|
+
*/
|
|
50
|
+
function defaultMarketplaceName() {
|
|
51
|
+
// `$USER` on POSIX, `$USERNAME` on Windows. Treat empty/whitespace as absent so a blank env var
|
|
52
|
+
// falls through to the next candidate rather than producing a `-ai-plugins` name.
|
|
53
|
+
for (const candidate of [process.env['USER'], process.env['USERNAME']]) {
|
|
54
|
+
const trimmed = candidate?.trim();
|
|
55
|
+
if (trimmed !== undefined && trimmed.length > 0)
|
|
56
|
+
return `${trimmed}-ai-plugins`;
|
|
57
|
+
}
|
|
58
|
+
return 'my-ai-plugins';
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Normalize an explicitly-provided `name`/`marketplaceName` option: `undefined` (caller wants the
|
|
62
|
+
* default) passes through as `undefined`; a non-blank string is returned trimmed; a blank or
|
|
63
|
+
* whitespace-only string is rejected, since it would yield an invalid `package.json` name and an
|
|
64
|
+
* empty marketplace identity. `field` names the option in the error message.
|
|
65
|
+
*/
|
|
66
|
+
function resolveProvidedName(value, field) {
|
|
67
|
+
if (value === undefined)
|
|
68
|
+
return undefined;
|
|
69
|
+
const trimmed = value.trim();
|
|
70
|
+
if (trimmed.length === 0) {
|
|
71
|
+
throw new Error(`Invalid '${field}': must be a non-empty, non-whitespace string.`);
|
|
72
|
+
}
|
|
73
|
+
return trimmed;
|
|
74
|
+
}
|
|
39
75
|
/**
|
|
40
76
|
* True iff `dir` does not exist, or exists as an empty directory. A non-empty directory (or a
|
|
41
77
|
* path that exists as a non-directory) is treated as "would clobber".
|
|
@@ -51,18 +87,22 @@ function isFreshTarget(dir) {
|
|
|
51
87
|
/**
|
|
52
88
|
* Scaffold a thin consumer repo at `targetDir` (§3.2).
|
|
53
89
|
*
|
|
54
|
-
* Writes `package.json` (with
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
* `aipm build` then `aipm validate` (§10.5 freshness).
|
|
58
|
-
* `
|
|
90
|
+
* Writes `package.json` (with `cli`/`core` dev dependencies pinned to carets of their respective
|
|
91
|
+
* versions), `.gitignore`, `README.md`, both repo-root marketplace registries (each named, empty:
|
|
92
|
+
* `{ "name", "owner": { "name" }, "plugins": [] }`), an empty `plugins/` (tracked via `.gitkeep`),
|
|
93
|
+
* and a CI workflow that runs `aipm build` then `aipm validate` (§10.5 freshness). It also seeds
|
|
94
|
+
* `.aipm/scaffold.json` so a later `aipm init --refresh` can tell pristine toolkit-owned files from
|
|
95
|
+
* user edits. The repo name defaults to `basename(targetDir)` (override with `opts.name`); the
|
|
96
|
+
* marketplace name defaults to `${USER}-ai-plugins` (override with `opts.marketplaceName`).
|
|
59
97
|
*
|
|
60
98
|
* **Refuses to clobber.** If `targetDir` exists and is a non-empty directory (or exists as a
|
|
61
99
|
* non-directory), the function throws and writes nothing. Creating into a fresh or empty directory
|
|
62
100
|
* is fine.
|
|
63
101
|
*
|
|
64
102
|
* @param targetDir - Absolute or relative path to the directory to scaffold into.
|
|
65
|
-
* @param opts - Init options; `name` overrides the derived repo name
|
|
103
|
+
* @param opts - Init options; `name` overrides the derived repo name, `marketplaceName` the
|
|
104
|
+
* default `${USER}-ai-plugins` marketplace name, `cliVersion` the pinned cli dependency version
|
|
105
|
+
* (defaults to core's version).
|
|
66
106
|
* @throws {Error} When `targetDir` exists and is non-empty (or is not a directory).
|
|
67
107
|
*/
|
|
68
108
|
export async function runInit(targetDir, opts = {}) {
|
|
@@ -71,14 +111,26 @@ export async function runInit(targetDir, opts = {}) {
|
|
|
71
111
|
throw new Error(`Refusing to scaffold into '${resolved}': the directory already exists and is not empty. ` +
|
|
72
112
|
'Choose a new path or an empty directory.');
|
|
73
113
|
}
|
|
74
|
-
|
|
75
|
-
|
|
114
|
+
// Reject an explicitly-provided but blank `name`/`marketplaceName` at the I/O boundary: an empty
|
|
115
|
+
// or whitespace-only value would otherwise produce an invalid `package.json` name and an empty
|
|
116
|
+
// marketplace identity in the registries. The derived defaults (basename / env-resolved) are
|
|
117
|
+
// trusted and not re-validated here.
|
|
118
|
+
const name = resolveProvidedName(opts.name, 'name') ?? path.basename(resolved);
|
|
119
|
+
// The marketplace name is the identity hosts register under and must be unique across
|
|
120
|
+
// marketplaces (a shared name collides on install). Prefer an explicit `--name`, then the
|
|
121
|
+
// env-derived `${USER}-ai-plugins`, resolved here so `buildInitFiles` stays pure.
|
|
122
|
+
const marketplaceName = resolveProvidedName(opts.marketplaceName, 'marketplaceName') ?? defaultMarketplaceName();
|
|
123
|
+
const core = coreVersion();
|
|
124
|
+
const cli = opts.cliVersion ?? core;
|
|
125
|
+
const files = buildInitFiles(name, marketplaceName, cli, core);
|
|
76
126
|
fs.mkdirSync(resolved, { recursive: true });
|
|
77
127
|
for (const file of files) {
|
|
78
128
|
const full = path.join(resolved, file.path);
|
|
79
129
|
fs.mkdirSync(path.dirname(full), { recursive: true });
|
|
80
130
|
fs.writeFileSync(full, file.content, 'utf-8');
|
|
81
131
|
}
|
|
132
|
+
// Seed the refresh sidecar so `aipm init --refresh` has a baseline of toolkit-owned content.
|
|
133
|
+
writeScaffoldSidecar(resolved);
|
|
82
134
|
return Promise.resolve();
|
|
83
135
|
}
|
|
84
136
|
//# sourceMappingURL=init.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/pipeline/init.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"init.js","sourceRoot":"","sources":["../../src/pipeline/init.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,M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