p-doom/crowd-code-dataset-0.2 huggingface dataset:
[tab] package.json (json)
{
  "name": "crowd-pilot",
  "displayName": "crowd-pilot-extension",
  "description": "Teaching language models to code like humans.",
  "version": "0.0.1",
  "engines": {
    "vscode": "^1.99.3"
  },
  "categories": [
    "Other"
  ],
  "activationEvents": [],
  "main": "./out/extension.js",
  "contributes": {
    "commands": [
      {
        "command": "crowd-pilot.testRun",
        "title": "Test Run"
      },
      {
        "command": "crowd-pilot.checkConfig",
        "title": "Check Keybinding Config"
      },
      {
        "command": "crowd-pilot.enableTerminalIntercept",
        "title": "Crowd Pilot: Enable Terminal Tab Intercept"
      },
      {
        "command": "crowd-pilot.disableTerminalIntercept",
        "title": "Crowd Pilot: Disable Terminal Tab Intercept"
      }
    ],
    "keybindings": [
      {
        "command": "crowd-pilot.testRun",
        "key": "tab",
        "mac": "tab",
        "when": "editorTextFocus || terminalFocus"
      }
    ]
  },
  "scripts": {
    "vscode:prepublish": "npm run compile",
    "compile": "tsc -p ./",
    "watch": "tsc -watch -p ./",
    "pretest": "npm run compile && npm run lint",
    "lint": "eslint src",
    "test": "vscode-test"
  },
  "devDependencies": {
    "@types/vscode": "^1.105.0",
    "@types/mocha": "^10.0.10",
    "@types/node": "22.x",
    "@typescript-eslint/eslint-plugin": "^8.45.0",
    "@typescript-eslint/parser": "^8.45.0",
    "eslint": "^9.36.0",
    "typescript": "^5.9.3",
    "@vscode/test-cli": "^0.0.11",
    "@vscode/test-electron": "^2.5.2"
  }
}
[content] package.json (json)
  "activationEvents": [
    "onStartupFinished",
    "onCommand:crowd-pilot.testRun",
    "onCommand:crowd-pilot.checkConfig",
    "onCommand:crowd-pilot.enableTerminalIntercept",
    "onCommand:crowd-pilot.disableTerminalIntercept"
  ],
[content] src/extension.ts (typescript)
async function ensureTerminalInterceptEnabled(): Promise<void> {
	try {
		const cfg = vscode.workspace.getConfiguration('terminal.integrated');
		const list = cfg.get<string[]>('commandsToSkipShell', []) ?? [];
		if (!list.includes('crowd-pilot.testRun')) {
			await cfg.update('commandsToSkipShell', [...list, 'crowd-pilot.testRun'], vscode.ConfigurationTarget.Global, false);
			console.log('[Crowd Pilot] Auto-enabled terminal intercept for crowd-pilot.testRun');
		} else {
			console.log('[Crowd Pilot] Terminal intercept already enabled');
		}
	} catch (err) {
		console.error('[Crowd Pilot] Failed to auto-enable terminal intercept:', err);
	}
}
[content] src/extension.ts (typescript)
async function ensureTerminalInterceptEnabled(): Promise<void> {
	try {
		const cfg = vscode.workspace.getConfiguration('terminal.integrated');
		const list = cfg.get<string[]>('commandsToSkipShell', []) ?? [];
		if (!list.includes('crowd-pilot.testRun')) {
			await cfg.update('commandsToSkipShell', [...list, 'crowd-pilot.testRun'], vscode.ConfigurationTarget.Global, false);
			console.log('[Crowd Pilot] Auto-enabled terminal intercept for crowd-pilot.testRun');
		} else {
			console.log('[Crowd Pilot] Terminal intercept already enabled');
		}
	} catch (err) {
		console.error('[Crowd Pilot] Failed to auto-enable terminal intercept:', err);
	}
}

