@lowgular/code-graph 0.0.1 → 0.1.2

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 (155) hide show
  1. package/bin/cli.js +2463 -0
  2. package/lib.js +2430 -0
  3. package/package.json +26 -7
  4. package/apps/code-graph/src/main.js +0 -50
  5. package/libs/cli/code-graph/src/index.js +0 -39
  6. package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.js +0 -72
  7. package/libs/cli/code-graph/src/lib/class-declarations/abstractions/service.stateful.js +0 -68
  8. package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.doc.js +0 -147
  9. package/libs/cli/code-graph/src/lib/class-declarations/class-declarations.graph.js +0 -55
  10. package/libs/cli/code-graph/src/lib/class-declarations/index.js +0 -27
  11. package/libs/cli/code-graph/src/lib/code.graph.factory.js +0 -63
  12. package/libs/cli/code-graph/src/lib/code.graph.js +0 -62
  13. package/libs/cli/code-graph/src/lib/core/core.js +0 -58
  14. package/libs/cli/code-graph/src/lib/core.js +0 -85
  15. package/libs/cli/code-graph/src/lib/decorators/index.js +0 -36
  16. package/libs/cli/code-graph/src/lib/docs/index.js +0 -21
  17. package/libs/cli/code-graph/src/lib/docs/specs.js +0 -36
  18. package/libs/cli/code-graph/src/lib/expressions/call-expressions.graph.js +0 -28
  19. package/libs/cli/code-graph/src/lib/fixtures/reactive-event-bus/src/app/examples.event-bus.js +0 -53
  20. package/libs/cli/code-graph/src/lib/method-declarations/index.js +0 -23
  21. package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.doc.js +0 -106
  22. package/libs/cli/code-graph/src/lib/method-declarations/method-declarations.graph.js +0 -56
  23. package/libs/cli/code-graph/src/lib/parameters/index.js +0 -42
  24. package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.evals.js +0 -139
  25. package/libs/cli/code-graph/src/lib/property-declarations/abstractions/reactive-state.js +0 -104
  26. package/libs/cli/code-graph/src/lib/property-declarations/index.js +0 -25
  27. package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.doc.js +0 -74
  28. package/libs/cli/code-graph/src/lib/property-declarations/property-declarations.graph.js +0 -43
  29. package/libs/cli/code-graph/src/lib/tools/index.js +0 -34
  30. package/libs/cli/code-graph/src/lib/tools/match-code-graph.tool.js +0 -64
  31. package/libs/cli/code-graph/src/lib/types/index.js +0 -99
  32. package/libs/cli/code-graph/src/lib/v2/extractors/extractor.doc.js +0 -345
  33. package/libs/cli/code-graph/src/lib/v2/extractors/extractor.js +0 -52
  34. package/libs/cli/code-graph/src/lib/v2/extractors/index.js +0 -23
  35. package/libs/cli/code-graph/src/lib/v2/graph-builder/code-graph.builder.js +0 -76
  36. package/libs/cli/code-graph/src/lib/v2/graph-builder/index.js +0 -21
  37. package/libs/cli/code-graph/src/lib/v2/graph-builder/node.processor.js +0 -48
  38. package/libs/cli/code-graph/src/lib/v2/graph-builder/relationship.processor.js +0 -79
  39. package/libs/cli/code-graph/src/lib/v2/graph-builder/type.processor.js +0 -45
  40. package/libs/cli/code-graph/src/lib/v2/index.js +0 -37
  41. package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.doc.js +0 -220
  42. package/libs/cli/code-graph/src/lib/v2/tools/build-code-graph.tool.js +0 -42
  43. package/libs/cli/cypher/src/index.js +0 -25
  44. package/libs/cli/cypher/src/lib/docs/features/advanced-optional-match.feature.js +0 -277
  45. package/libs/cli/cypher/src/lib/docs/features/anonymous-relationship.feature.js +0 -69
  46. package/libs/cli/cypher/src/lib/docs/features/anonymous-variable-length.feature.js +0 -105
  47. package/libs/cli/cypher/src/lib/docs/features/basic-filtering.feature.js +0 -70
  48. package/libs/cli/cypher/src/lib/docs/features/basic-optional-match.feature.js +0 -99
  49. package/libs/cli/cypher/src/lib/docs/features/basic-relationship.feature.js +0 -125
  50. package/libs/cli/cypher/src/lib/docs/features/index.js +0 -51
  51. package/libs/cli/cypher/src/lib/docs/features/limit.feature.js +0 -50
  52. package/libs/cli/cypher/src/lib/docs/features/match-nodes.feature.js +0 -106
  53. package/libs/cli/cypher/src/lib/docs/features/multiple-relationship-types.feature.js +0 -105
  54. package/libs/cli/cypher/src/lib/docs/features/order-by.feature.js +0 -143
  55. package/libs/cli/cypher/src/lib/docs/features/property-matching.feature.js +0 -152
  56. package/libs/cli/cypher/src/lib/docs/features/relationship-without-variable.feature.js +0 -48
  57. package/libs/cli/cypher/src/lib/docs/features/return-statement.feature.js +0 -65
  58. package/libs/cli/cypher/src/lib/docs/features/unidirected-relationship.feature.js +0 -82
  59. package/libs/cli/cypher/src/lib/docs/features/variable-length-path.feature.js +0 -136
  60. package/libs/cli/cypher/src/lib/docs/features/where-conditional.feature.js +0 -187
  61. package/libs/cli/cypher/src/lib/docs/features/where-operators.feature.js +0 -302
  62. package/libs/cli/cypher/src/lib/docs/prompts.js +0 -36
  63. package/libs/cli/cypher/src/lib/docs/specs.js +0 -181
  64. package/libs/cli/cypher/src/lib/executor/condition-evaluator.js +0 -158
  65. package/libs/cli/cypher/src/lib/executor/executor.js +0 -83
  66. package/libs/cli/cypher/src/lib/executor/graph.js +0 -15
  67. package/libs/cli/cypher/src/lib/executor/match-engine.js +0 -153
  68. package/libs/cli/cypher/src/lib/executor/pattern-matcher.js +0 -109
  69. package/libs/cli/cypher/src/lib/executor/relationship-navigator.js +0 -64
  70. package/libs/cli/cypher/src/lib/executor/result-formatter.js +0 -143
  71. package/libs/cli/cypher/src/lib/executor/traverse-engine.js +0 -164
  72. package/libs/cli/cypher/src/lib/executor/utils.js +0 -37
  73. package/libs/cli/cypher/src/lib/graph.stub.js +0 -63
  74. package/libs/cli/cypher/src/lib/index.js +0 -74
  75. package/libs/cli/cypher/src/lib/lexer.js +0 -398
  76. package/libs/cli/cypher/src/lib/parser.js +0 -602
  77. package/libs/cli/cypher/src/lib/validator/query-validator.js +0 -95
  78. package/libs/cli/cypher/src/lib/validator/supported-features.config.js +0 -111
  79. package/libs/cli/cypher/src/lib/validator/unsupported-features.config.js +0 -150
  80. package/libs/cli/shared/src/index.js +0 -53
  81. package/libs/cli/shared/src/lib/admin-token.js +0 -121
  82. package/libs/cli/shared/src/lib/config.js +0 -49
  83. package/libs/cli/shared/src/lib/consts.js +0 -57
  84. package/libs/cli/shared/src/lib/core.js +0 -46
  85. package/libs/cli/shared/src/lib/infrastructure/cli.js +0 -47
  86. package/libs/cli/shared/src/lib/infrastructure/config.js +0 -47
  87. package/libs/cli/shared/src/lib/infrastructure/config.reporitory.js +0 -51
  88. package/libs/cli/shared/src/lib/infrastructure/formatters/console-formatter.js +0 -96
  89. package/libs/cli/shared/src/lib/infrastructure/formatters/index.js +0 -41
  90. package/libs/cli/shared/src/lib/infrastructure/formatters/json-formatter.js +0 -64
  91. package/libs/cli/shared/src/lib/infrastructure/formatters/markdown-formatter.js +0 -120
  92. package/libs/cli/shared/src/lib/infrastructure/formatters/types.js +0 -15
  93. package/libs/cli/shared/src/lib/infrastructure/formatters/utils.js +0 -72
  94. package/libs/cli/shared/src/lib/infrastructure/git.js +0 -147
  95. package/libs/cli/shared/src/lib/infrastructure/http.js +0 -257
  96. package/libs/cli/shared/src/lib/infrastructure/markdown.js +0 -95
  97. package/libs/cli/shared/src/lib/infrastructure/transformers/embeddings.js +0 -88
  98. package/libs/cli/shared/src/lib/infrastructure/transformers/index.js +0 -25
  99. package/libs/cli/shared/src/lib/infrastructure/transformers/rag-eval.js +0 -154
  100. package/libs/cli/shared/src/lib/infrastructure/transformers/similarity.js +0 -210
  101. package/libs/cli/shared/src/lib/infrastructure/workspace.js +0 -297
  102. package/libs/cli/shared/src/lib/infrastructure/yaml.js +0 -237
  103. package/libs/cli/shared/src/lib/lowgular.config.js +0 -120
  104. package/libs/cli/shared/src/lib/token.js +0 -135
  105. package/libs/cli/shared/src/lib/utils/solution.util.js +0 -35
  106. package/libs/cli/shared/src/lib/utils/utils.js +0 -89
  107. package/libs/cli/typescript/src/index.js +0 -21
  108. package/libs/cli/typescript/src/lib/base/index.js +0 -23
  109. package/libs/cli/typescript/src/lib/base/nameable.js +0 -34
  110. package/libs/cli/typescript/src/lib/base/nodeable.js +0 -36
  111. package/libs/cli/typescript/src/lib/class.implementation.js +0 -52
  112. package/libs/cli/typescript/src/lib/core/declaration.registry.js +0 -107
  113. package/libs/cli/typescript/src/lib/core/design-pattern.js +0 -55
  114. package/libs/cli/typescript/src/lib/core/index.js +0 -35
  115. package/libs/cli/typescript/src/lib/core/navigable-declaration.js +0 -69
  116. package/libs/cli/typescript/src/lib/core/program-context.js +0 -71
  117. package/libs/cli/typescript/src/lib/core/syntax-kind.utils.js +0 -40
  118. package/libs/cli/typescript/src/lib/core/type.js +0 -374
  119. package/libs/cli/typescript/src/lib/declaration.abstraction.js +0 -90
  120. package/libs/cli/typescript/src/lib/decorator.implementation.js +0 -35
  121. package/libs/cli/typescript/src/lib/enum.implementation.js +0 -35
  122. package/libs/cli/typescript/src/lib/function-declaration.implementation.js +0 -35
  123. package/libs/cli/typescript/src/lib/index.js +0 -57
  124. package/libs/cli/typescript/src/lib/interface.implementation.js +0 -51
  125. package/libs/cli/typescript/src/lib/members/method-abstraction.resolver.js +0 -90
  126. package/libs/cli/typescript/src/lib/members/method-declaration.implementation.js +0 -44
  127. package/libs/cli/typescript/src/lib/members/method-signature.implementation.js +0 -46
  128. package/libs/cli/typescript/src/lib/members/method.util.js +0 -32
  129. package/libs/cli/typescript/src/lib/members/parameter.implementation.js +0 -38
  130. package/libs/cli/typescript/src/lib/members/property-declaration.implementation.js +0 -64
  131. package/libs/cli/typescript/src/lib/members/property-signature.implementation.js +0 -34
  132. package/libs/cli/typescript/src/lib/members/property.util.js +0 -61
  133. package/libs/cli/typescript/src/lib/members/statements/expressions/binary-expression.implementation.js +0 -42
  134. package/libs/cli/typescript/src/lib/members/statements/expressions/call-expression.implementation.js +0 -114
  135. package/libs/cli/typescript/src/lib/members/statements/expressions/expression.abstraction.js +0 -188
  136. package/libs/cli/typescript/src/lib/members/statements/expressions/property-access-expression.implementation.js +0 -35
  137. package/libs/cli/typescript/src/lib/members/statements/expressions/unary-expression.implementation.js +0 -51
  138. package/libs/cli/typescript/src/lib/members/statements/statement.implementation.js +0 -49
  139. package/libs/cli/typescript/src/lib/members/statements/utils.js +0 -51
  140. package/libs/cli/typescript/src/lib/plugins/built-in.plugin.js +0 -258
  141. package/libs/cli/typescript/src/lib/plugins/plugin.interface.js +0 -15
  142. package/libs/cli/typescript/src/lib/plugins/rxjs.plugin.js +0 -228
  143. package/libs/cli/typescript/src/lib/plugins/signal.plugin.js +0 -126
  144. package/libs/cli/typescript/src/lib/plugins/stubs.js +0 -66
  145. package/libs/cli/typescript/src/lib/type-alias.implementation.js +0 -72
  146. package/libs/cli/typescript/src/lib/utils.js +0 -39
  147. package/libs/cli/typescript/src/lib/variable-declaration.implementation.js +0 -35
  148. package/libs/core/codegular/src/index.js +0 -21
  149. package/libs/core/codegular/src/lib/index.js +0 -29
  150. package/libs/core/codegular/src/lib/node.js +0 -112
  151. package/libs/core/codegular/src/lib/program.js +0 -92
  152. package/libs/core/codegular/src/lib/string.js +0 -168
  153. package/libs/core/codegular/src/lib/type-checker.js +0 -170
  154. package/libs/core/codegular/src/lib/utils.js +0 -347
  155. package/main.js +0 -43
