From 8293ede6b3c3afe2840df6de5ade8b257ed11375 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 24 Nov 2026 22:27:42 +0000 Subject: [PATCH 1/2] chore: update OpenAPI to 10837344ff6c --- .changeset/update-openapi-10837344ff6c.md | 6 + packages/cli/package.json | 2 +- .../commands/_generated/_meta/commands.json | 301 ++++++++---------- .../commands/_generated/_meta/schemas.json | 183 +++++------ .../threat-signals/articles/list.ts | 1 + .../d1/insights/recommendations.ts | 10 + .../_operations/d1/insights/settings/get.ts | 8 + .../insights/settings}/update.ts | 4 +- .../_generated/_operations/d1/list.ts | 3 +- .../zero-trust/risk-scoring/behaviours/get.ts | 8 - .../zero-trust/risk-scoring/get.ts | 8 - .../zero-trust/risk-scoring/reset.ts | 8 - .../zero-trust/risk-scoring/summary/get.ts | 8 - .../threat-signals/articles/list.ts | 25 +- .../cloudforce-one/threat-signals/search.ts | 3 +- .../commands/_generated/d1/insights/index.ts | 4 + .../_generated/d1/insights/recommendations.ts | 92 ++++++ .../summary => d1/insights/settings}/get.ts | 14 +- .../insights/settings}/index.ts | 9 +- .../insights/settings}/update.ts | 61 ++-- .../cli/src/commands/_generated/d1/list.ts | 20 ++ .../zero-trust/risk-scoring/behaviours/get.ts | 71 ----- .../_generated/zero-trust/risk-scoring/get.ts | 79 ----- .../zero-trust/risk-scoring/index.ts | 10 +- .../zero-trust/risk-scoring/reset.ts | 96 ------ .../zero-trust/risk-scoring/summary/index.ts | 20 -- 26 files changed, 430 insertions(+), 624 deletions(-) create mode 100644 .changeset/update-openapi-10837344ff6c.md create mode 100644 packages/cli/src/commands/_generated/_operations/d1/insights/recommendations.ts create mode 100644 packages/cli/src/commands/_generated/_operations/d1/insights/settings/get.ts rename packages/cli/src/commands/_generated/_operations/{zero-trust/risk-scoring/behaviours => d1/insights/settings}/update.ts (50%) delete mode 100644 packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/behaviours/get.ts delete mode 100644 packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/get.ts delete mode 100644 packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/reset.ts delete mode 100644 packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/summary/get.ts create mode 100644 packages/cli/src/commands/_generated/d1/insights/recommendations.ts rename packages/cli/src/commands/_generated/{zero-trust/risk-scoring/summary => d1/insights/settings}/get.ts (69%) rename packages/cli/src/commands/_generated/{zero-trust/risk-scoring/behaviours => d1/insights/settings}/index.ts (68%) rename packages/cli/src/commands/_generated/{zero-trust/risk-scoring/behaviours => d1/insights/settings}/update.ts (61%) delete mode 100644 packages/cli/src/commands/_generated/zero-trust/risk-scoring/behaviours/get.ts delete mode 100644 packages/cli/src/commands/_generated/zero-trust/risk-scoring/get.ts delete mode 100644 packages/cli/src/commands/_generated/zero-trust/risk-scoring/reset.ts delete mode 100644 packages/cli/src/commands/_generated/zero-trust/risk-scoring/summary/index.ts diff --git a/.changeset/update-openapi-10837344ff6c.md b/.changeset/update-openapi-10837344ff6c.md new file mode 100644 index 0000000000..0dc71260b4 --- /dev/null +++ b/.changeset/update-openapi-10837344ff6c.md @@ -0,0 +1,6 @@ +--- +"cf": minor +--- + +Update the generated command surface for Cloudflare API schemas revision +`10837344ff6c5abd1d5602f1aeebe82ef353fa32`. diff --git a/packages/cli/package.json b/packages/cli/package.json index 803d711b91..642a8ecfad 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -113,7 +113,7 @@ "yargs": "18.2.0" }, "config": { - "openApiVersion": "3359e90fa19e8e250ab5a402b0f9dbe65bbe82a3" + "openApiVersion": "10837344ff6c5abd1d5602f1aeebe82ef353fa32" }, "engines": { "node": "^22.23.0 || ^24.22.0 || ^26.12.0" diff --git a/packages/cli/src/commands/_generated/_meta/commands.json b/packages/cli/src/commands/_generated/_meta/commands.json index 4110739647..8c3f5a4c8e 100644 --- a/packages/cli/src/commands/_generated/_meta/commands.json +++ b/packages/cli/src/commands/_generated/_meta/commands.json @@ -40891,7 +40891,7 @@ "name": "feed-id", "type": "string", "required": false, - "description": "Feed UUID filter. Omit to include articles from every account feed." + "description": "Repeatable feed UUID filter. An article matches any selected feed. Omit to include articles from every account feed." }, { "name": "article-id", @@ -40969,7 +40969,23 @@ "name": "feed-category", "type": "string", "required": false, - "description": "Exact feed-category filter after trimming. Omit to include every category." + "description": "Exact match on a feed's legacy free-form category after trimming. Omit to include every category; to filter by the categories shown on feeds, use feed_category_id." + }, + { + "name": "feed-category-id", + "type": "string", + "required": false, + "description": "Repeatable feed category UUID filter, using the ids from the feed categories list. An article matches when its feed has any selected category; feeds without a category never match.", + "enum": [ + "b12a0fd6-f7b9-5393-9ef3-f888d506c550", + "d5b70eaa-626f-5761-b55b-6d9590df49fb", + "3b572d2b-890d-5286-9433-f18c85079030", + "17f90d3b-37d3-5241-8ad4-7d6abbc2006c", + "c68f28e9-7e8f-5d4b-853b-f3076893a9ee", + "bb0e4a94-38ab-5c14-80a7-28cee9f4b139", + "b1ef66d9-a73c-58dc-b269-22d34dfd11f4", + "ab02a976-0a20-5c76-a553-7f6325afacfe" + ] }, { "name": "source-type", @@ -41938,7 +41954,7 @@ "name": "feed-id", "type": "string", "required": false, - "description": "Optional feed UUID that restricts results to articles from that feed." + "description": "Optional repeatable feed UUID filter, up to 40 feeds. Results come only from articles in the selected feeds." }, { "name": "dry-run", @@ -46119,6 +46135,108 @@ "operationId": "d1.insights.queries", "hideCommand": false }, + { + "command": "cf d1 insights recommendations", + "name": "recommendations", + "fullPath": ["d1", "insights", "recommendations"], + "description": "List index recommendations for the databases in your account, or for the databases in `database_id`, from highest to lowest estimated impact. D1 generates recommendations in the background from recent query usage. Each run replaces the recommendations of the databases it analyzed. Recommendations that are not refreshed expire after 7 days. Not every database has recommendations. Recommendations are only generated and returned while `ai_enabled` is true in the account's D1 Insights settings. When it is false, the response is an empty list. To check or change the setting, use `GET` or `PUT /accounts/{account_id}/d1/insights/settings`.", + "summary": "List D1 Index Recommendations", + "usage": "cf d1 insights recommendations [options]", + "arguments": [], + "options": [ + { + "name": "database-id", + "type": "string", + "required": false, + "description": "Only return recommendations for these databases, at most 50. Pass a comma-separated list or repeat the parameter. Defaults to all databases in the account. A database that is not in the account returns no recommendations." + }, + { + "name": "limit", + "type": "number", + "required": false, + "description": "Maximum number of recommendations to return in a page." + }, + { + "name": "cursor", + "type": "string", + "required": false, + "description": "`result_info.next_cursor` from the previous page. Pass the same `database_id` values as that request, or the request will fail." + }, + { + "name": "dry-run", + "type": "boolean", + "required": false, + "description": "Validate and show what would happen without executing", + "default": false + } + ], + "category": "action", + "hasRequestBody": false, + "httpMethod": "GET", + "apiPath": "/accounts/{account_id}/d1/insights/recommendations", + "operationId": "d1.insights.recommendations", + "hideCommand": false + }, + { + "command": "cf d1 insights settings get", + "name": "get", + "fullPath": ["d1", "insights", "settings", "get"], + "description": "Get whether D1 Insights uses AI on this account's query data. While `ai_enabled` is true, D1 sends the account's query statements, query usage and database schemas to Workers AI to generate index recommendations, and `GET /accounts/{account_id}/d1/insights/recommendations` returns them. Until the account changes the setting with `PUT`, the default depends on the account's plan. Requires the Account Settings Read permission.", + "summary": "Get D1 Insights Settings", + "usage": "cf d1 insights settings get", + "arguments": [], + "options": [ + { + "name": "dry-run", + "type": "boolean", + "required": false, + "description": "Validate and show what would happen without executing", + "default": false + } + ], + "category": "read", + "hasRequestBody": false, + "httpMethod": "GET", + "apiPath": "/accounts/{account_id}/d1/insights/settings", + "operationId": "d1.insights.settings.get", + "hideCommand": false + }, + { + "command": "cf d1 insights settings update", + "name": "update", + "fullPath": ["d1", "insights", "settings", "update"], + "description": "Turn AI use for D1 Insights on or off for every database in this account. When you turn it off, D1 stops generating index recommendations for the account and `GET /accounts/{account_id}/d1/insights/recommendations` returns an empty list. Existing recommendations are not deleted. They expire 7 days after they were generated, so any that have not expired are returned again if you turn it back on. Requires the Account Settings Write permission.", + "summary": "Update D1 Insights Settings", + "usage": "cf d1 insights settings update [options]", + "arguments": [], + "options": [ + { + "name": "ai-enabled", + "type": "boolean", + "required": true, + "description": "Whether D1 Insights uses AI on this account's query data." + }, + { + "name": "dry-run", + "type": "boolean", + "required": false, + "description": "Validate and show what would happen without executing", + "default": false + }, + { + "name": "body", + "type": "string", + "required": false, + "description": "Raw JSON request body (bypasses individual flags)" + } + ], + "category": "update", + "hasRequestBody": true, + "httpMethod": "PUT", + "apiPath": "/accounts/{account_id}/d1/insights/settings", + "operationId": "d1.insights.settings.update", + "hideCommand": false + }, { "command": "cf d1 list", "name": "list", @@ -46146,6 +46264,22 @@ "required": false, "description": "Number of items per page." }, + { + "name": "fields", + "type": "string", + "required": false, + "description": "Comma-separated list of fields to include for each database. When omitted, every field except `recommendation_count` is returned.", + "enum": [ + "uuid", + "name", + "created_at", + "version", + "jurisdiction", + "num_tables", + "file_size", + "recommendation_count" + ] + }, { "name": "dry-run", "type": "boolean", @@ -169988,98 +170122,6 @@ "operationId": "zero-trust.regions.list", "hideCommand": false }, - { - "command": "cf zero-trust risk-scoring behaviours get", - "name": "get", - "fullPath": ["zero-trust", "risk-scoring", "behaviours", "get"], - "description": "Retrieves configured risk score behaviors that define how user actions affect their overall risk score.", - "summary": "Get all behaviors and associated configuration", - "usage": "cf zero-trust risk-scoring behaviours get", - "arguments": [], - "options": [ - { - "name": "dry-run", - "type": "boolean", - "required": false, - "description": "Validate and show what would happen without executing", - "default": false - } - ], - "category": "read", - "hasRequestBody": false, - "httpMethod": "GET", - "apiPath": "/accounts/{account_id}/zt_risk_scoring/behaviors", - "operationId": "zero-trust.risk-scoring.behaviours.get", - "hideCommand": false - }, - { - "command": "cf zero-trust risk-scoring behaviours update", - "name": "update", - "fullPath": ["zero-trust", "risk-scoring", "behaviours", "update"], - "description": "Updates risk score behavior configurations, defining weights and thresholds for risk calculation.", - "summary": "Update configuration for risk behaviors", - "usage": "cf zero-trust risk-scoring behaviours update [options]", - "arguments": [], - "options": [ - { - "name": "behaviors", - "type": "string", - "required": true, - "description": "The behaviors field. Provide as a JSON object or @path/to/file.json. Shape: {\"\": {...}}." - }, - { - "name": "dry-run", - "type": "boolean", - "required": false, - "description": "Validate and show what would happen without executing", - "default": false - }, - { - "name": "body", - "type": "string", - "required": false, - "description": "Raw JSON request body (bypasses individual flags)" - } - ], - "category": "update", - "hasRequestBody": true, - "httpMethod": "PUT", - "apiPath": "/accounts/{account_id}/zt_risk_scoring/behaviors", - "operationId": "zero-trust.risk-scoring.behaviours.update", - "hideCommand": false - }, - { - "command": "cf zero-trust risk-scoring get", - "name": "get", - "fullPath": ["zero-trust", "risk-scoring", "get"], - "description": "Retrieves the detailed risk score breakdown for a specific user, including contributing factors.", - "summary": "Get risk event/score information for a specific user", - "usage": "cf zero-trust risk-scoring get ", - "arguments": [ - { - "name": "user-id", - "position": 0, - "type": "string", - "required": true, - "description": "User ID" - } - ], - "options": [ - { - "name": "dry-run", - "type": "boolean", - "required": false, - "description": "Validate and show what would happen without executing", - "default": false - } - ], - "category": "read", - "hasRequestBody": false, - "httpMethod": "GET", - "apiPath": "/accounts/{account_id}/zt_risk_scoring/{user_id}", - "operationId": "zero-trust.risk-scoring.get", - "hideCommand": false - }, { "command": "cf zero-trust risk-scoring integrations create", "name": "create", @@ -170319,70 +170361,6 @@ "operationId": "zero-trust.risk-scoring.integrations.update", "hideCommand": false }, - { - "command": "cf zero-trust risk-scoring reset", - "name": "reset", - "fullPath": ["zero-trust", "risk-scoring", "reset"], - "description": "Resets risk scores for specified users, clearing their accumulated risk history.", - "summary": "Clear the risk score for a particular user", - "usage": "cf zero-trust risk-scoring reset ", - "arguments": [ - { - "name": "user-id", - "position": 0, - "type": "string", - "required": true, - "description": "User ID" - } - ], - "options": [ - { - "name": "dry-run", - "type": "boolean", - "required": false, - "description": "Validate and show what would happen without executing", - "default": false - }, - { - "name": "force", - "type": "boolean", - "alias": "f", - "required": false, - "description": "Skip confirmation (useful in scripts and CI)", - "default": false - } - ], - "category": "action", - "hasRequestBody": false, - "httpMethod": "POST", - "apiPath": "/accounts/{account_id}/zt_risk_scoring/{user_id}/reset", - "operationId": "zero-trust.risk-scoring.reset", - "hideCommand": false - }, - { - "command": "cf zero-trust risk-scoring summary get", - "name": "get", - "fullPath": ["zero-trust", "risk-scoring", "summary", "get"], - "description": "Gets an aggregate summary of risk scores across the account, including distribution and trends.", - "summary": "Get risk score info for all users in the account", - "usage": "cf zero-trust risk-scoring summary get", - "arguments": [], - "options": [ - { - "name": "dry-run", - "type": "boolean", - "required": false, - "description": "Validate and show what would happen without executing", - "default": false - } - ], - "category": "read", - "hasRequestBody": false, - "httpMethod": "GET", - "apiPath": "/accounts/{account_id}/zt_risk_scoring/summary", - "operationId": "zero-trust.risk-scoring.summary.get", - "hideCommand": false - }, { "command": "cf zero-trust users mfa authenticators delete", "name": "delete", @@ -172828,6 +172806,7 @@ "custom-pages account-custom-pages preview-tokens": "Preview tokens for account-level custom pages", "d1": "D1 is Cloudflare's managed, serverless database with SQLite's SQL semantics, built-in disaster recovery, and Worker and HTTP API access.", "d1 insights": "show usage insights for the D1 databases in your account", + "d1 insights settings": "turn AI-generated D1 Insights on or off for your account", "d1 time-travel": "use specific point-in-time backups of your D1 database", "d1 migrations": "Create, list, and apply D1 database migrations", "diagnostics": "Network diagnostic tools — traceroutes from Cloudflare's edge and endpoint health checks", @@ -173674,11 +173653,9 @@ "zero-trust organization trust-settings": "Operations for organization.trust-settings", "zero-trust region": "Operations for region", "zero-trust regions": "Operations for regions", - "zero-trust risk-scoring": "User Risk Scoring - retrieve and reset user risk scores", - "zero-trust risk-scoring behaviours": "User Risk Scoring - manage behaviors used to calculate user risk scores", + "zero-trust risk-scoring": "Operations for risk-scoring", "zero-trust risk-scoring integrations": "User Risk Scoring - manage integrations that provide risk score signals", "zero-trust risk-scoring integrations references": "User Risk Scoring - retrieve integrations by external reference", - "zero-trust risk-scoring summary": "User Risk Scoring - retrieve account risk score summaries", "zero-trust users": "Operations for users", "zero-trust users mfa": "Operations for users.mfa", "zero-trust users mfa authenticators": "Operations for users.mfa.authenticators", diff --git a/packages/cli/src/commands/_generated/_meta/schemas.json b/packages/cli/src/commands/_generated/_meta/schemas.json index 16ce972b34..88e5ccbce6 100644 --- a/packages/cli/src/commands/_generated/_meta/schemas.json +++ b/packages/cli/src/commands/_generated/_meta/schemas.json @@ -30120,7 +30120,7 @@ { "name": "feed_id", "flag": "feed-id", - "type": "string", + "type": "array", "required": false }, { @@ -30201,6 +30201,12 @@ "type": "string", "required": false }, + { + "name": "feed_category_id", + "flag": "feed-category-id", + "type": "array", + "required": false + }, { "name": "source_type", "flag": "source-type", @@ -30859,7 +30865,7 @@ { "name": "feed_id", "flag": "feed-id", - "type": "string", + "type": "array", "required": false } ], @@ -33789,6 +33795,77 @@ "hasRequestBody": false, "requestBodyFields": [] }, + "d1 insights recommendations": { + "operationId": "d1.insights.recommendations", + "httpMethod": "GET", + "path": "/accounts/{account_id}/d1/insights/recommendations", + "pathParams": [ + { + "name": "account_id", + "type": "string", + "required": true + } + ], + "queryParams": [ + { + "name": "database_id", + "flag": "database-id", + "type": "array", + "required": false + }, + { + "name": "limit", + "flag": "limit", + "type": "number", + "required": false + }, + { + "name": "cursor", + "flag": "cursor", + "type": "string", + "required": false + } + ], + "hasRequestBody": false, + "requestBodyFields": [] + }, + "d1 insights settings get": { + "operationId": "d1.insights.settings.get", + "httpMethod": "GET", + "path": "/accounts/{account_id}/d1/insights/settings", + "pathParams": [ + { + "name": "account_id", + "type": "string", + "required": true + } + ], + "queryParams": [], + "hasRequestBody": false, + "requestBodyFields": [] + }, + "d1 insights settings update": { + "operationId": "d1.insights.settings.update", + "httpMethod": "PUT", + "path": "/accounts/{account_id}/d1/insights/settings", + "pathParams": [ + { + "name": "account_id", + "type": "string", + "required": true + } + ], + "queryParams": [], + "hasRequestBody": true, + "requestBodyFields": [ + { + "name": "ai-enabled", + "type": "boolean", + "required": true, + "description": "Whether D1 Insights uses AI on this account's query data." + } + ] + }, "d1 list": { "operationId": "d1.list", "httpMethod": "GET", @@ -33818,6 +33895,12 @@ "flag": "per-page", "type": "number", "required": false + }, + { + "name": "fields", + "flag": "fields", + "type": "array", + "required": false } ], "hasRequestBody": false, @@ -122494,65 +122577,6 @@ "hasRequestBody": false, "requestBodyFields": [] }, - "zero-trust risk-scoring behaviours get": { - "operationId": "zero-trust.risk-scoring.behaviours.get", - "httpMethod": "GET", - "path": "/accounts/{account_id}/zt_risk_scoring/behaviors", - "pathParams": [ - { - "name": "account_id", - "type": "string", - "required": true - } - ], - "queryParams": [], - "hasRequestBody": false, - "requestBodyFields": [] - }, - "zero-trust risk-scoring behaviours update": { - "operationId": "zero-trust.risk-scoring.behaviours.update", - "httpMethod": "PUT", - "path": "/accounts/{account_id}/zt_risk_scoring/behaviors", - "pathParams": [ - { - "name": "account_id", - "type": "string", - "required": true - } - ], - "queryParams": [], - "hasRequestBody": true, - "requestBodyFields": [ - { - "name": "behaviors", - "type": "string", - "required": true, - "description": "The behaviors field. Provide as a JSON object or @path/to/file.json. Shape: {\"\": {...}}." - } - ] - }, - "zero-trust risk-scoring get": { - "operationId": "zero-trust.risk-scoring.get", - "httpMethod": "GET", - "path": "/accounts/{account_id}/zt_risk_scoring/{user_id}", - "pathParams": [ - { - "name": "account_id", - "type": "string", - "required": true - }, - { - "name": "user_id", - "flag": "user-id", - "positional": true, - "type": "string", - "required": true - } - ], - "queryParams": [], - "hasRequestBody": false, - "requestBodyFields": [] - }, "zero-trust risk-scoring integrations create": { "operationId": "zero-trust.risk-scoring.integrations.create", "httpMethod": "POST", @@ -122709,43 +122733,6 @@ } ] }, - "zero-trust risk-scoring reset": { - "operationId": "zero-trust.risk-scoring.reset", - "httpMethod": "POST", - "path": "/accounts/{account_id}/zt_risk_scoring/{user_id}/reset", - "pathParams": [ - { - "name": "account_id", - "type": "string", - "required": true - }, - { - "name": "user_id", - "flag": "user-id", - "positional": true, - "type": "string", - "required": true - } - ], - "queryParams": [], - "hasRequestBody": false, - "requestBodyFields": [] - }, - "zero-trust risk-scoring summary get": { - "operationId": "zero-trust.risk-scoring.summary.get", - "httpMethod": "GET", - "path": "/accounts/{account_id}/zt_risk_scoring/summary", - "pathParams": [ - { - "name": "account_id", - "type": "string", - "required": true - } - ], - "queryParams": [], - "hasRequestBody": false, - "requestBodyFields": [] - }, "zero-trust users mfa authenticators delete": { "operationId": "zero-trust.users.mfa.authenticators.delete", "httpMethod": "DELETE", diff --git a/packages/cli/src/commands/_generated/_operations/cloudforce-one/threat-signals/articles/list.ts b/packages/cli/src/commands/_generated/_operations/cloudforce-one/threat-signals/articles/list.ts index 89c01ed272..2944ed0721 100644 --- a/packages/cli/src/commands/_generated/_operations/cloudforce-one/threat-signals/articles/list.ts +++ b/packages/cli/src/commands/_generated/_operations/cloudforce-one/threat-signals/articles/list.ts @@ -22,6 +22,7 @@ export default { "fetched_after", "fetched_before", "feed_category", + "feed_category_id", "source_type", "tag_applied_by", "pir_id", diff --git a/packages/cli/src/commands/_generated/_operations/d1/insights/recommendations.ts b/packages/cli/src/commands/_generated/_operations/d1/insights/recommendations.ts new file mode 100644 index 0000000000..6efa174de6 --- /dev/null +++ b/packages/cli/src/commands/_generated/_operations/d1/insights/recommendations.ts @@ -0,0 +1,10 @@ +/** @generated from d1.insights.recommendations */ +import { path } from "#api"; + +export default { + method: "GET", + path: (request: Record) => + path`/accounts/${request.account_id}/d1/insights/recommendations`, + query: ["database_id", "limit", "cursor"], + joined: ["database_id"], +} as const; diff --git a/packages/cli/src/commands/_generated/_operations/d1/insights/settings/get.ts b/packages/cli/src/commands/_generated/_operations/d1/insights/settings/get.ts new file mode 100644 index 0000000000..091d8bedcd --- /dev/null +++ b/packages/cli/src/commands/_generated/_operations/d1/insights/settings/get.ts @@ -0,0 +1,8 @@ +/** @generated from d1.insights.settings.get */ +import { path } from "#api"; + +export default { + method: "GET", + path: (request: Record) => + path`/accounts/${request.account_id}/d1/insights/settings`, +} as const; diff --git a/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/behaviours/update.ts b/packages/cli/src/commands/_generated/_operations/d1/insights/settings/update.ts similarity index 50% rename from packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/behaviours/update.ts rename to packages/cli/src/commands/_generated/_operations/d1/insights/settings/update.ts index 70e8674b36..72605a6578 100644 --- a/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/behaviours/update.ts +++ b/packages/cli/src/commands/_generated/_operations/d1/insights/settings/update.ts @@ -1,9 +1,9 @@ -/** @generated from zero-trust.risk-scoring.behaviours.update */ +/** @generated from d1.insights.settings.update */ import { path } from "#api"; export default { method: "PUT", path: (request: Record) => - path`/accounts/${request.account_id}/zt_risk_scoring/behaviors`, + path`/accounts/${request.account_id}/d1/insights/settings`, body: "json", } as const; diff --git a/packages/cli/src/commands/_generated/_operations/d1/list.ts b/packages/cli/src/commands/_generated/_operations/d1/list.ts index bd3e6a30bc..1a841603d2 100644 --- a/packages/cli/src/commands/_generated/_operations/d1/list.ts +++ b/packages/cli/src/commands/_generated/_operations/d1/list.ts @@ -5,5 +5,6 @@ export default { method: "GET", path: (request: Record) => path`/accounts/${request.account_id}/d1/database`, - query: ["name", "page", "per_page"], + query: ["name", "page", "per_page", "fields"], + joined: ["fields"], } as const; diff --git a/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/behaviours/get.ts b/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/behaviours/get.ts deleted file mode 100644 index b4a32381da..0000000000 --- a/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/behaviours/get.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** @generated from zero-trust.risk-scoring.behaviours.get */ -import { path } from "#api"; - -export default { - method: "GET", - path: (request: Record) => - path`/accounts/${request.account_id}/zt_risk_scoring/behaviors`, -} as const; diff --git a/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/get.ts b/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/get.ts deleted file mode 100644 index 48d2a35499..0000000000 --- a/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/get.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** @generated from zero-trust.risk-scoring.get */ -import { path } from "#api"; - -export default { - method: "GET", - path: (request: Record) => - path`/accounts/${request.account_id}/zt_risk_scoring/${request.user_id}`, -} as const; diff --git a/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/reset.ts b/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/reset.ts deleted file mode 100644 index 50ad7abd1b..0000000000 --- a/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/reset.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** @generated from zero-trust.risk-scoring.reset */ -import { path } from "#api"; - -export default { - method: "POST", - path: (request: Record) => - path`/accounts/${request.account_id}/zt_risk_scoring/${request.user_id}/reset`, -} as const; diff --git a/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/summary/get.ts b/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/summary/get.ts deleted file mode 100644 index 2925d63a4b..0000000000 --- a/packages/cli/src/commands/_generated/_operations/zero-trust/risk-scoring/summary/get.ts +++ /dev/null @@ -1,8 +0,0 @@ -/** @generated from zero-trust.risk-scoring.summary.get */ -import { path } from "#api"; - -export default { - method: "GET", - path: (request: Record) => - path`/accounts/${request.account_id}/zt_risk_scoring/summary`, -} as const; diff --git a/packages/cli/src/commands/_generated/cloudforce-one/threat-signals/articles/list.ts b/packages/cli/src/commands/_generated/cloudforce-one/threat-signals/articles/list.ts index 883a86c8b9..c4128a7fb1 100644 --- a/packages/cli/src/commands/_generated/cloudforce-one/threat-signals/articles/list.ts +++ b/packages/cli/src/commands/_generated/cloudforce-one/threat-signals/articles/list.ts @@ -34,8 +34,9 @@ function builder(yargs: Argv) { }) .option("feed-id", { type: "string", + array: true, description: - "Feed UUID filter. Omit to include articles from every account feed.", + "Repeatable feed UUID filter. An article matches any selected feed. Omit to include articles from every account feed.", }) .option("article-id", { type: "string", @@ -103,8 +104,27 @@ function builder(yargs: Argv) { .option("feed-category", { type: "string", description: - "Exact feed-category filter after trimming. Omit to include every category.", + "Exact match on a feed's legacy free-form category after trimming. Omit to include every category; to filter by the categories shown on feeds, use feed_category_id.", }) + .option("feed-category-id", { + type: "string", + array: true, + description: + "Repeatable feed category UUID filter, using the ids from the feed categories list. An article matches when its feed has any selected category; feeds without a category never match.", + choices: [ + "b12a0fd6-f7b9-5393-9ef3-f888d506c550", + "d5b70eaa-626f-5761-b55b-6d9590df49fb", + "3b572d2b-890d-5286-9433-f18c85079030", + "17f90d3b-37d3-5241-8ad4-7d6abbc2006c", + "c68f28e9-7e8f-5d4b-853b-f3076893a9ee", + "bb0e4a94-38ab-5c14-80a7-28cee9f4b139", + "b1ef66d9-a73c-58dc-b269-22d34dfd11f4", + "ab02a976-0a20-5c76-a553-7f6325afacfe", + ], + }) + .coerce("feed-category-id", (values: string[]) => + values.flatMap((value) => value.split(",")) + ) .option("source-type", { type: "string", description: @@ -190,6 +210,7 @@ const command: CommandModule = { fetched_after: argv["fetched-after"], fetched_before: argv["fetched-before"], feed_category: argv["feed-category"], + feed_category_id: argv["feed-category-id"], source_type: argv["source-type"], tag_applied_by: argv["tag-applied-by"], pir_id: argv["pir-id"], diff --git a/packages/cli/src/commands/_generated/cloudforce-one/threat-signals/search.ts b/packages/cli/src/commands/_generated/cloudforce-one/threat-signals/search.ts index 6557ae0e4c..be512f8d34 100644 --- a/packages/cli/src/commands/_generated/cloudforce-one/threat-signals/search.ts +++ b/packages/cli/src/commands/_generated/cloudforce-one/threat-signals/search.ts @@ -35,8 +35,9 @@ function builder(yargs: Argv) { }) .option("feed-id", { type: "string", + array: true, description: - "Optional feed UUID that restricts results to articles from that feed.", + "Optional repeatable feed UUID filter, up to 40 feeds. Results come only from articles in the selected feeds.", }) .option("dry-run", { type: "boolean", diff --git a/packages/cli/src/commands/_generated/d1/insights/index.ts b/packages/cli/src/commands/_generated/d1/insights/index.ts index e5e1d7db6c..627e5f44a7 100644 --- a/packages/cli/src/commands/_generated/d1/insights/index.ts +++ b/packages/cli/src/commands/_generated/d1/insights/index.ts @@ -1,5 +1,7 @@ import $databases from "./databases.js"; import $queries from "./queries.js"; +import $recommendations from "./recommendations.js"; +import $settings from "./settings/index.js"; import type { CommonYargsOptions } from "#lib/cli-types.js"; /** * insights command group @@ -15,6 +17,8 @@ const command: CommandModule = { return yargs .command($databases) .command($queries) + .command($recommendations) + .command($settings) .demandCommand(1, "Please specify a subcommand"); }, diff --git a/packages/cli/src/commands/_generated/d1/insights/recommendations.ts b/packages/cli/src/commands/_generated/d1/insights/recommendations.ts new file mode 100644 index 0000000000..101468d00e --- /dev/null +++ b/packages/cli/src/commands/_generated/d1/insights/recommendations.ts @@ -0,0 +1,92 @@ +import operation from "../../_operations/d1/insights/recommendations.js"; +import type { CommonYargsOptions, InferArgs } from "#lib/cli-types.js"; +import type { ArgClassification } from "#lib/telemetry/index.js"; +/** + * recommendations command + * @generated from apis/overlays/d1.ts + */ +import type { Argv, CommandModule } from "yargs"; +import { + createCommandClient, + getAccountId, + resolveAccountIdSilent, +} from "#lib/auth.js"; +import { formatDryRun } from "#lib/dry-run.js"; +import { LOCAL_ACCOUNT_ID } from "#lib/local.js"; +import { formatOutput } from "#lib/output.js"; +import { withProgress } from "#lib/progress.js"; +import { runWithTelemetry } from "#lib/telemetry/index.js"; + +function builder(yargs: Argv) { + return yargs + .usage( + "$0 d1 insights recommendations\n\nList index recommendations for the databases in your account, or for the databases in `database_id`, from highest to lowest estimated impact. D1 generates recommendations in the background from recent query usage. Each run replaces the recommendations of the databases it analyzed. Recommendations that are not refreshed expire after 7 days. Not every database has recommendations. Recommendations are only generated and returned while `ai_enabled` is true in the account's D1 Insights settings. When it is false, the response is an empty list. To check or change the setting, use `GET` or `PUT /accounts/{account_id}/d1/insights/settings`." + ) + .option("database-id", { + type: "string", + array: true, + description: + "Only return recommendations for these databases, at most 50. Pass a comma-separated list or repeat the parameter. Defaults to all databases in the account. A database that is not in the account returns no recommendations.", + }) + .option("limit", { + type: "number", + description: "Maximum number of recommendations to return in a page.", + }) + .option("cursor", { + type: "string", + description: + "`result_info.next_cursor` from the previous page. Pass the same `database_id` values as that request, or the request will fail.", + }) + .option("dry-run", { + type: "boolean", + description: "Validate and show what would happen without executing", + default: false, + }); +} + +type Args = InferArgs; + +const command: CommandModule = { + command: "recommendations", + describe: "List D1 Index Recommendations", + builder, + handler: async (argv): Promise => + runWithTelemetry( + { + command: "d1 insights recommendations", + classification: { + safeFlags: ["dry-run"], + } satisfies ArgClassification, + }, + argv as Record, + async () => { + const queryParams: Record = { + database_id: argv["database-id"], + limit: argv["limit"], + cursor: argv["cursor"], + }; + if (argv.dryRun) { + const __cfDryRunAccountId = await resolveAccountIdSilent(); + formatDryRun({ + command: "cf d1 insights recommendations", + method: "GET", + url: `https://api.cloudflare.com/client/v4/accounts/${__cfDryRunAccountId ?? ""}/d1/insights/recommendations`, + pathParams: {}, + query: queryParams, + bodyKind: "none", + }); + return; + } + const client = await createCommandClient(argv); + const accountId = argv.local ? LOCAL_ACCOUNT_ID : await getAccountId(); + argv.accountId = accountId; + + const result = await withProgress(`Loading`, async () => + client.send(operation, { account_id: accountId, ...queryParams }) + ); + formatOutput(result, { successLabel: `Loaded` }); + } + ), +}; + +export default command; diff --git a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/summary/get.ts b/packages/cli/src/commands/_generated/d1/insights/settings/get.ts similarity index 69% rename from packages/cli/src/commands/_generated/zero-trust/risk-scoring/summary/get.ts rename to packages/cli/src/commands/_generated/d1/insights/settings/get.ts index f5e3814328..01983a12d8 100644 --- a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/summary/get.ts +++ b/packages/cli/src/commands/_generated/d1/insights/settings/get.ts @@ -1,9 +1,9 @@ -import operation from "../../../_operations/zero-trust/risk-scoring/summary/get.js"; +import operation from "../../../_operations/d1/insights/settings/get.js"; import type { CommonYargsOptions, InferArgs } from "#lib/cli-types.js"; import type { ArgClassification } from "#lib/telemetry/index.js"; /** * get command - * @generated from apis/overlays/zero-trust.ts + * @generated from apis/overlays/d1.ts */ import type { Argv, CommandModule } from "yargs"; import { @@ -20,7 +20,7 @@ import { runWithTelemetry } from "#lib/telemetry/index.js"; function builder(yargs: Argv) { return yargs .usage( - "$0 zero-trust risk-scoring summary get\n\nGets an aggregate summary of risk scores across the account, including distribution and trends." + "$0 d1 insights settings get\n\nGet whether D1 Insights uses AI on this account's query data. While `ai_enabled` is true, D1 sends the account's query statements, query usage and database schemas to Workers AI to generate index recommendations, and `GET /accounts/{account_id}/d1/insights/recommendations` returns them. Until the account changes the setting with `PUT`, the default depends on the account's plan. Requires the Account Settings Read permission." ) .option("dry-run", { type: "boolean", @@ -33,12 +33,12 @@ type Args = InferArgs; const command: CommandModule = { command: "get", - describe: "Get risk score info for all users in the account", + describe: "Get D1 Insights Settings", builder, handler: async (argv): Promise => runWithTelemetry( { - command: "zero-trust risk-scoring summary get", + command: "d1 insights settings get", classification: { safeFlags: ["dry-run"], } satisfies ArgClassification, @@ -48,9 +48,9 @@ const command: CommandModule = { if (argv.dryRun) { const __cfDryRunAccountId = await resolveAccountIdSilent(); formatDryRun({ - command: "cf zero-trust risk-scoring summary get", + command: "cf d1 insights settings get", method: "GET", - url: `https://api.cloudflare.com/client/v4/accounts/${__cfDryRunAccountId ?? ""}/zt_risk_scoring/summary`, + url: `https://api.cloudflare.com/client/v4/accounts/${__cfDryRunAccountId ?? ""}/d1/insights/settings`, pathParams: {}, bodyKind: "none", }); diff --git a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/behaviours/index.ts b/packages/cli/src/commands/_generated/d1/insights/settings/index.ts similarity index 68% rename from packages/cli/src/commands/_generated/zero-trust/risk-scoring/behaviours/index.ts rename to packages/cli/src/commands/_generated/d1/insights/settings/index.ts index b06c6630ac..ee88539727 100644 --- a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/behaviours/index.ts +++ b/packages/cli/src/commands/_generated/d1/insights/settings/index.ts @@ -2,15 +2,14 @@ import $get from "./get.js"; import $update from "./update.js"; import type { CommonYargsOptions } from "#lib/cli-types.js"; /** - * behaviours command group - * @generated from apis/overlays/zero-trust.ts + * settings command group + * @generated from apis/overlays/d1.ts */ import type { CommandModule } from "yargs"; const command: CommandModule = { - command: "behaviours", - describe: - "User Risk Scoring - manage behaviors used to calculate user risk scores", + command: "settings", + describe: "turn AI-generated D1 Insights on or off for your account", builder: (yargs) => { return yargs diff --git a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/behaviours/update.ts b/packages/cli/src/commands/_generated/d1/insights/settings/update.ts similarity index 61% rename from packages/cli/src/commands/_generated/zero-trust/risk-scoring/behaviours/update.ts rename to packages/cli/src/commands/_generated/d1/insights/settings/update.ts index 28fe26ae5a..998884d90b 100644 --- a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/behaviours/update.ts +++ b/packages/cli/src/commands/_generated/d1/insights/settings/update.ts @@ -1,9 +1,9 @@ -import operation from "../../../_operations/zero-trust/risk-scoring/behaviours/update.js"; +import operation from "../../../_operations/d1/insights/settings/update.js"; import type { CommonYargsOptions, InferArgs } from "#lib/cli-types.js"; import type { ArgClassification } from "#lib/telemetry/index.js"; /** * update command - * @generated from apis/overlays/zero-trust.ts + * @generated from apis/overlays/d1.ts */ import type { Argv, CommandModule } from "yargs"; import { @@ -11,7 +11,7 @@ import { getAccountId, resolveAccountIdSilent, } from "#lib/auth.js"; -import { compactBody, parseBody, parseJsonMap } from "#lib/body-parser.js"; +import { compactBody, parseBody } from "#lib/body-parser.js"; import { formatDryRun } from "#lib/dry-run.js"; import { LOCAL_ACCOUNT_ID } from "#lib/local.js"; import { formatOutput } from "#lib/output.js"; @@ -21,12 +21,11 @@ import { runWithTelemetry } from "#lib/telemetry/index.js"; function builder(yargs: Argv) { return yargs .usage( - "$0 zero-trust risk-scoring behaviours update\n\nUpdates risk score behavior configurations, defining weights and thresholds for risk calculation." + "$0 d1 insights settings update\n\nTurn AI use for D1 Insights on or off for every database in this account. When you turn it off, D1 stops generating index recommendations for the account and `GET /accounts/{account_id}/d1/insights/recommendations` returns an empty list. Existing recommendations are not deleted. They expire 7 days after they were generated, so any that have not expired are returned again if you turn it back on. Requires the Account Settings Write permission." ) - .option("behaviors", { - type: "string", - description: - 'The behaviors field. Provide as a JSON object or @path/to/file.json. Shape: {"": {...}}.', + .option("ai-enabled", { + type: "boolean", + description: "Whether D1 Insights uses AI on this account's query data.", }) .option("dry-run", { type: "boolean", @@ -35,7 +34,7 @@ function builder(yargs: Argv) { }) .option("body", { type: "string", - description: "Behaviors.", + description: "Raw JSON request body (bypasses individual flags)", }); } @@ -43,22 +42,22 @@ type Args = InferArgs; const command: CommandModule = { command: "update", - describe: "Update configuration for risk behaviors", + describe: "Update D1 Insights Settings", builder, handler: async (argv): Promise => runWithTelemetry( { - command: "zero-trust risk-scoring behaviours update", + command: "d1 insights settings update", classification: { - safeFlags: ["dry-run"], + safeFlags: ["ai-enabled", "dry-run"], } satisfies ArgClassification, }, argv as Record, async () => { const resolveRequiredFields = async (): Promise => { - if (argv["behaviors"] === undefined) { + if (argv["ai-enabled"] === undefined) { throw new Error( - "--behaviors is required (or pass --body with this field set)." + "--ai-enabled is required (or pass --body with this field set)." ); } }; @@ -68,33 +67,22 @@ const command: CommandModule = { } const __cfDryRunAccountId = await resolveAccountIdSilent(); formatDryRun({ - command: "cf zero-trust risk-scoring behaviours update", + command: "cf d1 insights settings update", method: "PUT", - url: `https://api.cloudflare.com/client/v4/accounts/${__cfDryRunAccountId ?? ""}/zt_risk_scoring/behaviors`, + url: `https://api.cloudflare.com/client/v4/accounts/${__cfDryRunAccountId ?? ""}/d1/insights/settings`, pathParams: {}, bodyKind: "json", body: argv.body !== undefined - ? parseBody(argv.body, [ - { path: ["behaviors"], flag: "behaviors" }, - ]) - : compactBody( - { - behaviors: parseJsonMap( - argv["behaviors"], - "behaviors", - true - ), - }, - [["behaviors"]] - ), + ? parseBody(argv.body) + : compactBody({ + ai_enabled: argv["ai-enabled"], + }), }); return; } const parsedBody = - argv.body !== undefined - ? parseBody(argv.body, [{ path: ["behaviors"], flag: "behaviors" }]) - : undefined; + argv.body !== undefined ? parseBody(argv.body) : undefined; const client = await createCommandClient(argv); const accountId = argv.local ? LOCAL_ACCOUNT_ID : await getAccountId(); argv.accountId = accountId; @@ -110,12 +98,9 @@ const command: CommandModule = { await resolveRequiredFields(); // Assemble request body from individual flags - const bodyData = compactBody( - { - behaviors: parseJsonMap(argv["behaviors"], "behaviors", true), - }, - [["behaviors"]] - ); + const bodyData = compactBody({ + ai_enabled: argv["ai-enabled"], + }); const result = await withProgress(`Updating`, async () => client.send(operation, { body: bodyData, account_id: accountId }) ); diff --git a/packages/cli/src/commands/_generated/d1/list.ts b/packages/cli/src/commands/_generated/d1/list.ts index a798894bb7..8c89f6ca9e 100644 --- a/packages/cli/src/commands/_generated/d1/list.ts +++ b/packages/cli/src/commands/_generated/d1/list.ts @@ -32,6 +32,25 @@ function builder(yargs: Argv) { type: "number", description: "Number of items per page.", }) + .option("fields", { + type: "string", + array: true, + description: + "Comma-separated list of fields to include for each database. When omitted, every field except `recommendation_count` is returned.", + choices: [ + "uuid", + "name", + "created_at", + "version", + "jurisdiction", + "num_tables", + "file_size", + "recommendation_count", + ], + }) + .coerce("fields", (values: string[]) => + values.flatMap((value) => value.split(",")) + ) .option("dry-run", { type: "boolean", description: "Validate and show what would happen without executing", @@ -59,6 +78,7 @@ const command: CommandModule = { name: argv["name"], page: argv["page"], per_page: argv["per-page"], + fields: argv["fields"], }; if (argv.dryRun) { const __cfDryRunAccountId = await resolveAccountIdSilent(); diff --git a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/behaviours/get.ts b/packages/cli/src/commands/_generated/zero-trust/risk-scoring/behaviours/get.ts deleted file mode 100644 index 7bcec5456e..0000000000 --- a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/behaviours/get.ts +++ /dev/null @@ -1,71 +0,0 @@ -import operation from "../../../_operations/zero-trust/risk-scoring/behaviours/get.js"; -import type { CommonYargsOptions, InferArgs } from "#lib/cli-types.js"; -import type { ArgClassification } from "#lib/telemetry/index.js"; -/** - * get command - * @generated from apis/overlays/zero-trust.ts - */ -import type { Argv, CommandModule } from "yargs"; -import { - createCommandClient, - getAccountId, - resolveAccountIdSilent, -} from "#lib/auth.js"; -import { formatDryRun } from "#lib/dry-run.js"; -import { LOCAL_ACCOUNT_ID } from "#lib/local.js"; -import { formatOutput } from "#lib/output.js"; -import { withProgress } from "#lib/progress.js"; -import { runWithTelemetry } from "#lib/telemetry/index.js"; - -function builder(yargs: Argv) { - return yargs - .usage( - "$0 zero-trust risk-scoring behaviours get\n\nRetrieves configured risk score behaviors that define how user actions affect their overall risk score." - ) - .option("dry-run", { - type: "boolean", - description: "Validate and show what would happen without executing", - default: false, - }); -} - -type Args = InferArgs; - -const command: CommandModule = { - command: "get", - describe: "Get all behaviors and associated configuration", - builder, - handler: async (argv): Promise => - runWithTelemetry( - { - command: "zero-trust risk-scoring behaviours get", - classification: { - safeFlags: ["dry-run"], - } satisfies ArgClassification, - }, - argv as Record, - async () => { - if (argv.dryRun) { - const __cfDryRunAccountId = await resolveAccountIdSilent(); - formatDryRun({ - command: "cf zero-trust risk-scoring behaviours get", - method: "GET", - url: `https://api.cloudflare.com/client/v4/accounts/${__cfDryRunAccountId ?? ""}/zt_risk_scoring/behaviors`, - pathParams: {}, - bodyKind: "none", - }); - return; - } - const client = await createCommandClient(argv); - const accountId = argv.local ? LOCAL_ACCOUNT_ID : await getAccountId(); - argv.accountId = accountId; - - const result = await withProgress(`Loading`, async () => - client.send(operation, { account_id: accountId }) - ); - formatOutput(result, { successLabel: `Loaded` }); - } - ), -}; - -export default command; diff --git a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/get.ts b/packages/cli/src/commands/_generated/zero-trust/risk-scoring/get.ts deleted file mode 100644 index 85d851f390..0000000000 --- a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/get.ts +++ /dev/null @@ -1,79 +0,0 @@ -import operation from "../../_operations/zero-trust/risk-scoring/get.js"; -import type { CommonYargsOptions, InferArgs } from "#lib/cli-types.js"; -import type { ArgClassification } from "#lib/telemetry/index.js"; -/** - * get command - * @generated from apis/overlays/zero-trust.ts - */ -import type { Argv, CommandModule } from "yargs"; -import { - createCommandClient, - getAccountId, - resolveAccountIdSilent, -} from "#lib/auth.js"; -import { formatDryRun } from "#lib/dry-run.js"; -import { LOCAL_ACCOUNT_ID } from "#lib/local.js"; -import { formatOutput } from "#lib/output.js"; -import { withProgress } from "#lib/progress.js"; -import { runWithTelemetry } from "#lib/telemetry/index.js"; - -function builder(yargs: Argv) { - return yargs - .usage( - "$0 zero-trust risk-scoring get \n\nRetrieves the detailed risk score breakdown for a specific user, including contributing factors." - ) - .positional("user-id", { - type: "string", - description: "User ID", - demandOption: true, - }) - .option("dry-run", { - type: "boolean", - description: "Validate and show what would happen without executing", - default: false, - }); -} - -type Args = InferArgs; - -const command: CommandModule = { - command: "get ", - describe: "Get risk event/score information for a specific user", - builder, - handler: async (argv): Promise => - runWithTelemetry( - { - command: "zero-trust risk-scoring get", - classification: { - safeFlags: ["dry-run"], - } satisfies ArgClassification, - }, - argv as Record, - async () => { - if (argv.dryRun) { - const __cfDryRunAccountId = await resolveAccountIdSilent(); - formatDryRun({ - command: "cf zero-trust risk-scoring get", - method: "GET", - url: `https://api.cloudflare.com/client/v4/accounts/${__cfDryRunAccountId ?? ""}/zt_risk_scoring/${argv["user-id"] == null ? "" : encodeURIComponent(String(argv["user-id"]))}`, - pathParams: { "user-id": String(argv["user-id"] ?? "") }, - bodyKind: "none", - }); - return; - } - const client = await createCommandClient(argv); - const accountId = argv.local ? LOCAL_ACCOUNT_ID : await getAccountId(); - argv.accountId = accountId; - - const result = await withProgress(`Loading`, async () => - client.send(operation, { - account_id: accountId, - user_id: argv["user-id"], - }) - ); - formatOutput(result, { successLabel: `Loaded` }); - } - ), -}; - -export default command; diff --git a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/index.ts b/packages/cli/src/commands/_generated/zero-trust/risk-scoring/index.ts index 87926144dd..604d333c0d 100644 --- a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/index.ts +++ b/packages/cli/src/commands/_generated/zero-trust/risk-scoring/index.ts @@ -1,8 +1,4 @@ -import $behaviours from "./behaviours/index.js"; -import $get from "./get.js"; import $integrations from "./integrations/index.js"; -import $reset from "./reset.js"; -import $summary from "./summary/index.js"; import type { CommonYargsOptions } from "#lib/cli-types.js"; /** * risk-scoring command group @@ -12,15 +8,11 @@ import type { CommandModule } from "yargs"; const command: CommandModule = { command: "risk-scoring", - describe: "User Risk Scoring - retrieve and reset user risk scores", + describe: "Operations for risk-scoring", builder: (yargs) => { return yargs - .command($get) - .command($reset) - .command($behaviours) .command($integrations) - .command($summary) .demandCommand(1, "Please specify a subcommand"); }, diff --git a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/reset.ts b/packages/cli/src/commands/_generated/zero-trust/risk-scoring/reset.ts deleted file mode 100644 index fdaba68c64..0000000000 --- a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/reset.ts +++ /dev/null @@ -1,96 +0,0 @@ -import operation from "../../_operations/zero-trust/risk-scoring/reset.js"; -import type { CommonYargsOptions, InferArgs } from "#lib/cli-types.js"; -import type { ArgClassification } from "#lib/telemetry/index.js"; -/** - * reset command - * @generated from apis/overlays/zero-trust.ts - */ -import type { Argv, CommandModule } from "yargs"; -import { - createCommandClient, - getAccountId, - resolveAccountIdSilent, -} from "#lib/auth.js"; -import { formatDryRun } from "#lib/dry-run.js"; -import { LOCAL_ACCOUNT_ID } from "#lib/local.js"; -import { formatOutput } from "#lib/output.js"; -import { withProgress } from "#lib/progress.js"; -import { confirmDelete } from "#lib/prompt.js"; -import { runWithTelemetry } from "#lib/telemetry/index.js"; - -function builder(yargs: Argv) { - return yargs - .usage( - "$0 zero-trust risk-scoring reset \n\nResets risk scores for specified users, clearing their accumulated risk history." - ) - .positional("user-id", { - type: "string", - description: "User ID", - demandOption: true, - }) - .option("dry-run", { - type: "boolean", - description: "Validate and show what would happen without executing", - default: false, - }) - .option("force", { - type: "boolean", - alias: "f", - description: "Skip confirmation (useful in scripts and CI)", - default: false, - }); -} - -type Args = InferArgs; - -const command: CommandModule = { - command: "reset ", - describe: "Clear the risk score for a particular user", - builder, - handler: async (argv): Promise => - runWithTelemetry( - { - command: "zero-trust risk-scoring reset", - classification: { - safeFlags: ["dry-run", "force"], - shortFlagAliases: { f: { canonical: "force", type: "boolean" } }, - } satisfies ArgClassification, - }, - argv as Record, - async () => { - if (argv.dryRun) { - const __cfDryRunAccountId = await resolveAccountIdSilent(); - formatDryRun({ - command: "cf zero-trust risk-scoring reset", - method: "POST", - url: `https://api.cloudflare.com/client/v4/accounts/${__cfDryRunAccountId ?? ""}/zt_risk_scoring/${argv["user-id"] == null ? "" : encodeURIComponent(String(argv["user-id"]))}/reset`, - pathParams: { "user-id": String(argv["user-id"] ?? "") }, - bodyKind: "none", - }); - return; - } - const client = await createCommandClient(argv); - const accountId = argv.local ? LOCAL_ACCOUNT_ID : await getAccountId(); - argv.accountId = accountId; - - if ( - !(await confirmDelete({ - force: Boolean(argv.force), - message: `This operation wipes risk-scoring history.`, - })) - ) { - return; - } - - const result = await withProgress(`Processing`, async () => - client.send(operation, { - account_id: accountId, - user_id: argv["user-id"], - }) - ); - formatOutput(result, { successLabel: `Done` }); - } - ), -}; - -export default command; diff --git a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/summary/index.ts b/packages/cli/src/commands/_generated/zero-trust/risk-scoring/summary/index.ts deleted file mode 100644 index 27ef5e7b44..0000000000 --- a/packages/cli/src/commands/_generated/zero-trust/risk-scoring/summary/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -import $get from "./get.js"; -import type { CommonYargsOptions } from "#lib/cli-types.js"; -/** - * summary command group - * @generated from apis/overlays/zero-trust.ts - */ -import type { CommandModule } from "yargs"; - -const command: CommandModule = { - command: "summary", - describe: "User Risk Scoring - retrieve account risk score summaries", - - builder: (yargs) => { - return yargs.command($get).demandCommand(1, "Please specify a subcommand"); - }, - - handler: () => {}, -}; - -export default command; From 313a731d31c8c0318c2cd0fba7d0410bba631187 Mon Sep 17 00:00:00 2001 From: Pete Bacon Darwin Date: Tue, 24 Nov 2026 23:01:25 +0000 Subject: [PATCH 2/2] docs: document OpenAPI command changes --- .changeset/d1-insights-recommendations.md | 10 ++++++++++ .changeset/threat-signals-feed-filters.md | 9 +++++++++ .changeset/update-openapi-10837344ff6c.md | 8 ++++++-- 3 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 .changeset/d1-insights-recommendations.md create mode 100644 .changeset/threat-signals-feed-filters.md diff --git a/.changeset/d1-insights-recommendations.md b/.changeset/d1-insights-recommendations.md new file mode 100644 index 0000000000..7a933c7910 --- /dev/null +++ b/.changeset/d1-insights-recommendations.md @@ -0,0 +1,10 @@ +--- +"cf": minor +--- + +Add D1 Insights index recommendations and settings commands + +Use `cf d1 insights recommendations` to retrieve index recommendations and +`cf d1 insights settings get` or `cf d1 insights settings update` to view or +change the account's AI setting. Use `cf d1 list --fields` to select returned +database fields, including the opt-in `recommendation_count` field. diff --git a/.changeset/threat-signals-feed-filters.md b/.changeset/threat-signals-feed-filters.md new file mode 100644 index 0000000000..ee33215e33 --- /dev/null +++ b/.changeset/threat-signals-feed-filters.md @@ -0,0 +1,9 @@ +--- +"cf": minor +--- + +Add multi-feed filters to Cloudforce One Threat Signals + +Repeat `--feed-id` on `cf cloudforce-one threat-signals articles list` or +`cf cloudforce-one threat-signals search` to match multiple feeds. Use +`--feed-category-id` on `articles list` to filter by feed category ID. diff --git a/.changeset/update-openapi-10837344ff6c.md b/.changeset/update-openapi-10837344ff6c.md index 0dc71260b4..a1a6b8231d 100644 --- a/.changeset/update-openapi-10837344ff6c.md +++ b/.changeset/update-openapi-10837344ff6c.md @@ -2,5 +2,9 @@ "cf": minor --- -Update the generated command surface for Cloudflare API schemas revision -`10837344ff6c5abd1d5602f1aeebe82ef353fa32`. +Remove `cf zero-trust risk-scoring` commands no longer in the API schema + +Breaking change: under `cf zero-trust risk-scoring`, the `get`, `reset`, +`behaviours get`, `behaviours update`, and `summary get` commands are no longer +available. Update scripts that call them before upgrading. Commands under +`cf zero-trust risk-scoring integrations` remain available.