@ttctl/cli 0.1.0-rc.6 → 0.1.0-rc.8

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.
Files changed (55) hide show
  1. package/dist/commands/applications/availability-request.d.ts +47 -0
  2. package/dist/commands/applications/availability-request.d.ts.map +1 -0
  3. package/dist/commands/applications/availability-request.js +98 -0
  4. package/dist/commands/applications/availability-request.js.map +1 -0
  5. package/dist/commands/applications/confirm.d.ts +32 -2
  6. package/dist/commands/applications/confirm.d.ts.map +1 -1
  7. package/dist/commands/applications/confirm.js +194 -1
  8. package/dist/commands/applications/confirm.js.map +1 -1
  9. package/dist/commands/applications/index.d.ts +6 -2
  10. package/dist/commands/applications/index.d.ts.map +1 -1
  11. package/dist/commands/applications/index.js +112 -3
  12. package/dist/commands/applications/index.js.map +1 -1
  13. package/dist/commands/applications/interview.d.ts +159 -0
  14. package/dist/commands/applications/interview.d.ts.map +1 -0
  15. package/dist/commands/applications/interview.js +396 -0
  16. package/dist/commands/applications/interview.js.map +1 -0
  17. package/dist/commands/jobs/apply.d.ts +194 -0
  18. package/dist/commands/jobs/apply.d.ts.map +1 -0
  19. package/dist/commands/jobs/apply.js +505 -0
  20. package/dist/commands/jobs/apply.js.map +1 -0
  21. package/dist/commands/jobs/index.d.ts +19 -5
  22. package/dist/commands/jobs/index.d.ts.map +1 -1
  23. package/dist/commands/jobs/index.js +78 -6
  24. package/dist/commands/jobs/index.js.map +1 -1
  25. package/dist/commands/jobs/show.d.ts +63 -2
  26. package/dist/commands/jobs/show.d.ts.map +1 -1
  27. package/dist/commands/jobs/show.js +77 -5
  28. package/dist/commands/jobs/show.js.map +1 -1
  29. package/dist/commands/payments/index.d.ts +5 -2
  30. package/dist/commands/payments/index.d.ts.map +1 -1
  31. package/dist/commands/payments/index.js +27 -4
  32. package/dist/commands/payments/index.js.map +1 -1
  33. package/dist/commands/payments/rate.d.ts +16 -0
  34. package/dist/commands/payments/rate.d.ts.map +1 -1
  35. package/dist/commands/payments/rate.js +30 -0
  36. package/dist/commands/payments/rate.js.map +1 -1
  37. package/dist/commands/payments/summary.d.ts +17 -0
  38. package/dist/commands/payments/summary.d.ts.map +1 -0
  39. package/dist/commands/payments/summary.js +42 -0
  40. package/dist/commands/payments/summary.js.map +1 -0
  41. package/dist/commands/profile/employment/index.d.ts.map +1 -1
  42. package/dist/commands/profile/employment/index.js +23 -3
  43. package/dist/commands/profile/employment/index.js.map +1 -1
  44. package/dist/commands/profile/reviews/index.d.ts.map +1 -1
  45. package/dist/commands/profile/reviews/index.js +5 -1
  46. package/dist/commands/profile/reviews/index.js.map +1 -1
  47. package/dist/commands/profile/reviews/submit-for-review.d.ts +8 -0
  48. package/dist/commands/profile/reviews/submit-for-review.d.ts.map +1 -1
  49. package/dist/commands/profile/reviews/submit-for-review.js +15 -1
  50. package/dist/commands/profile/reviews/submit-for-review.js.map +1 -1
  51. package/dist/lib/json-input.d.ts +121 -0
  52. package/dist/lib/json-input.d.ts.map +1 -0
  53. package/dist/lib/json-input.js +245 -0
  54. package/dist/lib/json-input.js.map +1 -0
  55. package/package.json +2 -2
