md-pipe 0.2.1 → 0.3.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/cli-contract.yaml +312 -0
- package/dist/generated/policy-runtime.d.ts +19 -19
- package/dist/generated/policy-runtime.js +28 -28
- package/dist/generated/policy-runtime.js.map +1 -1
- package/dist/generated/policy.d.ts +5 -5
- package/dist/generated/policy.js +12 -12
- package/dist/generated/policy.js.map +1 -1
- package/docs/cli-reference.md +400 -0
- package/docs/styling-guide.md +463 -0
- package/package.json +4 -2
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
cli_contracts: 0.1.0
|
|
2
|
+
|
|
3
|
+
info:
|
|
4
|
+
title: md-pipe
|
|
5
|
+
version: 0.3.0
|
|
6
|
+
description: >
|
|
7
|
+
A rendering engine that transforms Markdown manuscripts into HTML/PDF
|
|
8
|
+
through HTML-comment directives and DOM transformations,
|
|
9
|
+
without polluting the Markdown source.
|
|
10
|
+
|
|
11
|
+
artifact_slots:
|
|
12
|
+
markdown-source:
|
|
13
|
+
direction: read
|
|
14
|
+
description: Markdown manuscript files
|
|
15
|
+
config:
|
|
16
|
+
direction: read
|
|
17
|
+
description: md-pipe.config.yml project configuration
|
|
18
|
+
rendered-output:
|
|
19
|
+
direction: write
|
|
20
|
+
description: Rendered HTML/PDF output files
|
|
21
|
+
|
|
22
|
+
command_sets:
|
|
23
|
+
md-pipe:
|
|
24
|
+
summary: Extended Markdown rendering toolchain.
|
|
25
|
+
description: >
|
|
26
|
+
Converts HTML-comment directives into class/id/attribute-bearing HTML nodes,
|
|
27
|
+
embeds CSS, and produces HTML or PDF output.
|
|
28
|
+
Pipeline stages: preprocess → render → transform → html → pdf.
|
|
29
|
+
Use --pipeline to select which stage range to execute.
|
|
30
|
+
Config precedence: CLI args > frontmatter > project config > tool default.
|
|
31
|
+
|
|
32
|
+
env:
|
|
33
|
+
PUPPETEER_EXECUTABLE_PATH:
|
|
34
|
+
required: false
|
|
35
|
+
description: >
|
|
36
|
+
Explicitly specify the Chromium executable path.
|
|
37
|
+
When unset, auto-detects from Puppeteer cache and common install locations.
|
|
38
|
+
|
|
39
|
+
global_options:
|
|
40
|
+
- name: config
|
|
41
|
+
aliases: [c]
|
|
42
|
+
description: Path to the project config file. Auto-detects md-pipe.config.yml when omitted.
|
|
43
|
+
schema:
|
|
44
|
+
type: string
|
|
45
|
+
file:
|
|
46
|
+
mode: read
|
|
47
|
+
exists: true
|
|
48
|
+
media_type: text/yaml
|
|
49
|
+
|
|
50
|
+
- name: verbose
|
|
51
|
+
aliases: [v]
|
|
52
|
+
description: Enable verbose logging.
|
|
53
|
+
schema:
|
|
54
|
+
type: boolean
|
|
55
|
+
default: false
|
|
56
|
+
|
|
57
|
+
- name: strict
|
|
58
|
+
description: >
|
|
59
|
+
Treat undefined directives as errors.
|
|
60
|
+
Overrides the config strictDirectives setting.
|
|
61
|
+
Recommended for CI usage.
|
|
62
|
+
schema:
|
|
63
|
+
type: boolean
|
|
64
|
+
default: false
|
|
65
|
+
|
|
66
|
+
commands:
|
|
67
|
+
# ──────────────────────────────────────────────
|
|
68
|
+
# (default) — pipeline rendering
|
|
69
|
+
# Spec §17: md-pipe [input] [--pipeline [start.]end] [-o output]
|
|
70
|
+
# ──────────────────────────────────────────────
|
|
71
|
+
render:
|
|
72
|
+
summary: Render a Markdown file through the pipeline.
|
|
73
|
+
description: >
|
|
74
|
+
Execute the rendering pipeline on an input file or stdin.
|
|
75
|
+
Stages: preprocess → render → transform → html → pdf.
|
|
76
|
+
Use --pipeline to specify the execution range in [start.]end format;
|
|
77
|
+
omitting start begins from the .md source.
|
|
78
|
+
When --pipeline is omitted, the output format is inferred from
|
|
79
|
+
the -o extension (.html → html, .pdf → pdf), then from
|
|
80
|
+
frontmatter/config, defaulting to html.
|
|
81
|
+
Output is written to a file with -o, or to stdout when omitted.
|
|
82
|
+
usage:
|
|
83
|
+
- md-pipe <input> [-o output] [--pipeline [start.]end]
|
|
84
|
+
- md-pipe report.md -o dist/report.html
|
|
85
|
+
- md-pipe report.md --pipeline .pdf -o dist/report.pdf
|
|
86
|
+
- md-pipe report.rendered.html --pipeline render.html -o report.html
|
|
87
|
+
- cat report.md | md-pipe --pipeline .transform | md-pipe --pipeline transform.pdf -o report.pdf
|
|
88
|
+
path: []
|
|
89
|
+
arguments:
|
|
90
|
+
- name: input
|
|
91
|
+
index: 0
|
|
92
|
+
required: false
|
|
93
|
+
description: Input Markdown file. Reads from stdin when omitted.
|
|
94
|
+
schema:
|
|
95
|
+
type: string
|
|
96
|
+
file:
|
|
97
|
+
mode: read
|
|
98
|
+
exists: true
|
|
99
|
+
options:
|
|
100
|
+
- name: output
|
|
101
|
+
aliases: [o]
|
|
102
|
+
description: Output file path. Writes to stdout when omitted.
|
|
103
|
+
schema:
|
|
104
|
+
type: string
|
|
105
|
+
file:
|
|
106
|
+
mode: write
|
|
107
|
+
|
|
108
|
+
- name: pipeline
|
|
109
|
+
aliases: [p]
|
|
110
|
+
description: >
|
|
111
|
+
Pipeline range in [start.]end format.
|
|
112
|
+
Omitting start begins from the .md source.
|
|
113
|
+
Examples: .html (source→html), .pdf (source→pdf),
|
|
114
|
+
.render (source→render), render.html, transform.pdf, html.pdf.
|
|
115
|
+
When omitted, inferred from -o extension (.html → html, .pdf → pdf).
|
|
116
|
+
When -o is also omitted, follows frontmatter / config (default: html).
|
|
117
|
+
schema:
|
|
118
|
+
type: string
|
|
119
|
+
|
|
120
|
+
- name: theme
|
|
121
|
+
aliases: [t]
|
|
122
|
+
description: >
|
|
123
|
+
Theme name. Applies a preset defined in the project config themes section.
|
|
124
|
+
Overrides frontmatter theme setting.
|
|
125
|
+
schema:
|
|
126
|
+
type: string
|
|
127
|
+
|
|
128
|
+
- name: styles
|
|
129
|
+
description: >
|
|
130
|
+
Additional CSS file paths. Multiple values allowed.
|
|
131
|
+
Appended after theme assets in load order.
|
|
132
|
+
schema:
|
|
133
|
+
type: array
|
|
134
|
+
items:
|
|
135
|
+
type: string
|
|
136
|
+
|
|
137
|
+
- name: scripts
|
|
138
|
+
description: >
|
|
139
|
+
Additional JavaScript file paths. Multiple values allowed.
|
|
140
|
+
Appended after theme assets in load order.
|
|
141
|
+
schema:
|
|
142
|
+
type: array
|
|
143
|
+
items:
|
|
144
|
+
type: string
|
|
145
|
+
|
|
146
|
+
- name: paper-size
|
|
147
|
+
description: Paper size for the pdf stage. Overrides frontmatter paper.size.
|
|
148
|
+
schema:
|
|
149
|
+
type: string
|
|
150
|
+
enum: [A4, A3, Letter, Legal, Tabloid]
|
|
151
|
+
default: A4
|
|
152
|
+
|
|
153
|
+
- name: landscape
|
|
154
|
+
description: Landscape orientation for the pdf stage.
|
|
155
|
+
schema:
|
|
156
|
+
type: boolean
|
|
157
|
+
default: false
|
|
158
|
+
|
|
159
|
+
- name: header
|
|
160
|
+
description: Page header text for the pdf stage.
|
|
161
|
+
schema:
|
|
162
|
+
type: string
|
|
163
|
+
|
|
164
|
+
- name: margin
|
|
165
|
+
description: "Page margin for the pdf stage. Example: 16mm, 18mm."
|
|
166
|
+
schema:
|
|
167
|
+
type: string
|
|
168
|
+
streams:
|
|
169
|
+
stdin:
|
|
170
|
+
required: false
|
|
171
|
+
format: text
|
|
172
|
+
encoding: utf-8
|
|
173
|
+
framing:
|
|
174
|
+
type: raw
|
|
175
|
+
stdout:
|
|
176
|
+
format: text
|
|
177
|
+
encoding: utf-8
|
|
178
|
+
framing:
|
|
179
|
+
type: raw
|
|
180
|
+
effects:
|
|
181
|
+
risk_level: low
|
|
182
|
+
writes:
|
|
183
|
+
- target: output file
|
|
184
|
+
description: Writes the rendered result to a file (when -o is specified).
|
|
185
|
+
overwrite: true
|
|
186
|
+
idempotent: true
|
|
187
|
+
idempotent_note: Produces identical output given the same input and settings.
|
|
188
|
+
exits:
|
|
189
|
+
'0':
|
|
190
|
+
description: Rendering succeeded.
|
|
191
|
+
'1':
|
|
192
|
+
description: Rendering error (Chromium launch failure, PDF generation failure, etc.).
|
|
193
|
+
stderr:
|
|
194
|
+
format: text
|
|
195
|
+
schema:
|
|
196
|
+
$ref: '#/components/schemas/ErrorMessage'
|
|
197
|
+
'2':
|
|
198
|
+
description: >
|
|
199
|
+
Input error (file not found, syntax error, invalid pipeline specification,
|
|
200
|
+
undefined directive in strict mode, etc.).
|
|
201
|
+
stderr:
|
|
202
|
+
format: text
|
|
203
|
+
schema:
|
|
204
|
+
$ref: '#/components/schemas/ErrorMessage'
|
|
205
|
+
x-agent:
|
|
206
|
+
recommended_before_use:
|
|
207
|
+
- Check that md-pipe.config.yml exists when using themes or custom directives
|
|
208
|
+
- Verify Chromium is available when targeting pdf output
|
|
209
|
+
rollback:
|
|
210
|
+
supported: false
|
|
211
|
+
notes: Output files can be deleted manually; no side effects beyond file writes.
|
|
212
|
+
retryable_exit_codes: [1]
|
|
213
|
+
expected_duration_ms: 5000
|
|
214
|
+
examples:
|
|
215
|
+
- name: Source to HTML
|
|
216
|
+
command: md-pipe report.md -o dist/report.html
|
|
217
|
+
- name: Source to PDF
|
|
218
|
+
command: md-pipe report.md --pipeline .pdf -o dist/report.pdf
|
|
219
|
+
- name: Stop at intermediate stage
|
|
220
|
+
command: md-pipe report.md --pipeline .render -o report.rendered.html
|
|
221
|
+
- name: Resume from intermediate file
|
|
222
|
+
command: md-pipe report.rendered.html --pipeline render.html -o report.html
|
|
223
|
+
- name: stdin/stdout pipe chaining
|
|
224
|
+
command: cat report.md | md-pipe --pipeline .transform | md-pipe --pipeline transform.pdf -o report.pdf
|
|
225
|
+
|
|
226
|
+
# ──────────────────────────────────────────────
|
|
227
|
+
# init — project initialization
|
|
228
|
+
# ──────────────────────────────────────────────
|
|
229
|
+
init:
|
|
230
|
+
summary: Initialize a md-pipe project.
|
|
231
|
+
description: >
|
|
232
|
+
Creates a md-pipe.config.yml template in the current directory.
|
|
233
|
+
usage:
|
|
234
|
+
- md-pipe init
|
|
235
|
+
- md-pipe init --theme business-report
|
|
236
|
+
options:
|
|
237
|
+
- name: theme
|
|
238
|
+
aliases: [t]
|
|
239
|
+
description: Initial theme name to scaffold.
|
|
240
|
+
schema:
|
|
241
|
+
type: string
|
|
242
|
+
default: default
|
|
243
|
+
|
|
244
|
+
- name: force
|
|
245
|
+
aliases: [f]
|
|
246
|
+
description: Overwrite existing config file.
|
|
247
|
+
schema:
|
|
248
|
+
type: boolean
|
|
249
|
+
default: false
|
|
250
|
+
effects:
|
|
251
|
+
risk_level: high
|
|
252
|
+
overwrites: true
|
|
253
|
+
effects:
|
|
254
|
+
risk_level: medium
|
|
255
|
+
writes:
|
|
256
|
+
- target: md-pipe.config.yml
|
|
257
|
+
description: Generates a config file template.
|
|
258
|
+
exits:
|
|
259
|
+
'0':
|
|
260
|
+
description: Initialization succeeded.
|
|
261
|
+
stdout:
|
|
262
|
+
format: text
|
|
263
|
+
schema:
|
|
264
|
+
type: string
|
|
265
|
+
description: List of generated files.
|
|
266
|
+
'1':
|
|
267
|
+
description: Initialization error (file write failure, etc.).
|
|
268
|
+
stderr:
|
|
269
|
+
format: text
|
|
270
|
+
schema:
|
|
271
|
+
$ref: '#/components/schemas/ErrorMessage'
|
|
272
|
+
'3':
|
|
273
|
+
description: Config file already exists (without --force).
|
|
274
|
+
stderr:
|
|
275
|
+
format: text
|
|
276
|
+
schema:
|
|
277
|
+
$ref: '#/components/schemas/ErrorMessage'
|
|
278
|
+
x-agent:
|
|
279
|
+
recommended_before_use:
|
|
280
|
+
- Check whether md-pipe.config.yml already exists
|
|
281
|
+
human_review:
|
|
282
|
+
required: false
|
|
283
|
+
reason: Safe scaffolding operation; --force requires attention.
|
|
284
|
+
rollback:
|
|
285
|
+
supported: true
|
|
286
|
+
notes: Delete the generated md-pipe.config.yml.
|
|
287
|
+
examples:
|
|
288
|
+
- name: Initialize with defaults
|
|
289
|
+
command: md-pipe init
|
|
290
|
+
- name: Initialize with a theme
|
|
291
|
+
command: md-pipe init --theme business-report
|
|
292
|
+
- name: Overwrite existing config
|
|
293
|
+
command: md-pipe init --force
|
|
294
|
+
|
|
295
|
+
components:
|
|
296
|
+
schemas:
|
|
297
|
+
ErrorMessage:
|
|
298
|
+
type: object
|
|
299
|
+
required: [message]
|
|
300
|
+
properties:
|
|
301
|
+
message:
|
|
302
|
+
type: string
|
|
303
|
+
description: Error message.
|
|
304
|
+
file:
|
|
305
|
+
type: string
|
|
306
|
+
description: File path where the error occurred.
|
|
307
|
+
line:
|
|
308
|
+
type: integer
|
|
309
|
+
description: Line number where the error occurred.
|
|
310
|
+
detail:
|
|
311
|
+
type: string
|
|
312
|
+
description: Detailed error information.
|
|
@@ -6,8 +6,8 @@ interface EffectWrite {
|
|
|
6
6
|
overwrite?: boolean;
|
|
7
7
|
destructive?: boolean;
|
|
8
8
|
idempotent?: boolean;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
idempotency_key?: string;
|
|
10
|
+
idempotent_note?: string;
|
|
11
11
|
}
|
|
12
12
|
interface EffectRead {
|
|
13
13
|
target: string;
|
|
@@ -17,16 +17,16 @@ interface NetworkEffect {
|
|
|
17
17
|
description?: string;
|
|
18
18
|
domains?: string[];
|
|
19
19
|
idempotent?: boolean;
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
idempotency_key?: string;
|
|
21
|
+
idempotent_note?: string;
|
|
22
22
|
}
|
|
23
23
|
interface Effects {
|
|
24
|
-
|
|
24
|
+
risk_level?: RiskLevel;
|
|
25
25
|
reads?: EffectRead[];
|
|
26
26
|
writes?: EffectWrite[];
|
|
27
27
|
network?: NetworkEffect | boolean;
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
execution_mode?: ExecutionMode;
|
|
29
|
+
requires_confirmation?: boolean;
|
|
30
30
|
}
|
|
31
31
|
interface FileContract {
|
|
32
32
|
mode: "read" | "write" | "append" | "readWrite";
|
|
@@ -68,32 +68,32 @@ export type DerivedWriteEffect = {
|
|
|
68
68
|
overwrite?: boolean;
|
|
69
69
|
destructive?: boolean;
|
|
70
70
|
idempotent?: boolean;
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
idempotency_key?: string;
|
|
72
|
+
idempotent_note?: string;
|
|
73
73
|
source: string;
|
|
74
74
|
};
|
|
75
75
|
export interface DerivedNetworkEffect {
|
|
76
76
|
description?: string;
|
|
77
77
|
domains?: string[];
|
|
78
78
|
idempotent?: boolean;
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
idempotency_key?: string;
|
|
80
|
+
idempotent_note?: string;
|
|
81
81
|
source: string;
|
|
82
82
|
}
|
|
83
83
|
export interface DerivedPolicy {
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
risk_level: RiskLevel;
|
|
85
|
+
requires_confirmation: boolean;
|
|
86
86
|
idempotent: boolean;
|
|
87
|
-
|
|
87
|
+
side_effects: string[];
|
|
88
88
|
reads: DerivedReadEffect[];
|
|
89
89
|
writes: DerivedWriteEffect[];
|
|
90
90
|
network?: DerivedNetworkEffect[];
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
execution_mode?: ExecutionMode;
|
|
92
|
+
requires_secrets?: string[];
|
|
93
93
|
}
|
|
94
94
|
export interface IntrospectionResult {
|
|
95
95
|
command: string;
|
|
96
|
-
|
|
96
|
+
active_options: string[];
|
|
97
97
|
policy: DerivedPolicy;
|
|
98
98
|
}
|
|
99
99
|
export interface OptionInput {
|
|
@@ -101,8 +101,8 @@ export interface OptionInput {
|
|
|
101
101
|
specified: boolean;
|
|
102
102
|
}
|
|
103
103
|
export interface PolicyDerivationInput {
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
command_id: string;
|
|
105
|
+
command_effects?: Effects;
|
|
106
106
|
options: Record<string, OptionInput & {
|
|
107
107
|
definition: Option;
|
|
108
108
|
}>;
|
|
@@ -36,9 +36,9 @@ export function derivePolicy(input) {
|
|
|
36
36
|
const riskLevels = [];
|
|
37
37
|
let executionMode;
|
|
38
38
|
let explicitConfirmation;
|
|
39
|
-
if (input.
|
|
40
|
-
const ce = input.
|
|
41
|
-
riskLevels.push(ce.
|
|
39
|
+
if (input.command_effects) {
|
|
40
|
+
const ce = input.command_effects;
|
|
41
|
+
riskLevels.push(ce.risk_level ?? "low");
|
|
42
42
|
if (ce.writes) {
|
|
43
43
|
sideEffects.add("file_write");
|
|
44
44
|
for (const w of ce.writes) {
|
|
@@ -49,9 +49,9 @@ export function derivePolicy(input) {
|
|
|
49
49
|
overwrite: w.overwrite,
|
|
50
50
|
destructive: w.destructive,
|
|
51
51
|
...(w.idempotent !== undefined ? { idempotent: w.idempotent } : {}),
|
|
52
|
-
...(w.
|
|
53
|
-
...(w.
|
|
54
|
-
source: `command:${input.
|
|
52
|
+
...(w.idempotency_key ? { idempotency_key: w.idempotency_key } : {}),
|
|
53
|
+
...(w.idempotent_note ? { idempotent_note: w.idempotent_note } : {}),
|
|
54
|
+
source: `command:${input.command_id}`,
|
|
55
55
|
});
|
|
56
56
|
}
|
|
57
57
|
}
|
|
@@ -61,7 +61,7 @@ export function derivePolicy(input) {
|
|
|
61
61
|
kind: "semantic",
|
|
62
62
|
target: r.target,
|
|
63
63
|
description: r.description,
|
|
64
|
-
source: `command:${input.
|
|
64
|
+
source: `command:${input.command_id}`,
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
}
|
|
@@ -72,17 +72,17 @@ export function derivePolicy(input) {
|
|
|
72
72
|
...(ce.network.description ? { description: ce.network.description } : {}),
|
|
73
73
|
...(ce.network.domains ? { domains: ce.network.domains } : {}),
|
|
74
74
|
...(ce.network.idempotent !== undefined ? { idempotent: ce.network.idempotent } : {}),
|
|
75
|
-
...(ce.network.
|
|
76
|
-
...(ce.network.
|
|
77
|
-
source: `command:${input.
|
|
75
|
+
...(ce.network.idempotency_key ? { idempotency_key: ce.network.idempotency_key } : {}),
|
|
76
|
+
...(ce.network.idempotent_note ? { idempotent_note: ce.network.idempotent_note } : {}),
|
|
77
|
+
source: `command:${input.command_id}`,
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
if (ce.
|
|
82
|
-
executionMode = ce.
|
|
81
|
+
if (ce.execution_mode) {
|
|
82
|
+
executionMode = ce.execution_mode;
|
|
83
83
|
}
|
|
84
|
-
if (ce.
|
|
85
|
-
explicitConfirmation = ce.
|
|
84
|
+
if (ce.requires_confirmation !== undefined) {
|
|
85
|
+
explicitConfirmation = ce.requires_confirmation;
|
|
86
86
|
}
|
|
87
87
|
}
|
|
88
88
|
for (const [optName, optInput] of Object.entries(input.options)) {
|
|
@@ -114,7 +114,7 @@ export function derivePolicy(input) {
|
|
|
114
114
|
}
|
|
115
115
|
if (definition.effects) {
|
|
116
116
|
const eff = definition.effects;
|
|
117
|
-
riskLevels.push(eff.
|
|
117
|
+
riskLevels.push(eff.risk_level ?? "low");
|
|
118
118
|
if (eff.writes) {
|
|
119
119
|
sideEffects.add("file_write");
|
|
120
120
|
for (const w of eff.writes) {
|
|
@@ -125,8 +125,8 @@ export function derivePolicy(input) {
|
|
|
125
125
|
overwrite: w.overwrite,
|
|
126
126
|
destructive: w.destructive,
|
|
127
127
|
...(w.idempotent !== undefined ? { idempotent: w.idempotent } : {}),
|
|
128
|
-
...(w.
|
|
129
|
-
...(w.
|
|
128
|
+
...(w.idempotency_key ? { idempotency_key: w.idempotency_key } : {}),
|
|
129
|
+
...(w.idempotent_note ? { idempotent_note: w.idempotent_note } : {}),
|
|
130
130
|
source: `option:${optName}`,
|
|
131
131
|
});
|
|
132
132
|
}
|
|
@@ -148,17 +148,17 @@ export function derivePolicy(input) {
|
|
|
148
148
|
...(eff.network.description ? { description: eff.network.description } : {}),
|
|
149
149
|
...(eff.network.domains ? { domains: eff.network.domains } : {}),
|
|
150
150
|
...(eff.network.idempotent !== undefined ? { idempotent: eff.network.idempotent } : {}),
|
|
151
|
-
...(eff.network.
|
|
152
|
-
...(eff.network.
|
|
151
|
+
...(eff.network.idempotency_key ? { idempotency_key: eff.network.idempotency_key } : {}),
|
|
152
|
+
...(eff.network.idempotent_note ? { idempotent_note: eff.network.idempotent_note } : {}),
|
|
153
153
|
source: `option:${optName}`,
|
|
154
154
|
});
|
|
155
155
|
}
|
|
156
156
|
}
|
|
157
|
-
if (eff.
|
|
158
|
-
executionMode = eff.
|
|
157
|
+
if (eff.execution_mode && !executionMode) {
|
|
158
|
+
executionMode = eff.execution_mode;
|
|
159
159
|
}
|
|
160
|
-
if (eff.
|
|
161
|
-
explicitConfirmation = eff.
|
|
160
|
+
if (eff.requires_confirmation !== undefined && explicitConfirmation === undefined) {
|
|
161
|
+
explicitConfirmation = eff.requires_confirmation;
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
164
|
}
|
|
@@ -181,15 +181,15 @@ export function derivePolicy(input) {
|
|
|
181
181
|
const idempotent = semanticWrites.every((w) => w.idempotent === true) &&
|
|
182
182
|
networkEffects.every((n) => n.idempotent === true);
|
|
183
183
|
return {
|
|
184
|
-
|
|
185
|
-
requiresConfirmation,
|
|
184
|
+
risk_level: finalRiskLevel,
|
|
185
|
+
requires_confirmation: requiresConfirmation,
|
|
186
186
|
idempotent,
|
|
187
|
-
|
|
187
|
+
side_effects: [...sideEffects],
|
|
188
188
|
reads,
|
|
189
189
|
writes,
|
|
190
190
|
...(networkEffects.length > 0 ? { network: networkEffects } : {}),
|
|
191
|
-
...(executionMode ? { executionMode } : {}),
|
|
192
|
-
...(requiresSecrets ? { requiresSecrets } : {}),
|
|
191
|
+
...(executionMode ? { execution_mode: executionMode } : {}),
|
|
192
|
+
...(requiresSecrets ? { requires_secrets: requiresSecrets } : {}),
|
|
193
193
|
};
|
|
194
194
|
}
|
|
195
195
|
//# sourceMappingURL=policy-runtime.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"policy-runtime.js","sourceRoot":"","sources":["../../src/generated/policy-runtime.ts"],"names":[],"mappings":"AAAA,+DAA+D;AAC/D,yEAAyE;AA2HzE,mEAAmE;AAEnE,MAAM,UAAU,GAA8B;IAC5C,GAAG,EAAE,CAAC;IACN,MAAM,EAAE,CAAC;IACT,IAAI,EAAE,CAAC;IACP,QAAQ,EAAE,CAAC;CAC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C,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACjE,GAAG,CAAC,aAAa,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,aAAa,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QAC3D,GAAG,CAAC,eAAe,CAAC,CAAC,CAAC,EAAE,gBAAgB,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAClE,CAAC;AACJ,CAAC"}
|
|
@@ -3,13 +3,13 @@ export type { DerivedPolicy, IntrospectionResult };
|
|
|
3
3
|
export declare const commandDefinitions: {
|
|
4
4
|
readonly render: {
|
|
5
5
|
readonly effects: {
|
|
6
|
-
readonly
|
|
6
|
+
readonly risk_level: "low";
|
|
7
7
|
readonly writes: readonly [{
|
|
8
8
|
readonly target: "output file";
|
|
9
9
|
readonly description: "Writes the rendered result to a file (when -o is specified).";
|
|
10
10
|
readonly overwrite: true;
|
|
11
11
|
readonly idempotent: true;
|
|
12
|
-
readonly
|
|
12
|
+
readonly idempotent_note: "Produces identical output given the same input and settings.";
|
|
13
13
|
}];
|
|
14
14
|
};
|
|
15
15
|
readonly options: readonly [{
|
|
@@ -73,7 +73,7 @@ export declare const commandDefinitions: {
|
|
|
73
73
|
};
|
|
74
74
|
readonly init: {
|
|
75
75
|
readonly effects: {
|
|
76
|
-
readonly
|
|
76
|
+
readonly risk_level: "medium";
|
|
77
77
|
readonly writes: readonly [{
|
|
78
78
|
readonly target: "md-pipe.config.yml";
|
|
79
79
|
readonly description: "Generates a config file template.";
|
|
@@ -92,10 +92,10 @@ export declare const commandDefinitions: {
|
|
|
92
92
|
readonly default: false;
|
|
93
93
|
};
|
|
94
94
|
readonly effects: {
|
|
95
|
-
readonly
|
|
95
|
+
readonly risk_level: "high";
|
|
96
96
|
readonly overwrites: true;
|
|
97
97
|
};
|
|
98
98
|
}];
|
|
99
99
|
};
|
|
100
100
|
};
|
|
101
|
-
export declare function deriveCommandPolicy(
|
|
101
|
+
export declare function deriveCommandPolicy(command_id: string, optionValues: Record<string, unknown>): IntrospectionResult;
|
package/dist/generated/policy.js
CHANGED
|
@@ -3,14 +3,14 @@ import { derivePolicy, isOptionActive } from "./policy-runtime.js";
|
|
|
3
3
|
export const commandDefinitions = {
|
|
4
4
|
"render": {
|
|
5
5
|
"effects": {
|
|
6
|
-
"
|
|
6
|
+
"risk_level": "low",
|
|
7
7
|
"writes": [
|
|
8
8
|
{
|
|
9
9
|
"target": "output file",
|
|
10
10
|
"description": "Writes the rendered result to a file (when -o is specified).",
|
|
11
11
|
"overwrite": true,
|
|
12
12
|
"idempotent": true,
|
|
13
|
-
"
|
|
13
|
+
"idempotent_note": "Produces identical output given the same input and settings."
|
|
14
14
|
}
|
|
15
15
|
]
|
|
16
16
|
},
|
|
@@ -91,7 +91,7 @@ export const commandDefinitions = {
|
|
|
91
91
|
},
|
|
92
92
|
"init": {
|
|
93
93
|
"effects": {
|
|
94
|
-
"
|
|
94
|
+
"risk_level": "medium",
|
|
95
95
|
"writes": [
|
|
96
96
|
{
|
|
97
97
|
"target": "md-pipe.config.yml",
|
|
@@ -114,35 +114,35 @@ export const commandDefinitions = {
|
|
|
114
114
|
"default": false
|
|
115
115
|
},
|
|
116
116
|
"effects": {
|
|
117
|
-
"
|
|
117
|
+
"risk_level": "high",
|
|
118
118
|
"overwrites": true
|
|
119
119
|
}
|
|
120
120
|
}
|
|
121
121
|
]
|
|
122
122
|
},
|
|
123
123
|
};
|
|
124
|
-
export function deriveCommandPolicy(
|
|
125
|
-
const def = commandDefinitions[
|
|
124
|
+
export function deriveCommandPolicy(command_id, optionValues) {
|
|
125
|
+
const def = commandDefinitions[command_id];
|
|
126
126
|
if (!def)
|
|
127
|
-
throw new Error(`Unknown command: ${
|
|
127
|
+
throw new Error(`Unknown command: ${command_id}`);
|
|
128
128
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
129
129
|
const cmdDef = def;
|
|
130
130
|
const options = {};
|
|
131
|
-
const
|
|
131
|
+
const active_options = [];
|
|
132
132
|
for (const optDef of cmdDef.options ?? []) {
|
|
133
133
|
const value = optionValues[optDef.name];
|
|
134
134
|
const specified = optDef.name in optionValues && value !== undefined;
|
|
135
135
|
options[optDef.name] = { value, specified, definition: optDef };
|
|
136
136
|
if (isOptionActive(optDef, value, specified)) {
|
|
137
|
-
|
|
137
|
+
active_options.push(optDef.name);
|
|
138
138
|
}
|
|
139
139
|
}
|
|
140
140
|
const policy = derivePolicy({
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
command_id,
|
|
142
|
+
command_effects: cmdDef.effects,
|
|
143
143
|
options,
|
|
144
144
|
env: cmdDef.env,
|
|
145
145
|
});
|
|
146
|
-
return { command:
|
|
146
|
+
return { command: command_id, active_options, policy };
|
|
147
147
|
}
|
|
148
148
|
//# sourceMappingURL=policy.js.map
|