@@ -1,51 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var config_reporitory_exports = {};
19
- __export(config_reporitory_exports, {
20
- CONFIG_FILE: () => CONFIG_FILE,
21
- LOWGULAR_DIR: () => LOWGULAR_DIR,
22
- readLowgularConfigFromRoot: () => readLowgularConfigFromRoot,
23
- setupLowgularFolder: () => setupLowgularFolder
24
- });
25
- module.exports = __toCommonJS(config_reporitory_exports);
26
- var import_shared = require("@cli/shared");
27
- var import_fs = require("fs");
28
- const LOWGULAR_DIR = ".lowgular";
29
- const CONFIG_FILE = "lg.json";
30
- const readLowgularConfigFromRoot = () => {
31
- const lgConfigFile = (0, import_fs.readFileSync)(
32
- LOWGULAR_DIR + "/" + import_shared.LG_CONFIG_FILE,
33
- "utf8"
34
- );
35
- return JSON.parse(lgConfigFile);
36
- };
37
- const setupLowgularFolder = (folder, ctx) => {
38
- const destDir = folder + LOWGULAR_DIR;
39
- if ((0, import_fs.existsSync)(destDir)) {
40
- (0, import_fs.rmSync)(destDir, { recursive: true, force: true });
41
- }
42
- (0, import_fs.mkdirSync)(destDir, { recursive: true });
43
- (0, import_fs.writeFileSync)(destDir + "/" + import_shared.LG_CONFIG_FILE, (0, import_shared.stringifyJSON)(ctx), "utf-8");
44
- };
45
- // Annotate the CommonJS export names for ESM import in node:
46
- 0 && (module.exports = {
47
- CONFIG_FILE,
48
- LOWGULAR_DIR,
49
- readLowgularConfigFromRoot,
50
- setupLowgularFolder
51
- });
@@ -1,96 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var console_formatter_exports = {};
19
- __export(console_formatter_exports, {
20
- ConsoleFormatter: () => ConsoleFormatter
21
- });
22
- module.exports = __toCommonJS(console_formatter_exports);
23
- var import_prompts = require("@clack/prompts");
24
- var import_utils = require("./utils.js");
25
- class ConsoleFormatter {
26
- format(abilityId, items) {
27
- if (items.length === 0) {
28
- return {
29
- message: `No items found for ability: ${abilityId}`
30
- };
31
- }
32
- import_prompts.log.info(`Found ${items.length} item(s) for ability: ${abilityId}
33
- `);
34
- items.forEach((item, index) => {
35
- import_prompts.log.info(`Item ${index + 1}:`);
36
- Object.entries(item).forEach(([key, value]) => {
37
- if (key === "comment")
38
- return;
39
- const formattedValue = this.formatValue(key, value);
40
- import_prompts.log.info(` ${(0, import_utils.capitalizeKey)(key)}: ${formattedValue}`);
41
- });
42
- if (item.comment) {
43
- import_prompts.log.info(` ${(0, import_utils.capitalizeKey)("comment")}:`);
44
- const commentLines = item.comment.split("\n");
45
- commentLines.forEach((line) => {
46
- import_prompts.log.info(` ${line}`);
47
- });
48
- }
49
- if (item.fileContent && item.startLine && item.endLine) {
50
- this.displayCodeContext(item);
51
- }
52
- import_prompts.log.info("");
53
- });
54
- return {
55
- message: `Successfully retrieved ${items.length} item(s) for ability: ${abilityId}`
56
- };
57
- }
58
- formatValue(key, value) {
59
- if (value === null || value === void 0) {
60
- return "N/A";
61
- }
62
- if ((0, import_utils.isDateField)(key, value)) {
63
- return new Date(value).toLocaleDateString();
64
- }
65
- if (key.toLowerCase().includes("correctness") && typeof value === "number") {
66
- return `${value}%`;
67
- }
68
- if (key === "startLine" && typeof value === "number") {
69
- return value.toString();
70
- }
71
- if (key === "endLine" && typeof value === "number") {
72
- return value.toString();
73
- }
74
- return String(value);
75
- }
76
- displayCodeContext(item) {
77
- if (!item.fileContent)
78
- return;
79
- const lines = item.fileContent.split("\n");
80
- const startLine = item.startLine || 1;
81
- const endLine = item.endLine || startLine;
82
- const contextStart = Math.max(0, startLine - 3);
83
- const contextEnd = Math.min(lines.length, endLine + 2);
84
- import_prompts.log.info(` Code context:`);
85
- for (let i = contextStart; i < contextEnd; i++) {
86
- const lineNum = i + 1;
87
- const isTarget = lineNum >= startLine && lineNum <= endLine;
88
- const prefix = isTarget ? ">>>" : " ";
89
- import_prompts.log.info(`${prefix} ${lineNum.toString().padStart(3)}: ${lines[i]}`);
90
- }
91
- }
92
- }
93
- // Annotate the CommonJS export names for ESM import in node:
94
- 0 && (module.exports = {
95
- ConsoleFormatter
96
- });
@@ -1,41 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var formatters_exports = {};
19
- __export(formatters_exports, {
20
- createFormatter: () => createFormatter
21
- });
22
- module.exports = __toCommonJS(formatters_exports);
23
- var import_console_formatter = require("./console-formatter.js");
24
- var import_json_formatter = require("./json-formatter.js");
25
- var import_markdown_formatter = require("./markdown-formatter.js");
26
- function createFormatter(type) {
27
- switch (type) {
28
- case "console":
29
- return new import_console_formatter.ConsoleFormatter();
30
- case "json":
31
- return new import_json_formatter.JsonFormatter();
32
- case "markdown":
33
- return new import_markdown_formatter.MarkdownFormatter();
34
- default:
35
- throw new Error(`Unknown formatter type: ${type}`);
36
- }
37
- }
38
- // Annotate the CommonJS export names for ESM import in node:
39
- 0 && (module.exports = {
40
- createFormatter
41
- });
@@ -1,64 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var json_formatter_exports = {};
19
- __export(json_formatter_exports, {
20
- JsonFormatter: () => JsonFormatter
21
- });
22
- module.exports = __toCommonJS(json_formatter_exports);
23
- var import_fs = require("fs");
24
- var import_utils = require("./utils.js");
25
- class JsonFormatter {
26
- format(abilityId, items) {
27
- const fileName = `examples.${abilityId}.json`;
28
- const output = {
29
- abilityId,
30
- totalItems: items.length,
31
- items: items.map((item, index) => ({
32
- itemNumber: index + 1,
33
- ...this.formatItemForJson(item)
34
- })),
35
- generatedAt: (/* @__PURE__ */ new Date()).toISOString()
36
- };
37
- try {
38
- (0, import_fs.writeFileSync)(fileName, JSON.stringify(output, null, 2), "utf-8");
39
- return {
40
- message: `Successfully exported ${items.length} item(s) for ability: ${abilityId} to ${fileName}`
41
- };
42
- } catch (error) {
43
- throw new Error(
44
- `Failed to write JSON file: ${error instanceof Error ? error.message : "Unknown error"}`
45
- );
46
- }
47
- }
48
- formatItemForJson(item) {
49
- const formatted = {};
50
- Object.entries(item).forEach(([key, value]) => {
51
- if ((0, import_utils.isDateField)(key, value)) {
52
- formatted[key] = new Date(value).toISOString();
53
- formatted[`${key}Formatted`] = new Date(value).toLocaleDateString();
54
- } else {
55
- formatted[key] = value;
56
- }
57
- });
58
- return formatted;
59
- }
60
- }
61
- // Annotate the CommonJS export names for ESM import in node:
62
- 0 && (module.exports = {
63
- JsonFormatter
64
- });
@@ -1,120 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var markdown_formatter_exports = {};
19
- __export(markdown_formatter_exports, {
20
- MarkdownFormatter: () => MarkdownFormatter
21
- });
22
- module.exports = __toCommonJS(markdown_formatter_exports);
23
- var import_fs = require("fs");
24
- var import_utils = require("./utils.js");
25
- class MarkdownFormatter {
26
- format(abilityId, items) {
27
- const fileName = `examples.${abilityId}.md`;
28
- if (items.length === 0) {
29
- const content2 = `# Items for Ability: ${abilityId}
30
-
31
- No items found for this ability.
32
-
33
- _Generated on ${(/* @__PURE__ */ new Date()).toLocaleDateString()}_
34
- `;
35
- (0, import_fs.writeFileSync)(fileName, content2, "utf-8");
36
- return {
37
- message: `No items found for ability: ${abilityId} - created empty ${fileName}`
38
- };
39
- }
40
- let content = `# Items for Ability: ${abilityId}
41
-
42
- `;
43
- content += `Found ${items.length} item(s) for this ability.
44
-
45
- `;
46
- items.forEach((item, index) => {
47
- content += `## Item ${index + 1}
48
-
49
- `;
50
- Object.entries(item).forEach(([key, value]) => {
51
- if (key === "fileContent" || key === "comment")
52
- return;
53
- const formattedValue = this.formatValueForMarkdown(key, value);
54
- const readableKey = (0, import_utils.capitalizeKey)(key);
55
- content += `- **${readableKey}**: ${formattedValue}
56
- `;
57
- });
58
- if (item.comment) {
59
- content += `- **Comment**: ${item.comment}
60
- `;
61
- }
62
- content += "\n";
63
- if (item.fileContent) {
64
- content = this.addFullFileContent(content, item);
65
- }
66
- content += `---
67
-
68
- `;
69
- });
70
- content += `_Generated on ${(/* @__PURE__ */ new Date()).toLocaleDateString()}_
71
- `;
72
- try {
73
- (0, import_fs.writeFileSync)(fileName, content, "utf-8");
74
- return {
75
- message: `Successfully exported ${items.length} item(s) for ability: ${abilityId} to ${fileName}`
76
- };
77
- } catch (error) {
78
- throw new Error(
79
- `Failed to write markdown file: ${error instanceof Error ? error.message : "Unknown error"}`
80
- );
81
- }
82
- }
83
- formatValueForMarkdown(key, value) {
84
- if (value === null || value === void 0) {
85
- return "N/A";
86
- }
87
- if ((0, import_utils.isDateField)(key, value)) {
88
- return new Date(value).toLocaleDateString();
89
- }
90
- if (key.toLowerCase().includes("correctness") && typeof value === "number") {
91
- return `${value}%`;
92
- }
93
- if (key.toLowerCase().includes("path") || key.toLowerCase().includes("file")) {
94
- return `\`${value}\``;
95
- }
96
- return String(value);
97
- }
98
- addFullFileContent(content, item) {
99
- if (!item.fileContent)
100
- return content;
101
- const filePath = item.filePath || item.file || "";
102
- const extension = filePath.split(".").pop() || "";
103
- const language = (0, import_utils.getLanguageFromExtension)(extension);
104
- content += `### Full File Content
105
-
106
- `;
107
- content += `\`\`\`${language}
108
- `;
109
- content += item.fileContent;
110
- content += `
111
- \`\`\`
112
-
113
- `;
114
- return content;
115
- }
116
- }
117
- // Annotate the CommonJS export names for ESM import in node:
118
- 0 && (module.exports = {
119
- MarkdownFormatter
120
- });
@@ -1,15 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
14
- var types_exports = {};
15
- module.exports = __toCommonJS(types_exports);
@@ -1,72 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var utils_exports = {};
19
- __export(utils_exports, {
20
- capitalizeKey: () => capitalizeKey,
21
- getLanguageFromExtension: () => getLanguageFromExtension,
22
- isDateField: () => isDateField
23
- });
24
- module.exports = __toCommonJS(utils_exports);
25
- function isDateField(key, value) {
26
- const dateKeyPatterns = ["date", "time", "created", "updated", "modified"];
27
- const keyLower = key.toLowerCase();
28
- const hasDateKeyword = dateKeyPatterns.some(
29
- (pattern) => keyLower.includes(pattern)
30
- );
31
- if (!hasDateKeyword)
32
- return false;
33
- const date = new Date(value);
34
- return !isNaN(date.getTime());
35
- }
36
- function capitalizeKey(key) {
37
- return key.replace(/([A-Z])/g, " $1").replace(/^./, (str) => str.toUpperCase());
38
- }
39
- function getLanguageFromExtension(extension) {
40
- const languageMap = {
41
- ts: "typescript",
42
- tsx: "typescript",
43
- js: "javascript",
44
- jsx: "javascript",
45
- py: "python",
46
- java: "java",
47
- cs: "csharp",
48
- cpp: "cpp",
49
- c: "c",
50
- go: "go",
51
- rs: "rust",
52
- php: "php",
53
- rb: "ruby",
54
- kt: "kotlin",
55
- swift: "swift",
56
- html: "html",
57
- css: "css",
58
- scss: "scss",
59
- sass: "sass",
60
- json: "json",
61
- xml: "xml",
62
- yml: "yaml",
63
- yaml: "yaml"
64
- };
65
- return languageMap[extension.toLowerCase()] || "";
66
- }
67
- // Annotate the CommonJS export names for ESM import in node:
68
- 0 && (module.exports = {
69
- capitalizeKey,
70
- getLanguageFromExtension,
71
- isDateField
72
- });
@@ -1,147 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __export = (target, all) => {
6
- for (var name in all)
7
- __defProp(target, name, { get: all[name], enumerable: true });
8
- };
9
- var __copyProps = (to, from, except, desc) => {
10
- if (from && typeof from === "object" || typeof from === "function") {
11
- for (let key of __getOwnPropNames(from))
12
- if (!__hasOwnProp.call(to, key) && key !== except)
13
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
14
- }
15
- return to;
16
- };
17
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
- var git_exports = {};
19
- __export(git_exports, {
20
- collectAllGitIgnoreRules: () => collectAllGitIgnoreRules,
21
- isIgnored: () => isIgnored,
22
- parseGitIgnoreRules: () => parseGitIgnoreRules
23
- });
24
- module.exports = __toCommonJS(git_exports);
25
- function parseGitIgnoreRules(content) {
26
- return content.split(/\r?\n/).map((line) => line.trim()).filter((line) => line && !line.startsWith("#")).map((line) => parseGitIgnoreRule(line)).filter((rule) => rule !== null);
27
- }
28
- function parseGitIgnoreRule(line) {
29
- if (!line || line.startsWith("#")) {
30
- return null;
31
- }
32
- const isNegation = line.startsWith("!");
33
- const pattern = isNegation ? line.slice(1) : line;
34
- if (!pattern) {
35
- return null;
36
- }
37
- const isDirectory = pattern.endsWith("/");
38
- const cleanPattern = isDirectory ? pattern.slice(0, -1) : pattern;
39
- const isGlob = /[*?\[\]]/.test(cleanPattern);
40
- return {
41
- pattern: cleanPattern,
42
- isNegation,
43
- isDirectory,
44
- isGlob
45
- };
46
- }
47
- function collectAllGitIgnoreRules(files) {
48
- const allRules = [];
49
- const gitignoreFiles = Object.entries(files).filter(([filePath]) => filePath.endsWith(".gitignore")).sort(([a], [b]) => a.split("/").length - b.split("/").length);
50
- for (const [gitignorePath, content] of gitignoreFiles) {
51
- const rules = parseGitIgnoreRules(content);
52
- const gitignoreDir = gitignorePath.replace(".gitignore", "");
53
- for (const rule of rules) {
54
- const contextualRule = createContextualRule(rule, gitignoreDir);
55
- allRules.push(contextualRule);
56
- }
57
- }
58
- return allRules;
59
- }
60
- function createContextualRule(rule, contextPath) {
61
- return {
62
- ...rule,
63
- contextPath: contextPath || "."
64
- };
65
- }
66
- function isIgnored(filePath, rules) {
67
- const contextualRules = rules.map((rule) => {
68
- if ("contextPath" in rule) {
69
- return rule;
70
- }
71
- return { ...rule, contextPath: "." };
72
- });
73
- const sortedRules = [...contextualRules].sort((a, b) => {
74
- if (a.isNegation !== b.isNegation) {
75
- return a.isNegation ? 1 : -1;
76
- }
77
- return 0;
78
- });
79
- let isIgnored2 = false;
80
- for (const rule of sortedRules) {
81
- const matches = matchesContextualGitIgnorePattern(filePath, rule);
82
- if (rule.isNegation) {
83
- if (matches) {
84
- isIgnored2 = false;
85
- }
86
- } else {
87
- if (matches) {
88
- isIgnored2 = true;
89
- }
90
- }
91
- }
92
- return isIgnored2;
93
- }
94
- function matchesContextualGitIgnorePattern(filePath, rule) {
95
- const { pattern, isDirectory, isGlob, contextPath } = rule;
96
- if (contextPath !== "." && !filePath.startsWith(contextPath)) {
97
- return false;
98
- }
99
- if (!pattern.startsWith("/")) {
100
- const relativePath = contextPath === "." ? filePath : filePath.substring(contextPath.length);
101
- if (isDirectory) {
102
- const matches = relativePath.startsWith(pattern + "/") || relativePath === pattern;
103
- return matches;
104
- } else if (isGlob) {
105
- return matchesGitIgnorePattern(relativePath, {
106
- pattern,
107
- isDirectory,
108
- isGlob,
109
- isNegation: rule.isNegation
110
- });
111
- } else {
112
- return relativePath === pattern || relativePath.startsWith(pattern + "/");
113
- }
114
- } else {
115
- return matchesGitIgnorePattern(filePath, {
116
- pattern,
117
- isDirectory,
118
- isGlob,
119
- isNegation: rule.isNegation
120
- });
121
- }
122
- }
123
- function matchesGitIgnorePattern(filePath, rule) {
124
- const { pattern, isDirectory, isGlob } = rule;
125
- if (isDirectory) {
126
- const dirPath = filePath.split("/").slice(0, -1).join("/");
127
- return matchesPattern(dirPath, pattern, isGlob);
128
- }
129
- return matchesPattern(filePath, pattern, isGlob);
130
- }
131
- function matchesPattern(path, pattern, isGlob) {
132
- if (isGlob) {
133
- const regexPattern = globToRegex(pattern);
134
- return new RegExp(regexPattern).test(path);
135
- } else {
136
- return path.includes(pattern);
137
- }
138
- }
139
- function globToRegex(pattern) {
140
- return pattern.replace(/\./g, "\\.").replace(/\*/g, ".*").replace(/\?/g, ".").replace(/\[([^\]]*)\]/g, "[$1]").replace(/\//g, "\\/");
141
- }
142
- // Annotate the CommonJS export names for ESM import in node:
143
- 0 && (module.exports = {
144
- collectAllGitIgnoreRules,
145
- isIgnored,
146
- parseGitIgnoreRules
147
- });