continue-custom/core/config/markdown/utils.ts
Nate Sesti 268329a944
feat(cli): enhance /init command to create custom slash command (#7888)
* feat(cli): enhance /init command to create custom slash command

Update the /init slash command prompt to also create a custom "review"
slash command file at .continue/rules/review.md with invokable frontmatter
and review-focused instructions.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>

* fix: address feedback

---------

Co-authored-by: Claude <noreply@anthropic.com>
2025-09-25 11:39:57 -07:00

27 lines
752 B
TypeScript

import {
RULE_FILE_EXTENSION,
sanitizeRuleName,
} from "@continuedev/config-yaml";
import { joinPathsToUri } from "../../util/uri";
function createRelativeRuleFilePathParts(ruleName: string): string[] {
const safeRuleName = sanitizeRuleName(ruleName);
return [".continue", "rules", `${safeRuleName}.${RULE_FILE_EXTENSION}`];
}
export function createRelativeRuleFilePath(ruleName: string): string {
return createRelativeRuleFilePathParts(ruleName).join("/");
}
/**
* Creates the file path for a rule in the workspace .continue/rules directory
*/
export function createRuleFilePath(
workspaceDir: string,
ruleName: string,
): string {
return joinPathsToUri(
workspaceDir,
...createRelativeRuleFilePathParts(ruleName),
);
}