Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ mise run install

[`sources.yml`](sources.yml) lists each source repository, where it's mounted,
and which tags to publish; `dev` is a branch built as an extra, unreleased
version. The assembler ([`assembler/`](assembler/)) fetches only the docs
version. A version with `local: <dir>` instead of a `ref` is built from that
directory in this repo; the SDK placeholders in [`stubs/`](stubs/) use it. The assembler ([`assembler/`](assembler/)) fetches only the docs
directory at each ref, reads it in its own format (Fern `index.yml`, mdBook
`SUMMARY.md`, or `docset.yml`), and writes the Starlight content, navigation,
and Markdown copies. The commits it used are recorded in
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ the docs, such as the landing page, in [`website/`](website/).
| Docset | Repository | Path | Dev branch |
| --------- | ------------------------------------------------------------------- | ----------- | ---------- |
| OpenShell | [ai-openshell/openshell](https://github.com/ai-openshell/openshell) | `docs/` | `main` |
| Go SDK | [ai-openshell/sdk-go](https://github.com/ai-openshell/sdk-go) | `docs/src/` | `main` |

## How it works

Expand All @@ -27,6 +28,9 @@ at `/docs/`, all with one site bar and one search. Every page also has a
Markdown copy for agents at its URL plus `.md`. The site is hosted on Netlify
under the CNCF's account.

The Python, TypeScript, and Rust SDKs have placeholder pages from
[`stubs/`](stubs/) until their docs move out of the core docs.

To publish a new release, add its tag to `sources.yml`.

## Run it locally
Expand Down
9 changes: 6 additions & 3 deletions assembler/assemble.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -97,9 +97,12 @@ for (const [id, src] of Object.entries(manifest.sources)) {
src,
name: v.name ?? v.ref.replace(/^v/, ''),
dev: false,
repo: v.repo ?? src.repo,
ref: v.ref,
subdir: v.path ?? src.path,
// A version can come from a directory in this repo (`local`) instead of
// a fetched ref, such as a placeholder for a docset with no docs yet.
repo: v.local ? manifest.site.repo : (v.repo ?? src.repo),
ref: v.local ? 'local' : v.ref,
subdir: v.local ? '' : (v.path ?? src.path),
local: v.local && path.join(root, v.local),
});
const own = wanted.filter((w) => w.id === id);
(own.find((w) => !w.dev) ?? own[0]).latest = true;
Expand Down
45 changes: 44 additions & 1 deletion sources.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@
# records the commit in build/sources.lock.json.
#
# Every source has its own versions, newest first. The first one is "latest".
# `dev` (optional) is a branch built as an extra, unreleased version.
# `dev` (optional) is a branch built as an extra, unreleased version. A version
# with `local: <dir>` instead of a `ref` is built from that directory in this
# repo.
#
# The newest release is published at /<mount>/<page>, with no version in the
# URL; every other version at /<mount>/<version>/<page>. /<mount>/latest/<page>
Expand All @@ -31,6 +33,11 @@ topics:
- id: core
label: Core
sources: [core]
- id: sdks
label: SDKs
description: Client libraries for the OpenShell gateway API.
intro: topics/sdks.mdx
sources: [sdk-go, sdk-python, sdk-typescript, sdk-rust]

sources:
core:
Expand All @@ -44,3 +51,39 @@ sources:
- { name: "0.1.9", ref: v0.1.9 }
- { name: "0.1.8", ref: v0.1.8 }
- { name: "0.1.7", ref: v0.1.7 }

sdk-go:
title: Go SDK
description: Go client for services and command-line tools.
mount: sdks/go
repo: ai-openshell/sdk-go
path: docs/src
dev: { ref: main }
versions:
- { name: "0.1.9", ref: v0.1.9 }
- { name: "0.1.8", ref: v0.1.8 }
- { name: "0.1.7", ref: v0.1.7 }

# The other SDKs don't publish docs yet: each has a placeholder page from
# stubs/ in this repo (a version with `local:` instead of a ref) until its
# docs move out of the core docs.
sdk-python:
title: Python SDK
description: Python client for the OpenShell gateway API.
mount: sdks/python
versions:
- { name: preview, local: stubs/sdk-python }

sdk-typescript:
title: TypeScript SDK
description: TypeScript client for the OpenShell gateway API.
mount: sdks/typescript
versions:
- { name: preview, local: stubs/sdk-typescript }

sdk-rust:
title: Rust SDK
description: Rust client for the OpenShell gateway API.
mount: sdks/rust
versions:
- { name: preview, local: stubs/sdk-rust }
6 changes: 6 additions & 0 deletions stubs/sdk-python/docset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Placeholder until the Python SDK publishes its own docs (see sources.yml).

title: Python SDK
nav:
- page: index.mdx
11 changes: 11 additions & 0 deletions stubs/sdk-python/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# SPDX-License-Identifier: Apache-2.0
title: Python SDK
description: Python client for the OpenShell gateway API.
---

<Note>
The Python SDK docs will move here from the core docs. Until then, see the [Python SDK page](core://sdk/python) in the core docs.
</Note>

The SDK lives in [ai-openshell/sdk-python](https://github.com/ai-openshell/sdk-python) and is published to PyPI as `openshell`.
6 changes: 6 additions & 0 deletions stubs/sdk-rust/docset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Placeholder until the Rust SDK publishes its own docs (see sources.yml).

title: Rust SDK
nav:
- page: index.mdx
11 changes: 11 additions & 0 deletions stubs/sdk-rust/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# SPDX-License-Identifier: Apache-2.0
title: Rust SDK
description: Rust client for the OpenShell gateway API.
---

<Note>
The Rust SDK docs will move here from the core docs. Until then, see the [Rust SDK page](core://sdk/rust) in the core docs.
</Note>

The SDK is the `openshell-sdk` crate in [ai-openshell/openshell](https://github.com/ai-openshell/openshell/tree/main/crates/openshell-sdk).
6 changes: 6 additions & 0 deletions stubs/sdk-typescript/docset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
# Placeholder until the TypeScript SDK publishes its own docs (see sources.yml).

title: TypeScript SDK
nav:
- page: index.mdx
11 changes: 11 additions & 0 deletions stubs/sdk-typescript/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
# SPDX-License-Identifier: Apache-2.0
title: TypeScript SDK
description: TypeScript client for the OpenShell gateway API.
---

<Note>
The TypeScript SDK docs will move here from the core docs. Until then, see the [TypeScript SDK page](core://sdk/typescript) in the core docs.
</Note>

The SDK lives in [ai-openshell/sdk-typescript](https://github.com/ai-openshell/sdk-typescript) and is published to npm as `@ai-openshell/sdk`.
41 changes: 29 additions & 12 deletions test/assemble.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -52,21 +52,14 @@ function sourcesYml() {
}

function assemble(name, ...extra) {
return assembleWith(sourcesYml(), name, ...extra);
}

function assembleWith(sources, name, ...extra) {
const out = path.join(tmp, name);
const r = spawnSync(
process.execPath,
[
assembler,
'--base',
'/docs/',
'--sources',
sourcesYml(),
'--out',
out,
'--cache',
path.join(tmp, 'cache'),
...extra,
],
[assembler, '--base', '/docs/', '--sources', sources, '--out', out, '--cache', path.join(tmp, 'cache'), ...extra],
{ encoding: 'utf8', env: { ...process.env, GITHUB_ACTIONS: '' } },
);
const read = (f) => fs.readFileSync(path.join(out, f), 'utf8');
Expand Down Expand Up @@ -165,3 +158,27 @@ describe('build with a --local checkout', () => {
assert.equal(build.json('sources.lock.json')['beta@dev'].sha, 'working-tree');
});
});

describe('a version from a directory in this repo', () => {
let build;
before(() => {
const file = path.join(tmp, 'stub-sources.yml');
fs.writeFileSync(
file,
`site:\n title: Test\n repo: example/docs\ntopics:\n - id: core\n label: Core\n sources: [alpha, stub]\nsources:\n alpha:\n mount: ""\n repo: ${repo('alpha')}\n path: docs\n versions:\n - { name: "1.0", ref: v1.0 }\n stub:\n mount: stub\n versions:\n - { name: preview, local: test/fixtures/stub }\n`,
);
build = assembleWith(file, 'stub');
});

test('builds without fetching and is recorded as this repo', () => {
assert.equal(build.status, 0, build.log);
const lock = build.json('sources.lock.json');
assert.equal(lock['stub@preview'].sha, 'working-tree');
assert.equal(lock['stub@preview'].repo, 'example/docs');
assert.equal(build.json('nav.json').docsets.stub.latest, 'preview');
});

test('is published at its mount and links to other docsets', () => {
assert.match(build.read('content/stub/index.mdx'), /\]\(\/docs\/guide\/\)/);
});
});
5 changes: 5 additions & 0 deletions test/fixtures/stub/docset.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: Apache-2.0

title: Stub
nav:
- page: index.mdx
6 changes: 6 additions & 0 deletions test/fixtures/stub/index.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# SPDX-License-Identifier: Apache-2.0
title: Stub
---

Coming soon. Until then, see the [guide](alpha://guide).
6 changes: 6 additions & 0 deletions topics/sdks.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
# SPDX-License-Identifier: Apache-2.0
# Hand-written intro for the generated /sdks/ page. Owned by the site repo.
---

Every SDK talks to the same gateway API, so pick the one for your language. To try OpenShell without writing code, start with [this overview](core://how-it-works/sandboxes/overview) using the CLI.
Loading