rudel 0.2.1 → 0.2.2

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/cli.js +54 -21
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -1887,7 +1887,7 @@ async function run(app, inputs, context) {
1887
1887
  // package.json
1888
1888
  var package_default = {
1889
1889
  name: "rudel",
1890
- version: "0.2.1",
1890
+ version: "0.2.2",
1891
1891
  type: "module",
1892
1892
  description: "CLI for the Coding Agent Analytics Platform rudel.ai",
1893
1893
  license: "MIT",
@@ -11021,7 +11021,6 @@ var SessionAnalyticsSchema = exports_external.object({
11021
11021
  skills: exports_external.array(exports_external.string()),
11022
11022
  slash_commands: exports_external.array(exports_external.string()),
11023
11023
  has_commit: exports_external.boolean(),
11024
- session_archetype: exports_external.string(),
11025
11024
  model_used: exports_external.string(),
11026
11025
  used_plan_mode: exports_external.boolean(),
11027
11026
  source: SourceSchema.optional()
@@ -11044,6 +11043,8 @@ var SessionAnalyticsSummaryComparisonSchema = exports_external.object({
11044
11043
  })
11045
11044
  });
11046
11045
  var SessionListInputSchema = DaysInputSchema.extend({
11046
+ startDate: exports_external.string().date().optional(),
11047
+ endDate: exports_external.string().date().optional(),
11047
11048
  userId: exports_external.string().max(MAX_ID_FILTER_LENGTH).optional(),
11048
11049
  projectPath: exports_external.string().max(MAX_PATH_FILTER_LENGTH).optional(),
11049
11050
  repository: exports_external.string().max(MAX_PATH_FILTER_LENGTH).optional(),
@@ -11057,7 +11058,6 @@ var VALID_DIMENSIONS = [
11057
11058
  "user_id",
11058
11059
  "project_path",
11059
11060
  "repository",
11060
- "session_archetype",
11061
11061
  "model_used",
11062
11062
  "has_commit",
11063
11063
  "used_plan_mode",
@@ -11111,7 +11111,6 @@ var SessionDetailSchema = exports_external.object({
11111
11111
  success_score: exports_external.number().optional(),
11112
11112
  duration_min: exports_external.number().optional(),
11113
11113
  total_interactions: exports_external.number().optional(),
11114
- session_archetype: exports_external.string().optional(),
11115
11114
  model_used: exports_external.string().optional(),
11116
11115
  source: SourceSchema.optional()
11117
11116
  });
@@ -11848,43 +11847,77 @@ var contract = {
11848
11847
  };
11849
11848
 
11850
11849
  // src/lib/credentials.ts
11850
+ import { randomUUID } from "node:crypto";
11851
11851
  import {
11852
+ chmodSync,
11852
11853
  existsSync as existsSync6,
11853
11854
  mkdirSync as mkdirSync2,
11854
11855
  readFileSync as readFileSync5,
11856
+ renameSync,
11855
11857
  rmSync,
11858
+ statSync,
11856
11859
  writeFileSync as writeFileSync3
11857
11860
  } from "node:fs";
11858
11861
  import { homedir as homedir7 } from "node:os";
11859
11862
  import { join as join9 } from "node:path";
11863
+ var PRIVATE_DIRECTORY_MODE2 = 448;
11864
+ var PRIVATE_FILE_MODE2 = 384;
11860
11865
  function getConfigDir() {
11861
11866
  return process.env.RUDEL_CONFIG_DIR ?? join9(homedir7(), ".rudel");
11862
11867
  }
11863
- function getCredentialsPath() {
11864
- return join9(getConfigDir(), "credentials.json");
11865
- }
11866
11868
  function saveCredentials(credentials) {
11867
11869
  const dir = getConfigDir();
11868
- if (!existsSync6(dir)) {
11869
- mkdirSync2(dir, { recursive: true, mode: 448 });
11870
+ const path = getCredentialsPath(dir);
11871
+ const content = JSON.stringify(credentials, null, 2);
11872
+ mkdirSync2(dir, { recursive: true, mode: PRIVATE_DIRECTORY_MODE2 });
11873
+ enforcePrivateMode(dir, PRIVATE_DIRECTORY_MODE2);
11874
+ if (existsSync6(path)) {
11875
+ enforcePrivateMode(path, PRIVATE_FILE_MODE2);
11870
11876
  }
11871
- writeFileSync3(getCredentialsPath(), JSON.stringify(credentials, null, 2), {
11872
- mode: 384
11873
- });
11877
+ replaceCredentialsFile(path, content);
11874
11878
  }
11875
11879
  function loadCredentials() {
11876
- const path = getCredentialsPath();
11880
+ const dir = getConfigDir();
11881
+ const path = getCredentialsPath(dir);
11877
11882
  if (!existsSync6(path))
11878
11883
  return null;
11884
+ enforcePrivateMode(dir, PRIVATE_DIRECTORY_MODE2);
11885
+ enforcePrivateMode(path, PRIVATE_FILE_MODE2);
11879
11886
  const content = readFileSync5(path, "utf-8");
11880
11887
  return JSON.parse(content);
11881
11888
  }
11882
11889
  function clearCredentials() {
11883
- const path = getCredentialsPath();
11890
+ const path = getCredentialsPath(getConfigDir());
11884
11891
  if (existsSync6(path)) {
11885
11892
  rmSync(path);
11886
11893
  }
11887
11894
  }
11895
+ function getCredentialsPath(configDir) {
11896
+ return join9(configDir, "credentials.json");
11897
+ }
11898
+ function replaceCredentialsFile(path, content) {
11899
+ const temporaryPath = `${path}.${process.pid}.${randomUUID()}.tmp`;
11900
+ try {
11901
+ writeFileSync3(temporaryPath, content, {
11902
+ encoding: "utf8",
11903
+ flag: "wx",
11904
+ mode: PRIVATE_FILE_MODE2
11905
+ });
11906
+ enforcePrivateMode(temporaryPath, PRIVATE_FILE_MODE2);
11907
+ renameSync(temporaryPath, path);
11908
+ enforcePrivateMode(path, PRIVATE_FILE_MODE2);
11909
+ } finally {
11910
+ rmSync(temporaryPath, { force: true });
11911
+ }
11912
+ }
11913
+ function enforcePrivateMode(path, mode) {
11914
+ if (process.platform === "win32")
11915
+ return;
11916
+ chmodSync(path, mode);
11917
+ if ((statSync(path).mode & 511) !== mode) {
11918
+ throw new Error("Unable to establish private credential permissions");
11919
+ }
11920
+ }
11888
11921
 
11889
11922
  // src/lib/insecure-url-opt-in.ts
11890
11923
  var TRUTHY_ENV_VALUES = ["1", "true", "yes", "on"];
@@ -14416,7 +14449,7 @@ function renderBatchSummary(summary, options) {
14416
14449
  }
14417
14450
 
14418
14451
  // src/lib/product-analytics.ts
14419
- import { randomUUID } from "node:crypto";
14452
+ import { randomUUID as randomUUID2 } from "node:crypto";
14420
14453
  import { existsSync as existsSync8, mkdirSync as mkdirSync3, readFileSync as readFileSync7, writeFileSync as writeFileSync4 } from "node:fs";
14421
14454
  import { homedir as homedir8 } from "node:os";
14422
14455
  import { join as join11 } from "node:path";
@@ -18938,7 +18971,7 @@ function getOrCreateCliInstallationId() {
18938
18971
  if (typeof state.cli_installation_id === "string") {
18939
18972
  return state.cli_installation_id;
18940
18973
  }
18941
- const cliInstallationId = randomUUID();
18974
+ const cliInstallationId = randomUUID2();
18942
18975
  writeAnalyticsState({
18943
18976
  ...state,
18944
18977
  cli_installation_id: cliInstallationId
@@ -19048,7 +19081,7 @@ var CliProductAnalyticsEvents = PRODUCT_ANALYTICS_EVENTS;
19048
19081
 
19049
19082
  // src/lib/project-config.ts
19050
19083
  import {
19051
- chmodSync,
19084
+ chmodSync as chmodSync2,
19052
19085
  existsSync as existsSync9,
19053
19086
  mkdirSync as mkdirSync4,
19054
19087
  readFileSync as readFileSync8,
@@ -19066,18 +19099,18 @@ function loadProjectsConfig() {
19066
19099
  const path = getProjectsConfigPath();
19067
19100
  if (!existsSync9(path))
19068
19101
  return { projects: {} };
19069
- chmodSync(getConfigDir3(), 448);
19070
- chmodSync(path, 384);
19102
+ chmodSync2(getConfigDir3(), 448);
19103
+ chmodSync2(path, 384);
19071
19104
  const content = readFileSync8(path, "utf-8");
19072
19105
  return JSON.parse(content);
19073
19106
  }
19074
19107
  function saveProjectsConfig(config) {
19075
19108
  const dir = getConfigDir3();
19076
19109
  mkdirSync4(dir, { recursive: true, mode: 448 });
19077
- chmodSync(dir, 448);
19110
+ chmodSync2(dir, 448);
19078
19111
  const path = getProjectsConfigPath();
19079
19112
  writeFileSync5(path, JSON.stringify(config, null, 2), { mode: 384 });
19080
- chmodSync(path, 384);
19113
+ chmodSync2(path, 384);
19081
19114
  }
19082
19115
  async function getProjectKey(cwd) {
19083
19116
  try {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rudel",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "type": "module",
5
5
  "description": "CLI for the Coding Agent Analytics Platform rudel.ai",
6
6
  "license": "MIT",