async function primeTerminalSubsystem(): Promise<void> {
	try {
		// If a terminal already exists, nothing to do
		if (vscode.window.terminals.length > 0) {
			return;
		}
		const opened = new Promise<void>((resolve) => {
			const d = vscode.window.onDidOpenTerminal(() => {
				try { d.dispose(); } catch {}
				resolve();
			});
		});
		const t = vscode.window.createTerminal('Crowd Pilot Prime');
		// Don't show; just let it initialize the terminal service
		await Promise.race([
			opened,
			new Promise<void>(r => setTimeout(r, 150))
		]);
		try { t.dispose(); } catch {}
		// Give disposal a moment to settle
		await new Promise<void>(r => setTimeout(r, 50));
		console.log('[Crowd Pilot] Primed terminal subsystem');
	} catch (err) {
		console.error('[Crowd Pilot] Failed to prime terminal subsystem:', err);
	}
}
[content] src/extension.ts (typescript)
	// Ensure terminal intercept is enabled on startup
	ensureInterceptPromise = ensureTerminalInterceptEnabled().then(() => primeTerminalSubsystem()).catch(() => undefined);

	// Read current configuration for diagnostics
[content] src/extension.ts (typescript)
async function primeTerminalSubsystem(): Promise<void> {
	try {
		// If a terminal already exists, nothing to do
		if (vscode.window.terminals.length > 0) {
			return;
		}
		const opened = new Promise<void>((resolve) => {
			const d = vscode.window.onDidOpenTerminal(() => {
				try { d.dispose(); } catch {}
				resolve();
			});
		});
		const t = vscode.window.createTerminal('Crowd Pilot Prime');
		// Don't show; just let it initialize the terminal service
		await Promise.race([
			opened,
			new Promise<void>(r => setTimeout(r, 150))
		]);
		try { t.dispose(); } catch {}
		// Give disposal a moment to settle
		await new Promise<void>(r => setTimeout(r, 50));
		console.log('[Crowd Pilot] Primed terminal subsystem');
	} catch (err) {
		console.error('[Crowd Pilot] Failed to prime terminal subsystem:', err);
	}
}
[content] src/extension.ts (typescript)
	// Ensure terminal intercept is enabled, then prime the terminal subsystem
	ensureTerminalInterceptEnabled()
		.then(() => primeTerminalSubsystem())
		.catch((err) => console.error('[Crowd Pilot] Startup initialization error:', err));
[content] src/extension.ts (typescript)
async function ensureTerminalInterceptEnabled(): Promise<void> {
	try {
		const cfg = vscode.workspace.getConfiguration('terminal.integrated');
		const list = cfg.get<string[]>('commandsToSkipShell', []) ?? [];
		if (!list.includes('crowd-pilot.testRun')) {
			await cfg.update('commandsToSkipShell', [...list, 'crowd-pilot.testRun'], vscode.ConfigurationTarget.Global, false);
			console.log('[Crowd Pilot] Auto-enabled terminal intercept for crowd-pilot.testRun');
		} else {
			console.log('[Crowd Pilot] Terminal intercept already enabled');
		}
	} catch (err) {
		console.error('[Crowd Pilot] Failed to auto-enable terminal intercept:', err);
		throw err;
	}
}

