mirror of
https://github.com/alkimake/paperclip.git
synced 2026-06-15 02:20:38 +09:00
Address remaining Greptile portability feedback
This commit is contained in:
parent
581a654748
commit
79652da520
5 changed files with 131 additions and 9 deletions
|
|
@ -351,10 +351,12 @@ function isSensitiveEnvKey(key: string) {
|
|||
normalized === "token" ||
|
||||
normalized.endsWith("_token") ||
|
||||
normalized.endsWith("-token") ||
|
||||
normalized.includes("apikey") ||
|
||||
normalized.includes("api_key") ||
|
||||
normalized.includes("api-key") ||
|
||||
normalized.includes("access_token") ||
|
||||
normalized.includes("access-token") ||
|
||||
normalized.includes("auth") ||
|
||||
normalized.includes("auth_token") ||
|
||||
normalized.includes("auth-token") ||
|
||||
normalized.includes("authorization") ||
|
||||
|
|
@ -364,6 +366,7 @@ function isSensitiveEnvKey(key: string) {
|
|||
normalized.includes("password") ||
|
||||
normalized.includes("credential") ||
|
||||
normalized.includes("jwt") ||
|
||||
normalized.includes("privatekey") ||
|
||||
normalized.includes("private_key") ||
|
||||
normalized.includes("private-key") ||
|
||||
normalized.includes("cookie") ||
|
||||
|
|
|
|||
|
|
@ -377,6 +377,28 @@ function parseYamlBlock(
|
|||
index = nested.nextIndex;
|
||||
continue;
|
||||
}
|
||||
const inlineObjectSeparator = remainder.indexOf(":");
|
||||
if (
|
||||
inlineObjectSeparator > 0 &&
|
||||
!remainder.startsWith("\"") &&
|
||||
!remainder.startsWith("{") &&
|
||||
!remainder.startsWith("[")
|
||||
) {
|
||||
const key = remainder.slice(0, inlineObjectSeparator).trim();
|
||||
const rawValue = remainder.slice(inlineObjectSeparator + 1).trim();
|
||||
const nextObject: Record<string, unknown> = {
|
||||
[key]: parseYamlScalar(rawValue),
|
||||
};
|
||||
if (index < lines.length && lines[index]!.indent > indentLevel) {
|
||||
const nested = parseYamlBlock(lines, index, indentLevel + 2);
|
||||
if (isPlainRecord(nested.value)) {
|
||||
Object.assign(nextObject, nested.value);
|
||||
}
|
||||
index = nested.nextIndex;
|
||||
}
|
||||
values.push(nextObject);
|
||||
continue;
|
||||
}
|
||||
values.push(parseYamlScalar(remainder));
|
||||
}
|
||||
return { value: values, nextIndex: index };
|
||||
|
|
@ -804,12 +826,11 @@ export async function readLocalSkillImportFromDirectory(
|
|||
const markdown = await fs.readFile(skillFilePath, "utf8");
|
||||
const parsed = parseFrontmatterMarkdown(markdown);
|
||||
const slug = deriveImportedSkillSlug(parsed.frontmatter, path.basename(resolvedSkillDir));
|
||||
const skillKey = readCanonicalSkillKey(
|
||||
parsed.frontmatter,
|
||||
isPlainRecord(parsed.frontmatter.metadata) ? parsed.frontmatter.metadata : null,
|
||||
);
|
||||
const parsedMetadata = isPlainRecord(parsed.frontmatter.metadata) ? parsed.frontmatter.metadata : null;
|
||||
const skillKey = readCanonicalSkillKey(parsed.frontmatter, parsedMetadata);
|
||||
const metadata = {
|
||||
...(skillKey ? { skillKey } : {}),
|
||||
...(parsedMetadata ?? {}),
|
||||
sourceKind: "local_path",
|
||||
...(options?.metadata ?? {}),
|
||||
};
|
||||
|
|
@ -877,12 +898,11 @@ async function readLocalSkillImports(companyId: string, sourcePath: string): Pro
|
|||
const markdown = await fs.readFile(resolvedPath, "utf8");
|
||||
const parsed = parseFrontmatterMarkdown(markdown);
|
||||
const slug = deriveImportedSkillSlug(parsed.frontmatter, path.basename(path.dirname(resolvedPath)));
|
||||
const skillKey = readCanonicalSkillKey(
|
||||
parsed.frontmatter,
|
||||
isPlainRecord(parsed.frontmatter.metadata) ? parsed.frontmatter.metadata : null,
|
||||
);
|
||||
const parsedMetadata = isPlainRecord(parsed.frontmatter.metadata) ? parsed.frontmatter.metadata : null;
|
||||
const skillKey = readCanonicalSkillKey(parsed.frontmatter, parsedMetadata);
|
||||
const metadata = {
|
||||
...(skillKey ? { skillKey } : {}),
|
||||
...(parsedMetadata ?? {}),
|
||||
sourceKind: "local_path",
|
||||
};
|
||||
const inventory: CompanySkillFileInventoryEntry[] = [
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue