MCPcopy
hub / github.com/callumalpass/tasknotes / extractContexts

Method extractContexts

src/utils/TasksPluginParser.ts:670–701  ·  view source on GitHub ↗
(content: string)

Source from the content-addressed store, hash-verified

668 }
669
670 private static extractContexts(content: string): string[] {
671 if (typeof content !== "string") {
672 return [];
673 }
674
675 try {
676 const freshPattern = new RegExp(
677 this.CONTEXT_PATTERN.source,
678 this.CONTEXT_PATTERN.flags
679 );
680 const contexts: string[] = [];
681 let match;
682
683 while ((match = freshPattern.exec(content)) !== null) {
684 if (match[0]) {
685 const context = match[0].substring(1);
686 if (context && !contexts.includes(context)) {
687 contexts.push(context);
688 }
689 }
690 }
691
692 return contexts;
693 } catch (error) {
694 tasknotesLogger.debug("Error extracting contexts:", {
695 category: "validation",
696 operation: "extracting-contexts",
697 error: error,
698 });
699 return [];
700 }
701 }
702
703 private static extractCleanTitle(content: string): string {
704 if (typeof content !== "string") {

Callers 1

parseTaskContentMethod · 0.95

Calls 1

debugMethod · 0.80

Tested by

no test coverage detected