|
| 1 | +# projspec VSCode Extension — User Actions |
| 2 | + |
| 3 | +This document describes every user action available in the `projspec` VSCode |
| 4 | +extension. |
| 5 | + |
| 6 | +The extension activates automatically once VS Code finishes starting up |
| 7 | +(`onStartupFinished`). |
| 8 | + |
| 9 | +--- |
| 10 | + |
| 11 | +## Command Palette Commands |
| 12 | + |
| 13 | +### `Show Project Library` (`projspec.showTree`) |
| 14 | + |
| 15 | +Opens the Project Library panel. |
| 16 | + |
| 17 | +**Steps:** |
| 18 | +1. Runs `projspec library list --json-out` to load the project tree. |
| 19 | +2. Runs `projspec info` once to load documentation for all spec/content/artifact types (cached for the lifetime of the window). |
| 20 | +3. Opens the **"Project Library"** panel. |
| 21 | + |
| 22 | +--- |
| 23 | + |
| 24 | +### `Open Project` (`projspec.openProject`) |
| 25 | + |
| 26 | +Opens a project folder in a new VS Code window. |
| 27 | +This command is invoked internally when a project node is clicked inside |
| 28 | +the Project Library panel. |
| 29 | + |
| 30 | +- **Local projects** (`file://` URLs): opens the folder directly with |
| 31 | + `vscode.openFolder`. |
| 32 | +- **Remote GCS projects** (`gs://` URLs): shows an error — "Cannot open GCS |
| 33 | + buckets directly. Clone the repository locally first." |
| 34 | +- **Other URL schemes**: shows an error — "Unsupported project URL scheme: …" |
| 35 | + |
| 36 | +--- |
| 37 | + |
| 38 | +### `Show` (`projspec.showJson`) |
| 39 | + |
| 40 | +Serialises a project tree node to JSON and opens it as a read-only editor tab. |
| 41 | +This command is invoked internally from the Project Library panel when a |
| 42 | +spec, content, or artifact node is selected. |
| 43 | + |
| 44 | +**Steps:** |
| 45 | +1. Receives a tree node item. |
| 46 | +2. JSON-stringifies the node's raw data. |
| 47 | +3. Opens a new unsaved document with JSON syntax highlighting in the editor. |
| 48 | + |
| 49 | +--- |
| 50 | + |
| 51 | +## Project Library Panel |
| 52 | + |
| 53 | +The Project Library panel (`projspec.showTree`) renders a custom HTML UI |
| 54 | +inside a Webview. The following interactive elements are available. |
| 55 | + |
| 56 | +### Toolbar |
| 57 | + |
| 58 | +| Element | Action | |
| 59 | +|---------|--------| |
| 60 | +| **Scan** button | Scans the current workspace folder into the projspec library (`projspec scan --library <folderPath>`), then refreshes the tree. | |
| 61 | +| **Create** button | Opens the [Create Project modal](#create-project-modal). | |
| 62 | +| **Search input** | Live-filters the tree by project name or any visible child field. Click the **×** button or press **Escape** to clear. | |
| 63 | +| **Expand All** button | Expands every node in the tree. | |
| 64 | +| **Collapse All** button | Collapses every node in the tree. | |
| 65 | + |
| 66 | +### Tree Nodes |
| 67 | +The top-level nodes are all Projects, with a name and a project URL. The name is the final portion of the URL. |
| 68 | +Projects contain Specs, and both Specs and Projects contain Contents and Artifacts. In the tree view, |
| 69 | +all Artifacts are show, but only Contents that are direct |
| 70 | +children of a Project are shown. |
| 71 | + |
| 72 | +Nodes are colour-coded: |
| 73 | + |
| 74 | +- **Projects** — bold, folder colour |
| 75 | +- **Contents** — teal (`#4ec9b0`) |
| 76 | +- **Artifacts** — orange (`#ce9178`) |
| 77 | +- **Specs** — function symbol colour |
| 78 | + |
| 79 | +| Element | Action | |
| 80 | +|---------|--------| |
| 81 | +| Click a **project** node | Selects the node (no other action). Right-click to open the context menu. | |
| 82 | +| Right-click a **project** node | Opens a context menu with two options: **Open** opens the project folder in a new VS Code window; **Remove** runs `projspec library delete <project-URL>` and refreshes the panel. | |
| 83 | +| Click a **spec / content / artifact** node | Opens (or updates) the **Project Details** panel in the side column, showing the project's full spec/content/artifact tree with the clicked item highlighted. | |
| 84 | +| **▶ / ▼ arrow** on any node | Toggles the visibility of that node's children. | |
| 85 | +| **"Make" button** on an artifact node | Runs `projspec make <qname> "<projectPath>"` in a dedicated **projspec** terminal panel. | |
| 86 | +| **"i" info button** on a spec / content / artifact node | Shows an inline popup with the item's doc string and, when available, a link to the upstream specification documentation. Press **Escape** or click elsewhere to dismiss. | |
| 87 | + |
| 88 | +### Create Project Modal |
| 89 | + |
| 90 | +Opened by the **Create** button in the toolbar. |
| 91 | + |
| 92 | +| Element | Action | |
| 93 | +|---------|--------| |
| 94 | +| **Type input with autocomplete** | Start typing a project spec type; suggestions appear below. Use **↑ / ↓** arrow keys or click to select a suggestion. | |
| 95 | +| **Create** button | Runs `projspec create <projectType> <folderPath>` in the current workspace folder, then automatically scans the result into the library (`projspec scan --library <folderPath>`) and refreshes the tree. | |
| 96 | +| **Cancel** button / **Escape** key | Dismisses the modal without creating anything. | |
| 97 | + |
| 98 | +--- |
| 99 | + |
| 100 | +## Project Details Panel |
| 101 | + |
| 102 | +Opened when a spec, content, or artifact node is clicked in the Library panel. A single panel is reused and updated on each click. |
| 103 | + |
| 104 | +The panel displays a header with the project name and URL, followed by a colour-coded tree of all the project's specs, contents, and artifacts — using the same visual conventions as the Library panel. |
| 105 | + |
| 106 | +| Element | Action | |
| 107 | +|---------|--------| |
| 108 | +| **▶ / ▼ arrow** on any node | Toggles the visibility of that node's children. | |
| 109 | +| **"Make" button** on an artifact node | Runs `projspec make <qname> "<projectPath>"` in a dedicated **projspec** terminal panel. | |
| 110 | +| **"i" info button** on a spec / content / artifact node | Shows an inline popup with the item's doc string and a link to specification documentation. Press **Escape** or click elsewhere to dismiss. | |
0 commit comments