@riotprompt/riotprompt 0.0.1 → 0.0.3

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 (93) hide show
  1. package/README.md +54 -470
  2. package/dist/builder.d.ts +3 -3
  3. package/dist/builder.js +7 -2
  4. package/dist/builder.js.map +1 -1
  5. package/dist/chat.js.map +1 -1
  6. package/dist/constants.js.map +1 -1
  7. package/dist/formatter.js.map +1 -1
  8. package/dist/items/content.js.map +1 -1
  9. package/dist/items/context.js.map +1 -1
  10. package/dist/items/instruction.js.map +1 -1
  11. package/dist/items/parameters.js.map +1 -1
  12. package/dist/items/section.js.map +1 -1
  13. package/dist/items/trait.js.map +1 -1
  14. package/dist/items/weighted.js.map +1 -1
  15. package/dist/loader.js +1 -0
  16. package/dist/loader.js.map +1 -1
  17. package/dist/logger.js +4 -2
  18. package/dist/logger.js.map +1 -1
  19. package/dist/override.d.ts +5 -5
  20. package/dist/override.js +47 -30
  21. package/dist/override.js.map +1 -1
  22. package/dist/parse/markdown.js.map +1 -1
  23. package/dist/parse/text.js.map +1 -1
  24. package/dist/parser.js.map +1 -1
  25. package/dist/prompt.js.map +1 -1
  26. package/dist/recipes.d.ts +405 -0
  27. package/dist/recipes.js +424 -0
  28. package/dist/recipes.js.map +1 -0
  29. package/dist/riotprompt.cjs +586 -132
  30. package/dist/riotprompt.cjs.map +1 -1
  31. package/dist/riotprompt.d.ts +3 -0
  32. package/dist/riotprompt.js +3 -0
  33. package/dist/riotprompt.js.map +1 -1
  34. package/dist/util/general.js.map +1 -1
  35. package/dist/util/markdown.js.map +1 -1
  36. package/dist/util/storage.js.map +1 -1
  37. package/dist/util/text.js.map +1 -1
  38. package/package.json +35 -28
  39. package/.gitcarve/config.yaml +0 -10
  40. package/.gitcarve/context/content.md +0 -11
  41. package/.markdown-doctest-setup.mjs +0 -23
  42. package/.nvmrc +0 -1
  43. package/dist/builder.cjs +0 -152
  44. package/dist/builder.cjs.map +0 -1
  45. package/dist/chat.cjs +0 -26
  46. package/dist/chat.cjs.map +0 -1
  47. package/dist/constants.cjs +0 -34
  48. package/dist/constants.cjs.map +0 -1
  49. package/dist/formatter.cjs +0 -139
  50. package/dist/formatter.cjs.map +0 -1
  51. package/dist/items/content.cjs +0 -14
  52. package/dist/items/content.cjs.map +0 -1
  53. package/dist/items/context.cjs +0 -13
  54. package/dist/items/context.cjs.map +0 -1
  55. package/dist/items/instruction.cjs +0 -13
  56. package/dist/items/instruction.cjs.map +0 -1
  57. package/dist/items/parameters.cjs +0 -53
  58. package/dist/items/parameters.cjs.map +0 -1
  59. package/dist/items/section.cjs +0 -120
  60. package/dist/items/section.cjs.map +0 -1
  61. package/dist/items/trait.cjs +0 -13
  62. package/dist/items/trait.cjs.map +0 -1
  63. package/dist/items/weighted.cjs +0 -27
  64. package/dist/items/weighted.cjs.map +0 -1
  65. package/dist/loader.cjs +0 -167
  66. package/dist/loader.cjs.map +0 -1
  67. package/dist/logger.cjs +0 -51
  68. package/dist/logger.cjs.map +0 -1
  69. package/dist/override.cjs +0 -109
  70. package/dist/override.cjs.map +0 -1
  71. package/dist/parse/markdown.cjs +0 -114
  72. package/dist/parse/markdown.cjs.map +0 -1
  73. package/dist/parse/text.cjs +0 -33
  74. package/dist/parse/text.cjs.map +0 -1
  75. package/dist/parser.cjs +0 -99
  76. package/dist/parser.cjs.map +0 -1
  77. package/dist/prompt.cjs +0 -15
  78. package/dist/prompt.cjs.map +0 -1
  79. package/dist/util/general.cjs +0 -52
  80. package/dist/util/general.cjs.map +0 -1
  81. package/dist/util/markdown.cjs +0 -115
  82. package/dist/util/markdown.cjs.map +0 -1
  83. package/dist/util/storage.cjs +0 -155
  84. package/dist/util/storage.cjs.map +0 -1
  85. package/dist/util/text.cjs +0 -42
  86. package/dist/util/text.cjs.map +0 -1
  87. package/docs/loader.md +0 -237
  88. package/docs/override.md +0 -323
  89. package/docs/parser.md +0 -130
  90. package/eslint.config.mjs +0 -82
  91. package/nodemon.json +0 -14
  92. package/vite.config.ts +0 -114
  93. package/vitest.config.ts +0 -25
