@ttctl/cli
Advanced tools
@@ -242,2 +242,21 @@ // SPDX-License-Identifier: AGPL-3.0-only | ||
| } | ||
| /** | ||
| * Renders one question's `options` cell, keyed on the declared `kind`. | ||
| * Option-emptiness is not the discriminator — a free-text question on | ||
| * this platform can arrive carrying options. | ||
| */ | ||
| function formatQuestionOptions(q) { | ||
| const optionList = q.options.map((o) => `${o.label}${o.commentRequired ? " (comment required)" : ""}`).join(" / "); | ||
| const hasOptions = q.options.length > 0; | ||
| switch (q.kind) { | ||
| case "TEXT": | ||
| return hasOptions ? "(free text — server also returned options)" : "(free text)"; | ||
| case "RADIO": | ||
| return hasOptions ? optionList : "(no options returned by the server)"; | ||
| default: | ||
| return hasOptions | ||
| ? `${optionList} (unrecognized kind)` | ||
| : "(unrecognized kind — no options returned by the server)"; | ||
| } | ||
| } | ||
| export function formatQuestionsBlock(items) { | ||
@@ -253,8 +272,5 @@ if (items.length === 0) { | ||
| for (const q of items) { | ||
| const opts = q.options.length === 0 | ||
| ? "(free text)" | ||
| : q.options.map((o) => `${o.label}${o.commentRequired ? " (comment required)" : ""}`).join(" / "); | ||
| table.push([q.id, q.kind, q.label, opts]); | ||
| table.push([q.id, q.kind, q.label, formatQuestionOptions(q)]); | ||
| } | ||
| return table.toString(); | ||
| } |
@@ -37,3 +37,3 @@ // SPDX-License-Identifier: AGPL-3.0-only | ||
| .description("Submit answers to a pending survey (IRREVERSIBLE — requires --consent-survey-submission)") | ||
| .option("-a, --answer <questionId=value>", "an answer as `<questionId>=<value>` (repeatable). Multiple-choice: the option value from `surveys list`. Checkbox (inputType CHECKBOX): `true` or `false`. Free-text: the text. All mandatory questions must be answered.", collectAnswer, []) | ||
| .option("-a, --answer <questionId=value>", "an answer as `<questionId>=<value>` (repeatable). Keyed off the question's `inputType` from `surveys list`, not its `answers` length. Multiple-choice (RADIO_BUTTONS/RATING/SLIDER): the option value. Checkbox (CHECKBOX): `true` or `false`. Free-text (OPEN_TEXT): the text. Date (PROPOSED_ENGAGEMENT_END_DATE): the date as `YYYY-MM-DD`, or `I do not know`. All mandatory questions must be answered; unanswered optional ones are forfeited, since submitting closes the survey.", collectAnswer, []) | ||
| .option("--kind <kind>", "survey kind override (resolved from `surveys list` when omitted)") | ||
@@ -40,0 +40,0 @@ .option("--consent-survey-submission", "acknowledge that this irreversibly submits your answers to Toptal", false) |
+4
-4
| { | ||
| "name": "@ttctl/cli", | ||
| "version": "0.2.0", | ||
| "version": "0.2.1", | ||
| "description": "TTCtl CLI commands and program definition", | ||
@@ -34,5 +34,5 @@ "type": "module", | ||
| "@types/node": "^26", | ||
| "eslint": "^10.7.0", | ||
| "eslint": "^10.8.1", | ||
| "typescript": "~6.0.3", | ||
| "vitest": "^4.1.9" | ||
| "vitest": "^4.1.10" | ||
| }, | ||
@@ -45,3 +45,3 @@ "dependencies": { | ||
| "zod": "^4.4.3", | ||
| "@ttctl/core": "^0.2.0" | ||
| "@ttctl/core": "^0.2.1" | ||
| }, | ||
@@ -48,0 +48,0 @@ "scripts": { |
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
Unidentified License
LicenseSomething that seems like a license was found, but its contents could not be matched with a known license.
URL strings
Supply chain riskPackage contains fragments of external URLs or IP addresses, which the package may be accessing at runtime.
1062780
0.09%22895
0.07%Updated