@yeseh/cortex-cli 0.6.4 → 0.6.6
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 +44 -0
- package/dist/category/commands/create.d.ts.map +1 -0
- package/dist/category/commands/create.spec.d.ts +7 -0
- package/dist/category/commands/create.spec.d.ts.map +1 -0
- package/dist/category/index.d.ts +19 -0
- package/dist/category/index.d.ts.map +1 -0
- package/dist/commands/init.d.ts +58 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.spec.d.ts +2 -0
- package/dist/commands/init.spec.d.ts.map +1 -0
- package/dist/context.d.ts +18 -0
- package/dist/context.d.ts.map +1 -0
- package/dist/context.spec.d.ts +2 -0
- package/dist/context.spec.d.ts.map +1 -0
- package/dist/create-cli-command.d.ts +23 -0
- package/dist/create-cli-command.d.ts.map +1 -0
- package/dist/create-cli-command.spec.d.ts +10 -0
- package/dist/create-cli-command.spec.d.ts.map +1 -0
- package/dist/errors.d.ts +57 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/errors.spec.d.ts +2 -0
- package/dist/errors.spec.d.ts.map +1 -0
- package/dist/input.d.ts +42 -0
- package/dist/input.d.ts.map +1 -0
- package/dist/input.spec.d.ts +2 -0
- package/dist/input.spec.d.ts.map +1 -0
- package/dist/memory/commands/add.d.ts +62 -0
- package/dist/memory/commands/add.d.ts.map +1 -0
- package/dist/memory/commands/add.spec.d.ts +7 -0
- package/dist/memory/commands/add.spec.d.ts.map +1 -0
- package/dist/memory/commands/definitions.spec.d.ts +10 -0
- package/dist/memory/commands/definitions.spec.d.ts.map +1 -0
- package/dist/memory/commands/handlers.spec.d.ts +2 -0
- package/dist/memory/commands/handlers.spec.d.ts.map +1 -0
- package/dist/memory/commands/list.d.ts +119 -0
- package/dist/memory/commands/list.d.ts.map +1 -0
- package/dist/memory/commands/list.spec.d.ts +2 -0
- package/dist/memory/commands/list.spec.d.ts.map +1 -0
- package/dist/memory/commands/move.d.ts +42 -0
- package/dist/memory/commands/move.d.ts.map +1 -0
- package/dist/memory/commands/move.spec.d.ts +2 -0
- package/dist/memory/commands/move.spec.d.ts.map +1 -0
- package/dist/memory/commands/remove.d.ts +41 -0
- package/dist/memory/commands/remove.d.ts.map +1 -0
- package/dist/memory/commands/remove.spec.d.ts +2 -0
- package/dist/memory/commands/remove.spec.d.ts.map +1 -0
- package/dist/memory/commands/show.d.ts +81 -0
- package/dist/memory/commands/show.d.ts.map +1 -0
- package/dist/memory/commands/show.spec.d.ts +2 -0
- package/dist/memory/commands/show.spec.d.ts.map +1 -0
- package/dist/memory/commands/test-helpers.spec.d.ts +19 -0
- package/dist/memory/commands/test-helpers.spec.d.ts.map +1 -0
- package/dist/memory/commands/update.d.ts +73 -0
- package/dist/memory/commands/update.d.ts.map +1 -0
- package/dist/memory/commands/update.spec.d.ts +2 -0
- package/dist/memory/commands/update.spec.d.ts.map +1 -0
- package/dist/memory/index.d.ts +29 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.spec.d.ts +10 -0
- package/dist/memory/index.spec.d.ts.map +1 -0
- package/dist/memory/parsing.d.ts +3 -0
- package/dist/memory/parsing.d.ts.map +1 -0
- package/dist/memory/parsing.spec.d.ts +7 -0
- package/dist/memory/parsing.spec.d.ts.map +1 -0
- package/dist/output.d.ts +87 -0
- package/dist/output.d.ts.map +1 -0
- package/dist/output.spec.d.ts +2 -0
- package/dist/output.spec.d.ts.map +1 -0
- package/dist/paths.d.ts +27 -0
- package/dist/paths.d.ts.map +1 -0
- package/dist/paths.spec.d.ts +7 -0
- package/dist/paths.spec.d.ts.map +1 -0
- package/dist/program.d.ts +41 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.spec.d.ts +11 -0
- package/dist/program.spec.d.ts.map +1 -0
- package/dist/run.d.ts +7 -0
- package/dist/run.d.ts.map +1 -0
- package/dist/run.spec.d.ts +12 -0
- package/dist/run.spec.d.ts.map +1 -0
- package/dist/store/commands/add.d.ts +73 -0
- package/dist/store/commands/add.d.ts.map +1 -0
- package/dist/store/commands/add.spec.d.ts +17 -0
- package/dist/store/commands/add.spec.d.ts.map +1 -0
- package/dist/store/commands/init.d.ts +75 -0
- package/dist/store/commands/init.d.ts.map +1 -0
- package/dist/store/commands/init.spec.d.ts +7 -0
- package/dist/store/commands/init.spec.d.ts.map +1 -0
- package/dist/store/commands/list.d.ts +62 -0
- package/dist/store/commands/list.d.ts.map +1 -0
- package/dist/store/commands/list.spec.d.ts +7 -0
- package/dist/store/commands/list.spec.d.ts.map +1 -0
- package/dist/store/commands/prune.d.ts +92 -0
- package/dist/store/commands/prune.d.ts.map +1 -0
- package/dist/store/commands/prune.spec.d.ts +7 -0
- package/dist/store/commands/prune.spec.d.ts.map +1 -0
- package/dist/store/commands/reindexs.d.ts +54 -0
- package/dist/store/commands/reindexs.d.ts.map +1 -0
- package/dist/store/commands/reindexs.spec.d.ts +7 -0
- package/dist/store/commands/reindexs.spec.d.ts.map +1 -0
- package/dist/store/commands/remove.d.ts +63 -0
- package/dist/store/commands/remove.d.ts.map +1 -0
- package/dist/store/commands/remove.spec.d.ts +17 -0
- package/dist/store/commands/remove.spec.d.ts.map +1 -0
- package/dist/store/index.d.ts +32 -0
- package/dist/store/index.d.ts.map +1 -0
- package/dist/store/index.spec.d.ts +9 -0
- package/dist/store/index.spec.d.ts.map +1 -0
- package/dist/store/utils/resolve-store-name.d.ts +30 -0
- package/dist/store/utils/resolve-store-name.d.ts.map +1 -0
- package/dist/store/utils/resolve-store-name.spec.d.ts +2 -0
- package/dist/store/utils/resolve-store-name.spec.d.ts.map +1 -0
- package/dist/test-helpers.spec.d.ts +224 -0
- package/dist/test-helpers.spec.d.ts.map +1 -0
- package/dist/tests/cli.integration.spec.d.ts +11 -0
- package/dist/tests/cli.integration.spec.d.ts.map +1 -0
- package/dist/toon.d.ts +197 -0
- package/dist/toon.d.ts.map +1 -0
- package/dist/toon.spec.d.ts +9 -0
- package/dist/toon.spec.d.ts.map +1 -0
- package/dist/utils/git.d.ts +20 -0
- package/dist/utils/git.d.ts.map +1 -0
- package/dist/utils/git.spec.d.ts +7 -0
- package/dist/utils/git.spec.d.ts.map +1 -0
- package/package.json +7 -7
- package/src/run.ts +0 -0
- package/src/tests/cli.integration.spec.ts +79 -270
- package/src/utils/input.ts +4 -9
- package/src/utils/resolve-default-store.spec.ts +1 -1
- package/src/utils/resolve-default-store.ts +2 -6
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,8 +64,7 @@ export const readContentFromFile = async (
|
|
|
64
64
|
try {
|
|
65
65
|
const content = await readFile(trimmed, 'utf8');
|
|
66
66
|
return ok({ content, source: 'file' });
|
|
67
|
-
}
|
|
68
|
-
catch (error) {
|
|
67
|
+
} catch (error) {
|
|
69
68
|
return err({
|
|
70
69
|
code: 'FILE_READ_FAILED',
|
|
71
70
|
message: `Failed to read content file: ${trimmed}.`,
|
|
@@ -76,7 +75,7 @@ export const readContentFromFile = async (
|
|
|
76
75
|
};
|
|
77
76
|
|
|
78
77
|
export const readContentFromStream = async (
|
|
79
|
-
stream: NodeJS.ReadableStream
|
|
78
|
+
stream: NodeJS.ReadableStream
|
|
80
79
|
): Promise<OptionalContentResult> => {
|
|
81
80
|
const isTty = 'isTTY' in stream ? Boolean(stream.isTTY) : false;
|
|
82
81
|
if (isTty) {
|
|
@@ -111,11 +110,7 @@ export const resolveInput = async (source: InputSource): Promise<InputResult> =>
|
|
|
111
110
|
source.stream !== undefined &&
|
|
112
111
|
!('isTTY' in source.stream && Boolean((source.stream as { isTTY?: boolean }).isTTY));
|
|
113
112
|
|
|
114
|
-
const requestedSources = [
|
|
115
|
-
contentProvided,
|
|
116
|
-
fileProvided,
|
|
117
|
-
streamRequested,
|
|
118
|
-
].filter(Boolean);
|
|
113
|
+
const requestedSources = [contentProvided, fileProvided, streamRequested].filter(Boolean);
|
|
119
114
|
|
|
120
115
|
if (requestedSources.length > 1) {
|
|
121
116
|
return err({
|
|
@@ -53,12 +53,8 @@ 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
|
-
|
|
58
|
-
];
|
|
59
|
-
for (const [
|
|
60
|
-
name, store,
|
|
61
|
-
] of Object.entries(stores)) {
|
|
56
|
+
const localPaths = [join(cwd, '.cortex'), join(cwd, '.cortex', 'memory')];
|
|
57
|
+
for (const [name, store] of Object.entries(stores)) {
|
|
62
58
|
const storePath = store.properties?.path as string | undefined;
|
|
63
59
|
if (storePath && localPaths.includes(storePath)) {
|
|
64
60
|
return name;
|