@icebreakers/monorepo-templates 2.1.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/.agents/skills/repoctl/SKILL.md +2 -0
- package/assets/.agents/skills/repoctl/references/commands.md +224 -13
- package/assets/.agents/skills/repoctl/references/config.md +70 -6
- package/assets/.agents/skills/repoctl/references/dependencies.md +37 -0
- package/assets/.agents/skills/repoctl/references/knip.md +34 -0
- package/assets/.agents/skills/repoctl/references/templates.md +23 -0
- package/assets/.github/workflows/ci.yml +10 -10
- package/assets/package.json +5 -9
- package/assets/pnpm-workspace.yaml +2 -1
- package/assets/repoctl.config.ts +1 -1
- package/assets/turbo.json +2 -1
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +281 -1
- package/dist/index.mjs +1137 -74
- package/dist/{prepare-2VvFwYDz.mjs → prepare-BYNSxvoB.mjs} +76 -4
- package/package.json +2 -1
- package/template-data.mjs +24 -0
- package/templates/client/package.json +1 -1
- package/templates/next/README.md +31 -0
- package/templates/next/eslint.config.js +5 -0
- package/templates/next/gitignore +7 -0
- package/templates/next/next.config.ts +5 -0
- package/templates/next/package.json +36 -0
- package/templates/next/src/app/api/health/route.ts +5 -0
- package/templates/next/src/app/counter.tsx +19 -0
- package/templates/next/src/app/favicon.ico +0 -0
- package/templates/next/src/app/globals.css +109 -0
- package/templates/next/src/app/layout.tsx +17 -0
- package/templates/next/src/app/page.tsx +16 -0
- package/templates/next/stylelint.config.js +3 -0
- package/templates/next/test/counter.test.tsx +22 -0
- package/templates/next/tsconfig.json +40 -0
- package/templates/next/turbo.json +24 -0
- package/templates/next/vitest.config.js +9 -0
- package/templates/react-lib/LICENSE +21 -0
- package/templates/react-lib/README.md +52 -0
- package/templates/react-lib/eslint.config.js +5 -0
- package/templates/react-lib/gitignore +4 -0
- package/templates/react-lib/package.json +48 -0
- package/templates/react-lib/src/counter.tsx +28 -0
- package/templates/react-lib/src/index.ts +2 -0
- package/templates/react-lib/src/style.css +36 -0
- package/templates/react-lib/stylelint.config.js +3 -0
- package/templates/react-lib/test/counter.test.tsx +28 -0
- package/templates/react-lib/test-d/index.test-d.ts +11 -0
- package/templates/react-lib/tsconfig.app.json +15 -0
- package/templates/react-lib/tsconfig.build.json +12 -0
- package/templates/react-lib/tsconfig.json +4 -0
- package/templates/react-lib/tsconfig.node.json +11 -0
- package/templates/react-lib/vite.config.ts +22 -0
- package/templates/react-lib/vitest.config.ts +5 -0
- package/templates/react-vite/README.md +27 -0
- package/templates/react-vite/eslint.config.js +5 -0
- package/templates/react-vite/gitignore +6 -0
- package/templates/react-vite/index.html +13 -0
- package/templates/react-vite/package.json +36 -0
- package/templates/react-vite/src/app.tsx +22 -0
- package/templates/react-vite/src/main.tsx +15 -0
- package/templates/react-vite/src/style.css +95 -0
- package/templates/react-vite/stylelint.config.js +3 -0
- package/templates/react-vite/test/app.test.tsx +22 -0
- package/templates/react-vite/tsconfig.app.json +26 -0
- package/templates/react-vite/tsconfig.json +11 -0
- package/templates/react-vite/tsconfig.node.json +18 -0
- package/templates/react-vite/vite.config.ts +6 -0
- package/templates/react-vite/vitest.config.ts +9 -0
- package/templates/vitepress/.vitepress/navigation/routes.ts +7 -0
- package/templates/vitepress/reference/artifacts.md +51 -0
- package/templates/vitepress/reference/commands.md +149 -0
- package/templates/vitepress/reference/config.md +101 -7
- package/templates/vitepress/reference/dependencies.md +116 -0
- package/templates/vitepress/reference/dependency-admission.md +67 -0
- package/templates/vitepress/reference/devcontainer.md +25 -0
- package/templates/vitepress/reference/index.md +1 -0
- package/templates/vitepress/reference/install-security.md +51 -0
- package/templates/vitepress/reference/knip.md +55 -0
- package/templates/vitepress/reference/move.md +39 -0
- package/templates/vitepress/reference/organization-presets.md +89 -0
- package/templates/vitepress/reference/removal.md +42 -0
- package/templates/vitepress/reference/template-assets.md +39 -0
- package/templates/vitepress/reference/templates.md +372 -9
- package/templates/vitepress/start/diagnose.md +19 -2
- package/templates/vitepress/tasks/checks.md +149 -1
- package/templates/vitepress/tasks/ci.md +93 -1
- package/templates/vitepress/tasks/release.md +72 -6
- package/templates/vitepress/zh/reference/artifacts.md +51 -0
- package/templates/vitepress/zh/reference/commands.md +148 -0
- package/templates/vitepress/zh/reference/config.md +94 -2
- package/templates/vitepress/zh/reference/dependencies.md +116 -0
- package/templates/vitepress/zh/reference/dependency-admission.md +67 -0
- package/templates/vitepress/zh/reference/devcontainer.md +25 -0
- package/templates/vitepress/zh/reference/index.md +1 -0
- package/templates/vitepress/zh/reference/install-security.md +51 -0
- package/templates/vitepress/zh/reference/knip.md +55 -0
- package/templates/vitepress/zh/reference/move.md +39 -0
- package/templates/vitepress/zh/reference/organization-presets.md +89 -0
- package/templates/vitepress/zh/reference/removal.md +42 -0
- package/templates/vitepress/zh/reference/template-assets.md +19 -4
- package/templates/vitepress/zh/reference/templates.md +352 -9
- package/templates/vitepress/zh/start/diagnose.md +24 -13
- package/templates/vitepress/zh/tasks/checks.md +150 -0
- package/templates/vitepress/zh/tasks/ci.md +93 -1
- package/templates/vitepress/zh/tasks/release.md +72 -6
- package/templates/vue-lib/package.json +1 -1
package/assets/package.json
CHANGED
|
@@ -27,16 +27,12 @@
|
|
|
27
27
|
},
|
|
28
28
|
"scripts": {
|
|
29
29
|
"build": "turbo run build",
|
|
30
|
-
"tooling:build": "turbo run build --filter=@icebreakers/monorepo --filter=repoctl",
|
|
31
30
|
"dev": "turbo run dev --concurrency=20",
|
|
32
|
-
"test": "node -e \"require('node:fs').mkdirSync('coverage/.tmp', { recursive: true })\" &&
|
|
33
|
-
"test:
|
|
34
|
-
"
|
|
35
|
-
"lint": "pnpm run tooling:build && turbo run lint",
|
|
31
|
+
"test": "node -e \"require('node:fs').mkdirSync('coverage/.tmp', { recursive: true })\" && vitest run && pnpm test:types",
|
|
32
|
+
"test:dev": "node -e \"require('node:fs').mkdirSync('coverage/.tmp', { recursive: true })\" && vitest",
|
|
33
|
+
"lint": "turbo run lint",
|
|
36
34
|
"tsd": "turbo run tsd",
|
|
37
35
|
"test:types": "turbo run test:types",
|
|
38
|
-
"check:no-tracked-build-artifacts": "node ./scripts/check-no-tracked-build-artifacts.mjs",
|
|
39
|
-
"check:workflows": "node ./scripts/check-workflows.mjs",
|
|
40
36
|
"audit": "pnpm audit --audit-level=moderate",
|
|
41
37
|
"audit:fix": "pnpm audit --fix",
|
|
42
38
|
"cf-typegen": "pnpm --filter @icebreakers/client --filter @icebreakers/server run cf-typegen",
|
|
@@ -81,11 +77,11 @@
|
|
|
81
77
|
"lint-staged": "^17.6.0",
|
|
82
78
|
"only-allow": "^1.2.2",
|
|
83
79
|
"repoctl": "latest",
|
|
84
|
-
"stylelint": "^17.
|
|
80
|
+
"stylelint": "^17.16.0",
|
|
85
81
|
"tailwindcss": "^4.3.3",
|
|
86
82
|
"tsd": "^0.33.0",
|
|
87
83
|
"tsdown": "0.23.0",
|
|
88
|
-
"turbo": "^2.11.
|
|
84
|
+
"turbo": "^2.11.6",
|
|
89
85
|
"typescript": "^6.0.3",
|
|
90
86
|
"vitest": "~5.0.3",
|
|
91
87
|
"yaml": "^2.9.1"
|
package/assets/repoctl.config.ts
CHANGED
package/assets/turbo.json
CHANGED
package/dist/cli.mjs
CHANGED
package/dist/index.d.mts
CHANGED
|
@@ -1,9 +1,34 @@
|
|
|
1
1
|
import checkbox from "@inquirer/checkbox";
|
|
2
2
|
import input from "@inquirer/input";
|
|
3
|
+
import password from "@inquirer/password";
|
|
3
4
|
import select from "@inquirer/select";
|
|
4
5
|
import { Command, program } from "commander";
|
|
5
6
|
//#region src/types.d.ts
|
|
6
7
|
type TemplateCategory = 'app' | 'docs' | 'library' | 'service' | 'tool';
|
|
8
|
+
type TemplateRemoteSource = {
|
|
9
|
+
kind: 'npm';
|
|
10
|
+
packageName: string;
|
|
11
|
+
version: string;
|
|
12
|
+
registry?: string;
|
|
13
|
+
} | {
|
|
14
|
+
kind: 'git';
|
|
15
|
+
repository: string;
|
|
16
|
+
ref: string;
|
|
17
|
+
};
|
|
18
|
+
type ResolvedTemplateRemoteSource = {
|
|
19
|
+
kind: 'npm';
|
|
20
|
+
packageName: string;
|
|
21
|
+
requestedVersion: string;
|
|
22
|
+
version: string;
|
|
23
|
+
registry: string;
|
|
24
|
+
integrity: string;
|
|
25
|
+
} | {
|
|
26
|
+
kind: 'git';
|
|
27
|
+
repository: string;
|
|
28
|
+
requestedRef: string;
|
|
29
|
+
commit: string;
|
|
30
|
+
integrity: string;
|
|
31
|
+
};
|
|
7
32
|
interface TemplateChoice {
|
|
8
33
|
key: string;
|
|
9
34
|
label: string;
|
|
@@ -15,6 +40,8 @@ interface TemplateChoice {
|
|
|
15
40
|
interface TemplateDefinition {
|
|
16
41
|
source: string;
|
|
17
42
|
target: string;
|
|
43
|
+
/** Resolve source relative to this immutable remote asset instead of templatesDir. */
|
|
44
|
+
remote?: TemplateRemoteSource;
|
|
18
45
|
}
|
|
19
46
|
interface GetTemplateChoicesOptions {
|
|
20
47
|
category?: TemplateCategory;
|
|
@@ -40,6 +67,8 @@ interface PrepareAssetsOptions {
|
|
|
40
67
|
export declare function prepareAssets(options?: PrepareAssetsOptions): Promise<void>;
|
|
41
68
|
//#endregion
|
|
42
69
|
//#region src/runtime-assets.d.ts
|
|
70
|
+
/** Inspect asset readiness without acquiring locks or writing generated files. */
|
|
71
|
+
export declare function areTemplateAssetsPrepared(): Promise<boolean>;
|
|
43
72
|
export declare function ensureTemplateAssetsPrepared(): Promise<void>;
|
|
44
73
|
//#endregion
|
|
45
74
|
//#region src/scaffold.d.ts
|
|
@@ -60,6 +89,8 @@ interface ScaffoldWorkspaceOptions {
|
|
|
60
89
|
includeAssets?: boolean;
|
|
61
90
|
targetMode?: TargetMode;
|
|
62
91
|
force?: boolean;
|
|
92
|
+
/** Runs caller-owned root transformations before any successful instance registration. */
|
|
93
|
+
afterScaffold?: () => Promise<void>;
|
|
63
94
|
}
|
|
64
95
|
export declare function scaffoldTemplate(options: ScaffoldTemplateOptions): Promise<void>;
|
|
65
96
|
export declare function scaffoldWorkspace(options: ScaffoldWorkspaceOptions): Promise<void>;
|
|
@@ -86,6 +117,255 @@ export declare function isGitignoreFile(name: string): boolean;
|
|
|
86
117
|
export declare function shouldSkipTemplatePath(rootDir: string, targetPath: string): boolean;
|
|
87
118
|
export declare function createTemplateCopyFilter(rootDir: string): (src: string) => boolean;
|
|
88
119
|
//#endregion
|
|
120
|
+
//#region src/instances/types.d.ts
|
|
121
|
+
interface TemplateSnapshotFile {
|
|
122
|
+
path: string;
|
|
123
|
+
content: string;
|
|
124
|
+
executable: boolean;
|
|
125
|
+
}
|
|
126
|
+
interface TemplateSnapshot {
|
|
127
|
+
schemaVersion: 1;
|
|
128
|
+
files: TemplateSnapshotFile[];
|
|
129
|
+
directories: string[];
|
|
130
|
+
}
|
|
131
|
+
type TemplateGenerationProfile = 'workspace-copy-v1' | 'repo-new-v1' | 'repo-new-parameters-v1';
|
|
132
|
+
/** Only these non-secret inputs are retained; arbitrary config and environment are never serialized. */
|
|
133
|
+
interface TemplateGenerationParameters {
|
|
134
|
+
packageName?: string;
|
|
135
|
+
renameJson?: boolean;
|
|
136
|
+
/** Validated nonsensitive template inputs only. */
|
|
137
|
+
templateValues?: Record<string, string | boolean>;
|
|
138
|
+
/** Names only; values are never retained. */
|
|
139
|
+
sensitiveParameters?: string[];
|
|
140
|
+
}
|
|
141
|
+
interface TemplateInstanceSource {
|
|
142
|
+
kind: 'package' | 'snapshot' | 'remote';
|
|
143
|
+
templatePath: string;
|
|
144
|
+
packageName?: string;
|
|
145
|
+
version?: string;
|
|
146
|
+
digest?: string;
|
|
147
|
+
remote?: ResolvedTemplateRemoteSource;
|
|
148
|
+
}
|
|
149
|
+
type TemplateInstanceBaseline = {
|
|
150
|
+
status: 'available';
|
|
151
|
+
original: string;
|
|
152
|
+
rendered: string;
|
|
153
|
+
} | {
|
|
154
|
+
status: 'unverified';
|
|
155
|
+
reason: 'source-unavailable';
|
|
156
|
+
};
|
|
157
|
+
interface TemplateInstance {
|
|
158
|
+
id: string;
|
|
159
|
+
target: string;
|
|
160
|
+
template: string;
|
|
161
|
+
provenance: 'created' | 'linked';
|
|
162
|
+
source: TemplateInstanceSource;
|
|
163
|
+
generator: {
|
|
164
|
+
profile: TemplateGenerationProfile;
|
|
165
|
+
version: string;
|
|
166
|
+
};
|
|
167
|
+
parameters: TemplateGenerationParameters;
|
|
168
|
+
baseline: TemplateInstanceBaseline;
|
|
169
|
+
/** Explicit instance-relative files or directories excluded from future template upgrades. */
|
|
170
|
+
excludedPaths?: string[];
|
|
171
|
+
}
|
|
172
|
+
interface TemplateInstanceRegistry {
|
|
173
|
+
schemaVersion: 1;
|
|
174
|
+
instances: TemplateInstance[];
|
|
175
|
+
}
|
|
176
|
+
interface TemplateInstanceInfo {
|
|
177
|
+
instance: TemplateInstance;
|
|
178
|
+
targetStatus: 'present' | 'missing' | 'unsafe';
|
|
179
|
+
baselineStatus: 'available' | 'unverified' | 'unavailable';
|
|
180
|
+
}
|
|
181
|
+
interface PreparedTemplateSource {
|
|
182
|
+
source: TemplateInstanceSource;
|
|
183
|
+
snapshot: TemplateSnapshot;
|
|
184
|
+
}
|
|
185
|
+
interface GeneratedTemplateInstanceOptions {
|
|
186
|
+
workspaceDir: string;
|
|
187
|
+
targetDir: string;
|
|
188
|
+
template: string;
|
|
189
|
+
preparedSource: PreparedTemplateSource;
|
|
190
|
+
profile: TemplateGenerationProfile;
|
|
191
|
+
parameters?: TemplateGenerationParameters;
|
|
192
|
+
generatorVersion?: string;
|
|
193
|
+
/** Secret-bearing output files stay outside recorded baselines and later upgrades. */
|
|
194
|
+
excludedPaths?: string[];
|
|
195
|
+
}
|
|
196
|
+
interface TemplateInstanceDraft {
|
|
197
|
+
instance: TemplateInstance;
|
|
198
|
+
snapshots: Record<string, TemplateSnapshot>;
|
|
199
|
+
}
|
|
200
|
+
interface TemplateInstanceRegistrationOptions extends Partial<Pick<TemplateInstanceReplacementHooks, 'rollback' | 'committed'>> {
|
|
201
|
+
/** Generated path-based IDs may collide after relocation; explicit caller IDs remain strict by default. */
|
|
202
|
+
allocateIdOnConflict?: boolean;
|
|
203
|
+
}
|
|
204
|
+
/** File-side transaction hooks run while the instance registry lock is held. */
|
|
205
|
+
interface TemplateInstanceReplacementHooks {
|
|
206
|
+
apply: () => Promise<void>;
|
|
207
|
+
rollback: () => Promise<void>;
|
|
208
|
+
committed: () => Promise<void>;
|
|
209
|
+
}
|
|
210
|
+
interface TemplateInstanceMovePlan {
|
|
211
|
+
from: string;
|
|
212
|
+
to: string;
|
|
213
|
+
beforeHash: string;
|
|
214
|
+
afterHash: string;
|
|
215
|
+
relocations: {
|
|
216
|
+
id: string;
|
|
217
|
+
from: string;
|
|
218
|
+
to: string;
|
|
219
|
+
}[];
|
|
220
|
+
}
|
|
221
|
+
interface TemplateFileDifference {
|
|
222
|
+
path: string;
|
|
223
|
+
status: 'added' | 'modified' | 'deleted';
|
|
224
|
+
}
|
|
225
|
+
//#endregion
|
|
226
|
+
//#region src/instances/move.d.ts
|
|
227
|
+
/** Preview target changes without treating business edits as a new template baseline. */
|
|
228
|
+
export declare function planTemplateInstanceMove(workspaceDir: string, from: string, to: string): Promise<TemplateInstanceMovePlan>;
|
|
229
|
+
/** Hold the registry lock through file mutation, registry commit and any rollback, including moves with no registered instances. */
|
|
230
|
+
export declare function moveTemplateInstances(workspaceDir: string, plan: TemplateInstanceMovePlan, hooks: TemplateInstanceReplacementHooks, replay?: boolean): Promise<string[]>;
|
|
231
|
+
//#endregion
|
|
232
|
+
//#region src/instances/operations.d.ts
|
|
233
|
+
export declare function templateInstanceId(target: string, template: string): string;
|
|
234
|
+
/** Reserve a new directory only when no existing instance owns its path. */
|
|
235
|
+
export declare function createTemplateInstanceTarget(workspaceDir: string, relative: string): Promise<string>;
|
|
236
|
+
export declare function prepareGeneratedTemplateInstance(options: GeneratedTemplateInstanceOptions): Promise<TemplateInstanceDraft>;
|
|
237
|
+
export declare function recordGeneratedTemplateInstance(options: GeneratedTemplateInstanceOptions): Promise<TemplateInstance>;
|
|
238
|
+
export declare function listTemplateInstances(workspaceDir: string): Promise<TemplateInstanceInfo[]>;
|
|
239
|
+
export declare function rebuildTemplateInstanceBaseline(workspaceDir: string, id: string, targetDir: string, layer?: 'original' | 'rendered'): Promise<TemplateInstance>;
|
|
240
|
+
/** Relocation never guesses based on a package name; all retained baseline files must identify the instance. */
|
|
241
|
+
export declare function relocateTemplateInstance(workspaceDir: string, id: string, target: string, apply?: boolean): Promise<{
|
|
242
|
+
applied: boolean;
|
|
243
|
+
instance: TemplateInstance;
|
|
244
|
+
target: string;
|
|
245
|
+
changed: boolean;
|
|
246
|
+
}>;
|
|
247
|
+
//#endregion
|
|
248
|
+
//#region src/instances/paths.d.ts
|
|
249
|
+
export declare const templateRegistryPath = ".repoctl/template-instances.json";
|
|
250
|
+
export declare const templateBaselineDirectory = ".repoctl/template-baselines";
|
|
251
|
+
/** Reject links in every existing ancestor, including a missing leaf's parents. */
|
|
252
|
+
export declare function safeInstancePath(workspaceDir: string, relativePath: string): Promise<string>;
|
|
253
|
+
export declare function instanceRelativePath(workspaceDir: string, targetDir: string): string;
|
|
254
|
+
//#endregion
|
|
255
|
+
//#region src/instances/replace.d.ts
|
|
256
|
+
/** Replace exactly one instance, rolling file mutations back before releasing the registry lock on failure. */
|
|
257
|
+
export declare function replaceTemplateInstance(workspaceDir: string, before: TemplateInstance, draft: TemplateInstanceDraft, hooks: TemplateInstanceReplacementHooks): Promise<TemplateInstance>;
|
|
258
|
+
//#endregion
|
|
259
|
+
//#region src/instances/schema.d.ts
|
|
260
|
+
export declare function isExactTemplateVersion(value: string): boolean;
|
|
261
|
+
export declare function normalizeTemplateExclusions(values: string[]): string[];
|
|
262
|
+
export declare function generationParameters(input?: TemplateGenerationParameters): TemplateGenerationParameters;
|
|
263
|
+
//#endregion
|
|
264
|
+
//#region src/instances/snapshot.d.ts
|
|
265
|
+
export declare function snapshotDigest(snapshot: TemplateSnapshot): string;
|
|
266
|
+
/** Capture only template deliverables; never follow symbolic links or collect repository credentials. */
|
|
267
|
+
export declare function captureTemplateSnapshot(directory: string): Promise<TemplateSnapshot>;
|
|
268
|
+
export declare function compareTemplateSnapshots(baseline: TemplateSnapshot, current: TemplateSnapshot): TemplateFileDifference[];
|
|
269
|
+
export declare function writeTemplateSnapshot(snapshot: TemplateSnapshot, targetDir: string): Promise<void>;
|
|
270
|
+
//#endregion
|
|
271
|
+
//#region src/instances/source.d.ts
|
|
272
|
+
export declare function readTemplatePackageVersion(sourcePackageDir?: string): Promise<string>;
|
|
273
|
+
export declare function prepareTemplateInstanceSource(sourceDir: string, historicalPackageDir?: string): Promise<PreparedTemplateSource>;
|
|
274
|
+
//#endregion
|
|
275
|
+
//#region src/instances/store.d.ts
|
|
276
|
+
export declare function loadTemplateInstanceRegistry(workspaceDir: string): Promise<TemplateInstanceRegistry>;
|
|
277
|
+
export declare function loadTemplateBaseline(workspaceDir: string, digest: string): Promise<TemplateSnapshot>;
|
|
278
|
+
export declare function canVerifyTemplateInstance(existing: TemplateInstance, next: TemplateInstance): boolean;
|
|
279
|
+
/** Generated IDs can opt into collision allocation under the lock; retries retain the existing target identity. */
|
|
280
|
+
export declare function registerTemplateInstances(workspaceDir: string, drafts: TemplateInstanceDraft[], precondition?: (registry: TemplateInstanceRegistry) => Promise<void>, options?: TemplateInstanceRegistrationOptions): Promise<TemplateInstance[]>;
|
|
281
|
+
//#endregion
|
|
282
|
+
//#region src/instances/workspace.d.ts
|
|
283
|
+
/** Call after all scaffold and root-manifest transformations have succeeded. */
|
|
284
|
+
export declare function recordWorkspaceTemplateInstances(workspaceDir: string, templateKeys: string[], templatesDir?: string, originals?: Map<string, PreparedTemplateSource>): Promise<TemplateInstance[]>;
|
|
285
|
+
//#endregion
|
|
286
|
+
//#region src/parameters/types.d.ts
|
|
287
|
+
type TemplateParameterValue = string | boolean;
|
|
288
|
+
interface ParameterDetails {
|
|
289
|
+
description?: string;
|
|
290
|
+
required?: boolean;
|
|
291
|
+
}
|
|
292
|
+
type TemplateParameterDefinition = ParameterDetails & ({
|
|
293
|
+
type: 'string';
|
|
294
|
+
default?: string;
|
|
295
|
+
sensitive?: boolean;
|
|
296
|
+
} | {
|
|
297
|
+
type: 'boolean';
|
|
298
|
+
default?: boolean;
|
|
299
|
+
sensitive?: false;
|
|
300
|
+
} | {
|
|
301
|
+
type: 'enum';
|
|
302
|
+
options: string[];
|
|
303
|
+
default?: string;
|
|
304
|
+
sensitive?: false;
|
|
305
|
+
});
|
|
306
|
+
type TemplateParameterSchema = Record<string, TemplateParameterDefinition>;
|
|
307
|
+
type TemplateParameterValues = Record<string, TemplateParameterValue>;
|
|
308
|
+
interface ResolvedTemplateParameters {
|
|
309
|
+
/** For rendering only. Never put this object in a log or persisted report. */
|
|
310
|
+
values: TemplateParameterValues;
|
|
311
|
+
report: TemplateParameterValues;
|
|
312
|
+
retained: TemplateParameterValues;
|
|
313
|
+
sensitive: string[];
|
|
314
|
+
}
|
|
315
|
+
interface TemplateParameterCondition {
|
|
316
|
+
parameter: string;
|
|
317
|
+
equals: TemplateParameterValue;
|
|
318
|
+
}
|
|
319
|
+
interface TemplateConditionalFiles {
|
|
320
|
+
when: TemplateParameterCondition;
|
|
321
|
+
/** Exact source-relative file or directory paths, without expressions or globs. */
|
|
322
|
+
files?: string[];
|
|
323
|
+
package?: Partial<Record<'scripts' | 'dependencies' | 'devDependencies' | 'peerDependencies' | 'optionalDependencies', Record<string, string>>>;
|
|
324
|
+
}
|
|
325
|
+
/** Optional repoctl.template.json inside a template source directory. */
|
|
326
|
+
interface TemplateParameterManifest {
|
|
327
|
+
schemaVersion: 1;
|
|
328
|
+
parameters: TemplateParameterSchema;
|
|
329
|
+
/** Only these UTF-8 text files expand {{repoctl:name}} or {{repoctl-json:name}}. */
|
|
330
|
+
interpolate?: string[];
|
|
331
|
+
conditions?: TemplateConditionalFiles[];
|
|
332
|
+
}
|
|
333
|
+
//#endregion
|
|
334
|
+
//#region src/parameters/manifest.d.ts
|
|
335
|
+
export declare const templateParameterManifestName = "repoctl.template.json";
|
|
336
|
+
export declare function parseTemplateParameterManifest(value: unknown): TemplateParameterManifest;
|
|
337
|
+
export declare function readTemplateParameterManifest(snapshot: TemplateSnapshot): TemplateParameterManifest | undefined;
|
|
338
|
+
//#endregion
|
|
339
|
+
//#region src/parameters/render.d.ts
|
|
340
|
+
interface TemplateParameterRender {
|
|
341
|
+
snapshot: TemplateSnapshot;
|
|
342
|
+
sensitivePaths: string[];
|
|
343
|
+
files: Array<{
|
|
344
|
+
path: string;
|
|
345
|
+
status: 'include' | 'omit';
|
|
346
|
+
sensitive: boolean;
|
|
347
|
+
}>;
|
|
348
|
+
package: Array<{
|
|
349
|
+
section: string;
|
|
350
|
+
name: string;
|
|
351
|
+
status: 'include' | 'omit';
|
|
352
|
+
}>;
|
|
353
|
+
}
|
|
354
|
+
/** Expand declared text only. Binary files and all undeclared files remain byte-for-byte identical. */
|
|
355
|
+
export declare function renderTemplateParameters(source: TemplateSnapshot, manifest: TemplateParameterManifest, parameters: ResolvedTemplateParameters): TemplateParameterRender;
|
|
356
|
+
//#endregion
|
|
357
|
+
//#region src/parameters/resolve.d.ts
|
|
358
|
+
/** The same strict, synchronous resolver serves prompts, JSON input and local generators. */
|
|
359
|
+
export declare function resolveTemplateParameters(schema: TemplateParameterSchema, input?: unknown): ResolvedTemplateParameters;
|
|
360
|
+
interface TemplateParameterPrompt {
|
|
361
|
+
(name: string, definition: TemplateParameterSchema[string]): Promise<TemplateParameterValue | undefined>;
|
|
362
|
+
}
|
|
363
|
+
/** Prompts only omitted inputs; supplied inputs are validated before any question is asked. */
|
|
364
|
+
export declare function promptTemplateParameters(schema: TemplateParameterSchema, input: unknown, prompt: TemplateParameterPrompt): Promise<ResolvedTemplateParameters>;
|
|
365
|
+
//#endregion
|
|
366
|
+
//#region src/parameters/schema.d.ts
|
|
367
|
+
export declare function validateTemplateParameterSchema(value: unknown): asserts value is TemplateParameterSchema;
|
|
368
|
+
//#endregion
|
|
89
369
|
//#region src/templates.d.ts
|
|
90
370
|
export declare const templateCategories: readonly ["app", "docs", "library", "service", "tool"];
|
|
91
371
|
export declare function isTemplateCategory(value: string): value is TemplateCategory;
|
|
@@ -106,4 +386,4 @@ export declare const templateSourceMap: Record<string, string>;
|
|
|
106
386
|
export declare const templateTargetMap: Record<string, string>;
|
|
107
387
|
export declare const templateMap: Record<string, string>;
|
|
108
388
|
//#endregion
|
|
109
|
-
export { Command, type GetTemplateChoicesOptions, type SuggestTemplateKeyOptions, type TemplateCategory, type TemplateChoice, type TemplateDefinition, checkbox, input, program, select };
|
|
389
|
+
export { Command, type GeneratedTemplateInstanceOptions, type GetTemplateChoicesOptions, type PreparedTemplateSource, type ResolvedTemplateParameters, type ResolvedTemplateRemoteSource, type SuggestTemplateKeyOptions, type TemplateCategory, type TemplateChoice, type TemplateConditionalFiles, type TemplateDefinition, type TemplateFileDifference, type TemplateGenerationParameters, type TemplateGenerationProfile, type TemplateInstance, type TemplateInstanceBaseline, type TemplateInstanceDraft, type TemplateInstanceInfo, type TemplateInstanceMovePlan, type TemplateInstanceRegistrationOptions, type TemplateInstanceRegistry, type TemplateInstanceReplacementHooks, type TemplateInstanceSource, type TemplateParameterCondition, type TemplateParameterDefinition, type TemplateParameterManifest, type TemplateParameterPrompt, type TemplateParameterRender, type TemplateParameterSchema, type TemplateParameterValue, type TemplateParameterValues, type TemplateRemoteSource, type TemplateSnapshot, type TemplateSnapshotFile, checkbox, input, password, program, select };
|