stk-codegen 1.0.1 → 1.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -1
- package/dist/App.d.ts +1 -3
- package/dist/components/AgentStatus.d.ts +2 -1
- package/dist/components/Conversation.d.ts +3 -1
- package/dist/components/DiffView.d.ts +11 -4
- package/dist/components/LimitedHeightBox.d.ts +25 -0
- package/dist/components/Message.d.ts +1 -0
- package/dist/hooks/useAgent.d.ts +7 -3
- package/dist/hooks/useTerminalLayout.d.ts +12 -0
- package/dist/index.js +6 -14
- package/dist/services/versionCheck.d.ts +11 -0
- package/dist/types/index.d.ts +6 -7
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -158,11 +158,30 @@ Roda a suíte de testes com [Vitest](https://vitest.dev/):
|
|
|
158
158
|
|
|
159
159
|
```bash
|
|
160
160
|
npm test
|
|
161
|
-
|
|
161
|
+
```
|
|
162
162
|
|
|
163
163
|
- Os testes estão sob `src/**/*.test.{ts,tsx}`.
|
|
164
164
|
- O ambiente de teste é `jsdom`, adequado para componentes Ink/React.
|
|
165
165
|
|
|
166
|
+
Para rodar os testes uma única vez em modo não interativo (por exemplo em CI):
|
|
167
|
+
|
|
168
|
+
```bash
|
|
169
|
+
npm test -- run
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Para gerar relatório de cobertura:
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
npm test -- --coverage
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Você pode filtrar testes por nome de arquivo ou de teste usando as flags do Vitest, por exemplo:
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
npm test -- useAgent
|
|
182
|
+
npm test -- src/services/versionCheck.test.ts
|
|
183
|
+
```
|
|
184
|
+
|
|
166
185
|
### 5.3. Start (build + execução)
|
|
167
186
|
|
|
168
187
|
Atalho para buildar e executar o CLI em sequência:
|
|
@@ -211,3 +230,4 @@ Sugestão de workflow para mexer no código:
|
|
|
211
230
|
Se precisar de mais detalhes sobre arquitetura, padrões e decisões do projeto, consulte o arquivo [`CODEGEN.md`](./CODEGEN.md).
|
|
212
231
|
|
|
213
232
|
---
|
|
233
|
+
|
package/dist/App.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
interface AgentStatusProps {
|
|
3
3
|
isVisible: boolean;
|
|
4
|
+
text?: string;
|
|
4
5
|
}
|
|
5
|
-
declare const AgentStatus: ({ isVisible }: AgentStatusProps) => React.JSX.Element;
|
|
6
|
+
declare const AgentStatus: ({ isVisible, text }: AgentStatusProps) => React.JSX.Element | null;
|
|
6
7
|
export default AgentStatus;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { ConversationMessage } from '../types/index.js';
|
|
2
|
+
import { ConversationMessage, PendingShellCommand } from '../types/index.js';
|
|
3
3
|
import { ChildProcess } from 'child_process';
|
|
4
4
|
interface ConversationProps {
|
|
5
5
|
conversation: ConversationMessage[];
|
|
6
6
|
activeShellCommand: any;
|
|
7
7
|
childProcess: ChildProcess | null;
|
|
8
8
|
handleShellCompletion: (result: any) => void;
|
|
9
|
+
pendingShellCommand: PendingShellCommand | null;
|
|
10
|
+
isFullReviewView: boolean;
|
|
9
11
|
}
|
|
10
12
|
export declare const Conversation: React.FC<ConversationProps>;
|
|
11
13
|
export {};
|
|
@@ -1,9 +1,16 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
interface
|
|
2
|
+
export interface DiffViewStaticProps {
|
|
3
3
|
oldContent: string;
|
|
4
4
|
newContent: string;
|
|
5
5
|
filePath: string;
|
|
6
|
-
|
|
6
|
+
isCompleted: boolean;
|
|
7
|
+
action?: string;
|
|
8
|
+
maxVisibleLines?: number;
|
|
7
9
|
}
|
|
8
|
-
|
|
9
|
-
|
|
10
|
+
interface DiffViewProps extends DiffViewStaticProps {
|
|
11
|
+
onComplete?: (action: 'accept' | 'reject' | 'edit', editedContent?: string) => void;
|
|
12
|
+
}
|
|
13
|
+
export declare const DiffDecisionHint: React.FC;
|
|
14
|
+
export declare const DiffViewStatic: React.FC<DiffViewStaticProps>;
|
|
15
|
+
declare const DiffView: React.FC<DiffViewProps>;
|
|
16
|
+
export default DiffView;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { BoxProps } from 'ink';
|
|
3
|
+
export interface LimitedHeightBoxOwnProps {
|
|
4
|
+
/**
|
|
5
|
+
* Fração máxima das linhas do terminal que este container pode ocupar.
|
|
6
|
+
* Por padrão, 0.6 = 60% da altura disponível.
|
|
7
|
+
*/
|
|
8
|
+
maxRatio?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Altura mínima em linhas para evitar containers excessivamente pequenos
|
|
11
|
+
* em terminais muito baixos.
|
|
12
|
+
*/
|
|
13
|
+
minLines?: number;
|
|
14
|
+
}
|
|
15
|
+
export type LimitedHeightBoxProps = PropsWithChildren<LimitedHeightBoxOwnProps & BoxProps>;
|
|
16
|
+
/**
|
|
17
|
+
* Container utilitário que limita a altura de seu conteúdo a uma fração
|
|
18
|
+
* da altura total do terminal (por padrão, 60%).
|
|
19
|
+
*
|
|
20
|
+
* Não tenta fazer scroll automático; apenas define um teto visual. Cabe ao
|
|
21
|
+
* componente interno (por exemplo, DiffView ou ShellExecution) controlar
|
|
22
|
+
* truncamento/scroll de conteúdo se necessário.
|
|
23
|
+
*/
|
|
24
|
+
export declare const LimitedHeightBox: React.FC<LimitedHeightBoxProps>;
|
|
25
|
+
export default LimitedHeightBox;
|
package/dist/hooks/useAgent.d.ts
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
1
|
import { ChildProcess } from 'child_process';
|
|
2
|
-
import { ConversationMessage,
|
|
2
|
+
import { ConversationMessage, PendingShellCommand } from '../types/index.js';
|
|
3
3
|
export declare const useAgent: () => {
|
|
4
4
|
conversation: ConversationMessage[];
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
agentStatus: {
|
|
6
|
+
isVisible: boolean;
|
|
7
|
+
text: string;
|
|
8
|
+
};
|
|
7
9
|
pendingShellCommand: PendingShellCommand | null;
|
|
8
10
|
approveShellCommand: () => void;
|
|
9
11
|
rejectShellCommand: () => void;
|
|
12
|
+
approveDiff: (editedContent?: string) => void;
|
|
13
|
+
rejectDiff: () => void;
|
|
10
14
|
submitUserInput: (text: string) => void;
|
|
11
15
|
navigateHistoryUp: () => string | undefined;
|
|
12
16
|
navigateHistoryDown: () => string | undefined;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare const useTerminalLayout: () => {
|
|
2
|
+
readonly rows: any;
|
|
3
|
+
readonly maxAgentStreamingLines: number;
|
|
4
|
+
readonly shellViewHeight: number;
|
|
5
|
+
readonly diffReviewHeight: number;
|
|
6
|
+
readonly layoutConstants: {
|
|
7
|
+
readonly AGENT_STREAM_RATIO: 0.5;
|
|
8
|
+
readonly DIFF_REVIEW_RATIO: 0.5;
|
|
9
|
+
readonly SHELL_OUTPUT_RATIO: 0.7;
|
|
10
|
+
readonly FOOTER_RESERVED_LINES: 4;
|
|
11
|
+
};
|
|
12
|
+
};
|