hone-ai 0.9.0 → 0.11.0
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/package.json +2 -1
- package/src/agent-client.ts +2 -2
- package/src/agents-md-generator.ts +8 -2
- package/src/config.ts +53 -1
- package/src/index.ts +12 -5
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hone-ai",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "AI coding agent orchestrator - orchestrate AI agents to implement features based on PRDs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -33,6 +33,7 @@
|
|
|
33
33
|
"hone": "src/index.ts"
|
|
34
34
|
},
|
|
35
35
|
"scripts": {
|
|
36
|
+
"test": "bun test",
|
|
36
37
|
"build": "bun run build:linux && bun run build:macos",
|
|
37
38
|
"format": "prettier --write \"**/*.ts\"",
|
|
38
39
|
"build:linux": "bun build --compile --minify --sourcemap --target=bun-linux-x64 ./src/index.ts --outfile hone-linux",
|
package/src/agent-client.ts
CHANGED
|
@@ -76,7 +76,7 @@ export class AgentClient {
|
|
|
76
76
|
workingDir: this.config.workingDir || process.cwd(),
|
|
77
77
|
model,
|
|
78
78
|
silent: true,
|
|
79
|
-
timeout:
|
|
79
|
+
timeout: 300000, // 5 minute timeout for PRD questions
|
|
80
80
|
})
|
|
81
81
|
|
|
82
82
|
// Only retry network errors, throw immediately for other failures
|
|
@@ -107,7 +107,7 @@ export class AgentClient {
|
|
|
107
107
|
)
|
|
108
108
|
exitWithError(message, details)
|
|
109
109
|
} else if (errorInfo.type === 'timeout') {
|
|
110
|
-
const timeoutMs =
|
|
110
|
+
const timeoutMs = 300000 // Default timeout
|
|
111
111
|
const { message, details } = ErrorMessages.AGENT_TIMEOUT(
|
|
112
112
|
this.config.agent,
|
|
113
113
|
timeoutMs
|
|
@@ -3,7 +3,13 @@
|
|
|
3
3
|
* Core module for generating project documentation for AI agents
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
loadConfig,
|
|
8
|
+
loadConfigWithoutCreation,
|
|
9
|
+
resolveModelForPhase,
|
|
10
|
+
type HoneConfig,
|
|
11
|
+
type AgentType,
|
|
12
|
+
} from './config'
|
|
7
13
|
import { readFile, writeFile, mkdir } from 'fs/promises'
|
|
8
14
|
import { join } from 'path'
|
|
9
15
|
import { existsSync } from 'fs'
|
|
@@ -729,7 +735,7 @@ export async function generateAgentsMd(
|
|
|
729
735
|
process.stdout.write('✓\n')
|
|
730
736
|
|
|
731
737
|
process.stdout.write('Loading configuration... ')
|
|
732
|
-
const config = await
|
|
738
|
+
const config = await loadConfigWithoutCreation()
|
|
733
739
|
process.stdout.write('✓\n')
|
|
734
740
|
|
|
735
741
|
logVerbose(
|
package/src/config.ts
CHANGED
|
@@ -21,8 +21,10 @@ export interface HoneConfig {
|
|
|
21
21
|
lintCommand?: string
|
|
22
22
|
}
|
|
23
23
|
|
|
24
|
+
export const DEFAULT_AGENT: AgentType = 'claude'
|
|
25
|
+
|
|
24
26
|
const DEFAULT_CONFIG: HoneConfig = {
|
|
25
|
-
defaultAgent:
|
|
27
|
+
defaultAgent: DEFAULT_AGENT,
|
|
26
28
|
models: {
|
|
27
29
|
opencode: 'claude-sonnet-4-20250514',
|
|
28
30
|
claude: 'claude-sonnet-4-20250514',
|
|
@@ -99,6 +101,56 @@ export async function resolveAgent(flagAgent?: string): Promise<AgentType> {
|
|
|
99
101
|
return config.defaultAgent
|
|
100
102
|
}
|
|
101
103
|
|
|
104
|
+
export async function resolveAgentWithoutConfigCreation(flagAgent?: string): Promise<AgentType> {
|
|
105
|
+
// Priority: flag > config (if exists) > default
|
|
106
|
+
if (flagAgent) {
|
|
107
|
+
if (!isValidAgent(flagAgent)) {
|
|
108
|
+
exitWithError(
|
|
109
|
+
'Error: Invalid agent',
|
|
110
|
+
`Agent "${flagAgent}" is not valid. Must be "opencode" or "claude".`
|
|
111
|
+
)
|
|
112
|
+
}
|
|
113
|
+
return flagAgent
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const configPath = getConfigPath()
|
|
117
|
+
if (existsSync(configPath)) {
|
|
118
|
+
try {
|
|
119
|
+
const content = await readFile(configPath, 'utf-8')
|
|
120
|
+
const config = yaml.load(content) as Partial<HoneConfig>
|
|
121
|
+
return config.defaultAgent || DEFAULT_AGENT
|
|
122
|
+
} catch (error) {
|
|
123
|
+
console.error('Error reading config, using default agent:', error)
|
|
124
|
+
return DEFAULT_AGENT
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
return DEFAULT_AGENT
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
export async function loadConfigWithoutCreation(): Promise<HoneConfig> {
|
|
132
|
+
const configPath = getConfigPath()
|
|
133
|
+
|
|
134
|
+
if (!existsSync(configPath)) {
|
|
135
|
+
// Return default config without creating the file
|
|
136
|
+
return DEFAULT_CONFIG
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
try {
|
|
140
|
+
const content = await readFile(configPath, 'utf-8')
|
|
141
|
+
const config = yaml.load(content) as Partial<HoneConfig>
|
|
142
|
+
// Deep merge models to preserve defaults
|
|
143
|
+
return {
|
|
144
|
+
...DEFAULT_CONFIG,
|
|
145
|
+
...config,
|
|
146
|
+
models: { ...DEFAULT_CONFIG.models, ...config.models },
|
|
147
|
+
}
|
|
148
|
+
} catch (error) {
|
|
149
|
+
console.error('Error reading config, using defaults:', error)
|
|
150
|
+
return DEFAULT_CONFIG
|
|
151
|
+
}
|
|
152
|
+
}
|
|
153
|
+
|
|
102
154
|
export interface InitResult {
|
|
103
155
|
plansCreated: boolean
|
|
104
156
|
configCreated: boolean
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
#!/usr/bin/env bun
|
|
2
2
|
import { Command } from 'commander'
|
|
3
|
-
import {
|
|
3
|
+
import {
|
|
4
|
+
loadConfig,
|
|
5
|
+
ensurePlansDir,
|
|
6
|
+
resolveAgent,
|
|
7
|
+
resolveAgentWithoutConfigCreation,
|
|
8
|
+
initProject,
|
|
9
|
+
} from './config'
|
|
4
10
|
import type { AgentType } from './config'
|
|
5
11
|
import { listPrds } from './prds'
|
|
6
12
|
import { listIncompleteTaskFiles } from './status'
|
|
@@ -11,11 +17,12 @@ import packageJson from '../package.json'
|
|
|
11
17
|
|
|
12
18
|
const program = new Command()
|
|
13
19
|
|
|
14
|
-
// Get command name to avoid auto-init on 'init'
|
|
20
|
+
// Get command name to avoid auto-init on 'init' and 'agents-md' commands
|
|
15
21
|
const isInitCommand = process.argv[2] === 'init'
|
|
22
|
+
const isAgentsMdCommand = process.argv[2] === 'agents-md'
|
|
16
23
|
|
|
17
|
-
// Auto-initialize for all commands except 'init'
|
|
18
|
-
if (!isInitCommand) {
|
|
24
|
+
// Auto-initialize for all commands except 'init' and 'agents-md'
|
|
25
|
+
if (!isInitCommand && !isAgentsMdCommand) {
|
|
19
26
|
ensurePlansDir()
|
|
20
27
|
loadConfig().catch(console.error)
|
|
21
28
|
}
|
|
@@ -212,7 +219,7 @@ program
|
|
|
212
219
|
.action(async (options: { overwrite?: boolean }) => {
|
|
213
220
|
try {
|
|
214
221
|
setVerbose(program.opts().verbose || false)
|
|
215
|
-
const agent = await
|
|
222
|
+
const agent = await resolveAgentWithoutConfigCreation(program.opts().agent)
|
|
216
223
|
const { generateAgentsMd } = await import('./agents-md-generator')
|
|
217
224
|
const result = await generateAgentsMd({ overwrite: options.overwrite, agent })
|
|
218
225
|
|