pepr 0.52.3-nightly.4 → 0.52.3-nightly.6

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.
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/build/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAuI/C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/build/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAepC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAsI/C"}
@@ -0,0 +1,3 @@
1
+ import { peprPackageJSON } from "./templates";
2
+ export declare function createProjectFiles(dirName: string, packageJSON: peprPackageJSON): Promise<void>;
3
+ //# sourceMappingURL=createProjectFiles.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createProjectFiles.d.ts","sourceRoot":"","sources":["../../../src/cli/init/createProjectFiles.ts"],"names":[],"mappings":"AACA,OAAO,EACL,eAAe,EAWhB,MAAM,aAAa,CAAC;AAGrB,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,MAAM,EACf,WAAW,EAAE,eAAe,GAC3B,OAAO,CAAC,IAAI,CAAC,CAyBf"}
@@ -0,0 +1,2 @@
1
+ export declare const doPostInitActions: (dirName: string) => void;
2
+ //# sourceMappingURL=doPostInitActions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"doPostInitActions.d.ts","sourceRoot":"","sources":["../../../src/cli/init/doPostInitActions.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,iBAAiB,GAAI,SAAS,MAAM,KAAG,IAoBnD,CAAC"}
@@ -1,3 +1,3 @@
1
1
  import { Command } from "commander";
