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
73 changes: 73 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: PR Checks

# The rac-editors merge-gate battery (ADR-027, ADR-075): build, typecheck, and
# integration-test the VS Code / Cursor extension, then prove a VSIX packages.
# Adapted from rac-core's typescript.yml / extension-release.yml gate steps
# (recovered with the extension source; see rac/roadmaps/rac-editors-buildout.md
# in rac-core). Runs per member subdir; today that is vscode/ only.
on:
pull_request:
paths:
- "vscode/**"
- ".github/workflows/pr-checks.yml"
push:
branches: [main]
paths:
- "vscode/**"
- ".github/workflows/pr-checks.yml"
workflow_dispatch:

permissions:
contents: read

concurrency:
group: pr-checks-${{ github.ref }}
cancel-in-progress: true

jobs:
vscode:
name: vscode — build · test · package
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5

- uses: actions/setup-node@v4
with:
node-version: "20"
cache: npm
cache-dependency-path: vscode/package-lock.json

# The tests and the extension shell out to a real `rac`.
- uses: actions/setup-python@v6
with:
python-version: "3.11"
- name: Install rac
run: |
python -m pip install --upgrade pip
python -m pip install rac-core

- name: Install, typecheck, bundle
working-directory: vscode
run: |
npm ci
npm run check-types
npm run compile

# Provider tests launch a real VS Code over the fixture corpus, so they
# need a virtual display (xvfb) and `rac` on PATH (installed above).
- name: Integration tests (@vscode/test-electron)
working-directory: vscode
env:
RAC_BIN: rac
run: xvfb-run -a npm test

- name: Package vsix (smoke)
working-directory: vscode
run: npx @vscode/vsce package -o rac-vscode.vsix

