@kitsy/cnos 1.3.0 → 1.5.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.
Files changed (59) hide show
  1. package/README.md +1 -1
  2. package/dist/build/index.cjs +153 -11
  3. package/dist/build/index.d.cts +11 -3
  4. package/dist/build/index.d.ts +11 -3
  5. package/dist/build/index.js +56 -9
  6. package/dist/{chunk-DRKDNY4I.js → chunk-APIU4GTB.js} +14 -4
  7. package/dist/{chunk-K6QYI2T4.js → chunk-EQSKV3DP.js} +1 -1
  8. package/dist/{chunk-JDII6O72.js → chunk-FWJC4Y2D.js} +1 -1
  9. package/dist/{chunk-QTKXPY3N.js → chunk-HMM76UYZ.js} +1 -1
  10. package/dist/{chunk-OOKFRWTN.js → chunk-J4K4JUJL.js} +1 -1
  11. package/dist/{chunk-EDCLLCNL.js → chunk-RYGSG3GR.js} +8 -8
  12. package/dist/{chunk-FC3IV6A7.js → chunk-T6Y57KTT.js} +20 -1
  13. package/dist/{chunk-E7SE6N26.js → chunk-TO76YYS4.js} +3 -3
  14. package/dist/chunk-WCHX2QFY.js +115 -0
  15. package/dist/{chunk-OWUZQ4OH.js → chunk-ZTPSFXWP.js} +1 -1
  16. package/dist/configure/index.cjs +102 -9
  17. package/dist/configure/index.d.cts +3 -3
  18. package/dist/configure/index.d.ts +3 -3
  19. package/dist/configure/index.js +8 -8
  20. package/dist/{envNaming-Dy3WYiGK.d.ts → envNaming-Dvm_LP2D.d.ts} +1 -1
  21. package/dist/{envNaming-D6k66myh.d.cts → envNaming-S4B-dHUx.d.cts} +1 -1
  22. package/dist/index.cjs +102 -9
  23. package/dist/index.d.cts +1 -1
  24. package/dist/index.d.ts +1 -1
  25. package/dist/index.js +10 -10
  26. package/dist/internal.cjs +14 -2
  27. package/dist/internal.d.cts +5 -4
  28. package/dist/internal.d.ts +5 -4
  29. package/dist/internal.js +10 -3
  30. package/dist/plugin/basic-schema.d.cts +1 -1
  31. package/dist/plugin/basic-schema.d.ts +1 -1
  32. package/dist/plugin/basic-schema.js +2 -2
  33. package/dist/plugin/cli-args.d.cts +1 -1
  34. package/dist/plugin/cli-args.d.ts +1 -1
  35. package/dist/plugin/cli-args.js +2 -2
  36. package/dist/plugin/dotenv.d.cts +2 -2
  37. package/dist/plugin/dotenv.d.ts +2 -2
  38. package/dist/plugin/dotenv.js +2 -2
  39. package/dist/plugin/env-export.d.cts +2 -2
  40. package/dist/plugin/env-export.d.ts +2 -2
  41. package/dist/plugin/env-export.js +2 -2
  42. package/dist/plugin/filesystem.cjs +19 -0
  43. package/dist/plugin/filesystem.d.cts +1 -1
  44. package/dist/plugin/filesystem.d.ts +1 -1
  45. package/dist/plugin/filesystem.js +2 -2
  46. package/dist/plugin/process-env.cjs +74 -7
  47. package/dist/plugin/process-env.d.cts +4 -3
  48. package/dist/plugin/process-env.d.ts +4 -3
  49. package/dist/plugin/process-env.js +6 -4
  50. package/dist/{plugin-CyNkf7Dm.d.cts → plugin-B4xwySxw.d.cts} +2 -1
  51. package/dist/{plugin-CyNkf7Dm.d.ts → plugin-B4xwySxw.d.ts} +2 -1
  52. package/dist/runtime/index.cjs +102 -9
  53. package/dist/runtime/index.d.cts +1 -1
  54. package/dist/runtime/index.d.ts +1 -1
  55. package/dist/runtime/index.js +10 -10
  56. package/dist/{toPublicEnv-D2PZkaN-.d.ts → toPublicEnv-CvhGAfsB.d.ts} +1 -1
  57. package/dist/{toPublicEnv-Cz72m6y0.d.cts → toPublicEnv-ggmphZFs.d.cts} +1 -1
  58. package/package.json +1 -1
  59. package/dist/chunk-CDXJISGB.js +0 -49
