mirror of
https://github.com/wu736139669/hapi.git
synced 2026-08-05 06:24:37 +00:00
feat: add source file execution and fix function name reference
- Add support for running CLI from TypeScript source when using tsx or similar tools - Fix outdated happy__change_title reference to hapi__change_title in codex prompt
This commit is contained in:
@@ -623,7 +623,7 @@ export async function runCodex(opts: {
|
||||
|
||||
if (!wasCreated) {
|
||||
const startConfig: CodexSessionConfig = {
|
||||
prompt: first ? message.message + '\n\n' + trimIdent(`Based on this message, call functions.happy__change_title to change chat session title that would represent the current task. If chat idea would change dramatically - call this function again to update the title.`) : message.message,
|
||||
prompt: first ? message.message + '\n\n' + trimIdent(`Based on this message, call functions.hapi__change_title to change chat session title that would represent the current task. If chat idea would change dramatically - call this function again to update the title.`) : message.message,
|
||||
sandbox,
|
||||
'approval-policy': approvalPolicy,
|
||||
config: { mcp_servers: mcpServers }
|
||||
|
||||
@@ -102,6 +102,16 @@ export function getHappyCliCommand(args: string[]): HappyCliCommand {
|
||||
const isBunRuntime = Boolean((process.versions as Record<string, string | undefined>).bun);
|
||||
const entrypoint = isBunRuntime ? resolveEntrypointForBun(projectRoot) : distEntrypoint;
|
||||
|
||||
const argv1 = process.argv[1] ?? '';
|
||||
const runningFromSource = argv1.endsWith(join('src', 'index.ts')) || process.execArgv.some((arg) => arg.includes('tsx'));
|
||||
const srcEntrypoint = join(projectRoot, 'src', 'index.ts');
|
||||
if (!isBunRuntime && runningFromSource && existsSync(srcEntrypoint)) {
|
||||
return {
|
||||
command: process.execPath,
|
||||
args: [...process.execArgv, srcEntrypoint, ...args]
|
||||
};
|
||||
}
|
||||
|
||||
const spawnArgs = isBunRuntime ? [entrypoint, ...args] : [
|
||||
'--no-warnings',
|
||||
'--no-deprecation',
|
||||
|
||||
Reference in New Issue
Block a user