@jive-ai/cli 0.0.33 ā 0.0.36
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/dist/index.mjs +85 -42
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -185,9 +185,9 @@ async function openBrowser(url) {
|
|
|
185
185
|
async function loginCommand() {
|
|
186
186
|
console.log(chalk.bold("\nš Login to Jive\n"));
|
|
187
187
|
console.log(chalk.white("Opening browser for authentication...\n"));
|
|
188
|
-
await openBrowser(`${API_URL}/cli-auth`);
|
|
188
|
+
await openBrowser(`${API_URL}/app/cli-auth`);
|
|
189
189
|
console.log(chalk.gray("If the browser did not open, visit:"));
|
|
190
|
-
console.log(chalk.cyan(`${API_URL}/cli-auth\n`));
|
|
190
|
+
console.log(chalk.cyan(`${API_URL}/app/cli-auth\n`));
|
|
191
191
|
const response = await prompts({
|
|
192
192
|
type: "password",
|
|
193
193
|
name: "apiKey",
|
|
@@ -2566,6 +2566,7 @@ const cliQueries = {
|
|
|
2566
2566
|
directory
|
|
2567
2567
|
repository
|
|
2568
2568
|
branch
|
|
2569
|
+
defaultBranch
|
|
2569
2570
|
gitAuth {
|
|
2570
2571
|
privateKey
|
|
2571
2572
|
repositoryUrl
|
|
@@ -2573,6 +2574,12 @@ const cliQueries = {
|
|
|
2573
2574
|
method
|
|
2574
2575
|
}
|
|
2575
2576
|
permissionMode
|
|
2577
|
+
settings {
|
|
2578
|
+
model
|
|
2579
|
+
environmentVariables
|
|
2580
|
+
betaFlags
|
|
2581
|
+
permissionMode
|
|
2582
|
+
}
|
|
2576
2583
|
}
|
|
2577
2584
|
sessionId
|
|
2578
2585
|
}
|
|
@@ -2613,6 +2620,18 @@ const cliQueries = {
|
|
|
2613
2620
|
gitDefaultBranch
|
|
2614
2621
|
team {
|
|
2615
2622
|
id
|
|
2623
|
+
settings {
|
|
2624
|
+
claude {
|
|
2625
|
+
defaultModel
|
|
2626
|
+
environmentVariables
|
|
2627
|
+
betaFlags
|
|
2628
|
+
}
|
|
2629
|
+
}
|
|
2630
|
+
}
|
|
2631
|
+
settings {
|
|
2632
|
+
defaultModel
|
|
2633
|
+
environmentVariables
|
|
2634
|
+
betaFlags
|
|
2616
2635
|
}
|
|
2617
2636
|
createdAt
|
|
2618
2637
|
updatedAt
|
|
@@ -2913,7 +2932,15 @@ var ApiClient = class {
|
|
|
2913
2932
|
directory: t$2.ctx.directory,
|
|
2914
2933
|
repository: t$2.ctx.repository,
|
|
2915
2934
|
branch: t$2.ctx.branch,
|
|
2916
|
-
|
|
2935
|
+
defaultBranch: t$2.ctx.defaultBranch,
|
|
2936
|
+
gitAuth: t$2.ctx.gitAuth,
|
|
2937
|
+
permissionMode: t$2.ctx.permissionMode,
|
|
2938
|
+
settings: {
|
|
2939
|
+
model: t$2.ctx.settings.model,
|
|
2940
|
+
environmentVariables: t$2.ctx.settings.environmentVariables,
|
|
2941
|
+
betaFlags: t$2.ctx.settings.betaFlags,
|
|
2942
|
+
permissionMode: t$2.ctx.settings.permissionMode
|
|
2943
|
+
}
|
|
2917
2944
|
},
|
|
2918
2945
|
sessionId: t$2.sessionId
|
|
2919
2946
|
})) };
|
|
@@ -2951,16 +2978,24 @@ var ApiClient = class {
|
|
|
2951
2978
|
};
|
|
2952
2979
|
}
|
|
2953
2980
|
async getSessionLines(taskId, sessionId, excludePending = false) {
|
|
2954
|
-
|
|
2955
|
-
|
|
2956
|
-
|
|
2957
|
-
|
|
2958
|
-
|
|
2959
|
-
|
|
2960
|
-
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2981
|
+
const client = await getGraphQLClient();
|
|
2982
|
+
const allLines = [];
|
|
2983
|
+
let hasNextPage = true;
|
|
2984
|
+
let after = void 0;
|
|
2985
|
+
while (hasNextPage) {
|
|
2986
|
+
const response = await client.request(queries.GetSessionLines, {
|
|
2987
|
+
taskId: String(taskId),
|
|
2988
|
+
sessionId: String(sessionId),
|
|
2989
|
+
excludePending,
|
|
2990
|
+
first: 100,
|
|
2991
|
+
after
|
|
2992
|
+
});
|
|
2993
|
+
const pageLines = response.sessionLines.edges.map((edge) => edge.node);
|
|
2994
|
+
allLines.push(...pageLines);
|
|
2995
|
+
hasNextPage = response.sessionLines.pageInfo.hasNextPage;
|
|
2996
|
+
after = response.sessionLines.pageInfo.endCursor ?? void 0;
|
|
2997
|
+
}
|
|
2998
|
+
return allLines;
|
|
2964
2999
|
}
|
|
2965
3000
|
async getTaskSessions(taskId) {
|
|
2966
3001
|
return (await (await getGraphQLClient()).request(queries.GetSessions, { taskId: String(taskId) })).sessions.map((s) => ({
|
|
@@ -3337,7 +3372,10 @@ async function spawnTaskDocker(ctx, config$2, opts) {
|
|
|
3337
3372
|
console.log(chalk.yellow("Warning: Using Docker socket mount (no isolation). Set JIVE_USE_SYSBOX=true on Linux for secure mode."));
|
|
3338
3373
|
}
|
|
3339
3374
|
dockerArgs.push("--network", "bridge");
|
|
3340
|
-
if (isDevMode)
|
|
3375
|
+
if (isDevMode) {
|
|
3376
|
+
dockerArgs.push("--add-host", "host.docker.internal:host-gateway");
|
|
3377
|
+
dockerArgs.push("--pull", "never");
|
|
3378
|
+
}
|
|
3341
3379
|
dockerArgs.push("--cpus", limits.docker.cpus, "--memory", limits.docker.memory, "-v", `${ctx.directory}:/workspace`, "-w", "/workspace", ...envVars, limits.docker.image, encode(JSON.stringify(ctx)));
|
|
3342
3380
|
console.log(chalk.dim(`[Task ${ctx.taskId}] Spawning Docker container with args:`, JSON.stringify(dockerArgs, null, 2)));
|
|
3343
3381
|
const taskProcess = spawn("docker", dockerArgs, { cwd: ctx.directory });
|
|
@@ -3396,6 +3434,10 @@ async function createGraphQLClient() {
|
|
|
3396
3434
|
};
|
|
3397
3435
|
}
|
|
3398
3436
|
|
|
3437
|
+
//#endregion
|
|
3438
|
+
//#region package.json
|
|
3439
|
+
var version = "0.0.36";
|
|
3440
|
+
|
|
3399
3441
|
//#endregion
|
|
3400
3442
|
//#region src/runner/index.ts
|
|
3401
3443
|
const execAsync$3 = promisify(exec);
|
|
@@ -3407,7 +3449,7 @@ function getEffectiveResourceLimits(config$2, projectLimits) {
|
|
|
3407
3449
|
docker: {
|
|
3408
3450
|
cpus: projectLimits?.dockerCpus?.toString() || process.env.JIVE_DOCKER_CPUS || config$2.resourceLimits?.docker?.cpus || "2",
|
|
3409
3451
|
memory: projectLimits?.dockerMemory || process.env.JIVE_DOCKER_MEMORY || config$2.resourceLimits?.docker?.memory || "2g",
|
|
3410
|
-
image: projectLimits?.dockerImage || process.env.JIVE_DOCKER_IMAGE || config$2.resourceLimits?.docker?.image ||
|
|
3452
|
+
image: projectLimits?.dockerImage || process.env.JIVE_DOCKER_IMAGE || config$2.resourceLimits?.docker?.image || `jiveai/task:${version}`
|
|
3411
3453
|
}
|
|
3412
3454
|
};
|
|
3413
3455
|
}
|
|
@@ -3496,6 +3538,7 @@ var TaskRunner = class {
|
|
|
3496
3538
|
directory
|
|
3497
3539
|
repository
|
|
3498
3540
|
branch
|
|
3541
|
+
defaultBranch
|
|
3499
3542
|
gitAuth {
|
|
3500
3543
|
privateKey
|
|
3501
3544
|
repositoryUrl
|
|
@@ -3503,6 +3546,12 @@ var TaskRunner = class {
|
|
|
3503
3546
|
method
|
|
3504
3547
|
}
|
|
3505
3548
|
permissionMode
|
|
3549
|
+
settings {
|
|
3550
|
+
model
|
|
3551
|
+
environmentVariables
|
|
3552
|
+
betaFlags
|
|
3553
|
+
permissionMode
|
|
3554
|
+
}
|
|
3506
3555
|
}
|
|
3507
3556
|
}
|
|
3508
3557
|
`);
|
|
@@ -3528,8 +3577,15 @@ var TaskRunner = class {
|
|
|
3528
3577
|
directory: data.taskContext.directory,
|
|
3529
3578
|
repository: data.taskContext.repository,
|
|
3530
3579
|
branch: data.taskContext.branch,
|
|
3580
|
+
defaultBranch: data.taskContext.defaultBranch,
|
|
3531
3581
|
gitAuth: auth || void 0,
|
|
3532
|
-
permissionMode: data.taskContext.permissionMode
|
|
3582
|
+
permissionMode: data.taskContext.permissionMode,
|
|
3583
|
+
settings: {
|
|
3584
|
+
model: data.taskContext.settings.model,
|
|
3585
|
+
environmentVariables: data.taskContext.settings.environmentVariables,
|
|
3586
|
+
betaFlags: data.taskContext.settings.betaFlags,
|
|
3587
|
+
permissionMode: data.taskContext.settings.permissionMode
|
|
3588
|
+
}
|
|
3533
3589
|
};
|
|
3534
3590
|
} catch (error$1) {
|
|
3535
3591
|
console.error(error$1);
|
|
@@ -3792,27 +3848,11 @@ async function queryClaude(prompt, mcpServer, opts) {
|
|
|
3792
3848
|
const credentials = await getCredentials();
|
|
3793
3849
|
if (!credentials?.anthropicApiKey) throw new Error("Anthropic API key not found in credentials JSON");
|
|
3794
3850
|
process.env.ANTHROPIC_API_KEY = credentials.anthropicApiKey;
|
|
3795
|
-
|
|
3796
|
-
try {
|
|
3797
|
-
const client = await getGraphQLClient();
|
|
3798
|
-
const projectData = await client.request(cliQueries.Project, { id: task.projectId.toString() });
|
|
3799
|
-
if (projectData.project?.team) {
|
|
3800
|
-
const claude = (await client.request(cliQueries.Team, { id: projectData.project.team.id })).team?.settings?.claude;
|
|
3801
|
-
if (claude) teamSettings = {
|
|
3802
|
-
defaultModel: claude.defaultModel,
|
|
3803
|
-
environmentVariables: claude.environmentVariables,
|
|
3804
|
-
betaFlags: claude.betaFlags
|
|
3805
|
-
};
|
|
3806
|
-
}
|
|
3807
|
-
} catch (error$1) {
|
|
3808
|
-
console.error("Failed to fetch team settings, using defaults:", error$1);
|
|
3809
|
-
}
|
|
3810
|
-
const defaultModel = teamSettings?.defaultModel || "sonnet";
|
|
3811
|
-
const environmentVariables = teamSettings?.environmentVariables || {};
|
|
3812
|
-
const betaFlags = teamSettings?.betaFlags || [];
|
|
3851
|
+
const { model: defaultModel, environmentVariables, betaFlags } = task.getSettings();
|
|
3813
3852
|
for (const [key, value$1] of Object.entries(environmentVariables)) process.env[key] = value$1;
|
|
3814
3853
|
debugLog(`[Task ${task.id}] Querying Claude with permission mode: ${permissionMode}`);
|
|
3815
3854
|
debugLog(`[Task ${task.id}] Using model: ${defaultModel}`);
|
|
3855
|
+
if (Object.keys(environmentVariables).length > 0) debugLog(`[Task ${task.id}] Environment variables: ${Object.keys(environmentVariables).join(", ")}`);
|
|
3816
3856
|
if (betaFlags.length > 0) debugLog(`[Task ${task.id}] Beta flags: ${betaFlags.join(", ")}`);
|
|
3817
3857
|
return query({
|
|
3818
3858
|
prompt,
|
|
@@ -4261,6 +4301,13 @@ var Task = class {
|
|
|
4261
4301
|
get projectId() {
|
|
4262
4302
|
return this.ctx.projectId;
|
|
4263
4303
|
}
|
|
4304
|
+
/**
|
|
4305
|
+
* Get task settings (model, environment variables, beta flags, permission mode).
|
|
4306
|
+
* Settings are inherited from team/project at task creation time and can be overridden per-task.
|
|
4307
|
+
*/
|
|
4308
|
+
getSettings() {
|
|
4309
|
+
return this.ctx.settings;
|
|
4310
|
+
}
|
|
4264
4311
|
constructor(ctx) {
|
|
4265
4312
|
this.id = ctx.taskId;
|
|
4266
4313
|
this.ctx = ctx;
|
|
@@ -4731,8 +4778,8 @@ Host gitlab.com
|
|
|
4731
4778
|
this.debugLog("Branch does not exist, creating...");
|
|
4732
4779
|
await execAsync$1(`git checkout -b ${this.ctx.branch}`);
|
|
4733
4780
|
}
|
|
4734
|
-
this.debugLog(
|
|
4735
|
-
await execAsync$1(`git pull origin
|
|
4781
|
+
this.debugLog(`Pulling from default branch (${this.ctx.defaultBranch})...`);
|
|
4782
|
+
await execAsync$1(`git pull origin ${this.ctx.defaultBranch}`);
|
|
4736
4783
|
this.debugLog("Pulling from task branch...");
|
|
4737
4784
|
try {
|
|
4738
4785
|
await execAsync$1(`git pull origin ${this.ctx.branch}`);
|
|
@@ -4753,7 +4800,7 @@ Host gitlab.com
|
|
|
4753
4800
|
const jsonlContent = sessionLines.map((m) => JSON.stringify(m)).join("\n");
|
|
4754
4801
|
await writeFile(this.claudeSessionFilePath, jsonlContent + "\n");
|
|
4755
4802
|
this.debugLog(`ā Saved session file to ${this.claudeSessionFilePath}`);
|
|
4756
|
-
this.debugLog(`
|
|
4803
|
+
this.debugLog(`Contains ${messages.length.toLocaleString()} session lines`);
|
|
4757
4804
|
}
|
|
4758
4805
|
async readNewSessionLines() {
|
|
4759
4806
|
try {
|
|
@@ -4879,7 +4926,7 @@ Host gitlab.com
|
|
|
4879
4926
|
}
|
|
4880
4927
|
});
|
|
4881
4928
|
} finally {
|
|
4882
|
-
this.claudeAbortController
|
|
4929
|
+
this.claudeAbortController?.signal.removeEventListener("abort", abortHandler);
|
|
4883
4930
|
this.stopSessionFileWatcher();
|
|
4884
4931
|
this.claudeAbortController = null;
|
|
4885
4932
|
this.sendStatusUpdate("idle");
|
|
@@ -5651,10 +5698,6 @@ async function resumeCommand(taskId) {
|
|
|
5651
5698
|
}
|
|
5652
5699
|
const taskCommands = { resume: resumeCommand };
|
|
5653
5700
|
|
|
5654
|
-
//#endregion
|
|
5655
|
-
//#region package.json
|
|
5656
|
-
var version = "0.0.33";
|
|
5657
|
-
|
|
5658
5701
|
//#endregion
|
|
5659
5702
|
//#region src/index.ts
|
|
5660
5703
|
const program = new Command();
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@jive-ai/cli",
|
|
4
|
-
"version": "0.0.
|
|
4
|
+
"version": "0.0.36",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"files": [
|
|
7
7
|
"dist",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"typecheck": "tsc --noEmit",
|
|
17
17
|
"build": "tsdown && npm pack && npm install -g jive-ai-cli-*.tgz",
|
|
18
18
|
"docker:build": "touch jive-ai-cli-0.0.0.tgz && docker build -t jiveai/task:latest . && rm -f jive-ai-cli-*.tgz",
|
|
19
|
-
"docker:build:local": "bun run build && docker build --build-arg USE_LOCAL=true -t jiveai/task:latest .",
|
|
19
|
+
"docker:build:local": "docker rmi jiveai/task:$npm_package_version jiveai/task:latest; bun run build && docker build --build-arg USE_LOCAL=true -t jiveai/task:latest -t jiveai/task:$npm_package_version .",
|
|
20
20
|
"docker:build:public": "touch jive-ai-cli-0.0.0.tgz && docker buildx build --platform linux/amd64 -t jiveai/task:latest -t jiveai/task:$npm_package_version . && rm -f jive-ai-cli-*.tgz",
|
|
21
21
|
"docker:push": "docker buildx build --platform linux/amd64 --push -t jiveai/task:latest -t jiveai/task:$npm_package_version .",
|
|
22
22
|
"docker:publish": "touch jive-ai-cli-0.0.0.tgz && docker buildx build --platform linux/amd64 --push -t jiveai/task:latest -t jiveai/task:$npm_package_version . && rm -f jive-ai-cli-*.tgz",
|