outfitter 0.2.2 → 0.2.3

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 (135) hide show
  1. package/README.md +215 -116
  2. package/dist/actions.d.ts +2 -0
  3. package/dist/actions.js +34 -0
  4. package/dist/cli.js +3 -1
  5. package/dist/commands/add.d.ts +54 -0
  6. package/dist/commands/add.js +16 -0
  7. package/dist/commands/check.d.ts +91 -0
  8. package/dist/commands/check.js +14 -0
  9. package/dist/commands/demo.d.ts +21 -0
  10. package/dist/commands/demo.js +8 -0
  11. package/dist/commands/docs-module-loader.d.ts +2 -0
  12. package/dist/commands/docs-module-loader.js +8 -0
  13. package/dist/commands/doctor.d.ts +2 -0
  14. package/dist/commands/doctor.js +13 -0
  15. package/dist/commands/init.d.ts +7 -0
  16. package/dist/commands/init.js +31 -0
  17. package/dist/commands/migrate-kit.d.ts +2 -0
  18. package/dist/commands/migrate-kit.js +15 -0
  19. package/dist/commands/repo.d.ts +3 -0
  20. package/dist/commands/repo.js +9 -0
  21. package/dist/commands/scaffold.d.ts +4 -0
  22. package/dist/commands/scaffold.js +31 -0
  23. package/dist/commands/shared-deps.d.ts +36 -0
  24. package/dist/commands/shared-deps.js +10 -0
  25. package/dist/commands/update-planner.d.ts +58 -0
  26. package/dist/commands/update-planner.js +8 -0
  27. package/dist/commands/update-workspace.d.ts +76 -0
  28. package/dist/commands/update-workspace.js +16 -0
  29. package/dist/commands/update.d.ts +113 -0
  30. package/dist/commands/update.js +21 -0
  31. package/dist/create/index.d.ts +5 -0
  32. package/dist/create/index.js +29 -0
  33. package/dist/create/planner.d.ts +3 -0
  34. package/dist/create/planner.js +21 -0
  35. package/dist/create/presets.d.ts +3 -0
  36. package/dist/create/presets.js +12 -0
  37. package/dist/create/types.d.ts +2 -0
  38. package/dist/create/types.js +1 -0
  39. package/dist/engine/blocks.d.ts +3 -0
  40. package/dist/engine/blocks.js +12 -0
  41. package/dist/engine/collector.d.ts +2 -0
  42. package/dist/engine/collector.js +8 -0
  43. package/dist/engine/config.d.ts +3 -0
  44. package/dist/engine/config.js +12 -0
  45. package/dist/engine/executor.d.ts +3 -0
  46. package/dist/engine/executor.js +16 -0
  47. package/dist/engine/index.d.ts +8 -0
  48. package/dist/engine/index.js +59 -0
  49. package/dist/engine/names.d.ts +2 -0
  50. package/dist/engine/names.js +16 -0
  51. package/dist/engine/post-scaffold.d.ts +3 -0
  52. package/dist/engine/post-scaffold.js +8 -0
  53. package/dist/engine/render-plan.d.ts +7 -0
  54. package/dist/engine/render-plan.js +9 -0
  55. package/dist/engine/template.d.ts +3 -0
  56. package/dist/engine/template.js +17 -0
  57. package/dist/engine/types.d.ts +2 -0
  58. package/dist/engine/types.js +8 -0
  59. package/dist/engine/workspace.d.ts +3 -0
  60. package/dist/engine/workspace.js +13 -0
  61. package/dist/index.d.ts +228 -152
  62. package/dist/index.js +144 -14
  63. package/dist/manifest.d.ts +71 -0
  64. package/dist/manifest.js +16 -0
  65. package/dist/output-mode.d.ts +2 -0
  66. package/dist/output-mode.js +10 -0
  67. package/dist/shared/chunk-b0y0cwkr.js +5533 -0
  68. package/dist/shared/outfitter-193jvzg4.d.ts +5 -0
  69. package/dist/shared/outfitter-1dd0k853.js +194 -0
  70. package/dist/shared/outfitter-1h7k8xxt.js +29 -0
  71. package/dist/shared/outfitter-1qwpjt6w.js +125 -0
  72. package/dist/shared/outfitter-2ngep1h2.d.ts +5 -0
  73. package/dist/shared/outfitter-2np85etz.js +95 -0
  74. package/dist/shared/outfitter-33w361tc.d.ts +18 -0
  75. package/dist/shared/outfitter-344t1r38.js +1 -0
  76. package/dist/shared/outfitter-3weh61w7.d.ts +25 -0
  77. package/dist/shared/outfitter-4s9meh3j.js +221 -0
  78. package/dist/shared/outfitter-6a4bq054.js +322 -0
  79. package/dist/shared/outfitter-6bkqjk86.d.ts +3 -0
  80. package/dist/shared/outfitter-6gc3g5wk.js +98 -0
  81. package/dist/shared/outfitter-7cv5fg1m.js +61 -0
  82. package/dist/shared/outfitter-7ha7p61k.d.ts +6 -0
  83. package/dist/shared/outfitter-7r12fj7f.js +30 -0
  84. package/dist/shared/outfitter-8y2dfx6n.js +11 -0
  85. package/dist/shared/outfitter-9c8edfsn.js +715 -0
  86. package/dist/shared/outfitter-9x1brcmq.js +184 -0
  87. package/dist/shared/outfitter-a79xrm12.d.ts +17 -0
  88. package/dist/shared/outfitter-amc4jbs1.d.ts +50 -0
  89. package/dist/shared/outfitter-ara3djt0.js +73 -0
  90. package/dist/shared/outfitter-avhm5z6w.js +82 -0
  91. package/dist/shared/outfitter-b5nd42y4.d.ts +45 -0
  92. package/dist/shared/outfitter-dd0btgec.d.ts +40 -0
  93. package/dist/shared/outfitter-e2zz5wv7.d.ts +51 -0
  94. package/dist/shared/outfitter-ehp18x1n.js +1 -0
  95. package/dist/shared/outfitter-fnsmx3xg.js +750 -0
  96. package/dist/shared/outfitter-gdvm5c0b.d.ts +4 -0
  97. package/dist/shared/outfitter-gp4v5gkf.js +322 -0
  98. package/dist/shared/outfitter-h1mnzzd1.d.ts +14 -0
  99. package/dist/shared/outfitter-hpymx4m9.js +184 -0
  100. package/dist/shared/outfitter-hvsaxgcp.js +1 -0
  101. package/dist/shared/outfitter-j8yc7294.d.ts +22 -0
  102. package/dist/shared/outfitter-jyxwznk1.js +404 -0
  103. package/dist/shared/outfitter-k112c427.js +21 -0
  104. package/dist/shared/outfitter-k56rmt24.d.ts +30 -0
  105. package/dist/shared/outfitter-ksa1pp4t.d.ts +4 -0
  106. package/dist/shared/outfitter-mdt37hqm.js +4 -0
  107. package/dist/shared/outfitter-mtbpabf3.js +91 -0
  108. package/dist/shared/outfitter-nm4m0v6x.d.ts +131 -0
  109. package/dist/shared/outfitter-nmeecf1b.js +531 -0
  110. package/dist/shared/outfitter-npyfbdmc.d.ts +6 -0
  111. package/dist/shared/outfitter-pxt58tsq.js +582 -0
  112. package/dist/shared/outfitter-q9agarmb.js +42 -0
  113. package/dist/shared/outfitter-qfgj5xpq.js +70 -0
  114. package/dist/shared/outfitter-qfh36ddg.d.ts +66 -0
  115. package/dist/shared/outfitter-s6k8y2p4.js +269 -0
  116. package/dist/shared/outfitter-sftf1s26.js +199 -0
  117. package/dist/shared/outfitter-sg7ncy4a.d.ts +51 -0
  118. package/dist/shared/outfitter-sgtq57qr.d.ts +5 -0
  119. package/dist/shared/outfitter-txre6cdn.d.ts +60 -0
  120. package/dist/shared/outfitter-vh4xgb93.js +35 -0
  121. package/dist/shared/outfitter-ya44h1km.js +191 -0
  122. package/dist/shared/outfitter-zwyvewr1.js +36 -0
  123. package/dist/targets/index.d.ts +4 -0
  124. package/dist/targets/index.js +29 -0
  125. package/dist/targets/registry.d.ts +3 -0
  126. package/dist/targets/registry.js +28 -0
  127. package/dist/targets/types.d.ts +2 -0
  128. package/dist/targets/types.js +1 -0
  129. package/package.json +154 -37
  130. package/templates/minimal/.gitignore.template +30 -0
  131. package/templates/minimal/.lefthook.yml.template +26 -0
  132. package/templates/minimal/package.json.template +46 -0
  133. package/templates/minimal/src/index.ts.template +26 -0
  134. package/templates/minimal/tsconfig.json.template +34 -0
  135. package/dist/shared/chunk-sak1tt33.js +0 -3457
@@ -0,0 +1,184 @@
1
+ // @bun
2
+ import {
3
+ ScaffoldError
4
+ } from "./outfitter-8y2dfx6n.js";
5
+
6
+ // apps/outfitter/src/engine/template.ts
7
+ import {
8
+ existsSync,
9
+ mkdirSync,
10
+ readdirSync,
11
+ readFileSync,
12
+ statSync,
13
+ writeFileSync
14
+ } from "fs";
15
+ import { dirname, extname, join } from "path";
16
+ import { fileURLToPath } from "url";
17
+ import { Result } from "@outfitter/contracts";
18
+ var BINARY_EXTENSIONS = new Set([
19
+ ".png",
20
+ ".jpg",
21
+ ".jpeg",
22
+ ".gif",
23
+ ".ico",
24
+ ".webp",
25
+ ".bmp",
26
+ ".tiff",
27
+ ".svg",
28
+ ".woff",
29
+ ".woff2",
30
+ ".ttf",
31
+ ".otf",
32
+ ".eot",
33
+ ".mp3",
34
+ ".mp4",
35
+ ".wav",
36
+ ".ogg",
37
+ ".webm",
38
+ ".zip",
39
+ ".tar",
40
+ ".gz",
41
+ ".bz2",
42
+ ".7z",
43
+ ".pdf",
44
+ ".exe",
45
+ ".dll",
46
+ ".so",
47
+ ".dylib",
48
+ ".node",
49
+ ".wasm",
50
+ ".bin",
51
+ ".dat",
52
+ ".db",
53
+ ".sqlite",
54
+ ".sqlite3"
55
+ ]);
56
+ function hasOutfitterPackage(dir) {
57
+ const packageJsonPath = join(dir, "package.json");
58
+ if (!existsSync(packageJsonPath)) {
59
+ return false;
60
+ }
61
+ try {
62
+ const content = readFileSync(packageJsonPath, "utf-8");
63
+ const parsed = JSON.parse(content);
64
+ return parsed.name === "outfitter";
65
+ } catch {
66
+ return false;
67
+ }
68
+ }
69
+ function getTemplatesDir() {
70
+ let currentDir = dirname(fileURLToPath(import.meta.url));
71
+ for (let i = 0;i < 10; i++) {
72
+ const templatesPath = join(currentDir, "templates");
73
+ if (existsSync(templatesPath) && hasOutfitterPackage(currentDir)) {
74
+ return templatesPath;
75
+ }
76
+ currentDir = dirname(currentDir);
77
+ }
78
+ const fallback = join(process.cwd(), "apps/outfitter/templates");
79
+ if (existsSync(fallback)) {
80
+ return fallback;
81
+ }
82
+ return join(process.cwd(), "templates");
83
+ }
84
+ function getOutputFilename(templateFilename) {
85
+ return templateFilename.endsWith(".template") ? templateFilename.slice(0, -".template".length) : templateFilename;
86
+ }
87
+ function isBinaryFile(filename) {
88
+ return BINARY_EXTENSIONS.has(extname(filename).toLowerCase());
89
+ }
90
+ function replacePlaceholders(content, values) {
91
+ return content.replace(/\{\{(\w+)\}\}/g, (match, key) => {
92
+ if (Object.hasOwn(values, key)) {
93
+ return values[key];
94
+ }
95
+ return match;
96
+ });
97
+ }
98
+ function copyTemplateFiles(templateDir, targetDir, values, options, copyOptions) {
99
+ const allowOverwrite = copyOptions?.allowOverwrite ?? false;
100
+ const relativePrefix = copyOptions?.relativePrefix ?? "";
101
+ try {
102
+ if (!existsSync(targetDir)) {
103
+ if (options.collector) {
104
+ options.collector.add({
105
+ type: "dir-create",
106
+ path: targetDir
107
+ });
108
+ } else {
109
+ mkdirSync(targetDir, { recursive: true });
110
+ }
111
+ }
112
+ const entries = readdirSync(templateDir);
113
+ for (const entry of entries) {
114
+ const sourcePath = join(templateDir, entry);
115
+ const sourceStat = statSync(sourcePath);
116
+ const relativePath = relativePrefix ? `${relativePrefix}/${entry}` : entry;
117
+ if (copyOptions?.skipFilter?.(relativePath)) {
118
+ continue;
119
+ }
120
+ if (sourceStat.isDirectory()) {
121
+ const targetSubDir = join(targetDir, entry);
122
+ const nestedResult = copyTemplateFiles(sourcePath, targetSubDir, values, options, {
123
+ ...copyOptions,
124
+ relativePrefix: relativePath
125
+ });
126
+ if (nestedResult.isErr()) {
127
+ return nestedResult;
128
+ }
129
+ continue;
130
+ }
131
+ if (!sourceStat.isFile()) {
132
+ continue;
133
+ }
134
+ const outputFilename = getOutputFilename(entry);
135
+ const targetPath = join(targetDir, outputFilename);
136
+ const targetExists = existsSync(targetPath);
137
+ const canOverlay = allowOverwrite && (!targetExists || Boolean(copyOptions?.overwritablePaths?.has(targetPath)));
138
+ if (targetExists && !options.force && !canOverlay) {
139
+ if (options.collector) {
140
+ options.collector.add({
141
+ type: "file-skip",
142
+ path: targetPath,
143
+ reason: "exists"
144
+ });
145
+ continue;
146
+ }
147
+ return Result.err(new ScaffoldError(`File '${targetPath}' already exists. Use --force to overwrite.`));
148
+ }
149
+ if (options.collector) {
150
+ if (targetExists) {
151
+ options.collector.add({
152
+ type: "file-overwrite",
153
+ path: targetPath,
154
+ source: "template"
155
+ });
156
+ } else {
157
+ options.collector.add({
158
+ type: "file-create",
159
+ path: targetPath,
160
+ source: "template"
161
+ });
162
+ }
163
+ copyOptions?.writtenPaths?.add(targetPath);
164
+ continue;
165
+ }
166
+ if (isBinaryFile(outputFilename)) {
167
+ const buffer = readFileSync(sourcePath);
168
+ writeFileSync(targetPath, buffer);
169
+ copyOptions?.writtenPaths?.add(targetPath);
170
+ continue;
171
+ }
172
+ const content = readFileSync(sourcePath, "utf-8");
173
+ const processedContent = replacePlaceholders(content, values);
174
+ writeFileSync(targetPath, processedContent, "utf-8");
175
+ copyOptions?.writtenPaths?.add(targetPath);
176
+ }
177
+ return Result.ok(undefined);
178
+ } catch (error) {
179
+ const message = error instanceof Error ? error.message : "Unknown error";
180
+ return Result.err(new ScaffoldError(`Failed to copy template files: ${message}`));
181
+ }
182
+ }
183
+
184
+ export { getTemplatesDir, getOutputFilename, isBinaryFile, replacePlaceholders, copyTemplateFiles };
@@ -0,0 +1,17 @@
1
+ import { OutputMode } from "@outfitter/cli/types";
2
+ type StructuredOutputMode = Extract<OutputMode, "json" | "jsonl">;
3
+ /** Output modes resolvable from CLI flags and env vars. */
4
+ type CliOutputMode = "human" | "json" | "jsonl";
5
+ /**
6
+ * Resolve output mode from CLI context (flags + env vars).
7
+ *
8
+ * Precedence: explicit flag > OUTFITTER_JSONL env > OUTFITTER_JSON env > "human"
9
+ *
10
+ * This function is pure -- no env var side effects.
11
+ */
12
+ declare function resolveOutputModeFromContext(flags: Record<string, unknown>): CliOutputMode;
13
+ /**
14
+ * Resolve machine-readable output mode from explicit options first, then env.
15
+ */
16
+ declare function resolveStructuredOutputMode(mode?: OutputMode): StructuredOutputMode | undefined;
17
+ export { StructuredOutputMode, CliOutputMode, resolveOutputModeFromContext, resolveStructuredOutputMode };
@@ -0,0 +1,50 @@
1
+ type Operation = {
2
+ readonly type: "file-create";
3
+ readonly path: string;
4
+ readonly source: "template" | "block" | "generated";
5
+ } | {
6
+ readonly type: "file-overwrite";
7
+ readonly path: string;
8
+ readonly source: "template" | "block" | "generated";
9
+ } | {
10
+ readonly type: "file-skip";
11
+ readonly path: string;
12
+ readonly reason: string;
13
+ } | {
14
+ readonly type: "dir-create";
15
+ readonly path: string;
16
+ } | {
17
+ readonly type: "dependency-add";
18
+ readonly name: string;
19
+ readonly version: string;
20
+ readonly section: "dependencies" | "devDependencies" | "peerDependencies";
21
+ } | {
22
+ readonly type: "block-add";
23
+ readonly name: string;
24
+ readonly files: readonly string[];
25
+ } | {
26
+ readonly type: "config-inject";
27
+ readonly target: string;
28
+ readonly description: string;
29
+ } | {
30
+ readonly type: "git";
31
+ readonly action: "init" | "add-all" | "commit";
32
+ readonly cwd: string;
33
+ readonly message?: string | undefined;
34
+ } | {
35
+ readonly type: "install";
36
+ readonly command: string;
37
+ readonly cwd: string;
38
+ };
39
+ declare class OperationCollector {
40
+ private readonly operations;
41
+ add(op: Operation): void;
42
+ getOperations(): readonly Operation[];
43
+ countByType(): Record<string, number>;
44
+ isEmpty(): boolean;
45
+ toJSON(): {
46
+ operations: readonly Operation[];
47
+ summary: Record<string, number>;
48
+ };
49
+ }
50
+ export { Operation, OperationCollector };
@@ -0,0 +1,73 @@
1
+ // @bun
2
+ import {
3
+ SHARED_DEV_DEPS,
4
+ SHARED_SCRIPTS
5
+ } from "./outfitter-k112c427.js";
6
+ import {
7
+ ScaffoldError
8
+ } from "./outfitter-8y2dfx6n.js";
9
+
10
+ // apps/outfitter/src/engine/config.ts
11
+ import { existsSync, readFileSync, writeFileSync } from "fs";
12
+ import { join } from "path";
13
+ import { Result } from "@outfitter/contracts";
14
+ var DEPENDENCY_SECTIONS = [
15
+ "dependencies",
16
+ "devDependencies",
17
+ "peerDependencies",
18
+ "optionalDependencies"
19
+ ];
20
+ function injectSharedConfig(targetDir) {
21
+ const packageJsonPath = join(targetDir, "package.json");
22
+ if (!existsSync(packageJsonPath)) {
23
+ return Result.ok(undefined);
24
+ }
25
+ try {
26
+ const content = readFileSync(packageJsonPath, "utf-8");
27
+ const parsed = JSON.parse(content);
28
+ const existingDevDeps = parsed["devDependencies"] ?? {};
29
+ parsed["devDependencies"] = { ...SHARED_DEV_DEPS, ...existingDevDeps };
30
+ const existingScripts = parsed["scripts"] ?? {};
31
+ parsed["scripts"] = { ...SHARED_SCRIPTS, ...existingScripts };
32
+ writeFileSync(packageJsonPath, `${JSON.stringify(parsed, null, 2)}
33
+ `, "utf-8");
34
+ return Result.ok(undefined);
35
+ } catch (error) {
36
+ const message = error instanceof Error ? error.message : "Unknown error";
37
+ return Result.err(new ScaffoldError(`Failed to inject shared config: ${message}`));
38
+ }
39
+ }
40
+ function rewriteLocalDependencies(targetDir) {
41
+ const packageJsonPath = join(targetDir, "package.json");
42
+ if (!existsSync(packageJsonPath)) {
43
+ return Result.ok(undefined);
44
+ }
45
+ try {
46
+ const content = readFileSync(packageJsonPath, "utf-8");
47
+ const parsed = JSON.parse(content);
48
+ let updated = false;
49
+ for (const section of DEPENDENCY_SECTIONS) {
50
+ const deps = parsed[section];
51
+ if (!deps || typeof deps !== "object" || Array.isArray(deps)) {
52
+ continue;
53
+ }
54
+ const entries = deps;
55
+ for (const [name, version] of Object.entries(entries)) {
56
+ if (typeof version === "string" && name.startsWith("@outfitter/") && version !== "workspace:*") {
57
+ entries[name] = "workspace:*";
58
+ updated = true;
59
+ }
60
+ }
61
+ }
62
+ if (updated) {
63
+ writeFileSync(packageJsonPath, `${JSON.stringify(parsed, null, 2)}
64
+ `, "utf-8");
65
+ }
66
+ return Result.ok(undefined);
67
+ } catch (error) {
68
+ const message = error instanceof Error ? error.message : "Unknown error";
69
+ return Result.err(new ScaffoldError(`Failed to update local dependencies: ${message}`));
70
+ }
71
+ }
72
+
73
+ export { injectSharedConfig, rewriteLocalDependencies };
@@ -0,0 +1,82 @@
1
+ // @bun
2
+ import {
3
+ getCreatePreset
4
+ } from "./outfitter-vh4xgb93.js";
5
+ import {
6
+ deriveBinName,
7
+ deriveProjectName
8
+ } from "./outfitter-q9agarmb.js";
9
+
10
+ // apps/outfitter/src/create/planner.ts
11
+ import { Result, ValidationError } from "@outfitter/contracts";
12
+ function derivePackageName(input) {
13
+ return (input.packageName ?? input.name).trim();
14
+ }
15
+ function planCreateProject(input) {
16
+ const packageName = derivePackageName(input);
17
+ if (packageName.length === 0) {
18
+ return Result.err(new ValidationError({
19
+ message: "Project name must not be empty",
20
+ field: "name"
21
+ }));
22
+ }
23
+ const targetDir = input.targetDir.trim();
24
+ if (targetDir.length === 0) {
25
+ return Result.err(new ValidationError({
26
+ message: "Target directory must not be empty",
27
+ field: "targetDir"
28
+ }));
29
+ }
30
+ if (packageName.startsWith("@") && !packageName.includes("/")) {
31
+ return Result.err(new ValidationError({
32
+ message: "Could not derive a project name from package name",
33
+ field: "packageName"
34
+ }));
35
+ }
36
+ const projectName = deriveProjectName(packageName);
37
+ if (projectName.length === 0) {
38
+ return Result.err(new ValidationError({
39
+ message: "Could not derive a project name from package name",
40
+ field: "packageName"
41
+ }));
42
+ }
43
+ const preset = getCreatePreset(input.preset);
44
+ if (!preset) {
45
+ return Result.err(new ValidationError({
46
+ message: `Unknown create preset '${input.preset}'`,
47
+ field: "preset"
48
+ }));
49
+ }
50
+ const includeTooling = input.includeTooling ?? true;
51
+ const defaultBlocks = includeTooling ? [...preset.defaultBlocks] : [];
52
+ const changes = [
53
+ {
54
+ type: "copy-template",
55
+ template: preset.template,
56
+ targetDir,
57
+ overlayBaseTemplate: true
58
+ },
59
+ { type: "inject-shared-config" }
60
+ ];
61
+ if (input.local) {
62
+ changes.push({ type: "rewrite-local-dependencies", mode: "workspace" });
63
+ }
64
+ if (defaultBlocks.length > 0) {
65
+ changes.push({ type: "add-blocks", blocks: defaultBlocks });
66
+ }
67
+ const plan = {
68
+ preset,
69
+ values: {
70
+ packageName,
71
+ projectName,
72
+ version: input.version?.trim() || "0.1.0",
73
+ description: input.description?.trim() || "A new project created with Outfitter",
74
+ binName: deriveBinName(projectName),
75
+ year: input.year ?? String(new Date().getFullYear())
76
+ },
77
+ changes
78
+ };
79
+ return Result.ok(plan);
80
+ }
81
+
82
+ export { planCreateProject };
@@ -0,0 +1,45 @@
1
+ import { PostScaffoldResult } from "./outfitter-3weh61w7";
2
+ import { OutputMode } from "@outfitter/cli/types";
3
+ import { Result } from "@outfitter/contracts";
4
+ import { AddBlockResult } from "@outfitter/tooling";
5
+ import { Command } from "commander";
6
+ interface ScaffoldOptions {
7
+ readonly target: string;
8
+ readonly name?: string | undefined;
9
+ readonly force: boolean;
10
+ readonly skipInstall: boolean;
11
+ readonly dryRun: boolean;
12
+ readonly with?: string | undefined;
13
+ readonly noTooling?: boolean | undefined;
14
+ readonly local?: boolean | undefined;
15
+ readonly cwd: string;
16
+ readonly installTimeout?: number | undefined;
17
+ }
18
+ interface ScaffoldCommandResult {
19
+ readonly target: string;
20
+ readonly rootDir: string;
21
+ readonly targetDir: string;
22
+ readonly converted: boolean;
23
+ readonly movedExisting?: {
24
+ readonly from: string;
25
+ readonly to: string;
26
+ readonly name: string;
27
+ } | undefined;
28
+ readonly workspacePatternsUpdated: boolean;
29
+ readonly blocksAdded?: AddBlockResult | undefined;
30
+ readonly postScaffold: PostScaffoldResult;
31
+ readonly dryRunPlan?: {
32
+ readonly operations: readonly unknown[];
33
+ readonly summary: Record<string, number>;
34
+ } | undefined;
35
+ }
36
+ declare class ScaffoldCommandError extends Error {
37
+ readonly _tag: "ScaffoldCommandError";
38
+ constructor(message: string);
39
+ }
40
+ declare function runScaffold(options: ScaffoldOptions): Promise<Result<ScaffoldCommandResult, ScaffoldCommandError>>;
41
+ declare function printScaffoldResults(result: ScaffoldCommandResult, options?: {
42
+ readonly mode?: OutputMode;
43
+ }): Promise<void>;
44
+ declare function scaffoldCommand(program: Command): void;
45
+ export { ScaffoldOptions, ScaffoldCommandResult, ScaffoldCommandError, runScaffold, printScaffoldResults, scaffoldCommand };
@@ -0,0 +1,40 @@
1
+ import { Command } from "commander";
2
+ type DocsMdxMode = "strict" | "lossy";
3
+ interface DocsBaseOptions {
4
+ readonly cwd?: string;
5
+ readonly workspaceRoot?: string;
6
+ readonly packagesDir?: string;
7
+ readonly outputDir?: string;
8
+ readonly excludedFilenames?: readonly string[];
9
+ readonly mdxMode?: DocsMdxMode;
10
+ }
11
+ interface ExecuteCheckCommandOptions extends DocsBaseOptions {}
12
+ interface ExecuteSyncCommandOptions extends DocsBaseOptions {}
13
+ type DocsExportTarget = "packages" | "llms" | "llms-full" | "all";
14
+ interface ExecuteExportCommandOptions extends DocsBaseOptions {
15
+ readonly llmsFile?: string;
16
+ readonly llmsFullFile?: string;
17
+ readonly target?: DocsExportTarget | string;
18
+ }
19
+ interface DocsCommandIo {
20
+ readonly out: (line: string) => void;
21
+ readonly err: (line: string) => void;
22
+ }
23
+ interface CreateDocsCommandOptions {
24
+ readonly commandName?: string;
25
+ readonly io?: {
26
+ readonly out?: (line: string) => void;
27
+ readonly err?: (line: string) => void;
28
+ };
29
+ }
30
+ interface DocsModule {
31
+ createDocsCommand: (options?: CreateDocsCommandOptions) => Command;
32
+ executeCheckCommand: (options: ExecuteCheckCommandOptions, io: DocsCommandIo) => Promise<number>;
33
+ executeSyncCommand: (options: ExecuteSyncCommandOptions, io: DocsCommandIo) => Promise<number>;
34
+ executeExportCommand: (options: ExecuteExportCommandOptions, io: DocsCommandIo) => Promise<number>;
35
+ }
36
+ /**
37
+ * Load docs command module with source-first resolution in monorepo development.
38
+ */
39
+ declare function loadDocsModule(): Promise<DocsModule>;
40
+ export { ExecuteCheckCommandOptions, ExecuteSyncCommandOptions, DocsExportTarget, ExecuteExportCommandOptions, DocsCommandIo, CreateDocsCommandOptions, loadDocsModule };
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Create planner types for kit-first project scaffolding.
3
+ *
4
+ * These types model preset intent separately from execution so future flows can
5
+ * consume a deterministic plan before mutating the filesystem.
6
+ */
7
+ type CreatePresetId = "basic" | "cli" | "daemon" | "mcp";
8
+ interface CreatePresetDefinition {
9
+ readonly id: CreatePresetId;
10
+ readonly template: CreatePresetId;
11
+ readonly summary: string;
12
+ readonly defaultBlocks: readonly string[];
13
+ }
14
+ interface CreateProjectInput {
15
+ readonly name: string;
16
+ readonly targetDir: string;
17
+ readonly preset: CreatePresetId;
18
+ readonly packageName?: string;
19
+ readonly description?: string;
20
+ readonly version?: string;
21
+ readonly includeTooling?: boolean;
22
+ readonly local?: boolean;
23
+ readonly year?: string;
24
+ }
25
+ type CreatePlanChange = {
26
+ readonly type: "copy-template";
27
+ readonly template: string;
28
+ readonly targetDir: string;
29
+ readonly overlayBaseTemplate: boolean;
30
+ } | {
31
+ readonly type: "inject-shared-config";
32
+ } | {
33
+ readonly type: "rewrite-local-dependencies";
34
+ readonly mode: "workspace";
35
+ } | {
36
+ readonly type: "add-blocks";
37
+ readonly blocks: readonly string[];
38
+ };
39
+ interface CreateProjectPlan {
40
+ readonly preset: CreatePresetDefinition;
41
+ readonly values: {
42
+ readonly packageName: string;
43
+ readonly projectName: string;
44
+ readonly version: string;
45
+ readonly description: string;
46
+ readonly binName: string;
47
+ readonly year: string;
48
+ };
49
+ readonly changes: readonly CreatePlanChange[];
50
+ }
51
+ export { CreatePresetId, CreatePresetDefinition, CreateProjectInput, CreatePlanChange, CreateProjectPlan };
@@ -0,0 +1 @@
1
+ // @bun