@siteoshq/cli 1.8.1 → 1.10.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/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # SiteOS CLI
2
2
 
3
3
  `@siteoshq/cli` exposes one `siteos` binary for Auth, common Projects, Pulse, Cookie, Forms,
4
- Search, Trace, SEO and Integrations. This source prepares version 1.8.1; publishing is a separate release.
4
+ Search, Trace, SEO and Integrations. This source prepares version 1.10.0; publishing is a separate release.
5
5
  Node.js 22 or newer is required.
6
6
 
7
7
  ## Install and authenticate
@@ -96,6 +96,15 @@ the bound Pulse resource and current URL; local tests use this URL unless explic
96
96
  `siteos.config.json` remains the tracked Playwright check configuration. Deployment and enabling
97
97
  monitoring are explicit operations. `deploy --dry-run` builds locally without uploading.
98
98
 
99
+ CLI 1.10.0 adds an optional `environmentVariables` array to each Check, for
100
+ example `"environmentVariables": ["TEST_EMAIL", "TEST_INBOX_TOKEN"]`. Declare names only, and set
101
+ values in Pulse Settings for the selected Environment. The runner exposes declared values through
102
+ `process.env.NAME`; `pulse sync --check --json` suggests names found in imported source, while
103
+ computed names need explicit declarations. `PLAYWRIGHT_BASE_URL` remains a system value.
104
+ Use the CLI build containing this support together with the matching application/runner release;
105
+ earlier published versions do not preserve these declarations. See
106
+ [Pulse variables operations](../../docs/operations/pulse-variables.md) for storage and diagnostics.
107
+
99
108
  ### Forms and Search
100
109
 
101
110
  ```sh
@@ -231,6 +240,12 @@ pnpm --dir packages/cli pack:check
231
240
 
232
241
  ## Cookie verification
233
242
 
243
+ Before a new Cookie connection, `cookie terms show --json` returns the current service terms and
244
+ the selected Organization's acceptance. After the owner or admin explicitly agrees to that
245
+ document, use `cookie terms accept --version <reviewed-version> --confirm --json`, then read the
246
+ status again. Setup and publication requests alone do not constitute agreement. These commands
247
+ are available in CLI 1.9.0 and require the matching application release.
248
+
234
249
  CLI 1.2.0 adds `cookie schema`, `cookie validate --input draft.json`,
235
250
  `cookie regions resolve --country GB --source published` and `cookie restore --input restore.json`.
236
251
  Restore changes the draft only. Validation makes no write and reports a stale draft version.
@@ -298,7 +313,6 @@ A changed field requires a normal build/release, not a second hand-edited valida
298
313
  `forms deployment-key list|revoke` manages release keys; submission keys cannot publish.
299
314
  See the SiteOS Forms skill for the portable generator and version serialization contract.
300
315
 
301
-
302
316
  ## Website Analytics
303
317
 
304
318
  The source CLI includes `siteos analytics` for an explicitly connected Project environment. Check
package/dist/cli.js CHANGED
@@ -1918,6 +1918,26 @@ var ScheduledConfigSchema = z6.object({
1918
1918
  });
1919
1919
  var ManualConfigSchema = z6.object({ mode: z6.literal("manual") });
1920
1920
  var CheckConfigSchema = z6.object({
1921
+ environmentVariables: z6.array(
1922
+ z6.string().regex(/^[A-Z][A-Z0-9_]{0,63}$/).refine(
1923
+ (name) => !/^(?:SITEOS_|PLAYWRIGHT_|DOCKER_|NODE_|NPM_|PNPM_|LD_|DYLD_)/.test(
1924
+ name
1925
+ ) && ![
1926
+ "PATH",
1927
+ "HOME",
1928
+ "TMPDIR",
1929
+ "TMP",
1930
+ "TEMP",
1931
+ "CI",
1932
+ "DATABASE_URL",
1933
+ "RUNNER_SHARED_SECRET"
1934
+ ].includes(name) && !name.endsWith("_DATABASE_URL") && !name.endsWith("_R2_ACCESS_KEY_ID") && !name.endsWith("_R2_SECRET_ACCESS_KEY"),
1935
+ "This name is reserved by Pulse."
1936
+ )
1937
+ ).max(50).refine(
1938
+ (names) => new Set(names).size === names.length,
1939
+ "Variable names must be unique."
1940
+ ).optional(),
1921
1941
  slug,
1922
1942
  name: displayName,
1923
1943
  include: z6.array(safeRelativePath).min(1).max(100),
@@ -6146,7 +6166,7 @@ var BUILTINS = /* @__PURE__ */ new Set([
6146
6166
  ...builtinModules,
6147
6167
  ...builtinModules.map((name) => `node:${name}`)
6148
6168
  ]);
6149
- var ENVIRONMENT_PATTERN = /\bprocess\.env\.([A-Z][A-Z0-9_]*)\b/g;
6169
+ var ENVIRONMENT_PATTERN = /\bprocess\.env(?:\.([A-Z][A-Z0-9_]*)\b|\[\s*["']([A-Z][A-Z0-9_]*)["']\s*\])/g;
6150
6170
  function packageName(importPath) {
6151
6171
  if (importPath.startsWith("@"))
6152
6172
  return importPath.split("/").slice(0, 2).join("/");
@@ -6227,8 +6247,9 @@ async function analyzeTestImports(input) {
6227
6247
  () => ""
6228
6248
  );
6229
6249
  for (const match of source.matchAll(ENVIRONMENT_PATTERN)) {
6230
- if (match[1] && match[1] !== "PLAYWRIGHT_BASE_URL") {
6231
- environmentVariables.add(match[1]);
6250
+ const name = match[1] ?? match[2];
6251
+ if (name && name !== "PLAYWRIGHT_BASE_URL") {
6252
+ environmentVariables.add(name);
6232
6253
  }
6233
6254
  }
6234
6255
  if (/playwright\.config\.[^.]+$/.test(file) && /\bwebServer\s*:/.test(source)) {
@@ -9588,6 +9609,8 @@ var SERVICE_HELP = {
9588
9609
  cookie: `Manage Cookie for the selected SiteOS Project.
