@aravhawk/cc-switch 1.1.0 → 1.1.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 (3) hide show
  1. package/README.md +14 -0
  2. package/dist/index.js +30 -1
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -25,6 +25,7 @@ cc-switch
25
25
  ```
26
26
 
27
27
  This will present a menu with options to:
28
+ - Show the current profile
28
29
  - Switch between profiles
29
30
  - Create new profiles
30
31
  - Delete profiles
@@ -44,6 +45,11 @@ Example:
44
45
  cc-switch switch work
45
46
  ```
46
47
 
48
+ Shorthand:
49
+ ```bash
50
+ cc-switch work
51
+ ```
52
+
47
53
  #### Create Profile
48
54
 
49
55
  Create a new profile from your current `~/.claude/settings.json`:
@@ -91,6 +97,14 @@ List all available profiles:
91
97
  cc-switch list
92
98
  ```
93
99
 
100
+ #### Current Profile
101
+
102
+ Show the active profile:
103
+
104
+ ```bash
105
+ cc-switch current
106
+ ```
107
+
94
108
  ## How It Works
95
109
 
96
110
  `cc-switch` manages multiple Claude Code profiles by storing copies of your `settings.json` file in separate profile directories.
package/dist/index.js CHANGED
@@ -111,6 +111,11 @@ async function profileExists(profileName) {
111
111
  return false;
112
112
  }
113
113
  }
114
+ async function getActiveProfileStatus() {
115
+ const state = await readState();
116
+ const exists = await profileExists(state.activeProfile);
117
+ return { name: state.activeProfile, exists };
118
+ }
114
119
  async function mirrorSettings(profileName) {
115
120
  const profileSettings = getProfileSettings(profileName);
116
121
  await mkdir2(dirname2(profileSettings), { recursive: true });
@@ -195,6 +200,10 @@ async function renameProfile(oldName, newName) {
195
200
 
196
201
  // src/index.ts
197
202
  var program = new Command();
203
+ function formatActiveProfileLine(status) {
204
+ const missingSuffix = status.exists ? "" : " (missing)";
205
+ return `Current profile: "${status.name}"${missingSuffix}`;
206
+ }
198
207
  program.name("cc-switch").description("Profile manager for Claude Code settings").version("1.0.0");
199
208
  program.command("switch <name>").description("Switch to a different profile").action(async (name) => {
200
209
  try {
@@ -236,9 +245,21 @@ program.command("rename <oldName> <newName>").description("Rename a profile").ac
236
245
  process.exit(1);
237
246
  }
238
247
  });
248
+ program.command("current").description("Show the current active profile").action(async () => {
249
+ try {
250
+ const activeStatus = await getActiveProfileStatus();
251
+ console.log(formatActiveProfileLine(activeStatus));
252
+ process.exit(0);
253
+ } catch (error) {
254
+ console.error(`Error: ${error.message}`);
255
+ process.exit(1);
256
+ }
257
+ });
239
258
  program.command("list").description("List all profiles").action(async () => {
240
259
  try {
241
260
  const profiles = await listProfiles();
261
+ const activeStatus = await getActiveProfileStatus();
262
+ console.log(formatActiveProfileLine(activeStatus));
242
263
  if (profiles.length === 0) {
243
264
  console.log("No profiles found");
244
265
  process.exit(0);
@@ -266,6 +287,7 @@ async function interactiveMode() {
266
287
  const action = await clack.select({
267
288
  message: "What would you like to do?",
268
289
  options: [
290
+ { value: "current", label: "Show current profile" },
269
291
  { value: "switch", label: "Switch profile" },
270
292
  { value: "create", label: "Create new profile" },
271
293
  { value: "delete", label: "Delete profile" },
@@ -295,6 +317,11 @@ async function interactiveMode() {
295
317
  clack.outro(`Switched to profile "${selectedProfile}"`);
296
318
  break;
297
319
  }
320
+ case "current": {
321
+ const activeStatus = await getActiveProfileStatus();
322
+ clack.outro(formatActiveProfileLine(activeStatus));
323
+ break;
324
+ }
298
325
  case "create": {
299
326
  const profileName = await clack.text({
300
327
  message: "Enter new profile name:",
@@ -377,6 +404,8 @@ async function interactiveMode() {
377
404
  break;
378
405
  }
379
406
  case "list": {
407
+ const activeStatus = await getActiveProfileStatus();
408
+ console.log(formatActiveProfileLine(activeStatus));
380
409
  console.log("\nProfiles:");
381
410
  for (const profile of profiles) {
382
411
  const marker = profile.isActive ? " (active)" : "";
@@ -394,7 +423,7 @@ async function interactiveMode() {
394
423
  }
395
424
  }
396
425
  var rawArgs = process.argv.slice(2);
397
- var knownCommands = /* @__PURE__ */ new Set(["switch", "create", "delete", "rename", "list"]);
426
+ var knownCommands = /* @__PURE__ */ new Set(["switch", "create", "delete", "rename", "list", "current"]);
398
427
  var firstArg = rawArgs[0];
399
428
  var isFlag = firstArg?.startsWith("-");
400
429
  if (rawArgs.length === 1 && firstArg && !knownCommands.has(firstArg) && !isFlag) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aravhawk/cc-switch",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "Profile manager for Claude Code settings",
5
5
  "type": "module",
6
6
  "bin": {