@benchcubed/today-cli 1.0.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.
- package/README.md +296 -0
- package/dist/ai/bedrock-client.d.ts +1 -0
- package/dist/ai/bedrock-client.d.ts.map +1 -0
- package/dist/ai/bedrock-client.js +2 -0
- package/dist/ai/bedrock-client.js.map +1 -0
- package/dist/ai/knowledge-processor.d.ts +1 -0
- package/dist/ai/knowledge-processor.d.ts.map +1 -0
- package/dist/ai/knowledge-processor.js +2 -0
- package/dist/ai/knowledge-processor.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +70 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/ask.d.ts +3 -0
- package/dist/commands/ask.d.ts.map +1 -0
- package/dist/commands/ask.js +217 -0
- package/dist/commands/ask.js.map +1 -0
- package/dist/commands/audit.d.ts +3 -0
- package/dist/commands/audit.d.ts.map +1 -0
- package/dist/commands/audit.js +153 -0
- package/dist/commands/audit.js.map +1 -0
- package/dist/commands/auth.d.ts +3 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +114 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/config.d.ts +3 -0
- package/dist/commands/config.d.ts.map +1 -0
- package/dist/commands/config.js +72 -0
- package/dist/commands/config.js.map +1 -0
- package/dist/commands/embeddings.d.ts +3 -0
- package/dist/commands/embeddings.d.ts.map +1 -0
- package/dist/commands/embeddings.js +118 -0
- package/dist/commands/embeddings.js.map +1 -0
- package/dist/commands/experts.d.ts +3 -0
- package/dist/commands/experts.d.ts.map +1 -0
- package/dist/commands/experts.js +129 -0
- package/dist/commands/experts.js.map +1 -0
- package/dist/commands/export-import.d.ts +4 -0
- package/dist/commands/export-import.d.ts.map +1 -0
- package/dist/commands/export-import.js +285 -0
- package/dist/commands/export-import.js.map +1 -0
- package/dist/commands/git.d.ts +4 -0
- package/dist/commands/git.d.ts.map +1 -0
- package/dist/commands/git.js +274 -0
- package/dist/commands/git.js.map +1 -0
- package/dist/commands/impact.d.ts +3 -0
- package/dist/commands/impact.d.ts.map +1 -0
- package/dist/commands/impact.js +121 -0
- package/dist/commands/impact.js.map +1 -0
- package/dist/commands/insights.d.ts +3 -0
- package/dist/commands/insights.d.ts.map +1 -0
- package/dist/commands/insights.js +113 -0
- package/dist/commands/insights.js.map +1 -0
- package/dist/commands/learned.d.ts +3 -0
- package/dist/commands/learned.d.ts.map +1 -0
- package/dist/commands/learned.js +355 -0
- package/dist/commands/learned.js.map +1 -0
- package/dist/commands/onboard.d.ts +3 -0
- package/dist/commands/onboard.d.ts.map +1 -0
- package/dist/commands/onboard.js +141 -0
- package/dist/commands/onboard.js.map +1 -0
- package/dist/commands/recent.d.ts +3 -0
- package/dist/commands/recent.d.ts.map +1 -0
- package/dist/commands/recent.js +83 -0
- package/dist/commands/recent.js.map +1 -0
- package/dist/commands/secrets.d.ts +3 -0
- package/dist/commands/secrets.d.ts.map +1 -0
- package/dist/commands/secrets.js +203 -0
- package/dist/commands/secrets.js.map +1 -0
- package/dist/commands/stats.d.ts +3 -0
- package/dist/commands/stats.d.ts.map +1 -0
- package/dist/commands/stats.js +120 -0
- package/dist/commands/stats.js.map +1 -0
- package/dist/config/index.d.ts +12 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +46 -0
- package/dist/config/index.js.map +1 -0
- package/dist/database/migrations.d.ts +13 -0
- package/dist/database/migrations.d.ts.map +1 -0
- package/dist/database/migrations.js +190 -0
- package/dist/database/migrations.js.map +1 -0
- package/dist/database/postgresql.d.ts +92 -0
- package/dist/database/postgresql.d.ts.map +1 -0
- package/dist/database/postgresql.js +382 -0
- package/dist/database/postgresql.js.map +1 -0
- package/dist/database/sqlite.d.ts +54 -0
- package/dist/database/sqlite.d.ts.map +1 -0
- package/dist/database/sqlite.js +337 -0
- package/dist/database/sqlite.js.map +1 -0
- package/dist/lambda/admin.d.ts +3 -0
- package/dist/lambda/admin.d.ts.map +1 -0
- package/dist/lambda/admin.js +818 -0
- package/dist/lambda/admin.js.map +1 -0
- package/dist/lambda/ai-services.d.ts +6 -0
- package/dist/lambda/ai-services.d.ts.map +1 -0
- package/dist/lambda/ai-services.js +472 -0
- package/dist/lambda/ai-services.js.map +1 -0
- package/dist/lambda/analytics.d.ts +3 -0
- package/dist/lambda/analytics.d.ts.map +1 -0
- package/dist/lambda/analytics.js +481 -0
- package/dist/lambda/analytics.js.map +1 -0
- package/dist/lambda/api-router.d.ts +3 -0
- package/dist/lambda/api-router.d.ts.map +1 -0
- package/dist/lambda/api-router.js +162 -0
- package/dist/lambda/api-router.js.map +1 -0
- package/dist/lambda/custom-topics.d.ts +3 -0
- package/dist/lambda/custom-topics.d.ts.map +1 -0
- package/dist/lambda/custom-topics.js +425 -0
- package/dist/lambda/custom-topics.js.map +1 -0
- package/dist/lambda/graph-builder.d.ts +3 -0
- package/dist/lambda/graph-builder.d.ts.map +1 -0
- package/dist/lambda/graph-builder.js +442 -0
- package/dist/lambda/graph-builder.js.map +1 -0
- package/dist/lambda/knowledge-ai.d.ts +3 -0
- package/dist/lambda/knowledge-ai.d.ts.map +1 -0
- package/dist/lambda/knowledge-ai.js +849 -0
- package/dist/lambda/knowledge-ai.js.map +1 -0
- package/dist/lambda/post-confirmation.d.ts +8 -0
- package/dist/lambda/post-confirmation.d.ts.map +1 -0
- package/dist/lambda/post-confirmation.js +92 -0
- package/dist/lambda/post-confirmation.js.map +1 -0
- package/dist/lambda/teams.d.ts +3 -0
- package/dist/lambda/teams.d.ts.map +1 -0
- package/dist/lambda/teams.js +568 -0
- package/dist/lambda/teams.js.map +1 -0
- package/dist/lib/export-helpers.d.ts +5 -0
- package/dist/lib/export-helpers.d.ts.map +1 -0
- package/dist/lib/export-helpers.js +137 -0
- package/dist/lib/export-helpers.js.map +1 -0
- package/dist/lib/import-helpers.d.ts +5 -0
- package/dist/lib/import-helpers.d.ts.map +1 -0
- package/dist/lib/import-helpers.js +185 -0
- package/dist/lib/import-helpers.js.map +1 -0
- package/dist/lib/insights-helpers.d.ts +123 -0
- package/dist/lib/insights-helpers.d.ts.map +1 -0
- package/dist/lib/insights-helpers.js +374 -0
- package/dist/lib/insights-helpers.js.map +1 -0
- package/dist/lib/search-helpers.d.ts +4 -0
- package/dist/lib/search-helpers.d.ts.map +1 -0
- package/dist/lib/search-helpers.js +124 -0
- package/dist/lib/search-helpers.js.map +1 -0
- package/dist/lib/secret-helpers.d.ts +2 -0
- package/dist/lib/secret-helpers.d.ts.map +1 -0
- package/dist/lib/secret-helpers.js +85 -0
- package/dist/lib/secret-helpers.js.map +1 -0
- package/dist/lib/stats-helpers.d.ts +41 -0
- package/dist/lib/stats-helpers.d.ts.map +1 -0
- package/dist/lib/stats-helpers.js +263 -0
- package/dist/lib/stats-helpers.js.map +1 -0
- package/dist/services/aws-api.d.ts +81 -0
- package/dist/services/aws-api.d.ts.map +1 -0
- package/dist/services/aws-api.js +388 -0
- package/dist/services/aws-api.js.map +1 -0
- package/dist/services/bedrock.d.ts +83 -0
- package/dist/services/bedrock.d.ts.map +1 -0
- package/dist/services/bedrock.js +434 -0
- package/dist/services/bedrock.js.map +1 -0
- package/dist/services/commit-learnings.d.ts +25 -0
- package/dist/services/commit-learnings.d.ts.map +1 -0
- package/dist/services/commit-learnings.js +180 -0
- package/dist/services/commit-learnings.js.map +1 -0
- package/dist/services/embedding-storage.d.ts +42 -0
- package/dist/services/embedding-storage.d.ts.map +1 -0
- package/dist/services/embedding-storage.js +124 -0
- package/dist/services/embedding-storage.js.map +1 -0
- package/dist/services/expert-engine.d.ts +21 -0
- package/dist/services/expert-engine.d.ts.map +1 -0
- package/dist/services/expert-engine.js +58 -0
- package/dist/services/expert-engine.js.map +1 -0
- package/dist/services/onboarding-accelerator.d.ts +118 -0
- package/dist/services/onboarding-accelerator.d.ts.map +1 -0
- package/dist/services/onboarding-accelerator.js +403 -0
- package/dist/services/onboarding-accelerator.js.map +1 -0
- package/dist/services/secret-detection.d.ts +46 -0
- package/dist/services/secret-detection.d.ts.map +1 -0
- package/dist/services/secret-detection.js +75 -0
- package/dist/services/secret-detection.js.map +1 -0
- package/dist/services/secret-manager-simple.d.ts +51 -0
- package/dist/services/secret-manager-simple.d.ts.map +1 -0
- package/dist/services/secret-manager-simple.js +119 -0
- package/dist/services/secret-manager-simple.js.map +1 -0
- package/dist/services/secret-manager.d.ts +150 -0
- package/dist/services/secret-manager.d.ts.map +1 -0
- package/dist/services/secret-manager.js +287 -0
- package/dist/services/secret-manager.js.map +1 -0
- package/dist/services/vector-embeddings.d.ts +70 -0
- package/dist/services/vector-embeddings.d.ts.map +1 -0
- package/dist/services/vector-embeddings.js +167 -0
- package/dist/services/vector-embeddings.js.map +1 -0
- package/dist/services/vector-search.d.ts +28 -0
- package/dist/services/vector-search.d.ts.map +1 -0
- package/dist/services/vector-search.js +192 -0
- package/dist/services/vector-search.js.map +1 -0
- package/dist/types/index.d.ts +86 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +4 -0
- package/dist/types/index.js.map +1 -0
- package/dist/utils/formatting.d.ts +10 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/formatting.js +82 -0
- package/dist/utils/formatting.js.map +1 -0
- package/dist/utils/git.d.ts +52 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.js +182 -0
- package/dist/utils/git.js.map +1 -0
- package/dist/utils/validation.d.ts +17 -0
- package/dist/utils/validation.d.ts.map +1 -0
- package/dist/utils/validation.js +187 -0
- package/dist/utils/validation.js.map +1 -0
- package/package.json +81 -0
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git utilities for analyzing commits and extracting learning insights
|
|
3
|
+
*/
|
|
4
|
+
export interface GitCommit {
|
|
5
|
+
hash: string;
|
|
6
|
+
message: string;
|
|
7
|
+
author: string;
|
|
8
|
+
date: Date;
|
|
9
|
+
diff: string;
|
|
10
|
+
files: string[];
|
|
11
|
+
}
|
|
12
|
+
export interface CommitAnalysis {
|
|
13
|
+
isWellStructured: boolean;
|
|
14
|
+
conventionalType?: string;
|
|
15
|
+
scope?: string | undefined;
|
|
16
|
+
description?: string;
|
|
17
|
+
reasons: string[];
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Get commits from a git push
|
|
21
|
+
* @param oldRef - Old reference (before push)
|
|
22
|
+
* @param newRef - New reference (after push)
|
|
23
|
+
* @returns Array of commit information
|
|
24
|
+
*/
|
|
25
|
+
export declare function getCommitsFromPush(oldRef: string, newRef: string): Promise<GitCommit[]>;
|
|
26
|
+
/**
|
|
27
|
+
* Get commits from recent pushes (last N commits)
|
|
28
|
+
* @param count - Number of recent commits to retrieve
|
|
29
|
+
* @returns Array of commit information
|
|
30
|
+
*/
|
|
31
|
+
export declare function getRecentCommits(count?: number): Promise<GitCommit[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Analyze if a commit is well-structured (follows conventional commits)
|
|
34
|
+
* @param commit - Commit to analyze
|
|
35
|
+
* @returns Analysis result
|
|
36
|
+
*/
|
|
37
|
+
export declare function analyzeCommitStructure(commit: GitCommit): CommitAnalysis;
|
|
38
|
+
/**
|
|
39
|
+
* Extract learning context from a commit
|
|
40
|
+
* @param commit - Commit to extract context from
|
|
41
|
+
* @returns Context string with commit details and changes
|
|
42
|
+
*/
|
|
43
|
+
export declare function extractCommitContext(commit: GitCommit): string;
|
|
44
|
+
/**
|
|
45
|
+
* Check if we're in a git repository
|
|
46
|
+
*/
|
|
47
|
+
export declare function isGitRepository(): Promise<boolean>;
|
|
48
|
+
/**
|
|
49
|
+
* Get the current git repository root path
|
|
50
|
+
*/
|
|
51
|
+
export declare function getGitRoot(): Promise<string>;
|
|
52
|
+
//# sourceMappingURL=git.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.d.ts","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,MAAM,WAAW,SAAS;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,IAAI,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,EAAE,CAAC;CACjB;AAED,MAAM,WAAW,cAAc;IAC7B,gBAAgB,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;;;GAKG;AACH,wBAAsB,kBAAkB,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CAgC7F;AAED;;;;GAIG;AACH,wBAAsB,gBAAgB,CAAC,KAAK,GAAE,MAAU,GAAG,OAAO,CAAC,SAAS,EAAE,CAAC,CA+B9E;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,SAAS,GAAG,cAAc,CAyDxE;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,MAAM,CAgB9D;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAOxD;AAED;;GAEG;AACH,wBAAsB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAOlD"}
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Git utilities for analyzing commits and extracting learning insights
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getCommitsFromPush = getCommitsFromPush;
|
|
7
|
+
exports.getRecentCommits = getRecentCommits;
|
|
8
|
+
exports.analyzeCommitStructure = analyzeCommitStructure;
|
|
9
|
+
exports.extractCommitContext = extractCommitContext;
|
|
10
|
+
exports.isGitRepository = isGitRepository;
|
|
11
|
+
exports.getGitRoot = getGitRoot;
|
|
12
|
+
const child_process_1 = require("child_process");
|
|
13
|
+
const util_1 = require("util");
|
|
14
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
15
|
+
// Configuration constants
|
|
16
|
+
const EXEC_OPTIONS = { maxBuffer: 10 * 1024 * 1024 }; // 10MB
|
|
17
|
+
const MAX_DIFF_SIZE = 50000; // Limit diff size to prevent buffer overflow
|
|
18
|
+
/**
|
|
19
|
+
* Get commits from a git push
|
|
20
|
+
* @param oldRef - Old reference (before push)
|
|
21
|
+
* @param newRef - New reference (after push)
|
|
22
|
+
* @returns Array of commit information
|
|
23
|
+
*/
|
|
24
|
+
async function getCommitsFromPush(oldRef, newRef) {
|
|
25
|
+
try {
|
|
26
|
+
// Get commit hashes in the push
|
|
27
|
+
const { stdout: hashesOutput } = await execAsync(`git rev-list ${oldRef}..${newRef}`, EXEC_OPTIONS);
|
|
28
|
+
const hashes = hashesOutput.trim().split('\n').filter(h => h);
|
|
29
|
+
const commits = [];
|
|
30
|
+
for (const hash of hashes) {
|
|
31
|
+
// Get commit details
|
|
32
|
+
const { stdout: messageOutput } = await execAsync(`git log -1 --pretty=format:"%s" ${hash}`, EXEC_OPTIONS);
|
|
33
|
+
const { stdout: authorOutput } = await execAsync(`git log -1 --pretty=format:"%an" ${hash}`, EXEC_OPTIONS);
|
|
34
|
+
const { stdout: dateOutput } = await execAsync(`git log -1 --pretty=format:"%ci" ${hash}`, EXEC_OPTIONS);
|
|
35
|
+
// Limit diff size to prevent buffer overflow
|
|
36
|
+
const { stdout: diffOutput } = await execAsync(`git show ${hash} --format="" --no-color | head -c ${MAX_DIFF_SIZE}`, EXEC_OPTIONS);
|
|
37
|
+
const { stdout: filesOutput } = await execAsync(`git show --name-only --format="" ${hash}`, EXEC_OPTIONS);
|
|
38
|
+
commits.push({
|
|
39
|
+
hash,
|
|
40
|
+
message: messageOutput.trim(),
|
|
41
|
+
author: authorOutput.trim(),
|
|
42
|
+
date: new Date(dateOutput.trim()),
|
|
43
|
+
diff: diffOutput,
|
|
44
|
+
files: filesOutput.trim().split('\n').filter(f => f)
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return commits;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
throw new Error(`Failed to get commits: ${error}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get commits from recent pushes (last N commits)
|
|
55
|
+
* @param count - Number of recent commits to retrieve
|
|
56
|
+
* @returns Array of commit information
|
|
57
|
+
*/
|
|
58
|
+
async function getRecentCommits(count = 1) {
|
|
59
|
+
try {
|
|
60
|
+
// Get recent commit hashes
|
|
61
|
+
const { stdout: hashesOutput } = await execAsync(`git log -${count} --pretty=format:"%H"`, EXEC_OPTIONS);
|
|
62
|
+
const hashes = hashesOutput.trim().split('\n').filter(h => h);
|
|
63
|
+
const commits = [];
|
|
64
|
+
for (const hash of hashes) {
|
|
65
|
+
const { stdout: messageOutput } = await execAsync(`git log -1 --pretty=format:"%s" ${hash}`, EXEC_OPTIONS);
|
|
66
|
+
const { stdout: authorOutput } = await execAsync(`git log -1 --pretty=format:"%an" ${hash}`, EXEC_OPTIONS);
|
|
67
|
+
const { stdout: dateOutput } = await execAsync(`git log -1 --pretty=format:"%ci" ${hash}`, EXEC_OPTIONS);
|
|
68
|
+
// Limit diff size to prevent buffer overflow
|
|
69
|
+
const { stdout: diffOutput } = await execAsync(`git show ${hash} --format="" --no-color | head -c ${MAX_DIFF_SIZE}`, EXEC_OPTIONS);
|
|
70
|
+
const { stdout: filesOutput } = await execAsync(`git show --name-only --format="" ${hash}`, EXEC_OPTIONS);
|
|
71
|
+
commits.push({
|
|
72
|
+
hash,
|
|
73
|
+
message: messageOutput.trim(),
|
|
74
|
+
author: authorOutput.trim(),
|
|
75
|
+
date: new Date(dateOutput.trim()),
|
|
76
|
+
diff: diffOutput,
|
|
77
|
+
files: filesOutput.trim().split('\n').filter(f => f)
|
|
78
|
+
});
|
|
79
|
+
}
|
|
80
|
+
return commits;
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
throw new Error(`Failed to get recent commits: ${error}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Analyze if a commit is well-structured (follows conventional commits)
|
|
88
|
+
* @param commit - Commit to analyze
|
|
89
|
+
* @returns Analysis result
|
|
90
|
+
*/
|
|
91
|
+
function analyzeCommitStructure(commit) {
|
|
92
|
+
const message = commit.message;
|
|
93
|
+
const reasons = [];
|
|
94
|
+
// Check for conventional commit format: type(scope): description
|
|
95
|
+
const conventionalCommitRegex = /^(feat|fix|docs|style|refactor|test|chore|perf|ci|build|revert)(\([a-z0-9-]+\))?:\s.+/i;
|
|
96
|
+
const match = message.match(conventionalCommitRegex);
|
|
97
|
+
if (match) {
|
|
98
|
+
const type = match[1];
|
|
99
|
+
const scope = match[2] ? match[2].slice(1, -1) : undefined;
|
|
100
|
+
const description = message.substring(match[0].indexOf(':') + 1).trim();
|
|
101
|
+
reasons.push('Follows conventional commit format');
|
|
102
|
+
// Additional quality checks
|
|
103
|
+
if (description.length > 10) {
|
|
104
|
+
reasons.push('Has descriptive commit message');
|
|
105
|
+
}
|
|
106
|
+
if (commit.diff && commit.diff.length > 50) {
|
|
107
|
+
reasons.push('Contains meaningful code changes');
|
|
108
|
+
}
|
|
109
|
+
if (commit.files.length > 0 && commit.files.length <= 10) {
|
|
110
|
+
reasons.push('Focused change scope (reasonable number of files)');
|
|
111
|
+
}
|
|
112
|
+
return {
|
|
113
|
+
isWellStructured: true,
|
|
114
|
+
conventionalType: type,
|
|
115
|
+
scope,
|
|
116
|
+
description,
|
|
117
|
+
reasons
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
// Check other quality indicators even if not conventional
|
|
121
|
+
const hasReasonableLength = message.length >= 10 && message.length <= 200;
|
|
122
|
+
const hasCapitalization = /^[A-Z]/.test(message);
|
|
123
|
+
const hasNoDot = !message.endsWith('.');
|
|
124
|
+
if (hasReasonableLength) {
|
|
125
|
+
reasons.push('Has reasonable message length');
|
|
126
|
+
}
|
|
127
|
+
if (hasCapitalization) {
|
|
128
|
+
reasons.push('Message is properly capitalized');
|
|
129
|
+
}
|
|
130
|
+
// A commit is considered well-structured if it either follows conventional commits
|
|
131
|
+
// or has at least 2 quality indicators
|
|
132
|
+
const isWellStructured = reasons.length >= 2;
|
|
133
|
+
return {
|
|
134
|
+
isWellStructured,
|
|
135
|
+
reasons
|
|
136
|
+
};
|
|
137
|
+
}
|
|
138
|
+
/**
|
|
139
|
+
* Extract learning context from a commit
|
|
140
|
+
* @param commit - Commit to extract context from
|
|
141
|
+
* @returns Context string with commit details and changes
|
|
142
|
+
*/
|
|
143
|
+
function extractCommitContext(commit) {
|
|
144
|
+
let context = `Commit: ${commit.message}\n`;
|
|
145
|
+
context += `Author: ${commit.author}\n`;
|
|
146
|
+
context += `Date: ${commit.date.toISOString()}\n`;
|
|
147
|
+
context += `Files changed: ${commit.files.join(', ')}\n\n`;
|
|
148
|
+
// Add a reasonable sample of the diff (first 2000 chars to keep context manageable)
|
|
149
|
+
if (commit.diff) {
|
|
150
|
+
const diffSample = commit.diff.substring(0, 2000);
|
|
151
|
+
context += `Changes:\n${diffSample}`;
|
|
152
|
+
if (commit.diff.length > 2000) {
|
|
153
|
+
context += '\n... (diff truncated for brevity)';
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
return context;
|
|
157
|
+
}
|
|
158
|
+
/**
|
|
159
|
+
* Check if we're in a git repository
|
|
160
|
+
*/
|
|
161
|
+
async function isGitRepository() {
|
|
162
|
+
try {
|
|
163
|
+
await execAsync('git rev-parse --is-inside-work-tree', EXEC_OPTIONS);
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
catch {
|
|
167
|
+
return false;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Get the current git repository root path
|
|
172
|
+
*/
|
|
173
|
+
async function getGitRoot() {
|
|
174
|
+
try {
|
|
175
|
+
const { stdout } = await execAsync('git rev-parse --show-toplevel', EXEC_OPTIONS);
|
|
176
|
+
return stdout.trim();
|
|
177
|
+
}
|
|
178
|
+
catch (error) {
|
|
179
|
+
throw new Error('Not in a git repository');
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
//# sourceMappingURL=git.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git.js","sourceRoot":"","sources":["../../src/utils/git.ts"],"names":[],"mappings":";AAAA;;GAEG;;AAkCH,gDAgCC;AAOD,4CA+BC;AAOD,wDAyDC;AAOD,oDAgBC;AAKD,0CAOC;AAKD,gCAOC;AArND,iDAAqC;AACrC,+BAAiC;AAEjC,MAAM,SAAS,GAAG,IAAA,gBAAS,EAAC,oBAAI,CAAC,CAAC;AAElC,0BAA0B;AAC1B,MAAM,YAAY,GAAG,EAAE,SAAS,EAAE,EAAE,GAAG,IAAI,GAAG,IAAI,EAAE,CAAC,CAAC,OAAO;AAC7D,MAAM,aAAa,GAAG,KAAK,CAAC,CAAC,6CAA6C;AAmB1E;;;;;GAKG;AACI,KAAK,UAAU,kBAAkB,CAAC,MAAc,EAAE,MAAc;IACrE,IAAI,CAAC;QACH,gCAAgC;QAChC,MAAM,EAAE,MAAM,EAAE,YAAY,EAAE,GAAG,MAAM,SAAS,CAAC,gBAAgB,MAAM,KAAK,MAAM,EAAE,EAAE,YAAY,CAAC,CAAC;QACpG,MAAM,MAAM,GAAG,YAAY,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;QAE9D,MAAM,OAAO,GAAgB,EAAE,CAAC;QAEhC,KAAK,MAAM,IAAI,IAAI,MAAM,EAAE,CA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C,IAAI,EAAE,CAAC;QAChB,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;QAClD,OAAO,IAAI,aAAa,UAAU,EAAE,CAAC;QACrC,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;YAC9B,OAAO,IAAI,oCAAoC,CAAC;QAClD,CAAC;IACH,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,eAAe;IACnC,IAAI,CAAC;QACH,MAAM,SAAS,CAAC,qCAAqC,EAAE,YAAY,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAED;;GAEG;AACI,KAAK,UAAU,UAAU;IAC9B,IAAI,CAAC;QACH,MAAM,EAAE,MAAM,EAAE,GAAG,MAAM,SAAS,CAAC,+BAA+B,EAAE,YAAY,CAAC,CAAC;QAClF,OAAO,MAAM,CAAC,IAAI,EAAE,CAAC;IACvB,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;IAC7C,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export declare class ValidationError extends Error {
|
|
2
|
+
field?: string | undefined;
|
|
3
|
+
constructor(message: string, field?: string | undefined);
|
|
4
|
+
}
|
|
5
|
+
export declare function validateLearningContent(content: string): void;
|
|
6
|
+
export declare function validateSearchQuery(query: string): void;
|
|
7
|
+
export declare function validateTags(tags: string): string[];
|
|
8
|
+
export interface SecretDetection {
|
|
9
|
+
type: 'api_key' | 'password' | 'token' | 'connection_string';
|
|
10
|
+
value: string;
|
|
11
|
+
confidence: number;
|
|
12
|
+
startIndex: number;
|
|
13
|
+
endIndex: number;
|
|
14
|
+
}
|
|
15
|
+
export declare function detectSecrets(content: string): SecretDetection[];
|
|
16
|
+
export declare function sanitizeInput(input: string): string;
|
|
17
|
+
//# sourceMappingURL=validation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":"AAEA,qBAAa,eAAgB,SAAQ,KAAK;IACJ,KAAK,CAAC,EAAE,MAAM;gBAAtC,OAAO,EAAE,MAAM,EAAS,KAAK,CAAC,EAAE,MAAM,YAAA;CAInD;AAED,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAY7D;AAED,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,CAQvD;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAqBnD;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,mBAAmB,CAAC;IAC7D,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,eAAe,EAAE,CA2EhE;AA4ED,wBAAgB,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAKnD"}
|
|
@@ -0,0 +1,187 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
// Input validation utilities for Today CLI
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.ValidationError = void 0;
|
|
5
|
+
exports.validateLearningContent = validateLearningContent;
|
|
6
|
+
exports.validateSearchQuery = validateSearchQuery;
|
|
7
|
+
exports.validateTags = validateTags;
|
|
8
|
+
exports.detectSecrets = detectSecrets;
|
|
9
|
+
exports.sanitizeInput = sanitizeInput;
|
|
10
|
+
class ValidationError extends Error {
|
|
11
|
+
constructor(message, field) {
|
|
12
|
+
super(message);
|
|
13
|
+
this.field = field;
|
|
14
|
+
this.name = 'ValidationError';
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.ValidationError = ValidationError;
|
|
18
|
+
function validateLearningContent(content) {
|
|
19
|
+
if (!content || content.trim().length === 0) {
|
|
20
|
+
throw new ValidationError('Learning content cannot be empty');
|
|
21
|
+
}
|
|
22
|
+
if (content.length < 10) {
|
|
23
|
+
throw new ValidationError('Learning content should be at least 10 characters long for meaningful capture');
|
|
24
|
+
}
|
|
25
|
+
if (content.length > 2000) {
|
|
26
|
+
throw new ValidationError('Learning content is too long (max 2000 characters). Consider breaking it into multiple entries.');
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
function validateSearchQuery(query) {
|
|
30
|
+
if (!query || query.trim().length === 0) {
|
|
31
|
+
throw new ValidationError('Search query cannot be empty');
|
|
32
|
+
}
|
|
33
|
+
if (query.length < 2) {
|
|
34
|
+
throw new ValidationError('Search query should be at least 2 characters long');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function validateTags(tags) {
|
|
38
|
+
if (!tags)
|
|
39
|
+
return [];
|
|
40
|
+
const tagList = tags.split(',').map(tag => tag.trim()).filter(tag => tag.length > 0);
|
|
41
|
+
// Validate each tag
|
|
42
|
+
tagList.forEach(tag => {
|
|
43
|
+
if (tag.length > 50) {
|
|
44
|
+
throw new ValidationError(`Tag "${tag}" is too long (max 50 characters)`);
|
|
45
|
+
}
|
|
46
|
+
if (!/^[a-zA-Z0-9-_]+$/.test(tag)) {
|
|
47
|
+
throw new ValidationError(`Tag "${tag}" contains invalid characters. Use only letters, numbers, hyphens, and underscores.`);
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
if (tagList.length > 10) {
|
|
51
|
+
throw new ValidationError('Too many tags (max 10 tags per entry)');
|
|
52
|
+
}
|
|
53
|
+
return tagList;
|
|
54
|
+
}
|
|
55
|
+
function detectSecrets(content) {
|
|
56
|
+
const detections = [];
|
|
57
|
+
// API Key patterns - enhanced for realistic formats
|
|
58
|
+
const apiKeyPatterns = [
|
|
59
|
+
// AWS Access Key
|
|
60
|
+
{ pattern: /AKIA[0-9A-Z]{16}/g, type: 'api_key', confidence: 0.95 },
|
|
61
|
+
// Custom API key patterns (like TUI example)
|
|
62
|
+
{ pattern: /[a-zA-Z_]+_(?:live|prod|production)_sk_[A-Za-z0-9]{20,}/g, type: 'api_key', confidence: 0.9 },
|
|
63
|
+
{ pattern: /[a-zA-Z_]+_(?:test|staging|dev)_sk_[A-Za-z0-9]{20,}/g, type: 'api_key', confidence: 0.85 },
|
|
64
|
+
// Generic API key patterns - more flexible
|
|
65
|
+
{ pattern: /[Aa][Pp][Ii][-_]?[Kk][Ee][Yy][\s]*[:=][\s]*['"]?([A-Za-z0-9_\-]{8,})['"]?/g, type: 'api_key', confidence: 0.8 },
|
|
66
|
+
{ pattern: /[Kk][Ee][Yy][\s]*[:=][\s]*['"]?([A-Za-z0-9_\-]{12,})['"]?/g, type: 'api_key', confidence: 0.7 },
|
|
67
|
+
// OpenAI API key
|
|
68
|
+
{ pattern: /sk-[A-Za-z0-9]{48}/g, type: 'api_key', confidence: 0.95 },
|
|
69
|
+
// GitHub token
|
|
70
|
+
{ pattern: /ghp_[A-Za-z0-9]{36}/g, type: 'token', confidence: 0.95 },
|
|
71
|
+
{ pattern: /gho_[A-Za-z0-9]{36}/g, type: 'token', confidence: 0.95 },
|
|
72
|
+
{ pattern: /ghu_[A-Za-z0-9]{36}/g, type: 'token', confidence: 0.95 },
|
|
73
|
+
{ pattern: /ghs_[A-Za-z0-9]{36}/g, type: 'token', confidence: 0.95 },
|
|
74
|
+
// JWT tokens
|
|
75
|
+
{ pattern: /eyJ[A-Za-z0-9_\-]*\.eyJ[A-Za-z0-9_\-]*\.[A-Za-z0-9_\-]*/g, type: 'token', confidence: 0.9 },
|
|
76
|
+
];
|
|
77
|
+
// Password patterns - enhanced
|
|
78
|
+
const passwordPatterns = [
|
|
79
|
+
{ pattern: /[Pp][Aa][Ss][Ss][Ww][Oo][Rr][Dd][\s]*[:=][\s]*['"]?([^\s'"]{6,})['"]?/g, type: 'password', confidence: 0.8 },
|
|
80
|
+
{ pattern: /[Pp][Ww][Dd][\s]*[:=][\s]*['"]?([^\s'"]{6,})['"]?/g, type: 'password', confidence: 0.7 },
|
|
81
|
+
// Database passwords in connection strings
|
|
82
|
+
{ pattern: /:([A-Za-z0-9@!#$%^&*()_+\-=\[\]{}|;':\",./<>?]{6,})@/g, type: 'password', confidence: 0.85 },
|
|
83
|
+
];
|
|
84
|
+
// Connection string patterns - enhanced
|
|
85
|
+
const connectionStringPatterns = [
|
|
86
|
+
// Database connection strings
|
|
87
|
+
{ pattern: /(?:mongodb|mysql|postgresql|postgres):\/\/[^\s'"]+/g, type: 'connection_string', confidence: 0.9 },
|
|
88
|
+
{ pattern: /Server=[^;]+;Database=[^;]+;.*Password=[^;]+/gi, type: 'connection_string', confidence: 0.9 },
|
|
89
|
+
{ pattern: /Data Source=[^;]+;.*Password=[^;]+/gi, type: 'connection_string', confidence: 0.85 },
|
|
90
|
+
];
|
|
91
|
+
// Token patterns - enhanced
|
|
92
|
+
const tokenPatterns = [
|
|
93
|
+
{ pattern: /[Tt][Oo][Kk][Ee][Nn][\s]*[:=][\s]*['"]?([A-Za-z0-9_\-]{16,})['"]?/g, type: 'token', confidence: 0.75 },
|
|
94
|
+
{ pattern: /[Bb][Ee][Aa][Rr][Ee][Rr][\s]+([A-Za-z0-9_\-]{16,})/g, type: 'token', confidence: 0.8 },
|
|
95
|
+
{ pattern: /[Aa][Uu][Tt][Hh][Oo][Rr][Ii][Zz][Aa][Tt][Ii][Oo][Nn][\s]*:[\s]*[Bb][Ee][Aa][Rr][Ee][Rr][\s]+([A-Za-z0-9_\-]{16,})/g, type: 'token', confidence: 0.85 },
|
|
96
|
+
// Webhook secrets
|
|
97
|
+
{ pattern: /whsec_[A-Za-z0-9]{20,}/g, type: 'token', confidence: 0.9 },
|
|
98
|
+
];
|
|
99
|
+
const allPatterns = [...apiKeyPatterns, ...passwordPatterns, ...connectionStringPatterns, ...tokenPatterns];
|
|
100
|
+
for (const { pattern, type, confidence } of allPatterns) {
|
|
101
|
+
let match;
|
|
102
|
+
while ((match = pattern.exec(content)) !== null) {
|
|
103
|
+
const value = match[1] || match[0]; // Use capture group if available, otherwise full match
|
|
104
|
+
const startIndex = match.index;
|
|
105
|
+
const endIndex = match.index + match[0].length;
|
|
106
|
+
// Skip if this is likely a placeholder or example
|
|
107
|
+
if (isLikelyPlaceholder(value)) {
|
|
108
|
+
continue;
|
|
109
|
+
}
|
|
110
|
+
detections.push({
|
|
111
|
+
type,
|
|
112
|
+
value,
|
|
113
|
+
confidence,
|
|
114
|
+
startIndex,
|
|
115
|
+
endIndex,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
// Remove duplicates and overlapping detections
|
|
120
|
+
return deduplicateDetections(detections);
|
|
121
|
+
}
|
|
122
|
+
function isLikelyPlaceholder(value) {
|
|
123
|
+
const placeholderPatterns = [
|
|
124
|
+
/^(your|my|test|example|demo|placeholder|xxx+|yyy+|zzz+)/i,
|
|
125
|
+
/^[x]{3,}$/i,
|
|
126
|
+
/^[*]{3,}$/i,
|
|
127
|
+
/^[.]{3,}$/i,
|
|
128
|
+
/^(123|abc|test|example|demo|placeholder)$/i,
|
|
129
|
+
/^[0]{8,}$/,
|
|
130
|
+
/^[1]{8,}$/,
|
|
131
|
+
/_here$/i,
|
|
132
|
+
/^example_/i,
|
|
133
|
+
/^placeholder_/i,
|
|
134
|
+
/^your_/i,
|
|
135
|
+
/^test_/i
|
|
136
|
+
];
|
|
137
|
+
// Don't filter out values that are too short to be meaningful placeholders
|
|
138
|
+
if (value.length < 3) {
|
|
139
|
+
return false;
|
|
140
|
+
}
|
|
141
|
+
// Don't filter out realistic API keys that look like production values
|
|
142
|
+
// TUI example: tui_live_sk_1a2b3c4d5e6f7g8h9i0j1k2l3m4n5o6p7q8r9s0t
|
|
143
|
+
if (value.includes('_live_') || value.includes('_prod_') || value.includes('_production_')) {
|
|
144
|
+
return false; // These are likely real secrets, not placeholders
|
|
145
|
+
}
|
|
146
|
+
// Don't filter out values that contain mixed character types (likely real secrets)
|
|
147
|
+
const hasLetters = /[a-zA-Z]/.test(value);
|
|
148
|
+
const hasNumbers = /[0-9]/.test(value);
|
|
149
|
+
const hasSpecialChars = /[^a-zA-Z0-9]/.test(value);
|
|
150
|
+
// If it has a mix of character types and looks realistic, it's probably not a placeholder
|
|
151
|
+
if ((hasLetters && hasNumbers) || (hasLetters && hasSpecialChars) || (hasNumbers && hasSpecialChars)) {
|
|
152
|
+
// Still check for obvious placeholder patterns, but be more lenient
|
|
153
|
+
return placeholderPatterns.slice(0, 5).some(pattern => pattern.test(value)); // Only check the most obvious patterns
|
|
154
|
+
}
|
|
155
|
+
return placeholderPatterns.some(pattern => pattern.test(value));
|
|
156
|
+
}
|
|
157
|
+
function deduplicateDetections(detections) {
|
|
158
|
+
// Sort by start index
|
|
159
|
+
detections.sort((a, b) => a.startIndex - b.startIndex);
|
|
160
|
+
const deduplicated = [];
|
|
161
|
+
for (const detection of detections) {
|
|
162
|
+
// Check if this detection overlaps with any existing detection
|
|
163
|
+
const overlaps = deduplicated.some(existing => (detection.startIndex >= existing.startIndex && detection.startIndex < existing.endIndex) ||
|
|
164
|
+
(detection.endIndex > existing.startIndex && detection.endIndex <= existing.endIndex) ||
|
|
165
|
+
(detection.startIndex <= existing.startIndex && detection.endIndex >= existing.endIndex));
|
|
166
|
+
if (!overlaps) {
|
|
167
|
+
deduplicated.push(detection);
|
|
168
|
+
}
|
|
169
|
+
else {
|
|
170
|
+
// If there's an overlap, keep the one with higher confidence
|
|
171
|
+
const overlappingIndex = deduplicated.findIndex(existing => (detection.startIndex >= existing.startIndex && detection.startIndex < existing.endIndex) ||
|
|
172
|
+
(detection.endIndex > existing.startIndex && detection.endIndex <= existing.endIndex) ||
|
|
173
|
+
(detection.startIndex <= existing.startIndex && detection.endIndex >= existing.endIndex));
|
|
174
|
+
if (overlappingIndex !== -1 && detection.confidence > deduplicated[overlappingIndex].confidence) {
|
|
175
|
+
deduplicated[overlappingIndex] = detection;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
return deduplicated;
|
|
180
|
+
}
|
|
181
|
+
function sanitizeInput(input) {
|
|
182
|
+
// Remove potentially dangerous characters while preserving code snippets
|
|
183
|
+
return input
|
|
184
|
+
.replace(/[\x00-\x08\x0B\x0C\x0E-\x1F\x7F]/g, '') // Remove control characters
|
|
185
|
+
.trim();
|
|
186
|
+
}
|
|
187
|
+
//# sourceMappingURL=validation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validation.js","sourceRoot":"","sources":["../../src/utils/validation.ts"],"names":[],"mappings":";AAAA,2CAA2C;;;AAS3C,0DAYC;AAED,kDAQC;AAED,oCAqBC;AAUD,sCA2EC;AA4ED,sCAKC;AA1ND,MAAa,eAAgB,SAAQ,KAAK;IACxC,YAAY,OAAe,EAAS,KAAc;QAChD,KAAK,CAAC,OAAO,CAAC,CAAC;QADmB,UAAK,GAAL,KAAK,CAAS;QAEhD,IAAI,CAAC,IAAI,GAAG,iBAAiB,CAAC;IAChC,CAAC;CACF;AALD,0CAKC;AAED,SAAgB,uBAAuB,CAAC,OAAe;IACrD,IAAI,CAAC,OAAO,IAAI,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC5C,MAAM,IAAI,eAAe,CAAC,kCAAkC,CAAC,CAAC;IAChE,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,EAAE,EAAE,CAAC;QACxB,MAAM,IAAI,eAAe,CAAC,+EAA+E,CAAC,CAAC;IAC7G,CAAC;IAED,IAAI,OAAO,CAAC,MAAM,GAAG,IAAI,EAAE,CAAC;QAC1B,MAAM,IAAI,eAAe,CAAC,iGAAiG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,IAAI,QAAQ,CAAC,QAAQ,CAAC,CACzF,CAAC;QAEF,IAAI,CAAC,QAAQ,EAAE,CAAC;YACd,YAAY,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;QAC/B,CAAC;aAAM,CAAC;YACN,6DAA6D;YAC7D,MAAM,gBAAgB,GAAG,YAAY,CAAC,SAAS,CAAC,QAAQ,CAAC,EAAE,CACzD,CAAC,SAAS,CAAC,UAAU,IAAI,QAAQ,CAAC,UAAU,IAAI,SAAS,CAAC,UAAU,GAAG,QAAQ,CAAC,QAAQ,CAAC;gBACzF,CAAC,SAAS,CAAC,QAAQ,GAAG,QAAQ,CAAC,UAAU,IAAI,SAAS,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC;gBACrF,CAAC,SAAS,CAAC,UAAU,IAAI,QAAQ,CAAC,UAAU,IAAI,SAAS,CAAC,QAAQ,IAAI,QAAQ,CAAC,QAAQ,CAAC,CACzF,CAAC;YAEF,IAAI,gBAAgB,KAAK,CAAC,CAAC,IAAI,SAAS,CAAC,UAAU,GAAG,YAAY,CAAC,gBAAgB,CAAC,CAAC,UAAU,EAAE,CAAC;gBAChG,YAAY,CAAC,gBAAgB,CAAC,GAAG,SAAS,CAAC;YAC7C,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,SAAgB,aAAa,CAAC,KAAa;IACzC,yEAAyE;IACzE,OAAO,KAAK;SACT,OAAO,CAAC,mCAAmC,EAAE,EAAE,CAAC,CAAC,4BAA4B;SAC7E,IAAI,EAAE,CAAC;AACZ,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@benchcubed/today-cli",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "AI-powered developer knowledge platform for AWS 10,000 AIdeas Competition",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"bin": {
|
|
7
|
+
"today": "./dist/cli.js"
|
|
8
|
+
},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"repository": {
|
|
15
|
+
"type": "git",
|
|
16
|
+
"url": "https://github.com/benchcubed/Today"
|
|
17
|
+
},
|
|
18
|
+
"scripts": {
|
|
19
|
+
"build": "tsc",
|
|
20
|
+
"build:lambdas": "node scripts/build-lambdas.js",
|
|
21
|
+
"dev": "ts-node src/cli.ts",
|
|
22
|
+
"prepublishOnly": "npm run build",
|
|
23
|
+
"test": "jest",
|
|
24
|
+
"test:watch": "jest --watch",
|
|
25
|
+
"test:property": "jest --testNamePattern='Property'",
|
|
26
|
+
"lint": "eslint src/**/*.ts",
|
|
27
|
+
"start": "node dist/cli.js",
|
|
28
|
+
"bundle": "npm run build:lambdas",
|
|
29
|
+
"deploy": "npm run bundle && cd infrastructure && terraform apply",
|
|
30
|
+
"deploy:backend": "npm run bundle && cd infrastructure && terraform apply",
|
|
31
|
+
"deploy:web": "cd app && npm run build && aws s3 sync ../web/ s3://$(cd ../infrastructure && terraform output -raw web_bucket_name) --delete && aws cloudfront create-invalidation --distribution-id $(cd ../infrastructure && terraform output -raw cloudfront_distribution_id) --paths '/*'"
|
|
32
|
+
},
|
|
33
|
+
"keywords": [
|
|
34
|
+
"cli",
|
|
35
|
+
"knowledge-management",
|
|
36
|
+
"ai",
|
|
37
|
+
"aws",
|
|
38
|
+
"developer-tools",
|
|
39
|
+
"competition"
|
|
40
|
+
],
|
|
41
|
+
"author": "AWS 10,000 AIdeas Competition Entry",
|
|
42
|
+
"license": "MIT",
|
|
43
|
+
"dependencies": {
|
|
44
|
+
"@aws-sdk/client-bedrock-runtime": "^3.958.0",
|
|
45
|
+
"@aws-sdk/client-cognito-identity-provider": "^3.958.0",
|
|
46
|
+
"@aws-sdk/client-comprehend": "^3.958.0",
|
|
47
|
+
"@aws-sdk/client-dynamodb": "^3.958.0",
|
|
48
|
+
"@aws-sdk/client-rds": "^3.958.0",
|
|
49
|
+
"@aws-sdk/client-s3": "^3.958.0",
|
|
50
|
+
"@aws-sdk/client-secrets-manager": "^3.958.0",
|
|
51
|
+
"@aws-sdk/client-sns": "^3.958.0",
|
|
52
|
+
"@aws-sdk/lib-dynamodb": "^3.958.0",
|
|
53
|
+
"@types/aws-lambda": "^8.10.159",
|
|
54
|
+
"aws-lambda": "^1.0.7",
|
|
55
|
+
"chalk": "^4.1.2",
|
|
56
|
+
"commander": "^11.1.0",
|
|
57
|
+
"cosmiconfig": "^9.0.0",
|
|
58
|
+
"inquirer": "^8.2.6",
|
|
59
|
+
"ora": "^5.4.1",
|
|
60
|
+
"pg": "^8.16.3",
|
|
61
|
+
"table": "^6.8.1"
|
|
62
|
+
},
|
|
63
|
+
"devDependencies": {
|
|
64
|
+
"@types/inquirer": "^9.0.3",
|
|
65
|
+
"@types/jest": "^29.5.5",
|
|
66
|
+
"@types/node": "^20.8.0",
|
|
67
|
+
"@types/pg": "^8.16.0",
|
|
68
|
+
"@typescript-eslint/eslint-plugin": "^6.7.4",
|
|
69
|
+
"@typescript-eslint/parser": "^6.7.4",
|
|
70
|
+
"esbuild": "^0.27.2",
|
|
71
|
+
"eslint": "^8.50.0",
|
|
72
|
+
"fast-check": "^3.13.2",
|
|
73
|
+
"jest": "^29.7.0",
|
|
74
|
+
"ts-jest": "^29.1.1",
|
|
75
|
+
"ts-node": "^10.9.1",
|
|
76
|
+
"typescript": "^5.2.2"
|
|
77
|
+
},
|
|
78
|
+
"engines": {
|
|
79
|
+
"node": ">=18.0.0"
|
|
80
|
+
}
|
|
81
|
+
}
|