async function primeTerminalSubsystem(): Promise<void> {
	try {
		// If a terminal already exists, nothing to do
		if (vscode.window.terminals.length > 0) {
			return;
		}
		const opened = new Promise<void>((resolve) => {
			const d = vscode.window.onDidOpenTerminal(() => {
				try { d.dispose(); } catch {}
				resolve();
			});
		});
		const t = vscode.window.createTerminal('Crowd Pilot Prime');
		// Don't show; just let it initialize the terminal service
		await Promise.race([
			opened,
			new Promise<void>(r => setTimeout(r, 150))
		]);
		try { t.dispose(); } catch {}
		// Give disposal a moment to settle
		await new Promise<void>(r => setTimeout(r, 50));
		console.log('[Crowd Pilot] Primed terminal subsystem');
	} catch (err) {
		console.error('[Crowd Pilot] Failed to prime terminal subsystem:', err);
	}
}
[content] src/extension.ts (typescript)
	// Configure terminal to allow tab keybinding to work
	// This makes the command skip the shell so VS Code can intercept tab in terminals
	const config = vscode.workspace.getConfiguration('terminal.integrated');
	const commandsToSkipShell = config.get<string[]>('commandsToSkipShell', []);
	if (!commandsToSkipShell.includes('crowd-pilot.testRun')) {
		commandsToSkipShell.push('crowd-pilot.testRun');
		config.update('commandsToSkipShell', commandsToSkipShell, vscode.ConfigurationTarget.Global);
	}

	// The command has been defined in the package.json file
	// Now provide the implementation of the command with registerCommand
	// The commandId parameter must match the command field in package.json
	const disposable = vscode.commands.registerCommand('crowd-pilot.helloWorld', () => {
		// The code you place here will be executed every time your command is executed
		// Display a message box to the user
		vscode.window.showInformationMessage('Hello World from crowd-pilot-extension!');
	});

	context.subscriptions.push(disposable);
[content] src/extension.ts (typescript)
	(async () => {
		const config = vscode.workspace.getConfiguration('terminal.integrated');
		const commandsToSkipShell = config.get<string[]>('commandsToSkipShell', []);
		if (!commandsToSkipShell.includes('crowd-pilot.testRun')) {
			commandsToSkipShell.push('crowd-pilot.testRun');
			await config.update('commandsToSkipShell', commandsToSkipShell, vscode.ConfigurationTarget.Global);
		}
		// Prime terminal subsystem after intercept is enabled
		await primeTerminalSubsystem();
	})().catch((err) => console.error('[Crowd Pilot] Startup initialization error:', err));
[content] src/extension.ts (typescript)
	const config = vscode.workspace.getConfiguration('terminal.integrated');
	const commandsToSkipShell = config.get<string[]>('commandsToSkipShell', []);
	if (!commandsToSkipShell.includes('crowd-pilot.testRun')) {
		commandsToSkipShell.push('crowd-pilot.testRun');
		config.update('commandsToSkipShell', commandsToSkipShell, vscode.ConfigurationTarget.Global);
	}
[tab] package.json (json)
{
  "name": "crowd-pilot",
  "displayName": "crowd-pilot-extension",
  "description": "Teaching language models to code like humans.",
  "version": "0.0.1",
  "engines": {
    "vscode": "^1.99.3"
  },
  "categories": [
    "Other"
  ],
  "activationEvents": [
    "onStartupFinished"
  ],
  "main": "./out/extension.js",
  "contributes": {
    "commands": [
      {
        "command": "crowd-pilot.testRun",
        "title": "Test Run"
      }
    ],
    "keybindings": [
      {
        "command": "crowd-pilot.testRun",
        "key": "tab",
        "mac": "tab",
        "when": "editorTextFocus || terminalFocus"
      }
    ]
  },
  "scripts": {
    "vscode:prepublish": "npm run compile",
    "compile": "tsc -p ./",
    "watch": "tsc -watch -p ./",
    "pretest": "npm run compile && npm run lint",
    "lint": "eslint src",
    "test": "vscode-test"
  },
  "devDependencies": {
    "@types/vscode": "^1.105.0",
    "@types/mocha": "^10.0.10",
    "@types/node": "22.x",
    "@typescript-eslint/eslint-plugin": "^8.45.0",
    "@typescript-eslint/parser": "^8.45.0",
    "eslint": "^9.36.0",
    "typescript": "^5.9.3",
    "@vscode/test-cli": "^0.0.11",
    "@vscode/test-electron": "^2.5.2"
  }
}
[content] src/extension.ts (typescript)
// The module 'vscode' contains the VS Code extensibility API
// Import the module and reference it with the alias vscode in your code below
import * as vscode from 'vscode';

