mirror of
https://github.com/expo/eas-cli.git
synced 2026-11-15 17:31:46 -10:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4d9555255d | ||
|
|
92ff555e87 | ||
|
|
07d811cc85 |
No files matched your search
@@ -8,6 +8,7 @@ This is the log of notable changes to EAS CLI and related packages.
|
||||
|
||||
### 🎉 New features
|
||||
|
||||
- [eas-cli] Prompt detected coding agents to report actionable feedback after non-interactive commands. ([#4039](https://github.com/expo/eas-cli/pull/4039) by [@davidmokos](https://github.com/davidmokos))
|
||||
- [eas-cli] Support drill-down from event lists in observe:session. ([#3987](https://github.com/expo/eas-cli/pull/3987) by [@douglowder](https://github.com/douglowder))
|
||||
|
||||
### 🐛 Bug fixes
|
||||
|
||||
@@ -31,6 +31,7 @@ import Sentry from '../sentry';
|
||||
import SessionManager from '../user/SessionManager';
|
||||
import { getActorDisplayName } from '../user/User';
|
||||
import { Client } from '../vcs/vcs';
|
||||
import { printAgentFeedbackIfNeeded } from './agentFeedback';
|
||||
|
||||
export type ContextInput<
|
||||
T extends {
|
||||
@@ -252,7 +253,9 @@ export default abstract class EasCommand extends Command {
|
||||
override async finally(err: Error): Promise<any> {
|
||||
await this.analytics.flushAsync();
|
||||
await Sentry.flush(2000);
|
||||
return await super.finally(err);
|
||||
const result = await super.finally(err);
|
||||
printAgentFeedbackIfNeeded(this.id, this.argv);
|
||||
return result;
|
||||
}
|
||||
|
||||
protected override catch(err: Error): Promise<any> {
|
||||
|
||||
@@ -23,6 +23,9 @@ jest.mock('../../analytics/AnalyticsManager', () => {
|
||||
};
|
||||
});
|
||||
jest.mock('../../log');
|
||||
jest.mock('../agentFeedback', () => ({
|
||||
printAgentFeedbackIfNeeded: jest.fn(),
|
||||
}));
|
||||
|
||||
let originalProcessArgv: string[];
|
||||
const mockRequestId = uuidv4();
|
||||
@@ -100,6 +103,14 @@ describe('EasCommand', () => {
|
||||
expect(Sentry.flush).toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('checks whether to print agent feedback instructions after the command finishes', async () => {
|
||||
const TestEasCommand = createTestEasCommand();
|
||||
await TestEasCommand.run();
|
||||
|
||||
const { printAgentFeedbackIfNeeded } = jest.requireMock('../agentFeedback');
|
||||
expect(printAgentFeedbackIfNeeded).toHaveBeenCalledWith(TestEasCommand.id, expect.any(Array));
|
||||
});
|
||||
|
||||
it('logs events', async () => {
|
||||
const TestEasCommand = createTestEasCommand();
|
||||
await TestEasCommand.run();
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
import { getAgentTelemetryContext } from '../../analytics/agent';
|
||||
import { printAgentFeedbackIfNeeded } from '../agentFeedback';
|
||||
import { isNonInteractiveByDefault } from '../flags';
|
||||
|
||||
jest.mock('../../analytics/agent');
|
||||
jest.mock('../flags');
|
||||
|
||||
const getAgentTelemetryContextMock = jest.mocked(getAgentTelemetryContext);
|
||||
const isNonInteractiveByDefaultMock = jest.mocked(isNonInteractiveByDefault);
|
||||
|
||||
beforeEach(() => {
|
||||
getAgentTelemetryContextMock.mockReturnValue({ id: 'codex', sessionId: undefined });
|
||||
isNonInteractiveByDefaultMock.mockReturnValue(false);
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
jest.restoreAllMocks();
|
||||
});
|
||||
|
||||
it.each([['--non-interactive'], ['--json']])(
|
||||
'prints feedback instructions for agent commands run with %s',
|
||||
flag => {
|
||||
const stderrWriteSpy = jest.spyOn(process.stderr, 'write').mockImplementation(() => true);
|
||||
|
||||
printAgentFeedbackIfNeeded('build:list', [flag]);
|
||||
|
||||
expect(stderrWriteSpy).toHaveBeenCalledWith(
|
||||
'\nEAS CLI issue? Report it: npx --yes submit-expo-feedback@latest --category eas-cli --subject "build:list" "<what happened and how to reproduce>"\n'
|
||||
);
|
||||
}
|
||||
);
|
||||
|
||||
it('prints feedback instructions when non-interactive mode is inferred', () => {
|
||||
isNonInteractiveByDefaultMock.mockReturnValue(true);
|
||||
const stderrWriteSpy = jest.spyOn(process.stderr, 'write').mockImplementation(() => true);
|
||||
|
||||
printAgentFeedbackIfNeeded('build', []);
|
||||
|
||||
expect(stderrWriteSpy).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
it('does not print feedback instructions in interactive mode', () => {
|
||||
const stderrWriteSpy = jest.spyOn(process.stderr, 'write').mockImplementation(() => true);
|
||||
|
||||
printAgentFeedbackIfNeeded('build', []);
|
||||
|
||||
expect(stderrWriteSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('does not print feedback instructions without a detected agent', () => {
|
||||
getAgentTelemetryContextMock.mockReturnValue(null);
|
||||
const stderrWriteSpy = jest.spyOn(process.stderr, 'write').mockImplementation(() => true);
|
||||
|
||||
printAgentFeedbackIfNeeded('build', ['--non-interactive']);
|
||||
|
||||
expect(stderrWriteSpy).not.toHaveBeenCalled();
|
||||
});
|
||||
@@ -0,0 +1,20 @@
|
||||
import { getAgentTelemetryContext } from '../analytics/agent';
|
||||
import { isNonInteractiveByDefault } from './flags';
|
||||
|
||||
export function printAgentFeedbackIfNeeded(
|
||||
commandId: string | undefined,
|
||||
argv: readonly string[]
|
||||
): void {
|
||||
const isNonInteractive =
|
||||
isNonInteractiveByDefault() || argv.includes('--non-interactive') || argv.includes('--json');
|
||||
|
||||
if (!isNonInteractive || !getAgentTelemetryContext()) {
|
||||
return;
|
||||
}
|
||||
|
||||
process.stderr.write(
|
||||
`\nEAS CLI issue? Report it: npx --yes submit-expo-feedback@latest --category eas-cli --subject "${
|
||||
commandId ?? 'unknown'
|
||||
}" "<what happened and how to reproduce>"\n`
|
||||
);
|
||||
}
|
||||
Reference in new issue
Block a user