@elysiumoss/grepo 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (72) hide show
  1. package/LICENSE.md +20 -0
  2. package/README.md +61 -0
  3. package/lib/cli.d.ts +1 -0
  4. package/lib/cli.js +84 -0
  5. package/lib/cli.js.map +1 -0
  6. package/lib/commands/analyze.d.ts +11 -0
  7. package/lib/commands/analyze.d.ts.map +1 -0
  8. package/lib/commands/analyze.js +49 -0
  9. package/lib/commands/analyze.js.map +1 -0
  10. package/lib/commands/describe.d.ts +11 -0
  11. package/lib/commands/describe.d.ts.map +1 -0
  12. package/lib/commands/describe.js +89 -0
  13. package/lib/commands/describe.js.map +1 -0
  14. package/lib/commands/readme.d.ts +11 -0
  15. package/lib/commands/readme.d.ts.map +1 -0
  16. package/lib/commands/readme.js +69 -0
  17. package/lib/commands/readme.js.map +1 -0
  18. package/lib/commands/topics.d.ts +11 -0
  19. package/lib/commands/topics.d.ts.map +1 -0
  20. package/lib/commands/topics.js +74 -0
  21. package/lib/commands/topics.js.map +1 -0
  22. package/lib/config.d.ts +31 -0
  23. package/lib/config.d.ts.map +1 -0
  24. package/lib/config.js +149 -0
  25. package/lib/config.js.map +1 -0
  26. package/lib/errors.d.ts +55 -0
  27. package/lib/errors.d.ts.map +1 -0
  28. package/lib/errors.js +27 -0
  29. package/lib/errors.js.map +1 -0
  30. package/lib/index.d.ts +14 -0
  31. package/lib/index.js +14 -0
  32. package/lib/mermaid.d.ts +17 -0
  33. package/lib/mermaid.d.ts.map +1 -0
  34. package/lib/mermaid.js +132 -0
  35. package/lib/mermaid.js.map +1 -0
  36. package/lib/prompts/readme.d.ts +90 -0
  37. package/lib/prompts/readme.d.ts.map +1 -0
  38. package/lib/prompts/readme.js +345 -0
  39. package/lib/prompts/readme.js.map +1 -0
  40. package/lib/services.d.ts +29 -0
  41. package/lib/services.d.ts.map +1 -0
  42. package/lib/services.js +59 -0
  43. package/lib/services.js.map +1 -0
  44. package/lib/utils/args.d.ts +15 -0
  45. package/lib/utils/args.d.ts.map +1 -0
  46. package/lib/utils/args.js +70 -0
  47. package/lib/utils/args.js.map +1 -0
  48. package/lib/utils/fetcher.d.ts +44 -0
  49. package/lib/utils/fetcher.d.ts.map +1 -0
  50. package/lib/utils/fetcher.js +173 -0
  51. package/lib/utils/fetcher.js.map +1 -0
  52. package/lib/utils/gemini.d.ts +25 -0
  53. package/lib/utils/gemini.d.ts.map +1 -0
  54. package/lib/utils/gemini.js +108 -0
  55. package/lib/utils/gemini.js.map +1 -0
  56. package/lib/utils/github.d.ts +28 -0
  57. package/lib/utils/github.d.ts.map +1 -0
  58. package/lib/utils/github.js +94 -0
  59. package/lib/utils/github.js.map +1 -0
  60. package/lib/utils/gitingest.d.ts +19 -0
  61. package/lib/utils/gitingest.d.ts.map +1 -0
  62. package/lib/utils/gitingest.js +46 -0
  63. package/lib/utils/gitingest.js.map +1 -0
  64. package/lib/utils/logger.d.ts +47 -0
  65. package/lib/utils/logger.d.ts.map +1 -0
  66. package/lib/utils/logger.js +155 -0
  67. package/lib/utils/logger.js.map +1 -0
  68. package/lib/utils/validation.d.ts +38 -0
  69. package/lib/utils/validation.d.ts.map +1 -0
  70. package/lib/utils/validation.js +65 -0
  71. package/lib/utils/validation.js.map +1 -0
  72. package/package.json +81 -0
