diff --git a/.agents/skills/no-greptile/SKILL.md b/.agents/skills/no-greptile/SKILL.md new file mode 100644 index 0000000..0278b15 --- /dev/null +++ b/.agents/skills/no-greptile/SKILL.md @@ -0,0 +1,24 @@ +--- +name: no-greptile +description: Apply and verify Rudder's no-greptile pull-request label. Use when creating, updating, or reviewing a PR that the user explicitly wants to exclude from Greptile automated review. +--- + +# No Greptile + +Use the `no-greptile` GitHub label to skip Greptile automated review for a specific pull request. +Apply it only when the user explicitly requests that review skip. + +1. Resolve the pull request number from the current branch or user request. +2. Apply the label: + + ```bash + gh pr edit --add-label no-greptile + ``` + +3. Verify that the label is present: + + ```bash + gh pr view --json labels + ``` + +Do not remove the label or alter other review settings unless the user asks. diff --git a/.agents/skills/no-greptile/agents/openai.yaml b/.agents/skills/no-greptile/agents/openai.yaml new file mode 100644 index 0000000..1961d72 --- /dev/null +++ b/.agents/skills/no-greptile/agents/openai.yaml @@ -0,0 +1,4 @@ +interface: + display_name: "No Greptile" + short_description: "Skip Greptile review for a pull request" + default_prompt: "Use $no-greptile to skip Greptile review for this pull request." diff --git a/test/plugin-package.test.ts b/test/plugin-package.test.ts index 03b84bc..760c1c6 100644 --- a/test/plugin-package.test.ts +++ b/test/plugin-package.test.ts @@ -190,10 +190,6 @@ test('keeps the release PostHog host explicit', () => { join(pluginRoot, '.github', 'workflows', 'publish.yml'), 'utf8' ); - const telemetryBuildConfig = readFileSync( - join(pluginRoot, 'src', 'telemetry-build-config.ts'), - 'utf8' - ); const telemetrySource = readFileSync( join(pluginRoot, 'src', 'telemetry.ts'), 'utf8' @@ -204,8 +200,8 @@ test('keeps the release PostHog host explicit', () => { /const host = process\.env\.POSTHOG_HOST\?\.trim\(\) \|\| '';/ ); assert.match( - telemetryBuildConfig, - /export const BUILT_IN_POSTHOG_HOST = '';/, + publishWorkflow, + /BUILT_IN_POSTHOG_HOST = \$\{JSON\.stringify\(host\)\}/ ); assert.match( telemetrySource, diff --git a/test/prompt-hook.test.ts b/test/prompt-hook.test.ts index 5bd18f0..a23205d 100644 --- a/test/prompt-hook.test.ts +++ b/test/prompt-hook.test.ts @@ -29,6 +29,45 @@ let originalRudderHome: string | undefined; const hookExecutable = fileURLToPath(new URL('../bin/rudder-prompt-hook.ts', import.meta.url)); const pluginRoot = fileURLToPath(new URL('../', import.meta.url)); +function buildHookWithTelemetryConfig( + buildRoot: string, + projectToken: string, + host: string +): string { + const dist = join(buildRoot, 'dist'); + cpSync(join(pluginRoot, 'bin'), join(buildRoot, 'bin'), { + recursive: true, + }); + cpSync(join(pluginRoot, 'src'), join(buildRoot, 'src'), { + recursive: true, + }); + symlinkSync(join(pluginRoot, 'node_modules'), join(buildRoot, 'node_modules')); + writeFileSync( + join(buildRoot, 'src', 'telemetry-build-config.ts'), + [ + `export const BUILT_IN_POSTHOG_PROJECT_TOKEN = ${JSON.stringify(projectToken)};`, + `export const BUILT_IN_POSTHOG_HOST = ${JSON.stringify(host)};`, + '', + ].join('\n') + ); + execFileSync( + join(pluginRoot, 'node_modules', '.bin', 'esbuild'), + [ + join(buildRoot, 'bin', 'rudder-prompt-hook.ts'), + '--bundle', + '--platform=node', + '--format=esm', + '--target=node23', + `--outfile=${join(dist, 'rudder-prompt-hook.mjs')}`, + ], + { + cwd: buildRoot, + stdio: 'ignore', + } + ); + return join(dist, 'rudder-prompt-hook.mjs'); +} + function git(cwd: string, ...args: string[]): string { return execFileSync('git', ['-C', cwd, ...args], { encoding: 'utf8' }).trim(); } @@ -459,9 +498,14 @@ test('the legacy PostHog API key does not enable telemetry', async () => { const receiver = await startTelemetryReceiver(capturePath); try { + const legacyHookExecutable = buildHookWithTelemetryConfig( + join(root, 'legacy-build'), + '', + '' + ); const stdout = execFileSync( process.execPath, - [hookExecutable, '--source', 'codex'], + [legacyHookExecutable, '--source', 'codex'], { cwd: repo, encoding: 'utf8', @@ -496,40 +540,13 @@ test('a release build sends telemetry without user environment configuration', a const capturePath = join(root, 'built-telemetry-capture.jsonl'); const receiver = await startTelemetryReceiver(capturePath); const releaseRoot = join(root, 'release'); - const dist = join(releaseRoot, 'dist'); try { - cpSync(join(pluginRoot, 'bin'), join(releaseRoot, 'bin'), { - recursive: true, - }); - cpSync(join(pluginRoot, 'src'), join(releaseRoot, 'src'), { - recursive: true, - }); - symlinkSync(join(pluginRoot, 'node_modules'), join(releaseRoot, 'node_modules')); - writeFileSync( - join(releaseRoot, 'src', 'telemetry-build-config.ts'), - [ - "export const BUILT_IN_POSTHOG_PROJECT_TOKEN = 'built-test-project-token';", - `export const BUILT_IN_POSTHOG_HOST = ${JSON.stringify(receiver.host)};`, - '', - ].join('\n') - ); - execFileSync( - join(pluginRoot, 'node_modules', '.bin', 'esbuild'), - [ - join(releaseRoot, 'bin', 'rudder-prompt-hook.ts'), - '--bundle', - '--platform=node', - '--format=esm', - '--target=node23', - `--outfile=${join(dist, 'rudder-prompt-hook.mjs')}`, - ], - { - cwd: releaseRoot, - stdio: 'ignore', - } + const releaseHookExecutable = buildHookWithTelemetryConfig( + releaseRoot, + 'built-test-project-token', + receiver.host ); - const environment: NodeJS.ProcessEnv = { ...process.env, RUDDER_HOME: process.env.RUDDER_HOME, @@ -542,7 +559,7 @@ test('a release build sends telemetry without user environment configuration', a const stdout = execFileSync( process.execPath, - [join(dist, 'rudder-prompt-hook.mjs'), '--source', 'codex'], + [releaseHookExecutable, '--source', 'codex'], { cwd: repo, encoding: 'utf8',