- name: Upload vsix artifact
uses: actions/upload-artifact@v6
with:
name: rac-vscode-vsix
path: vscode/rac-vscode.vsix
retention-days: 14
5 changes: 5 additions & 0 deletions vscode/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
node_modules/
dist/
*.vsix
*.tsbuildinfo
out/
12 changes: 12 additions & 0 deletions vscode/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Run RAC Extension",
"type": "extensionHost",
"request": "launch",
"args": ["--extensionDevelopmentPath=${workspaceFolder}"],
"outFiles": ["${workspaceFolder}/dist/**/*.js"]
}
]
}
12 changes: 12 additions & 0 deletions vscode/.vscodeignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
.vscode/**
src/**
node_modules/**
esbuild.mjs
tsconfig.json
.gitignore
**/*.ts
**/*.map

out/**
fixtures/**
tsconfig.test.json
19 changes: 19 additions & 0 deletions vscode/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Changelog

## 0.1.0

Initial release — a thin client over the `rac` CLI (no engine logic is
reimplemented).

- Live per-file validation and cross-artifact enforcement (broken and retired
references) surfaced at the reference site.
- Authoring aids: artifact-ID completion in relationship sections,
missing-section quick-fixes, and a New Artifact command.
- Navigation: status-aware hover, go-to-definition, find-all-references,
clickable alias links, an Outline, and workspace symbols.
- Ambient awareness: a status-bar corpus health score and workspace-wide
diagnostics.
- RAC Explorer: a self-contained, offline corpus viewer with a list/detail view
and an Obsidian-style node-link graph, synced to the editor, served under a
strict Content-Security-Policy.
- Runs entirely on your machine with no telemetry and no network access.
86 changes: 86 additions & 0 deletions vscode/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# RAC for VS Code / Cursor

Inline validation for [RAC](../../README.md) (requirements-as-code) artifacts,
powered by the [`@itsthelore/rac-sdk`](../rac-sdk/README.md) thin client.

Open or save a RAC artifact (a Markdown file with `schema_version` frontmatter)
and validation findings appear as diagnostics — the same findings `rac validate`
reports on the command line, because the extension runs `rac` rather than
reimplementing it ([ADR-063](../../rac/decisions/adr-063-non-python-clients-are-thin.md)).

> Status: early (0.1.0).

## Requirements

- The `rac` CLI installed and discoverable (`pip install requirements-as-code`),
or its path set in `rac.path`.

## Features

- **Live validation** — diagnostics update as you type (the unsaved buffer is
piped through `rac validate -`, debounced), and immediately on open/save.
Errors + warnings are mapped to the right lines.
- **Cross-artifact enforcement** — references that don't resolve, and references
to **retired** (superseded/deprecated) artifacts, are flagged at the reference
site, drawn distinctly (from `rac relationships --validate`). Refreshes on
save/activation, since relationship validation reads files from disk.
- **Hover** — hovering an artifact ID or alias (e.g. `adr-007`,
`v0.20.0-python-sdk-foundation`) shows its title, type, **lifecycle status**
(⚠ for retired), a snippet, and its path.
- **Go-to-definition, find-all-references, clickable links** — jump to a target,
list every artifact that references the one under the cursor (from the export's
resolved edges), and Ctrl/Cmd-click any alias to open its file.
- **Outline & workspace symbols** — the artifact's sections in the Outline view,
and jump-to-any-artifact by title (Ctrl/Cmd-T).
- **Corpus awareness** — a status-bar health score (`rac review`, click for the
Problems panel) and workspace-wide diagnostics (`rac validate <dir>`), so issues
in unopened artifacts show up too.
- **RAC Explorer** — **RAC: Open Explorer** renders the corpus in a side panel
(the self-contained, offline Portal viewer from `rac export --html`): a
searchable list/detail view and an Obsidian-style **node-link graph** (a global
graph, or a local graph that follows the file you are editing). Selecting a node
opens its file, and switching files reveals that artifact in the graph.
- **Authoring aids** — artifact-alias completion inside relationship sections
(`## Related Decisions`, …), quick-fixes that insert a missing `## Section`,
and a **RAC: New Artifact** command that suggests an existing folder for the
type, then scaffolds via `rac new`.
- **RAC: Validate Open Artifacts** command.
- Graceful handling when `rac` is missing — a one-time prompt to install or set
`rac.path`, never a wall of errors.

Only Markdown files with a leading `schema_version` frontmatter block are
treated as RAC artifacts, so ordinary Markdown stays untouched.

The extension activates only in RAC workspaces (those with a `.rac/config.yaml`),
caches `rac` lookups (cleared on save) to stay responsive, warns once on `rac`
schema-version skew, and logs to a "RAC" output channel.

## Settings

| Setting | Default | Meaning |
| --- | --- | --- |
| `rac.path` | `""` | Path to `rac`. Empty = `RAC_BIN` env, else `rac` on `PATH`. |
| `rac.validate.enable` | `true` | Validate artifacts and show diagnostics. |

## Privacy

No telemetry. The extension runs entirely on your machine and only ever invokes
your local `rac` CLI — it makes no network requests and collects no usage data.
The Explorer webview is a self-contained, offline document served under a strict
Content-Security-Policy (no network, no remote code, no eval).

## Develop

```sh
npm install # links @itsthelore/rac-sdk from ../rac-sdk (build it first: cd ../rac-sdk && npm run build)
npm run check-types
npm run compile # esbuild → dist/extension.js
```

Then press **F5** (Run RAC Extension) to launch an Extension Development Host.

## Roadmap

Tracked in [`rac/roadmaps/future/typescript-sdk-vscode.md`](../../rac/roadmaps/future/typescript-sdk-vscode.md).
Next: relationship findings drawn at the reference site (`rac relationships` /
`rac review`), and completion for artifact IDs.
23 changes: 23 additions & 0 deletions vscode/esbuild.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Bundle the extension (and its @itsthelore/rac-sdk dependency) into a single CommonJS file
// for the VS Code extension host. `vscode` is provided by the host at runtime,
// so it stays external.
import * as esbuild from "esbuild";

const options = {
entryPoints: ["src/extension.ts"],
bundle: true,
platform: "node",
format: "cjs",
target: "node18",
external: ["vscode"],
outfile: "dist/extension.js",
sourcemap: true,
logLevel: "info",
};

if (process.argv.includes("--watch")) {
const ctx = await esbuild.context(options);
await ctx.watch();
} else {
await esbuild.build(options);
}
1 change: 1 addition & 0 deletions vscode/fixtures/corpus/.rac/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
repository_key: TESTFIX
26 changes: 26 additions & 0 deletions vscode/fixtures/corpus/rac/decisions/adr-001-foo.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
schema_version: 1
id: RAC-TEST00000001
type: decision
---
# ADR-001: Foo

## Context

Background for the fixture corpus.

## Decision

We choose foo.

## Consequences

Foo becomes the default; bar is retired.

## Status

Accepted

## Category

Architecture
26 changes: 26 additions & 0 deletions vscode/fixtures/corpus/rac/decisions/adr-002-bar.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
---
schema_version: 1
id: RAC-TEST00000002
type: decision
---
# ADR-002: Bar

## Context

The earlier approach.

## Decision

We chose bar.

## Consequences

Superseded by foo (ADR-001).

## Status

Superseded

## Category

Architecture
43 changes: 43 additions & 0 deletions vscode/fixtures/corpus/rac/roadmaps/v0.1.0-sample.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
---
schema_version: 1
id: RAC-TEST00000003
type: roadmap
---
# Sample Roadmap v0.1.0

## Status

Planned

## Context

A fixture roadmap that references a retired decision and a missing one, so the
extension's relationship enforcement has something to surface.

## Outcomes

- A fixture outcome the test can rely on.

## Initiatives

### Initiative 1 — Do the thing

Do the thing.

## Success Measures

- The thing is done.

## Assumptions

- The fixture holds.

## Risks

- The fixture could drift.

## Related Decisions

- adr-001-foo
- adr-002-bar
- adr-404-missing
Binary file added vscode/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Loading