package/README.md CHANGED
@@ -19,4 +19,4 @@ CLI-oriented storage/export rules to be aware of:
19
19
  - shell env export comes from explicit `envMapping.explicit`
20
20
  - local secret material lives outside the repo in encrypted vault storage under `~/.cnos/secrets`
21
21
 
22
- Use `@kitsy/cnos-vite` for Vite projects and `@kitsy/cnos-next` for Next.js projects when you want CNOS public values projected into framework-native env surfaces and embedded for `@kitsy/cnos/browser`.
22
+ Use `@kitsy/cnos-vite` for Vite projects, `@kitsy/cnos-next` for Next.js projects, and `@kitsy/cnos-webpack` for webpack/static bundles when you want CNOS public values projected into framework-native env surfaces and embedded for `@kitsy/cnos/browser`.
@@ -30,7 +30,9 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
30
30
  // src/build/index.ts
31
31
  var build_exports = {};
32
32
  __export(build_exports, {
33
- resolveBrowserData: () => resolveBrowserData
33
+ resolveBrowserData: () => resolveBrowserData,
34
+ resolveFrameworkEnv: () => resolveFrameworkEnv,
35
+ toFrameworkEnv: () => toFrameworkEnv
34
36
  });
35
37
  module.exports = __toCommonJS(build_exports);
36
38
 
@@ -294,6 +296,11 @@ var DEFAULT_NAMESPACES = {
294
296
  shareable: false,
295
297
  readonly: true
296
298
  },
299
+ process: {
300
+ kind: "system",
301
+ shareable: false,
302
+ readonly: true
303
+ },
297
304
  public: {
298
305
  kind: "projection",
299
306
  source: "promote",
@@ -953,12 +960,15 @@ async function exists2(targetPath) {
953
960
  return false;
954
961
  }
955
962
  }
