sensemaking 0.9.3 → 0.9.4
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 +2 -4
- package/dist/cjs/cli/check.js +1 -2
- package/dist/cjs/cli/check.js.map +1 -1
- package/dist/cjs/cli/named.js +5 -2
- package/dist/cjs/cli/named.js.map +1 -1
- package/dist/cjs/cli/shared.d.cts +8 -13
- package/dist/cjs/cli/shared.d.ts +8 -13
- package/dist/cjs/cli/shared.js +29 -124
- package/dist/cjs/cli/shared.js.map +1 -1
- package/dist/cjs/cli.js +111 -116
- package/dist/cjs/cli.js.map +1 -1
- package/dist/esm/cli/check.js +1 -2
- package/dist/esm/cli/check.js.map +1 -1
- package/dist/esm/cli/named.js +5 -2
- package/dist/esm/cli/named.js.map +1 -1
- package/dist/esm/cli/shared.d.ts +8 -13
- package/dist/esm/cli/shared.js +33 -55
- package/dist/esm/cli/shared.js.map +1 -1
- package/dist/esm/cli.js +74 -68
- package/dist/esm/cli.js.map +1 -1
- package/package.json +1 -3
- package/dist/cjs/cli/exit.d.cts +0 -5
- package/dist/cjs/cli/exit.d.ts +0 -5
- package/dist/cjs/cli/exit.js +0 -147
- package/dist/cjs/cli/exit.js.map +0 -1
- package/dist/esm/cli/exit.d.ts +0 -5
- package/dist/esm/cli/exit.js +0 -15
- package/dist/esm/cli/exit.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/shared.ts"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/shared.ts"],"sourcesContent":["import type { ParseArgsOptionsConfig } from 'node:util';\nimport { parseArgs } from 'node:util';\nimport type { ResolvedConfig } from '../config.ts';\nimport type { OpenResult } from '../db.ts';\nimport { open } from '../db.ts';\nimport type { Row } from '../output.ts';\nimport { printRows } from '../output.ts';\nimport { searchError } from '../search-error.ts';\nimport type { Ctx } from './types.ts';\n\n// Spreadable option fragments -- one flag name keeps one meaning across every command's table.\nexport const FORMAT: ParseArgsOptionsConfig = { format: { type: 'string', default: 'table' } };\nexport const CONFIG: ParseArgsOptionsConfig = { config: { type: 'string' } };\nexport const SEARCH_FLAGS: ParseArgsOptionsConfig = {\n where: { type: 'string' },\n k: { type: 'string' },\n preset: { type: 'string' },\n include: { type: 'string', multiple: true },\n lexical: { type: 'boolean', default: false },\n};\n\ntype Values = Record<string, string | boolean | string[] | undefined>;\n\nexport function formatOf(values: Values): 'table' | 'json' {\n return values.format === 'json' ? 'json' : 'table';\n}\n\n// Per-command parseArgs: strict (a foreign flag exits 2), and every table gets --help for free.\nexport function parse(argv: string[], usage: string, options: ParseArgsOptionsConfig): { values: Values; positionals: string[] } {\n let values: Values;\n let positionals: string[];\n try {\n ({ values, positionals } = parseArgs({\n args: argv,\n options: { ...options, help: { type: 'boolean', default: false, short: 'h' } },\n strict: true,\n allowPositionals: true,\n }));\n } catch (err) {\n console.error((err as Error).message);\n console.error(usage);\n process.exit(2);\n }\n if (values.help) {\n console.log(usage);\n process.exit(0);\n }\n return { values, positionals };\n}\n\n// --k must be a positive integer: SQLite reads a bound LIMIT of -1 as \"unlimited\" and 0 as\n// \"nothing\", and parseInt would silently truncate \"5.9\" -- all three are caller mistakes\n// worth a usage error, matching the config-level SavedSearch validation.\nexport function parseK(k: string | undefined, usageError: (message: string) => never): number | undefined {\n if (k === undefined) return undefined;\n const parsed = Number(k);\n if (!Number.isInteger(parsed) || parsed <= 0) usageError(`--k expects a positive integer, got \"${k}\"`);\n return parsed;\n}\n\n// Shared open-query-close envelope for commands that touch the tree.\n\nexport function printWarnings(warnings: string[]): void {\n for (const w of warnings) console.warn(w);\n}\n\nexport async function withDb(ctx: Ctx, configPath: string | undefined, fn: (db: OpenResult['db'], cfg: ResolvedConfig) => void | Promise<void>): Promise<void> {\n const cfg = ctx.resolveConfig(configPath);\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n try {\n await fn(db, cfg);\n } finally {\n db.close();\n }\n}\n\n// An unbound `?` silently binds NULL, so mismatched param counts fail loudly instead.\nexport function runSql(cfg: ResolvedConfig, sql: string, params: string[], format: 'table' | 'json', label: string): void {\n const placeholderCount = (sql.match(/\\?/g) ?? []).length;\n if (params.length !== placeholderCount) {\n console.error(`${label} expects ${placeholderCount} parameter(s), got ${params.length}`);\n process.exit(2);\n }\n const { db, warnings } = open(cfg);\n printWarnings(warnings);\n let rows: Row[];\n try {\n rows = db.prepare(sql).all(...params) as Row[];\n } catch (err) {\n db.close();\n // A saved query or ad-hoc SQL can carry `content MATCH ?` too, so the same FTS5\n // punctuation trap applies -- the bound parameters are the search terms there. SQL\n // without MATCH gets its error verbatim; search advice on a plain typo would mislead.\n if (/\\bMATCH\\b/i.test(sql)) throw searchError(err as Error, params.join(' '));\n throw err;\n }\n printRows(rows, format);\n db.close();\n}\n"],"names":["parseArgs","open","printRows","searchError","FORMAT","format","type","default","CONFIG","config","SEARCH_FLAGS","where","k","preset","include","multiple","lexical","formatOf","values","parse","argv","usage","options","positionals","args","help","short","strict","allowPositionals","err","console","error","message","process","exit","log","parseK","usageError","undefined","parsed","Number","isInteger","printWarnings","warnings","w","warn","withDb","ctx","configPath","fn","cfg","resolveConfig","db","close","runSql","sql","params","label","placeholderCount","match","length","rows","prepare","all","test","join"],"mappings":"AACA,SAASA,SAAS,QAAQ,YAAY;AAGtC,SAASC,IAAI,QAAQ,WAAW;AAEhC,SAASC,SAAS,QAAQ,eAAe;AACzC,SAASC,WAAW,QAAQ,qBAAqB;AAGjD,+FAA+F;AAC/F,OAAO,MAAMC,SAAiC;IAAEC,QAAQ;QAAEC,MAAM;QAAUC,SAAS;IAAQ;AAAE,EAAE;AAC/F,OAAO,MAAMC,SAAiC;IAAEC,QAAQ;QAAEH,MAAM;IAAS;AAAE,EAAE;AAC7E,OAAO,MAAMI,eAAuC;IAClDC,OAAO;QAAEL,MAAM;IAAS;IACxBM,GAAG;QA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AAeE,OAAOC,GAAQ,EAAEC,UAA8B,EAAEC,EAAuE;IAC5I,MAAMC,MAAMH,IAAII,aAAa,CAACH;IAC9B,MAAM,EAAEI,EAAE,EAAET,QAAQ,EAAE,GAAG1C,KAAKiD;IAC9BR,cAAcC;IACd,IAAI;QACF,MAAMM,GAAGG,IAAIF;IACf,SAAU;QACRE,GAAGC,KAAK;IACV;AACF;AAEA,sFAAsF;AACtF,OAAO,SAASC,OAAOJ,GAAmB,EAAEK,GAAW,EAAEC,MAAgB,EAAEnD,MAAwB,EAAEoD,KAAa;QACtFF;IAA1B,MAAMG,mBAAmB,EAACH,aAAAA,IAAII,KAAK,CAAC,oBAAVJ,wBAAAA,aAAoB,EAAE,EAAEK,MAAM;IACxD,IAAIJ,OAAOI,MAAM,KAAKF,kBAAkB;QACtC5B,QAAQC,KAAK,CAAC,GAAG0B,MAAM,SAAS,EAAEC,iBAAiB,mBAAmB,EAAEF,OAAOI,MAAM,EAAE;QACvF3B,QAAQC,IAAI,CAAC;IACf;IACA,MAAM,EAAEkB,EAAE,EAAET,QAAQ,EAAE,GAAG1C,KAAKiD;IAC9BR,cAAcC;IACd,IAAIkB;IACJ,IAAI;QACFA,OAAOT,GAAGU,OAAO,CAACP,KAAKQ,GAAG,IAAIP;IAChC,EAAE,OAAO3B,KAAK;QACZuB,GAAGC,KAAK;QACR,gFAAgF;QAChF,mFAAmF;QACnF,sFAAsF;QACtF,IAAI,aAAaW,IAAI,CAACT,MAAM,MAAMpD,YAAY0B,KAAc2B,OAAOS,IAAI,CAAC;QACxE,MAAMpC;IACR;IACA3B,UAAU2D,MAAMxD;IAChB+C,GAAGC,KAAK;AACV"}
|
package/dist/esm/cli.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
import { createRequire } from 'node:module';
|
|
2
|
-
import
|
|
3
|
-
import getopts from 'getopts-compat';
|
|
4
|
-
import { ExitError, usageError } from './cli/exit.js';
|
|
2
|
+
import { parseArgs } from 'node:util';
|
|
5
3
|
import { COMMANDS, USAGE } from './cli/index.js';
|
|
6
4
|
import { loadConfig, SUPPORTED_CONFIG_VERSION } from './config.js';
|
|
7
5
|
// Parsing and dispatch only. Commands live in src/cli/, one file each, lazy-loaded --
|
|
8
6
|
// nothing tree- or dependency-heavy may be imported at the top of this file. Flags parse
|
|
9
7
|
// per command (each command's own parse() call); this file only handles the bare top-level
|
|
10
|
-
// flags (--version/--help/--list/--config) and dispatch
|
|
8
|
+
// flags (--version/--help/--list/--config) and dispatch.
|
|
11
9
|
// Works from dist/cjs and dist/esm alike: walk up past the dist type-marker package.json.
|
|
12
10
|
function packageVersion() {
|
|
13
11
|
const load = createRequire(import.meta.url);
|
|
@@ -42,79 +40,87 @@ function resolveConfigFor(name, configPath) {
|
|
|
42
40
|
}
|
|
43
41
|
return cfg;
|
|
44
42
|
}
|
|
45
|
-
//
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
43
|
+
// Thrown errors -> exit 1 with the message verbatim; usage errors exit 2 directly.
|
|
44
|
+
export default async function cli(argv, name) {
|
|
45
|
+
const first = argv[0];
|
|
46
|
+
// No command word, or the first token looks like a flag: the only flags this level knows.
|
|
47
|
+
if (!first || first.startsWith('-')) {
|
|
48
|
+
let values;
|
|
49
|
+
try {
|
|
50
|
+
({ values } = parseArgs({
|
|
51
|
+
args: argv,
|
|
52
|
+
options: {
|
|
53
|
+
version: {
|
|
54
|
+
type: 'boolean',
|
|
55
|
+
default: false,
|
|
56
|
+
short: 'v'
|
|
57
|
+
},
|
|
58
|
+
help: {
|
|
59
|
+
type: 'boolean',
|
|
60
|
+
default: false,
|
|
61
|
+
short: 'h'
|
|
62
|
+
},
|
|
63
|
+
list: {
|
|
64
|
+
type: 'boolean',
|
|
65
|
+
default: false
|
|
66
|
+
},
|
|
67
|
+
config: {
|
|
68
|
+
type: 'string'
|
|
69
|
+
}
|
|
70
|
+
},
|
|
71
|
+
allowPositionals: true
|
|
72
|
+
}));
|
|
73
|
+
} catch (err) {
|
|
74
|
+
console.error(err.message);
|
|
75
|
+
console.error(usage(name));
|
|
76
|
+
process.exit(2);
|
|
70
77
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
78
|
+
try {
|
|
79
|
+
if (values.version) {
|
|
80
|
+
console.log(packageVersion());
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
if (values.help) {
|
|
84
|
+
console.log(usage(name));
|
|
85
|
+
return;
|
|
86
|
+
}
|
|
87
|
+
if (values.list) {
|
|
88
|
+
const queries = resolveConfigFor(name, values.config).queries;
|
|
89
|
+
for (const queryName of Object.keys(queries).sort()){
|
|
90
|
+
const entry = queries[queryName];
|
|
91
|
+
const isSavedSearch = typeof entry === 'object' && entry !== null && 'search' in entry;
|
|
92
|
+
console.log(isSavedSearch ? `${queryName} (search)` : queryName);
|
|
93
|
+
}
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
} catch (err) {
|
|
97
|
+
console.error(err.message);
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
console.error(usage(name));
|
|
101
|
+
process.exit(2);
|
|
76
102
|
}
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
103
|
+
// find -> search (breaking rename): one release of a pointer instead of "unknown query".
|
|
104
|
+
if (first === 'find') {
|
|
105
|
+
console.error(`${name}: find is now search`);
|
|
106
|
+
console.error(usage(name));
|
|
107
|
+
process.exit(2);
|
|
80
108
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
console.
|
|
109
|
+
const ctx = {
|
|
110
|
+
name,
|
|
111
|
+
argv: argv.slice(1),
|
|
112
|
+
resolveConfig: (configPath)=>resolveConfigFor(name, configPath),
|
|
113
|
+
usageError (message) {
|
|
114
|
+
console.error(message);
|
|
115
|
+
process.exit(2);
|
|
87
116
|
}
|
|
88
|
-
|
|
89
|
-
}
|
|
90
|
-
console.error(usage(name));
|
|
91
|
-
throw new ExitError(2);
|
|
92
|
-
}
|
|
93
|
-
// ExitError carries a chosen code; anything else is an error -> exit 1 with its message.
|
|
94
|
-
export default async function cli(argv, name) {
|
|
117
|
+
};
|
|
95
118
|
try {
|
|
96
|
-
const first = argv[0];
|
|
97
|
-
if (!first || first.startsWith('-')) {
|
|
98
|
-
topLevel(argv, name);
|
|
99
|
-
return;
|
|
100
|
-
}
|
|
101
|
-
// find -> search (breaking rename): one release of a pointer instead of "unknown query".
|
|
102
|
-
if (first === 'find') usageError(`${name}: find is now search`, usage(name));
|
|
103
|
-
const ctx = {
|
|
104
|
-
name,
|
|
105
|
-
argv: argv.slice(1),
|
|
106
|
-
resolveConfig: (configPath)=>resolveConfigFor(name, configPath),
|
|
107
|
-
usageError: (message)=>usageError(message)
|
|
108
|
-
};
|
|
109
119
|
const load = COMMANDS[first];
|
|
110
120
|
if (load) await (await load()).default(ctx);
|
|
111
121
|
else await (await import('./cli/named.js')).default(ctx, first);
|
|
112
122
|
} catch (err) {
|
|
113
|
-
if (err instanceof ExitError) {
|
|
114
|
-
exit(err.code);
|
|
115
|
-
return;
|
|
116
|
-
}
|
|
117
123
|
console.error(err.message);
|
|
118
|
-
exit(1);
|
|
124
|
+
process.exit(1);
|
|
119
125
|
}
|
|
120
126
|
}
|
package/dist/esm/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport
|
|
1
|
+
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli.ts"],"sourcesContent":["import { createRequire } from 'node:module';\nimport { parseArgs } from 'node:util';\nimport { COMMANDS, USAGE } from './cli/index.ts';\nimport type { Ctx } from './cli/types.ts';\nimport { loadConfig, SUPPORTED_CONFIG_VERSION } from './config.ts';\n\n// Parsing and dispatch only. Commands live in src/cli/, one file each, lazy-loaded --\n// nothing tree- or dependency-heavy may be imported at the top of this file. Flags parse\n// per command (each command's own parse() call); this file only handles the bare top-level\n// flags (--version/--help/--list/--config) and dispatch.\n\n// Works from dist/cjs and dist/esm alike: walk up past the dist type-marker package.json.\nfunction packageVersion(): string {\n const load = createRequire(import.meta.url);\n for (const rel of ['../package.json', '../../package.json', '../../../package.json']) {\n try {\n const pkg = load(rel) as { name?: string; version?: string };\n if (pkg.name === 'sensemaking' && pkg.version) return pkg.version;\n } catch {}\n }\n return 'unknown';\n}\n\nfunction usage(name: string): string {\n const lines = Object.values(USAGE).map((u) => ` ${name} ${u}`);\n return [`usage: ${name} <name> [params...] [--format table|json] [--config path]`, ...lines, ` ${name} --list`, ` ${name} --version`].join('\\n');\n}\n\nfunction resolveConfigFor(name: string, configPath: string | undefined) {\n const cfg = loadConfig(configPath);\n if (cfg.migratedFrom !== undefined) {\n console.warn(`${name}: migrated ${cfg.configPath} from config version ${cfg.migratedFrom} to ${SUPPORTED_CONFIG_VERSION}`);\n }\n if (cfg.unknownKeys !== undefined) {\n console.warn(`${name}: ${cfg.configPath} sets ${cfg.unknownKeys.join(', ')}, which this build does not read (no effect); see schema.json for the keys it does`);\n }\n return cfg;\n}\n\n// Thrown errors -> exit 1 with the message verbatim; usage errors exit 2 directly.\nexport default async function cli(argv: string[], name: string): Promise<void> {\n const first = argv[0];\n\n // No command word, or the first token looks like a flag: the only flags this level knows.\n if (!first || first.startsWith('-')) {\n let values: Record<string, string | boolean | undefined>;\n try {\n ({ values } = parseArgs({\n args: argv,\n options: {\n version: { type: 'boolean', default: false, short: 'v' },\n help: { type: 'boolean', default: false, short: 'h' },\n list: { type: 'boolean', default: false },\n config: { type: 'string' },\n },\n allowPositionals: true,\n }));\n } catch (err) {\n console.error((err as Error).message);\n console.error(usage(name));\n process.exit(2);\n }\n\n try {\n if (values.version) {\n console.log(packageVersion());\n return;\n }\n if (values.help) {\n console.log(usage(name));\n return;\n }\n if (values.list) {\n const queries = resolveConfigFor(name, values.config as string | undefined).queries;\n for (const queryName of Object.keys(queries).sort()) {\n const entry = queries[queryName];\n const isSavedSearch = typeof entry === 'object' && entry !== null && 'search' in entry;\n console.log(isSavedSearch ? `${queryName} (search)` : queryName);\n }\n return;\n }\n } catch (err) {\n console.error((err as Error).message);\n process.exit(1);\n }\n\n console.error(usage(name));\n process.exit(2);\n }\n\n // find -> search (breaking rename): one release of a pointer instead of \"unknown query\".\n if (first === 'find') {\n console.error(`${name}: find is now search`);\n console.error(usage(name));\n process.exit(2);\n }\n\n const ctx: Ctx = {\n name,\n argv: argv.slice(1),\n resolveConfig: (configPath) => resolveConfigFor(name, configPath),\n usageError(message) {\n console.error(message);\n process.exit(2);\n },\n };\n\n try {\n const load = COMMANDS[first];\n if (load) await (await load()).default(ctx);\n else await (await import('./cli/named.ts')).default(ctx, first);\n } catch (err) {\n console.error((err as Error).message);\n process.exit(1);\n }\n}\n"],"names":["createRequire","parseArgs","COMMANDS","USAGE","loadConfig","SUPPORTED_CONFIG_VERSION","packageVersion","load","url","rel","pkg","name","version","usage","lines","Object","values","map","u","join","resolveConfigFor","configPath","cfg","migratedFrom","undefined","console","warn","unknownKeys","cli","argv","first","startsWith","args","options","type","default","short","help","list","config","allowPositionals","err","error","message","process","exit","log","queries","queryName","keys","sort","entry","isSavedSearch","ctx","slice","resolveConfig","usageError"],"mappings":"AAAA,SAASA,aAAa,QAAQ,cAAc;AAC5C,SAASC,SAAS,QAAQ,YAAY;AACtC,SAASC,QAAQ,EAAEC,KAAK,QAAQ,iBAAiB;AAEjD,SAASC,UAAU,EAAEC,wBAAwB,QAAQ,cAA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iC,QAAQC,IAAI,CAAC;IACf;IAEA,yFAAyF;IACzF,IAAIf,UAAU,QAAQ;QACpBL,QAAQiB,KAAK,CAAC,GAAG/B,KAAK,oBAAoB,CAAC;QAC3Cc,QAAQiB,KAAK,CAAC7B,MAAMF;QACpBiC,QAAQC,IAAI,CAAC;IACf;IAEA,MAAMQ,MAAW;QACf1C;QACAkB,MAAMA,KAAKyB,KAAK,CAAC;QACjBC,eAAe,CAAClC,aAAeD,iBAAiBT,MAAMU;QACtDmC,YAAWb,OAAO;YAChBlB,QAAQiB,KAAK,CAACC;YACdC,QAAQC,IAAI,CAAC;QACf;IACF;IAEA,IAAI;QACF,MAAMtC,OAAOL,QAAQ,CAAC4B,MAAM;QAC5B,IAAIvB,MAAM,MAAM,AAAC,CAAA,MAAMA,MAAK,EAAG4B,OAAO,CAACkB;aAClC,MAAM,AAAC,CAAA,MAAM,MAAM,CAAC,iBAAgB,EAAGlB,OAAO,CAACkB,KAAKvB;IAC3D,EAAE,OAAOW,KAAK;QACZhB,QAAQiB,KAAK,CAAC,AAACD,IAAcE,OAAO;QACpCC,QAAQC,IAAI,CAAC;IACf;AACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sensemaking",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.4",
|
|
4
4
|
"description": "Query and search a tree of markdown notes: SQL over frontmatter and links, ranked search over the prose — words, links, and meaning fused",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"markdown",
|
|
@@ -58,9 +58,7 @@
|
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
60
|
"@huggingface/tokenizers": "^0.1.3",
|
|
61
|
-
"exit-compat": "^1.0.5",
|
|
62
61
|
"fast-glob": "^3.3.3",
|
|
63
|
-
"getopts-compat": "^2.2.6",
|
|
64
62
|
"remove-markdown": "^0.6.4",
|
|
65
63
|
"yaml": "^2.9.0"
|
|
66
64
|
},
|
package/dist/cjs/cli/exit.d.cts
DELETED
package/dist/cjs/cli/exit.d.ts
DELETED
package/dist/cjs/cli/exit.js
DELETED
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
// Commands never end the process themselves: they throw this, and cli.ts -- the one place
|
|
2
|
-
// that owns the exit -- drains stdio through exit-compat and returns. Neither alternative
|
|
3
|
-
// works here: a direct process.exit() races a pending write, and a bare return would let a
|
|
4
|
-
// command body run on after --help had already printed its usage.
|
|
5
|
-
"use strict";
|
|
6
|
-
Object.defineProperty(exports, "__esModule", {
|
|
7
|
-
value: true
|
|
8
|
-
});
|
|
9
|
-
function _export(target, all) {
|
|
10
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
11
|
-
enumerable: true,
|
|
12
|
-
get: Object.getOwnPropertyDescriptor(all, name).get
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
_export(exports, {
|
|
16
|
-
get ExitError () {
|
|
17
|
-
return ExitError;
|
|
18
|
-
},
|
|
19
|
-
get usageError () {
|
|
20
|
-
return usageError;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
function _assert_this_initialized(self) {
|
|
24
|
-
if (self === void 0) {
|
|
25
|
-
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
|
|
26
|
-
}
|
|
27
|
-
return self;
|
|
28
|
-
}
|
|
29
|
-
function _call_super(_this, derived, args) {
|
|
30
|
-
derived = _get_prototype_of(derived);
|
|
31
|
-
return _possible_constructor_return(_this, _is_native_reflect_construct() ? Reflect.construct(derived, args || [], _get_prototype_of(_this).constructor) : derived.apply(_this, args));
|
|
32
|
-
}
|
|
33
|
-
function _class_call_check(instance, Constructor) {
|
|
34
|
-
if (!(instance instanceof Constructor)) {
|
|
35
|
-
throw new TypeError("Cannot call a class as a function");
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
function _construct(Parent, args, Class) {
|
|
39
|
-
if (_is_native_reflect_construct()) {
|
|
40
|
-
_construct = Reflect.construct;
|
|
41
|
-
} else {
|
|
42
|
-
_construct = function construct(Parent, args, Class) {
|
|
43
|
-
var a = [
|
|
44
|
-
null
|
|
45
|
-
];
|
|
46
|
-
a.push.apply(a, args);
|
|
47
|
-
var Constructor = Function.bind.apply(Parent, a);
|
|
48
|
-
var instance = new Constructor();
|
|
49
|
-
if (Class) _set_prototype_of(instance, Class.prototype);
|
|
50
|
-
return instance;
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
return _construct.apply(null, arguments);
|
|
54
|
-
}
|
|
55
|
-
function _get_prototype_of(o) {
|
|
56
|
-
_get_prototype_of = Object.setPrototypeOf ? Object.getPrototypeOf : function getPrototypeOf(o) {
|
|
57
|
-
return o.__proto__ || Object.getPrototypeOf(o);
|
|
58
|
-
};
|
|
59
|
-
return _get_prototype_of(o);
|
|
60
|
-
}
|
|
61
|
-
function _inherits(subClass, superClass) {
|
|
62
|
-
if (typeof superClass !== "function" && superClass !== null) {
|
|
63
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
64
|
-
}
|
|
65
|
-
subClass.prototype = Object.create(superClass && superClass.prototype, {
|
|
66
|
-
constructor: {
|
|
67
|
-
value: subClass,
|
|
68
|
-
writable: true,
|
|
69
|
-
configurable: true
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
if (superClass) _set_prototype_of(subClass, superClass);
|
|
73
|
-
}
|
|
74
|
-
function _is_native_function(fn) {
|
|
75
|
-
return Function.toString.call(fn).indexOf("[native code]") !== -1;
|
|
76
|
-
}
|
|
77
|
-
function _possible_constructor_return(self, call) {
|
|
78
|
-
if (call && (_type_of(call) === "object" || typeof call === "function")) {
|
|
79
|
-
return call;
|
|
80
|
-
}
|
|
81
|
-
return _assert_this_initialized(self);
|
|
82
|
-
}
|
|
83
|
-
function _set_prototype_of(o, p) {
|
|
84
|
-
_set_prototype_of = Object.setPrototypeOf || function setPrototypeOf(o, p) {
|
|
85
|
-
o.__proto__ = p;
|
|
86
|
-
return o;
|
|
87
|
-
};
|
|
88
|
-
return _set_prototype_of(o, p);
|
|
89
|
-
}
|
|
90
|
-
function _type_of(obj) {
|
|
91
|
-
"@swc/helpers - typeof";
|
|
92
|
-
return obj && typeof Symbol !== "undefined" && obj.constructor === Symbol ? "symbol" : typeof obj;
|
|
93
|
-
}
|
|
94
|
-
function _wrap_native_super(Class) {
|
|
95
|
-
var _cache = typeof Map === "function" ? new Map() : undefined;
|
|
96
|
-
_wrap_native_super = function wrapNativeSuper(Class) {
|
|
97
|
-
if (Class === null || !_is_native_function(Class)) return Class;
|
|
98
|
-
if (typeof Class !== "function") {
|
|
99
|
-
throw new TypeError("Super expression must either be null or a function");
|
|
100
|
-
}
|
|
101
|
-
if (typeof _cache !== "undefined") {
|
|
102
|
-
if (_cache.has(Class)) return _cache.get(Class);
|
|
103
|
-
_cache.set(Class, Wrapper);
|
|
104
|
-
}
|
|
105
|
-
function Wrapper() {
|
|
106
|
-
return _construct(Class, arguments, _get_prototype_of(this).constructor);
|
|
107
|
-
}
|
|
108
|
-
Wrapper.prototype = Object.create(Class.prototype, {
|
|
109
|
-
constructor: {
|
|
110
|
-
value: Wrapper,
|
|
111
|
-
enumerable: false,
|
|
112
|
-
writable: true,
|
|
113
|
-
configurable: true
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
return _set_prototype_of(Wrapper, Class);
|
|
117
|
-
};
|
|
118
|
-
return _wrap_native_super(Class);
|
|
119
|
-
}
|
|
120
|
-
function _is_native_reflect_construct() {
|
|
121
|
-
try {
|
|
122
|
-
var result = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {}));
|
|
123
|
-
} catch (_) {}
|
|
124
|
-
return (_is_native_reflect_construct = function() {
|
|
125
|
-
return !!result;
|
|
126
|
-
})();
|
|
127
|
-
}
|
|
128
|
-
var ExitError = /*#__PURE__*/ function(Error1) {
|
|
129
|
-
"use strict";
|
|
130
|
-
_inherits(ExitError, Error1);
|
|
131
|
-
function ExitError(code) {
|
|
132
|
-
_class_call_check(this, ExitError);
|
|
133
|
-
var _this;
|
|
134
|
-
_this = _call_super(this, ExitError, [
|
|
135
|
-
"exit ".concat(code)
|
|
136
|
-
]);
|
|
137
|
-
_this.code = code;
|
|
138
|
-
return _this;
|
|
139
|
-
}
|
|
140
|
-
return ExitError;
|
|
141
|
-
}(_wrap_native_super(Error));
|
|
142
|
-
function usageError(message, usage) {
|
|
143
|
-
console.error(message);
|
|
144
|
-
if (usage !== undefined) console.error(usage);
|
|
145
|
-
throw new ExitError(2);
|
|
146
|
-
}
|
|
147
|
-
/* CJS INTEROP */ if (exports.__esModule && exports.default) { try { Object.defineProperty(exports.default, '__esModule', { value: true }); for (var key in exports) { exports.default[key] = exports[key]; } } catch (_) {}; module.exports = exports.default; }
|
package/dist/cjs/cli/exit.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/exit.ts"],"sourcesContent":["// Commands never end the process themselves: they throw this, and cli.ts -- the one place\n// that owns the exit -- drains stdio through exit-compat and returns. Neither alternative\n// works here: a direct process.exit() races a pending write, and a bare return would let a\n// command body run on after --help had already printed its usage.\nexport class ExitError extends Error {\n readonly code: number;\n constructor(code: number) {\n super(`exit ${code}`);\n this.code = code;\n }\n}\n\nexport function usageError(message: string, usage?: string): never {\n console.error(message);\n if (usage !== undefined) console.error(usage);\n throw new ExitError(2);\n}\n"],"names":["ExitError","usageError","code","Error","message","usage","console","error","undefined"],"mappings":"AAAA,0FAA0F;AAC1F,0FAA0F;AAC1F,2FAA2F;AAC3F,kEAAkE;;;;;;;;;;;;QACrDA;eAAAA;;QAQGC;eAAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AART,IAAA,AAAMD,0BAAN;;cAAMA;aAAAA,UAECE,IAAY;gCAFbF;;gBAGT,kBAHSA;YAGF,QAAY,OAALE;;QACd,MAAKA,IAAI,GAAGA;;;WAJHF;qBAAkBG;AAQxB,SAASF,WAAWG,OAAe,EAAEC,KAAc;IACxDC,QAAQC,KAAK,CAACH;IACd,IAAIC,UAAUG,WAAWF,QAAQC,KAAK,CAACF;IACvC,MAAM,IAAIL,UAAU;AACtB"}
|
package/dist/esm/cli/exit.d.ts
DELETED
package/dist/esm/cli/exit.js
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
// Commands never end the process themselves: they throw this, and cli.ts -- the one place
|
|
2
|
-
// that owns the exit -- drains stdio through exit-compat and returns. Neither alternative
|
|
3
|
-
// works here: a direct process.exit() races a pending write, and a bare return would let a
|
|
4
|
-
// command body run on after --help had already printed its usage.
|
|
5
|
-
export class ExitError extends Error {
|
|
6
|
-
constructor(code){
|
|
7
|
-
super(`exit ${code}`);
|
|
8
|
-
this.code = code;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
export function usageError(message, usage) {
|
|
12
|
-
console.error(message);
|
|
13
|
-
if (usage !== undefined) console.error(usage);
|
|
14
|
-
throw new ExitError(2);
|
|
15
|
-
}
|
package/dist/esm/cli/exit.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["/Users/kevin/Dev/OpenSource/ai/sensemaking/src/cli/exit.ts"],"sourcesContent":["// Commands never end the process themselves: they throw this, and cli.ts -- the one place\n// that owns the exit -- drains stdio through exit-compat and returns. Neither alternative\n// works here: a direct process.exit() races a pending write, and a bare return would let a\n// command body run on after --help had already printed its usage.\nexport class ExitError extends Error {\n readonly code: number;\n constructor(code: number) {\n super(`exit ${code}`);\n this.code = code;\n }\n}\n\nexport function usageError(message: string, usage?: string): never {\n console.error(message);\n if (usage !== undefined) console.error(usage);\n throw new ExitError(2);\n}\n"],"names":["ExitError","Error","code","usageError","message","usage","console","error","undefined"],"mappings":"AAAA,0FAA0F;AAC1F,0FAA0F;AAC1F,2FAA2F;AAC3F,kEAAkE;AAClE,OAAO,MAAMA,kBAAkBC;IAE7B,YAAYC,IAAY,CAAE;QACxB,KAAK,CAAC,CAAC,KAAK,EAAEA,MAAM;QACpB,IAAI,CAACA,IAAI,GAAGA;IACd;AACF;AAEA,OAAO,SAASC,WAAWC,OAAe,EAAEC,KAAc;IACxDC,QAAQC,KAAK,CAACH;IACd,IAAIC,UAAUG,WAAWF,QAAQC,KAAK,CAACF;IACvC,MAAM,IAAIL,UAAU;AACtB"}
|