9589
9610
 
9590
9611
  Usage:
9612
+ siteos cookie terms show [--json]
9613
+ siteos cookie terms accept --version <reviewed-version> --confirm [--json]
9591
9614
  siteos cookie status [--json]
9592
9615
  siteos cookie installation [--json]
9593
9616
  siteos cookie schema [--json]
@@ -9600,7 +9623,8 @@ Usage:
9600
9623
  siteos cookie publish --input <publication.json> [--json]
9601
9624
  siteos cookie analytics [--range-days <7|30|90>] [--json]
9602
9625
 
9603
- Start with siteos project use, then siteos project connect cookie.
9626
+ Start with siteos project use, then read and explicitly accept Cookie service terms before siteos project connect cookie.
9627
+ Accept only after an organization owner or admin has reviewed and authorized that exact version.
9604
9628
  Draft get returns the complete save payload including expectedDraftVersion.
9605
9629
  Publish input: {"expectedDraftVersion":1,"idempotencyKey":"a-unique-request-key"}.
9606
9630
  Saving a draft has no public effect. Publish activates the reviewed banner at Cookie Edge.`,
@@ -9653,6 +9677,8 @@ async function runServiceCommand(service, options) {
9653
9677
  strict: true,
9654
9678
  options: {
9655
9679
  json: { type: "boolean" },
9680
+ confirm: { type: "boolean" },
9681
+ version: { type: "string" },
9656
9682
  input: { type: "string" },
9657
9683
  environment: { type: "string" },
9658
9684
  "range-days": { type: "string" },
@@ -9683,6 +9709,8 @@ async function runServiceCommand(service, options) {
9683
9709
  const route = positionals.join(" ");
9684
9710
  const allowed = {
9685
9711
  cookie: {
9712
+ "terms show": [],
9713
+ "terms accept": ["version", "confirm"],
9686
9714
  status: [],
9687
9715
  installation: [],
9688
9716
  schema: [],
@@ -9736,8 +9764,15 @@ async function runServiceCommand(service, options) {
9736
9764
  const expectedDraftVersion = tracePublicationVersion(
9737
9765
  values["expected-draft-version"]
9738
9766
  );
9767
+ const isCookieTerms = service === "cookie" && action === "terms";
9768
+ if (isCookieTerms && subaction === "accept" && (!values.version || !values.confirm))
9769
+ throw new Error(
9770
+ "Read siteos cookie terms show, then explicitly pass --version <reviewed-version> --confirm."
9771
+ );
9739
9772
  const runtime = commonProjectRuntime(options);
9740
- const common = service === "integrations" ? null : await commonServiceContext(
9773
+ const common = service === "integrations" ? null : isCookieTerms ? await readCommonProject(options).then(
9774
+ (context) => context ? { ...context, resourceId: "" } : null
9775
+ ) : await commonServiceContext(
9741
9776
  options,
9742
9777
  service,
9743
9778
  values.environment
@@ -9798,7 +9833,12 @@ async function runServiceCommand(service, options) {
9798
9833
  const site = common ? `/sites/${encodeURIComponent(common.resourceId)}` : "";
9799
9834
  let result;
9800
9835
  if (service === "cookie") {
9801
- if (action === "status" && positionals.length === 1)
9836
+ if (isCookieTerms)
9837
+ result = subaction === "show" ? await request("/terms") : await request("/terms", "POST", {
9838
+ version: values.version,
9839
+ accepted: true
9840
+ });
9841
+ else if (action === "status" && positionals.length === 1)
9802
9842
  result = await request(site);
9803
9843
  else if (action === "schema") result = await request(`${site}/schema`);
9804
9844
  else if (action === "validate") {