@eldrforge/kodrdriv 0.0.23 → 0.0.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/arguments.js +7 -4
- package/dist/arguments.js.map +1 -1
- package/dist/commands/audio-commit.js +2 -1
- package/dist/commands/audio-commit.js.map +1 -1
- package/dist/commands/audio-review.js +139 -19
- package/dist/commands/audio-review.js.map +1 -1
- package/dist/commands/release.js +5 -3
- package/dist/commands/release.js.map +1 -1
- package/dist/commands/review.js +24 -14
- package/dist/commands/review.js.map +1 -1
- package/dist/constants.js +3 -2
- package/dist/constants.js.map +1 -1
- package/dist/content/issues.js +170 -66
- package/dist/content/issues.js.map +1 -1
- package/dist/prompt/commit.js +2 -2
- package/dist/prompt/commit.js.map +1 -1
- package/dist/prompt/instructions/review.md +26 -9
- package/dist/prompt/release.js +2 -2
- package/dist/prompt/release.js.map +1 -1
- package/dist/prompt/review.js +31 -40
- package/dist/prompt/review.js.map +1 -1
- package/dist/types.js +3 -1
- package/dist/types.js.map +1 -1
- package/dist/util/general.js +55 -1
- package/dist/util/general.js.map +1 -1
- package/dist/util/openai.js +9 -0
- package/dist/util/openai.js.map +1 -1
- package/package.json +3 -3
package/dist/prompt/review.js
CHANGED
|
@@ -1,72 +1,63 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { recipe } from '@riotprompt/riotprompt';
|
|
2
2
|
import path from 'path';
|
|
3
3
|
import { fileURLToPath } from 'url';
|
|
4
4
|
|
|
5
5
|
const __filename = fileURLToPath(import.meta.url);
|
|
6
6
|
const __dirname = path.dirname(__filename);
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Build a review prompt using RiotPrompt Recipes.
|
|
9
|
+
*/ const createPrompt = async ({ overridePaths: _overridePaths, overrides: _overrides }, { notes }, { logContext, diffContext, releaseNotesContext, issuesContext, context, directories } = {})=>{
|
|
10
|
+
const basePath = __dirname;
|
|
11
|
+
// Build content items for the prompt
|
|
12
|
+
const contentItems = [];
|
|
13
|
+
const contextItems = [];
|
|
14
|
+
if (notes) {
|
|
15
|
+
contentItems.push({
|
|
11
16
|
content: notes,
|
|
12
|
-
title: 'Review Notes'
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
];
|
|
16
|
-
// Prepare context array for the recipe
|
|
17
|
-
const contextArray = [];
|
|
17
|
+
title: 'Review Notes'
|
|
18
|
+
});
|
|
19
|
+
}
|
|
18
20
|
if (logContext) {
|
|
19
|
-
|
|
21
|
+
contextItems.push({
|
|
20
22
|
content: logContext,
|
|
21
|
-
title: 'Log Context'
|
|
22
|
-
weight: 0.5
|
|
23
|
+
title: 'Log Context'
|
|
23
24
|
});
|
|
24
25
|
}
|
|
25
26
|
if (diffContext) {
|
|
26
|
-
|
|
27
|
+
contextItems.push({
|
|
27
28
|
content: diffContext,
|
|
28
|
-
title: 'Diff Context'
|
|
29
|
-
weight: 0.5
|
|
29
|
+
title: 'Diff Context'
|
|
30
30
|
});
|
|
31
31
|
}
|
|
32
32
|
if (releaseNotesContext) {
|
|
33
|
-
|
|
33
|
+
contextItems.push({
|
|
34
34
|
content: releaseNotesContext,
|
|
35
|
-
title: 'Release Notes Context'
|
|
36
|
-
weight: 0.5
|
|
35
|
+
title: 'Release Notes Context'
|
|
37
36
|
});
|
|
38
37
|
}
|
|
39
38
|
if (issuesContext) {
|
|
40
|
-
|
|
39
|
+
contextItems.push({
|
|
41
40
|
content: issuesContext,
|
|
42
|
-
title: 'Issues Context'
|
|
43
|
-
weight: 0.5
|
|
41
|
+
title: 'Issues Context'
|
|
44
42
|
});
|
|
45
43
|
}
|
|
46
44
|
if (context) {
|
|
47
|
-
|
|
45
|
+
contextItems.push({
|
|
48
46
|
content: context,
|
|
49
|
-
title: 'User Context'
|
|
50
|
-
weight: 1.0
|
|
47
|
+
title: 'User Context'
|
|
51
48
|
});
|
|
52
49
|
}
|
|
53
|
-
if (directories
|
|
54
|
-
|
|
50
|
+
if (directories && directories.length > 0) {
|
|
51
|
+
contextItems.push({
|
|
55
52
|
directories,
|
|
56
|
-
|
|
53
|
+
title: 'Directories'
|
|
57
54
|
});
|
|
58
55
|
}
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
overridePaths: overridePaths || [],
|
|
65
|
-
overrides: overrides || false,
|
|
66
|
-
template: 'review',
|
|
67
|
-
content,
|
|
68
|
-
context: contextArray
|
|
69
|
-
});
|
|
56
|
+
return recipe(basePath).persona({
|
|
57
|
+
path: 'personas/you.md'
|
|
58
|
+
}).instructions({
|
|
59
|
+
path: 'instructions/review.md'
|
|
60
|
+
}).overridePaths(_overridePaths !== null && _overridePaths !== void 0 ? _overridePaths : []).overrides(_overrides !== null && _overrides !== void 0 ? _overrides : true).content(...contentItems).context(...contextItems).cook();
|
|
70
61
|
};
|
|
71
62
|
|
|
72
63
|
export { createPrompt };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"review.js","sources":["../../src/prompt/review.ts"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"review.js","sources":["../../src/prompt/review.ts"],"sourcesContent":["import { ContentItem, Prompt, recipe } from '@riotprompt/riotprompt';\nimport path from 'path';\nimport { fileURLToPath } from 'url';\n\nconst __filename = fileURLToPath(import.meta.url);\nconst __dirname = path.dirname(__filename);\n\nexport type Config = {\n overridePaths?: string[];\n overrides?: boolean;\n}\n\nexport type Content = {\n notes: string;\n};\n\nexport type Context = {\n logContext?: string;\n diffContext?: string;\n releaseNotesContext?: string;\n issuesContext?: string;\n context?: string;\n directories?: string[];\n};\n\n/**\n * Build a review prompt using RiotPrompt Recipes.\n */\nexport const createPrompt = async (\n { overridePaths: _overridePaths, overrides: _overrides }: Config,\n { notes }: Content,\n { logContext, diffContext, releaseNotesContext, issuesContext, context, directories }: Context = {}\n): Promise<Prompt> => {\n const basePath = __dirname;\n\n // Build content items for the prompt\n const contentItems: ContentItem[] = [];\n const contextItems: ContentItem[] = [];\n\n if (notes) {\n contentItems.push({ content: notes, title: 'Review Notes' });\n }\n\n if (logContext) {\n contextItems.push({ content: logContext, title: 'Log Context' });\n }\n if (diffContext) {\n contextItems.push({ content: diffContext, title: 'Diff Context' });\n }\n if (releaseNotesContext) {\n contextItems.push({ content: releaseNotesContext, title: 'Release Notes Context' });\n }\n if (issuesContext) {\n contextItems.push({ content: issuesContext, title: 'Issues Context' });\n }\n if (context) {\n contextItems.push({ content: context, title: 'User Context' });\n }\n if (directories && directories.length > 0) {\n contextItems.push({ directories, title: 'Directories' });\n }\n\n return recipe(basePath)\n .persona({ path: 'personas/you.md' })\n .instructions({ path: 'instructions/review.md' })\n .overridePaths(_overridePaths ?? [])\n .overrides(_overrides ?? true)\n .content(...contentItems)\n .context(...contextItems)\n .cook();\n}; "],"names":["__filename","fileURLToPath","url","__dirname","path","dirname","createPrompt","overridePaths","_overridePaths","overrides","_overrides","notes","logContext","diffContext","releaseNotesContext","issuesContext","context","directories","basePath","contentItems","contextItems","push","content","title","length","recipe","persona","instructions","cook"],"mappings":";;;;AAIA,MAAMA,UAAAA,GAAaC,aAAAA,CAAc,MAAA,CAAA,IAAA,CAAYC,GAAG,CAAA;AAChD,MAAMC,SAAAA,GAAYC,IAAAA,CAAKC,OAAO,CAACL,UAAAA,CAAAA;AAoB/B;;AAEC,IACM,MAAMM,YAAAA,GAAe,OACxB,EAAEC,aAAAA,EAAeC,cAAc,EAAEC,SAAAA,EAAWC,UAAU,EAAU,EAChE,EAAEC,KAAK,EAAW,EAClB,EAAEC,UAAU,EAAEC,WAAW,EAAEC,mBAAmB,EAAEC,aAAa,EAAEC,OAAO,EAAEC,WAAW,EAAW,GAAG,EAAE,GAAA;AAEnG,IAAA,MAAMC,QAAAA,GAAWf,SAAAA;;AAGjB,IAAA,MAAMgB,eAA8B,EAAE;AACtC,IAAA,MAAMC,eAA8B,EAAE;AAEtC,IAAA,IAAIT,KAAAA,EAAO;AACPQ,QAA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CAACC,cAAAA,KAAAA,IAAAA,IAAAA,4BAAAA,cAAAA,GAAkB,EAAE,EAClCC,SAAS,CAACC,uBAAAA,UAAAA,KAAAA,MAAAA,GAAAA,UAAAA,GAAc,MACxBY,OAAO,CAAA,GAAIH,cACXH,OAAO,CAAA,GAAII,cACXQ,IAAI,EAAA;AACb;;;;"}
|
package/dist/types.js
CHANGED
|
@@ -27,7 +27,8 @@ const ConfigSchema = z.object({
|
|
|
27
27
|
from: z.string().optional(),
|
|
28
28
|
to: z.string().optional(),
|
|
29
29
|
messageLimit: z.number().optional(),
|
|
30
|
-
context: z.string().optional()
|
|
30
|
+
context: z.string().optional(),
|
|
31
|
+
focus: z.string().optional()
|
|
31
32
|
}).optional(),
|
|
32
33
|
review: z.object({
|
|
33
34
|
includeCommitHistory: z.boolean().optional(),
|
|
@@ -56,6 +57,7 @@ const ConfigSchema = z.object({
|
|
|
56
57
|
maxRecordingTime: z.number().optional(),
|
|
57
58
|
audioDevice: z.string().optional(),
|
|
58
59
|
file: z.string().optional(),
|
|
60
|
+
directory: z.string().optional(),
|
|
59
61
|
keepTemp: z.boolean().optional()
|
|
60
62
|
}).optional(),
|
|
61
63
|
publish: z.object({
|
package/dist/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import * as Cardigantime from '@theunwalked/cardigantime';\nimport { z } from \"zod\";\n\nexport const ConfigSchema = z.object({\n dryRun: z.boolean().optional(),\n verbose: z.boolean().optional(),\n debug: z.boolean().optional(),\n overrides: z.boolean().optional(),\n model: z.string().optional(),\n contextDirectories: z.array(z.string()).optional(),\n outputDirectory: z.string().optional(),\n preferencesDirectory: z.string().optional(),\n commit: z.object({\n add: z.boolean().optional(),\n cached: z.boolean().optional(),\n sendit: z.boolean().optional(),\n messageLimit: z.number().optional(),\n context: z.string().optional(),\n direction: z.string().optional(),\n }).optional(),\n audioCommit: z.object({\n maxRecordingTime: z.number().optional(),\n audioDevice: z.string().optional(),\n file: z.string().optional(),\n keepTemp: z.boolean().optional(),\n }).optional(),\n release: z.object({\n from: z.string().optional(),\n to: z.string().optional(),\n messageLimit: z.number().optional(),\n context: z.string().optional(),\n }).optional(),\n review: z.object({\n includeCommitHistory: z.boolean().optional(),\n includeRecentDiffs: z.boolean().optional(),\n includeReleaseNotes: z.boolean().optional(),\n includeGithubIssues: z.boolean().optional(),\n commitHistoryLimit: z.number().optional(),\n diffHistoryLimit: z.number().optional(),\n releaseNotesLimit: z.number().optional(),\n githubIssuesLimit: z.number().optional(),\n context: z.string().optional(),\n sendit: z.boolean().optional(),\n note: z.string().optional(),\n }).optional(),\n audioReview: z.object({\n includeCommitHistory: z.boolean().optional(),\n includeRecentDiffs: z.boolean().optional(),\n includeReleaseNotes: z.boolean().optional(),\n includeGithubIssues: z.boolean().optional(),\n commitHistoryLimit: z.number().optional(),\n diffHistoryLimit: z.number().optional(),\n releaseNotesLimit: z.number().optional(),\n githubIssuesLimit: z.number().optional(),\n context: z.string().optional(),\n sendit: z.boolean().optional(),\n maxRecordingTime: z.number().optional(),\n audioDevice: z.string().optional(),\n file: z.string().optional(),\n keepTemp: z.boolean().optional(),\n }).optional(),\n publish: z.object({\n mergeMethod: z.enum(['merge', 'squash', 'rebase']).optional(),\n dependencyUpdatePatterns: z.array(z.string()).optional(),\n requiredEnvVars: z.array(z.string()).optional(),\n linkWorkspacePackages: z.boolean().optional(),\n unlinkWorkspacePackages: z.boolean().optional(),\n }).optional(),\n link: z.object({\n scopeRoots: z.record(z.string(), z.string()).optional(),\n workspaceFile: z.string().optional(),\n dryRun: z.boolean().optional(),\n }).optional(),\n excludedPatterns: z.array(z.string()).optional(),\n});\n\nexport const SecureConfigSchema = z.object({\n openaiApiKey: z.string().optional(),\n});\n\nexport const CommandConfigSchema = z.object({\n commandName: z.string().optional(),\n});\n\nexport type Config = z.infer<typeof ConfigSchema> & Cardigantime.Config;\nexport type SecureConfig = z.infer<typeof SecureConfigSchema>;\nexport type CommandConfig = z.infer<typeof CommandConfigSchema>;\n\nexport type MergeMethod = 'merge' | 'squash' | 'rebase';\n\nexport interface PullRequest {\n html_url: string;\n number: number;\n labels: {\n name: string;\n }[];\n}\n\nexport type ReleaseSummary = {\n title: string;\n body: string;\n}\n\nexport type ReleaseConfig = {\n from?: string;\n to?: string;\n context?: string;\n}\n\nexport type ReviewConfig = {\n includeCommitHistory?: boolean;\n includeRecentDiffs?: boolean;\n includeReleaseNotes?: boolean;\n includeGithubIssues?: boolean;\n commitHistoryLimit?: number;\n diffHistoryLimit?: number;\n releaseNotesLimit?: number;\n githubIssuesLimit?: number;\n context?: string;\n sendit?: boolean;\n note?: string;\n}\n\nexport type AudioReviewConfig = {\n includeCommitHistory?: boolean;\n includeRecentDiffs?: boolean;\n includeReleaseNotes?: boolean;\n includeGithubIssues?: boolean;\n commitHistoryLimit?: number;\n diffHistoryLimit?: number;\n releaseNotesLimit?: number;\n githubIssuesLimit?: number;\n context?: string;\n sendit?: boolean;\n maxRecordingTime?: number;\n audioDevice?: string;\n file?: string;\n keepTemp?: boolean;\n}\n\nexport type AudioCommitConfig = {\n maxRecordingTime?: number;\n audioDevice?: string;\n file?: string;\n keepTemp?: boolean;\n}\n\nexport type PublishConfig = {\n from?: string;\n to?: string;\n}\n"],"names":["ConfigSchema","z","object","dryRun","boolean","optional","verbose","debug","overrides","model","string","contextDirectories","array","outputDirectory","preferencesDirectory","commit","add","cached","sendit","messageLimit","number","context","direction","audioCommit","maxRecordingTime","audioDevice","file","keepTemp","release","from","to","review","includeCommitHistory","includeRecentDiffs","includeReleaseNotes","includeGithubIssues","commitHistoryLimit","diffHistoryLimit","releaseNotesLimit","githubIssuesLimit","note","audioReview","publish","mergeMethod","enum","dependencyUpdatePatterns","requiredEnvVars","linkWorkspacePackages","unlinkWorkspacePackages","link","scopeRoots","record","workspaceFile","excludedPatterns","openaiApiKey","commandName"],"mappings":";;AAGO,MAAMA,YAAAA,GAAeC,CAAAA,CAAEC,MAAM,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AA,CAAEC,MAAM,CAAC;IACxCqD,WAAAA,EAAatD,CAAAA,CAAES,MAAM,EAAA,CAAGL,QAAQ;AACpC,CAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"types.js","sources":["../src/types.ts"],"sourcesContent":["import * as Cardigantime from '@theunwalked/cardigantime';\nimport { z } from \"zod\";\n\nexport const ConfigSchema = z.object({\n dryRun: z.boolean().optional(),\n verbose: z.boolean().optional(),\n debug: z.boolean().optional(),\n overrides: z.boolean().optional(),\n model: z.string().optional(),\n contextDirectories: z.array(z.string()).optional(),\n outputDirectory: z.string().optional(),\n preferencesDirectory: z.string().optional(),\n commit: z.object({\n add: z.boolean().optional(),\n cached: z.boolean().optional(),\n sendit: z.boolean().optional(),\n messageLimit: z.number().optional(),\n context: z.string().optional(),\n direction: z.string().optional(),\n }).optional(),\n audioCommit: z.object({\n maxRecordingTime: z.number().optional(),\n audioDevice: z.string().optional(),\n file: z.string().optional(),\n keepTemp: z.boolean().optional(),\n }).optional(),\n release: z.object({\n from: z.string().optional(),\n to: z.string().optional(),\n messageLimit: z.number().optional(),\n context: z.string().optional(),\n focus: z.string().optional(),\n }).optional(),\n review: z.object({\n includeCommitHistory: z.boolean().optional(),\n includeRecentDiffs: z.boolean().optional(),\n includeReleaseNotes: z.boolean().optional(),\n includeGithubIssues: z.boolean().optional(),\n commitHistoryLimit: z.number().optional(),\n diffHistoryLimit: z.number().optional(),\n releaseNotesLimit: z.number().optional(),\n githubIssuesLimit: z.number().optional(),\n context: z.string().optional(),\n sendit: z.boolean().optional(),\n note: z.string().optional(),\n }).optional(),\n audioReview: z.object({\n includeCommitHistory: z.boolean().optional(),\n includeRecentDiffs: z.boolean().optional(),\n includeReleaseNotes: z.boolean().optional(),\n includeGithubIssues: z.boolean().optional(),\n commitHistoryLimit: z.number().optional(),\n diffHistoryLimit: z.number().optional(),\n releaseNotesLimit: z.number().optional(),\n githubIssuesLimit: z.number().optional(),\n context: z.string().optional(),\n sendit: z.boolean().optional(),\n maxRecordingTime: z.number().optional(),\n audioDevice: z.string().optional(),\n file: z.string().optional(),\n directory: z.string().optional(),\n keepTemp: z.boolean().optional(),\n }).optional(),\n publish: z.object({\n mergeMethod: z.enum(['merge', 'squash', 'rebase']).optional(),\n dependencyUpdatePatterns: z.array(z.string()).optional(),\n requiredEnvVars: z.array(z.string()).optional(),\n linkWorkspacePackages: z.boolean().optional(),\n unlinkWorkspacePackages: z.boolean().optional(),\n }).optional(),\n link: z.object({\n scopeRoots: z.record(z.string(), z.string()).optional(),\n workspaceFile: z.string().optional(),\n dryRun: z.boolean().optional(),\n }).optional(),\n excludedPatterns: z.array(z.string()).optional(),\n});\n\nexport const SecureConfigSchema = z.object({\n openaiApiKey: z.string().optional(),\n});\n\nexport const CommandConfigSchema = z.object({\n commandName: z.string().optional(),\n});\n\nexport type Config = z.infer<typeof ConfigSchema> & Cardigantime.Config;\nexport type SecureConfig = z.infer<typeof SecureConfigSchema>;\nexport type CommandConfig = z.infer<typeof CommandConfigSchema>;\n\nexport type MergeMethod = 'merge' | 'squash' | 'rebase';\n\nexport interface PullRequest {\n html_url: string;\n number: number;\n labels: {\n name: string;\n }[];\n}\n\nexport type ReleaseSummary = {\n title: string;\n body: string;\n}\n\nexport type ReleaseConfig = {\n from?: string;\n to?: string;\n context?: string;\n focus?: string;\n}\n\nexport type ReviewConfig = {\n includeCommitHistory?: boolean;\n includeRecentDiffs?: boolean;\n includeReleaseNotes?: boolean;\n includeGithubIssues?: boolean;\n commitHistoryLimit?: number;\n diffHistoryLimit?: number;\n releaseNotesLimit?: number;\n githubIssuesLimit?: number;\n context?: string;\n sendit?: boolean;\n note?: string;\n}\n\nexport type AudioReviewConfig = {\n includeCommitHistory?: boolean;\n includeRecentDiffs?: boolean;\n includeReleaseNotes?: boolean;\n includeGithubIssues?: boolean;\n commitHistoryLimit?: number;\n diffHistoryLimit?: number;\n releaseNotesLimit?: number;\n githubIssuesLimit?: number;\n context?: string;\n sendit?: boolean;\n maxRecordingTime?: number;\n audioDevice?: string;\n file?: string;\n directory?: string;\n keepTemp?: boolean;\n}\n\nexport type AudioCommitConfig = {\n maxRecordingTime?: number;\n audioDevice?: string;\n file?: string;\n keepTemp?: boolean;\n}\n\nexport type PublishConfig = {\n from?: string;\n to?: string;\n}\n"],"names":["ConfigSchema","z","object","dryRun","boolean","optional","verbose","debug","overrides","model","string","contextDirectories","array","outputDirectory","preferencesDirectory","commit","add","cached","sendit","messageLimit","number","context","direction","audioCommit","maxRecordingTime","audioDevice","file","keepTemp","release","from","to","focus","review","includeCommitHistory","includeRecentDiffs","includeReleaseNotes","includeGithubIssues","commitHistoryLimit","diffHistoryLimit","releaseNotesLimit","githubIssuesLimit","note","audioReview","directory","publish","mergeMethod","enum","dependencyUpdatePatterns","requiredEnvVars","linkWorkspacePackages","unlinkWorkspacePackages","link","scopeRoots","record","workspaceFile","excludedPatterns","openaiApiKey","commandName"],"mappings":";;AAGO,MAAMA,YAAAA,GAAeC,CAAAA,CAAEC,MAAM,CAAC;IACjCC,MAAAA,EAAQF,CAAAA,CAAEG,OAAO,EAAA,CAAGC,QAAQ,EAAA;IAC5BC,OAAAA,EAASL,CAAAA,CAAEG,OAAO,EAAA,CAAGC,QAAQ,EAAA;IAC7BE,KAAAA,EAAON,CAAAA,CAAEG,OAAO,EAAA,CAAGC,QAAQ,EAAA;IAC3BG,SAAAA,EAAWP,CAAAA,CAAEG,OAAO,EAAA,CAAGC,QAAQ,EAAA;IAC/BI,KAAAA,EAAOR,CAAAA,CAAES,MAAM,EAAA,CAAGL,QAAQ,EAAA;AAC1BM,IAAAA,kBAAAA,EAAoBV,EAAEW,KAAK,CAACX,CAAAA,CAAES,MAAM,IAAIL,QAAQ,EAAA;IAChDQ,eAAAA,EAAiBZ,CAAAA,CAAES,MAAM,EAAA,CAAGL,QAAQ,EAAA;IACpCS,oBAAAA,EAAsBb,CAAAA,CAAES,MAAM,EAAA,CAAGL,QAAQ,EAAA;IACzCU,MAAAA,EAAQd,CAAAA,CAAEC,MA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C4C,qBAAAA,EAAuBhD,CAAAA,CAAEG,OAAO,EAAA,CAAGC,QAAQ,EAAA;QAC3C6C,uBAAAA,EAAyBjD,CAAAA,CAAEG,OAAO,EAAA,CAAGC,QAAQ;AACjD,KAAA,CAAA,CAAGA,QAAQ,EAAA;IACX8C,IAAAA,EAAMlD,CAAAA,CAAEC,MAAM,CAAC;QACXkD,UAAAA,EAAYnD,CAAAA,CAAEoD,MAAM,CAACpD,CAAAA,CAAES,MAAM,EAAA,EAAIT,CAAAA,CAAES,MAAM,EAAA,CAAA,CAAIL,QAAQ,EAAA;QACrDiD,aAAAA,EAAerD,CAAAA,CAAES,MAAM,EAAA,CAAGL,QAAQ,EAAA;QAClCF,MAAAA,EAAQF,CAAAA,CAAEG,OAAO,EAAA,CAAGC,QAAQ;AAChC,KAAA,CAAA,CAAGA,QAAQ,EAAA;AACXkD,IAAAA,gBAAAA,EAAkBtD,EAAEW,KAAK,CAACX,CAAAA,CAAES,MAAM,IAAIL,QAAQ;AAClD,CAAA;AAEkCJ,CAAAA,CAAEC,MAAM,CAAC;IACvCsD,YAAAA,EAAcvD,CAAAA,CAAES,MAAM,EAAA,CAAGL,QAAQ;AACrC,CAAA;AAEmCJ,CAAAA,CAAEC,MAAM,CAAC;IACxCuD,WAAAA,EAAaxD,CAAAA,CAAES,MAAM,EAAA,CAAGL,QAAQ;AACpC,CAAA;;;;"}
|
package/dist/util/general.js
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
import path from 'path';
|
|
2
|
+
import { create } from './storage.js';
|
|
3
|
+
import { getLogger } from '../logging.js';
|
|
4
|
+
import * as fs from 'fs';
|
|
2
5
|
|
|
3
6
|
//Recursive implementation of jSON.stringify;
|
|
4
7
|
const stringifyJSON = function(obj, options = {
|
|
@@ -91,6 +94,57 @@ const getTimestampedReviewFilename = ()=>{
|
|
|
91
94
|
const getTimestampedReviewNotesFilename = ()=>{
|
|
92
95
|
return getTimestampedFilename('review-notes', '.md');
|
|
93
96
|
};
|
|
97
|
+
const getTimestampedArchivedAudioFilename = (originalExtension = '.wav')=>{
|
|
98
|
+
return getTimestampedFilename('review-audio', originalExtension);
|
|
99
|
+
};
|
|
100
|
+
const getTimestampedArchivedTranscriptFilename = ()=>{
|
|
101
|
+
return getTimestampedFilename('review-transcript', '.md');
|
|
102
|
+
};
|
|
103
|
+
/**
|
|
104
|
+
* Archives an audio file and its transcription to the output/kodrdriv directory
|
|
105
|
+
* @param originalAudioPath - Path to the original audio file
|
|
106
|
+
* @param transcriptionText - The raw transcription text
|
|
107
|
+
* @param outputDirectory - Base output directory (default: 'output')
|
|
108
|
+
* @returns Object containing the paths where files were archived
|
|
109
|
+
*/ const archiveAudio = async (originalAudioPath, transcriptionText, outputDirectory = 'output')=>{
|
|
110
|
+
const logger = getLogger();
|
|
111
|
+
const storage = create({
|
|
112
|
+
log: logger.debug
|
|
113
|
+
});
|
|
114
|
+
try {
|
|
115
|
+
// Ensure the output directory exists (should already be output/kodrdriv)
|
|
116
|
+
await storage.ensureDirectory(outputDirectory);
|
|
117
|
+
// Get file extension from original audio file
|
|
118
|
+
const originalExtension = path.extname(originalAudioPath);
|
|
119
|
+
// Generate timestamped filenames
|
|
120
|
+
const archivedAudioFilename = getTimestampedArchivedAudioFilename(originalExtension);
|
|
121
|
+
const archivedTranscriptFilename = getTimestampedArchivedTranscriptFilename();
|
|
122
|
+
// Full paths for archived files - directly in the output directory
|
|
123
|
+
const archivedAudioPath = path.join(outputDirectory, archivedAudioFilename);
|
|
124
|
+
const archivedTranscriptPath = path.join(outputDirectory, archivedTranscriptFilename);
|
|
125
|
+
// Copy audio file if it exists
|
|
126
|
+
if (await storage.isFileReadable(originalAudioPath)) {
|
|
127
|
+
// Read original audio file as buffer using fs directly for binary files
|
|
128
|
+
const audioBuffer = await fs.promises.readFile(originalAudioPath);
|
|
129
|
+
await storage.writeFile(archivedAudioPath, audioBuffer, 'binary');
|
|
130
|
+
logger.debug('Archived audio file to: %s', archivedAudioPath);
|
|
131
|
+
} else {
|
|
132
|
+
logger.warn('Original audio file not found or not readable: %s', originalAudioPath);
|
|
133
|
+
}
|
|
134
|
+
// Save transcription text
|
|
135
|
+
const transcriptContent = `# Audio Transcription Archive\n\n**Original Audio File:** ${originalAudioPath}\n**Archived:** ${new Date().toISOString()}\n\n## Transcription\n\n${transcriptionText}`;
|
|
136
|
+
await storage.writeFile(archivedTranscriptPath, transcriptContent, 'utf8');
|
|
137
|
+
logger.debug('Archived transcription to: %s', archivedTranscriptPath);
|
|
138
|
+
logger.info('📁 Audio archived successfully - Audio: %s, Transcript: %s', archivedAudioFilename, archivedTranscriptFilename);
|
|
139
|
+
return {
|
|
140
|
+
audioPath: archivedAudioPath,
|
|
141
|
+
transcriptPath: archivedTranscriptPath
|
|
142
|
+
};
|
|
143
|
+
} catch (error) {
|
|
144
|
+
logger.error('Failed to archive audio: %s', error.message);
|
|
145
|
+
throw new Error(`Audio archiving failed: ${error.message}`);
|
|
146
|
+
}
|
|
147
|
+
};
|
|
94
148
|
|
|
95
|
-
export { getOutputPath, getTimestampedAudioFilename, getTimestampedCommitFilename, getTimestampedFilename, getTimestampedReleaseNotesFilename, getTimestampedRequestFilename, getTimestampedResponseFilename, getTimestampedReviewFilename, getTimestampedReviewNotesFilename, incrementPatchVersion, stringifyJSON };
|
|
149
|
+
export { archiveAudio, getOutputPath, getTimestampedArchivedAudioFilename, getTimestampedArchivedTranscriptFilename, getTimestampedAudioFilename, getTimestampedCommitFilename, getTimestampedFilename, getTimestampedReleaseNotesFilename, getTimestampedRequestFilename, getTimestampedResponseFilename, getTimestampedReviewFilename, getTimestampedReviewNotesFilename, incrementPatchVersion, stringifyJSON };
|
|
96
150
|
//# sourceMappingURL=general.js.map
|
package/dist/util/general.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"general.js","sources":["../../src/util/general.ts"],"sourcesContent":["import path from 'path';\n\n// Utility function for deep merging two objects.\nexport function deepMerge(target: any, source: any): any {\n for (const key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n if (key === \"__proto__\" || key === \"constructor\") {\n continue; // Skip prototype-polluting keys\n }\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n if (!target[key]) {\n target[key] = {};\n }\n deepMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n }\n }\n return target;\n}\n\n//Recursive implementation of jSON.stringify;\nexport const stringifyJSON = function (obj: any, options: { depth: number } = { depth: 0 }): string {\n\n if (options.depth > 10) {\n return '{\"error\": \"Maximum depth reached\"}';\n }\n\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 /*********CHECK FOR ARRAY**********/\n else if (Array.isArray(obj)) {\n //check for empty array\n if (obj[0] === undefined)\n return '[]';\n else {\n obj.forEach(function (el) {\n arrVals.push(stringifyJSON(el, { depth: options.depth + 1 }));\n });\n return '[' + arrVals + ']';\n }\n }\n /*********CHECK FOR OBJECT**********/\n else if (obj instanceof Object) {\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 arrOfKeyVals.push('');\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, { depth: options.depth + 1 }));\n }\n });\n return '{' + arrOfKeyVals + '}';\n }\n return '';\n};\n\nexport const incrementPatchVersion = (version: string): string => {\n const parts = version.split('.');\n if (parts.length !== 3) {\n throw new Error(`Invalid version string: ${version}`);\n }\n const patch = parseInt(parts[2], 10);\n if (isNaN(patch)) {\n throw new Error(`Invalid patch version: ${parts[2]}`);\n }\n parts[2] = (patch + 1).toString();\n return parts.join('.');\n};\n\nexport const getOutputPath = (outputDirectory: string, filename: string): string => {\n return path.join(outputDirectory, filename);\n};\n\nexport const getTimestampedFilename = (baseName: string, extension: string = '.json'): string => {\n const now = new Date();\n\n // Format as YYMMdd-HHmm (e.g., 250701-1030)\n const yy = now.getFullYear().toString().slice(-2);\n const mm = (now.getMonth() + 1).toString().padStart(2, '0');\n const dd = now.getDate().toString().padStart(2, '0');\n const hh = now.getHours().toString().padStart(2, '0');\n const min = now.getMinutes().toString().padStart(2, '0');\n\n const timestamp = `${yy}${mm}${dd}-${hh}${min}`;\n\n return `${timestamp}-${baseName}${extension}`;\n};\n\nexport const getTimestampedRequestFilename = (baseName: string): string => {\n return getTimestampedFilename(baseName, '.request.json');\n};\n\nexport const getTimestampedResponseFilename = (baseName: string): string => {\n return getTimestampedFilename(baseName, '.response.json');\n};\n\nexport const getTimestampedCommitFilename = (): string => {\n return getTimestampedFilename('commit-message', '.md');\n};\n\nexport const getTimestampedReleaseNotesFilename = (): string => {\n return getTimestampedFilename('release-notes', '.md');\n};\n\nexport const getTimestampedAudioFilename = (): string => {\n return getTimestampedFilename('audio-recording', '.wav');\n};\n\nexport const getTimestampedTranscriptFilename = (): string => {\n return getTimestampedFilename('audio-transcript', '.md');\n};\n\nexport const getTimestampedReviewFilename = (): string => {\n return getTimestampedFilename('review-analysis', '.md');\n};\n\nexport const getTimestampedReviewNotesFilename = (): string => {\n return getTimestampedFilename('review-notes', '.md');\n};"],"names":["stringifyJSON","obj","options","depth","arrOfKeyVals","arrVals","objKeys","Array","isArray","undefined","forEach","el","push","Object","keys","key","keyOut","keyValOut","Function","incrementPatchVersion","version","parts","split","length","Error","patch","parseInt","isNaN","toString","join","getOutputPath","outputDirectory","filename","path","getTimestampedFilename","baseName","extension","now","Date","yy","getFullYear","slice","mm","getMonth","padStart","dd","getDate","hh","getHours","min","getMinutes","timestamp","getTimestampedRequestFilename","getTimestampedResponseFilename","getTimestampedCommitFilename","getTimestampedReleaseNotesFilename","getTimestampedAudioFilename","getTimestampedReviewFilename","getTimestampedReviewNotesFilename"],"mappings":";;AAsBA;AACO,MAAMA,aAAAA,GAAgB,SAAUC,GAAQ,EAAEC,OAAAA,GAA6B;IAAEC,KAAAA,EAAO;AAAE,CAAC,EAAA;IAEtF,IAAID,OAAAA,CAAQC,KAAK,GAAG,EAAA,EAAI;QACpB,OAAO,oCAAA;AACX,IAAA;AAEA,IAAA,MAAMC,eAAyB,EAAE;AACjC,IAAA,MAAMC,UAAoB,EAAE;AAC5B,IAAA,IAAIC,UAAoB,EAAE;mDAG1B,IAAI,OAAOL,GAAAA,KAAQ,QAAA,IAAY,OAAOA,GAAAA,KAAQ,SAAA,IAAaA,GAAAA,KAAQ,IAAA,EAC/D,OAAO,EAAA,GAAKA,GAAAA;AACX,SAAA,IAAI,OAAOA,GAAAA,KAAQ,QAAA,EACpB,OAAO,MAAMA,GAAAA,GAAM,GAAA;SAGlB,IAAIM,KAAAA,CAAMC,OAAO,CAACP,GAAAA,CAAAA,EAAM;;AAEzB,QAAA,IAAIA,GAAG,CAAC,CAAA,CAAE,KAAKQ,WACX,OAAO,IAAA;AACN,aAAA;YACDR,GAAAA,CAAIS,OAAO,CAAC,SAAUC,EAAE,EAAA;gBACpBN,OAAAA,CAAQO,IAAI,CAACZ,aAAAA,CAAcW,EAAAA,EAAI;oBAAER,KAAAA,EAAOD,OAAAA,CAAQC,KAAK,GAAG;AAAE,iBAAA,CAAA,CAAA;AAC9D,YAAA,CAAA,CAAA;AACA,YAAA,OAAO,MAAME,OAAAA,GAAU,GAAA;AAC3B,QAAA;IACJ,CAAA,MAEK,IAAIJ,eAAeY,MAAAA,EAAQ;;QAE5BP,OAAAA,GAAUO,MAAAA,CAAOC,IAAI,CAACb,GAAA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AAA,CAAAA,CAAK;AAE/C,IAAA,OAAO,CAAA,EAAGE,SAAAA,CAAU,CAAC,EAAEhB,WAAWC,SAAAA,CAAAA,CAAW;AACjD;AAEO,MAAMgB,gCAAgC,CAACjB,QAAAA,GAAAA;AAC1C,IAAA,OAAOD,uBAAuBC,QAAAA,EAAU,eAAA,CAAA;AAC5C;AAEO,MAAMkB,iCAAiC,CAAClB,QAAAA,GAAAA;AAC3C,IAAA,OAAOD,uBAAuBC,QAAAA,EAAU,gBAAA,CAAA;AAC5C;MAEamB,4BAAAA,GAA+B,IAAA;AACxC,IAAA,OAAOpB,uBAAuB,gBAAA,EAAkB,KAAA,CAAA;AACpD;MAEaqB,kCAAAA,GAAqC,IAAA;AAC9C,IAAA,OAAOrB,uBAAuB,eAAA,EAAiB,KAAA,CAAA;AACnD;MAEasB,2BAAAA,GAA8B,IAAA;AACvC,IAAA,OAAOtB,uBAAuB,iBAAA,EAAmB,MAAA,CAAA;AACrD;MAMauB,4BAAAA,GAA+B,IAAA;AACxC,IAAA,OAAOvB,uBAAuB,iBAAA,EAAmB,KAAA,CAAA;AACrD;MAEawB,iCAAAA,GAAoC,IAAA;AAC7C,IAAA,OAAOxB,uBAAuB,cAAA,EAAgB,KAAA,CAAA;AAClD;;;;"}
|
|
1
|
+
{"version":3,"file":"general.js","sources":["../../src/util/general.ts"],"sourcesContent":["import path from 'path';\nimport * as Storage from './storage';\nimport { getLogger } from '../logging';\n// eslint-disable-next-line no-restricted-imports\nimport * as fs from 'fs';\n\n// Utility function for deep merging two objects.\nexport function deepMerge(target: any, source: any): any {\n for (const key in source) {\n if (Object.prototype.hasOwnProperty.call(source, key)) {\n if (key === \"__proto__\" || key === \"constructor\") {\n continue; // Skip prototype-polluting keys\n }\n if (source[key] && typeof source[key] === 'object' && !Array.isArray(source[key])) {\n if (!target[key]) {\n target[key] = {};\n }\n deepMerge(target[key], source[key]);\n } else {\n target[key] = source[key];\n }\n }\n }\n return target;\n}\n\n//Recursive implementation of jSON.stringify;\nexport const stringifyJSON = function (obj: any, options: { depth: number } = { depth: 0 }): string {\n\n if (options.depth > 10) {\n return '{\"error\": \"Maximum depth reached\"}';\n }\n\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 /*********CHECK FOR ARRAY**********/\n else if (Array.isArray(obj)) {\n //check for empty array\n if (obj[0] === undefined)\n return '[]';\n else {\n obj.forEach(function (el) {\n arrVals.push(stringifyJSON(el, { depth: options.depth + 1 }));\n });\n return '[' + arrVals + ']';\n }\n }\n /*********CHECK FOR OBJECT**********/\n else if (obj instanceof Object) {\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 arrOfKeyVals.push('');\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, { depth: options.depth + 1 }));\n }\n });\n return '{' + arrOfKeyVals + '}';\n }\n return '';\n};\n\nexport const incrementPatchVersion = (version: string): string => {\n const parts = version.split('.');\n if (parts.length !== 3) {\n throw new Error(`Invalid version string: ${version}`);\n }\n const patch = parseInt(parts[2], 10);\n if (isNaN(patch)) {\n throw new Error(`Invalid patch version: ${parts[2]}`);\n }\n parts[2] = (patch + 1).toString();\n return parts.join('.');\n};\n\nexport const getOutputPath = (outputDirectory: string, filename: string): string => {\n return path.join(outputDirectory, filename);\n};\n\nexport const getTimestampedFilename = (baseName: string, extension: string = '.json'): string => {\n const now = new Date();\n\n // Format as YYMMdd-HHmm (e.g., 250701-1030)\n const yy = now.getFullYear().toString().slice(-2);\n const mm = (now.getMonth() + 1).toString().padStart(2, '0');\n const dd = now.getDate().toString().padStart(2, '0');\n const hh = now.getHours().toString().padStart(2, '0');\n const min = now.getMinutes().toString().padStart(2, '0');\n\n const timestamp = `${yy}${mm}${dd}-${hh}${min}`;\n\n return `${timestamp}-${baseName}${extension}`;\n};\n\nexport const getTimestampedRequestFilename = (baseName: string): string => {\n return getTimestampedFilename(baseName, '.request.json');\n};\n\nexport const getTimestampedResponseFilename = (baseName: string): string => {\n return getTimestampedFilename(baseName, '.response.json');\n};\n\nexport const getTimestampedCommitFilename = (): string => {\n return getTimestampedFilename('commit-message', '.md');\n};\n\nexport const getTimestampedReleaseNotesFilename = (): string => {\n return getTimestampedFilename('release-notes', '.md');\n};\n\nexport const getTimestampedAudioFilename = (): string => {\n return getTimestampedFilename('audio-recording', '.wav');\n};\n\nexport const getTimestampedTranscriptFilename = (): string => {\n return getTimestampedFilename('audio-transcript', '.md');\n};\n\nexport const getTimestampedReviewFilename = (): string => {\n return getTimestampedFilename('review-analysis', '.md');\n};\n\nexport const getTimestampedReviewNotesFilename = (): string => {\n return getTimestampedFilename('review-notes', '.md');\n};\n\nexport const getTimestampedArchivedAudioFilename = (originalExtension: string = '.wav'): string => {\n return getTimestampedFilename('review-audio', originalExtension);\n};\n\nexport const getTimestampedArchivedTranscriptFilename = (): string => {\n return getTimestampedFilename('review-transcript', '.md');\n};\n\n/**\n * Archives an audio file and its transcription to the output/kodrdriv directory\n * @param originalAudioPath - Path to the original audio file\n * @param transcriptionText - The raw transcription text\n * @param outputDirectory - Base output directory (default: 'output')\n * @returns Object containing the paths where files were archived\n */\nexport const archiveAudio = async (\n originalAudioPath: string,\n transcriptionText: string,\n outputDirectory: string = 'output'\n): Promise<{ audioPath: string; transcriptPath: string }> => {\n const logger = getLogger();\n const storage = Storage.create({ log: logger.debug });\n\n try {\n // Ensure the output directory exists (should already be output/kodrdriv)\n await storage.ensureDirectory(outputDirectory);\n\n // Get file extension from original audio file\n const originalExtension = path.extname(originalAudioPath);\n\n // Generate timestamped filenames\n const archivedAudioFilename = getTimestampedArchivedAudioFilename(originalExtension);\n const archivedTranscriptFilename = getTimestampedArchivedTranscriptFilename();\n\n // Full paths for archived files - directly in the output directory\n const archivedAudioPath = path.join(outputDirectory, archivedAudioFilename);\n const archivedTranscriptPath = path.join(outputDirectory, archivedTranscriptFilename);\n\n // Copy audio file if it exists\n if (await storage.isFileReadable(originalAudioPath)) {\n // Read original audio file as buffer using fs directly for binary files\n const audioBuffer = await fs.promises.readFile(originalAudioPath);\n await storage.writeFile(archivedAudioPath, audioBuffer, 'binary');\n logger.debug('Archived audio file to: %s', archivedAudioPath);\n } else {\n logger.warn('Original audio file not found or not readable: %s', originalAudioPath);\n }\n\n // Save transcription text\n const transcriptContent = `# Audio Transcription Archive\\n\\n**Original Audio File:** ${originalAudioPath}\\n**Archived:** ${new Date().toISOString()}\\n\\n## Transcription\\n\\n${transcriptionText}`;\n await storage.writeFile(archivedTranscriptPath, transcriptContent, 'utf8');\n logger.debug('Archived transcription to: %s', archivedTranscriptPath);\n\n logger.info('📁 Audio archived successfully - Audio: %s, Transcript: %s', archivedAudioFilename, archivedTranscriptFilename);\n\n return {\n audioPath: archivedAudioPath,\n transcriptPath: archivedTranscriptPath\n };\n\n } catch (error: any) {\n logger.error('Failed to archive audio: %s', error.message);\n throw new Error(`Audio archiving failed: ${error.message}`);\n }\n};"],"names":["stringifyJSON","obj","options","depth","arrOfKeyVals","arrVals","objKeys","Array","isArray","undefined","forEach","el","push","Object","keys","key","keyOut","keyValOut","Function","incrementPatchVersion","version","parts","split","length","Error","patch","parseInt","isNaN","toString","join","getOutputPath","outputDirectory","filename","path","getTimestampedFilename","baseName","extension","now","Date","yy","getFullYear","slice","mm","getMonth","padStart","dd","getDate","hh","getHours","min","getMinutes","timestamp","getTimestampedRequestFilename","getTimestampedResponseFilename","getTimestampedCommitFilename","getTimestampedReleaseNotesFilename","getTimestampedAudioFilename","getTimestampedReviewFilename","getTimestampedReviewNotesFilename","getTimestampedArchivedAudioFilename","originalExtension","getTimestampedArchivedTranscriptFilename","archiveAudio","originalAudioPath","transcriptionText","logger","getLogger","storage","Storage","log","debug","ensureDirectory","extname","archivedAudioFilename","archivedTranscriptFilename","archivedAudioPath","archivedTranscriptPath","isFileReadable","audioBuffer","fs","promises","readFile","writeFile","warn","transcriptContent","toISOString","info","audioPath","transcriptPath","error","message"],"mappings":";;;;;AA0BA;AACO,MAAMA,aAAAA,GAAgB,SAAUC,GAAQ,EAAEC,OAAAA,GAA6B;IAAEC,KAAAA,EAAO;AAAE,CAAC,EAAA;IAEtF,IAAID,OAAAA,CAAQC,KAAK,GAAG,EAAA,EAAI;QACpB,OAAO,oCAAA;AACX,IAAA;AAEA,IAAA,MAAMC,eAAyB,EAAE;AACjC,IAAA,MAAMC,UAAoB,EAAE;AAC5B,IAAA,IAAIC,UAAoB,EAAE;mDAG1B,IAAI,OAAOL,GAAAA,KAAQ,QAAA,IAAY,OAAOA,GAAAA,KAAQ,SAAA,IAAaA,GAAAA,KAAQ,IAAA,EAC/D,OAAO,EAAA,GAAKA,GAAAA;AACX,SAAA,IAAI,OAAOA,GAAAA,KAAQ,QAAA,EACpB,OAAO,MAAMA,GAAAA,GAAM,GAAA;SAGlB,IAAIM,KAAAA,CAAMC,OAAO,CAACP,GAAAA,CAAAA,EAAM;;AAEzB,QAAA,IAAIA,GAAG,CAAC,CAAA,CAAE,KAAKQ,WACX,OAAO,IAAA;AACN,aAAA;YACDR,GAAAA,CAAIS,OAAO,CAAC,SAAUC,EAAE,EAAA;gBACpBN,OAAAA,CAAQO,IAAI,CAACZ,aAAAA,CAAcW,EAAAA,EAAI;oBAAER,KAAAA,EAAOD,OAAAA,CAAQC,KAAK,GAAG;AAAE,iBAAA,CAAA,CAAA;AAC9D,YAAA,CAAA,CAAA;A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ACjM,QAAA,MAAMG,OAAAA,CAAQe,SAAS,CAACN,sBAAAA,EAAwBQ,iBAAAA,EAAmB,MAAA,CAAA;QACnEnB,MAAAA,CAAOK,KAAK,CAAC,+BAAA,EAAiCM,sBAAAA,CAAAA;QAE9CX,MAAAA,CAAOqB,IAAI,CAAC,4DAAA,EAA8Db,qBAAAA,EAAuBC,0BAAAA,CAAAA;QAEjG,OAAO;YACHa,SAAAA,EAAWZ,iBAAAA;YACXa,cAAAA,EAAgBZ;AACpB,SAAA;AAEJ,IAAA,CAAA,CAAE,OAAOa,KAAAA,EAAY;AACjBxB,QAAAA,MAAAA,CAAOwB,KAAK,CAAC,6BAAA,EAA+BA,KAAAA,CAAMC,OAAO,CAAA;AACzD,QAAA,MAAM,IAAIlE,KAAAA,CAAM,CAAC,wBAAwB,EAAEiE,KAAAA,CAAMC,OAAO,CAAA,CAAE,CAAA;AAC9D,IAAA;AACJ;;;;"}
|
package/dist/util/openai.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { OpenAI } from 'openai';
|
|
2
2
|
import { create } from './storage.js';
|
|
3
3
|
import { getLogger } from '../logging.js';
|
|
4
|
+
import { archiveAudio } from './general.js';
|
|
4
5
|
|
|
5
6
|
class OpenAIError extends Error {
|
|
6
7
|
constructor(message){
|
|
@@ -124,6 +125,14 @@ async function transcribeAudio(filePath, options = {
|
|
|
124
125
|
throw new OpenAIError('No transcription received from OpenAI');
|
|
125
126
|
}
|
|
126
127
|
logger.debug('Received transcription from OpenAI: %s', response);
|
|
128
|
+
// Archive the audio file and transcription
|
|
129
|
+
try {
|
|
130
|
+
const outputDir = options.outputDirectory || 'output';
|
|
131
|
+
await archiveAudio(filePath, response.text, outputDir);
|
|
132
|
+
} catch (archiveError) {
|
|
133
|
+
// Don't fail the transcription if archiving fails, just log the error
|
|
134
|
+
logger.warn('Failed to archive audio file: %s', archiveError.message);
|
|
135
|
+
}
|
|
127
136
|
return response;
|
|
128
137
|
} catch (error) {
|
|
129
138
|
logger.error('Error transcribing audio file: %s %s', error.message, error.stack);
|
package/dist/util/openai.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"openai.js","sources":["../../src/util/openai.ts"],"sourcesContent":["import { OpenAI } from 'openai';\nimport { ChatCompletionMessageParam } from 'openai/resources';\nimport * as Storage from './storage';\nimport { getLogger } from '../logging';\n// eslint-disable-next-line no-restricted-imports\nimport fs from 'fs';\n\nexport interface Transcription {\n text: string;\n}\n\nexport class OpenAIError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'OpenAIError';\n }\n}\n\nexport async function createCompletion(messages: ChatCompletionMessageParam[], options: { responseFormat?: any, model?: string, debug?: boolean, debugFile?: string, debugRequestFile?: string, debugResponseFile?: string } = { model: \"gpt-4o-mini\" }): Promise<string | any> {\n const logger = getLogger();\n const storage = Storage.create({ log: logger.debug });\n let openai: OpenAI | null = null;\n try {\n const apiKey = process.env.OPENAI_API_KEY;\n if (!apiKey) {\n throw new OpenAIError('OPENAI_API_KEY environment variable is not set');\n }\n\n // Create the client which we'll close in the finally block.\n openai = new OpenAI({\n apiKey: apiKey,\n timeout: 180000, // 180 seconds timeout\n });\n\n logger.debug('Sending prompt to OpenAI: %j', messages);\n\n // Save request debug file if enabled\n if (options.debug && (options.debugRequestFile || options.debugFile)) {\n const requestData = {\n model: options.model || \"gpt-4o-mini\",\n messages,\n max_completion_tokens: 10000,\n response_format: options.responseFormat,\n };\n const debugFile = options.debugRequestFile || options.debugFile;\n await storage.writeFile(debugFile!, JSON.stringify(requestData, null, 2), 'utf8');\n logger.debug('Wrote request debug file to %s', debugFile);\n }\n\n // Add timeout wrapper to the OpenAI API call\n const completionPromise = openai.chat.completions.create({\n model: options.model || \"gpt-4o-mini\",\n messages,\n max_completion_tokens: 10000,\n response_format: options.responseFormat,\n });\n\n const timeoutPromise = new Promise<never>((_, reject) => {\n setTimeout(() => reject(new OpenAIError('OpenAI API call timed out after 180 seconds')), 180000);\n });\n\n const completion = await Promise.race([completionPromise, timeoutPromise]);\n\n // Save response debug file if enabled\n if (options.debug && (options.debugResponseFile || options.debugFile)) {\n const debugFile = options.debugResponseFile || options.debugFile;\n await storage.writeFile(debugFile!, JSON.stringify(completion, null, 2), 'utf8');\n logger.debug('Wrote response debug file to %s', debugFile);\n }\n\n const response = completion.choices[0]?.message?.content?.trim();\n if (!response) {\n throw new OpenAIError('No response received from OpenAI');\n }\n\n logger.debug('Received response from OpenAI: %s...', response.substring(0, 30));\n if (options.responseFormat) {\n return JSON.parse(response);\n } else {\n return response;\n }\n\n } catch (error: any) {\n logger.error('Error calling OpenAI API: %s %s', error.message, error.stack);\n throw new OpenAIError(`Failed to create completion: ${error.message}`);\n } finally {\n // OpenAI client cleanup is handled automatically by the library\n // No manual cleanup needed for newer versions\n }\n}\n\nexport async function transcribeAudio(filePath: string, options: { model?: string, debug?: boolean, debugFile?: string, debugRequestFile?: string, debugResponseFile?: string } = { model: \"whisper-1\" }): Promise<Transcription> {\n const logger = getLogger();\n const storage = Storage.create({ log: logger.debug });\n let openai: OpenAI | null = null;\n let audioStream: fs.ReadStream | null = null;\n try {\n const apiKey = process.env.OPENAI_API_KEY;\n if (!apiKey) {\n throw new OpenAIError('OPENAI_API_KEY environment variable is not set');\n }\n\n openai = new OpenAI({\n apiKey: apiKey,\n });\n\n logger.debug('Transcribing audio file: %s', filePath);\n\n // Save request debug file if enabled\n if (options.debug && (options.debugRequestFile || options.debugFile)) {\n const requestData = {\n model: options.model || \"whisper-1\",\n file: filePath, // Can't serialize the stream, so just save the file path\n response_format: \"json\",\n };\n const debugFile = options.debugRequestFile || options.debugFile;\n await storage.writeFile(debugFile!, JSON.stringify(requestData, null, 2), 'utf8');\n logger.debug('Wrote request debug file to %s', debugFile);\n }\n\n audioStream = await storage.readStream(filePath);\n const transcription = await openai.audio.transcriptions.create({\n model: options.model || \"whisper-1\",\n file: audioStream,\n response_format: \"json\",\n });\n\n // Save response debug file if enabled\n if (options.debug && (options.debugResponseFile || options.debugFile)) {\n const debugFile = options.debugResponseFile || options.debugFile;\n await storage.writeFile(debugFile!, JSON.stringify(transcription, null, 2), 'utf8');\n logger.debug('Wrote response debug file to %s', debugFile);\n }\n\n const response = transcription;\n if (!response) {\n throw new OpenAIError('No transcription received from OpenAI');\n }\n\n logger.debug('Received transcription from OpenAI: %s', response);\n return response;\n\n } catch (error: any) {\n logger.error('Error transcribing audio file: %s %s', error.message, error.stack);\n throw new OpenAIError(`Failed to transcribe audio: ${error.message}`);\n } finally {\n // Ensure the audio stream is properly closed to release file handles\n try {\n if (audioStream) {\n audioStream.close();\n }\n } catch (streamErr) {\n logger.debug('Failed to close audio read stream: %s', (streamErr as Error).message);\n }\n // OpenAI client cleanup is handled automatically by the library\n // No manual cleanup needed for newer versions\n }\n}\n"],"names":["OpenAIError","Error","message","name","createCompletion","messages","options","model","logger","getLogger","storage","Storage","log","debug","openai","completion","apiKey","process","env","OPENAI_API_KEY","OpenAI","timeout","debugRequestFile","debugFile","requestData","max_completion_tokens","response_format","responseFormat","writeFile","JSON","stringify","completionPromise","chat","completions","create","timeoutPromise","Promise","_","reject","setTimeout","race","debugResponseFile","response","choices","content","trim","substring","parse","error","stack","transcribeAudio","filePath","audioStream","file","readStream","transcription","audio","transcriptions","close","streamErr"],"mappings":";;;;AAWO,MAAMA,WAAAA,SAAoBC,KAAAA,CAAAA;AAC7B,IAAA,WAAA,CAAYC,OAAe,CAAE;AACzB,QAAA,KAAK,CAACA,OAAAA,CAAAA;QACN,IAAI,CAACC,IAAI,GAAG,aAAA;AAChB,IAAA;AACJ;AAEO,eAAeC,gBAAAA,CAAiBC,QAAsC,EAAEC,OAAAA,GAAgJ;IAAEC,KAAAA,EAAO;AAAc,CAAC,EAAA;AACnP,IAAA,MAAMC,MAAAA,GAASC,SAAAA,EAAAA;IACf,MAAMC,OAAAA,GAAUC,MAAc,CAAC;AAAEC,QAAAA,GAAAA,EAAKJ,OAAOK;AAAM,KAAA,CAAA;AACnD,IAAA,IAAIC,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SAAAA,CAAAA;AACpD,QAAA;AAEA,QAAA,MAAMmB,QAAAA,GAAWa,aAAAA;AACjB,QAAA,IAAI,CAACb,QAAAA,EAAU;AACX,YAAA,MAAM,IAAI1C,WAAAA,CAAY,uCAAA,CAAA;AAC1B,QAAA;QAEAQ,MAAAA,CAAOK,KAAK,CAAC,wCAAA,EAA0C6B,QAAAA,CAAAA;QACvD,OAAOA,QAAAA;AAEX,IAAA,CAAA,CAAE,OAAOM,KAAAA,EAAY;AACjBxC,QAAAA,MAAAA,CAAOwC,KAAK,CAAC,sCAAA,EAAwCA,MAAM9C,OAAO,EAAE8C,MAAMC,KAAK,CAAA;AAC/E,QAAA,MAAM,IAAIjD,WAAAA,CAAY,CAAC,4BAA4B,EAAEgD,KAAAA,CAAM9C,OAAO,CAAA,CAAE,CAAA;IACxE,CAAA,QAAU;;QAEN,IAAI;AACA,YAAA,IAAIkD,WAAAA,EAAa;AACbA,gBAAAA,WAAAA,CAAYM,KAAK,EAAA;AACrB,YAAA;AACJ,QAAA,CAAA,CAAE,OAAOC,SAAAA,EAAW;AAChBnD,YAAAA,MAAAA,CAAOK,KAAK,CAAC,uCAAA,EAA0C8C,UAAoBzD,OAAO,CAAA;AACtF,QAAA;;;AAGJ,IAAA;AACJ;;;;"}
|
|
1
|
+
{"version":3,"file":"openai.js","sources":["../../src/util/openai.ts"],"sourcesContent":["import { OpenAI } from 'openai';\nimport { ChatCompletionMessageParam } from 'openai/resources';\nimport * as Storage from './storage';\nimport { getLogger } from '../logging';\nimport { archiveAudio } from './general';\n// eslint-disable-next-line no-restricted-imports\nimport fs from 'fs';\n\nexport interface Transcription {\n text: string;\n}\n\nexport class OpenAIError extends Error {\n constructor(message: string) {\n super(message);\n this.name = 'OpenAIError';\n }\n}\n\nexport async function createCompletion(messages: ChatCompletionMessageParam[], options: { responseFormat?: any, model?: string, debug?: boolean, debugFile?: string, debugRequestFile?: string, debugResponseFile?: string } = { model: \"gpt-4o-mini\" }): Promise<string | any> {\n const logger = getLogger();\n const storage = Storage.create({ log: logger.debug });\n let openai: OpenAI | null = null;\n try {\n const apiKey = process.env.OPENAI_API_KEY;\n if (!apiKey) {\n throw new OpenAIError('OPENAI_API_KEY environment variable is not set');\n }\n\n // Create the client which we'll close in the finally block.\n openai = new OpenAI({\n apiKey: apiKey,\n timeout: 180000, // 180 seconds timeout\n });\n\n logger.debug('Sending prompt to OpenAI: %j', messages);\n\n // Save request debug file if enabled\n if (options.debug && (options.debugRequestFile || options.debugFile)) {\n const requestData = {\n model: options.model || \"gpt-4o-mini\",\n messages,\n max_completion_tokens: 10000,\n response_format: options.responseFormat,\n };\n const debugFile = options.debugRequestFile || options.debugFile;\n await storage.writeFile(debugFile!, JSON.stringify(requestData, null, 2), 'utf8');\n logger.debug('Wrote request debug file to %s', debugFile);\n }\n\n // Add timeout wrapper to the OpenAI API call\n const completionPromise = openai.chat.completions.create({\n model: options.model || \"gpt-4o-mini\",\n messages,\n max_completion_tokens: 10000,\n response_format: options.responseFormat,\n });\n\n const timeoutPromise = new Promise<never>((_, reject) => {\n setTimeout(() => reject(new OpenAIError('OpenAI API call timed out after 180 seconds')), 180000);\n });\n\n const completion = await Promise.race([completionPromise, timeoutPromise]);\n\n // Save response debug file if enabled\n if (options.debug && (options.debugResponseFile || options.debugFile)) {\n const debugFile = options.debugResponseFile || options.debugFile;\n await storage.writeFile(debugFile!, JSON.stringify(completion, null, 2), 'utf8');\n logger.debug('Wrote response debug file to %s', debugFile);\n }\n\n const response = completion.choices[0]?.message?.content?.trim();\n if (!response) {\n throw new OpenAIError('No response received from OpenAI');\n }\n\n logger.debug('Received response from OpenAI: %s...', response.substring(0, 30));\n if (options.responseFormat) {\n return JSON.parse(response);\n } else {\n return response;\n }\n\n } catch (error: any) {\n logger.error('Error calling OpenAI API: %s %s', error.message, error.stack);\n throw new OpenAIError(`Failed to create completion: ${error.message}`);\n } finally {\n // OpenAI client cleanup is handled automatically by the library\n // No manual cleanup needed for newer versions\n }\n}\n\nexport async function transcribeAudio(filePath: string, options: { model?: string, debug?: boolean, debugFile?: string, debugRequestFile?: string, debugResponseFile?: string, outputDirectory?: string } = { model: \"whisper-1\" }): Promise<Transcription> {\n const logger = getLogger();\n const storage = Storage.create({ log: logger.debug });\n let openai: OpenAI | null = null;\n let audioStream: fs.ReadStream | null = null;\n try {\n const apiKey = process.env.OPENAI_API_KEY;\n if (!apiKey) {\n throw new OpenAIError('OPENAI_API_KEY environment variable is not set');\n }\n\n openai = new OpenAI({\n apiKey: apiKey,\n });\n\n logger.debug('Transcribing audio file: %s', filePath);\n\n // Save request debug file if enabled\n if (options.debug && (options.debugRequestFile || options.debugFile)) {\n const requestData = {\n model: options.model || \"whisper-1\",\n file: filePath, // Can't serialize the stream, so just save the file path\n response_format: \"json\",\n };\n const debugFile = options.debugRequestFile || options.debugFile;\n await storage.writeFile(debugFile!, JSON.stringify(requestData, null, 2), 'utf8');\n logger.debug('Wrote request debug file to %s', debugFile);\n }\n\n audioStream = await storage.readStream(filePath);\n const transcription = await openai.audio.transcriptions.create({\n model: options.model || \"whisper-1\",\n file: audioStream,\n response_format: \"json\",\n });\n\n // Save response debug file if enabled\n if (options.debug && (options.debugResponseFile || options.debugFile)) {\n const debugFile = options.debugResponseFile || options.debugFile;\n await storage.writeFile(debugFile!, JSON.stringify(transcription, null, 2), 'utf8');\n logger.debug('Wrote response debug file to %s', debugFile);\n }\n\n const response = transcription;\n if (!response) {\n throw new OpenAIError('No transcription received from OpenAI');\n }\n\n logger.debug('Received transcription from OpenAI: %s', response);\n\n // Archive the audio file and transcription\n try {\n const outputDir = options.outputDirectory || 'output';\n await archiveAudio(filePath, response.text, outputDir);\n } catch (archiveError: any) {\n // Don't fail the transcription if archiving fails, just log the error\n logger.warn('Failed to archive audio file: %s', archiveError.message);\n }\n\n return response;\n\n } catch (error: any) {\n logger.error('Error transcribing audio file: %s %s', error.message, error.stack);\n throw new OpenAIError(`Failed to transcribe audio: ${error.message}`);\n } finally {\n // Ensure the audio stream is properly closed to release file handles\n try {\n if (audioStream) {\n audioStream.close();\n }\n } catch (streamErr) {\n logger.debug('Failed to close audio read stream: %s', (streamErr as Error).message);\n }\n // OpenAI client cleanup is handled automatically by the library\n // No manual cleanup needed for newer versions\n }\n}\n"],"names":["OpenAIError","Error","message","name","createCompletion","messages","options","model","logger","getLogger","storage","Storage","log","debug","openai","completion","apiKey","process","env","OPENAI_API_KEY","OpenAI","timeout","debugRequestFile","debugFile","requestData","max_completion_tokens","response_format","responseFormat","writeFile","JSON","stringify","completionPromise","chat","completions","create","timeoutPromise","Promise","_","reject","setTimeout","race","debugResponseFile","response","choices","content","trim","substring","parse","error","stack","transcribeAudio","filePath","audioStream","file","readStream","transcription","audio","transcriptions","outputDir","outputDirectory","archiveAudio","text","archiveError","warn","close","streamErr"],"mappings":";;;;;AAYO,MAAMA,WAAAA,SAAoBC,KAAAA,CAAAA;AAC7B,IAAA,WAAA,CAAYC,OAAe,CAAE;AACzB,QAAA,KAAK,CAACA,OAAAA,CAAAA;QACN,IAAI,CAACC,IAAI,GAAG,aAAA;AAChB,IAAA;AACJ;AAEO,eAAeC,gBAAAA,CAAiBC,QAAsC,EAAEC,OAAAA,GAAgJ;IAAEC,KAAAA,EAAO;AAAc,CAAC,EAAA;AACnP,IAAA,MAAMC,MAAAA,GAASC,SAAAA,EAAAA;IACf,MAAMC,OAAAA,GAAUC,MAAc,CAAC;AAAEC,QAAAA,GAAAA,EAAKJ,OAAOK;AAAM,KAAA,CAAA;AACnD,IAAA,IAAIC,MAAAA,GAAwB,IAAA;IAC5B,IAAI;AAgDiBC,QAAAA,IAAAA,oCAAAA,EAAAA,4BAAAA,EAAAA,oBAAAA;AA/CjB,QAAA,MAAMC,MAAAA,GAASC,OAAAA,CAAQC,GAAG,CAACC,cAAc;AACzC,QAAA,IAAI,CAACH,MAAAA,EAAQ;AACT,YAAA,MAAM,IAAIhB,WAAAA,CAAY,gDAAA,CAAA;AAC1B,QAAA;;AAGAc,QAAAA,MAAAA,GAAS,IAAIM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,IAAI,QAAA;AAC7C,YAAA,MAAMC,YAAAA,CAAaT,QAAAA,EAAUT,QAAAA,CAASmB,IAAI,EAAEH,SAAAA,CAAAA;AAChD,QAAA,CAAA,CAAE,OAAOI,YAAAA,EAAmB;;AAExBtD,YAAAA,MAAAA,CAAOuD,IAAI,CAAC,kCAAA,EAAoCD,YAAAA,CAAa5D,OAAO,CAAA;AACxE,QAAA;QAEA,OAAOwC,QAAAA;AAEX,IAAA,CAAA,CAAE,OAAOM,KAAAA,EAAY;AACjBxC,QAAAA,MAAAA,CAAOwC,KAAK,CAAC,sCAAA,EAAwCA,MAAM9C,OAAO,EAAE8C,MAAMC,KAAK,CAAA;AAC/E,QAAA,MAAM,IAAIjD,WAAAA,CAAY,CAAC,4BAA4B,EAAEgD,KAAAA,CAAM9C,OAAO,CAAA,CAAE,CAAA;IACxE,CAAA,QAAU;;QAEN,IAAI;AACA,YAAA,IAAIkD,WAAAA,EAAa;AACbA,gBAAAA,WAAAA,CAAYY,KAAK,EAAA;AACrB,YAAA;AACJ,QAAA,CAAA,CAAE,OAAOC,SAAAA,EAAW;AAChBzD,YAAAA,MAAAA,CAAOK,KAAK,CAAC,uCAAA,EAA0CoD,UAAoB/D,OAAO,CAAA;AACtF,QAAA;;;AAGJ,IAAA;AACJ;;;;"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@eldrforge/kodrdriv",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.25",
|
|
4
4
|
"description": "Create Intelligent Release Notes or Change Logs from Git",
|
|
5
5
|
"main": "dist/main.js",
|
|
6
6
|
"type": "module",
|
|
@@ -22,9 +22,9 @@
|
|
|
22
22
|
"license": "Apache-2.0",
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"@octokit/rest": "^22.0.0",
|
|
25
|
-
"@riotprompt/riotprompt": "^0.0.
|
|
25
|
+
"@riotprompt/riotprompt": "^0.0.7",
|
|
26
26
|
"@theunwalked/cardigantime": "^0.0.14",
|
|
27
|
-
"@theunwalked/unplayable": "^0.0.
|
|
27
|
+
"@theunwalked/unplayable": "^0.0.20",
|
|
28
28
|
"audify": "^1.9.0",
|
|
29
29
|
"commander": "^14.0.0",
|
|
30
30
|
"dayjs": "^1.11.13",
|