@cleocode/cleo 2026.3.2 → 2026.3.6
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 +1 -3
- package/dist/cli/index.js +7381 -3507
- package/dist/cli/index.js.map +4 -4
- package/dist/mcp/index.js +5792 -2097
- package/dist/mcp/index.js.map +4 -4
- package/package.json +4 -4
- package/packages/ct-skills/index.js +1 -1
- package/packages/ct-skills/package.json +0 -2
- package/packages/ct-skills/profiles/core.json +1 -1
- package/packages/ct-skills/profiles/full.json +4 -5
- package/packages/ct-skills/profiles/minimal.json +3 -3
- package/packages/ct-skills/profiles/recommended.json +2 -2
- package/packages/ct-skills/provider-skills-map.json +97 -0
- package/packages/ct-skills/skills/_shared/skill-chaining-patterns.md +23 -26
- package/packages/ct-skills/skills/_shared/testing-framework-config.md +9 -9
- package/packages/ct-skills/skills/ct-cleo/SKILL.md +21 -1
- package/packages/ct-skills/skills/ct-dev-workflow/SKILL.md +1 -1
- package/packages/ct-skills/skills/ct-documentor/SKILL.md +1 -1
- package/packages/ct-skills/skills/ct-epic-architect/SKILL.md +1 -1
- package/packages/ct-skills/skills/ct-grade/SKILL.md +214 -0
- package/packages/ct-skills/skills/ct-orchestrator/SKILL.md +119 -43
- package/packages/ct-skills/skills/ct-orchestrator/orchestrator-prompt.txt +17 -0
- package/packages/ct-skills/skills/ct-orchestrator/references/orchestrator-patterns.md +1 -1
- package/packages/ct-skills/skills/ct-research-agent/SKILL.md +1 -1
- package/packages/ct-skills/skills/ct-spec-writer/SKILL.md +1 -1
- package/packages/ct-skills/skills/ct-task-executor/SKILL.md +1 -1
- package/packages/ct-skills/skills/ct-validator/SKILL.md +1 -1
- package/packages/ct-skills/skills/manifest.json +217 -947
- package/packages/ct-skills/skills.json +244 -3
- package/templates/CLEO-INJECTION.md +37 -0
- package/templates/README.md +4 -4
- package/templates/cleo-gitignore +3 -11
- package/templates/git-hooks/pre-commit +1 -1
- package/packages/ct-skills/protocols/agent-protocol.md +0 -260
- package/packages/ct-skills/protocols/artifact-publish.md +0 -587
- package/packages/ct-skills/protocols/consensus.md +0 -309
- package/packages/ct-skills/protocols/contribution.md +0 -375
- package/packages/ct-skills/protocols/decomposition.md +0 -352
- package/packages/ct-skills/protocols/implementation.md +0 -344
- package/packages/ct-skills/protocols/provenance.md +0 -600
- package/packages/ct-skills/protocols/release.md +0 -635
- package/packages/ct-skills/protocols/research.md +0 -248
- package/packages/ct-skills/protocols/specification.md +0 -287
- package/packages/ct-skills/protocols/testing.md +0 -346
- package/packages/ct-skills/protocols/validation.md +0 -229
- package/packages/ct-skills/skills/ct-gitbook/SKILL.md +0 -516
- package/packages/ct-skills/skills/ct-gitbook/assets/SUMMARY.md +0 -28
- package/packages/ct-skills/skills/ct-gitbook/assets/gitbook.yaml +0 -14
- package/packages/ct-skills/skills/ct-gitbook/references/api-sdk.md +0 -318
- package/packages/ct-skills/skills/ct-gitbook/references/auth-sso.md +0 -208
- package/packages/ct-skills/skills/ct-gitbook/references/change-requests.md +0 -169
- package/packages/ct-skills/skills/ct-gitbook/references/content-blocks.md +0 -230
- package/packages/ct-skills/skills/ct-gitbook/references/docs-sites.md +0 -202
- package/packages/ct-skills/skills/ct-gitbook/references/git-sync.md +0 -175
- package/packages/ct-skills/skills/ct-gitbook/references/llm-ready.md +0 -178
- package/packages/ct-skills/skills/ct-gitbook/references/migration.md +0 -263
- package/packages/ct-skills/skills/ct-library-implementer-bash/SKILL.md +0 -316
- package/packages/ct-skills/skills/ct-skill-lookup/SKILL.md +0 -179
- package/packages/ct-skills/skills/ct-test-writer-bats/SKILL.md +0 -347
- package/packages/ct-skills/skills/railway-platform/SKILL.md +0 -506
- package/packages/ct-skills/skills/railway-platform/_shared/scripts/railway-api.sh +0 -180
- package/packages/ct-skills/skills/railway-platform/_shared/scripts/railway-common.sh +0 -262
- package/packages/ct-skills/skills/railway-platform/references/01-getting-started.md +0 -149
- package/packages/ct-skills/skills/railway-platform/references/02-projects.md +0 -116
- package/packages/ct-skills/skills/railway-platform/references/03-services.md +0 -147
- package/packages/ct-skills/skills/railway-platform/references/04-deployments.md +0 -210
- package/packages/ct-skills/skills/railway-platform/references/05-databases.md +0 -142
- package/packages/ct-skills/skills/railway-platform/references/06-environments.md +0 -261
- package/packages/ct-skills/skills/railway-platform/references/07-domains.md +0 -139
- package/packages/ct-skills/skills/railway-platform/references/08-volumes.md +0 -533
- package/packages/ct-skills/skills/railway-platform/references/09-networking.md +0 -592
- package/packages/ct-skills/skills/railway-platform/references/10-cron.md +0 -488
- package/packages/ct-skills/skills/railway-platform/references/11-functions.md +0 -170
- package/packages/ct-skills/skills/railway-platform/references/12-monorepo.md +0 -294
- package/packages/ct-skills/skills/railway-platform/references/13-troubleshooting.md +0 -335
- package/packages/ct-skills/skills/railway-platform/references/14-railway-metal.md +0 -197
|
@@ -1,318 +0,0 @@
|
|
|
1
|
-
# @gitbook/api TypeScript SDK Reference
|
|
2
|
-
|
|
3
|
-
The official TypeScript SDK for the GitBook API. Works in Node.js and browsers.
|
|
4
|
-
|
|
5
|
-
## Installation
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
npm install @gitbook/api
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
## Client Initialization
|
|
12
|
-
|
|
13
|
-
```typescript
|
|
14
|
-
import { GitBookAPI } from '@gitbook/api';
|
|
15
|
-
|
|
16
|
-
// With explicit token
|
|
17
|
-
const client = new GitBookAPI({
|
|
18
|
-
authToken: 'gb_api_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
|
|
19
|
-
});
|
|
20
|
-
|
|
21
|
-
// From environment
|
|
22
|
-
const client = new GitBookAPI({
|
|
23
|
-
authToken: process.env.GITBOOK_API_TOKEN,
|
|
24
|
-
});
|
|
25
|
-
```
|
|
26
|
-
|
|
27
|
-
## Authentication
|
|
28
|
-
|
|
29
|
-
Generate an API token at `https://app.gitbook.com/account/developer`.
|
|
30
|
-
|
|
31
|
-
```typescript
|
|
32
|
-
// Verify authentication
|
|
33
|
-
const user = await client.user.getCurrentUser();
|
|
34
|
-
console.log(user.data.displayName);
|
|
35
|
-
// Returns: { data: { id, displayName, email, photoURL } }
|
|
36
|
-
```
|
|
37
|
-
|
|
38
|
-
Token scopes control access. Create tokens with the minimum required permissions.
|
|
39
|
-
|
|
40
|
-
## Organizations
|
|
41
|
-
|
|
42
|
-
```typescript
|
|
43
|
-
// List all organizations for the authenticated user
|
|
44
|
-
const orgs = await client.orgs.listOrganizationsForAuthenticatedUser();
|
|
45
|
-
for (const org of orgs.data.items) {
|
|
46
|
-
console.log(`${org.title} (${org.id})`);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
// Get organization by ID
|
|
50
|
-
const org = await client.orgs.getOrganizationById(orgId);
|
|
51
|
-
|
|
52
|
-
// List members
|
|
53
|
-
const members = await client.orgs.listMembersInOrganization(orgId);
|
|
54
|
-
|
|
55
|
-
// Invite members
|
|
56
|
-
await client.orgs.inviteMembersToOrganization(orgId, {
|
|
57
|
-
emails: ['user@example.com'],
|
|
58
|
-
role: 'editor', // admin | creator | editor | reviewer | reader
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
// Update member role
|
|
62
|
-
await client.orgs.updateMemberInOrganization(orgId, memberId, {
|
|
63
|
-
role: 'admin',
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
// Remove member
|
|
67
|
-
await client.orgs.removeMemberFromOrganization(orgId, memberId);
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
## Spaces
|
|
71
|
-
|
|
72
|
-
```typescript
|
|
73
|
-
// List spaces in an organization
|
|
74
|
-
const spaces = await client.orgs.listSpacesInOrganization(orgId);
|
|
75
|
-
|
|
76
|
-
// Get space by ID
|
|
77
|
-
const space = await client.spaces.getSpaceById(spaceId);
|
|
78
|
-
|
|
79
|
-
// Create space
|
|
80
|
-
const newSpace = await client.orgs.createSpace(orgId, {
|
|
81
|
-
title: 'API Documentation',
|
|
82
|
-
visibility: 'public', // public | private | unlisted
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
// Update space
|
|
86
|
-
await client.spaces.updateSpace(spaceId, {
|
|
87
|
-
title: 'Updated Title',
|
|
88
|
-
visibility: 'private',
|
|
89
|
-
});
|
|
90
|
-
|
|
91
|
-
// Delete space
|
|
92
|
-
await client.spaces.deleteSpace(spaceId);
|
|
93
|
-
```
|
|
94
|
-
|
|
95
|
-
## Content & Pages
|
|
96
|
-
|
|
97
|
-
```typescript
|
|
98
|
-
// List pages in a space (returns tree structure)
|
|
99
|
-
const pages = await client.spaces.listPagesInSpace(spaceId);
|
|
100
|
-
for (const page of pages.data.pages) {
|
|
101
|
-
console.log(`${page.title} — ${page.path}`);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Get a specific page
|
|
105
|
-
const page = await client.spaces.getPageInSpace(spaceId, pageId);
|
|
106
|
-
|
|
107
|
-
// Search content
|
|
108
|
-
const results = await client.spaces.searchSpaceContent(spaceId, {
|
|
109
|
-
query: 'authentication',
|
|
110
|
-
});
|
|
111
|
-
|
|
112
|
-
// Import content from external source
|
|
113
|
-
await client.spaces.importContentInSpace(spaceId, {
|
|
114
|
-
source: {
|
|
115
|
-
type: 'github',
|
|
116
|
-
url: 'https://github.com/org/docs-repo',
|
|
117
|
-
ref: 'main',
|
|
118
|
-
},
|
|
119
|
-
});
|
|
120
|
-
```
|
|
121
|
-
|
|
122
|
-
## Content Variants
|
|
123
|
-
|
|
124
|
-
```typescript
|
|
125
|
-
// List variants for a space
|
|
126
|
-
const variants = await client.spaces.listVariantsInSpace(spaceId);
|
|
127
|
-
|
|
128
|
-
// Create a variant
|
|
129
|
-
const variant = await client.spaces.createVariant(spaceId, {
|
|
130
|
-
title: 'v2.0',
|
|
131
|
-
slug: 'v2',
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
// Set default variant
|
|
135
|
-
await client.spaces.setDefaultVariant(spaceId, variantId);
|
|
136
|
-
|
|
137
|
-
// Get variant content
|
|
138
|
-
const content = await client.spaces.listPagesInVariant(spaceId, variantId);
|
|
139
|
-
|
|
140
|
-
// Delete variant
|
|
141
|
-
await client.spaces.deleteVariant(spaceId, variantId);
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
## Collections
|
|
145
|
-
|
|
146
|
-
```typescript
|
|
147
|
-
// List collections
|
|
148
|
-
const collections = await client.orgs.listCollectionsInOrganization(orgId);
|
|
149
|
-
|
|
150
|
-
// Create collection
|
|
151
|
-
const collection = await client.orgs.createCollection(orgId, {
|
|
152
|
-
title: 'Product Docs',
|
|
153
|
-
description: 'All product documentation',
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
// Add space to collection
|
|
157
|
-
await client.collections.addSpaceToCollection(collectionId, spaceId);
|
|
158
|
-
|
|
159
|
-
// List spaces in collection
|
|
160
|
-
const spaces = await client.collections.listSpacesInCollection(collectionId);
|
|
161
|
-
|
|
162
|
-
// Remove space from collection
|
|
163
|
-
await client.collections.removeSpaceFromCollection(collectionId, spaceId);
|
|
164
|
-
```
|
|
165
|
-
|
|
166
|
-
## Docs Sites
|
|
167
|
-
|
|
168
|
-
```typescript
|
|
169
|
-
// Create a docs site
|
|
170
|
-
const site = await client.orgs.createSite(orgId, {
|
|
171
|
-
title: 'Developer Documentation',
|
|
172
|
-
});
|
|
173
|
-
|
|
174
|
-
// List sites
|
|
175
|
-
const sites = await client.orgs.listSitesInOrganization(orgId);
|
|
176
|
-
|
|
177
|
-
// Get site
|
|
178
|
-
const site = await client.sites.getSiteById(siteId);
|
|
179
|
-
|
|
180
|
-
// Update site customization
|
|
181
|
-
await client.sites.updateSiteCustomization(siteId, {
|
|
182
|
-
hostname: 'docs.example.com',
|
|
183
|
-
styling: {
|
|
184
|
-
primaryColor: '#0066FF',
|
|
185
|
-
font: 'Inter',
|
|
186
|
-
},
|
|
187
|
-
themes: {
|
|
188
|
-
default: 'light',
|
|
189
|
-
toggleable: true,
|
|
190
|
-
},
|
|
191
|
-
favicon: 'https://example.com/favicon.ico',
|
|
192
|
-
logo: {
|
|
193
|
-
light: 'https://example.com/logo-light.png',
|
|
194
|
-
dark: 'https://example.com/logo-dark.png',
|
|
195
|
-
},
|
|
196
|
-
});
|
|
197
|
-
|
|
198
|
-
// Delete site
|
|
199
|
-
await client.sites.deleteSite(siteId);
|
|
200
|
-
```
|
|
201
|
-
|
|
202
|
-
## Site Sections
|
|
203
|
-
|
|
204
|
-
```typescript
|
|
205
|
-
// Add a section to a site
|
|
206
|
-
await client.sites.addSiteSection(siteId, {
|
|
207
|
-
spaceId: spaceId,
|
|
208
|
-
title: 'API Reference',
|
|
209
|
-
});
|
|
210
|
-
|
|
211
|
-
// List sections
|
|
212
|
-
const sections = await client.sites.listSiteSections(siteId);
|
|
213
|
-
|
|
214
|
-
// Update section
|
|
215
|
-
await client.sites.updateSiteSection(siteId, sectionId, {
|
|
216
|
-
title: 'Updated Section Title',
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
// Remove section
|
|
220
|
-
await client.sites.removeSiteSection(siteId, sectionId);
|
|
221
|
-
|
|
222
|
-
// Create section group (nested navigation)
|
|
223
|
-
await client.sites.addSiteSectionGroup(siteId, {
|
|
224
|
-
title: 'Products',
|
|
225
|
-
sections: [sectionId1, sectionId2],
|
|
226
|
-
});
|
|
227
|
-
```
|
|
228
|
-
|
|
229
|
-
## Change Requests
|
|
230
|
-
|
|
231
|
-
```typescript
|
|
232
|
-
// Create a change request
|
|
233
|
-
const cr = await client.spaces.createChangeRequest(spaceId, {
|
|
234
|
-
subject: 'Update authentication guide',
|
|
235
|
-
});
|
|
236
|
-
|
|
237
|
-
// List change requests
|
|
238
|
-
const changeRequests = await client.spaces.listChangeRequests(spaceId);
|
|
239
|
-
|
|
240
|
-
// Get change request details
|
|
241
|
-
const detail = await client.spaces.getChangeRequest(spaceId, crId);
|
|
242
|
-
|
|
243
|
-
// Merge change request
|
|
244
|
-
await client.spaces.mergeChangeRequest(spaceId, crId);
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
## Error Handling
|
|
248
|
-
|
|
249
|
-
The SDK throws typed errors for API failures:
|
|
250
|
-
|
|
251
|
-
```typescript
|
|
252
|
-
import { GitBookAPI, GitBookAPIError } from '@gitbook/api';
|
|
253
|
-
|
|
254
|
-
try {
|
|
255
|
-
await client.spaces.getSpaceById('invalid-id');
|
|
256
|
-
} catch (error) {
|
|
257
|
-
if (error instanceof GitBookAPIError) {
|
|
258
|
-
console.error(`API Error ${error.statusCode}: ${error.message}`);
|
|
259
|
-
// error.statusCode — HTTP status (401, 403, 404, etc.)
|
|
260
|
-
// error.message — Human-readable error description
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
```
|
|
264
|
-
|
|
265
|
-
### Common Error Codes
|
|
266
|
-
|
|
267
|
-
| Status | Meaning | Action |
|
|
268
|
-
|--------|---------|--------|
|
|
269
|
-
| 401 | Unauthorized | Check/regenerate API token |
|
|
270
|
-
| 403 | Forbidden | Token lacks required scope |
|
|
271
|
-
| 404 | Not Found | Verify resource ID |
|
|
272
|
-
| 429 | Rate Limited | Back off and retry |
|
|
273
|
-
| 500 | Server Error | Retry with exponential backoff |
|
|
274
|
-
|
|
275
|
-
## Rate Limiting
|
|
276
|
-
|
|
277
|
-
The API enforces rate limits. Handle 429 responses with exponential backoff:
|
|
278
|
-
|
|
279
|
-
```typescript
|
|
280
|
-
async function withRetry<T>(fn: () => Promise<T>, maxRetries = 3): Promise<T> {
|
|
281
|
-
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
282
|
-
try {
|
|
283
|
-
return await fn();
|
|
284
|
-
} catch (error) {
|
|
285
|
-
if (error instanceof GitBookAPIError && error.statusCode === 429 && attempt < maxRetries) {
|
|
286
|
-
const delay = Math.pow(2, attempt) * 1000;
|
|
287
|
-
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
288
|
-
continue;
|
|
289
|
-
}
|
|
290
|
-
throw error;
|
|
291
|
-
}
|
|
292
|
-
}
|
|
293
|
-
throw new Error('Max retries exceeded');
|
|
294
|
-
}
|
|
295
|
-
```
|
|
296
|
-
|
|
297
|
-
## Pagination
|
|
298
|
-
|
|
299
|
-
List endpoints return paginated results:
|
|
300
|
-
|
|
301
|
-
```typescript
|
|
302
|
-
// Manual pagination
|
|
303
|
-
let page = await client.orgs.listSpacesInOrganization(orgId);
|
|
304
|
-
const allSpaces = [...page.data.items];
|
|
305
|
-
|
|
306
|
-
while (page.data.next) {
|
|
307
|
-
page = await client.orgs.listSpacesInOrganization(orgId, {
|
|
308
|
-
page: page.data.next,
|
|
309
|
-
});
|
|
310
|
-
allSpaces.push(...page.data.items);
|
|
311
|
-
}
|
|
312
|
-
```
|
|
313
|
-
|
|
314
|
-
## Resources
|
|
315
|
-
|
|
316
|
-
- **npm**: https://www.npmjs.com/package/@gitbook/api
|
|
317
|
-
- **API Docs**: https://developer.gitbook.com/
|
|
318
|
-
- **API Reference**: https://gitbook.com/docs/developers/gitbook-api/api-reference
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
# Authentication & SSO Reference
|
|
2
|
-
|
|
3
|
-
Visitor authentication, SSO/SAML, and identity provider setup for GitBook.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
GitBook provides two layers of authentication:
|
|
8
|
-
|
|
9
|
-
1. **Organization SSO** — Controls who can edit documentation (team members)
|
|
10
|
-
2. **Visitor Authentication** — Controls who can view published documentation (end users)
|
|
11
|
-
|
|
12
|
-
## Visitor Authentication
|
|
13
|
-
|
|
14
|
-
Protect published docs behind a login screen. When enabled, visitors must authenticate through your identity provider before viewing content.
|
|
15
|
-
|
|
16
|
-
### Supported Providers
|
|
17
|
-
|
|
18
|
-
| Provider | Type | GitBook Integration |
|
|
19
|
-
|----------|------|-------------------|
|
|
20
|
-
| Auth0 | Native | Install from integrations |
|
|
21
|
-
| Okta | Native | Install from integrations |
|
|
22
|
-
| Azure AD | Native | Install from integrations |
|
|
23
|
-
| AWS Cognito | Native | Install from integrations |
|
|
24
|
-
| Custom OIDC | Manual | Build your own backend |
|
|
25
|
-
|
|
26
|
-
### Enabling Authenticated Access
|
|
27
|
-
|
|
28
|
-
1. Open your site's settings
|
|
29
|
-
2. Navigate to **Audience**
|
|
30
|
-
3. Select **Authenticated access**
|
|
31
|
-
4. Choose your identity provider
|
|
32
|
-
5. Configure the provider settings
|
|
33
|
-
|
|
34
|
-
## Auth0 Setup
|
|
35
|
-
|
|
36
|
-
### 1. Create Auth0 Application
|
|
37
|
-
|
|
38
|
-
In Auth0 dashboard:
|
|
39
|
-
- Create a new **Regular Web Application**
|
|
40
|
-
- Note the Domain, Client ID, and Client Secret
|
|
41
|
-
|
|
42
|
-
### 2. Configure Callback URLs
|
|
43
|
-
|
|
44
|
-
Add your GitBook docs URL as an allowed callback:
|
|
45
|
-
```
|
|
46
|
-
https://docs.example.com/~gitbook/auth/callback
|
|
47
|
-
```
|
|
48
|
-
|
|
49
|
-
### 3. Install GitBook Integration
|
|
50
|
-
|
|
51
|
-
In GitBook:
|
|
52
|
-
1. Go to site settings > Integrations
|
|
53
|
-
2. Install the **Auth0** integration
|
|
54
|
-
3. Enter your Auth0 Domain, Client ID, and Client Secret
|
|
55
|
-
|
|
56
|
-
### 4. Configure Claims for Adaptive Content
|
|
57
|
-
|
|
58
|
-
To use Auth0 with adaptive content, add an Auth0 Action or Rule that includes custom claims in the ID token:
|
|
59
|
-
|
|
60
|
-
```javascript
|
|
61
|
-
// Auth0 Action — Add custom claims
|
|
62
|
-
exports.onExecutePostLogin = async (event, api) => {
|
|
63
|
-
const namespace = 'https://docs.example.com/';
|
|
64
|
-
api.idToken.setCustomClaim(`${namespace}plan`, event.user.app_metadata?.plan || 'free');
|
|
65
|
-
api.idToken.setCustomClaim(`${namespace}role`, event.user.app_metadata?.role || 'user');
|
|
66
|
-
};
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
These claims become available for adaptive content conditions in GitBook.
|
|
70
|
-
|
|
71
|
-
## Okta Setup
|
|
72
|
-
|
|
73
|
-
### 1. Create Okta Application
|
|
74
|
-
|
|
75
|
-
In Okta admin console:
|
|
76
|
-
- Create a new **Web Application**
|
|
77
|
-
- Set the sign-in redirect URI to your GitBook callback URL
|
|
78
|
-
- Note the Client ID and Client Secret
|
|
79
|
-
|
|
80
|
-
### 2. Configure in GitBook
|
|
81
|
-
|
|
82
|
-
Install the Okta integration and provide:
|
|
83
|
-
- Okta domain (e.g., `dev-12345.okta.com`)
|
|
84
|
-
- Client ID
|
|
85
|
-
- Client Secret
|
|
86
|
-
|
|
87
|
-
### 3. Claims for Adaptive Content
|
|
88
|
-
|
|
89
|
-
Configure Okta to include custom claims in the authentication token:
|
|
90
|
-
|
|
91
|
-
1. Go to **Security > API > Authorization Servers**
|
|
92
|
-
2. Select your authorization server
|
|
93
|
-
3. Add custom claims (e.g., `plan`, `role`) with values from user profile attributes
|
|
94
|
-
|
|
95
|
-
## Azure AD Setup
|
|
96
|
-
|
|
97
|
-
### 1. Register Application
|
|
98
|
-
|
|
99
|
-
In Azure portal:
|
|
100
|
-
- Navigate to **Azure Active Directory > App registrations**
|
|
101
|
-
- Register a new application
|
|
102
|
-
- Add redirect URI: `https://docs.example.com/~gitbook/auth/callback`
|
|
103
|
-
- Create a client secret
|
|
104
|
-
|
|
105
|
-
### 2. Configure in GitBook
|
|
106
|
-
|
|
107
|
-
Install the Azure AD integration and provide:
|
|
108
|
-
- Tenant ID
|
|
109
|
-
- Client ID
|
|
110
|
-
- Client Secret
|
|
111
|
-
|
|
112
|
-
### Known Limitation
|
|
113
|
-
|
|
114
|
-
The Azure integration removes heading URL fragments upon authentication. Deep links to specific headings may not work as expected after the auth redirect.
|
|
115
|
-
|
|
116
|
-
## Custom OIDC Backend
|
|
117
|
-
|
|
118
|
-
For providers not natively supported, implement a custom authentication backend:
|
|
119
|
-
|
|
120
|
-
### Requirements
|
|
121
|
-
|
|
122
|
-
Your backend must:
|
|
123
|
-
1. Handle the OIDC authorization flow
|
|
124
|
-
2. Redirect to GitBook with a signed JWT
|
|
125
|
-
3. Include required claims in the JWT payload
|
|
126
|
-
|
|
127
|
-
### JWT Payload
|
|
128
|
-
|
|
129
|
-
```json
|
|
130
|
-
{
|
|
131
|
-
"sub": "user-id",
|
|
132
|
-
"email": "user@example.com",
|
|
133
|
-
"name": "User Name",
|
|
134
|
-
"iat": 1706000000,
|
|
135
|
-
"exp": 1706003600,
|
|
136
|
-
"custom_claims": {
|
|
137
|
-
"plan": "enterprise",
|
|
138
|
-
"role": "admin"
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
```
|
|
142
|
-
|
|
143
|
-
### Flow
|
|
144
|
-
|
|
145
|
-
1. Visitor accesses protected docs
|
|
146
|
-
2. GitBook redirects to your auth endpoint
|
|
147
|
-
3. Your backend authenticates the user
|
|
148
|
-
4. Your backend redirects back to GitBook with a signed JWT
|
|
149
|
-
5. GitBook validates the JWT and grants access
|
|
150
|
-
|
|
151
|
-
## Organization SSO
|
|
152
|
-
|
|
153
|
-
Separate from visitor auth — this controls team member access to the GitBook organization.
|
|
154
|
-
|
|
155
|
-
### Email Domain SSO
|
|
156
|
-
|
|
157
|
-
Allow anyone with an email from your domain to join your organization:
|
|
158
|
-
|
|
159
|
-
1. Go to **Organization settings > SSO**
|
|
160
|
-
2. Add your verified email domain
|
|
161
|
-
3. Team members can sign in with their work email
|
|
162
|
-
|
|
163
|
-
### SAML 2.0
|
|
164
|
-
|
|
165
|
-
For enterprise identity providers:
|
|
166
|
-
|
|
167
|
-
1. Go to **Organization settings > SSO > SAML**
|
|
168
|
-
2. Provide your IdP's metadata URL or upload metadata XML
|
|
169
|
-
3. Configure attribute mapping:
|
|
170
|
-
- `email` → User email
|
|
171
|
-
- `firstName` → First name
|
|
172
|
-
- `lastName` → Last name
|
|
173
|
-
4. Enable SAML SSO
|
|
174
|
-
|
|
175
|
-
### Supported SAML IdPs
|
|
176
|
-
|
|
177
|
-
Any SAML 2.0 compliant provider works, including:
|
|
178
|
-
- Okta
|
|
179
|
-
- Azure AD
|
|
180
|
-
- OneLogin
|
|
181
|
-
- Google Workspace
|
|
182
|
-
- PingFederate
|
|
183
|
-
- JumpCloud
|
|
184
|
-
|
|
185
|
-
## Security Certifications
|
|
186
|
-
|
|
187
|
-
GitBook holds:
|
|
188
|
-
- **SOC 2 Type II** — Security, availability, and confidentiality
|
|
189
|
-
- **ISO 27001** — Information security management
|
|
190
|
-
|
|
191
|
-
## Access Control Roles
|
|
192
|
-
|
|
193
|
-
| Role | Permissions |
|
|
194
|
-
|------|------------|
|
|
195
|
-
| Admin | Full organization management |
|
|
196
|
-
| Creator | Create spaces and content |
|
|
197
|
-
| Editor | Edit existing content |
|
|
198
|
-
| Reviewer | Review change requests, add comments |
|
|
199
|
-
| Reader | View private content only |
|
|
200
|
-
|
|
201
|
-
## Resources
|
|
202
|
-
|
|
203
|
-
- **Visitor Authentication**: https://docs.gitbook.com/publishing-documentation/visitor-authentication
|
|
204
|
-
- **SSO & SAML**: https://gitbook.com/docs/account-management/sso-and-saml
|
|
205
|
-
- **Auth0 Setup**: https://gitbook.com/docs/publishing-documentation/authenticated-access/setting-up-auth0
|
|
206
|
-
- **Okta Setup**: https://gitbook.com/docs/publishing-documentation/authenticated-access/setting-up-okta
|
|
207
|
-
- **Azure AD Setup**: https://gitbook.com/docs/publishing-documentation/authenticated-access/setting-up-azure-ad
|
|
208
|
-
- **Authenticated Access**: https://gitbook.com/docs/publishing-documentation/authenticated-access/enabling-authenticated-access
|
|
@@ -1,169 +0,0 @@
|
|
|
1
|
-
# Change Requests Reference
|
|
2
|
-
|
|
3
|
-
Branch-and-merge editing workflow with review, plus adaptive content personalization.
|
|
4
|
-
|
|
5
|
-
## Overview
|
|
6
|
-
|
|
7
|
-
A Change Request (CR) is an isolated copy of your space's content — similar to a Git branch or pull request. You can edit freely in a CR without affecting live documentation, then merge when ready.
|
|
8
|
-
|
|
9
|
-
## Workflow
|
|
10
|
-
|
|
11
|
-
### 1. Create a Change Request
|
|
12
|
-
|
|
13
|
-
**In the UI**: Click **New change request** in the space sidebar.
|
|
14
|
-
|
|
15
|
-
**Via API**:
|
|
16
|
-
```typescript
|
|
17
|
-
const cr = await client.spaces.createChangeRequest(spaceId, {
|
|
18
|
-
subject: 'Update authentication guide',
|
|
19
|
-
});
|
|
20
|
-
console.log(`Created CR: ${cr.data.id}`);
|
|
21
|
-
```
|
|
22
|
-
|
|
23
|
-
### 2. Make Edits
|
|
24
|
-
|
|
25
|
-
- Edit pages in the GitBook editor within the CR context
|
|
26
|
-
- Add, remove, or reorder pages
|
|
27
|
-
- Upload new assets
|
|
28
|
-
- Use the Docs Agent (AI) to generate or refine content within the CR
|
|
29
|
-
|
|
30
|
-
All changes are isolated from the live site.
|
|
31
|
-
|
|
32
|
-
### 3. Request Review
|
|
33
|
-
|
|
34
|
-
- Tag reviewers in the CR's **Overview** tab
|
|
35
|
-
- Reviewers are notified and can approve, request changes, or comment
|
|
36
|
-
- Docs Agent can also be assigned as a reviewer for AI-assisted feedback
|
|
37
|
-
|
|
38
|
-
### 4. Review
|
|
39
|
-
|
|
40
|
-
Reviewers can:
|
|
41
|
-
- View a diff of all changes
|
|
42
|
-
- Add inline comments on specific content
|
|
43
|
-
- Approve or request changes
|
|
44
|
-
- Previous reviews are marked as **outdated** when the CR is updated
|
|
45
|
-
|
|
46
|
-
### 5. Merge
|
|
47
|
-
|
|
48
|
-
```typescript
|
|
49
|
-
await client.spaces.mergeChangeRequest(spaceId, crId);
|
|
50
|
-
```
|
|
51
|
-
|
|
52
|
-
Merging applies all changes to the main content and publishes them to the live site immediately.
|
|
53
|
-
|
|
54
|
-
## API Operations
|
|
55
|
-
|
|
56
|
-
```typescript
|
|
57
|
-
// Create change request
|
|
58
|
-
const cr = await client.spaces.createChangeRequest(spaceId, {
|
|
59
|
-
subject: 'Add new API endpoints documentation',
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
// List change requests for a space
|
|
63
|
-
const list = await client.spaces.listChangeRequests(spaceId);
|
|
64
|
-
for (const item of list.data.items) {
|
|
65
|
-
console.log(`${item.subject} — ${item.status}`);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
// Get change request details
|
|
69
|
-
const detail = await client.spaces.getChangeRequest(spaceId, crId);
|
|
70
|
-
|
|
71
|
-
// Get content diff
|
|
72
|
-
const diff = await client.spaces.getChangeRequestDiff(spaceId, crId);
|
|
73
|
-
|
|
74
|
-
// Merge
|
|
75
|
-
await client.spaces.mergeChangeRequest(spaceId, crId);
|
|
76
|
-
|
|
77
|
-
// Close without merging
|
|
78
|
-
await client.spaces.closeChangeRequest(spaceId, crId);
|
|
79
|
-
```
|
|
80
|
-
|
|
81
|
-
## Review Features (October 2025 Updates)
|
|
82
|
-
|
|
83
|
-
- **Improved sidebar**: Filter CRs by creator, participant, or review status
|
|
84
|
-
- **Shortcut filters**: Quick access to "awaiting my review" and "created by me"
|
|
85
|
-
- **Outdated reviews**: Automatically marked when new changes are pushed
|
|
86
|
-
- **Re-request review**: Single-action button to request a fresh review
|
|
87
|
-
- **Review badges**: Visual indicators for review status on each CR
|
|
88
|
-
|
|
89
|
-
## Docs Agent Integration
|
|
90
|
-
|
|
91
|
-
The Docs Agent is GitBook's AI assistant that can:
|
|
92
|
-
- Generate content within a change request
|
|
93
|
-
- Review changes and suggest improvements
|
|
94
|
-
- Be assigned as a reviewer alongside human reviewers
|
|
95
|
-
- Provide automated quality feedback
|
|
96
|
-
|
|
97
|
-
## Change Request Statuses
|
|
98
|
-
|
|
99
|
-
| Status | Description |
|
|
100
|
-
|--------|-------------|
|
|
101
|
-
| `open` | Active, editable |
|
|
102
|
-
| `merged` | Changes applied to main content |
|
|
103
|
-
| `closed` | Discarded without merging |
|
|
104
|
-
|
|
105
|
-
## Best Practices
|
|
106
|
-
|
|
107
|
-
1. **One topic per CR** — Keep changes focused for easier review
|
|
108
|
-
2. **Descriptive subjects** — Use clear subjects like "Add OAuth2 guide" not "Update docs"
|
|
109
|
-
3. **Tag reviewers early** — Don't wait until the CR is complete to request feedback
|
|
110
|
-
4. **Use Docs Agent** — Let AI catch formatting issues and suggest improvements
|
|
111
|
-
5. **Merge promptly** — Long-lived CRs increase conflict risk
|
|
112
|
-
|
|
113
|
-
---
|
|
114
|
-
|
|
115
|
-
## Adaptive Content
|
|
116
|
-
|
|
117
|
-
Adaptive content personalizes published documentation based on visitor attributes (claims).
|
|
118
|
-
|
|
119
|
-
### How It Works
|
|
120
|
-
|
|
121
|
-
1. Visitors arrive with **claims** — data about who they are (role, plan, region, etc.)
|
|
122
|
-
2. Claims are passed via cookies, URL parameters, feature flags, or authentication providers
|
|
123
|
-
3. GitBook dynamically shows/hides content based on claim values
|
|
124
|
-
|
|
125
|
-
### Methods for Passing Claims
|
|
126
|
-
|
|
127
|
-
| Method | Use Case |
|
|
128
|
-
|--------|----------|
|
|
129
|
-
| Cookies | Public or signed cookies set by your app |
|
|
130
|
-
| URL parameters | `?plan=enterprise&role=admin` |
|
|
131
|
-
| Feature flag provider | LaunchDarkly, Split, etc. |
|
|
132
|
-
| Authentication provider | Auth0, Okta, Azure AD claims |
|
|
133
|
-
|
|
134
|
-
### What You Can Adapt
|
|
135
|
-
|
|
136
|
-
- **Pages**: Show/hide entire pages based on claims
|
|
137
|
-
- **Sections**: Show/hide page sections
|
|
138
|
-
- **Header links**: Dynamic navigation based on user type
|
|
139
|
-
- **Content blocks**: Conditional content within a page
|
|
140
|
-
|
|
141
|
-
### Example Use Cases
|
|
142
|
-
|
|
143
|
-
- Show "Getting Started" to new users, "Advanced API" to experienced users
|
|
144
|
-
- Display pre-filled API keys for authenticated developers
|
|
145
|
-
- Show enterprise features only to enterprise plan users
|
|
146
|
-
- Present region-specific compliance information
|
|
147
|
-
- Hide internal-only documentation from external visitors
|
|
148
|
-
|
|
149
|
-
### Configuration
|
|
150
|
-
|
|
151
|
-
Enable adaptive content in site settings. Requires an Ultimate plan and a custom domain.
|
|
152
|
-
|
|
153
|
-
```typescript
|
|
154
|
-
// Site must have authenticated access enabled
|
|
155
|
-
// Claims are then available for content conditions
|
|
156
|
-
await client.sites.updateSiteCustomization(siteId, {
|
|
157
|
-
audience: 'authenticated',
|
|
158
|
-
});
|
|
159
|
-
```
|
|
160
|
-
|
|
161
|
-
### AI Assistant Integration
|
|
162
|
-
|
|
163
|
-
GitBook Assistant uses adaptive content context to provide personalized answers. When connected to MCP servers, the assistant can pull information from third-party sources and trigger actions based on visitor claims.
|
|
164
|
-
|
|
165
|
-
## Resources
|
|
166
|
-
|
|
167
|
-
- **Change Requests**: https://gitbook.com/docs/collaboration/change-requests
|
|
168
|
-
- **Adaptive Content**: https://gitbook.com/docs/publishing-documentation/adaptive-content
|
|
169
|
-
- **Personalization Guide**: https://gitbook.com/docs/guides/docs-personalization-and-authentication/setting-up-adaptive-content
|