@ekkos/cli 0.2.9 → 0.2.10
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/cache/LocalSessionStore.d.ts +34 -21
- package/dist/cache/LocalSessionStore.js +169 -53
- package/dist/cache/capture.d.ts +19 -11
- package/dist/cache/capture.js +243 -76
- package/dist/cache/types.d.ts +14 -1
- package/dist/commands/doctor.d.ts +10 -0
- package/dist/commands/doctor.js +148 -73
- package/dist/commands/hooks.d.ts +109 -0
- package/dist/commands/hooks.js +668 -0
- package/dist/commands/run.d.ts +1 -0
- package/dist/commands/run.js +69 -21
- package/dist/index.js +42 -1
- package/dist/restore/RestoreOrchestrator.d.ts +17 -3
- package/dist/restore/RestoreOrchestrator.js +64 -22
- package/dist/utils/paths.d.ts +125 -0
- package/dist/utils/paths.js +283 -0
- package/package.json +1 -1
- package/templates/ekkos-manifest.json +223 -0
- package/templates/helpers/json-parse.cjs +101 -0
- package/templates/hooks/assistant-response.ps1 +256 -0
- package/templates/hooks/assistant-response.sh +124 -64
- package/templates/hooks/session-start.ps1 +107 -2
- package/templates/hooks/session-start.sh +201 -166
- package/templates/hooks/stop.ps1 +124 -3
- package/templates/hooks/stop.sh +470 -843
- package/templates/hooks/user-prompt-submit.ps1 +107 -22
- package/templates/hooks/user-prompt-submit.sh +403 -393
- package/templates/project-stubs/session-start.ps1 +63 -0
- package/templates/project-stubs/session-start.sh +55 -0
- package/templates/project-stubs/stop.ps1 +63 -0
- package/templates/project-stubs/stop.sh +55 -0
- package/templates/project-stubs/user-prompt-submit.ps1 +63 -0
- package/templates/project-stubs/user-prompt-submit.sh +55 -0
- package/templates/shared/hooks-enabled.json +22 -0
- package/templates/shared/session-words.json +45 -0
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ekkOS Path Utilities - Instance-Aware Path Resolution
|
|
3
|
+
*
|
|
4
|
+
* Per ekkOS Onboarding Spec v1.2 FINAL + ADDENDUM:
|
|
5
|
+
* - All Tier 0 cache paths MUST be: ~/.ekkos/cache/sessions/{instanceId}/{sessionId}.jsonl
|
|
6
|
+
* - All persisted records MUST include: instanceId, sessionId, sessionName
|
|
7
|
+
*
|
|
8
|
+
* This module provides canonical path helpers for the entire CLI.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_INSTANCE_ID = "default";
|
|
11
|
+
/**
|
|
12
|
+
* Normalize instanceId - use 'default' if empty/undefined
|
|
13
|
+
*/
|
|
14
|
+
export declare function normalizeInstanceId(instanceId?: string | null): string;
|
|
15
|
+
/**
|
|
16
|
+
* Get the base ekkOS config directory
|
|
17
|
+
* ~/.ekkos on Unix, %USERPROFILE%\.ekkos on Windows
|
|
18
|
+
*/
|
|
19
|
+
export declare function getConfigDir(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Get the cache directory
|
|
22
|
+
* ~/.ekkos/cache
|
|
23
|
+
*/
|
|
24
|
+
export declare function getCacheDir(): string;
|
|
25
|
+
/**
|
|
26
|
+
* Get the sessions cache directory
|
|
27
|
+
* ~/.ekkos/cache/sessions
|
|
28
|
+
*/
|
|
29
|
+
export declare function getSessionsDir(): string;
|
|
30
|
+
/**
|
|
31
|
+
* Get the instance-scoped sessions directory
|
|
32
|
+
* ~/.ekkos/cache/sessions/{instanceId}
|
|
33
|
+
*/
|
|
34
|
+
export declare function getInstanceSessionsDir(instanceId?: string | null): string;
|
|
35
|
+
/**
|
|
36
|
+
* Get the path to a session's turns JSONL file (instance-scoped)
|
|
37
|
+
* ~/.ekkos/cache/sessions/{instanceId}/{sessionId}.jsonl
|
|
38
|
+
*/
|
|
39
|
+
export declare function getTurnsPath(instanceId: string | null | undefined, sessionId: string): string;
|
|
40
|
+
/**
|
|
41
|
+
* Get the path to a session's metadata file (instance-scoped)
|
|
42
|
+
* ~/.ekkos/cache/sessions/{instanceId}/{sessionId}.meta.json
|
|
43
|
+
*/
|
|
44
|
+
export declare function getMetaPath(instanceId: string | null | undefined, sessionId: string): string;
|
|
45
|
+
/**
|
|
46
|
+
* Get the path to a session's stream log file (instance-scoped)
|
|
47
|
+
* ~/.ekkos/cache/sessions/{instanceId}/{sessionId}.stream.jsonl
|
|
48
|
+
*/
|
|
49
|
+
export declare function getStreamLogPath(instanceId: string | null | undefined, sessionId: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Get the path to a session's state file (instance-scoped)
|
|
52
|
+
* ~/.ekkos/cache/sessions/{instanceId}/{sessionId}.state.json
|
|
53
|
+
*/
|
|
54
|
+
export declare function getStreamStatePath(instanceId: string | null | undefined, sessionId: string): string;
|
|
55
|
+
/**
|
|
56
|
+
* Get the path to the session index file (instance-scoped)
|
|
57
|
+
* ~/.ekkos/cache/sessions/{instanceId}/index.json
|
|
58
|
+
*/
|
|
59
|
+
export declare function getIndexPath(instanceId?: string | null): string;
|
|
60
|
+
/**
|
|
61
|
+
* Get the instances directory
|
|
62
|
+
* ~/.ekkos/instances
|
|
63
|
+
*/
|
|
64
|
+
export declare function getInstancesDir(): string;
|
|
65
|
+
/**
|
|
66
|
+
* Get the path to an instance file
|
|
67
|
+
* ~/.ekkos/instances/{instanceId}.json
|
|
68
|
+
*/
|
|
69
|
+
export declare function getInstanceFilePath(instanceId: string): string;
|
|
70
|
+
/**
|
|
71
|
+
* Legacy path for backward compatibility (read-only fallback)
|
|
72
|
+
* ~/.ekkos/cache/sessions/{sessionId}.jsonl
|
|
73
|
+
*/
|
|
74
|
+
export declare function getLegacyTurnsPath(sessionId: string): string;
|
|
75
|
+
/**
|
|
76
|
+
* Legacy metadata path for backward compatibility (read-only fallback)
|
|
77
|
+
* ~/.ekkos/cache/sessions/{sessionId}.meta.json
|
|
78
|
+
*/
|
|
79
|
+
export declare function getLegacyMetaPath(sessionId: string): string;
|
|
80
|
+
/**
|
|
81
|
+
* Legacy stream log path for backward compatibility (read-only fallback)
|
|
82
|
+
* ~/.ekkos/cache/sessions/{sessionId}.stream.jsonl
|
|
83
|
+
*/
|
|
84
|
+
export declare function getLegacyStreamLogPath(sessionId: string): string;
|
|
85
|
+
/**
|
|
86
|
+
* Ensure a directory exists (mkdirp)
|
|
87
|
+
*/
|
|
88
|
+
export declare function ensureDir(dirPath: string): void;
|
|
89
|
+
/**
|
|
90
|
+
* Ensure the instance sessions directory exists
|
|
91
|
+
*/
|
|
92
|
+
export declare function ensureInstanceDir(instanceId?: string | null): string;
|
|
93
|
+
/**
|
|
94
|
+
* Ensure the base ekkOS directories exist
|
|
95
|
+
*/
|
|
96
|
+
export declare function ensureBaseDirs(): void;
|
|
97
|
+
/**
|
|
98
|
+
* List all instance directories under sessions cache
|
|
99
|
+
* Returns array of instanceIds
|
|
100
|
+
*/
|
|
101
|
+
export declare function listInstanceIds(): string[];
|
|
102
|
+
/**
|
|
103
|
+
* Check if a file exists at the instance-scoped path
|
|
104
|
+
* If not, check legacy path and return which one exists (if any)
|
|
105
|
+
*/
|
|
106
|
+
export declare function findTurnsFile(instanceId: string | null | undefined, sessionId: string): {
|
|
107
|
+
path: string;
|
|
108
|
+
isLegacy: boolean;
|
|
109
|
+
} | null;
|
|
110
|
+
/**
|
|
111
|
+
* Check if a meta file exists at the instance-scoped path
|
|
112
|
+
* If not, check legacy path and return which one exists (if any)
|
|
113
|
+
*/
|
|
114
|
+
export declare function findMetaFile(instanceId: string | null | undefined, sessionId: string): {
|
|
115
|
+
path: string;
|
|
116
|
+
isLegacy: boolean;
|
|
117
|
+
} | null;
|
|
118
|
+
/**
|
|
119
|
+
* Check if a stream log exists at the instance-scoped path
|
|
120
|
+
* If not, check legacy path and return which one exists (if any)
|
|
121
|
+
*/
|
|
122
|
+
export declare function findStreamLogFile(instanceId: string | null | undefined, sessionId: string): {
|
|
123
|
+
path: string;
|
|
124
|
+
isLegacy: boolean;
|
|
125
|
+
} | null;
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* ekkOS Path Utilities - Instance-Aware Path Resolution
|
|
4
|
+
*
|
|
5
|
+
* Per ekkOS Onboarding Spec v1.2 FINAL + ADDENDUM:
|
|
6
|
+
* - All Tier 0 cache paths MUST be: ~/.ekkos/cache/sessions/{instanceId}/{sessionId}.jsonl
|
|
7
|
+
* - All persisted records MUST include: instanceId, sessionId, sessionName
|
|
8
|
+
*
|
|
9
|
+
* This module provides canonical path helpers for the entire CLI.
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.DEFAULT_INSTANCE_ID = void 0;
|
|
46
|
+
exports.normalizeInstanceId = normalizeInstanceId;
|
|
47
|
+
exports.getConfigDir = getConfigDir;
|
|
48
|
+
exports.getCacheDir = getCacheDir;
|
|
49
|
+
exports.getSessionsDir = getSessionsDir;
|
|
50
|
+
exports.getInstanceSessionsDir = getInstanceSessionsDir;
|
|
51
|
+
exports.getTurnsPath = getTurnsPath;
|
|
52
|
+
exports.getMetaPath = getMetaPath;
|
|
53
|
+
exports.getStreamLogPath = getStreamLogPath;
|
|
54
|
+
exports.getStreamStatePath = getStreamStatePath;
|
|
55
|
+
exports.getIndexPath = getIndexPath;
|
|
56
|
+
exports.getInstancesDir = getInstancesDir;
|
|
57
|
+
exports.getInstanceFilePath = getInstanceFilePath;
|
|
58
|
+
exports.getLegacyTurnsPath = getLegacyTurnsPath;
|
|
59
|
+
exports.getLegacyMetaPath = getLegacyMetaPath;
|
|
60
|
+
exports.getLegacyStreamLogPath = getLegacyStreamLogPath;
|
|
61
|
+
exports.ensureDir = ensureDir;
|
|
62
|
+
exports.ensureInstanceDir = ensureInstanceDir;
|
|
63
|
+
exports.ensureBaseDirs = ensureBaseDirs;
|
|
64
|
+
exports.listInstanceIds = listInstanceIds;
|
|
65
|
+
exports.findTurnsFile = findTurnsFile;
|
|
66
|
+
exports.findMetaFile = findMetaFile;
|
|
67
|
+
exports.findStreamLogFile = findStreamLogFile;
|
|
68
|
+
const path = __importStar(require("path"));
|
|
69
|
+
const os = __importStar(require("os"));
|
|
70
|
+
const fs = __importStar(require("fs"));
|
|
71
|
+
// Base directories
|
|
72
|
+
const HOME = os.homedir();
|
|
73
|
+
const EKKOS_DIR = path.join(HOME, '.ekkos');
|
|
74
|
+
const CACHE_DIR = path.join(EKKOS_DIR, 'cache');
|
|
75
|
+
const SESSIONS_DIR = path.join(CACHE_DIR, 'sessions');
|
|
76
|
+
const INSTANCES_DIR = path.join(EKKOS_DIR, 'instances');
|
|
77
|
+
// Default instanceId when none provided (backward compatibility)
|
|
78
|
+
exports.DEFAULT_INSTANCE_ID = 'default';
|
|
79
|
+
/**
|
|
80
|
+
* Normalize instanceId - use 'default' if empty/undefined
|
|
81
|
+
*/
|
|
82
|
+
function normalizeInstanceId(instanceId) {
|
|
83
|
+
if (!instanceId || instanceId.trim() === '') {
|
|
84
|
+
return exports.DEFAULT_INSTANCE_ID;
|
|
85
|
+
}
|
|
86
|
+
return instanceId.trim();
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get the base ekkOS config directory
|
|
90
|
+
* ~/.ekkos on Unix, %USERPROFILE%\.ekkos on Windows
|
|
91
|
+
*/
|
|
92
|
+
function getConfigDir() {
|
|
93
|
+
return EKKOS_DIR;
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Get the cache directory
|
|
97
|
+
* ~/.ekkos/cache
|
|
98
|
+
*/
|
|
99
|
+
function getCacheDir() {
|
|
100
|
+
return CACHE_DIR;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Get the sessions cache directory
|
|
104
|
+
* ~/.ekkos/cache/sessions
|
|
105
|
+
*/
|
|
106
|
+
function getSessionsDir() {
|
|
107
|
+
return SESSIONS_DIR;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Get the instance-scoped sessions directory
|
|
111
|
+
* ~/.ekkos/cache/sessions/{instanceId}
|
|
112
|
+
*/
|
|
113
|
+
function getInstanceSessionsDir(instanceId) {
|
|
114
|
+
const normalizedId = normalizeInstanceId(instanceId);
|
|
115
|
+
return path.join(SESSIONS_DIR, normalizedId);
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Get the path to a session's turns JSONL file (instance-scoped)
|
|
119
|
+
* ~/.ekkos/cache/sessions/{instanceId}/{sessionId}.jsonl
|
|
120
|
+
*/
|
|
121
|
+
function getTurnsPath(instanceId, sessionId) {
|
|
122
|
+
const instanceDir = getInstanceSessionsDir(instanceId);
|
|
123
|
+
return path.join(instanceDir, `${sessionId}.jsonl`);
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Get the path to a session's metadata file (instance-scoped)
|
|
127
|
+
* ~/.ekkos/cache/sessions/{instanceId}/{sessionId}.meta.json
|
|
128
|
+
*/
|
|
129
|
+
function getMetaPath(instanceId, sessionId) {
|
|
130
|
+
const instanceDir = getInstanceSessionsDir(instanceId);
|
|
131
|
+
return path.join(instanceDir, `${sessionId}.meta.json`);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Get the path to a session's stream log file (instance-scoped)
|
|
135
|
+
* ~/.ekkos/cache/sessions/{instanceId}/{sessionId}.stream.jsonl
|
|
136
|
+
*/
|
|
137
|
+
function getStreamLogPath(instanceId, sessionId) {
|
|
138
|
+
const instanceDir = getInstanceSessionsDir(instanceId);
|
|
139
|
+
return path.join(instanceDir, `${sessionId}.stream.jsonl`);
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Get the path to a session's state file (instance-scoped)
|
|
143
|
+
* ~/.ekkos/cache/sessions/{instanceId}/{sessionId}.state.json
|
|
144
|
+
*/
|
|
145
|
+
function getStreamStatePath(instanceId, sessionId) {
|
|
146
|
+
const instanceDir = getInstanceSessionsDir(instanceId);
|
|
147
|
+
return path.join(instanceDir, `${sessionId}.state.json`);
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get the path to the session index file (instance-scoped)
|
|
151
|
+
* ~/.ekkos/cache/sessions/{instanceId}/index.json
|
|
152
|
+
*/
|
|
153
|
+
function getIndexPath(instanceId) {
|
|
154
|
+
const instanceDir = getInstanceSessionsDir(instanceId);
|
|
155
|
+
return path.join(instanceDir, 'index.json');
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Get the instances directory
|
|
159
|
+
* ~/.ekkos/instances
|
|
160
|
+
*/
|
|
161
|
+
function getInstancesDir() {
|
|
162
|
+
return INSTANCES_DIR;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Get the path to an instance file
|
|
166
|
+
* ~/.ekkos/instances/{instanceId}.json
|
|
167
|
+
*/
|
|
168
|
+
function getInstanceFilePath(instanceId) {
|
|
169
|
+
return path.join(INSTANCES_DIR, `${instanceId}.json`);
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Legacy path for backward compatibility (read-only fallback)
|
|
173
|
+
* ~/.ekkos/cache/sessions/{sessionId}.jsonl
|
|
174
|
+
*/
|
|
175
|
+
function getLegacyTurnsPath(sessionId) {
|
|
176
|
+
return path.join(SESSIONS_DIR, `${sessionId}.jsonl`);
|
|
177
|
+
}
|
|
178
|
+
/**
|
|
179
|
+
* Legacy metadata path for backward compatibility (read-only fallback)
|
|
180
|
+
* ~/.ekkos/cache/sessions/{sessionId}.meta.json
|
|
181
|
+
*/
|
|
182
|
+
function getLegacyMetaPath(sessionId) {
|
|
183
|
+
return path.join(SESSIONS_DIR, `${sessionId}.meta.json`);
|
|
184
|
+
}
|
|
185
|
+
/**
|
|
186
|
+
* Legacy stream log path for backward compatibility (read-only fallback)
|
|
187
|
+
* ~/.ekkos/cache/sessions/{sessionId}.stream.jsonl
|
|
188
|
+
*/
|
|
189
|
+
function getLegacyStreamLogPath(sessionId) {
|
|
190
|
+
return path.join(SESSIONS_DIR, `${sessionId}.stream.jsonl`);
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Ensure a directory exists (mkdirp)
|
|
194
|
+
*/
|
|
195
|
+
function ensureDir(dirPath) {
|
|
196
|
+
if (!fs.existsSync(dirPath)) {
|
|
197
|
+
fs.mkdirSync(dirPath, { recursive: true });
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
/**
|
|
201
|
+
* Ensure the instance sessions directory exists
|
|
202
|
+
*/
|
|
203
|
+
function ensureInstanceDir(instanceId) {
|
|
204
|
+
const instanceDir = getInstanceSessionsDir(instanceId);
|
|
205
|
+
ensureDir(instanceDir);
|
|
206
|
+
return instanceDir;
|
|
207
|
+
}
|
|
208
|
+
/**
|
|
209
|
+
* Ensure the base ekkOS directories exist
|
|
210
|
+
*/
|
|
211
|
+
function ensureBaseDirs() {
|
|
212
|
+
ensureDir(EKKOS_DIR);
|
|
213
|
+
ensureDir(CACHE_DIR);
|
|
214
|
+
ensureDir(SESSIONS_DIR);
|
|
215
|
+
ensureDir(INSTANCES_DIR);
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* List all instance directories under sessions cache
|
|
219
|
+
* Returns array of instanceIds
|
|
220
|
+
*/
|
|
221
|
+
function listInstanceIds() {
|
|
222
|
+
ensureDir(SESSIONS_DIR);
|
|
223
|
+
try {
|
|
224
|
+
const entries = fs.readdirSync(SESSIONS_DIR, { withFileTypes: true });
|
|
225
|
+
return entries
|
|
226
|
+
.filter(e => e.isDirectory())
|
|
227
|
+
.map(e => e.name);
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
return [];
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Check if a file exists at the instance-scoped path
|
|
235
|
+
* If not, check legacy path and return which one exists (if any)
|
|
236
|
+
*/
|
|
237
|
+
function findTurnsFile(instanceId, sessionId) {
|
|
238
|
+
// Try instance-scoped path first
|
|
239
|
+
const instancePath = getTurnsPath(instanceId, sessionId);
|
|
240
|
+
if (fs.existsSync(instancePath)) {
|
|
241
|
+
return { path: instancePath, isLegacy: false };
|
|
242
|
+
}
|
|
243
|
+
// Try legacy path as fallback (read-only)
|
|
244
|
+
const legacyPath = getLegacyTurnsPath(sessionId);
|
|
245
|
+
if (fs.existsSync(legacyPath)) {
|
|
246
|
+
return { path: legacyPath, isLegacy: true };
|
|
247
|
+
}
|
|
248
|
+
return null;
|
|
249
|
+
}
|
|
250
|
+
/**
|
|
251
|
+
* Check if a meta file exists at the instance-scoped path
|
|
252
|
+
* If not, check legacy path and return which one exists (if any)
|
|
253
|
+
*/
|
|
254
|
+
function findMetaFile(instanceId, sessionId) {
|
|
255
|
+
// Try instance-scoped path first
|
|
256
|
+
const instancePath = getMetaPath(instanceId, sessionId);
|
|
257
|
+
if (fs.existsSync(instancePath)) {
|
|
258
|
+
return { path: instancePath, isLegacy: false };
|
|
259
|
+
}
|
|
260
|
+
// Try legacy path as fallback (read-only)
|
|
261
|
+
const legacyPath = getLegacyMetaPath(sessionId);
|
|
262
|
+
if (fs.existsSync(legacyPath)) {
|
|
263
|
+
return { path: legacyPath, isLegacy: true };
|
|
264
|
+
}
|
|
265
|
+
return null;
|
|
266
|
+
}
|
|
267
|
+
/**
|
|
268
|
+
* Check if a stream log exists at the instance-scoped path
|
|
269
|
+
* If not, check legacy path and return which one exists (if any)
|
|
270
|
+
*/
|
|
271
|
+
function findStreamLogFile(instanceId, sessionId) {
|
|
272
|
+
// Try instance-scoped path first
|
|
273
|
+
const instancePath = getStreamLogPath(instanceId, sessionId);
|
|
274
|
+
if (fs.existsSync(instancePath)) {
|
|
275
|
+
return { path: instancePath, isLegacy: false };
|
|
276
|
+
}
|
|
277
|
+
// Try legacy path as fallback (read-only)
|
|
278
|
+
const legacyPath = getLegacyStreamLogPath(sessionId);
|
|
279
|
+
if (fs.existsSync(legacyPath)) {
|
|
280
|
+
return { path: legacyPath, isLegacy: true };
|
|
281
|
+
}
|
|
282
|
+
return null;
|
|
283
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://ekkos.dev/schemas/manifest-v1.json",
|
|
3
|
+
"manifestVersion": "1.0.0",
|
|
4
|
+
"generatedAt": "2026-01-19T16:26:13.076Z",
|
|
5
|
+
"platforms": {
|
|
6
|
+
"darwin": {
|
|
7
|
+
"configDir": "~/.ekkos",
|
|
8
|
+
"globalHooksDir": "~/.claude/hooks",
|
|
9
|
+
"shell": "bash"
|
|
10
|
+
},
|
|
11
|
+
"linux": {
|
|
12
|
+
"configDir": "~/.ekkos",
|
|
13
|
+
"globalHooksDir": "~/.claude/hooks",
|
|
14
|
+
"shell": "bash"
|
|
15
|
+
},
|
|
16
|
+
"win32": {
|
|
17
|
+
"configDir": "%USERPROFILE%\\.ekkos",
|
|
18
|
+
"globalHooksDir": "%USERPROFILE%\\.claude\\hooks",
|
|
19
|
+
"shell": "powershell"
|
|
20
|
+
}
|
|
21
|
+
},
|
|
22
|
+
"files": {
|
|
23
|
+
"managed": [
|
|
24
|
+
{
|
|
25
|
+
"source": "shared/session-words.json",
|
|
26
|
+
"destination": ".defaults/session-words.json",
|
|
27
|
+
"description": "Default session word lists (managed fallback)",
|
|
28
|
+
"checksum": "c64af03b9ae58d8c94e71886f80e590ad3a72fb2dcdbe02812789fecb4773e1a",
|
|
29
|
+
"overwrite": "always"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"source": "shared/hooks-enabled.json",
|
|
33
|
+
"destination": ".defaults/hooks-enabled.json",
|
|
34
|
+
"description": "Default hooks enablement config (managed fallback)",
|
|
35
|
+
"checksum": "74b833a1979f1b9467be6dcdeecc024073a4f3c02625b0751f4b1f9d53f143a3",
|
|
36
|
+
"overwrite": "always"
|
|
37
|
+
}
|
|
38
|
+
],
|
|
39
|
+
"helpers": [
|
|
40
|
+
{
|
|
41
|
+
"source": "helpers/json-parse.cjs",
|
|
42
|
+
"destination": ".helpers/json-parse.cjs",
|
|
43
|
+
"description": "Node-based JSON parser (replaces jq dependency)",
|
|
44
|
+
"checksum": "e421977262b3bffcbec9f6f7a172df6f998f3b4deac64d478ef5a0a17034b026",
|
|
45
|
+
"executable": true,
|
|
46
|
+
"overwrite": "always"
|
|
47
|
+
}
|
|
48
|
+
],
|
|
49
|
+
"userEditable": [
|
|
50
|
+
{
|
|
51
|
+
"source": "shared/session-words.json",
|
|
52
|
+
"destination": "session-words.json",
|
|
53
|
+
"description": "User-customizable session word lists",
|
|
54
|
+
"checksum": "c64af03b9ae58d8c94e71886f80e590ad3a72fb2dcdbe02812789fecb4773e1a",
|
|
55
|
+
"overwrite": "createOnly"
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
"source": "shared/hooks-enabled.json",
|
|
59
|
+
"destination": "hooks-enabled.json",
|
|
60
|
+
"description": "User-controlled hook enablement",
|
|
61
|
+
"checksum": "74b833a1979f1b9467be6dcdeecc024073a4f3c02625b0751f4b1f9d53f143a3",
|
|
62
|
+
"overwrite": "createOnly"
|
|
63
|
+
}
|
|
64
|
+
],
|
|
65
|
+
"hooks": {
|
|
66
|
+
"bash": [
|
|
67
|
+
{
|
|
68
|
+
"source": "hooks/user-prompt-submit.sh",
|
|
69
|
+
"destination": "user-prompt-submit.sh",
|
|
70
|
+
"description": "User prompt submit hook (Unix)",
|
|
71
|
+
"checksum": "0e006eb7becba874f34fc622c9ee83b3c96a6e00daf95db840369894af94abf3",
|
|
72
|
+
"executable": true
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
"source": "hooks/stop.sh",
|
|
76
|
+
"destination": "stop.sh",
|
|
77
|
+
"description": "Session stop hook (Unix)",
|
|
78
|
+
"checksum": "fd436ea847bf6fbe367f8aa61ddf6d97e8605837badc3af8d433b59599ef6615",
|
|
79
|
+
"executable": true
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"source": "hooks/session-start.sh",
|
|
83
|
+
"destination": "session-start.sh",
|
|
84
|
+
"description": "Session start hook (Unix)",
|
|
85
|
+
"checksum": "8d17fd3203045589f0c410f465b0d1e98d6ed24dc3bc99f44878e44e9501a22d",
|
|
86
|
+
"executable": true
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
"source": "hooks/assistant-response.sh",
|
|
90
|
+
"destination": "assistant-response.sh",
|
|
91
|
+
"description": "Assistant response hook (Unix)",
|
|
92
|
+
"checksum": "11c3b84aff29552f8a28b59851a4fdc7de4414d28161cca7418dfc93e0c64eac",
|
|
93
|
+
"executable": true
|
|
94
|
+
}
|
|
95
|
+
],
|
|
96
|
+
"powershell": [
|
|
97
|
+
{
|
|
98
|
+
"source": "hooks/user-prompt-submit.ps1",
|
|
99
|
+
"destination": "user-prompt-submit.ps1",
|
|
100
|
+
"description": "User prompt submit hook (Windows)",
|
|
101
|
+
"checksum": "ba044ec066935a9413811e53fd70f42f0ffd959fc361b746c6b54768ac8c6fb9"
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
"source": "hooks/stop.ps1",
|
|
105
|
+
"destination": "stop.ps1",
|
|
106
|
+
"description": "Session stop hook (Windows)",
|
|
107
|
+
"checksum": "455d9dfca8cea2f8289604ca2389b8e43c8af380fbcc5e2eef18382d30e4be6d"
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"source": "hooks/session-start.ps1",
|
|
111
|
+
"destination": "session-start.ps1",
|
|
112
|
+
"description": "Session start hook (Windows)",
|
|
113
|
+
"checksum": "0897603df2b3261857be79108c0831b0fbc3744722b4923ce632844e7c6483c6"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
"source": "hooks/assistant-response.ps1",
|
|
117
|
+
"destination": "assistant-response.ps1",
|
|
118
|
+
"description": "Assistant response hook (Windows)",
|
|
119
|
+
"checksum": "83fb65cec1cb9b1b9ef7a2036c9440e8b6ced16d82a2623b5353899918ae9653"
|
|
120
|
+
}
|
|
121
|
+
],
|
|
122
|
+
"lib": [
|
|
123
|
+
{
|
|
124
|
+
"source": "hooks/lib/contract.sh",
|
|
125
|
+
"destination": "lib/contract.sh",
|
|
126
|
+
"description": "Hook contract library",
|
|
127
|
+
"checksum": "1d86128a2a4a25e653a02c4eb08dbfd28db53063c618cd43b85f0603a135e8b2",
|
|
128
|
+
"executable": true
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
"source": "hooks/lib/state.sh",
|
|
132
|
+
"destination": "lib/state.sh",
|
|
133
|
+
"description": "Hook state management library",
|
|
134
|
+
"checksum": "ba72c00a1fb0f6768e37aff754ad6ac0e8e20aa0b9b393193e2d92357cac5a71",
|
|
135
|
+
"executable": true
|
|
136
|
+
}
|
|
137
|
+
]
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
"projectStubs": {
|
|
141
|
+
"description": "Delegating stub hooks for project-level installation. These source global hooks first, then load project-specific overrides.",
|
|
142
|
+
"bash": [
|
|
143
|
+
{
|
|
144
|
+
"source": "project-stubs/user-prompt-submit.sh",
|
|
145
|
+
"destination": "user-prompt-submit.sh",
|
|
146
|
+
"description": "Project delegating stub for user-prompt-submit (Unix)",
|
|
147
|
+
"checksum": "47cc6b45dbb027e321c136f7c0935bae0d3dc349f01912fbe42ae27d382e297d",
|
|
148
|
+
"executable": true
|
|
149
|
+
},
|
|
150
|
+
{
|
|
151
|
+
"source": "project-stubs/stop.sh",
|
|
152
|
+
"destination": "stop.sh",
|
|
153
|
+
"description": "Project delegating stub for stop (Unix)",
|
|
154
|
+
"checksum": "a429c5ee596e6c975df32feb8ba952c77c0492d91bd9cd80f9eac2e721040eb4",
|
|
155
|
+
"executable": true
|
|
156
|
+
},
|
|
157
|
+
{
|
|
158
|
+
"source": "project-stubs/session-start.sh",
|
|
159
|
+
"destination": "session-start.sh",
|
|
160
|
+
"description": "Project delegating stub for session-start (Unix)",
|
|
161
|
+
"checksum": "189379e81e000153d057e49afd71791d28a6b73baab4b49b39de34918a00c493",
|
|
162
|
+
"executable": true
|
|
163
|
+
}
|
|
164
|
+
],
|
|
165
|
+
"powershell": [
|
|
166
|
+
{
|
|
167
|
+
"source": "project-stubs/user-prompt-submit.ps1",
|
|
168
|
+
"destination": "user-prompt-submit.ps1",
|
|
169
|
+
"description": "Project delegating stub for user-prompt-submit (Windows)",
|
|
170
|
+
"checksum": "86cfea6a6e1181fc6b9180e82a3e34e1ba8e8b412c65bdf013d2367ea8b93283"
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"source": "project-stubs/stop.ps1",
|
|
174
|
+
"destination": "stop.ps1",
|
|
175
|
+
"description": "Project delegating stub for stop (Windows)",
|
|
176
|
+
"checksum": "042f815ed455c5b5e51291b8740deafaea827c594695b270f4d4e4e5086bc234"
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
"source": "project-stubs/session-start.ps1",
|
|
180
|
+
"destination": "session-start.ps1",
|
|
181
|
+
"description": "Project delegating stub for session-start (Windows)",
|
|
182
|
+
"checksum": "14081806c7ca63a67999314f31e14a6c1293e57a8ce64335122f359e3bb8fba4"
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
},
|
|
186
|
+
"cli": {
|
|
187
|
+
"minVersion": "0.2.9",
|
|
188
|
+
"legacySupported": true,
|
|
189
|
+
"requiredCommands": {
|
|
190
|
+
"0.2.9": [
|
|
191
|
+
"run",
|
|
192
|
+
"config"
|
|
193
|
+
],
|
|
194
|
+
"0.3.0": [
|
|
195
|
+
"run",
|
|
196
|
+
"config",
|
|
197
|
+
"hooks"
|
|
198
|
+
]
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
"validation": {
|
|
202
|
+
"requiredFiles": [
|
|
203
|
+
"shared/session-words.json",
|
|
204
|
+
"shared/hooks-enabled.json",
|
|
205
|
+
"helpers/json-parse.cjs",
|
|
206
|
+
"hooks/user-prompt-submit.sh",
|
|
207
|
+
"hooks/user-prompt-submit.ps1",
|
|
208
|
+
"hooks/stop.sh",
|
|
209
|
+
"hooks/stop.ps1",
|
|
210
|
+
"hooks/session-start.sh",
|
|
211
|
+
"hooks/session-start.ps1",
|
|
212
|
+
"hooks/assistant-response.sh",
|
|
213
|
+
"hooks/assistant-response.ps1",
|
|
214
|
+
"project-stubs/user-prompt-submit.sh",
|
|
215
|
+
"project-stubs/user-prompt-submit.ps1",
|
|
216
|
+
"project-stubs/stop.sh",
|
|
217
|
+
"project-stubs/stop.ps1",
|
|
218
|
+
"project-stubs/session-start.sh",
|
|
219
|
+
"project-stubs/session-start.ps1"
|
|
220
|
+
],
|
|
221
|
+
"checksumAlgorithm": "sha256"
|
|
222
|
+
}
|
|
223
|
+
}
|