@speedkit/cli 4.44.1 → 4.45.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ # [4.45.0](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.44.1...v4.45.0) (2026-10-15)
2
+
3
+
4
+ ### Features
5
+
6
+ * **origin-request:** a raw mode without a customer ([9acce74](https://gitlab.orestes.info/baqend/speed-kit-cli/commit/9acce74f54622caff99a422d89b362f574ec440b))
7
+
1
8
  ## [4.44.1](https://gitlab.orestes.info/baqend/speed-kit-cli/compare/v4.44.0...v4.44.1) (2026-10-15)
2
9
 
3
10
 
package/README.md CHANGED
@@ -89,7 +89,7 @@ By either...
89
89
  * [`sk help [COMMAND]`](#sk-help-command)
90
90
  * [`sk login [APP]`](#sk-login-app)
91
91
  * [`sk onboarding [CUSTOMERPATH]`](#sk-onboarding-customerpath)
92
- * [`sk origin-request CUSTOMERPATH PAGEURL`](#sk-origin-request-customerpath-pageurl)
92
+ * [`sk origin-request [CUSTOMERPATH] [PAGEURL]`](#sk-origin-request-customerpath-pageurl)
93
93
  * [`sk prewarm APP PATH`](#sk-prewarm-app-path)
94
94
  * [`sk pull CUSTOMERPATH`](#sk-pull-customerpath)
95
95
  * [`sk query parameter CUSTOMERPATH`](#sk-query-parameter-customerpath)
@@ -826,18 +826,18 @@ EXAMPLES
826
826
  $ sk onboarding customers/decathlon.de --inject <installationId>
827
827
  ```
828
828
 
829
- ## `sk origin-request CUSTOMERPATH PAGEURL`
829
+ ## `sk origin-request [CUSTOMERPATH] [PAGEURL]`
830
830
 
831
831
  Request a page from origin with the exact headers Speed Kit's server sends for a cache variation, using the app's deployed runtime config
832
832
 
833
833
  ```
834
834
  USAGE
835
- $ sk origin-request CUSTOMERPATH PAGEURL [-c <value>] [-v <value>] [--host <value>] [--body <value>] [--grep
836
- <value>] [--json] [--variations <value>]
835
+ $ sk origin-request [CUSTOMERPATH] [PAGEURL] [-c <value>] [-v <value>] [--host <value>] [--body <value>] [--grep
836
+ <value>] [--json] [--variations <value>] [--raw]
837
837
 
838
838
  ARGUMENTS
839
- CUSTOMERPATH The customer config path
840
- PAGEURL Page to request from origin
839
+ [CUSTOMERPATH] The customer config path; optional with --raw, which then sends Speed Kit's device defaults
840
+ [PAGEURL] Page to request from origin
841
841
 
842
842
  FLAGS
843
843
  -c, --configName=<value> [default: production] The costumer config name
@@ -847,6 +847,8 @@ FLAGS
847
847
  --grep=<value> Print body lines matching this regex, case-insensitive
848
848
  --host=<value> Send this Host header, emulating an origin-map host override
849
849
  --json Machine-readable output
850
+ --raw Request without a customer: the customer path becomes optional, and the request carries
851
+ Speed Kit's device defaults (default, mobile, tablet) and no variation of an app
850
852
  --variations=<value> Simulate against a runtime config in a local file instead of the app's deployed one
851
853
 
852
854
  DESCRIPTION
@@ -859,6 +861,8 @@ EXAMPLES
859
861
  $ sk origin-request customers/decathlon.de https://www.decathlon.de/ -v mobile
860
862
 
861
863
  $ sk origin-request customers/decathlon.de https://www.decathlon.de/ --grep "storeId" --body /tmp/origin.html
864
+
865
+ $ sk origin-request --raw https://www.decathlon.de/ -v mobile --body /tmp/mobile.html
862
866
  ```
863
867
 
864
868
  ## `sk prewarm APP PATH`
@@ -4,10 +4,10 @@ export default class OriginRequest extends SkCommand<OriginRequestServiceBuildCo
4
4
  static description: string;
5
5
  static buildContext: typeof OriginRequestServiceBuildContext;
6
6
  static args: {
7
- pageUrl: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
8
7
  customerPath: import("@oclif/core/interfaces").Arg<string, {
9
8
  exists?: boolean;
10
9
  }>;
10
+ pageUrl: import("@oclif/core/interfaces").Arg<string, Record<string, unknown>>;
11
11
  };
12
12
  static flags: {
13
13
  variation: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
@@ -16,6 +16,7 @@ export default class OriginRequest extends SkCommand<OriginRequestServiceBuildCo
16
16
  grep: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
17
17
  json: import("@oclif/core/interfaces").BooleanFlag<boolean>;
18
18
  variations: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
19
+ raw: import("@oclif/core/interfaces").BooleanFlag<boolean>;
19
20
  configName: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
20
21
  };
21
22
  static examples: string[];
@@ -9,6 +9,7 @@ export default class OriginRequest extends SkCommand {
9
9
  `$ sk origin-request <customerPath> <pageUrl>`,
10
10
  `$ sk origin-request customers/decathlon.de https://www.decathlon.de/ -v mobile`,
11
11
  `$ sk origin-request customers/decathlon.de https://www.decathlon.de/ --grep "storeId" --body /tmp/origin.html`,
12
+ `$ sk origin-request --raw https://www.decathlon.de/ -v mobile --body /tmp/mobile.html`,
12
13
  ];
13
14
  async run() {
14
15
  const service = await new OriginRequestServiceFactory(this.context).buildService();
@@ -1,10 +1,10 @@
1
1
  import { Interfaces } from "@oclif/core";
2
2
  import { CommandContextValues, CliEnvironment } from "../cli/index.js";
3
3
  declare const args: {
4
- pageUrl: Interfaces.Arg<string, Record<string, unknown>>;
5
4
  customerPath: Interfaces.Arg<string, {
6
5
  exists?: boolean;
7
6
  }>;
7
+ pageUrl: Interfaces.Arg<string, Record<string, unknown>>;
8
8
  };
9
9
  declare const flags: {
10
10
  variation: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
@@ -13,11 +13,13 @@ declare const flags: {
13
13
  grep: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
14
14
  json: Interfaces.BooleanFlag<boolean>;
15
15
  variations: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
16
+ raw: Interfaces.BooleanFlag<boolean>;
16
17
  configName: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
17
18
  };
18
19
  /** What `sk origin-request` asks for, as the service reads it. */
19
20
  export interface OriginRequestOptions {
20
- readonly customerPath: string;
21
+ /** Absent with `--raw <pageUrl>`: no app, so only the device defaults resolve. */
22
+ readonly customerPath?: string;
21
23
  readonly configName: string;
22
24
  readonly pageUrl: string;
23
25
  readonly variation?: string;
@@ -33,10 +35,10 @@ declare const OriginRequestServiceBuildContext_base: new (values: OriginRequestS
33
35
  /** What an origin request is built from. */
34
36
  export declare class OriginRequestServiceBuildContext extends OriginRequestServiceBuildContext_base {
35
37
  static readonly args: {
36
- pageUrl: Interfaces.Arg<string, Record<string, unknown>>;
37
38
  customerPath: Interfaces.Arg<string, {
38
39
  exists?: boolean;
39
40
  }>;
41
+ pageUrl: Interfaces.Arg<string, Record<string, unknown>>;
40
42
  };
41
43
  static readonly flags: {
42
44
  variation: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
@@ -45,6 +47,7 @@ export declare class OriginRequestServiceBuildContext extends OriginRequestServi
45
47
  grep: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
46
48
  json: Interfaces.BooleanFlag<boolean>;
47
49
  variations: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
50
+ raw: Interfaces.BooleanFlag<boolean>;
48
51
  configName: Interfaces.OptionFlag<string, Interfaces.CustomOptions>;
49
52
  };
50
53
  static create(parsedArgs: Interfaces.InferredArgs<typeof args>, parsedFlags: Interfaces.InferredFlags<typeof flags>, environment: CliEnvironment): OriginRequestServiceBuildContext;
@@ -1,11 +1,20 @@
1
1
  import { Args, Flags } from "@oclif/core";
2
2
  import { CLI_CONFIG_NAME, CLI_CUSTOMER_CONFIG, } from "../integration-api/customer-config-flags.js";
3
3
  import { Context } from "../../models/context.js";
4
+ import ApplicationError from "../error-handling/error/application-error.js";
5
+ /** Whether an argument is a page rather than a customer directory. */
6
+ function isUrl(value) {
7
+ return /^https?:\/\//i.test(value ?? "");
8
+ }
4
9
  const args = {
5
- ...CLI_CUSTOMER_CONFIG,
10
+ customerPath: Args.directory({
11
+ ...CLI_CUSTOMER_CONFIG.customerPath,
12
+ required: false,
13
+ description: "The customer config path; optional with --raw, which then sends Speed Kit's device defaults",
14
+ }),
6
15
  pageUrl: Args.string({
7
16
  name: "pageUrl",
8
- required: true,
17
+ required: false,
9
18
  description: "Page to request from origin",
10
19
  example: "https://www.decathlon.de/",
11
20
  }),
@@ -31,17 +40,34 @@ const flags = {
31
40
  variations: Flags.string({
32
41
  description: "Simulate against a runtime config in a local file instead of the app's deployed one",
33
42
  }),
43
+ raw: Flags.boolean({
44
+ description: "Request without a customer: the customer path becomes optional, and the request carries Speed Kit's device defaults (default, mobile, tablet) and no variation of an app",
45
+ }),
34
46
  };
35
47
  /** What an origin request is built from. */
36
48
  export class OriginRequestServiceBuildContext extends Context() {
37
49
  static args = args;
38
50
  static flags = flags;
39
51
  static create(parsedArgs, parsedFlags, environment) {
52
+ // `sk origin-request --raw <url>`: a lone url is the page, not a customer directory.
53
+ const [customerPath, pageUrl] = isUrl(parsedArgs.customerPath)
54
+ ? [undefined, parsedArgs.customerPath]
55
+ : [parsedArgs.customerPath, parsedArgs.pageUrl];
56
+ if (!pageUrl) {
57
+ throw new ApplicationError("sk origin-request needs the page to request.", [
58
+ "sk origin-request <customerPath> <pageUrl>, or sk origin-request --raw <pageUrl>",
59
+ ]);
60
+ }
61
+ if (!customerPath && !parsedFlags.raw) {
62
+ throw new ApplicationError("Without a customer path there is no runtime config to build the request from.", [
63
+ "Name the customer, or pass --raw to send Speed Kit's device defaults.",
64
+ ]);
65
+ }
40
66
  return new OriginRequestServiceBuildContext({
41
67
  environment,
42
- customerPath: parsedArgs.customerPath,
68
+ customerPath,
43
69
  configName: parsedFlags.configName,
44
- pageUrl: parsedArgs.pageUrl,
70
+ pageUrl,
45
71
  variation: parsedFlags.variation,
46
72
  host: parsedFlags.host,
47
73
  bodyFile: parsedFlags.body,
@@ -6,6 +6,11 @@ export declare class OriginRequestServiceFactory {
6
6
  constructor(context: OriginRequestServiceBuildContext);
7
7
  buildService(): Promise<OriginRequestService>;
8
8
  private build;
9
+ /**
10
+ * The runtime config: a local file when one is named, else the app's. Without a customer there is
11
+ * no app, and the request carries Speed Kit's device defaults only.
12
+ */
13
+ private loadRuntimeConfig;
9
14
  private getIntegrationFiles;
10
15
  private getConfigApi;
11
16
  }
@@ -3,7 +3,7 @@ import { IntegrationApiServiceBuildContext, IntegrationApiFactory, } from "../in
3
3
  import { applyOriginProxy } from "../../helpers/origin-proxy.js";
4
4
  import { OriginRequestService } from "./origin-request-service.js";
5
5
  import { OriginFetcher } from "./origin-fetcher.js";
6
- import { RuntimeConfigSource } from "./runtime-config-source.js";
6
+ import { RuntimeConfigSource, } from "./runtime-config-source.js";
7
7
  export class OriginRequestServiceFactory {
8
8
  context;
9
9
  service = undefined;
@@ -18,16 +18,14 @@ export class OriginRequestServiceFactory {
18
18
  }
19
19
  async build() {
20
20
  const cli = this.context.environment.cli;
21
- const files = await this.getIntegrationFiles();
22
- const customer = files.getCustomerConfig().config;
21
+ const customer = this.context.customerPath
22
+ ? (await this.getIntegrationFiles(this.context.customerPath)).getCustomerConfig().config
23
+ : undefined;
23
24
  // `--json` owns stdout, so the proxy line stays out of a machine-readable run.
24
- applyOriginProxy(customer.chromeFlags, this.context.json ? undefined : cli);
25
- const config = await new RuntimeConfigSource({
26
- cli,
27
- configApi: this.getConfigApi(customer.app),
28
- fileFlag: "--variations",
29
- }).load(this.context.variationsFile);
30
- const usable = config && Object.keys(config.variations).length > 0;
25
+ applyOriginProxy(customer?.chromeFlags, this.context.json ? undefined : cli);
26
+ const config = await this.loadRuntimeConfig(customer?.app);
27
+ // Without a customer, an empty set is the point: only the device defaults resolve.
28
+ const usable = config && (!customer || Object.keys(config.variations).length > 0);
31
29
  if (config && !usable) {
32
30
  cli.writeError("the config carries no speedKit.variations — nothing to simulate");
33
31
  }
@@ -40,10 +38,28 @@ export class OriginRequestServiceFactory {
40
38
  })
41
39
  : undefined);
42
40
  }
43
- async getIntegrationFiles() {
41
+ /**
42
+ * The runtime config: a local file when one is named, else the app's. Without a customer there is
43
+ * no app, and the request carries Speed Kit's device defaults only.
44
+ */
45
+ async loadRuntimeConfig(app) {
46
+ const cli = this.context.environment.cli;
47
+ if (!app && !this.context.variationsFile) {
48
+ if (!this.context.json) {
49
+ cli.writeWarning("no customer: the request carries Speed Kit's device defaults only, no variation of an app");
50
+ }
51
+ return { variations: {}, authentications: [] };
52
+ }
53
+ return new RuntimeConfigSource({
54
+ cli,
55
+ configApi: app ? this.getConfigApi(app) : undefined,
56
+ fileFlag: "--variations",
57
+ }).load(this.context.variationsFile);
58
+ }
59
+ async getIntegrationFiles(customerPath) {
44
60
  const integrationApiContext = new IntegrationApiServiceBuildContext({
45
61
  environment: this.context.environment,
46
- basePath: this.context.customerPath,
62
+ basePath: customerPath,
47
63
  configName: this.context.configName,
48
64
  whitelist: [],
49
65
  });
@@ -0,0 +1,32 @@
1
+ import { expect } from "chai";
2
+ import { describe, it } from "mocha";
3
+ import { OriginRequestServiceBuildContext } from "../origin-request-service-build-context.js";
4
+ const environment = {};
5
+ function create(args, flags = {}) {
6
+ return OriginRequestServiceBuildContext.create(args, { configName: "production", json: false, raw: false, ...flags }, environment);
7
+ }
8
+ describe("OriginRequestServiceBuildContext", () => {
9
+ it("takes the customer and the page", () => {
10
+ const context = create({
11
+ customerPath: "customers/shop",
12
+ pageUrl: "https://shop.test/",
13
+ });
14
+ expect(context.customerPath).to.equal("customers/shop");
15
+ expect(context.pageUrl).to.equal("https://shop.test/");
16
+ });
17
+ it("takes a lone url as the page with --raw", () => {
18
+ const context = create({ customerPath: "https://shop.test/" }, { raw: true });
19
+ expect(context.customerPath).to.equal(undefined);
20
+ expect(context.pageUrl).to.equal("https://shop.test/");
21
+ });
22
+ it("keeps the customer with --raw when one is named", () => {
23
+ const context = create({ customerPath: "customers/shop", pageUrl: "https://shop.test/" }, { raw: true });
24
+ expect(context.customerPath).to.equal("customers/shop");
25
+ });
26
+ it("refuses a lone url without --raw", () => {
27
+ expect(() => create({ customerPath: "https://shop.test/" })).to.throw(/no runtime config/);
28
+ });
29
+ it("refuses a run without a page", () => {
30
+ expect(() => create({ customerPath: "customers/shop" })).to.throw(/needs the page/);
31
+ });
32
+ });
@@ -918,21 +918,22 @@
918
918
  "aliases": [],
919
919
  "args": {
920
920
  "customerPath": {
921
- "description": "The customer config path",
921
+ "description": "The customer config path; optional with --raw, which then sends Speed Kit's device defaults",
922
922
  "name": "customerPath",
923
- "required": true
923
+ "required": false
924
924
  },
925
925
  "pageUrl": {
926
926
  "description": "Page to request from origin",
927
927
  "name": "pageUrl",
928
- "required": true
928
+ "required": false
929
929
  }
930
930
  },
931
931
  "description": "Request a page from origin with the exact headers Speed Kit's server sends for a cache variation, using the app's deployed runtime config",
932
932
  "examples": [
933
933
  "$ sk origin-request <customerPath> <pageUrl>",
934
934
  "$ sk origin-request customers/decathlon.de https://www.decathlon.de/ -v mobile",
935
- "$ sk origin-request customers/decathlon.de https://www.decathlon.de/ --grep \"storeId\" --body /tmp/origin.html"
935
+ "$ sk origin-request customers/decathlon.de https://www.decathlon.de/ --grep \"storeId\" --body /tmp/origin.html",
936
+ "$ sk origin-request --raw https://www.decathlon.de/ -v mobile --body /tmp/mobile.html"
936
937
  ],
937
938
  "flags": {
938
939
  "configName": {
@@ -986,6 +987,12 @@
986
987
  "hasDynamicHelp": false,
987
988
  "multiple": false,
988
989
  "type": "option"
990
+ },
991
+ "raw": {
992
+ "description": "Request without a customer: the customer path becomes optional, and the request carries Speed Kit's device defaults (default, mobile, tablet) and no variation of an app",
993
+ "name": "raw",
994
+ "allowNo": false,
995
+ "type": "boolean"
989
996
  }
990
997
  },
991
998
  "hasDynamicHelp": false,
@@ -1920,5 +1927,5 @@
1920
1927
  ]
1921
1928
  }
1922
1929
  },
1923
- "version": "4.44.1"
1930
+ "version": "4.45.0"
1924
1931
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@speedkit/cli",
3
3
  "description": "Speed Kit CLI",
4
- "version": "4.44.1",
4
+ "version": "4.45.0",
5
5
  "author": {
6
6
  "name": "Baqend.com",
7
7
  "email": "info@baqend.com"