@hasna/skills 0.5.0 → 0.5.2

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/README.md CHANGED
@@ -674,7 +674,7 @@ skills/ # Public skill contracts and local OSS skills
674
674
  |---|---|---|
675
675
  | Catalog skills | 86 | `SKILLS.length` (`src/lib/registry-data/`) |
676
676
  | Categories | 17 | `CATEGORIES` (`src/lib/registry-types.ts`) |
677
- | MCP tools | 61 | `tools/list` against a live `buildServer()` |
677
+ | MCP tools | 62 | `tools/list` against a live `buildServer()` |
678
678
 
679
679
  Every number in this table is re-derived from the source tree on each test run by
680
680
  `src/lib/readme-derived-counts.test.ts`, so a drifted figure fails a test rather
@@ -889,3 +889,74 @@ The client never refreshes, changes the precondition, or retries automatically.
889
889
  Known refusals expose a fixed message and code through `RemoteWorkspaceMemberError`;
890
890
  unsupported routes remain errors. Invitations, workspace switching and leaving
891
891
  your own workspace are separate capabilities.
892
+
893
+ ### Workspace profiles
894
+
895
+ Discover the workspaces available to your account using a fresh verification code:
896
+
897
+ ```sh
898
+ skills workspace list --email you@example.com --code-stdin --json
899
+ ```
900
+
901
+ Pipe the six-digit code to stdin. Interactive terminal requests can omit
902
+ `--code-stdin` to request and enter a masked code. Discovery saves no credential.
903
+ The current marker identifies the workspace initially chosen by sign-in; it does
904
+ not change your account's default workspace.
905
+
906
+ To enroll a workspace, choose its exact membership ID from that list and name
907
+ the destination credential profile explicitly:
908
+
909
+ ```sh
910
+ HASNA_PROFILE=team-b skills auth login --membership-id <membership-id> --email you@example.com --code-stdin --json
911
+ HASNA_PROFILE=team-b skills auth whoami --json
912
+ ```
913
+
914
+ This fresh sign-in creates one ordinary CLI API key in that workspace, verifies
915
+ its identity, and saves it only in the named profile. Existing keys and other
916
+ profiles stay bound to their original workspaces. Viewer memberships cannot
917
+ create keys. Session JWTs are never saved. Remove injected API-key overrides
918
+ before enrolling a profile so that later commands use the saved credential.
919
+ A profile belonging to a different account requires a different profile name
920
+ or an ordinary replacement login. New accounts must finish ordinary account
921
+ login before workspace enrollment; the server's existing signup policy applies.
922
+
923
+ Named-profile account/workspace name updates, roster/member actions, and API-key
924
+ management retain that profile's live workspace identity through fresh OTP
925
+ verification. A revoked key, unavailable membership, or inconsistent profile
926
+ metadata refuses the operation; it does not fall back to the default workspace.
927
+ The CLI cannot change your parent shell: keep `HASNA_PROFILE=team-b` on subsequent
928
+ commands or configure it explicitly in that shell. Existing MCP fresh-auth
929
+ account, member and key tools retain the same named profile authority for each
930
+ invocation. Changing an MCP host’s selected profile
931
+ through a tool remains a separate follow-up.
932
+
933
+ If enrollment reports that key issuance was attempted but not confirmed, inspect
934
+ the selected profile and workspace keys before retrying. A lost response can
935
+ still have created a server key; the CLI does not retry issuance automatically.
936
+
937
+ ### Leave a workspace
938
+
939
+ Use the exact membership ID and observed role from fresh `workspace list` output.
940
+ Leaving requires deliberate confirmation and a fresh verification code:
941
+
942
+ ```sh
943
+ HASNA_PROFILE=team-b skills workspace leave <membership-id> --expected-role member --email you@example.com --code-stdin --confirm --json
944
+ ```
945
+
946
+ The selected profile must authenticate the same membership. Without a named
947
+ profile, supply `--user-id <user-id>` from discovery; this also supports viewers
948
+ who cannot create API keys. The server refuses stale roles, the last active
949
+ owner, and leaving your last available workspace. It decides authority atomically.
950
+
951
+ The SDK offers `RemoteSkillsAuthClient.leaveWorkspace(email, code,
952
+ { userId, membershipId }, { expectedRole, confirm: true })`; an existing interactive
953
+ session can use `RemoteSkillsClient.leaveWorkspace(context, input)`. MCP exposes
954
+ `leave_workspace` with those same explicit IDs, role, confirmation and fresh code.
955
+ All surfaces call the same HTTP method once. API keys cannot authorize the leave.
956
+
957
+ Success returns `{ organizationId, membershipId, removed: true,
958
+ signInRequired: true }`. Sign in again to an available workspace afterwards.
959
+ Saved credentials and unrelated profiles remain unchanged; credentials for the
960
+ left membership no longer grant access. A lost or invalid response raises
961
+ `RemoteWorkspaceLeaveUnconfirmedError`: inspect available memberships before any
962
+ new action. Never automatically retry or substitute another membership ID.