@hasna/contacts 0.6.9 → 0.6.11

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.
@@ -1 +1 @@
1
- {"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/advanced.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBzC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAg5B/D"}
1
+ {"version":3,"file":"advanced.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/advanced.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkBzC,wBAAgB,wBAAwB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAm6B/D"}
package/dist/cli/index.js CHANGED
@@ -12188,6 +12188,9 @@ function getDatabase(path) {
12188
12188
  const db = new SqliteAdapter(dbPath, { create: true });
12189
12189
  db.exec("PRAGMA journal_mode=WAL");
12190
12190
  db.exec("PRAGMA foreign_keys=ON");
12191
+ if (typeof db["query"] !== "function") {
12192
+ db["query"] = (sql) => db.prepare(sql);
12193
+ }
12191
12194
  runMigrations(db);
12192
12195
  _db = db;
12193
12196
  return db;
@@ -19142,6 +19145,16 @@ Vault Status:`));
19142
19145
  }
19143
19146
  console.log();
19144
19147
  });
19148
+ function handleVaultError(err) {
19149
+ const msg = err instanceof Error ? err.message : String(err);
19150
+ if (msg.includes("Vault is locked") || msg.includes("not initialized")) {
19151
+ console.error(chalk4.red(`
19152
+ Vault is locked. Run: contacts vault unlock --passphrase <pass>
19153
+ `));
19154
+ process.exit(1);
19155
+ }
19156
+ throw err;
19157
+ }
19145
19158
  const docsCmd = program2.command("docs").description("Manage encrypted contact documents");
19146
19159
  docsCmd.command("add <contact-id>").description("Add an encrypted document").option("--type <type>", "Document type (passport, national_id, tax_id, ssn, drivers_license, bank_account, visa, insurance, contract, certificate, medical_record, prescription, allergy_list, vaccination, blood_type, health_insurance, medical_condition, emergency_contact_medical, other)", "other").option("--label <label>", "Document label").option("--value <value>", "Document value (required)").option("--file <path>", "File to encrypt and attach").option("--expires <date>", "Expiry date (YYYY-MM-DD)").action(async (contactId, opts) => {
19147
19160
  const { addDocument: addDocument2 } = await Promise.resolve().then(() => (init_documents(), exports_documents));
@@ -19149,14 +19162,19 @@ Vault Status:`));
19149
19162
  console.error(chalk4.red("--value is required"));
19150
19163
  process.exit(1);
19151
19164
  }
19152
- const doc = addDocument2({
19153
- contact_id: contactId,
19154
- doc_type: opts.type || "other",
19155
- label: opts.label,
19156
- value: opts.value,
19157
- file_path: opts.file,
19158
- expires_at: opts.expires
19159
- });
19165
+ let doc;
19166
+ try {
19167
+ doc = addDocument2({
19168
+ contact_id: contactId,
19169
+ doc_type: opts.type || "other",
19170
+ label: opts.label,
19171
+ value: opts.value,
19172
+ file_path: opts.file,
19173
+ expires_at: opts.expires
19174
+ });
19175
+ } catch (err) {
19176
+ handleVaultError(err);
19177
+ }
19160
19178
  console.log(chalk4.green(`
19161
19179
  Document added: ${doc.doc_type} (${doc.id})
19162
19180
  `));
