Skip to content
Open
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: 1 addition & 1 deletion .claude-plugin/marketplace.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"$schema": "https://anthropic.com/claude-code/marketplace.schema.json",
"name": "glance-agent-plugins",
"name": "glance",
"version": "1.0.0",
"description": "glance.sh plugins for coding agents",
"metadata": {
Expand Down
45 changes: 39 additions & 6 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ on:
pull_request:
workflow_dispatch:

permissions:
contents: read

jobs:
test:
plugins:
runs-on: ubuntu-latest

steps:
Expand All @@ -18,11 +21,41 @@ jobs:
node-version: 22
cache: npm

- name: Install dependencies
- name: Install plugin dependencies
run: npm ci

- name: Run test coverage
run: npm run test:coverage
- name: Run plugin coverage
run: npm run test:plugins:coverage

- name: Run plugin type check
run: npm run typecheck:plugins

web:
runs-on: ubuntu-latest

defaults:
run:
working-directory: apps/web

steps:
- name: Check out repository
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22
cache: npm
cache-dependency-path: apps/web/package-lock.json

- name: Install web dependencies
run: npm ci

- name: Run web tests
run: npm test

- name: Run web type check
run: npm run typecheck

- name: Run type check
run: npm exec -- tsc --noEmit
- name: Build web app
run: npm run build
9 changes: 9 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
node_modules/
coverage/
.DS_Store

# Web app local/deploy artifacts
apps/web/node_modules/
apps/web/.next/
apps/web/coverage/
apps/web/.env
apps/web/.env.*
!apps/web/.env.example
apps/web/.vercel/
100 changes: 56 additions & 44 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,34 @@ Guidance for coding agents working in this repository.

## Purpose

This repo contains small, self-contained [glance.sh](https://glance.sh) integrations for different coding agents. Each plugin should be easy to read, easy to install, and easy to test locally.
This repo is the public Glance monorepo. It contains:

- `apps/web/` — the Next.js web app behind glance.sh.
- `claude/`, `codex/`, `opencode/`, `pi/` — agent integrations.

Glance provides temporary image sharing for coding agents and terminal workflows.

## Repository shape

- Each agent integration lives in its own top-level directory such as `pi/` or `opencode/`.
- Each plugin directory should contain:
- `glance.ts`: the plugin implementation
- `glance.test.ts`: the Vitest suite for that plugin
- `README.md`: install and usage instructions for that plugin
- Shared test-only helpers and runtime stubs belong under `test/`.
- Keep the existing plugin directories at the repository root during the first
monorepo migration to preserve install flows.
- The web app has its own package and lockfile under `apps/web/` so Vercel can
deploy it with Root Directory = `apps/web`.
- Public CI must not require production secrets.
- The hosted service deploys from a separate private deployment repo, not from
untrusted public PRs.

## Plugin expectations

- Keep plugins self-contained inside their own directory.
- Prefer platform-native APIs such as `fetch`, `AbortController`, and `ReadableStream` over adding new dependencies.
- Preserve the style already used in the plugin you are editing instead of forcing a repo-wide formatting style.
- Match the repo's writing style: concise, direct, and low on filler in code comments, README copy, and PR text.
- Keep runtime-specific code minimal and explicit. Document runtime assumptions in the plugin `README.md`.
- Update the plugin `README.md` whenever install steps, behavior, supported commands/tools, or runtime requirements change.
- If a plugin has internal async/session logic that is hard to verify from the public API alone, expose a small `__testing` surface rather than making production code more coupled.

## Behavior requirements
- Prefer platform-native APIs such as `fetch`, `AbortController`, and
`ReadableStream` over adding new dependencies.
- Preserve the style already used in the plugin you are editing.
- Update the plugin `README.md` whenever install steps, behavior, supported
commands/tools, or runtime requirements change.
- If a plugin has internal async/session logic that is hard to verify from the
public API alone, expose a small `__testing` surface rather than making
production code more coupled.

Every plugin should cover the same core lifecycle:

Expand All @@ -35,49 +41,55 @@ Every plugin should cover the same core lifecycle:
- handle reconnects, timeouts, expiry, and cancellation
- return or inject the received image URL in the host agent's expected format

If you fix a behavior bug in one plugin, check the other plugins for the same pattern before stopping.
If you fix a behavior bug in one plugin, check the other plugins for the same
pattern before stopping.

## Testing requirements
## Web app expectations

- Every plugin must have a Vitest suite in the same directory as the plugin file.
- Tests should cover both the happy path and failure modes, not just basic registration.
- At minimum, cover:
- session creation
- reuse or refresh of persistent sessions
- SSE image delivery
- timeout or expiry handling
- cancellation or shutdown behavior
- user-facing command/tool responses
- Prefer deterministic tests with mocked `fetch`, streams, timers, and runtime APIs.
- Keep tests local to the plugin. Put only reusable stubs or fixtures in `test/`.
Read `apps/web/AGENTS.md` before changing the web app.

## Tooling and config
Important invariants:

When adding a new plugin directory or new test-only runtime stub, update the root tooling so it stays in sync:
- Blob storage is private.
- Shared links point to app routes such as `/<token>.<ext>`, never raw Blob URLs.
- Expiry is enforced by the app route on every request.
- Client components must not import server-only modules.
- The session API contract is consumed by the root plugins; coordinate changes.
- Sentry and analytics must remain opt-in for self-hosters.

- `vitest.config.ts`
- `tsconfig.json`
- `package.json` if new scripts are genuinely needed
- `.github/workflows/test.yml` if CI inputs change
## Validation

Do not add a build step unless the repository actually needs one.
Plugin validation from the repository root:

## Validation
```bash
npm ci
npm run test:plugins
npm run typecheck:plugins
```

Web validation:

```bash
npm --prefix apps/web ci
npm run test:web
npm run typecheck:web
npm run build:web
```

Before opening or updating a PR, run:
Full validation:

```bash
npm test
npm run test:coverage
npm exec -- tsc --noEmit
npm run typecheck
npm run build:web
```

If a command cannot be run, say so explicitly and explain why.

## PR checklist

- The plugin implementation, tests, and README are all updated together.
- New behavior is covered by tests.
- Root test/typecheck config includes any new plugin or stub paths.
- CI still runs the repo validation commands on pull requests.
- The PR description calls out user-visible behavior changes and any runtime-specific caveats in concise language.
- Plugin implementation, tests, and README are updated together when plugin behavior changes.
- Web app behavior changes include route/component tests where practical.
- Public CI does not depend on production secrets.
- No hard-coded deployment telemetry, org IDs, or private repo paths are added.
- User-visible behavior changes are called out in the PR description.
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Changelog

All notable changes to this project will be documented here.

## Unreleased

- Begin migration from plugin-only repository to public Glance monorepo.
- Add `apps/web/` with the glance.sh web app.
- Keep hosted-service deployment separate from the public repository.
51 changes: 51 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Contributing

Thanks for helping improve Glance.

## Development setup

```bash
git clone https://github.com/modem-dev/glance.git
cd glance
npm ci
npm --prefix apps/web ci
```

## Validate changes

Plugins:

```bash
npm run test:plugins
npm run typecheck:plugins
```

Web app:

```bash
npm run test:web
npm run typecheck:web
npm run build:web
```

Full local check:

```bash
npm test
npm run typecheck
npm run build:web
```

## Pull requests

- Keep changes focused.
- Update docs when install steps, env vars, routes, or user-visible behavior change.
- Add or update tests for behavior changes.
- Do not add production secrets, deployment-only state, `.env` files, or hard-coded telemetry DSNs.
- Public PRs should be safe to run without secrets.

## Deployment

The hosted `glance.sh` service deploys from a private deployment repository after
reviewed public commits are synced. Public PRs do not deploy to production and
must never require production env vars.
Loading
Loading