2
- export default function (program: Command): void;
2
+ export default function (): Command;
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/init/index.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAqBpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAsD/C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/init/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAapC,MAAM,CAAC,OAAO,cAAc,OAAO,CAsDlC"}
@@ -0,0 +1,2 @@
1
+ export declare function setupProjectStructure(dirName: string): Promise<void>;
2
+ //# sourceMappingURL=setupProjectStructure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setupProjectStructure.d.ts","sourceRoot":"","sources":["../../../src/cli/init/setupProjectStructure.ts"],"names":[],"mappings":"AAGA,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAI1E"}
@@ -52,6 +52,9 @@ export declare const dependencies: {
52
52
  "build:image": string;
53
53
  "build:image:unicorn": string;
54
54
  ci: string;
55
+ "cluster:k3d": string;
56
+ "cluster:k3d:import-upstream": string;
57
+ "cluster:k3d:import-unicorn": string;
55
58
  "format:check": string;
56
59
  "format:fix": string;
57
60
  "format:integration": string;
@@ -69,15 +72,6 @@ export declare const dependencies: {
69
72
  "test:integration": string;
70
73
  "test:integration:prep": string;
71
74
  "test:integration:run": string;
72
- "test:journey": string;
73
- "test:journey-wasm": string;
74
- "test:journey-wasm:unicorn": string;
75
- "test:journey:image": string;
76
- "test:journey:image:unicorn": string;
77
- "test:journey:k3d": string;
78
- "test:journey:run": string;
79
- "test:journey:run-wasm": string;
80
- "test:journey:unicorn": string;
81
75
  "test:unit": string;
82
76
  "test:upgrade:unicorn": string;
83
77
  "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C,CAoCxF;AAED,wBAAsB,OAAO,CAC3B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAC5C,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,OAAO,GACnB,OAAO,CAAC,OAAO,CAAC,CA+BlB"}
1
+ {"version":3,"file":"walkthrough.d.ts","sourceRoot":"","sources":["../../../src/cli/init/walkthrough.ts"],"names":[],"mappings":"AAIA,OAAe,EAAE,OAAO,EAAgB,MAAM,SAAS,CAAC;AAIxD,OAAO,EAAE,OAAO,EAAqB,MAAM,SAAS,CAAC;AAGrD,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,OAAO,CAAC;IACvB,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAE1D,wBAAsB,WAAW,CAAC,IAAI,CAAC,EAAE,oBAAoB,GAAG,OAAO,CAAC,aAAa,CAAC,CAQrF;AAuBD,wBAAsB,OAAO,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CA6BrE;AAgBD,wBAAsB,gBAAgB,CAAC,aAAa,CAAC,EAAE,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAoCxF;AAED,wBAAsB,OAAO,CAC3B,OAAO,EAAE,MAAM,EACf,WAAW,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,EAC5C,UAAU,EAAE,MAAM,EAClB,UAAU,CAAC,EAAE,OAAO,GACnB,OAAO,CAAC,OAAO,CAAC,CA+BlB"}
package/dist/cli.js CHANGED
@@ -8126,9 +8126,9 @@ async function overridesFile({ hash, name: name2, image, config, apiPath, capabi
8126
8126
  },
8127
8127
  securityContext: {
8128
8128
  runAsUser: image.includes("private") ? 1e3 : 65532,
8129
- runAsGroup: 65532,
8129
+ runAsGroup: image.includes("private") ? 1e3 : 65532,
8130
8130
  runAsNonRoot: true,
8131
- fsGroup: 65532
8131
+ fsGroup: image.includes("private") ? 1e3 : 65532
8132
8132
  },
8133
8133
  readinessProbe: {
8134
8134
  httpGet: {
@@ -8158,7 +8158,7 @@ async function overridesFile({ hash, name: name2, image, config, apiPath, capabi
8158
8158
  },
8159
8159
  containerSecurityContext: {
8160
8160
  runAsUser: image.includes("private") ? 1e3 : 65532,
8161
- runAsGroup: 65532,
8161
+ runAsGroup: image.includes("private") ? 1e3 : 65532,
8162
8162
  runAsNonRoot: true,
8163
8163
  allowPrivilegeEscalation: false,
8164
8164
  capabilities: {
@@ -8194,9 +8194,9 @@ async function overridesFile({ hash, name: name2, image, config, apiPath, capabi
8194
8194
  },
8195
8195
  securityContext: {
8196
8196
  runAsUser: image.includes("private") ? 1e3 : 65532,
8197
- runAsGroup: 65532,
8197
+ runAsGroup: image.includes("private") ? 1e3 : 65532,
8198
8198
  runAsNonRoot: true,
8199
- fsGroup: 65532
8199
+ fsGroup: image.includes("private") ? 1e3 : 65532
8200
8200
  },
8201
8201
  readinessProbe: {
8202
8202
  httpGet: {
@@ -8226,7 +8226,7 @@ async function overridesFile({ hash, name: name2, image, config, apiPath, capabi
8226
8226
  },
8227
8227
  containerSecurityContext: {
8228
8228
  runAsUser: image.includes("private") ? 1e3 : 65532,
8229
- runAsGroup: 65532,
8229
+ runAsGroup: image.includes("private") ? 1e3 : 65532,
8230
8230
  runAsNonRoot: true,
8231
8231
  allowPrivilegeEscalation: false,
8232
8232
  capabilities: {
@@ -8333,7 +8333,7 @@ function helmLayout(basePath, unique) {
8333
8333
  // src/lib/assets/loader.ts
8334
8334
  var import_child_process = require("child_process");
8335
8335
  function loadCapabilities(path4) {
8336
- return new Promise((resolve7, reject) => {
8336
+ return new Promise((resolve8, reject) => {
8337
8337
  const program2 = (0, import_child_process.fork)(path4, {
8338
8338
  env: {
8339
8339
  ...process.env,
@@ -8344,7 +8344,7 @@ function loadCapabilities(path4) {
8344
8344
  });
8345
8345
  program2.on("message", (message) => {
8346
8346
  const capabilities = message.valueOf();
8347
- resolve7(capabilities);
8347
+ resolve8(capabilities);
8348
8348
  });
8349
8349
  program2.on("error", (error) => {
8350
8350
  reject(error);
@@ -8695,9 +8695,9 @@ function getWatcher(assets, hash, buildTimestamp, imagePullSecret) {
8695
8695
  serviceAccountName: name2,
8696
8696
  securityContext: {
8697
8697
  runAsUser: image.includes("private") ? 1e3 : 65532,
8698
- runAsGroup: 65532,
8698
+ runAsGroup: image.includes("private") ? 1e3 : 65532,
8699
8699
  runAsNonRoot: true,
8700
- fsGroup: 65532
8700
+ fsGroup: image.includes("private") ? 1e3 : 65532
8701
8701
  },
8702
8702
  containers: [
8703
8703
  {
@@ -8738,7 +8738,7 @@ function getWatcher(assets, hash, buildTimestamp, imagePullSecret) {
8738
8738
  },
8739
8739
  securityContext: {
8740
8740
  runAsUser: image.includes("private") ? 1e3 : 65532,
8741
- runAsGroup: 65532,
8741
+ runAsGroup: image.includes("private") ? 1e3 : 65532,
8742
8742
  runAsNonRoot: true,
8743
8743
  allowPrivilegeEscalation: false,
8744
8744
  capabilities: {
@@ -8828,9 +8828,9 @@ function getDeployment(assets, hash, buildTimestamp, imagePullSecret) {
8828
8828
  serviceAccountName: name2,
8829
8829
  securityContext: {
8830
8830
  runAsUser: image.includes("private") ? 1e3 : 65532,
8831
- runAsGroup: 65532,
8831
+ runAsGroup: image.includes("private") ? 1e3 : 65532,
8832
8832
  runAsNonRoot: true,
8833
- fsGroup: 65532
8833
+ fsGroup: image.includes("private") ? 1e3 : 65532
8834
8834
  },
8835
8835
  containers: [
8836
8836
  {
@@ -8872,7 +8872,7 @@ function getDeployment(assets, hash, buildTimestamp, imagePullSecret) {
8872
8872
  env: genEnv(config),
8873
8873
  securityContext: {
8874
8874
  runAsUser: image.includes("private") ? 1e3 : 65532,
8875
- runAsGroup: 65532,
8875
+ runAsGroup: image.includes("private") ? 1e3 : 65532,
8876
8876
  runAsNonRoot: true,
8877
8877
  allowPrivilegeEscalation: false,
8878
8878
  capabilities: {
@@ -9279,7 +9279,6 @@ var import_path4 = require("path");
9279
9279
  // src/cli/init/templates.ts
9280
9280
  var import_client_node5 = require("@kubernetes/client-node");
9281
9281
  var import_util = require("util");
9282
- var import_uuid = require("uuid");
9283
9282
  var import_fs8 = require("fs");
9284
9283
  var import_path3 = __toESM(require("path"));
9285
9284
 
@@ -9522,7 +9521,7 @@ var gitIgnore = "# Ignore node_modules and Pepr build artifacts\nnode_modules\nd
9522
9521
  var readmeMd = '# Pepr Module\n\nThis is a Pepr Module. [Pepr](https://github.com/defenseunicorns/pepr) is a type-safe Kubernetes middleware system.\n\nThe `capabilities` directory contains all the capabilities for this module. By default,\na capability is a single typescript file in the format of `capability-name.ts` that is\nimported in the root `pepr.ts` file as `import { HelloPepr } from "./capabilities/hello-pepr";`.\nBecause this is typescript, you can organize this however you choose, e.g. creating a sub-folder\nper-capability or common logic in shared files or folders.\n\nExample Structure:\n\n```text\nModule Root\n\u251C\u2500\u2500 package.json\n\u251C\u2500\u2500 pepr.ts\n\u2514\u2500\u2500 capabilities\n \u251C\u2500\u2500 example-one.ts\n \u251C\u2500\u2500 example-three.ts\n \u2514\u2500\u2500 example-two.ts\n```\n';
9523
9522
  var peprTS = 'import { PeprModule } from "pepr";\n// cfg loads your pepr configuration from package.json\nimport cfg from "./package.json";\n\n// HelloPepr is a demo capability that is included with Pepr. Comment or delete the line below to remove it.\nimport { HelloPepr } from "./capabilities/hello-pepr";\n\n/**\n * This is the main entrypoint for this Pepr module. It is run when the module is started.\n * This is where you register your Pepr configurations and capabilities.\n */\nnew PeprModule(cfg, [\n // "HelloPepr" is a demo capability that is included with Pepr. Comment or delete the line below to remove it.\n HelloPepr,\n\n // Your additional capabilities go here\n]);\n';
9524
9523
  var helloPeprTS = 'import {\n Capability,\n K8s,\n Log,\n PeprMutateRequest,\n RegisterKind,\n a,\n fetch,\n fetchStatus,\n kind,\n} from "pepr";\nimport { MockAgent, setGlobalDispatcher } from "undici";\n\n/**\n * The HelloPepr Capability is an example capability to demonstrate some general concepts of Pepr.\n * To test this capability you run `pepr dev`and then run the following command:\n * `kubectl apply -f capabilities/hello-pepr.samples.yaml`\n */\nexport const HelloPepr = new Capability({\n name: "hello-pepr",\n description: "A simple example capability to show how things work.",\n namespaces: ["pepr-demo", "pepr-demo-2"],\n});\n\n// Use the \'When\' function to create a new action, use \'Store\' to persist data\nconst { When, Store } = HelloPepr;\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Namespace) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action removes the label `remove-me` when a Namespace is created.\n * Note we don\'t need to specify the namespace here, because we\'ve already specified\n * it in the Capability definition above.\n */\nWhen(a.Namespace)\n .IsCreated()\n .Mutate(ns => ns.RemoveLabel("remove-me"));\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Watch Action with K8s SSA (Namespace) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action watches for the `pepr-demo-2` namespace to be created, then creates a ConfigMap with\n * the name `pepr-ssa-demo` and adds the namespace UID to the ConfigMap data. Because Pepr uses\n * server-side apply for this operation, the ConfigMap will be created or updated if it already exists.\n */\nWhen(a.Namespace)\n .IsCreated()\n .WithName("pepr-demo-2")\n .Watch(async ns => {\n Log.info("Namespace pepr-demo-2 was created.");\n\n try {\n // Apply the ConfigMap using K8s server-side apply\n await K8s(kind.ConfigMap).Apply({\n metadata: {\n name: "pepr-ssa-demo",\n namespace: "pepr-demo-2",\n },\n data: {\n "ns-uid": ns.metadata.uid,\n },\n });\n } catch (error) {\n // You can use the Log object to log messages to the Pepr controller pod\n Log.error(error, "Failed to apply ConfigMap using server-side apply.");\n }\n\n // You can share data between actions using the Store, including between different types of actions\n Store.setItem("watch-data", "This data was stored by a Watch Action.");\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 1) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This is a single action. They can be in the same file or put imported from other files.\n * In this example, when a ConfigMap is created with the name `example-1`, then add a label and annotation.\n *\n * Equivalent to manually running:\n * `kubectl label configmap example-1 pepr=was-here`\n * `kubectl annotate configmap example-1 pepr.dev=annotations-work-too`\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .WithName("example-1")\n .Mutate(request => {\n request.SetLabel("pepr", "was-here").SetAnnotation("pepr.dev", "annotations-work-too");\n\n // Use the Store to persist data between requests and Pepr controller pods\n Store.setItem("example-1", "was-here");\n\n // This data is written asynchronously and can be read back via `Store.getItem()` or `Store.subscribe()`\n Store.setItem("example-1-data", JSON.stringify(request.Raw.data));\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate & Validate Actions (CM Example 2) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This combines 3 different types of actions: \'Mutate\', \'Validate\', and \'Watch\'. The order\n * of the actions is required, but each action is optional. In this example, when a ConfigMap is created\n * with the name `example-2`, then add a label and annotation, validate that the ConfigMap has the label\n * `pepr`, and log the request.\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .WithName("example-2")\n .Mutate(request => {\n // This Mutate Action will mutate the request before it is persisted to the cluster\n\n // Use `request.Merge()` to merge the new data with the existing data\n request.Merge({\n metadata: {\n labels: {\n pepr: "was-here",\n },\n annotations: {\n "pepr.dev": "annotations-work-too",\n },\n },\n });\n })\n .Validate(request => {\n // This Validate Action will validate the request before it is persisted to the cluster\n\n // Approve the request if the ConfigMap has the label \'pepr\'\n if (request.HasLabel("pepr")) {\n return request.Approve();\n }\n\n // Otherwise, deny the request with an error message (optional)\n return request.Deny("ConfigMap must have label \'pepr\'");\n })\n .Watch((cm, phase) => {\n // This Watch Action will watch the ConfigMap after it has been persisted to the cluster\n Log.info(cm, `ConfigMap was ${phase} with the name example-2`);\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 2a) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action shows a simple validation that will deny any ConfigMap that has the\n * annotation `evil`. Note that the `Deny()` function takes an optional second parameter that is a\n * user-defined status code to return.\n */\nWhen(a.ConfigMap)\n .IsCreated()\n .Validate(request => {\n if (request.HasAnnotation("evil")) {\n return request.Deny("No evil CM annotations allowed.", 400);\n }\n\n return request.Approve();\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 3) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action combines different styles. Unlike the previous actions, this one will look\n * for any ConfigMap in the `pepr-demo` namespace that has the label `change=by-label` during either\n * CREATE or UPDATE. Note that all conditions added such as `WithName()`, `WithLabel()`, `InNamespace()`,\n * are ANDs so all conditions must be true for the request to be processed.\n */\nWhen(a.ConfigMap)\n .IsCreatedOrUpdated()\n .WithLabel("change", "by-label")\n .Mutate(request => {\n // The K8s object e are going to mutate\n const cm = request.Raw;\n\n // Get the username and uid of the K8s request\n const { username, uid } = request.Request.userInfo;\n\n // Store some data about the request in the configmap\n cm.data["username"] = username;\n cm.data["uid"] = uid;\n\n // You can still mix other ways of making changes too\n request.SetAnnotation("pepr.dev", "making-waves");\n });\n\n// This action validates the label `change=by-label` is deleted\nWhen(a.ConfigMap)\n .IsDeleted()\n .WithLabel("change", "by-label")\n .Validate(request => {\n // Log and then always approve the request\n Log.info("CM with label \'change=by-label\' was deleted.");\n return request.Approve();\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 4) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action show how you can use the `Mutate()` function without an inline function.\n * This is useful if you want to keep your actions small and focused on a single task,\n * or if you want to reuse the same function in multiple actions.\n */\nWhen(a.ConfigMap).IsCreated().WithName("example-4").Mutate(example4Cb);\n\n// This function uses the complete type definition, but is not required.\nfunction example4Cb(cm: PeprMutateRequest<a.ConfigMap>): void {\n cm.SetLabel("pepr.dev/first", "true");\n cm.SetLabel("pepr.dev/second", "true");\n cm.SetLabel("pepr.dev/third", "true");\n}\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 4a) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This is the same as Example 4, except this only operates on a CM in the `pepr-demo-2` namespace.\n * Note because the Capability defines namespaces, the namespace specified here must be one of those.\n * Alternatively, you can remove the namespace from the Capability definition and specify it here.\n */\nWhen(a.ConfigMap).IsCreated().InNamespace("pepr-demo-2").WithName("example-4a").Mutate(example4Cb);\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (CM Example 5) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This action is a bit more complex. It will look for any ConfigMap in the `pepr-demo`\n * namespace that has the label `chuck-norris` during CREATE. When it finds one, it will fetch a\n * random Chuck Norris joke from the API and add it to the ConfigMap. This is a great example of how\n * you can use Pepr to make changes to your K8s objects based on external data.\n *\n * Note the use of the `async` keyword. This is required for any action that uses `await` or `fetch()`.\n *\n * Also note we are passing a type to the `fetch()` function. This is optional, but it will help you\n * avoid mistakes when working with the data returned from the API. You can also use the `as` keyword to\n * cast the data returned from the API.\n *\n * These are equivalent:\n * ```ts\n * const joke = await fetch<TheChuckNorrisJoke>("https://icanhazdadjoke.com/");\n * const joke = await fetch("https://icanhazdadjoke.com/") as TheChuckNorrisJoke;\n * ```\n *\n * Alternatively, you can drop the type completely:\n *\n * ```ts\n * fetch("https://icanhazdadjoke.com")\n * ```\n */\ninterface TheChuckNorrisJoke {\n id: string;\n joke: string;\n status: number;\n}\n\nWhen(a.ConfigMap)\n .IsCreatedOrUpdated()\n .WithLabel("chuck-norris")\n .Mutate(cm => cm.SetLabel("got-jokes", "true"))\n .Watch(async cm => {\n const jokeURL = "https://icanhazdadjoke.com";\n\n const mockAgent: MockAgent = new MockAgent();\n setGlobalDispatcher(mockAgent);\n const mockClient = mockAgent.get(jokeURL);\n mockClient.intercept({ path: "/", method: "GET" }).reply(\n 200,\n {\n id: "R7UfaahVfFd",\n joke: "Funny joke goes here.",\n status: 200,\n },\n {\n headers: {\n "Content-Type": "application/json; charset=utf-8",\n },\n },\n );\n\n // Try/catch is not needed as a response object will always be returned\n const response = await fetch<TheChuckNorrisJoke>(jokeURL, {\n headers: {\n Accept: "application/json",\n },\n });\n\n // Instead, check the `response.ok` field\n if (response.ok) {\n const { joke } = response.data;\n // Add Joke to the Store\n await Store.setItemAndWait(jokeURL, joke);\n // Add the Chuck Norris joke to the configmap\n try {\n await K8s(kind.ConfigMap).Apply({\n metadata: {\n name: cm.metadata.name,\n namespace: cm.metadata.namespace,\n },\n data: {\n "chuck-says": Store.getItem(jokeURL),\n },\n });\n } catch (error) {\n Log.error(error, "Failed to apply ConfigMap using server-side apply.", {\n cm,\n });\n }\n }\n\n // You can also assert on different HTTP response codes\n if (response.status === fetchStatus.NOT_FOUND) {\n // Do something else\n return;\n }\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Secret Base64 Handling) *\n * ---------------------------------------------------------------------------------------------------\n *\n * The K8s JS client provides incomplete support for base64 encoding/decoding handling for secrets,\n * unlike the GO client. To make this less painful, Pepr automatically handles base64 encoding/decoding\n * secret data before and after the action is executed.\n */\nWhen(a.Secret)\n .IsCreated()\n .WithName("secret-1")\n .Mutate(request => {\n const secret = request.Raw;\n\n // This will be encoded at the end of all processing back to base64: "Y2hhbmdlLXdpdGhvdXQtZW5jb2Rpbmc="\n secret.data.magic = "change-without-encoding";\n\n // You can modify the data directly, and it will be encoded at the end of all processing\n secret.data.example += " - modified by Pepr";\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Untyped Custom Resource) *\n * ---------------------------------------------------------------------------------------------------\n *\n * Out of the box, Pepr supports all the standard Kubernetes objects. However, you can also create\n * your own types. This is useful if you are working with an Operator that creates custom resources.\n * There are two ways to do this, the first is to use the `When()` function with a `GenericKind`,\n * the second is to create a new class that extends `GenericKind` and use the `RegisterKind()` function.\n *\n * This example shows how to use the `When()` function with a `GenericKind`. Note that you\n * must specify the `group`, `version`, and `kind` of the object (if applicable). This is how Pepr knows\n * if the action should be triggered or not. Since we are using a `GenericKind`,\n * Pepr will not be able to provide any intellisense for the object, so you will need to refer to the\n * Kubernetes API documentation for the object you are working with.\n *\n * You will need to wait for the CRD in `hello-pepr.samples.yaml` to be created, then you can apply\n *\n * ```yaml\n * apiVersion: pepr.dev/v1\n * kind: Unicorn\n * metadata:\n * name: example-1\n * namespace: pepr-demo\n * spec:\n * message: replace-me\n * counter: 0\n * ```\n */\nWhen(a.GenericKind, {\n group: "pepr.dev",\n version: "v1",\n kind: "Unicorn",\n})\n .IsCreated()\n .WithName("example-1")\n .Mutate(request => {\n request.Merge({\n spec: {\n message: "Hello Pepr without type data!",\n counter: Math.random(),\n },\n });\n });\n\n/**\n * ---------------------------------------------------------------------------------------------------\n * Mutate Action (Typed Custom Resource) *\n * ---------------------------------------------------------------------------------------------------\n *\n * This example shows how to use the `RegisterKind()` function to create a new type. This is useful\n * if you are working with an Operator that creates custom resources and you want to have intellisense\n * for the object. Note that you must specify the `group`, `version`, and `kind` of the object (if applicable)\n * as this is how Pepr knows if the action should be triggered or not.\n *\n * Once you register a new Kind with Pepr, you can use the `When()` function with the new Kind. Ideally,\n * you should register custom Kinds at the top of your Capability file or Pepr Module so they are available\n * to all actions, but we are putting it here for demonstration purposes.\n *\n * You will need to wait for the CRD in `hello-pepr.samples.yaml` to be created, then you can apply\n *\n * ```yaml\n * apiVersion: pepr.dev/v1\n * kind: Unicorn\n * metadata:\n * name: example-2\n * namespace: pepr-demo\n * spec:\n * message: replace-me\n * counter: 0\n * ```*\n */\nclass UnicornKind extends a.GenericKind {\n spec: {\n /**\n * JSDoc comments can be added to explain more details about the field.\n *\n * @example\n * ```ts\n * request.Raw.spec.message = "Hello Pepr!";\n * ```\n * */\n message: string;\n counter: number;\n };\n}\n\nRegisterKind(UnicornKind, {\n group: "pepr.dev",\n version: "v1",\n kind: "Unicorn",\n});\n\nWhen(UnicornKind)\n .IsCreated()\n .WithName("example-2")\n .Mutate(request => {\n request.Merge({\n spec: {\n message: "Hello Pepr with type data!",\n counter: Math.random(),\n },\n });\n });\n\n/**\n * A callback function that is called once the Pepr Store is fully loaded.\n */\nStore.onReady(data => {\n Log.info(data, "Pepr Store Ready");\n});\n';
9525
- var packageJSON = { name: "pepr", description: "Kubernetes application engine", author: "Defense Unicorns", homepage: "https://github.com/defenseunicorns/pepr", license: "Apache-2.0", bin: "dist/cli.js", repository: "defenseunicorns/pepr", engines: { node: ">=18.0.0" }, files: ["/dist", "/src", "!src/**/*.test.ts", "!src/fixtures/**", "!dist/**/*.test.d.ts*"], version: "0.52.3-nightly.4", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { build: "tsc -p config/tsconfig.root.json && node build.mjs && npm pack", "build:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev .", "build:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) .", ci: "npm ci", "format:check": "npm run format:src && npm run format:tests && npm run format:markdown && npm run format:integration && npm run format:prettier -- --check", "format:fix": "npm run format:src -- --fix && npm run format:markdown -- --fix && npm run format:integration -- --fix && npm run format:prettier -- --write", "format:integration": "eslint --config config/eslint.integration.config.mjs integration/cli integration/helpers", "format:markdown": 'npx -y markdownlint-cli --config config/.markdownlint.json --ignore adr --ignore integration/testroot --ignore pepr-test-module --ignore node_modules "**/*.md"', "format:prettier": "prettier --config config/.prettierrc src integration/cli/**/*.ts integration/helpers/**/*.ts", "format:src": "eslint --config config/eslint.root.config.mjs 'src/**/*.ts' --ignore-pattern '**/*.test.ts' --ignore-pattern 'src/templates/**'", "format:tests": "eslint --config config/eslint.test.config.mjs 'src/**/*.test.ts'", "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", prepare: `if [ "$NODE_ENV" != 'production' ]; then husky; fi`, "set:version": "node scripts/set-version.js", test: "npm run test:unit && npm run test:journey && npm run test:journey-wasm", "test:artifacts": "npm run build && vitest run src/build-artifact.test.ts", "test:docs": "vitest run --config=config/vitest.integration.config.ts integration/cli/docs/*.test.ts", "test:integration": "npm run test:integration:prep && npm run test:integration:run", "test:integration:prep": "./integration/prep.sh", "test:integration:run": "vitest run --config=config/vitest.integration.config.ts integration", "test:journey": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run", "test:journey-wasm": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run-wasm", "test:journey-wasm:unicorn": "npm run test:journey:k3d && npm run build && npm run test:journey:image:unicorn && npm run test:journey:run-wasm", "test:journey:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "test:journey:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) . && k3d image import pepr/private:dev -c pepr-dev", "test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system", "test:journey:run": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint.test.ts", "test:journey:run-wasm": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint-wasm.test.ts", "test:journey:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && npm run test:journey:run", "test:unit": "npm run gen-data-json && NODE_OPTIONS=--no-deprecation vitest --config config/vitest.root.config.ts run --coverage", "test:upgrade:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && vitest run integration/cluster/upgrade.test.ts", "test:upgrade:upstream": "npm run test:journey:k3d && npm run test:journey:image && vitest run integration/cluster/upgrade.test.ts" }, dependencies: { "@types/ramda": "0.31.0", commander: "14.0.0", express: "5.1.0", "fast-json-patch": "3.1.1", heredoc: "^1.3.1", "http-status-codes": "^2.3.0", "json-pointer": "^0.6.2", "kubernetes-fluent-client": "3.10.0", pino: "9.7.0", "pino-pretty": "13.1.1", "prom-client": "15.1.3", ramda: "0.31.3", "ts-morph": "^26.0.0" }, devDependencies: { "@commitlint/cli": "19.8.1", "@commitlint/config-conventional": "19.8.1", "@fast-check/vitest": "^0.2.1", "@types/eslint": "9.6.1", "@types/express": "5.0.3", "@types/json-pointer": "^1.0.34", "@types/node": "24.x.x", "@types/node-forge": "1.3.13", "@types/uuid": "10.0.0", "@types/ws": "^8.18.1", "@vitest/coverage-v8": "^3.2.3", "fast-check": "^4.0.0", globals: "^16.0.0", husky: "^9.1.6", "js-yaml": "^4.1.0", shellcheck: "^3.0.0", tsx: "^4.20.3", undici: "^7.0.1", vitest: "^3.2.3" }, overrides: { glob: "^9.0.0" }, peerDependencies: { "@types/prompts": "2.4.9", "@typescript-eslint/eslint-plugin": "8.38.0", "@typescript-eslint/parser": "8.38.0", esbuild: "0.25.8", eslint: "9.32.0", "node-forge": "1.3.1", prettier: "3.6.2", prompts: "2.4.2", typescript: "5.8.3", uuid: "11.1.0" } };
9524
+ var packageJSON = { name: "pepr", description: "Kubernetes application engine", author: "Defense Unicorns", homepage: "https://github.com/defenseunicorns/pepr", license: "Apache-2.0", bin: "dist/cli.js", repository: "defenseunicorns/pepr", engines: { node: ">=18.0.0" }, files: ["/dist", "/src", "!src/**/*.test.ts", "!src/fixtures/**", "!dist/**/*.test.d.ts*"], version: "0.52.3-nightly.6", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { build: "tsc -p config/tsconfig.root.json && node build.mjs && npm pack", "build:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev .", "build:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) .", ci: "npm ci", "cluster:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system", "cluster:k3d:import-upstream": "npm run build && docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "cluster:k3d:import-unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) . && k3d image import pepr/private:dev -c pepr-dev", "format:check": "npm run format:src && npm run format:tests && npm run format:markdown && npm run format:integration && npm run format:prettier -- --check", "format:fix": "npm run format:src -- --fix && npm run format:markdown -- --fix && npm run format:integration -- --fix && npm run format:prettier -- --write", "format:integration": "eslint --config config/eslint.integration.config.mjs integration/cli integration/helpers", "format:markdown": 'npx -y markdownlint-cli --config config/.markdownlint.json --ignore adr --ignore integration/testroot --ignore pepr-test-module --ignore node_modules "**/*.md"', "format:prettier": "prettier --config config/.prettierrc src integration/cli/**/*.ts integration/helpers/**/*.ts", "format:src": "eslint --config config/eslint.root.config.mjs 'src/**/*.ts' --ignore-pattern '**/*.test.ts' --ignore-pattern 'src/templates/**'", "format:tests": "eslint --config config/eslint.test.config.mjs 'src/**/*.test.ts'", "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", prepare: `if [ "$NODE_ENV" != 'production' ]; then husky; fi`, "set:version": "node scripts/set-version.js", test: "npm run test:unit && npm run test:integration", "test:artifacts": "npm run build && vitest run src/build-artifact.test.ts", "test:docs": "vitest run --config=config/vitest.integration.config.ts integration/cli/docs/*.test.ts", "test:integration": "npm run test:integration:prep && npm run test:integration:run", "test:integration:prep": "./integration/prep.sh", "test:integration:run": "vitest run --config=config/vitest.integration.config.ts integration", "test:unit": "npm run gen-data-json && NODE_OPTIONS=--no-deprecation vitest --config config/vitest.root.config.ts run --coverage", "test:upgrade:unicorn": "npm run cluster:k3d && npm run cluster:k3d:import-unicorn && vitest run integration/cluster/upgrade.test.ts", "test:upgrade:upstream": "npm run cluster:k3d && npm run cluster:k3d:import-upstream && vitest run integration/cluster/upgrade.test.ts" }, dependencies: { "@types/ramda": "0.31.0", commander: "14.0.0", express: "5.1.0", "fast-json-patch": "3.1.1", heredoc: "^1.3.1", "http-status-codes": "^2.3.0", "json-pointer": "^0.6.2", "kubernetes-fluent-client": "3.10.0", pino: "9.7.0", "pino-pretty": "13.1.1", "prom-client": "15.1.3", ramda: "0.31.3", "ts-morph": "^26.0.0" }, devDependencies: { "@commitlint/cli": "19.8.1", "@commitlint/config-conventional": "19.8.1", "@fast-check/vitest": "^0.2.1", "@types/eslint": "9.6.1", "@types/express": "5.0.3", "@types/json-pointer": "^1.0.34", "@types/node": "24.x.x", "@types/node-forge": "1.3.13", "@types/uuid": "10.0.0", "@types/ws": "^8.18.1", "@vitest/coverage-v8": "^3.2.3", "fast-check": "^4.0.0", globals: "^16.0.0", husky: "^9.1.6", "js-yaml": "^4.1.0", shellcheck: "^3.0.0", tsx: "^4.20.3", undici: "^7.0.1", vitest: "^3.2.3" }, overrides: { glob: "^9.0.0" }, peerDependencies: { "@types/prompts": "2.4.9", "@typescript-eslint/eslint-plugin": "8.38.0", "@typescript-eslint/parser": "8.38.0", esbuild: "0.25.8", eslint: "9.32.0", "node-forge": "1.3.1", prettier: "3.6.2", prompts: "2.4.2", typescript: "5.8.3", uuid: "11.1.0" } };
9526
9525
 
9527
9526
  // src/cli/init/utils.ts
9528
9527
  var import_fs7 = require("fs");
@@ -9558,7 +9557,7 @@ function write(path4, data) {
9558
9557
  // src/cli/init/templates.ts
9559
9558
  var { dependencies, devDependencies, peerDependencies, scripts, version } = packageJSON;
9560
9559
  function genPkgJSON(opts) {
9561
- const uuid = !opts.uuid ? (0, import_uuid.v4)() : opts.uuid;
9560
+ const uuid = opts.uuid;
9562
9561
  const name2 = sanitizeName(opts.name);
9563
9562
  const { typescript } = peerDependencies;
9564
9563
  const data = {
@@ -9595,7 +9594,7 @@ function genPkgJSON(opts) {
9595
9594
  env: {}
9596
9595
  },
9597
9596
  scripts: {
9598
- "k3d-setup": scripts["test:journey:k3d"]
9597
+ "k3d-setup": scripts["cluster:k3d"]
9599
9598
  },
9600
9599
  dependencies: {
9601
9600
  pepr: version,
@@ -10222,7 +10221,7 @@ async function namespaceDeploymentsReady(namespace = "pepr-system") {
10222
10221
  if (ready) {
10223
10222
  return ready;
10224
10223
  }
10225
- await new Promise((resolve7) => setTimeout(resolve7, 1e3));
10224
+ await new Promise((resolve8) => setTimeout(resolve8, 1e3));
10226
10225
  }
10227
10226
  logger_default.info(`All ${namespace} deployments are ready`);
10228
10227
  }
@@ -10462,8 +10461,7 @@ ${filteredFailures.length > 0 ? "\u274C" : "\u2705"} VALIDATE ${name2} (${uid
10462
10461
  }
10463
10462
 
10464
10463
  // src/cli/init/index.ts
10465
- var import_child_process5 = require("child_process");
10466
- var import_path5 = require("path");
10464
+ var import_commander2 = require("commander");
10467
10465
 
10468
10466
  // src/cli/init/walkthrough.ts
10469
10467
  var import_fs12 = require("fs");
@@ -10497,6 +10495,9 @@ async function setUUID(uuid) {
10497
10495
  name: "uuid",
10498
10496
  message: "Enter a unique identifier for the new Pepr module.\n",
10499
10497
  validate: (val) => {
10498
+ if (typeof val === "undefined" || val === "") {
10499
+ return "The UUID must be at least 1 character long";
10500
+ }
10500
10501
  return val.length <= UUID_LENGTH_LIMIT || `The UUID must be ${UUID_LENGTH_LIMIT} characters or fewer.`;
10501
10502
  }
10502
10503
  };
@@ -10606,15 +10607,75 @@ ${packageJSON2.print.replace(/^/gm, " \u2502 ")}
10606
10607
  }
10607
10608
 
10608
10609
  // src/cli/init/index.ts
10609
- var import_commander2 = require("commander");
10610
- function init_default(program2) {
10610
+ var import_commander3 = require("commander");
10611
+
10612
+ // src/cli/init/setupProjectStructure.ts
10613
+ var import_path5 = require("path");
10614
+ async function setupProjectStructure(dirName) {
10615
+ await createDir(dirName);
10616
+ await createDir((0, import_path5.resolve)(dirName, ".vscode"));
10617
+ await createDir((0, import_path5.resolve)(dirName, "capabilities"));
10618
+ }
10619
+
10620
+ // src/cli/init/doPostInitActions.ts
10621
+ var import_child_process5 = require("child_process");
10622
+ var doPostInitActions = (dirName) => {
10623
+ process.chdir(dirName);
10624
+ (0, import_child_process5.execSync)("npm install", {
10625
+ stdio: "inherit"
10626
+ });
10627
+ (0, import_child_process5.execSync)("git init --initial-branch=main", {
10628
+ stdio: "inherit"
10629
+ });
10630
+ try {
10631
+ (0, import_child_process5.execSync)("code .", {
10632
+ stdio: "inherit"
10633
+ });
10634
+ } catch {
10635
+ console.warn("VSCode was not found, IDE will not automatically open.");
10636
+ }
10637
+ };
10638
+
10639
+ // src/cli/init/createProjectFiles.ts
10640
+ var import_posix2 = require("path/posix");
10641
+ async function createProjectFiles(dirName, packageJSON2) {
10642
+ const files = [
10643
+ { path: gitignore.path, data: gitignore.data },
10644
+ { path: eslint.path, data: eslint.data },
10645
+ { path: prettier.path, data: prettier.data },
10646
+ { path: packageJSON2.path, data: packageJSON2.data },
10647
+ { path: readme.path, data: readme.data },
10648
+ { path: tsConfig.path, data: tsConfig.data },
10649
+ { path: peprTSTemplate.path, data: peprTSTemplate.data }
10650
+ ];
10651
+ const nestedFiles = [
10652
+ { dir: ".vscode", path: snippet.path, data: snippet.data },
10653
+ { dir: ".vscode", path: codeSettings.path, data: codeSettings.data },
10654
+ { dir: "capabilities", path: samplesYaml.path, data: samplesYaml.data },
10655
+ { dir: "capabilities", path: helloPepr.path, data: helloPepr.data }
10656
+ ];
10657
+ for (const file of files) {
10658
+ await write((0, import_posix2.resolve)(dirName, file.path), file.data);
10659
+ }
10660
+ for (const file of nestedFiles) {
10661
+ await write((0, import_posix2.resolve)(dirName, file.dir, file.path), file.data);
10662
+ }
10663
+ }
10664
+
10665
+ // src/cli/init/index.ts
10666
+ var import_uuid = require("uuid");
10667
+ function init_default() {
10611
10668
  let response = {};
10612
- program2.command("init").description("Initialize a new Pepr Module").option("-d, --description <string>", "Explain the purpose of the new module.").addOption(
10613
- new import_commander2.Option("-e, --error-behavior <behavior>", "Set an error behavior.").choices(ErrorList)
10669
+ return new import_commander2.Command("init").description("Initialize a new Pepr Module").option("-d, --description <string>", "Explain the purpose of the new module.").addOption(
10670
+ new import_commander3.Option("-e, --error-behavior <behavior>", "Set an error behavior.").choices(ErrorList)
10614
10671
  ).option("-n, --name <string>", "Set the name of the new module.").option("-s, --skip-post-init", "Skip npm install, git init, and VSCode launch.").option(
10615
10672
  "-u, --uuid <string>",
10616
10673
  "Unique identifier for your module with a max length of 36 characters.",
10617
10674
  (uuid) => {
10675
+ if (typeof uuid === "undefined" || uuid === "") {
10676
+ uuid = (0, import_uuid.v4)();
10677
+ logger_default.warn(`The UUID was empty. Generated new UUID: '${uuid}'`);
10678
+ }
10618
10679
  if (uuid.length > UUID_LENGTH_LIMIT) {
10619
10680
  throw new Error("The UUID must be 36 characters or fewer.");
10620
10681
  }
@@ -10628,68 +10689,21 @@ function init_default(program2) {
10628
10689
  const packageJSON2 = genPkgJSON(response);
10629
10690
  const confirmed = await confirm(dirName, packageJSON2, peprTSTemplate.path, opts.yes);
10630
10691
  if (confirmed) {
10631
- console.log("Creating new Pepr module...");
10692
+ logger_default.info("Creating new Pepr module...");
10632
10693
  try {
10633
10694
  await setupProjectStructure(dirName);
10634
10695
  await createProjectFiles(dirName, packageJSON2);
10635
10696
  if (!opts.skipPostInit) {
10636
10697
  doPostInitActions(dirName);
10637
10698
  }
10638
- console.log(`New Pepr module created at ${dirName}`);
10639
- console.log(`Open VSCode or your editor of choice in ${dirName} to get started!`);
10640
- } catch (e) {
10641
- if (e instanceof Error) {
10642
- console.error(`Error creating Pepr module:`, e);
10643
- }
10644
- process.exit(1);
10699
+ logger_default.info(`New Pepr module created at ${dirName}`);
10700
+ logger_default.info(`Open VSCode or your editor of choice in ${dirName} to get started!`);
10701
+ } catch (error) {
10702
+ throw new Error(`Error creating Pepr module:`, { cause: error });
10645
10703
  }
10646
10704
  }
10647
10705
  });
10648
10706
  }
10649
- async function setupProjectStructure(dirName) {
10650
- await createDir(dirName);
10651
- await createDir((0, import_path5.resolve)(dirName, ".vscode"));
10652
- await createDir((0, import_path5.resolve)(dirName, "capabilities"));
10653
- }
10654
- async function createProjectFiles(dirName, packageJSON2) {
10655
- const files = [
10656
- { path: gitignore.path, data: gitignore.data },
10657
- { path: eslint.path, data: eslint.data },
10658
- { path: prettier.path, data: prettier.data },
10659
- { path: packageJSON2.path, data: packageJSON2.data },
10660
- { path: readme.path, data: readme.data },
10661
- { path: tsConfig.path, data: tsConfig.data },
10662
- { path: peprTSTemplate.path, data: peprTSTemplate.data }
10663
- ];
10664
- const nestedFiles = [
10665
- { dir: ".vscode", path: snippet.path, data: snippet.data },
10666
- { dir: ".vscode", path: codeSettings.path, data: codeSettings.data },
10667
- { dir: "capabilities", path: samplesYaml.path, data: samplesYaml.data },
10668
- { dir: "capabilities", path: helloPepr.path, data: helloPepr.data }
10669
- ];
10670
- for (const file of files) {
10671
- await write((0, import_path5.resolve)(dirName, file.path), file.data);
10672
- }
10673
- for (const file of nestedFiles) {
10674
- await write((0, import_path5.resolve)(dirName, file.dir, file.path), file.data);
10675
- }
10676
- }
10677
- var doPostInitActions = (dirName) => {
10678
- process.chdir(dirName);
10679
- (0, import_child_process5.execSync)("npm install", {
10680
- stdio: "inherit"
10681
- });
10682
- (0, import_child_process5.execSync)("git init --initial-branch=main", {
10683
- stdio: "inherit"
10684
- });
10685
- try {
10686
- (0, import_child_process5.execSync)("code .", {
10687
- stdio: "inherit"
10688
- });
10689
- } catch {
10690
- console.warn("VSCode was not found, IDE will not automatically open.");
10691
- }
10692
- };
10693
10707
 
10694
10708
  // src/cli/uuid.ts
10695
10709
  var import_kubernetes_fluent_client7 = require("kubernetes-fluent-client");
@@ -10730,7 +10744,7 @@ function buildUUIDTable(deployments) {
10730
10744
  }
10731
10745
 
10732
10746
  // src/cli.ts
10733
- var import_commander6 = require("commander");
10747
+ var import_commander7 = require("commander");
10734
10748
 
10735
10749
  // src/cli/update/index.ts
10736
10750
  var import_child_process6 = require("child_process");
@@ -10821,10 +10835,10 @@ function kfc_default(program2) {
10821
10835
  }
10822
10836
 
10823
10837
  // src/cli/crd/index.ts
10824
- var import_commander5 = require("commander");
10838
+ var import_commander6 = require("commander");
10825
10839
 
10826
10840
  // src/cli/crd/generate/index.ts
10827
- var import_commander3 = require("commander");
10841
+ var import_commander4 = require("commander");
10828
10842
 
10829
10843
  // src/cli/crd/generate/generators.ts
10830
10844
  var import_fs14 = __toESM(require("fs"));
@@ -11060,13 +11074,13 @@ function buildCRD(config) {
11060
11074
 
11061
11075
  // src/cli/crd/generate/index.ts
11062
11076
  function generate_default() {
11063
- return new import_commander3.Command("generate").description(
11077
+ return new import_commander4.Command("generate").description(
11064
11078
  "Generate CRD manifests from TypeScript definitions stored in 'api/' of the current directory."
11065
11079
  ).option("-o, --output <directory>", "Output directory for generated CRDs", "./crds").action((options) => generateCRDs(options));
11066
11080
  }
11067
11081
 
11068
11082
  // src/cli/crd/create/index.ts
11069
- var import_commander4 = require("commander");
11083
+ var import_commander5 = require("commander");
11070
11084
  var import_fs15 = require("fs");
11071
11085
 
11072
11086
  // src/cli/crd/create/createCRDscaffold.ts
@@ -11153,8 +11167,8 @@ type ${kind8}StatusCondition = {
11153
11167
  // src/cli/crd/create/index.ts
11154
11168
  var import_path8 = __toESM(require("path"));
11155
11169
  function create_default() {
11156
- return new import_commander4.Command("create").description("Create a new CRD TypeScript definition").addOption(
11157
- new import_commander4.Option(
11170
+ return new import_commander5.Command("create").description("Create a new CRD TypeScript definition").addOption(
11171
+ new import_commander5.Option(
11158
11172
  "-S, --scope <scope>",
11159
11173
  "Whether the resulting custom resource is cluster- or namespace-scoped"
11160
11174
  ).choices(["Namespaced", "Cluster"]).default("Namespaced")
@@ -11172,18 +11186,18 @@ function create_default() {
11172
11186
 
11173
11187
  // src/cli/crd/index.ts
11174
11188
  function crd_default() {
11175
- return new import_commander5.Command("crd").description("Scaffold and generate Kubernetes CRDs from structured TypeScript definitions").addCommand(create_default()).addCommand(generate_default());
11189
+ return new import_commander6.Command("crd").description("Scaffold and generate Kubernetes CRDs from structured TypeScript definitions").addCommand(create_default()).addCommand(generate_default());
11176
11190
  }
11177
11191
 
11178
11192
  // src/cli.ts
11179
11193
  if (process.env.npm_lifecycle_event !== "npx") {
11180
11194
  console.info("Pepr should be run via `npx pepr <command>` instead of `pepr <command>`.");
11181
11195
  }
11182
- var program = new import_commander6.Command();
11196
+ var program = new import_commander7.Command();
11183
11197
  if (!process.env.PEPR_NODE_WARNINGS) {
11184
11198
  process.removeAllListeners("warning");
11185
11199
  }
11186
- program.enablePositionalOptions().version(version).description(`Pepr (v${version}) - Type safe K8s middleware for humans`).addCommand(crd_default()).action(() => {
11200
+ program.enablePositionalOptions().version(version).description(`Pepr (v${version}) - Type safe K8s middleware for humans`).addCommand(crd_default()).addCommand(init_default()).action(() => {
11187
11201
  if (program.args.length < 1) {
11188
11202
  console.log(banner);
11189
11203
  program.help();
@@ -11194,7 +11208,6 @@ program.enablePositionalOptions().version(version).description(`Pepr (v${version
11194
11208
  process.exitCode = 1;
11195
11209
  }
11196
11210
  });
11197
- init_default(program);
11198
11211
  build_default(program);
11199
11212
  deploy_default(program);
11200
11213
  dev_default(program);
@@ -60,7 +60,7 @@ if (process.env.LOG_LEVEL) {
60
60
  var logger_default = Log;
61
61
 
62
62
  // src/templates/data.json
63
- var packageJSON = { name: "pepr", description: "Kubernetes application engine", author: "Defense Unicorns", homepage: "https://github.com/defenseunicorns/pepr", license: "Apache-2.0", bin: "dist/cli.js", repository: "defenseunicorns/pepr", engines: { node: ">=18.0.0" }, files: ["/dist", "/src", "!src/**/*.test.ts", "!src/fixtures/**", "!dist/**/*.test.d.ts*"], version: "0.52.3-nightly.4", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { build: "tsc -p config/tsconfig.root.json && node build.mjs && npm pack", "build:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev .", "build:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) .", ci: "npm ci", "format:check": "npm run format:src && npm run format:tests && npm run format:markdown && npm run format:integration && npm run format:prettier -- --check", "format:fix": "npm run format:src -- --fix && npm run format:markdown -- --fix && npm run format:integration -- --fix && npm run format:prettier -- --write", "format:integration": "eslint --config config/eslint.integration.config.mjs integration/cli integration/helpers", "format:markdown": 'npx -y markdownlint-cli --config config/.markdownlint.json --ignore adr --ignore integration/testroot --ignore pepr-test-module --ignore node_modules "**/*.md"', "format:prettier": "prettier --config config/.prettierrc src integration/cli/**/*.ts integration/helpers/**/*.ts", "format:src": "eslint --config config/eslint.root.config.mjs 'src/**/*.ts' --ignore-pattern '**/*.test.ts' --ignore-pattern 'src/templates/**'", "format:tests": "eslint --config config/eslint.test.config.mjs 'src/**/*.test.ts'", "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", prepare: `if [ "$NODE_ENV" != 'production' ]; then husky; fi`, "set:version": "node scripts/set-version.js", test: "npm run test:unit && npm run test:journey && npm run test:journey-wasm", "test:artifacts": "npm run build && vitest run src/build-artifact.test.ts", "test:docs": "vitest run --config=config/vitest.integration.config.ts integration/cli/docs/*.test.ts", "test:integration": "npm run test:integration:prep && npm run test:integration:run", "test:integration:prep": "./integration/prep.sh", "test:integration:run": "vitest run --config=config/vitest.integration.config.ts integration", "test:journey": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run", "test:journey-wasm": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run-wasm", "test:journey-wasm:unicorn": "npm run test:journey:k3d && npm run build && npm run test:journey:image:unicorn && npm run test:journey:run-wasm", "test:journey:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "test:journey:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) . && k3d image import pepr/private:dev -c pepr-dev", "test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system", "test:journey:run": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint.test.ts", "test:journey:run-wasm": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint-wasm.test.ts", "test:journey:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && npm run test:journey:run", "test:unit": "npm run gen-data-json && NODE_OPTIONS=--no-deprecation vitest --config config/vitest.root.config.ts run --coverage", "test:upgrade:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && vitest run integration/cluster/upgrade.test.ts", "test:upgrade:upstream": "npm run test:journey:k3d && npm run test:journey:image && vitest run integration/cluster/upgrade.test.ts" }, dependencies: { "@types/ramda": "0.31.0", commander: "14.0.0", express: "5.1.0", "fast-json-patch": "3.1.1", heredoc: "^1.3.1", "http-status-codes": "^2.3.0", "json-pointer": "^0.6.2", "kubernetes-fluent-client": "3.10.0", pino: "9.7.0", "pino-pretty": "13.1.1", "prom-client": "15.1.3", ramda: "0.31.3", "ts-morph": "^26.0.0" }, devDependencies: { "@commitlint/cli": "19.8.1", "@commitlint/config-conventional": "19.8.1", "@fast-check/vitest": "^0.2.1", "@types/eslint": "9.6.1", "@types/express": "5.0.3", "@types/json-pointer": "^1.0.34", "@types/node": "24.x.x", "@types/node-forge": "1.3.13", "@types/uuid": "10.0.0", "@types/ws": "^8.18.1", "@vitest/coverage-v8": "^3.2.3", "fast-check": "^4.0.0", globals: "^16.0.0", husky: "^9.1.6", "js-yaml": "^4.1.0", shellcheck: "^3.0.0", tsx: "^4.20.3", undici: "^7.0.1", vitest: "^3.2.3" }, overrides: { glob: "^9.0.0" }, peerDependencies: { "@types/prompts": "2.4.9", "@typescript-eslint/eslint-plugin": "8.38.0", "@typescript-eslint/parser": "8.38.0", esbuild: "0.25.8", eslint: "9.32.0", "node-forge": "1.3.1", prettier: "3.6.2", prompts: "2.4.2", typescript: "5.8.3", uuid: "11.1.0" } };
63
+ var packageJSON = { name: "pepr", description: "Kubernetes application engine", author: "Defense Unicorns", homepage: "https://github.com/defenseunicorns/pepr", license: "Apache-2.0", bin: "dist/cli.js", repository: "defenseunicorns/pepr", engines: { node: ">=18.0.0" }, files: ["/dist", "/src", "!src/**/*.test.ts", "!src/fixtures/**", "!dist/**/*.test.d.ts*"], version: "0.52.3-nightly.6", main: "dist/lib.js", types: "dist/lib.d.ts", scripts: { build: "tsc -p config/tsconfig.root.json && node build.mjs && npm pack", "build:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev .", "build:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) .", ci: "npm ci", "cluster:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system", "cluster:k3d:import-upstream": "npm run build && docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev", "cluster:k3d:import-unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) . && k3d image import pepr/private:dev -c pepr-dev", "format:check": "npm run format:src && npm run format:tests && npm run format:markdown && npm run format:integration && npm run format:prettier -- --check", "format:fix": "npm run format:src -- --fix && npm run format:markdown -- --fix && npm run format:integration -- --fix && npm run format:prettier -- --write", "format:integration": "eslint --config config/eslint.integration.config.mjs integration/cli integration/helpers", "format:markdown": 'npx -y markdownlint-cli --config config/.markdownlint.json --ignore adr --ignore integration/testroot --ignore pepr-test-module --ignore node_modules "**/*.md"', "format:prettier": "prettier --config config/.prettierrc src integration/cli/**/*.ts integration/helpers/**/*.ts", "format:src": "eslint --config config/eslint.root.config.mjs 'src/**/*.ts' --ignore-pattern '**/*.test.ts' --ignore-pattern 'src/templates/**'", "format:tests": "eslint --config config/eslint.test.config.mjs 'src/**/*.test.ts'", "gen-data-json": "node hack/build-template-data.js", prebuild: "rm -fr dist/* && npm run gen-data-json", prepare: `if [ "$NODE_ENV" != 'production' ]; then husky; fi`, "set:version": "node scripts/set-version.js", test: "npm run test:unit && npm run test:integration", "test:artifacts": "npm run build && vitest run src/build-artifact.test.ts", "test:docs": "vitest run --config=config/vitest.integration.config.ts integration/cli/docs/*.test.ts", "test:integration": "npm run test:integration:prep && npm run test:integration:run", "test:integration:prep": "./integration/prep.sh", "test:integration:run": "vitest run --config=config/vitest.integration.config.ts integration", "test:unit": "npm run gen-data-json && NODE_OPTIONS=--no-deprecation vitest --config config/vitest.root.config.ts run --coverage", "test:upgrade:unicorn": "npm run cluster:k3d && npm run cluster:k3d:import-unicorn && vitest run integration/cluster/upgrade.test.ts", "test:upgrade:upstream": "npm run cluster:k3d && npm run cluster:k3d:import-upstream && vitest run integration/cluster/upgrade.test.ts" }, dependencies: { "@types/ramda": "0.31.0", commander: "14.0.0", express: "5.1.0", "fast-json-patch": "3.1.1", heredoc: "^1.3.1", "http-status-codes": "^2.3.0", "json-pointer": "^0.6.2", "kubernetes-fluent-client": "3.10.0", pino: "9.7.0", "pino-pretty": "13.1.1", "prom-client": "15.1.3", ramda: "0.31.3", "ts-morph": "^26.0.0" }, devDependencies: { "@commitlint/cli": "19.8.1", "@commitlint/config-conventional": "19.8.1", "@fast-check/vitest": "^0.2.1", "@types/eslint": "9.6.1", "@types/express": "5.0.3", "@types/json-pointer": "^1.0.34", "@types/node": "24.x.x", "@types/node-forge": "1.3.13", "@types/uuid": "10.0.0", "@types/ws": "^8.18.1", "@vitest/coverage-v8": "^3.2.3", "fast-check": "^4.0.0", globals: "^16.0.0", husky: "^9.1.6", "js-yaml": "^4.1.0", shellcheck: "^3.0.0", tsx: "^4.20.3", undici: "^7.0.1", vitest: "^3.2.3" }, overrides: { glob: "^9.0.0" }, peerDependencies: { "@types/prompts": "2.4.9", "@typescript-eslint/eslint-plugin": "8.38.0", "@typescript-eslint/parser": "8.38.0", esbuild: "0.25.8", eslint: "9.32.0", "node-forge": "1.3.1", prettier: "3.6.2", prompts: "2.4.2", typescript: "5.8.3", uuid: "11.1.0" } };
64
64
 
65
65
  // src/lib/k8s.ts
66
66
  var import_kubernetes_fluent_client = require("kubernetes-fluent-client");
package/package.json CHANGED
@@ -16,7 +16,7 @@
16
16
  "!src/fixtures/**",
17
17
  "!dist/**/*.test.d.ts*"
18
18
  ],
19
- "version": "0.52.3-nightly.4",
19
+ "version": "0.52.3-nightly.6",
20
20
  "main": "dist/lib.js",
21
21
  "types": "dist/lib.d.ts",
22
22
  "scripts": {
@@ -24,6 +24,9 @@
24
24
  "build:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev .",
25
25
  "build:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) .",
26
26
  "ci": "npm ci",
27
+ "cluster:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system",
28
+ "cluster:k3d:import-upstream": "npm run build && docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev",
29
+ "cluster:k3d:import-unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) . && k3d image import pepr/private:dev -c pepr-dev",
27
30
  "format:check": "npm run format:src && npm run format:tests && npm run format:markdown && npm run format:integration && npm run format:prettier -- --check",
28
31
  "format:fix": "npm run format:src -- --fix && npm run format:markdown -- --fix && npm run format:integration -- --fix && npm run format:prettier -- --write",
29
32
  "format:integration": "eslint --config config/eslint.integration.config.mjs integration/cli integration/helpers",
@@ -35,24 +38,15 @@
35
38
  "prebuild": "rm -fr dist/* && npm run gen-data-json",
36
39
  "prepare": "if [ \"$NODE_ENV\" != 'production' ]; then husky; fi",
37
40
  "set:version": "node scripts/set-version.js",
38
- "test": "npm run test:unit && npm run test:journey && npm run test:journey-wasm",
41
+ "test": "npm run test:unit && npm run test:integration",
39
42
  "test:artifacts": "npm run build && vitest run src/build-artifact.test.ts",
40
43
  "test:docs": "vitest run --config=config/vitest.integration.config.ts integration/cli/docs/*.test.ts",
41
44
  "test:integration": "npm run test:integration:prep && npm run test:integration:run",
42
45
  "test:integration:prep": "./integration/prep.sh",
43
46
  "test:integration:run": "vitest run --config=config/vitest.integration.config.ts integration",
44
- "test:journey": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run",
45
- "test:journey-wasm": "npm run test:journey:k3d && npm run build && npm run test:journey:image && npm run test:journey:run-wasm",
46
- "test:journey-wasm:unicorn": "npm run test:journey:k3d && npm run build && npm run test:journey:image:unicorn && npm run test:journey:run-wasm",
47
- "test:journey:image": "npm run build && docker buildx build --output type=docker --tag pepr:dev . && k3d image import pepr:dev -c pepr-dev",
48
- "test:journey:image:unicorn": "npm run build && docker buildx build --output type=docker --tag pepr/private:dev $(node scripts/read-unicorn-build-args.mjs) . && k3d image import pepr/private:dev -c pepr-dev",
49
- "test:journey:k3d": "k3d cluster delete pepr-dev && k3d cluster create pepr-dev --k3s-arg '--debug@server:0' --wait && kubectl rollout status deployment -n kube-system",
50
- "test:journey:run": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint.test.ts",
51
- "test:journey:run-wasm": "vitest run --config=config/vitest.journey.config.ts journey/entrypoint-wasm.test.ts",
52
- "test:journey:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && npm run test:journey:run",
53
47
  "test:unit": "npm run gen-data-json && NODE_OPTIONS=--no-deprecation vitest --config config/vitest.root.config.ts run --coverage",
54
- "test:upgrade:unicorn": "npm run test:journey:k3d && npm run test:journey:image:unicorn && vitest run integration/cluster/upgrade.test.ts",
55
- "test:upgrade:upstream": "npm run test:journey:k3d && npm run test:journey:image && vitest run integration/cluster/upgrade.test.ts"
48
+ "test:upgrade:unicorn": "npm run cluster:k3d && npm run cluster:k3d:import-unicorn && vitest run integration/cluster/upgrade.test.ts",
49
+ "test:upgrade:upstream": "npm run cluster:k3d && npm run cluster:k3d:import-upstream && vitest run integration/cluster/upgrade.test.ts"
56
50
  },
57
51
  "dependencies": {
58
52
  "@types/ramda": "0.31.0",
@@ -101,7 +101,6 @@ export default function (program: Command): void {
101
101
 
102
102
  if (opts.registryInfo !== undefined) {
103
103
  Log.info(`Including ${cfg.pepr.includedFiles.length} files in controller image.`);
104
- // for journey test to make sure the image is built
105
104
 
106
105
  // only actually build/push if there are files to include
107
106
  await handleCustomImageBuild(
@@ -0,0 +1,45 @@
1
+ import { resolve } from "path/posix";
2
+ import {
3
+ peprPackageJSON,
4
+ gitignore,
5
+ eslint,
6
+ prettier,
7
+ readme,
8
+ tsConfig,
9
+ peprTSTemplate,
10
+ snippet,
11
+ codeSettings,
12
+ samplesYaml,
13
+ helloPepr,
14
+ } from "./templates";
15
+ import { write } from "./utils";
16
+
17
+ export async function createProjectFiles(
18
+ dirName: string,
19
+ packageJSON: peprPackageJSON,
20
+ ): Promise<void> {
21
+ const files = [
22
+ { path: gitignore.path, data: gitignore.data },
23
+ { path: eslint.path, data: eslint.data },
24
+ { path: prettier.path, data: prettier.data },
25
+ { path: packageJSON.path, data: packageJSON.data },
26
+ { path: readme.path, data: readme.data },
27
+ { path: tsConfig.path, data: tsConfig.data },
28
+ { path: peprTSTemplate.path, data: peprTSTemplate.data },
29
+ ];
30
+
31
+ const nestedFiles = [
32
+ { dir: ".vscode", path: snippet.path, data: snippet.data },
33
+ { dir: ".vscode", path: codeSettings.path, data: codeSettings.data },
34
+ { dir: "capabilities", path: samplesYaml.path, data: samplesYaml.data },
35
+ { dir: "capabilities", path: helloPepr.path, data: helloPepr.data },
36
+ ];
37
+
38
+ for (const file of files) {
39
+ await write(resolve(dirName, file.path), file.data);
40
+ }
41
+
42
+ for (const file of nestedFiles) {
43
+ await write(resolve(dirName, file.dir, file.path), file.data);
44
+ }
45
+ }
@@ -0,0 +1,23 @@
1
+ import { execSync } from "child_process";
2
+
3
+ export const doPostInitActions = (dirName: string): void => {
4
+ // run npm install from the new directory
5
+ process.chdir(dirName);
6
+ execSync("npm install", {
7
+ stdio: "inherit",
8
+ });
9
+
10
+ // setup git
11
+ execSync("git init --initial-branch=main", {
12
+ stdio: "inherit",
13
+ });
14
+
15
+ // try to open vscode
16
+ try {
17
+ execSync("code .", {
18
+ stdio: "inherit",
19
+ });
20
+ } catch {
21
+ console.warn("VSCode was not found, IDE will not automatically open.");
22
+ }
23
+ };
@@ -1,35 +1,23 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
3
3
 
4
- import { execSync } from "child_process";
5
- import { resolve } from "path";
6
-
7
4
  import { Command } from "commander";
8
- import {
9
- codeSettings,
10
- eslint,
11
- peprTSTemplate,
12
- genPkgJSON,
13
- gitignore,
14
- helloPepr,
15
- peprPackageJSON,
16
- prettier,
17
- readme,
18
- samplesYaml,
19
- snippet,
20
- tsConfig,
21
- } from "./templates";
22
- import { createDir, sanitizeName, write } from "./utils";
5
+ import { peprTSTemplate, genPkgJSON } from "./templates";
6
+ import { sanitizeName } from "./utils";
23
7
  import { confirm, PromptOptions, walkthrough } from "./walkthrough";
24
8
  import { ErrorList } from "../../lib/errors";
25
9
  import { UUID_LENGTH_LIMIT } from "./enums";
26
10
  import { Option } from "commander";
11
+ import { setupProjectStructure } from "./setupProjectStructure";
12
+ import { doPostInitActions } from "./doPostInitActions";
13
+ import { createProjectFiles } from "./createProjectFiles";
14
+ import { v4 as uuidv4 } from "uuid";
15
+ import Log from "../../lib/telemetry/logger";
27
16
 
28
- export default function (program: Command): void {
17
+ export default function (): Command {
29
18
  let response = {} as PromptOptions;
30
19
 
31
- program
32
- .command("init")
20
+ return new Command("init")
33
21
  .description("Initialize a new Pepr Module")
34
22
  .option("-d, --description <string>", "Explain the purpose of the new module.")
35
23
  .addOption(
@@ -41,6 +29,10 @@ export default function (program: Command): void {
41
29
  "-u, --uuid <string>",
42
30
  "Unique identifier for your module with a max length of 36 characters.",
43
31
  (uuid: string): string => {
32
+ if (typeof uuid === "undefined" || uuid === "") {
33
+ uuid = uuidv4();
34
+ Log.warn(`The UUID was empty. Generated new UUID: '${uuid}'`);
35
+ }
44
36
  if (uuid.length > UUID_LENGTH_LIMIT) {
45
37
  throw new Error("The UUID must be 36 characters or fewer.");
46
38
  }
@@ -59,7 +51,7 @@ export default function (program: Command): void {
59
51
  const confirmed = await confirm(dirName, packageJSON, peprTSTemplate.path, opts.yes);
60
52
 
61
53
  if (confirmed) {
62
- console.log("Creating new Pepr module...");
54
+ Log.info("Creating new Pepr module...");
63
55
 
64
56
  try {
65
57
  await setupProjectStructure(dirName);
@@ -69,69 +61,11 @@ export default function (program: Command): void {
69
61
  doPostInitActions(dirName);
70
62
  }
71
63
 
72
- console.log(`New Pepr module created at ${dirName}`);
73
- console.log(`Open VSCode or your editor of choice in ${dirName} to get started!`);
74
- } catch (e) {
75
- if (e instanceof Error) {
76
- console.error(`Error creating Pepr module:`, e);
77
- }
78
- process.exit(1);
64
+ Log.info(`New Pepr module created at ${dirName}`);
65
+ Log.info(`Open VSCode or your editor of choice in ${dirName} to get started!`);
66
+ } catch (error) {
67
+ throw new Error(`Error creating Pepr module:`, { cause: error });
79
68
  }
80
69
  }
81
70
  });
82
71
  }
83
-
84
- async function setupProjectStructure(dirName: string): Promise<void> {
85
- await createDir(dirName);
86
- await createDir(resolve(dirName, ".vscode"));
87
- await createDir(resolve(dirName, "capabilities"));
88
- }
89
-
90
- async function createProjectFiles(dirName: string, packageJSON: peprPackageJSON): Promise<void> {
91
- const files = [
92
- { path: gitignore.path, data: gitignore.data },
93
- { path: eslint.path, data: eslint.data },
94
- { path: prettier.path, data: prettier.data },
95
- { path: packageJSON.path, data: packageJSON.data },
96
- { path: readme.path, data: readme.data },
97
- { path: tsConfig.path, data: tsConfig.data },
98
- { path: peprTSTemplate.path, data: peprTSTemplate.data },
99
- ];
100
-
101
- const nestedFiles = [
102
- { dir: ".vscode", path: snippet.path, data: snippet.data },
103
- { dir: ".vscode", path: codeSettings.path, data: codeSettings.data },
104
- { dir: "capabilities", path: samplesYaml.path, data: samplesYaml.data },
105
- { dir: "capabilities", path: helloPepr.path, data: helloPepr.data },
106
- ];
107
-
108
- for (const file of files) {
109
- await write(resolve(dirName, file.path), file.data);
110
- }
111
-
112
- for (const file of nestedFiles) {
113
- await write(resolve(dirName, file.dir, file.path), file.data);
114
- }
115
- }
116
-
117
- const doPostInitActions = (dirName: string): void => {
118
- // run npm install from the new directory
119
- process.chdir(dirName);
120
- execSync("npm install", {
121
- stdio: "inherit",
122
- });
123
-
124
- // setup git
125
- execSync("git init --initial-branch=main", {
126
- stdio: "inherit",
127
- });
128
-
129
- // try to open vscode
130
- try {
131
- execSync("code .", {
132
- stdio: "inherit",
133
- });
134
- } catch {
135
- console.warn("VSCode was not found, IDE will not automatically open.");
136
- }
137
- };
@@ -0,0 +1,8 @@
1
+ import { createDir } from "./utils";
2
+ import { resolve } from "path";
3
+
4
+ export async function setupProjectStructure(dirName: string): Promise<void> {
5
+ await createDir(dirName);
6
+ await createDir(resolve(dirName, ".vscode"));
7
+ await createDir(resolve(dirName, "capabilities"));
8
+ }
@@ -3,7 +3,6 @@
3
3
 
4
4
  import { dumpYaml } from "@kubernetes/client-node";
5
5
  import { inspect } from "util";
6
- import { v4 as uuidv4 } from "uuid";
7
6
  import { readFileSync } from "fs";
8
7
  import path from "path";
9
8
 
@@ -50,8 +49,7 @@ export type peprPackageJSON = {
50
49
  };
51
50
 
52
51
  export function genPkgJSON(opts: InitOptions): peprPackageJSON {
53
- // Generate a random UUID for the module based on the module name if it is not provided
54
- const uuid = !opts.uuid ? uuidv4() : opts.uuid;
52
+ const uuid = opts.uuid;
55
53
  // Generate a name for the module based on the module name
56
54
  const name = sanitizeName(opts.name);
57
55
  // Make typescript a dev dependency
@@ -91,7 +89,7 @@ export function genPkgJSON(opts: InitOptions): peprPackageJSON {
91
89
  env: {},
92
90
  },
93
91
  scripts: {
94
- "k3d-setup": scripts["test:journey:k3d"],
92
+ "k3d-setup": scripts["cluster:k3d"],
95
93
  },
96
94
  dependencies: {
97
95
  pepr: version,
@@ -33,6 +33,9 @@ async function setUUID(uuid?: string): Promise<Answers<string>> {
33
33
  name: "uuid",
34
34
  message: "Enter a unique identifier for the new Pepr module.\n",
35
35
  validate: (val: string) => {
36
+ if (typeof val === "undefined" || val === "") {
37
+ return "The UUID must be at least 1 character long";
38
+ }
36
39
  return (
37
40
  val.length <= UUID_LENGTH_LIMIT ||
38
41
  `The UUID must be ${UUID_LENGTH_LIMIT} characters or fewer.`
package/src/cli.ts CHANGED
@@ -30,6 +30,7 @@ program
30
30
  .version(version)
31
31
  .description(`Pepr (v${version}) - Type safe K8s middleware for humans`)
32
32
  .addCommand(crd())
33
+ .addCommand(init())
33
34
  .action(() => {
34
35
  if (program.args.length < 1) {
35
36
  console.log(banner);
@@ -41,7 +42,6 @@ program
41
42
  }
42
43
  });
43
44
 
44
- init(program);
45
45
  build(program);
46
46
  deploy(program);
47
47
  dev(program);
@@ -85,9 +85,9 @@ export function getWatcher(
85
85
  serviceAccountName: name,
86
86
  securityContext: {
87
87
  runAsUser: image.includes("private") ? 1000 : 65532,
88
- runAsGroup: 65532,
88
+ runAsGroup: image.includes("private") ? 1000 : 65532,
89
89
  runAsNonRoot: true,
90
- fsGroup: 65532,
90
+ fsGroup: image.includes("private") ? 1000 : 65532,
91
91
  },
92
92
  containers: [
93
93
  {
@@ -128,7 +128,7 @@ export function getWatcher(
128
128
  },
129
129
  securityContext: {
130
130
  runAsUser: image.includes("private") ? 1000 : 65532,
131
- runAsGroup: 65532,
131
+ runAsGroup: image.includes("private") ? 1000 : 65532,
132
132
  runAsNonRoot: true,
133
133
  allowPrivilegeEscalation: false,
134
134
  capabilities: {
@@ -228,9 +228,9 @@ export function getDeployment(
228
228
  serviceAccountName: name,
229
229
  securityContext: {
230
230
  runAsUser: image.includes("private") ? 1000 : 65532,
231
- runAsGroup: 65532,
231
+ runAsGroup: image.includes("private") ? 1000 : 65532,
232
232
  runAsNonRoot: true,
233
- fsGroup: 65532,
233
+ fsGroup: image.includes("private") ? 1000 : 65532,
234
234
  },
235
235
  containers: [
236
236
  {
@@ -272,7 +272,7 @@ export function getDeployment(
272
272
  env: genEnv(config),
273
273
  securityContext: {
274
274
  runAsUser: image.includes("private") ? 1000 : 65532,
275
- runAsGroup: 65532,
275
+ runAsGroup: image.includes("private") ? 1000 : 65532,
276
276
  runAsNonRoot: true,
277
277
  allowPrivilegeEscalation: false,
278
278
  capabilities: {
@@ -60,9 +60,9 @@ export async function overridesFile(
60
60
  },
61
61
  securityContext: {
62
62
  runAsUser: image.includes("private") ? 1000 : 65532,
63
- runAsGroup: 65532,
63
+ runAsGroup: image.includes("private") ? 1000 : 65532,
64
64
  runAsNonRoot: true,
65
- fsGroup: 65532,
65
+ fsGroup: image.includes("private") ? 1000 : 65532,
66
66
  },
67
67
  readinessProbe: {
68
68
  httpGet: {
@@ -92,7 +92,7 @@ export async function overridesFile(
92
92
  },
93
93
  containerSecurityContext: {
94
94
  runAsUser: image.includes("private") ? 1000 : 65532,
95
- runAsGroup: 65532,
95
+ runAsGroup: image.includes("private") ? 1000 : 65532,
96
96
  runAsNonRoot: true,
97
97
  allowPrivilegeEscalation: false,
98
98
  capabilities: {
@@ -128,9 +128,9 @@ export async function overridesFile(
128
128
  },
129
129
  securityContext: {
130
130
  runAsUser: image.includes("private") ? 1000 : 65532,
131
- runAsGroup: 65532,
131
+ runAsGroup: image.includes("private") ? 1000 : 65532,
132
132
  runAsNonRoot: true,
133
- fsGroup: 65532,
133
+ fsGroup: image.includes("private") ? 1000 : 65532,
134
134
  },
135
135
  readinessProbe: {
136
136
  httpGet: {
@@ -160,7 +160,7 @@ export async function overridesFile(
160
160
  },
161
161
  containerSecurityContext: {
162
162
  runAsUser: image.includes("private") ? 1000 : 65532,
163
- runAsGroup: 65532,
163
+ runAsGroup: image.includes("private") ? 1000 : 65532,
164
164
  runAsNonRoot: true,
165
165
  allowPrivilegeEscalation: false,
166
166
  capabilities: {