authoring-cli 0.1.12 → 0.1.13

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/HELP.md CHANGED
@@ -193,6 +193,7 @@ authoring-cli validate-review-concepts
193
193
 
194
194
  ### Session Management
195
195
  - Your session is stored in `~/.authoring-cli/session.json`
196
+ - Set `AUTHORING_CLI_HOME` to store the session under a different directory instead (e.g. a workspace-local path when `~` isn't accessible to the caller, such as a sandboxed agent) — the session file is then `$AUTHORING_CLI_HOME/session.json`
196
197
  - If you have multiple Chrome profiles, specify which one: `authoring-cli login --chrome-profile "Work Profile"`
197
198
  - If your session expires during use, you'll get a `401 Unauthorized` error — run `authoring-cli login` again
198
199
 
package/README.md CHANGED
@@ -79,6 +79,8 @@ Signed in as Jane Doe. (reused an existing Chrome session — no browser opened.
79
79
 
80
80
  `logout` deletes the locally stored session (`~/.authoring-cli/session.json`). It does not sign you out of IMS in Chrome, so a subsequent `login` will reuse that browser session.
81
81
 
82
+ By default the session lives under the real home directory (`os.homedir()`), which a sandboxed caller — an AI agent whose filesystem access is scoped to a workspace, for example — may not be able to read or write. Set `AUTHORING_CLI_HOME` to a workspace-local directory to store `session.json` there instead; every command reads/writes the session through the same path, so setting the variable once (e.g. exported alongside the agent's launch environment) covers `login`, `select-task`, and everything else with no per-command flag.
83
+
82
84
  Optional flags, for a deployment the named environments don't cover: `--ims-endpoint`, `--terminology-server-endpoint`, `--authoring-services-endpoint` (each overrides just that one value of the selected environment), `--cookie-name <name>` (override the IMS session cookie name), `--chrome-profile <name>` (target a specific Chrome profile by its display name or directory name if you have more than one).
83
85
 
84
86
  ## Pick a project and task
package/dist/index.js CHANGED
@@ -81,7 +81,7 @@ var http = __toESM(require("http"));
81
81
  var https = __toESM(require("https"));
82
82
  function requestJson(url, opts = {}) {
83
83
  const { method = "GET", cookie, body, headers = {}, timeoutMs = 15e3 } = opts;
84
- return new Promise((resolve2, reject) => {
84
+ return new Promise((resolve3, reject) => {
85
85
  let urlObj;
86
86
  try {
87
87
  urlObj = new URL(url);
@@ -137,7 +137,7 @@ function requestJson(url, opts = {}) {
137
137
  sessionExpired = !looksJson;
138
138
  }
139
139
  }
140
- resolve2({ statusCode, body: parsed, rawBody: data, sessionExpired });
140
+ resolve3({ statusCode, body: parsed, rawBody: data, sessionExpired });
141
141
  });
142
142
  }
143
143
  );
@@ -919,7 +919,7 @@ function cleanConceptForUpdate(concept) {
919
919
  return cleaned;
920
920
  }
921
921
  function sleep(ms) {
922
- return new Promise((resolve2) => setTimeout(resolve2, ms));
922
+ return new Promise((resolve3) => setTimeout(resolve3, ms));
923
923
  }
924
924
  function isBranchLockConflict(result) {
925
925
  if (result.statusCode !== 400) {
@@ -2473,11 +2473,11 @@ function matchesNotification(payload, match) {
2473
2473
  function waitForNotification(match) {
2474
2474
  let unsubscribe = () => {
2475
2475
  };
2476
- const promise = new Promise((resolve2) => {
2476
+ const promise = new Promise((resolve3) => {
2477
2477
  unsubscribe = onNotification((payload) => {
2478
2478
  if (matchesNotification(payload, match)) {
2479
2479
  unsubscribe();
2480
- resolve2(payload);
2480
+ resolve3(payload);
2481
2481
  }
2482
2482
  });
2483
2483
  });
@@ -2490,7 +2490,7 @@ var VALIDATION_RUNNING_STATUSES = ["QUEUED", "SCHEDULED", "RUNNING"];
2490
2490
  var BLOCKED_TASK_STATUSES = ["Promoted", "Completed"];
2491
2491
  var POLL_INTERVAL_MS = 5e3;
2492
2492
  function sleep2(ms) {
2493
- return new Promise((resolve2) => setTimeout(resolve2, ms));
2493
+ return new Promise((resolve3) => setTimeout(resolve3, ms));
2494
2494
  }
2495
2495
  async function pollUntil(check, intervalMs, maxAttempts) {
2496
2496
  let attempt = 0;
@@ -3245,8 +3245,8 @@ async function watchNotification(cfg, input, currentTask) {
3245
3245
  const timeoutSeconds = input.timeoutSeconds ?? DEFAULT_TIMEOUT_SECONDS;
3246
3246
  const wake = waitForNotification({ entityType: input.entityType, projectKey, taskKey, branchPath });
3247
3247
  let timer;
3248
- const timeout = new Promise((resolve2) => {
3249
- timer = setTimeout(() => resolve2({ kind: "timeout" }), timeoutSeconds * 1e3);
3248
+ const timeout = new Promise((resolve3) => {
3249
+ timer = setTimeout(() => resolve3({ kind: "timeout" }), timeoutSeconds * 1e3);
3250
3250
  });
3251
3251
  const notified = wake.promise.then((payload) => ({ kind: "notification", payload }));
3252
3252
  const result = await Promise.race([notified, timeout]);
@@ -3448,7 +3448,7 @@ async function readCookieValue(profileDirectory, host, cookieName) {
3448
3448
  }
3449
3449
  }
3450
3450
  function defaultSleep(ms) {
3451
- return new Promise((resolve2) => setTimeout(resolve2, ms));
3451
+ return new Promise((resolve3) => setTimeout(resolve3, ms));
3452
3452
  }
3453
3453
  async function captureFreshCookie(opts, deps = {}) {
3454
3454
  const platform = deps.platform ?? process.platform;
@@ -3511,7 +3511,7 @@ function waitForBrowserLogin(opts, deps = {}) {
3511
3511
  const captureCookie = deps.captureCookie ?? captureFreshCookie;
3512
3512
  const timeoutMs = opts.callbackTimeoutMs ?? 12e4;
3513
3513
  const profile = resolveProfile(opts.chromeProfile);
3514
- return new Promise((resolve2, reject) => {
3514
+ return new Promise((resolve3, reject) => {
3515
3515
  let settled = false;
3516
3516
  const finish = (fn) => {
3517
3517
  if (!settled) {
@@ -3528,7 +3528,7 @@ function waitForBrowserLogin(opts, deps = {}) {
3528
3528
  void (async () => {
3529
3529
  try {
3530
3530
  const value = await captureCookie({ profileDirectory: profile.directoryName, host: opts.host, cookieName });
3531
- finish(() => resolve2({ cookie: `${cookieName}=${value}` }));
3531
+ finish(() => resolve3({ cookie: `${cookieName}=${value}` }));
3532
3532
  } catch (err) {
3533
3533
  finish(() => reject(err));
3534
3534
  }
@@ -3545,7 +3545,7 @@ function waitForBrowserLogin(opts, deps = {}) {
3545
3545
  openChrome(loginUrl, profile.directoryName);
3546
3546
  });
3547
3547
  server.on("error", (err) => finish(() => reject(err)));
3548
- setTimeout(() => finish(() => resolve2(null)), timeoutMs);
3548
+ setTimeout(() => finish(() => resolve3(null)), timeoutMs);
3549
3549
  });
3550
3550
  }
3551
3551
 
@@ -3553,7 +3553,12 @@ function waitForBrowserLogin(opts, deps = {}) {
3553
3553
  var fs4 = __toESM(require("fs"));
3554
3554
  var os3 = __toESM(require("os"));
3555
3555
  var path3 = __toESM(require("path"));
3556
+ var HOME_OVERRIDE_ENV_VAR = "AUTHORING_CLI_HOME";
3556
3557
  function sessionDir() {
3558
+ const override = process.env[HOME_OVERRIDE_ENV_VAR];
3559
+ if (override && override.trim() !== "") {
3560
+ return path3.resolve(override);
3561
+ }
3557
3562
  return path3.join(os3.homedir(), ".authoring-cli");
3558
3563
  }
3559
3564
  function sessionPath() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "authoring-cli",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "CLI for SNOMED CT authoring against authoring-services",
5
5
  "license": "Apache-2.0",
6
6
  "bin": {