pepr 0.52.1-nightly.0 → 0.52.1-nightly.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ export declare const createCRDscaffold: (group: string, version: string, kind: string, data: {
2
+ domain: string;
3
+ plural: string;
4
+ scope: string;
5
+ shortName: string;
6
+ }) => string;
7
+ //# sourceMappingURL=createCRDscaffold.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"createCRDscaffold.d.ts","sourceRoot":"","sources":["../../../../src/cli/crd/create/createCRDscaffold.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,iBAAiB,GAC5B,OAAO,MAAM,EACb,SAAS,MAAM,EACf,MAAM,MAAM,EACZ,MAAM;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,KACA,MA8EF,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export default function (): Command;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/crd/create/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAQ5C,MAAM,CAAC,OAAO,cAAc,OAAO,CA6BlC"}
@@ -1,9 +1,6 @@
1
- import { Command } from "commander";
2
1
  import { Project, InterfaceDeclaration, TypeAliasDeclaration, Node, SourceFile, Type } from "ts-morph";
3
2
  import { kind as k } from "kubernetes-fluent-client";
4
3
  import { V1JSONSchemaProps } from "@kubernetes/client-node";
5
- declare const _default: Command;
6
- export default _default;
7
4
  export declare function extractCRDDetails(content: string, sourceFile: SourceFile): {
8
5
  kind: string | undefined;
9
6
  fqdn: string;
@@ -46,4 +43,5 @@ interface CRDConfig {
46
43
  conditionSchema: ReturnType<typeof getSchemaFromType>;
47
44
  }
48
45
  export declare function buildCRD(config: CRDConfig): k.CustomResourceDefinition;
49
- //# sourceMappingURL=generate.d.ts.map
46
+ export {};
47
+ //# sourceMappingURL=generators.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators.d.ts","sourceRoot":"","sources":["../../../../src/cli/crd/generate/generators.ts"],"names":[],"mappings":"AAIA,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EAEpB,IAAI,EACJ,UAAU,EACV,IAAI,EACL,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAG5D,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,UAAU,GACrB;IACD,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAYA;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAe7E;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAExD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,EAAE,CAInF;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,IAAI,CAiCN;AAGD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI3F;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;CACnB,CA2BA;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAQtD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,GAAG,oBAAoB,GAAG;IACpF,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC9C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAuBA;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,iBAAiB,CAc7D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,iBAAiB,CA0B/D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,WAAW,IAAI;IAC7B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC9C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAEA;AAED,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;IACjD,eAAe,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;CACvD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,CAAC,CAAC,wBAAwB,CA0DtE"}
@@ -0,0 +1,3 @@
1
+ import { Command } from "commander";
2
+ export default function (): Command;
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/cli/crd/generate/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,MAAM,CAAC,OAAO,cAAc,OAAO,CAOlC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../../src/cli/crd/generate/messages.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,aAAa;;2BAED,MAAM,KAAG,MAAM;kCAER,MAAM,KAAG,MAAM;CAE9C,CAAC;AAEF,eAAO,MAAM,eAAe;;qCAEO,MAAM,KAAG,MAAM;kCAElB,MAAM,QAAQ,MAAM,KAAG,MAAM;CAE5D,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/crd/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,MAAM,CAAC,OAAO,WAAW,OAAO,EAAE,OAAO,GAAG,IAAI,CAO/C"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/cli/crd/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,MAAM,CAAC,OAAO,cAAc,OAAO,CAKlC"}
package/dist/cli.js CHANGED
@@ -8875,7 +8875,7 @@ var gitIgnore = "# Ignore node_modules and Pepr build artifacts\nnode_modules\nd
8875
8875
  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';
8876
8876
  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';
8877
8877
  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';
8878
- 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.1-nightly.0", 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.30.2", 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.8.2", pino: "9.7.0", "pino-pretty": "13.0.0", "prom-client": "15.1.3", ramda: "0.31.3", sigstore: "3.1.0", "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.33.0", "@typescript-eslint/parser": "8.33.0", esbuild: "0.25.5", eslint: "^9.26.0", "node-forge": "1.3.1", prettier: "3.5.3", prompts: "2.4.2", typescript: "5.8.3", uuid: "11.1.0" } };
8878
+ 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.1-nightly.1", 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.30.2", 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.9.0", pino: "9.7.0", "pino-pretty": "13.0.0", "prom-client": "15.1.3", ramda: "0.31.3", sigstore: "3.1.0", "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.33.0", "@typescript-eslint/parser": "8.33.0", esbuild: "0.25.5", eslint: "^9.26.0", "node-forge": "1.3.1", prettier: "3.5.3", prompts: "2.4.2", typescript: "5.8.3", uuid: "11.1.0" } };
8879
8879
 
