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
5 changes: 5 additions & 0 deletions .projectroom/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ product:
summary: Show the number of configured services, tools, servers, APIs, suites, data sources and declared variable names, plus product content counts, in the expanded navigation.
status: done
relatedComponents: [product-spec, web]
- id: explorer-deduplication
title: Show each explorer integration once
summary: Merge linked CLI and MCP discoveries into their registered entries, and normalize OpenAPI spec paths before showing additional local files.
status: done
relatedComponents: [web]
- id: evidence-based-onboarding
title: Evidence-based onboarding progress
summary: Count only detected sections, keep configured entries separate from hands-on verification, review paths, commands and environment names, and make the agent inspect before writing.
Expand Down
4 changes: 2 additions & 2 deletions desktop/api-explorer.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ function listApiSources(root, config) {
if (item.spec) try { spec = readSpec(root, item.spec); } catch (cause) { error = cause.message; }
return { ...item, id: `yaml:${item.id}`, source: '.projectroom/project.yaml', linked: true, operations: spec?.operations || [], specTitle: spec?.title || '', specVersion: spec?.version || '', error };
});
const linkedPaths = new Set((config.workspace?.apiSources || []).map(item => item.spec).filter(Boolean));
return [...configured, ...discoverSpecs(root).filter(item => !linkedPaths.has(item.spec)).map(item => ({ ...item, linked: false, baseUrl: '' }))];
const linkedPaths = new Set((config.workspace?.apiSources || []).map(item => item.spec).filter(Boolean).map(spec => path.resolve(root, spec)));
return [...configured, ...discoverSpecs(root).filter(item => !linkedPaths.has(path.resolve(root, item.spec))).map(item => ({ ...item, linked: false, baseUrl: '' }))];
}
function editDocument(root) {
const base = fs.realpathSync(root);
Expand Down
21 changes: 20 additions & 1 deletion desktop/mcp-explorer.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,17 @@ function substitute(value, environment) {
return String(value).replace(/\$\{([A-Z][A-Z0-9_]*)\}/g, (_match, name) => environment[name] || '');
}

function serverTarget(root, item) {
if (item.builtIn) return null;
if (item.transport === 'stdio') {
if (!item.command) return null;
return JSON.stringify(['stdio', path.resolve(root, item.cwd || '.'), item.command, item.args || []]);
}
if (!item.url) return null;
try { return JSON.stringify([item.transport, new URL(item.url).href]); }
catch { return null; }
}

class McpExplorer {
constructor(options) { this.options = options; this.active = new Map(); }
discover() {
Expand All @@ -81,8 +92,16 @@ class McpExplorer {
list() {
const linked = new Map((this.options.getConfig()?.workspace?.mcpServers || []).filter(item => item.linkedFrom).map(item => [item.linkedFrom, item.id]));
const root = this.options.getRoot();
const candidates = this.discover();
const registered = new Map(candidates.filter(item => item.source === '.projectroom/project.yaml')
.map(item => [serverTarget(root, item), item.id.slice(5)]).filter(([target]) => target));
for (const item of candidates) {
if (item.builtIn || item.source === '.projectroom/project.yaml' || linked.has(item.id)) continue;
const match = registered.get(serverTarget(root, item));
if (match) linked.set(item.id, match);
}
const revision = root ? sourceRevision(root) : null;
return this.discover().map(item => ({ ...publicCandidate(item, name => !!this.options.getEnvironment(name)),
return candidates.map(item => ({ ...publicCandidate(item, name => !!this.options.getEnvironment(name)),
connected: this.active.has(item.id), linkedId: linked.get(item.id) || null,
buildIdentity: this.active.get(item.id)?.buildIdentity || (item.transport === 'stdio' && !item.builtIn && item.build?.file ? readBuildIdentity(root, item, revision) : null) }));
}
Expand Down
5 changes: 5 additions & 0 deletions dist/.projectroom/project.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,11 @@ product:
summary: Show the number of configured services, tools, servers, APIs, suites, data sources and declared variable names, plus product content counts, in the expanded navigation.
status: done
relatedComponents: [product-spec, web]
- id: explorer-deduplication
title: Show each explorer integration once
summary: Merge linked CLI and MCP discoveries into their registered entries, and normalize OpenAPI spec paths before showing additional local files.
status: done
relatedComponents: [web]
- id: evidence-based-onboarding
title: Evidence-based onboarding progress
summary: Count only detected sections, keep configured entries separate from hands-on verification, review paths, commands and environment names, and make the agent inspect before writing.
Expand Down
8 changes: 5 additions & 3 deletions dist/cli-explorer-ui.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions dist/docs/product/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ The source audit improves setup completeness but is not a universal protocol imp

## API Explorer

A project OpenAPI file already named in `workspace.apiSources` appears only as the registered API, including when the relative path uses a `./` prefix.

Project-local OpenAPI 3.x files are scanned read-only and listed beside HTTP APIs declared in `workspace.apiSources`. The file remains the source of truth for endpoint paths and summaries; the repository YAML stores only its relative path, clean base URL and public authentication metadata. Alternatively, `specPath` identifies a dynamically served OpenAPI document on the registered API. The user must click **Load OpenAPI**; the main process fetches from that API's origin without redirects or authentication headers, with a timeout and 2 MB limit. An API can be registered without a spec and tested with a manually entered relative path. The main process performs a request only after the user clicks Send, checks that the target stays on the selected origin, blocks redirects, applies a timeout and bounds the response preview. It resolves Bearer and API-key values from the local project `.env`. Public-client OAuth uses PKCE and a loopback callback; access and refresh tokens are encrypted outside the repository with macOS secure storage. Activity records only request metadata, without headers, query values, body or response content. The included Hello Workspace has a matching OpenAPI document for its real health and notes endpoints.

## MCP Explorer

The desktop main process uses the official MCP client SDK to connect to explicitly selected project servers over stdio, Streamable HTTP or legacy SSE. It keeps one client session per connected server, so several can remain connected while the user switches between them. Read-only discovery scans project-local MCP configuration and shared `workspace.mcpServers`; it does not launch anything. Add, link and remove actions update the YAML array atomically after schema validation; linked entries record the discovered source ID. The renderer gets safe server metadata, capabilities, schemas and user-requested results over IPC. Connect, disconnect and invocation metadata goes to `.productview/events.jsonl`; arguments and responses remain in memory. YAML declares only static variable names or public OAuth client metadata. Static values come from the ignored project `.env`; SDK-managed OAuth credentials are encrypted locally and scoped to the workspace and endpoint. The built-in Project Room MCP server serves coding agents and is hidden from the project MCP Explorer.

### Linked MCP entries

The catalog shows a client setting only when it is not already linked to a YAML registration. Matching uses transport plus the complete command or URL; different arguments and endpoints remain separate.
2 changes: 2 additions & 0 deletions dist/docs/product/command-tools.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# CLI Explorer

An entry point already linked to a registered YAML tool appears only once, under the registered tool. Catalog counts reflect distinct tools rather than both discovery and registration.

CLI Explorer follows the same browse and inspect layout as MCP Explorer. The left catalog lists **Discovered locally** entry points found by reading the open repository: `package.json` `bin` entries, Python project scripts, Cargo binaries, Go `cmd/*/main.go` and `examples/*/main.go` programs, and executable CLI files. A package CLI whose declared `dist/` or `build/` target is absent is labeled **Build required**; it cannot be run, linked or queried for help until that target exists. This scan does not run candidates. It is intentionally bounded and may miss custom build systems; ordinary package scripts and tests are not automatically treated as product CLIs. **In .projectroom/project.yaml** lists registered `commandTool` components. Select either type to inspect it on the right.

Select a discovered entry to see its source file and exact command. **Read help** explicitly starts the command with `--help`, `-h`, or `help` and shows the real output, including a parsed synopsis, paired short and long flags, common subcommand lists and positional arguments where recognizable. Parsed commands and options become suggestions in Explore. The full original output stays visible because CLI help has no universal machine-readable format. A program can have side effects even while printing help; Project Room never requests it automatically. Discovery does not prove that the CLI is safe or fully documented.
Expand Down
2 changes: 1 addition & 1 deletion dist/mcp-explorer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
let message = '';
const safe = value => escapeHtml(value == null ? '' : String(value));
const selected = () => servers.find(item => item.id === selectedId);
const projectServers = async () => (await pv.listMcpServers()).filter(item => !item.builtIn);
const projectServers = async () => (await pv.listMcpServers()).filter(item => !item.builtIn && !item.linkedId);
const editable = item => !!item && item.id.startsWith('yaml:');
const activeItems = () => detail ? ({ tools: detail.tools, resources: detail.resources, templates: detail.resourceTemplates, prompts: detail.prompts })[selectedKind] || [] : [];
const activeItem = () => activeItems().find(item => (item.name || item.uri || item.uriTemplate) === selectedName);
Expand Down
9 changes: 9 additions & 0 deletions dist/projectroom.json
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,15 @@
"web"
]
},
{
"id": "explorer-deduplication",
"title": "Show each explorer integration once",
"summary": "Merge linked CLI and MCP discoveries into their registered entries, and normalize OpenAPI spec paths before showing additional local files.",
"status": "done",
"relatedComponents": [
"web"
]
},
{
"id": "evidence-based-onboarding",
"title": "Evidence-based onboarding progress",
Expand Down
4 changes: 3 additions & 1 deletion dist/v5.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ async function commandDiscover(force = false) {
const found = await pv.discoverCliTools();
if (root === projectRoot) {
commandCandidates = found;
if (commandCandidateId && !found.some(item => item.id === commandCandidateId)) commandCandidateId = null;
const selected = found.find(item => item.id === commandCandidateId);
if (selected?.linkedId) { commandSelectedId = selected.linkedId; commandCandidateId = null; }
else if (commandCandidateId && !selected) commandCandidateId = null;
}
} catch (error) { if (root === projectRoot) commandCandidatesError = error.message; }
finally {
Expand Down
6 changes: 6 additions & 0 deletions docs/product/architecture.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,14 @@ The source audit improves setup completeness but is not a universal protocol imp

## API Explorer

A project OpenAPI file already named in `workspace.apiSources` appears only as the registered API, including when the relative path uses a `./` prefix.

Project-local OpenAPI 3.x files are scanned read-only and listed beside HTTP APIs declared in `workspace.apiSources`. The file remains the source of truth for endpoint paths and summaries; the repository YAML stores only its relative path, clean base URL and public authentication metadata. Alternatively, `specPath` identifies a dynamically served OpenAPI document on the registered API. The user must click **Load OpenAPI**; the main process fetches from that API's origin without redirects or authentication headers, with a timeout and 2 MB limit. An API can be registered without a spec and tested with a manually entered relative path. The main process performs a request only after the user clicks Send, checks that the target stays on the selected origin, blocks redirects, applies a timeout and bounds the response preview. It resolves Bearer and API-key values from the local project `.env`. Public-client OAuth uses PKCE and a loopback callback; access and refresh tokens are encrypted outside the repository with macOS secure storage. Activity records only request metadata, without headers, query values, body or response content. The included Hello Workspace has a matching OpenAPI document for its real health and notes endpoints.

## MCP Explorer

The desktop main process uses the official MCP client SDK to connect to explicitly selected project servers over stdio, Streamable HTTP or legacy SSE. It keeps one client session per connected server, so several can remain connected while the user switches between them. Read-only discovery scans project-local MCP configuration and shared `workspace.mcpServers`; it does not launch anything. Add, link and remove actions update the YAML array atomically after schema validation; linked entries record the discovered source ID. The renderer gets safe server metadata, capabilities, schemas and user-requested results over IPC. Connect, disconnect and invocation metadata goes to `.productview/events.jsonl`; arguments and responses remain in memory. YAML declares only static variable names or public OAuth client metadata. Static values come from the ignored project `.env`; SDK-managed OAuth credentials are encrypted locally and scoped to the workspace and endpoint. The built-in Project Room MCP server serves coding agents and is hidden from the project MCP Explorer.

### Linked MCP entries

The catalog shows a client setting only when it is not already linked to a YAML registration. Matching uses transport plus the complete command or URL; different arguments and endpoints remain separate.
2 changes: 2 additions & 0 deletions docs/product/command-tools.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
# CLI Explorer

An entry point already linked to a registered YAML tool appears only once, under the registered tool. Catalog counts reflect distinct tools rather than both discovery and registration.

CLI Explorer follows the same browse and inspect layout as MCP Explorer. The left catalog lists **Discovered locally** entry points found by reading the open repository: `package.json` `bin` entries, Python project scripts, Cargo binaries, Go `cmd/*/main.go` and `examples/*/main.go` programs, and executable CLI files. A package CLI whose declared `dist/` or `build/` target is absent is labeled **Build required**; it cannot be run, linked or queried for help until that target exists. This scan does not run candidates. It is intentionally bounded and may miss custom build systems; ordinary package scripts and tests are not automatically treated as product CLIs. **In .projectroom/project.yaml** lists registered `commandTool` components. Select either type to inspect it on the right.

Select a discovered entry to see its source file and exact command. **Read help** explicitly starts the command with `--help`, `-h`, or `help` and shows the real output, including a parsed synopsis, paired short and long flags, common subcommand lists and positional arguments where recognizable. Parsed commands and options become suggestions in Explore. The full original output stays visible because CLI help has no universal machine-readable format. A program can have side effects even while printing help; Project Room never requests it automatically. Discovery does not prove that the CLI is safe or fully documented.
Expand Down
6 changes: 6 additions & 0 deletions scripts/api-explorer.test.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ test('discovers real OpenAPI operations and manages multiple YAML sources', t =>
assert.equal(discoverSpecs(root).length, 1);
});

test('a configured OpenAPI file is not listed again when its path has a dot prefix', t => {
const root = fixture(t);
const config = { workspace: { apiSources: [{ id: 'orders', name: 'Orders', baseUrl: 'https://example.com', spec: './specs/001-orders/contracts/openapi.yaml' }] } };
assert.deepEqual(listApiSources(root, config).map(item => item.id), ['yaml:orders']);
});

test('loads a live OpenAPI document only on request and only from the configured API origin', async t => {
const root = fixture(t);
const saved = addApiSource(root, { name: 'Live API', baseUrl: 'http://127.0.0.1:43179/rest', specPath: '/open-api/core' });
Expand Down
Loading
Loading