@milo4jo/contextkit 0.1.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 +181 -0
- package/dist/commands/index-cmd.d.ts +3 -0
- package/dist/commands/index-cmd.d.ts.map +1 -0
- package/dist/commands/index-cmd.js +111 -0
- package/dist/commands/index-cmd.js.map +1 -0
- package/dist/commands/init.d.ts +3 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +56 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/select.d.ts +3 -0
- package/dist/commands/select.d.ts.map +1 -0
- package/dist/commands/select.js +64 -0
- package/dist/commands/select.js.map +1 -0
- package/dist/commands/source/add.d.ts +3 -0
- package/dist/commands/source/add.d.ts.map +1 -0
- package/dist/commands/source/add.js +87 -0
- package/dist/commands/source/add.js.map +1 -0
- package/dist/commands/source/index.d.ts +3 -0
- package/dist/commands/source/index.d.ts.map +1 -0
- package/dist/commands/source/index.js +14 -0
- package/dist/commands/source/index.js.map +1 -0
- package/dist/commands/source/list.d.ts +3 -0
- package/dist/commands/source/list.d.ts.map +1 -0
- package/dist/commands/source/list.js +46 -0
- package/dist/commands/source/list.js.map +1 -0
- package/dist/commands/source/remove.d.ts +3 -0
- package/dist/commands/source/remove.d.ts.map +1 -0
- package/dist/commands/source/remove.js +38 -0
- package/dist/commands/source/remove.js.map +1 -0
- package/dist/commands/source.d.ts +3 -0
- package/dist/commands/source.d.ts.map +1 -0
- package/dist/commands/source.js +153 -0
- package/dist/commands/source.js.map +1 -0
- package/dist/config/index.d.ts +38 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +100 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/types.d.ts +21 -0
- package/dist/config/types.d.ts.map +1 -0
- package/dist/config/types.js +5 -0
- package/dist/config/types.js.map +1 -0
- package/dist/db/index.d.ts +14 -0
- package/dist/db/index.d.ts.map +1 -0
- package/dist/db/index.js +63 -0
- package/dist/db/index.js.map +1 -0
- package/dist/errors/index.d.ts +30 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +51 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +90 -0
- package/dist/index.js.map +1 -0
- package/dist/indexer/chunker.d.ts +44 -0
- package/dist/indexer/chunker.d.ts.map +1 -0
- package/dist/indexer/chunker.js +102 -0
- package/dist/indexer/chunker.js.map +1 -0
- package/dist/indexer/discovery.d.ts +34 -0
- package/dist/indexer/discovery.d.ts.map +1 -0
- package/dist/indexer/discovery.js +66 -0
- package/dist/indexer/discovery.js.map +1 -0
- package/dist/indexer/embeddings.d.ts +32 -0
- package/dist/indexer/embeddings.d.ts.map +1 -0
- package/dist/indexer/embeddings.js +85 -0
- package/dist/indexer/embeddings.js.map +1 -0
- package/dist/indexer/index.d.ts +37 -0
- package/dist/indexer/index.d.ts.map +1 -0
- package/dist/indexer/index.js +123 -0
- package/dist/indexer/index.js.map +1 -0
- package/dist/selector/budget.d.ts +26 -0
- package/dist/selector/budget.d.ts.map +1 -0
- package/dist/selector/budget.js +75 -0
- package/dist/selector/budget.js.map +1 -0
- package/dist/selector/formatter.d.ts +44 -0
- package/dist/selector/formatter.d.ts.map +1 -0
- package/dist/selector/formatter.js +114 -0
- package/dist/selector/formatter.js.map +1 -0
- package/dist/selector/index.d.ts +37 -0
- package/dist/selector/index.d.ts.map +1 -0
- package/dist/selector/index.js +67 -0
- package/dist/selector/index.js.map +1 -0
- package/dist/selector/scoring.d.ts +26 -0
- package/dist/selector/scoring.d.ts.map +1 -0
- package/dist/selector/scoring.js +113 -0
- package/dist/selector/scoring.js.map +1 -0
- package/dist/selector/search.d.ts +29 -0
- package/dist/selector/search.d.ts.map +1 -0
- package/dist/selector/search.js +48 -0
- package/dist/selector/search.js.map +1 -0
- package/dist/utils/cli.d.ts +20 -0
- package/dist/utils/cli.d.ts.map +1 -0
- package/dist/utils/cli.js +19 -0
- package/dist/utils/cli.js.map +1 -0
- package/dist/utils/format.d.ts +30 -0
- package/dist/utils/format.d.ts.map +1 -0
- package/dist/utils/format.js +44 -0
- package/dist/utils/format.js.map +1 -0
- package/dist/utils/output.d.ts +42 -0
- package/dist/utils/output.d.ts.map +1 -0
- package/dist/utils/output.js +62 -0
- package/dist/utils/output.js.map +1 -0
- package/dist/utils/prompts.d.ts +23 -0
- package/dist/utils/prompts.d.ts.map +1 -0
- package/dist/utils/prompts.js +46 -0
- package/dist/utils/prompts.js.map +1 -0
- package/dist/utils/streams.d.ts +40 -0
- package/dist/utils/streams.d.ts.map +1 -0
- package/dist/utils/streams.js +61 -0
- package/dist/utils/streams.js.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI utilities
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for CLI commands.
|
|
5
|
+
*/
|
|
6
|
+
import type { Command } from 'commander';
|
|
7
|
+
/** Global CLI options */
|
|
8
|
+
export interface GlobalOpts {
|
|
9
|
+
json?: boolean;
|
|
10
|
+
plain?: boolean;
|
|
11
|
+
quiet?: boolean;
|
|
12
|
+
verbose?: boolean;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Get global options from command hierarchy
|
|
16
|
+
*
|
|
17
|
+
* Traverses up the command tree to find the root program's options.
|
|
18
|
+
*/
|
|
19
|
+
export declare function getGlobalOpts(command: Command): GlobalOpts;
|
|
20
|
+
//# sourceMappingURL=cli.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/utils/cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,yBAAyB;AACzB,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;;;GAIG;AACH,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,GAAG,UAAU,CAS1D"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI utilities
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for CLI commands.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Get global options from command hierarchy
|
|
8
|
+
*
|
|
9
|
+
* Traverses up the command tree to find the root program's options.
|
|
10
|
+
*/
|
|
11
|
+
export function getGlobalOpts(command) {
|
|
12
|
+
let current = command;
|
|
13
|
+
// Walk up to root
|
|
14
|
+
while (current?.parent) {
|
|
15
|
+
current = current.parent;
|
|
16
|
+
}
|
|
17
|
+
return current?.opts() || {};
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=cli.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/utils/cli.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAYH;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAC,OAAgB;IAC5C,IAAI,OAAO,GAAmB,OAAO,CAAC;IAEtC,kBAAkB;IAClB,OAAO,OAAO,EAAE,MAAM,EAAE,CAAC;QACvB,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC;IAC3B,CAAC;IAED,OAAO,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting utilities for CLI output
|
|
3
|
+
*
|
|
4
|
+
* Centralized formatting functions to avoid duplication.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Format a command for display
|
|
8
|
+
*/
|
|
9
|
+
export declare function formatCommand(cmd: string): string;
|
|
10
|
+
/**
|
|
11
|
+
* Format a path for display
|
|
12
|
+
*/
|
|
13
|
+
export declare function formatPath(path: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Format highlighted text
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatHighlight(text: string): string;
|
|
18
|
+
/**
|
|
19
|
+
* Format bold text
|
|
20
|
+
*/
|
|
21
|
+
export declare function formatBold(text: string): string;
|
|
22
|
+
/**
|
|
23
|
+
* Format dim/secondary text
|
|
24
|
+
*/
|
|
25
|
+
export declare function formatDim(text: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Format gray text (alias for formatDim)
|
|
28
|
+
*/
|
|
29
|
+
export declare function formatGray(text: string): string;
|
|
30
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH;;GAEG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAEjD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAEpD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE9C;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAE/C"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting utilities for CLI output
|
|
3
|
+
*
|
|
4
|
+
* Centralized formatting functions to avoid duplication.
|
|
5
|
+
*/
|
|
6
|
+
import chalk from 'chalk';
|
|
7
|
+
import { shouldUseColor } from './streams.js';
|
|
8
|
+
/**
|
|
9
|
+
* Format a command for display
|
|
10
|
+
*/
|
|
11
|
+
export function formatCommand(cmd) {
|
|
12
|
+
return shouldUseColor() ? chalk.cyan(cmd) : `'${cmd}'`;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Format a path for display
|
|
16
|
+
*/
|
|
17
|
+
export function formatPath(path) {
|
|
18
|
+
return shouldUseColor() ? chalk.cyan(path) : path;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Format highlighted text
|
|
22
|
+
*/
|
|
23
|
+
export function formatHighlight(text) {
|
|
24
|
+
return shouldUseColor() ? chalk.cyan(text) : text;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Format bold text
|
|
28
|
+
*/
|
|
29
|
+
export function formatBold(text) {
|
|
30
|
+
return shouldUseColor() ? chalk.bold(text) : text;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Format dim/secondary text
|
|
34
|
+
*/
|
|
35
|
+
export function formatDim(text) {
|
|
36
|
+
return shouldUseColor() ? chalk.gray(text) : text;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Format gray text (alias for formatDim)
|
|
40
|
+
*/
|
|
41
|
+
export function formatGray(text) {
|
|
42
|
+
return formatDim(text);
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAE9C;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,cAAc,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,GAAG,GAAG,CAAC;AACzD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,cAAc,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAAY;IAC1C,OAAO,cAAc,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,cAAc,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,cAAc,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;AACpD,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,UAAU,CAAC,IAAY;IACrC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC;AACzB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output utilities for consistent CLI formatting
|
|
3
|
+
*/
|
|
4
|
+
export declare const output: {
|
|
5
|
+
/**
|
|
6
|
+
* Print a success message with checkmark
|
|
7
|
+
*/
|
|
8
|
+
success(message: string): void;
|
|
9
|
+
/**
|
|
10
|
+
* Print an error message
|
|
11
|
+
*/
|
|
12
|
+
error(message: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* Print a warning message
|
|
15
|
+
*/
|
|
16
|
+
warn(message: string): void;
|
|
17
|
+
/**
|
|
18
|
+
* Print an info message
|
|
19
|
+
*/
|
|
20
|
+
info(message: string): void;
|
|
21
|
+
/**
|
|
22
|
+
* Print a dim/secondary message
|
|
23
|
+
*/
|
|
24
|
+
dim(message: string): void;
|
|
25
|
+
/**
|
|
26
|
+
* Print a heading
|
|
27
|
+
*/
|
|
28
|
+
heading(message: string): void;
|
|
29
|
+
/**
|
|
30
|
+
* Print a key-value pair
|
|
31
|
+
*/
|
|
32
|
+
keyValue(key: string, value: string): void;
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* Check if stdout is a TTY (for progress bars, colors, etc.)
|
|
36
|
+
*/
|
|
37
|
+
export declare function isTTY(): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* Check if colors should be disabled
|
|
40
|
+
*/
|
|
41
|
+
export declare function isNoColor(): boolean;
|
|
42
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,eAAO,MAAM,MAAM;IACjB;;OAEG;qBACc,MAAM,GAAG,IAAI;IAI9B;;OAEG;mBACY,MAAM,GAAG,IAAI;IAI5B;;OAEG;kBACW,MAAM,GAAG,IAAI;IAI3B;;OAEG;kBACW,MAAM,GAAG,IAAI;IAI3B;;OAEG;iBACU,MAAM,GAAG,IAAI;IAI1B;;OAEG;qBACc,MAAM,GAAG,IAAI;IAK9B;;OAEG;kBACW,MAAM,SAAS,MAAM,GAAG,IAAI;CAG3C,CAAC;AAEF;;GAEG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAED;;GAEG;AACH,wBAAgB,SAAS,IAAI,OAAO,CAEnC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
/**
|
|
3
|
+
* Output utilities for consistent CLI formatting
|
|
4
|
+
*/
|
|
5
|
+
export const output = {
|
|
6
|
+
/**
|
|
7
|
+
* Print a success message with checkmark
|
|
8
|
+
*/
|
|
9
|
+
success(message) {
|
|
10
|
+
console.log(chalk.green('✓') + ' ' + message);
|
|
11
|
+
},
|
|
12
|
+
/**
|
|
13
|
+
* Print an error message
|
|
14
|
+
*/
|
|
15
|
+
error(message) {
|
|
16
|
+
console.error(chalk.red('Error:') + ' ' + message);
|
|
17
|
+
},
|
|
18
|
+
/**
|
|
19
|
+
* Print a warning message
|
|
20
|
+
*/
|
|
21
|
+
warn(message) {
|
|
22
|
+
console.warn(chalk.yellow('⚠') + ' ' + message);
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* Print an info message
|
|
26
|
+
*/
|
|
27
|
+
info(message) {
|
|
28
|
+
console.log(chalk.blue('ℹ') + ' ' + message);
|
|
29
|
+
},
|
|
30
|
+
/**
|
|
31
|
+
* Print a dim/secondary message
|
|
32
|
+
*/
|
|
33
|
+
dim(message) {
|
|
34
|
+
console.log(chalk.dim(message));
|
|
35
|
+
},
|
|
36
|
+
/**
|
|
37
|
+
* Print a heading
|
|
38
|
+
*/
|
|
39
|
+
heading(message) {
|
|
40
|
+
console.log();
|
|
41
|
+
console.log(chalk.bold(message));
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Print a key-value pair
|
|
45
|
+
*/
|
|
46
|
+
keyValue(key, value) {
|
|
47
|
+
console.log(` ${chalk.gray(key + ':')} ${value}`);
|
|
48
|
+
},
|
|
49
|
+
};
|
|
50
|
+
/**
|
|
51
|
+
* Check if stdout is a TTY (for progress bars, colors, etc.)
|
|
52
|
+
*/
|
|
53
|
+
export function isTTY() {
|
|
54
|
+
return process.stdout.isTTY === true;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Check if colors should be disabled
|
|
58
|
+
*/
|
|
59
|
+
export function isNoColor() {
|
|
60
|
+
return process.env.NO_COLOR !== undefined || process.env.TERM === 'dumb';
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=output.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.js","sourceRoot":"","sources":["../../src/utils/output.ts"],"names":[],"mappings":"AAAA,OAAO,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I,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS;IACvB,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,CAAC;AAC3E,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive prompts for CLI
|
|
3
|
+
*
|
|
4
|
+
* Based on CLI-DESIGN.md:
|
|
5
|
+
* - Confirm before destructive actions
|
|
6
|
+
* - Default to safe option (N)
|
|
7
|
+
* - Support --yes to skip
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Ask for confirmation before a destructive action
|
|
11
|
+
*
|
|
12
|
+
* @param message - The question to ask
|
|
13
|
+
* @param defaultNo - Default to No (safe option)
|
|
14
|
+
* @returns Promise<boolean> - true if confirmed
|
|
15
|
+
*/
|
|
16
|
+
export declare function confirm(message: string, defaultNo?: boolean): Promise<boolean>;
|
|
17
|
+
/**
|
|
18
|
+
* Check if --yes flag was passed (skip confirmations)
|
|
19
|
+
*/
|
|
20
|
+
export declare function shouldSkipConfirm(options: {
|
|
21
|
+
yes?: boolean;
|
|
22
|
+
}): boolean;
|
|
23
|
+
//# sourceMappingURL=prompts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.d.ts","sourceRoot":"","sources":["../../src/utils/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;;;;GAMG;AACH,wBAAsB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,OAAO,CAAC,OAAO,CAAC,CA2BjF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE;IAAE,GAAG,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,OAAO,CAErE"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Interactive prompts for CLI
|
|
3
|
+
*
|
|
4
|
+
* Based on CLI-DESIGN.md:
|
|
5
|
+
* - Confirm before destructive actions
|
|
6
|
+
* - Default to safe option (N)
|
|
7
|
+
* - Support --yes to skip
|
|
8
|
+
*/
|
|
9
|
+
import * as readline from 'readline';
|
|
10
|
+
import { isTTY } from './streams.js';
|
|
11
|
+
/**
|
|
12
|
+
* Ask for confirmation before a destructive action
|
|
13
|
+
*
|
|
14
|
+
* @param message - The question to ask
|
|
15
|
+
* @param defaultNo - Default to No (safe option)
|
|
16
|
+
* @returns Promise<boolean> - true if confirmed
|
|
17
|
+
*/
|
|
18
|
+
export async function confirm(message, defaultNo = true) {
|
|
19
|
+
// If not interactive, default to safe option
|
|
20
|
+
if (!isTTY()) {
|
|
21
|
+
return !defaultNo;
|
|
22
|
+
}
|
|
23
|
+
const suffix = defaultNo ? '[y/N]' : '[Y/n]';
|
|
24
|
+
const rl = readline.createInterface({
|
|
25
|
+
input: process.stdin,
|
|
26
|
+
output: process.stderr, // Prompts go to stderr
|
|
27
|
+
});
|
|
28
|
+
return new Promise((resolve) => {
|
|
29
|
+
rl.question(`${message} ${suffix} `, (answer) => {
|
|
30
|
+
rl.close();
|
|
31
|
+
const normalized = answer.trim().toLowerCase();
|
|
32
|
+
if (normalized === '') {
|
|
33
|
+
resolve(!defaultNo);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
resolve(normalized === 'y' || normalized === 'yes');
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Check if --yes flag was passed (skip confirmations)
|
|
42
|
+
*/
|
|
43
|
+
export function shouldSkipConfirm(options) {
|
|
44
|
+
return options.yes === true;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=prompts.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prompts.js","sourceRoot":"","sources":["../../src/utils/prompts.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAA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I-DESIGN.md:
|
|
5
|
+
* - stdout: Primary output (results, data)
|
|
6
|
+
* - stderr: Progress, logs, errors, prompts
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Check if stdout is a TTY
|
|
10
|
+
*/
|
|
11
|
+
export declare function isTTY(): boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Check if colors should be disabled
|
|
14
|
+
*/
|
|
15
|
+
export declare function shouldUseColor(): boolean;
|
|
16
|
+
/**
|
|
17
|
+
* Write data to stdout (for results, JSON, lists)
|
|
18
|
+
*/
|
|
19
|
+
export declare function writeData(data: string): void;
|
|
20
|
+
/**
|
|
21
|
+
* Write message to stderr (for progress, logs, info)
|
|
22
|
+
*/
|
|
23
|
+
export declare function writeMessage(message: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* Write error to stderr
|
|
26
|
+
*/
|
|
27
|
+
export declare function writeError(message: string): void;
|
|
28
|
+
/**
|
|
29
|
+
* Write success message to stderr
|
|
30
|
+
*/
|
|
31
|
+
export declare function writeSuccess(message: string): void;
|
|
32
|
+
/**
|
|
33
|
+
* Write warning to stderr
|
|
34
|
+
*/
|
|
35
|
+
export declare function writeWarning(message: string): void;
|
|
36
|
+
/**
|
|
37
|
+
* Write info to stderr
|
|
38
|
+
*/
|
|
39
|
+
export declare function writeInfo(message: string): void;
|
|
40
|
+
//# sourceMappingURL=streams.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streams.d.ts","sourceRoot":"","sources":["../../src/utils/streams.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH;;GAEG;AACH,wBAAgB,KAAK,IAAI,OAAO,CAE/B;AAED;;GAEG;AACH,wBAAgB,cAAc,IAAI,OAAO,CAExC;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAE5C;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAElD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAGhD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAGlD;AAED;;GAEG;AACH,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAGlD;AAED;;GAEG;AACH,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,IAAI,CAG/C"}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Stream utilities for proper stdout/stderr separation
|
|
3
|
+
*
|
|
4
|
+
* Based on CLI-DESIGN.md:
|
|
5
|
+
* - stdout: Primary output (results, data)
|
|
6
|
+
* - stderr: Progress, logs, errors, prompts
|
|
7
|
+
*/
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
/**
|
|
10
|
+
* Check if stdout is a TTY
|
|
11
|
+
*/
|
|
12
|
+
export function isTTY() {
|
|
13
|
+
return process.stdout.isTTY === true;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Check if colors should be disabled
|
|
17
|
+
*/
|
|
18
|
+
export function shouldUseColor() {
|
|
19
|
+
return process.env.NO_COLOR === undefined && process.env.TERM !== 'dumb' && isTTY();
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Write data to stdout (for results, JSON, lists)
|
|
23
|
+
*/
|
|
24
|
+
export function writeData(data) {
|
|
25
|
+
process.stdout.write(data + '\n');
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Write message to stderr (for progress, logs, info)
|
|
29
|
+
*/
|
|
30
|
+
export function writeMessage(message) {
|
|
31
|
+
process.stderr.write(message + '\n');
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Write error to stderr
|
|
35
|
+
*/
|
|
36
|
+
export function writeError(message) {
|
|
37
|
+
const prefix = shouldUseColor() ? chalk.red('Error:') : 'Error:';
|
|
38
|
+
process.stderr.write(`${prefix} ${message}\n`);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Write success message to stderr
|
|
42
|
+
*/
|
|
43
|
+
export function writeSuccess(message) {
|
|
44
|
+
const prefix = shouldUseColor() ? chalk.green('✓') : '✓';
|
|
45
|
+
process.stderr.write(`${prefix} ${message}\n`);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Write warning to stderr
|
|
49
|
+
*/
|
|
50
|
+
export function writeWarning(message) {
|
|
51
|
+
const prefix = shouldUseColor() ? chalk.yellow('⚠') : '⚠';
|
|
52
|
+
process.stderr.write(`${prefix} ${message}\n`);
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Write info to stderr
|
|
56
|
+
*/
|
|
57
|
+
export function writeInfo(message) {
|
|
58
|
+
const prefix = shouldUseColor() ? chalk.blue('ℹ') : 'ℹ';
|
|
59
|
+
process.stderr.write(`${prefix} ${message}\n`);
|
|
60
|
+
}
|
|
61
|
+
//# sourceMappingURL=streams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"streams.js","sourceRoot":"","sources":["../../src/utils/streams.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B;;GAEG;AACH,MAAM,UAAU,KAAK;IACnB,OAAO,OAAO,CAAC,MAAM,CAAC,KAAK,KAAK,IAAI,CAAC;AACvC,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,cAAc;IAC5B,OAAO,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,SAAS,IAAI,OAAO,CAAC,GAAG,CAAC,IAAI,KAAK,MAAM,IAAI,KAAK,EAAE,CAAC;AACtF,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,GAAG,IAAI,CAAC,CAAC;AACpC,CAAC;AAED;;GAEG;AACH,MAAM,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
|
+
"name": "@milo4jo/contextkit",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Intelligent context selection for LLM applications",
|
|
5
|
+
"author": "Milo <milo4jo@outlook.de>",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"type": "module",
|
|
8
|
+
"bin": {
|
|
9
|
+
"contextkit": "./dist/index.js"
|
|
10
|
+
},
|
|
11
|
+
"main": "./dist/index.js",
|
|
12
|
+
"types": "./dist/index.d.ts",
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"dev": "tsc --watch",
|
|
19
|
+
"start": "node dist/index.js",
|
|
20
|
+
"lint": "eslint src --ext .ts",
|
|
21
|
+
"lint:fix": "eslint src --ext .ts --fix",
|
|
22
|
+
"format": "prettier --write .",
|
|
23
|
+
"format:check": "prettier --check .",
|
|
24
|
+
"clean": "rm -rf dist",
|
|
25
|
+
"prepublishOnly": "npm run build"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"@xenova/transformers": "^2.17.2",
|
|
29
|
+
"better-sqlite3": "^11.7.0",
|
|
30
|
+
"chalk": "^5.3.0",
|
|
31
|
+
"cli-progress": "^3.12.0",
|
|
32
|
+
"commander": "^12.1.0",
|
|
33
|
+
"fast-glob": "^3.3.2",
|
|
34
|
+
"js-tiktoken": "^1.0.15",
|
|
35
|
+
"yaml": "^2.6.1"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@types/better-sqlite3": "^7.6.12",
|
|
39
|
+
"@types/cli-progress": "^3.11.6",
|
|
40
|
+
"@types/node": "^22.10.7",
|
|
41
|
+
"eslint": "^9.18.0",
|
|
42
|
+
"prettier": "^3.4.2",
|
|
43
|
+
"typescript": "^5.7.3",
|
|
44
|
+
"typescript-eslint": "^8.20.0"
|
|
45
|
+
},
|
|
46
|
+
"engines": {
|
|
47
|
+
"node": ">=18"
|
|
48
|
+
},
|
|
49
|
+
"homepage": "https://github.com/milo4jo/contextkit#readme",
|
|
50
|
+
"bugs": {
|
|
51
|
+
"url": "https://github.com/milo4jo/contextkit/issues"
|
|
52
|
+
},
|
|
53
|
+
"keywords": [
|
|
54
|
+
"llm",
|
|
55
|
+
"context",
|
|
56
|
+
"ai",
|
|
57
|
+
"rag",
|
|
58
|
+
"embeddings",
|
|
59
|
+
"claude",
|
|
60
|
+
"gpt",
|
|
61
|
+
"cli"
|
|
62
|
+
],
|
|
63
|
+
"repository": {
|
|
64
|
+
"type": "git",
|
|
65
|
+
"url": "https://github.com/milo4jo/contextkit.git"
|
|
66
|
+
}
|
|
67
|
+
}
|