ucode-agent 1.63.0 → 1.64.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/README.md +95 -2
- package/package.json +65 -64
- package/src/core/commands.js +44 -0
- package/src/core/genericcheck.js +147 -0
- package/src/core/headless.js +73 -0
- package/src/core/lessons.js +83 -0
- package/src/core/loop.js +453 -18
- package/src/core/mcp.js +337 -0
- package/src/core/mcpcli.js +52 -0
- package/src/core/provider.js +93 -11
- package/src/core/scope.js +62 -3
- package/src/core/settings.js +148 -0
- package/src/core/snapshot.js +147 -0
- package/src/core/tests.js +14 -1
- package/src/tools/browser.js +2 -1
- package/src/tools/search.js +74 -0
- package/src/tools/shared.js +33 -2
- package/src/tools/shell.js +4 -1
- package/src/ui/plain.js +9 -6
- package/src/ui/screen.js +7 -5
- package/src/ui/theme.js +23 -1
- package/ucode.js +37 -1
package/ucode.js
CHANGED
|
@@ -39,6 +39,9 @@ function parseArgs(argv) {
|
|
|
39
39
|
else if (a === '--cwd' || a === '-C') args.cwd = path.resolve(argv[++i]);
|
|
40
40
|
else if (a === '--help' || a === '-h') args.help = true;
|
|
41
41
|
else if (a === '--version' || a === '-v') args.version = true;
|
|
42
|
+
else if (a === '--print' || a === '-p') args.print = argv[i + 1] && !argv[i + 1].startsWith('-') ? argv[++i] : '-';
|
|
43
|
+
else if (a === '--json') args.json = true;
|
|
44
|
+
else if (a === '--yes' || a === '-y') args.yes = true;
|
|
42
45
|
}
|
|
43
46
|
|
|
44
47
|
return args;
|
|
@@ -59,10 +62,16 @@ async function usage() {
|
|
|
59
62
|
' -C, --cwd <dir> work in another directory\n' +
|
|
60
63
|
' --plan start in plan mode: read and research, change nothing\n' +
|
|
61
64
|
' --debug print stack traces when something breaks\n' +
|
|
65
|
+
' -p, --print <task> do one task with no keyboard, print the answer, exit\n' +
|
|
66
|
+
' --json with -p: print one JSON object about the run instead\n' +
|
|
67
|
+
' -y, --yes with -p: say yes to anything that would be asked\n' +
|
|
62
68
|
' -v, --version print the version\n' +
|
|
63
69
|
' -h, --help this message\n' +
|
|
64
70
|
' doctor check that everything ucode needs is working\n' +
|
|
65
|
-
' login <key> save your key for every folder on this machine\n
|
|
71
|
+
' login <key> save your key for every folder on this machine\n' +
|
|
72
|
+
' mcp add <name> <command> [args...] connect an MCP server (--url <url> for a remote one)\n' +
|
|
73
|
+
' mcp list | mcp remove <name>\n\n' +
|
|
74
|
+
` ${sky('Other models')} UCODE_BASE_URL=http://localhost:11434/v1 UCODE_MODEL=<model> ucode (Ollama, offline)\n\n` +
|
|
66
75
|
` ${sky('Models')}\n${models}\n\n` +
|
|
67
76
|
` Needs GEMINI_API_KEY in the environment or in ${ENV_FILE}\n` +
|
|
68
77
|
' Free keys: https://aistudio.google.com/apikey\n\n'
|
|
@@ -92,6 +101,33 @@ async function main() {
|
|
|
92
101
|
return;
|
|
93
102
|
}
|
|
94
103
|
|
|
104
|
+
if (process.argv[2] === 'mcp') {
|
|
105
|
+
const { mcpCommand } = await import('./src/core/mcpcli.js');
|
|
106
|
+
process.stdout.write(`${await mcpCommand(process.argv.slice(3))}\n`);
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
if (args.print !== undefined) {
|
|
111
|
+
let prompt = args.print;
|
|
112
|
+
if (prompt === '-') {
|
|
113
|
+
const chunks = [];
|
|
114
|
+
for await (const chunk of process.stdin) chunks.push(chunk);
|
|
115
|
+
prompt = Buffer.concat(chunks).toString('utf8').trim();
|
|
116
|
+
}
|
|
117
|
+
if (!prompt) {
|
|
118
|
+
process.stderr.write('ucode -p needs a task: ucode -p "fix the failing test"\n');
|
|
119
|
+
process.exitCode = 2;
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
const [, { setModel }] = await heavy();
|
|
123
|
+
if (args.model) setModel(args.model);
|
|
124
|
+
const { runHeadless } = await import('./src/core/headless.js');
|
|
125
|
+
const code = await runHeadless({ cwd: args.cwd, prompt, json: args.json, yes: args.yes, plan: args.plan });
|
|
126
|
+
// A one-shot run ends here, whatever handle something left open.
|
|
127
|
+
process.stdout.write('', () => process.exit(code));
|
|
128
|
+
return;
|
|
129
|
+
}
|
|
130
|
+
|
|
95
131
|
// Update before the session starts, not after it ends.
|
|
96
132
|
//
|
|
97
133
|
// Installing in the background and taking effect "next time" means the run
|