// This method is called when your extension is activated
// Your extension is activated the very first time the command is executed
export function activate(context: vscode.ExtensionContext) {

	// Use the console to output diagnostic information (console.log) and errors (console.error)
	// This line of code will only be executed once when your extension is activated
	console.log('Congratulations, your extension "crowd-pilot" is now active!');

	// The command has been defined in the package.json file
	// Now provide the implementation of the command with registerCommand
	// The commandId parameter must match the command field in package.json
	const disposable = vscode.commands.registerCommand('crowd-pilot.helloWorld', () => {
		// The code you place here will be executed every time your command is executed
		// Display a message box to the user
		vscode.window.showInformationMessage('Hello World from crowd-pilot-extension!');
	});

	context.subscriptions.push(disposable);
	const testRun = vscode.commands.registerCommand('crowd-pilot.testRun', async () => {
		const editor = vscode.window.activeTextEditor;
		const doc = editor.document;
		const term = vscode.window.terminals[0] ?? vscode.window.createTerminal('Test');
		const git = vscode.extensions.getExtension('vscode.git')?.exports?.getAPI(1);
		const repo = git?.repositories?.[0];
	
		// Emit a few actions:
		await vscode.window.showTextDocument(doc);
		editor.selections = [new vscode.Selection(0, 0, 0, 0)];
		await editor.edit(e => e.insert(new vscode.Position(0, 0), 'hello world
'));
		term.show();
		term.sendText('echo VSCode test');
		//await repo?.pull();
	
		vscode.window.showInformationMessage('All actions emitted');
	  });

	context.subscriptions.push(testRun);
}

// This method is called when your extension is deactivated
export function deactivate() {}
[content] src/extension.ts (typescript)
import * as vscode from 'vscode';

export function activate(context: vscode.ExtensionContext) {

	console.log('[Crowd Pilot] Extension activated');

	// Configure terminal to allow tab keybinding to work
	(async () => {
		const config = vscode.workspace.getConfiguration('terminal.integrated');
		const commandsToSkipShell = config.get<string[]>('commandsToSkipShell', []);
		if (!commandsToSkipShell.includes('crowd-pilot.testRun')) {
			commandsToSkipShell.push('crowd-pilot.testRun');
			await config.update('commandsToSkipShell', commandsToSkipShell, vscode.ConfigurationTarget.Global);
		}
		// Prime terminal subsystem after intercept is enabled (NOTE: this is a workaround)
		await primeTerminalSubsystem();
	})().catch((err) => console.error('[Crowd Pilot] Startup initialization error:', err));

	const testRun = vscode.commands.registerCommand('crowd-pilot.testRun', async () => {
		const editor = vscode.window.activeTextEditor;
		const doc = editor!.document;
		const term = vscode.window.terminals[0] ?? vscode.window.createTerminal('Test');
		const git = vscode.extensions.getExtension('vscode.git')?.exports?.getAPI(1);
		const repo = git?.repositories?.[0];
	
		await vscode.window.showTextDocument(doc);
		editor!.selections = [new vscode.Selection(0, 0, 0, 0)];
		await editor!.edit(e => e.insert(new vscode.Position(0, 0), 'hello world
'));
		term.show();
		term.sendText('echo VSCode test');
		//await repo?.pull();
	
		vscode.window.showInformationMessage('All actions emitted');
	  });

	context.subscriptions.push(testRun);
}

export function deactivate() {}

async function primeTerminalSubsystem(): Promise<void> {
	try {
		if (vscode.window.terminals.length > 0) {
			return;
		}
		const opened = new Promise<void>((resolve) => {
			const d = vscode.window.onDidOpenTerminal(() => {
				try { d.dispose(); } catch {}
				resolve();
			});
		});
		const t = vscode.window.createTerminal('Crowd Pilot Prime');
		await Promise.race([
			opened,
			new Promise<void>(r => setTimeout(r, 150))
		]);
		try { t.dispose(); } catch {}
		await new Promise<void>(r => setTimeout(r, 50));
		console.log('[Crowd Pilot] Primed terminal subsystem');
	} catch (err) {
		console.error('[Crowd Pilot] Failed to prime terminal subsystem:', err);
	}
}