@hasna/microservices 0.0.16 → 0.0.17
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 +143 -23
- package/bin/index.js +711 -13998
- package/bin/mcp.js +228 -10987
- package/dist/index.js +166 -10056
- package/package.json +25 -25
- package/microservices/microservice-ads/package.json +0 -28
- package/microservices/microservice-ads/src/cli/index.ts +0 -605
- package/microservices/microservice-ads/src/db/campaigns.ts +0 -797
- package/microservices/microservice-ads/src/db/database.ts +0 -91
- package/microservices/microservice-ads/src/db/migrations.ts +0 -60
- package/microservices/microservice-ads/src/index.ts +0 -39
- package/microservices/microservice-ads/src/mcp/index.ts +0 -480
- package/microservices/microservice-analytics/package.json +0 -28
- package/microservices/microservice-analytics/src/cli/index.ts +0 -373
- package/microservices/microservice-analytics/src/db/analytics.ts +0 -564
- package/microservices/microservice-analytics/src/db/database.ts +0 -91
- package/microservices/microservice-analytics/src/db/migrations.ts +0 -50
- package/microservices/microservice-analytics/src/index.ts +0 -37
- package/microservices/microservice-analytics/src/mcp/index.ts +0 -334
- package/microservices/microservice-assets/package.json +0 -28
- package/microservices/microservice-assets/src/cli/index.ts +0 -375
- package/microservices/microservice-assets/src/db/assets.ts +0 -370
- package/microservices/microservice-assets/src/db/database.ts +0 -91
- package/microservices/microservice-assets/src/db/migrations.ts +0 -51
- package/microservices/microservice-assets/src/index.ts +0 -32
- package/microservices/microservice-assets/src/mcp/index.ts +0 -346
- package/microservices/microservice-bookkeeping/package.json +0 -28
- package/microservices/microservice-bookkeeping/src/cli/index.ts +0 -386
- package/microservices/microservice-bookkeeping/src/db/bookkeeping.ts +0 -591
- package/microservices/microservice-bookkeeping/src/db/database.ts +0 -91
- package/microservices/microservice-bookkeeping/src/db/migrations.ts +0 -52
- package/microservices/microservice-bookkeeping/src/index.ts +0 -32
- package/microservices/microservice-bookkeeping/src/mcp/index.ts +0 -284
- package/microservices/microservice-calendar/package.json +0 -28
- package/microservices/microservice-calendar/src/cli/index.ts +0 -287
- package/microservices/microservice-calendar/src/db/calendar.ts +0 -328
- package/microservices/microservice-calendar/src/db/database.ts +0 -91
- package/microservices/microservice-calendar/src/db/migrations.ts +0 -47
- package/microservices/microservice-calendar/src/index.ts +0 -24
- package/microservices/microservice-calendar/src/mcp/index.ts +0 -226
- package/microservices/microservice-company/package.json +0 -28
- package/microservices/microservice-company/src/cli/index.ts +0 -1126
- package/microservices/microservice-company/src/db/company.ts +0 -854
- package/microservices/microservice-company/src/db/database.ts +0 -91
- package/microservices/microservice-company/src/db/migrations.ts +0 -214
- package/microservices/microservice-company/src/db/workflow-migrations.ts +0 -44
- package/microservices/microservice-company/src/index.ts +0 -60
- package/microservices/microservice-company/src/lib/audit.ts +0 -168
- package/microservices/microservice-company/src/lib/finance.ts +0 -299
- package/microservices/microservice-company/src/lib/settings.ts +0 -85
- package/microservices/microservice-company/src/lib/workflows.ts +0 -698
- package/microservices/microservice-company/src/mcp/index.ts +0 -991
- package/microservices/microservice-compliance/package.json +0 -28
- package/microservices/microservice-compliance/src/cli/index.ts +0 -467
- package/microservices/microservice-compliance/src/db/compliance.ts +0 -633
- package/microservices/microservice-compliance/src/db/database.ts +0 -91
- package/microservices/microservice-compliance/src/db/migrations.ts +0 -63
- package/microservices/microservice-compliance/src/index.ts +0 -46
- package/microservices/microservice-compliance/src/mcp/index.ts +0 -438
- package/microservices/microservice-contacts/package.json +0 -28
- package/microservices/microservice-contacts/src/cli/index.ts +0 -393
- package/microservices/microservice-contacts/src/db/companies.ts +0 -167
- package/microservices/microservice-contacts/src/db/contacts.ts +0 -249
- package/microservices/microservice-contacts/src/db/database.ts +0 -91
- package/microservices/microservice-contacts/src/db/migrations.ts +0 -71
- package/microservices/microservice-contacts/src/db/relationships.ts +0 -53
- package/microservices/microservice-contacts/src/index.ts +0 -42
- package/microservices/microservice-contacts/src/mcp/index.ts +0 -303
- package/microservices/microservice-contracts/package.json +0 -28
- package/microservices/microservice-contracts/src/cli/index.ts +0 -770
- package/microservices/microservice-contracts/src/db/contracts.ts +0 -925
- package/microservices/microservice-contracts/src/db/database.ts +0 -91
- package/microservices/microservice-contracts/src/db/migrations.ts +0 -141
- package/microservices/microservice-contracts/src/index.ts +0 -43
- package/microservices/microservice-contracts/src/mcp/index.ts +0 -617
- package/microservices/microservice-crm/package.json +0 -28
- package/microservices/microservice-crm/src/cli/index.ts +0 -396
- package/microservices/microservice-crm/src/db/database.ts +0 -91
- package/microservices/microservice-crm/src/db/migrations.ts +0 -66
- package/microservices/microservice-crm/src/db/pipeline.ts +0 -397
- package/microservices/microservice-crm/src/index.ts +0 -34
- package/microservices/microservice-crm/src/mcp/index.ts +0 -294
- package/microservices/microservice-documents/package.json +0 -28
- package/microservices/microservice-documents/src/cli/index.ts +0 -246
- package/microservices/microservice-documents/src/db/database.ts +0 -91
- package/microservices/microservice-documents/src/db/documents.ts +0 -316
- package/microservices/microservice-documents/src/db/migrations.ts +0 -49
- package/microservices/microservice-documents/src/index.ts +0 -24
- package/microservices/microservice-documents/src/mcp/index.ts +0 -202
- package/microservices/microservice-domains/package.json +0 -28
- package/microservices/microservice-domains/src/cli/index.ts +0 -1111
- package/microservices/microservice-domains/src/db/database.ts +0 -91
- package/microservices/microservice-domains/src/db/domains.ts +0 -1164
- package/microservices/microservice-domains/src/db/migrations.ts +0 -60
- package/microservices/microservice-domains/src/index.ts +0 -65
- package/microservices/microservice-domains/src/lib/brandsight.ts +0 -350
- package/microservices/microservice-domains/src/lib/godaddy.ts +0 -338
- package/microservices/microservice-domains/src/lib/namecheap.ts +0 -262
- package/microservices/microservice-domains/src/lib/registrar.ts +0 -355
- package/microservices/microservice-domains/src/mcp/index.ts +0 -781
- package/microservices/microservice-expenses/package.json +0 -28
- package/microservices/microservice-expenses/src/cli/index.ts +0 -267
- package/microservices/microservice-expenses/src/db/database.ts +0 -91
- package/microservices/microservice-expenses/src/db/expenses.ts +0 -345
- package/microservices/microservice-expenses/src/db/migrations.ts +0 -45
- package/microservices/microservice-expenses/src/index.ts +0 -25
- package/microservices/microservice-expenses/src/mcp/index.ts +0 -196
- package/microservices/microservice-habits/package.json +0 -28
- package/microservices/microservice-habits/src/cli/index.ts +0 -315
- package/microservices/microservice-habits/src/db/database.ts +0 -91
- package/microservices/microservice-habits/src/db/habits.ts +0 -451
- package/microservices/microservice-habits/src/db/migrations.ts +0 -46
- package/microservices/microservice-habits/src/index.ts +0 -31
- package/microservices/microservice-habits/src/mcp/index.ts +0 -313
- package/microservices/microservice-health/package.json +0 -28
- package/microservices/microservice-health/src/cli/index.ts +0 -484
- package/microservices/microservice-health/src/db/database.ts +0 -91
- package/microservices/microservice-health/src/db/health.ts +0 -708
- package/microservices/microservice-health/src/db/migrations.ts +0 -70
- package/microservices/microservice-health/src/index.ts +0 -63
- package/microservices/microservice-health/src/mcp/index.ts +0 -437
- package/microservices/microservice-hiring/package.json +0 -28
- package/microservices/microservice-hiring/src/cli/index.ts +0 -741
- package/microservices/microservice-hiring/src/db/database.ts +0 -91
- package/microservices/microservice-hiring/src/db/hiring.ts +0 -1085
- package/microservices/microservice-hiring/src/db/migrations.ts +0 -89
- package/microservices/microservice-hiring/src/index.ts +0 -80
- package/microservices/microservice-hiring/src/lib/scoring.ts +0 -206
- package/microservices/microservice-hiring/src/mcp/index.ts +0 -709
- package/microservices/microservice-inventory/package.json +0 -28
- package/microservices/microservice-inventory/src/cli/index.ts +0 -365
- package/microservices/microservice-inventory/src/db/database.ts +0 -91
- package/microservices/microservice-inventory/src/db/inventory.ts +0 -393
- package/microservices/microservice-inventory/src/db/migrations.ts +0 -54
- package/microservices/microservice-inventory/src/index.ts +0 -28
- package/microservices/microservice-inventory/src/mcp/index.ts +0 -250
- package/microservices/microservice-invoices/dashboard/index.html +0 -12
- package/microservices/microservice-invoices/dashboard/package.json +0 -29
- package/microservices/microservice-invoices/dashboard/tsconfig.json +0 -14
- package/microservices/microservice-invoices/dashboard/vite.config.ts +0 -15
- package/microservices/microservice-invoices/package.json +0 -31
- package/microservices/microservice-invoices/src/cli/index.ts +0 -308
- package/microservices/microservice-invoices/src/db/business.ts +0 -241
- package/microservices/microservice-invoices/src/db/clients.ts +0 -127
- package/microservices/microservice-invoices/src/db/database.ts +0 -91
- package/microservices/microservice-invoices/src/db/invoices.ts +0 -345
- package/microservices/microservice-invoices/src/db/migrations.ts +0 -184
- package/microservices/microservice-invoices/src/index.ts +0 -56
- package/microservices/microservice-invoices/src/mcp/index.ts +0 -242
- package/microservices/microservice-invoices/src/server/index.ts +0 -162
- package/microservices/microservice-leads/package.json +0 -28
- package/microservices/microservice-leads/src/cli/index.ts +0 -596
- package/microservices/microservice-leads/src/db/database.ts +0 -91
- package/microservices/microservice-leads/src/db/leads.ts +0 -520
- package/microservices/microservice-leads/src/db/lists.ts +0 -151
- package/microservices/microservice-leads/src/db/migrations.ts +0 -93
- package/microservices/microservice-leads/src/index.ts +0 -65
- package/microservices/microservice-leads/src/lib/enrichment.ts +0 -202
- package/microservices/microservice-leads/src/lib/scoring.ts +0 -134
- package/microservices/microservice-leads/src/mcp/index.ts +0 -533
- package/microservices/microservice-notes/package.json +0 -28
- package/microservices/microservice-notes/src/cli/index.ts +0 -63
- package/microservices/microservice-notes/src/db/database.ts +0 -91
- package/microservices/microservice-notes/src/db/migrations.ts +0 -40
- package/microservices/microservice-notes/src/db/notes.ts +0 -114
- package/microservices/microservice-notes/src/index.ts +0 -2
- package/microservices/microservice-notes/src/mcp/index.ts +0 -37
- package/microservices/microservice-notifications/package.json +0 -28
- package/microservices/microservice-notifications/src/cli/index.ts +0 -349
- package/microservices/microservice-notifications/src/db/database.ts +0 -91
- package/microservices/microservice-notifications/src/db/migrations.ts +0 -62
- package/microservices/microservice-notifications/src/db/notifications.ts +0 -509
- package/microservices/microservice-notifications/src/index.ts +0 -41
- package/microservices/microservice-notifications/src/mcp/index.ts +0 -422
- package/microservices/microservice-payments/package.json +0 -28
- package/microservices/microservice-payments/src/cli/index.ts +0 -609
- package/microservices/microservice-payments/src/db/database.ts +0 -91
- package/microservices/microservice-payments/src/db/migrations.ts +0 -81
- package/microservices/microservice-payments/src/db/payments.ts +0 -1204
- package/microservices/microservice-payments/src/index.ts +0 -51
- package/microservices/microservice-payments/src/mcp/index.ts +0 -683
- package/microservices/microservice-payroll/package.json +0 -28
- package/microservices/microservice-payroll/src/cli/index.ts +0 -643
- package/microservices/microservice-payroll/src/db/database.ts +0 -91
- package/microservices/microservice-payroll/src/db/migrations.ts +0 -95
- package/microservices/microservice-payroll/src/db/payroll.ts +0 -1377
- package/microservices/microservice-payroll/src/index.ts +0 -48
- package/microservices/microservice-payroll/src/mcp/index.ts +0 -666
- package/microservices/microservice-products/package.json +0 -28
- package/microservices/microservice-products/src/cli/index.ts +0 -416
- package/microservices/microservice-products/src/db/categories.ts +0 -154
- package/microservices/microservice-products/src/db/database.ts +0 -91
- package/microservices/microservice-products/src/db/migrations.ts +0 -58
- package/microservices/microservice-products/src/db/pricing-tiers.ts +0 -66
- package/microservices/microservice-products/src/db/products.ts +0 -452
- package/microservices/microservice-products/src/index.ts +0 -53
- package/microservices/microservice-products/src/mcp/index.ts +0 -453
- package/microservices/microservice-projects/package.json +0 -28
- package/microservices/microservice-projects/src/cli/index.ts +0 -480
- package/microservices/microservice-projects/src/db/database.ts +0 -91
- package/microservices/microservice-projects/src/db/migrations.ts +0 -65
- package/microservices/microservice-projects/src/db/projects.ts +0 -715
- package/microservices/microservice-projects/src/index.ts +0 -57
- package/microservices/microservice-projects/src/mcp/index.ts +0 -501
- package/microservices/microservice-proposals/package.json +0 -28
- package/microservices/microservice-proposals/src/cli/index.ts +0 -400
- package/microservices/microservice-proposals/src/db/database.ts +0 -91
- package/microservices/microservice-proposals/src/db/migrations.ts +0 -52
- package/microservices/microservice-proposals/src/db/proposals.ts +0 -532
- package/microservices/microservice-proposals/src/index.ts +0 -37
- package/microservices/microservice-proposals/src/mcp/index.ts +0 -375
- package/microservices/microservice-reading/package.json +0 -28
- package/microservices/microservice-reading/src/cli/index.ts +0 -464
- package/microservices/microservice-reading/src/db/database.ts +0 -91
- package/microservices/microservice-reading/src/db/migrations.ts +0 -59
- package/microservices/microservice-reading/src/db/reading.ts +0 -524
- package/microservices/microservice-reading/src/index.ts +0 -51
- package/microservices/microservice-reading/src/mcp/index.ts +0 -368
- package/microservices/microservice-shipping/package.json +0 -28
- package/microservices/microservice-shipping/src/cli/index.ts +0 -606
- package/microservices/microservice-shipping/src/db/database.ts +0 -91
- package/microservices/microservice-shipping/src/db/migrations.ts +0 -69
- package/microservices/microservice-shipping/src/db/shipping.ts +0 -1093
- package/microservices/microservice-shipping/src/index.ts +0 -53
- package/microservices/microservice-shipping/src/mcp/index.ts +0 -533
- package/microservices/microservice-social/package.json +0 -29
- package/microservices/microservice-social/src/cli/index.ts +0 -1583
- package/microservices/microservice-social/src/db/database.ts +0 -91
- package/microservices/microservice-social/src/db/migrations.ts +0 -160
- package/microservices/microservice-social/src/db/social.ts +0 -1076
- package/microservices/microservice-social/src/index.ts +0 -46
- package/microservices/microservice-social/src/lib/audience.ts +0 -353
- package/microservices/microservice-social/src/lib/content-ai.ts +0 -278
- package/microservices/microservice-social/src/lib/media.ts +0 -311
- package/microservices/microservice-social/src/lib/mentions.ts +0 -434
- package/microservices/microservice-social/src/lib/metrics-sync.ts +0 -264
- package/microservices/microservice-social/src/lib/publisher.ts +0 -377
- package/microservices/microservice-social/src/lib/scheduler.ts +0 -229
- package/microservices/microservice-social/src/lib/sentiment.ts +0 -256
- package/microservices/microservice-social/src/lib/threads.ts +0 -291
- package/microservices/microservice-social/src/mcp/index.ts +0 -1425
- package/microservices/microservice-social/src/server/index.ts +0 -441
- package/microservices/microservice-subscriptions/package.json +0 -28
- package/microservices/microservice-subscriptions/src/cli/index.ts +0 -715
- package/microservices/microservice-subscriptions/src/db/database.ts +0 -91
- package/microservices/microservice-subscriptions/src/db/migrations.ts +0 -125
- package/microservices/microservice-subscriptions/src/db/subscriptions.ts +0 -1256
- package/microservices/microservice-subscriptions/src/index.ts +0 -41
- package/microservices/microservice-subscriptions/src/mcp/index.ts +0 -631
- package/microservices/microservice-timesheets/package.json +0 -28
- package/microservices/microservice-timesheets/src/cli/index.ts +0 -373
- package/microservices/microservice-timesheets/src/db/database.ts +0 -91
- package/microservices/microservice-timesheets/src/db/locale.ts +0 -217
- package/microservices/microservice-timesheets/src/db/migrations.ts +0 -74
- package/microservices/microservice-timesheets/src/db/timesheets.ts +0 -447
- package/microservices/microservice-timesheets/src/index.ts +0 -44
- package/microservices/microservice-timesheets/src/mcp/index.ts +0 -269
- package/microservices/microservice-transcriber/package.json +0 -29
- package/microservices/microservice-transcriber/src/cli/index.ts +0 -1593
- package/microservices/microservice-transcriber/src/db/annotations.ts +0 -37
- package/microservices/microservice-transcriber/src/db/comments.ts +0 -166
- package/microservices/microservice-transcriber/src/db/database.ts +0 -91
- package/microservices/microservice-transcriber/src/db/migrations.ts +0 -118
- package/microservices/microservice-transcriber/src/db/proofread.ts +0 -119
- package/microservices/microservice-transcriber/src/db/transcripts.ts +0 -395
- package/microservices/microservice-transcriber/src/index.ts +0 -43
- package/microservices/microservice-transcriber/src/lib/config.ts +0 -77
- package/microservices/microservice-transcriber/src/lib/diff.ts +0 -91
- package/microservices/microservice-transcriber/src/lib/downloader.ts +0 -638
- package/microservices/microservice-transcriber/src/lib/feeds.ts +0 -62
- package/microservices/microservice-transcriber/src/lib/live.ts +0 -94
- package/microservices/microservice-transcriber/src/lib/notion.ts +0 -129
- package/microservices/microservice-transcriber/src/lib/proofread.ts +0 -296
- package/microservices/microservice-transcriber/src/lib/providers.ts +0 -713
- package/microservices/microservice-transcriber/src/lib/summarizer.ts +0 -147
- package/microservices/microservice-transcriber/src/lib/translator.ts +0 -75
- package/microservices/microservice-transcriber/src/lib/webhook.ts +0 -37
- package/microservices/microservice-transcriber/src/mcp/index.ts +0 -1330
- package/microservices/microservice-transcriber/src/server/index.ts +0 -199
- package/microservices/microservice-travel/package.json +0 -28
- package/microservices/microservice-travel/src/cli/index.ts +0 -505
- package/microservices/microservice-travel/src/db/database.ts +0 -91
- package/microservices/microservice-travel/src/db/migrations.ts +0 -77
- package/microservices/microservice-travel/src/db/travel.ts +0 -802
- package/microservices/microservice-travel/src/index.ts +0 -60
- package/microservices/microservice-travel/src/mcp/index.ts +0 -495
- package/microservices/microservice-wiki/package.json +0 -28
- package/microservices/microservice-wiki/src/cli/index.ts +0 -345
- package/microservices/microservice-wiki/src/db/database.ts +0 -91
- package/microservices/microservice-wiki/src/db/migrations.ts +0 -55
- package/microservices/microservice-wiki/src/db/wiki.ts +0 -395
- package/microservices/microservice-wiki/src/index.ts +0 -32
- package/microservices/microservice-wiki/src/mcp/index.ts +0 -344
|
@@ -1,741 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bun
|
|
2
|
-
|
|
3
|
-
import { Command } from "commander";
|
|
4
|
-
import { readFileSync } from "node:fs";
|
|
5
|
-
import {
|
|
6
|
-
createJob,
|
|
7
|
-
getJob,
|
|
8
|
-
listJobs,
|
|
9
|
-
closeJob,
|
|
10
|
-
createApplicant,
|
|
11
|
-
getApplicant,
|
|
12
|
-
listApplicants,
|
|
13
|
-
advanceApplicant,
|
|
14
|
-
rejectApplicant,
|
|
15
|
-
searchApplicants,
|
|
16
|
-
getPipeline,
|
|
17
|
-
getHiringStats,
|
|
18
|
-
createInterview,
|
|
19
|
-
listInterviews,
|
|
20
|
-
addInterviewFeedback,
|
|
21
|
-
bulkImportApplicants,
|
|
22
|
-
generateOffer,
|
|
23
|
-
getHiringForecast,
|
|
24
|
-
submitStructuredFeedback,
|
|
25
|
-
bulkReject,
|
|
26
|
-
getReferralStats,
|
|
27
|
-
saveJobAsTemplate,
|
|
28
|
-
createJobFromTemplate,
|
|
29
|
-
listJobTemplates,
|
|
30
|
-
} from "../db/hiring.js";
|
|
31
|
-
import { scoreApplicant, rankApplicants } from "../lib/scoring.js";
|
|
32
|
-
|
|
33
|
-
const program = new Command();
|
|
34
|
-
|
|
35
|
-
program
|
|
36
|
-
.name("microservice-hiring")
|
|
37
|
-
.description("Applicant tracking and recruitment microservice")
|
|
38
|
-
.version("0.0.1");
|
|
39
|
-
|
|
40
|
-
// --- Jobs ---
|
|
41
|
-
|
|
42
|
-
const jobCmd = program
|
|
43
|
-
.command("job")
|
|
44
|
-
.description("Job management");
|
|
45
|
-
|
|
46
|
-
jobCmd
|
|
47
|
-
.command("create")
|
|
48
|
-
.description("Create a new job posting")
|
|
49
|
-
.requiredOption("--title <title>", "Job title")
|
|
50
|
-
.option("--department <dept>", "Department")
|
|
51
|
-
.option("--location <loc>", "Location")
|
|
52
|
-
.option("--type <type>", "Job type (full-time/part-time/contract)", "full-time")
|
|
53
|
-
.option("--description <desc>", "Job description")
|
|
54
|
-
.option("--requirements <reqs>", "Comma-separated requirements")
|
|
55
|
-
.option("--salary-range <range>", "Salary range")
|
|
56
|
-
.option("--json", "Output as JSON", false)
|
|
57
|
-
.action((opts) => {
|
|
58
|
-
const job = createJob({
|
|
59
|
-
title: opts.title,
|
|
60
|
-
department: opts.department,
|
|
61
|
-
location: opts.location,
|
|
62
|
-
type: opts.type,
|
|
63
|
-
description: opts.description,
|
|
64
|
-
requirements: opts.requirements
|
|
65
|
-
? opts.requirements.split(",").map((r: string) => r.trim())
|
|
66
|
-
: undefined,
|
|
67
|
-
salary_range: opts.salaryRange,
|
|
68
|
-
});
|
|
69
|
-
|
|
70
|
-
if (opts.json) {
|
|
71
|
-
console.log(JSON.stringify(job, null, 2));
|
|
72
|
-
} else {
|
|
73
|
-
console.log(`Created job: ${job.title} (${job.id})`);
|
|
74
|
-
}
|
|
75
|
-
});
|
|
76
|
-
|
|
77
|
-
jobCmd
|
|
78
|
-
.command("list")
|
|
79
|
-
.description("List jobs")
|
|
80
|
-
.option("--status <status>", "Filter by status (open/closed/paused)")
|
|
81
|
-
.option("--department <dept>", "Filter by department")
|
|
82
|
-
.option("--type <type>", "Filter by type")
|
|
83
|
-
.option("--limit <n>", "Limit results")
|
|
84
|
-
.option("--json", "Output as JSON", false)
|
|
85
|
-
.action((opts) => {
|
|
86
|
-
const jobs = listJobs({
|
|
87
|
-
status: opts.status,
|
|
88
|
-
department: opts.department,
|
|
89
|
-
type: opts.type,
|
|
90
|
-
limit: opts.limit ? parseInt(opts.limit) : undefined,
|
|
91
|
-
});
|
|
92
|
-
|
|
93
|
-
if (opts.json) {
|
|
94
|
-
console.log(JSON.stringify(jobs, null, 2));
|
|
95
|
-
} else {
|
|
96
|
-
if (jobs.length === 0) {
|
|
97
|
-
console.log("No jobs found.");
|
|
98
|
-
return;
|
|
99
|
-
}
|
|
100
|
-
for (const j of jobs) {
|
|
101
|
-
const dept = j.department ? ` [${j.department}]` : "";
|
|
102
|
-
console.log(` ${j.title}${dept} — ${j.status} (${j.id})`);
|
|
103
|
-
}
|
|
104
|
-
console.log(`\n${jobs.length} job(s)`);
|
|
105
|
-
}
|
|
106
|
-
});
|
|
107
|
-
|
|
108
|
-
jobCmd
|
|
109
|
-
.command("get")
|
|
110
|
-
.description("Get a job by ID")
|
|
111
|
-
.argument("<id>", "Job ID")
|
|
112
|
-
.option("--json", "Output as JSON", false)
|
|
113
|
-
.action((id, opts) => {
|
|
114
|
-
const job = getJob(id);
|
|
115
|
-
if (!job) {
|
|
116
|
-
console.error(`Job '${id}' not found.`);
|
|
117
|
-
process.exit(1);
|
|
118
|
-
}
|
|
119
|
-
|
|
120
|
-
if (opts.json) {
|
|
121
|
-
console.log(JSON.stringify(job, null, 2));
|
|
122
|
-
} else {
|
|
123
|
-
console.log(`${job.title}`);
|
|
124
|
-
console.log(` Status: ${job.status}`);
|
|
125
|
-
console.log(` Type: ${job.type}`);
|
|
126
|
-
if (job.department) console.log(` Department: ${job.department}`);
|
|
127
|
-
if (job.location) console.log(` Location: ${job.location}`);
|
|
128
|
-
if (job.salary_range) console.log(` Salary: ${job.salary_range}`);
|
|
129
|
-
if (job.description) console.log(` Description: ${job.description}`);
|
|
130
|
-
if (job.requirements.length) console.log(` Requirements: ${job.requirements.join(", ")}`);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
jobCmd
|
|
135
|
-
.command("close")
|
|
136
|
-
.description("Close a job posting")
|
|
137
|
-
.argument("<id>", "Job ID")
|
|
138
|
-
.option("--json", "Output as JSON", false)
|
|
139
|
-
.action((id, opts) => {
|
|
140
|
-
const job = closeJob(id);
|
|
141
|
-
if (!job) {
|
|
142
|
-
console.error(`Job '${id}' not found.`);
|
|
143
|
-
process.exit(1);
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
if (opts.json) {
|
|
147
|
-
console.log(JSON.stringify(job, null, 2));
|
|
148
|
-
} else {
|
|
149
|
-
console.log(`Closed job: ${job.title}`);
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
|
|
153
|
-
// --- Applicants ---
|
|
154
|
-
|
|
155
|
-
const applicantCmd = program
|
|
156
|
-
.command("applicant")
|
|
157
|
-
.description("Applicant management");
|
|
158
|
-
|
|
159
|
-
applicantCmd
|
|
160
|
-
.command("add")
|
|
161
|
-
.description("Add a new applicant")
|
|
162
|
-
.requiredOption("--name <name>", "Applicant name")
|
|
163
|
-
.requiredOption("--job <id>", "Job ID")
|
|
164
|
-
.option("--email <email>", "Email address")
|
|
165
|
-
.option("--phone <phone>", "Phone number")
|
|
166
|
-
.option("--resume <url>", "Resume URL")
|
|
167
|
-
.option("--source <source>", "Source (linkedin, referral, etc.)")
|
|
168
|
-
.option("--notes <notes>", "Notes")
|
|
169
|
-
.option("--json", "Output as JSON", false)
|
|
170
|
-
.action((opts) => {
|
|
171
|
-
const applicant = createApplicant({
|
|
172
|
-
name: opts.name,
|
|
173
|
-
job_id: opts.job,
|
|
174
|
-
email: opts.email,
|
|
175
|
-
phone: opts.phone,
|
|
176
|
-
resume_url: opts.resume,
|
|
177
|
-
source: opts.source,
|
|
178
|
-
notes: opts.notes,
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
if (opts.json) {
|
|
182
|
-
console.log(JSON.stringify(applicant, null, 2));
|
|
183
|
-
} else {
|
|
184
|
-
console.log(`Added applicant: ${applicant.name} (${applicant.id})`);
|
|
185
|
-
}
|
|
186
|
-
});
|
|
187
|
-
|
|
188
|
-
applicantCmd
|
|
189
|
-
.command("list")
|
|
190
|
-
.description("List applicants")
|
|
191
|
-
.option("--job <id>", "Filter by job ID")
|
|
192
|
-
.option("--status <status>", "Filter by status")
|
|
193
|
-
.option("--source <source>", "Filter by source")
|
|
194
|
-
.option("--limit <n>", "Limit results")
|
|
195
|
-
.option("--json", "Output as JSON", false)
|
|
196
|
-
.action((opts) => {
|
|
197
|
-
const applicants = listApplicants({
|
|
198
|
-
job_id: opts.job,
|
|
199
|
-
status: opts.status,
|
|
200
|
-
source: opts.source,
|
|
201
|
-
limit: opts.limit ? parseInt(opts.limit) : undefined,
|
|
202
|
-
});
|
|
203
|
-
|
|
204
|
-
if (opts.json) {
|
|
205
|
-
console.log(JSON.stringify(applicants, null, 2));
|
|
206
|
-
} else {
|
|
207
|
-
if (applicants.length === 0) {
|
|
208
|
-
console.log("No applicants found.");
|
|
209
|
-
return;
|
|
210
|
-
}
|
|
211
|
-
for (const a of applicants) {
|
|
212
|
-
const email = a.email ? ` <${a.email}>` : "";
|
|
213
|
-
console.log(` ${a.name}${email} — ${a.status} (${a.id})`);
|
|
214
|
-
}
|
|
215
|
-
console.log(`\n${applicants.length} applicant(s)`);
|
|
216
|
-
}
|
|
217
|
-
});
|
|
218
|
-
|
|
219
|
-
applicantCmd
|
|
220
|
-
.command("get")
|
|
221
|
-
.description("Get an applicant by ID")
|
|
222
|
-
.argument("<id>", "Applicant ID")
|
|
223
|
-
.option("--json", "Output as JSON", false)
|
|
224
|
-
.action((id, opts) => {
|
|
225
|
-
const applicant = getApplicant(id);
|
|
226
|
-
if (!applicant) {
|
|
227
|
-
console.error(`Applicant '${id}' not found.`);
|
|
228
|
-
process.exit(1);
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
if (opts.json) {
|
|
232
|
-
console.log(JSON.stringify(applicant, null, 2));
|
|
233
|
-
} else {
|
|
234
|
-
console.log(`${applicant.name}`);
|
|
235
|
-
console.log(` Status: ${applicant.status}`);
|
|
236
|
-
if (applicant.email) console.log(` Email: ${applicant.email}`);
|
|
237
|
-
if (applicant.phone) console.log(` Phone: ${applicant.phone}`);
|
|
238
|
-
if (applicant.source) console.log(` Source: ${applicant.source}`);
|
|
239
|
-
if (applicant.rating) console.log(` Rating: ${applicant.rating}`);
|
|
240
|
-
if (applicant.notes) console.log(` Notes: ${applicant.notes}`);
|
|
241
|
-
}
|
|
242
|
-
});
|
|
243
|
-
|
|
244
|
-
applicantCmd
|
|
245
|
-
.command("advance")
|
|
246
|
-
.description("Advance an applicant to a new status")
|
|
247
|
-
.argument("<id>", "Applicant ID")
|
|
248
|
-
.requiredOption("--status <status>", "New status (screening/interviewing/offered/hired)")
|
|
249
|
-
.option("--json", "Output as JSON", false)
|
|
250
|
-
.action((id, opts) => {
|
|
251
|
-
const applicant = advanceApplicant(id, opts.status);
|
|
252
|
-
if (!applicant) {
|
|
253
|
-
console.error(`Applicant '${id}' not found.`);
|
|
254
|
-
process.exit(1);
|
|
255
|
-
}
|
|
256
|
-
|
|
257
|
-
if (opts.json) {
|
|
258
|
-
console.log(JSON.stringify(applicant, null, 2));
|
|
259
|
-
} else {
|
|
260
|
-
console.log(`Advanced ${applicant.name} to ${applicant.status}`);
|
|
261
|
-
}
|
|
262
|
-
});
|
|
263
|
-
|
|
264
|
-
applicantCmd
|
|
265
|
-
.command("reject")
|
|
266
|
-
.description("Reject an applicant")
|
|
267
|
-
.argument("<id>", "Applicant ID")
|
|
268
|
-
.option("--reason <reason>", "Rejection reason")
|
|
269
|
-
.option("--json", "Output as JSON", false)
|
|
270
|
-
.action((id, opts) => {
|
|
271
|
-
const applicant = rejectApplicant(id, opts.reason);
|
|
272
|
-
if (!applicant) {
|
|
273
|
-
console.error(`Applicant '${id}' not found.`);
|
|
274
|
-
process.exit(1);
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
if (opts.json) {
|
|
278
|
-
console.log(JSON.stringify(applicant, null, 2));
|
|
279
|
-
} else {
|
|
280
|
-
console.log(`Rejected ${applicant.name}`);
|
|
281
|
-
}
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
applicantCmd
|
|
285
|
-
.command("search")
|
|
286
|
-
.description("Search applicants")
|
|
287
|
-
.argument("<query>", "Search term")
|
|
288
|
-
.option("--json", "Output as JSON", false)
|
|
289
|
-
.action((query, opts) => {
|
|
290
|
-
const results = searchApplicants(query);
|
|
291
|
-
|
|
292
|
-
if (opts.json) {
|
|
293
|
-
console.log(JSON.stringify(results, null, 2));
|
|
294
|
-
} else {
|
|
295
|
-
if (results.length === 0) {
|
|
296
|
-
console.log(`No applicants matching "${query}".`);
|
|
297
|
-
return;
|
|
298
|
-
}
|
|
299
|
-
for (const a of results) {
|
|
300
|
-
console.log(` ${a.name} ${a.email ? `<${a.email}>` : ""} — ${a.status}`);
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
});
|
|
304
|
-
|
|
305
|
-
// --- Bulk Import ---
|
|
306
|
-
|
|
307
|
-
applicantCmd
|
|
308
|
-
.command("bulk-import")
|
|
309
|
-
.description("Bulk import applicants from a CSV file")
|
|
310
|
-
.requiredOption("--file <path>", "Path to CSV file (name,email,phone,job_id,source,resume_url)")
|
|
311
|
-
.option("--json", "Output as JSON", false)
|
|
312
|
-
.action((opts) => {
|
|
313
|
-
const csvData = readFileSync(opts.file, "utf-8");
|
|
314
|
-
const result = bulkImportApplicants(csvData);
|
|
315
|
-
|
|
316
|
-
if (opts.json) {
|
|
317
|
-
console.log(JSON.stringify(result, null, 2));
|
|
318
|
-
} else {
|
|
319
|
-
console.log(`Imported: ${result.imported}`);
|
|
320
|
-
console.log(`Skipped: ${result.skipped}`);
|
|
321
|
-
if (result.errors.length > 0) {
|
|
322
|
-
console.log("Errors:");
|
|
323
|
-
for (const e of result.errors) {
|
|
324
|
-
console.log(` - ${e}`);
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
|
|
330
|
-
// --- AI Scoring ---
|
|
331
|
-
|
|
332
|
-
applicantCmd
|
|
333
|
-
.command("score")
|
|
334
|
-
.description("AI-score an applicant against job requirements")
|
|
335
|
-
.argument("<id>", "Applicant ID")
|
|
336
|
-
.option("--json", "Output as JSON", false)
|
|
337
|
-
.action(async (id, opts) => {
|
|
338
|
-
try {
|
|
339
|
-
const score = await scoreApplicant(id);
|
|
340
|
-
|
|
341
|
-
if (opts.json) {
|
|
342
|
-
console.log(JSON.stringify(score, null, 2));
|
|
343
|
-
} else {
|
|
344
|
-
console.log(`Match: ${score.match_pct}%`);
|
|
345
|
-
console.log(`Recommendation: ${score.recommendation}`);
|
|
346
|
-
if (score.strengths.length) console.log(`Strengths: ${score.strengths.join(", ")}`);
|
|
347
|
-
if (score.gaps.length) console.log(`Gaps: ${score.gaps.join(", ")}`);
|
|
348
|
-
}
|
|
349
|
-
} catch (err) {
|
|
350
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
351
|
-
process.exit(1);
|
|
352
|
-
}
|
|
353
|
-
});
|
|
354
|
-
|
|
355
|
-
// --- AI Bulk Ranking ---
|
|
356
|
-
|
|
357
|
-
applicantCmd
|
|
358
|
-
.command("rank")
|
|
359
|
-
.description("AI-rank all applicants for a job by fit score")
|
|
360
|
-
.requiredOption("--job <id>", "Job ID")
|
|
361
|
-
.option("--json", "Output as JSON", false)
|
|
362
|
-
.action(async (opts) => {
|
|
363
|
-
try {
|
|
364
|
-
const ranked = await rankApplicants(opts.job);
|
|
365
|
-
|
|
366
|
-
if (opts.json) {
|
|
367
|
-
console.log(JSON.stringify(ranked, null, 2));
|
|
368
|
-
} else {
|
|
369
|
-
if (ranked.length === 0) {
|
|
370
|
-
console.log("No applicants to rank.");
|
|
371
|
-
return;
|
|
372
|
-
}
|
|
373
|
-
console.log("Ranking:");
|
|
374
|
-
for (let i = 0; i < ranked.length; i++) {
|
|
375
|
-
const { applicant, score } = ranked[i];
|
|
376
|
-
console.log(` ${i + 1}. ${applicant.name} — ${score.match_pct}% (${score.recommendation})`);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
} catch (err) {
|
|
380
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
381
|
-
process.exit(1);
|
|
382
|
-
}
|
|
383
|
-
});
|
|
384
|
-
|
|
385
|
-
// --- Offer Letter ---
|
|
386
|
-
|
|
387
|
-
applicantCmd
|
|
388
|
-
.command("offer")
|
|
389
|
-
.description("Generate a Markdown offer letter")
|
|
390
|
-
.argument("<id>", "Applicant ID")
|
|
391
|
-
.requiredOption("--salary <amount>", "Annual salary")
|
|
392
|
-
.requiredOption("--start-date <date>", "Start date (YYYY-MM-DD)")
|
|
393
|
-
.option("--title <title>", "Position title override")
|
|
394
|
-
.option("--department <dept>", "Department override")
|
|
395
|
-
.option("--benefits <text>", "Benefits description")
|
|
396
|
-
.option("--equity <text>", "Equity details")
|
|
397
|
-
.option("--signing-bonus <amount>", "Signing bonus")
|
|
398
|
-
.option("--json", "Output as JSON", false)
|
|
399
|
-
.action((id, opts) => {
|
|
400
|
-
try {
|
|
401
|
-
const letter = generateOffer(id, {
|
|
402
|
-
salary: parseInt(opts.salary),
|
|
403
|
-
start_date: opts.startDate,
|
|
404
|
-
position_title: opts.title,
|
|
405
|
-
department: opts.department,
|
|
406
|
-
benefits: opts.benefits,
|
|
407
|
-
equity: opts.equity,
|
|
408
|
-
signing_bonus: opts.signingBonus ? parseInt(opts.signingBonus) : undefined,
|
|
409
|
-
});
|
|
410
|
-
|
|
411
|
-
if (opts.json) {
|
|
412
|
-
console.log(JSON.stringify({ offer_letter: letter }, null, 2));
|
|
413
|
-
} else {
|
|
414
|
-
console.log(letter);
|
|
415
|
-
}
|
|
416
|
-
} catch (err) {
|
|
417
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
418
|
-
process.exit(1);
|
|
419
|
-
}
|
|
420
|
-
});
|
|
421
|
-
|
|
422
|
-
// --- Bulk Rejection ---
|
|
423
|
-
|
|
424
|
-
applicantCmd
|
|
425
|
-
.command("reject-batch")
|
|
426
|
-
.description("Bulk reject applicants for a job by status")
|
|
427
|
-
.requiredOption("--job <id>", "Job ID")
|
|
428
|
-
.requiredOption("--status <status>", "Status to reject (applied/screening/etc.)")
|
|
429
|
-
.option("--reason <reason>", "Rejection reason")
|
|
430
|
-
.option("--json", "Output as JSON", false)
|
|
431
|
-
.action((opts) => {
|
|
432
|
-
const result = bulkReject(opts.job, opts.status, opts.reason);
|
|
433
|
-
|
|
434
|
-
if (opts.json) {
|
|
435
|
-
console.log(JSON.stringify(result, null, 2));
|
|
436
|
-
} else {
|
|
437
|
-
console.log(`Rejected ${result.rejected} applicant(s)`);
|
|
438
|
-
}
|
|
439
|
-
});
|
|
440
|
-
|
|
441
|
-
// --- Interviews ---
|
|
442
|
-
|
|
443
|
-
const interviewCmd = program
|
|
444
|
-
.command("interview")
|
|
445
|
-
.description("Interview management");
|
|
446
|
-
|
|
447
|
-
interviewCmd
|
|
448
|
-
.command("schedule")
|
|
449
|
-
.description("Schedule an interview")
|
|
450
|
-
.requiredOption("--applicant <id>", "Applicant ID")
|
|
451
|
-
.option("--interviewer <name>", "Interviewer name")
|
|
452
|
-
.option("--at <datetime>", "Scheduled datetime (ISO 8601)")
|
|
453
|
-
.option("--duration <min>", "Duration in minutes")
|
|
454
|
-
.option("--type <type>", "Interview type (phone/video/onsite)", "phone")
|
|
455
|
-
.option("--json", "Output as JSON", false)
|
|
456
|
-
.action((opts) => {
|
|
457
|
-
const interview = createInterview({
|
|
458
|
-
applicant_id: opts.applicant,
|
|
459
|
-
interviewer: opts.interviewer,
|
|
460
|
-
scheduled_at: opts.at,
|
|
461
|
-
duration_min: opts.duration ? parseInt(opts.duration) : undefined,
|
|
462
|
-
type: opts.type,
|
|
463
|
-
});
|
|
464
|
-
|
|
465
|
-
if (opts.json) {
|
|
466
|
-
console.log(JSON.stringify(interview, null, 2));
|
|
467
|
-
} else {
|
|
468
|
-
console.log(`Scheduled interview (${interview.id})`);
|
|
469
|
-
}
|
|
470
|
-
});
|
|
471
|
-
|
|
472
|
-
interviewCmd
|
|
473
|
-
.command("list")
|
|
474
|
-
.description("List interviews")
|
|
475
|
-
.option("--applicant <id>", "Filter by applicant ID")
|
|
476
|
-
.option("--status <status>", "Filter by status")
|
|
477
|
-
.option("--type <type>", "Filter by type")
|
|
478
|
-
.option("--limit <n>", "Limit results")
|
|
479
|
-
.option("--json", "Output as JSON", false)
|
|
480
|
-
.action((opts) => {
|
|
481
|
-
const interviews = listInterviews({
|
|
482
|
-
applicant_id: opts.applicant,
|
|
483
|
-
status: opts.status,
|
|
484
|
-
type: opts.type,
|
|
485
|
-
limit: opts.limit ? parseInt(opts.limit) : undefined,
|
|
486
|
-
});
|
|
487
|
-
|
|
488
|
-
if (opts.json) {
|
|
489
|
-
console.log(JSON.stringify(interviews, null, 2));
|
|
490
|
-
} else {
|
|
491
|
-
if (interviews.length === 0) {
|
|
492
|
-
console.log("No interviews found.");
|
|
493
|
-
return;
|
|
494
|
-
}
|
|
495
|
-
for (const i of interviews) {
|
|
496
|
-
const when = i.scheduled_at || "TBD";
|
|
497
|
-
const who = i.interviewer || "TBD";
|
|
498
|
-
console.log(` ${i.type} with ${who} @ ${when} — ${i.status} (${i.id})`);
|
|
499
|
-
}
|
|
500
|
-
console.log(`\n${interviews.length} interview(s)`);
|
|
501
|
-
}
|
|
502
|
-
});
|
|
503
|
-
|
|
504
|
-
interviewCmd
|
|
505
|
-
.command("feedback")
|
|
506
|
-
.description("Add feedback to an interview (supports structured scoring dimensions)")
|
|
507
|
-
.argument("<id>", "Interview ID")
|
|
508
|
-
.option("--feedback <text>", "Feedback text")
|
|
509
|
-
.option("--rating <n>", "Overall rating (1-5)")
|
|
510
|
-
.option("--technical <n>", "Technical score (1-5)")
|
|
511
|
-
.option("--communication <n>", "Communication score (1-5)")
|
|
512
|
-
.option("--culture-fit <n>", "Culture fit score (1-5)")
|
|
513
|
-
.option("--problem-solving <n>", "Problem solving score (1-5)")
|
|
514
|
-
.option("--leadership <n>", "Leadership score (1-5)")
|
|
515
|
-
.option("--json", "Output as JSON", false)
|
|
516
|
-
.action((id, opts) => {
|
|
517
|
-
const hasStructured = opts.technical || opts.communication || opts.cultureFit ||
|
|
518
|
-
opts.problemSolving || opts.leadership;
|
|
519
|
-
|
|
520
|
-
let interview;
|
|
521
|
-
if (hasStructured) {
|
|
522
|
-
interview = submitStructuredFeedback(
|
|
523
|
-
id,
|
|
524
|
-
{
|
|
525
|
-
technical: opts.technical ? parseInt(opts.technical) : undefined,
|
|
526
|
-
communication: opts.communication ? parseInt(opts.communication) : undefined,
|
|
527
|
-
culture_fit: opts.cultureFit ? parseInt(opts.cultureFit) : undefined,
|
|
528
|
-
problem_solving: opts.problemSolving ? parseInt(opts.problemSolving) : undefined,
|
|
529
|
-
leadership: opts.leadership ? parseInt(opts.leadership) : undefined,
|
|
530
|
-
overall: opts.rating ? parseInt(opts.rating) : undefined,
|
|
531
|
-
},
|
|
532
|
-
opts.feedback
|
|
533
|
-
);
|
|
534
|
-
} else {
|
|
535
|
-
if (!opts.feedback) {
|
|
536
|
-
console.error("Either --feedback or structured scores (--technical, --communication, etc.) are required.");
|
|
537
|
-
process.exit(1);
|
|
538
|
-
}
|
|
539
|
-
interview = addInterviewFeedback(
|
|
540
|
-
id,
|
|
541
|
-
opts.feedback,
|
|
542
|
-
opts.rating ? parseInt(opts.rating) : undefined
|
|
543
|
-
);
|
|
544
|
-
}
|
|
545
|
-
|
|
546
|
-
if (!interview) {
|
|
547
|
-
console.error(`Interview '${id}' not found.`);
|
|
548
|
-
process.exit(1);
|
|
549
|
-
}
|
|
550
|
-
|
|
551
|
-
if (opts.json) {
|
|
552
|
-
console.log(JSON.stringify(interview, null, 2));
|
|
553
|
-
} else {
|
|
554
|
-
console.log(`Added feedback to interview ${id}`);
|
|
555
|
-
}
|
|
556
|
-
});
|
|
557
|
-
|
|
558
|
-
// --- Pipeline & Stats ---
|
|
559
|
-
|
|
560
|
-
program
|
|
561
|
-
.command("pipeline")
|
|
562
|
-
.description("Show hiring pipeline for a job")
|
|
563
|
-
.argument("<job-id>", "Job ID")
|
|
564
|
-
.option("--json", "Output as JSON", false)
|
|
565
|
-
.action((jobId, opts) => {
|
|
566
|
-
const pipeline = getPipeline(jobId);
|
|
567
|
-
|
|
568
|
-
if (opts.json) {
|
|
569
|
-
console.log(JSON.stringify(pipeline, null, 2));
|
|
570
|
-
} else {
|
|
571
|
-
if (pipeline.length === 0) {
|
|
572
|
-
console.log("No applicants in pipeline.");
|
|
573
|
-
return;
|
|
574
|
-
}
|
|
575
|
-
console.log("Pipeline:");
|
|
576
|
-
for (const p of pipeline) {
|
|
577
|
-
const bar = "#".repeat(p.count);
|
|
578
|
-
console.log(` ${p.status.padEnd(14)} ${bar} (${p.count})`);
|
|
579
|
-
}
|
|
580
|
-
}
|
|
581
|
-
});
|
|
582
|
-
|
|
583
|
-
program
|
|
584
|
-
.command("stats")
|
|
585
|
-
.description("Show hiring statistics")
|
|
586
|
-
.option("--json", "Output as JSON", false)
|
|
587
|
-
.action((opts) => {
|
|
588
|
-
const stats = getHiringStats();
|
|
589
|
-
|
|
590
|
-
if (opts.json) {
|
|
591
|
-
console.log(JSON.stringify(stats, null, 2));
|
|
592
|
-
} else {
|
|
593
|
-
console.log("Hiring Stats:");
|
|
594
|
-
console.log(` Jobs: ${stats.total_jobs} total, ${stats.open_jobs} open`);
|
|
595
|
-
console.log(` Applicants: ${stats.total_applicants}`);
|
|
596
|
-
console.log(` Interviews: ${stats.total_interviews}`);
|
|
597
|
-
if (stats.avg_rating) console.log(` Avg Rating: ${stats.avg_rating}`);
|
|
598
|
-
if (stats.applicants_by_status.length) {
|
|
599
|
-
console.log(" By Status:");
|
|
600
|
-
for (const s of stats.applicants_by_status) {
|
|
601
|
-
console.log(` ${s.status}: ${s.count}`);
|
|
602
|
-
}
|
|
603
|
-
}
|
|
604
|
-
}
|
|
605
|
-
});
|
|
606
|
-
|
|
607
|
-
// --- Referral Stats ---
|
|
608
|
-
|
|
609
|
-
const statsCmd = program
|
|
610
|
-
.command("stats-referrals")
|
|
611
|
-
.description("Show referral/source conversion rates")
|
|
612
|
-
.option("--json", "Output as JSON", false)
|
|
613
|
-
.action((opts) => {
|
|
614
|
-
const stats = getReferralStats();
|
|
615
|
-
|
|
616
|
-
if (opts.json) {
|
|
617
|
-
console.log(JSON.stringify(stats, null, 2));
|
|
618
|
-
} else {
|
|
619
|
-
if (stats.length === 0) {
|
|
620
|
-
console.log("No applicant source data.");
|
|
621
|
-
return;
|
|
622
|
-
}
|
|
623
|
-
console.log("Referral Stats:");
|
|
624
|
-
for (const s of stats) {
|
|
625
|
-
console.log(` ${s.source}: ${s.total} total, ${s.hired} hired, ${s.conversion_rate}% conversion`);
|
|
626
|
-
}
|
|
627
|
-
}
|
|
628
|
-
});
|
|
629
|
-
|
|
630
|
-
// --- Forecast ---
|
|
631
|
-
|
|
632
|
-
program
|
|
633
|
-
.command("forecast")
|
|
634
|
-
.description("Estimate days-to-fill based on pipeline velocity")
|
|
635
|
-
.argument("<job-id>", "Job ID")
|
|
636
|
-
.option("--json", "Output as JSON", false)
|
|
637
|
-
.action((jobId, opts) => {
|
|
638
|
-
try {
|
|
639
|
-
const forecast = getHiringForecast(jobId);
|
|
640
|
-
|
|
641
|
-
if (opts.json) {
|
|
642
|
-
console.log(JSON.stringify(forecast, null, 2));
|
|
643
|
-
} else {
|
|
644
|
-
console.log(`Forecast for: ${forecast.job_title}`);
|
|
645
|
-
console.log(` Total applicants: ${forecast.total_applicants}`);
|
|
646
|
-
console.log(` Estimated days to fill: ${forecast.estimated_days_to_fill ?? "N/A"}`);
|
|
647
|
-
|
|
648
|
-
if (Object.keys(forecast.avg_days_per_stage).length) {
|
|
649
|
-
console.log(" Avg days per transition:");
|
|
650
|
-
for (const [stage, days] of Object.entries(forecast.avg_days_per_stage)) {
|
|
651
|
-
console.log(` ${stage}: ${days} days`);
|
|
652
|
-
}
|
|
653
|
-
}
|
|
654
|
-
|
|
655
|
-
if (Object.keys(forecast.conversion_rates).length) {
|
|
656
|
-
console.log(" Conversion rates:");
|
|
657
|
-
for (const [stage, rate] of Object.entries(forecast.conversion_rates)) {
|
|
658
|
-
console.log(` ${stage}: ${rate}%`);
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
} catch (err) {
|
|
663
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
664
|
-
process.exit(1);
|
|
665
|
-
}
|
|
666
|
-
});
|
|
667
|
-
|
|
668
|
-
// --- Job Templates ---
|
|
669
|
-
|
|
670
|
-
jobCmd
|
|
671
|
-
.command("save-template")
|
|
672
|
-
.description("Save a job as a reusable template")
|
|
673
|
-
.argument("<id>", "Job ID")
|
|
674
|
-
.requiredOption("--name <name>", "Template name")
|
|
675
|
-
.option("--json", "Output as JSON", false)
|
|
676
|
-
.action((id, opts) => {
|
|
677
|
-
try {
|
|
678
|
-
const template = saveJobAsTemplate(id, opts.name);
|
|
679
|
-
|
|
680
|
-
if (opts.json) {
|
|
681
|
-
console.log(JSON.stringify(template, null, 2));
|
|
682
|
-
} else {
|
|
683
|
-
console.log(`Saved template: ${template.name} (${template.id})`);
|
|
684
|
-
}
|
|
685
|
-
} catch (err) {
|
|
686
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
687
|
-
process.exit(1);
|
|
688
|
-
}
|
|
689
|
-
});
|
|
690
|
-
|
|
691
|
-
jobCmd
|
|
692
|
-
.command("from-template")
|
|
693
|
-
.description("Create a job from a template")
|
|
694
|
-
.requiredOption("--template <name>", "Template name")
|
|
695
|
-
.option("--title <title>", "Override title")
|
|
696
|
-
.option("--department <dept>", "Override department")
|
|
697
|
-
.option("--location <loc>", "Override location")
|
|
698
|
-
.option("--salary-range <range>", "Override salary range")
|
|
699
|
-
.option("--json", "Output as JSON", false)
|
|
700
|
-
.action((opts) => {
|
|
701
|
-
try {
|
|
702
|
-
const job = createJobFromTemplate(opts.template, {
|
|
703
|
-
title: opts.title,
|
|
704
|
-
department: opts.department,
|
|
705
|
-
location: opts.location,
|
|
706
|
-
salary_range: opts.salaryRange,
|
|
707
|
-
});
|
|
708
|
-
|
|
709
|
-
if (opts.json) {
|
|
710
|
-
console.log(JSON.stringify(job, null, 2));
|
|
711
|
-
} else {
|
|
712
|
-
console.log(`Created job from template: ${job.title} (${job.id})`);
|
|
713
|
-
}
|
|
714
|
-
} catch (err) {
|
|
715
|
-
console.error(err instanceof Error ? err.message : String(err));
|
|
716
|
-
process.exit(1);
|
|
717
|
-
}
|
|
718
|
-
});
|
|
719
|
-
|
|
720
|
-
jobCmd
|
|
721
|
-
.command("templates")
|
|
722
|
-
.description("List all job templates")
|
|
723
|
-
.option("--json", "Output as JSON", false)
|
|
724
|
-
.action((opts) => {
|
|
725
|
-
const templates = listJobTemplates();
|
|
726
|
-
|
|
727
|
-
if (opts.json) {
|
|
728
|
-
console.log(JSON.stringify(templates, null, 2));
|
|
729
|
-
} else {
|
|
730
|
-
if (templates.length === 0) {
|
|
731
|
-
console.log("No templates found.");
|
|
732
|
-
return;
|
|
733
|
-
}
|
|
734
|
-
for (const t of templates) {
|
|
735
|
-
console.log(` ${t.name} — ${t.title} (${t.id})`);
|
|
736
|
-
}
|
|
737
|
-
console.log(`\n${templates.length} template(s)`);
|
|
738
|
-
}
|
|
739
|
-
});
|
|
740
|
-
|
|
741
|
-
program.parse(process.argv);
|