8880
8880
  // src/cli/init/utils.ts
8881
8881
  var import_fs4 = require("fs");
@@ -10747,7 +10747,7 @@ function buildUUIDTable(deployments) {
10747
10747
  }
10748
10748
 
10749
10749
  // src/cli.ts
10750
- var import_commander5 = require("commander");
10750
+ var import_commander6 = require("commander");
10751
10751
 
10752
10752
  // src/cli/update/index.ts
10753
10753
  var import_child_process6 = require("child_process");
@@ -10837,114 +10837,19 @@ function kfc_default(program2) {
10837
10837
  });
10838
10838
  }
10839
10839
 
10840
- // src/cli/crd/create.ts
10841
- var import_commander3 = require("commander");
10842
- var import_fs15 = require("fs");
10843
- var import_path7 = __toESM(require("path"));
10844
- var create = new import_commander3.Command("create").description("Create a new CRD TypeScript definition").addOption(
10845
- new import_commander3.Option(
10846
- "-S, --scope <scope>",
10847
- "Whether the resulting custom resource is cluster- or namespace-scoped"
10848
- ).choices(["Namespaced", "Cluster"]).default("Namespaced")
10849
- ).option("-d, --domain <domain>", "Optional domain for CRD (e.g. pepr.dev)", "pepr.dev").requiredOption("-g, --group <group>", "API group (e.g. cache)").requiredOption("-k, --kind <kind>", "Kind name (e.g. memcached)").option("-p, --plural <plural>", "Plural name for CRD (e.g. memcacheds)").requiredOption("-s, --short-name <name>", "Short name for CRD (e.g. mc)", "").requiredOption("-v, --version <version>", "API version (e.g. v1alpha1)").action(async ({ group: group2, version: version3, kind: kind8, domain, scope, plural: plural2, shortName }) => {
10850
- console.log("This feature is currently in alpha.");
10851
- const outputDir2 = import_path7.default.resolve(`./api/${version3}`);
10852
- await createDirectoryIfNotExists(outputDir2);
10853
- await import_fs15.promises.writeFile(
10854
- `./api/${version3}/${kind8.toLowerCase()}_types.ts`,
10855
- generateCRDScaffold(group2, version3, kind8, { domain, scope, plural: plural2, shortName })
10856
- );
10857
- console.log(`\u2714 Created ${kind8} TypeScript definition in ${outputDir2}`);
10858
- });
10859
- var create_default = create;
10860
- var generateCRDScaffold = (group2, version3, kind8, data) => {
10861
- return `// Auto-generated CRD TypeScript definition
10862
- // Kind: ${kind8}
10863
- // Group: ${group2}
10864
- // Version: ${version3}
10865
- // Domain: ${data.domain}
10866
-
10867
- export interface ${kind8}Spec {
10868
- // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
10869
- // Important: Run "npx pepr crd generate" to regenerate code after modifying this file
10870
-
10871
- /**
10872
- * Size defines the number of Memcache instances
10873
- */
10874
- Size?: number[];
10875
-
10876
- /**
10877
- * Port defines the port that will be used to init the container with the image
10878
- */
10879
- ContainerPort: number;
10880
-
10881
- /**
10882
- * Application specific configuration
10883
- */
10884
- Config?: {
10885
- language: string[];
10886
- timezone: number;
10887
- zone: {
10888
- state: string;
10889
- areaCode: string[];
10890
- };
10891
- };
10892
- }
10893
-
10894
- export interface ${kind8}Status {
10895
- conditions: ${kind8}StatusCondition[];
10896
- }
10897
-
10898
- export const details = {
10899
- plural: "${data.plural}",
10900
- scope: "${data.scope}",
10901
- shortName: "${data.shortName}",
10902
- };
10903
-
10904
- type ${kind8}StatusCondition = {
10905
- /**
10906
- * lastTransitionTime is the last time the condition transitioned from one status to another. This is not guaranteed to be set in happensBefore order across different conditions for a given object. It may be unset in some circumstances.
10907
- */
10908
- lastTransitionTime: Date;
10909
- /**
10910
- * message is a human readable message indicating details about the transition. This may be an empty string.
10911
- */
10912
- message: string;
10913
- /**
10914
- * observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.
10915
- */
10916
- observedGeneration?: number;
10917
- /**
10918
- * reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
10919
- */
10920
- reason: string;
10921
- /**
10922
- * status of the condition, one of True, False, Unknown.
10923
- */
10924
- status: string;
10925
- /**
10926
- * VM location.
10927
- */
10928
- vm: {
10929
- name: string;
10930
- region: string;
10931
- status: string;
10932
- message: string;
10933
- }
10934
- };
10935
-
10840
+ // src/cli/crd/index.ts
10841
+ var import_commander5 = require("commander");
10936
10842
 
10937
- `;
10938
- };
10843
+ // src/cli/crd/generate/index.ts
10844
+ var import_commander3 = require("commander");
10939
10845
 
