lalph 0.3.93 → 0.3.94
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/cli.mjs +168 -60
- package/package.json +4 -4
- package/src/Linear.ts +71 -46
package/dist/cli.mjs
CHANGED
|
@@ -397,7 +397,7 @@ function flow(ab, bc, cd, de, ef, fg, gh, hi, ij) {
|
|
|
397
397
|
/**
|
|
398
398
|
* @since 4.0.0
|
|
399
399
|
*/
|
|
400
|
-
function memoize(f) {
|
|
400
|
+
function memoize$1(f) {
|
|
401
401
|
const cache = /* @__PURE__ */ new WeakMap();
|
|
402
402
|
return (a) => {
|
|
403
403
|
if (cache.has(a)) return cache.get(a);
|
|
@@ -18395,7 +18395,7 @@ const resolveDescription$1 = /* @__PURE__ */ resolveAt$1("description");
|
|
|
18395
18395
|
/** @internal */
|
|
18396
18396
|
const resolveBrands = /* @__PURE__ */ resolveAt$1("brands");
|
|
18397
18397
|
/** @internal */
|
|
18398
|
-
const getExpected = /* @__PURE__ */ memoize((ast) => {
|
|
18398
|
+
const getExpected = /* @__PURE__ */ memoize$1((ast) => {
|
|
18399
18399
|
const identifier = resolveIdentifier$1(ast);
|
|
18400
18400
|
if (typeof identifier === "string") return identifier;
|
|
18401
18401
|
return ast.getExpected(getExpected);
|
|
@@ -23314,7 +23314,7 @@ function isMutable(ast) {
|
|
|
23314
23314
|
*
|
|
23315
23315
|
* @since 4.0.0
|
|
23316
23316
|
*/
|
|
23317
|
-
const toType$1 = /* @__PURE__ */ memoize((ast) => {
|
|
23317
|
+
const toType$1 = /* @__PURE__ */ memoize$1((ast) => {
|
|
23318
23318
|
if (ast.encoding) return toType$1(replaceEncoding(ast, void 0));
|
|
23319
23319
|
const out = ast;
|
|
23320
23320
|
return out.recur?.(toType$1) ?? out;
|
|
@@ -23344,7 +23344,7 @@ const toType$1 = /* @__PURE__ */ memoize((ast) => {
|
|
|
23344
23344
|
*
|
|
23345
23345
|
* @since 4.0.0
|
|
23346
23346
|
*/
|
|
23347
|
-
const toEncoded$1 = /* @__PURE__ */ memoize((ast) => {
|
|
23347
|
+
const toEncoded$1 = /* @__PURE__ */ memoize$1((ast) => {
|
|
23348
23348
|
return toType$1(flip(ast));
|
|
23349
23349
|
});
|
|
23350
23350
|
function flipEncoding(ast, encoding) {
|
|
@@ -23373,7 +23373,7 @@ function flipEncoding(ast, encoding) {
|
|
|
23373
23373
|
*
|
|
23374
23374
|
* @since 4.0.0
|
|
23375
23375
|
*/
|
|
23376
|
-
const flip = /* @__PURE__ */ memoize((ast) => {
|
|
23376
|
+
const flip = /* @__PURE__ */ memoize$1((ast) => {
|
|
23377
23377
|
if (ast.encoding) return flipEncoding(ast, ast.encoding);
|
|
23378
23378
|
const out = ast;
|
|
23379
23379
|
return out.flip?.(flip) ?? out.recur?.(flip) ?? out;
|
|
@@ -23390,7 +23390,7 @@ function getTemplateLiteralSource(ast, top) {
|
|
|
23390
23390
|
return ast.encodedParts.map((part) => handleTemplateLiteralASTPartParens(part, getTemplateLiteralASTPartPattern(part), top)).join("");
|
|
23391
23391
|
}
|
|
23392
23392
|
/** @internal */
|
|
23393
|
-
const getTemplateLiteralRegExp = /* @__PURE__ */ memoize((ast) => {
|
|
23393
|
+
const getTemplateLiteralRegExp = /* @__PURE__ */ memoize$1((ast) => {
|
|
23394
23394
|
return new globalThis.RegExp(`^${getTemplateLiteralSource(ast, true)}$`);
|
|
23395
23395
|
});
|
|
23396
23396
|
function getTemplateLiteralASTPartPattern(part) {
|
|
@@ -23427,7 +23427,7 @@ function toCodec(f) {
|
|
|
23427
23427
|
function out(ast) {
|
|
23428
23428
|
return ast.encoding ? replaceEncoding(ast, updateLastLink(ast.encoding, out)) : f(ast);
|
|
23429
23429
|
}
|
|
23430
|
-
return memoize(out);
|
|
23430
|
+
return memoize$1(out);
|
|
23431
23431
|
}
|
|
23432
23432
|
const indexSignatureParameterFromString = /* @__PURE__ */ toCodec((ast) => {
|
|
23433
23433
|
switch (ast._tag) {
|
|
@@ -34112,7 +34112,7 @@ const match$1 = /* @__PURE__ */ dual(2, (self, { onDefined, onUndefined }) => se
|
|
|
34112
34112
|
/**
|
|
34113
34113
|
* @since 4.0.0
|
|
34114
34114
|
*/
|
|
34115
|
-
const recurDefaults = /* @__PURE__ */ memoize((ast) => {
|
|
34115
|
+
const recurDefaults = /* @__PURE__ */ memoize$1((ast) => {
|
|
34116
34116
|
switch (ast._tag) {
|
|
34117
34117
|
case "Declaration": {
|
|
34118
34118
|
const getLink = ast.annotations?.[ClassTypeId];
|
|
@@ -34261,7 +34261,7 @@ function asOption(parser) {
|
|
|
34261
34261
|
function asSync(parser) {
|
|
34262
34262
|
return (input, options) => runSync(mapErrorEager(parser(input, options), (issue) => new Error(issue.toString(), { cause: issue })));
|
|
34263
34263
|
}
|
|
34264
|
-
const recur$1 = /* @__PURE__ */ memoize((ast) => {
|
|
34264
|
+
const recur$1 = /* @__PURE__ */ memoize$1((ast) => {
|
|
34265
34265
|
let parser;
|
|
34266
34266
|
if (!ast.context && !ast.encoding && !ast.checks) return (ou, options) => {
|
|
34267
34267
|
parser ??= ast.getParser(recur$1);
|
|
@@ -61464,7 +61464,7 @@ var RouterImpl = class {
|
|
|
61464
61464
|
if (staticPart) {
|
|
61465
61465
|
staticPart = staticPart.split("::").join(":");
|
|
61466
61466
|
staticPart = staticPart.split("%").join("%25");
|
|
61467
|
-
regexps.push(escapeRegExp(staticPart));
|
|
61467
|
+
regexps.push(escapeRegExp$1(staticPart));
|
|
61468
61468
|
}
|
|
61469
61469
|
lastParamStartIndex = j + 1;
|
|
61470
61470
|
if (isEndOfNode || pattern.charCodeAt(j) === 47 || j === pattern.length) {
|
|
@@ -61778,7 +61778,7 @@ function trimRegExpStartAndEnd(regexString) {
|
|
|
61778
61778
|
if (regexString.charCodeAt(regexString.length - 2) === 36) regexString = regexString.slice(0, regexString.length - 2) + regexString.slice(regexString.length - 1);
|
|
61779
61779
|
return regexString;
|
|
61780
61780
|
}
|
|
61781
|
-
function escapeRegExp(string) {
|
|
61781
|
+
function escapeRegExp$1(string) {
|
|
61782
61782
|
return string.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
61783
61783
|
}
|
|
61784
61784
|
function decodeComponentChar(highCharCode, lowCharCode) {
|
|
@@ -181680,7 +181680,7 @@ var ji = Bt, Ii = Object.assign(Qe, { sync: Bt }), zi = Ut, Bi = Object.assign(e
|
|
|
181680
181680
|
});
|
|
181681
181681
|
Ze.glob = Ze;
|
|
181682
181682
|
//#endregion
|
|
181683
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
181683
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/ApplyPatch.js
|
|
181684
181684
|
/**
|
|
181685
181685
|
* @since 1.0.0
|
|
181686
181686
|
*/
|
|
@@ -196553,7 +196553,7 @@ var StreamableHTTPClientTransport = class {
|
|
|
196553
196553
|
}
|
|
196554
196554
|
};
|
|
196555
196555
|
//#endregion
|
|
196556
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
196556
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/McpClient.js
|
|
196557
196557
|
/**
|
|
196558
196558
|
* @since 1.0.0
|
|
196559
196559
|
*/
|
|
@@ -196598,7 +196598,7 @@ const layer$13 = effect$1(McpClient, gen(function* () {
|
|
|
196598
196598
|
});
|
|
196599
196599
|
}));
|
|
196600
196600
|
//#endregion
|
|
196601
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
196601
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/ExaSearch.js
|
|
196602
196602
|
/**
|
|
196603
196603
|
* @since 1.0.0
|
|
196604
196604
|
*/
|
|
@@ -211548,7 +211548,7 @@ var require_lib = /* @__PURE__ */ __commonJSMin$1(((exports) => {
|
|
|
211548
211548
|
exports.impl = impl;
|
|
211549
211549
|
}));
|
|
211550
211550
|
//#endregion
|
|
211551
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
211551
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/WebToMarkdown.js
|
|
211552
211552
|
/**
|
|
211553
211553
|
* @since 1.0.0
|
|
211554
211554
|
*/
|
|
@@ -215166,7 +215166,7 @@ const mapProviderResults = (inputLength, results) => {
|
|
|
215166
215166
|
return succeed$3(embeddings);
|
|
215167
215167
|
};
|
|
215168
215168
|
//#endregion
|
|
215169
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
215169
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/ChunkRepo.js
|
|
215170
215170
|
/**
|
|
215171
215171
|
* @since 1.0.0
|
|
215172
215172
|
* @category Models
|
|
@@ -215297,7 +215297,7 @@ const layer$10 = effect$1(ChunkRepo, gen(function* () {
|
|
|
215297
215297
|
});
|
|
215298
215298
|
}));
|
|
215299
215299
|
//#endregion
|
|
215300
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
215300
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/CodeChunker.js
|
|
215301
215301
|
/**
|
|
215302
215302
|
* @since 1.0.0
|
|
215303
215303
|
*/
|
|
@@ -215920,7 +215920,7 @@ const run$1 = /* @__PURE__ */ make$25({});
|
|
|
215920
215920
|
*/
|
|
215921
215921
|
const layer$7 = (options) => effectDiscard(run$1(options));
|
|
215922
215922
|
//#endregion
|
|
215923
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
215923
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/internal/sqlite-vector.js
|
|
215924
215924
|
/**
|
|
215925
215925
|
* Binary extension for each platform
|
|
215926
215926
|
*/
|
|
@@ -216037,7 +216037,7 @@ function getExtensionPath() {
|
|
|
216037
216037
|
throw new ExtensionNotFoundError(`SQLite Vector extension not found for platform: ${getCurrentPlatform()}\n\nThe platform-specific package "${getPlatformPackageName()}" is not installed.\nThis usually happens when:\n 1. Your platform is not supported\n 2. npm failed to install optional dependencies\n 3. You're installing with --no-optional flag\n\nTry running: npm install --force`);
|
|
216038
216038
|
}
|
|
216039
216039
|
//#endregion
|
|
216040
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
216040
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/Sqlite.js
|
|
216041
216041
|
/**
|
|
216042
216042
|
* @since 1.0.0
|
|
216043
216043
|
*/
|
|
@@ -216065,7 +216065,7 @@ const SqliteLayer = (database) => layer$7({ loader: fromRecord({ "0001_create_ch
|
|
|
216065
216065
|
yield* fs.makeDirectory(directory, { recursive: true });
|
|
216066
216066
|
}))));
|
|
216067
216067
|
//#endregion
|
|
216068
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
216068
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/SemanticSearch.js
|
|
216069
216069
|
/**
|
|
216070
216070
|
* @since 1.0.0
|
|
216071
216071
|
*/
|
|
@@ -216209,7 +216209,7 @@ const maybeRemoveFile = (path) => serviceOption(SemanticSearch).pipe(flatMap$4(m
|
|
|
216209
216209
|
onSome: (service) => service.removeFile(path)
|
|
216210
216210
|
})));
|
|
216211
216211
|
//#endregion
|
|
216212
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
216212
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/AgentTools.js
|
|
216213
216213
|
/**
|
|
216214
216214
|
* @since 1.0.0
|
|
216215
216215
|
*/
|
|
@@ -216560,7 +216560,7 @@ const AgentToolHandlers = AgentToolHandlersNoDeps.pipe(provide$3([layer$12, laye
|
|
|
216560
216560
|
AgentToolHandlersNoDeps.pipe(provide$3([mock(ExaSearch)({}), mock(WebToMarkdown)({})]));
|
|
216561
216561
|
var ApplyPatchError = class extends TaggedClass$2("ApplyPatchError") {};
|
|
216562
216562
|
//#endregion
|
|
216563
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
216563
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/TypeBuilder.js
|
|
216564
216564
|
const resolveDocumentation = resolveAt("documentation");
|
|
216565
216565
|
const identifierPattern = /^[$A-Z_a-z][$0-9A-Z_a-z]*$/u;
|
|
216566
216566
|
const Precedence = {
|
|
@@ -216833,7 +216833,7 @@ const render = (schema, options) => {
|
|
|
216833
216833
|
return printNode({ text: documentation === void 0 ? rendered.text : `${renderJsDoc(documentation, 0, printerOptions)}${printerOptions.newLine}${rendered.text}` }, printerOptions);
|
|
216834
216834
|
};
|
|
216835
216835
|
//#endregion
|
|
216836
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
216836
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/ToolkitRenderer.js
|
|
216837
216837
|
/**
|
|
216838
216838
|
* @since 1.0.0
|
|
216839
216839
|
*/
|
|
@@ -216842,7 +216842,7 @@ const render = (schema, options) => {
|
|
|
216842
216842
|
* @category Services
|
|
216843
216843
|
*/
|
|
216844
216844
|
var ToolkitRenderer = class ToolkitRenderer extends Service$1()("clanka/ToolkitRenderer") {
|
|
216845
|
-
static layer = succeed$4(ToolkitRenderer, { render: memoize((tools) => {
|
|
216845
|
+
static layer = succeed$4(ToolkitRenderer, { render: memoize$1((tools) => {
|
|
216846
216846
|
const output = empty$17();
|
|
216847
216847
|
for (const [name, tool] of Object.entries(tools.tools)) {
|
|
216848
216848
|
const paramName = resolveIdentifier(tool.parametersSchema.ast) ?? "options";
|
|
@@ -216855,7 +216855,7 @@ declare function ${name}(${params}): Promise<${render(tool.successSchema)}>`);
|
|
|
216855
216855
|
}) });
|
|
216856
216856
|
};
|
|
216857
216857
|
//#endregion
|
|
216858
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
216858
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/ScriptPreprocessing.js
|
|
216859
216859
|
const isIdentifierChar = (char) => char !== void 0 && /[A-Za-z0-9_$]/.test(char);
|
|
216860
216860
|
const isIdentifierStartChar = (char) => char !== void 0 && /[A-Za-z_$]/.test(char);
|
|
216861
216861
|
const hasIdentifierBoundary = (text, index, length) => !isIdentifierChar(text[index - 1]) && !isIdentifierChar(text[index + length]);
|
|
@@ -217040,6 +217040,80 @@ const findClosingParen = (text, openParen) => {
|
|
|
217040
217040
|
}
|
|
217041
217041
|
return -1;
|
|
217042
217042
|
};
|
|
217043
|
+
const findClosingBrace = (text, openBrace) => {
|
|
217044
|
+
let depth = 1;
|
|
217045
|
+
let stringDelimiter;
|
|
217046
|
+
for (let i = openBrace + 1; i < text.length; i++) {
|
|
217047
|
+
const char = text[i];
|
|
217048
|
+
if (stringDelimiter !== void 0) {
|
|
217049
|
+
if (char === stringDelimiter && !isEscaped(text, i)) stringDelimiter = void 0;
|
|
217050
|
+
continue;
|
|
217051
|
+
}
|
|
217052
|
+
if (char === "\"" || char === "'" || char === "`") {
|
|
217053
|
+
stringDelimiter = char;
|
|
217054
|
+
continue;
|
|
217055
|
+
}
|
|
217056
|
+
if (char === "{") {
|
|
217057
|
+
depth++;
|
|
217058
|
+
continue;
|
|
217059
|
+
}
|
|
217060
|
+
if (char === "}") {
|
|
217061
|
+
depth--;
|
|
217062
|
+
if (depth === 0) return i;
|
|
217063
|
+
}
|
|
217064
|
+
}
|
|
217065
|
+
return -1;
|
|
217066
|
+
};
|
|
217067
|
+
const fixObjectLiteralTemplateValues = (text) => text.replace(/\\{2,}(?=`|\$\{)/g, "\\");
|
|
217068
|
+
const fixAssignedObjectTemplateValues = (script, variableName) => {
|
|
217069
|
+
let out = script;
|
|
217070
|
+
let cursor = 0;
|
|
217071
|
+
while (cursor < out.length) {
|
|
217072
|
+
const variableStart = findNextIdentifier(out, variableName, cursor);
|
|
217073
|
+
if (variableStart === -1) break;
|
|
217074
|
+
let assignmentStart = skipWhitespace(out, variableStart + variableName.length);
|
|
217075
|
+
if (out[assignmentStart] === ":") {
|
|
217076
|
+
assignmentStart = findTypeAnnotationAssignment(out, assignmentStart + 1);
|
|
217077
|
+
if (assignmentStart === -1) {
|
|
217078
|
+
cursor = variableStart + variableName.length;
|
|
217079
|
+
continue;
|
|
217080
|
+
}
|
|
217081
|
+
}
|
|
217082
|
+
if (out[assignmentStart] !== "=" || out[assignmentStart + 1] === "=" || out[assignmentStart + 1] === ">") {
|
|
217083
|
+
cursor = variableStart + variableName.length;
|
|
217084
|
+
continue;
|
|
217085
|
+
}
|
|
217086
|
+
const objectStart = skipWhitespace(out, assignmentStart + 1);
|
|
217087
|
+
if (out[objectStart] !== "{") {
|
|
217088
|
+
cursor = objectStart + 1;
|
|
217089
|
+
continue;
|
|
217090
|
+
}
|
|
217091
|
+
const objectEnd = findClosingBrace(out, objectStart);
|
|
217092
|
+
if (objectEnd === -1) {
|
|
217093
|
+
cursor = objectStart + 1;
|
|
217094
|
+
continue;
|
|
217095
|
+
}
|
|
217096
|
+
const original = out.slice(objectStart, objectEnd + 1);
|
|
217097
|
+
const escaped = fixObjectLiteralTemplateValues(original);
|
|
217098
|
+
if (escaped !== original) {
|
|
217099
|
+
out = `${out.slice(0, objectStart)}${escaped}${out.slice(objectEnd + 1)}`;
|
|
217100
|
+
cursor = objectEnd + (escaped.length - original.length) + 1;
|
|
217101
|
+
continue;
|
|
217102
|
+
}
|
|
217103
|
+
cursor = objectEnd + 1;
|
|
217104
|
+
}
|
|
217105
|
+
return out;
|
|
217106
|
+
};
|
|
217107
|
+
const escapeRegExp = (text) => text.replace(/[.*+?^${}()|[\\]\\]/g, "\\$&");
|
|
217108
|
+
const collectObjectEntryMapSources = (script, valueIdentifier) => {
|
|
217109
|
+
const out = /* @__PURE__ */ new Set();
|
|
217110
|
+
const pattern = new RegExp(`Object\\.entries\\(\\s*([A-Za-z_$][A-Za-z0-9_$]*)\\s*\\)\\s*\\.map\\(\\s*(?:async\\s*)?\\(\\s*\\[\\s*[A-Za-z_$][A-Za-z0-9_$]*\\s*,\\s*${escapeRegExp(valueIdentifier)}\\s*\\]\\s*\\)\\s*=>`, "g");
|
|
217111
|
+
for (const match of script.matchAll(pattern)) {
|
|
217112
|
+
const sourceIdentifier = match[1];
|
|
217113
|
+
if (sourceIdentifier !== void 0) out.add(sourceIdentifier);
|
|
217114
|
+
}
|
|
217115
|
+
return out;
|
|
217116
|
+
};
|
|
217043
217117
|
const findCallTemplateEnd = (text, templateStart, openParen) => {
|
|
217044
217118
|
const closeParen = findClosingParen(text, openParen);
|
|
217045
217119
|
if (closeParen === -1) return -1;
|
|
@@ -217221,13 +217295,16 @@ const fixAssignedTemplatesForToolCalls = (script) => {
|
|
|
217221
217295
|
for (const functionName of ["applyPatch", "taskComplete"]) for (const identifier of collectCallArgumentIdentifiers(script, functionName)) identifiers.add(identifier);
|
|
217222
217296
|
for (const [functionName, propertyName] of callObjectPropertyTargets) for (const identifier of collectCallObjectPropertyIdentifiers(script, functionName, propertyName)) identifiers.add(identifier);
|
|
217223
217297
|
if (script.includes("*** Begin Patch")) identifiers.add("patch");
|
|
217298
|
+
const objectTemplateIdentifiers = /* @__PURE__ */ new Set();
|
|
217299
|
+
for (const identifier of identifiers) for (const sourceIdentifier of collectObjectEntryMapSources(script, identifier)) objectTemplateIdentifiers.add(sourceIdentifier);
|
|
217224
217300
|
let out = script;
|
|
217225
217301
|
for (const identifier of identifiers) out = fixAssignedTemplate(out, identifier);
|
|
217302
|
+
for (const identifier of objectTemplateIdentifiers) out = fixAssignedObjectTemplateValues(out, identifier);
|
|
217226
217303
|
return out;
|
|
217227
217304
|
};
|
|
217228
217305
|
const preprocessScript = (script) => fixAssignedTemplatesForToolCalls(["applyPatch", "taskComplete"].reduce((current, functionName) => fixCallTemplateArgument(current, functionName), fixTargetCallObjectPropertyTemplates(script)));
|
|
217229
217306
|
//#endregion
|
|
217230
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
217307
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/AgentExecutor.js
|
|
217231
217308
|
/**
|
|
217232
217309
|
* @since 1.0.0
|
|
217233
217310
|
*/
|
|
@@ -217412,7 +217489,7 @@ var QueueWriteStream = class extends Writable {
|
|
|
217412
217489
|
}
|
|
217413
217490
|
};
|
|
217414
217491
|
//#endregion
|
|
217415
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
217492
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/ScriptExtraction.js
|
|
217416
217493
|
const stripWrappingCodeFence = (script) => {
|
|
217417
217494
|
const lines = script.split(/\r?\n/);
|
|
217418
217495
|
if (lines.length < 2) return script;
|
|
@@ -218961,7 +219038,7 @@ const applySpanTransformer = (transformer, response, options) => {
|
|
|
218961
219038
|
});
|
|
218962
219039
|
};
|
|
218963
219040
|
//#endregion
|
|
218964
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
219041
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/Agent.js
|
|
218965
219042
|
/**
|
|
218966
219043
|
* @since 1.0.0
|
|
218967
219044
|
*/
|
|
@@ -230345,7 +230422,7 @@ const transformToolCallParams = /* @__PURE__ */ fnUntraced(function* (tools, too
|
|
|
230345
230422
|
})));
|
|
230346
230423
|
});
|
|
230347
230424
|
//#endregion
|
|
230348
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
230425
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/CodexAuth.js
|
|
230349
230426
|
/**
|
|
230350
230427
|
* @since 1.0.0
|
|
230351
230428
|
*/
|
|
@@ -230565,7 +230642,7 @@ var CodexAuth = class CodexAuth extends Service$1()("clanka/CodexAuth") {
|
|
|
230565
230642
|
static layerClient = this.layerClientNoDeps.pipe(provide$3(CodexAuth.layer));
|
|
230566
230643
|
};
|
|
230567
230644
|
//#endregion
|
|
230568
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
230645
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/Codex.js
|
|
230569
230646
|
/**
|
|
230570
230647
|
* @since 1.0.0
|
|
230571
230648
|
*/
|
|
@@ -231877,7 +231954,7 @@ const getUsageDetailNumber = (details, field) => {
|
|
|
231877
231954
|
return typeof value === "number" ? value : void 0;
|
|
231878
231955
|
};
|
|
231879
231956
|
//#endregion
|
|
231880
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
231957
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/CopilotAuth.js
|
|
231881
231958
|
/**
|
|
231882
231959
|
* @since 1.0.0
|
|
231883
231960
|
*/
|
|
@@ -232068,7 +232145,7 @@ var GithubCopilotAuth = class GithubCopilotAuth extends Service$1()("clanka/Gith
|
|
|
232068
232145
|
static layerClient = this.layerClientNoDeps.pipe(provide$3(GithubCopilotAuth.layer));
|
|
232069
232146
|
};
|
|
232070
232147
|
//#endregion
|
|
232071
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
232148
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/Copilot.js
|
|
232072
232149
|
/**
|
|
232073
232150
|
* @since 1.0.0
|
|
232074
232151
|
*/
|
|
@@ -232488,7 +232565,7 @@ Object.defineProperties(createChalk.prototype, styles);
|
|
|
232488
232565
|
const chalk = createChalk();
|
|
232489
232566
|
createChalk({ level: stderrColor ? stderrColor.level : 0 });
|
|
232490
232567
|
//#endregion
|
|
232491
|
-
//#region node_modules/.pnpm/clanka@0.2.
|
|
232568
|
+
//#region node_modules/.pnpm/clanka@0.2.21_@effect+ai-openai-compat@4.0.0-beta.36_effect@4.0.0-beta.36__@effect+ai-o_09288369fd42a7055df614a5b619d2f6/node_modules/clanka/dist/OutputFormatter.js
|
|
232492
232569
|
/**
|
|
232493
232570
|
* @since 1.0.0
|
|
232494
232571
|
*/
|
|
@@ -232821,19 +232898,34 @@ const LinearIssueSource = effect$1(IssueSource, gen(function* () {
|
|
|
232821
232898
|
const presets = yield* getPresetsWithMetadata("linear", PresetMetadata$1);
|
|
232822
232899
|
const identifierMap = /* @__PURE__ */ new Map();
|
|
232823
232900
|
const presetMap = /* @__PURE__ */ new Map();
|
|
232824
|
-
const
|
|
232825
|
-
|
|
232826
|
-
|
|
232827
|
-
|
|
232828
|
-
|
|
232829
|
-
|
|
232830
|
-
|
|
232901
|
+
const findState = (teamId, type, names = [], fallbackType = type) => {
|
|
232902
|
+
const filtered = state.states.filter((s) => {
|
|
232903
|
+
if (names.length === 0) return s.type === type;
|
|
232904
|
+
const name = s.name.toLowerCase();
|
|
232905
|
+
return s.type === type && names.some((n) => name.includes(n));
|
|
232906
|
+
});
|
|
232907
|
+
const withTeamId = filtered.filter((s) => s.teamId === teamId);
|
|
232908
|
+
if (withTeamId.length > 0) return withTeamId[0];
|
|
232909
|
+
const withoutTeamId = filtered.filter((s) => s.teamId === void 0);
|
|
232910
|
+
if (withoutTeamId.length > 0) return withoutTeamId[0];
|
|
232911
|
+
return state.states.find((s) => s.type === fallbackType);
|
|
232912
|
+
};
|
|
232913
|
+
const statesForTeamId = memoize((teamId) => ({
|
|
232914
|
+
backlog: findState(teamId, "backlog", ["backlog"]),
|
|
232915
|
+
todo: findState(teamId, "unstarted", ["todo", "unstarted"]),
|
|
232916
|
+
inProgress: findState(teamId, "started", ["progress", "started"]),
|
|
232917
|
+
inReview: findState(teamId, "started", ["review"], "completed"),
|
|
232918
|
+
done: findState(teamId, "completed"),
|
|
232919
|
+
canceled: findState(teamId, "canceled")
|
|
232920
|
+
}));
|
|
232921
|
+
const linearStateToPrdState = (state, teamId) => {
|
|
232922
|
+
const states = statesForTeamId(teamId);
|
|
232831
232923
|
switch (state.id) {
|
|
232832
|
-
case
|
|
232833
|
-
case
|
|
232834
|
-
case
|
|
232835
|
-
case
|
|
232836
|
-
case
|
|
232924
|
+
case states.backlog.id: return "backlog";
|
|
232925
|
+
case states.todo.id: return "todo";
|
|
232926
|
+
case states.inProgress.id: return "in-progress";
|
|
232927
|
+
case states.inReview.id: return "in-review";
|
|
232928
|
+
case states.done.id: return "done";
|
|
232837
232929
|
default:
|
|
232838
232930
|
if (state.type === "backlog") return "backlog";
|
|
232839
232931
|
if (state.type === "unstarted") return "todo";
|
|
@@ -232842,16 +232934,17 @@ const LinearIssueSource = effect$1(IssueSource, gen(function* () {
|
|
|
232842
232934
|
return "backlog";
|
|
232843
232935
|
}
|
|
232844
232936
|
};
|
|
232845
|
-
const prdStateToLinearStateId = (state) => {
|
|
232937
|
+
const prdStateToLinearStateId = (state, teamId) => {
|
|
232938
|
+
const states = statesForTeamId(teamId);
|
|
232846
232939
|
switch (state) {
|
|
232847
|
-
case "backlog": return
|
|
232848
|
-
case "todo": return
|
|
232849
|
-
case "in-progress": return
|
|
232850
|
-
case "in-review": return
|
|
232851
|
-
case "done": return
|
|
232940
|
+
case "backlog": return states.backlog.id;
|
|
232941
|
+
case "todo": return states.todo.id;
|
|
232942
|
+
case "in-progress": return states.inProgress.id;
|
|
232943
|
+
case "in-review": return states.inReview.id;
|
|
232944
|
+
case "done": return states.done.id;
|
|
232852
232945
|
}
|
|
232853
232946
|
};
|
|
232854
|
-
const issues = ({ labelId, projectId, autoMergeLabelId }) => linear.issues({
|
|
232947
|
+
const issues = ({ labelId, projectId, teamId, autoMergeLabelId }) => linear.issues({
|
|
232855
232948
|
labelId,
|
|
232856
232949
|
projectId
|
|
232857
232950
|
}).pipe(mapError$2((cause) => new IssueSourceError({ cause })), map$9((issues) => {
|
|
@@ -232869,7 +232962,7 @@ const LinearIssueSource = effect$1(IssueSource, gen(function* () {
|
|
|
232869
232962
|
description: issue.description ?? "",
|
|
232870
232963
|
priority: issue.priority,
|
|
232871
232964
|
estimate: issue.estimate ?? null,
|
|
232872
|
-
state: linearStateToPrdState(issue.state),
|
|
232965
|
+
state: linearStateToPrdState(issue.state, teamId),
|
|
232873
232966
|
blockedBy: issue.blockedBy.map((r) => r.issue.identifier),
|
|
232874
232967
|
autoMerge: autoMergeLabelId.pipe(map$16((labelId) => issue.labelIds.includes(labelId)), getOrElse$2(() => false))
|
|
232875
232968
|
})));
|
|
@@ -232879,6 +232972,7 @@ const LinearIssueSource = effect$1(IssueSource, gen(function* () {
|
|
|
232879
232972
|
const settings = yield* get$7(projectSettings, projectId);
|
|
232880
232973
|
return yield* issues({
|
|
232881
232974
|
projectId: settings.project.id,
|
|
232975
|
+
teamId: settings.teamId,
|
|
232882
232976
|
labelId: settings.labelId,
|
|
232883
232977
|
autoMergeLabelId: settings.autoMergeLabelId
|
|
232884
232978
|
});
|
|
@@ -232888,6 +232982,7 @@ const LinearIssueSource = effect$1(IssueSource, gen(function* () {
|
|
|
232888
232982
|
return (yield* issues({
|
|
232889
232983
|
projectId: settings.project.id,
|
|
232890
232984
|
labelId: settings.labelId,
|
|
232985
|
+
teamId: settings.teamId,
|
|
232891
232986
|
autoMergeLabelId: settings.autoMergeLabelId
|
|
232892
232987
|
})).find((issue) => issue.id === issueId) ?? null;
|
|
232893
232988
|
}),
|
|
@@ -232902,7 +232997,7 @@ const LinearIssueSource = effect$1(IssueSource, gen(function* () {
|
|
|
232902
232997
|
description: issue.description,
|
|
232903
232998
|
priority: issue.priority,
|
|
232904
232999
|
estimate: issue.estimate,
|
|
232905
|
-
stateId: prdStateToLinearStateId(issue.state)
|
|
233000
|
+
stateId: prdStateToLinearStateId(issue.state, teamId)
|
|
232906
233001
|
}));
|
|
232907
233002
|
const linearIssue = yield* linear.use(() => created.issue);
|
|
232908
233003
|
identifierMap.set(linearIssue.identifier, linearIssue.id);
|
|
@@ -232925,13 +233020,13 @@ const LinearIssueSource = effect$1(IssueSource, gen(function* () {
|
|
|
232925
233020
|
};
|
|
232926
233021
|
}, mapError$2((cause) => new IssueSourceError({ cause }))),
|
|
232927
233022
|
updateIssue: fnUntraced(function* (options) {
|
|
232928
|
-
const { autoMergeLabelId } = yield* get$7(projectSettings, options.projectId);
|
|
233023
|
+
const { autoMergeLabelId, teamId } = yield* get$7(projectSettings, options.projectId);
|
|
232929
233024
|
const issueId = identifierMap.get(options.issueId);
|
|
232930
233025
|
const linearIssue = yield* linear.issueById(issueId);
|
|
232931
233026
|
const update = { labelIds: linearIssue.labelIds.slice() };
|
|
232932
233027
|
if (options.title) update.title = options.title;
|
|
232933
233028
|
if (options.description) update.description = options.description;
|
|
232934
|
-
if (options.state) update.stateId = prdStateToLinearStateId(options.state);
|
|
233029
|
+
if (options.state) update.stateId = prdStateToLinearStateId(options.state, teamId);
|
|
232935
233030
|
if (options.autoMerge !== void 0 && isSome(autoMergeLabelId)) {
|
|
232936
233031
|
const hasLabel = update.labelIds.includes(autoMergeLabelId.value);
|
|
232937
233032
|
if (options.autoMerge && !hasLabel) update.labelIds.push(autoMergeLabelId.value);
|
|
@@ -232954,9 +233049,11 @@ const LinearIssueSource = effect$1(IssueSource, gen(function* () {
|
|
|
232954
233049
|
})).pipe(ignore$1), { concurrency: 5 });
|
|
232955
233050
|
yield* forEach$4(toRemove, (relation) => linear.use((c) => c.deleteIssueRelation(relation.id)).pipe(ignore$1), { concurrency: 5 });
|
|
232956
233051
|
}, mapError$2((cause) => new IssueSourceError({ cause }))),
|
|
232957
|
-
cancelIssue: fnUntraced(function* (
|
|
233052
|
+
cancelIssue: fnUntraced(function* (projectId, issueId) {
|
|
233053
|
+
const { teamId } = yield* get$7(projectSettings, projectId);
|
|
233054
|
+
const states = statesForTeamId(teamId);
|
|
232958
233055
|
const linearIssueId = identifierMap.get(issueId);
|
|
232959
|
-
yield* linear.use((c) => c.updateIssue(linearIssueId, { stateId:
|
|
233056
|
+
yield* linear.use((c) => c.updateIssue(linearIssueId, { stateId: states.canceled.id }));
|
|
232960
233057
|
}, mapError$2((cause) => new IssueSourceError({ cause }))),
|
|
232961
233058
|
reset: gen(function* () {
|
|
232962
233059
|
const projectId = yield* CurrentProjectId;
|
|
@@ -233220,11 +233317,22 @@ var LinearState = class extends Class$1()("lalph/LinearState", {
|
|
|
233220
233317
|
states: Array$1(Struct$2({
|
|
233221
233318
|
id: String$1,
|
|
233222
233319
|
name: String$1,
|
|
233223
|
-
type: String$1
|
|
233320
|
+
type: String$1,
|
|
233321
|
+
teamId: optional$3(String$1)
|
|
233224
233322
|
})),
|
|
233225
233323
|
viewer: Struct$2({ id: String$1 })
|
|
233226
233324
|
})
|
|
233227
233325
|
}) {};
|
|
233326
|
+
const memoize = (f) => {
|
|
233327
|
+
const cache = /* @__PURE__ */ new Map();
|
|
233328
|
+
return (a) => {
|
|
233329
|
+
const cached = cache.get(a);
|
|
233330
|
+
if (cached) return cached;
|
|
233331
|
+
const b = f(a);
|
|
233332
|
+
cache.set(a, b);
|
|
233333
|
+
return b;
|
|
233334
|
+
};
|
|
233335
|
+
};
|
|
233228
233336
|
//#endregion
|
|
233229
233337
|
//#region node_modules/.pnpm/universal-user-agent@7.0.3/node_modules/universal-user-agent/index.js
|
|
233230
233338
|
function getUserAgent() {
|
|
@@ -242183,7 +242291,7 @@ const commandEdit = make$58("edit").pipe(withDescription("Open the selected proj
|
|
|
242183
242291
|
const commandSource = make$58("source").pipe(withDescription("Select the issue source to use (e.g. GitHub Issues or Linear). This applies to all projects."), withHandler(() => selectIssueSource), provide(Settings.layer));
|
|
242184
242292
|
//#endregion
|
|
242185
242293
|
//#region package.json
|
|
242186
|
-
var version = "0.3.
|
|
242294
|
+
var version = "0.3.94";
|
|
242187
242295
|
//#endregion
|
|
242188
242296
|
//#region src/commands/projects/ls.ts
|
|
242189
242297
|
const commandProjectsLs = make$58("ls").pipe(withDescription("List configured projects and how they run (enabled state, concurrency, branch, git flow, review agent)."), withHandler(fnUntraced(function* () {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lalph",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.94",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -39,13 +39,13 @@
|
|
|
39
39
|
"@changesets/cli": "^2.30.0",
|
|
40
40
|
"@effect/ai-openai": "4.0.0-beta.36",
|
|
41
41
|
"@effect/ai-openai-compat": "4.0.0-beta.36",
|
|
42
|
-
"@effect/language-service": "^0.
|
|
42
|
+
"@effect/language-service": "^0.81.0",
|
|
43
43
|
"@effect/platform-node": "4.0.0-beta.36",
|
|
44
44
|
"@linear/sdk": "^78.0.0",
|
|
45
45
|
"@octokit/plugin-rest-endpoint-methods": "^17.0.0",
|
|
46
46
|
"@octokit/types": "^16.0.0",
|
|
47
|
-
"@typescript/native-preview": "7.0.0-dev.
|
|
48
|
-
"clanka": "^0.2.
|
|
47
|
+
"@typescript/native-preview": "7.0.0-dev.20260320.1",
|
|
48
|
+
"clanka": "^0.2.21",
|
|
49
49
|
"concurrently": "^9.2.1",
|
|
50
50
|
"effect": "4.0.0-beta.36",
|
|
51
51
|
"husky": "^9.1.7",
|
package/src/Linear.ts
CHANGED
|
@@ -208,45 +208,48 @@ export const LinearIssueSource = Layer.effect(
|
|
|
208
208
|
const identifierMap = new Map<string, string>()
|
|
209
209
|
const presetMap = new Map<string, CliAgentPreset>()
|
|
210
210
|
|
|
211
|
-
const
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
)
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
const
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
211
|
+
const findState = (
|
|
212
|
+
teamId: string,
|
|
213
|
+
type: string,
|
|
214
|
+
names: Array<string> = [],
|
|
215
|
+
fallbackType = type,
|
|
216
|
+
) => {
|
|
217
|
+
const filtered = state.states.filter((s) => {
|
|
218
|
+
if (names.length === 0) return s.type === type
|
|
219
|
+
const name = s.name.toLowerCase()
|
|
220
|
+
return s.type === type && names.some((n) => name.includes(n))
|
|
221
|
+
})
|
|
222
|
+
const withTeamId = filtered.filter((s) => s.teamId === teamId)
|
|
223
|
+
if (withTeamId.length > 0) return withTeamId[0]!
|
|
224
|
+
const withoutTeamId = filtered.filter((s) => s.teamId === undefined)
|
|
225
|
+
if (withoutTeamId.length > 0) return withoutTeamId[0]!
|
|
226
|
+
return state.states.find((s) => s.type === fallbackType)!
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
const statesForTeamId = memoize((teamId: string) => ({
|
|
230
|
+
backlog: findState(teamId, "backlog", ["backlog"]),
|
|
231
|
+
todo: findState(teamId, "unstarted", ["todo", "unstarted"]),
|
|
232
|
+
inProgress: findState(teamId, "started", ["progress", "started"]),
|
|
233
|
+
inReview: findState(teamId, "started", ["review"], "completed"),
|
|
234
|
+
done: findState(teamId, "completed"),
|
|
235
|
+
canceled: findState(teamId, "canceled"),
|
|
236
|
+
}))
|
|
237
|
+
|
|
238
|
+
const linearStateToPrdState = (
|
|
239
|
+
state: State,
|
|
240
|
+
teamId: string,
|
|
241
|
+
): PrdIssue["state"] => {
|
|
242
|
+
const states = statesForTeamId(teamId)
|
|
240
243
|
switch (state.id) {
|
|
241
|
-
case
|
|
244
|
+
case states.backlog.id:
|
|
242
245
|
return "backlog"
|
|
243
|
-
case
|
|
246
|
+
case states.todo.id:
|
|
244
247
|
return "todo"
|
|
245
|
-
case
|
|
248
|
+
case states.inProgress.id:
|
|
246
249
|
return "in-progress"
|
|
247
|
-
case
|
|
250
|
+
case states.inReview.id:
|
|
248
251
|
return "in-review"
|
|
249
|
-
case
|
|
252
|
+
case states.done.id:
|
|
250
253
|
return "done"
|
|
251
254
|
default:
|
|
252
255
|
if (state.type === "backlog") return "backlog"
|
|
@@ -256,28 +259,34 @@ export const LinearIssueSource = Layer.effect(
|
|
|
256
259
|
return "backlog"
|
|
257
260
|
}
|
|
258
261
|
}
|
|
259
|
-
const prdStateToLinearStateId = (
|
|
262
|
+
const prdStateToLinearStateId = (
|
|
263
|
+
state: PrdIssue["state"],
|
|
264
|
+
teamId: string,
|
|
265
|
+
): string => {
|
|
266
|
+
const states = statesForTeamId(teamId)
|
|
260
267
|
switch (state) {
|
|
261
268
|
case "backlog":
|
|
262
|
-
return
|
|
269
|
+
return states.backlog.id
|
|
263
270
|
case "todo":
|
|
264
|
-
return
|
|
271
|
+
return states.todo.id
|
|
265
272
|
case "in-progress":
|
|
266
|
-
return
|
|
273
|
+
return states.inProgress.id
|
|
267
274
|
case "in-review":
|
|
268
|
-
return
|
|
275
|
+
return states.inReview.id
|
|
269
276
|
case "done":
|
|
270
|
-
return
|
|
277
|
+
return states.done.id
|
|
271
278
|
}
|
|
272
279
|
}
|
|
273
280
|
|
|
274
281
|
const issues = ({
|
|
275
282
|
labelId,
|
|
276
283
|
projectId,
|
|
284
|
+
teamId,
|
|
277
285
|
autoMergeLabelId,
|
|
278
286
|
}: {
|
|
279
287
|
readonly labelId: Option.Option<string>
|
|
280
288
|
readonly projectId: string
|
|
289
|
+
readonly teamId: string
|
|
281
290
|
readonly autoMergeLabelId: Option.Option<string>
|
|
282
291
|
}) =>
|
|
283
292
|
linear.issues({ labelId, projectId }).pipe(
|
|
@@ -308,7 +317,7 @@ export const LinearIssueSource = Layer.effect(
|
|
|
308
317
|
description: issue.description ?? "",
|
|
309
318
|
priority: issue.priority,
|
|
310
319
|
estimate: issue.estimate ?? null,
|
|
311
|
-
state: linearStateToPrdState(issue.state),
|
|
320
|
+
state: linearStateToPrdState(issue.state, teamId),
|
|
312
321
|
blockedBy: issue.blockedBy.map((r) => r.issue.identifier),
|
|
313
322
|
autoMerge: autoMergeLabelId.pipe(
|
|
314
323
|
Option.map((labelId) => issue.labelIds.includes(labelId)),
|
|
@@ -325,6 +334,7 @@ export const LinearIssueSource = Layer.effect(
|
|
|
325
334
|
const settings = yield* Cache.get(projectSettings, projectId)
|
|
326
335
|
return yield* issues({
|
|
327
336
|
projectId: settings.project.id,
|
|
337
|
+
teamId: settings.teamId,
|
|
328
338
|
labelId: settings.labelId,
|
|
329
339
|
autoMergeLabelId: settings.autoMergeLabelId,
|
|
330
340
|
})
|
|
@@ -334,6 +344,7 @@ export const LinearIssueSource = Layer.effect(
|
|
|
334
344
|
const projectIssues = yield* issues({
|
|
335
345
|
projectId: settings.project.id,
|
|
336
346
|
labelId: settings.labelId,
|
|
347
|
+
teamId: settings.teamId,
|
|
337
348
|
autoMergeLabelId: settings.autoMergeLabelId,
|
|
338
349
|
})
|
|
339
350
|
return projectIssues.find((issue) => issue.id === issueId) ?? null
|
|
@@ -355,7 +366,7 @@ export const LinearIssueSource = Layer.effect(
|
|
|
355
366
|
description: issue.description,
|
|
356
367
|
priority: issue.priority,
|
|
357
368
|
estimate: issue.estimate,
|
|
358
|
-
stateId: prdStateToLinearStateId(issue.state),
|
|
369
|
+
stateId: prdStateToLinearStateId(issue.state, teamId),
|
|
359
370
|
}),
|
|
360
371
|
)
|
|
361
372
|
const linearIssue = yield* linear.use(() => created.issue!)
|
|
@@ -391,7 +402,7 @@ export const LinearIssueSource = Layer.effect(
|
|
|
391
402
|
),
|
|
392
403
|
updateIssue: Effect.fnUntraced(
|
|
393
404
|
function* (options) {
|
|
394
|
-
const { autoMergeLabelId } = yield* Cache.get(
|
|
405
|
+
const { autoMergeLabelId, teamId } = yield* Cache.get(
|
|
395
406
|
projectSettings,
|
|
396
407
|
options.projectId,
|
|
397
408
|
)
|
|
@@ -412,7 +423,7 @@ export const LinearIssueSource = Layer.effect(
|
|
|
412
423
|
update.description = options.description
|
|
413
424
|
}
|
|
414
425
|
if (options.state) {
|
|
415
|
-
update.stateId = prdStateToLinearStateId(options.state)
|
|
426
|
+
update.stateId = prdStateToLinearStateId(options.state, teamId)
|
|
416
427
|
}
|
|
417
428
|
if (
|
|
418
429
|
options.autoMerge !== undefined &&
|
|
@@ -475,11 +486,13 @@ export const LinearIssueSource = Layer.effect(
|
|
|
475
486
|
Effect.mapError((cause) => new IssueSourceError({ cause })),
|
|
476
487
|
),
|
|
477
488
|
cancelIssue: Effect.fnUntraced(
|
|
478
|
-
function* (
|
|
489
|
+
function* (projectId, issueId) {
|
|
490
|
+
const { teamId } = yield* Cache.get(projectSettings, projectId)
|
|
491
|
+
const states = statesForTeamId(teamId)
|
|
479
492
|
const linearIssueId = identifierMap.get(issueId)!
|
|
480
493
|
yield* linear.use((c) =>
|
|
481
494
|
c.updateIssue(linearIssueId, {
|
|
482
|
-
stateId:
|
|
495
|
+
stateId: states.canceled.id,
|
|
483
496
|
}),
|
|
484
497
|
)
|
|
485
498
|
},
|
|
@@ -878,6 +891,7 @@ class LinearState extends Persistable.Class<{
|
|
|
878
891
|
id: Schema.String,
|
|
879
892
|
name: Schema.String,
|
|
880
893
|
type: Schema.String,
|
|
894
|
+
teamId: Schema.optional(Schema.String),
|
|
881
895
|
}),
|
|
882
896
|
),
|
|
883
897
|
viewer: Schema.Struct({
|
|
@@ -885,3 +899,14 @@ class LinearState extends Persistable.Class<{
|
|
|
885
899
|
}),
|
|
886
900
|
}),
|
|
887
901
|
}) {}
|
|
902
|
+
|
|
903
|
+
const memoize = <A, B>(f: (a: A) => B): ((a: A) => B) => {
|
|
904
|
+
const cache = new Map<A, B>()
|
|
905
|
+
return (a: A) => {
|
|
906
|
+
const cached = cache.get(a)
|
|
907
|
+
if (cached) return cached
|
|
908
|
+
const b = f(a)
|
|
909
|
+
cache.set(a, b)
|
|
910
|
+
return b
|
|
911
|
+
}
|
|
912
|
+
}
|