@rolino/cli 0.7.0 → 0.7.1

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/bin.js CHANGED
@@ -1,7 +1,7 @@
1
1
  #!/usr/bin/env node
2
2
  import {
3
3
  runCli
4
- } from "./chunk-PEJ2WA66.js";
4
+ } from "./chunk-KSPZKKBG.js";
5
5
 
6
6
  // src/bin.ts
7
7
  void runCli().then(
@@ -143,13 +143,12 @@ function updateCodexConfig(source, server) {
143
143
  const block = codexBlock(server, newline);
144
144
  const begin = source.indexOf(CODEX_BEGIN);
145
145
  const end = source.indexOf(CODEX_END);
146
- if (begin === -1 !== (end === -1) || begin !== -1 && end < begin) {
147
- throw new TypeError("Codex config contains an incomplete Rolino-managed block.");
148
- }
149
146
  let unmanagedSource = source;
150
- if (begin !== -1) {
147
+ if (begin !== -1 && end !== -1 && end > begin) {
151
148
  const after = end + CODEX_END.length;
152
149
  unmanagedSource = `${source.slice(0, begin)}${source.slice(after)}`;
150
+ } else if (begin !== -1 || end !== -1) {
151
+ unmanagedSource = source.split(/\r?\n/).filter((line) => line.trim() !== CODEX_BEGIN && line.trim() !== CODEX_END).join(newline);
153
152
  }
154
153
  const withoutRolino = removeExistingCodexEntry(unmanagedSource, newline);
155
154
  return `${withoutRolino ? `${withoutRolino}${newline}${newline}` : ""}${block}${newline}`;
@@ -341,7 +340,7 @@ import { Command, CommanderError, InvalidArgumentError } from "commander";
341
340
  // package.json
342
341
  var package_default = {
343
342
  name: "@rolino/cli",
344
- version: "0.7.0",
343
+ version: "0.7.1",
345
344
  description: "Agent-friendly command-line interface for Rolino",
346
345
  type: "module",
347
346
  license: "MIT",
@@ -398,9 +397,9 @@ var package_default = {
398
397
  dev: "tsx src/bin.ts"
399
398
  },
400
399
  dependencies: {
401
- "@rolino/contracts": "0.7.0",
402
- "@rolino/local-auth": "0.7.0",
403
- "@rolino/sdk": "0.7.0",
400
+ "@rolino/contracts": "0.7.1",
401
+ "@rolino/local-auth": "0.7.1",
402
+ "@rolino/sdk": "0.7.1",
404
403
  commander: "^15.0.0",
405
404
  open: "^11.0.0"
406
405
  },
@@ -438,6 +437,7 @@ import {
438
437
  // src/browser-login.ts
439
438
  import { createHash, randomBytes, timingSafeEqual } from "crypto";
440
439
  import { createServer } from "http";
440
+ import { AGENT_CAPABILITIES } from "@rolino/contracts";
441
441
  import {
442
442
  oauthConfiguration
443
443
  } from "@rolino/local-auth";
@@ -445,13 +445,9 @@ import open from "open";
445
445
  var OAUTH_CALLBACK_PORT = 48391;
446
446
  var OAUTH_CALLBACK_PATH = "/oauth/callback";
447
447
  var OAUTH_TIMEOUT_MS = 5 * 60 * 1e3;
448
- var DEFAULT_SCOPES = [
448
+ var AUTHORIZATION_REQUEST_SCOPES = [
449
449
  "offline_access",
450
- "identity:read",
451
- "projects:read",
452
- "posts:read",
453
- "integrations:read",
454
- "calendar:read"
450
+ ...AGENT_CAPABILITIES
455
451
  ];
456
452
  function escapeHtml(value) {
457
453
  return value.replace(/[&<>"']/g, (character) => ({
@@ -491,7 +487,7 @@ function createBrowserAuthorizationRequest(baseUrl) {
491
487
  url.searchParams.set("response_type", "code");
492
488
  url.searchParams.set("client_id", configuration.clientId);
493
489
  url.searchParams.set("redirect_uri", redirectUri);
494
- url.searchParams.set("scope", DEFAULT_SCOPES.join(" "));
490
+ url.searchParams.set("scope", AUTHORIZATION_REQUEST_SCOPES.join(" "));
495
491
  url.searchParams.set("resource", configuration.resource);
496
492
  url.searchParams.set("state", state);
497
493
  url.searchParams.set("code_challenge", codeChallenge);
@@ -530,7 +526,7 @@ async function exchangeAuthorizationCode(options) {
530
526
  accessTokenExpiresAt: new Date(Date.now() + expiresIn * 1e3).toISOString(),
531
527
  refreshToken: payload.refresh_token,
532
528
  refreshTokenExpiresAt: new Date(Date.now() + 30 * 24 * 60 * 60 * 1e3).toISOString(),
533
- scopes: typeof payload.scope === "string" ? payload.scope.split(/\s+/).filter(Boolean) : [...DEFAULT_SCOPES]
529
+ scopes: typeof payload.scope === "string" ? payload.scope.split(/\s+/).filter(Boolean) : [...AUTHORIZATION_REQUEST_SCOPES]
534
530
  };
535
531
  }
536
532
  async function loginWithBrowser(options) {
@@ -2591,4 +2587,4 @@ export {
2591
2587
  ROLINO_CLI_VERSION,
2592
2588
  runCli
2593
2589
  };
2594
- //# sourceMappingURL=chunk-PEJ2WA66.js.map
2590
+ //# sourceMappingURL=chunk-KSPZKKBG.js.map