@ontrails/config 1.0.0-beta.15 → 1.0.0-beta.16

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 (139) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/README.md +1 -1
  3. package/package.json +10 -2
  4. package/src/define-config.ts +6 -3
  5. package/src/extensions.ts +1 -1
  6. package/src/index.ts +0 -1
  7. package/src/registry.ts +1 -1
  8. package/src/resolve.ts +4 -2
  9. package/.turbo/turbo-build.log +0 -1
  10. package/.turbo/turbo-lint.log +0 -3
  11. package/.turbo/turbo-typecheck.log +0 -1
  12. package/dist/app-config.d.ts +0 -65
  13. package/dist/app-config.d.ts.map +0 -1
  14. package/dist/app-config.js +0 -177
  15. package/dist/app-config.js.map +0 -1
  16. package/dist/collect.d.ts +0 -11
  17. package/dist/collect.d.ts.map +0 -1
  18. package/dist/collect.js +0 -81
  19. package/dist/collect.js.map +0 -1
  20. package/dist/compose.d.ts +0 -26
  21. package/dist/compose.d.ts.map +0 -1
  22. package/dist/compose.js +0 -19
  23. package/dist/compose.js.map +0 -1
  24. package/dist/config-layer.d.ts +0 -11
  25. package/dist/config-layer.d.ts.map +0 -1
  26. package/dist/config-layer.js +0 -6
  27. package/dist/config-layer.js.map +0 -1
  28. package/dist/config-resource.d.ts +0 -3
  29. package/dist/config-resource.d.ts.map +0 -1
  30. package/dist/config-resource.js +0 -26
  31. package/dist/config-resource.js.map +0 -1
  32. package/dist/define-config.d.ts +0 -61
  33. package/dist/define-config.d.ts.map +0 -1
  34. package/dist/define-config.js +0 -87
  35. package/dist/define-config.js.map +0 -1
  36. package/dist/derive/env.d.ts +0 -15
  37. package/dist/derive/env.d.ts.map +0 -1
  38. package/dist/derive/env.js +0 -65
  39. package/dist/derive/env.js.map +0 -1
  40. package/dist/derive/example.d.ts +0 -16
  41. package/dist/derive/example.d.ts.map +0 -1
  42. package/dist/derive/example.js +0 -138
  43. package/dist/derive/example.js.map +0 -1
  44. package/dist/derive/helpers.d.ts +0 -35
  45. package/dist/derive/helpers.d.ts.map +0 -1
  46. package/dist/derive/helpers.js +0 -116
  47. package/dist/derive/helpers.js.map +0 -1
  48. package/dist/derive/index.d.ts +0 -4
  49. package/dist/derive/index.d.ts.map +0 -1
  50. package/dist/derive/index.js +0 -4
  51. package/dist/derive/index.js.map +0 -1
  52. package/dist/derive/json-schema.d.ts +0 -18
  53. package/dist/derive/json-schema.d.ts.map +0 -1
  54. package/dist/derive/json-schema.js +0 -97
  55. package/dist/derive/json-schema.js.map +0 -1
  56. package/dist/derive-fields.d.ts +0 -25
  57. package/dist/derive-fields.d.ts.map +0 -1
  58. package/dist/derive-fields.js +0 -147
  59. package/dist/derive-fields.js.map +0 -1
  60. package/dist/derive-provenance.d.ts +0 -30
  61. package/dist/derive-provenance.d.ts.map +0 -1
  62. package/dist/derive-provenance.js +0 -101
  63. package/dist/derive-provenance.js.map +0 -1
  64. package/dist/doctor.d.ts +0 -27
  65. package/dist/doctor.d.ts.map +0 -1
  66. package/dist/doctor.js +0 -131
  67. package/dist/doctor.js.map +0 -1
  68. package/dist/extensions.d.ts +0 -38
  69. package/dist/extensions.d.ts.map +0 -1
  70. package/dist/extensions.js +0 -35
  71. package/dist/extensions.js.map +0 -1
  72. package/dist/index.d.ts +0 -20
  73. package/dist/index.d.ts.map +0 -1
  74. package/dist/index.js +0 -20
  75. package/dist/index.js.map +0 -1
  76. package/dist/merge.d.ts +0 -16
  77. package/dist/merge.d.ts.map +0 -1
  78. package/dist/merge.js +0 -34
  79. package/dist/merge.js.map +0 -1
  80. package/dist/ref.d.ts +0 -29
  81. package/dist/ref.d.ts.map +0 -1
  82. package/dist/ref.js +0 -30
  83. package/dist/ref.js.map +0 -1
  84. package/dist/registry.d.ts +0 -24
  85. package/dist/registry.d.ts.map +0 -1
  86. package/dist/registry.js +0 -12
  87. package/dist/registry.js.map +0 -1
  88. package/dist/resolve.d.ts +0 -21
  89. package/dist/resolve.d.ts.map +0 -1
  90. package/dist/resolve.js +0 -177
  91. package/dist/resolve.js.map +0 -1
  92. package/dist/secret-heuristics.d.ts +0 -10
  93. package/dist/secret-heuristics.d.ts.map +0 -1
  94. package/dist/secret-heuristics.js +0 -11
  95. package/dist/secret-heuristics.js.map +0 -1
  96. package/dist/trails/config-check.d.ts +0 -11
  97. package/dist/trails/config-check.d.ts.map +0 -1
  98. package/dist/trails/config-check.js +0 -53
  99. package/dist/trails/config-check.js.map +0 -1
  100. package/dist/trails/config-describe.d.ts +0 -12
  101. package/dist/trails/config-describe.d.ts.map +0 -1
  102. package/dist/trails/config-describe.js +0 -41
  103. package/dist/trails/config-describe.js.map +0 -1
  104. package/dist/trails/config-explain.d.ts +0 -8
  105. package/dist/trails/config-explain.d.ts.map +0 -1
  106. package/dist/trails/config-explain.js +0 -74
  107. package/dist/trails/config-explain.js.map +0 -1
  108. package/dist/trails/config-init.d.ts +0 -9
  109. package/dist/trails/config-init.d.ts.map +0 -1
  110. package/dist/trails/config-init.js +0 -78
  111. package/dist/trails/config-init.js.map +0 -1
  112. package/dist/workspace.d.ts +0 -9
  113. package/dist/workspace.d.ts.map +0 -1
  114. package/dist/workspace.js +0 -49
  115. package/dist/workspace.js.map +0 -1
  116. package/dist/zod-utils.d.ts +0 -14
  117. package/dist/zod-utils.d.ts.map +0 -1
  118. package/dist/zod-utils.js +0 -41
  119. package/dist/zod-utils.js.map +0 -1
  120. package/src/__tests__/app-config.test.ts +0 -342
  121. package/src/__tests__/compose.test.ts +0 -59
  122. package/src/__tests__/config-check.test.ts +0 -171
  123. package/src/__tests__/config-describe.test.ts +0 -154
  124. package/src/__tests__/config-explain.test.ts +0 -167
  125. package/src/__tests__/config-init.test.ts +0 -210
  126. package/src/__tests__/config-resource.test.ts +0 -87
  127. package/src/__tests__/define-config.test.ts +0 -269
  128. package/src/__tests__/derive-fields.test.ts +0 -158
  129. package/src/__tests__/derive-provenance.test.ts +0 -139
  130. package/src/__tests__/derive.test.ts +0 -269
  131. package/src/__tests__/doctor.test.ts +0 -172
  132. package/src/__tests__/extensions.test.ts +0 -134
  133. package/src/__tests__/ref.test.ts +0 -35
  134. package/src/__tests__/resolve.test.ts +0 -246
  135. package/src/__tests__/workspace.test.ts +0 -64
  136. package/src/workspace.ts +0 -56
  137. package/tsconfig.json +0 -9
  138. package/tsconfig.tests.json +0 -10
  139. package/tsconfig.tsbuildinfo +0 -1