@@ -0,0 +1,155 @@
1
+ import { Effect, LogLevel as LogLevel$1, Logger as Logger$1, Schema } from "effect";
2
+ //#region src/utils/logger.ts
3
+ /**
4
+ *
5
+ * Copyright 2026 Mike Odnis
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ *
19
+ */
20
+ let LogLevel = /* @__PURE__ */ function(LogLevel) {
21
+ LogLevel[LogLevel["NONE"] = 0] = "NONE";
22
+ LogLevel[LogLevel["ERROR"] = 1] = "ERROR";
23
+ LogLevel[LogLevel["WARN"] = 2] = "WARN";
24
+ LogLevel[LogLevel["INFO"] = 3] = "INFO";
25
+ LogLevel[LogLevel["DEBUG"] = 4] = "DEBUG";
26
+ LogLevel[LogLevel["TRACE"] = 5] = "TRACE";
27
+ LogLevel[LogLevel["ALL"] = 6] = "ALL";
28
+ return LogLevel;
29
+ }({});
30
+ const LogDataSchema = Schema.Record({
31
+ key: Schema.String,
32
+ value: Schema.Unknown
33
+ });
34
+ const LoggerOptionsSchema = Schema.Struct({
35
+ colorize: Schema.optional(Schema.Boolean),
36
+ filePath: Schema.optional(Schema.String),
37
+ includeTimestamp: Schema.optional(Schema.Boolean),
38
+ logToFile: Schema.optional(Schema.Boolean),
39
+ minLevel: Schema.optional(Schema.Literal(LogLevel.NONE, LogLevel.ERROR, LogLevel.WARN, LogLevel.INFO, LogLevel.DEBUG, LogLevel.TRACE, LogLevel.ALL))
40
+ });
41
+ var Logger = class Logger {
42
+ context;
43
+ minLevel;
44
+ static instances = /* @__PURE__ */ new Map();
45
+ constructor(context, options = {}) {
46
+ this.context = context;
47
+ this.minLevel = options.minLevel ?? (process.env.NODE_ENV === "production" ? LogLevel.ERROR : LogLevel.ALL);
48
+ }
49
+ static getLogger(context, options) {
50
+ let instance = Logger.instances.get(context);
51
+ if (!instance) {
52
+ instance = new Logger(context, options);
53
+ Logger.instances.set(context, instance);
54
+ }
55
+ return instance;
56
+ }
57
+ static setGlobalLogLevel(level) {
58
+ Logger.instances.forEach((logger) => {
59
+ logger.minLevel = level;
60
+ });
61
+ }
62
+ getEffectLogLevel(level) {
63
+ switch (level) {
64
+ case LogLevel.NONE: return LogLevel$1.None;
65
+ case LogLevel.ERROR: return LogLevel$1.Error;
66
+ case LogLevel.WARN: return LogLevel$1.Warning;
67
+ case LogLevel.INFO: return LogLevel$1.Info;
68
+ case LogLevel.DEBUG: return LogLevel$1.Debug;
69
+ case LogLevel.TRACE: return LogLevel$1.Debug;
70
+ case LogLevel.ALL: return LogLevel$1.All;
71
+ default: return LogLevel$1.Info;
72
+ }
73
+ }
74
+ run(effect) {
75
+ const minEffectLevel = this.getEffectLogLevel(this.minLevel);
76
+ const program = effect.pipe(Effect.annotateLogs({ context: this.context }), Logger$1.withMinimumLogLevel(minEffectLevel));
77
+ try {
78
+ Effect.runSync(Effect.scoped(program));
79
+ } catch (error) {
80
+ console.error("Logger failed:", error);
81
+ }
82
+ }
83
+ info(message, data) {
84
+ if (this.minLevel < LogLevel.INFO) return;
85
+ this.run(Effect.logInfo(message).pipe(Effect.annotateLogs(data ?? {})));
86
+ }
87
+ error(message, error, data) {
88
+ if (this.minLevel < LogLevel.ERROR) return;
89
+ let errorObj = error;
90
+ if (error instanceof Error) errorObj = {
91
+ message: error.message,
92
+ name: error.name,
93
+ stack: error.stack
94
+ };
95
+ this.run(Effect.logError(message).pipe(Effect.annotateLogs({
96
+ ...data,
97
+ error: errorObj
98
+ })));
99
+ }
100
+ warn(message, data) {
101
+ if (this.minLevel < LogLevel.WARN) return;
102
+ this.run(Effect.logWarning(message).pipe(Effect.annotateLogs(data ?? {})));
103
+ }
104
+ debug(message, data) {
105
+ if (this.minLevel < LogLevel.DEBUG) return;
106
+ this.run(Effect.logDebug(message).pipe(Effect.annotateLogs(data ?? {})));
107
+ }
108
+ trace(message, data) {
109
+ if (this.minLevel < LogLevel.TRACE) return;
110
+ this.run(Effect.logDebug(message).pipe(Effect.annotateLogs({
111
+ ...data,
112
+ level: "TRACE"
113
+ })));
114
+ }
115
+ action(message, data) {
116
+ if (this.minLevel < LogLevel.INFO) return;
117
+ this.run(Effect.logInfo(message).pipe(Effect.annotateLogs({
118
+ ...data,
119
+ type: "ACTION"
120
+ })));
121
+ }
122
+ success(message, data) {
123
+ if (this.minLevel < LogLevel.INFO) return;
124
+ this.run(Effect.logInfo(message).pipe(Effect.annotateLogs({
125
+ ...data,
126
+ type: "SUCCESS"
127
+ })));
128
+ }
129
+ group(label) {
130
+ if (this.minLevel < LogLevel.INFO) return;
131
+ console.group(label);
132
+ }
133
+ groupEnd() {
134
+ if (this.minLevel < LogLevel.INFO) return;
135
+ console.groupEnd();
136
+ }
137
+ async time(label, fn) {
138
+ if (this.minLevel < LogLevel.DEBUG) return fn();
139
+ const startTime = performance.now();
140
+ try {
141
+ const result = await fn();
142
+ const duration = (performance.now() - startTime).toFixed(2);
143
+ this.info(`${label} completed`, { duration: `${duration}ms` });
144
+ return result;
145
+ } catch (error) {
146
+ const duration = (performance.now() - startTime).toFixed(2);
147
+ this.error(`${label} failed`, error, { duration: `${duration}ms` });
148
+ throw error;
149
+ }
150
+ }
151
+ };
152
+ //#endregion
153
+ export { LogDataSchema, LogLevel, Logger, LoggerOptionsSchema };
154
+
155
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.js","names":["EffectLogLevel","EffectLogger"],"sources":["../../src/utils/logger.ts"],"sourcesContent":["/**\n *\n * Copyright 2026 Mike Odnis\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nimport {\n\tEffect,\n\tLogger as EffectLogger,\n\tLogLevel as EffectLogLevel,\n\tSchema,\n} from \"effect\";\n\nexport enum LogLevel {\n\tNONE = 0,\n\tERROR = 1,\n\tWARN = 2,\n\tINFO = 3,\n\tDEBUG = 4,\n\tTRACE = 5,\n\tALL = 6,\n}\n\nexport type ColorKey =\n\t| \"blue\"\n\t| \"bold\"\n\t| \"cyan\"\n\t| \"gray\"\n\t| \"green\"\n\t| \"magenta\"\n\t| \"red\"\n\t| \"reset\"\n\t| \"white\"\n\t| \"yellow\";\n\nexport const LogDataSchema = Schema.Record({\n\tkey: Schema.String,\n\tvalue: Schema.Unknown,\n});\nexport type LogData = Schema.Schema.Type<typeof LogDataSchema>;\n\nexport const LoggerOptionsSchema = Schema.Struct({\n\tcolorize: Schema.optional(Schema.Boolean),\n\tfilePath: Schema.optional(Schema.String),\n\tincludeTimestamp: Schema.optional(Schema.Boolean),\n\tlogToFile: Schema.optional(Schema.Boolean),\n\tminLevel: Schema.optional(\n\t\tSchema.Literal(\n\t\t\tLogLevel.NONE,\n\t\t\tLogLevel.ERROR,\n\t\t\tLogLevel.WARN,\n\t\t\tLogLevel.INFO,\n\t\t\tLogLevel.DEBUG,\n\t\t\tLogLevel.TRACE,\n\t\t\tLogLevel.ALL,\n\t\t),\n\t),\n});\nexport type LoggerOptions = Schema.Schema.Type<typeof LoggerOptionsSchema>;\n\nexport class Logger {\n\tprivate readonly context: string;\n\tprivate minLevel: LogLevel;\n\tprivate static readonly instances: Map<string, Logger> = new Map();\n\n\tconstructor(context: string, options: LoggerOptions = {}) {\n\t\tthis.context = context;\n\t\tthis.minLevel =\n\t\t\toptions.minLevel ??\n\t\t\t(process.env.NODE_ENV === \"production\" ? LogLevel.ERROR : LogLevel.ALL);\n\t}\n\n\tpublic static getLogger(context: string, options?: LoggerOptions): Logger {\n\t\tlet instance = Logger.instances.get(context);\n\t\tif (!instance) {\n\t\t\tinstance = new Logger(context, options);\n\t\t\tLogger.instances.set(context, instance);\n\t\t}\n\t\treturn instance;\n\t}\n\n\tpublic static setGlobalLogLevel(level: LogLevel): void {\n\t\tLogger.instances.forEach((logger) => {\n\t\t\tlogger.minLevel = level;\n\t\t});\n\t}\n\n\tprivate getEffectLogLevel(level: LogLevel): EffectLogLevel.LogLevel {\n\t\tswitch (level) {\n\t\t\tcase LogLevel.NONE:\n\t\t\t\treturn EffectLogLevel.None;\n\t\t\tcase LogLevel.ERROR:\n\t\t\t\treturn EffectLogLevel.Error;\n\t\t\tcase LogLevel.WARN:\n\t\t\t\treturn EffectLogLevel.Warning;\n\t\t\tcase LogLevel.INFO:\n\t\t\t\treturn EffectLogLevel.Info;\n\t\t\tcase LogLevel.DEBUG:\n\t\t\t\treturn EffectLogLevel.Debug;\n\t\t\tcase LogLevel.TRACE:\n\t\t\t\treturn EffectLogLevel.Debug;\n\t\t\tcase LogLevel.ALL:\n\t\t\t\treturn EffectLogLevel.All;\n\t\t\tdefault:\n\t\t\t\treturn EffectLogLevel.Info;\n\t\t}\n\t}\n\n\tprivate run(effect: Effect.Effect<void>) {\n\t\tconst minEffectLevel = this.getEffectLogLevel(this.minLevel);\n\t\tconst program = effect.pipe(\n\t\t\tEffect.annotateLogs({ context: this.context }),\n\t\t\tEffectLogger.withMinimumLogLevel(minEffectLevel),\n\t\t);\n\n\t\ttry {\n\t\t\tEffect.runSync(Effect.scoped(program));\n\t\t} catch (error) {\n\t\t\tconsole.error(\"Logger failed:\", error);\n\t\t}\n\t}\n\n\tinfo(message: string, data?: LogData): void {\n\t\tif (this.minLevel < LogLevel.INFO) {\n\t\t\treturn;\n\t\t}\n\t\tthis.run(Effect.logInfo(message).pipe(Effect.annotateLogs(data ?? {})));\n\t}\n\n\terror(message: string, error?: unknown, data?: LogData): void {\n\t\tif (this.minLevel < LogLevel.ERROR) {\n\t\t\treturn;\n\t\t}\n\t\tlet errorObj: unknown = error;\n\t\tif (error instanceof Error) {\n\t\t\terrorObj = {\n\t\t\t\tmessage: error.message,\n\t\t\t\tname: error.name,\n\t\t\t\tstack: error.stack,\n\t\t\t};\n\t\t}\n\t\tthis.run(\n\t\t\tEffect.logError(message).pipe(\n\t\t\t\tEffect.annotateLogs({ ...data, error: errorObj }),\n\t\t\t),\n\t\t);\n\t}\n\n\twarn(message: string, data?: LogData): void {\n\t\tif (this.minLevel < LogLevel.WARN) {\n\t\t\treturn;\n\t\t}\n\t\tthis.run(Effect.logWarning(message).pipe(Effect.annotateLogs(data ?? {})));\n\t}\n\n\tdebug(message: string, data?: LogData): void {\n\t\tif (this.minLevel < LogLevel.DEBUG) {\n\t\t\treturn;\n\t\t}\n\t\tthis.run(Effect.logDebug(message).pipe(Effect.annotateLogs(data ?? {})));\n\t}\n\n\ttrace(message: string, data?: LogData): void {\n\t\tif (this.minLevel < LogLevel.TRACE) {\n\t\t\treturn;\n\t\t}\n\t\tthis.run(\n\t\t\tEffect.logDebug(message).pipe(\n\t\t\t\tEffect.annotateLogs({ ...data, level: \"TRACE\" }),\n\t\t\t),\n\t\t);\n\t}\n\n\taction(message: string, data?: LogData): void {\n\t\tif (this.minLevel < LogLevel.INFO) {\n\t\t\treturn;\n\t\t}\n\t\tthis.run(\n\t\t\tEffect.logInfo(message).pipe(\n\t\t\t\tEffect.annotateLogs({ ...data, type: \"ACTION\" }),\n\t\t\t),\n\t\t);\n\t}\n\n\tsuccess(message: string, data?: LogData): void {\n\t\tif (this.minLevel < LogLevel.INFO) {\n\t\t\treturn;\n\t\t}\n\t\tthis.run(\n\t\t\tEffect.logInfo(message).pipe(\n\t\t\t\tEffect.annotateLogs({ ...data, type: \"SUCCESS\" }),\n\t\t\t),\n\t\t);\n\t}\n\n\tgroup(label: string): void {\n\t\tif (this.minLevel < LogLevel.INFO) {\n\t\t\treturn;\n\t\t}\n\t\tconsole.group(label);\n\t}\n\n\tgroupEnd(): void {\n\t\tif (this.minLevel < LogLevel.INFO) {\n\t\t\treturn;\n\t\t}\n\t\tconsole.groupEnd();\n\t}\n\n\tasync time<T>(label: string, fn: () => Promise<T> | T): Promise<T> {\n\t\tif (this.minLevel < LogLevel.DEBUG) {\n\t\t\treturn fn();\n\t\t}\n\t\tconst startTime = performance.now();\n\t\ttry {\n\t\t\tconst result = await fn();\n\t\t\tconst endTime = performance.now();\n\t\t\tconst duration = (endTime - startTime).toFixed(2);\n\t\t\tthis.info(`${label} completed`, { duration: `${duration}ms` });\n\t\t\treturn result;\n\t\t} catch (error) {\n\t\t\tconst endTime = performance.now();\n\t\t\tconst duration = (endTime - startTime).toFixed(2);\n\t\t\tthis.error(`${label} failed`, error, { duration: `${duration}ms` });\n\t\t\tthrow error;\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAyBA,IAAY,WAAL,yBAAA,UAAA;AACN,UAAA,SAAA,UAAA,KAAA;AACA,UAAA,SAAA,WAAA,KAAA;AACA,UAAA,SAAA,UAAA,KAAA;AACA,UAAA,SAAA,UAAA,KAAA;AACA,UAAA,SAAA,WAAA,KAAA;AACA,UAAA,SAAA,WAAA,KAAA;AACA,UAAA,SAAA,SAAA,KAAA;;KACA;AAcD,MAAa,gBAAgB,OAAO,OAAO;CAC1C,KAAK,OAAO;CACZ,OAAO,OAAO;CACd,CAAC;AAGF,MAAa,sBAAsB,OAAO,OAAO;CAChD,UAAU,OAAO,SAAS,OAAO,QAAQ;CACzC,UAAU,OAAO,SAAS,OAAO,OAAO;CACxC,kBAAkB,OAAO,SAAS,OAAO,QAAQ;CACjD,WAAW,OAAO,SAAS,OAAO,QAAQ;CAC1C,UAAU,OAAO,SAChB,OAAO,QACN,SAAS,MACT,SAAS,OACT,SAAS,MACT,SAAS,MACT,SAAS,OACT,SAAS,OACT,SAAS,IACT,CACD;CACD,CAAC;AAGF,IAAa,SAAb,MAAa,OAAO;CACnB;CACA;CACA,OAAwB,4BAAiC,IAAI,KAAK;CAElE,YAAY,SAAiB,UAAyB,EAAE,EAAE;AACzD,OAAK,UAAU;AACf,OAAK,WACJ,QAAQ,aACP,QAAQ,IAAI,aAAa,eAAe,SAAS,QAAQ,SAAS;;CAGrE,OAAc,UAAU,SAAiB,SAAiC;EACzE,IAAI,WAAW,OAAO,UAAU,IAAI,QAAQ;AAC5C,MAAI,CAAC,UAAU;AACd,cAAW,IAAI,OAAO,SAAS,QAAQ;AACvC,UAAO,UAAU,IAAI,SAAS,SAAS;;AAExC,SAAO;;CAGR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,QAAQ,EAAE;AACjD,QAAK,MAAM,GAAG,MAAM,UAAU,OAAO,EAAE,UAAU,GAAG,SAAS,KAAK,CAAC;AACnE,SAAM"}
@@ -0,0 +1,38 @@
1
+ //#region src/utils/validation.d.ts
2
+ /**
3
+ *
4
+ * Copyright 2026 Mike Odnis
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ */
19
+ declare function isValidGitHubUrl(url: string): url is string;
20
+ declare function isValidGitHubToken(token: string): boolean;
21
+ declare function isValidGeminiApiKey(apiKey: string): boolean;
22
+ declare function isValidBranchName(branch: string): boolean;
23
+ declare function parseGitHubUrl(url: string): {
24
+ owner: string;
25
+ repo: string;
26
+ };
27
+ declare class ValidationError extends Error {
28
+ readonly field?: string | undefined;
29
+ constructor(message: string, field?: string | undefined);
30
+ }
31
+ declare class ApiError extends Error {
32
+ readonly statusCode?: number | undefined;
33
+ readonly endpoint?: string | undefined;
34
+ constructor(message: string, statusCode?: number | undefined, endpoint?: string | undefined);
35
+ }
36
+ //#endregion
37
+ export { ApiError, ValidationError, isValidBranchName, isValidGeminiApiKey, isValidGitHubToken, isValidGitHubUrl, parseGitHubUrl };
38
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","names":[],"sources":["../../src/utils/validation.ts"],"sourcesContent":[],"mappings":";;AAkBA;AAaA;AAYA;AAIA;AAIA;AAcA;AAUA;;;;;;;;;;iBAzDgB,gBAAA;iBAaA,kBAAA;iBAYA,mBAAA;iBAIA,iBAAA;iBAIA,cAAA;;;;cAcH,eAAA,SAAwB,KAAA;;;;cAUxB,QAAA,SAAiB,KAAA"}
@@ -0,0 +1,65 @@
1
+ //#region src/utils/validation.ts
2
+ /**
3
+ *
4
+ * Copyright 2026 Mike Odnis
5
+ *
6
+ * Licensed under the Apache License, Version 2.0 (the "License");
7
+ * you may not use this file except in compliance with the License.
8
+ * You may obtain a copy of the License at
9
+ *
10
+ * http://www.apache.org/licenses/LICENSE-2.0
11
+ *
12
+ * Unless required by applicable law or agreed to in writing, software
13
+ * distributed under the License is distributed on an "AS IS" BASIS,
14
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15
+ * See the License for the specific language governing permissions and
16
+ * limitations under the License.
17
+ *
18
+ */
19
+ function isValidGitHubUrl(url) {
20
+ try {
21
+ const parsed = new URL(url);
22
+ return (parsed.protocol === "https:" || parsed.protocol === "http:") && parsed.hostname === "github.com" && parsed.pathname.split("/").filter(Boolean).length >= 2;
23
+ } catch {
24
+ return false;
25
+ }
26
+ }
27
+ function isValidGitHubToken(token) {
28
+ return typeof token === "string" && (token.startsWith("ghp_") || token.startsWith("github_pat_") || token.startsWith("gho_") || token.startsWith("ghu_") || token.startsWith("ghs_") || token.startsWith("ghr_"));
29
+ }
30
+ function isValidGeminiApiKey(apiKey) {
31
+ return typeof apiKey === "string" && apiKey.length >= 20;
32
+ }
33
+ function isValidBranchName(branch) {
34
+ return /^[a-zA-Z0-9._-]+$/.test(branch) && branch.length <= 255;
35
+ }
36
+ function parseGitHubUrl(url) {
37
+ const parts = new URL(url).pathname.split("/").filter(Boolean);
38
+ if (parts.length < 2) throw new Error(`Invalid GitHub URL: ${url}`);
39
+ const owner = parts[0];
40
+ const repo = parts[1];
41
+ if (!owner || !repo) throw new Error(`Invalid GitHub URL: ${url}`);
42
+ return {
43
+ owner,
44
+ repo
45
+ };
46
+ }
47
+ var ValidationError = class extends Error {
48
+ constructor(message, field) {
49
+ super(message);
50
+ this.field = field;
51
+ this.name = "ValidationError";
52
+ }
53
+ };
54
+ var ApiError = class extends Error {
55
+ constructor(message, statusCode, endpoint) {
56
+ super(message);
57
+ this.statusCode = statusCode;
58
+ this.endpoint = endpoint;
59
+ this.name = "ApiError";
60
+ }
61
+ };
62
+ //#endregion
63
+ export { ApiError, ValidationError, isValidBranchName, isValidGeminiApiKey, isValidGitHubToken, isValidGitHubUrl, parseGitHubUrl };
64
+
65
+ //# sourceMappingURL=validation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.js","names":[],"sources":["../../src/utils/validation.ts"],"sourcesContent":["/**\n *\n * Copyright 2026 Mike Odnis\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\nexport function isValidGitHubUrl(url: string): url is string {\n\ttry {\n\t\tconst parsed = new URL(url);\n\t\treturn (\n\t\t\t(parsed.protocol === \"https:\" || parsed.protocol === \"http:\") &&\n\t\t\tparsed.hostname === \"github.com\" &&\n\t\t\tparsed.pathname.split(\"/\").filter(Boolean).length >= 2\n\t\t);\n\t} catch {\n\t\treturn false;\n\t}\n}\n\nexport function isValidGitHubToken(token: string): boolean {\n\treturn (\n\t\ttypeof token === \"string\" &&\n\t\t(token.startsWith(\"ghp_\") ||\n\t\t\ttoken.startsWith(\"github_pat_\") ||\n\t\t\ttoken.startsWith(\"gho_\") ||\n\t\t\ttoken.startsWith(\"ghu_\") ||\n\t\t\ttoken.startsWith(\"ghs_\") ||\n\t\t\ttoken.startsWith(\"ghr_\"))\n\t);\n}\n\nexport function isValidGeminiApiKey(apiKey: string): boolean {\n\treturn typeof apiKey === \"string\" && apiKey.length >= 20;\n}\n\nexport function isValidBranchName(branch: string): boolean {\n\treturn /^[a-zA-Z0-9._-]+$/.test(branch) && branch.length <= 255;\n}\n\nexport function parseGitHubUrl(url: string): { owner: string; repo: string } {\n\tconst parsed = new URL(url);\n\tconst parts = parsed.pathname.split(\"/\").filter(Boolean);\n\tif (parts.length < 2) {\n\t\tthrow new Error(`Invalid GitHub URL: ${url}`);\n\t}\n\tconst owner = parts[0];\n\tconst repo = parts[1];\n\tif (!owner || !repo) {\n\t\tthrow new Error(`Invalid GitHub URL: ${url}`);\n\t}\n\treturn { owner, repo };\n}\n\nexport class ValidationError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic readonly field?: string,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"ValidationError\";\n\t}\n}\n\nexport class ApiError extends Error {\n\tconstructor(\n\t\tmessage: string,\n\t\tpublic readonly statusCode?: number,\n\t\tpublic readonly endpoint?: string,\n\t) {\n\t\tsuper(message);\n\t\tthis.name = \"ApiError\";\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAkBA,SAAgB,iBAAiB,KAA4B;AAC5D,KAAI;EACH,MAAM,SAAS,IAAI,IAAI,IAAI;AAC3B,UACE,OAAO,aAAa,YAAY,OAAO,aAAa,YACrD,OAAO,aAAa,gBACpB,OAAO,SAAS,MAAM,IAAI,CAAC,OAAO,QAAQ,CAAC,UAAU;SAE/C;AACP,SAAO;;;AAIT,SAAgB,mBAAmB,OAAwB;AAC1D,QACC,OAAO,UAAU,aAChB,MAAM,WAAW,OAAO,IACxB,MAAM,WAAW,cAAc,IAC/B,MAAM,WAAW,OAAO,IACxB,MAAM,WAAW,OAAO,IACxB,MAAM,WAAW,OAAO,IACxB,MAAM,WAAW,OAAO;;AAI3B,SAAgB,oBAAoB,QAAyB;AAC5D,QAAO,OAAO,WAAW,YAAY,OAAO,UAAU;;AAGvD,SAAgB,kBAAkB,QAAyB;AAC1D,QAAO,oBAAoB,KAAK,OAAO,IAAI,OAAO,UAAU;;AAG7D,SAAgB,eAAe,KAA8C;CAE5E,MAAM,QADS,IAAI,IAAI,IAAI,CACN,SAAS,MAAM,IAAI,CAAC,OAAO,QAAQ;AACxD,KAAI,MAAM,SAAS,EAClB,OAAM,IAAI,MAAM,uBAAuB,MAAM;CAE9C,MAAM,QAAQ,MAAM;CACpB,MAAM,OAAO,MAAM;AACnB,KAAI,CAAC,SAAS,CAAC,KACd,OAAM,IAAI,MAAM,uBAAuB,MAAM;AAE9C,QAAO;EAAE;EAAO;EAAM;;AAGvB,IAAa,kBAAb,cAAqC,MAAM;CAC1C,YACC,SACA,OACC;AACD,QAAM,QAAQ;AAFE,OAAA,QAAA;AAGhB,OAAK,OAAO;;;AAId,IAAa,WAAb,cAA8B,MAAM;CACnC,YACC,SACA,YACA,UACC;AACD,QAAM,QAAQ;AAHE,OAAA,aAAA;AACA,OAAA,WAAA;AAGhB,OAAK,OAAO"}
package/package.json ADDED
@@ -0,0 +1,81 @@
1
+ {
2
+ "name": "@elysiumoss/grepo",
3
+ "version": "0.2.0",
4
+ "description": "AI-powered GitHub repository management CLI — generate READMEs, topics, descriptions, and more using Gemini",
5
+ "keywords": [
6
+ "ai",
7
+ "cli",
8
+ "documentation",
9
+ "gemini",
10
+ "github",
11
+ "readme",
12
+ "repository"
13
+ ],
14
+ "repository": {
15
+ "type": "git",
16
+ "url": "git+https://github.com/ElysiumOSS/grepo.git"
17
+ },
18
+ "license": "MIT",
19
+ "author": {
20
+ "name": "Mike Odnis",
21
+ "url": "https://github.com/WomB0ComB0"
22
+ },
23
+ "type": "module",
24
+ "main": "lib/index.js",
25
+ "bin": {
26
+ "grepo": "lib/cli.js"
27
+ },
28
+ "files": [
29
+ "LICENSE.md",
30
+ "README.md",
31
+ "lib/",
32
+ "package.json"
33
+ ],
34
+ "scripts": {
35
+ "build": "tsdown",
36
+ "docs": "bunx typedoc --entryPointStrategy Expand src",
37
+ "format": "biome format --write .",
38
+ "lint": "biome check .",
39
+ "lint:knip": "knip",
40
+ "lint:md": "markdownlint \"**/*.md\" \".github/**/*.md\" --rules sentences-per-line",
41
+ "lint:packages": "bun pm ls",
42
+ "lint:spelling": "cspell \"**\" \".github/**/*\"",
43
+ "prepare": "husky",
44
+ "test": "vitest",
45
+ "tsc": "tsc"
46
+ },
47
+ "lint-staged": {
48
+ "*": "biome check --write --no-errors-on-unmatched --files-ignore-unknown=true"
49
+ },
50
+ "dependencies": {
51
+ "@effect/platform": "^0.94.2",
52
+ "@google/genai": "^1.22.0",
53
+ "@mermaid-js/mermaid-cli": "^11.12.0",
54
+ "effect": "^3.19.15"
55
+ },
56
+ "devDependencies": {
57
+ "@biomejs/biome": "^2.4.7",
58
+ "@release-it/conventional-changelog": "10.0.1",
59
+ "@types/bun": "^1.3.10",
60
+ "@types/node": "24.6.2",
61
+ "@vitest/coverage-v8": "3.2.4",
62
+ "console-fail-test": "0.5.0",
63
+ "cspell": "9.2.1",
64
+ "husky": "9.1.7",
65
+ "knip": "5.64.1",
66
+ "lint-staged": "16.2.3",
67
+ "markdownlint": "0.38.0",
68
+ "markdownlint-cli": "0.45.0",
69
+ "release-it": "19.0.5",
70
+ "sentences-per-line": "0.3.0",
71
+ "tsdown": "0.15.6",
72
+ "typescript": "5.9.3",
73
+ "vitest": "3.2.4"
74
+ },
75
+ "engines": {
76
+ "node": ">=20.19.0"
77
+ },
78
+ "publishConfig": {
79
+ "provenance": true
80
+ }
81
+ }