@hasna/contacts 0.6.10 → 0.6.12

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,CAg7B/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;
@@ -19051,6 +19054,19 @@ Deal Team: ${dealId}
19051
19054
  console.log(chalk4.yellow(`No logo set for ${company.name}`));
19052
19055
  }
19053
19056
  });
19057
+ logoCmd.command("remove <company-id>").description("Remove a company's logo").action((companyId) => {
19058
+ const { deleteImage: deleteImage2 } = (init_images(), __toCommonJS(exports_images));
19059
+ const { updateCompany: updateCompany2 } = (init_companies(), __toCommonJS(exports_companies));
19060
+ const company = getCompany(companyId);
19061
+ if (!company) {
19062
+ console.error(chalk4.red("Company not found"));
19063
+ return;
19064
+ }
19065
+ const deleted = deleteImage2(companyId);
19066
+ if (deleted)
19067
+ updateCompany2(companyId, { logo_url: null });
19068
+ console.log(deleted ? chalk4.green(`Logo removed for ${company.name}`) : chalk4.yellow(`No logo set for ${company.name}`));
19069
+ });
19054
19070
  program2.command("set-sensitivity <id> <level>").description("Set contact sensitivity level (normal, confidential, restricted)").action((id, level) => {
19055
19071
  if (!["normal", "confidential", "restricted"].includes(level)) {
19056
19072
  console.error(chalk4.red(`
@@ -19142,6 +19158,16 @@ Vault Status:`));
19142
19158
  }
19143
19159
  console.log();
19144
19160
  });
19161
+ function handleVaultError(err) {
19162
+ const msg = err instanceof Error ? err.message : String(err);
19163
+ if (msg.includes("Vault is locked") || msg.includes("not initialized")) {
19164
+ console.error(chalk4.red(`
19165
+ Vault is locked. Run: contacts vault unlock --passphrase <pass>
19166
+ `));
19167
+ process.exit(1);
19168
+ }
19169
+ throw err;
19170
+ }
19145
19171
  const docsCmd = program2.command("docs").description("Manage encrypted contact documents");
19146
19172
  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
19173
  const { addDocument: addDocument2 } = await Promise.resolve().then(() => (init_documents(), exports_documents));
@@ -19149,14 +19175,19 @@ Vault Status:`));
19149
19175
  console.error(chalk4.red("--value is required"));
19150
19176
  process.exit(1);
19151
19177
  }
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
- });
19178
+ let doc;
19179
+ try {
19180
+ doc = addDocument2({
19181
+ contact_id: contactId,
19182
+ doc_type: opts.type || "other",
19183
+ label: opts.label,
19184
+ value: opts.value,
19185
+ file_path: opts.file,
19186
+ expires_at: opts.expires
19187
+ });
19188
+ } catch (err) {
19189
+ handleVaultError(err);
19190
+ }
19160
19191
  console.log(chalk4.green(`
19161
19192
  Document added: ${doc.doc_type} (${doc.id})
19162
19193
  `));
@@ -19231,7 +19262,12 @@ Document Types:
19231
19262
  healthCmd.command("show <id>").description("Show health data for a contact").action(async (id) => {
19232
19263
  const { getHealthData: getHealthData2 } = await Promise.resolve().then(() => (init_health(), exports_health));
19233
19264
  const contact = getContact(id);
19234
- const health = getHealthData2(id);
19265
+ let health;
19266
+ try {
19267
+ health = getHealthData2(id);
19268
+ } catch (err) {
19269
+ handleVaultError(err);
19270
+ }
19235
19271
  if (!health) {
19236
19272
  console.log(chalk4.gray(`
19237
19273
  No health data for ${contact.display_name}.
@@ -19290,7 +19326,11 @@ Health: ${contact.display_name}
19290
19326
  input.organ_donor = opts.organDonor;
19291
19327
  if (opts.notes)
19292
19328
  input.notes = opts.notes;
19293
- setHealthData2(id, input);
19329
+ try {
19330
+ setHealthData2(id, input);
19331
+ } catch (err) {
19332
+ handleVaultError(err);
19333
+ }
19294
19334
  console.log(chalk4.green(`
19295
19335
  Health data updated for ${contact.display_name}
19296
19336
  `));
@@ -19298,7 +19338,11 @@ Health data updated for ${contact.display_name}
19298
19338
  healthCmd.command("clear <id>").description("Delete all health data for a contact").action(async (id) => {
19299
19339
  const { deleteHealthData: deleteHealthData2 } = await Promise.resolve().then(() => (init_health(), exports_health));
19300
19340
  const contact = getContact(id);
19301
- deleteHealthData2(id);
19341
+ try {
19342
+ deleteHealthData2(id);
19343
+ } catch (err) {
19344
+ handleVaultError(err);
19345
+ }
19302
19346
  console.log(chalk4.green(`
19303
19347
  Health data cleared for ${contact.display_name}
19304
19348
  `));
@@ -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.10",
3
+ "version": "0.6.12",
4
4
  "description": "Contact management for AI coding agents — CLI + MCP + Web",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",