@xemahq/create-biome 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.md +58 -0
- package/dist/bin/create-biome.d.ts +3 -0
- package/dist/bin/create-biome.d.ts.map +1 -0
- package/dist/bin/create-biome.js +169 -0
- package/dist/bin/create-biome.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +6 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/manifest-builder.d.ts +29 -0
- package/dist/lib/manifest-builder.d.ts.map +1 -0
- package/dist/lib/manifest-builder.js +29 -0
- package/dist/lib/manifest-builder.js.map +1 -0
- package/dist/lib/package-builder.d.ts +17 -0
- package/dist/lib/package-builder.d.ts.map +1 -0
- package/dist/lib/package-builder.js +25 -0
- package/dist/lib/package-builder.js.map +1 -0
- package/dist/lib/scaffolder.d.ts +19 -0
- package/dist/lib/scaffolder.d.ts.map +1 -0
- package/dist/lib/scaffolder.js +56 -0
- package/dist/lib/scaffolder.js.map +1 -0
- package/dist/lib/template-files.d.ts +8 -0
- package/dist/lib/template-files.d.ts.map +1 -0
- package/dist/lib/template-files.js +263 -0
- package/dist/lib/template-files.js.map +1 -0
- package/dist/lib/template.d.ts +14 -0
- package/dist/lib/template.d.ts.map +1 -0
- package/dist/lib/template.js +26 -0
- package/dist/lib/template.js.map +1 -0
- package/package.json +43 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for describing the origin of the Work and
|
|
141
|
+
reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Support. While redistributing the Work or
|
|
166
|
+
Derivative Works thereof, You may choose to offer, and charge a
|
|
167
|
+
fee for, acceptance of support, warranty, indemnity, or other
|
|
168
|
+
liability obligations and/or rights consistent with this License.
|
|
169
|
+
However, in accepting such obligations, You may act only on Your
|
|
170
|
+
own behalf and on Your sole responsibility, not on behalf of any
|
|
171
|
+
other Contributor, and only if You agree to indemnify, defend, and
|
|
172
|
+
hold each Contributor harmless for any liability incurred by, or
|
|
173
|
+
claims asserted against, such Contributor by reason of your
|
|
174
|
+
accepting any such warranty or support.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Xema
|
|
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,58 @@
|
|
|
1
|
+
<p align="center">
|
|
2
|
+
<svg width="680" height="120" viewBox="0 0 680 120" fill="none" xmlns="http://www.w3.org/2000/svg" role="img" aria-label="@xemahq/create-biome">
|
|
3
|
+
<rect width="680" height="120" rx="14" fill="#0B1020"/>
|
|
4
|
+
<g transform="translate(28,34)">
|
|
5
|
+
<path d="M26 0 L52 15 L52 45 L26 60 L0 45 L0 15 Z" fill="#F59E0B" opacity="0.18"/>
|
|
6
|
+
<path d="M26 12 L41 21 L41 39 L26 48 L11 39 L11 21 Z" fill="#F59E0B"/>
|
|
7
|
+
</g>
|
|
8
|
+
<text x="92" y="52" font-family="ui-monospace,SFMono-Regular,Menlo,monospace" font-size="22" fill="#F8FAFC" font-weight="700">@xemahq/create-biome</text>
|
|
9
|
+
<text x="92" y="80" font-family="ui-sans-serif,system-ui,sans-serif" font-size="15" fill="#94A3B8">Scaffolder for new Xema biome packages</text>
|
|
10
|
+
<text x="652" y="105" text-anchor="end" font-family="ui-sans-serif,system-ui,sans-serif" font-size="12" fill="#475569">xema.dev</text>
|
|
11
|
+
</svg>
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p align="center">
|
|
15
|
+
<a href="https://xema.dev">Website</a> ·
|
|
16
|
+
<a href="https://www.npmjs.com/package/@xemahq/create-biome">npm</a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<p align="center">
|
|
20
|
+
<img alt="npm" src="https://img.shields.io/npm/v/%40xemahq%2Fcreate-biome?color=2563eb&label=npm">
|
|
21
|
+
<img alt="license" src="https://img.shields.io/npm/l/%40xemahq%2Fcreate-biome?color=10b981">
|
|
22
|
+
<img alt="types" src="https://img.shields.io/npm/types/%40xemahq%2Fcreate-biome?color=3178c6">
|
|
23
|
+
</p>
|
|
24
|
+
|
|
25
|
+
# @xemahq/create-biome
|
|
26
|
+
|
|
27
|
+
> Scaffolder for new Xema biome packages
|
|
28
|
+
|
|
29
|
+
## Overview
|
|
30
|
+
|
|
31
|
+
Generates a working biome folder from a single command, complete with a
|
|
32
|
+
manifest, an ESM TypeScript layout, and sample tests. It ships three starter
|
|
33
|
+
templates — integration-provider, workflows-only, and storage-only — so a new
|
|
34
|
+
biome begins from a structure that already builds and tests cleanly.
|
|
35
|
+
|
|
36
|
+
## When to use it
|
|
37
|
+
|
|
38
|
+
- Use it to bootstrap a brand-new biome package from a starter template.
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# No install needed — run it directly:
|
|
44
|
+
pnpm dlx @xemahq/create-biome <biomeId>
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
## Usage
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
# Scaffold a biome, choosing a starter template:
|
|
51
|
+
pnpm dlx @xemahq/create-biome my-biome --template integration-provider
|
|
52
|
+
pnpm dlx @xemahq/create-biome my-biome --template workflows-only
|
|
53
|
+
pnpm dlx @xemahq/create-biome my-biome --template storage-only
|
|
54
|
+
```
|
|
55
|
+
|
|
56
|
+
## License
|
|
57
|
+
|
|
58
|
+
Apache-2.0 © Xema — [xema.dev](https://xema.dev)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-biome.d.ts","sourceRoot":"","sources":["../../src/bin/create-biome.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import * as path from 'node:path';
|
|
3
|
+
import { stdin, stdout } from 'node:process';
|
|
4
|
+
import { createInterface } from 'node:readline/promises';
|
|
5
|
+
import { existsSync } from 'node:fs';
|
|
6
|
+
import { validateBiomeId } from '../lib/manifest-builder.js';
|
|
7
|
+
import { ScaffolderError, scaffoldBiome } from '../lib/scaffolder.js';
|
|
8
|
+
import { BiomeTemplateId, listTemplates } from '../lib/template.js';
|
|
9
|
+
function parseArgs(argv) {
|
|
10
|
+
let biomeId;
|
|
11
|
+
let template;
|
|
12
|
+
let displayName;
|
|
13
|
+
let description;
|
|
14
|
+
let target;
|
|
15
|
+
let yes = false;
|
|
16
|
+
let help = false;
|
|
17
|
+
for (let i = 0; i < argv.length; i++) {
|
|
18
|
+
const token = argv[i];
|
|
19
|
+
if (token === undefined) {
|
|
20
|
+
continue;
|
|
21
|
+
}
|
|
22
|
+
switch (token) {
|
|
23
|
+
case '--help':
|
|
24
|
+
case '-h':
|
|
25
|
+
help = true;
|
|
26
|
+
break;
|
|
27
|
+
case '--yes':
|
|
28
|
+
case '-y':
|
|
29
|
+
yes = true;
|
|
30
|
+
break;
|
|
31
|
+
case '--template':
|
|
32
|
+
template = argv[++i];
|
|
33
|
+
break;
|
|
34
|
+
case '--display':
|
|
35
|
+
displayName = argv[++i];
|
|
36
|
+
break;
|
|
37
|
+
case '--desc':
|
|
38
|
+
description = argv[++i];
|
|
39
|
+
break;
|
|
40
|
+
case '--target':
|
|
41
|
+
target = argv[++i];
|
|
42
|
+
break;
|
|
43
|
+
default:
|
|
44
|
+
if (token.startsWith('--')) {
|
|
45
|
+
throw new ScaffolderError(`unknown flag: ${token} (use --help)`);
|
|
46
|
+
}
|
|
47
|
+
if (!biomeId) {
|
|
48
|
+
biomeId = token;
|
|
49
|
+
}
|
|
50
|
+
else {
|
|
51
|
+
throw new ScaffolderError(`unexpected positional argument: ${token}`);
|
|
52
|
+
}
|
|
53
|
+
break;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
return { biomeId, template, displayName, description, target, yes, help };
|
|
57
|
+
}
|
|
58
|
+
function printUsage() {
|
|
59
|
+
stdout.write(`Usage: pnpm dlx @xemahq/create-biome <biomeId> [options]
|
|
60
|
+
|
|
61
|
+
Options:
|
|
62
|
+
--template <id> One of: ${listTemplates().map((t) => t.id).join(' | ')}
|
|
63
|
+
--display "<name>" Human-readable display name (default: biomeId)
|
|
64
|
+
--desc "<text>" One-line manifest description
|
|
65
|
+
--target <path> Where to create the biome (default: ./<biomeId>)
|
|
66
|
+
--yes Skip the final confirmation prompt
|
|
67
|
+
--help Print this help
|
|
68
|
+
|
|
69
|
+
Examples:
|
|
70
|
+
pnpm dlx @xemahq/create-biome acme-tickets --template integration-provider
|
|
71
|
+
pnpm dlx @xemahq/create-biome acme-cache --template storage-only --yes
|
|
72
|
+
`);
|
|
73
|
+
}
|
|
74
|
+
async function main() {
|
|
75
|
+
const args = parseArgs(process.argv.slice(2));
|
|
76
|
+
if (args.help) {
|
|
77
|
+
printUsage();
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
const rl = createInterface({ input: stdin, output: stdout });
|
|
81
|
+
try {
|
|
82
|
+
const biomeId = args.biomeId ?? (await prompt(rl, 'Biome id (kebab-case): '));
|
|
83
|
+
if (!biomeId) {
|
|
84
|
+
throw new ScaffolderError('biome id is required');
|
|
85
|
+
}
|
|
86
|
+
const idCheck = validateBiomeId(biomeId);
|
|
87
|
+
if (!idCheck.ok) {
|
|
88
|
+
throw new ScaffolderError(idCheck.reason);
|
|
89
|
+
}
|
|
90
|
+
const templateId = args.template ?? (await promptTemplate(rl));
|
|
91
|
+
if (!isKnownTemplate(templateId)) {
|
|
92
|
+
throw new ScaffolderError(`unknown template "${templateId}". Choose one of: ${listTemplates().map((t) => t.id).join(', ')}`);
|
|
93
|
+
}
|
|
94
|
+
const targetDir = path.resolve(args.target ?? `./${biomeId}`);
|
|
95
|
+
if (existsSync(targetDir)) {
|
|
96
|
+
throw new ScaffolderError(`target directory already exists: ${targetDir} — choose a fresh path or delete it first`);
|
|
97
|
+
}
|
|
98
|
+
const displayName = args.displayName ??
|
|
99
|
+
(await prompt(rl, `Display name [${humanize(biomeId)}]: `, humanize(biomeId)));
|
|
100
|
+
const description = args.description ??
|
|
101
|
+
(await prompt(rl, 'One-line description: ', `${humanize(biomeId)} biome scaffolded by @xemahq/create-biome`));
|
|
102
|
+
if (!args.yes) {
|
|
103
|
+
const confirm = await prompt(rl, `Create biome "${biomeId}" (${templateId}) at ${targetDir}? [Y/n] `, 'y');
|
|
104
|
+
if (!isYes(confirm)) {
|
|
105
|
+
stdout.write('Aborted — no files written.\n');
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
const result = await scaffoldBiome({
|
|
110
|
+
biomeId,
|
|
111
|
+
displayName,
|
|
112
|
+
description,
|
|
113
|
+
template: templateId,
|
|
114
|
+
targetDir,
|
|
115
|
+
});
|
|
116
|
+
printSuccessSummary(result.targetDir, result.filesWritten.length);
|
|
117
|
+
}
|
|
118
|
+
finally {
|
|
119
|
+
rl.close();
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
function printSuccessSummary(targetDir, fileCount) {
|
|
123
|
+
stdout.write(`\n✔ Created ${fileCount} files in ${targetDir}\n`);
|
|
124
|
+
stdout.write(`\nNext steps:\n`);
|
|
125
|
+
stdout.write(` cd ${path.relative(process.cwd(), targetDir) || '.'}\n`);
|
|
126
|
+
stdout.write(` pnpm install\n`);
|
|
127
|
+
stdout.write(` pnpm build\n`);
|
|
128
|
+
stdout.write(` pnpm test\n\n`);
|
|
129
|
+
stdout.write(`Edit xema-biome.json to declare integration requirements, capabilities, and contributions.\n`);
|
|
130
|
+
}
|
|
131
|
+
async function promptTemplate(rl) {
|
|
132
|
+
stdout.write('\nAvailable templates:\n');
|
|
133
|
+
for (const t of listTemplates()) {
|
|
134
|
+
stdout.write(` • ${t.id} — ${t.displayName}\n ${t.summary}\n`);
|
|
135
|
+
}
|
|
136
|
+
const answer = await prompt(rl, `\nTemplate [${BiomeTemplateId.Connector}]: `, BiomeTemplateId.Connector);
|
|
137
|
+
return answer;
|
|
138
|
+
}
|
|
139
|
+
async function prompt(rl, question, fallback) {
|
|
140
|
+
const raw = await rl.question(question);
|
|
141
|
+
const trimmed = raw.trim();
|
|
142
|
+
if (trimmed.length === 0 && fallback !== undefined) {
|
|
143
|
+
return fallback;
|
|
144
|
+
}
|
|
145
|
+
return trimmed;
|
|
146
|
+
}
|
|
147
|
+
function isKnownTemplate(value) {
|
|
148
|
+
return Object.values(BiomeTemplateId).includes(value);
|
|
149
|
+
}
|
|
150
|
+
function isYes(value) {
|
|
151
|
+
const v = value.trim().toLowerCase();
|
|
152
|
+
return v === '' || v === 'y' || v === 'yes';
|
|
153
|
+
}
|
|
154
|
+
function humanize(biomeId) {
|
|
155
|
+
return biomeId
|
|
156
|
+
.split('-')
|
|
157
|
+
.filter((segment) => segment.length > 0)
|
|
158
|
+
.map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1))
|
|
159
|
+
.join(' ');
|
|
160
|
+
}
|
|
161
|
+
main().catch((error) => {
|
|
162
|
+
if (error instanceof ScaffolderError) {
|
|
163
|
+
process.stderr.write(`create-biome: ${error.message}\n`);
|
|
164
|
+
process.exit(1);
|
|
165
|
+
}
|
|
166
|
+
process.stderr.write(`create-biome: unexpected error\n${error instanceof Error ? error.stack ?? error.message : String(error)}\n`);
|
|
167
|
+
process.exit(1);
|
|
168
|
+
});
|
|
169
|
+
//# sourceMappingURL=create-biome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create-biome.js","sourceRoot":"","sources":["../../src/bin/create-biome.ts"],"names":[],"mappings":";AACA,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAErC,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAC7D,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACtE,OAAO,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AA8BpE,SAAS,SAAS,CAAC,IAAuB;IACxC,IAAI,OAA2B,CAAC;IAChC,IAAI,QAA4B,CAAC;IACjC,IAAI,WAA+B,CAAC;IACpC,IAAI,WAA+B,CAAC;IACpC,IAAI,MAA0B,C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IACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,0BAA0B,CAAC;AACzC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { BiomeTemplateMetadata } from './template.js';
|
|
2
|
+
export interface ManifestBuilderInput {
|
|
3
|
+
readonly biomeId: string;
|
|
4
|
+
readonly displayName: string;
|
|
5
|
+
readonly description: string;
|
|
6
|
+
readonly template: BiomeTemplateMetadata;
|
|
7
|
+
}
|
|
8
|
+
export interface ManifestObject {
|
|
9
|
+
readonly schemaVersion: 1;
|
|
10
|
+
readonly id: string;
|
|
11
|
+
readonly name: string;
|
|
12
|
+
readonly version: string;
|
|
13
|
+
readonly trustTier: 'third-party';
|
|
14
|
+
readonly engines: {
|
|
15
|
+
readonly xema: string;
|
|
16
|
+
};
|
|
17
|
+
readonly requiresCapabilities: readonly never[];
|
|
18
|
+
readonly exposesCapabilities: readonly never[];
|
|
19
|
+
readonly contributes: readonly never[];
|
|
20
|
+
}
|
|
21
|
+
export declare function buildManifest(input: ManifestBuilderInput): ManifestObject;
|
|
22
|
+
export declare function npmPackageName(biomeId: string): string;
|
|
23
|
+
export declare function validateBiomeId(biomeId: string): {
|
|
24
|
+
ok: true;
|
|
25
|
+
} | {
|
|
26
|
+
ok: false;
|
|
27
|
+
reason: string;
|
|
28
|
+
};
|
|
29
|
+
//# sourceMappingURL=manifest-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-builder.d.ts","sourceRoot":"","sources":["../../src/lib/manifest-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAgB3D,MAAM,WAAW,oBAAoB;IACnC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;CAC1C;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,aAAa,EAAE,CAAC,CAAC;IAC1B,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,aAAa,CAAC;IAClC,QAAQ,CAAC,OAAO,EAAE;QAChB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,QAAQ,CAAC,oBAAoB,EAAE,SAAS,KAAK,EAAE,CAAC;IAChD,QAAQ,CAAC,mBAAmB,EAAE,SAAS,KAAK,EAAE,CAAC;IAC/C,QAAQ,CAAC,WAAW,EAAE,SAAS,KAAK,EAAE,CAAC;CACxC;AAED,wBAAgB,aAAa,CAAC,KAAK,EAAE,oBAAoB,GAAG,cAAc,CAczE;AAQD,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAEtD;AASD,wBAAgB,eAAe,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,EAAE,EAAE,IAAI,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAQ7F"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function buildManifest(input) {
|
|
2
|
+
return {
|
|
3
|
+
schemaVersion: 1,
|
|
4
|
+
id: input.biomeId,
|
|
5
|
+
name: input.displayName,
|
|
6
|
+
version: '0.1.0',
|
|
7
|
+
trustTier: 'third-party',
|
|
8
|
+
engines: {
|
|
9
|
+
xema: '>=1.0.0',
|
|
10
|
+
},
|
|
11
|
+
requiresCapabilities: [],
|
|
12
|
+
exposesCapabilities: [],
|
|
13
|
+
contributes: [],
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
export function npmPackageName(biomeId) {
|
|
17
|
+
return `@xemahq-biomes/${biomeId}`;
|
|
18
|
+
}
|
|
19
|
+
const BIOME_ID_PATTERN = /^[a-z][a-z0-9-]{1,61}[a-z0-9]$/;
|
|
20
|
+
export function validateBiomeId(biomeId) {
|
|
21
|
+
if (!BIOME_ID_PATTERN.test(biomeId)) {
|
|
22
|
+
return {
|
|
23
|
+
ok: false,
|
|
24
|
+
reason: `biome id "${biomeId}" must be kebab-case (lowercase letters/digits + dashes), 3-63 chars, starting with a letter`,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
return { ok: true };
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=manifest-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"manifest-builder.js","sourceRoot":"","sources":["../../src/lib/manifest-builder.ts"],"names":[],"mappings":"AAqCA,MAAM,UAAU,aAAa,CAAC,KAA2B;IACvD,OAAO;QACL,aAAa,EAAE,CAAC;QAChB,EAAE,EAAE,KAAK,CAAC,OAAO;QACjB,IAAI,EAAE,KAAK,CAAC,WAAW;QACvB,OAAO,EAAE,OAAO;QAChB,SAAS,EAAE,aAAa;QACxB,OAAO,EAAE;YACP,IAAI,EAAE,SAAS;SAChB;QACD,oBAAoB,EAAE,EAAE;QACxB,mBAAmB,EAAE,EAAE;QACvB,WAAW,EAAE,EAAE;KAChB,CAAC;AACJ,CAAC;AAQD,MAAM,UAAU,cAAc,CAAC,OAAe;IAC5C,OAAO,kBAAkB,OAAO,EAAE,CAAC;AACrC,CAAC;AAOD,MAAM,gBAAgB,GAAG,gCAAgC,CAAC;AAE1D,MAAM,UAAU,eAAe,CAAC,OAAe;IAC7C,IAAI,CAAC,gBAAgB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QACpC,OAAO;YACL,EAAE,EAAE,KAAK;YACT,MAAM,EAAE,aAAa,OAAO,8FAA8F;SAC3H,CAAC;IACJ,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { BiomeTemplateMetadata } from './template.js';
|
|
2
|
+
export interface BiomePackageJsonInput {
|
|
3
|
+
readonly biomePackageName: string;
|
|
4
|
+
readonly template: BiomeTemplateMetadata;
|
|
5
|
+
}
|
|
6
|
+
export interface BiomePackageJson {
|
|
7
|
+
readonly name: string;
|
|
8
|
+
readonly version: string;
|
|
9
|
+
readonly private: boolean;
|
|
10
|
+
readonly type: 'module';
|
|
11
|
+
readonly main: string;
|
|
12
|
+
readonly scripts: Readonly<Record<string, string>>;
|
|
13
|
+
readonly dependencies: Readonly<Record<string, string>>;
|
|
14
|
+
readonly devDependencies: Readonly<Record<string, string>>;
|
|
15
|
+
}
|
|
16
|
+
export declare function buildPackageJson(input: BiomePackageJsonInput): BiomePackageJson;
|
|
17
|
+
//# sourceMappingURL=package-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-builder.d.ts","sourceRoot":"","sources":["../../src/lib/package-builder.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAS3D,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,gBAAgB,EAAE,MAAM,CAAC;IAClC,QAAQ,CAAC,QAAQ,EAAE,qBAAqB,CAAC;CAC1C;AAED,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,IAAI,EAAE,QAAQ,CAAC;IACxB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACnD,QAAQ,CAAC,YAAY,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IACxD,QAAQ,CAAC,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;CAC5D;AAED,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,gBAAgB,CA2B/E"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function buildPackageJson(input) {
|
|
2
|
+
const deps = {};
|
|
3
|
+
for (const dep of input.template.workspaceDependencies) {
|
|
4
|
+
deps[dep] = '^0.1.0';
|
|
5
|
+
}
|
|
6
|
+
return {
|
|
7
|
+
name: input.biomePackageName,
|
|
8
|
+
version: '0.1.0',
|
|
9
|
+
private: false,
|
|
10
|
+
type: 'module',
|
|
11
|
+
main: 'dist/index.js',
|
|
12
|
+
scripts: {
|
|
13
|
+
build: 'tsc -p tsconfig.json',
|
|
14
|
+
typecheck: 'tsc --noEmit',
|
|
15
|
+
test: 'vitest run',
|
|
16
|
+
},
|
|
17
|
+
dependencies: deps,
|
|
18
|
+
devDependencies: {
|
|
19
|
+
'@types/node': '^22.10.5',
|
|
20
|
+
typescript: '^5.7.3',
|
|
21
|
+
vitest: '^2.1.8',
|
|
22
|
+
},
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=package-builder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-builder.js","sourceRoot":"","sources":["../../src/lib/package-builder.ts"],"names":[],"mappings":"AAyBA,MAAM,UAAU,gBAAgB,CAAC,KAA4B;IAC3D,MAAM,IAAI,GAA2B,EAAE,CAAC;IACxC,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,QAAQ,CAAC,qBAAqB,EAAE,CAAC;QAKvD,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;IACvB,CAAC;IACD,OAAO;QACL,IAAI,EAAE,KAAK,CAAC,gBAAgB;QAC5B,OAAO,EAAE,OAAO;QAChB,OAAO,EAAE,KAAK;QACd,IAAI,EAAE,QAAQ;QACd,IAAI,EAAE,eAAe;QACrB,OAAO,EAAE;YACP,KAAK,EAAE,sBAAsB;YAC7B,SAAS,EAAE,cAAc;YACzB,IAAI,EAAE,YAAY;SACnB;QACD,YAAY,EAAE,IAAI;QAClB,eAAe,EAAE;YACf,aAAa,EAAE,UAAU;YACzB,UAAU,EAAE,QAAQ;YACpB,MAAM,EAAE,QAAQ;SACjB;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { buildManifest } from './manifest-builder.js';
|
|
2
|
+
import { type BiomeTemplateId } from './template.js';
|
|
3
|
+
export interface ScaffoldBiomeInput {
|
|
4
|
+
readonly biomeId: string;
|
|
5
|
+
readonly displayName: string;
|
|
6
|
+
readonly description: string;
|
|
7
|
+
readonly template: BiomeTemplateId;
|
|
8
|
+
readonly targetDir: string;
|
|
9
|
+
}
|
|
10
|
+
export interface ScaffoldBiomeResult {
|
|
11
|
+
readonly targetDir: string;
|
|
12
|
+
readonly filesWritten: readonly string[];
|
|
13
|
+
readonly manifest: ReturnType<typeof buildManifest>;
|
|
14
|
+
}
|
|
15
|
+
export declare function scaffoldBiome(input: ScaffoldBiomeInput): Promise<ScaffoldBiomeResult>;
|
|
16
|
+
export declare class ScaffolderError extends Error {
|
|
17
|
+
constructor(message: string);
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=scaffolder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffolder.d.ts","sourceRoot":"","sources":["../../src/lib/scaffolder.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,aAAa,EAAmC,MAAM,uBAAuB,CAAC;AAEvF,OAAO,EAAe,KAAK,eAAe,EAAE,MAAM,eAAe,CAAC;AASlE,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IAEnC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,mBAAmB;IAClC,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,SAAS,MAAM,EAAE,CAAC;IACzC,QAAQ,CAAC,QAAQ,EAAE,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC;CACrD;AAUD,wBAAsB,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAoC3F;AAOD,qBAAa,eAAgB,SAAQ,KAAK;gBAC5B,OAAO,EAAE,MAAM;CAI5B"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { existsSync } from 'node:fs';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { buildManifest, npmPackageName, validateBiomeId } from './manifest-builder.js';
|
|
5
|
+
import { buildPackageJson } from './package-builder.js';
|
|
6
|
+
import { getTemplate } from './template.js';
|
|
7
|
+
import { renderTemplateFiles } from './template-files.js';
|
|
8
|
+
export async function scaffoldBiome(input) {
|
|
9
|
+
const idCheck = validateBiomeId(input.biomeId);
|
|
10
|
+
if (!idCheck.ok) {
|
|
11
|
+
throw new ScaffolderError(idCheck.reason);
|
|
12
|
+
}
|
|
13
|
+
if (existsSync(input.targetDir)) {
|
|
14
|
+
throw new ScaffolderError(`target directory already exists: ${input.targetDir} — choose a fresh path or delete it first`);
|
|
15
|
+
}
|
|
16
|
+
const template = getTemplate(input.template);
|
|
17
|
+
const manifest = buildManifest({
|
|
18
|
+
biomeId: input.biomeId,
|
|
19
|
+
displayName: input.displayName,
|
|
20
|
+
description: input.description,
|
|
21
|
+
template,
|
|
22
|
+
});
|
|
23
|
+
const pkg = buildPackageJson({
|
|
24
|
+
biomePackageName: npmPackageName(input.biomeId),
|
|
25
|
+
template,
|
|
26
|
+
});
|
|
27
|
+
const templateFiles = renderTemplateFiles(template.id, {
|
|
28
|
+
biomeId: input.biomeId,
|
|
29
|
+
displayName: input.displayName,
|
|
30
|
+
});
|
|
31
|
+
await mkdir(input.targetDir, { recursive: true });
|
|
32
|
+
const filesWritten = [];
|
|
33
|
+
await writeJson(input.targetDir, 'package.json', pkg, filesWritten);
|
|
34
|
+
await writeJson(input.targetDir, 'xema-biome.json', manifest, filesWritten);
|
|
35
|
+
for (const [relativePath, content] of Object.entries(templateFiles)) {
|
|
36
|
+
await writeText(input.targetDir, relativePath, content, filesWritten);
|
|
37
|
+
}
|
|
38
|
+
return { targetDir: input.targetDir, filesWritten, manifest };
|
|
39
|
+
}
|
|
40
|
+
export class ScaffolderError extends Error {
|
|
41
|
+
constructor(message) {
|
|
42
|
+
super(message);
|
|
43
|
+
this.name = 'ScaffolderError';
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
async function writeJson(root, relativePath, data, written) {
|
|
47
|
+
const json = `${JSON.stringify(data, null, 2)}\n`;
|
|
48
|
+
await writeText(root, relativePath, json, written);
|
|
49
|
+
}
|
|
50
|
+
async function writeText(root, relativePath, content, written) {
|
|
51
|
+
const absolute = path.join(root, relativePath);
|
|
52
|
+
await mkdir(path.dirname(absolute), { recursive: true });
|
|
53
|
+
await writeFile(absolute, content, 'utf8');
|
|
54
|
+
written.push(absolute);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=scaffolder.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scaffolder.js","sourceRoot":"","sources":["../../src/lib/scaffolder.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACvF,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAE,WAAW,EAAwB,MAAM,eAAe,CAAC;AAClE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AA+B1D,MAAM,CAAC,KAAK,UAAU,aAAa,CAAC,KAAyB;IAC3D,MAAM,OAAO,GAAG,eAAe,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;IAC/C,IAAI,CAAC,OAAO,CAAC,EAAE,EAAE,CAAC;QAChB,MAAM,IAAI,eAAe,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAC5C,CAAC;IACD,IAAI,UAAU,CAAC,KAAK,CAAC,SAAS,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,eAAe,CACvB,oCAAoC,KAAK,CAAC,SAAS,2CAA2C,CAC/F,CAAC;IACJ,CAAC;IACD,MAAM,QAAQ,GAAG,WAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IAC7C,MAAM,QAAQ,GAAG,aAAa,CAAC;QAC7B,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B,IAAa,EACb,OAAiB;IAEjB,MAAM,IAAI,GAAG,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,CAAC;IAClD,MAAM,SAAS,CAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;AACrD,CAAC;AAED,KAAK,UAAU,SAAS,CACtB,IAAY,EACZ,YAAoB,EACpB,OAAe,EACf,OAAiB;IAEjB,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;IAC/C,MAAM,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACzD,MAAM,SAAS,CAAC,QAAQ,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC;IAC3C,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { BiomeTemplateId } from './template.js';
|
|
2
|
+
export interface TemplateContext {
|
|
3
|
+
readonly biomeId: string;
|
|
4
|
+
readonly displayName: string;
|
|
5
|
+
}
|
|
6
|
+
export type TemplateFiles = Readonly<Record<string, string>>;
|
|
7
|
+
export declare function renderTemplateFiles(templateId: BiomeTemplateId, ctx: TemplateContext): TemplateFiles;
|
|
8
|
+
//# sourceMappingURL=template-files.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-files.d.ts","sourceRoot":"","sources":["../../src/lib/template-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAYhD,MAAM,WAAW,eAAe;IAC9B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;CAC9B;AAED,MAAM,MAAM,aAAa,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;AAE7D,wBAAgB,mBAAmB,CACjC,UAAU,EAAE,eAAe,EAC3B,GAAG,EAAE,eAAe,GACnB,aAAa,CAOf"}
|
|
@@ -0,0 +1,263 @@
|
|
|
1
|
+
import { BiomeTemplateId } from './template.js';
|
|
2
|
+
export function renderTemplateFiles(templateId, ctx) {
|
|
3
|
+
switch (templateId) {
|
|
4
|
+
case BiomeTemplateId.Connector:
|
|
5
|
+
return renderConnectorTemplate(ctx);
|
|
6
|
+
case BiomeTemplateId.WorkflowsOnly:
|
|
7
|
+
return renderWorkflowsOnlyTemplate(ctx);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
const TSCONFIG = `{
|
|
11
|
+
"extends": "../../tsconfig.base.json",
|
|
12
|
+
"compilerOptions": {
|
|
13
|
+
"outDir": "dist",
|
|
14
|
+
"rootDir": "src",
|
|
15
|
+
"module": "ESNext",
|
|
16
|
+
"moduleResolution": "Bundler"
|
|
17
|
+
},
|
|
18
|
+
"include": ["src/**/*.ts"]
|
|
19
|
+
}
|
|
20
|
+
`;
|
|
21
|
+
const GITIGNORE = `node_modules
|
|
22
|
+
dist
|
|
23
|
+
`;
|
|
24
|
+
const VITEST_CONFIG = `import { defineConfig } from 'vitest/config';
|
|
25
|
+
|
|
26
|
+
export default defineConfig({
|
|
27
|
+
test: {
|
|
28
|
+
environment: 'node',
|
|
29
|
+
include: ['src/**/*.test.ts'],
|
|
30
|
+
},
|
|
31
|
+
});
|
|
32
|
+
`;
|
|
33
|
+
function readmeFor(ctx, summary) {
|
|
34
|
+
return `# ${ctx.displayName}
|
|
35
|
+
|
|
36
|
+
${summary}
|
|
37
|
+
|
|
38
|
+
## Develop
|
|
39
|
+
|
|
40
|
+
\`\`\`sh
|
|
41
|
+
pnpm install
|
|
42
|
+
pnpm build
|
|
43
|
+
pnpm test
|
|
44
|
+
\`\`\`
|
|
45
|
+
|
|
46
|
+
## Manifest
|
|
47
|
+
|
|
48
|
+
Edit \`xema-biome.json\` to adjust capabilities, integration requirements, or contributions.
|
|
49
|
+
The Xema biome host validates the manifest on boot — fail-fast errors point at the field to fix.
|
|
50
|
+
|
|
51
|
+
## Publish
|
|
52
|
+
|
|
53
|
+
Biomes are npm packages. Set the version in \`package.json\` and publish to your registry.
|
|
54
|
+
Operators install them on Xema by adding \`@xemahq-biomes/${ctx.biomeId}\` to their org's biome catalog.
|
|
55
|
+
`;
|
|
56
|
+
}
|
|
57
|
+
function renderConnectorTemplate(ctx) {
|
|
58
|
+
return {
|
|
59
|
+
'tsconfig.json': TSCONFIG,
|
|
60
|
+
'.gitignore': GITIGNORE,
|
|
61
|
+
'vitest.config.ts': VITEST_CONFIG,
|
|
62
|
+
'README.md': readmeFor(ctx, 'Integration provider biome scaffolded by `@xemahq/create-biome`. Ships a webhook verifier, event mapper, credential kind declaration, and a placeholder resource lister. Replace the placeholders with calls into the upstream provider SDK.'),
|
|
63
|
+
'contracts/index.ts': renderContractsIndex(ctx),
|
|
64
|
+
'agents/index.ts': renderAgentsIndex(ctx),
|
|
65
|
+
'src/integration-provider/index.ts': renderProviderModuleSource(ctx),
|
|
66
|
+
'src/integration-provider/index.test.ts': renderProviderModuleTest(ctx),
|
|
67
|
+
'test/manifest.test.ts': renderManifestTest(ctx),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function renderContractsIndex(_ctx) {
|
|
71
|
+
return `// Biome-local contract types. Export shared types used by both the
|
|
72
|
+
// integration provider and any activity handlers shipped with this biome.
|
|
73
|
+
export {};
|
|
74
|
+
`;
|
|
75
|
+
}
|
|
76
|
+
function renderAgentsIndex(_ctx) {
|
|
77
|
+
return `// Agent definitions contributed by this biome. Export agent config
|
|
78
|
+
// objects that the biome host registers with llm-registry-api on boot.
|
|
79
|
+
export {};
|
|
80
|
+
`;
|
|
81
|
+
}
|
|
82
|
+
function renderProviderModuleSource(ctx) {
|
|
83
|
+
return `import {
|
|
84
|
+
adapterError,
|
|
85
|
+
defineIntegrationProvider,
|
|
86
|
+
err,
|
|
87
|
+
ok,
|
|
88
|
+
type EventMapper,
|
|
89
|
+
type IdempotencyKeyExtractor,
|
|
90
|
+
type IntegrationProviderModule,
|
|
91
|
+
type WebhookVerifier,
|
|
92
|
+
} from '@xemahq/biome-sdk/adapter';
|
|
93
|
+
import {
|
|
94
|
+
BuiltInAdapterKind,
|
|
95
|
+
CredentialFieldTransform,
|
|
96
|
+
CredentialFieldType,
|
|
97
|
+
CredentialKind,
|
|
98
|
+
IntegrationOnboardingKind,
|
|
99
|
+
ProjectBindingAdapterKey,
|
|
100
|
+
type ProviderOnboardingManifest,
|
|
101
|
+
} from '@xemahq/kernel-contracts/connector';
|
|
102
|
+
|
|
103
|
+
// Replace the placeholder verifier below with the real signature
|
|
104
|
+
// algorithm your provider uses. The kernel ships hmac-sha256,
|
|
105
|
+
// hmac-sha1, ed25519, and 'none' (static-token); biomes re-use the
|
|
106
|
+
// same primitive so the registry never has to know provider-specific
|
|
107
|
+
// details.
|
|
108
|
+
const verifier: WebhookVerifier = {
|
|
109
|
+
signatureHeader: 'x-${ctx.biomeId}-signature',
|
|
110
|
+
algorithm: 'hmac-sha256',
|
|
111
|
+
secretSource: 'org-integration-secret',
|
|
112
|
+
verify(_input) {
|
|
113
|
+
return err(
|
|
114
|
+
adapterError('internal', 'replace this with a real verify() before shipping'),
|
|
115
|
+
);
|
|
116
|
+
},
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const eventMapper: EventMapper = {
|
|
120
|
+
map({ rawEvent, headers }) {
|
|
121
|
+
// Discriminate on the provider's event header or payload field,
|
|
122
|
+
// then map onto the canonical envelope for your AdapterKind.
|
|
123
|
+
if (!rawEvent || typeof rawEvent !== 'object') {
|
|
124
|
+
return err(adapterError('malformed-payload', 'event body is not an object'));
|
|
125
|
+
}
|
|
126
|
+
// \`headers\` is lower-cased; useful when the discriminator lives
|
|
127
|
+
// on a header instead of the payload.
|
|
128
|
+
void headers;
|
|
129
|
+
return ok(null);
|
|
130
|
+
},
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
const idempotencyKeyExtractor: IdempotencyKeyExtractor = ({ headers }) => {
|
|
134
|
+
const id = headers['x-${ctx.biomeId}-delivery'];
|
|
135
|
+
if (typeof id === 'string' && id.length > 0) {return \`${ctx.biomeId}:\${id}\`;}
|
|
136
|
+
return \`${ctx.biomeId}:fallback:\${Date.now().toString(36)}\`;
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
// Install-wizard onboarding manifest. Declares the "Connect" surface
|
|
140
|
+
// the frontend renders for this provider — display copy, icon, and the
|
|
141
|
+
// credential field schema (or APP_INSTALL launch copy for app-install
|
|
142
|
+
// providers). Replace placeholder strings before shipping.
|
|
143
|
+
const onboarding: ProviderOnboardingManifest = {
|
|
144
|
+
provider: '${ctx.biomeId}',
|
|
145
|
+
displayName: '${ctx.displayName}',
|
|
146
|
+
description: 'Replace this with a one-sentence provider description.',
|
|
147
|
+
iconName: 'Globe',
|
|
148
|
+
kind: IntegrationOnboardingKind.CREDENTIALS,
|
|
149
|
+
// Declare which project-binding adapter kinds your provider supports.
|
|
150
|
+
// Keep this list explicit — an empty array means the provider has no
|
|
151
|
+
// project-level bindings today and the project Bind dialog will hide
|
|
152
|
+
// it. Available keys: SCM, TRACKER, DOCUMENTATION.
|
|
153
|
+
supportedProjectBindingAdapterKinds: [] as readonly ProjectBindingAdapterKey[],
|
|
154
|
+
fields: [
|
|
155
|
+
{
|
|
156
|
+
key: 'apiToken',
|
|
157
|
+
label: 'API Token',
|
|
158
|
+
type: CredentialFieldType.PASSWORD,
|
|
159
|
+
required: true,
|
|
160
|
+
placeholder: 'Paste the provider API token',
|
|
161
|
+
transform: CredentialFieldTransform.TRIM,
|
|
162
|
+
},
|
|
163
|
+
],
|
|
164
|
+
hint: 'Issue a token under your provider settings — minimum scopes documented in the biome README.',
|
|
165
|
+
};
|
|
166
|
+
|
|
167
|
+
export const ${camelize(ctx.biomeId)}ProviderModule: IntegrationProviderModule = defineIntegrationProvider({
|
|
168
|
+
adapterKind: BuiltInAdapterKind.Tracker,
|
|
169
|
+
provider: '${ctx.biomeId}',
|
|
170
|
+
displayName: '${ctx.displayName}',
|
|
171
|
+
webhook: {
|
|
172
|
+
verifier,
|
|
173
|
+
eventMapper,
|
|
174
|
+
idempotencyKeyExtractor,
|
|
175
|
+
},
|
|
176
|
+
credentialKind: CredentialKind.OAuthUser,
|
|
177
|
+
resources: {},
|
|
178
|
+
actions: {},
|
|
179
|
+
onboarding,
|
|
180
|
+
});
|
|
181
|
+
|
|
182
|
+
export default [${camelize(ctx.biomeId)}ProviderModule];
|
|
183
|
+
`;
|
|
184
|
+
}
|
|
185
|
+
function renderProviderModuleTest(ctx) {
|
|
186
|
+
return `import { describe, expect, it } from 'vitest';
|
|
187
|
+
|
|
188
|
+
import { ${camelize(ctx.biomeId)}ProviderModule } from './index.js';
|
|
189
|
+
|
|
190
|
+
describe('${ctx.displayName} provider module', () => {
|
|
191
|
+
it('declares an adapter kind and a provider slug', () => {
|
|
192
|
+
expect(${camelize(ctx.biomeId)}ProviderModule.provider).toBe('${ctx.biomeId}');
|
|
193
|
+
expect(${camelize(ctx.biomeId)}ProviderModule.adapterKind).toBeTruthy();
|
|
194
|
+
});
|
|
195
|
+
});
|
|
196
|
+
`;
|
|
197
|
+
}
|
|
198
|
+
function renderManifestTest(ctx) {
|
|
199
|
+
return `import { describe, expect, it } from 'vitest';
|
|
200
|
+
import { readFile } from 'node:fs/promises';
|
|
201
|
+
import { join } from 'node:path';
|
|
202
|
+
import { BiomeManifestSchema } from '@xemahq/kernel-contracts/biome';
|
|
203
|
+
|
|
204
|
+
describe('xema-biome.json', () => {
|
|
205
|
+
it('parses against the BiomeManifestSchema', async () => {
|
|
206
|
+
const raw = await readFile(join(import.meta.dirname, '..', 'xema-biome.json'), 'utf8');
|
|
207
|
+
const parsed = BiomeManifestSchema.safeParse(JSON.parse(raw));
|
|
208
|
+
if (!parsed.success) {
|
|
209
|
+
throw new Error(\`xema-biome.json validation failed:\\n\${JSON.stringify(parsed.error.issues, null, 2)}\`);
|
|
210
|
+
}
|
|
211
|
+
expect(parsed.data.id).toBe('${ctx.biomeId}');
|
|
212
|
+
});
|
|
213
|
+
});
|
|
214
|
+
`;
|
|
215
|
+
}
|
|
216
|
+
function renderWorkflowsOnlyTemplate(ctx) {
|
|
217
|
+
return {
|
|
218
|
+
'tsconfig.json': TSCONFIG,
|
|
219
|
+
'.gitignore': GITIGNORE,
|
|
220
|
+
'vitest.config.ts': VITEST_CONFIG,
|
|
221
|
+
'README.md': readmeFor(ctx, 'Workflow-only biome scaffolded by `@xemahq/create-biome`. Ships YAML workflows under `workflow-config/` plus an empty TS shell for activity handlers.'),
|
|
222
|
+
'contracts/index.ts': renderContractsIndex(ctx),
|
|
223
|
+
'agents/index.ts': renderAgentsIndex(ctx),
|
|
224
|
+
'workflow-config/workflows/sample.yaml': renderSampleWorkflow(ctx),
|
|
225
|
+
'src/index.ts': `// Biomes without modules export an empty placeholder. Add typed
|
|
226
|
+
// helpers here if your YAML workflows reference custom activities.
|
|
227
|
+
// defineBiome() will be called here once you add contributions.
|
|
228
|
+
export {};
|
|
229
|
+
`,
|
|
230
|
+
'src/index.test.ts': `import { describe, it, expect } from 'vitest';
|
|
231
|
+
|
|
232
|
+
describe('${ctx.displayName}', () => {
|
|
233
|
+
it('boots', () => {
|
|
234
|
+
expect(true).toBe(true);
|
|
235
|
+
});
|
|
236
|
+
});
|
|
237
|
+
`,
|
|
238
|
+
'test/manifest.test.ts': renderManifestTest(ctx),
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
function renderSampleWorkflow(ctx) {
|
|
242
|
+
return `id: ${ctx.biomeId}-sample
|
|
243
|
+
name: ${ctx.displayName} sample workflow
|
|
244
|
+
on:
|
|
245
|
+
manual:
|
|
246
|
+
inputs:
|
|
247
|
+
message:
|
|
248
|
+
type: string
|
|
249
|
+
required: true
|
|
250
|
+
jobs:
|
|
251
|
+
log:
|
|
252
|
+
steps:
|
|
253
|
+
- id: emit
|
|
254
|
+
uses: xema/log@v1
|
|
255
|
+
with:
|
|
256
|
+
level: info
|
|
257
|
+
message: \${{ inputs.message }}
|
|
258
|
+
`;
|
|
259
|
+
}
|
|
260
|
+
function camelize(kebab) {
|
|
261
|
+
return kebab.replaceAll(/-([a-z0-9])/g, (_, ch) => ch.toUpperCase());
|
|
262
|
+
}
|
|
263
|
+
//# sourceMappingURL=template-files.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template-files.js","sourceRoot":"","sources":["../../src/lib/template-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAmBhD,MAAM,UAAU,mBAAmB,CACjC,UAA2B,EAC3B,GAAoB;IAEpB,QAAQ,UAAU,EAAE,CAAC;QACnB,KAAK,eAAe,CAAC,SAAS;YAC5B,OAAO,uBAAuB,CAAC,GAAG,CAAC,CAAC;QACtC,KAAK,eAAe,CAAC,aAAa;YAChC,OAAO,2BAA2B,CAAC,GAAG,CAAC,CAAC;IAC5C,CAAC;AACH,CAAC;AAID,MAAM,QAAQ,GAAG;;;;;;;;;;CAUhB,CAAC;AAEF,MAAM,SAAS,GAAG;;CAEjB,CAAC;AAEF,MAAM,aAAa,GAAG;;;;;;;;CAQrB,CAAC;AAEF,SAAS,SAAS,CAAC,GAAoB,EAAE,OAAe;IACtD,OAAO,KAAK,GAAG,CAAC,WAAW;;EAE3B,OAAO;;;;;;;;;;;;;;;;;;4DAkBmD,GAAG,CAAC,OAAO;CACtE,CAAC;AACF,CAAC;AAID,SAAS,uBAAuB,CAAC,GAAoB;IACnD,OAAO;QACL,eAAe,EAAE,QAAQ;QACzB,YAAY,EAAE,SAAS;QACvB,kBAAkB,EAAE,aAAa;QACjC,WAAW,EAAE,SAAS,CACpB,GAAG,EACH,8OAA8O,CAC/O;QACD,oBAAoB,EAAE,oBAAoB,CAAC,GAAG,CAAC;QAC/C,iB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AAE,QAAQ;QACzB,YAAY,EAAE,SAAS;QACvB,kBAAkB,EAAE,aAAa;QACjC,WAAW,EAAE,SAAS,CACpB,GAAG,EACH,uJAAuJ,CACxJ;QACD,oBAAoB,EAAE,oBAAoB,CAAC,GAAG,CAAC;QAC/C,iBAAiB,EAAE,iBAAiB,CAAC,GAAG,CAAC;QACzC,uCAAuC,EAAE,oBAAoB,CAAC,GAAG,CAAC;QAClE,cAAc,EAAE;;;;CAInB;QACG,mBAAmB,EAAE;;YAEb,GAAG,CAAC,WAAW;;;;;CAK1B;QACG,uBAAuB,EAAE,kBAAkB,CAAC,GAAG,CAAC;KACjD,CAAC;AACJ,CAAC;AAED,SAAS,oBAAoB,CAAC,GAAoB;IAChD,OAAO,OAAO,GAAG,CAAC,OAAO;QACnB,GAAG,CAAC,WAAW;;;;;;;;;;;;;;;CAetB,CAAC;AACF,CAAC;AAID,SAAS,QAAQ,CAAC,KAAa;IAC7B,OAAO,KAAK,CAAC,UAAU,CAAC,cAAc,EAAE,CAAC,CAAC,EAAE,EAAU,EAAE,EAAE,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;AAC/E,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare enum BiomeTemplateId {
|
|
2
|
+
Connector = "connector",
|
|
3
|
+
WorkflowsOnly = "workflows-only"
|
|
4
|
+
}
|
|
5
|
+
export interface BiomeTemplateMetadata {
|
|
6
|
+
readonly id: BiomeTemplateId;
|
|
7
|
+
readonly displayName: string;
|
|
8
|
+
readonly summary: string;
|
|
9
|
+
readonly workspaceDependencies: readonly string[];
|
|
10
|
+
}
|
|
11
|
+
export declare const BIOME_TEMPLATES: Readonly<Record<BiomeTemplateId, BiomeTemplateMetadata>>;
|
|
12
|
+
export declare function listTemplates(): readonly BiomeTemplateMetadata[];
|
|
13
|
+
export declare function getTemplate(id: BiomeTemplateId): BiomeTemplateMetadata;
|
|
14
|
+
//# sourceMappingURL=template.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.d.ts","sourceRoot":"","sources":["../../src/lib/template.ts"],"names":[],"mappings":"AASA,oBAAY,eAAe;IACzB,SAAS,cAAc;IACvB,aAAa,mBAAmB;CACjC;AAED,MAAM,WAAW,qBAAqB;IACpC,QAAQ,CAAC,EAAE,EAAE,eAAe,CAAC;IAC7B,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IAEzB,QAAQ,CAAC,qBAAqB,EAAE,SAAS,MAAM,EAAE,CAAC;CACnD;AAED,eAAO,MAAM,eAAe,EAAE,QAAQ,CAAC,MAAM,CAAC,eAAe,EAAE,qBAAqB,CAAC,CAepF,CAAC;AAEF,wBAAgB,aAAa,IAAI,SAAS,qBAAqB,EAAE,CAEhE;AAED,wBAAgB,WAAW,CAAC,EAAE,EAAE,eAAe,GAAG,qBAAqB,CAEtE"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export var BiomeTemplateId;
|
|
2
|
+
(function (BiomeTemplateId) {
|
|
3
|
+
BiomeTemplateId["Connector"] = "connector";
|
|
4
|
+
BiomeTemplateId["WorkflowsOnly"] = "workflows-only";
|
|
5
|
+
})(BiomeTemplateId || (BiomeTemplateId = {}));
|
|
6
|
+
export const BIOME_TEMPLATES = {
|
|
7
|
+
[BiomeTemplateId.Connector]: {
|
|
8
|
+
id: BiomeTemplateId.Connector,
|
|
9
|
+
displayName: 'Connector',
|
|
10
|
+
summary: 'Adds a new integration provider (webhook ingress, credential mint, resource pickers, outbound actions). Closest example: the Linear integration under biomes/platform/linear-integration.',
|
|
11
|
+
workspaceDependencies: ['@xemahq/biome-sdk/adapter', '@xemahq/kernel-contracts/connector'],
|
|
12
|
+
},
|
|
13
|
+
[BiomeTemplateId.WorkflowsOnly]: {
|
|
14
|
+
id: BiomeTemplateId.WorkflowsOnly,
|
|
15
|
+
displayName: 'Workflows only',
|
|
16
|
+
summary: 'Ships YAML workflows + activity handlers without contributing an integration. Good for biomes that orchestrate existing platform capabilities (review gates, deliverable specs, scheduled jobs).',
|
|
17
|
+
workspaceDependencies: ['@xemahq/kernel-contracts/workflow'],
|
|
18
|
+
},
|
|
19
|
+
};
|
|
20
|
+
export function listTemplates() {
|
|
21
|
+
return Object.values(BIOME_TEMPLATES);
|
|
22
|
+
}
|
|
23
|
+
export function getTemplate(id) {
|
|
24
|
+
return BIOME_TEMPLATES[id];
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=template.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"template.js","sourceRoot":"","sources":["../../src/lib/template.ts"],"names":[],"mappings":"AASA,MAAM,CAAN,IAAY,eAGX;AAHD,WAAY,eAAe;IACzB,0CAAuB,CAAA;IACvB,mDAAgC,CAAA;AAClC,CAAC,EAHW,eAAe,KAAf,eAAe,QAG1B;AAUD,MAAM,CAAC,MAAM,eAAe,GAA6D;IACvF,CAAC,eAAe,CAAC,SAAS,CAAC,EAAE;QAC3B,EAAE,EAAE,eAAe,CAAC,SAAS;QAC7B,WAAW,EAAE,WAAW;QACxB,OAAO,EACL,2LAA2L;QAC7L,qBAAqB,EAAE,CAAC,2BAA2B,EAAE,oCAAoC,CAAC;KAC3F;IACD,CAAC,eAAe,CAAC,aAAa,CAAC,EAAE;QAC/B,EAAE,EAAE,eAAe,CAAC,aAAa;QACjC,WAAW,EAAE,gBAAgB;QAC7B,OAAO,EACL,kMAAkM;QACpM,qBAAqB,EAAE,CAAC,mCAAmC,CAAC;KAC7D;CACF,CAAC;AAEF,MAAM,UAAU,aAAa;IAC3B,OAAO,MAAM,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,EAAmB;IAC7C,OAAO,eAAe,CAAC,EAAE,CAAC,CAAC;AAC7B,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@xemahq/create-biome",
|
|
3
|
+
"version": "0.1.1",
|
|
4
|
+
"description": "Scaffolder for Xema biome packages. `pnpm dlx @xemahq/create-biome <biomeId>` generates a working biome folder with manifest, ESM TypeScript layout, sample tests, and one of three starter templates: integration-provider, workflows-only, storage-only.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"publishConfig": {
|
|
7
|
+
"registry": "https://registry.npmjs.org/",
|
|
8
|
+
"access": "public"
|
|
9
|
+
},
|
|
10
|
+
"main": "dist/index.js",
|
|
11
|
+
"types": "dist/index.d.ts",
|
|
12
|
+
"bin": {
|
|
13
|
+
"create-biome": "dist/bin/create-biome.js"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
],
|
|
18
|
+
"devDependencies": {
|
|
19
|
+
"@types/node": "25.2.3",
|
|
20
|
+
"prettier": "3.6.2",
|
|
21
|
+
"typescript": "5.9.3"
|
|
22
|
+
},
|
|
23
|
+
"dependencies": {
|
|
24
|
+
"@xemahq/biome-sdk": "^0.1.1"
|
|
25
|
+
},
|
|
26
|
+
"exports": {
|
|
27
|
+
".": {
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"xema-source": "./src/index.ts",
|
|
30
|
+
"default": "./dist/index.js"
|
|
31
|
+
},
|
|
32
|
+
"./dist/lib/*": {
|
|
33
|
+
"types": "./dist/lib/*.d.ts",
|
|
34
|
+
"default": "./dist/lib/*.js"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"scripts": {
|
|
38
|
+
"clean": "rm -rf dist",
|
|
39
|
+
"build": "tsc -p tsconfig.json",
|
|
40
|
+
"format": "prettier --write \"src/**/*.ts\"",
|
|
41
|
+
"typecheck": "tsc -p tsconfig.json --noEmit"
|
|
42
|
+
}
|
|
43
|
+
}
|