diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ea783ff58..c2dcff6fa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,15 +5,12 @@ name: 'ci: native package' run-name: 'ci: native package' -# PUSH, never pull_request. The fleet takes no outside contributions and -# lands on main directly, so a pull_request trigger adds no coverage a push -# trigger does not already give — and it is the fragile half: GitHub has -# narrowed pull_request defaults for security, and a silently non-firing -# trigger reads as a green repo with no CI at all. on: push: branches: [main] tags: ['*'] + pull_request: + branches: [main] workflow_dispatch: permissions: diff --git a/package.json b/package.json index 87d8479c3..93de29b44 100644 --- a/package.json +++ b/package.json @@ -92,6 +92,8 @@ "check:hooks": "node scripts/fleet/check.mts --category=hooks", "check:native-package": "node scripts/repo/build/sea/check.mts", "check:paths": "node scripts/fleet/check/paths-are-valid.mts", + "docs:commands:check": "node scripts/repo/check/docs-commands-are-complete.mts", + "docs:commands:test": "node scripts/fleet/test.mts test/repo/unit/docs/commands/inventory.test.mts test/repo/unit/check/docs-commands-are-complete.test.mts", "check:test": "node scripts/fleet/commands/run.mts check test", "check:test-budget-headroom": "node scripts/fleet/check/test-budget-headroom.mts", "check:types": "node scripts/fleet/check.mts --category=types", diff --git a/scripts/repo/check/docs-commands.mts b/scripts/repo/check/docs-commands-are-complete.mts similarity index 97% rename from scripts/repo/check/docs-commands.mts rename to scripts/repo/check/docs-commands-are-complete.mts index 83cbaeee1..1c56019a7 100644 --- a/scripts/repo/check/docs-commands.mts +++ b/scripts/repo/check/docs-commands-are-complete.mts @@ -6,17 +6,18 @@ import { fromMarkdown } from 'mdast-util-from-markdown' import { gfmFromMarkdown } from 'mdast-util-gfm' import { gfm } from 'micromark-extension-gfm' -import { extractCommandInventory } from './docs-command-inventory.mts' +import { extractCommandInventory } from '../docs/commands/inventory.mts' import { REPO_ROOT } from '../../fleet/paths.mts' import { isMainModule } from '../../fleet/process/is-main-module.mts' import { runMain } from '../../fleet/process/main/run.mts' -import type { CommandInventory } from './docs-command-inventory.mts' +import type { CommandInventory } from '../docs/commands/inventory.mts' import type { ScriptMeta } from '../../fleet/process/main/run.mts' export const SCRIPT_META: ScriptMeta = { describe: 'Check the exact CLI command and alias inventory in its reference.', help: 'Usage: pnpm run docs:commands:check', + json: 'result', } interface MarkdownNode { diff --git a/scripts/repo/check/docs-command-custom-routes.mts b/scripts/repo/docs/commands/custom-routes.mts similarity index 98% rename from scripts/repo/check/docs-command-custom-routes.mts rename to scripts/repo/docs/commands/custom-routes.mts index e193bc686..95f42c197 100644 --- a/scripts/repo/check/docs-command-custom-routes.mts +++ b/scripts/repo/docs/commands/custom-routes.mts @@ -5,13 +5,9 @@ import { parseModule, stringLiteral, visitAst, -} from './docs-command-inventory-lib.mts' +} from './util.mts' -import type { - AstNode, - ParsedModule, - SourceReader, -} from './docs-command-inventory-lib.mts' +import type { AstNode, ParsedModule, SourceReader } from './util.mts' export type CustomRouteKind = 'patch' | 'sfw' diff --git a/scripts/repo/check/docs-command-inventory.mts b/scripts/repo/docs/commands/inventory.mts similarity index 97% rename from scripts/repo/check/docs-command-inventory.mts rename to scripts/repo/docs/commands/inventory.mts index 9100a9795..4c64b1b6e 100644 --- a/scripts/repo/check/docs-command-inventory.mts +++ b/scripts/repo/docs/commands/inventory.mts @@ -6,16 +6,12 @@ import { parseModule, sourceError, stringLiteral, -} from './docs-command-inventory-lib.mts' -import { extractCustomRoutes } from './docs-command-custom-routes.mts' +} from './util.mts' +import { extractCustomRoutes } from './custom-routes.mts' -import type { CustomRouteKind } from './docs-command-custom-routes.mts' +import type { CustomRouteKind } from './custom-routes.mts' -import type { - AstNode, - ParsedModule, - SourceReader, -} from './docs-command-inventory-lib.mts' +import type { AstNode, ParsedModule, SourceReader } from './util.mts' export interface CommandAlias { alias: string diff --git a/scripts/repo/check/docs-command-inventory-lib.mts b/scripts/repo/docs/commands/util.mts similarity index 92% rename from scripts/repo/check/docs-command-inventory-lib.mts rename to scripts/repo/docs/commands/util.mts index 0ae822c63..c8607eaa1 100644 --- a/scripts/repo/check/docs-command-inventory-lib.mts +++ b/scripts/repo/docs/commands/util.mts @@ -5,6 +5,33 @@ import { parseAst } from 'rolldown/parseAst' export interface AstNode extends Record { type: string + arguments?: unknown | undefined + body?: unknown | undefined + callee?: unknown | undefined + computed?: unknown | undefined + consequent?: unknown | undefined + declaration?: unknown | undefined + declarations?: unknown | undefined + elements?: unknown | undefined + id?: unknown | undefined + imported?: unknown | undefined + init?: unknown | undefined + key?: unknown | undefined + kind?: unknown | undefined + left?: unknown | undefined + local?: unknown | undefined + loc?: unknown | undefined + name?: unknown | undefined + object?: unknown | undefined + operator?: unknown | undefined + properties?: unknown | undefined + property?: unknown | undefined + right?: unknown | undefined + source?: unknown | undefined + specifiers?: unknown | undefined + start?: unknown | undefined + test?: unknown | undefined + value?: unknown | undefined } export type SourceReader = (sourcePath: string) => string diff --git a/test/integration/cli/cmd-config-auto.test.mts b/test/integration/cli/cmd-config-auto.test.mts index 5fdb7ca3a..b40f6524e 100644 --- a/test/integration/cli/cmd-config-auto.test.mts +++ b/test/integration/cli/cmd-config-auto.test.mts @@ -59,6 +59,7 @@ describe('socket config auto', async () => { - apiToken -- The Socket API token required to access most Socket API endpoints - defaultOrg -- The default org slug to use; usually the org your Socket API token has access to. When set, all orgSlug arguments are implied to be this value. - enforcedOrgs -- Orgs in this list have their security policies enforced on this machine + - oauthSession -- The selected Socket OAuth issuer and client - org -- Alias for defaultOrg - skipAskToPersistDefaultOrg -- This flag prevents the Socket CLI from asking you to persist the org slug when you selected one interactively" `) diff --git a/test/repo/unit/check/docs-commands.test.mts b/test/repo/unit/check/docs-commands-are-complete.test.mts similarity index 98% rename from test/repo/unit/check/docs-commands.test.mts rename to test/repo/unit/check/docs-commands-are-complete.test.mts index 7524364f7..b51bb89ec 100644 --- a/test/repo/unit/check/docs-commands.test.mts +++ b/test/repo/unit/check/docs-commands-are-complete.test.mts @@ -1,6 +1,6 @@ import { describe, expect, it } from 'vitest' -import { checkCommandDocumentation } from '../../../../scripts/repo/check/docs-commands.mts' +import { checkCommandDocumentation } from '../../../../scripts/repo/check/docs-commands-are-complete.mts' const inventory = { commands: ['alpha', 'alpha child', 'patch list'], diff --git a/test/repo/unit/check/docs-command-inventory.test.mts b/test/repo/unit/docs/commands/inventory.test.mts similarity index 97% rename from test/repo/unit/check/docs-command-inventory.test.mts rename to test/repo/unit/docs/commands/inventory.test.mts index e50dc25fb..c6dec4e90 100644 --- a/test/repo/unit/check/docs-command-inventory.test.mts +++ b/test/repo/unit/docs/commands/inventory.test.mts @@ -1,8 +1,8 @@ import { describe, expect, it } from 'vitest' -import { extractCommandInventory } from '../../../../scripts/repo/check/docs-command-inventory.mts' -import { extractCustomRoutes } from '../../../../scripts/repo/check/docs-command-custom-routes.mts' -import { checkCommandDocumentation } from '../../../../scripts/repo/check/docs-commands.mts' +import { extractCommandInventory } from '../../../../../scripts/repo/docs/commands/inventory.mts' +import { extractCustomRoutes } from '../../../../../scripts/repo/docs/commands/custom-routes.mts' +import { checkCommandDocumentation } from '../../../../../scripts/repo/check/docs-commands-are-complete.mts' function sourceReader( files: Record,