@hasna/accounts 0.1.17 → 0.1.18
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/dist/cli.js +6 -2
- package/dist/index.js +6 -2
- package/dist/lib/profiles.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -42541,7 +42541,7 @@ function removeCustomTool(id) {
|
|
|
42541
42541
|
|
|
42542
42542
|
// src/lib/profiles.ts
|
|
42543
42543
|
import { homedir as homedir4 } from "node:os";
|
|
42544
|
-
import { isAbsolute, join as join5, resolve as resolve2 } from "node:path";
|
|
42544
|
+
import { isAbsolute, join as join5, relative, resolve as resolve2 } from "node:path";
|
|
42545
42545
|
import { existsSync as existsSync5, mkdirSync as mkdirSync3, rmSync } from "node:fs";
|
|
42546
42546
|
|
|
42547
42547
|
// src/lib/detect.ts
|
|
@@ -42599,6 +42599,10 @@ function listProfiles(toolId) {
|
|
|
42599
42599
|
function profileMatches(name, toolId) {
|
|
42600
42600
|
return loadStore().profiles.filter((p) => p.name === name && (!toolId || p.tool === toolId));
|
|
42601
42601
|
}
|
|
42602
|
+
function isManagedProfileDir(dir) {
|
|
42603
|
+
const rel = relative(resolve2(profilesDir()), resolve2(dir));
|
|
42604
|
+
return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
|
|
42605
|
+
}
|
|
42602
42606
|
function getProfile(name, toolId) {
|
|
42603
42607
|
const matches = profileMatches(name, toolId);
|
|
42604
42608
|
if (matches.length === 0) {
|
|
@@ -42662,7 +42666,7 @@ function removeProfile(name, opts = {}) {
|
|
|
42662
42666
|
let purged = false;
|
|
42663
42667
|
let purgeNote;
|
|
42664
42668
|
if (options.purge) {
|
|
42665
|
-
const managed = profile.dir
|
|
42669
|
+
const managed = isManagedProfileDir(profile.dir);
|
|
42666
42670
|
const isDefault = profile.dir === getTool(profile.tool).defaultDir;
|
|
42667
42671
|
if (managed && !isDefault && existsSync5(profile.dir)) {
|
|
42668
42672
|
rmSync(profile.dir, { recursive: true, force: true });
|
package/dist/index.js
CHANGED
|
@@ -4846,7 +4846,7 @@ function readEmail(file, path) {
|
|
|
4846
4846
|
}
|
|
4847
4847
|
// src/lib/profiles.ts
|
|
4848
4848
|
import { homedir as homedir4 } from "node:os";
|
|
4849
|
-
import { isAbsolute, join as join7, resolve as resolve2 } from "node:path";
|
|
4849
|
+
import { isAbsolute, join as join7, relative, resolve as resolve2 } from "node:path";
|
|
4850
4850
|
import { existsSync as existsSync6, mkdirSync as mkdirSync5, rmSync } from "node:fs";
|
|
4851
4851
|
function nowIso() {
|
|
4852
4852
|
return new Date().toISOString();
|
|
@@ -4867,6 +4867,10 @@ function listProfiles(toolId) {
|
|
|
4867
4867
|
function profileMatches(name, toolId) {
|
|
4868
4868
|
return loadStore().profiles.filter((p) => p.name === name && (!toolId || p.tool === toolId));
|
|
4869
4869
|
}
|
|
4870
|
+
function isManagedProfileDir(dir) {
|
|
4871
|
+
const rel = relative(resolve2(profilesDir()), resolve2(dir));
|
|
4872
|
+
return rel !== "" && !rel.startsWith("..") && !isAbsolute(rel);
|
|
4873
|
+
}
|
|
4870
4874
|
function findProfile(name, toolId) {
|
|
4871
4875
|
const matches = profileMatches(name, toolId);
|
|
4872
4876
|
return matches.length === 1 ? matches[0] : undefined;
|
|
@@ -4934,7 +4938,7 @@ function removeProfile(name, opts = {}) {
|
|
|
4934
4938
|
let purged = false;
|
|
4935
4939
|
let purgeNote;
|
|
4936
4940
|
if (options.purge) {
|
|
4937
|
-
const managed = profile.dir
|
|
4941
|
+
const managed = isManagedProfileDir(profile.dir);
|
|
4938
4942
|
const isDefault = profile.dir === getTool(profile.tool).defaultDir;
|
|
4939
4943
|
if (managed && !isDefault && existsSync6(profile.dir)) {
|
|
4940
4944
|
rmSync(profile.dir, { recursive: true, force: true });
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"profiles.d.ts","sourceRoot":"","sources":["../../src/lib/profiles.ts"],"names":[],"mappings":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AAE,MAAM,CAAA;CAAE,CAoC3D;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAyBxF;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,aAAa,GAAG,OAAO,CAsBxE;AAED,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,OAAO,CAiBpE;AAED,qDAAqD;AACrD,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG;IAAE,OAAO,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAiB9F;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAKlE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/accounts",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "Manage and switch between multiple Claude Code (and other AI coding tool) profiles/accounts locally — isolated config dirs, per-account email, one-command switching.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|