@tryarcanist/cli 0.1.194 → 0.1.195

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.
Files changed (2) hide show
  1. package/dist/index.js +35 -16
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1062,7 +1062,7 @@ var CODEX_SUBSCRIPTION_SESSION_START_MODEL_PROVIDER_GROUPS = buildModelProviderG
1062
1062
  function parseGithubRepoFullName(value) {
1063
1063
  const shorthand = value.match(/^([a-zA-Z0-9_.-]+)\/([a-zA-Z0-9_.-]+)$/);
1064
1064
  if (shorthand) return { owner: shorthand[1], repo: shorthand[2] };
1065
- const ssh = value.match(/git@[^:]+:([^/]+)\/([^/]+?)(?:\.git)?$/);
1065
+ const ssh = value.match(/^git@github\.com:([^/]+)\/([^/]+?)(?:\.git)?$/);
1066
1066
  if (ssh) return { owner: ssh[1], repo: ssh[2] };
1067
1067
  const https = value.match(/^https?:\/\/github\.com\/([^/]+)\/([^/]+?)(?:\.git)?\/?$/);
1068
1068
  if (https) return { owner: https[1], repo: https[2] };
@@ -1240,6 +1240,7 @@ function formatTime(value) {
1240
1240
 
1241
1241
  // src/commands/codex.ts
1242
1242
  import { spawn } from "child_process";
1243
+ import { rmSync } from "fs";
1243
1244
  import { mkdtemp, readFile, rm } from "fs/promises";
1244
1245
  import { tmpdir } from "os";
1245
1246
  import { join as join2 } from "path";
@@ -1288,8 +1289,19 @@ async function setCodexSubscriptionEnabled(config, enabled) {
1288
1289
  async function codexLoginCommand(options, command) {
1289
1290
  const { config } = resolveBusinessContext(command, options);
1290
1291
  const codexPath = resolveCodexPath(options.codexPath);
1291
- const codexHome = await mkdtemp(join2(tmpdir(), "arcanist-codex-"));
1292
+ let codexHome;
1293
+ const handleSigint = () => {
1294
+ if (codexHome) {
1295
+ try {
1296
+ rmSync(codexHome, { recursive: true, force: true });
1297
+ } catch {
1298
+ }
1299
+ }
1300
+ process.exit(EXIT_CODE_INTERRUPTED);
1301
+ };
1302
+ process.on("SIGINT", handleSigint);
1292
1303
  try {
1304
+ codexHome = await mkdtemp(join2(tmpdir(), "arcanist-codex-"));
1293
1305
  await runCodexDeviceLogin(codexPath, codexHome);
1294
1306
  let authJson;
1295
1307
  try {
@@ -1325,8 +1337,14 @@ async function codexLoginCommand(options, command) {
1325
1337
  }
1326
1338
  });
1327
1339
  } finally {
1328
- await rm(codexHome, { recursive: true, force: true }).catch(() => {
1329
- });
1340
+ try {
1341
+ if (codexHome) {
1342
+ await rm(codexHome, { recursive: true, force: true }).catch(() => {
1343
+ });
1344
+ }
1345
+ } finally {
1346
+ process.off("SIGINT", handleSigint);
1347
+ }
1330
1348
  }
1331
1349
  }
1332
1350
  async function codexUseCommand(state, options, command) {
@@ -3457,10 +3475,14 @@ function parseEgressAllowlistSourceFile(content, key = EGRESS_ALLOWLIST_SOURCE_P
3457
3475
 
3458
3476
  // src/commands/egress.ts
3459
3477
  function parseRepoArg(value) {
3460
- const trimmed = value.trim().replace(/^https:\/\/github\.com\//, "").replace(/\.git$/, "");
3461
- const [owner, repo, extra] = trimmed.split("/");
3462
- if (!owner || !repo || extra) throw new CliError("user", "repo must be owner/name or a GitHub URL");
3463
- return { owner, repo };
3478
+ const parsed = parseGithubRepoFullName(value);
3479
+ if (!parsed) throw new CliError("user", "repo must be owner/name or a GitHub URL");
3480
+ return {
3481
+ ...parsed,
3482
+ // Preserve the legacy shorthand contract while URLs and SSH remotes are
3483
+ // normalized by the shared parser itself.
3484
+ repo: /^[^/:]+\/[^/]+\.git$/.test(value.trim()) ? parsed.repo.slice(0, -4) : parsed.repo
3485
+ };
3464
3486
  }
3465
3487
  async function egressSourceSetCommand(sourceRepoArg, options = {}, command) {
3466
3488
  const { config } = resolveBusinessContext(command, options);
@@ -3812,7 +3834,7 @@ function currentRepo() {
3812
3834
 
3813
3835
  // src/commands/repos.ts
3814
3836
  function parseRepoArg2(value) {
3815
- if (!value) return currentRepo();
3837
+ if (value === void 0) return currentRepo();
3816
3838
  const parsed = parseGithubRepoFullName(value);
3817
3839
  if (!parsed) throw new CliError("user", "repo must be owner/name or a GitHub URL");
3818
3840
  return { owner: parsed.owner, repo: parsed.repo };
@@ -5161,13 +5183,10 @@ function parseStopBlocked(err) {
5161
5183
 
5162
5184
  // src/commands/test-creds.ts
5163
5185
  import { readFileSync as readFileSync4 } from "fs";
5164
- function parseRepoArg4(repo) {
5165
- const trimmed = repo.trim();
5166
- const slashIndex = trimmed.indexOf("/");
5167
- if (slashIndex <= 0 || slashIndex === trimmed.length - 1) {
5168
- throw new CliError("user", `repo must be in the form 'owner/name' (got: '${repo}')`);
5169
- }
5170
- return { owner: trimmed.slice(0, slashIndex), name: trimmed.slice(slashIndex + 1) };
5186
+ function parseRepoArg4(value) {
5187
+ const parsed = parseGithubRepoFullName(value);
5188
+ if (!parsed) throw new CliError("user", "repo must be owner/name or a GitHub URL");
5189
+ return { owner: parsed.owner, name: parsed.repo };
5171
5190
  }
5172
5191
  function basePath(businessId, repo) {
5173
5192
  return `/api/businesses/${encodeURIComponent(businessId)}/repos/${encodeURIComponent(repo.owner)}/${encodeURIComponent(repo.name)}/test-credentials`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tryarcanist/cli",
3
- "version": "0.1.194",
3
+ "version": "0.1.195",
4
4
  "description": "CLI for Arcanist — create and manage coding agent sessions",
5
5
  "type": "module",
6
6
  "bin": {