@staff0rd/assist 0.66.0 → 0.66.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.
Files changed (2) hide show
  1. package/dist/index.js +23 -24
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.66.0",
9
+ version: "0.66.1",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -147,9 +147,11 @@ function loadConfig() {
147
147
  const merged = { ...globalRaw, ...projectRaw };
148
148
  return assistConfigSchema.parse(merged);
149
149
  }
150
- function loadGlobalConfig() {
151
- const raw = loadRawConfig(getGlobalConfigPath());
152
- return assistConfigSchema.parse(raw);
150
+ function loadProjectConfig() {
151
+ return loadRawConfig(getConfigPath());
152
+ }
153
+ function loadGlobalConfigRaw() {
154
+ return loadRawConfig(getGlobalConfigPath());
153
155
  }
154
156
  function saveGlobalConfig(config) {
155
157
  writeFileSync(getGlobalConfigPath(), stringifyYaml(config, { lineWidth: 0 }));
@@ -291,14 +293,10 @@ function exitValidationFailed(issues, key) {
291
293
  function validateConfig(updated, key) {
292
294
  const result = assistConfigSchema.safeParse(updated);
293
295
  if (!result.success) return exitValidationFailed(result.error.issues, key);
294
- return result.data;
296
+ return updated;
295
297
  }
296
298
  function applyConfigSet(key, coerced) {
297
- const updated = setNestedValue(
298
- loadConfig(),
299
- key,
300
- coerced
301
- );
299
+ const updated = setNestedValue(loadProjectConfig(), key, coerced);
302
300
  saveConfig(validateConfig(updated, key));
303
301
  }
304
302
  function configSet(key, value) {
@@ -2944,21 +2942,19 @@ function skip(date) {
2944
2942
  console.log(chalk39.red("Invalid date format. Use YYYY-MM-DD"));
2945
2943
  process.exit(1);
2946
2944
  }
2947
- const config = loadConfig();
2948
- const skipDays = config.devlog?.skip?.days ?? [];
2945
+ const config = loadProjectConfig();
2946
+ const devlog = config.devlog ?? {};
2947
+ const skip2 = devlog.skip ?? {};
2948
+ const skipDays = skip2.days ?? [];
2949
2949
  if (skipDays.includes(date)) {
2950
2950
  console.log(chalk39.yellow(`${date} is already in skip list`));
2951
2951
  return;
2952
2952
  }
2953
2953
  skipDays.push(date);
2954
2954
  skipDays.sort();
2955
- config.devlog = {
2956
- ...config.devlog,
2957
- skip: {
2958
- ...config.devlog?.skip,
2959
- days: skipDays
2960
- }
2961
- };
2955
+ skip2.days = skipDays;
2956
+ devlog.skip = skip2;
2957
+ config.devlog = devlog;
2962
2958
  saveConfig(config);
2963
2959
  console.log(chalk39.green(`Added ${date} to skip list`));
2964
2960
  }
@@ -4333,7 +4329,7 @@ function validateDirectories(transcript) {
4333
4329
  }
4334
4330
  async function configure() {
4335
4331
  const rl = createReadlineInterface();
4336
- const config = loadConfig();
4332
+ const config = loadProjectConfig();
4337
4333
  const existing = config.transcript;
4338
4334
  console.log("Configure transcript directories\n");
4339
4335
  if (existing) printExisting(existing);
@@ -5057,9 +5053,12 @@ async function promptCredentials(existing) {
5057
5053
 
5058
5054
  // src/commands/roam/auth.ts
5059
5055
  async function auth() {
5060
- const config = loadGlobalConfig();
5061
- const { clientId, clientSecret } = await promptCredentials(config.roam);
5062
- config.roam = { ...config.roam, clientId, clientSecret };
5056
+ const config = loadGlobalConfigRaw();
5057
+ const { clientId, clientSecret } = await promptCredentials(
5058
+ config.roam
5059
+ );
5060
+ const existingRoam = config.roam ?? {};
5061
+ config.roam = { ...existingRoam, clientId, clientSecret };
5063
5062
  saveGlobalConfig(config);
5064
5063
  const state = randomBytes(16).toString("hex");
5065
5064
  console.log(
@@ -5143,7 +5142,7 @@ function requireParsedArgs() {
5143
5142
  return parsed;
5144
5143
  }
5145
5144
  function getOrInitRunList() {
5146
- const config = loadConfig();
5145
+ const config = loadProjectConfig();
5147
5146
  if (!config.run) config.run = [];
5148
5147
  return { config, runList: config.run };
5149
5148
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.66.0",
3
+ "version": "0.66.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {