StayFn for VS Code
Build, run and debug typed C# functions for Oracle OPERA Cloud (OHIP) without leaving your editor.
Features
The StayFn extension provides an interface for:
- Browsing and searching the OHIP catalog. Every OHIP module and operation (2,800+ operations from Oracle's official 26.3 specs) in
a tree, with a hover that shows the C# call, its parameters and its request and response types. Search filters every module at
once, and Open Catalog shows the whole catalog in a full editor tab as a searchable, sortable table with the typed call of the
selected operation and an Insert call button.
- Browsing your own functions. Every
[OhipFunction], [EventHandler] and scheduled function in your workspace, grouped by area,
with validation badges and one click to the source.
- Creating functions, event handlers and scheduled functions from a wizard. It asks for the name, the area, the OHIP operation (searched
in the catalog) and the inputs and outputs, then writes the class, its tests and a catalog doc stub.
- Inserting typed OHIP calls. One command inserts
await ctx.Ohip.Api.Rsv.SearchHotelReservationsAsync(…)-style calls with the
right parameters for any operation.
- Validating a file with the same registry checks and analyzers the host runs, reported in the Problems panel.
- Running functions locally. Start the local dev host with one click, then ▶ Invoke any function from a CodeLens with its input
pre-filled from the schema.
- Watching invocations live. A live feed of invocations with filters, and a detail view with the OHIP call timeline, retries,
dead letters and Replay, with personal data masked.
- Inspecting events. Inbox and outbox counts, recent events and stream checkpoint lag, and Send Test Event to exercise a handler.
- Editing variables at tenant, environment and hotel scope. Secrets show as
••• and are edited without being displayed.
- Code fixes from the StayFn analyzers: Replace HttpClient usage with ctx.Ohip and Make input type a record.
- Regenerating the OHIP SDKs, running the OPERA 5 equivalence report and exporting catalog docs from the command palette.
- Opening the ops dashboard of the dev host inside VS Code.
Quick start
Create a project and open it in VS Code.
With the stayfn tool installed (see Setting up your environment), run
stayfn new project MyHotelFunctions and open the new folder. It has a functions project on the StayFn SDK packages, a sample
function with its test, PostgreSQL for the dev host and a .mcp.json. The StayFn repository itself works too. The extension uses the
workspace to find your functions and the stayfn CLI, and the StayFn icon appears in the activity bar.
Add your OHIP credentials (only for functions that call OHIP).
Copy .env.example to .env and fill in the OHIP_SANDBOX_* values from the OHIP Developer Portal. See
Setting up your environment below.
Start the dev host.
Run StayFn: Start Dev Host, or click ○ StayFn in the status bar. It starts PostgreSQL if needed, builds your functions, runs
the host and turns the status bar to ● StayFn sandbox / <hotel>.
Create your first function.
Run StayFn: New Function and answer the wizard. The new class opens with its tests next to it.
Invoke it.
Click ▶ Invoke above [OhipFunction], edit the input and choose Run. The output and the invocation id appear.
See what happened.
Run Show Invocation, or click the invocation in the Invocations view, to see its OHIP calls.
The Get started with StayFn walkthrough (Help → Welcome → Walkthroughs) follows the same steps.
Requirements
- VS Code 1.95 or later.
- C# Dev Kit, for C# editing and the analyzer code fixes.
- The .NET 8 SDK.
- Docker. The dev host starts PostgreSQL with
docker compose when none is reachable.
- The
stayfn CLI, a .NET tool on GitHub Packages, and a project from stayfn new project (or the StayFn repository).
Setting up your environment
Install the .NET 8 SDK.
From dot.net, or brew install dotnet@8 on macOS.
Check in a new terminal: dotnet --list-sdks shows an 8.0.x entry.
Install Docker.
Docker Desktop, or on macOS without it: brew install colima docker docker-compose, then colima start.
Check: docker info answers.
Install the stayfn CLI.
The tool is on GitHub Packages, which needs a token even to read. Create a GitHub personal access token (classic) with the
read:packages scope, register the feed once, then install:
dotnet nuget add source https://nuget.pkg.github.com/rizanc/index.json --name stayfn-github \
--username <your GitHub user name> --password <token> --store-password-in-clear-text
dotnet tool install -g stayfn --add-source https://nuget.pkg.github.com/rizanc/index.json
Check: stayfn --help answers (~/.dotnet/tools must be on your PATH; the extension also looks there itself).
Create a project.
stayfn new project MyHotelFunctions, then open the folder. Its nuget.config reads the feed token from STAYFN_FEED_USERNAME and
STAYFN_FEED_TOKEN (export them in your shell profile), so dotnet test restores the SDK packages. No token is written into the
project.
Create your .env.
Copy .env.example to .env in the project folder (it is git-ignored) and fill in, from the OHIP Developer Portal:
| Variable |
From the portal |
OHIP_SANDBOX_GATEWAY_URL |
the environment's gateway URL |
OHIP_SANDBOX_APP_KEY |
the application key |
OHIP_SANDBOX_CLIENT_ID, OHIP_SANDBOX_CLIENT_SECRET |
the OAuth client |
OHIP_SANDBOX_ENTERPRISE_ID |
client-credentials environments only |
OHIP_SANDBOX_HOTEL_ID, OHIP_SANDBOX_CHAIN_CODE |
the hotel and chain you test against |
Pick the environment and hotel.
Run StayFn: Select Environment / Hotel…, or set stayfn.environment and stayfn.hotel.
Tip: keep the environment name sandbox (variables OHIP_SANDBOX_*). It is the default, so nothing else needs configuring.
Why StayFn
StayFn turns OHIP into typed, discoverable C# functions. You write a small class or method against Oracle's own generated models. One
host then runs every call through the same pipeline: tenant resolution, quotas, input validation, idempotency, the OHIP rate-limit
budget, retries, dead letters, metering and audit.
The extension brings that loop into the editor. You find the operation in the catalog and scaffold a function that calls it. Then you
validate it, run it against the sandbox and inspect every OHIP call it made, without leaving VS Code or writing HTTP by hand. Credentials
and tokens stay with the dev host; your code never handles them.
The extension is a thin client over the local dev host (stayfn dev) and the StayFn MCP server (stayfn mcp stdio). Scaffolding and
validation therefore behave exactly as they do from the CLI and from Claude Code.
Commands
Every command is in the Command Palette under StayFn:.
| Command |
What it does |
| New Function / New Event Handler / New Scheduled Function |
Scaffold the code, its tests and a doc stub |
| Validate Current File |
Registry checks and analyzers, into Problems |
| Invoke Function… |
Pick a function, edit its schema-filled input, run it on the dev host |
| Insert Typed Call Snippet |
Insert the typed ctx.Ohip.Api… call for an OHIP operation |
| Show OHIP Operation |
Parameters, schemas and the C# call of one operation |
| Search Catalog… / Clear Catalog Search |
Filter the Catalog view across every module (every word must match) |
| Open Catalog |
The full-window catalog: search, sort, see an operation's typed call, insert it into your C# file |
| Start Dev Host / Stop Dev Host / Reload Dev Host |
Run stayfn dev in a terminal, stop it, or restart it after a change |
| Show Invocation / Last 10 Invocations / Filter Invocations… |
Inspect invocations and their OHIP calls |
| Replay Dead Letter |
Replay a failed invocation's dead letter |
| Send Test Event… |
Post a test event to the dev tenant's inbox |
| Edit Variable… |
Edit a tenant, environment or hotel variable (secrets blind) |
| Select Environment / Hotel… |
Choose where invocations run |
| Open Dashboard |
The ops dashboard in VS Code's Simple Browser |
| Regenerate OHIP SDKs |
Run tools/kiota/generate.sh |
| Run Equivalence Report |
OPERA 5 vs OHIP comparison (stayfn equivalence run) |
| Export Catalog Docs |
Write docs/functions/*.md from the catalog |
| Refresh (per view) |
Reload the Catalog, Functions, Invocations, Events or Variables view |
In the editor:
- CodeLens above every function: ▶ Invoke, Validate and Last 10 invocations.
- Snippets:
stayfn-function, stayfn-handler, stayfn-scheduled.
- The
stayfn: validate task with a problem matcher.
- JSON schemas for
stayfn.settings.json and tests/fixtures/**/*.json.
- A status bar showing the dev host state, the environment and hotel, and the OHIP rate-limit budget.
Settings
| Setting |
Default |
Meaning |
stayfn.devHostUrl |
http://localhost:5080 |
Base URL of the dev host |
stayfn.environment |
sandbox |
OHIP environment of the dev tenant |
stayfn.hotel |
empty |
Hotel code for invocations (empty: the tenant's default hotel) |
stayfn.mcpPath |
empty |
The stayfn CLI; empty = .mcp.json, then PATH, then the repository build |
stayfn.functionsProject |
empty |
The project stayfn dev watches (empty = auto-detect) |
stayfn.telemetry |
false |
Opt-in usage telemetry (no sink ships in this version) |
Telemetry
Off by default, and this version contains no telemetry sink at all. The extension talks only to the configured dev host and the local MCP
server. It never sends payloads, hotel codes, tenant ids, tokens or file contents anywhere.
More
The full guide, with every command id, troubleshooting and development notes, is docs/vscode-extension.md in the
StayFn repository. This is a pre-release.
| |