10940
- // src/cli/crd/generate.ts
10941
- var import_commander4 = require("commander");
10942
- var import_fs16 = __toESM(require("fs"));
10943
- var import_path8 = __toESM(require("path"));
10846
+ // src/cli/crd/generate/generators.ts
10847
+ var import_fs15 = __toESM(require("fs"));
10848
+ var import_path7 = __toESM(require("path"));
10944
10849
  var import_yaml = __toESM(require_dist());
10945
10850
  var import_ts_morph = require("ts-morph");
10946
10851
 
10947
- // src/cli/crd/messages.ts
10852
+ // src/cli/crd/generate/messages.ts
10948
10853
  var ErrorMessages = {
10949
10854
  MISSING_DETAILS: "Missing 'details' variable declaration.",
10950
10855
  INVALID_SCOPE: (scope) => `'scope' must be either "Cluster" or "Namespaced", got "${scope}"`,
@@ -10956,10 +10861,7 @@ var WarningMessages = {
10956
10861
  MISSING_INTERFACE: (fileName, kind8) => `Skipping ${fileName}: missing interface ${kind8}Spec`
10957
10862
  };
10958
10863
 
10959
- // src/cli/crd/generate.ts
10960
- var generate_default = new import_commander4.Command("generate").description(
10961
- "Generate CRD manifests from TypeScript definitions stored in 'api/' of the current directory."
10962
- ).option("-o, --output <directory>", "Output directory for generated CRDs", "./crds").action(generateCRDs);
10864
+ // src/cli/crd/generate/generators.ts
10963
10865
  function extractCRDDetails(content, sourceFile) {
10964
10866
  const kind8 = extractSingleLineComment(content, "Kind");
10965
10867
  const group2 = extractSingleLineComment(content, "Group") ?? "example";
@@ -10972,24 +10874,24 @@ function extractCRDDetails(content, sourceFile) {
10972
10874
  }
10973
10875
  async function generateCRDs(options) {
10974
10876
  logger_default.warn("This feature is currently in alpha.\n");
10975
- const outputDir2 = import_path8.default.resolve(options.output);
10877
+ const outputDir2 = import_path7.default.resolve(options.output);
10976
10878
  await createDirectoryIfNotExists(outputDir2);
10977
10879
  const project = new import_ts_morph.Project();
10978
- const apiRoot = import_path8.default.resolve("api");
10880
+ const apiRoot = import_path7.default.resolve("api");
10979
10881
  const versions = getAPIVersions(apiRoot);
10980
10882
  for (const version3 of versions) {
10981
- const sourceFiles = loadVersionFiles(project, import_path8.default.join(apiRoot, version3));
10883
+ const sourceFiles = loadVersionFiles(project, import_path7.default.join(apiRoot, version3));
10982
10884
  for (const sourceFile of sourceFiles) {
10983
10885
  processSourceFile(sourceFile, version3, outputDir2);
10984
10886
  }
10985
10887
  }
10986
10888
  }
10987
10889
  function getAPIVersions(apiRoot) {
10988
- return import_fs16.default.readdirSync(apiRoot).filter((v) => import_fs16.default.statSync(import_path8.default.join(apiRoot, v)).isDirectory());
10890
+ return import_fs15.default.readdirSync(apiRoot).filter((v) => import_fs15.default.statSync(import_path7.default.join(apiRoot, v)).isDirectory());
10989
10891
  }
10990
10892
  function loadVersionFiles(project, versionDir) {
10991
- const files = import_fs16.default.readdirSync(versionDir).filter((f) => f.endsWith(".ts"));
10992
- const filePaths = files.map((f) => import_path8.default.join(versionDir, f));
10893
+ const files = import_fs15.default.readdirSync(versionDir).filter((f) => f.endsWith(".ts"));
10894
+ const filePaths = files.map((f) => import_path7.default.join(versionDir, f));
10993
10895
  return project.addSourceFilesAtPaths(filePaths);
10994
10896
  }
10995
10897
  function processSourceFile(sourceFile, version3, outputDir2) {
@@ -11017,8 +10919,8 @@ function processSourceFile(sourceFile, version3, outputDir2) {
11017
10919
  specSchema,
11018
10920
  conditionSchema
11019
10921
  });
11020
- const outPath = import_path8.default.join(outputDir2, `${kind8.toLowerCase()}.yaml`);
11021
- import_fs16.default.writeFileSync(outPath, (0, import_yaml.stringify)(crd), "utf8");
10922
+ const outPath = import_path7.default.join(outputDir2, `${kind8.toLowerCase()}.yaml`);
10923
+ import_fs15.default.writeFileSync(outPath, (0, import_yaml.stringify)(crd), "utf8");
11022
10924
  logger_default.info(`\u2714 Created ${outPath}`);
11023
10925
  }
11024
10926
  function extractSingleLineComment(content, label) {
@@ -11173,22 +11075,132 @@ function buildCRD(config) {
11173
11075
  };
11174
11076
  }
11175
11077
 
11078
+ // src/cli/crd/generate/index.ts
11079
+ function generate_default() {
11080
+ return new import_commander3.Command("generate").description(
11081
+ "Generate CRD manifests from TypeScript definitions stored in 'api/' of the current directory."
11082
+ ).option("-o, --output <directory>", "Output directory for generated CRDs", "./crds").action((options) => generateCRDs(options));
11083
+ }
11084
+
11085
+ // src/cli/crd/create/index.ts
11086
+ var import_commander4 = require("commander");
11087
+ var import_fs16 = require("fs");
11088
+
11089
+ // src/cli/crd/create/createCRDscaffold.ts
11090
+ var createCRDscaffold = (group2, version3, kind8, data) => {
11091
+ return `// Auto-generated CRD TypeScript definition
11092
+ // Kind: ${kind8}
11093
+ // Group: ${group2}
11094
+ // Version: ${version3}
11095
+ // Domain: ${data.domain}
11096
+
11097
+ export interface ${kind8}Spec {
11098
+ // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
11099
+ // Important: Run "npx pepr crd generate" to regenerate code after modifying this file
11100
+
11101
+ /**
11102
+ * Size defines the number of Memcache instances
11103
+ */
11104
+ Size?: number[];
11105
+
11106
+ /**
11107
+ * Port defines the port that will be used to init the container with the image
11108
+ */
11109
+ ContainerPort: number;
11110
+
11111
+ /**
11112
+ * Application specific configuration
11113
+ */
11114
+ Config?: {
11115
+ language: string[];
11116
+ timezone: number;
11117
+ zone: {
11118
+ state: string;
11119
+ areaCode: string[];
11120
+ };
11121
+ };
11122
+ }
11123
+
11124
+ export interface ${kind8}Status {
11125
+ conditions: ${kind8}StatusCondition[];
11126
+ }
11127
+
11128
+ export const details = {
11129
+ plural: "${data.plural}",
11130
+ scope: "${data.scope}",
11131
+ shortName: "${data.shortName}",
11132
+ };
11133
+
11134
+ type ${kind8}StatusCondition = {
11135
+ /**
11136
+ * lastTransitionTime is the last time the condition transitioned from one status to another. This is not guaranteed to be set in happensBefore order across different conditions for a given object. It may be unset in some circumstances.
11137
+ */
11138
+ lastTransitionTime: Date;
11139
+ /**
11140
+ * message is a human readable message indicating details about the transition. This may be an empty string.
11141
+ */
11142
+ message: string;
11143
+ /**
11144
+ * observedGeneration represents the .metadata.generation that the condition was set based upon. For instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date with respect to the current state of the instance.
11145
+ */
11146
+ observedGeneration?: number;
11147
+ /**
11148
+ * reason contains a programmatic identifier indicating the reason for the condition's last transition. Producers of specific condition types may define expected values and meanings for this field, and whether the values are considered a guaranteed API. The value should be a CamelCase string. This field may not be empty.
11149
+ */
11150
+ reason: string;
11151
+ /**
11152
+ * status of the condition, one of True, False, Unknown.
11153
+ */
11154
+ status: string;
11155
+ /**
11156
+ * VM location.
11157
+ */
11158
+ vm: {
11159
+ name: string;
11160
+ region: string;
11161
+ status: string;
11162
+ message: string;
11163
+ }
11164
+ };
11165
+
11166
+
11167
+ `;
11168
+ };
11169
+
11170
+ // src/cli/crd/create/index.ts
11171
+ var import_path8 = __toESM(require("path"));
11172
+ function create_default() {
11173
+ return new import_commander4.Command("create").description("Create a new CRD TypeScript definition").addOption(
11174
+ new import_commander4.Option(
11175
+ "-S, --scope <scope>",
11176
+ "Whether the resulting custom resource is cluster- or namespace-scoped"
11177
+ ).choices(["Namespaced", "Cluster"]).default("Namespaced")
11178
+ ).option("-d, --domain <domain>", "Optional domain for CRD (e.g. pepr.dev)", "pepr.dev").requiredOption("-g, --group <group>", "API group (e.g. cache)").requiredOption("-k, --kind <kind>", "Kind name (e.g. memcached)").option("-p, --plural <plural>", "Plural name for CRD (e.g. memcacheds)").requiredOption("-s, --short-name <name>", "Short name for CRD (e.g. mc)").requiredOption("-v, --version <version>", "API version (e.g. v1alpha1)").action(async ({ group: group2, version: version3, kind: kind8, domain, scope, plural: plural2, shortName }) => {
11179
+ logger_default.warn("This feature is currently in alpha.");
11180
+ const outputDir2 = import_path8.default.resolve(`./api/${version3}`);
11181
+ await createDirectoryIfNotExists(outputDir2);
11182
+ await import_fs16.promises.writeFile(
11183
+ `./api/${version3}/${kind8.toLowerCase()}_types.ts`,
11184
+ createCRDscaffold(group2, version3, kind8, { domain, scope, plural: plural2, shortName })
11185
+ );
11186
+ logger_default.info(`\u2714 Created ${kind8} TypeScript definition in ${outputDir2}`);
11187
+ });
11188
+ }
11189
+
11176
11190
  // src/cli/crd/index.ts
11177
- function crd_default(program2) {
11178
- const crd = program2.command("crd").description("Scaffold and generate Kubernetes CRDs from structured TypeScript definitions");
11179
- crd.addCommand(create_default);
11180
- crd.addCommand(generate_default);
11191
+ function crd_default() {
11192
+ return new import_commander5.Command("crd").description("Scaffold and generate Kubernetes CRDs from structured TypeScript definitions").addCommand(create_default()).addCommand(generate_default());
11181
11193
  }
11182
11194
 
11183
11195
  // src/cli.ts
11184
11196
  if (process.env.npm_lifecycle_event !== "npx") {
11185
11197
  console.info("Pepr should be run via `npx pepr <command>` instead of `pepr <command>`.");
11186
11198
  }
11187
- var program = new import_commander5.Command();
11199
+ var program = new import_commander6.Command();
11188
11200
  if (!process.env.PEPR_NODE_WARNINGS) {
11189
11201
  process.removeAllListeners("warning");
11190
11202
  }
11191
- program.enablePositionalOptions().version(version).description(`Pepr (v${version}) - Type safe K8s middleware for humans`).action(() => {
11203
+ program.enablePositionalOptions().version(version).description(`Pepr (v${version}) - Type safe K8s middleware for humans`).addCommand(crd_default()).action(() => {
11192
11204
  if (program.args.length < 1) {
11193
11205
  console.log(banner);
11194
11206
  program.help();
@@ -11208,5 +11220,4 @@ format_default(program);
11208
11220
  monitor_default(program);
11209
11221
  uuid_default(program);
11210
11222
  kfc_default(program);
11211
- crd_default(program);
11212
11223
  program.parse();
@@ -50,7 +50,7 @@ if (process.env.LOG_LEVEL) {
50
50
  var logger_default = Log;
51
51
 
52
52
  // src/templates/data.json
53
- 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.1-nightly.0", 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.30.2", 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.8.2", pino: "9.7.0", "pino-pretty": "13.0.0", "prom-client": "15.1.3", ramda: "0.31.3", sigstore: "3.1.0", "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.33.0", "@typescript-eslint/parser": "8.33.0", esbuild: "0.25.5", eslint: "^9.26.0", "node-forge": "1.3.1", prettier: "3.5.3", prompts: "2.4.2", typescript: "5.8.3", uuid: "11.1.0" } };
53
+ 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.1-nightly.1", 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.30.2", 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.9.0", pino: "9.7.0", "pino-pretty": "13.0.0", "prom-client": "15.1.3", ramda: "0.31.3", sigstore: "3.1.0", "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.33.0", "@typescript-eslint/parser": "8.33.0", esbuild: "0.25.5", eslint: "^9.26.0", "node-forge": "1.3.1", prettier: "3.5.3", prompts: "2.4.2", typescript: "5.8.3", uuid: "11.1.0" } };
54
54
 
55
55
  // src/lib/k8s.ts
56
56
  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.1-nightly.0",
19
+ "version": "0.52.1-nightly.1",
20
20
  "main": "dist/lib.js",
21
21
  "types": "dist/lib.d.ts",
22
22
  "scripts": {
@@ -62,7 +62,7 @@
62
62
  "heredoc": "^1.3.1",
63
63
  "http-status-codes": "^2.3.0",
64
64
  "json-pointer": "^0.6.2",
65
- "kubernetes-fluent-client": "3.8.2",
65
+ "kubernetes-fluent-client": "3.9.0",
66
66
  "pino": "9.7.0",
67
67
  "pino-pretty": "13.0.0",
68
68
  "prom-client": "15.1.3",
@@ -1,44 +1,7 @@
1
1
  // SPDX-License-Identifier: Apache-2.0
2
2
  // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
3
3
 
4
- import { Command, Option } from "commander";
5
- import { createDirectoryIfNotExists } from "../../lib/filesystemService";
6
- import { promises as fs } from "fs";
7
- import path from "path";
8
-
9
- // Scaffolds a new CRD TypeScript definition
10
- const create = new Command("create")
11
- .description("Create a new CRD TypeScript definition")
12
- .addOption(
13
- new Option(
14
- "-S, --scope <scope>",
15
- "Whether the resulting custom resource is cluster- or namespace-scoped",
16
- )
17
- .choices(["Namespaced", "Cluster"])
18
- .default("Namespaced"),
19
- )
20
- .option("-d, --domain <domain>", "Optional domain for CRD (e.g. pepr.dev)", "pepr.dev")
21
- .requiredOption("-g, --group <group>", "API group (e.g. cache)")
22
- .requiredOption("-k, --kind <kind>", "Kind name (e.g. memcached)")
23
- .option("-p, --plural <plural>", "Plural name for CRD (e.g. memcacheds)")
24
- .requiredOption("-s, --short-name <name>", "Short name for CRD (e.g. mc)", "")
25
- .requiredOption("-v, --version <version>", "API version (e.g. v1alpha1)")
26
- .action(async ({ group, version, kind, domain, scope, plural, shortName }) => {
27
- console.log("This feature is currently in alpha.");
28
- const outputDir = path.resolve(`./api/${version}`);
29
- await createDirectoryIfNotExists(outputDir);
30
-
31
- // create file in directory with kind
32
- await fs.writeFile(
33
- `./api/${version}/${kind.toLowerCase()}_types.ts`,
34
- generateCRDScaffold(group, version, kind, { domain, scope, plural, shortName }),
35
- );
36
- console.log(`✔ Created ${kind} TypeScript definition in ${outputDir}`);
37
- });
38
-
39
- export default create;
40
-
41
- export const generateCRDScaffold = (
4
+ export const createCRDscaffold = (
42
5
  group: string,
43
6
  version: string,
44
7
  kind: string,
@@ -0,0 +1,41 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
3
+
4
+ import { Command, Option } from "commander";
5
+ import { createDirectoryIfNotExists } from "../../../lib/filesystemService";
6
+ import { promises as fs } from "fs";
7
+ import Log from "../../../lib/telemetry/logger";
8
+ import { createCRDscaffold } from "./createCRDscaffold";
9
+ import path from "path";
10
+
11
+ // Scaffolds a new CRD TypeScript definition
12
+ export default function (): Command {
13
+ return new Command("create")
14
+ .description("Create a new CRD TypeScript definition")
15
+ .addOption(
16
+ new Option(
17
+ "-S, --scope <scope>",
18
+ "Whether the resulting custom resource is cluster- or namespace-scoped",
19
+ )
20
+ .choices(["Namespaced", "Cluster"])
21
+ .default("Namespaced"),
22
+ )
23
+ .option("-d, --domain <domain>", "Optional domain for CRD (e.g. pepr.dev)", "pepr.dev")
24
+ .requiredOption("-g, --group <group>", "API group (e.g. cache)")
25
+ .requiredOption("-k, --kind <kind>", "Kind name (e.g. memcached)")
26
+ .option("-p, --plural <plural>", "Plural name for CRD (e.g. memcacheds)")
27
+ .requiredOption("-s, --short-name <name>", "Short name for CRD (e.g. mc)")
28
+ .requiredOption("-v, --version <version>", "API version (e.g. v1alpha1)")
29
+ .action(async ({ group, version, kind, domain, scope, plural, shortName }) => {
30
+ Log.warn("This feature is currently in alpha.");
31
+ const outputDir = path.resolve(`./api/${version}`);
32
+ await createDirectoryIfNotExists(outputDir);
33
+
34
+ // create file in directory with kind
35
+ await fs.writeFile(
36
+ `./api/${version}/${kind.toLowerCase()}_types.ts`,
37
+ createCRDscaffold(group, version, kind, { domain, scope, plural, shortName }),
38
+ );
39
+ Log.info(`✔ Created ${kind} TypeScript definition in ${outputDir}`);
40
+ });
41
+ }
@@ -1,10 +1,6 @@
1
- // SPDX-License-Identifier: Apache-2.0
2
- // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
3
-
4
- import { Command } from "commander";
5
1
  import fs from "fs";
6
2
  import path from "path";
7
- import Log from "../../lib/telemetry/logger";
3
+ import Log from "../../../lib/telemetry/logger";
8
4
  import { stringify } from "yaml";
9
5
  import {
10
6
  Project,
@@ -15,18 +11,11 @@ import {
15
11
  SourceFile,
16
12
  Type,
17
13
  } from "ts-morph";
18
- import { createDirectoryIfNotExists } from "../../lib/filesystemService";
14
+ import { createDirectoryIfNotExists } from "../../../lib/filesystemService";
19
15
  import { kind as k } from "kubernetes-fluent-client";
20
16
  import { V1JSONSchemaProps } from "@kubernetes/client-node";
21
17
  import { WarningMessages, ErrorMessages } from "./messages";
22
18
 
23
- export default new Command("generate")
24
- .description(
25
- "Generate CRD manifests from TypeScript definitions stored in 'api/' of the current directory.",
26
- )
27
- .option("-o, --output <directory>", "Output directory for generated CRDs", "./crds")
28
- .action(generateCRDs);
29
-
30
19
  export function extractCRDDetails(
31
20
  content: string,
32
21
  sourceFile: SourceFile,
@@ -0,0 +1,14 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
3
+
4
+ import { Command } from "commander";
5
+ import { generateCRDs } from "./generators";
6
+
7
+ export default function (): Command {
8
+ return new Command("generate")
9
+ .description(
10
+ "Generate CRD manifests from TypeScript definitions stored in 'api/' of the current directory.",
11
+ )
12
+ .option("-o, --output <directory>", "Output directory for generated CRDs", "./crds")
13
+ .action(options => generateCRDs(options));
14
+ }
@@ -1,3 +1,6 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
3
+
1
4
  export const ErrorMessages = {
2
5
  MISSING_DETAILS: "Missing 'details' variable declaration.",
3
6
  INVALID_SCOPE: (scope: string): string =>
@@ -2,14 +2,12 @@
2
2
  // SPDX-FileCopyrightText: 2023-Present The Pepr Authors
3
3
 
4
4
  import { Command } from "commander";
5
- import createCmd from "./create";
6
- import generateCmd from "./generate";
5
+ import generate from "./generate/";
6
+ import create from "./create";
7
7
 
8
- export default function (program: Command): void {
9
- const crd = program
10
- .command("crd")
11
- .description("Scaffold and generate Kubernetes CRDs from structured TypeScript definitions");
12
-
13
- crd.addCommand(createCmd);
14
- crd.addCommand(generateCmd);
8
+ export default function (): Command {
9
+ return new Command("crd")
10
+ .description("Scaffold and generate Kubernetes CRDs from structured TypeScript definitions")
11
+ .addCommand(create())
12
+ .addCommand(generate());
15
13
  }
package/src/cli.ts CHANGED
@@ -29,6 +29,7 @@ program
29
29
  .enablePositionalOptions()
30
30
  .version(version)
31
31
  .description(`Pepr (v${version}) - Type safe K8s middleware for humans`)
32
+ .addCommand(crd())
32
33
  .action(() => {
33
34
  if (program.args.length < 1) {
34
35
  console.log(banner);
@@ -49,5 +50,4 @@ format(program);
49
50
  monitor(program);
50
51
  uuid(program);
51
52
  kfc(program);
52
- crd(program);
53
53
  program.parse();
@@ -1,10 +0,0 @@
1
- import { Command } from "commander";
2
- declare const create: Command;
3
- export default create;
4
- export declare const generateCRDScaffold: (group: string, version: string, kind: string, data: {
5
- domain: string;
6
- plural: string;
7
- scope: string;
8
- shortName: string;
9
- }) => string;
10
- //# sourceMappingURL=create.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"create.d.ts","sourceRoot":"","sources":["../../../src/cli/crd/create.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAU,MAAM,WAAW,CAAC;AAM5C,QAAA,MAAM,MAAM,SA2BR,CAAC;AAEL,eAAe,MAAM,CAAC;AAEtB,eAAO,MAAM,mBAAmB,GAC9B,OAAO,MAAM,EACb,SAAS,MAAM,EACf,MAAM,MAAM,EACZ,MAAM;IACJ,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,MAAM,CAAC;CACnB,KACA,MA8EF,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"generate.d.ts","sourceRoot":"","sources":["../../../src/cli/crd/generate.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAKpC,OAAO,EACL,OAAO,EACP,oBAAoB,EACpB,oBAAoB,EAEpB,IAAI,EACJ,UAAU,EACV,IAAI,EACL,MAAM,UAAU,CAAC;AAElB,OAAO,EAAE,IAAI,IAAI,CAAC,EAAE,MAAM,0BAA0B,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;;AAG5D,wBAKwB;AAExB,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,MAAM,EACf,UAAU,EAAE,UAAU,GACrB;IACD,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAYA;AAED,wBAAsB,YAAY,CAAC,OAAO,EAAE;IAAE,MAAM,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAe7E;AAED,wBAAgB,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,CAExD;AAED,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,MAAM,GAAG,UAAU,EAAE,CAInF;AAED,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,MAAM,EACf,SAAS,EAAE,MAAM,GAChB,IAAI,CAiCN;AAGD,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAI3F;AAED,wBAAgB,cAAc,CAAC,UAAU,EAAE,UAAU,GAAG;IACtD,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC;IAChC,SAAS,EAAE,MAAM,CAAC;CACnB,CA2BA;AAED,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,IAAI,GAAG,MAAM,CAQtD;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,oBAAoB,GAAG,oBAAoB,GAAG;IACpF,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC9C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAuBA;AAED,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,GAAG,iBAAiB,CAc7D;AAED,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,IAAI,GAAG,iBAAiB,CA0B/D;AAED,wBAAgB,YAAY,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEhD;AAED,wBAAgB,WAAW,IAAI;IAC7B,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC;IAC9C,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB,CAEA;AAED,UAAU,SAAS;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,GAAG,YAAY,CAAC;IAChC,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,UAAU,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;IACjD,eAAe,EAAE,UAAU,CAAC,OAAO,iBAAiB,CAAC,CAAC;CACvD;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,GAAG,CAAC,CAAC,wBAAwB,CA0DtE"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"messages.d.ts","sourceRoot":"","sources":["../../../src/cli/crd/messages.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa;;2BAED,MAAM,KAAG,MAAM;kCAER,MAAM,KAAG,MAAM;CAE9C,CAAC;AAEF,eAAO,MAAM,eAAe;;qCAEO,MAAM,KAAG,MAAM;kCAElB,MAAM,QAAQ,MAAM,KAAG,MAAM;CAE5D,CAAC"}