Skip to content
Merged
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
2 changes: 2 additions & 0 deletions WRITING.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ checks their recorded hashes, executes the displayed setup, and saves logs
and a result. Dependency downloads and native builds are separate from the
routine site tests. A changed hash needs a new native run before review.
Use `--example attach` to check the existing-server programs in the attach guide.
Use `--example query --port ts` to run every complete program on the TypeScript
filtering page, including its displayed setup and error assertions.

Put explanatory comments on separate lines above the code they describe.
Limit example comments to 100 columns, including indentation; prefer shorter
Expand Down
2 changes: 1 addition & 1 deletion scripts/check-example-prose.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
def main():
repo = Path(__file__).resolve().parent.parent
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument('--example', choices=['capture', 'attach'], default='capture')
parser.add_argument('--example', choices=['capture', 'attach', 'query'], default='capture')
parser.add_argument('--port', required=True)
parser.add_argument('--output-dir', required=True, type=Path)
args = parser.parse_args()
Expand Down
19 changes: 19 additions & 0 deletions site/scripts/check-navigation.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,25 @@ export async function checkNavigation(page, base) {
assert.equal(await page.locator('html').getAttribute('data-mcp-install-cooldown-enabled'), '1')
console.log('Navigation: document retained, Back, search, code tabs, menu and saved theme/cooldown pass')

for (const [port, version] of [['ts', 'latest'], ['py', 'stable']]) {
const prefix = new URL(`${base}/${port}/${version}/`).pathname
for (const width of [1440, 390]) {
await page.setViewportSize({ width, height: 900 })
const response = await page.goto(`${base}/${port}/${version}/examples/capture-pane-output/`, { waitUntil: 'load' })
assert(response?.ok(), `${port}: owned example exists in the root build`)
const sidebars = page.locator('nav.sidebar-nav')
assert.equal(await sidebars.count(), 2, 'Desktop and mobile both have navigation')
for (const sidebar of await sidebars.all()) {
const query = sidebar.getByRole('link', { name: 'Filtering and queries', exact: true, includeHidden: true })
assert.equal(await query.getAttribute('href'), `${prefix}concepts/queries/`,
`${port} ${version} at ${width}px: shared query page stays in the selected port`)
const links = await sidebar.locator('a[href^="/"]').evaluateAll((items) => items.map((a) => a.getAttribute('href')))
for (const href of links) assert(href.startsWith(prefix), `${port} sidebar leaves ${prefix}: ${href}`)
}
}
}
console.log('Sidebars: root-mounted port pages retain the selected port and version on desktop and mobile')

const legacy = `${base}/go/latest/examples/workspace-from-file/`
const current = `${base}/go/latest/workspace/internals/examples/`
await page.goto(`${legacy}?from=legacy#where-this-comes-from`, { waitUntil: 'load' })
Expand Down
24 changes: 5 additions & 19 deletions site/src/content/docs/concepts/queries.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
supportedPorts: [py, ts, rs, go, java, dotnet, cxx, swift]
supportedPorts: [py, rs, go, java, dotnet, cxx, swift]
title: Filtering and queries
description: How you get from every session on the server to the one pane you mean, and what happens when zero or several match.
sidebar:
Expand Down Expand Up @@ -66,25 +66,11 @@ check that the session data is available.
<!-- port:ts -->
<a id="typescript-criteria-as-data"></a>

## Criteria as data
## TypeScript criteria

TypeScript's `Selection.where()` accepts structured, serializable criteria that
can be stored in a configuration file or sent through MCP:

```ts
snapshot.sessions.where({
AND: [
{ name: { startsWith: "prod" } },
{ windows: { some: { name: { regex: { pattern: "^log", flags: "" } } } } },
],
});
```

`some`, `every`, and `none` test related objects. `{ mode: "insensitive" }`
enables case-insensitive comparison. Use `.where()` for criteria that can be
encoded with `encodeWhereDocument` and decoded with `decodeWhereDocument`; use
`.filter()` for a predicate function. `.one()` throws `NoMatchError` or
`MultipleMatchesError`. `.oneOrUndefined()` permits an absent result.
The [TypeScript filtering guide](/ts/latest/concepts/queries/) includes complete
programs for matching names, handling result counts, traversing linked windows,
refreshing snapshots, validating query documents, and filtering live tmux rows.
<!-- /port -->

<!-- port:go,rs,java,cxx,dotnet,swift -->
Expand Down
Loading
Loading