@lumpcode/core 0.0.11 → 0.0.12
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/helpers/executeStepsForContextList/main.d.ts +1 -1
- package/dist/helpers/getCodeBasePaths/main.d.ts +2 -2
- package/dist/helpers/getCodeBasePaths/main.d.ts.map +1 -1
- package/dist/helpers/getToDoContextList/main.d.ts +2 -2
- package/dist/helpers/getToDoContextList/main.d.ts.map +1 -1
- package/dist/index.cjs +36 -7
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +36 -7
- package/dist/index.js.map +1 -1
- package/dist/utils/historyFile/main.d.ts.map +1 -1
- package/package.json +2 -1
|
@@ -6,7 +6,7 @@ export type ExecuteStepsForContextListParams = Required<Pick<RunLumpInput, 'base
|
|
|
6
6
|
};
|
|
7
7
|
export declare function executeStepsForContextList({ baseBranch, branchFn, lumpVariables, contextList, gitAddCommandFn, gitCommitCommandFn, gitPushCommandFn, gitCommitMessageFn, projectRoot, steps, setupFn, setupWorkspaceFn, teardownFn, teardownWorkspaceFn, getKeepHistoryFilePathFn, logger: loggerInput, }: ExecuteStepsForContextListParams): Promise<Failure<{
|
|
8
8
|
message: string;
|
|
9
|
-
}> | import("
|
|
9
|
+
}> | import("../..").Success<{
|
|
10
10
|
branchName: string;
|
|
11
11
|
contextNames: string[];
|
|
12
12
|
contextRunStateList: ContextRunState[];
|
|
@@ -2,7 +2,7 @@ import { CodeBasePath, Logger } from '../../types';
|
|
|
2
2
|
export declare function getCodeBasePaths({ cwd, logger: loggerInput, }: {
|
|
3
3
|
cwd: string;
|
|
4
4
|
logger?: Logger;
|
|
5
|
-
}): Promise<import("
|
|
5
|
+
}): Promise<import("../..").Failure<{
|
|
6
6
|
message: string;
|
|
7
|
-
}> | import("
|
|
7
|
+
}> | import("../..").Success<CodeBasePath[]>>;
|
|
8
8
|
//# sourceMappingURL=main.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/helpers/getCodeBasePaths/main.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEnD,wBAAsB,gBAAgB,CAAC,EACnC,GAAG,EACH,MAAM,EAAE,WAAW,GACtB,EAAE;IACC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/helpers/getCodeBasePaths/main.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,aAAa,CAAC;AAEnD,wBAAsB,gBAAgB,CAAC,EACnC,GAAG,EACH,MAAM,EAAE,WAAW,GACtB,EAAE;IACC,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;;8CAoBA"}
|
|
@@ -7,7 +7,7 @@ export declare function getToDoContextList(params: {
|
|
|
7
7
|
projectRoot: string;
|
|
8
8
|
baseBranch: string;
|
|
9
9
|
logger?: Logger;
|
|
10
|
-
}): Promise<import("
|
|
10
|
+
}): Promise<import("../..").Failure<{
|
|
11
11
|
message: string;
|
|
12
|
-
}> | import("
|
|
12
|
+
}> | import("../..").Success<import("../..").Context<Record<string, string | number | boolean>>[]>>;
|
|
13
13
|
//# sourceMappingURL=main.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/helpers/getToDoContextList/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,wBAAsB,kBAAkB,CAAC,MAAM,EAAE;IAC7C,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;;
|
|
1
|
+
{"version":3,"file":"main.d.ts","sourceRoot":"","sources":["../../../src/helpers/getToDoContextList/main.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAGtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AAGpE,wBAAsB,kBAAkB,CAAC,MAAM,EAAE;IAC7C,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,aAAa,EAAE,aAAa,CAAC;IAC7B,kBAAkB,EAAE,kBAAkB,CAAC;IACvC,WAAW,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB;;oGA8DA"}
|
package/dist/index.cjs
CHANGED
|
@@ -3165,6 +3165,38 @@ async function pathExists(filePath) {
|
|
|
3165
3165
|
}
|
|
3166
3166
|
}
|
|
3167
3167
|
|
|
3168
|
+
/** Strip terminal ANSI escapes and other C0 controls js-yaml rejects in literal blocks. */
|
|
3169
|
+
function sanitizeHistoryText(value) {
|
|
3170
|
+
return value
|
|
3171
|
+
.replace(/\x1b\[[0-9;]*[A-Za-z]/g, '')
|
|
3172
|
+
.replace(/[\x00-\x08\x0b\x0c\x0e-\x1f\x7f]/g, '');
|
|
3173
|
+
}
|
|
3174
|
+
function parseHistoryYamlContent(content) {
|
|
3175
|
+
const parsed = load(content, { schema: YAML11_SCHEMA });
|
|
3176
|
+
if (!Array.isArray(parsed)) {
|
|
3177
|
+
throw new Error('History file must contain a YAML sequence');
|
|
3178
|
+
}
|
|
3179
|
+
return parsed;
|
|
3180
|
+
}
|
|
3181
|
+
function tryParseHistoryContent(content) {
|
|
3182
|
+
try {
|
|
3183
|
+
return parseHistoryYamlContent(content);
|
|
3184
|
+
}
|
|
3185
|
+
catch (firstError) {
|
|
3186
|
+
const sanitized = sanitizeHistoryText(content);
|
|
3187
|
+
if (sanitized === content) {
|
|
3188
|
+
throw firstError;
|
|
3189
|
+
}
|
|
3190
|
+
return parseHistoryYamlContent(sanitized);
|
|
3191
|
+
}
|
|
3192
|
+
}
|
|
3193
|
+
function sanitizeHistoryEntry(entry) {
|
|
3194
|
+
return {
|
|
3195
|
+
...entry,
|
|
3196
|
+
prompt: sanitizeHistoryText(entry.prompt),
|
|
3197
|
+
commandResult: sanitizeHistoryText(entry.commandResult),
|
|
3198
|
+
};
|
|
3199
|
+
}
|
|
3168
3200
|
function historyFormatFromPath(filePath) {
|
|
3169
3201
|
const ext = path.extname(filePath).toLowerCase();
|
|
3170
3202
|
if (ext === '.yaml' || ext === '.yml') {
|
|
@@ -3202,7 +3234,8 @@ function dumpHistoryEntries(entries) {
|
|
|
3202
3234
|
if (entries.length === 0) {
|
|
3203
3235
|
return '[]\n';
|
|
3204
3236
|
}
|
|
3205
|
-
|
|
3237
|
+
const sanitizedEntries = entries.map(sanitizeHistoryEntry);
|
|
3238
|
+
return dump(sanitizedEntries, {
|
|
3206
3239
|
schema: YAML11_SCHEMA,
|
|
3207
3240
|
lineWidth: 0,
|
|
3208
3241
|
noRefs: true,
|
|
@@ -3220,11 +3253,7 @@ async function readHistoryFile({ filePath, }) {
|
|
|
3220
3253
|
}
|
|
3221
3254
|
try {
|
|
3222
3255
|
const content = await fs$1.readFile(filePath, 'utf-8');
|
|
3223
|
-
|
|
3224
|
-
if (!Array.isArray(parsed)) {
|
|
3225
|
-
return failure(`History file ${filePath} must contain a YAML sequence`);
|
|
3226
|
-
}
|
|
3227
|
-
return success(parsed);
|
|
3256
|
+
return success(tryParseHistoryContent(content));
|
|
3228
3257
|
}
|
|
3229
3258
|
catch (error) {
|
|
3230
3259
|
const detail = error instanceof Error ? error.message : String(error);
|
|
@@ -3264,7 +3293,7 @@ async function appendHistoryEntry({ filePath, entry, }) {
|
|
|
3264
3293
|
await fs$1.mkdir(path.dirname(filePath), { recursive: true });
|
|
3265
3294
|
entries = [];
|
|
3266
3295
|
}
|
|
3267
|
-
entries.push(entry);
|
|
3296
|
+
entries.push(sanitizeHistoryEntry(entry));
|
|
3268
3297
|
return writeHistoryFile({ filePath, entries });
|
|
3269
3298
|
}
|
|
3270
3299
|
|