envpkt 0.2.0 → 0.4.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.d.ts CHANGED
@@ -24,6 +24,7 @@ declare const SecretMetaSchema: _sinclair_typebox0.TObject<{
24
24
  expires: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
25
25
  rotation_url: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
26
26
  purpose: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
27
+ comment: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
27
28
  capabilities: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
28
29
  created: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
29
30
  rotates: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
@@ -49,6 +50,13 @@ declare const CallbackConfigSchema: _sinclair_typebox0.TObject<{
49
50
  type CallbackConfig = Static<typeof CallbackConfigSchema>;
50
51
  declare const ToolsConfigSchema: _sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TUnknown>;
51
52
  type ToolsConfig = Static<typeof ToolsConfigSchema>;
53
+ declare const EnvMetaSchema: _sinclair_typebox0.TObject<{
54
+ value: _sinclair_typebox0.TString;
55
+ purpose: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
56
+ comment: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
57
+ tags: _sinclair_typebox0.TOptional<_sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TString>>;
58
+ }>;
59
+ type EnvMeta = Static<typeof EnvMetaSchema>;
52
60
  declare const EnvpktConfigSchema: _sinclair_typebox0.TObject<{
53
61
  version: _sinclair_typebox0.TNumber;
54
62
  catalog: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
@@ -63,11 +71,12 @@ declare const EnvpktConfigSchema: _sinclair_typebox0.TObject<{
63
71
  recipient: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
64
72
  secrets: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
65
73
  }>>;
66
- meta: _sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TObject<{
74
+ secret: _sinclair_typebox0.TOptional<_sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TObject<{
67
75
  service: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
68
76
  expires: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
69
77
  rotation_url: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
70
78
  purpose: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
79
+ comment: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
71
80
  capabilities: _sinclair_typebox0.TOptional<_sinclair_typebox0.TArray<_sinclair_typebox0.TString>>;
72
81
  created: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
73
82
  rotates: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
@@ -77,7 +86,13 @@ declare const EnvpktConfigSchema: _sinclair_typebox0.TObject<{
77
86
  encrypted_value: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
78
87
  required: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
79
88
  tags: _sinclair_typebox0.TOptional<_sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TString>>;
80
- }>>;
89
+ }>>>;
90
+ env: _sinclair_typebox0.TOptional<_sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TObject<{
91
+ value: _sinclair_typebox0.TString;
92
+ purpose: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
93
+ comment: _sinclair_typebox0.TOptional<_sinclair_typebox0.TString>;
94
+ tags: _sinclair_typebox0.TOptional<_sinclair_typebox0.TRecord<_sinclair_typebox0.TString, _sinclair_typebox0.TString>>;
95
+ }>>>;
81
96
  lifecycle: _sinclair_typebox0.TOptional<_sinclair_typebox0.TObject<{
82
97
  stale_warning_days: _sinclair_typebox0.TOptional<_sinclair_typebox0.TNumber>;
83
98
  require_expiration: _sinclair_typebox0.TOptional<_sinclair_typebox0.TBoolean>;
@@ -119,6 +134,21 @@ type AuditResult = {
119
134
  readonly orphaned: number;
120
135
  readonly agent?: AgentIdentity;
121
136
  };
137
+ type EnvDriftStatus = "default" | "overridden" | "missing";
138
+ type EnvDriftEntry = {
139
+ readonly key: string;
140
+ readonly defaultValue: string;
141
+ readonly currentValue: string | undefined;
142
+ readonly status: EnvDriftStatus;
143
+ readonly purpose: string | undefined;
144
+ };
145
+ type EnvAuditResult = {
146
+ readonly entries: ReadonlyArray<EnvDriftEntry>;
147
+ readonly total: number;
148
+ readonly defaults_applied: number;
149
+ readonly overridden: number;
150
+ readonly missing: number;
151
+ };
122
152
  type FleetAgent = {
123
153
  readonly path: string;
124
154
  readonly agent?: AgentIdentity;
@@ -164,6 +194,11 @@ type FnoxError = {
164
194
  readonly _tag: "FnoxParseError";
165
195
  readonly message: string;
166
196
  };
197
+ type ConfigSource = "flag" | "env" | "cwd" | "search";
198
+ type ResolvedPath = {
199
+ readonly path: string;
200
+ readonly source: ConfigSource;
201
+ };
167
202
  type ResolveOptions = {
168
203
  readonly configPath?: string;
169
204
  readonly output?: string;
@@ -202,6 +237,10 @@ type BootResult = {
202
237
  readonly skipped: ReadonlyArray<string>;
203
238
  readonly secrets: Readonly<Record<string, string>>;
204
239
  readonly warnings: ReadonlyArray<string>;
240
+ readonly envDefaults: Readonly<Record<string, string>>;
241
+ readonly overridden: ReadonlyArray<string>;
242
+ readonly configPath: string;
243
+ readonly configSource: ConfigSource;
205
244
  };
206
245
  type BootError = ConfigError | FnoxError | CatalogError | {
207
246
  readonly _tag: "AuditFailed";
@@ -237,6 +276,12 @@ type SealError = {
237
276
  //#region src/core/config.d.ts
238
277
  /** Find envpkt.toml in the given directory */
239
278
  declare const findConfigPath: (dir: string) => Option<string>;
279
+ type DiscoveredConfig = {
280
+ readonly path: string;
281
+ readonly source: "cwd" | "search";
282
+ };
283
+ /** Discover config by checking CWD, then ENVPKT_SEARCH_PATH, then built-in candidate paths */
284
+ declare const discoverConfig: (cwd?: string) => Option<DiscoveredConfig>;
240
285
  /** Read a config file, returning Either<ConfigError, string> */
241
286
  declare const readConfigFile: (path: string) => Either<ConfigError, string>;
242
287
  /** Parse a TOML string, returning Either<ConfigError, unknown> */
@@ -245,18 +290,19 @@ declare const parseToml: (raw: string) => Either<ConfigError, unknown>;
245
290
  declare const validateConfig: (data: unknown) => Either<ConfigError, EnvpktConfig>;
246
291
  /** Load and validate an envpkt.toml from a file path */
247
292
  declare const loadConfig: (path: string) => Either<ConfigError, EnvpktConfig>;
248
- /** Load config from CWD, returning both path and parsed config */
293
+ /** Load config from CWD or discovery chain, returning path, source, and parsed config */
249
294
  declare const loadConfigFromCwd: (cwd?: string) => Either<ConfigError, {
250
295
  path: string;
296
+ source: "cwd" | "search";
251
297
  config: EnvpktConfig;
252
298
  }>;
253
299
  /**
254
300
  * Resolve config path via priority chain:
255
301
  * 1. Explicit flag path
256
302
  * 2. ENVPKT_CONFIG env var
257
- * 3. CWD discovery
303
+ * 3. CWD + discovery chain (home dir, cloud storage, custom search paths)
258
304
  */
259
- declare const resolveConfigPath: (flagPath?: string, envVar?: string, cwd?: string) => Either<ConfigError, string>;
305
+ declare const resolveConfigPath: (flagPath?: string, envVar?: string, cwd?: string) => Either<ConfigError, ResolvedPath>;
260
306
  //#endregion
261
307
  //#region src/core/catalog.d.ts
262
308
  /** Load and validate a catalog file, mapping ConfigError → CatalogError */
@@ -277,6 +323,7 @@ declare const formatPacket: (result: ResolveResult, options?: FormatPacketOption
277
323
  //#endregion
278
324
  //#region src/core/audit.d.ts
279
325
  declare const computeAudit: (config: EnvpktConfig, fnoxKeys?: ReadonlySet<string>, today?: Date) => AuditResult;
326
+ declare const computeEnvAudit: (config: EnvpktConfig, env?: Readonly<Record<string, string | undefined>>) => EnvAuditResult;
280
327
  //#endregion
281
328
  //#region src/core/patterns.d.ts
282
329
  type ConfidenceLevel = "high" | "medium" | "low";
@@ -335,7 +382,7 @@ type ScanOptions = {
335
382
  declare const envScan: (env: Readonly<Record<string, string | undefined>>, options?: ScanOptions) => ScanResult;
336
383
  /** Bidirectional drift detection between config and live environment */
337
384
  declare const envCheck: (config: EnvpktConfig, env: Readonly<Record<string, string | undefined>>) => CheckResult;
338
- /** Generate TOML [meta.*] blocks from scan results, mirroring init.ts pattern */
385
+ /** Generate TOML [secret.*] blocks from scan results, mirroring init.ts pattern */
339
386
  declare const generateTomlFromScan: (matches: ReadonlyArray<MatchResult>) => string;
340
387
  //#endregion
341
388
  //#region src/core/boot.d.ts
@@ -420,4 +467,4 @@ type ToolDef = {
420
467
  declare const toolDefinitions: readonly ToolDef[];
421
468
  declare const callTool: (name: string, args: Record<string, unknown>) => CallToolResult;
422
469
  //#endregion
423
- export { type AgentIdentity, AgentIdentitySchema, type AuditResult, type BootError, type BootOptions, type BootResult, type CallbackConfig, CallbackConfigSchema, type CatalogError, type CheckResult, type ConfidenceLevel, type ConfigError, type ConsumerType, type CredentialPattern, type DriftEntry, type DriftStatus, EnvpktBootError, type EnvpktConfig, EnvpktConfigSchema, type FleetAgent, type FleetHealth, type FnoxConfig, type FnoxError, type FnoxSecret, type FormatPacketOptions, type HealthStatus, type IdentityError, type LifecycleConfig, LifecycleConfigSchema, type MatchResult, type ResolveOptions, type ResolveResult, type ScanOptions, type ScanResult, type SealError, type SecretDisplay, type SecretHealth, type SecretMeta, SecretMetaSchema, type SecretStatus, type ToolsConfig, ToolsConfigSchema, ageAvailable, ageDecrypt, ageEncrypt, boot, bootSafe, callTool, compareFnoxAndEnvpkt, computeAudit, createServer, deriveServiceFromName, detectFnox, envCheck, envScan, extractFnoxKeys, findConfigPath, fnoxAvailable, fnoxExport, fnoxGet, formatPacket, generateTomlFromScan, loadCatalog, loadConfig, loadConfigFromCwd, maskValue, matchEnvVar, matchValueShape, parseToml, readConfigFile, readFnoxConfig, readResource, resolveConfig, resolveConfigPath, resolveSecrets, resolveValues, resourceDefinitions, scanEnv, scanFleet, sealSecrets, startServer, toolDefinitions, unsealSecrets, unwrapAgentKey, validateConfig };
470
+ export { type AgentIdentity, AgentIdentitySchema, type AuditResult, type BootError, type BootOptions, type BootResult, type CallbackConfig, CallbackConfigSchema, type CatalogError, type CheckResult, type ConfidenceLevel, type ConfigError, type ConfigSource, type ConsumerType, type CredentialPattern, type DriftEntry, type DriftStatus, type EnvAuditResult, type EnvDriftEntry, type EnvDriftStatus, type EnvMeta, EnvMetaSchema, EnvpktBootError, type EnvpktConfig, EnvpktConfigSchema, type FleetAgent, type FleetHealth, type FnoxConfig, type FnoxError, type FnoxSecret, type FormatPacketOptions, type HealthStatus, type IdentityError, type LifecycleConfig, LifecycleConfigSchema, type MatchResult, type ResolveOptions, type ResolveResult, type ResolvedPath, type ScanOptions, type ScanResult, type SealError, type SecretDisplay, type SecretHealth, type SecretMeta, SecretMetaSchema, type SecretStatus, type ToolsConfig, ToolsConfigSchema, ageAvailable, ageDecrypt, ageEncrypt, boot, bootSafe, callTool, compareFnoxAndEnvpkt, computeAudit, computeEnvAudit, createServer, deriveServiceFromName, detectFnox, discoverConfig, envCheck, envScan, extractFnoxKeys, findConfigPath, fnoxAvailable, fnoxExport, fnoxGet, formatPacket, generateTomlFromScan, loadCatalog, loadConfig, loadConfigFromCwd, maskValue, matchEnvVar, matchValueShape, parseToml, readConfigFile, readFnoxConfig, readResource, resolveConfig, resolveConfigPath, resolveSecrets, resolveValues, resourceDefinitions, scanEnv, scanFleet, sealSecrets, startServer, toolDefinitions, unsealSecrets, unwrapAgentKey, validateConfig };