package/dist/parser.cjs DELETED
@@ -1,99 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const fs = require('fs/promises');
6
- const path = require('path');
7
- const zod = require('zod');
8
- const parameters = require('./items/parameters.cjs');
9
- const section = require('./items/section.cjs');
10
- const logger = require('./logger.cjs');
11
- const markdown$1 = require('./parse/markdown.cjs');
12
- const text$1 = require('./parse/text.cjs');
13
- const markdown = require('./util/markdown.cjs');
14
- const text = require('./util/text.cjs');
15
-
16
- function _interopNamespaceDefault(e) {
17
- const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
18
- if (e) {
19
- for (const k in e) {
20
- if (k !== 'default') {
21
- const d = Object.getOwnPropertyDescriptor(e, k);
22
- Object.defineProperty(n, k, d.get ? d : {
23
- enumerable: true,
24
- get: () => e[k]
25
- });
26
- }
27
- }
28
- }
29
- n.default = e;
30
- return Object.freeze(n);
31
- }
32
-
33
- const fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
34
- const path__namespace = /*#__PURE__*/_interopNamespaceDefault(path);
35
-
36
- const OptionsSchema = zod.z.object({
37
- logger: zod.z.any().optional().default(logger.DEFAULT_LOGGER),
38
- parameters: parameters.ParametersSchema.optional().default({})
39
- });
40
- const create = (parserOptions)=>{
41
- const options = OptionsSchema.parse(parserOptions || {});
42
- const parameters = options.parameters;
43
- const logger$1 = logger.wrapLogger(options.logger, 'Parser');
44
- const loadOptions = (sectionOptions = {})=>{
45
- const currentOptions = section.SectionOptionsSchema.parse(sectionOptions);
46
- return {
47
- ...currentOptions,
48
- parameters: {
49
- ...parameters,
50
- ...currentOptions.parameters
51
- }
52
- };
53
- };
54
- const parseFile = async (filePath, options = {})=>{
55
- const currentOptions = loadOptions(options);
56
- try {
57
- const content = await fs__namespace.readFile(filePath, 'utf-8');
58
- // Only use the filename as title if no title was explicitly provided
59
- const fileName = path__namespace.basename(filePath, path__namespace.extname(filePath));
60
- return parse(content, {
61
- ...currentOptions,
62
- title: (currentOptions === null || currentOptions === void 0 ? void 0 : currentOptions.title) || fileName
63
- });
64
- } catch (error) {
65
- // Log the error or handle it appropriately
66
- logger$1.error(`Error reading or parsing file with marked at ${filePath}:`, error);
67
- throw new Error(`Failed to parse instructions from ${filePath}: ${error instanceof Error ? error.message : String(error)}`);
68
- }
69
- };
70
- /**
71
- * Reads Markdown content and parses it into a single Section.
72
- *
73
- * - If the content starts with a heading, that becomes the title of the returned Section
74
- * - If no heading at the start, creates a Section with no title
75
- * - Headers within the content create nested sections based on their depth
76
- * - All content is organized in a hierarchical structure based on heading levels
77
- *
78
- * @param content The content to parse
79
- * @returns A Section containing all content in a hierarchical structure
80
- */ const parse = (content, options = {})=>{
81
- const currentOptions = loadOptions(options);
82
- let mainSection;
83
- if (markdown.isMarkdown(content)) {
84
- mainSection = markdown$1.parseMarkdown(content, currentOptions);
85
- } else if (text.isText(content)) {
86
- mainSection = text$1.parseText(content, currentOptions);
87
- } else {
88
- throw new Error(`Unsupported content supplied to parse, riotprompt currently only supports markdown and text`);
89
- }
90
- return mainSection;
91
- };
92
- return {
93
- parse,
94
- parseFile
95
- };
96
- };
97
-
98
- exports.create = create;
99
- //# sourceMappingURL=parser.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"parser.cjs","sources":["../src/parser.ts"],"sourcesContent":["import * as fs from 'fs/promises';\nimport * as path from 'path';\nimport { z } from 'zod';\nimport { ParametersSchema } from './items/parameters';\nimport { Section, SectionOptions, SectionOptionsSchema } from './items/section';\nimport { Weighted } from './items/weighted';\nimport { DEFAULT_LOGGER, wrapLogger } from './logger';\nimport { parseMarkdown } from './parse/markdown';\nimport { parseText } from './parse/text';\nimport { isMarkdown } from './util/markdown';\nimport { isText } from './util/text';\n\nconst OptionsSchema = z.object({\n logger: z.any().optional().default(DEFAULT_LOGGER),\n parameters: ParametersSchema.optional().default({}),\n});\n\nexport type Options = z.infer<typeof OptionsSchema>;\n\nexport type OptionsParam = Partial<Options>;\n\nexport interface Instance {\n parse: <T extends Weighted>(input: string | Buffer, options?: SectionOptions) => Section<T>;\n parseFile: <T extends Weighted>(filePath: string, options?: SectionOptions) => Promise<Section<T>>;\n}\n\nexport const create = (parserOptions?: OptionsParam): Instance => {\n const options: Required<Options> = OptionsSchema.parse(parserOptions || {}) as Required<Options>;\n const parameters = options.parameters;\n\n const logger = wrapLogger(options.logger, 'Parser');\n\n const loadOptions = (sectionOptions: Partial<SectionOptions> = {}): SectionOptions => {\n const currentOptions = SectionOptionsSchema.parse(sectionOptions);\n return {\n ...currentOptions,\n parameters: {\n ...parameters,\n ...currentOptions.parameters\n }\n }\n }\n\n const parseFile = async <T extends Weighted>(\n filePath: string,\n options: Partial<SectionOptions> = {}\n ): Promise<Section<T>> => {\n const currentOptions = loadOptions(options);\n try {\n const content = await fs.readFile(filePath, 'utf-8');\n // Only use the filename as title if no title was explicitly provided\n const fileName = path.basename(filePath, path.extname(filePath));\n return parse(content, {\n ...currentOptions,\n title: currentOptions?.title || fileName\n });\n } catch (error) {\n // Log the error or handle it appropriately\n logger.error(`Error reading or parsing file with marked at ${filePath}:`, error);\n throw new Error(`Failed to parse instructions from ${filePath}: ${error instanceof Error ? error.message : String(error)}`);\n }\n }\n\n /**\n * Reads Markdown content and parses it into a single Section.\n * \n * - If the content starts with a heading, that becomes the title of the returned Section\n * - If no heading at the start, creates a Section with no title\n * - Headers within the content create nested sections based on their depth\n * - All content is organized in a hierarchical structure based on heading levels\n *\n * @param content The content to parse\n * @returns A Section containing all content in a hierarchical structure\n */\n const parse = <T extends Weighted>(\n content: string | Buffer,\n options: Partial<SectionOptions> = {}\n ): Section<T> => {\n const currentOptions = loadOptions(options);\n\n let mainSection: Section<T>;\n if (isMarkdown(content)) {\n mainSection = parseMarkdown<T>(content, currentOptions);\n } else if (isText(content)) {\n mainSection = parseText<T>(content, currentOptions);\n } else {\n throw new Error(`Unsupported content supplied to parse, riotprompt currently only supports markdown and text`);\n }\n return mainSection;\n }\n\n return {\n parse,\n parseFile\n }\n}"],"names":["OptionsSchema","z","object","logger","any","optional","default","DEFAULT_LOGGER","parameters","ParametersSchema","create","parserOptions","options","parse","wrapLogger","loadOptions","sectionOptions","currentOptions","SectionOptionsSchema","parseFile","filePath","content","fs","readFile","fileName","path","basename","extname","title","error","Error","message","String","mainSection","isMarkdown","parseMarkdown","isText","parseText"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAYA,MAAMA,aAAAA,GAAgBC,KAAEC,CAAAA,MAAM,CAAC;AAC3BC,IAAAA,MAAAA,EAAQF,MAAEG,GAAG,EAAA,CAAGC,QAAQ,EAAA,CAAGC,OAAO,CAACC,qBAAAA,CAAAA;AACnCC,IAAAA,UAAAA,EAAYC,2BAAiBJ,CAAAA,QAAQ,EAAGC,CAAAA,OAAO,CAAC,EAAC;AACrD,CAAA,CAAA;AAWO,MAAMI,SAAS,CAACC,aAAAA,GAAAA;AACnB,IAAA,MAAMC,OAA6BZ,GAAAA,aAAAA,CAAca,KAAK,CAACF,iBAAiB,EAAC,CAAA;IACzE,MAAMH,UAAAA,GAAaI,QAAQJ,UAAU;AAErC,IAAA,MAAML,QAASW,GAAAA,iBAAAA,CAAWF,OAAQT,CAAAA,MAAM,EAAE,QAAA,CAAA;AAE1C,IAAA,MAAMY,WAAc,GAAA,CAACC,cAA0C,GAAA,EAAE,GAAA;QAC7D,MAAMC,cAAAA,GAAiBC,4BAAqBL,CAAAA,KAAK,CAACG,cAAAA,CAAAA;QAClD,OAAO;AACH,YAAA,GAAGC,cAAc;YACjBT,UAAY,EAAA;AACR,gBAAA,GAAGA,UAAU;AACb,gBAAA,GAAGS,eAAeT;AACtB;AACJ,SAAA;AACJ,KAAA;AAEA,IAAA,MAAMW,SAAY,GAAA,OACdC,QACAR,EAAAA,OAAAA,GAAmC,EAAE,GAAA;AAErC,QAAA,MAAMK,iBAAiBF,WAAYH,CAAAA,O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AAA,MAAM,IAAIa,KAAAA,CAAM,CAAC,2FAA2F,CAAC,CAAA;AACjH;QACA,OAAOG,WAAAA;AACX,KAAA;IAEA,OAAO;AACHpB,QAAAA,KAAAA;AACAM,QAAAA;AACJ,KAAA;AACJ;;;;"}
package/dist/prompt.cjs DELETED
@@ -1,15 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const create = ({ persona, instructions, contents, contexts })=>{
6
- return {
7
- persona,
8
- instructions,
9
- contents,
10
- contexts
11
- };
12
- };
13
-
14
- exports.create = create;
15
- //# sourceMappingURL=prompt.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"prompt.cjs","sources":["../src/prompt.ts"],"sourcesContent":["import { Content } from \"./items/content\";\nimport { Context } from \"./items/context\";\nimport { Instruction } from \"./items/instruction\";\nimport { Section } from \"./items/section\";\n\nexport interface Prompt {\n persona?: Section<Instruction>;\n instructions: Section<Instruction>;\n contents?: Section<Content>;\n contexts?: Section<Context>;\n}\n\nexport const create = ({\n persona,\n instructions,\n contents,\n contexts,\n}: {\n persona?: Section<Instruction>,\n instructions: Section<Instruction>,\n contents?: Section<Content>,\n contexts?: Section<Context>\n}): Prompt => {\n\n return {\n persona,\n instructions,\n contents,\n contexts,\n }\n}"],"names":["create","persona","instructions","contents","contexts"],"mappings":";;;;AAYO,MAAMA,MAAS,GAAA,CAAC,EACnBC,OAAO,EACPC,YAAY,EACZC,QAAQ,EACRC,QAAQ,EAMX,GAAA;IAEG,OAAO;AACHH,QAAAA,OAAAA;AACAC,QAAAA,YAAAA;AACAC,QAAAA,QAAAA;AACAC,QAAAA;AACJ,KAAA;AACJ;;;;"}
@@ -1,52 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const clean = (obj)=>{
6
- return Object.fromEntries(Object.entries(obj).filter(([_, v])=>v !== undefined));
7
- };
8
- //Recursive implementation of jSON.stringify;
9
- const stringifyJSON = function(obj, visited = new Set()) {
10
- const arrOfKeyVals = [];
11
- const arrVals = [];
12
- let objKeys = [];
13
- /*********CHECK FOR PRIMITIVE TYPES**********/ if (typeof obj === 'number' || typeof obj === 'boolean' || obj === null) return '' + obj;
14
- else if (typeof obj === 'string') return '"' + obj + '"';
15
- /*********DETECT CIRCULAR REFERENCES**********/ if (obj instanceof Object && visited.has(obj)) {
16
- return '"(circular)"';
17
- } else if (Array.isArray(obj)) {
18
- //check for empty array
19
- if (obj[0] === undefined) return '[]';
20
- else {
21
- // Add array to visited before processing its elements
22
- visited.add(obj);
23
- obj.forEach(function(el) {
24
- arrVals.push(stringifyJSON(el, visited));
25
- });
26
- return '[' + arrVals + ']';
27
- }
28
- } else if (obj instanceof Object) {
29
- // Add object to visited before processing its properties
30
- visited.add(obj);
31
- //get object keys
32
- objKeys = Object.keys(obj);
33
- //set key output;
34
- objKeys.forEach(function(key) {
35
- const keyOut = '"' + key + '":';
36
- const keyValOut = obj[key];
37
- //skip functions and undefined properties
38
- if (keyValOut instanceof Function || keyValOut === undefined) return; // Skip this entry entirely instead of pushing an empty string
39
- else if (typeof keyValOut === 'string') arrOfKeyVals.push(keyOut + '"' + keyValOut + '"');
40
- else if (typeof keyValOut === 'boolean' || typeof keyValOut === 'number' || keyValOut === null) arrOfKeyVals.push(keyOut + keyValOut);
41
- else if (keyValOut instanceof Object) {
42
- arrOfKeyVals.push(keyOut + stringifyJSON(keyValOut, visited));
43
- }
44
- });
45
- return '{' + arrOfKeyVals + '}';
46
- }
47
- return '';
48
- };
49
-
50
- exports.clean = clean;
51
- exports.stringifyJSON = stringifyJSON;
52
- //# sourceMappingURL=general.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"general.cjs","sources":["../../src/util/general.ts"],"sourcesContent":["export const clean = (obj: any) => {\n return Object.fromEntries(\n Object.entries(obj).filter(([_, v]) => v !== undefined)\n );\n}\n\n//Recursive implementation of jSON.stringify;\nexport const stringifyJSON = function (obj: any, visited: Set<any> = new Set()): string {\n const arrOfKeyVals: string[] = [];\n const arrVals: string[] = [];\n let objKeys: string[] = [];\n\n /*********CHECK FOR PRIMITIVE TYPES**********/\n if (typeof obj === 'number' || typeof obj === 'boolean' || obj === null)\n return '' + obj;\n else if (typeof obj === 'string')\n return '\"' + obj + '\"';\n\n /*********DETECT CIRCULAR REFERENCES**********/\n if (obj instanceof Object && visited.has(obj)) {\n return '\"(circular)\"';\n }\n\n /*********CHECK FOR ARRAY**********/\n else if (Array.isArray(obj)) {\n //check for empty array\n if (obj[0] === undefined)\n return '[]';\n else {\n // Add array to visited before processing its elements\n visited.add(obj);\n obj.forEach(function (el) {\n arrVals.push(stringifyJSON(el, visited));\n });\n return '[' + arrVals + ']';\n }\n }\n /*********CHECK FOR OBJECT**********/\n else if (obj instanceof Object) {\n // Add object to visited before processing its properties\n visited.add(obj);\n //get object keys\n objKeys = Object.keys(obj);\n //set key output;\n objKeys.forEach(function (key) {\n const keyOut = '\"' + key + '\":';\n const keyValOut = obj[key];\n //skip functions and undefined properties\n if (keyValOut instanceof Function || keyValOut === undefined)\n return; // Skip this entry entirely instead of pushing an empty string\n else if (typeof keyValOut === 'string')\n arrOfKeyVals.push(keyOut + '\"' + keyValOut + '\"');\n else if (typeof keyValOut === 'boolean' || typeof keyValOut === 'number' || keyValOut === null)\n arrOfKeyVals.push(keyOut + keyValOut);\n //check for nested objects, call recursively until no more objects\n else if (keyValOut instanceof Object) {\n arrOfKeyVals.push(keyOut + stringifyJSON(keyValOut, visited));\n }\n });\n return '{' + arrOfKeyVals + '}';\n }\n return '';\n};"],"names":["clean","obj","Object","fromEntries","entries","filter","_","v","undefined","stringifyJSON","visited","Set","arrOfKeyVals","arrVals","objKeys","has","Array","isArray","add","forEach","el","push","keys","key","keyOut","keyValOut","Function"],"mappings":";;;;AAAO,MAAMA,QAAQ,CAACC,GAAAA,GAAAA;AAClB,IAAA,OAAOC,MAAOC,CAAAA,WAAW,CACrBD,MAAAA,CA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CAAAA;;QAEtBa,OAAQK,CAAAA,OAAO,CAAC,SAAUI,GAAG,EAAA;YACzB,MAAMC,MAAAA,GAAS,MAAMD,GAAM,GAAA,IAAA;YAC3B,MAAME,SAAAA,GAAYxB,GAAG,CAACsB,GAAI,CAAA;;AAE1B,YAAA,IAAIE,SAAqBC,YAAAA,QAAAA,IAAYD,SAAcjB,KAAAA,SAAAA,EAC/C;iBACC,IAAI,OAAOiB,cAAc,QAC1Bb,EAAAA,YAAAA,CAAaS,IAAI,CAACG,MAAAA,GAAS,MAAMC,SAAY,GAAA,GAAA,CAAA;iBAC5C,IAAI,OAAOA,SAAc,KAAA,SAAA,IAAa,OAAOA,SAAAA,KAAc,QAAYA,IAAAA,SAAAA,KAAc,IACtFb,EAAAA,YAAAA,CAAaS,IAAI,CAACG,MAASC,GAAAA,SAAAA,CAAAA;AAE1B,iBAAA,IAAIA,qBAAqBvB,MAAQ,EAAA;AAClCU,gBAAAA,YAAAA,CAAaS,IAAI,CAACG,MAASf,GAAAA,aAAAA,CAAcgB,SAAWf,EAAAA,OAAAA,CAAAA,CAAAA;AACxD;AACJ,SAAA,CAAA;AACA,QAAA,OAAO,MAAME,YAAe,GAAA,GAAA;AAChC;IACA,OAAO,EAAA;AACX;;;;;"}
@@ -1,115 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const constants = require('../constants.cjs');
6
-
7
- // Heuristic to check for Markdown syntax. This is not a full parser.
8
- // It looks for common Markdown patterns.
9
- const markdownRegex = /^(#+\s|\*\s|-\s|\+\s|>\s|\[.*\]\(.*\)|```|~~~|---\\s*$)/m;
10
- /**
11
- * Inspects a string to see if it likely contains Markdown syntax.
12
- *
13
- * @param input The string or Buffer content to inspect.
14
- * @returns True if Markdown syntax is suspected, false otherwise.
15
- */ function isMarkdown(input) {
16
- if (input == null) {
17
- return false;
18
- }
19
- // Convert Buffer to string if necessary
20
- const content = typeof input === 'string' ? input : input.toString(constants.DEFAULT_CHARACTER_ENCODING);
21
- if (!content || content.trim() === '') {
22
- return false; // Empty string is not considered Markdown
23
- }
24
- // Check for common Markdown patterns in the entire content
25
- if (markdownRegex.test(content)) {
26
- return true;
27
- }
28
- // Fallback: Check for a high prevalence of Markdown-like list/header starters
29
- // or thematic breaks, or code blocks.
30
- // We'll consider up to the first ~2000 characters, roughly equivalent to the byte check.
31
- const effectiveContent = content.length > 2000 ? content.substring(0, 2000) : content;
32
- const lines = effectiveContent.split('\n');
33
- let markdownFeatureCount = 0;
34
- const featurePatterns = [
35
- /^#+\s+.+/,
36
- /^\s*[*+-]\s+.+/,
37
- /^\s*>\s+.+/,
38
- /\[.+\]\(.+\)/,
39
- /!\[.+\]\(.+\)/,
40
- /`{1,3}[^`]+`{1,3}/,
41
- /^\s*_{3,}\s*$/,
42
- /^\s*-{3,}\s*$/,
43
- /^\s*\*{3,}\s*$/
44
- ];
45
- for (const line of lines){
46
- // Stop checking if we have already found enough features to be confident.
47
- // This is a small optimization for very long inputs that are clearly markdown early on.
48
- if (markdownFeatureCount >= 2 && lines.length > 10) {
49
- const significantLineCountEarly = Math.min(lines.indexOf(line) + 1, 20);
50
- if (significantLineCountEarly > 0 && markdownFeatureCount / significantLineCountEarly > 0.1) {
51
- return true;
52
- }
53
- }
54
- for (const pattern of featurePatterns){
55
- if (pattern.test(line.trim())) {
56
- markdownFeatureCount++;
57
- break; // Count each line only once
58
- }
59
- }
60
- }
61
- // If more than 5% of the first few lines (up to 20 lines or all lines if fewer)
62
- // show markdown features, or if there are at least 2 distinct features in short texts,
63
- // consider it Markdown.
64
- const significantLineCount = Math.min(lines.length, 20);
65
- if (significantLineCount > 0) {
66
- // Calculate the exact threshold percentage
67
- const thresholdPercentage = markdownFeatureCount / significantLineCount;
68
- // Check against the 5% threshold (0.05)
69
- // Using >= 0.05 exactly matches 5%, > 0.05 requires more than 5%
70
- if (thresholdPercentage >= 0.05 + 0.0001) {
71
- return true;
72
- }
73
- // Other conditions for returning true
74
- if (markdownFeatureCount >= 1 && significantLineCount <= 5 || markdownFeatureCount >= 2) {
75
- return true;
76
- }
77
- }
78
- return false;
79
- } // Example usage (optional, for testing):
80
- // function testIsMarkdownString() {
81
- // console.log('--- Testing isMarkdownString ---');
82
- // const markdown1 = '# Hello World\\nThis is a test.';
83
- // console.log(`Test 1 (Header): "${markdown1.substring(0,10)}..." -> ${isMarkdownString(markdown1)}`); // true
84
- // const markdown2 = '* Item 1\\n* Item 2';
85
- // console.log(`Test 2 (List): "${markdown2.substring(0,10)}..." -> ${isMarkdownString(markdown2)}`); // true
86
- // const markdown3 = '[Google](https://google.com)';
87
- // console.log(`Test 3 (Link): "${markdown3.substring(0,15)}..." -> ${isMarkdownString(markdown3)}`); // true
88
- // const markdown4 = '> This is a quote.';
89
- // console.log(`Test 4 (Blockquote): "${markdown4.substring(0,10)}..." -> ${isMarkdownString(markdown4)}`); // true
90
- // const markdown5 = '```javascript\\nconsole.log("hello");\\n```';
91
- // console.log(`Test 5 (Code block): "${markdown5.substring(0,15)}..." -> ${isMarkdownString(markdown5)}`); // true
92
- // const text1 = 'This is a plain text string.';
93
- // console.log(`Test 6 (Plain text): "${text1.substring(0,10)}..." -> ${isMarkdownString(text1)}`); // false
94
- // const text2 = 'hello_world.this_is_a_test_string_with_underscores_but_not_markdown_thematic_break';
95
- // console.log(`Test 7 (Long non-markdown): "${text2.substring(0,10)}..." -> ${isMarkdownString(text2)}`); // false
96
- // const text3 = '<xml><tag>value</tag></xml>';
97
- // console.log(`Test 8 (XML): "${text3.substring(0,10)}..." -> ${isMarkdownString(text3)}`); // false
98
- // const shortMarkdown = '# H';
99
- // console.log(`Test 9 (Short Markdown): "${shortMarkdown}" -> ${isMarkdownString(shortMarkdown)}`); // true
100
- // const shortNonMarkdown = 'Hello';
101
- // console.log(`Test 10 (Short Non-Markdown): "${shortNonMarkdown}" -> ${isMarkdownString(shortNonMarkdown)}`); // false
102
- // const emptyString = '';
103
- // console.log(`Test 11 (Empty string): "" -> ${isMarkdownString(emptyString)}`); // false
104
- // const whitespaceString = ' \t \n ';
105
- // console.log(`Test 12 (Whitespace string): "${whitespaceString.substring(0,5)}..." -> ${isMarkdownString(whitespaceString)}`); // false
106
- // const markdownWithManyFeatures = `# Title\\n\\n* list\\n* list2\\n\\n> quote here\\n\\n\`\`\`\\ncode\\n\`\`\`\\n\\nnormal text paragraph with a [link](url).\n---\nAnother paragraph.\nThis is just a test string to see how it performs with multiple markdown features present.\nHello world this is a very long line that does not contain any markdown syntax at all, it is just plain text that goes on and on.\n* Another list item\n* And another one\n# Another Header\n## Subheader\nThis is fun.\nOkay I think this is enough.\nFinal line.\nAnother final line.\nOne more for good measure.\nOkay that should be enough lines to test the early exit.\n`;
107
- // console.log(`Test 13 (Many Features): "${markdownWithManyFeatures.substring(0,10)}..." -> ${isMarkdownString(markdownWithManyFeatures)}`); // true
108
- // const htmlLike = '<div><p>Hello</p><ul><li>item</li></ul></div>';
109
- // console.log(`Test 14 (HTML-like): "${htmlLike.substring(0,10)}..." -> ${isMarkdownString(htmlLike)}`); // false
110
- // console.log('--- End Testing ---');
111
- // }
112
- // testIsMarkdownString();
113
-
114
- exports.isMarkdown = isMarkdown;
115
- //# sourceMappingURL=markdown.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markdown.cjs","sources":["../../src/util/markdown.ts"],"sourcesContent":["import { DEFAULT_CHARACTER_ENCODING } from \"../constants\";\n\n// Heuristic to check for Markdown syntax. This is not a full parser.\n// It looks for common Markdown patterns.\nconst markdownRegex = /^(#+\\s|\\*\\s|-\\s|\\+\\s|>\\s|\\[.*\\]\\(.*\\)|```|~~~|---\\\\s*$)/m;\n\n/**\n * Inspects a string to see if it likely contains Markdown syntax.\n *\n * @param input The string or Buffer content to inspect.\n * @returns True if Markdown syntax is suspected, false otherwise.\n */\nexport function isMarkdown(input: string | Buffer): boolean {\n if (input == null) {\n return false;\n }\n // Convert Buffer to string if necessary\n const content = typeof input === 'string' ? input : input.toString(DEFAULT_CHARACTER_ENCODING);\n if (!content || content.trim() === '') {\n return false; // Empty string is not considered Markdown\n }\n\n // Check for common Markdown patterns in the entire content\n if (markdownRegex.test(content)) {\n return true;\n }\n\n // Fallback: Check for a high prevalence of Markdown-like list/header starters\n // or thematic breaks, or code blocks.\n // We'll consider up to the first ~2000 characters, roughly equivalent to the byte check.\n const effectiveContent = content.length > 2000 ? content.substring(0, 2000) : content;\n const lines = effectiveContent.split('\\n');\n let markdownFeatureCount = 0;\n const featurePatterns = [\n /^#+\\s+.+/, // Headers (e.g., # Heading)\n /^\\s*[*+-]\\s+.+/, // List items (e.g., * item, - item, + item)\n /^\\s*>\\s+.+/, // Blockquotes (e.g., > quote)\n /\\[.+\\]\\(.+\\)/, // Links (e.g., [text](url))\n /!\\[.+\\]\\(.+\\)/, // Images (e.g., ![alt](src))\n /`{1,3}[^`]+`{1,3}/, // Inline code (e.g., `code`) or code blocks (```code```)\n /^\\s*_{3,}\\s*$/, // Thematic breaks (e.g., ---, ***, ___)\n /^\\s*-{3,}\\s*$/,\n /^\\s*\\*{3,}\\s*$/\n ];\n\n for (const line of lines) {\n // Stop checking if we have already found enough features to be confident.\n // This is a small optimization for very long inputs that are clearly markdown early on.\n if (markdownFeatureCount >= 2 && lines.length > 10) { // Heuristic threshold\n const significantLineCountEarly = Math.min(lines.indexOf(line) + 1, 20);\n if (significantLineCountEarly > 0 && markdownFeatureCount / significantLineCountEarly > 0.1) {\n return true;\n }\n }\n\n for (const pattern of featurePatterns) {\n if (pattern.test(line.trim())) {\n markdownFeatureCount++;\n break; // Count each line only once\n }\n }\n }\n\n // If more than 5% of the first few lines (up to 20 lines or all lines if fewer)\n // show markdown features, or if there are at least 2 distinct features in short texts,\n // consider it Markdown.\n const significantLineCount = Math.min(lines.length, 20);\n if (significantLineCount > 0) {\n // Calculate the exact threshold percentage\n const thresholdPercentage = markdownFeatureCount / significantLineCount;\n\n // Check against the 5% threshold (0.05)\n // Using >= 0.05 exactly matches 5%, > 0.05 requires more than 5%\n if (thresholdPercentage >= 0.05 + 0.0001) { // Adding a small epsilon to ensure exactly 5% passes but just below fails\n return true;\n }\n\n // Other conditions for returning true\n if ((markdownFeatureCount >= 1 && significantLineCount <= 5) || markdownFeatureCount >= 2) {\n return true;\n }\n }\n\n return false;\n}\n\n// Example usage (optional, for testing):\n// function testIsMarkdownString() {\n// console.log('--- Testing isMarkdownString ---');\n// const markdown1 = '# Hello World\\\\nThis is a test.';\n// console.log(`Test 1 (Header): \"${markdown1.substring(0,10)}...\" -> ${isMarkdownString(markdown1)}`); // true\n\n// const markdown2 = '* Item 1\\\\n* Item 2';\n// console.log(`Test 2 (List): \"${markdown2.substring(0,10)}...\" -> ${isMarkdownString(markdown2)}`); // true\n\n// const markdown3 = '[Google](https://google.com)';\n// console.log(`Test 3 (Link): \"${markdown3.substring(0,15)}...\" -> ${isMarkdownString(markdown3)}`); // true\n\n// const markdown4 = '> This is a quote.';\n// console.log(`Test 4 (Blockquote): \"${markdown4.substring(0,10)}...\" -> ${isMarkdownString(markdown4)}`); // true\n\n// const markdown5 = '```javascript\\\\nconsole.log(\"hello\");\\\\n```';\n// console.log(`Test 5 (Code block): \"${markdown5.substring(0,15)}...\" -> ${isMarkdownString(markdown5)}`); // true\n\n// const text1 = 'This is a plain text string.';\n// console.log(`Test 6 (Plain text): \"${text1.substring(0,10)}...\" -> ${isMarkdownString(text1)}`); // false\n\n// const text2 = 'hello_world.this_is_a_test_string_with_underscores_but_not_markdown_thematic_break';\n// console.log(`Test 7 (Long non-markdown): \"${text2.substring(0,10)}...\" -> ${isMarkdownString(text2)}`); // false\n\n// const text3 = '<xml><tag>value</tag></xml>';\n// console.log(`Test 8 (XML): \"${text3.substring(0,10)}...\" -> ${isMarkdownString(text3)}`); // false\n\n// const shortMarkdown = '# H';\n// console.log(`Test 9 (Short Markdown): \"${shortMarkdown}\" -> ${isMarkdownString(shortMarkdown)}`); // true\n\n// const shortNonMarkdown = 'Hello';\n// console.log(`Test 10 (Short Non-Markdown): \"${shortNonMarkdown}\" -> ${isMarkdownString(shortNonMarkdown)}`); // false\n\n// const emptyString = '';\n// console.log(`Test 11 (Empty string): \"\" -> ${isMarkdownString(emptyString)}`); // false\n\n// const whitespaceString = ' \\t \\n ';\n// console.log(`Test 12 (Whitespace string): \"${whitespaceString.substring(0,5)}...\" -> ${isMarkdownString(whitespaceString)}`); // false\n\n// const markdownWithManyFeatures = `# Title\\\\n\\\\n* list\\\\n* list2\\\\n\\\\n> quote here\\\\n\\\\n\\`\\`\\`\\\\ncode\\\\n\\`\\`\\`\\\\n\\\\nnormal text paragraph with a [link](url).\\n---\\nAnother paragraph.\\nThis is just a test string to see how it performs with multiple markdown features present.\\nHello world this is a very long line that does not contain any markdown syntax at all, it is just plain text that goes on and on.\\n* Another list item\\n* And another one\\n# Another Header\\n## Subheader\\nThis is fun.\\nOkay I think this is enough.\\nFinal line.\\nAnother final line.\\nOne more for good measure.\\nOkay that should be enough lines to test the early exit.\\n`;\n// console.log(`Test 13 (Many Features): \"${markdownWithManyFeatures.substring(0,10)}...\" -> ${isMarkdownString(markdownWithManyFeatures)}`); // true\n\n// const htmlLike = '<div><p>Hello</p><ul><li>item</li></ul></div>';\n// console.log(`Test 14 (HTML-like): \"${htmlLike.substring(0,10)}...\" -> ${isMarkdownString(htmlLike)}`); // false\n\n// console.log('--- End Testing ---');\n// }\n\n// testIsMarkdownString();\n"],"names":["markdownRegex","isMarkdown","input","content","toString","DEFAULT_CHARACTER_ENCODING","trim","test","effectiveContent","length","substring","lines","split","markdownFeatureCount","featurePatterns","line","significantLineCountEarly","Math","min","indexOf","pattern","significantLineCount","thresholdPercentage"],"mappings":";;;;;;AAEA;AACA;AACA,MAAMA,aAAgB,GAAA,0DAAA;AAEtB;;;;;IAMO,SAASC,UAAAA,CAAWC,KAAsB,EAAA;AAC7C,IAAA,IAAIA,SAAS,IAAM,EAAA;QACf,OAAO,KAAA;AACX;;AAEA,IAAA,MAAMC,UAAU,OAAOD,KAAAA,KAAU,WAAWA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,MAAMQ,uBAAuBJ,IAAKC,CAAAA,GAAG,CAACP,KAAAA,CAAMF,MAAM,EAAE,EAAA,CAAA;AACpD,IAAA,IAAIY,uBAAuB,CAAG,EAAA;;AAE1B,QAAA,MAAMC,sBAAsBT,oBAAuBQ,GAAAA,oBAAAA;;;QAInD,IAAIC,mBAAAA,IAAuB,OAAO,MAAQ,EAAA;YACtC,OAAO,IAAA;AACX;;AAGA,QAAA,IAAI,oBAAyB,IAAA,CAAA,IAAKD,oBAAwB,IAAA,CAAA,IAAMR,wBAAwB,CAAG,EAAA;YACvF,OAAO,IAAA;AACX;AACJ;IAEA,OAAO,KAAA;AACX,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -1,155 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const fs = require('fs');
6
- const glob = require('glob');
7
- const path = require('path');
8
- const crypto = require('crypto');
9
-
10
- function _interopNamespaceDefault(e) {
11
- const n = Object.create(null, { [Symbol.toStringTag]: { value: 'Module' } });
12
- if (e) {
13
- for (const k in e) {
14
- if (k !== 'default') {
15
- const d = Object.getOwnPropertyDescriptor(e, k);
16
- Object.defineProperty(n, k, d.get ? d : {
17
- enumerable: true,
18
- get: () => e[k]
19
- });
20
- }
21
- }
22
- }
23
- n.default = e;
24
- return Object.freeze(n);
25
- }
26
-
27
- const fs__namespace = /*#__PURE__*/_interopNamespaceDefault(fs);
28
-
29
- // eslint-disable-next-line no-restricted-imports
30
- const create = (params)=>{
31
- // eslint-disable-next-line no-console
32
- const log = params.log || console.log;
33
- const exists = async (path)=>{
34
- try {
35
- await fs__namespace.promises.stat(path);
36
- return true;
37
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
38
- } catch (error) {
39
- return false;
40
- }
41
- };
42
- const isDirectory = async (path)=>{
43
- const stats = await fs__namespace.promises.stat(path);
44
- if (!stats.isDirectory()) {
45
- log(`${path} is not a directory`);
46
- return false;
47
- }
48
- return true;
49
- };
50
- const isFile = async (path)=>{
51
- const stats = await fs__namespace.promises.stat(path);
52
- if (!stats.isFile()) {
53
- log(`${path} is not a file`);
54
- return false;
55
- }
56
- return true;
57
- };
58
- const isReadable = async (path)=>{
59
- try {
60
- await fs__namespace.promises.access(path, fs__namespace.constants.R_OK);
61
- } catch (error) {
62
- log(`${path} is not readable: %s %s`, error.message, error.stack);
63
- return false;
64
- }
65
- return true;
66
- };
67
- const isWritable = async (path)=>{
68
- try {
69
- await fs__namespace.promises.access(path, fs__namespace.constants.W_OK);
70
- } catch (error) {
71
- log(`${path} is not writable: %s %s`, error.message, error.stack);
72
- return false;
73
- }
74
- return true;
75
- };
76
- const isFileReadable = async (path)=>{
77
- return await exists(path) && await isFile(path) && await isReadable(path);
78
- };
79
- const isDirectoryWritable = async (path)=>{
80
- return await exists(path) && await isDirectory(path) && await isWritable(path);
81
- };
82
- const isDirectoryReadable = async (path)=>{
83
- return await exists(path) && await isDirectory(path) && await isReadable(path);
84
- };
85
- const createDirectory = async (path)=>{
86
- try {
87
- await fs__namespace.promises.mkdir(path, {
88
- recursive: true
89
- });
90
- } catch (mkdirError) {
91
- throw new Error(`Failed to create output directory ${path}: ${mkdirError.message} ${mkdirError.stack}`);
92
- }
93
- };
94
- const readFile = async (path, encoding)=>{
95
- return await fs__namespace.promises.readFile(path, {
96
- encoding: encoding
97
- });
98
- };
99
- const writeFile = async (path, data, encoding)=>{
100
- await fs__namespace.promises.writeFile(path, data, {
101
- encoding: encoding
102
- });
103
- };
104
- const forEachFileIn = async (directory, callback, options = {
105
- pattern: '*.*'
106
- })=>{
107
- try {
108
- let filesProcessed = 0;
109
- const files = await glob.glob(options.pattern, {
110
- cwd: directory,
111
- nodir: true
112
- });
113
- for (const file of files){
114
- await callback(path.join(directory, file));
115
- filesProcessed++;
116
- if (options.limit && filesProcessed >= options.limit) {
117
- log(`Reached limit of ${options.limit} files, stopping`);
118
- break;
119
- }
120
- }
121
- } catch (err) {
122
- throw new Error(`Failed to glob pattern ${options.pattern} in ${directory}: ${err.message}`);
123
- }
124
- };
125
- const readStream = async (path)=>{
126
- return fs__namespace.createReadStream(path);
127
- };
128
- const hashFile = async (path, length)=>{
129
- const file = await readFile(path, 'utf8');
130
- return crypto.createHash('sha256').update(file).digest('hex').slice(0, length);
131
- };
132
- const listFiles = async (directory)=>{
133
- return await fs__namespace.promises.readdir(directory);
134
- };
135
- return {
136
- exists,
137
- isDirectory,
138
- isFile,
139
- isReadable,
140
- isWritable,
141
- isFileReadable,
142
- isDirectoryWritable,
143
- isDirectoryReadable,
144
- createDirectory,
145
- readFile,
146
- readStream,
147
- writeFile,
148
- forEachFileIn,
149
- hashFile,
150
- listFiles
151
- };
152
- };
153
-
154
- exports.create = create;
155
- //# sourceMappingURL=storage.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"storage.cjs","sources":["../../src/util/storage.ts"],"sourcesContent":["// eslint-disable-next-line no-restricted-imports\nimport * as fs from 'fs';\nimport { glob } from 'glob';\nimport path from 'path';\nimport crypto from 'crypto';\n/**\n * This module exists to isolate filesystem operations from the rest of the codebase.\n * This makes testing easier by avoiding direct fs mocking in jest configuration.\n * \n * Additionally, abstracting storage operations allows for future flexibility - \n * this export utility may need to work with storage systems other than the local filesystem\n * (e.g. S3, Google Cloud Storage, etc).\n */\n\nexport interface Utility {\n exists: (path: string) => Promise<boolean>;\n isDirectory: (path: string) => Promise<boolean>;\n isFile: (path: string) => Promise<boolean>;\n isReadable: (path: string) => Promise<boolean>;\n isWritable: (path: string) => Promise<boolean>;\n isFileReadable: (path: string) => Promise<boolean>;\n isDirectoryWritable: (path: string) => Promise<boolean>;\n isDirectoryReadable: (path: string) => Promise<boolean>;\n createDirectory: (path: string) => Promise<void>;\n readFile: (path: string, encoding: string) => Promise<string>;\n readStream: (path: string) => Promise<fs.ReadStream>;\n writeFile: (path: string, data: string | Buffer, encoding: string) => Promise<void>;\n forEachFileIn: (directory: string, callback: (path: string) => Promise<void>, options?: { pattern: string, limit?: number }) => Promise<void>;\n hashFile: (path: string, length: number) => Promise<string>;\n listFiles: (directory: string) => Promise<string[]>;\n}\n\nexport const create = (params: { log?: (message: string, ...args: any[]) => void }): Utility => {\n\n // eslint-disable-next-line no-console\n const log = params.log || console.log;\n\n const exists = async (path: string): Promise<boolean> => {\n try {\n await fs.promises.stat(path);\n return true;\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n } catch (error: any) {\n return false;\n }\n }\n\n const isDirectory = async (path: string): Promise<boolean> => {\n const stats = await fs.promises.stat(path);\n if (!stats.isDirectory()) {\n log(`${path} is not a directory`);\n return false;\n }\n return true;\n }\n\n const isFile = async (path: string): Promise<boolean> => {\n const stats = await fs.promises.stat(path);\n if (!stats.isFile()) {\n log(`${path} is not a file`);\n return false;\n }\n return true;\n }\n\n const isReadable = async (path: string): Promise<boolean> => {\n try {\n await fs.promises.access(path, fs.constants.R_OK);\n } catch (error: any) {\n log(`${path} is not readable: %s %s`, error.message, error.stack);\n return false;\n }\n return true;\n }\n\n const isWritable = async (path: string): Promise<boolean> => {\n try {\n await fs.promises.access(path, fs.constants.W_OK);\n } catch (error: any) {\n log(`${path} is not writable: %s %s`, error.message, error.stack);\n return false;\n }\n return true;\n }\n\n const isFileReadable = async (path: string): Promise<boolean> => {\n return await exists(path) && await isFile(path) && await isReadable(path);\n }\n\n const isDirectoryWritable = async (path: string): Promise<boolean> => {\n return await exists(path) && await isDirectory(path) && await isWritable(path);\n }\n\n const isDirectoryReadable = async (path: string): Promise<boolean> => {\n return await exists(path) && await isDirectory(path) && await isReadable(path);\n }\n\n const createDirectory = async (path: string): Promise<void> => {\n try {\n await fs.promises.mkdir(path, { recursive: true });\n } catch (mkdirError: any) {\n throw new Error(`Failed to create output directory ${path}: ${mkdirError.message} ${mkdirError.stack}`);\n }\n }\n\n const readFile = async (path: string, encoding: string): Promise<string> => {\n return await fs.promises.readFile(path, { encoding: encoding as BufferEncoding });\n }\n\n const writeFile = async (path: string, data: string | Buffer, encoding: string): Promise<void> => {\n await fs.promises.writeFile(path, data, { encoding: encoding as BufferEncoding });\n }\n\n const forEachFileIn = async (\n directory: string,\n callback: (file: string) => Promise<void>,\n options: { pattern: string | string[], limit?: number } = { pattern: '*.*' },\n ): Promise<void> => {\n try {\n let filesProcessed = 0;\n const files = await glob(options.pattern, { cwd: directory, nodir: true });\n for (const file of files) {\n await callback(path.join(directory, file));\n filesProcessed++;\n if (options.limit && filesProcessed >= options.limit) {\n log(`Reached limit of ${options.limit} files, stopping`);\n break;\n }\n }\n } catch (err: any) {\n throw new Error(`Failed to glob pattern ${options.pattern} in ${directory}: ${err.message}`);\n }\n }\n\n const readStream = async (path: string): Promise<fs.ReadStream> => {\n return fs.createReadStream(path);\n }\n\n const hashFile = async (path: string, length: number): Promise<string> => {\n const file = await readFile(path, 'utf8');\n return crypto.createHash('sha256').update(file).digest('hex').slice(0, length);\n }\n\n const listFiles = async (directory: string): Promise<string[]> => {\n return await fs.promises.readdir(directory);\n }\n\n return {\n exists,\n isDirectory,\n isFile,\n isReadable,\n isWritable,\n isFileReadable,\n isDirectoryWritable,\n isDirectoryReadable,\n createDirectory,\n readFile,\n readStream,\n writeFile,\n forEachFileIn,\n hashFile,\n listFiles,\n };\n}"],"names":["create","params","log","console","exists","path","fs","promises","stat","error","isDirectory","stats","isFile","isReadable","access","constants","R_OK","message","stack","isWritable","W_OK","isFileReadable","isDirectoryWritable","isDirectoryReadable","createDirectory","mkdir","recursive","mkdirError","Error","readFile","encoding","writeFile","data","forEachFileIn","directory","callback","options","pattern","filesProcessed","files","glob","cwd","nodir","file","join","limit","err","readStream","createReadStream","hashFile","length","crypto","createHash","update","digest","slice","listFiles","readdir"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAgCO,MAAMA,SAAS,CAACC,MAAAA,GAAAA;;AAGnB,IAAA,MAAMC,GAAMD,GAAAA,MAAAA,CAAOC,GAAG,IAAIC,QAAQD,GAAG;AAErC,IAAA,MAAME,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M,IAAIlB,KAAAA,CAAM,CAAC,uBAAuB,EAAEQ,OAAQC,CAAAA,OAAO,CAAC,IAAI,EAAEH,SAAU,CAAA,EAAE,EAAEY,GAAAA,CAAI7B,OAAO,CAAE,CAAA,CAAA;AAC/F;AACJ,KAAA;AAEA,IAAA,MAAM8B,aAAa,OAAO1C,IAAAA,GAAAA;QACtB,OAAOC,aAAAA,CAAG0C,gBAAgB,CAAC3C,IAAAA,CAAAA;AAC/B,KAAA;IAEA,MAAM4C,QAAAA,GAAW,OAAO5C,IAAc6C,EAAAA,MAAAA,GAAAA;QAClC,MAAMP,IAAAA,GAAO,MAAMd,QAAAA,CAASxB,IAAM,EAAA,MAAA,CAAA;AAClC,QAAA,OAAO8C,MAAOC,CAAAA,UAAU,CAAC,QAAA,CAAA,CAAUC,MAAM,CAACV,IAAMW,CAAAA,CAAAA,MAAM,CAAC,KAAA,CAAA,CAAOC,KAAK,CAAC,CAAGL,EAAAA,MAAAA,CAAAA;AAC3E,KAAA;AAEA,IAAA,MAAMM,YAAY,OAAOtB,SAAAA,GAAAA;AACrB,QAAA,OAAO,MAAM5B,aAAAA,CAAGC,QAAQ,CAACkD,OAAO,CAACvB,SAAAA,CAAAA;AACrC,KAAA;IAEA,OAAO;AACH9B,QAAAA,MAAAA;AACAM,QAAAA,WAAAA;AACAE,QAAAA,MAAAA;AACAC,QAAAA,UAAAA;AACAM,QAAAA,UAAAA;AACAE,QAAAA,cAAAA;AACAC,QAAAA,mBAAAA;AACAC,QAAAA,mBAAAA;AACAC,QAAAA,eAAAA;AACAK,QAAAA,QAAAA;AACAkB,QAAAA,UAAAA;AACAhB,QAAAA,SAAAA;AACAE,QAAAA,aAAAA;AACAgB,QAAAA,QAAAA;AACAO,QAAAA;AACJ,KAAA;AACJ;;;;"}
@@ -1,42 +0,0 @@
1
- 'use strict';
2
-
3
- Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
4
-
5
- const constants = require('../constants.cjs');
6
-
7
- // Returns true if the input is likely text, false if likely binary
8
- function isText(input) {
9
- let buf;
10
- if (typeof input === 'string') {
11
- buf = Buffer.from(input, constants.DEFAULT_CHARACTER_ENCODING);
12
- } else {
13
- buf = input;
14
- }
15
- // Empty buffers are considered text
16
- if (buf.length === 0) {
17
- return true;
18
- }
19
- // If the buffer contains null bytes, it's likely binary
20
- if (buf.includes(0)) {
21
- return false;
22
- }
23
- // For UTF-8 encoded text (including emoji and international characters),
24
- // convert to string first and check if there are non-printable characters
25
- const str = buf.toString(constants.DEFAULT_CHARACTER_ENCODING);
26
- // Count the number of non-printable ASCII characters (excluding common whitespace)
27
- let nonPrintable = 0;
28
- const len = Math.min(str.length, 512); // Only check the first 512 characters for performance
29
- for(let i = 0; i < len; i++){
30
- const charCode = str.charCodeAt(i);
31
- // Allow: tab (9), line feed (10), carriage return (13), printable ASCII (32-126)
32
- // Also allow all non-ASCII Unicode characters (charCode > 127)
33
- if (charCode !== 9 && charCode !== 10 && charCode !== 13 && (charCode < 32 || charCode > 126 && charCode < 128)) {
34
- nonPrintable++;
35
- }
36
- }
37
- // If more than 10% of the checked characters are non-printable, consider it binary
38
- return nonPrintable / len < 0.1;
39
- }
40
-
41
- exports.isText = isText;
42
- //# sourceMappingURL=text.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"text.cjs","sources":["../../src/util/text.ts"],"sourcesContent":["import { DEFAULT_CHARACTER_ENCODING } from \"../constants\";\n\n// Returns true if the input is likely text, false if likely binary\nexport function isText(input: string | Buffer): boolean {\n let buf: Buffer;\n if (typeof input === 'string') {\n buf = Buffer.from(input, DEFAULT_CHARACTER_ENCODING);\n } else {\n buf = input;\n }\n\n // Empty buffers are considered text\n if (buf.length === 0) {\n return true;\n }\n\n // If the buffer contains null bytes, it's likely binary\n if (buf.includes(0)) {\n return false;\n }\n\n // For UTF-8 encoded text (including emoji and international characters),\n // convert to string first and check if there are non-printable characters\n const str = buf.toString(DEFAULT_CHARACTER_ENCODING);\n\n // Count the number of non-printable ASCII characters (excluding common whitespace)\n let nonPrintable = 0;\n const len = Math.min(str.length, 512); // Only check the first 512 characters for performance\n\n for (let i = 0; i < len; i++) {\n const charCode = str.charCodeAt(i);\n // Allow: tab (9), line feed (10), carriage return (13), printable ASCII (32-126)\n // Also allow all non-ASCII Unicode characters (charCode > 127)\n if (\n charCode !== 9 && charCode !== 10 && charCode !== 13 &&\n (charCode < 32 || (charCode > 126 && charCode < 128))\n ) {\n nonPrintable++;\n }\n }\n\n // If more than 10% of the checked characters are non-printable, consider it binary\n return nonPrintable / len < 0.1;\n}\n"],"names":["isText","input","buf","Buffer","from","DEFAULT_CHARACTER_ENCODING","length","includes","str","toString","nonPrintable","len","Math","min","i","charCode","charCodeAt"],"mappings":";;;;;;AAEA;AACO,SAASA,OAAOC,KAAsB,EAAA;IACzC,IAAIC,GAAAA;IACJ,IAAI,OAAOD,UAAU,QAAU,EAAA;QAC3BC,GAAMC,GAAAA,MAAAA,CAAOC,IAAI,CAACH,KAAOI,EAAAA,oCAAAA,CAAAA;KACtB,MAAA;QACHH,GAAMD,GAAAA,KAAAA;AACV;;IAGA,IAAIC,GAAAA,CAAII,MAAM,KAAK,CAAG,EAAA;QAClB,OAAO,IAAA;AACX;;IAGA,IAAIJ,GAAAA,CAAIK,QAAQ,CAAC,CAAI,CAAA,EAAA;QACjB,OAAO,KAAA;AACX;;;IAIA,MAAMC,GAAAA,GAAMN,GAAIO,CAAAA,QAAQ,CAACJ,oCAAAA,CAAAA;;AAGzB,IAAA,IAAIK,YAAe,GAAA,CAAA;IACnB,MAAMC,GAAAA,GAAMC,KAAKC,GAAG,CAACL,IAAIF,MAAM,EAAE;AAEjC,IAAA,IAAK,IAAIQ,CAAAA,GAAI,CAAGA,EAAAA,CAAAA,GAAIH,KAAKG,CAAK,EAAA,CAAA;QAC1B,MAAMC,QAAAA,GAAWP,GAAIQ,CAAAA,UAAU,CAACF,CAAAA,CAAAA;;;AAGhC,QAAA,IACIC,QAAa,KAAA,CAAA,IAAKA,QAAa,KAAA,EAAA,IAAMA,QAAa,KAAA,EAAA,KACjDA,QAAAA,GAAW,EAAOA,IAAAA,QAAAA,GAAW,GAAOA,IAAAA,QAAAA,GAAW,GAAG,CACrD,EAAA;AACEL,YAAAA,YAAAA,EAAAA;AACJ;AACJ;;AAGA,IAAA,OAAOA,eAAeC,GAAM,GAAA,GAAA;AAChC;;;;"}