@refhub/cli 1.5.0 → 1.6.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/README.md CHANGED
@@ -77,6 +77,7 @@ refhub vaults get <vaultId>
77
77
  refhub vaults create --name <n> [--description] [--color] [--visibility] [--category]
78
78
  refhub vaults update <vaultId> [--name] [--description] [--color] [--category]
79
79
  refhub vaults delete <vaultId> --confirm
80
+ refhub vaults archive <vaultId> --confirm
80
81
  refhub vaults visibility <vaultId> --visibility <private|protected|public> [--slug]
81
82
 
82
83
  # shares
@@ -222,6 +223,7 @@ rate-limited responses (429) include `retry_after_seconds`.
222
223
  ## // guardrails
223
224
 
224
225
  - `vaults delete` and `items delete` require `--confirm` — hard deletes, no undo
226
+ - `vaults archive` requires `--confirm` — permanent read-only lockdown, no undo, no unarchive command exists
225
227
  - `items upsert` without `--idempotency-key` emits a `partial_write_risk` warning before exiting 1 on failure
226
228
  - `items update --tags` warns that the tags list is a full replacement
227
229
 
package/dist/client.d.ts CHANGED
@@ -32,6 +32,8 @@ export declare class RefHubClient {
32
32
  deleteVault(vaultId: string): Promise<ApiResponse<{
33
33
  id: string;
34
34
  }>>;
35
+ /** Permanently archives the vault. There is no unarchive — this cannot be undone. */
36
+ archiveVault(vaultId: string): Promise<ApiResponse<Vault>>;
35
37
  setVaultVisibility(vaultId: string, body: {
36
38
  visibility: string;
37
39
  public_slug?: string;
package/dist/client.js CHANGED
@@ -13,7 +13,7 @@ export class RefHubError extends Error {
13
13
  }
14
14
  }
15
15
  export class RefHubClient {
16
- baseUrl = 'https://refhub-api.netlify.app/api/v1';
16
+ baseUrl = process.env['REFHUB_API_BASE_URL'] ?? 'https://refhub-api.netlify.app/api/v1';
17
17
  headers;
18
18
  constructor(apiKey) {
19
19
  this.headers = {
@@ -61,6 +61,10 @@ export class RefHubClient {
61
61
  deleteVault(vaultId) {
62
62
  return this.req('DELETE', `/vaults/${vaultId}`);
63
63
  }
64
+ /** Permanently archives the vault. There is no unarchive — this cannot be undone. */
65
+ archiveVault(vaultId) {
66
+ return this.req('POST', `/vaults/${vaultId}/archive`);
67
+ }
64
68
  setVaultVisibility(vaultId, body) {
65
69
  return this.req('PATCH', `/vaults/${vaultId}/visibility`, body);
66
70
  }
@@ -18,6 +18,7 @@ export declare function handleVaultUpdate(client: RefHubClient, vaultId: string,
18
18
  abstract?: string;
19
19
  }, tableMode: boolean): Promise<void>;
20
20
  export declare function handleVaultDelete(client: RefHubClient, vaultId: string, confirmed: boolean): Promise<void>;
21
+ export declare function handleVaultArchive(client: RefHubClient, vaultId: string, confirmed: boolean, tableMode: boolean): Promise<void>;
21
22
  export declare function handleVaultVisibility(client: RefHubClient, vaultId: string, opts: {
22
23
  visibility: string;
23
24
  slug?: string;
@@ -2,7 +2,7 @@ import { resolveClient, run } from '../client.js';
2
2
  import { format } from '../format.js';
3
3
  export async function handleVaultsList(client, tableMode) {
4
4
  const result = await client.listVaults();
5
- format(result, tableMode, ['id', 'name', 'visibility', 'item_count', 'updated_at']);
5
+ format(result, tableMode, ['id', 'name', 'visibility', 'archived_at', 'item_count', 'updated_at']);
6
6
  }
7
7
  export async function handleVaultGet(client, vaultId, tableMode) {
8
8
  const result = await client.getVault(vaultId);
@@ -46,6 +46,14 @@ export async function handleVaultDelete(client, vaultId, confirmed) {
46
46
  const result = await client.deleteVault(vaultId);
47
47
  format(result, false);
48
48
  }
49
+ export async function handleVaultArchive(client, vaultId, confirmed, tableMode) {
50
+ if (!confirmed) {
51
+ process.stderr.write(JSON.stringify({ error: { code: 'confirm_required', message: 'Pass --confirm to acknowledge this is permanent: archiving makes the vault read-only forever (items/tags/relations/shares) and cannot be undone (no unarchive).' } }) + '\n');
52
+ process.exit(2);
53
+ }
54
+ const result = await client.archiveVault(vaultId);
55
+ format(result, tableMode);
56
+ }
49
57
  export async function handleVaultVisibility(client, vaultId, opts, tableMode) {
50
58
  const body = { visibility: opts.visibility };
51
59
  if (opts.slug)
@@ -126,6 +134,16 @@ export function registerVaults(program) {
126
134
  const client = resolveClient(g.apiKey);
127
135
  await run(() => handleVaultDelete(client, vaultId, opts.confirm ?? false));
128
136
  });
137
+ vaults
138
+ .command('archive')
139
+ .argument('<vaultId>')
140
+ .description('Permanently archive a vault (read-only forever, no unarchive)')
141
+ .option('--confirm', 'required: acknowledge this cannot be undone')
142
+ .action(async (vaultId, opts, cmd) => {
143
+ const g = cmd.optsWithGlobals();
144
+ const client = resolveClient(g.apiKey);
145
+ await run(() => handleVaultArchive(client, vaultId, opts.confirm ?? false, g.table ?? false));
146
+ });
129
147
  vaults
130
148
  .command('visibility')
131
149
  .argument('<vaultId>')
package/dist/types.d.ts CHANGED
@@ -11,6 +11,8 @@ export interface Vault {
11
11
  item_count: number;
12
12
  created_at: string;
13
13
  updated_at: string;
14
+ /** Set once, permanently, when the vault is archived. No unarchive path exists. */
15
+ archived_at: string | null;
14
16
  }
15
17
  export interface Item {
16
18
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@refhub/cli",
3
- "version": "1.5.0",
3
+ "version": "1.6.0",
4
4
  "description": "refhub CLI execution layer for agent skills",
5
5
  "type": "module",
6
6
  "repository": {