@michaelborck/honeyguide-cli 0.0.0-stage → 0.6.0

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.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
package/dist/index.js ADDED
@@ -0,0 +1,94 @@
1
+ #!/usr/bin/env node
2
+ import path from 'node:path';
3
+ import { readFile } from 'node:fs/promises';
4
+ import { Command } from 'commander';
5
+ import { suggestResources, suggestBatch, toBatchMarkdown, recheckResources, toRecheckMarkdown, configFromEnv, toMarkdown, toCitations, toLmsHtml, extract, } from '@michaelborck/honeyguide-core';
6
+ const program = new Command();
7
+ program
8
+ .name('honeyguide')
9
+ .description('Finds and verifies supporting resources for your teaching.')
10
+ .version('0.1.1');
11
+ program
12
+ .command('suggest')
13
+ .description('List mode: verified, annotated resources for a topic or document')
14
+ .argument('[topic...]', 'topic to find supporting resources for')
15
+ .option('-f, --file <path>', 'read the topic from a document (PDF, DOCX, TXT, MD)')
16
+ .option('-n, --max-results <n>', 'maximum number of resources', '10')
17
+ .option('-o, --format <format>', 'output format: markdown, json, html (LMS-ready), apa, harvard', 'markdown')
18
+ .option('--json', 'shorthand for --format json')
19
+ .option('-c, --counterpoint', 'also surface material disagreeing with the framing')
20
+ .action(async (topicWords, options) => {
21
+ let input = topicWords.join(' ');
22
+ let label = input;
23
+ if (options.file) {
24
+ const doc = await extract(options.file);
25
+ input = doc.text;
26
+ label = label || path.basename(options.file);
27
+ }
28
+ if (!input.trim()) {
29
+ program.error('Provide a topic or --file <path>.');
30
+ }
31
+ const result = await suggestResources({
32
+ input,
33
+ maxResults: Number(options.maxResults),
34
+ counterpoint: Boolean(options.counterpoint),
35
+ }, configFromEnv());
36
+ const format = options.json ? 'json' : options.format;
37
+ let out;
38
+ switch (format) {
39
+ case 'json':
40
+ out = JSON.stringify(result, null, 2);
41
+ break;
42
+ case 'html':
43
+ out = toLmsHtml(label, result);
44
+ break;
45
+ case 'apa':
46
+ case 'harvard':
47
+ out = toCitations(result, format);
48
+ break;
49
+ default:
50
+ out = toMarkdown(label, result);
51
+ }
52
+ process.stdout.write(out + '\n');
53
+ });
54
+ program
55
+ .command('batch')
56
+ .description('Batch mode: verified resources for many topics at once (one per line)')
57
+ .argument('<file>', 'text file with one topic per line')
58
+ .option('-n, --max-results <n>', 'maximum resources per topic', '8')
59
+ .option('-c, --counterpoint', 'also surface disagreeing material per topic')
60
+ .option('--json', 'output JSON instead of markdown')
61
+ .action(async (file, options) => {
62
+ const topics = (await readFile(file, 'utf8'))
63
+ .split('\n')
64
+ .map((l) => l.trim())
65
+ .filter((l) => l && !l.startsWith('#'));
66
+ if (!topics.length)
67
+ program.error('No topics found in file.');
68
+ const entries = await suggestBatch(topics, configFromEnv(), {
69
+ maxResults: Number(options.maxResults),
70
+ counterpoint: Boolean(options.counterpoint),
71
+ });
72
+ process.stdout.write((options.json ? JSON.stringify({ entries }, null, 2) : toBatchMarkdown(entries)) +
73
+ '\n');
74
+ });
75
+ program
76
+ .command('recheck')
77
+ .description('Link-rot re-run: re-verify a previously saved JSON result list')
78
+ .argument('<file>', 'JSON file from a previous `suggest --json` run')
79
+ .option('--json', 'output JSON instead of markdown')
80
+ .action(async (file, options) => {
81
+ const saved = JSON.parse(await readFile(file, 'utf8'));
82
+ const resources = saved.resources ?? saved.entries?.flatMap((e) => e.result.resources);
83
+ if (!Array.isArray(resources) || !resources.length) {
84
+ program.error('No resources found in file — expected suggest/batch JSON output.');
85
+ }
86
+ const entries = await recheckResources(resources);
87
+ process.stdout.write((options.json ? JSON.stringify({ entries }, null, 2) : toRecheckMarkdown(entries)) +
88
+ '\n');
89
+ });
90
+ program.parseAsync().catch((error) => {
91
+ console.error(error instanceof Error ? error.message : error);
92
+ process.exitCode = 1;
93
+ });
94
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AACA,OAAO,IAAI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CAAC;IACvD,MAAM,SAAS,GAAG,KAAK,CAAC,SAAS,IAAI,KAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAuC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IAC7H,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,CAAC;QACnD,OAAO,CAAC,KAAK,CAAC,kEAAkE,CAAC,CAAC;IACpF,CAAC;IACD,MAAM,OAAO,GAAG,MAAM,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAClD,OAAO,CAAC,MAAM,CAAC,KAAK,CAClB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAC;QAChF,IAAI,CACP,CAAC;AACJ,CAAC,CAAC,CAAC;AAEL,OAAO,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,KAAc,EAAE,EAAE;IAC5C,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;IAC9D,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;AACvB,CAAC,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "@michaelborck/honeyguide-cli",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.6.0",
4
+ "description": "Honeyguide CLI: verified teaching resources from your terminal.",
5
+ "license": "MIT",
6
+ "author": "Michael Borck",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "https://github.com/michael-borck/honeyguide.git",
10
+ "directory": "packages/cli"
11
+ },
12
+ "type": "module",
13
+ "bin": {
14
+ "honeyguide": "dist/index.js"
15
+ },
16
+ "files": [
17
+ "dist"
18
+ ],
19
+ "scripts": {
20
+ "build": "tsc -p tsconfig.json"
21
+ },
22
+ "dependencies": {
23
+ "@michaelborck/honeyguide-core": "*",
24
+ "commander": "^12.1.0"
25
+ },
26
+ "devDependencies": {
27
+ "typescript": "^5.5.0"
28
+ }
29
+ }
package/README.md DELETED
@@ -1,3 +0,0 @@
1
- # Temporary Holding Version
2
-
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.