@yeseh/cortex-cli 0.6.6 → 0.6.7
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/category/commands/create.d.ts.map +1 -1
- package/dist/chunk-tgrm2cc9.js +1543 -0
- package/dist/chunk-tgrm2cc9.js.map +38 -0
- package/dist/commands/init.d.ts +26 -5
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/context.d.ts +22 -17
- package/dist/context.d.ts.map +1 -1
- package/dist/context.spec.d.ts +8 -0
- package/dist/context.spec.d.ts.map +1 -1
- package/dist/memory/commands/add.d.ts.map +1 -1
- package/dist/memory/commands/list.d.ts.map +1 -1
- package/dist/memory/commands/move.d.ts.map +1 -1
- package/dist/memory/commands/remove.d.ts.map +1 -1
- package/dist/memory/commands/show.d.ts.map +1 -1
- package/dist/memory/commands/update.d.ts.map +1 -1
- package/dist/observability.d.ts +33 -0
- package/dist/observability.d.ts.map +1 -0
- package/dist/observability.spec.d.ts +2 -0
- package/dist/observability.spec.d.ts.map +1 -0
- package/dist/output.d.ts +21 -1
- package/dist/output.d.ts.map +1 -1
- package/dist/program.d.ts.map +1 -1
- package/dist/program.js +11 -0
- package/dist/program.js.map +9 -0
- package/dist/run.js +10 -0
- package/dist/run.js.map +10 -0
- package/dist/store/commands/init.d.ts +23 -7
- package/dist/store/commands/init.d.ts.map +1 -1
- package/dist/store/commands/prune.d.ts.map +1 -1
- package/dist/store/commands/reindexs.d.ts.map +1 -1
- package/dist/test-helpers.spec.d.ts +2 -2
- package/dist/utils/input.d.ts.map +1 -0
- package/dist/{input.spec.d.ts.map → utils/input.spec.d.ts.map} +1 -1
- package/dist/{paths.d.ts → utils/paths.d.ts} +10 -0
- package/dist/utils/paths.d.ts.map +1 -0
- package/dist/utils/paths.spec.d.ts.map +1 -0
- package/dist/utils/prompts.d.ts +86 -0
- package/dist/utils/prompts.d.ts.map +1 -0
- package/dist/utils/prompts.spec.d.ts +2 -0
- package/dist/utils/prompts.spec.d.ts.map +1 -0
- package/dist/utils/resolve-default-store.d.ts +44 -0
- package/dist/utils/resolve-default-store.d.ts.map +1 -0
- package/dist/utils/resolve-default-store.spec.d.ts +7 -0
- package/dist/utils/resolve-default-store.spec.d.ts.map +1 -0
- package/package.json +9 -9
- package/src/run.ts +0 -0
- package/src/tests/cli.integration.spec.ts +270 -79
- package/src/utils/input.ts +9 -4
- package/src/utils/resolve-default-store.spec.ts +1 -1
- package/src/utils/resolve-default-store.ts +6 -2
- package/dist/create-cli-command.d.ts +0 -23
- package/dist/create-cli-command.d.ts.map +0 -1
- package/dist/create-cli-command.spec.d.ts +0 -10
- package/dist/create-cli-command.spec.d.ts.map +0 -1
- package/dist/input.d.ts.map +0 -1
- package/dist/memory/commands/handlers.spec.d.ts +0 -2
- package/dist/memory/commands/handlers.spec.d.ts.map +0 -1
- package/dist/paths.d.ts.map +0 -1
- package/dist/paths.spec.d.ts.map +0 -1
- /package/dist/{input.d.ts → utils/input.d.ts} +0 -0
- /package/dist/{input.spec.d.ts → utils/input.spec.d.ts} +0 -0
- /package/dist/{paths.spec.d.ts → utils/paths.spec.d.ts} +0 -0
package/src/utils/input.ts
CHANGED
|
@@ -49,7 +49,7 @@ type InputResult = Result<InputContent, InputError>;
|
|
|
49
49
|
type OptionalContentResult = Result<InputContent | null, InputError>;
|
|
50
50
|
|
|
51
51
|
export const readContentFromFile = async (
|
|
52
|
-
filePath: string | undefined
|
|
52
|
+
filePath: string | undefined,
|
|
53
53
|
): Promise<OptionalContentResult> => {
|
|
54
54
|
if (filePath === undefined) {
|
|
55
55
|
return ok(null);
|
|
@@ -64,7 +64,8 @@ export const readContentFromFile = async (
|
|
|
64
64
|
try {
|
|
65
65
|
const content = await readFile(trimmed, 'utf8');
|
|
66
66
|
return ok({ content, source: 'file' });
|
|
67
|
-
}
|
|
67
|
+
}
|
|
68
|
+
catch (error) {
|
|
68
69
|
return err({
|
|
69
70
|
code: 'FILE_READ_FAILED',
|
|
70
71
|
message: `Failed to read content file: ${trimmed}.`,
|
|
@@ -75,7 +76,7 @@ export const readContentFromFile = async (
|
|
|
75
76
|
};
|
|
76
77
|
|
|
77
78
|
export const readContentFromStream = async (
|
|
78
|
-
stream: NodeJS.ReadableStream
|
|
79
|
+
stream: NodeJS.ReadableStream,
|
|
79
80
|
): Promise<OptionalContentResult> => {
|
|
80
81
|
const isTty = 'isTTY' in stream ? Boolean(stream.isTTY) : false;
|
|
81
82
|
if (isTty) {
|
|
@@ -110,7 +111,11 @@ export const resolveInput = async (source: InputSource): Promise<InputResult> =>
|
|
|
110
111
|
source.stream !== undefined &&
|
|
111
112
|
!('isTTY' in source.stream && Boolean((source.stream as { isTTY?: boolean }).isTTY));
|
|
112
113
|
|
|
113
|
-
const requestedSources = [
|
|
114
|
+
const requestedSources = [
|
|
115
|
+
contentProvided,
|
|
116
|
+
fileProvided,
|
|
117
|
+
streamRequested,
|
|
118
|
+
].filter(Boolean);
|
|
114
119
|
|
|
115
120
|
if (requestedSources.length > 1) {
|
|
116
121
|
return err({
|
|
@@ -53,8 +53,12 @@ export function resolveDefaultStore(ctx: CortexContext, explicit: string | undef
|
|
|
53
53
|
// 2. Local store – registered store whose path is the `.cortex` dir in cwd
|
|
54
54
|
// Both `.cortex` and `.cortex/memory` are accepted to handle both
|
|
55
55
|
// naming conventions in use across the project.
|
|
56
|
-
const localPaths = [
|
|
57
|
-
|
|
56
|
+
const localPaths = [
|
|
57
|
+
join(cwd, '.cortex'), join(cwd, '.cortex', 'memory'),
|
|
58
|
+
];
|
|
59
|
+
for (const [
|
|
60
|
+
name, store,
|
|
61
|
+
] of Object.entries(stores)) {
|
|
58
62
|
const storePath = store.properties?.path as string | undefined;
|
|
59
63
|
if (storePath && localPaths.includes(storePath)) {
|
|
60
64
|
return name;
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { getDefaultSettings, type ConfigValidationError, type CortexContext, type Result } from '@yeseh/cortex-core';
|
|
2
|
-
import { FilesystemStorageAdapter, FilesystemConfigAdapter } from '@yeseh/cortex-storage-fs';
|
|
3
|
-
export declare const validateStorePath: (storePath: string, storeName: string) => Result<void, ConfigValidationError>;
|
|
4
|
-
export interface ConfigLoadOptions {
|
|
5
|
-
cwd?: string;
|
|
6
|
-
globalConfigPath?: string;
|
|
7
|
-
localConfigPath?: string;
|
|
8
|
-
}
|
|
9
|
-
export interface CliContextOptions {
|
|
10
|
-
configDir?: string;
|
|
11
|
-
configCwd?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface CliConfigContext {
|
|
14
|
-
configAdapter: FilesystemConfigAdapter;
|
|
15
|
-
stores: Record<string, any>;
|
|
16
|
-
settings: ReturnType<typeof getDefaultSettings>;
|
|
17
|
-
effectiveCwd: string;
|
|
18
|
-
}
|
|
19
|
-
export declare const createCliConfigAdapter: (configPath: string) => FilesystemConfigAdapter;
|
|
20
|
-
export declare const createCliAdapterFactory: (configAdapter: FilesystemConfigAdapter) => (storeName: string) => FilesystemStorageAdapter;
|
|
21
|
-
export declare const createCliConfigContext: (options?: CliContextOptions) => Promise<Result<CliConfigContext, any>>;
|
|
22
|
-
export declare const createCliCommandContext: (configDir?: string) => Promise<Result<CortexContext, any>>;
|
|
23
|
-
//# sourceMappingURL=create-cli-command.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-cli-command.d.ts","sourceRoot":"","sources":["../src/create-cli-command.ts"],"names":[],"mappings":"AAAA,OAAO,EAGH,kBAAkB,EAElB,KAAK,qBAAqB,EAC1B,KAAK,aAAa,EAClB,KAAK,MAAM,EACd,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,0BAA0B,CAAC;AAY7F,eAAO,MAAM,iBAAiB,GAC1B,WAAW,MAAM,EACjB,WAAW,MAAM,KAClB,MAAM,CAAC,IAAI,EAAE,qBAAqB,CAWpC,CAAC;AAEF,MAAM,WAAW,iBAAiB;IAC9B,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,iBAAiB;IAC9B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,gBAAgB;IAC7B,aAAa,EAAE,uBAAuB,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IAC5B,QAAQ,EAAE,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC;IAChD,YAAY,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,sBAAsB,GAAI,YAAY,MAAM,KAAG,uBAE3D,CAAC;AAEF,eAAO,MAAM,uBAAuB,GAAI,eAAe,uBAAuB,MAClE,WAAW,MAAM,6BAkB5B,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAC/B,UAAS,iBAAsB,KAChC,OAAO,CAAC,MAAM,CAAC,gBAAgB,EAAE,GAAG,CAAC,CA0CvC,CAAC;AAKF,eAAO,MAAM,uBAAuB,GAChC,YAAY,MAAM,KACnB,OAAO,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,CAAC,CAoCpC,CAAC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Unit tests for create-cli-command.ts — validateStorePath.
|
|
3
|
-
*
|
|
4
|
-
* Verifies that absolute paths pass validation and relative paths
|
|
5
|
-
* produce a typed INVALID_STORE_PATH error result.
|
|
6
|
-
*
|
|
7
|
-
* @module cli/create-cli-command.spec
|
|
8
|
-
*/
|
|
9
|
-
export {};
|
|
10
|
-
//# sourceMappingURL=create-cli-command.spec.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"create-cli-command.spec.d.ts","sourceRoot":"","sources":["../src/create-cli-command.spec.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG"}
|
package/dist/input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Q,WAAW,KAAG,OAAO,CAAC,WAAW,CA6C3E,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.spec.d.ts","sourceRoot":"","sources":["../../../src/memory/commands/handlers.spec.ts"],"names":[],"mappings":""}
|
package/dist/paths.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../src/paths.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAKH;;;GAGG;AACH,wBAAgB,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAQzD;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAYtE"}
|
package/dist/paths.spec.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"paths.spec.d.ts","sourceRoot":"","sources":["../src/paths.spec.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|