@penvhq/cli 0.2.0 → 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/dist/index.cjs +286 -140
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +71 -1
- package/dist/index.d.ts +71 -1
- package/dist/index.js +208 -61
- package/dist/index.js.map +1 -1
- package/package.json +10 -7
package/dist/index.d.cts
CHANGED
|
@@ -83,6 +83,76 @@ interface ResealResult {
|
|
|
83
83
|
declare function runEncrypt(options: ResealOptions): Promise<ResealResult>;
|
|
84
84
|
declare function runDecrypt(options: ResealOptions): Promise<ResealResult>;
|
|
85
85
|
|
|
86
|
+
/**
|
|
87
|
+
* `penv fill` — walk the schema's required-but-missing parameters and ask for
|
|
88
|
+
* each one, deriving the value file's name so the user never has to.
|
|
89
|
+
*
|
|
90
|
+
* The schema-first flow writes `.penv/env.ts` before any value exists, and there
|
|
91
|
+
* the user hits a translation they should not have to make: `databaseUrl` in the
|
|
92
|
+
* schema is `database-url` on disk, and typing the wrong one writes a file the
|
|
93
|
+
* schema still cannot see. `fill` reads the same declared drift `validate`
|
|
94
|
+
* computes, and for each missing parameter asks for a value and writes it through
|
|
95
|
+
* the one writer — `runSet` — deriving the kebab filename from the schema key.
|
|
96
|
+
*
|
|
97
|
+
* A value is never invented: a blank answer skips the parameter, because the
|
|
98
|
+
* silent value reaching runtime is the failure penv exists to delete, and a
|
|
99
|
+
* placeholder written here is exactly that value by a friendlier route.
|
|
100
|
+
*/
|
|
101
|
+
/** One question `fill` puts to the user: which parameter, in which environment. */
|
|
102
|
+
interface FillPrompt {
|
|
103
|
+
/** The value file's key, kebab and slash-separated — the name the user need never derive. */
|
|
104
|
+
readonly parameter: string;
|
|
105
|
+
readonly environment: string;
|
|
106
|
+
/**
|
|
107
|
+
* Whether meta says this is a secret. Carried so a wrapper can mute the echo;
|
|
108
|
+
* v1 does not, and the drift carries no meta, so this is `false` today.
|
|
109
|
+
*/
|
|
110
|
+
readonly secret: boolean;
|
|
111
|
+
readonly description?: string;
|
|
112
|
+
}
|
|
113
|
+
interface FillOptions {
|
|
114
|
+
readonly cwd: string;
|
|
115
|
+
readonly environment?: string;
|
|
116
|
+
/**
|
|
117
|
+
* How a value is obtained for one prompt. `undefined` or an empty answer skips
|
|
118
|
+
* the parameter — the readline half lives only in the wrapper, so `runFill`
|
|
119
|
+
* stays pure and unit-testable.
|
|
120
|
+
*/
|
|
121
|
+
readonly ask: (prompt: FillPrompt) => Promise<string | undefined>;
|
|
122
|
+
}
|
|
123
|
+
interface FillResult {
|
|
124
|
+
readonly environment: string;
|
|
125
|
+
/** The value files written, one per answered prompt. */
|
|
126
|
+
readonly written: ReadonlyArray<{
|
|
127
|
+
readonly parameter: string;
|
|
128
|
+
/** The value file written, relative to `.penv/`. */
|
|
129
|
+
readonly location: string;
|
|
130
|
+
readonly encrypted: boolean;
|
|
131
|
+
}>;
|
|
132
|
+
/** The parameters a blank answer left for later — never written as an empty value. */
|
|
133
|
+
readonly skipped: readonly string[];
|
|
134
|
+
/**
|
|
135
|
+
* The declared keys no filename reaches (`apiURL`, a reserved token). `fill`
|
|
136
|
+
* cannot ask for a value it could never write, so it carries the rename remedy
|
|
137
|
+
* out rather than prompting for a file that would error.
|
|
138
|
+
*/
|
|
139
|
+
readonly unreachable: ReadonlyArray<{
|
|
140
|
+
readonly subject: string;
|
|
141
|
+
readonly remedy: string;
|
|
142
|
+
}>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Asks for every declared-but-missing parameter, and writes the ones answered.
|
|
146
|
+
*
|
|
147
|
+
* The drift is `validate`'s, not a second reading of the schema: `runValidate`
|
|
148
|
+
* already computes exactly the required-but-absent set, so `fill` and `validate`
|
|
149
|
+
* can never disagree about what is missing. The writing is `runSet`'s, so a
|
|
150
|
+
* filled secret is sealed exactly as a `set` one is — `fill` owns neither the
|
|
151
|
+
* resolution nor the write, only the prompting between them.
|
|
152
|
+
*/
|
|
153
|
+
declare function runFill(options: FillOptions): Promise<FillResult>;
|
|
154
|
+
declare function renderFill(result: FillResult): string[];
|
|
155
|
+
|
|
86
156
|
interface GenerateOptions {
|
|
87
157
|
readonly cwd: string;
|
|
88
158
|
readonly environment?: string;
|
|
@@ -611,4 +681,4 @@ declare function renderWatch(result: ValidateResult): string[];
|
|
|
611
681
|
declare const main: citty.CommandDef<citty.ArgsDef>;
|
|
612
682
|
declare function runMain(): Promise<void>;
|
|
613
683
|
|
|
614
|
-
export { type DoctorCheck, type DoctorFinding, type DoctorReport, type DoctorSeverity, type GenerateResult, type GetExplanation, type ImportReport, type InitResult, type InitStep, LAST_PUSHED_KEY, type ListResult, type MoveResult, type PullOptions, type PullResult, type PushOptions, type PushResult, type RemoveResult, type ResealResult, type RotateOptions, type RotatePhase, type RotateResult, type SetResult, type ValidateIssue, type ValidateResult, type WatchHandle, type WatchOptions, generateDotenv, importDotenv, insertEnvAlias, main, renderDoctor, renderMove, renderPull, renderPush, renderRotate, renderWatch, runDecrypt, runDoctor, runEncrypt, runExplain, runGenerate, runGet, runInit, runList, runMain, runMove, runPull, runPush, runRemove, runRotate, runSet, runValidate, runWatch };
|
|
684
|
+
export { type DoctorCheck, type DoctorFinding, type DoctorReport, type DoctorSeverity, type FillOptions, type FillPrompt, type FillResult, type GenerateResult, type GetExplanation, type ImportReport, type InitResult, type InitStep, LAST_PUSHED_KEY, type ListResult, type MoveResult, type PullOptions, type PullResult, type PushOptions, type PushResult, type RemoveResult, type ResealResult, type RotateOptions, type RotatePhase, type RotateResult, type SetResult, type ValidateIssue, type ValidateResult, type WatchHandle, type WatchOptions, generateDotenv, importDotenv, insertEnvAlias, main, renderDoctor, renderFill, renderMove, renderPull, renderPush, renderRotate, renderWatch, runDecrypt, runDoctor, runEncrypt, runExplain, runFill, runGenerate, runGet, runInit, runList, runMain, runMove, runPull, runPush, runRemove, runRotate, runSet, runValidate, runWatch };
|
package/dist/index.d.ts
CHANGED
|
@@ -83,6 +83,76 @@ interface ResealResult {
|
|
|
83
83
|
declare function runEncrypt(options: ResealOptions): Promise<ResealResult>;
|
|
84
84
|
declare function runDecrypt(options: ResealOptions): Promise<ResealResult>;
|
|
85
85
|
|
|
86
|
+
/**
|
|
87
|
+
* `penv fill` — walk the schema's required-but-missing parameters and ask for
|
|
88
|
+
* each one, deriving the value file's name so the user never has to.
|
|
89
|
+
*
|
|
90
|
+
* The schema-first flow writes `.penv/env.ts` before any value exists, and there
|
|
91
|
+
* the user hits a translation they should not have to make: `databaseUrl` in the
|
|
92
|
+
* schema is `database-url` on disk, and typing the wrong one writes a file the
|
|
93
|
+
* schema still cannot see. `fill` reads the same declared drift `validate`
|
|
94
|
+
* computes, and for each missing parameter asks for a value and writes it through
|
|
95
|
+
* the one writer — `runSet` — deriving the kebab filename from the schema key.
|
|
96
|
+
*
|
|
97
|
+
* A value is never invented: a blank answer skips the parameter, because the
|
|
98
|
+
* silent value reaching runtime is the failure penv exists to delete, and a
|
|
99
|
+
* placeholder written here is exactly that value by a friendlier route.
|
|
100
|
+
*/
|
|
101
|
+
/** One question `fill` puts to the user: which parameter, in which environment. */
|
|
102
|
+
interface FillPrompt {
|
|
103
|
+
/** The value file's key, kebab and slash-separated — the name the user need never derive. */
|
|
104
|
+
readonly parameter: string;
|
|
105
|
+
readonly environment: string;
|
|
106
|
+
/**
|
|
107
|
+
* Whether meta says this is a secret. Carried so a wrapper can mute the echo;
|
|
108
|
+
* v1 does not, and the drift carries no meta, so this is `false` today.
|
|
109
|
+
*/
|
|
110
|
+
readonly secret: boolean;
|
|
111
|
+
readonly description?: string;
|
|
112
|
+
}
|
|
113
|
+
interface FillOptions {
|
|
114
|
+
readonly cwd: string;
|
|
115
|
+
readonly environment?: string;
|
|
116
|
+
/**
|
|
117
|
+
* How a value is obtained for one prompt. `undefined` or an empty answer skips
|
|
118
|
+
* the parameter — the readline half lives only in the wrapper, so `runFill`
|
|
119
|
+
* stays pure and unit-testable.
|
|
120
|
+
*/
|
|
121
|
+
readonly ask: (prompt: FillPrompt) => Promise<string | undefined>;
|
|
122
|
+
}
|
|
123
|
+
interface FillResult {
|
|
124
|
+
readonly environment: string;
|
|
125
|
+
/** The value files written, one per answered prompt. */
|
|
126
|
+
readonly written: ReadonlyArray<{
|
|
127
|
+
readonly parameter: string;
|
|
128
|
+
/** The value file written, relative to `.penv/`. */
|
|
129
|
+
readonly location: string;
|
|
130
|
+
readonly encrypted: boolean;
|
|
131
|
+
}>;
|
|
132
|
+
/** The parameters a blank answer left for later — never written as an empty value. */
|
|
133
|
+
readonly skipped: readonly string[];
|
|
134
|
+
/**
|
|
135
|
+
* The declared keys no filename reaches (`apiURL`, a reserved token). `fill`
|
|
136
|
+
* cannot ask for a value it could never write, so it carries the rename remedy
|
|
137
|
+
* out rather than prompting for a file that would error.
|
|
138
|
+
*/
|
|
139
|
+
readonly unreachable: ReadonlyArray<{
|
|
140
|
+
readonly subject: string;
|
|
141
|
+
readonly remedy: string;
|
|
142
|
+
}>;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Asks for every declared-but-missing parameter, and writes the ones answered.
|
|
146
|
+
*
|
|
147
|
+
* The drift is `validate`'s, not a second reading of the schema: `runValidate`
|
|
148
|
+
* already computes exactly the required-but-absent set, so `fill` and `validate`
|
|
149
|
+
* can never disagree about what is missing. The writing is `runSet`'s, so a
|
|
150
|
+
* filled secret is sealed exactly as a `set` one is — `fill` owns neither the
|
|
151
|
+
* resolution nor the write, only the prompting between them.
|
|
152
|
+
*/
|
|
153
|
+
declare function runFill(options: FillOptions): Promise<FillResult>;
|
|
154
|
+
declare function renderFill(result: FillResult): string[];
|
|
155
|
+
|
|
86
156
|
interface GenerateOptions {
|
|
87
157
|
readonly cwd: string;
|
|
88
158
|
readonly environment?: string;
|
|
@@ -611,4 +681,4 @@ declare function renderWatch(result: ValidateResult): string[];
|
|
|
611
681
|
declare const main: citty.CommandDef<citty.ArgsDef>;
|
|
612
682
|
declare function runMain(): Promise<void>;
|
|
613
683
|
|
|
614
|
-
export { type DoctorCheck, type DoctorFinding, type DoctorReport, type DoctorSeverity, type GenerateResult, type GetExplanation, type ImportReport, type InitResult, type InitStep, LAST_PUSHED_KEY, type ListResult, type MoveResult, type PullOptions, type PullResult, type PushOptions, type PushResult, type RemoveResult, type ResealResult, type RotateOptions, type RotatePhase, type RotateResult, type SetResult, type ValidateIssue, type ValidateResult, type WatchHandle, type WatchOptions, generateDotenv, importDotenv, insertEnvAlias, main, renderDoctor, renderMove, renderPull, renderPush, renderRotate, renderWatch, runDecrypt, runDoctor, runEncrypt, runExplain, runGenerate, runGet, runInit, runList, runMain, runMove, runPull, runPush, runRemove, runRotate, runSet, runValidate, runWatch };
|
|
684
|
+
export { type DoctorCheck, type DoctorFinding, type DoctorReport, type DoctorSeverity, type FillOptions, type FillPrompt, type FillResult, type GenerateResult, type GetExplanation, type ImportReport, type InitResult, type InitStep, LAST_PUSHED_KEY, type ListResult, type MoveResult, type PullOptions, type PullResult, type PushOptions, type PushResult, type RemoveResult, type ResealResult, type RotateOptions, type RotatePhase, type RotateResult, type SetResult, type ValidateIssue, type ValidateResult, type WatchHandle, type WatchOptions, generateDotenv, importDotenv, insertEnvAlias, main, renderDoctor, renderFill, renderMove, renderPull, renderPush, renderRotate, renderWatch, runDecrypt, runDoctor, runEncrypt, runExplain, runFill, runGenerate, runGet, runInit, runList, runMain, runMove, runPull, runPush, runRemove, runRotate, runSet, runValidate, runWatch };
|