@dreamlake/dreamlake-cli 0.92.0 → 0.94.0

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.
@@ -1,9 +1,15 @@
1
1
  import { type SkillAgent } from "./manifest.js";
2
2
  export interface SkillPreferences {
3
3
  agent: SkillAgent;
4
+ /** Present only when more than one agent was chosen; `agent` is its first entry. */
5
+ agents?: SkillAgent[];
4
6
  scope: "project" | "global";
5
7
  }
6
8
  export declare function preferencesPath(): string;
9
+ /** The saved preferences for these agents, in the shape older CLIs can read. */
10
+ export declare function skillPreferences(agents: SkillAgent[], scope: "project" | "global"): SkillPreferences;
11
+ /** Every agent the preferences select. */
12
+ export declare function preferredAgents(prefs: SkillPreferences): SkillAgent[];
7
13
  /** `null` when nothing was saved or the file is unreadable — never throws. */
8
14
  export declare function readSkillPreferences(): SkillPreferences | null;
9
15
  export declare function writeSkillPreferences(prefs: SkillPreferences): string;
@@ -1,25 +1,42 @@
1
- // The agent and scope `dreamlake init` chose, remembered so every later
1
+ // The agent(s) and scope `dreamlake init` chose, remembered so every later
2
2
  // `skill` subcommand defaults to them. Lives in the CLI state directory next
3
3
  // to `skill-reminders.json`; `--agent`, `--global`, `--project` and `--dir`
4
4
  // override it per invocation and never rewrite it.
5
+ //
6
+ // One agent is saved as `{ agent, scope }`, exactly as before. Several are
7
+ // saved as `{ agent, agents, scope }`: `agents` is the list, `agent` its first
8
+ // entry, so an older CLI that knows only `agent` still reads a usable file.
5
9
  import { readFileSync } from "node:fs";
6
10
  import path from "node:path";
7
11
  import { updateStatePath } from "../self-update/paths.js";
8
12
  import { writeStateFile } from "./files.js";
9
- import { isAgent } from "./manifest.js";
13
+ import { AGENTS, isAgent } from "./manifest.js";
10
14
  export function preferencesPath() {
11
15
  return path.join(path.dirname(updateStatePath()), "skill-preferences.json");
12
16
  }
17
+ /** The saved preferences for these agents, in the shape older CLIs can read. */
18
+ export function skillPreferences(agents, scope) {
19
+ return agents.length > 1 ? { agent: agents[0], agents, scope } : { agent: agents[0], scope };
20
+ }
21
+ /** Every agent the preferences select. */
22
+ export function preferredAgents(prefs) {
23
+ return prefs.agents ?? [prefs.agent];
24
+ }
13
25
  /** `null` when nothing was saved or the file is unreadable — never throws. */
14
26
  export function readSkillPreferences() {
15
27
  try {
16
28
  const parsed = JSON.parse(readFileSync(preferencesPath(), "utf8"));
17
29
  if (!parsed || typeof parsed !== "object")
18
30
  return null;
19
- const { agent, scope } = parsed;
31
+ const { agent, agents, scope } = parsed;
32
+ const scoped = scope === "global" ? "global" : "project";
33
+ // A list wins when every entry is an agent; a malformed list falls back to `agent`.
34
+ if (Array.isArray(agents) && agents.length > 0 && agents.every(isAgent)) {
35
+ return skillPreferences(AGENTS.filter((a) => agents.includes(a)), scoped);
36
+ }
20
37
  if (!isAgent(agent))
21
38
  return null;
22
- return { agent, scope: scope === "global" ? "global" : "project" };
39
+ return { agent, scope: scoped };
23
40
  }
24
41
  catch {
25
42
  return null;
@@ -1 +1 @@
1
- export declare const VERSION = "0.92.0";
1
+ export declare const VERSION = "0.94.0";
@@ -6,4 +6,4 @@
6
6
  // value means a binary that re-installs the same version forever.
7
7
  //
8
8
  // Editing this by hand does nothing for a release; bump package.json.
9
- export const VERSION = "0.92.0";
9
+ export const VERSION = "0.94.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dreamlake/dreamlake-cli",
3
- "version": "0.92.0",
3
+ "version": "0.94.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/dreamlake-ai/dreamlake-cli.git"
@@ -35,13 +35,13 @@
35
35
  "node": ">=18"
36
36
  },
37
37
  "optionalDependencies": {
38
- "@dreamlake/dreamlake-cli-darwin-arm64": "0.92.0",
39
- "@dreamlake/dreamlake-cli-darwin-x64": "0.92.0",
40
- "@dreamlake/dreamlake-cli-linux-x64": "0.92.0",
41
- "@dreamlake/dreamlake-cli-linux-arm64": "0.92.0",
42
- "@dreamlake/dreamlake-cli-linux-x64-musl": "0.92.0",
43
- "@dreamlake/dreamlake-cli-linux-arm64-musl": "0.92.0",
44
- "@dreamlake/dreamlake-cli-win32-x64": "0.92.0",
45
- "@dreamlake/dreamlake-cli-win32-arm64": "0.92.0"
38
+ "@dreamlake/dreamlake-cli-darwin-arm64": "0.94.0",
39
+ "@dreamlake/dreamlake-cli-darwin-x64": "0.94.0",
40
+ "@dreamlake/dreamlake-cli-linux-x64": "0.94.0",
41
+ "@dreamlake/dreamlake-cli-linux-arm64": "0.94.0",
42
+ "@dreamlake/dreamlake-cli-linux-x64-musl": "0.94.0",
43
+ "@dreamlake/dreamlake-cli-linux-arm64-musl": "0.94.0",
44
+ "@dreamlake/dreamlake-cli-win32-x64": "0.94.0",
45
+ "@dreamlake/dreamlake-cli-win32-arm64": "0.94.0"
46
46
  }
47
47
  }