@canonical/summon 0.17.1 → 0.21.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/generators/example/hello/index.ts +3 -9
- package/generators/example/webapp/index.ts +7 -5
- package/generators/init/index.ts +3 -8
- package/generators/init/templates/generator.ts.ejs +3 -9
- package/package.json +25 -27
- package/src/bin.tsx +199 -0
- package/src/completion.test.ts +202 -0
- package/src/completion.ts +4 -1
- package/src/components/App.tsx +108 -15
- package/src/components/ExecutionProgress.tsx +8 -4
- package/src/components/FileTreePreview.tsx +1 -1
- package/src/components/PromptSequence.tsx +1 -1
- package/src/discovery/index.ts +1 -0
- package/src/discovery/loadGenerator.ts +37 -0
- package/src/display/index.ts +2 -0
- package/src/display/printGeneratorHelp.ts +128 -0
- package/src/display/printNode.ts +76 -0
- package/src/registration/buildCommandBarrel.ts +57 -0
- package/src/registration/index.ts +3 -0
- package/src/registration/registerFromBarrel.tsx +548 -0
- package/src/registration/types.ts +28 -0
- package/README.md +0 -446
- package/src/__tests__/combinators.test.ts +0 -895
- package/src/__tests__/dry-run.test.ts +0 -927
- package/src/__tests__/effect.test.ts +0 -816
- package/src/__tests__/interpreter.test.ts +0 -673
- package/src/__tests__/primitives.test.ts +0 -970
- package/src/__tests__/task.test.ts +0 -929
- package/src/__tests__/template.test.ts +0 -666
- package/src/cli-format.ts +0 -236
- package/src/cli-types.ts +0 -53
- package/src/cli.tsx +0 -1366
- package/src/combinators.ts +0 -294
- package/src/dry-run.ts +0 -434
- package/src/effect.ts +0 -224
- package/src/index.ts +0 -266
- package/src/interpreter.ts +0 -463
- package/src/primitives.ts +0 -442
- package/src/task.ts +0 -245
- package/src/template.ts +0 -537
- package/src/types.ts +0 -453
package/src/index.ts
DELETED
|
@@ -1,266 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Summon - A Monadic Task-Centric Code Generator Framework
|
|
3
|
-
*
|
|
4
|
-
* @packageDocumentation
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
// =============================================================================
|
|
8
|
-
// Core Types
|
|
9
|
-
// =============================================================================
|
|
10
|
-
|
|
11
|
-
export type {
|
|
12
|
-
// Generator types
|
|
13
|
-
AnyGenerator,
|
|
14
|
-
ConfirmPrompt,
|
|
15
|
-
// Result types
|
|
16
|
-
DryRunResult,
|
|
17
|
-
Effect,
|
|
18
|
-
ExecResult,
|
|
19
|
-
GeneratorDefinition,
|
|
20
|
-
GeneratorMeta,
|
|
21
|
-
LogLevel,
|
|
22
|
-
MultiselectPrompt,
|
|
23
|
-
PromptDefinition,
|
|
24
|
-
// Prompt types
|
|
25
|
-
PromptQuestion,
|
|
26
|
-
PromptQuestionBase,
|
|
27
|
-
SelectPrompt,
|
|
28
|
-
// Task and Effect types
|
|
29
|
-
Task,
|
|
30
|
-
TaskError,
|
|
31
|
-
// Event types
|
|
32
|
-
TaskEvent,
|
|
33
|
-
TextPrompt,
|
|
34
|
-
TraceResult,
|
|
35
|
-
TraceSpan,
|
|
36
|
-
} from "./types.js";
|
|
37
|
-
|
|
38
|
-
// =============================================================================
|
|
39
|
-
// Task Monad
|
|
40
|
-
// =============================================================================
|
|
41
|
-
|
|
42
|
-
export {
|
|
43
|
-
ap,
|
|
44
|
-
effect,
|
|
45
|
-
fail,
|
|
46
|
-
failWith,
|
|
47
|
-
// Monad operations
|
|
48
|
-
flatMap,
|
|
49
|
-
hasEffects,
|
|
50
|
-
isFailed,
|
|
51
|
-
// Utilities
|
|
52
|
-
isPure,
|
|
53
|
-
map,
|
|
54
|
-
mapError,
|
|
55
|
-
of,
|
|
56
|
-
// Core constructors
|
|
57
|
-
pure,
|
|
58
|
-
recover,
|
|
59
|
-
// Fluent builder
|
|
60
|
-
TaskBuilder,
|
|
61
|
-
task,
|
|
62
|
-
} from "./task.js";
|
|
63
|
-
|
|
64
|
-
// =============================================================================
|
|
65
|
-
// Effects
|
|
66
|
-
// =============================================================================
|
|
67
|
-
|
|
68
|
-
export {
|
|
69
|
-
// File system effects
|
|
70
|
-
appendFileEffect,
|
|
71
|
-
copyDirectoryEffect,
|
|
72
|
-
copyFileEffect,
|
|
73
|
-
deleteDirectoryEffect,
|
|
74
|
-
deleteFileEffect,
|
|
75
|
-
// Utilities
|
|
76
|
-
describeEffect,
|
|
77
|
-
// Process effects
|
|
78
|
-
execEffect,
|
|
79
|
-
existsEffect,
|
|
80
|
-
getAffectedPaths,
|
|
81
|
-
globEffect,
|
|
82
|
-
isWriteEffect,
|
|
83
|
-
// Logging effects
|
|
84
|
-
logEffect,
|
|
85
|
-
makeDirEffect,
|
|
86
|
-
// Concurrency effects
|
|
87
|
-
parallelEffect,
|
|
88
|
-
// Prompt effects
|
|
89
|
-
promptEffect,
|
|
90
|
-
raceEffect,
|
|
91
|
-
// Context effects
|
|
92
|
-
readContextEffect,
|
|
93
|
-
readFileEffect,
|
|
94
|
-
writeContextEffect,
|
|
95
|
-
writeFileEffect,
|
|
96
|
-
} from "./effect.js";
|
|
97
|
-
|
|
98
|
-
// =============================================================================
|
|
99
|
-
// Primitives
|
|
100
|
-
// =============================================================================
|
|
101
|
-
|
|
102
|
-
export type { SortFileLinesOptions } from "./primitives.js";
|
|
103
|
-
export {
|
|
104
|
-
// File system primitives
|
|
105
|
-
appendFile,
|
|
106
|
-
copyDirectory,
|
|
107
|
-
copyFile,
|
|
108
|
-
debug,
|
|
109
|
-
deleteDirectory,
|
|
110
|
-
deleteFile,
|
|
111
|
-
error,
|
|
112
|
-
// Process primitives
|
|
113
|
-
exec,
|
|
114
|
-
execSimple,
|
|
115
|
-
exists,
|
|
116
|
-
// Context primitives
|
|
117
|
-
getContext,
|
|
118
|
-
glob,
|
|
119
|
-
info,
|
|
120
|
-
// Logging primitives
|
|
121
|
-
log,
|
|
122
|
-
mkdir,
|
|
123
|
-
// Pure primitives
|
|
124
|
-
noop,
|
|
125
|
-
// Prompt primitives
|
|
126
|
-
prompt,
|
|
127
|
-
promptConfirm,
|
|
128
|
-
promptMultiselect,
|
|
129
|
-
promptSelect,
|
|
130
|
-
promptText,
|
|
131
|
-
readFile,
|
|
132
|
-
setContext,
|
|
133
|
-
// File transformation primitives
|
|
134
|
-
sortFileLines,
|
|
135
|
-
succeed,
|
|
136
|
-
warn,
|
|
137
|
-
withContext,
|
|
138
|
-
writeFile,
|
|
139
|
-
} from "./primitives.js";
|
|
140
|
-
|
|
141
|
-
// =============================================================================
|
|
142
|
-
// Combinators
|
|
143
|
-
// =============================================================================
|
|
144
|
-
|
|
145
|
-
export {
|
|
146
|
-
attempt,
|
|
147
|
-
// Resource management
|
|
148
|
-
bracket,
|
|
149
|
-
delay,
|
|
150
|
-
ensure,
|
|
151
|
-
fold,
|
|
152
|
-
ifElse,
|
|
153
|
-
ifElseM,
|
|
154
|
-
optional,
|
|
155
|
-
orElse,
|
|
156
|
-
// Parallelism
|
|
157
|
-
parallel,
|
|
158
|
-
parallelN,
|
|
159
|
-
race,
|
|
160
|
-
// Error handling
|
|
161
|
-
retry,
|
|
162
|
-
retryWithBackoff,
|
|
163
|
-
// Sequencing
|
|
164
|
-
sequence,
|
|
165
|
-
sequence_,
|
|
166
|
-
// Utilities
|
|
167
|
-
tap,
|
|
168
|
-
tapError,
|
|
169
|
-
timeout,
|
|
170
|
-
traverse,
|
|
171
|
-
traverse_,
|
|
172
|
-
unless,
|
|
173
|
-
// Conditionals
|
|
174
|
-
when,
|
|
175
|
-
whenM,
|
|
176
|
-
zip,
|
|
177
|
-
zip3,
|
|
178
|
-
} from "./combinators.js";
|
|
179
|
-
|
|
180
|
-
// =============================================================================
|
|
181
|
-
// Interpreter
|
|
182
|
-
// =============================================================================
|
|
183
|
-
|
|
184
|
-
export type { RunTaskOptions, StampConfig } from "./interpreter.js";
|
|
185
|
-
export {
|
|
186
|
-
executeEffect,
|
|
187
|
-
run,
|
|
188
|
-
runTask,
|
|
189
|
-
TaskExecutionError,
|
|
190
|
-
} from "./interpreter.js";
|
|
191
|
-
|
|
192
|
-
// =============================================================================
|
|
193
|
-
// Dry-Run
|
|
194
|
-
// =============================================================================
|
|
195
|
-
|
|
196
|
-
export {
|
|
197
|
-
// Test utilities
|
|
198
|
-
assertEffects,
|
|
199
|
-
assertFileWrites,
|
|
200
|
-
collectEffects,
|
|
201
|
-
countEffects,
|
|
202
|
-
dryRun,
|
|
203
|
-
dryRunWith,
|
|
204
|
-
expectTask,
|
|
205
|
-
filterEffects,
|
|
206
|
-
getAffectedFiles,
|
|
207
|
-
getFileWrites,
|
|
208
|
-
mockEffect,
|
|
209
|
-
} from "./dry-run.js";
|
|
210
|
-
|
|
211
|
-
// =============================================================================
|
|
212
|
-
// Templates
|
|
213
|
-
// =============================================================================
|
|
214
|
-
|
|
215
|
-
export type {
|
|
216
|
-
StampOptions,
|
|
217
|
-
TemplateDirOptions,
|
|
218
|
-
TemplateOptions,
|
|
219
|
-
TemplatingEngine,
|
|
220
|
-
} from "./template.js";
|
|
221
|
-
export {
|
|
222
|
-
// Templating engine
|
|
223
|
-
ejsEngine,
|
|
224
|
-
// Stamp utilities
|
|
225
|
-
generateStamp,
|
|
226
|
-
// Metadata
|
|
227
|
-
generatorComment,
|
|
228
|
-
generatorHtmlComment,
|
|
229
|
-
prependStamp,
|
|
230
|
-
renderFile,
|
|
231
|
-
// Template rendering
|
|
232
|
-
renderString,
|
|
233
|
-
renderStringAsync,
|
|
234
|
-
// Template tasks
|
|
235
|
-
template,
|
|
236
|
-
templateDir,
|
|
237
|
-
// Helpers
|
|
238
|
-
templateHelpers,
|
|
239
|
-
withHelpers,
|
|
240
|
-
} from "./template.js";
|
|
241
|
-
|
|
242
|
-
// =============================================================================
|
|
243
|
-
// Components (for custom CLI implementations)
|
|
244
|
-
// =============================================================================
|
|
245
|
-
|
|
246
|
-
export type {
|
|
247
|
-
AppProps,
|
|
248
|
-
AppState,
|
|
249
|
-
ExecutionProgressProps,
|
|
250
|
-
FileTreePreviewProps,
|
|
251
|
-
PromptSequenceProps,
|
|
252
|
-
SpinnerProps,
|
|
253
|
-
} from "./components/index.js";
|
|
254
|
-
export {
|
|
255
|
-
App,
|
|
256
|
-
ExecutionProgress,
|
|
257
|
-
FileTreePreview,
|
|
258
|
-
PromptSequence,
|
|
259
|
-
Spinner,
|
|
260
|
-
} from "./components/index.js";
|
|
261
|
-
|
|
262
|
-
// =============================================================================
|
|
263
|
-
// CLI Types (for generator authors)
|
|
264
|
-
// =============================================================================
|
|
265
|
-
|
|
266
|
-
export type { ForbidReserved, ReservedOption } from "./cli-types.js";
|