@tenderlead/cli 0.4.0 → 0.4.1

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 CHANGED
@@ -110,6 +110,31 @@ For draft workspace edits or evidence-pack workspace state, pass the existing
110
110
  request JSON with `--file`. The CLI sets `contract_id` from the command and sends
111
111
  the remaining fields to the same handler used by the signed-in product.
112
112
 
113
+ ### Prepare a checklist from a public tender link
114
+
115
+ With a Team account and a `workspace:write` token:
116
+
117
+ ```bash
118
+ tenderlead drafts fetch CONTRACT_ID --url "https://www.contractsfinder.service.gov.uk/Notice/NOTICE_ID" > documents.json
119
+ ```
120
+
121
+ This retrieves public PDF/Word attachments from supported official notices
122
+ (Contracts Finder, Find a Tender and Public Contracts Scotland). It returns
123
+ `documents` and `warnings`, without calling a model or saving a draft. Each
124
+ document retains its source URL. Check the text, warnings and complete buyer
125
+ pack before proceeding. Portal-only files still need manual upload.
126
+
127
+ To build a checklist, put the reviewed `documents` array into a JSON object
128
+ under `preparation_documents`, then run:
129
+
130
+ ```bash
131
+ tenderlead drafts create CONTRACT_ID --file reviewed-documents.json
132
+ ```
133
+
134
+ Checklist generation requires explicit account AI consent and available budget.
135
+ It does not submit a bid or replace saved answers. Imports are limited to five
136
+ documents, 2 MB per file and 60,000 text characters in total.
137
+
113
138
  Commands that replace, import, update or remove saved data ask for a typed
114
139
  confirmation. Reviewed automation can pass `--yes`. Run `tenderlead --help` for
115
140
  the full command list.
package/bin/tenderlead.js CHANGED
@@ -45,6 +45,7 @@ function usage() {
45
45
  ' tenderlead templates upload --file <path> [--file <path>...] [--role <role>] [--yes] [--json]',
46
46
  ' tenderlead templates remove <template-id> [--yes]',
47
47
  ' tenderlead drafts list [--json]',
48
+ ' tenderlead drafts fetch <contract-id> --url <official-tender-url> [--json]',
48
49
  ' tenderlead drafts show <contract-id> [--workspace] [--json]',
49
50
  ' tenderlead drafts create <contract-id> [--file <request.json>] [--refresh] [--workspace] [--yes] [--json]',
50
51
  ' tenderlead drafts export <contract-id> --format text|docx|xlsx --output <path> [--yes]',
@@ -314,13 +315,14 @@ function parseTemplatesArgs(argv) {
314
315
  function parseDraftArgs(argv) {
315
316
  const action = argv[3];
316
317
  if (action === 'list') return parseJsonOnlyArgs(argv, 4, { command: 'drafts', action, json: false });
317
- if (!['show', 'create', 'export', 'import'].includes(action)) throw new Error('Use drafts list, show, create, export or import.');
318
+ if (!['show', 'create', 'export', 'import', 'fetch'].includes(action)) throw new Error('Use drafts list, show, create, export, import or fetch.');
318
319
  const contractId = argv[4];
319
320
  if (!contractId || contractId.startsWith('--')) throw new Error(`drafts ${action} requires a contract ID`);
320
321
  const options = { command: 'drafts', action, contractId, file: null, refresh: false, workspace: false, format: null, output: null, yes: false, json: false };
321
322
  for (let index = 5; index < argv.length; index += 1) {
322
323
  const arg = argv[index];
323
- if (arg === '--json') options.json = true;
324
+ if (arg === '--url' && action === 'fetch') { options.url = optionValue(argv, index, arg); index += 1; }
325
+ else if (arg === '--json') options.json = true;
324
326
  else if (arg === '--yes') options.yes = true;
325
327
  else if (arg === '--refresh') options.refresh = true;
326
328
  else if (arg === '--workspace') options.workspace = true;
@@ -331,6 +333,7 @@ function parseDraftArgs(argv) {
331
333
  }
332
334
  if (action === 'export' && (!['text', 'docx', 'xlsx'].includes(options.format) || !options.output)) throw new Error('drafts export requires --format text|docx|xlsx and --output <path>');
333
335
  if (action === 'import' && !options.file) throw new Error('drafts import requires --file <workspace.xlsx>');
336
+ if (action === 'fetch' && !options.url) throw new Error('drafts fetch requires --url <official-tender-url>');
334
337
  return options;
335
338
  }
336
339
 
@@ -774,6 +777,7 @@ async function main() {
774
777
  return printPayload(await removeTemplate(options.id), options.json, () => `Removed bid template ${options.id}.`);
775
778
  }
776
779
  if (options.command === 'drafts') {
780
+ if (options.action === 'fetch') return printPayload(await apiRequest('/v1/drafts', {method: 'POST', body: JSON.stringify({contract_id: options.contractId, preparation_url: options.url})}), true);
777
781
  if (options.action === 'list') {
778
782
  const payload = await fetchDrafts();
779
783
  return printPayload(payload, options.json, value => formatList('TenderLead bid drafts', value.drafts || [], row => `${line(row.title, 'Untitled')} · ${line(row.contract_id, 'unknown')}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tenderlead/cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.1",
4
4
  "private": false,
5
5
  "description": "Run TenderLead tender, profile, pipeline, insight and bid-workspace workflows from the terminal",
6
6
  "homepage": "https://tenderlead.co.uk",