Skip to content

Commit 72ba5da

Browse files
committed
chore: remove 'review' namespace in document-api, docs improvements for format aliases, new sections
1 parent 70fd7d9 commit 72ba5da

87 files changed

Lines changed: 959 additions & 725 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

apps/cli/scripts/export-sdk-contract.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ const INTENT_NAMES = {
7676
'doc.comments.list': 'list_comments',
7777
'doc.trackChanges.list': 'list_tracked_changes',
7878
'doc.trackChanges.get': 'get_tracked_change',
79-
'doc.review.decide': 'review_decide',
79+
'doc.trackChanges.decide': 'decide_tracked_change',
8080
'doc.query.match': 'query_match',
8181
'doc.mutations.preview': 'preview_mutations',
8282
'doc.mutations.apply': 'apply_mutations',

apps/cli/src/__tests__/conformance/scenarios.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ export const SUCCESS_SCENARIOS = {
514514
docPath,
515515
'--target-json',
516516
JSON.stringify(target),
517-
'--marks-json',
517+
'--inline-json',
518518
JSON.stringify({ bold: true }),
519519
'--out',
520520
harness.createOutputPath('doc-style-apply-output'),
@@ -537,21 +537,21 @@ export const SUCCESS_SCENARIOS = {
537537
args: ['track-changes', 'get', fixture.docPath, '--id', fixture.changeId],
538538
};
539539
},
540-
'doc.review.decide': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
541-
const stateDir = await harness.createStateDir('doc-review-decide-success');
542-
const fixture = await harness.addTrackedChangeFixture(stateDir, 'doc-review-decide');
540+
'doc.trackChanges.decide': async (harness: ConformanceHarness): Promise<ScenarioInvocation> => {
541+
const stateDir = await harness.createStateDir('doc-trackChanges-decide-success');
542+
const fixture = await harness.addTrackedChangeFixture(stateDir, 'doc-trackChanges-decide');
543543
return {
544544
stateDir,
545545
args: [
546-
'review',
546+
'track-changes',
547547
'decide',
548548
fixture.docPath,
549549
'--decision',
550550
'accept',
551551
'--target-json',
552552
JSON.stringify({ id: fixture.changeId }),
553553
'--out',
554-
harness.createOutputPath('doc-review-decide-output'),
554+
harness.createOutputPath('doc-trackChanges-decide-output'),
555555
],
556556
};
557557
},

apps/cli/src/cli/__tests__/schema-ref-resolution.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const $defs: Record<string, Record<string, unknown>> = {
3232
required: ['kind', 'blockId', 'range'],
3333
additionalProperties: false,
3434
},
35-
MarkSet: {
35+
InlineStylePatch: {
3636
type: 'object',
3737
properties: {
3838
bold: { type: 'boolean' },
@@ -71,10 +71,10 @@ describe('operation-params $ref resolution', () => {
7171
type: 'object',
7272
properties: {
7373
target: { $ref: '#/$defs/TextAddress' },
74-
marks: { $ref: '#/$defs/MarkSet' },
74+
inline: { $ref: '#/$defs/InlineStylePatch' },
7575
text: { type: 'string' },
7676
},
77-
required: ['target', 'marks', 'text'],
77+
required: ['target', 'inline', 'text'],
7878
};
7979
const result = jsonSchemaToTypeSpec(schema, $defs) as {
8080
type: string;
@@ -83,7 +83,7 @@ describe('operation-params $ref resolution', () => {
8383
};
8484
expect(result.type).toBe('object');
8585
expect((result.properties.target as { type: string }).type).toBe('object');
86-
expect((result.properties.marks as { type: string }).type).toBe('object');
86+
expect((result.properties.inline as { type: string }).type).toBe('object');
8787
expect((result.properties.text as { type: string }).type).toBe('string');
8888
});
8989

apps/cli/src/cli/helper-commands.ts

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
*
55
* Helper commands are NOT derived from OPERATION_DEFINITIONS. They exist
66
* only in the CLI and SDK layers, providing familiar shortcuts like
7-
* `superdoc format bold` that route to `format.apply` with marks pre-filled.
7+
* `superdoc format bold` that route to `format.apply` with inline styles pre-filled.
88
*
99
* Each entry maps CLI tokens → canonical OperationId + default args to merge.
1010
* Helper commands route through the standard doc operation dispatch (read/mutation
@@ -34,7 +34,7 @@ export interface CliHelperCommand {
3434
inputTransform?: (input: Record<string, unknown>) => Record<string, unknown>;
3535
}
3636

37-
/** Maps a flat `--id` flag to the `target: { id }` shape expected by review.decide. */
37+
/** Maps a flat `--id` flag to the `target: { id }` shape expected by trackChanges.decide. */
3838
function mapIdToTarget(input: Record<string, unknown>): Record<string, unknown> {
3939
if (typeof input.id === 'string' && input.target === undefined) {
4040
const { id, ...rest } = input;
@@ -44,7 +44,7 @@ function mapIdToTarget(input: Record<string, unknown>): Record<string, unknown>
4444
}
4545

4646
/**
47-
* Format helper commands — map `format <mark>` to `format.apply` with pre-filled marks.
47+
* Format helper commands — map `format <mark>` to `format.apply` with pre-filled inline styles.
4848
* These keep `superdoc format bold|italic|underline|strikethrough` as ergonomic
4949
* shortcuts over the canonical `format.apply` contract operation.
5050
*/
@@ -53,7 +53,7 @@ export const CLI_HELPER_COMMANDS: readonly CliHelperCommand[] = [
5353
{
5454
tokens: ['format', 'bold'],
5555
canonicalOperationId: 'format.apply',
56-
defaultInput: { marks: { bold: true } },
56+
defaultInput: { inline: { bold: true } },
5757
description: 'Apply bold formatting to a text range.',
5858
category: 'format',
5959
mutates: true,
@@ -65,7 +65,7 @@ export const CLI_HELPER_COMMANDS: readonly CliHelperCommand[] = [
6565
{
6666
tokens: ['format', 'italic'],
6767
canonicalOperationId: 'format.apply',
68-
defaultInput: { marks: { italic: true } },
68+
defaultInput: { inline: { italic: true } },
6969
description: 'Apply italic formatting to a text range.',
7070
category: 'format',
7171
mutates: true,
@@ -74,7 +74,7 @@ export const CLI_HELPER_COMMANDS: readonly CliHelperCommand[] = [
7474
{
7575
tokens: ['format', 'underline'],
7676
canonicalOperationId: 'format.apply',
77-
defaultInput: { marks: { underline: true } },
77+
defaultInput: { inline: { underline: true } },
7878
description: 'Apply underline formatting to a text range.',
7979
category: 'format',
8080
mutates: true,
@@ -83,16 +83,16 @@ export const CLI_HELPER_COMMANDS: readonly CliHelperCommand[] = [
8383
{
8484
tokens: ['format', 'strikethrough'],
8585
canonicalOperationId: 'format.apply',
86-
defaultInput: { marks: { strike: true } },
86+
defaultInput: { inline: { strike: true } },
8787
description: 'Apply strikethrough formatting to a text range.',
8888
category: 'format',
8989
mutates: true,
9090
examples: ['superdoc format strikethrough --blockId p1 --start 0 --end 5'],
9191
},
92-
// --- Track-changes review helpers (route to review.decide) ---
92+
// --- Track-changes review helpers (route to trackChanges.decide) ---
9393
{
9494
tokens: ['track-changes', 'accept'],
95-
canonicalOperationId: 'review.decide',
95+
canonicalOperationId: 'trackChanges.decide',
9696
defaultInput: { decision: 'accept' },
9797
description: 'Accept a tracked change by ID.',
9898
category: 'trackChanges',
@@ -103,7 +103,7 @@ export const CLI_HELPER_COMMANDS: readonly CliHelperCommand[] = [
103103
},
104104
{
105105
tokens: ['track-changes', 'reject'],
106-
canonicalOperationId: 'review.decide',
106+
canonicalOperationId: 'trackChanges.decide',
107107
defaultInput: { decision: 'reject' },
108108
description: 'Reject a tracked change by ID.',
109109
category: 'trackChanges',
@@ -114,7 +114,7 @@ export const CLI_HELPER_COMMANDS: readonly CliHelperCommand[] = [
114114
},
115115
{
116116
tokens: ['track-changes', 'accept-all'],
117-
canonicalOperationId: 'review.decide',
117+
canonicalOperationId: 'trackChanges.decide',
118118
defaultInput: { decision: 'accept', target: { scope: 'all' } },
119119
description: 'Accept all tracked changes.',
120120
category: 'trackChanges',
@@ -123,7 +123,7 @@ export const CLI_HELPER_COMMANDS: readonly CliHelperCommand[] = [
123123
},
124124
{
125125
tokens: ['track-changes', 'reject-all'],
126-
canonicalOperationId: 'review.decide',
126+
canonicalOperationId: 'trackChanges.decide',
127127
defaultInput: { decision: 'reject', target: { scope: 'all' } },
128128
description: 'Reject all tracked changes.',
129129
category: 'trackChanges',

apps/cli/src/cli/operation-hints.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const SUCCESS_VERB: Record<CliExposedOperationId, string> = {
5353
'comments.list': 'listed comments',
5454
'trackChanges.list': 'listed tracked changes',
5555
'trackChanges.get': 'resolved tracked change',
56-
'review.decide': 'reviewed tracked change',
56+
'trackChanges.decide': 'reviewed tracked change',
5757
'query.match': 'matched selectors',
5858
'mutations.preview': 'previewed mutations',
5959
'mutations.apply': 'applied mutations',
@@ -110,7 +110,7 @@ export const OUTPUT_FORMAT: Record<CliExposedOperationId, OutputFormat> = {
110110
'comments.list': 'commentList',
111111
'trackChanges.list': 'trackChangeList',
112112
'trackChanges.get': 'trackChangeInfo',
113-
'review.decide': 'trackChangeMutationReceipt',
113+
'trackChanges.decide': 'trackChangeMutationReceipt',
114114
'query.match': 'plain',
115115
'mutations.preview': 'plain',
116116
'mutations.apply': 'plain',
@@ -155,7 +155,7 @@ export const RESPONSE_ENVELOPE_KEY: Record<CliExposedOperationId, string | null>
155155
'comments.list': 'result',
156156
'trackChanges.list': 'result',
157157
'trackChanges.get': 'change',
158-
'review.decide': 'receipt',
158+
'trackChanges.decide': 'receipt',
159159
'query.match': 'result',
160160
'mutations.preview': 'result',
161161
'mutations.apply': 'result',
@@ -217,7 +217,7 @@ export const OPERATION_FAMILY: Record<CliExposedOperationId, OperationFamily> =
217217
'comments.list': 'comments',
218218
'trackChanges.list': 'trackChanges',
219219
'trackChanges.get': 'trackChanges',
220-
'review.decide': 'trackChanges',
220+
'trackChanges.decide': 'trackChanges',
221221
'query.match': 'query',
222222
'mutations.preview': 'general',
223223
'mutations.apply': 'general',

apps/cli/src/cli/operation-set.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,9 +94,6 @@ function deriveCategoryFromDocApi(docApiId: OperationId): CliCategory {
9494
return COMMAND_CATALOG[docApiId].mutates ? 'mutation' : 'query';
9595
}
9696

97-
// Map 'review' reference group to 'trackChanges' CLI category
98-
if (group === 'review') return 'trackChanges';
99-
10097
return group as CliCategory;
10198
}
10299

apps/cli/src/lib/operation-executor.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ export async function executeOperation(request: ExecuteOperationRequest): Promis
192192
extraOptionSpecs: request.extraOptionSpecs,
193193
}),
194194
) ?? {}) as Record<string, unknown>;
195-
// Merge helper command defaults (e.g., marks: { bold: true } for `format bold`).
195+
// Merge helper command defaults (e.g., inline: { bold: true } for `format bold`).
196196
// User-provided values take precedence over defaults.
197197
if (request.defaultInput) {
198198
input = { ...request.defaultInput, ...input };

apps/cli/src/lib/special-handlers.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const resolveTrackChangeId: PreInvokeHook = (input, context) => {
144144
};
145145

146146
/**
147-
* review.decide needs stable-ID → raw-ID translation on target.id.
147+
* trackChanges.decide needs stable-ID → raw-ID translation on target.id.
148148
*/
149149
const resolveReviewDecideId: PreInvokeHook = (input, context) => {
150150
const record = asRecord(input);
@@ -230,8 +230,8 @@ const flattenTextMutationReceipt: PostInvokeHook = (result) => {
230230
export const PRE_INVOKE_HOOKS: Partial<Record<CliExposedOperationId, PreInvokeHook>> = {
231231
// Track-changes get needs stable-ID → raw-ID translation
232232
'trackChanges.get': resolveTrackChangeId,
233-
// review.decide needs stable-ID → raw-ID translation on target.id
234-
'review.decide': resolveReviewDecideId,
233+
// trackChanges.decide needs stable-ID → raw-ID translation on target.id
234+
'trackChanges.decide': resolveReviewDecideId,
235235
};
236236

237237
/** Post-invoke: transform the raw invoke() result before envelope wrapping. */

apps/docs/CLAUDE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ Document API docs have mixed manual/generated ownership. Treat these paths as au
2121

2222
- `apps/docs/document-api/reference/*`: generated, committed to git (Mintlify deploys from git), do not hand-edit.
2323
- `packages/document-api/generated/*`: generated, **not in git**, do not hand-edit. Run `pnpm run generate:all` to produce.
24-
- `apps/docs/document-api/overview.mdx`: manual except for the block between:
24+
- `apps/docs/document-api/available-operations.mdx`: manual except for the block between:
2525
- `{/* DOC_API_OPERATIONS_START */}`
2626
- `{/* DOC_API_OPERATIONS_END */}`
2727

apps/docs/docs.json

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,15 @@
9494
"tag": "ALPHA",
9595
"pages": [
9696
"document-engine/overview",
97-
"document-api/overview",
97+
{
98+
"group": "Document API",
99+
"pages": [
100+
"document-api/overview",
101+
"document-api/reference/index",
102+
"document-api/common-workflows",
103+
"document-api/available-operations"
104+
]
105+
},
98106
"document-engine/sdks",
99107
"document-engine/cli",
100108
"document-engine/mcp"

0 commit comments

Comments
 (0)