@synth1s/cloak 1.6.0 → 1.8.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@synth1s/cloak",
3
- "version": "1.6.0",
3
+ "version": "1.8.0",
4
4
  "description": "Cloak your Claude. Switch identities in seconds.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -42,6 +42,13 @@ export function getInitScript() {
42
42
  ' command claude "$@"',
43
43
  ' fi',
44
44
  ' else',
45
+ ' if [ -n "$CLAUDE_CONFIG_DIR" ]; then',
46
+ ' local _cloak_name',
47
+ ' _cloak_name=$(command cloak whoami 2>/dev/null)',
48
+ ' if [ -n "$_cloak_name" ]; then',
49
+ ' echo "🔹 Wearing cloak \\"$_cloak_name\\"" >&2',
50
+ ' fi',
51
+ ' fi',
45
52
  ' command claude "$@"',
46
53
  ' fi',
47
54
  '}',
@@ -1,4 +1,4 @@
1
- import { listProfileNames, getActiveProfile } from '../lib/paths.js'
1
+ import { listProfileNames, getActiveProfile, getAccountEmail } from '../lib/paths.js'
2
2
  import * as msg from '../lib/messages.js'
3
3
 
4
4
  export function listAccounts() {
@@ -8,6 +8,7 @@ export function listAccounts() {
8
8
  const accounts = names.map(name => ({
9
9
  name,
10
10
  active: name === active,
11
+ email: getAccountEmail(name),
11
12
  }))
12
13
 
13
14
  if (accounts.length === 0) {
@@ -17,8 +18,8 @@ export function listAccounts() {
17
18
  }
18
19
 
19
20
  console.log(msg.accountListHeader())
20
- accounts.forEach(({ name, active: isActive }) => {
21
- console.log(msg.accountListItem(name, isActive))
21
+ accounts.forEach(({ name, active: isActive, email }) => {
22
+ console.log(msg.accountListItem(name, isActive, email))
22
23
  })
23
24
  console.log()
24
25
 
@@ -98,11 +98,12 @@ export function accountListHeader() {
98
98
  return chalk.bold('\nYour Cloaks\n')
99
99
  }
100
100
 
101
- export function accountListItem(name, isActive) {
101
+ export function accountListItem(name, isActive, email) {
102
102
  const marker = isActive ? icon.active : icon.inactive
103
103
  const label = isActive ? chalk.green.bold(name) : chalk.white(name)
104
104
  const tag = isActive ? chalk.green(' (active)') : ''
105
- return ` ${marker} ${label}${tag}`
105
+ const emailTag = email ? chalk.dim(` ${email}`) : ''
106
+ return ` ${marker} ${label}${tag}${emailTag}`
106
107
  }
107
108
 
108
109
  export function alreadyInstalled(rcFile) {
@@ -127,6 +128,12 @@ export function shellIntegrationTip(rcFile) {
127
128
  chalk.dim(` echo 'eval "$(cloak init)"' >> ${file} && source ${file}\n\n`)
128
129
  }
129
130
 
131
+ // --- Active cloak indicator (shown on claude launch) ---
132
+
133
+ export function wearingCloak(name) {
134
+ return `🔹 Wearing cloak "${name}"`
135
+ }
136
+
130
137
  // --- Print-env (stdout, no chalk — evaluated by shell) ---
131
138
 
132
139
  export function printEnvExport(dir) {
package/src/lib/paths.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { homedir } from 'os'
2
2
  import { join, resolve, sep } from 'path'
3
- import { existsSync, mkdirSync, readdirSync } from 'fs'
3
+ import { existsSync, mkdirSync, readdirSync, readFileSync } from 'fs'
4
4
 
5
5
  function getHome() {
6
6
  return process.env.HOME || homedir()
@@ -67,3 +67,14 @@ export function getActiveProfile() {
67
67
  const name = resolved.slice(profilesResolved.length + 1).split(sep)[0]
68
68
  return name || null
69
69
  }
70
+
71
+ export function getAccountEmail(name) {
72
+ try {
73
+ const authFile = profileAuthPath(name)
74
+ if (!existsSync(authFile)) return null
75
+ const data = JSON.parse(readFileSync(authFile, 'utf8'))
76
+ return data?.oauthAccount?.emailAddress || null
77
+ } catch {
78
+ return null
79
+ }
80
+ }