Skip to content

Commit 24dd96a

Browse files
committed
fix(docs): land isolated command inventory helpers
2 parents 4f0d252 + 3db7907 commit 24dd96a

8 files changed

Lines changed: 43 additions & 20 deletions

File tree

‎package.json‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@
9292
"check:hooks": "node scripts/fleet/check.mts --category=hooks",
9393
"check:native-package": "node scripts/repo/build/sea/check.mts",
9494
"check:paths": "node scripts/fleet/check/paths-are-valid.mts",
95+
"docs:commands:check": "node scripts/repo/check/docs-commands-are-complete.mts",
96+
"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",
9597
"check:test": "node scripts/fleet/commands/run.mts check test",
9698
"check:test-budget-headroom": "node scripts/fleet/check/test-budget-headroom.mts",
9799
"check:types": "node scripts/fleet/check.mts --category=types",

scripts/repo/check/docs-commands.mts renamed to scripts/repo/check/docs-commands-are-complete.mts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@ import { fromMarkdown } from 'mdast-util-from-markdown'
66
import { gfmFromMarkdown } from 'mdast-util-gfm'
77
import { gfm } from 'micromark-extension-gfm'
88

9-
import { extractCommandInventory } from './docs-command-inventory.mts'
9+
import { extractCommandInventory } from '../docs/commands/inventory.mts'
1010
import { REPO_ROOT } from '../../fleet/paths.mts'
1111
import { isMainModule } from '../../fleet/process/is-main-module.mts'
1212
import { runMain } from '../../fleet/process/main/run.mts'
1313

14-
import type { CommandInventory } from './docs-command-inventory.mts'
14+
import type { CommandInventory } from '../docs/commands/inventory.mts'
1515
import type { ScriptMeta } from '../../fleet/process/main/run.mts'
1616

1717
export const SCRIPT_META: ScriptMeta = {
1818
describe: 'Check the exact CLI command and alias inventory in its reference.',
1919
help: 'Usage: pnpm run docs:commands:check',
20+
json: 'result',
2021
}
2122

2223
interface MarkdownNode {

scripts/repo/check/docs-command-custom-routes.mts renamed to scripts/repo/docs/commands/custom-routes.mts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@ import {
55
parseModule,
66
stringLiteral,
77
visitAst,
8-
} from './docs-command-inventory-lib.mts'
8+
} from './util.mts'
99

10-
import type {
11-
AstNode,
12-
ParsedModule,
13-
SourceReader,
14-
} from './docs-command-inventory-lib.mts'
10+
import type { AstNode, ParsedModule, SourceReader } from './util.mts'
1511

1612
export type CustomRouteKind = 'patch' | 'sfw'
1713

scripts/repo/check/docs-command-inventory.mts renamed to scripts/repo/docs/commands/inventory.mts

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,16 +6,12 @@ import {
66
parseModule,
77
sourceError,
88
stringLiteral,
9-
} from './docs-command-inventory-lib.mts'
10-
import { extractCustomRoutes } from './docs-command-custom-routes.mts'
9+
} from './util.mts'
10+
import { extractCustomRoutes } from './custom-routes.mts'
1111

12-
import type { CustomRouteKind } from './docs-command-custom-routes.mts'
12+
import type { CustomRouteKind } from './custom-routes.mts'
1313

14-
import type {
15-
AstNode,
16-
ParsedModule,
17-
SourceReader,
18-
} from './docs-command-inventory-lib.mts'
14+
import type { AstNode, ParsedModule, SourceReader } from './util.mts'
1915

2016
export interface CommandAlias {
2117
alias: string

scripts/repo/check/docs-command-inventory-lib.mts renamed to scripts/repo/docs/commands/util.mts

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,33 @@ import { parseAst } from 'rolldown/parseAst'
55

66
export interface AstNode extends Record<string, unknown> {
77
type: string
8+
arguments?: unknown | undefined
9+
body?: unknown | undefined
10+
callee?: unknown | undefined
11+
computed?: unknown | undefined
12+
consequent?: unknown | undefined
13+
declaration?: unknown | undefined
14+
declarations?: unknown | undefined
15+
elements?: unknown | undefined
16+
id?: unknown | undefined
17+
imported?: unknown | undefined
18+
init?: unknown | undefined
19+
key?: unknown | undefined
20+
kind?: unknown | undefined
21+
left?: unknown | undefined
22+
local?: unknown | undefined
23+
loc?: unknown | undefined
24+
name?: unknown | undefined
25+
object?: unknown | undefined
26+
operator?: unknown | undefined
27+
properties?: unknown | undefined
28+
property?: unknown | undefined
29+
right?: unknown | undefined
30+
source?: unknown | undefined
31+
specifiers?: unknown | undefined
32+
start?: unknown | undefined
33+
test?: unknown | undefined
34+
value?: unknown | undefined
835
}
936

1037
export type SourceReader = (sourcePath: string) => string

‎test/integration/cli/cmd-config-auto.test.mts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ describe('socket config auto', async () => {
5959
- apiToken -- The Socket API token required to access most Socket API endpoints
6060
- 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.
6161
- enforcedOrgs -- Orgs in this list have their security policies enforced on this machine
62+
- oauthSession -- The selected Socket OAuth issuer and client
6263
- org -- Alias for defaultOrg
6364
- skipAskToPersistDefaultOrg -- This flag prevents the Socket CLI from asking you to persist the org slug when you selected one interactively"
6465
`)

test/repo/unit/check/docs-commands.test.mts renamed to test/repo/unit/check/docs-commands-are-complete.test.mts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, expect, it } from 'vitest'
22

3-
import { checkCommandDocumentation } from '../../../../scripts/repo/check/docs-commands.mts'
3+
import { checkCommandDocumentation } from '../../../../scripts/repo/check/docs-commands-are-complete.mts'
44

55
const inventory = {
66
commands: ['alpha', 'alpha child', 'patch list'],

test/repo/unit/check/docs-command-inventory.test.mts renamed to test/repo/unit/docs/commands/inventory.test.mts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { describe, expect, it } from 'vitest'
22

3-
import { extractCommandInventory } from '../../../../scripts/repo/check/docs-command-inventory.mts'
4-
import { extractCustomRoutes } from '../../../../scripts/repo/check/docs-command-custom-routes.mts'
5-
import { checkCommandDocumentation } from '../../../../scripts/repo/check/docs-commands.mts'
3+
import { extractCommandInventory } from '../../../../../scripts/repo/docs/commands/inventory.mts'
4+
import { extractCustomRoutes } from '../../../../../scripts/repo/docs/commands/custom-routes.mts'
5+
import { checkCommandDocumentation } from '../../../../../scripts/repo/check/docs-commands-are-complete.mts'
66

77
function sourceReader(
88
files: Record<string, string>,

0 commit comments

Comments
 (0)