956
- async function resolveLocalWorkspaceRoot(manifestRoot, workspaceId) {
963
+ async function resolveLocalWorkspaceRoot(manifestRoot, workspaceId, manifest) {
957
964
  const workspaceRoot = import_node_path5.default.join(manifestRoot, "workspaces", workspaceId);
958
965
  if (await exists2(workspaceRoot)) {
959
966
  return workspaceRoot;
960
967
  }
961
- const legacyMarkers = ["values", "secrets", "env", "profiles"].map(
968
+ const customDataNamespaceRoots = Object.entries(manifest.namespaces).filter(
969
+ ([namespace, definition]) => namespace !== "value" && namespace !== "secret" && definition.kind === "data" && !definition.sensitive
970
+ ).map(([namespace]) => namespace);
971
+ const legacyMarkers = ["values", "secrets", "env", "profiles", ...customDataNamespaceRoots].map(
962
972
  (segment) => import_node_path5.default.join(manifestRoot, segment)
963
973
  );
964
974
  if ((await Promise.all(legacyMarkers.map((marker) => exists2(marker)))).some(Boolean)) {
@@ -1045,7 +1055,7 @@ async function resolveWorkspaceContext(manifest, options) {
1045
1055
  workspaceRoots.push({
1046
1056
  scope: "local",
1047
1057
  workspaceId: chainWorkspaceId,
1048
- path: await resolveLocalWorkspaceRoot(options.manifestRoot, chainWorkspaceId)
1058
+ path: await resolveLocalWorkspaceRoot(options.manifestRoot, chainWorkspaceId, manifest)
1049
1059
  });
1050
1060
  }
1051
1061
  return {
@@ -1210,6 +1220,7 @@ async function runPipeline(options) {
1210
1220
  const collectedEntries = await Promise.all(
1211
1221
  options.plugins.map(
1212
1222
  (plugin) => plugin.load({
1223
+ manifest: options.manifest,
1213
1224
  manifestConfig: {
1214
1225
  ...options.manifest.sources[plugin.id] ?? {},
1215
1226
  envMapping: options.manifest.envMapping
@@ -2308,7 +2319,7 @@ function envVarToLogicalKey(envVar, config = {}) {
2308
2319
  // package.json
2309
2320
  var package_default = {
2310
2321
  name: "@kitsy/cnos",
2311
- version: "1.3.0",
2322
+ version: "1.5.0",
2312
2323
  description: "Batteries-included CNOS runtime package wired with the official plugins.",
2313
2324
  type: "module",
2314
2325
  main: "./dist/index.cjs",
@@ -2782,11 +2793,30 @@ function createFilesystemValuesPlugin() {
2782
2793
  sourceRoot,
2783
2794
  context.profileActivation.values
2784
2795
  );
2796
+ const customNamespaces = Object.entries(context.manifest.namespaces).filter(
2797
+ ([namespace, definition]) => namespace !== "value" && namespace !== "secret" && definition.kind === "data" && !definition.sensitive
2798
+ ).map(([namespace]) => namespace);
2785
2799
  const entries = [];
2786
2800
  for (const file of files) {
2787
2801
  const document = await (0, import_promises13.readFile)(file.absolutePath, "utf8");
2788
2802
  entries.push(...filesystemValuesReader(file.relativePath, document, file.workspaceId));
2789
2803
  }
2804
+ for (const namespace of customNamespaces) {
2805
+ const layers = [
2806
+ namespace,
2807
+ ...context.profileChain.filter((profile) => profile !== "base").map((profile) => `profiles/${profile}/${namespace}`)
2808
+ ];
2809
+ const namespaceFiles = await collectFilesystemLayerFiles(
2810
+ context.manifestRoot,
2811
+ context.workspace.workspaceRoots,
2812
+ sourceRoot,
2813
+ layers
2814
+ );
2815
+ for (const file of namespaceFiles) {
2816
+ const document = await (0, import_promises13.readFile)(file.absolutePath, "utf8");
2817
+ entries.push(...yamlObjectToEntries(document, file.relativePath, namespace, "filesystem-values", file.workspaceId));
2818
+ }
2819
+ }
2790
2820
  return entries;
2791
2821
  }
2792
2822
  };
@@ -2794,6 +2824,11 @@ function createFilesystemValuesPlugin() {
2794
2824
 
2795
2825
  // ../../plugins/process-env/src/index.ts
2796
2826
  var PROCESS_ENV_PLUGIN_ID = "@kitsy/cnos/plugins/process-env";
2827
+ var PROCESS_GRAPH_OMIT = /* @__PURE__ */ new Set([
2828
+ "__CNOS_GRAPH__",
2829
+ "__CNOS_SECRET_PAYLOAD__",
2830
+ "__CNOS_SESSION_KEY__"
2831
+ ]);
2797
2832
  function processEnvEntriesFromObject(env, mapping = {}, workspaceId = "default") {
2798
2833
  return Object.entries(env).flatMap(([envVar, value]) => {
2799
2834
  if (typeof value !== "string") {
@@ -2818,17 +2853,77 @@ function processEnvEntriesFromObject(env, mapping = {}, workspaceId = "default")
2818
2853
  ];
2819
2854
  });
2820
2855
  }
2856
+ function processNamespaceEntriesFromContext(env, workspaceId = "default") {
2857
+ const envEntries = Object.entries(env).filter((entry) => typeof entry[1] === "string").filter(([envVar]) => !PROCESS_GRAPH_OMIT.has(envVar)).map(([envVar, value]) => ({
2858
+ key: `process.env.${envVar}`,
2859
+ value,
2860
+ namespace: "process",
2861
+ sourceId: "process-runtime",
2862
+ pluginId: PROCESS_ENV_PLUGIN_ID,
2863
+ workspaceId,
2864
+ origin: {
2865
+ envVar
2866
+ }
2867
+ }));
2868
+ const runtimeEntries = [
2869
+ {
2870
+ key: "process.cwd",
2871
+ value: process.cwd(),
2872
+ namespace: "process",
2873
+ sourceId: "process-runtime",
2874
+ pluginId: PROCESS_ENV_PLUGIN_ID,
2875
+ workspaceId
2876
+ },
2877
+ {
2878
+ key: "process.platform",
2879
+ value: process.platform,
2880
+ namespace: "process",
2881
+ sourceId: "process-runtime",
2882
+ pluginId: PROCESS_ENV_PLUGIN_ID,
2883
+ workspaceId
2884
+ },
2885
+ {
2886
+ key: "process.arch",
2887
+ value: process.arch,
2888
+ namespace: "process",
2889
+ sourceId: "process-runtime",
2890
+ pluginId: PROCESS_ENV_PLUGIN_ID,
2891
+ workspaceId
2892
+ },
2893
+ {
2894
+ key: "process.node.version",
2895
+ value: process.version,
2896
+ namespace: "process",
2897
+ sourceId: "process-runtime",
2898
+ pluginId: PROCESS_ENV_PLUGIN_ID,
2899
+ workspaceId
2900
+ },
2901
+ {
2902
+ key: "process.args.raw",
2903
+ value: process.argv.slice(2),
2904
+ namespace: "process",
2905
+ sourceId: "process-runtime",
2906
+ pluginId: PROCESS_ENV_PLUGIN_ID,
2907
+ workspaceId
2908
+ }
2909
+ ];
2910
+ return [...runtimeEntries, ...envEntries];
2911
+ }
2821
2912
  function createProcessEnvPlugin() {
2822
2913
  return {
2823
2914
  id: "process-env",
2824
2915
  kind: "loader",
2825
2916
  async load(context) {
2826
2917
  const config = context.manifestConfig;
2827
- return processEnvEntriesFromObject(
2828
- context.processEnv ?? process.env,
2829
- config.envMapping,
2830
- context.workspace.workspaceId
2831
- );
2918
+ const env = context.processEnv ?? process.env;
2919
+ return [
2920
+ ...processEnvEntriesFromObject(
2921
+ env,
2922
+ config.envMapping,
2923
+ context.workspace.workspaceId
2924
+ ),
2925
+ ...processNamespaceEntriesFromContext(env, context.workspace.workspaceId)
2926
+ ];
2832
2927
  }
2833
2928
  };
2834
2929
  }
@@ -2883,7 +2978,54 @@ async function resolveBrowserData(options = {}) {
2883
2978
  }
2884
2979
  return browserData;
2885
2980
  }
2981
+ function toScreamingSnakeSegment(segment) {
2982
+ return segment.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
2983
+ }
2984
+ function toScreamingSnake(path12) {
2985
+ return path12.split(".").map((segment) => toScreamingSnakeSegment(segment)).filter(Boolean).join("_");
2986
+ }
2987
+ function stripPublicNamespace(key) {
2988
+ return key.startsWith("public.") ? key.slice("public.".length) : key;
2989
+ }
2990
+ function resolveFrameworkPrefix(framework, prefix) {
2991
+ if (prefix !== void 0) {
2992
+ return prefix;
2993
+ }
2994
+ switch (framework) {
2995
+ case "vite":
2996
+ return "VITE_";
2997
+ case "next":
2998
+ return "NEXT_PUBLIC_";
2999
+ case "webpack":
3000
+ case "generic":
3001
+ return "";
3002
+ default:
3003
+ return "";
3004
+ }
3005
+ }
3006
+ function toFrameworkEnv(browserData, framework = "generic", options = {}) {
3007
+ const resolvedPrefix = resolveFrameworkPrefix(framework, options.prefix);
3008
+ return Object.fromEntries(
3009
+ Object.entries(browserData).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => [
3010
+ `${resolvedPrefix}${toScreamingSnake(stripPublicNamespace(key))}`,
3011
+ String(value)
3012
+ ])
3013
+ );
3014
+ }
3015
+ async function resolveFrameworkEnv(options = {}, framework = "generic", envOptions = {}) {
3016
+ if (framework === "generic") {
3017
+ const browserData = await resolveBrowserData(options);
3018
+ return toFrameworkEnv(browserData, framework, envOptions);
3019
+ }
3020
+ const runtime = await createCnos2(options);
3021
+ return runtime.toPublicEnv({
3022
+ framework,
3023
+ ...envOptions.prefix ? { prefix: envOptions.prefix } : {}
3024
+ });
3025
+ }
2886
3026
  // Annotate the CommonJS export names for ESM import in node:
2887
3027
  0 && (module.exports = {
2888
- resolveBrowserData
3028
+ resolveBrowserData,
3029
+ resolveFrameworkEnv,
3030
+ toFrameworkEnv
2889
3031
  });
@@ -1,5 +1,13 @@
1
- import { C as CnosCreateOptions } from '../plugin-CyNkf7Dm.cjs';
1
+ import { C as CnosCreateOptions } from '../plugin-B4xwySxw.cjs';
2
2
 
3
- declare function resolveBrowserData(options?: CnosCreateOptions): Promise<Record<string, unknown>>;
3
+ type BrowserDataMap = Record<string, unknown>;
4
+ type FrameworkEnvTarget = 'generic' | 'vite' | 'next' | 'webpack' | (string & {});
5
+ declare function resolveBrowserData(options?: CnosCreateOptions): Promise<BrowserDataMap>;
6
+ declare function toFrameworkEnv(browserData: BrowserDataMap, framework?: FrameworkEnvTarget, options?: {
7
+ prefix?: string;
8
+ }): Record<string, string>;
9
+ declare function resolveFrameworkEnv(options?: CnosCreateOptions, framework?: FrameworkEnvTarget, envOptions?: {
10
+ prefix?: string;
11
+ }): Promise<Record<string, string>>;
4
12
 
5
- export { resolveBrowserData };
13
+ export { type BrowserDataMap, type FrameworkEnvTarget, resolveBrowserData, resolveFrameworkEnv, toFrameworkEnv };
@@ -1,5 +1,13 @@
1
- import { C as CnosCreateOptions } from '../plugin-CyNkf7Dm.js';
1
+ import { C as CnosCreateOptions } from '../plugin-B4xwySxw.js';
2
2
 
3
- declare function resolveBrowserData(options?: CnosCreateOptions): Promise<Record<string, unknown>>;
3
+ type BrowserDataMap = Record<string, unknown>;
4
+ type FrameworkEnvTarget = 'generic' | 'vite' | 'next' | 'webpack' | (string & {});
5
+ declare function resolveBrowserData(options?: CnosCreateOptions): Promise<BrowserDataMap>;
6
+ declare function toFrameworkEnv(browserData: BrowserDataMap, framework?: FrameworkEnvTarget, options?: {
7
+ prefix?: string;
8
+ }): Record<string, string>;
9
+ declare function resolveFrameworkEnv(options?: CnosCreateOptions, framework?: FrameworkEnvTarget, envOptions?: {
10
+ prefix?: string;
11
+ }): Promise<Record<string, string>>;
4
12
 
5
- export { resolveBrowserData };
13
+ export { type BrowserDataMap, type FrameworkEnvTarget, resolveBrowserData, resolveFrameworkEnv, toFrameworkEnv };
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  createCnos
3
- } from "../chunk-EDCLLCNL.js";
4
- import "../chunk-OOKFRWTN.js";
5
- import "../chunk-FC3IV6A7.js";
6
- import "../chunk-CDXJISGB.js";
7
- import "../chunk-JDII6O72.js";
8
- import "../chunk-OWUZQ4OH.js";
9
- import "../chunk-QTKXPY3N.js";
10
- import "../chunk-DRKDNY4I.js";
3
+ } from "../chunk-RYGSG3GR.js";
4
+ import "../chunk-J4K4JUJL.js";
5
+ import "../chunk-T6Y57KTT.js";
6
+ import "../chunk-WCHX2QFY.js";
7
+ import "../chunk-FWJC4Y2D.js";
8
+ import "../chunk-ZTPSFXWP.js";
9
+ import "../chunk-HMM76UYZ.js";
10
+ import "../chunk-APIU4GTB.js";
11
11
 
12
12
  // src/build/index.ts
13
13
  async function resolveBrowserData(options = {}) {
@@ -21,6 +21,53 @@ async function resolveBrowserData(options = {}) {
21
21
  }
22
22
  return browserData;
23
23
  }
24
+ function toScreamingSnakeSegment(segment) {
25
+ return segment.replace(/([a-z0-9])([A-Z])/g, "$1_$2").replace(/[^A-Za-z0-9]+/g, "_").replace(/_+/g, "_").replace(/^_+|_+$/g, "").toUpperCase();
26
+ }
27
+ function toScreamingSnake(path) {
28
+ return path.split(".").map((segment) => toScreamingSnakeSegment(segment)).filter(Boolean).join("_");
29
+ }
30
+ function stripPublicNamespace(key) {
31
+ return key.startsWith("public.") ? key.slice("public.".length) : key;
32
+ }
33
+ function resolveFrameworkPrefix(framework, prefix) {
34
+ if (prefix !== void 0) {
35
+ return prefix;
36
+ }
37
+ switch (framework) {
38
+ case "vite":
39
+ return "VITE_";
40
+ case "next":
41
+ return "NEXT_PUBLIC_";
42
+ case "webpack":
43
+ case "generic":
44
+ return "";
45
+ default:
46
+ return "";
47
+ }
48
+ }
49
+ function toFrameworkEnv(browserData, framework = "generic", options = {}) {
50
+ const resolvedPrefix = resolveFrameworkPrefix(framework, options.prefix);
51
+ return Object.fromEntries(
52
+ Object.entries(browserData).sort(([left], [right]) => left.localeCompare(right)).map(([key, value]) => [
53
+ `${resolvedPrefix}${toScreamingSnake(stripPublicNamespace(key))}`,
54
+ String(value)
55
+ ])
56
+ );
57
+ }
58
+ async function resolveFrameworkEnv(options = {}, framework = "generic", envOptions = {}) {
59
+ if (framework === "generic") {
60
+ const browserData = await resolveBrowserData(options);
61
+ return toFrameworkEnv(browserData, framework, envOptions);
62
+ }
63
+ const runtime = await createCnos(options);
64
+ return runtime.toPublicEnv({
65
+ framework,
66
+ ...envOptions.prefix ? { prefix: envOptions.prefix } : {}
67
+ });
68
+ }
24
69
  export {
25
- resolveBrowserData
70
+ resolveBrowserData,
71
+ resolveFrameworkEnv,
72
+ toFrameworkEnv
26
73
  };
@@ -234,7 +234,7 @@ function resolveWorkspaceScopedPath(workspaceRoot, template, tokens) {
234
234
  return path.resolve(workspaceRoot, interpolated);
235
235
  }
236
236
  function resolveNamespaceDirectory(workspaceRoot, namespace, profile) {
237
- const rootFolder = namespace === "value" ? "values" : "secrets";
237
+ const rootFolder = namespace === "value" ? "values" : namespace === "secret" ? "secrets" : namespace;
238
238
  if (profile && profile !== "base") {
239
239
  return path.resolve(workspaceRoot, "profiles", profile, rootFolder);
240
240
  }
@@ -303,6 +303,11 @@ var DEFAULT_NAMESPACES = {
303
303
  shareable: false,
304
304
  readonly: true
305
305
  },
306
+ process: {
307
+ kind: "system",
308
+ shareable: false,
309
+ readonly: true
310
+ },
306
311
  public: {
307
312
  kind: "projection",
308
313
  source: "promote",
@@ -1997,12 +2002,15 @@ async function exists3(targetPath) {
1997
2002
  return false;
1998
2003
  }
1999
2004
  }
2000
- async function resolveLocalWorkspaceRoot(manifestRoot, workspaceId) {
2005
+ async function resolveLocalWorkspaceRoot(manifestRoot, workspaceId, manifest) {
2001
2006
  const workspaceRoot = path9.join(manifestRoot, "workspaces", workspaceId);
2002
2007
  if (await exists3(workspaceRoot)) {
2003
2008
  return workspaceRoot;
2004
2009
  }
2005
- const legacyMarkers = ["values", "secrets", "env", "profiles"].map(
2010
+ const customDataNamespaceRoots = Object.entries(manifest.namespaces).filter(
2011
+ ([namespace, definition]) => namespace !== "value" && namespace !== "secret" && definition.kind === "data" && !definition.sensitive
2012
+ ).map(([namespace]) => namespace);
2013
+ const legacyMarkers = ["values", "secrets", "env", "profiles", ...customDataNamespaceRoots].map(
2006
2014
  (segment) => path9.join(manifestRoot, segment)
2007
2015
  );
2008
2016
  if ((await Promise.all(legacyMarkers.map((marker) => exists3(marker)))).some(Boolean)) {
@@ -2089,7 +2097,7 @@ async function resolveWorkspaceContext(manifest, options) {
2089
2097
  workspaceRoots.push({
2090
2098
  scope: "local",
2091
2099
  workspaceId: chainWorkspaceId,
2092
- path: await resolveLocalWorkspaceRoot(options.manifestRoot, chainWorkspaceId)
2100
+ path: await resolveLocalWorkspaceRoot(options.manifestRoot, chainWorkspaceId, manifest)
2093
2101
  });
2094
2102
  }
2095
2103
  return {
@@ -2254,6 +2262,7 @@ async function runPipeline(options) {
2254
2262
  const collectedEntries = await Promise.all(
2255
2263
  options.plugins.map(
2256
2264
  (plugin) => plugin.load({
2265
+ manifest: options.manifest,
2257
2266
  manifestConfig: {
2258
2267
  ...options.manifest.sources[plugin.id] ?? {},
2259
2268
  envMapping: options.manifest.envMapping
@@ -2571,6 +2580,7 @@ export {
2571
2580
  parseYaml,
2572
2581
  stringifyYaml,
2573
2582
  loadManifest,
2583
+ getNamespaceDefinition,
2574
2584
  ensureProjectionAllowed,
2575
2585
  applySchemaRules,
2576
2586
  writeVaultSessionKey,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  isSecretReference
3
- } from "./chunk-DRKDNY4I.js";
3
+ } from "./chunk-APIU4GTB.js";
4
4
 
5
5
  // src/runtime/bootstrap.ts
6
6
  import { createCipheriv, createDecipheriv, randomBytes } from "crypto";
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  applySchemaRules
3
- } from "./chunk-DRKDNY4I.js";
3
+ } from "./chunk-APIU4GTB.js";
4
4
 
5
5
  // ../../plugins/basic-schema/src/index.ts
6
6
  function createBasicSchemaPlugin() {
@@ -2,7 +2,7 @@ import {
2
2
  envVarToLogicalKey,
3
3
  resolveWorkspaceScopedPath,
4
4
  toPortablePath
5
- } from "./chunk-DRKDNY4I.js";
5
+ } from "./chunk-APIU4GTB.js";
6
6
 
7
7
  // ../../plugins/dotenv/src/index.ts
8
8
  import { readFile } from "fs/promises";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  toEnv,
3
3
  toPublicEnv
4
- } from "./chunk-DRKDNY4I.js";
4
+ } from "./chunk-APIU4GTB.js";
5
5
 
6
6
  // ../../plugins/env-export/src/index.ts
7
7
  function createEnvExportPlugin() {
@@ -1,27 +1,27 @@
1
1
  import {
2
2
  createEnvExportPlugin,
3
3
  createPublicEnvExportPlugin
4
- } from "./chunk-OOKFRWTN.js";
4
+ } from "./chunk-J4K4JUJL.js";
5
5
  import {
6
6
  createFilesystemSecretsPlugin,
7
7
  createFilesystemValuesPlugin
8
- } from "./chunk-FC3IV6A7.js";
8
+ } from "./chunk-T6Y57KTT.js";
9
9
  import {
10
10
  createProcessEnvPlugin
11
- } from "./chunk-CDXJISGB.js";
11
+ } from "./chunk-WCHX2QFY.js";
12
12
  import {
13
13
  createBasicSchemaPlugin
14
- } from "./chunk-JDII6O72.js";
14
+ } from "./chunk-FWJC4Y2D.js";
15
15
  import {
16
16
  createCliArgsPlugin
17
- } from "./chunk-OWUZQ4OH.js";
17
+ } from "./chunk-ZTPSFXWP.js";
18
18
  import {
19
19
  createDotenvPlugin
20
- } from "./chunk-QTKXPY3N.js";
20
+ } from "./chunk-HMM76UYZ.js";
21
21
  import {
22
22
  createCnos,
23
23
  createProvenanceInspector
24
- } from "./chunk-DRKDNY4I.js";
24
+ } from "./chunk-APIU4GTB.js";
25
25
 
26
26
  // src/defaultPlugins.ts
27
27
  function defaultPlugins() {
@@ -68,7 +68,7 @@ function setBootstrappedSecretHydrationRequired(value) {
68
68
  // package.json
69
69
  var package_default = {
70
70
  name: "@kitsy/cnos",
71
- version: "1.3.0",
71
+ version: "1.5.0",
72
72
  description: "Batteries-included CNOS runtime package wired with the official plugins.",
73
73
  type: "module",
74
74
  main: "./dist/index.cjs",
@@ -3,7 +3,7 @@ import {
3
3
  isSecretReference,
4
4
  parseYaml,
5
5
  toPortablePath
6
- } from "./chunk-DRKDNY4I.js";
6
+ } from "./chunk-APIU4GTB.js";
7
7
 
8
8
  // ../../plugins/filesystem/src/helpers.ts
9
9
  import { readdir } from "fs/promises";
@@ -155,11 +155,30 @@ function createFilesystemValuesPlugin() {
155
155
  sourceRoot,
156
156
  context.profileActivation.values
157
157
  );
158
+ const customNamespaces = Object.entries(context.manifest.namespaces).filter(
159
+ ([namespace, definition]) => namespace !== "value" && namespace !== "secret" && definition.kind === "data" && !definition.sensitive
160
+ ).map(([namespace]) => namespace);
158
161
  const entries = [];
159
162
  for (const file of files) {
160
163
  const document = await readFile2(file.absolutePath, "utf8");
161
164
  entries.push(...filesystemValuesReader(file.relativePath, document, file.workspaceId));
162
165
  }
166
+ for (const namespace of customNamespaces) {
167
+ const layers = [
168
+ namespace,
169
+ ...context.profileChain.filter((profile) => profile !== "base").map((profile) => `profiles/${profile}/${namespace}`)
170
+ ];
171
+ const namespaceFiles = await collectFilesystemLayerFiles(
172
+ context.manifestRoot,
173
+ context.workspace.workspaceRoots,
174
+ sourceRoot,
175
+ layers
176
+ );
177
+ for (const file of namespaceFiles) {
178
+ const document = await readFile2(file.absolutePath, "utf8");
179
+ entries.push(...yamlObjectToEntries(document, file.relativePath, namespace, "filesystem-values", file.workspaceId));
180
+ }
181
+ }
163
182
  return entries;
164
183
  }
165
184
  };
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  graphRequiresSecretHydration,
3
3
  readRuntimeGraphFromEnv
4
- } from "./chunk-K6QYI2T4.js";
4
+ } from "./chunk-EQSKV3DP.js";
5
5
  import {
6
6
  createCnos,
7
7
  getBootstrappedSecretHydrationRequired,
@@ -10,7 +10,7 @@ import {
10
10
  setBootstrappedSecretHydrationRequired,
11
11
  setSingletonReady,
12
12
  setSingletonRuntime
13
- } from "./chunk-EDCLLCNL.js";
13
+ } from "./chunk-RYGSG3GR.js";
14
14
  import {
15
15
  inspectValue,
16
16
  readOrValue,
@@ -20,7 +20,7 @@ import {
20
20
  toLogicalKey,
21
21
  toNamespaceObject,
22
22
  toPublicEnv
23
- } from "./chunk-DRKDNY4I.js";
23
+ } from "./chunk-APIU4GTB.js";
24
24
 
25
25
  // src/runtime/index.ts
26
26
  var NOT_READY_MESSAGE = "CNOS not initialized. Call await cnos.ready() or use cnos run.";