@@ -19231,7 +19249,12 @@ Document Types:
19231
19249
  healthCmd.command("show <id>").description("Show health data for a contact").action(async (id) => {
19232
19250
  const { getHealthData: getHealthData2 } = await Promise.resolve().then(() => (init_health(), exports_health));
19233
19251
  const contact = getContact(id);
19234
- const health = getHealthData2(id);
19252
+ let health;
19253
+ try {
19254
+ health = getHealthData2(id);
19255
+ } catch (err) {
19256
+ handleVaultError(err);
19257
+ }
19235
19258
  if (!health) {
19236
19259
  console.log(chalk4.gray(`
19237
19260
  No health data for ${contact.display_name}.
@@ -19290,7 +19313,11 @@ Health: ${contact.display_name}
19290
19313
  input.organ_donor = opts.organDonor;
19291
19314
  if (opts.notes)
19292
19315
  input.notes = opts.notes;
19293
- setHealthData2(id, input);
19316
+ try {
19317
+ setHealthData2(id, input);
19318
+ } catch (err) {
19319
+ handleVaultError(err);
19320
+ }
19294
19321
  console.log(chalk4.green(`
19295
19322
  Health data updated for ${contact.display_name}
19296
19323
  `));
@@ -19298,7 +19325,11 @@ Health data updated for ${contact.display_name}
19298
19325
  healthCmd.command("clear <id>").description("Delete all health data for a contact").action(async (id) => {
19299
19326
  const { deleteHealthData: deleteHealthData2 } = await Promise.resolve().then(() => (init_health(), exports_health));
19300
19327
  const contact = getContact(id);
19301
- deleteHealthData2(id);
19328
+ try {
19329
+ deleteHealthData2(id);
19330
+ } catch (err) {
19331
+ handleVaultError(err);
19332
+ }
19302
19333
  console.log(chalk4.green(`
19303
19334
  Health data cleared for ${contact.display_name}
19304
19335
  `));
@@ -19306,7 +19337,10 @@ Health data cleared for ${contact.display_name}
19306
19337
  }
19307
19338
 
19308
19339
  // src/cli/index.tsx
19309
- program.name("contacts").description("Open Contacts \u2014 contact management for AI coding agents").version("0.6.8");
19340
+ import { createRequire as createRequire2 } from "module";
19341
+ var _require = createRequire2(import.meta.url);
19342
+ var pkg = _require("../../package.json");
19343
+ program.name("contacts").description("Open Contacts \u2014 contact management for AI coding agents").version(pkg.version);
19310
19344
  registerCoreCommands(program);
19311
19345
  registerCrmCommands(program);
19312
19346
  registerAdvancedCommands(program);
@@ -1 +1 @@
1
- {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AAIzD,wBAAgB,UAAU,IAAI,MAAM,CAkBnC;AAED,wBAAgB,SAAS,IAAI,MAAM,CAIlC;AA8hBD,wBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAUnD;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED,wBAAgB,GAAG,IAAI,MAAM,CAE5B"}
1
+ {"version":3,"file":"database.d.ts","sourceRoot":"","sources":["../../src/db/database.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,IAAI,QAAQ,EAAE,MAAM,cAAc,CAAC;AAIzD,wBAAgB,UAAU,IAAI,MAAM,CAkBnC;AAED,wBAAgB,SAAS,IAAI,MAAM,CAIlC;AA8hBD,wBAAgB,WAAW,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,QAAQ,CAenD;AAED,wBAAgB,aAAa,IAAI,IAAI,CAEpC;AAED,wBAAgB,IAAI,IAAI,MAAM,CAE7B;AAED,wBAAgB,GAAG,IAAI,MAAM,CAE5B"}
package/dist/index.js CHANGED
@@ -9440,6 +9440,9 @@ function getDatabase(path) {
9440
9440
  const db = new SqliteAdapter(dbPath, { create: true });
9441
9441
  db.exec("PRAGMA journal_mode=WAL");
9442
9442
  db.exec("PRAGMA foreign_keys=ON");
9443
+ if (typeof db["query"] !== "function") {
9444
+ db["query"] = (sql) => db.prepare(sql);
9445
+ }
9443
9446
  runMigrations(db);
9444
9447
  _db = db;
9445
9448
  return db;
package/dist/mcp/index.js CHANGED
@@ -10094,6 +10094,9 @@ function getDatabase(path) {
10094
10094
  const db = new SqliteAdapter(dbPath, { create: true });
10095
10095
  db.exec("PRAGMA journal_mode=WAL");
10096
10096
  db.exec("PRAGMA foreign_keys=ON");
10097
+ if (typeof db["query"] !== "function") {
10098
+ db["query"] = (sql) => db.prepare(sql);
10099
+ }
10097
10100
  runMigrations(db);
10098
10101
  _db = db;
10099
10102
  return db;
@@ -10094,6 +10094,9 @@ function getDatabase(path) {
10094
10094
  const db = new SqliteAdapter(dbPath, { create: true });
10095
10095
  db.exec("PRAGMA journal_mode=WAL");
10096
10096
  db.exec("PRAGMA foreign_keys=ON");
10097
+ if (typeof db["query"] !== "function") {
10098
+ db["query"] = (sql) => db.prepare(sql);
10099
+ }
10097
10100
  runMigrations(db);
10098
10101
  _db = db;
10099
10102
  return db;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hasna/contacts",
3
- "version": "0.6.9",
3
+ "version": "0.6.11",
4
4
  "description": "Contact management for AI coding agents — CLI + MCP + Web",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",