@ai-plugin-marketplace/core 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.
Files changed (136) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +67 -0
  3. package/dist/config.d.ts +47 -0
  4. package/dist/config.d.ts.map +1 -0
  5. package/dist/config.js +38 -0
  6. package/dist/config.js.map +1 -0
  7. package/dist/core.d.ts +291 -0
  8. package/dist/index.d.ts +15 -0
  9. package/dist/index.d.ts.map +1 -0
  10. package/dist/index.js +13 -0
  11. package/dist/index.js.map +1 -0
  12. package/dist/pipeline/build.d.ts +90 -0
  13. package/dist/pipeline/build.d.ts.map +1 -0
  14. package/dist/pipeline/build.js +224 -0
  15. package/dist/pipeline/build.js.map +1 -0
  16. package/dist/pipeline/discover.d.ts +37 -0
  17. package/dist/pipeline/discover.d.ts.map +1 -0
  18. package/dist/pipeline/discover.js +71 -0
  19. package/dist/pipeline/discover.js.map +1 -0
  20. package/dist/pipeline/init-template.d.ts +33 -0
  21. package/dist/pipeline/init-template.d.ts.map +1 -0
  22. package/dist/pipeline/init-template.js +142 -0
  23. package/dist/pipeline/init-template.js.map +1 -0
  24. package/dist/pipeline/init.d.ts +39 -0
  25. package/dist/pipeline/init.d.ts.map +1 -0
  26. package/dist/pipeline/init.js +84 -0
  27. package/dist/pipeline/init.js.map +1 -0
  28. package/dist/pipeline/load-config.d.ts +47 -0
  29. package/dist/pipeline/load-config.d.ts.map +1 -0
  30. package/dist/pipeline/load-config.js +106 -0
  31. package/dist/pipeline/load-config.js.map +1 -0
  32. package/dist/pipeline/operations.d.ts +70 -0
  33. package/dist/pipeline/operations.d.ts.map +1 -0
  34. package/dist/pipeline/operations.js +100 -0
  35. package/dist/pipeline/operations.js.map +1 -0
  36. package/dist/pipeline/scaffold.d.ts +105 -0
  37. package/dist/pipeline/scaffold.d.ts.map +1 -0
  38. package/dist/pipeline/scaffold.js +422 -0
  39. package/dist/pipeline/scaffold.js.map +1 -0
  40. package/dist/pipeline/sentinel.d.ts +127 -0
  41. package/dist/pipeline/sentinel.d.ts.map +1 -0
  42. package/dist/pipeline/sentinel.js +263 -0
  43. package/dist/pipeline/sentinel.js.map +1 -0
  44. package/dist/pipeline/types.d.ts +178 -0
  45. package/dist/pipeline/types.d.ts.map +1 -0
  46. package/dist/pipeline/types.js +26 -0
  47. package/dist/pipeline/types.js.map +1 -0
  48. package/dist/pipeline/validate.d.ts +90 -0
  49. package/dist/pipeline/validate.d.ts.map +1 -0
  50. package/dist/pipeline/validate.js +617 -0
  51. package/dist/pipeline/validate.js.map +1 -0
  52. package/dist/targets/claude/scaffold.d.ts +32 -0
  53. package/dist/targets/claude/scaffold.d.ts.map +1 -0
  54. package/dist/targets/claude/scaffold.js +48 -0
  55. package/dist/targets/claude/scaffold.js.map +1 -0
  56. package/dist/targets/claude/schemas.d.ts +119 -0
  57. package/dist/targets/claude/schemas.d.ts.map +1 -0
  58. package/dist/targets/claude/schemas.js +204 -0
  59. package/dist/targets/claude/schemas.js.map +1 -0
  60. package/dist/targets/claude/transform.d.ts +40 -0
  61. package/dist/targets/claude/transform.d.ts.map +1 -0
  62. package/dist/targets/claude/transform.js +48 -0
  63. package/dist/targets/claude/transform.js.map +1 -0
  64. package/dist/targets/claude/validate.d.ts +25 -0
  65. package/dist/targets/claude/validate.d.ts.map +1 -0
  66. package/dist/targets/claude/validate.js +263 -0
  67. package/dist/targets/claude/validate.js.map +1 -0
  68. package/dist/targets/cursor/scaffold.d.ts +29 -0
  69. package/dist/targets/cursor/scaffold.d.ts.map +1 -0
  70. package/dist/targets/cursor/scaffold.js +45 -0
  71. package/dist/targets/cursor/scaffold.js.map +1 -0
  72. package/dist/targets/cursor/schemas.d.ts +49 -0
  73. package/dist/targets/cursor/schemas.d.ts.map +1 -0
  74. package/dist/targets/cursor/schemas.js +125 -0
  75. package/dist/targets/cursor/schemas.js.map +1 -0
  76. package/dist/targets/cursor/validate.d.ts +28 -0
  77. package/dist/targets/cursor/validate.d.ts.map +1 -0
  78. package/dist/targets/cursor/validate.js +181 -0
  79. package/dist/targets/cursor/validate.js.map +1 -0
  80. package/dist/targets/gemini/bundle.d.ts +25 -0
  81. package/dist/targets/gemini/bundle.d.ts.map +1 -0
  82. package/dist/targets/gemini/bundle.js +149 -0
  83. package/dist/targets/gemini/bundle.js.map +1 -0
  84. package/dist/targets/gemini/scaffold.d.ts +28 -0
  85. package/dist/targets/gemini/scaffold.d.ts.map +1 -0
  86. package/dist/targets/gemini/scaffold.js +57 -0
  87. package/dist/targets/gemini/scaffold.js.map +1 -0
  88. package/dist/targets/gemini/schemas.d.ts +53 -0
  89. package/dist/targets/gemini/schemas.d.ts.map +1 -0
  90. package/dist/targets/gemini/schemas.js +72 -0
  91. package/dist/targets/gemini/schemas.js.map +1 -0
  92. package/dist/targets/gemini/transform.d.ts +106 -0
  93. package/dist/targets/gemini/transform.d.ts.map +1 -0
  94. package/dist/targets/gemini/transform.js +137 -0
  95. package/dist/targets/gemini/transform.js.map +1 -0
  96. package/dist/targets/gemini/validate.d.ts +26 -0
  97. package/dist/targets/gemini/validate.d.ts.map +1 -0
  98. package/dist/targets/gemini/validate.js +146 -0
  99. package/dist/targets/gemini/validate.js.map +1 -0
  100. package/dist/targets/kiro/bundle.d.ts +32 -0
  101. package/dist/targets/kiro/bundle.d.ts.map +1 -0
  102. package/dist/targets/kiro/bundle.js +106 -0
  103. package/dist/targets/kiro/bundle.js.map +1 -0
  104. package/dist/targets/kiro/scaffold.d.ts +28 -0
  105. package/dist/targets/kiro/scaffold.d.ts.map +1 -0
  106. package/dist/targets/kiro/scaffold.js +55 -0
  107. package/dist/targets/kiro/scaffold.js.map +1 -0
  108. package/dist/targets/kiro/schemas.d.ts +100 -0
  109. package/dist/targets/kiro/schemas.d.ts.map +1 -0
  110. package/dist/targets/kiro/schemas.js +147 -0
  111. package/dist/targets/kiro/schemas.js.map +1 -0
  112. package/dist/targets/kiro/transform.d.ts +53 -0
  113. package/dist/targets/kiro/transform.d.ts.map +1 -0
  114. package/dist/targets/kiro/transform.js +113 -0
  115. package/dist/targets/kiro/transform.js.map +1 -0
  116. package/dist/targets/kiro/validate.d.ts +36 -0
  117. package/dist/targets/kiro/validate.d.ts.map +1 -0
  118. package/dist/targets/kiro/validate.js +232 -0
  119. package/dist/targets/kiro/validate.js.map +1 -0
  120. package/dist/targets/scaffold-kit.d.ts +56 -0
  121. package/dist/targets/scaffold-kit.d.ts.map +1 -0
  122. package/dist/targets/scaffold-kit.js +33 -0
  123. package/dist/targets/scaffold-kit.js.map +1 -0
  124. package/dist/targets/vercel/scaffold.d.ts +34 -0
  125. package/dist/targets/vercel/scaffold.d.ts.map +1 -0
  126. package/dist/targets/vercel/scaffold.js +58 -0
  127. package/dist/targets/vercel/scaffold.js.map +1 -0
  128. package/dist/targets/vercel/schemas.d.ts +42 -0
  129. package/dist/targets/vercel/schemas.d.ts.map +1 -0
  130. package/dist/targets/vercel/schemas.js +69 -0
  131. package/dist/targets/vercel/schemas.js.map +1 -0
  132. package/dist/targets/vercel/validate.d.ts +28 -0
  133. package/dist/targets/vercel/validate.d.ts.map +1 -0
  134. package/dist/targets/vercel/validate.js +180 -0
  135. package/dist/targets/vercel/validate.js.map +1 -0
  136. package/package.json +50 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Mike North
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,67 @@
1
+ # @ai-plugin-marketplace/core
2
+
3
+ Build pipeline, validation, scaffolding, and `defineConfig` — the programmatic API behind the
4
+ `aipm` CLI.
5
+
6
+ > Most users should install [`@ai-plugin-marketplace/cli`](../cli) instead. Use this package
7
+ > directly only when you need to call the build/validate operations from your own scripts.
8
+
9
+ ## Install
10
+
11
+ ```sh
12
+ pnpm add -D @ai-plugin-marketplace/core
13
+ ```
14
+
15
+ ## Public API
16
+
17
+ All exports are available from the root import path — there are no public subpaths.
18
+
19
+ ```ts
20
+ import {
21
+ defineConfig,
22
+ build,
23
+ validate,
24
+ scaffold,
25
+ init,
26
+ migrate,
27
+ checkSupport,
28
+ addTarget,
29
+ listTargets,
30
+ } from '@ai-plugin-marketplace/core';
31
+ ```
32
+
33
+ ### Config
34
+
35
+ | Export | Description |
36
+ | ----------------- | ------------------------------------------------------------------------ |
37
+ | `defineConfig` | Validates and brands an `AipmConfigInput`; use in every `aipm.config.ts` |
38
+ | `AipmConfigInput` | Input type: `{ version: string; targets: TargetId[] }` |
39
+ | `AipmConfig` | Branded output type returned by `defineConfig` |
40
+
41
+ ### Operations
42
+
43
+ | Export | Description |
44
+ | -------------- | ------------------------------------------------------------------ |
45
+ | `init` | Scaffold a new plugin repo at a given directory |
46
+ | `build` | Build artifacts for a plugin or all plugins under a repo root |
47
+ | `validate` | Inspect on-disk state and return `ValidationResult` (read-only) |
48
+ | `scaffold` | Create a new plugin directory from templates |
49
+ | `migrate` | Apply schema migrations (no-op in v0.1.0; real in future releases) |
50
+ | `checkSupport` | Report missing artifacts and expansion suggestions for a plugin |
51
+ | `addTarget` | Scaffold skeleton files for a new target in an existing plugin |
52
+ | `listTargets` | Return the `TargetId` values this toolkit version recognises |
53
+
54
+ ### Key types
55
+
56
+ `TargetId`, `BuildOptions`, `BuildResult`, `GeneratedFile`, `ValidateOptions`,
57
+ `ValidationResult`, `Finding`, `FindingCode`, `ScaffoldOptions`, `InitOptions`,
58
+ `MigrateOptions`, `MigrateResult`, `SupportReport`.
59
+
60
+ ## Links
61
+
62
+ - [Architecture spec](../../docs/specs/architecture.md) (§8.1 for the full public-API contract)
63
+ - [Repository](https://github.com/ai-plugin-marketplace/tools)
64
+
65
+ ## License
66
+
67
+ MIT
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Plugin author configuration — `aipm.config.ts`.
3
+ *
4
+ * Per §6.1 of the architecture spec, `defineConfig` takes an `AipmConfigInput` and returns a
5
+ * branded `AipmConfig`. The brand symbol is module-private (never exported); consumers see
6
+ * `AipmConfig` as `AipmConfigInput` plus a structural marker proving `defineConfig` validated
7
+ * the value.
8
+ */
9
+ import type { TargetId } from './pipeline/types.js';
10
+ /**
11
+ * Raw input shape accepted by `defineConfig`. Plugin authors type their config literal against
12
+ * `AipmConfigInput` implicitly via `defineConfig`'s parameter.
13
+ *
14
+ * @public
15
+ */
16
+ export interface AipmConfigInput {
17
+ /** Semver string identifying the plugin author's release. See §9.5 of the spec. */
18
+ version: string;
19
+ /** Targets this plugin supports. See §6 of the spec. */
20
+ targets: readonly TargetId[];
21
+ }
22
+ /**
23
+ * Module-private brand marker. Intentionally never exported (§8.1: "The brand symbol is
24
+ * module-private"). Marked `@internal` so API Extractor does not flag `AipmConfig`'s reference
25
+ * to it as `ae-forgotten-export`; the symbol carries no runtime value and does not appear in the
26
+ * trimmed public rollup.
27
+ *
28
+ * @internal
29
+ */
30
+ declare const aipmConfigBrand: unique symbol;
31
+ /**
32
+ * Validated plugin configuration. Structurally identical to `AipmConfigInput` but carries a
33
+ * module-private brand indicating `defineConfig` validated it at runtime.
34
+ *
35
+ * @public
36
+ */
37
+ export type AipmConfig = AipmConfigInput & {
38
+ readonly [aipmConfigBrand]: 'AipmConfig';
39
+ };
40
+ /**
41
+ * Validate and brand a plugin configuration. Throws a `ZodError` on invalid input.
42
+ *
43
+ * @public
44
+ */
45
+ export declare function defineConfig(config: AipmConfigInput): AipmConfig;
46
+ export {};
47
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGpD;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,mFAAmF;IACnF,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,OAAO,EAAE,SAAS,QAAQ,EAAE,CAAC;CAC9B;AAED;;;;;;;GAOG;AACH,OAAO,CAAC,MAAM,eAAe,EAAE,OAAO,MAAM,CAAC;AAE7C;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,eAAe,GAAG;IACzC,QAAQ,CAAC,CAAC,eAAe,CAAC,EAAE,YAAY,CAAC;CAC1C,CAAC;AAqBF;;;;GAIG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,eAAe,GAAG,UAAU,CAKhE"}
package/dist/config.js ADDED
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Plugin author configuration — `aipm.config.ts`.
3
+ *
4
+ * Per §6.1 of the architecture spec, `defineConfig` takes an `AipmConfigInput` and returns a
5
+ * branded `AipmConfig`. The brand symbol is module-private (never exported); consumers see
6
+ * `AipmConfig` as `AipmConfigInput` plus a structural marker proving `defineConfig` validated
7
+ * the value.
8
+ */
9
+ import { z } from 'zod';
10
+ import { TARGET_IDS } from './pipeline/types.js';
11
+ /**
12
+ * Zod schema used for runtime validation. Uses `.strict()` to reject unknown keys.
13
+ *
14
+ * `version` must parse as semver. `targets` must be a non-empty subset of known target IDs and
15
+ * must not contain duplicates.
16
+ */
17
+ const semverPattern = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-[0-9A-Za-z.-]+)?(?:\+[0-9A-Za-z.-]+)?$/;
18
+ const aipmConfigSchema = z
19
+ .object({
20
+ version: z.string().regex(semverPattern, 'version must be a valid semver string'),
21
+ targets: z
22
+ .array(z.enum(TARGET_IDS))
23
+ .min(1, 'targets must contain at least one target')
24
+ .refine((arr) => new Set(arr).size === arr.length, 'targets must not contain duplicates'),
25
+ })
26
+ .strict();
27
+ /**
28
+ * Validate and brand a plugin configuration. Throws a `ZodError` on invalid input.
29
+ *
30
+ * @public
31
+ */
32
+ export function defineConfig(config) {
33
+ const parsed = aipmConfigSchema.parse(config);
34
+ // Brand injection: the parsed value is structurally AipmConfigInput; the brand is a
35
+ // type-only marker proving validation ran. Cast through `unknown` per TS guidance.
36
+ return parsed;
37
+ }
38
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAmCjD;;;;;GAKG;AACH,MAAM,aAAa,GACjB,qFAAqF,CAAC;AAExF,MAAM,gBAAgB,GAAG,CAAC;KACvB,MAAM,CAAC;IACN,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,aAAa,EAAE,uCAAuC,CAAC;IACjF,OAAO,EAAE,CAAC;SACP,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;SACzB,GAAG,CAAC,CAAC,EAAE,0CAA0C,CAAC;SAClD,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,MAAM,EAAE,qCAAqC,CAAC;CAC5F,CAAC;KACD,MAAM,EAAE,CAAC;AAEZ;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAC,MAAuB;IAClD,MAAM,MAAM,GAAG,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;IAC9C,oFAAoF;IACpF,mFAAmF;IACnF,OAAO,MAA+B,CAAC;AACzC,CAAC"}
package/dist/core.d.ts ADDED
@@ -0,0 +1,291 @@
1
+ /**
2
+ * `@ai-plugin-marketplace/core` — public API.
3
+ *
4
+ * Only the exports listed here are part of the public contract. Per §8.1 of the architecture
5
+ * spec (`docs/specs/architecture.md`), the package's only public subpath is the root — types
6
+ * and functions import from `@ai-plugin-marketplace/core` directly, not from `/types`,
7
+ * `/config`, `/targets`, or any internal subpath.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+
12
+ /**
13
+ * Scaffold skeleton files for a new target in an existing plugin (§6.4).
14
+ *
15
+ * @public
16
+ */
17
+ export declare function addTarget(pluginDir: string, target: TargetId): Promise<void>;
18
+
19
+ /**
20
+ * Validated plugin configuration. Structurally identical to `AipmConfigInput` but carries a
21
+ * module-private brand indicating `defineConfig` validated it at runtime.
22
+ *
23
+ * @public
24
+ */
25
+ export declare type AipmConfig = AipmConfigInput & {
26
+ readonly [aipmConfigBrand]: 'AipmConfig';
27
+ };
28
+
29
+ /**
30
+ * Module-private brand marker. Intentionally never exported (§8.1: "The brand symbol is
31
+ * module-private"). Marked `@internal` so API Extractor does not flag `AipmConfig`'s reference
32
+ * to it as `ae-forgotten-export`; the symbol carries no runtime value and does not appear in the
33
+ * trimmed public rollup.
34
+ *
35
+ * @internal
36
+ */
37
+ declare const aipmConfigBrand: unique symbol;
38
+
39
+ /**
40
+ * Raw input shape accepted by `defineConfig`. Plugin authors type their config literal against
41
+ * `AipmConfigInput` implicitly via `defineConfig`'s parameter.
42
+ *
43
+ * @public
44
+ */
45
+ export declare interface AipmConfigInput {
46
+ /** Semver string identifying the plugin author's release. See §9.5 of the spec. */
47
+ version: string;
48
+ /** Targets this plugin supports. See §6 of the spec. */
49
+ targets: readonly TargetId[];
50
+ }
51
+
52
+ /**
53
+ * Build a single plugin or every plugin under a repo root. `path` may be a plugin directory
54
+ * (contains `aipm.config.ts`) or a repo root (contains `plugins/`); the orchestrator detects
55
+ * which and returns a length-1 array for single-plugin input. See §5.2, §8.1.
56
+ *
57
+ * @public
58
+ */
59
+ export declare function build(targetPath: string, opts?: BuildOptions): Promise<BuildResult[]>;
60
+
61
+ /**
62
+ * Options for {@link build}.
63
+ *
64
+ * @public
65
+ */
66
+ export declare interface BuildOptions {
67
+ /** Abort after the first hard validation finding. Default: false. */
68
+ failFast?: boolean;
69
+ }
70
+
71
+ /**
72
+ * Result of building a single plugin. One entry per plugin built.
73
+ *
74
+ * @public
75
+ */
76
+ export declare interface BuildResult {
77
+ /** Plugin directory name, e.g. 'skill-evaluator'. */
78
+ plugin: string;
79
+ /** Absolute path to the plugin directory. */
80
+ pluginDir: string;
81
+ /** Every file the build produced or verified as up-to-date. */
82
+ artifacts: GeneratedFile[];
83
+ /** Wall-clock time in milliseconds. */
84
+ durationMs: number;
85
+ }
86
+
87
+ /**
88
+ * Diagnose a plugin's support envelope: declared targets, missing artifacts, addable targets (§6.4).
89
+ *
90
+ * @public
91
+ */
92
+ export declare function checkSupport(pluginDir: string): Promise<SupportReport>;
93
+
94
+ /**
95
+ * Validate and brand a plugin configuration. Throws a `ZodError` on invalid input.
96
+ *
97
+ * @public
98
+ */
99
+ export declare function defineConfig(config: AipmConfigInput): AipmConfig;
100
+
101
+ /**
102
+ * A single validation finding.
103
+ *
104
+ * @public
105
+ */
106
+ export declare interface Finding {
107
+ severity: 'hard' | 'soft';
108
+ code: FindingCode;
109
+ /** Plugin name, if the finding is scoped to a specific plugin. */
110
+ plugin?: string;
111
+ /** Human-readable message. */
112
+ message: string;
113
+ /** Optional remediation hint. */
114
+ hint?: string;
115
+ }
116
+
117
+ /**
118
+ * Enumerated finding codes. Additive — new codes arrive in toolkit MINOR releases; removing
119
+ * or renaming a code is MAJOR. Consumers SHOULD handle unknown codes gracefully.
120
+ *
121
+ * @public
122
+ */
123
+ export declare type FindingCode = 'envelope-invalid' | 'envelope-adherence' | 'schema-invalid' | 'name-consistency' | 'mcp-key-sync' | 'marketplace-registration' | 'freshness';
124
+
125
+ /**
126
+ * A file produced or verified by the build.
127
+ *
128
+ * @public
129
+ */
130
+ export declare interface GeneratedFile {
131
+ /** Absolute path. */
132
+ path: string;
133
+ /** The author-authored file this was generated from, if applicable. */
134
+ source?: string;
135
+ /** Which target's build step produced this file. */
136
+ target: TargetId;
137
+ }
138
+
139
+ /**
140
+ * Scaffold a thin consumer repo (the "template") at `targetDir` that depends on
141
+ * `@ai-plugin-marketplace/cli` and holds plugin sources only (§3.2, §11). The generated
142
+ * `package.json` pins the cli dev dependency to a caret of the current toolkit version (§9.1
143
+ * lockstep). Refuses to write into a non-empty directory.
144
+ *
145
+ * @public
146
+ */
147
+ export declare function init(targetDir: string, opts?: InitOptions): Promise<void>;
148
+
149
+ /**
150
+ * Options for {@link init}.
151
+ *
152
+ * @public
153
+ */
154
+ export declare interface InitOptions {
155
+ /**
156
+ * Repo name written into the generated `package.json`. Defaults to the basename of the target
157
+ * directory.
158
+ */
159
+ name?: string;
160
+ }
161
+
162
+ /**
163
+ * List the target IDs this toolkit version knows about (§6.4).
164
+ *
165
+ * @public
166
+ */
167
+ export declare function listTargets(): readonly TargetId[];
168
+
169
+ /**
170
+ * No-op in v0.1.0 per §8.1 of the spec. Always returns `status: 'no-migrations-needed'` because
171
+ * §9.4 constrains every `schemaVersion` to a single value. When real migrations ship, this
172
+ * must distinguish up-to-date from unknown-future-version.
173
+ *
174
+ * @public
175
+ */
176
+ export declare function migrate(_path: string, _opts?: MigrateOptions): Promise<MigrateResult>;
177
+
178
+ /**
179
+ * Options for {@link migrate}.
180
+ *
181
+ * @public
182
+ */
183
+ export declare interface MigrateOptions {
184
+ /** When true, print planned changes without writing. Default: false. */
185
+ dryRun?: boolean;
186
+ }
187
+
188
+ /**
189
+ * Result of running {@link migrate}.
190
+ *
191
+ * @public
192
+ */
193
+ export declare interface MigrateResult {
194
+ /**
195
+ * Discriminant so consumers distinguish "ran and did nothing" from "ran and applied zero
196
+ * of N" from "ran and failed." Retrofitting this later would be breaking.
197
+ */
198
+ status: 'no-migrations-needed' | 'applied' | 'failed';
199
+ /** 0 in v0.1.0. */
200
+ migrationsApplied: number;
201
+ /** Absolute paths of files modified. */
202
+ filesChanged: string[];
203
+ }
204
+
205
+ /**
206
+ * Scaffold a new plugin under `<cwd>/plugins/<name>`. The plugins directory is derived from the
207
+ * current working directory, matching how `aipm scaffold` is invoked from a template repo root.
208
+ *
209
+ * @public
210
+ */
211
+ export declare function scaffold(name: string, opts?: ScaffoldOptions): Promise<void>;
212
+
213
+ /**
214
+ * Options for {@link scaffold}.
215
+ *
216
+ * @public
217
+ */
218
+ export declare interface ScaffoldOptions {
219
+ /** Targets to scaffold for. Defaults to all known targets. */
220
+ targets?: readonly TargetId[];
221
+ /** Description field for the generated plugin. */
222
+ description?: string;
223
+ }
224
+
225
+ /**
226
+ * Diagnostic report from {@link checkSupport} describing a plugin's support envelope.
227
+ *
228
+ * @public
229
+ */
230
+ export declare interface SupportReport {
231
+ plugin: string;
232
+ /** Targets the plugin declares support for. */
233
+ declared: TargetId[];
234
+ /** Declared targets that are missing required artifacts. */
235
+ missingArtifacts: {
236
+ target: TargetId;
237
+ missing: string[];
238
+ }[];
239
+ /** Targets not declared but plausibly addable, with the files the author would need. */
240
+ suggestions: {
241
+ target: TargetId;
242
+ wouldNeed: string[];
243
+ }[];
244
+ }
245
+
246
+ /**
247
+ * Public types for the core API. These are the contract surface per §8.1 of the spec.
248
+ */
249
+ /**
250
+ * A host-platform identity. The closed union of target IDs this toolkit version knows about.
251
+ *
252
+ * Declared as an explicit literal union (matching the public contract in spec §8.1) rather than
253
+ * derived from `TARGET_IDS`. This keeps the public type self-contained: a
254
+ * `typeof TARGET_IDS` derivation would make the published `TargetId` depend on the non-exported
255
+ * `TARGET_IDS` const, which API Extractor reports as `ae-forgotten-export`. The runtime array
256
+ * below is validated against this union with `satisfies`, so the two cannot drift.
257
+ *
258
+ * @public
259
+ */
260
+ export declare type TargetId = 'claude' | 'cursor' | 'gemini' | 'kiro' | 'vercel';
261
+
262
+ /**
263
+ * Validate a single plugin or every plugin under a repo root, in the order defined by §10.1.
264
+ * Freshness severity follows the CI environment (§10.2).
265
+ *
266
+ * @public
267
+ */
268
+ export declare function validate(targetPath: string, opts?: ValidateOptions): Promise<ValidationResult>;
269
+
270
+ /**
271
+ * Options for {@link validate}.
272
+ *
273
+ * @public
274
+ */
275
+ export declare interface ValidateOptions {
276
+ /** When true, skip the freshness check (§10.5). Default: false. */
277
+ skipFreshness?: boolean;
278
+ }
279
+
280
+ /**
281
+ * Result of validating one or more plugins.
282
+ *
283
+ * @public
284
+ */
285
+ export declare interface ValidationResult {
286
+ findings: Finding[];
287
+ /** True iff no hard findings were emitted. Soft findings do not flip this. */
288
+ passed: boolean;
289
+ }
290
+
291
+ export { }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * `@ai-plugin-marketplace/core` — public API.
3
+ *
4
+ * Only the exports listed here are part of the public contract. Per §8.1 of the architecture
5
+ * spec (`docs/specs/architecture.md`), the package's only public subpath is the root — types
6
+ * and functions import from `@ai-plugin-marketplace/core` directly, not from `/types`,
7
+ * `/config`, `/targets`, or any internal subpath.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ export { defineConfig } from './config.js';
12
+ export type { AipmConfig, AipmConfigInput } 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';
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,YAAY,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE/D,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"}
package/dist/index.js ADDED
@@ -0,0 +1,13 @@
1
+ /**
2
+ * `@ai-plugin-marketplace/core` — public API.
3
+ *
4
+ * Only the exports listed here are part of the public contract. Per §8.1 of the architecture
5
+ * spec (`docs/specs/architecture.md`), the package's only public subpath is the root — types
6
+ * and functions import from `@ai-plugin-marketplace/core` directly, not from `/types`,
7
+ * `/config`, `/targets`, or any internal subpath.
8
+ *
9
+ * @packageDocumentation
10
+ */
11
+ export { defineConfig } from './config.js';
12
+ export { build, validate, scaffold, init, migrate, checkSupport, addTarget, listTargets, } from './pipeline/operations.js';
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAG3C,OAAO,EACL,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,OAAO,EACP,YAAY,EACZ,SAAS,EACT,WAAW,GACZ,MAAM,0BAA0B,CAAC"}
@@ -0,0 +1,90 @@
1
+ /**
2
+ * Build orchestrator (§5.2).
3
+ *
4
+ * `runBuild` loads each plugin's envelope, dispatches to the per-target build steps, writes the
5
+ * generated artifacts, and (per §5.4) runs validation before returning. The pipeline holds no
6
+ * target-specific transformation logic — it dispatches to the per-target internal modules under
7
+ * `targets/<id>/` (§7.2). Cross-target imports between `targets/<X>` and `targets/<Y>` are
8
+ * forbidden, but the pipeline is permitted to orchestrate all of them.
9
+ *
10
+ * **Sentinel scope (§4.3).** Only the in-plugin-dir generated hook JSONs (`hooks/claude.json`,
11
+ * `hooks/hooks.json`) carry a `_generated` JSON sentinel. The `dist/**` bundle trees are
12
+ * wholly-generated and stay sentinel-less so they remain byte-identical to the committed
13
+ * template oracle; freshness for those is a whole-tree regeneration compare (§10.5).
14
+ *
15
+ * @see docs/specs/architecture.md §5.2 (build phase), §5.4 (phase invariants), §7.2, §10.5
16
+ */
17
+ import type { SentinelMode } from './sentinel.js';
18
+ import type { BuildOptions, BuildResult, TargetId } from './types.js';
19
+ /**
20
+ * A toolkit-generated file that lives **inside the plugin directory** and carries a sentinel.
21
+ * Both the build (which writes `expectedContent`) and the freshness check (which compares the
22
+ * on-disk bytes against `expectedContent`) derive these from one place so they cannot diverge.
23
+ */
24
+ export interface PluginHookArtifact {
25
+ /** Absolute path of the generated file. */
26
+ absPath: string;
27
+ /** Author-authored source path, relative to the plugin dir (recorded in the sentinel). */
28
+ source: string;
29
+ /** Sentinel carrier used for this artifact. */
30
+ sentinelMode: SentinelMode;
31
+ /** Which target's build step produced this file. */
32
+ target: TargetId;
33
+ /** Exact bytes the build writes (sentinel included). */
34
+ expectedContent: string;
35
+ }
36
+ /**
37
+ * Compute every in-plugin-dir generated hook JSON for a plugin given its envelope, **without
38
+ * writing**. This is the single source of truth shared by `runBuild` and the freshness check.
39
+ *
40
+ * - `claude` in envelope + a hooks YAML present → `hooks/claude.json` (Claude JSON + sentinel).
41
+ * - `gemini` in envelope + a hooks YAML present → `hooks/hooks.json` (Gemini JSON + sentinel).
42
+ *
43
+ * The sentinel is applied to the **parsed object** so the on-disk file carries a top-level
44
+ * `_generated` field (§4.3), serialized 2-space + trailing newline.
45
+ *
46
+ * @throws {Error} If the hooks YAML is malformed or fails the Claude hooks schema.
47
+ */
48
+ export declare function computePluginHookArtifacts(pluginDir: string, envelope: readonly TargetId[]): PluginHookArtifact[];
49
+ /**
50
+ * The set of `dist/**` bundle trees a plugin's envelope produces. Each entry names the absolute
51
+ * destination directory and a `regenerate` closure that rebuilds the tree into an arbitrary
52
+ * directory — used both to emit the real bundle (build) and to regenerate into a temp dir for
53
+ * the byte-parity freshness compare (§10.5). Bundles are sentinel-less by design.
54
+ */
55
+ export interface DistBundle {
56
+ target: TargetId;
57
+ /** Absolute destination directory under `dist/`. */
58
+ destDir: string;
59
+ /** Rebuild the bundle into `into` (clears `into` first, per the bundlers' contract). */
60
+ regenerate: (into: string) => void;
61
+ }
62
+ /**
63
+ * Compute the `dist/**` bundles a plugin's envelope produces, **without writing**. Shared by
64
+ * build (calls `regenerate(destDir)`) and freshness (calls `regenerate(tempDir)` then compares).
65
+ */
66
+ export declare function computeDistBundles(pluginDir: string, distDir: string, envelope: readonly TargetId[]): DistBundle[];
67
+ /** Collect every file path under `dir`, relative to `dir`. Returns `[]` if `dir` is absent. */
68
+ export declare function collectFilesRelative(dir: string): string[];
69
+ /**
70
+ * Build one plugin or every plugin under a repo root (§8.1). `targetPath` is detected as a single
71
+ * plugin directory (contains `aipm.config.ts`) or a repo root (contains a `plugins/` directory).
72
+ *
73
+ * After emitting artifacts, runs `runValidate(targetPath, { skipFreshness: true })` per §5.4. When
74
+ * `opts.failFast` is set and validation reports hard findings, throws an Error summarizing them;
75
+ * otherwise the build results are returned and the caller (CLI) decides the exit code.
76
+ *
77
+ * @param targetPath - Absolute path to a plugin directory or repo root.
78
+ * @param opts - Build options.
79
+ * @returns One `BuildResult` per built plugin (length-1 for single-plugin input).
80
+ * @throws {Error} If `targetPath` is neither a plugin nor a repo root, a config fails to load,
81
+ * a transform fails, or (when `failFast`) post-build validation reports hard findings.
82
+ */
83
+ export declare function runBuild(targetPath: string, opts?: BuildOptions): Promise<BuildResult[]>;
84
+ /**
85
+ * Regenerate a dist bundle into a fresh temp directory and return that directory. The caller is
86
+ * responsible for removing it. Used by the freshness check (§10.5) to byte-compare against the
87
+ * on-disk bundle without disturbing it.
88
+ */
89
+ export declare function regenerateBundleToTemp(bundle: DistBundle): string;
90
+ //# sourceMappingURL=build.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"build.d.ts","sourceRoot":"","sources":["../../src/pipeline/build.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAeH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAElD,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAiB,QAAQ,EAAE,MAAM,YAAY,CAAC;AAMrF;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,2CAA2C;IAC3C,OAAO,EAAE,MAAM,CAAC;IAChB,0FAA0F;IAC1F,MAAM,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,YAAY,EAAE,YAAY,CAAC;IAC3B,oDAAoD;IACpD,MAAM,EAAE,QAAQ,CAAC;IACjB,wDAAwD;IACxD,eAAe,EAAE,MAAM,CAAC;CACzB;AAaD;;;;;;;;;;;GAWG;AACH,wBAAgB,0BAA0B,CACxC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,SAAS,QAAQ,EAAE,GAC5B,kBAAkB,EAAE,CAoCtB;AAED;;;;;GAKG;AACH,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,QAAQ,CAAC;IACjB,oDAAoD;IACpD,OAAO,EAAE,MAAM,CAAC;IAChB,wFAAwF;IACxF,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CACpC;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAChC,SAAS,EAAE,MAAM,EACjB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,SAAS,QAAQ,EAAE,GAC5B,UAAU,EAAE,CA0Bd;AAMD,+FAA+F;AAC/F,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,CAa1D;AA6DD;;;;;;;;;;;;;GAaG;AACH,wBAAsB,QAAQ,CAAC,UAAU,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,EAAE,CAAC,CAsB9F;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,UAAU,GAAG,MAAM,CAIjE"}