@hasna/skills 0.10.0 → 0.10.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.
package/bin/index.js CHANGED
@@ -36868,7 +36868,7 @@ var package_default;
36868
36868
  var init_package = __esm(() => {
36869
36869
  package_default = {
36870
36870
  name: "@hasna/skills",
36871
- version: "0.10.0",
36871
+ version: "0.10.1",
36872
36872
  description: "Skills library for AI coding agents",
36873
36873
  type: "module",
36874
36874
  bin: {
@@ -48285,10 +48285,19 @@ var init_transport = __esm(() => {
48285
48285
  ]);
48286
48286
  });
48287
48287
 
48288
+ // src/lib/cli-credential-profile.ts
48289
+ function selectCliSkillsCredentialProfile(profile) {
48290
+ cliCredentialProfile = profile;
48291
+ }
48292
+ function selectedCliSkillsCredentialProfile() {
48293
+ return cliCredentialProfile;
48294
+ }
48295
+ var cliCredentialProfile;
48296
+
48288
48297
  // src/lib/instance-credentials.ts
48289
48298
  import { closeSync as closeSync5, constants as constants3, fstatSync as fstatSync5, lstatSync as lstatSync8, openSync as openSync5, readSync as readSync2 } from "fs";
48290
48299
  function selectedSkillsProfile(env3, explicit) {
48291
- const selected = explicit ?? env3.HASNA_PROFILE;
48300
+ const selected = explicit ?? selectedCliSkillsCredentialProfile() ?? env3.HASNA_PROFILE;
48292
48301
  if (selected === undefined)
48293
48302
  return null;
48294
48303
  const profile = selected.trim();
@@ -48574,11 +48583,13 @@ function snapshotSkillsEnvironment(env3) {
48574
48583
  return Object.freeze(snapshot);
48575
48584
  }
48576
48585
  function snapshotSkillsOptions(env3, options) {
48586
+ const profile = options.credentials?.profile ?? selectedCliSkillsCredentialProfile();
48587
+ const credentials = profile === undefined ? options.credentials : { ...options.credentials, profile };
48577
48588
  if (env3 !== process.env)
48578
- return options;
48579
- return { ...options, credentials: { ...options.credentials, keychain: {
48580
- ...options.credentials?.keychain,
48581
- enabled: options.credentials?.keychain?.enabled ?? true
48589
+ return credentials === options.credentials ? options : { ...options, credentials };
48590
+ return { ...options, credentials: { ...credentials, keychain: {
48591
+ ...credentials?.keychain,
48592
+ enabled: credentials?.keychain?.enabled ?? true
48582
48593
  } } };
48583
48594
  }
48584
48595
  function resolveSkillsFleetOrThrow(env3, options) {
@@ -48666,8 +48677,9 @@ async function resolveSkillsApiKey(env3 = process.env, options = {}) {
48666
48677
  }
48667
48678
  async function resolveSkillsConnection(env3 = process.env, options = {}) {
48668
48679
  const snapshotEnv = snapshotSkillsEnvironment(env3);
48669
- const assertFilesUnchanged = selectsSkillsLocalMode(snapshotEnv) ? () => {} : captureSkillsCredentialFiles(skillsProfileCredentialFiles(snapshotEnv, options.credentials?.profile));
48670
- const fleet = resolveSkillsFleet(snapshotEnv, snapshotSkillsOptions(env3, options));
48680
+ const resolvedOptions = snapshotSkillsOptions(env3, options);
48681
+ const assertFilesUnchanged = selectsSkillsLocalMode(snapshotEnv) ? () => {} : captureSkillsCredentialFiles(skillsProfileCredentialFiles(snapshotEnv, resolvedOptions.credentials?.profile));
48682
+ const fleet = resolveSkillsFleet(snapshotEnv, resolvedOptions);
48671
48683
  if (fleet.mode === "local" && env3 === process.env)
48672
48684
  noticeLocalSkillsMode();
48673
48685
  if (fleet.mode !== "hosted")
@@ -80211,9 +80223,12 @@ async function revokeStoredKey(origin, apiKey) {
80211
80223
  return { outcome: "revoked" };
80212
80224
  return { outcome: "not_revoked", detail: "the server answered without confirming revocation" };
80213
80225
  }
80214
- function activeCredentialSource(env3, options) {
80226
+ function activeCredentialSource(env3, options, profile) {
80215
80227
  try {
80216
- return resolveCredential("skills", env3, options.credentials)?.source ?? null;
80228
+ return resolveCredential("skills", env3, {
80229
+ ...options.credentials,
80230
+ profile: profile ?? options.credentials?.profile ?? selectedSkillsProfile(env3) ?? undefined
80231
+ })?.source ?? null;
80217
80232
  } catch {
80218
80233
  return null;
80219
80234
  }
@@ -80290,7 +80305,7 @@ async function signOut(options = {}) {
80290
80305
  const selected = selectedSkillsProfile(env3);
80291
80306
  const other = options.environmentProfile;
80292
80307
  if (other !== undefined && other !== selected) {
80293
- const otherSource = activeCredentialSource({ ...env3, HASNA_PROFILE: other }, fleet);
80308
+ const otherSource = activeCredentialSource({ ...env3, HASNA_PROFILE: other }, fleet, other);
80294
80309
  if (otherSource) {
80295
80310
  reasons.push({
80296
80311
  code: "credential_still_active",
@@ -80299,7 +80314,7 @@ async function signOut(options = {}) {
80299
80314
  }
80300
80315
  }
80301
80316
  if (selected && !still) {
80302
- notes.push(`HASNA_PROFILE still selects profile "${selected}", which now has no credential. The next command will stop and name it until you run skills login or unset HASNA_PROFILE.`);
80317
+ notes.push(selectedCliSkillsCredentialProfile() ? `--profile selected profile "${selected}", which now has no credential. A future command with the same flag will stop and name it until you run skills login for that profile.` : `HASNA_PROFILE still selects profile "${selected}", which now has no credential. The next command will stop and name it until you run skills login or unset HASNA_PROFILE.`);
80303
80318
  }
80304
80319
  if (!stored && reasons.length === 0)
80305
80320
  notes.push("Already signed out: this profile has no credential stored by skills login.");
@@ -122009,8 +122024,7 @@ program2.name("skills").description("Discover and run AI agent skills through th
122009
122024
  program2.hook("preAction", () => {
122010
122025
  const profile = program2.opts().profile;
122011
122026
  recordEnvironmentProfile(process.env.HASNA_PROFILE);
122012
- if (profile !== undefined)
122013
- process.env.HASNA_PROFILE = profile;
122027
+ selectCliSkillsCredentialProfile(profile);
122014
122028
  });
122015
122029
  program2.command("interactive", { isDefault: true }).alias("i").allowExcessArguments(true).description("Interactive skill browser (TUI)").action(async (_options, command) => {
122016
122030
  const stray = command.args[0];
package/bin/mcp.js CHANGED
@@ -20019,7 +20019,7 @@ var package_default;
20019
20019
  var init_package = __esm(() => {
20020
20020
  package_default = {
20021
20021
  name: "@hasna/skills",
20022
- version: "0.10.0",
20022
+ version: "0.10.1",
20023
20023
  description: "Skills library for AI coding agents",
20024
20024
  type: "module",
20025
20025
  bin: {
@@ -20974,10 +20974,16 @@ var init_transport = __esm(() => {
20974
20974
  ]);
20975
20975
  });
20976
20976
 
20977
+ // src/lib/cli-credential-profile.ts
20978
+ function selectedCliSkillsCredentialProfile() {
20979
+ return cliCredentialProfile;
20980
+ }
20981
+ var cliCredentialProfile;
20982
+
20977
20983
  // src/lib/instance-credentials.ts
20978
20984
  import { closeSync as closeSync3, constants, fstatSync as fstatSync3, lstatSync as lstatSync2, openSync as openSync3, readSync } from "fs";
20979
20985
  function selectedSkillsProfile(env, explicit) {
20980
- const selected = explicit ?? env.HASNA_PROFILE;
20986
+ const selected = explicit ?? selectedCliSkillsCredentialProfile() ?? env.HASNA_PROFILE;
20981
20987
  if (selected === undefined)
20982
20988
  return null;
20983
20989
  const profile = selected.trim();
@@ -21263,11 +21269,13 @@ function snapshotSkillsEnvironment(env) {
21263
21269
  return Object.freeze(snapshot);
21264
21270
  }
21265
21271
  function snapshotSkillsOptions(env, options) {
21272
+ const profile = options.credentials?.profile ?? selectedCliSkillsCredentialProfile();
21273
+ const credentials = profile === undefined ? options.credentials : { ...options.credentials, profile };
21266
21274
  if (env !== process.env)
21267
- return options;
21268
- return { ...options, credentials: { ...options.credentials, keychain: {
21269
- ...options.credentials?.keychain,
21270
- enabled: options.credentials?.keychain?.enabled ?? true
21275
+ return credentials === options.credentials ? options : { ...options, credentials };
21276
+ return { ...options, credentials: { ...credentials, keychain: {
21277
+ ...credentials?.keychain,
21278
+ enabled: credentials?.keychain?.enabled ?? true
21271
21279
  } } };
21272
21280
  }
21273
21281
  function resolveSkillsFleetOrThrow(env, options) {
@@ -21355,8 +21363,9 @@ async function resolveSkillsApiKey(env = process.env, options = {}) {
21355
21363
  }
21356
21364
  async function resolveSkillsConnection(env = process.env, options = {}) {
21357
21365
  const snapshotEnv = snapshotSkillsEnvironment(env);
21358
- const assertFilesUnchanged = selectsSkillsLocalMode(snapshotEnv) ? () => {} : captureSkillsCredentialFiles(skillsProfileCredentialFiles(snapshotEnv, options.credentials?.profile));
21359
- const fleet = resolveSkillsFleet(snapshotEnv, snapshotSkillsOptions(env, options));
21366
+ const resolvedOptions = snapshotSkillsOptions(env, options);
21367
+ const assertFilesUnchanged = selectsSkillsLocalMode(snapshotEnv) ? () => {} : captureSkillsCredentialFiles(skillsProfileCredentialFiles(snapshotEnv, resolvedOptions.credentials?.profile));
21368
+ const fleet = resolveSkillsFleet(snapshotEnv, resolvedOptions);
21360
21369
  if (fleet.mode === "local" && env === process.env)
21361
21370
  noticeLocalSkillsMode();
21362
21371
  if (fleet.mode !== "hosted")
package/bin/migrate.js CHANGED
@@ -7,7 +7,7 @@ import { join as join5 } from "path";
7
7
  // package.json
8
8
  var package_default = {
9
9
  name: "@hasna/skills",
10
- version: "0.10.0",
10
+ version: "0.10.1",
11
11
  description: "Skills library for AI coding agents",
12
12
  type: "module",
13
13
  bin: {
package/bin/server.js CHANGED
@@ -24122,7 +24122,7 @@ var init_dist_es9 = __esm(() => {
24122
24122
  // package.json
24123
24123
  var package_default = {
24124
24124
  name: "@hasna/skills",
24125
- version: "0.10.0",
24125
+ version: "0.10.1",
24126
24126
  description: "Skills library for AI coding agents",
24127
24127
  type: "module",
24128
24128
  bin: {
package/bin/worker.js CHANGED
@@ -24125,7 +24125,7 @@ import { randomUUID as randomUUID6 } from "crypto";
24125
24125
  // package.json
24126
24126
  var package_default = {
24127
24127
  name: "@hasna/skills",
24128
- version: "0.10.0",
24128
+ version: "0.10.1",
24129
24129
  description: "Skills library for AI coding agents",
24130
24130
  type: "module",
24131
24131
  bin: {
@@ -1,3 +1,3 @@
1
- /** Called once by the program's preAction hook, before `--profile` is applied. */
1
+ /** Called once by the program's preAction hook. */
2
2
  export declare function recordEnvironmentProfile(value: string | undefined): void;
3
3
  export declare function getEnvironmentProfile(): string | undefined;
package/dist/index.js CHANGED
@@ -9611,7 +9611,7 @@ import { isAbsolute as isAbsolute11, join as join23, resolve as resolve11 } from
9611
9611
  // package.json
9612
9612
  var package_default = {
9613
9613
  name: "@hasna/skills",
9614
- version: "0.10.0",
9614
+ version: "0.10.1",
9615
9615
  description: "Skills library for AI coding agents",
9616
9616
  type: "module",
9617
9617
  bin: {
@@ -10569,9 +10569,17 @@ var AUTHORITY_OVERRIDE_HEADERS = new Set([
10569
10569
 
10570
10570
  // src/lib/instance-credentials.ts
10571
10571
  import { closeSync as closeSync5, constants as constants2, fstatSync as fstatSync5, lstatSync as lstatSync8, openSync as openSync5, readSync as readSync2 } from "fs";
10572
+
10573
+ // src/lib/cli-credential-profile.ts
10574
+ var cliCredentialProfile;
10575
+ function selectedCliSkillsCredentialProfile() {
10576
+ return cliCredentialProfile;
10577
+ }
10578
+
10579
+ // src/lib/instance-credentials.ts
10572
10580
  var SKILLS_BOUND_API_URL = "HASNA_SKILLS_BOUND_API_URL";
10573
10581
  function selectedSkillsProfile(env, explicit) {
10574
- const selected = explicit ?? env.HASNA_PROFILE;
10582
+ const selected = explicit ?? selectedCliSkillsCredentialProfile() ?? env.HASNA_PROFILE;
10575
10583
  if (selected === undefined)
10576
10584
  return null;
10577
10585
  const profile = selected.trim();
@@ -10819,11 +10827,13 @@ function snapshotSkillsEnvironment(env) {
10819
10827
  return Object.freeze(snapshot);
10820
10828
  }
10821
10829
  function snapshotSkillsOptions(env, options) {
10830
+ const profile = options.credentials?.profile ?? selectedCliSkillsCredentialProfile();
10831
+ const credentials = profile === undefined ? options.credentials : { ...options.credentials, profile };
10822
10832
  if (env !== process.env)
10823
- return options;
10824
- return { ...options, credentials: { ...options.credentials, keychain: {
10825
- ...options.credentials?.keychain,
10826
- enabled: options.credentials?.keychain?.enabled ?? true
10833
+ return credentials === options.credentials ? options : { ...options, credentials };
10834
+ return { ...options, credentials: { ...credentials, keychain: {
10835
+ ...credentials?.keychain,
10836
+ enabled: credentials?.keychain?.enabled ?? true
10827
10837
  } } };
10828
10838
  }
10829
10839
  function resolveSkillsFleetOrThrow(env, options) {
@@ -10911,8 +10921,9 @@ async function resolveSkillsApiKey(env = process.env, options = {}) {
10911
10921
  }
10912
10922
  async function resolveSkillsConnection(env = process.env, options = {}) {
10913
10923
  const snapshotEnv = snapshotSkillsEnvironment(env);
10914
- const assertFilesUnchanged = selectsSkillsLocalMode(snapshotEnv) ? () => {} : captureSkillsCredentialFiles(skillsProfileCredentialFiles(snapshotEnv, options.credentials?.profile));
10915
- const fleet = resolveSkillsFleet(snapshotEnv, snapshotSkillsOptions(env, options));
10924
+ const resolvedOptions = snapshotSkillsOptions(env, options);
10925
+ const assertFilesUnchanged = selectsSkillsLocalMode(snapshotEnv) ? () => {} : captureSkillsCredentialFiles(skillsProfileCredentialFiles(snapshotEnv, resolvedOptions.credentials?.profile));
10926
+ const fleet = resolveSkillsFleet(snapshotEnv, resolvedOptions);
10916
10927
  if (fleet.mode === "local" && env === process.env)
10917
10928
  noticeLocalSkillsMode();
10918
10929
  if (fleet.mode !== "hosted")
@@ -0,0 +1,2 @@
1
+ export declare function selectCliSkillsCredentialProfile(profile: string | undefined): void;
2
+ export declare function selectedCliSkillsCredentialProfile(): string | undefined;
package/dist/sdk/index.js CHANGED
@@ -32373,7 +32373,7 @@ var init_event_sink = __esm(() => {
32373
32373
  // package.json
32374
32374
  var package_default = {
32375
32375
  name: "@hasna/skills",
32376
- version: "0.10.0",
32376
+ version: "0.10.1",
32377
32377
  description: "Skills library for AI coding agents",
32378
32378
  type: "module",
32379
32379
  bin: {
@@ -33390,9 +33390,17 @@ var AUTHORITY_OVERRIDE_HEADERS = new Set([
33390
33390
 
33391
33391
  // src/lib/instance-credentials.ts
33392
33392
  import { closeSync as closeSync3, constants, fstatSync as fstatSync3, lstatSync as lstatSync2, openSync as openSync3, readSync } from "fs";
33393
+
33394
+ // src/lib/cli-credential-profile.ts
33395
+ var cliCredentialProfile;
33396
+ function selectedCliSkillsCredentialProfile() {
33397
+ return cliCredentialProfile;
33398
+ }
33399
+
33400
+ // src/lib/instance-credentials.ts
33393
33401
  var SKILLS_BOUND_API_URL = "HASNA_SKILLS_BOUND_API_URL";
33394
33402
  function selectedSkillsProfile(env, explicit) {
33395
- const selected = explicit ?? env.HASNA_PROFILE;
33403
+ const selected = explicit ?? selectedCliSkillsCredentialProfile() ?? env.HASNA_PROFILE;
33396
33404
  if (selected === undefined)
33397
33405
  return null;
33398
33406
  const profile = selected.trim();
@@ -33640,11 +33648,13 @@ function snapshotSkillsEnvironment(env) {
33640
33648
  return Object.freeze(snapshot);
33641
33649
  }
33642
33650
  function snapshotSkillsOptions(env, options) {
33651
+ const profile = options.credentials?.profile ?? selectedCliSkillsCredentialProfile();
33652
+ const credentials = profile === undefined ? options.credentials : { ...options.credentials, profile };
33643
33653
  if (env !== process.env)
33644
- return options;
33645
- return { ...options, credentials: { ...options.credentials, keychain: {
33646
- ...options.credentials?.keychain,
33647
- enabled: options.credentials?.keychain?.enabled ?? true
33654
+ return credentials === options.credentials ? options : { ...options, credentials };
33655
+ return { ...options, credentials: { ...credentials, keychain: {
33656
+ ...credentials?.keychain,
33657
+ enabled: credentials?.keychain?.enabled ?? true
33648
33658
  } } };
33649
33659
  }
33650
33660
  function resolveSkillsFleetOrThrow(env, options) {
@@ -33732,8 +33742,9 @@ async function resolveSkillsApiKey(env = process.env, options = {}) {
33732
33742
  }
33733
33743
  async function resolveSkillsConnection(env = process.env, options = {}) {
33734
33744
  const snapshotEnv = snapshotSkillsEnvironment(env);
33735
- const assertFilesUnchanged = selectsSkillsLocalMode(snapshotEnv) ? () => {} : captureSkillsCredentialFiles(skillsProfileCredentialFiles(snapshotEnv, options.credentials?.profile));
33736
- const fleet = resolveSkillsFleet(snapshotEnv, snapshotSkillsOptions(env, options));
33745
+ const resolvedOptions = snapshotSkillsOptions(env, options);
33746
+ const assertFilesUnchanged = selectsSkillsLocalMode(snapshotEnv) ? () => {} : captureSkillsCredentialFiles(skillsProfileCredentialFiles(snapshotEnv, resolvedOptions.credentials?.profile));
33747
+ const fleet = resolveSkillsFleet(snapshotEnv, resolvedOptions);
33737
33748
  if (fleet.mode === "local" && env === process.env)
33738
33749
  noticeLocalSkillsMode();
33739
33750
  if (fleet.mode !== "hosted")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/skills",
3
- "version": "0.10.0",
3
+ "version": "0.10.1",
4
4
  "description": "Skills library for AI coding agents",
5
5
  "type": "module",
6
6
  "bin": {