@@ -0,0 +1,194 @@
1
+ import { applications } from "@ttctl/core";
2
+ import type { OutputFormat } from "../../lib/output.js";
3
+ /**
4
+ * Options for `ttctl jobs apply <id>` (#430). The CLI verb lives on
5
+ * `jobs` (reads naturally: "apply to a job") while the underlying
6
+ * service module is `applications.apply` per ADR-008 § Decision Part 5.
7
+ *
8
+ * `--consent` is the user-side legal-compliance attestation locked by
9
+ * ADR-008 § Decision Part 4 — absence raises `CONSENT_REQUIRED` BEFORE
10
+ * any wire call. Auto-filling this field is forbidden.
11
+ *
12
+ * `--answers-file` / `--pitch-file` follow the ADR-008 § Decision Part 2
13
+ * JSON-file grammar (sibling to `applications confirm` per #428): a
14
+ * path (or `-` for stdin) pointing at a JSON document; the wrapper
15
+ * shape AND inner content are validated against the recovered Zod
16
+ * schemas per #438 Stage-2 before any wire call.
17
+ */
18
+ export interface JobsApplyOptions {
19
+ /**
20
+ * Legal-compliance attestation per ADR-008 § Decision Part 4. MUST be
21
+ * supplied by the user — auto-filling is forbidden. Absence raises
22
+ * `CONSENT_REQUIRED` with no wire call issued.
23
+ */
24
+ consent?: boolean;
25
+ /**
26
+ * Optional hourly rate the talent requests (decimal string, matches
27
+ * `BigDecimal!`). When omitted, the service defaults from
28
+ * `PreApplyData.suggestedRate` (REQ-A4). When supplied, must pass the
29
+ * `DECIMAL_PATTERN` regex.
30
+ */
31
+ rate?: string;
32
+ /**
33
+ * Optional talent-side free-text accompanying message. Forwarded to
34
+ * `applications.apply` as `message`, which maps to the wire
35
+ * `$comment` variable on the `JobApply` mutation.
36
+ */
37
+ message?: string;
38
+ /**
39
+ * Path to a JSON file (or `-` for stdin) containing
40
+ * `{ matcherAnswers: [...], expertiseAnswers: [...] }` per ADR-008
41
+ * § Decision Part 2. Wrapper shape AND inner items validated against
42
+ * the recovered Zod schemas before any wire call (#438 Stage-2).
43
+ */
44
+ answersFile?: string;
45
+ /**
46
+ * Path to a JSON file (or `-` for stdin) containing a `PitchInput`
47
+ * object. Forwarded to `applications.apply` as `pitchData`, mapping
48
+ * to the wire `$talentCard` variable. Validated against the recovered
49
+ * `PitchInputSchema` (#438 Stage-2); extra unknown keys reject with a
50
+ * field-path error.
51
+ */
52
+ pitchFile?: string;
53
+ /**
54
+ * Preview-only flag (REQ-Q3). When set, fetches `applyData` +
55
+ * `applyQuestions` and emits the inventory WITHOUT issuing the
56
+ * `JobApply` mutation. Does NOT require `--consent` (read-only
57
+ * path; never reaches the apply mutation).
58
+ */
59
+ showQuestions?: boolean;
60
+ /**
61
+ * Opt-in autocomplete suggestion fetch (REQ-Q4 / #452). When set,
62
+ * issues an additional `SimilarJobQuestionAnswers` fan-out in
63
+ * addition to the standard 3-query pre-apply suite and renders the
64
+ * historical similar answers in the output. NEVER auto-fills the
65
+ * `--answers-file` payload — suggestions are advisory only.
66
+ *
67
+ * The suggestion fetch fans out N parallel calls (one per matcher
68
+ * + expertise question). Per scenario "Suggestion query fails —
69
+ * apply continues without suggestions", failures of the suggestion
70
+ * branch surface as a stderr warning and the apply path continues
71
+ * unchanged.
72
+ *
73
+ * Works in `--dry-run` mode: the suggestion query is suppressed
74
+ * (zero wire calls under dry-run, matching the standard apply
75
+ * dry-run posture). Set this with `--show-questions` to also
76
+ * suppress the apply mutation (suggestion fetch runs against the
77
+ * applyQuestions inventory and is reported alongside the question
78
+ * preview).
79
+ */
80
+ suggestAnswers?: boolean;
81
+ output: OutputFormat;
82
+ }
83
+ /**
84
+ * Projection emitted on the `--show-questions` preview path. Carries
85
+ * the pre-apply context (canApply, applyErrors, suggestedRate,
86
+ * rateValidation) alongside the matcher + expertise question
87
+ * inventories so the user can author an `--answers-file` payload
88
+ * without a separate command. The shape is distinct from the
89
+ * service-layer's {@link applications.PreApplyData} /
90
+ * {@link applications.ApplicationQuestions} types so consumers
91
+ * don't have to reach across two type namespaces.
92
+ */
93
+ interface ShowQuestionsProjection {
94
+ jobId: string;
95
+ canApply: boolean;
96
+ applyErrors: applications.ApplyError[];
97
+ suggestedRate: string | null;
98
+ rateValidation: {
99
+ minRate: string;
100
+ rateStep: number;
101
+ } | null;
102
+ matcherQuestions: applications.ApplicationQuestion[];
103
+ expertiseQuestions: applications.ApplicationQuestion[];
104
+ /**
105
+ * Optional autocomplete suggestions (#452). Populated when
106
+ * `--suggest-answers` is set; absent otherwise. One group per
107
+ * question (matcher + expertise, interleaved in the same order as
108
+ * the inventory). Each group's `suggestions` array carries the
109
+ * talent's own historical answers to semantically-similar questions.
110
+ * Empty arrays surface verbatim when the talent has no similar-job
111
+ * history for that question.
112
+ */
113
+ suggestions?: applications.SimilarJobAnswerGroup[];
114
+ }
115
+ /**
116
+ * Apply-success envelope extension (#452). When `--suggest-answers`
117
+ * is passed alongside an actual apply (NOT `--show-questions`), the
118
+ * apply outcome surfaces the post-apply `JobApplicationRecord` AND
119
+ * the historical suggestions that would have been useful to author
120
+ * the answers-file (rendered as a sibling section in the pretty
121
+ * output). The shape is distinct from the bare
122
+ * {@link applications.JobApplicationRecord} so the JSON envelope
123
+ * carries both payloads under one parent.
124
+ */
125
+ interface ApplyWithSuggestionsProjection {
126
+ application: applications.JobApplicationRecord;
127
+ suggestions: applications.SimilarJobAnswerGroup[];
128
+ }
129
+ /**
130
+ * Action handler for `ttctl jobs apply <id>` (#430).
131
+ *
132
+ * Issues the direct `JobApply` mutation via `applications.apply()` (per
133
+ * ADR-008 § Decision Part 5: the service module is `applications`; the
134
+ * user-facing verb lives on `jobs`). The handler enforces three
135
+ * pre-wire gates in order:
136
+ *
137
+ * 1. **`--show-questions` preview** — when set, fetches `applyData`
138
+ * + `applyQuestions` in parallel and emits the projection;
139
+ * returns BEFORE the consent gate (read-only path).
140
+ * 2. **Consent gate** — `--consent` is REQUIRED per ADR-008 § Decision
141
+ * Part 4. Absence raises `CONSENT_REQUIRED` with no wire call
142
+ * issued. The service's own runtime check at `apply()` is
143
+ * defense-in-depth.
144
+ * 3. **`--rate` validation** — decimal-string format enforced via
145
+ * {@link DECIMAL_PATTERN} (mirrors the `applications confirm`
146
+ * pattern). Bad input refuses with `MUTATION_ERROR`.
147
+ *
148
+ * `--answers-file` / `--pitch-file` are loaded + wrapper-shape-validated
149
+ * BEFORE the apply call (mirrors #428 confirm semantics): malformed
150
+ * JSON or wrong wrapper shape refuses with `VALIDATION_ERROR` and no
151
+ * mutation is issued.
152
+ *
153
+ * **DESTRUCTIVE** — applying to a job creates a `JobApplication`
154
+ * record. No `withdraw` operation is available on the wire (per ADR-008
155
+ * § What We're NOT Solving). Prefer `--dry-run` to preview the wire
156
+ * payload first; the AC scenarios pin the dry-run preview shape.
157
+ */
158
+ export declare function runJobsApply(id: string, opts: JobsApplyOptions): Promise<void>;
159
+ /**
160
+ * Render the post-apply `JobApplicationRecord` as the indented entity
161
+ * preview inside the success-update envelope's pretty block. Pure —
162
+ * directly unit-testable.
163
+ *
164
+ * Fields surfaced: status (value + verbose), requested rate (when
165
+ * present), the wrapping activity-item id so the user can chain
166
+ * `applications show <activity-item-id>` to view the new row.
167
+ */
168
+ export declare function formatJobApplicationRecord(result: applications.JobApplicationRecord): string;
169
+ /**
170
+ * Render the `--show-questions` projection as a sectioned multi-line
171
+ * block. Surfaces apply readiness (canApply, applyErrors,
172
+ * suggestedRate) AND the question inventories so the user can decide
173
+ * whether to apply AND author the answers-file payload in one glance.
174
+ *
175
+ * Each question renders as ` • <identifier>: <prompt>` (mirrors the
176
+ * `jobs show --with-questions` / #437 format). Empty inventories
177
+ * surface the zero count in the section header so the user reads
178
+ * "Toptal returned an empty inventory" rather than "the CLI silently
179
+ * dropped the section". Pure — directly unit-testable.
180
+ */
181
+ export declare function formatShowQuestions(projection: ShowQuestionsProjection): string;
182
+ /**
183
+ * Render the apply-success envelope's pretty body when
184
+ * `--suggest-answers` was passed alongside the actual apply (#452).
185
+ * Combines the post-apply `JobApplicationRecord` section with the
186
+ * advisory suggestion inventory beneath it; the suggestions are
187
+ * displayed AFTER the apply confirmation so the user reads "apply
188
+ * succeeded" first and then sees what they could have used.
189
+ *
190
+ * Pure — directly unit-testable.
191
+ */
192
+ export declare function formatApplyWithSuggestions(projection: ApplyWithSuggestionsProjection): string;
193
+ export {};
194
+ //# sourceMappingURL=apply.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"apply.d.ts","sourceRoot":"","sources":["../../../src/commands/jobs/apply.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAO3C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAGxD;;;;;;;;;;;;;;GAcG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;;OAKG;IACH,WAAW,CA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