mirror of
https://github.com/google-gemini/gemini-cli.git
synced 2026-05-30 13:43:00 -07:00
fix(workspaces): clean up distractors and fix ESM runtime errors
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
/**
|
||||
* Workspace Status Inspector (Local)
|
||||
*
|
||||
* Orchestrates remote status retrieval via the WorkerProvider.
|
||||
* @license
|
||||
* Copyright 2026 Google LLC
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
import path from 'path';
|
||||
import fs from 'fs';
|
||||
import { fileURLToPath } from 'url';
|
||||
import path from 'node:path';
|
||||
import fs from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { ProviderFactory } from './providers/ProviderFactory.ts';
|
||||
|
||||
const __dirname = path.dirname(fileURLToPath(import.meta.url));
|
||||
@@ -14,7 +14,7 @@ const REPO_ROOT = path.resolve(__dirname, '../../../..');
|
||||
async function runStatus(env: NodeJS.ProcessEnv = process.env) {
|
||||
const settingsPath = path.join(REPO_ROOT, '.gemini/workspaces/settings.json');
|
||||
if (!fs.existsSync(settingsPath)) {
|
||||
console.error('❌ Settings not found. Run "npm run workspace:setup" first.');
|
||||
console.error('❌ Settings not found. Run "workspace setup" first.');
|
||||
return 1;
|
||||
}
|
||||
const settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8'));
|
||||
@@ -26,11 +26,17 @@ async function runStatus(env: NodeJS.ProcessEnv = process.env) {
|
||||
|
||||
const { projectId, zone } = config;
|
||||
const targetVM = `gcli-workspace-${env.USER || 'mattkorwel'}`;
|
||||
const provider = ProviderFactory.getProvider({ projectId, zone, instanceName: targetVM });
|
||||
const provider = ProviderFactory.getProvider({
|
||||
projectId,
|
||||
zone,
|
||||
instanceName: targetVM,
|
||||
});
|
||||
|
||||
console.log(`\n🛰️ Workspace Mission Control: ${targetVM}`);
|
||||
console.log(`--------------------------------------------------------------------------------`);
|
||||
|
||||
console.log(
|
||||
`--------------------------------------------------------------------------------`,
|
||||
);
|
||||
|
||||
const status = await provider.getStatus();
|
||||
console.log(` - VM State: ${status.status}`);
|
||||
console.log(` - Internal IP: ${status.internalIp || 'N/A'}`);
|
||||
@@ -38,11 +44,14 @@ async function runStatus(env: NodeJS.ProcessEnv = process.env) {
|
||||
if (status.status === 'RUNNING') {
|
||||
console.log(`\n🧵 Active Sessions (tmux):`);
|
||||
// We fetch the list of sessions from INSIDE the container
|
||||
const tmuxRes = await provider.getExecOutput('tmux list-sessions -F "#S" 2>/dev/null', { wrapContainer: 'maintainer-worker' });
|
||||
|
||||
const tmuxRes = await provider.getExecOutput(
|
||||
'tmux list-sessions -F "#S" 2>/dev/null',
|
||||
{ wrapContainer: 'maintainer-worker' },
|
||||
);
|
||||
|
||||
if (tmuxRes.status === 0 && tmuxRes.stdout.trim()) {
|
||||
const sessions = tmuxRes.stdout.trim().split('\n');
|
||||
sessions.forEach(s => {
|
||||
sessions.forEach((s) => {
|
||||
if (s.startsWith('workspace-')) {
|
||||
console.log(` ✅ ${s}`);
|
||||
} else {
|
||||
@@ -54,7 +63,9 @@ async function runStatus(env: NodeJS.ProcessEnv = process.env) {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`--------------------------------------------------------------------------------\n`);
|
||||
console.log(
|
||||
`--------------------------------------------------------------------------------\n`,
|
||||
);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user