@tekmemo/cli 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/LICENSE +21 -0
- package/README.md +73 -0
- package/dist/bin/tekmemo.cjs +20 -0
- package/dist/bin/tekmemo.cjs.map +1 -0
- package/dist/bin/tekmemo.d.cts +1 -0
- package/dist/bin/tekmemo.d.mts +1 -0
- package/dist/bin/tekmemo.mjs +21 -0
- package/dist/bin/tekmemo.mjs.map +1 -0
- package/dist/chunk-C0xms8kb.cjs +34 -0
- package/dist/index.cjs +38 -0
- package/dist/index.d.cts +276 -0
- package/dist/index.d.cts.map +1 -0
- package/dist/index.d.mts +276 -0
- package/dist/index.d.mts.map +1 -0
- package/dist/index.mjs +3 -0
- package/dist/runner-Bz3RPzFc.mjs +3719 -0
- package/dist/runner-Bz3RPzFc.mjs.map +1 -0
- package/dist/runner-CiA5dFku.cjs +3914 -0
- package/dist/runner-CiA5dFku.cjs.map +1 -0
- package/dist/testing/index.cjs +26 -0
- package/dist/testing/index.cjs.map +1 -0
- package/dist/testing/index.d.cts +8 -0
- package/dist/testing/index.d.cts.map +1 -0
- package/dist/testing/index.d.mts +8 -0
- package/dist/testing/index.d.mts.map +1 -0
- package/dist/testing/index.mjs +21 -0
- package/dist/testing/index.mjs.map +1 -0
- package/package.json +99 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 TekMemo.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
# `@tekmemo/cli`
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@tekmemo%2Fcli)
|
|
4
|
+
[](https://www.npmjs.com/package/@tekmemo%2Fcli)
|
|
5
|
+
[](https://github.com/tekbreed/tekmemo/actions/workflows/ci.yml)
|
|
6
|
+
[](https://docs.tekmemo.dev)
|
|
7
|
+
[](../../LICENSE)
|
|
8
|
+

|
|
9
|
+
|
|
10
|
+
## Purpose
|
|
11
|
+
|
|
12
|
+
**CLI.** Command-line interface for local, cloud, and hybrid TekMemo workflows.
|
|
13
|
+
|
|
14
|
+
## Install
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
pnpm add @tekmemo/cli
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## Quick start
|
|
21
|
+
|
|
22
|
+
```bash
|
|
23
|
+
pnpm add -D @tekmemo/cli
|
|
24
|
+
pnpm exec tekmemo init
|
|
25
|
+
pnpm exec tekmemo remember "Use D1 for hosted sync" --kind decision
|
|
26
|
+
pnpm exec tekmemo context --query "current task" --json
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## Boundary
|
|
30
|
+
|
|
31
|
+
This package owns its package-level contract only. It does not own TekMemo Cloud billing, dashboards, tenancy, hosted database storage, or provider secrets unless explicitly stated by its package name.
|
|
32
|
+
|
|
33
|
+
For hosted memory, use `@tekmemo/cloud-client`. For local file-backed memory, use `tekmemo` with `@tekmemo/fs`. For MCP tools, use `@tekmemo/mcp-server`.
|
|
34
|
+
|
|
35
|
+
## Scripts
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
pnpm --filter @tekmemo/cli typecheck
|
|
39
|
+
pnpm --filter @tekmemo/cli test:run
|
|
40
|
+
pnpm --filter @tekmemo/cli build
|
|
41
|
+
pnpm --filter @tekmemo/cli lint:package
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Docs
|
|
45
|
+
|
|
46
|
+
- Package docs: https://docs.tekmemo.dev/packages/
|
|
47
|
+
- Examples: https://docs.tekmemo.dev/examples/
|
|
48
|
+
- Repository: https://github.com/tekbreed/tekmemo
|
|
49
|
+
|
|
50
|
+
## Publishing metadata
|
|
51
|
+
|
|
52
|
+
- npm package: `@tekmemo/cli`
|
|
53
|
+
- publish visibility: public
|
|
54
|
+
- runtime format: dual ESM/CJS
|
|
55
|
+
- ESM output: `dist/**/*.mjs` + `dist/**/*.d.mts`
|
|
56
|
+
- CJS output: `dist/**/*.cjs` + `dist/**/*.d.cts`
|
|
57
|
+
- package contents: `dist` and `README.md`
|
|
58
|
+
- package boundary: hosted cloud calls must go through `@tekmemo/cloud-client` unless this package is `@tekmemo/cloud-client` itself.
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
## Publish readiness
|
|
62
|
+
|
|
63
|
+
Before publishing this package, run:
|
|
64
|
+
|
|
65
|
+
```bash
|
|
66
|
+
pnpm --filter @tekmemo/cli release:check
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
The package-level check builds `dist/`, runs TypeScript and tests, runs `publint`, and performs `npm pack --dry-run`. Publish from CI with Changesets and npm trusted publishing/provenance after the root release preflight passes.
|
|
70
|
+
|
|
71
|
+
## License
|
|
72
|
+
|
|
73
|
+
MIT.
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
const require_runner = require('../runner-CiA5dFku.cjs');
|
|
3
|
+
|
|
4
|
+
//#region src/bin/tekmemo.ts
|
|
5
|
+
async function main() {
|
|
6
|
+
const result = await require_runner.runTekMemoCli({
|
|
7
|
+
argv: process.argv.slice(2),
|
|
8
|
+
cwd: process.cwd()
|
|
9
|
+
});
|
|
10
|
+
for (const line of result.stdout) console.log(line);
|
|
11
|
+
for (const line of result.stderr) console.error(line);
|
|
12
|
+
process.exitCode = result.exitCode;
|
|
13
|
+
}
|
|
14
|
+
main().catch((error) => {
|
|
15
|
+
console.error(error);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
//# sourceMappingURL=tekmemo.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tekmemo.cjs","names":["runTekMemoCli"],"sources":["../../src/bin/tekmemo.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { runTekMemoCli } from \"../runner\";\n\nasync function main() {\n\tconst result = await runTekMemoCli({\n\t\targv: process.argv.slice(2),\n\t\tcwd: process.cwd(),\n\t});\n\n\tfor (const line of result.stdout) {\n\t\tconsole.log(line);\n\t}\n\n\tfor (const line of result.stderr) {\n\t\tconsole.error(line);\n\t}\n\n\tprocess.exitCode = result.exitCode;\n}\n\nmain().catch((error) => {\n\tconsole.error(error);\n\tprocess.exit(1);\n});\n"],"mappings":";;;;AAGA,eAAe,OAAO;CACrB,MAAM,SAAS,MAAMA,6BAAc;EAClC,MAAM,QAAQ,KAAK,MAAM,EAAE;EAC3B,KAAK,QAAQ,KAAK;EAClB,CAAC;AAEF,MAAK,MAAM,QAAQ,OAAO,OACzB,SAAQ,IAAI,KAAK;AAGlB,MAAK,MAAM,QAAQ,OAAO,OACzB,SAAQ,MAAM,KAAK;AAGpB,SAAQ,WAAW,OAAO;;AAG3B,MAAM,CAAC,OAAO,UAAU;AACvB,SAAQ,MAAM,MAAM;AACpB,SAAQ,KAAK,EAAE;EACd"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { t as runTekMemoCli } from "../runner-Bz3RPzFc.mjs";
|
|
3
|
+
|
|
4
|
+
//#region src/bin/tekmemo.ts
|
|
5
|
+
async function main() {
|
|
6
|
+
const result = await runTekMemoCli({
|
|
7
|
+
argv: process.argv.slice(2),
|
|
8
|
+
cwd: process.cwd()
|
|
9
|
+
});
|
|
10
|
+
for (const line of result.stdout) console.log(line);
|
|
11
|
+
for (const line of result.stderr) console.error(line);
|
|
12
|
+
process.exitCode = result.exitCode;
|
|
13
|
+
}
|
|
14
|
+
main().catch((error) => {
|
|
15
|
+
console.error(error);
|
|
16
|
+
process.exit(1);
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
//#endregion
|
|
20
|
+
export { };
|
|
21
|
+
//# sourceMappingURL=tekmemo.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tekmemo.mjs","names":[],"sources":["../../src/bin/tekmemo.ts"],"sourcesContent":["#!/usr/bin/env node\nimport { runTekMemoCli } from \"../runner\";\n\nasync function main() {\n\tconst result = await runTekMemoCli({\n\t\targv: process.argv.slice(2),\n\t\tcwd: process.cwd(),\n\t});\n\n\tfor (const line of result.stdout) {\n\t\tconsole.log(line);\n\t}\n\n\tfor (const line of result.stderr) {\n\t\tconsole.error(line);\n\t}\n\n\tprocess.exitCode = result.exitCode;\n}\n\nmain().catch((error) => {\n\tconsole.error(error);\n\tprocess.exit(1);\n});\n"],"mappings":";;;;AAGA,eAAe,OAAO;CACrB,MAAM,SAAS,MAAM,cAAc;EAClC,MAAM,QAAQ,KAAK,MAAM,EAAE;EAC3B,KAAK,QAAQ,KAAK;EAClB,CAAC;AAEF,MAAK,MAAM,QAAQ,OAAO,OACzB,SAAQ,IAAI,KAAK;AAGlB,MAAK,MAAM,QAAQ,OAAO,OACzB,SAAQ,MAAM,KAAK;AAGpB,SAAQ,WAAW,OAAO;;AAG3B,MAAM,CAAC,OAAO,UAAU;AACvB,SAAQ,MAAM,MAAM;AACpB,SAAQ,KAAK,EAAE;EACd"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __copyProps = (to, from, except, desc) => {
|
|
9
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
10
|
+
for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
11
|
+
key = keys[i];
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
13
|
+
__defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return to;
|
|
21
|
+
};
|
|
22
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
23
|
+
value: mod,
|
|
24
|
+
enumerable: true
|
|
25
|
+
}) : target, mod));
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
|
|
29
|
+
Object.defineProperty(exports, '__toESM', {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
get: function () {
|
|
32
|
+
return __toESM;
|
|
33
|
+
}
|
|
34
|
+
});
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_chunk = require('./chunk-C0xms8kb.cjs');
|
|
3
|
+
const require_runner = require('./runner-CiA5dFku.cjs');
|
|
4
|
+
let tekmemo = require("tekmemo");
|
|
5
|
+
|
|
6
|
+
exports.CliError = require_runner.CliError;
|
|
7
|
+
exports.CliFsError = require_runner.CliFsError;
|
|
8
|
+
exports.CliJsonlError = require_runner.CliJsonlError;
|
|
9
|
+
exports.CliProtocolError = require_runner.CliProtocolError;
|
|
10
|
+
exports.CliUsageError = require_runner.CliUsageError;
|
|
11
|
+
exports.CliValidationError = require_runner.CliValidationError;
|
|
12
|
+
exports.REQUIRED_DIRS = require_runner.REQUIRED_DIRS;
|
|
13
|
+
exports.REQUIRED_FILES = require_runner.REQUIRED_FILES;
|
|
14
|
+
exports.TEKMEMO_DIR = tekmemo.TEKMEMO_DIR;
|
|
15
|
+
exports.TEKMEMO_PATHS = require_runner.TEKMEMO_PATHS;
|
|
16
|
+
exports.TekMemoFileSystem = require_runner.TekMemoFileSystem;
|
|
17
|
+
exports.cloudConnectionSummary = require_runner.cloudConnectionSummary;
|
|
18
|
+
exports.createBufferedOutput = require_runner.createBufferedOutput;
|
|
19
|
+
exports.createCliCloudClient = require_runner.createCliCloudClient;
|
|
20
|
+
exports.createDefaultManifest = require_runner.createDefaultManifest;
|
|
21
|
+
exports.createSafeIdFromLabel = require_runner.createSafeIdFromLabel;
|
|
22
|
+
exports.formatCloudError = require_runner.formatCloudError;
|
|
23
|
+
exports.inspectTekMemo = require_runner.inspectTekMemo;
|
|
24
|
+
exports.normalizeCloudConnectionOptions = require_runner.normalizeCloudConnectionOptions;
|
|
25
|
+
exports.parseJsonl = require_runner.parseJsonl;
|
|
26
|
+
exports.parseManifest = require_runner.parseManifest;
|
|
27
|
+
exports.printHumanOrJson = require_runner.printHumanOrJson;
|
|
28
|
+
exports.printJsonEnvelope = require_runner.printJsonEnvelope;
|
|
29
|
+
exports.printJsonError = require_runner.printJsonError;
|
|
30
|
+
exports.redactSecretPreview = require_runner.redactSecretPreview;
|
|
31
|
+
exports.resolveCliRuntimeConfig = require_runner.resolveCliRuntimeConfig;
|
|
32
|
+
exports.runTekMemoCli = require_runner.runTekMemoCli;
|
|
33
|
+
exports.scanForSecrets = require_runner.scanForSecrets;
|
|
34
|
+
exports.stringifyJsonl = require_runner.stringifyJsonl;
|
|
35
|
+
exports.toCloudClientOptions = require_runner.toCloudClientOptions;
|
|
36
|
+
exports.validateManifest = require_runner.validateManifest;
|
|
37
|
+
exports.validateSnapshotLabel = require_runner.validateSnapshotLabel;
|
|
38
|
+
exports.writeDefaultCliConfig = require_runner.writeDefaultCliConfig;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
import { TekMemoCloudClient, TekMemoCloudClientOptions } from "@tekmemo/cloud-client";
|
|
2
|
+
import { TEKMEMO_DIR, TekMemoManifest } from "tekmemo";
|
|
3
|
+
|
|
4
|
+
//#region src/cloud/client.d.ts
|
|
5
|
+
interface CloudConnectionOptions {
|
|
6
|
+
cloudUrl?: string | undefined;
|
|
7
|
+
apiKey?: string | undefined;
|
|
8
|
+
workspaceId?: string | undefined;
|
|
9
|
+
projectId?: string | undefined;
|
|
10
|
+
timeoutMs?: number | string | undefined;
|
|
11
|
+
allowMissingApiKey?: boolean | undefined;
|
|
12
|
+
allowMissingProjectId?: boolean | undefined;
|
|
13
|
+
}
|
|
14
|
+
interface NormalizedCloudConnectionOptions {
|
|
15
|
+
baseUrl: string;
|
|
16
|
+
apiKey?: string | undefined;
|
|
17
|
+
workspaceId?: string | undefined;
|
|
18
|
+
projectId?: string | undefined;
|
|
19
|
+
timeoutMs?: number | undefined;
|
|
20
|
+
}
|
|
21
|
+
declare function createCliCloudClient(options?: CloudConnectionOptions): TekMemoCloudClient;
|
|
22
|
+
declare function toCloudClientOptions(options?: CloudConnectionOptions): TekMemoCloudClientOptions;
|
|
23
|
+
declare function normalizeCloudConnectionOptions(options?: CloudConnectionOptions): NormalizedCloudConnectionOptions;
|
|
24
|
+
declare function formatCloudError(error: unknown): string;
|
|
25
|
+
declare function cloudConnectionSummary(options: NormalizedCloudConnectionOptions): Record<string, unknown>;
|
|
26
|
+
//#endregion
|
|
27
|
+
//#region src/config/runtime.d.ts
|
|
28
|
+
type TekMemoRuntimeMode = "local" | "cloud" | "hybrid";
|
|
29
|
+
type TekMemoReadPolicy = "local-first" | "cloud-first" | "local-only" | "cloud-only";
|
|
30
|
+
type TekMemoWritePolicy = "local-first" | "cloud-first" | "local-only" | "cloud-only";
|
|
31
|
+
interface TekMemoConfigFile {
|
|
32
|
+
version?: number;
|
|
33
|
+
runtime?: TekMemoRuntimeMode;
|
|
34
|
+
root?: string;
|
|
35
|
+
cloud?: {
|
|
36
|
+
baseUrl?: string;
|
|
37
|
+
workspaceId?: string;
|
|
38
|
+
projectId?: string;
|
|
39
|
+
timeoutMs?: number;
|
|
40
|
+
};
|
|
41
|
+
hybrid?: {
|
|
42
|
+
readPolicy?: TekMemoReadPolicy;
|
|
43
|
+
writePolicy?: TekMemoWritePolicy;
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
interface CliRuntimeFlags {
|
|
47
|
+
root?: string;
|
|
48
|
+
runtime?: string;
|
|
49
|
+
cloudUrl?: string;
|
|
50
|
+
apiKey?: string;
|
|
51
|
+
workspaceId?: string;
|
|
52
|
+
projectId?: string;
|
|
53
|
+
timeoutMs?: string | number;
|
|
54
|
+
readPolicy?: string;
|
|
55
|
+
writePolicy?: string;
|
|
56
|
+
}
|
|
57
|
+
interface ResolvedCliRuntimeConfig {
|
|
58
|
+
runtime: TekMemoRuntimeMode;
|
|
59
|
+
root: string;
|
|
60
|
+
configPath: string;
|
|
61
|
+
configLoaded: boolean;
|
|
62
|
+
cloud: {
|
|
63
|
+
cloudUrl?: string;
|
|
64
|
+
apiKey?: string;
|
|
65
|
+
workspaceId?: string;
|
|
66
|
+
projectId?: string;
|
|
67
|
+
timeoutMs?: number;
|
|
68
|
+
};
|
|
69
|
+
hybrid: {
|
|
70
|
+
readPolicy: TekMemoReadPolicy;
|
|
71
|
+
writePolicy: TekMemoWritePolicy;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
declare function resolveCliRuntimeConfig(input: {
|
|
75
|
+
cwd: string;
|
|
76
|
+
flags?: CliRuntimeFlags;
|
|
77
|
+
env?: NodeJS.ProcessEnv;
|
|
78
|
+
}): Promise<ResolvedCliRuntimeConfig>;
|
|
79
|
+
declare function writeDefaultCliConfig(input: {
|
|
80
|
+
cwd: string;
|
|
81
|
+
root?: string;
|
|
82
|
+
config?: TekMemoConfigFile;
|
|
83
|
+
force?: boolean;
|
|
84
|
+
}): Promise<{
|
|
85
|
+
path: string;
|
|
86
|
+
created: boolean;
|
|
87
|
+
overwritten: boolean;
|
|
88
|
+
}>;
|
|
89
|
+
//#endregion
|
|
90
|
+
//#region src/errors/cli-errors.d.ts
|
|
91
|
+
type CliErrorCode = "CLI_USAGE_ERROR" | "CLI_VALIDATION_ERROR" | "CLI_FS_ERROR" | "CLI_PROTOCOL_ERROR" | "CLI_JSONL_ERROR";
|
|
92
|
+
declare class CliError extends Error {
|
|
93
|
+
readonly code: CliErrorCode;
|
|
94
|
+
readonly exitCode: number;
|
|
95
|
+
readonly cause?: unknown;
|
|
96
|
+
constructor(code: CliErrorCode, message: string, options?: {
|
|
97
|
+
exitCode?: number;
|
|
98
|
+
cause?: unknown;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
declare class CliUsageError extends CliError {
|
|
102
|
+
constructor(message: string, options?: {
|
|
103
|
+
cause?: unknown;
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
declare class CliValidationError extends CliError {
|
|
107
|
+
constructor(message: string, options?: {
|
|
108
|
+
cause?: unknown;
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
declare class CliFsError extends CliError {
|
|
112
|
+
constructor(message: string, options?: {
|
|
113
|
+
cause?: unknown;
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
declare class CliProtocolError extends CliError {
|
|
117
|
+
constructor(message: string, options?: {
|
|
118
|
+
cause?: unknown;
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
declare class CliJsonlError extends CliError {
|
|
122
|
+
constructor(message: string, options?: {
|
|
123
|
+
cause?: unknown;
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/fs/tekmemo-fs.d.ts
|
|
128
|
+
interface TekMemoFileSystemOptions {
|
|
129
|
+
rootDir: string;
|
|
130
|
+
rejectSymlinkedTekMemoDir?: boolean;
|
|
131
|
+
}
|
|
132
|
+
declare class TekMemoFileSystem {
|
|
133
|
+
readonly rootDir: string;
|
|
134
|
+
private readonly rejectSymlinkedTekMemoDir;
|
|
135
|
+
constructor(options: TekMemoFileSystemOptions);
|
|
136
|
+
resolve(relativePath: string): string;
|
|
137
|
+
ensureSafeRoot(): Promise<void>;
|
|
138
|
+
exists(relativePath: string): Promise<boolean>;
|
|
139
|
+
readText(relativePath: string): Promise<string>;
|
|
140
|
+
readTextIfExists(relativePath: string): Promise<string | undefined>;
|
|
141
|
+
writeText(relativePath: string, content: string): Promise<void>;
|
|
142
|
+
appendText(relativePath: string, content: string): Promise<void>;
|
|
143
|
+
mkdir(relativePath: string): Promise<void>;
|
|
144
|
+
stat(relativePath: string): Promise<{
|
|
145
|
+
isFile: boolean;
|
|
146
|
+
isDirectory: boolean;
|
|
147
|
+
isSymbolicLink: boolean;
|
|
148
|
+
size: number;
|
|
149
|
+
}>;
|
|
150
|
+
private rejectUnsafeTekMemoSymlinkIfNeeded;
|
|
151
|
+
}
|
|
152
|
+
//#endregion
|
|
153
|
+
//#region src/output/output.d.ts
|
|
154
|
+
interface CliOutput {
|
|
155
|
+
stdout: string[];
|
|
156
|
+
stderr: string[];
|
|
157
|
+
write(message: string): void;
|
|
158
|
+
error(message: string): void;
|
|
159
|
+
success(message: string): void;
|
|
160
|
+
warn(message: string): void;
|
|
161
|
+
}
|
|
162
|
+
interface JsonEnvelope<T = unknown> {
|
|
163
|
+
ok: boolean;
|
|
164
|
+
command: string;
|
|
165
|
+
data?: T;
|
|
166
|
+
error?: {
|
|
167
|
+
code: string;
|
|
168
|
+
message: string;
|
|
169
|
+
details?: unknown;
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
interface BufferedOutputOptions {
|
|
173
|
+
noColor?: boolean;
|
|
174
|
+
}
|
|
175
|
+
declare function createBufferedOutput(options?: BufferedOutputOptions): CliOutput;
|
|
176
|
+
declare function printHumanOrJson(output: CliOutput, value: unknown, human: string, json?: boolean): void;
|
|
177
|
+
declare function printJsonEnvelope<T>(output: CliOutput, command: string, data: T): void;
|
|
178
|
+
declare function printJsonError(output: CliOutput, command: string, code: string, message: string, details?: unknown): void;
|
|
179
|
+
//#endregion
|
|
180
|
+
//#region src/protocol/constants.d.ts
|
|
181
|
+
/**
|
|
182
|
+
* Flat CLI path map kept for command ergonomics.
|
|
183
|
+
* The values intentionally come from `tekmemo`, so the CLI cannot drift from
|
|
184
|
+
* the canonical protocol owned by the core package.
|
|
185
|
+
*/
|
|
186
|
+
declare const TEKMEMO_PATHS: {
|
|
187
|
+
readonly manifest: ".tekmemo/manifest.json";
|
|
188
|
+
readonly coreMemory: ".tekmemo/memory/core.md";
|
|
189
|
+
readonly notesMemory: ".tekmemo/memory/notes.md";
|
|
190
|
+
readonly memoryEvents: ".tekmemo/events/memory-events.jsonl";
|
|
191
|
+
readonly conversations: ".tekmemo/events/conversations.jsonl";
|
|
192
|
+
readonly chunks: ".tekmemo/indexes/chunks.jsonl";
|
|
193
|
+
readonly graphNodes: ".tekmemo/graph/nodes.jsonl";
|
|
194
|
+
readonly graphEdges: ".tekmemo/graph/edges.jsonl";
|
|
195
|
+
readonly snapshots: ".tekmemo/snapshots/snapshots.jsonl";
|
|
196
|
+
readonly snapshotsDir: ".tekmemo/snapshots";
|
|
197
|
+
readonly tmpDir: ".tekmemo/tmp";
|
|
198
|
+
};
|
|
199
|
+
declare const REQUIRED_FILES: readonly [".tekmemo/manifest.json", ".tekmemo/memory/core.md", ".tekmemo/memory/notes.md", ".tekmemo/events/memory-events.jsonl", ".tekmemo/events/conversations.jsonl", ".tekmemo/indexes/chunks.jsonl", ".tekmemo/graph/nodes.jsonl", ".tekmemo/graph/edges.jsonl", ".tekmemo/snapshots/snapshots.jsonl"];
|
|
200
|
+
declare const REQUIRED_DIRS: readonly [".tekmemo", ".tekmemo/memory", ".tekmemo/events", ".tekmemo/indexes", ".tekmemo/graph", ".tekmemo/snapshots", ".tekmemo/tmp"];
|
|
201
|
+
//#endregion
|
|
202
|
+
//#region src/protocol/jsonl.d.ts
|
|
203
|
+
interface JsonlParseOptions {
|
|
204
|
+
strict?: boolean | undefined;
|
|
205
|
+
}
|
|
206
|
+
interface JsonlRecord {
|
|
207
|
+
line: number;
|
|
208
|
+
value: Record<string, unknown>;
|
|
209
|
+
}
|
|
210
|
+
declare function parseJsonl(content: string, options?: JsonlParseOptions): JsonlRecord[];
|
|
211
|
+
declare function stringifyJsonl(records: readonly Record<string, unknown>[]): string;
|
|
212
|
+
//#endregion
|
|
213
|
+
//#region src/protocol/manifest.d.ts
|
|
214
|
+
type TekMemoCliManifest = TekMemoManifest;
|
|
215
|
+
declare function createDefaultManifest(input?: {
|
|
216
|
+
projectId?: string;
|
|
217
|
+
now?: string;
|
|
218
|
+
}): TekMemoCliManifest;
|
|
219
|
+
declare function parseManifest(content: string): TekMemoCliManifest;
|
|
220
|
+
declare function validateManifest(value: unknown): TekMemoCliManifest;
|
|
221
|
+
//#endregion
|
|
222
|
+
//#region src/protocol/summary.d.ts
|
|
223
|
+
interface TekMemoInspection {
|
|
224
|
+
rootDir: string;
|
|
225
|
+
exists: boolean;
|
|
226
|
+
manifest?: TekMemoCliManifest;
|
|
227
|
+
files: Array<{
|
|
228
|
+
path: string;
|
|
229
|
+
exists: boolean;
|
|
230
|
+
bytes: number;
|
|
231
|
+
lines?: number;
|
|
232
|
+
records?: number;
|
|
233
|
+
}>;
|
|
234
|
+
summary: {
|
|
235
|
+
eventCount: number;
|
|
236
|
+
conversationCount: number;
|
|
237
|
+
chunkCount: number;
|
|
238
|
+
graphNodeCount: number;
|
|
239
|
+
graphEdgeCount: number;
|
|
240
|
+
snapshotCount: number;
|
|
241
|
+
};
|
|
242
|
+
}
|
|
243
|
+
declare function inspectTekMemo(fs: TekMemoFileSystem): Promise<TekMemoInspection>;
|
|
244
|
+
//#endregion
|
|
245
|
+
//#region src/runner.d.ts
|
|
246
|
+
interface RunTekMemoCliInput {
|
|
247
|
+
argv: string[];
|
|
248
|
+
cwd?: string;
|
|
249
|
+
output?: CliOutput;
|
|
250
|
+
verbose?: boolean;
|
|
251
|
+
quiet?: boolean;
|
|
252
|
+
noColor?: boolean;
|
|
253
|
+
stdinContent?: string;
|
|
254
|
+
}
|
|
255
|
+
interface RunTekMemoCliResult {
|
|
256
|
+
exitCode: number;
|
|
257
|
+
stdout: string[];
|
|
258
|
+
stderr: string[];
|
|
259
|
+
}
|
|
260
|
+
declare function runTekMemoCli(input: RunTekMemoCliInput): Promise<RunTekMemoCliResult>;
|
|
261
|
+
//#endregion
|
|
262
|
+
//#region src/utils/labels.d.ts
|
|
263
|
+
declare function validateSnapshotLabel(label: string): string;
|
|
264
|
+
declare function createSafeIdFromLabel(label: string, timestamp?: string): string;
|
|
265
|
+
//#endregion
|
|
266
|
+
//#region src/utils/secrets.d.ts
|
|
267
|
+
interface SecretScanFinding {
|
|
268
|
+
kind: string;
|
|
269
|
+
index: number;
|
|
270
|
+
preview: string;
|
|
271
|
+
}
|
|
272
|
+
declare function scanForSecrets(content: string): SecretScanFinding[];
|
|
273
|
+
declare function redactSecretPreview(value: string): string;
|
|
274
|
+
//#endregion
|
|
275
|
+
export { type BufferedOutputOptions, CliError, type CliErrorCode, CliFsError, CliJsonlError, type CliOutput, CliProtocolError, type CliRuntimeFlags, CliUsageError, CliValidationError, type CloudConnectionOptions, type JsonEnvelope, type JsonlParseOptions, type JsonlRecord, type NormalizedCloudConnectionOptions, REQUIRED_DIRS, REQUIRED_FILES, type ResolvedCliRuntimeConfig, type RunTekMemoCliInput, type RunTekMemoCliResult, TEKMEMO_DIR, TEKMEMO_PATHS, type TekMemoCliManifest, type TekMemoConfigFile, TekMemoFileSystem, type TekMemoFileSystemOptions, type TekMemoInspection, type TekMemoReadPolicy, type TekMemoRuntimeMode, type TekMemoWritePolicy, cloudConnectionSummary, createBufferedOutput, createCliCloudClient, createDefaultManifest, createSafeIdFromLabel, formatCloudError, inspectTekMemo, normalizeCloudConnectionOptions, parseJsonl, parseManifest, printHumanOrJson, printJsonEnvelope, printJsonError, redactSecretPreview, resolveCliRuntimeConfig, runTekMemoCli, scanForSecrets, stringifyJsonl, toCloudClientOptions, validateManifest, validateSnapshotLabel, writeDefaultCliConfig };
|
|
276
|
+
//# sourceMappingURL=index.d.cts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.cts","names":[],"sources":["../src/cloud/client.ts","../src/config/runtime.ts","../src/errors/cli-errors.ts","../src/fs/tekmemo-fs.ts","../src/output/output.ts","../src/protocol/constants.ts","../src/protocol/jsonl.ts","../src/protocol/manifest.ts","../src/protocol/summary.ts","../src/runner.ts","../src/utils/labels.ts","../src/utils/secrets.ts"],"mappings":";;;;UASiB,sBAAA;EAChB,QAAA;EACA,MAAA;EACA,WAAA;EACA,SAAA;EACA,SAAA;EACA,kBAAA;EACA,qBAAA;AAAA;AAAA,UAGgB,gCAAA;EAChB,OAAA;EACA,MAAA;EACA,WAAA;EACA,SAAA;EACA,SAAA;AAAA;AAAA,iBAGe,oBAAA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