@@ -1,41 +0,0 @@
1
- /**
2
- * Infrastructure trail that describes all config fields in a schema.
3
- *
4
- * Returns a structured catalog of field definitions suitable for
5
- * CLI rendering or agent inspection.
6
- */
7
- import { Result, trail } from '@ontrails/core';
8
- import { z } from 'zod';
9
- import { configResource } from '../config-resource.js';
10
- import { deriveConfigFields } from '../derive-fields.js';
11
- const fieldSchema = z.object({
12
- deprecated: z.string().optional(),
13
- description: z.string().optional(),
14
- env: z.string().optional(),
15
- path: z.string(),
16
- required: z.boolean(),
17
- secret: z.boolean().optional(),
18
- type: z.string(),
19
- });
20
- const outputSchema = z.object({
21
- fields: z.array(fieldSchema),
22
- });
23
- export const configDescribe = trail('config.describe', {
24
- blaze: (_input, ctx) => {
25
- const state = configResource.from(ctx);
26
- const fields = deriveConfigFields(state.schema);
27
- return Result.ok({ fields: [...fields] });
28
- },
29
- examples: [
30
- {
31
- input: {},
32
- name: 'Describe all config fields',
33
- },
34
- ],
35
- input: z.object({}),
36
- intent: 'read',
37
- meta: { category: 'infrastructure' },
38
- output: outputSchema,
39
- resources: [configResource],
40
- });
41
- //# sourceMappingURL=config-describe.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-describe.js","sourceRoot":"","sources":["../../src/trails/config-describe.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,kBAAkB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CAAC,CAAC"}
@@ -1,8 +0,0 @@
1
- export declare const configExplain: import("@ontrails/core").Trail<{
2
- path: string;
3
- }, {
4
- entries: {
5
- readonly path: string;
6
- }[];
7
- }, never>;
8
- //# sourceMappingURL=config-explain.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-explain.d.ts","sourceRoot":"","sources":["../../src/trails/config-explain.ts"],"names":[],"mappings":"AAoEA,eAAO,MAAM,aAAa;;;;uBAvCG,MAAM;;SA+DjC,CAAC"}
@@ -1,74 +0,0 @@
1
- /**
2
- * Infrastructure trail that exposes config provenance.
3
- *
4
- * Returns resolved config entries with source information so agents
5
- * and operators can answer "where did this value come from?"
6
- */
7
- import { Result, trail } from '@ontrails/core';
8
- import { z } from 'zod';
9
- import { configResource } from '../config-resource.js';
10
- import { deriveConfigProvenance } from '../derive-provenance.js';
11
- const provenanceEntrySchema = z.object({
12
- path: z.string(),
13
- redacted: z.boolean(),
14
- source: z.string(),
15
- value: z.unknown(),
16
- });
17
- const outputSchema = z.object({
18
- entries: z.array(provenanceEntrySchema),
19
- });
20
- /** Filter provenance entries by path prefix when specified. */
21
- const filterByPath = (entries, prefix) => prefix
22
- ? entries.filter((entry) => entry.path === prefix || entry.path.startsWith(`${prefix}.`))
23
- : entries;
24
- /** Build DeriveConfigProvenanceOptions from ConfigState, omitting undefined source overrides. */
25
- const toExplainOptions = (state) => {
26
- const base = {
27
- resolved: state.resolved,
28
- schema: state.schema,
29
- };
30
- if (state.base) {
31
- return { ...base, base: state.base };
32
- }
33
- return base;
34
- };
35
- /** Enrich explain options with env and source overrides from state. */
36
- const enrichOptions = (state, options) => {
37
- let enriched = options;
38
- if (state.env) {
39
- enriched = { ...enriched, env: state.env };
40
- }
41
- if (state.profile) {
42
- enriched = { ...enriched, profile: state.profile };
43
- }
44
- if (state.local) {
45
- enriched = { ...enriched, local: state.local };
46
- }
47
- return enriched;
48
- };
49
- export const configExplain = trail('config.explain', {
50
- blaze: (input, ctx) => {
51
- const state = configResource.from(ctx);
52
- const options = enrichOptions(state, toExplainOptions(state));
53
- const entries = deriveConfigProvenance(options);
54
- const filtered = filterByPath(entries, input.path);
55
- return Result.ok({ entries: [...filtered] });
56
- },
57
- examples: [
58
- {
59
- input: {},
60
- name: 'Explain all fields',
61
- },
62
- ],
63
- input: z.object({
64
- path: z
65
- .string()
66
- .describe('Config field path to explain (or empty for all)')
67
- .default(''),
68
- }),
69
- intent: 'read',
70
- meta: { category: 'infrastructure' },
71
- output: outputSchema,
72
- resources: [configResource],
73
- });
74
- //# sourceMappingURL=config-explain.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-explain.js","sourceRoot":"","sources":["../../src/trails/config-explain.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAC/C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,sBAAsB,EAAE,MAAM,yBAAyB,CAAC;AAGjE,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IACrC,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;IAChB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;IACrB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,OAAO,EAAE;CACnB,CAAC,CAAC;AAEH,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5B,OAAO,EAAE,CAAC,CAAC,KAAK,CAAC,qBAAqB,CAAC;CACxC,CAAC,CAAC;AAEH,+DAA+D;AAC/D,MAAM,YAAY,GAAG,CACnB,OAA6C,EAC7C,MAAc,EACwB,EAAE,CACxC,MAAM;IACJ,CAAC,CAAC,OAAO,CAAC,MAAM,CACZ,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,KAAK,MAA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G,aAAa,CAAC,KAAK,EAAE,gBAAgB,CAAC,KAAK,CAAC,CAAC,CAAC;QAC9D,MAAM,OAAO,GAAG,sBAAsB,CAAC,OAAO,CAAC,CAAC;QAChD,MAAM,QAAQ,GAAG,YAAY,CAAC,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,CAAC;QACnD,OAAO,MAAM,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;IACD,QAAQ,EAAE;QACR;YACE,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,oBAAoB;SAC3B;KACF;IACD,KAAK,EAAE,CAAC,CAAC,MAAM,CAAC;QACd,IAAI,EAAE,CAAC;aACJ,MAAM,EAAE;aACR,QAAQ,CAAC,iDAAiD,CAAC;aAC3D,OAAO,CAAC,EAAE,CAAC;KACf,CAAC;IACF,MAAM,EAAE,MAAM;IACd,IAAI,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE;IACpC,MAAM,EAAE,YAAY;IACpB,SAAS,EAAE,CAAC,cAAc,CAAC;CAC5B,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- export declare const configInit: import("@ontrails/core").Trail<{
2
- format: "toml" | "json" | "jsonc" | "yaml";
3
- dir?: string | undefined;
4
- }, {
5
- content: string;
6
- format: string;
7
- writtenFiles?: string[] | undefined;
8
- }, never>;
9
- //# sourceMappingURL=config-init.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-init.d.ts","sourceRoot":"","sources":["../../src/trails/config-init.ts"],"names":[],"mappings":"AA+DA,eAAO,MAAM,UAAU;;;;;;;SAgCrB,CAAC"}
@@ -1,78 +0,0 @@
1
- /**
2
- * Infrastructure trail that generates an example config file.
3
- *
4
- * Produces TOML, JSON, JSONC, or YAML output from the registered
5
- * config schema, with defaults shown and deprecated fields annotated.
6
- *
7
- * When `dir` is provided, also writes `.env.example` and `.schema.json`
8
- * to the specified directory.
9
- */
10
- import { join } from 'node:path';
11
- import { mkdir } from 'node:fs/promises';
12
- import { Result, trail } from '@ontrails/core';
13
- import { z as zod } from 'zod';
14
- import { configResource } from '../config-resource.js';
15
- import { deriveConfigEnvExample, deriveConfigExample, deriveConfigJsonSchema, } from '../derive/index.js';
16
- const formatEnum = zod.enum(['toml', 'json', 'jsonc', 'yaml']);
17
- const outputSchema = zod.object({
18
- content: zod.string(),
19
- format: zod.string(),
20
- writtenFiles: zod.array(zod.string()).optional(),
21
- });
22
- /** Collect artifacts to write: [relativeName, content] pairs. */
23
- const collectArtifacts = (schema) => {
24
- const artifacts = [];
25
- const envContent = deriveConfigEnvExample(schema);
26
- if (envContent.length > 0) {
27
- artifacts.push(['.env.example', envContent]);
28
- }
29
- artifacts.push([
30
- '.schema.json',
31
- JSON.stringify(deriveConfigJsonSchema(schema), null, 2),
32
- ]);
33
- return artifacts;
34
- };
35
- /** Write generated artifacts to the target directory. */
36
- const writeArtifacts = async (dir, schema) => {
37
- await mkdir(dir, { recursive: true });
38
- const artifacts = collectArtifacts(schema);
39
- const written = [];
40
- for (const [name, content] of artifacts) {
41
- const fullPath = join(dir, name);
42
- await Bun.write(fullPath, content);
43
- written.push(fullPath);
44
- }
45
- return written;
46
- };
47
- export const configInit = trail('config.init', {
48
- blaze: async (input, ctx) => {
49
- const state = configResource.from(ctx);
50
- const schema = state.schema;
51
- const content = deriveConfigExample(schema, input.format);
52
- if (input.dir) {
53
- const writtenFiles = await writeArtifacts(input.dir, schema);
54
- return Result.ok({ content, format: input.format, writtenFiles });
55
- }
56
- return Result.ok({ content, format: input.format });
57
- },
58
- examples: [
59
- {
60
- input: {},
61
- name: 'Generate TOML example',
62
- },
63
- ],
64
- input: zod.object({
65
- dir: zod
66
- .string()
67
- .describe('Directory to write generated artifacts to')
68
- .optional(),
69
- format: formatEnum
70
- .describe('Output format for the example config file')
71
- .default('toml'),
72
- }),
73
- intent: 'write',
74
- meta: { category: 'infrastructure' },
75
- output: outputSchema,
76
- resources: [configResource],
77
- });
78
- //# sourceMappingURL=config-init.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config-init.js","sourceRoot":"","sources":["../../src/trails/config-init.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAEzC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAE/C,OAAO,EAAE,CAAC,IAAI,GAAG,EAAE,MAAM,KAAK,CAAC;AAE/B,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,sBAAsB,GACvB,MAAM,oBAAoB,CAAC;AAE5B,MAAM,UAAU,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;AAE/D,MAAM,YAAY,GAAG,GAAG,CAAC,MAAM,CAAC;IAC9B,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE;IACrB,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE;IACpB,YAAY,EAAE,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;CACjD,CAAC,CAAC;AAEH,iEAAiE;AACjE,MAAM,gBAAgB,GAAG,CACvB,MAA8C,EAC1B,EAAE;IACtB,MAAM,SAAS,GAAuB,EAAE,CAAC;IACzC,MAAM,UAAU,GAAG,sBAAsB,CAAC,MAAM,CAAC,CAAC;IAClD,IAAI,UAAU,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QAC1B,SAAS,CAAC,IAAI,CAAC,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC,CAAC;IAC/C,CAAC;IACD,SAAS,CAAC,IAAI,CAAC;QACb,cAAc;QACd,IAAI,CAAC,SAAS,CAAC,sB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,CAAC;QACpE,CAAC;QAED,OAAO,MAAM,CAAC,EAAE,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,CAAC,CAAC;IACtD,CAAC;IACD,QAAQ,EAAE;QACR;YACE,KAAK,EAAE,EAAE;YACT,IAAI,EAAE,uBAAuB;SAC9B;KACF;IACD,KAAK,EAAE,GAAG,CAAC,MAAM,CAAC;QAChB,GAAG,EAAE,GAAG;aACL,MAAM,EAAE;aACR,QAAQ,CAAC,2CAA2C,CAAC;aACrD,QAAQ,EAAE;QACb,MAAM,EAAE,UAAU;aACf,QAAQ,CAAC,2CAA2C,CAAC;aACrD,OAAO,CAAC,MAAM,CAAC;KACnB,CAAC;IACF,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,EAAE,QAAQ,EAAE,gBAAgB,EAAE;IACpC,MAAM,EAAE,YAAY;IACpB,SAAS,EAAE,CAAC,cAAc,CAAC;CAC5B,CAAC,CAAC"}
@@ -1,9 +0,0 @@
1
- /**
2
- * Ensure the `.trails/` workspace directory exists with proper structure.
3
- *
4
- * Creates `config/`, `dev/`, and `generated/` subdirectories plus a
5
- * `.gitignore` that excludes local-only files. Safe to call repeatedly —
6
- * existing files are never overwritten.
7
- */
8
- export declare const ensureWorkspace: (root: string) => Promise<void>;
9
- //# sourceMappingURL=workspace.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspace.d.ts","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAwCA;;;;;;GAMG;AACH,eAAO,MAAM,eAAe,GAAU,MAAM,MAAM,KAAG,OAAO,CAAC,IAAI,CAQhE,CAAC"}
package/dist/workspace.js DELETED
@@ -1,49 +0,0 @@
1
- /**
2
- * Ensure the `.trails/` workspace directory exists with proper structure.
3
- *
4
- * Auto-creates on first framework operation. The workspace holds local
5
- * config overrides, development state, and generated artifacts that
6
- * should not be committed to source control.
7
- */
8
- import { mkdir } from 'node:fs/promises';
9
- import { join } from 'node:path';
10
- const WORKSPACE_DIRS = ['config', 'dev', 'generated'];
11
- const GITIGNORE_CONTENT = [
12
- '# Local config overrides',
13
- 'config/',
14
- '',
15
- '# Development state',
16
- 'dev/',
17
- '',
18
- '# Generated artifacts',
19
- 'generated/',
20
- '',
21
- '# Shared Trails database',
22
- 'trails.db',
23
- 'trails.db-shm',
24
- 'trails.db-wal',
25
- '',
26
- ].join('\n');
27
- /**
28
- * Write `.gitignore` inside the workspace directory if it does not already exist.
29
- */
30
- const writeGitignoreIfMissing = async (trailsDir) => {
31
- const gitignorePath = join(trailsDir, '.gitignore');
32
- const file = Bun.file(gitignorePath);
33
- if (!(await file.exists())) {
34
- await Bun.write(gitignorePath, GITIGNORE_CONTENT);
35
- }
36
- };
37
- /**
38
- * Ensure the `.trails/` workspace directory exists with proper structure.
39
- *
40
- * Creates `config/`, `dev/`, and `generated/` subdirectories plus a
41
- * `.gitignore` that excludes local-only files. Safe to call repeatedly —
42
- * existing files are never overwritten.
43
- */
44
- export const ensureWorkspace = async (root) => {
45
- const trailsDir = join(root, '.trails');
46
- await Promise.all(WORKSPACE_DIRS.map((d) => mkdir(join(trailsDir, d), { recursive: true })));
47
- await writeGitignoreIfMissing(trailsDir);
48
- };
49
- //# sourceMappingURL=workspace.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"workspace.js","sourceRoot":"","sources":["../src/workspace.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,MAAM,cAAc,GAAG,CAAC,QAAQ,EAAE,KAAK,EAAE,WAAW,CAAU,CAAC;AAE/D,MAAM,iBAAiB,GAAG;IACxB,0BAA0B;IAC1B,SAAS;IACT,EAAE;IACF,qBAAqB;IACrB,MAAM;IACN,EAAE;IACF,uBAAuB;IACvB,YAAY;IACZ,EAAE;IACF,0BAA0B;IAC1B,WAAW;IACX,eAAe;IACf,eAAe;IACf,EAAE;CACH,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAEb;;GAEG;AACH,MAAM,uBAAuB,GAAG,KAAK,EAAE,SAAiB,EAAiB,EAAE;IACzE,MAAM,aAAa,GAAG,IAAI,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IACpD,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACrC,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,CAAC;QAC3B,MAAM,GAAG,CAAC,KAAK,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;IACpD,CAAC;AACH,CAAC,CAAC;AAEF;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,eAAe,GAAG,KAAK,EAAE,IAAY,EAAiB,EAAE;IACnE,MAAM,SAAS,GAAG,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAExC,MAAM,OAAO,CAAC,GAAG,CACf,cAAc,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,EAAE,CAAC,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAC1E,CAAC;IAEF,MAAM,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC3C,CAAC,CAAC"}
@@ -1,14 +0,0 @@
1
- /**
2
- * Shared Zod introspection helpers used by config resolution, doctor,
3
- * describe, explain, and collect modules.
4
- */
5
- import type { z } from 'zod';
6
- /** Extract the Zod def record from any ZodType. */
7
- export declare const zodDef: (schema: z.ZodType) => Record<string, unknown>;
8
- /** Unwrap through optional/default/nullable wrappers to find the base schema. */
9
- export declare const unwrapToBase: (schema: z.ZodType) => z.ZodType;
10
- /** Check if a schema is (or wraps) a ZodObject by inspecting its def. */
11
- export declare const isZodObject: (schema: z.ZodType) => schema is z.ZodObject<Record<string, z.ZodType>>;
12
- /** Read a value at a dot-separated path from a plain object. */
13
- export declare const getAtPath: (obj: Record<string, unknown>, path: string) => unknown;
14
- //# sourceMappingURL=zod-utils.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zod-utils.d.ts","sourceRoot":"","sources":["../src/zod-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAE7B,mDAAmD;AACnD,eAAO,MAAM,MAAM,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CACf,CAAC;AAKnD,iFAAiF;AACjF,eAAO,MAAM,YAAY,GAAI,QAAQ,CAAC,CAAC,OAAO,KAAG,CAAC,CAAC,OAclD,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,WAAW,GACtB,QAAQ,CAAC,CAAC,OAAO,KAChB,MAAM,IAAI,CAAC,CAAC,SAAS,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,CAGjD,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,SAAS,GACpB,KAAK,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC5B,MAAM,MAAM,KACX,OASF,CAAC"}
package/dist/zod-utils.js DELETED
@@ -1,41 +0,0 @@
1
- /**
2
- * Shared Zod introspection helpers used by config resolution, doctor,
3
- * describe, explain, and collect modules.
4
- */
5
- /** Extract the Zod def record from any ZodType. */
6
- export const zodDef = (schema) => schema.def;
7
- /** Wrapper types that should be peeled before checking the base type. */
8
- const WRAPPER_TYPES = new Set(['optional', 'default', 'nullable']);
9
- /** Unwrap through optional/default/nullable wrappers to find the base schema. */
10
- export const unwrapToBase = (schema) => {
11
- let current = schema;
12
- for (let depth = 0; depth < 10; depth += 1) {
13
- const def = zodDef(current);
14
- if (!WRAPPER_TYPES.has(def['type'])) {
15
- return current;
16
- }
17
- const inner = def['innerType'];
18
- if (!inner) {
19
- return current;
20
- }
21
- current = inner;
22
- }
23
- return current;
24
- };
25
- /** Check if a schema is (or wraps) a ZodObject by inspecting its def. */
26
- export const isZodObject = (schema) => {
27
- const def = zodDef(unwrapToBase(schema));
28
- return def['type'] === 'object' && 'shape' in def;
29
- };
30
- /** Read a value at a dot-separated path from a plain object. */
31
- export const getAtPath = (obj, path) => {
32
- let current = obj;
33
- for (const part of path.split('.')) {
34
- if (typeof current !== 'object' || current === null) {
35
- return undefined;
36
- }
37
- current = current[part];
38
- }
39
- return current;
40
- };
41
- //# sourceMappingURL=zod-utils.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"zod-utils.js","sourceRoot":"","sources":["../src/zod-utils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,mDAAmD;AACnD,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,MAAiB,EAA2B,EAAE,CACnE,MAAM,CAAC,GAAyC,CAAC;AAEnD,yEAAyE;AACzE,MAAM,aAAa,GAAG,IAAI,GAAG,CAAC,CAAC,UAAU,EAAE,SAAS,EAAE,UAAU,CAAC,CAAC,CAAC;AAEnE,iFAAiF;AACjF,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAiB,EAAa,EAAE;IAC3D,IAAI,OAAO,GAAG,MAAM,CAAC;IACrB,KAAK,IAAI,KAAK,GAAG,CAAC,EAAE,KAAK,GAAG,EAAE,EAAE,KAAK,IAAI,CAAC,EAAE,CAAC;QAC3C,MAAM,GAAG,GAAG,MAAM,CAAC,OAAO,CAAC,CAAC;QAC5B,IAAI,CAAC,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAW,CAAC,EAAE,CAAC;YAC9C,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,MAAM,KAAK,GAAG,GAAG,CAAC,WAAW,CAA0B,CAAC;QACxD,IAAI,CAAC,KAAK,EAAE,CAAC;YACX,OAAO,OAAO,CAAC;QACjB,CAAC;QACD,OAAO,GAAG,KAAK,CAAC;IAClB,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAA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