From fe6f00a0696e11904e793ed6864f000171cda370 Mon Sep 17 00:00:00 2001 From: Taylor Steinberg Date: Tue, 10 Nov 2026 10:32:00 -0500 Subject: [PATCH 1/5] chore: configure agent skills for issue tracking and domain docs Co-Authored-By: Claude Opus 5.5 --- CLAUDE.md | 14 ++++++++++ docs/agents/domain.md | 51 ++++++++++++++++++++++++++++++++++++ docs/agents/issue-tracker.md | 50 +++++++++++++++++++++++++++++++++++ docs/agents/triage-labels.md | 15 +++++++++++ mkdocs.yml | 4 +++ 5 files changed, 134 insertions(+) create mode 100644 docs/agents/domain.md create mode 100644 docs/agents/issue-tracker.md create mode 100644 docs/agents/triage-labels.md diff --git a/CLAUDE.md b/CLAUDE.md index d92dfef2..090d89c7 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -200,3 +200,17 @@ The app mode determines how Connect runs the content. Manifests must specify the - Special deployment path for Snowflake Snowpark - `SPCSConnectServer` class for Snowflake-specific authentication - JWT generation in `snowflake.py` + +## Agent skills + +### Issue tracker + +Issues are tracked in GitHub Issues on posit-dev/rsconnect-python via the `gh` CLI. See `docs/agents/issue-tracker.md`. + +### Triage labels + +Uses the five default labels: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. See `docs/agents/triage-labels.md`. + +### Domain docs + +Single-context: one root `GLOSSARY.md` plus `docs/adr/`. See `docs/agents/domain.md`. diff --git a/docs/agents/domain.md b/docs/agents/domain.md new file mode 100644 index 00000000..4032de01 --- /dev/null +++ b/docs/agents/domain.md @@ -0,0 +1,51 @@ +# Domain Docs + +How the engineering skills should consume this repo's domain documentation when exploring the codebase. + +## Before exploring, read these + +- **`GLOSSARY.md`** at the repo root, or +- **`GLOSSARY-MAP.md`** at the repo root if it exists: it points at one `GLOSSARY.md` per context. Read each one relevant to the topic. +- **`docs/adr/`**: read ADRs that touch the area you're about to work in. In multi-context repos, also check `src//docs/adr/` for context-scoped decisions. + +If any of these files don't exist, **proceed silently**. Don't flag their absence; don't suggest creating them upfront. The `/domain-modeling` skill (reached via `/grill-with-docs` and `/improve-codebase-architecture`) creates them lazily when terms or decisions actually get resolved. + +## File structure + +Single-context repo (most repos): + +``` +/ +├── GLOSSARY.md +├── docs/adr/ +│ ├── 0001-event-sourced-orders.md +│ └── 0002-postgres-for-write-model.md +└── src/ +``` + +Multi-context repo (presence of `GLOSSARY-MAP.md` at the root): + +``` +/ +├── GLOSSARY-MAP.md +├── docs/adr/ ← system-wide decisions +└── src/ + ├── ordering/ + │ ├── GLOSSARY.md + │ └── docs/adr/ ← context-specific decisions + └── billing/ + ├── GLOSSARY.md + └── docs/adr/ +``` + +## Use the glossary's vocabulary + +When your output names a domain concept (in an issue title, a refactor proposal, a hypothesis, a test name), use the term as defined in `GLOSSARY.md`. Don't drift to synonyms the glossary explicitly avoids. + +If the concept you need isn't in the glossary yet, that's a signal: either you're inventing language the project doesn't use (reconsider) or there's a real gap (note it for `/domain-modeling`). + +## Flag ADR conflicts + +If your output contradicts an existing ADR, surface it explicitly rather than silently overriding: + +> _Contradicts ADR-0007 (event-sourced orders), but worth reopening because…_ diff --git a/docs/agents/issue-tracker.md b/docs/agents/issue-tracker.md new file mode 100644 index 00000000..dc806f56 --- /dev/null +++ b/docs/agents/issue-tracker.md @@ -0,0 +1,50 @@ +# Issue tracker: GitHub + +Issues and specs for this repo live as GitHub issues. Use the `gh` CLI for all operations. + +## Conventions + +- **Create an issue**: `gh issue create --title "..." --body "..."`. Use a heredoc for multi-line bodies. +- **Read an issue**: `gh issue view --json number,title,body,labels,comments`. +- **List issues**: `gh issue list --state open --json number,title,body,labels,comments --jq '[.[] | {number, title, body, labels: [.labels[].name], comments: [.comments[].body]}]'` with appropriate `--label` and `--state` filters. +- **Make an issue a sub-issue of a parent**: `gh issue create --parent ...`, or `gh issue edit --add-sub-issue ` afterwards (`gh` 2.94+). Older `gh`: `gh api --method POST repos///issues//sub_issues -F sub_issue_id=` (database id, as in **Blocking** below). Without sub-issues, put `Part of #` at the top of the child body. +- **Blocking**: GitHub's **native issue dependencies**, the canonical, UI-visible representation. Add an edge with `gh issue create --blocked-by , ...` or `gh issue edit --add-blocked-by ` (`gh` 2.94+). Older `gh`: `gh api --method POST repos///issues//dependencies/blocked_by -F issue_id=`, where `` is the blocker's numeric **database id** (`gh api repos///issues/ --jq .id`, _not_ the `#number` or `node_id`). Where dependencies aren't available, fall back to a `Blocked by: #, #` line at the top of the child body. A ticket is unblocked when every blocker is closed. +- **Count open blockers**: `gh api repos///issues/ --jq .issue_dependencies_summary.blocked_by` (open blockers only; 0 means startable). `gh issue view --json blockedBy` also lists closed blockers, so filter it: `--jq '[.blockedBy.nodes[] | select(.state == "OPEN")] | length'`. +- **Comment on an issue**: `gh issue comment --body "..."` +- **Apply / remove labels**: `gh issue edit --add-label "..."` / `--remove-label "..."` +- **Close**: post the explanation with `gh issue comment --body "..."`, then `gh issue close `. On an already-closed issue, `gh issue close --comment` drops the comment and still exits 0. + +Infer the repo from `git remote -v`; `gh` does this automatically when run inside a clone. + +File issues only into the user's own repo. Never file into `mattpocock/skills` (the repo these skills come from) unless the user owns it. In a fork, `gh` can default to the upstream parent, so before the first `gh issue create` of a session, check the target with `gh repo view --json nameWithOwner` and confirm it with the user if it is not their repo. + +## Pull requests as a triage surface + +**PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; `/triage` reads this flag.)_ + +When set to `yes`, PRs run through the same labels and states as issues, using the `gh pr` equivalents: + +- **Read a PR**: `gh pr view `, then `gh pr view --comments` (off a TTY, `--comments` prints only the comments, not the body), and `gh pr diff ` for the diff. +- **List external PRs for triage**: `gh api --paginate 'repos/{owner}/{repo}/pulls?state=open' --jq '.[] | select(.author_association | IN("OWNER","MEMBER","COLLABORATOR") | not) | {number, title, author: .user.login, author_association, labels: [.labels[].name]}'`. +- **Comment / label / close**: `gh pr comment`, `gh pr edit --add-label`/`--remove-label`, `gh pr close`. + +GitHub shares one number space across issues and PRs, so a bare `#42` may be either: resolve with `gh pr view 42` and fall back to `gh issue view 42`. + +## When a skill says "publish to the issue tracker" + +Create a GitHub issue. + +## When a skill says "fetch the relevant ticket" + +Read it as in **Read an issue** above. + +## Wayfinding operations + +Used by `/wayfinder`. The **map** is a single issue with **child** issues as tickets. + +- **Map**: a single issue labelled `wayfinder:map`, holding the Notes / Decisions-so-far / Fog body. `gh issue create --label wayfinder:map`. +- **Child ticket**: an issue linked to the map as a GitHub sub-issue (see **Make an issue a sub-issue of a parent**). Where sub-issues aren't enabled, add the child to a task list in the map body and put `Part of #` at the top of the child body. Labels: `wayfinder:` (`research`/`prototype`/`grilling`/`task`). Once claimed, the ticket is assigned to the driving dev. +- **Blocking**: see **Blocking** under Conventions. +- **Frontier query**: list the map's open children (`gh issue list --state open`, scoped to the map's sub-issues / task list), drop any with an open blocker (see **Count open blockers**, or an open issue in the `Blocked by` line) or an assignee; first in map order wins. +- **Claim**: `gh issue edit --add-assignee @me`, the session's first write. +- **Resolve**: `gh issue comment --body ""`, then `gh issue close `, then append a context pointer (gist + link) to the map's Decisions-so-far. diff --git a/docs/agents/triage-labels.md b/docs/agents/triage-labels.md new file mode 100644 index 00000000..52764642 --- /dev/null +++ b/docs/agents/triage-labels.md @@ -0,0 +1,15 @@ +# Triage Labels + +The skills speak in terms of five canonical triage roles. This file maps those roles to the actual label strings used in this repo's issue tracker. + +| Label in mattpocock/skills | Label in our tracker | Meaning | +| -------------------------- | -------------------- | ---------------------------------------- | +| `needs-triage` | `needs-triage` | Maintainer needs to evaluate this issue | +| `needs-info` | `needs-info` | Waiting on reporter for more information | +| `ready-for-agent` | `ready-for-agent` | Fully specified, ready for an AFK agent | +| `ready-for-human` | `ready-for-human` | Requires human implementation | +| `wontfix` | `wontfix` | Will not be actioned | + +When a skill mentions a role (e.g. "apply the AFK-ready triage label"), use the corresponding label string from this table. + +Edit the "Label in our tracker" column to match whatever vocabulary you actually use. diff --git a/mkdocs.yml b/mkdocs.yml index d9ce7f4c..24e0d2b0 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -1,6 +1,10 @@ site_name: 'rsconnect-python' copyright: Posit Software, PBC. All Rights Reserved +exclude_docs: | + agents/ + adr/ + markdown_extensions: - attr_list - mkdocs-click From 243454ea893099d19a00792f20cd30068c17e279 Mon Sep 17 00:00:00 2001 From: Taylor Steinberg Date: Tue, 10 Nov 2026 10:33:26 -0500 Subject: [PATCH 2/5] chore: move agent instructions to AGENTS.md CLAUDE.md now imports AGENTS.md so Claude Code and other agents share one source. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 216 +++++++++++++++++++++++++++++++++++++++++++++++++++++ CLAUDE.md | 217 +----------------------------------------------------- 2 files changed, 217 insertions(+), 216 deletions(-) create mode 100644 AGENTS.md diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..9aefea31 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,216 @@ +# AGENTS.md + +This file provides guidance to coding agents when working with code in this repository. + +## Project Overview + +rsconnect-python is the Posit Connect command-line interface for deploying Python content (Shiny apps, Quarto documents, APIs, Jupyter notebooks, etc.) to Posit Connect servers. The tool handles bundling content, managing credentials, and orchestrating deployments. + +## Development Commands + +### Environment Setup +```bash +# Install the project plus dev tooling +# `uv` provisions the interpreter and resolves the `test` dependency group +uv sync --group test + +# Run the CLI from your working tree +uv run rsconnect version +``` + +### Testing +```bash +# Run tests with the default Python (3.13) +just test + +# Run tests with a specific Python version (uv fetches it if needed) +just test 3.12 + +# Run tests across all supported Python versions +just all-tests + +# Run single test file +uv run pytest tests/test_bundle.py + +# Run single test +uv run pytest tests/test_bundle.py::test_function_name +``` + +### Linting and Formatting +```bash +# Auto-format and apply fixes +just fmt + +# Run all linters (ruff format --check, ruff check, pyright) +just lint +``` + +### Documentation +```bash +# Build documentation +just docs + +# Serve documentation locally (with live reload) +just docs-serve +``` + +### Building Distribution +```bash +# Build wheel distribution +just dist + +# Install built package +just install +``` + +## Code Architecture + +### Core Modules + +**main.py** - CLI entry point using Click framework. Defines all commands (deploy, add, list, etc.) and option parsing. Commands delegate to action functions. + +**api.py** - HTTP client for Posit Connect API. Key classes: +- `RSConnectServer` - represents a Connect server (URL, API key, certificates) +- `RSConnectClient` - low-level HTTP operations +- `RSConnectExecutor` - high-level deployment operations (deploy_bundle, wait_for_task, etc.) +- `SPCSConnectServer` - specialized server for Snowflake deployments + +**actions.py & actions_content.py** - High-level deployment orchestration: +- `actions.py` - deployment workflows (test connections, create bundles, validate Quarto) +- `actions_content.py` - content management (list, search, build history, download bundles) + +**bundle.py** - Content bundling and manifest generation. Creates tar.gz bundles containing: +- Application files +- `manifest.json` describing app mode, entry point, dependencies +- Environment snapshot (requirements.txt or environment.yml) + +Functions named `make_*_bundle()` for different content types (api, html, notebook, tensorflow, voila, quarto). + +**models.py** - Data structures: +- `AppMode` - represents content types (shiny, quarto-shiny, jupyter-static, python-api, etc.) +- `AppModes` - registry of all supported app modes with lookup functions +- TypedDict models for API responses (ContentItemV1, TaskStatusV1, etc.) + +**metadata.py** - Persistent storage of configuration: +- `ServerStore` - saved server credentials (stored in `~/.rsconnect-python/`) +- `AppStore` - deployment history per directory (stored in local `rsconnect-python/` subdirs) + +**environment.py** - Python dependency detection: +- Inspects virtual environments, conda environments, or current Python +- Generates requirements files for reproducible deployments +- Runs inspection in subprocess for isolation + +### Deployment Flow + +1. **Validate** - Check server connection, validate content files +2. **Bundle** - Create manifest.json, snapshot dependencies, tar content files +3. **Upload** - POST bundle to `/v1/content` or existing content GUID +4. **Deploy** - Server extracts bundle, starts deployment task +5. **Wait** - Poll task status until COMPLETE or ERROR +6. **Store** - Save deployment metadata to local AppStore + +### App Modes + +Different content types have different app modes (defined in models.py): +- `python-shiny` - Shiny for Python apps +- `quarto-shiny` - Quarto documents with Shiny runtime +- `jupyter-static` - Rendered Jupyter notebooks +- `python-api` - FastAPI, Flask APIs +- `python-dash` - Plotly Dash apps +- `python-streamlit` - Streamlit apps +- `python-holoviz-panel` - HoloViz Panel apps +- etc. + +The app mode determines how Connect runs the content. Manifests must specify the correct mode. + +## Testing + +### Test Structure +- Unit tests in `tests/` mirror module structure (`test_bundle.py`, `test_api.py`, etc.) +- Uses `pytest` with `httpretty` for mocking HTTP requests +- `conftest.py` defines shared fixtures + +### Key Test Patterns +- Mock HTTP responses with `httpretty` decorators +- Use temporary directories for file operations +- Test fixtures in `tests/testdata/` for sample content +- `test_metadata.py` has long lines that exceed the default line length limit + +### CI/CD +- GitHub Actions workflow in `.github/workflows/main.yml` +- Tests run on Python 3.8-3.14 across ubuntu/macos/windows +- Linting enforced on all PRs +- Coverage reported on Python 3.8 PRs + +## Code Style + +### Python Standards +- `ruff format` for formatting (120 char line length) +- `ruff check` for linting (enforced in CI) +- Pyright for type checking (advisory; does not fail `just lint`) +- Python 3.8+ compatibility (use `typing_extensions` for newer types) + +### Type Annotations +- Strict type checking enabled (`typeCheckingMode = "strict"`) +- Use `TypedDict` for structured dictionaries (API responses, manifest data) +- Import from `typing_extensions` for Python 3.8-3.10 compatibility +- `py.typed` marker indicates typed package + +## Important Patterns + +### Error Handling +- Raise `RSConnectException` for operational errors (user-facing) +- Include helpful error messages with context +- Use `cli_feedback()` context manager for OK/ERROR output + +### Logging +- Logger in `log.py` with custom VERBOSE level between INFO and DEBUG +- Use `logger.info()` for user-visible progress +- Use `logger.debug()` for detailed diagnostics +- Console output uses Click's `echo()` and `secho()` for colors + +### Manifest Generation +- Every deployment requires a `manifest.json` describing the content +- Manifests include file checksums, app mode, entry point, dependencies +- Different manifest generators for different content types + +### Server Communication +- All API calls go through `RSConnectClient` in api.py +- Handle non-JSON responses and network errors gracefully +- Retry logic built into executor methods +- Support for certificate validation with custom CA bundles + +## Releasing + +- Version is a static field in `pyproject.toml`, managed with `uv version`. +- `main` carries a `.dev` version (e.g. `1.29.1.dev0`). +- Update CHANGELOG.md before each release (even betas). +- Cut a release: `uv version --bump stable`, commit, `git tag -a 1.2.3 -m 'Release 1.2.3'`, push the tag. +- The `distributions` CI job asserts the tag matches the `pyproject.toml` version, then builds and publishes to PyPI. +- After releasing, bump `main` back to the next `.dev` version with `uv version .dev0`. + +## Special Integrations + +### Quarto +- Quarto support requires quarto CLI installed +- `actions.py` has `quarto_inspect()` for introspecting projects +- Special handling for Quarto projects with Shiny runtime + +### Snowflake +- Special deployment path for Snowflake Snowpark +- `SPCSConnectServer` class for Snowflake-specific authentication +- JWT generation in `snowflake.py` + +## Agent skills + +### Issue tracker + +Issues are tracked in GitHub Issues on posit-dev/rsconnect-python via the `gh` CLI. See `docs/agents/issue-tracker.md`. + +### Triage labels + +Uses the five default labels: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. See `docs/agents/triage-labels.md`. + +### Domain docs + +Single-context: one root `GLOSSARY.md` plus `docs/adr/`. See `docs/agents/domain.md`. diff --git a/CLAUDE.md b/CLAUDE.md index 090d89c7..43c994c2 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -1,216 +1 @@ -# CLAUDE.md - -This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository. - -## Project Overview - -rsconnect-python is the Posit Connect command-line interface for deploying Python content (Shiny apps, Quarto documents, APIs, Jupyter notebooks, etc.) to Posit Connect servers. The tool handles bundling content, managing credentials, and orchestrating deployments. - -## Development Commands - -### Environment Setup -```bash -# Install the project plus dev tooling -# `uv` provisions the interpreter and resolves the `test` dependency group -uv sync --group test - -# Run the CLI from your working tree -uv run rsconnect version -``` - -### Testing -```bash -# Run tests with the default Python (3.13) -just test - -# Run tests with a specific Python version (uv fetches it if needed) -just test 3.12 - -# Run tests across all supported Python versions -just all-tests - -# Run single test file -uv run pytest tests/test_bundle.py - -# Run single test -uv run pytest tests/test_bundle.py::test_function_name -``` - -### Linting and Formatting -```bash -# Auto-format and apply fixes -just fmt - -# Run all linters (ruff format --check, ruff check, pyright) -just lint -``` - -### Documentation -```bash -# Build documentation -just docs - -# Serve documentation locally (with live reload) -just docs-serve -``` - -### Building Distribution -```bash -# Build wheel distribution -just dist - -# Install built package -just install -``` - -## Code Architecture - -### Core Modules - -**main.py** - CLI entry point using Click framework. Defines all commands (deploy, add, list, etc.) and option parsing. Commands delegate to action functions. - -**api.py** - HTTP client for Posit Connect API. Key classes: -- `RSConnectServer` - represents a Connect server (URL, API key, certificates) -- `RSConnectClient` - low-level HTTP operations -- `RSConnectExecutor` - high-level deployment operations (deploy_bundle, wait_for_task, etc.) -- `SPCSConnectServer` - specialized server for Snowflake deployments - -**actions.py & actions_content.py** - High-level deployment orchestration: -- `actions.py` - deployment workflows (test connections, create bundles, validate Quarto) -- `actions_content.py` - content management (list, search, build history, download bundles) - -**bundle.py** - Content bundling and manifest generation. Creates tar.gz bundles containing: -- Application files -- `manifest.json` describing app mode, entry point, dependencies -- Environment snapshot (requirements.txt or environment.yml) - -Functions named `make_*_bundle()` for different content types (api, html, notebook, tensorflow, voila, quarto). - -**models.py** - Data structures: -- `AppMode` - represents content types (shiny, quarto-shiny, jupyter-static, python-api, etc.) -- `AppModes` - registry of all supported app modes with lookup functions -- TypedDict models for API responses (ContentItemV1, TaskStatusV1, etc.) - -**metadata.py** - Persistent storage of configuration: -- `ServerStore` - saved server credentials (stored in `~/.rsconnect-python/`) -- `AppStore` - deployment history per directory (stored in local `rsconnect-python/` subdirs) - -**environment.py** - Python dependency detection: -- Inspects virtual environments, conda environments, or current Python -- Generates requirements files for reproducible deployments -- Runs inspection in subprocess for isolation - -### Deployment Flow - -1. **Validate** - Check server connection, validate content files -2. **Bundle** - Create manifest.json, snapshot dependencies, tar content files -3. **Upload** - POST bundle to `/v1/content` or existing content GUID -4. **Deploy** - Server extracts bundle, starts deployment task -5. **Wait** - Poll task status until COMPLETE or ERROR -6. **Store** - Save deployment metadata to local AppStore - -### App Modes - -Different content types have different app modes (defined in models.py): -- `python-shiny` - Shiny for Python apps -- `quarto-shiny` - Quarto documents with Shiny runtime -- `jupyter-static` - Rendered Jupyter notebooks -- `python-api` - FastAPI, Flask APIs -- `python-dash` - Plotly Dash apps -- `python-streamlit` - Streamlit apps -- `python-holoviz-panel` - HoloViz Panel apps -- etc. - -The app mode determines how Connect runs the content. Manifests must specify the correct mode. - -## Testing - -### Test Structure -- Unit tests in `tests/` mirror module structure (`test_bundle.py`, `test_api.py`, etc.) -- Uses `pytest` with `httpretty` for mocking HTTP requests -- `conftest.py` defines shared fixtures - -### Key Test Patterns -- Mock HTTP responses with `httpretty` decorators -- Use temporary directories for file operations -- Test fixtures in `tests/testdata/` for sample content -- `test_metadata.py` has long lines that exceed the default line length limit - -### CI/CD -- GitHub Actions workflow in `.github/workflows/main.yml` -- Tests run on Python 3.8-3.14 across ubuntu/macos/windows -- Linting enforced on all PRs -- Coverage reported on Python 3.8 PRs - -## Code Style - -### Python Standards -- `ruff format` for formatting (120 char line length) -- `ruff check` for linting (enforced in CI) -- Pyright for type checking (advisory; does not fail `just lint`) -- Python 3.8+ compatibility (use `typing_extensions` for newer types) - -### Type Annotations -- Strict type checking enabled (`typeCheckingMode = "strict"`) -- Use `TypedDict` for structured dictionaries (API responses, manifest data) -- Import from `typing_extensions` for Python 3.8-3.10 compatibility -- `py.typed` marker indicates typed package - -## Important Patterns - -### Error Handling -- Raise `RSConnectException` for operational errors (user-facing) -- Include helpful error messages with context -- Use `cli_feedback()` context manager for OK/ERROR output - -### Logging -- Logger in `log.py` with custom VERBOSE level between INFO and DEBUG -- Use `logger.info()` for user-visible progress -- Use `logger.debug()` for detailed diagnostics -- Console output uses Click's `echo()` and `secho()` for colors - -### Manifest Generation -- Every deployment requires a `manifest.json` describing the content -- Manifests include file checksums, app mode, entry point, dependencies -- Different manifest generators for different content types - -### Server Communication -- All API calls go through `RSConnectClient` in api.py -- Handle non-JSON responses and network errors gracefully -- Retry logic built into executor methods -- Support for certificate validation with custom CA bundles - -## Releasing - -- Version is a static field in `pyproject.toml`, managed with `uv version`. -- `main` carries a `.dev` version (e.g. `1.29.1.dev0`). -- Update CHANGELOG.md before each release (even betas). -- Cut a release: `uv version --bump stable`, commit, `git tag -a 1.2.3 -m 'Release 1.2.3'`, push the tag. -- The `distributions` CI job asserts the tag matches the `pyproject.toml` version, then builds and publishes to PyPI. -- After releasing, bump `main` back to the next `.dev` version with `uv version .dev0`. - -## Special Integrations - -### Quarto -- Quarto support requires quarto CLI installed -- `actions.py` has `quarto_inspect()` for introspecting projects -- Special handling for Quarto projects with Shiny runtime - -### Snowflake -- Special deployment path for Snowflake Snowpark -- `SPCSConnectServer` class for Snowflake-specific authentication -- JWT generation in `snowflake.py` - -## Agent skills - -### Issue tracker - -Issues are tracked in GitHub Issues on posit-dev/rsconnect-python via the `gh` CLI. See `docs/agents/issue-tracker.md`. - -### Triage labels - -Uses the five default labels: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. See `docs/agents/triage-labels.md`. - -### Domain docs - -Single-context: one root `GLOSSARY.md` plus `docs/adr/`. See `docs/agents/domain.md`. +@AGENTS.md From ae6cd7f71ce974d2d6837850d71008c3b1b86165 Mon Sep 17 00:00:00 2001 From: Taylor Steinberg Date: Tue, 10 Nov 2026 10:34:57 -0500 Subject: [PATCH 3/5] docs: tailor agent domain docs guide to rsconnect-python Co-Authored-By: Claude Opus 5.5 --- docs/agents/domain.md | 53 +++++++++++++++++++++---------------------- 1 file changed, 26 insertions(+), 27 deletions(-) diff --git a/docs/agents/domain.md b/docs/agents/domain.md index 4032de01..45d99210 100644 --- a/docs/agents/domain.md +++ b/docs/agents/domain.md @@ -1,51 +1,50 @@ # Domain Docs -How the engineering skills should consume this repo's domain documentation when exploring the codebase. +How the engineering skills should use rsconnect-python's domain documentation when exploring the codebase. ## Before exploring, read these -- **`GLOSSARY.md`** at the repo root, or -- **`GLOSSARY-MAP.md`** at the repo root if it exists: it points at one `GLOSSARY.md` per context. Read each one relevant to the topic. -- **`docs/adr/`**: read ADRs that touch the area you're about to work in. In multi-context repos, also check `src//docs/adr/` for context-scoped decisions. +- **`GLOSSARY.md`** at the repo root: the project's vocabulary. +- **`docs/adr/`**: architecture decision records. Read the ones that touch the area you're about to work in. -If any of these files don't exist, **proceed silently**. Don't flag their absence; don't suggest creating them upfront. The `/domain-modeling` skill (reached via `/grill-with-docs` and `/improve-codebase-architecture`) creates them lazily when terms or decisions actually get resolved. +If either doesn't exist yet, **proceed silently**. Don't flag the absence or suggest creating them upfront. The `/domain-modeling` skill (reached via `/grill-with-docs` and `/improve-codebase-architecture`) creates them when a term or decision actually gets resolved. -## File structure +## Layout -Single-context repo (most repos): +This is a single-context repo: one Python package (`rsconnect/`), one glossary, one ADR folder. ``` / +├── AGENTS.md ├── GLOSSARY.md -├── docs/adr/ -│ ├── 0001-event-sourced-orders.md -│ └── 0002-postgres-for-write-model.md -└── src/ +├── docs/ +│ ├── adr/ ← decision records (excluded from the MkDocs site) +│ ├── agents/ ← skill configuration (excluded from the MkDocs site) +│ └── *.md ← public user docs, published by MkDocs +└── rsconnect/ ``` -Multi-context repo (presence of `GLOSSARY-MAP.md` at the root): +`docs/adr/` and `docs/agents/` are listed under `exclude_docs` in `mkdocs.yml`. Anything else added under `docs/` is published to the public documentation site, so keep internal notes in those two folders. -``` -/ -├── GLOSSARY-MAP.md -├── docs/adr/ ← system-wide decisions -└── src/ - ├── ordering/ - │ ├── GLOSSARY.md - │ └── docs/adr/ ← context-specific decisions - └── billing/ - ├── GLOSSARY.md - └── docs/adr/ -``` +## Where the vocabulary already lives + +Until `GLOSSARY.md` covers a term, these are the authoritative sources: + +- **`rsconnect/models.py`**: `AppModes` is the canonical list of content types. Use the mode's name string (`python-shiny`, `quarto-static`, `jupyter-voila`) when naming a content type, not a framework nickname. +- **`rsconnect/api.py`**: the deployment targets (`RSConnectServer` for Posit Connect, `SPCSConnectServer` for Connect on Snowflake, `ShinyappsServer`, `ConnectCloudServer`). Say which target you mean; "server" alone is ambiguous. +- **`rsconnect/metadata.py`**: `ServerStore` (saved server credentials) and `AppStore` (per-directory deployment records). +- **Public docs under `docs/`**: the user-facing wording for CLI concepts. Issue titles and user-visible messages should match it. + +Terms that are easy to blur and worth pinning down in the glossary when they come up: *content* vs. *app*, *bundle* vs. *manifest*, *deployment* vs. *content build*, and *environment* (local Python environment vs. Connect execution environment). ## Use the glossary's vocabulary When your output names a domain concept (in an issue title, a refactor proposal, a hypothesis, a test name), use the term as defined in `GLOSSARY.md`. Don't drift to synonyms the glossary explicitly avoids. -If the concept you need isn't in the glossary yet, that's a signal: either you're inventing language the project doesn't use (reconsider) or there's a real gap (note it for `/domain-modeling`). +If the concept you need isn't in the glossary yet, either you're inventing language the project doesn't use (reconsider) or there's a real gap (note it for `/domain-modeling`). ## Flag ADR conflicts -If your output contradicts an existing ADR, surface it explicitly rather than silently overriding: +If your output contradicts an existing ADR, say so explicitly rather than silently overriding it: -> _Contradicts ADR-0007 (event-sourced orders), but worth reopening because…_ +> _Contradicts ADR-0003 (keep Python 3.8 support), but worth reopening because…_ From f26092883e88936c9580240c3721ae077647269a Mon Sep 17 00:00:00 2001 From: Taylor Steinberg Date: Tue, 10 Nov 2026 10:36:26 -0500 Subject: [PATCH 4/5] docs: make agent docs independent of user-level skills Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 16 ++++----------- docs/agents/domain.md | 8 ++++---- docs/agents/issue-tracker.md | 39 ++++-------------------------------- docs/agents/triage-labels.md | 22 +++++++++----------- 4 files changed, 21 insertions(+), 64 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 9aefea31..f69567ad 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -201,16 +201,8 @@ The app mode determines how Connect runs the content. Manifests must specify the - `SPCSConnectServer` class for Snowflake-specific authentication - JWT generation in `snowflake.py` -## Agent skills +## Issues and domain docs -### Issue tracker - -Issues are tracked in GitHub Issues on posit-dev/rsconnect-python via the `gh` CLI. See `docs/agents/issue-tracker.md`. - -### Triage labels - -Uses the five default labels: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. See `docs/agents/triage-labels.md`. - -### Domain docs - -Single-context: one root `GLOSSARY.md` plus `docs/adr/`. See `docs/agents/domain.md`. +- **Issues**: tracked in GitHub Issues on posit-dev/rsconnect-python via the `gh` CLI. See `docs/agents/issue-tracker.md`. +- **Triage labels**: `needs-triage`, `needs-info`, `ready-for-agent`, `ready-for-human`, `wontfix`. See `docs/agents/triage-labels.md`. +- **Domain docs**: one root `GLOSSARY.md` plus `docs/adr/`. See `docs/agents/domain.md`. diff --git a/docs/agents/domain.md b/docs/agents/domain.md index 45d99210..3b7b1d4f 100644 --- a/docs/agents/domain.md +++ b/docs/agents/domain.md @@ -1,13 +1,13 @@ # Domain Docs -How the engineering skills should use rsconnect-python's domain documentation when exploring the codebase. +How coding agents should use rsconnect-python's domain documentation when exploring the codebase. ## Before exploring, read these - **`GLOSSARY.md`** at the repo root: the project's vocabulary. - **`docs/adr/`**: architecture decision records. Read the ones that touch the area you're about to work in. -If either doesn't exist yet, **proceed silently**. Don't flag the absence or suggest creating them upfront. The `/domain-modeling` skill (reached via `/grill-with-docs` and `/improve-codebase-architecture`) creates them when a term or decision actually gets resolved. +If either doesn't exist yet, **proceed silently**. Don't flag the absence or suggest creating them upfront. Create them only when a term or decision actually gets resolved in the course of the work. ## Layout @@ -19,7 +19,7 @@ This is a single-context repo: one Python package (`rsconnect/`), one glossary, ├── GLOSSARY.md ├── docs/ │ ├── adr/ ← decision records (excluded from the MkDocs site) -│ ├── agents/ ← skill configuration (excluded from the MkDocs site) +│ ├── agents/ ← agent guidance (excluded from the MkDocs site) │ └── *.md ← public user docs, published by MkDocs └── rsconnect/ ``` @@ -41,7 +41,7 @@ Terms that are easy to blur and worth pinning down in the glossary when they com When your output names a domain concept (in an issue title, a refactor proposal, a hypothesis, a test name), use the term as defined in `GLOSSARY.md`. Don't drift to synonyms the glossary explicitly avoids. -If the concept you need isn't in the glossary yet, either you're inventing language the project doesn't use (reconsider) or there's a real gap (note it for `/domain-modeling`). +If the concept you need isn't in the glossary yet, either you're inventing language the project doesn't use (reconsider) or there's a real gap (add it to the glossary once the term is agreed). ## Flag ADR conflicts diff --git a/docs/agents/issue-tracker.md b/docs/agents/issue-tracker.md index dc806f56..0b2a65a7 100644 --- a/docs/agents/issue-tracker.md +++ b/docs/agents/issue-tracker.md @@ -1,6 +1,6 @@ # Issue tracker: GitHub -Issues and specs for this repo live as GitHub issues. Use the `gh` CLI for all operations. +Issues and specs for this repo live as GitHub issues on `posit-dev/rsconnect-python`. Use the `gh` CLI for all operations. ## Conventions @@ -8,43 +8,12 @@ Issues and specs for this repo live as GitHub issues. Use the `gh` CLI for all o - **Read an issue**: `gh issue view --json number,title,body,labels,comments`. - **List issues**: `gh issue list --state open --json number,title,body,labels,comments --jq '[.[] | {number, title, body, labels: [.labels[].name], comments: [.comments[].body]}]'` with appropriate `--label` and `--state` filters. - **Make an issue a sub-issue of a parent**: `gh issue create --parent ...`, or `gh issue edit --add-sub-issue ` afterwards (`gh` 2.94+). Older `gh`: `gh api --method POST repos///issues//sub_issues -F sub_issue_id=` (database id, as in **Blocking** below). Without sub-issues, put `Part of #` at the top of the child body. -- **Blocking**: GitHub's **native issue dependencies**, the canonical, UI-visible representation. Add an edge with `gh issue create --blocked-by , ...` or `gh issue edit --add-blocked-by ` (`gh` 2.94+). Older `gh`: `gh api --method POST repos///issues//dependencies/blocked_by -F issue_id=`, where `` is the blocker's numeric **database id** (`gh api repos///issues/ --jq .id`, _not_ the `#number` or `node_id`). Where dependencies aren't available, fall back to a `Blocked by: #, #` line at the top of the child body. A ticket is unblocked when every blocker is closed. +- **Blocking**: use GitHub's native issue dependencies. Add an edge with `gh issue create --blocked-by , ...` or `gh issue edit --add-blocked-by ` (`gh` 2.94+). Older `gh`: `gh api --method POST repos///issues//dependencies/blocked_by -F issue_id=`, where `` is the blocker's numeric **database id** (`gh api repos///issues/ --jq .id`, _not_ the `#number` or `node_id`). Where dependencies aren't available, fall back to a `Blocked by: #, #` line at the top of the child body. A ticket is unblocked when every blocker is closed. - **Count open blockers**: `gh api repos///issues/ --jq .issue_dependencies_summary.blocked_by` (open blockers only; 0 means startable). `gh issue view --json blockedBy` also lists closed blockers, so filter it: `--jq '[.blockedBy.nodes[] | select(.state == "OPEN")] | length'`. - **Comment on an issue**: `gh issue comment --body "..."` -- **Apply / remove labels**: `gh issue edit --add-label "..."` / `--remove-label "..."` +- **Apply / remove labels**: `gh issue edit --add-label "..."` / `--remove-label "..."`. See `triage-labels.md` for the triage vocabulary. - **Close**: post the explanation with `gh issue comment --body "..."`, then `gh issue close `. On an already-closed issue, `gh issue close --comment` drops the comment and still exits 0. -Infer the repo from `git remote -v`; `gh` does this automatically when run inside a clone. - -File issues only into the user's own repo. Never file into `mattpocock/skills` (the repo these skills come from) unless the user owns it. In a fork, `gh` can default to the upstream parent, so before the first `gh issue create` of a session, check the target with `gh repo view --json nameWithOwner` and confirm it with the user if it is not their repo. - -## Pull requests as a triage surface - -**PRs as a request surface: no.** _(Set to `yes` if this repo treats external PRs as feature requests; `/triage` reads this flag.)_ - -When set to `yes`, PRs run through the same labels and states as issues, using the `gh pr` equivalents: - -- **Read a PR**: `gh pr view `, then `gh pr view --comments` (off a TTY, `--comments` prints only the comments, not the body), and `gh pr diff ` for the diff. -- **List external PRs for triage**: `gh api --paginate 'repos/{owner}/{repo}/pulls?state=open' --jq '.[] | select(.author_association | IN("OWNER","MEMBER","COLLABORATOR") | not) | {number, title, author: .user.login, author_association, labels: [.labels[].name]}'`. -- **Comment / label / close**: `gh pr comment`, `gh pr edit --add-label`/`--remove-label`, `gh pr close`. +`gh` infers the repo from `git remote -v` when run inside a clone. In a fork it can default to the upstream parent, so before the first `gh issue create` of a session, check the target with `gh repo view --json nameWithOwner` and confirm with the user if it isn't the repo they intend. GitHub shares one number space across issues and PRs, so a bare `#42` may be either: resolve with `gh pr view 42` and fall back to `gh issue view 42`. - -## When a skill says "publish to the issue tracker" - -Create a GitHub issue. - -## When a skill says "fetch the relevant ticket" - -Read it as in **Read an issue** above. - -## Wayfinding operations - -Used by `/wayfinder`. The **map** is a single issue with **child** issues as tickets. - -- **Map**: a single issue labelled `wayfinder:map`, holding the Notes / Decisions-so-far / Fog body. `gh issue create --label wayfinder:map`. -- **Child ticket**: an issue linked to the map as a GitHub sub-issue (see **Make an issue a sub-issue of a parent**). Where sub-issues aren't enabled, add the child to a task list in the map body and put `Part of #` at the top of the child body. Labels: `wayfinder:` (`research`/`prototype`/`grilling`/`task`). Once claimed, the ticket is assigned to the driving dev. -- **Blocking**: see **Blocking** under Conventions. -- **Frontier query**: list the map's open children (`gh issue list --state open`, scoped to the map's sub-issues / task list), drop any with an open blocker (see **Count open blockers**, or an open issue in the `Blocked by` line) or an assignee; first in map order wins. -- **Claim**: `gh issue edit --add-assignee @me`, the session's first write. -- **Resolve**: `gh issue comment --body ""`, then `gh issue close `, then append a context pointer (gist + link) to the map's Decisions-so-far. diff --git a/docs/agents/triage-labels.md b/docs/agents/triage-labels.md index 52764642..a5961e6d 100644 --- a/docs/agents/triage-labels.md +++ b/docs/agents/triage-labels.md @@ -1,15 +1,11 @@ # Triage Labels -The skills speak in terms of five canonical triage roles. This file maps those roles to the actual label strings used in this repo's issue tracker. - -| Label in mattpocock/skills | Label in our tracker | Meaning | -| -------------------------- | -------------------- | ---------------------------------------- | -| `needs-triage` | `needs-triage` | Maintainer needs to evaluate this issue | -| `needs-info` | `needs-info` | Waiting on reporter for more information | -| `ready-for-agent` | `ready-for-agent` | Fully specified, ready for an AFK agent | -| `ready-for-human` | `ready-for-human` | Requires human implementation | -| `wontfix` | `wontfix` | Will not be actioned | - -When a skill mentions a role (e.g. "apply the AFK-ready triage label"), use the corresponding label string from this table. - -Edit the "Label in our tracker" column to match whatever vocabulary you actually use. +Labels used to track an issue's triage state on GitHub. Use these exact strings; don't create variants. + +| Label | Meaning | +| ----------------- | ----------------------------------------------------------- | +| `needs-triage` | A maintainer needs to evaluate this issue | +| `needs-info` | Waiting on the reporter for more information | +| `ready-for-agent` | Fully specified; a coding agent can implement it unattended | +| `ready-for-human` | Specified, but needs a human to implement it | +| `wontfix` | Will not be actioned | From 01720cb19caa5bafd93893df31cc26fbbc65dfbe Mon Sep 17 00:00:00 2001 From: Taylor Steinberg Date: Tue, 10 Nov 2026 10:43:43 -0500 Subject: [PATCH 5/5] docs: slim AGENTS.md and move architecture notes to docs/agents Release steps now defer to CONTRIBUTING.md, which already documents the release PR flow. The architecture map is corrected against the code and covers shinyapps.io, Connect Cloud, and Node.js. Co-Authored-By: Claude Opus 5.5 --- AGENTS.md | 146 +++++------------------------------- docs/agents/architecture.md | 56 ++++++++++++++ 2 files changed, 73 insertions(+), 129 deletions(-) create mode 100644 docs/agents/architecture.md diff --git a/AGENTS.md b/AGENTS.md index f69567ad..0ce227b2 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -63,143 +63,31 @@ just dist just install ``` -## Code Architecture - -### Core Modules - -**main.py** - CLI entry point using Click framework. Defines all commands (deploy, add, list, etc.) and option parsing. Commands delegate to action functions. - -**api.py** - HTTP client for Posit Connect API. Key classes: -- `RSConnectServer` - represents a Connect server (URL, API key, certificates) -- `RSConnectClient` - low-level HTTP operations -- `RSConnectExecutor` - high-level deployment operations (deploy_bundle, wait_for_task, etc.) -- `SPCSConnectServer` - specialized server for Snowflake deployments - -**actions.py & actions_content.py** - High-level deployment orchestration: -- `actions.py` - deployment workflows (test connections, create bundles, validate Quarto) -- `actions_content.py` - content management (list, search, build history, download bundles) - -**bundle.py** - Content bundling and manifest generation. Creates tar.gz bundles containing: -- Application files -- `manifest.json` describing app mode, entry point, dependencies -- Environment snapshot (requirements.txt or environment.yml) - -Functions named `make_*_bundle()` for different content types (api, html, notebook, tensorflow, voila, quarto). - -**models.py** - Data structures: -- `AppMode` - represents content types (shiny, quarto-shiny, jupyter-static, python-api, etc.) -- `AppModes` - registry of all supported app modes with lookup functions -- TypedDict models for API responses (ContentItemV1, TaskStatusV1, etc.) - -**metadata.py** - Persistent storage of configuration: -- `ServerStore` - saved server credentials (stored in `~/.rsconnect-python/`) -- `AppStore` - deployment history per directory (stored in local `rsconnect-python/` subdirs) - -**environment.py** - Python dependency detection: -- Inspects virtual environments, conda environments, or current Python -- Generates requirements files for reproducible deployments -- Runs inspection in subprocess for isolation - -### Deployment Flow - -1. **Validate** - Check server connection, validate content files -2. **Bundle** - Create manifest.json, snapshot dependencies, tar content files -3. **Upload** - POST bundle to `/v1/content` or existing content GUID -4. **Deploy** - Server extracts bundle, starts deployment task -5. **Wait** - Poll task status until COMPLETE or ERROR -6. **Store** - Save deployment metadata to local AppStore +## Code Style -### App Modes +- `ruff format` (120-character lines) and `ruff check` are enforced in CI. `tests/test_metadata.py` is exempt from the line-length rule. +- Pyright runs in strict mode (`typeCheckingMode = "strict"`). It is advisory and doesn't fail `just lint`. +- Support Python 3.8+. Import newer typing features from `typing_extensions`. +- Use `TypedDict` for structured dictionaries such as API responses and manifest data. -Different content types have different app modes (defined in models.py): -- `python-shiny` - Shiny for Python apps -- `quarto-shiny` - Quarto documents with Shiny runtime -- `jupyter-static` - Rendered Jupyter notebooks -- `python-api` - FastAPI, Flask APIs -- `python-dash` - Plotly Dash apps -- `python-streamlit` - Streamlit apps -- `python-holoviz-panel` - HoloViz Panel apps -- etc. +## Important Patterns -The app mode determines how Connect runs the content. Manifests must specify the correct mode. +- Raise `RSConnectException` for user-facing operational errors, with a message that says what went wrong and how to fix it. +- Wrap CLI steps in `cli_feedback()` (in `actions.py`) for consistent OK/ERROR output. +- Log user-visible progress with `logger.info()` and diagnostics with `logger.debug()`. `log.py` also defines a `VERBOSE` level between the two. +- Use Click's `echo()` / `secho()` for console output. +- `AppModes` in `models.py` is the canonical list of content types; a manifest must declare the right one. ## Testing -### Test Structure -- Unit tests in `tests/` mirror module structure (`test_bundle.py`, `test_api.py`, etc.) -- Uses `pytest` with `httpretty` for mocking HTTP requests -- `conftest.py` defines shared fixtures - -### Key Test Patterns -- Mock HTTP responses with `httpretty` decorators -- Use temporary directories for file operations -- Test fixtures in `tests/testdata/` for sample content -- `test_metadata.py` has long lines that exceed the default line length limit - -### CI/CD -- GitHub Actions workflow in `.github/workflows/main.yml` -- Tests run on Python 3.8-3.14 across ubuntu/macos/windows -- Linting enforced on all PRs -- Coverage reported on Python 3.8 PRs +- Tests in `tests/` mirror the module names (`test_bundle.py`, `test_api.py`, ...). Shared fixtures are in `conftest.py`; sample content is in `tests/testdata/`. +- Mock HTTP with `httpretty`. Use temporary directories for anything that writes files. +- Integration tests against a live Connect server run only when `CONNECT_SERVER` and `CONNECT_API_KEY` are set. Unset them if unrelated tests fail unexpectedly. -## Code Style - -### Python Standards -- `ruff format` for formatting (120 char line length) -- `ruff check` for linting (enforced in CI) -- Pyright for type checking (advisory; does not fail `just lint`) -- Python 3.8+ compatibility (use `typing_extensions` for newer types) - -### Type Annotations -- Strict type checking enabled (`typeCheckingMode = "strict"`) -- Use `TypedDict` for structured dictionaries (API responses, manifest data) -- Import from `typing_extensions` for Python 3.8-3.10 compatibility -- `py.typed` marker indicates typed package - -## Important Patterns +## More guidance -### Error Handling -- Raise `RSConnectException` for operational errors (user-facing) -- Include helpful error messages with context -- Use `cli_feedback()` context manager for OK/ERROR output - -### Logging -- Logger in `log.py` with custom VERBOSE level between INFO and DEBUG -- Use `logger.info()` for user-visible progress -- Use `logger.debug()` for detailed diagnostics -- Console output uses Click's `echo()` and `secho()` for colors - -### Manifest Generation -- Every deployment requires a `manifest.json` describing the content -- Manifests include file checksums, app mode, entry point, dependencies -- Different manifest generators for different content types - -### Server Communication -- All API calls go through `RSConnectClient` in api.py -- Handle non-JSON responses and network errors gracefully -- Retry logic built into executor methods -- Support for certificate validation with custom CA bundles - -## Releasing - -- Version is a static field in `pyproject.toml`, managed with `uv version`. -- `main` carries a `.dev` version (e.g. `1.29.1.dev0`). -- Update CHANGELOG.md before each release (even betas). -- Cut a release: `uv version --bump stable`, commit, `git tag -a 1.2.3 -m 'Release 1.2.3'`, push the tag. -- The `distributions` CI job asserts the tag matches the `pyproject.toml` version, then builds and publishes to PyPI. -- After releasing, bump `main` back to the next `.dev` version with `uv version .dev0`. - -## Special Integrations - -### Quarto -- Quarto support requires quarto CLI installed -- `actions.py` has `quarto_inspect()` for introspecting projects -- Special handling for Quarto projects with Shiny runtime - -### Snowflake -- Special deployment path for Snowflake Snowpark -- `SPCSConnectServer` class for Snowflake-specific authentication -- JWT generation in `snowflake.py` +- `docs/agents/architecture.md`: module map, deployment targets, and the deployment flow. Read it before changing `api.py`, `bundle.py`, or deployment commands. +- `CONTRIBUTING.md`: contributor workflow, testing against Connect, and the release process. ## Issues and domain docs diff --git a/docs/agents/architecture.md b/docs/agents/architecture.md new file mode 100644 index 00000000..aea2cf84 --- /dev/null +++ b/docs/agents/architecture.md @@ -0,0 +1,56 @@ +# Architecture + +A map of the `rsconnect/` package for agents working on deployment, bundling, or server code. Read the code for details; this file only tells you where to look. + +## Deployment targets + +Server classes subclass `AbstractRemoteServer` in `api.py`: + +| Target | Server class | Client / service | +| --------------------------------- | -------------------- | ------------------------------------------- | +| Posit Connect | `RSConnectServer` | `RSConnectClient` | +| Posit Connect on Snowflake (SPCS) | `SPCSConnectServer` | `RSConnectClient` | +| shinyapps.io | `ShinyappsServer` | `PositClient`, `ShinyappsService` | +| Posit Connect Cloud | `ConnectCloudServer` | `ConnectCloudClient`, `ConnectCloudService` | + +`S3Server` / `S3Client` handle bundle storage uploads; they are not a deployment target you can name on the command line. + +`RSConnectExecutor` (in `api.py`) drives a deployment end to end and dispatches on the target. + +## Modules + +- **`main.py`**: Click CLI. Commands parse options and delegate to `actions*.py`, `bundle.py`, and `api.py`. The `deploy` and `write-manifest` groups have one subcommand per content type. +- **`api.py`**: server classes, HTTP clients, and `RSConnectExecutor`. +- **`actions.py`**: deployment helpers, `cli_feedback()`, and `quarto_inspect()`. +- **`actions_content.py`**: content management (search, build history, bundle download). +- **`actions_environment.py`**, **`actions_integration.py`**: public API for Connect execution environments and OAuth integrations. +- **`bundle.py`**: `Manifest` and `Bundle`, plus `make_*_bundle()` builders per content type (notebook, Quarto, HTML, TensorFlow, Voila, API, Node.js, from an existing manifest). +- **`models.py`**: `AppModes` (canonical content types) and `TypedDict` models for API payloads. +- **`metadata.py`**: on-disk stores. `ServerStore` holds saved server credentials in the platform config directory (see `config_dirname()`). `AppStore` records deployments, next to the content in an `rsconnect-python/` directory, falling back to the config directory. +- **`environment.py`**: Python environment detection. Runs `subprocesses/inspect_environment.py` under the target interpreter so inspection is isolated from the CLI's own environment. +- **`environment_node.py`**: Node.js/npm environment detection. +- **`preflight.py`**, **`preflight_node.py`**: checks that a Python or Node.js project is deployable before uploading. +- **`pyproject.py`**: reads Python version requirements from static project metadata. +- **`oauth.py`**, **`device_login.py`**: OAuth login (Connect and Connect Cloud). **`connect_cloud.py`**: Connect Cloud URLs and auth configuration. +- **`snowflake.py`**: wraps the `snow` CLI to list connections and generate JWTs for SPCS. +- **`json_web_token.py`**: JWT handling for `rsconnect bootstrap`. +- **`git_metadata.py`**: attaches git commit, branch, and remote URL metadata to bundle uploads. +- **`quickstart/`**: `rsconnect quickstart` project scaffolding. +- **`log.py`**: logger with a custom `VERBOSE` level between INFO and DEBUG. + +## Posit Connect deployment flow + +1. **Validate**: check the server connection and content files. +2. **Bundle**: write `manifest.json`, snapshot dependencies, tar the content. +3. **Create**: `POST v1/content` for new content, or reuse an existing content GUID. +4. **Upload**: `POST v1/content/{guid}/bundles`. +5. **Deploy**: `POST v1/content/{guid}/deploy` starts a server-side task. +6. **Wait**: `RSConnectClient.wait_for_task()` polls until the task finishes. +7. **Store**: record the deployment in `AppStore`. + +Other targets follow the same shape through their own clients. + +## Integrations + +- **Quarto**: requires the `quarto` CLI. `quarto_inspect()` introspects Quarto documents and projects (`quarto-static` and `quarto-shiny` app modes). +- **Snowflake**: requires the `snow` CLI; see `snowflake.py`.